CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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 public:
00054     //helper struct to store reco approximations of variables made by HLT
00055     struct HLTData {
00056       //const math::XYZTLorentzVector p4() const;
00057       float HLTeta;
00058       float HLTphi;
00059       float HLTenergy;
00060     };    
00061 
00062 
00063   private:
00064     const reco::Photon* pho_; //pointers to the underlying phoctron (we do not own this)
00065 
00066     ClusShapeData clusShapeData_;
00067     IsolData isolData_;
00068     HLTData hltData_;
00069     
00070     //these are bit-packed words telling me which cuts the photon fail (ie 0x0 is passed all cuts) 
00071     int cutCode_;
00072     int looseCutCode_;
00073   
00074     //the idea is that these are user definable cuts mean to be idenital to the specified trigger
00075     //it is probably clear to the reader that I havent decided on the most efficient way to do this
00076     std::vector<std::pair<TrigCodes::TrigBitSet,int> > trigCutsCutCodes_; //unsorted vector (may sort if have performance issues)
00077     
00078     //and these are the trigger bits stored
00079     //note that the trigger bits are defined at the begining of each job
00080     //and do not necessaryly map between jobs
00081     TrigCodes::TrigBitSet trigBits_;
00082     
00083   public:
00084     
00085     OffPho(const reco::Photon& pho,const ClusShapeData& shapeData,const IsolData& isolData,const HLTData& hltData):
00086       pho_(&pho),clusShapeData_(shapeData),isolData_(isolData),hltData_(hltData),
00087       cutCode_(int(EgCutCodes::INVALID)),looseCutCode_(int(EgCutCodes::INVALID)){}
00088     ~OffPho(){}
00089     
00090     //modifiers  
00091     void setCutCode(int code){cutCode_=code;}
00092     void setLooseCutCode(int code){looseCutCode_=code;} 
00093     
00094     //slightly inefficient way, think I can afford it and its a lot easier to just make the sorted vector outside the class
00095     void setTrigCutsCutCodes(const std::vector<std::pair<TrigCodes::TrigBitSet,int> > trigCutsCutCodes){trigCutsCutCodes_=trigCutsCutCodes;}
00096     void setTrigBits(TrigCodes::TrigBitSet bits){trigBits_=bits;}
00097     
00098     const reco::Photon* recoPho()const{return pho_;}
00099 
00100     //kinematic and geometric methods
00101     float et()const{return pho_->et();}  
00102     float pt()const{return pho_->pt();}
00103     float energy()const{return pho_->energy();}
00104     float eta()const{return pho_->eta();}
00105     float phi()const{return pho_->phi();}
00106     float etSC()const{return pho_->superCluster()->position().rho()/pho_->superCluster()->position().r()*energy();}
00107     float etaSC()const{return pho_->superCluster()->eta();}
00108     float detEta()const{return etaSC();}
00109     float phiSC()const{return pho_->superCluster()->phi();}
00110     float zVtx()const{return pho_->vz();}
00111     const math::XYZTLorentzVector& p4()const{return pho_->p4();}
00112     
00113     bool isGap()const{return pho_->isEBGap() || pho_->isEEGap() || pho_->isEBEEGap();}
00114     
00115     //abreviations of overly long Photon methods, I'm sorry but if you cant figure out what hOverE() means, you shouldnt be using this class
00116     float hOverE()const{return pho_->hadronicOverEm();}
00117     
00118     
00119     
00120     float sigmaEtaEta()const;
00121     float sigmaEtaEtaUnCorr()const{return clusShapeData_.sigmaEtaEta;}
00122     float sigmaIEtaIEta()const{return clusShapeData_.sigmaIEtaIEta;}                                    
00123     float sigmaPhiPhi()const{return clusShapeData_.sigmaPhiPhi;}
00124     float sigmaIPhiIPhi()const{return clusShapeData_.sigmaIPhiIPhi;}
00125     float e2x5MaxOver5x5()const{return clusShapeData_.e2x5MaxOver5x5;}
00126     float e1x5Over5x5()const{return clusShapeData_.e1x5Over5x5;}
00127     float r9()const{return clusShapeData_.r9;}
00128     
00129     //isolation
00130     float isolEm()const{return isolData_.em;}
00131     float isolHad()const{return isolData_.had;}
00132     int isolNrTrks()const{return isolData_.nrTrks;}
00133     float isolPtTrks()const{return isolData_.ptTrks;}
00134     float hltIsolHad()const{return isolData_.hltHad;}
00135     float hltIsolTrks()const{return isolData_.hltTrks;}
00136     float hltIsolEm()const{return isolData_.hltEm;}
00137 
00138     //hlt position - not a reco approximation, taken from triggerobject
00139     //const math::XYZTLorentzVector& HLTp4()const{return hltDataPho_.p4();}
00140     float hltPhi()const{return hltData_.HLTphi;}
00141     float hltEta()const{return hltData_.HLTeta;}
00142     float hltEnergy()const{return hltData_.HLTenergy;}
00143     //Diference between HLT Et and reco SC Et
00144     float DeltaE()const{return (hltEnergy() - energy());}
00145 
00146     //selection cuts
00147     int cutCode()const{return cutCode_;}
00148     int looseCutCode()const{return looseCutCode_;}
00149   
00150     //trigger codes are just used as a unique identifier of the trigger, it is an error to specify more than a single bit
00151     //the idea here is to allow an arbitary number of photon triggers
00152     int trigCutsCutCode(const TrigCodes::TrigBitSet& trigger)const; 
00153     
00154     //trigger
00155     TrigCodes::TrigBitSet trigBits()const{return trigBits_;}
00156     
00157   };
00158 }
00159 
00160 #endif