CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EgHLTOffHelper.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTOFFHELPER
2 #define DQMOFFLINE_TRIGGER_EGHLTOFFHELPER
3 
4 //class: EgHLTOffHelper (Egamma HLT offline helper)
5 //
6 //author: Sam Harper (July 2008)
7 //
8 //
9 //aim: to hide temporary place holder code away from the rest of the system
10 //
11 //implimentation: currently no isolation producers or electron selection cut meets my needs
12 // while I would like to use a central tool, for now I'm cludging my own as
13 // placeholders
14 
22 
31 
37 
42 
45 
51 
53 class HLTConfigProvider;
56 
57 namespace egHLT {
58 
59  class OffHelper {
60  private:
61  OffEgSel eleLooseCuts_; //loose selection cuts (loose has no relation to other 'loose' cuts)
62  OffEgSel eleCuts_; //normal selection cuts
63  OffEgSel phoLooseCuts_; //loose selection cuts (loose has no relation to other 'loose' cuts)
64  OffEgSel phoCuts_; //normal selection cuts
65 
66  std::vector<std::pair<TrigCodes::TrigBitSet, OffEgSel> > trigCuts_; //non sorted vector (for now)
67 
81 
86 
91 
97 
102 
105 
107 
109 
111  std::vector<std::string> hltFiltersUsed_;
112  std::vector<std::pair<std::string, int> >
113  hltFiltersUsedWithNrCandsCut_; //stores the filter name + number of candidates required to pass that filter for it to accept
114  std::vector<std::pair<std::string, std::string> >
115  l1PreAndSeedFilters_; //filter names of a l1 prescaler and the corresponding l1 seed filter
116  std::vector<std::string> l1PreScaledPaths_; //l1 pre-scaled path names
117  std::vector<std::string> l1PreScaledFilters_; //l1 pre scale filters
118 
119  //allow us to recompute e/gamma HLT isolations (note we also have em and hcal but they have to be declared for every event)
120  //which is awkward and I havent thought of a good way around it yet
123 
124  //our hlt isolation parameters...
125  //ecal
135  //tracker
147  //hcal
152  //flags to disable calculations if same as reco (saves time)
157 
158  std::vector<edm::ParameterSet> trigCutParams_; //probably the least bad option
159 
160  public:
162  : eleLooseCuts_(),
163  eleCuts_(),
164  phoLooseCuts_(),
165  phoCuts_(),
166  hltEleTrkIsolAlgo_(nullptr),
167  hltPhoTrkIsolAlgo_(nullptr) {}
168  OffHelper& operator=(const OffHelper&) = delete;
169  OffHelper(const OffHelper&) = delete;
170  ~OffHelper();
171 
172  void setup(const edm::ParameterSet& conf, edm::ConsumesCollector&& iC);
174  const std::vector<std::string>& hltFiltersUsed,
175  const TrigCodes& trigCodes);
176 
177  //int is the error code, 0 = no error
178  //it should never throw, print to screen or crash, this is the only error reporting it does
179  int makeOffEvt(const edm::Event& edmEvent,
180  const edm::EventSetup& setup,
181  egHLT::OffEvt& offEvent,
182  const TrigCodes& trigCodes);
183 
184  int getHandles(const edm::Event& event, const edm::EventSetup& setup);
185  int fillOffEleVec(std::vector<OffEle>& offEles);
186  int fillOffPhoVec(std::vector<OffPho>& offPhos);
187  int setTrigInfo(const edm::Event& edmEvent, egHLT::OffEvt& offEvent, const TrigCodes& trigCodes);
188 
189  void fillIsolData(const reco::GsfElectron& ele, OffEle::IsolData& isolData);
190  void fillClusShapeData(const reco::GsfElectron& ele, OffEle::ClusShapeData& clusShapeData);
191  void fillHLTData(const reco::GsfElectron& ele, OffEle::HLTData& hltData);
192 
193  void fillIsolData(const reco::Photon& pho, OffPho::IsolData& isolData);
194  void fillClusShapeData(const reco::Photon& pho, OffPho::ClusShapeData& clusShapeData);
195  void fillHLTDataPho(const reco::Photon& pho, OffPho::HLTData& hltData);
196 
197  //tempory debugging functions
198  const trigger::TriggerEvent* trigEvt() const { return trigEvt_.product(); }
199  const std::vector<std::pair<TrigCodes::TrigBitSet, OffEgSel> >& trigCuts() const { return trigCuts_; }
200 
201  template <class T>
203  };
204 
205  template <class T>
207  bool success = event.getByToken(token, handle);
208  return success && handle.product();
209  }
210 } // namespace egHLT
211 
212 #endif
double hltEMIsolEtaSliceEB_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
edm::Handle< reco::TrackCollection > isolTrks_
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
int fillOffPhoVec(std::vector< OffPho > &offPhos)
double hltPhoTrkIsolRSpan_
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken
OffEgSel phoLooseCuts_
void fillClusShapeData(const reco::GsfElectron &ele, OffEle::ClusShapeData &clusShapeData)
edm::Handle< reco::PhotonCollection > recoPhos_
int setTrigInfo(const edm::Event &edmEvent, egHLT::OffEvt &offEvent, const TrigCodes &trigCodes)
std::vector< std::pair< std::string, std::string > > l1PreAndSeedFilters_
double hltEMIsolOuterCone_
OffEgSel eleLooseCuts_
edm::EDGetTokenT< HBHERecHitCollection > hbheHitsToken
std::vector< std::string > l1PreScaledPaths_
EgammaHLTTrackIsolation * hltPhoTrkIsolAlgo_
double hltEleTrkIsolOuterCone_
void fillIsolData(const reco::GsfElectron &ele, OffEle::IsolData &isolData)
void fillHLTData(const reco::GsfElectron &ele, OffEle::HLTData &hltData)
edm::EDGetTokenT< reco::TrackCollection > isolTrkToken
double hltEMIsolInnerConeEE_
const std::vector< std::pair< TrigCodes::TrigBitSet, OffEgSel > > & trigCuts() const
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken
std::vector< edm::ParameterSet > trigCutParams_
double hltEleTrkIsolInnerCone_
edm::Handle< HBHERecHitCollection > hbheHits_
double hltPhoTrkIsolPtMin_
std::vector< std::pair< std::string, int > > hltFiltersUsedWithNrCandsCut_
double hltEleTrkIsolZSpan_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken
OffHelper & operator=(const OffHelper &)=delete
void fillHLTDataPho(const reco::Photon &pho, OffPho::HLTData &hltData)
double hltHadIsolInnerCone_
const trigger::TriggerEvent * trigEvt() const
double hltPhoTrkIsolZSpan_
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEEToken
double hltEleTrkIsolRSpan_
double hltHadIsolOuterCone_
edm::EDGetTokenT< reco::PhotonCollection > photonsToken
tuple handle
Definition: patZpeak.py:25
static bool getHandle(const edm::Event &event, const edm::EDGetTokenT< T > &token, edm::Handle< T > &handle)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
edm::Handle< HFRecHitCollection > hfHits_
edm::Handle< std::vector< reco::CaloJet > > recoJets_
double hltEleTrkIsolPtMin_
edm::ESHandle< MagneticField > magField_
edm::Handle< trigger::TriggerEvent > trigEvt_
edm::ESHandle< CaloGeometry > caloGeom_
double hltPhoTrkIsolInnerCone_
double hltEMIsolEtaSliceEE_
double hltEMIsolInnerConeEB_
edm::Handle< reco::GsfElectronCollection > recoEles_
edm::EDGetTokenT< edm::TriggerResults > trigResultsToken
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< HFRecHitCollection > hfHitsToken
edm::Handle< edm::TriggerResults > trigResults_
edm::ESHandle< CaloTopology > caloTopology_
int makeOffEvt(const edm::Event &edmEvent, const edm::EventSetup &setup, egHLT::OffEvt &offEvent, const TrigCodes &trigCodes)
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken
std::vector< std::string > l1PreScaledFilters_
std::vector< std::pair< TrigCodes::TrigBitSet, OffEgSel > > trigCuts_
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEBToken
edm::Handle< EcalRecHitCollection > eeRecHits_
int getHandles(const edm::Event &event, const edm::EventSetup &setup)
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
tuple config
parse the configuration file
double hltPhoTrkIsolOuterCone_
edm::Handle< CaloTowerCollection > caloTowers_
edm::Handle< EcalRecHitCollection > ebRecHits_
std::vector< std::string > hltFiltersUsed_
edm::Handle< reco::VertexCollection > recoVertices_
edm::ESHandle< EcalSeverityLevelAlgo > ecalSeverityLevel_
void setupTriggers(const HLTConfigProvider &config, const std::vector< std::string > &hltFiltersUsed, const TrigCodes &trigCodes)
EgammaHLTTrackIsolation * hltEleTrkIsolAlgo_
edm::Handle< reco::BeamSpot > beamSpot_
std::string hltTag_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeverityToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken
int fillOffEleVec(std::vector< OffEle > &offEles)