CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_EGHLTOFFHELPER
00002 #define DQMOFFLINE_TRIGGER_EGHLTOFFHELPER
00003 
00004 //class: EgHLTOffHelper (Egamma HLT offline helper)
00005 //
00006 //author: Sam Harper (July 2008)
00007 //
00008 //
00009 //aim: to hide temporary place holder code away from the rest of the system
00010 //
00011 //implimentation: currently no isolation producers or electron selection cut meets my needs
00012 //                while I would like to use a central tool, for now I'm cludging my own as
00013 //                placeholders
00014 
00015 
00016 #include "DataFormats/Common/interface/Handle.h"
00017 #include "DataFormats/Common/interface/ValueMap.h"
00018 #include "DataFormats/Common/interface/TriggerResults.h"
00019 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00020 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00021 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00022 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00023 
00024 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00025 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00026 #include "DataFormats/JetReco/interface/CaloJet.h"
00027 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00028 #include "DataFormats/CaloTowers/interface/CaloTower.h"
00029 #include "DataFormats/CaloTowers/interface/CaloTowerFwd.h"
00030 
00031 #include "DQMOffline/Trigger/interface/EgHLTOffEvt.h"
00032 #include "DQMOffline/Trigger/interface/EgHLTOffEle.h"
00033 #include "DQMOffline/Trigger/interface/EgHLTOffPho.h"
00034 #include "DQMOffline/Trigger/interface/EgHLTOffEgSel.h"
00035 #include "DQMOffline/Trigger/interface/EgHLTTrigCodes.h"
00036 
00037 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00038 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00039 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00040 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00041 
00042 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00043 #include "MagneticField/Engine/interface/MagneticField.h"
00044 
00045 #include "FWCore/Utilities/interface/InputTag.h"
00046 #include "FWCore/Framework/interface/Event.h"
00047 #include "FWCore/Framework/interface/ESHandle.h"
00048 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00049 
00050 class EgammaHLTTrackIsolation;
00051 class HLTConfigProvider;
00052 class EcalSeverityLevelAlgo;
00053 
00054 namespace egHLT {
00055 
00056   class OffHelper {
00057 
00058   private:
00059     OffEgSel eleLooseCuts_; //loose selection cuts (loose has no relation to other 'loose' cuts)
00060     OffEgSel eleCuts_; //normal selection cuts
00061     OffEgSel phoLooseCuts_; //loose selection cuts (loose has no relation to other 'loose' cuts)
00062     OffEgSel phoCuts_; //normal selection cuts
00063     
00064     std::vector<std::pair<TrigCodes::TrigBitSet,OffEgSel> > trigCuts_;//non sorted vector (for now)
00065     
00066     
00067     edm::InputTag ecalRecHitsEBTag_;
00068     edm::InputTag ecalRecHitsEETag_;
00069     edm::InputTag caloJetsTag_;
00070     edm::InputTag isolTrkTag_;
00071     edm::InputTag hbheHitsTag_;
00072     edm::InputTag hfHitsTag_;
00073     edm::InputTag triggerSummaryLabel_;
00074     edm::InputTag electronsTag_;
00075     edm::InputTag photonsTag_;
00076     edm::InputTag beamSpotTag_;
00077     edm::InputTag caloTowersTag_;
00078     edm::InputTag trigResultsTag_;
00079 
00080     edm::ESHandle<CaloGeometry> caloGeom_;
00081     edm::ESHandle<CaloTopology> caloTopology_;
00082     edm::ESHandle<MagneticField> magField_;
00083     edm::ESHandle<EcalSeverityLevelAlgo> ecalSeverityLevel_;
00084 
00085     edm::Handle<EcalRecHitCollection> ebRecHits_;
00086     edm::Handle<EcalRecHitCollection> eeRecHits_; 
00087     edm::Handle<HFRecHitCollection> hfHits_;
00088     edm::Handle<HBHERecHitCollection> hbheHits_;
00089     edm::Handle<reco::TrackCollection> isolTrks_;
00090 
00091     edm::Handle<trigger::TriggerEvent> trigEvt_;
00092     edm::Handle<reco::PhotonCollection> recoPhos_;
00093     edm::Handle<reco::GsfElectronCollection> recoEles_;
00094     edm::Handle<std::vector<reco::CaloJet> > recoJets_;
00095     
00096     edm::Handle<reco::BeamSpot> beamSpot_;
00097     edm::Handle<CaloTowerCollection> caloTowers_;
00098    
00099     edm::Handle<edm::TriggerResults> trigResults_;
00100     
00101  
00102 
00103     std::string hltTag_;
00104     std::vector<std::string> hltFiltersUsed_;
00105     std::vector<std::pair<std::string,int> > hltFiltersUsedWithNrCandsCut_; //stores the filter name + number of candidates required to pass that filter for it to accept
00106     std::vector<std::pair<std::string,std::string> > l1PreAndSeedFilters_; //filter names of a l1 prescaler and the corresponding l1 seed filter
00107     std::vector<std::string> l1PreScaledPaths_;//l1 pre-scaled path names
00108     std::vector<std::string> l1PreScaledFilters_;//l1 pre scale filters
00109 
00110     //allow us to recompute e/gamma HLT isolations (note we also have em and hcal but they have to be declared for every event)
00111     //which is awkward and I havent thought of a good way around it yet
00112     EgammaHLTTrackIsolation* hltEleTrkIsolAlgo_;
00113     EgammaHLTTrackIsolation* hltPhoTrkIsolAlgo_;
00114 
00115     //our hlt isolation parameters...
00116     //ecal
00117     double hltEMIsolOuterCone_;
00118     double hltEMIsolInnerConeEB_;
00119     double hltEMIsolEtaSliceEB_;
00120     double hltEMIsolEtMinEB_;
00121     double hltEMIsolEMinEB_;
00122     double hltEMIsolInnerConeEE_;
00123     double hltEMIsolEtaSliceEE_;
00124     double hltEMIsolEtMinEE_;
00125     double hltEMIsolEMinEE_;
00126     //tracker
00127     double hltPhoTrkIsolPtMin_;
00128     double hltPhoTrkIsolOuterCone_;
00129     double hltPhoTrkIsolInnerCone_;
00130     double hltPhoTrkIsolZSpan_;
00131     double hltPhoTrkIsolRSpan_;
00132     bool hltPhoTrkIsolCountTrks_;
00133     double hltEleTrkIsolPtMin_;
00134     double hltEleTrkIsolOuterCone_;
00135     double hltEleTrkIsolInnerCone_;
00136     double hltEleTrkIsolZSpan_;
00137     double hltEleTrkIsolRSpan_;
00138     //hcal
00139     double hltHadIsolOuterCone_;
00140     double hltHadIsolInnerCone_;
00141     double hltHadIsolEtMin_;
00142     int hltHadIsolDepth_;
00143     //flags to disable calculations if same as reco (saves time)
00144     bool calHLTHcalIsol_;
00145     bool calHLTEmIsol_;
00146     bool calHLTEleTrkIsol_;
00147     bool calHLTPhoTrkIsol_;
00148     
00149     
00150     std::vector<edm::ParameterSet> trigCutParams_; //probably the least bad option
00151 
00152   private: //disabling copy / assignment
00153     OffHelper& operator=(const OffHelper& rhs){return *this;}
00154     OffHelper(const OffHelper& rhs){}
00155     
00156   public:
00157     OffHelper():eleLooseCuts_(),eleCuts_(),phoLooseCuts_(),phoCuts_(),hltEleTrkIsolAlgo_(NULL),hltPhoTrkIsolAlgo_(NULL){}
00158     ~OffHelper();
00159     
00160     void setup(const edm::ParameterSet& conf);
00161     void setupTriggers(const HLTConfigProvider& config,const std::vector<std::string>& hltFiltersUsed);
00162 
00163     //int is the error code, 0 = no error
00164     //it should never throw, print to screen or crash, this is the only error reporting it does
00165     int makeOffEvt(const edm::Event& edmEvent,const edm::EventSetup& setup,egHLT::OffEvt& offEvent);
00166     
00167     
00168     int getHandles(const edm::Event& event,const edm::EventSetup& setup);
00169     int fillOffEleVec(std::vector<OffEle>& offEles);
00170     int fillOffPhoVec(std::vector<OffPho>& offPhos);
00171     int setTrigInfo(const edm::Event & edmEvent, egHLT::OffEvt& offEvent);
00172 
00173     void fillIsolData(const reco::GsfElectron& ele,OffEle::IsolData& isolData);
00174     void fillClusShapeData(const reco::GsfElectron& ele,OffEle::ClusShapeData& clusShapeData);
00175     void fillHLTData(const reco::GsfElectron& ele,OffEle::HLTData& hltData);
00176     
00177     void fillIsolData(const reco::Photon& pho,OffPho::IsolData& isolData);
00178     void fillClusShapeData(const reco::Photon& pho,OffPho::ClusShapeData& clusShapeData);
00179 
00180     //tempory debugging functions
00181     const trigger::TriggerEvent* trigEvt()const{return trigEvt_.product();}
00182     const std::vector<std::pair<TrigCodes::TrigBitSet,OffEgSel> >& trigCuts()const{return trigCuts_;}
00183     
00184     
00185     template<class T> static bool getHandle(const edm::Event& event,const edm::InputTag& tag,edm::Handle<T>& handle);
00186     
00187   };
00188   
00189 
00190   template<class T> bool OffHelper::getHandle(const edm::Event& event,const edm::InputTag& tag,edm::Handle<T>& handle)
00191   {
00192   
00193     bool success=event.getByLabel(tag,handle);
00194     return success &&  handle.product();
00195     
00196 
00197   }
00198 }
00199 
00200 #endif