CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQMOffline/Trigger/interface/EgHLTOffPho.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_EGHLTOFFPHO
00002 #define DQMOFFLINE_TRIGGER_EGHLTOFFPHO
00003 
00004 //class: EgHLTOffPho
00005 //
00006 //author: Sam Harper (July 2008)
00007 //
00008 //
00009 //aim: to allow easy access to phoctron ID variables
00010 //     currently the CMSSW photon classes are a mess with key photon variables not being accessable from Photon
00011 //     this a stop gap to produce a simple photon class with all variables easily accessable via methods 
00012 //     note as this is meant for HLT Offline DQM, I do not want the overhead of converting to pat
00013 //
00014 //implimentation: aims to be a wrapper for Photon methods, it is hoped that in time these methods will be directly added to Photon and so
00015 //                make this class obsolute
00016 //                unfortunately can not be a pure wrapper as needs to store isol and cluster shape
00017 //
00018 
00019 
00020 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00021 #include "DataFormats/EgammaCandidates/interface/Photon.h" 
00022 
00023 #include "DQMOffline/Trigger/interface/EgHLTEgCutCodes.h"
00024 #include "DQMOffline/Trigger/interface/EgHLTTrigCodes.h"
00025 
00026 namespace egHLT {
00027   class OffPho { 
00028     
00029   public:
00030     //helper struct to store the isolations
00031     struct IsolData {
00032       int nrTrks;
00033       float ptTrks;
00034       float em;
00035       float had;
00036       float hltHad;
00037       float hltTrks;
00038       float hltEm;
00039     };
00040     
00041   public:
00042     //helper struct to store the cluster shapes
00043     struct ClusShapeData {
00044       float sigmaEtaEta;
00045       float sigmaIEtaIEta;
00046       float e2x5MaxOver5x5; 
00047       float e1x5Over5x5;
00048       float sigmaPhiPhi;
00049       float sigmaIPhiIPhi;
00050       float r9;
00051     };
00052     
00053     
00054   private:
00055     const reco::Photon* pho_; //pointers to the underlying phoctron (we do not own this)
00056 
00057     ClusShapeData clusShapeData_;
00058     IsolData isolData_;
00059     
00060     //these are bit-packed words telling me which cuts the photon fail (ie 0x0 is passed all cuts) 
00061     int cutCode_;
00062     int looseCutCode_;
00063   
00064     //the idea is that these are user definable cuts mean to be idenital to the specified trigger
00065     //it is probably clear to the reader that I havent decided on the most efficient way to do this
00066     std::vector<std::pair<TrigCodes::TrigBitSet,int> > trigCutsCutCodes_; //unsorted vector (may sort if have performance issues)
00067     
00068     //and these are the trigger bits stored
00069     //note that the trigger bits are defined at the begining of each job
00070     //and do not necessaryly map between jobs
00071     TrigCodes::TrigBitSet trigBits_;
00072     
00073   public:
00074     
00075     OffPho(const reco::Photon& pho,const ClusShapeData& shapeData,const IsolData& isolData):
00076       pho_(&pho),clusShapeData_(shapeData),isolData_(isolData),
00077       cutCode_(int(EgCutCodes::INVALID)),looseCutCode_(int(EgCutCodes::INVALID)){}
00078     ~OffPho(){}
00079     
00080     //modifiers  
00081     void setCutCode(int code){cutCode_=code;}
00082     void setLooseCutCode(int code){looseCutCode_=code;} 
00083     
00084     //slightly inefficient way, think I can afford it and its a lot easier to just make the sorted vector outside the class
00085     void setTrigCutsCutCodes(const std::vector<std::pair<TrigCodes::TrigBitSet,int> > trigCutsCutCodes){trigCutsCutCodes_=trigCutsCutCodes;}
00086     void setTrigBits(TrigCodes::TrigBitSet bits){trigBits_=bits;}
00087     
00088     const reco::Photon* recoPho()const{return pho_;}
00089 
00090     //kinematic and geometric methods
00091     float et()const{return pho_->et();}  
00092     float pt()const{return pho_->pt();}
00093     float energy()const{return pho_->energy();}
00094     float eta()const{return pho_->eta();}
00095     float phi()const{return pho_->phi();}
00096     float etSC()const{return pho_->superCluster()->position().rho()/pho_->superCluster()->position().r()*energy();}
00097     float etaSC()const{return pho_->superCluster()->eta();}
00098     float detEta()const{return etaSC();}
00099     float phiSC()const{return pho_->superCluster()->phi();}
00100     float zVtx()const{return pho_->vz();}
00101     const math::XYZTLorentzVector& p4()const{return pho_->p4();}
00102     
00103     bool isGap()const{return pho_->isEBGap() || pho_->isEEGap() || pho_->isEBEEGap();}
00104     
00105     //abreviations of overly long Photon methods, I'm sorry but if you cant figure out what hOverE() means, you shouldnt be using this class
00106     float hOverE()const{return pho_->hadronicOverEm();}
00107     
00108     
00109     
00110     float sigmaEtaEta()const;
00111     float sigmaEtaEtaUnCorr()const{return clusShapeData_.sigmaEtaEta;}
00112     float sigmaIEtaIEta()const{return clusShapeData_.sigmaIEtaIEta;}                                    
00113     float sigmaPhiPhi()const{return clusShapeData_.sigmaPhiPhi;}
00114     float sigmaIPhiIPhi()const{return clusShapeData_.sigmaIPhiIPhi;}
00115     float e2x5MaxOver5x5()const{return clusShapeData_.e2x5MaxOver5x5;}
00116     float e1x5Over5x5()const{return clusShapeData_.e1x5Over5x5;}
00117     float r9()const{return clusShapeData_.r9;}
00118     
00119     //isolation
00120     float isolEm()const{return isolData_.em;}
00121     float isolHad()const{return isolData_.had;}
00122     int isolNrTrks()const{return isolData_.nrTrks;}
00123     float isolPtTrks()const{return isolData_.ptTrks;}
00124     float hltIsolHad()const{return isolData_.hltHad;}
00125     float hltIsolTrks()const{return isolData_.hltTrks;}
00126     float hltIsolEm()const{return isolData_.hltEm;}
00127 
00128     //selection cuts
00129     int cutCode()const{return cutCode_;}
00130     int looseCutCode()const{return looseCutCode_;}
00131   
00132     //trigger codes are just used as a unique identifier of the trigger, it is an error to specify more than a single bit
00133     //the idea here is to allow an arbitary number of photon triggers
00134     int trigCutsCutCode(const TrigCodes::TrigBitSet& trigger)const; 
00135     
00136     //trigger
00137     TrigCodes::TrigBitSet trigBits()const{return trigBits_;}
00138     
00139   };
00140 }
00141 
00142 #endif