00001 00009 #ifndef __FUNS_H 00010 #define __FUNS_H 00011 00012 #include "jbltools/sfh/FillIterator.h" 00013 #include "jbltools/sfh/BaseCut.h" 00014 #include "jbltools/sfh/FloatFun.h" 00015 00016 #include <TClonesArray.h> 00017 #include "Marana/TTools.h" 00018 00020 class NSelJetsFun: public FloatFun { 00021 public: 00023 NSelJetsFun (TClonesArray* jet_, 00024 const std::string& name_ 00025 ) 00026 : FloatFun (name_), jet (jet_) 00027 {} 00028 virtual float operator() () const { 00029 return (jet < 0) ? 0 : float(jet->GetEntries()); 00030 } 00031 protected: 00032 // Data members 00033 TClonesArray* jet; 00035 virtual ~NSelJetsFun() {} 00036 }; 00037 00039 class PtSelJet1Fun: public FloatFun { 00040 public: 00042 PtSelJet1Fun (TClonesArray* jet_, 00043 const std::string& name_ 00044 ) 00045 : FloatFun (name_), jet (jet_) 00046 {} 00047 virtual float operator() () const { 00048 float result = 0; 00049 if (jet) { 00050 for (int i = 0; i < jet->GetEntries(); i++) { 00051 TMarBody *Jet = (TMarBody*) jet->At(i); 00052 if (Jet->GetPt() > result) result = Jet->GetPt(); 00053 } 00054 } 00055 return result; 00056 } 00057 protected: 00058 // Data members 00059 TClonesArray* jet; 00061 virtual ~PtSelJet1Fun() {} 00062 }; 00063 00065 class ThSelJet1Fun: public FloatFun { 00066 public: 00068 ThSelJet1Fun (TClonesArray* jet_, 00069 const std::string& name_ 00070 ) 00071 : FloatFun (name_), jet (jet_) 00072 {} 00073 virtual float operator() () const { 00074 float result = 0; 00075 if (jet) { 00076 float pt = 0; 00077 for (int i = 0; i < jet->GetEntries(); i++) { 00078 TMarBody *Jet = (TMarBody*) jet->At(i); 00079 if (Jet->GetPt() > pt) { 00080 pt = Jet->GetPt(); 00081 result = Jet->GetTheta(); 00082 } 00083 } 00084 } 00085 return result; 00086 } 00087 protected: 00088 // Data members 00089 TClonesArray* jet; 00091 virtual ~ThSelJet1Fun() {} 00092 }; 00093 00095 class TimimgCut: public BaseCut { 00096 public: 00098 TimimgCut (TTools* tools_, 00099 const std::string& name_ 00100 ) 00101 : BaseCut (name_), tools (tools_) 00102 {} 00103 virtual bool operator() () const { 00104 return (tools) ? tools->Is2004CalibratedTimingOK() : false; 00105 } 00106 protected: 00107 // Data members 00108 TTools* tools; 00110 virtual ~TimimgCut() {} 00111 }; 00112 00113 00114 #endif /* #ifndef __FUNS_H */