CMS 3D CMS Logo

EgHLTOffHelper.cc
Go to the documentation of this file.
2 
3 
8 
10 
13 
19 
23 
24 #include <iostream>
25 
26 using namespace egHLT;
27 
28 
29 
31 {
34 }
35 
37 {
38 
39  ecalRecHitsEBToken = iC.consumes <EcalRecHitCollection > (conf.getParameter<edm::InputTag>("BarrelRecHitCollection"));
40  ecalRecHitsEEToken = iC.consumes <EcalRecHitCollection > (conf.getParameter<edm::InputTag>("EndcapRecHitCollection"));
41  caloJetsToken = iC.consumes <reco::CaloJetCollection > (conf.getParameter<edm::InputTag>("CaloJetCollection"));
42  isolTrkToken = iC.consumes <reco::TrackCollection > (conf.getParameter<edm::InputTag>("IsolTrackCollection"));
43  hbheHitsToken = iC.consumes <HBHERecHitCollection > (conf.getParameter<edm::InputTag>("HBHERecHitCollection"));
44  hfHitsToken = iC.consumes <HFRecHitCollection > (conf.getParameter<edm::InputTag>("HFRecHitCollection"));
45  electronsToken = iC.consumes <reco::GsfElectronCollection > (conf.getParameter<edm::InputTag>("ElectronCollection"));
46  photonsToken = iC.consumes <reco::PhotonCollection > (conf.getParameter<edm::InputTag>("PhotonCollection"));
47  triggerSummaryToken = iC.consumes <trigger::TriggerEvent> (conf.getParameter<edm::InputTag>("triggerSummaryLabel"));
48  hltTag_ = conf.getParameter<std::string>("hltTag");
49  beamSpotToken = iC.consumes <reco::BeamSpot > (conf.getParameter<edm::InputTag>("BeamSpotProducer"));
50  caloTowersToken = iC.consumes <CaloTowerCollection > (conf.getParameter<edm::InputTag>("CaloTowers"));
51  trigResultsToken = iC.consumes <edm::TriggerResults > (conf.getParameter<edm::InputTag>("TrigResults"));
52  vertexToken = iC.consumes <reco::VertexCollection > (conf.getParameter<edm::InputTag>("VertexCollection"));
53 
54  eleCuts_.setup(conf.getParameter<edm::ParameterSet>("eleCuts"));
55  eleLooseCuts_.setup(conf.getParameter<edm::ParameterSet>("eleLooseCuts"));
56  phoCuts_.setup(conf.getParameter<edm::ParameterSet>("phoCuts"));
57  phoLooseCuts_.setup(conf.getParameter<edm::ParameterSet>("phoLooseCuts"));
58 
59  //now we have the isolations completely configurable via python
60  hltEMIsolOuterCone_ = conf.getParameter<double>("hltEMIsolOuterCone");
61  hltEMIsolInnerConeEB_ = conf.getParameter<double>("hltEMIsolInnerConeEB");
62  hltEMIsolEtaSliceEB_ = conf.getParameter<double>("hltEMIsolEtaSliceEB");
63  hltEMIsolEtMinEB_ = conf.getParameter<double>("hltEMIsolEtMinEB");
64  hltEMIsolEMinEB_ = conf.getParameter<double>("hltEMIsolEMinEB");
65  hltEMIsolInnerConeEE_ = conf.getParameter<double>("hltEMIsolInnerConeEE");
66  hltEMIsolEtaSliceEE_ = conf.getParameter<double>("hltEMIsolEtaSliceEE");
67  hltEMIsolEtMinEE_ = conf.getParameter<double>("hltEMIsolEtMinEE");
68  hltEMIsolEMinEE_ = conf.getParameter<double>("hltEMIsolEMinEE");
69 
70  hltPhoTrkIsolPtMin_ = conf.getParameter<double>("hltPhoTrkIsolPtMin");
71  hltPhoTrkIsolOuterCone_ = conf.getParameter<double>("hltPhoTrkIsolOuterCone");
72  hltPhoTrkIsolInnerCone_ = conf.getParameter<double>("hltPhoTrkIsolInnerCone");
73  hltPhoTrkIsolZSpan_ = conf.getParameter<double>("hltPhoTrkIsolZSpan");
74  hltPhoTrkIsolRSpan_ = conf.getParameter<double>("hltPhoTrkIsolZSpan");
75  hltPhoTrkIsolCountTrks_ = conf.getParameter<bool>("hltPhoTrkIsolCountTrks");
76 
77  hltEleTrkIsolPtMin_ = conf.getParameter<double>("hltEleTrkIsolPtMin");
78  hltEleTrkIsolOuterCone_ = conf.getParameter<double>("hltEleTrkIsolOuterCone");
79  hltEleTrkIsolInnerCone_ = conf.getParameter<double>("hltEleTrkIsolInnerCone");
80  hltEleTrkIsolZSpan_ = conf.getParameter<double>("hltEleTrkIsolZSpan");
81  hltEleTrkIsolRSpan_ = conf.getParameter<double>("hltEleTrkIsolZSpan");
82 
83  hltHadIsolOuterCone_ = conf.getParameter<double>("hltHadIsolOuterCone");
84  hltHadIsolInnerCone_ = conf.getParameter<double>("hltHadIsolInnerCone");
85  hltHadIsolEtMin_ = conf.getParameter<double>("hltHadIsolEtMin");
86  hltHadIsolDepth_ = conf.getParameter<int>("hltHadIsolDepth");
87 
88  calHLTHcalIsol_ = conf.getParameter<bool>("calHLTHcalIsol");
89  calHLTEmIsol_ = conf.getParameter<bool>("calHLTEmIsol");
90  calHLTEleTrkIsol_ = conf.getParameter<bool>("calHLTEleTrkIsol");
91  calHLTPhoTrkIsol_ = conf.getParameter<bool>("calHLTPhoTrkIsol");
92 
93  trigCutParams_ = conf.getParameter<std::vector<edm::ParameterSet> >("triggerCuts"); //setupTriggers used to be in this function but had to be moved due to HLTConfigChanges (has to be called beginRun) so we have to save this for later.
94 
95  hltEleTrkIsolAlgo_ = new EgammaHLTTrackIsolation(hltEleTrkIsolPtMin_,hltEleTrkIsolOuterCone_,hltEleTrkIsolZSpan_,hltEleTrkIsolRSpan_,hltEleTrkIsolInnerCone_);
96  hltPhoTrkIsolAlgo_ = new EgammaHLTTrackIsolation(hltPhoTrkIsolPtMin_,hltPhoTrkIsolOuterCone_,hltPhoTrkIsolZSpan_,hltPhoTrkIsolRSpan_,hltPhoTrkIsolInnerCone_);
97 
98 
99 }
100 
101 //this code was taken out of OffHelper::setup due to HLTConfigProvider changes
102 //it still assumes that this is called only once
103 void OffHelper::setupTriggers(const HLTConfigProvider& hltConfig,const std::vector<std::string>& hltFiltersUsed, const TrigCodes& trigCodes)
104 {
105  hltFiltersUsed_ = hltFiltersUsed; //expensive but only do this once and faster ways could make things less clear
106  //now work out how many objects are requires to pass filter for it to accept
109  for(size_t filterNr=0;filterNr<hltFiltersUsed_.size();filterNr++){
110  hltFiltersUsedWithNrCandsCut_.push_back(std::make_pair(hltFiltersUsed_[filterNr],getMRObjs[filterNr]));
111  }
112 
113  //now loading the cuts for every trigger into our vector which stores them
114  //only load cuts for triggers that are in hltFiltersUsed
115 
116  for(auto & trigCutParam : trigCutParams_) {
117  std::string trigName = trigCutParam.getParameter<std::string>("trigName");
118  if(std::find(hltFiltersUsed_.begin(),hltFiltersUsed_.end(),trigName)!=hltFiltersUsed_.end()){ //perhaps I should sort hltFiltersUsed_....
119  trigCuts_.push_back(std::make_pair(trigCodes.getCode(trigName),OffEgSel(trigCutParam)));
120  // std::cout<<trigName<<std::endl<<"between"<<std::endl<<trigCutParams_[trigNr]<<std::endl<<"after"<<std::endl;
121  }
122  }
123  trigCutParams_.clear();//dont need it any more, get rid of it
124 
125  //to make my life difficult, the scaled l1 paths are special
126  //and arent stored in trigger event
127  //to I have to figure out the path, see if it passes
128  //and then hunt down the l1 seed filter and use that to match to the pho/ele
129  //matching on l1 seed filter is not enough as that will be passed for normal
130  //electron triggers even if pre-scale hasnt fired
131  l1PreScaledFilters_.clear();
132  l1PreScaledPaths_.clear();
133  l1PreAndSeedFilters_.clear();
134  for(auto & filterNr : hltFiltersUsed_){
135  if(filterNr.find("hltPreL1")==0){ //l1 prescaled path
136  l1PreScaledFilters_.push_back(filterNr);
137  }
138  }
139 
141  if(l1PreScaledPaths_.size()==l1PreScaledFilters_.size()){
142  for(size_t pathNr=0;pathNr<l1PreScaledPaths_.size();pathNr++){
143 
145  //---Morse====
146  //std::cout<<l1PreScaledFilters_[pathNr]<<" "<<l1PreScaledPaths_[pathNr]<<" "<<l1SeedFilter<<std::endl;
147  //------------
148  l1PreAndSeedFilters_.push_back(std::make_pair(l1PreScaledFilters_[pathNr],l1SeedFilter));
149  }
150  }
151 }
152 
153 int OffHelper::makeOffEvt(const edm::Event& edmEvent,const edm::EventSetup& setup,egHLT::OffEvt& offEvent,const TrigCodes& c)
154 {
155  offEvent.clear();
156  int errCode=0; //excution stops as soon as an error is flagged
157  if(errCode==0) errCode = getHandles(edmEvent,setup);
158  if(errCode==0) errCode = fillOffEleVec(offEvent.eles());
159  if(errCode==0) errCode = fillOffPhoVec(offEvent.phos());
160  if(errCode==0) errCode = setTrigInfo(edmEvent, offEvent, c);
161  if(errCode==0) offEvent.setJets(recoJets_);
162  return errCode;
163 }
164 
165 
167 {
168  try {
169  setup.get<CaloGeometryRecord>().get(caloGeom_);
170  setup.get<CaloTopologyRecord>().get(caloTopology_);
171  //setup.get<EcalSeverityLevelAlgoRcd>().get(ecalSeverityLevel_);
172  }catch(cms::Exception& iException){
173  return errCodes::Geom;
174  }
175  try {
176  setup.get<IdealMagneticFieldRecord>().get(magField_);
177  }catch(cms::Exception& iException){
178  return errCodes::MagField;
179  }
180 
181  //get objects
182  if(!getHandle(event,triggerSummaryToken,trigEvt_)) return errCodes::TrigEvent; //must have this, otherwise skip event
183  if(!getHandle(event,trigResultsToken,trigResults_)) return errCodes::TrigEvent; //re using bit to minimise bug fix code changes
184  if(!getHandle(event,electronsToken,recoEles_)) return errCodes::OffEle; //need for electrons
185  if(!getHandle(event,photonsToken, recoPhos_)) return errCodes::OffPho; //need for photons
186  if(!getHandle(event,caloJetsToken,recoJets_)) return errCodes::OffJet; //need for electrons and photons
187  if(!getHandle(event,vertexToken,recoVertices_)) return errCodes::OffVertex; //need for eff vs nVertex
188 
189  //need for HLT isolations (rec hits also need for sigmaIPhiIPhi (ele/pho) and r9 pho)
193  if(!getHandle(event,hbheHitsToken, hbheHits_)) return errCodes::HBHERecHits; //I dont think we need hbhe rec-hits any more
194  if(!getHandle(event,hfHitsToken, hfHits_)) return errCodes::HFRecHits;//I dont think we need hf rec-hits any more
197 
198 
199  return 0;
200 }
201 
202 //this function coverts GsfElectrons to a format which is actually useful to me
203 int OffHelper::fillOffEleVec(std::vector<OffEle>& egHLTOffEles)
204 {
205  egHLTOffEles.clear();
206  egHLTOffEles.reserve(recoEles_->size());
207  for(auto const & gsfIter : *recoEles_){
208  if(!gsfIter.ecalDrivenSeed()) continue; //avoid PF electrons (this is Eg HLT validation and HLT is ecal driven)
209 
210  int nVertex=0;
211  for(auto const & nVit : *recoVertices_){
212  if( !nVit.isFake()
213  && nVit.ndof()>4
214  && std::fabs( nVit.z()<24.0)
215  && sqrt(nVit.x()*nVit.x() + nVit.y()*nVit.y())<2.0){nVertex++;}
216  }
217  //if(nVertex>20)std::cout<<"nVertex: "<<nVertex<<std::endl;
218  OffEle::EventData eventData;
219  eventData.NVertex=nVertex;
220 
221  OffEle::IsolData isolData;
222  fillIsolData(gsfIter,isolData);
223 
224  OffEle::ClusShapeData clusShapeData;
225  fillClusShapeData(gsfIter,clusShapeData);
226 
227  OffEle::HLTData hltData;
228  fillHLTData(gsfIter,hltData);
229 
230  egHLTOffEles.emplace_back(gsfIter,clusShapeData,isolData,hltData,eventData);
231 
232  //now we would like to set the cut results
233  OffEle& ele = egHLTOffEles.back();
234  ele.setCutCode(eleCuts_.getCutCode(ele));
236 
237  std::vector<std::pair<TrigCodes::TrigBitSet,int> >trigCutsCutCodes;
238  for(auto & trigCut : trigCuts_) trigCutsCutCodes.push_back(std::make_pair(trigCut.first,trigCut.second.getCutCode(ele)));
239  ele.setTrigCutsCutCodes(trigCutsCutCodes);
240  }//end loop over gsf electron collection
241  return 0;
242 }
243 
245 {
251 
252  isolData.ptTrks=ele.dr03TkSumPt();
253  isolData.nrTrks=999; //no longer supported
254  isolData.em= ele.dr03EcalRecHitSumEt();
255  isolData.hadDepth1 = ele.dr03HcalDepth1TowerSumEt();
256  isolData.hadDepth2 = ele.dr03HcalDepth2TowerSumEt();
257 
258  //now time to do the HLT algos
259  if(calHLTHcalIsol_) isolData.hltHad=hcalIsolAlgo.getTowerESum(&ele);
260  else isolData.hltHad = 0.;
262  else isolData.hltTrksEle = 0.;
263  if(calHLTPhoTrkIsol_){
265  else isolData.hltTrksPho=hltPhoTrkIsolAlgo_->photonPtSum(&ele,isolTrks_.product(),false);
266  }
267  else isolData.hltTrksPho = 0.;
268  if(calHLTEmIsol_) isolData.hltEm = ecalIsolAlgoEB.getEtSum(&ele) +
269  ecalIsolAlgoEE.getEtSum(&ele);
270  else isolData.hltEm = 0.;
271 
272 }
273 
274 
276 {
277  clusShapeData.sigmaEtaEta = ele.sigmaEtaEta();
278  clusShapeData.sigmaIEtaIEta = ele.sigmaIetaIeta();
279  double e5x5 = ele.e5x5();
280  if(e5x5!=0.){
281  clusShapeData.e1x5Over5x5 = ele.e1x5()/e5x5;
282  clusShapeData.e2x5MaxOver5x5 = ele.e2x5Max()/e5x5;
283  }else{
284  clusShapeData.e1x5Over5x5 = -1;
285  clusShapeData.e2x5MaxOver5x5 = -1;
286  }
287 
288  //want to calculate r9, sigmaPhiPhi and sigmaIPhiIPhi, have to do old fashioned way
289  const reco::BasicCluster& seedClus = *(ele.superCluster()->seed());
290  const DetId seedDetId = seedClus.hitsAndFractions()[0].first; //note this may not actually be the seed hit but it doesnt matter because all hits will be in the barrel OR endcap
291  if(seedDetId.subdetId()==EcalBarrel){
292  std::vector<float> stdCov = EcalClusterTools::covariances(seedClus,ebRecHits_.product(),caloTopology_.product(),caloGeom_.product());
293  std::vector<float> crysCov = EcalClusterTools::localCovariances(seedClus,ebRecHits_.product(),caloTopology_.product());
294  clusShapeData.sigmaPhiPhi = sqrt(stdCov[2]);
295  clusShapeData.sigmaIPhiIPhi = sqrt(crysCov[2]);
296  if(ele.superCluster()->rawEnergy()!=0.){
297  clusShapeData.r9 = EcalClusterTools::e3x3(seedClus,ebRecHits_.product(),caloTopology_.product()) / ele.superCluster()->rawEnergy();
298  }else clusShapeData.r9 = -1.;
299 
300  }else{
301  std::vector<float> stdCov = EcalClusterTools::covariances(seedClus,eeRecHits_.product(),caloTopology_.product(),caloGeom_.product());
302  std::vector<float> crysCov = EcalClusterTools::localCovariances(seedClus,eeRecHits_.product(),caloTopology_.product());
303  clusShapeData.sigmaPhiPhi = sqrt(stdCov[2]);
304  clusShapeData.sigmaIPhiIPhi = sqrt(crysCov[2]);
305  if(ele.superCluster()->rawEnergy()!=0.){
306  clusShapeData.r9 = EcalClusterTools::e3x3(seedClus,eeRecHits_.product(),caloTopology_.product()) / ele.superCluster()->rawEnergy();
307  }else clusShapeData.r9 = -1.;
308  }
309 }
310 
311 //reco approximations of hlt quantities
313 {
314  if(ele.closestCtfTrackRef().isNonnull() &&
315  ele.closestCtfTrackRef()->extra().isNonnull()){
316  reco::TrackRef ctfTrack = ele.closestCtfTrackRef();
317  reco::SuperClusterRef scClus = ele.superCluster();
318 
319  //dEta
320  const reco::BeamSpot::Point& bsPos = beamSpot_->position();
321  math::XYZPoint scPosWRTVtx(scClus->x()-bsPos.x(), scClus->y()-bsPos.y() , scClus->z()-ctfTrack->vz());
322  hltData.dEtaIn = fabs(scPosWRTVtx.eta()-ctfTrack->eta());
323 
324  //dPhi: lifted straight from hlt code
325  float deltaPhi=fabs(ctfTrack->outerPosition().phi()-scClus->phi());
326  if(deltaPhi>6.283185308) deltaPhi -= 6.283185308;
327  if(deltaPhi>3.141592654) deltaPhi = 6.283185308-deltaPhi;
328  hltData.dPhiIn = deltaPhi;
329 
330  //invEInvP
331  if(ele.ecalEnergy()!=0 && ctfTrack->p()!=0) hltData.invEInvP= 1/ele.ecalEnergy() - 1/ctfTrack->p();
332  else hltData.invEInvP = 0;
333  }else{
334  hltData.dEtaIn =999;
335  hltData.dPhiIn =999;
336  hltData.invEInvP = 999;
337 
338  }
339 
340  //Now get HLT p4 from triggerobject
341  //reset the position first
342  hltData.HLTeta = 999;
343  hltData.HLTphi = 999;
344  hltData.HLTenergy = -999;
346  //trigTools::fillHLTposition(phos(),hltFiltersUsed_,l1PreAndSeedFilters_,evtTrigBits,trigEvt_.product(),hltTag_);
347 }
348 
349 
351 {
352  //Now get HLT p4 from triggerobject
353  //reset the position first
354  hltData.HLTeta = 999;
355  hltData.HLTphi = 999;
356  hltData.HLTenergy = -999;
358  //trigTools::fillHLTposition(phos(),hltFiltersUsed_,l1PreAndSeedFilters_,evtTrigBits,trigEvt_.product(),hltTag_);
359 }
360 
361 
362 
363 
364 //this function coverts Photons to a format which more useful to me
365 int OffHelper::fillOffPhoVec(std::vector<OffPho>& egHLTOffPhos)
366 {
367  egHLTOffPhos.clear();
368  egHLTOffPhos.reserve(recoPhos_->size());
369  for(auto const & phoIter : *recoPhos_){
370 
371  OffPho::IsolData isolData;
372  OffPho::ClusShapeData clusShapeData;
373 
374  fillIsolData(phoIter,isolData);
375  fillClusShapeData(phoIter,clusShapeData);
376 
377  OffPho::HLTData hltData;
378  fillHLTDataPho(phoIter,hltData);
379 
380  egHLTOffPhos.emplace_back(phoIter,clusShapeData,isolData,hltData);
381  OffPho& pho = egHLTOffPhos.back();
382  pho.setCutCode(phoCuts_.getCutCode(pho));
384 
385  std::vector<std::pair<TrigCodes::TrigBitSet,int> >trigCutsCutCodes;
386  for(auto & trigCut : trigCuts_) trigCutsCutCodes.push_back(std::make_pair(trigCut.first,trigCut.second.getCutCode(pho)));
387  pho.setTrigCutsCutCodes(trigCutsCutCodes);
388 
389 
390  }//end loop over photon collection
391  return 0;
392 }
393 
394 
396 {
402 
403  isolData.nrTrks = pho.nTrkHollowConeDR03();
404  isolData.ptTrks = pho.trkSumPtHollowConeDR03();
405  isolData.em = pho.ecalRecHitSumEtConeDR03();
406  isolData.had = pho.hcalTowerSumEtConeDR03();
407 
408  //now calculate hlt algos
409  if(calHLTHcalIsol_) isolData.hltHad=hcalIsolAlgo.getTowerESum(&pho);
410  else isolData.hltHad = 0.;
411  if(calHLTPhoTrkIsol_){
413  else isolData.hltTrks=hltPhoTrkIsolAlgo_->photonPtSum(&pho,isolTrks_.product(),false);
414  }
415  else isolData.hltTrks = 0.;
416  if(calHLTEmIsol_) isolData.hltEm = ecalIsolAlgoEB.getEtSum(&pho) +
417  ecalIsolAlgoEE.getEtSum(&pho);
418  else isolData.hltEm = 0.;
419 
420 }
421 
423 {
424  clusShapeData.sigmaEtaEta = pho.sigmaEtaEta();
425  clusShapeData.sigmaIEtaIEta = pho.sigmaIetaIeta();
426  double e5x5 = pho.e5x5();
427  if(e5x5!=0.){ //even though it is almost impossible for this to be 0., this code can never ever crash under any situation
428  clusShapeData.e1x5Over5x5 = pho.e1x5()/e5x5;
429  clusShapeData.e2x5MaxOver5x5 = pho.e2x5()/e5x5;
430  }else{
431  clusShapeData.e1x5Over5x5 = -1;
432  clusShapeData.e2x5MaxOver5x5 = -1;
433  }
434  clusShapeData.r9 = pho.r9();
435 
436  //sigmaPhiPhi and sigmaIPhiIPhi are not in object (and nor should they be) so have to get them old fashioned way
437  //need to figure out if its in the barrel or endcap
438  //get the first hit of the cluster and figure out if its barrel or endcap
439  const reco::BasicCluster& seedClus = *(pho.superCluster()->seed());
440  const DetId seedDetId = seedClus.hitsAndFractions()[0].first; //note this may not actually be the seed hit but it doesnt matter because all hits will be in the barrel OR endcap (it is also incredably inefficient as it getHitsByDetId passes the vector by value not reference
441  if(seedDetId.subdetId()==EcalBarrel){
442  std::vector<float> stdCov = EcalClusterTools::covariances(seedClus,ebRecHits_.product(),caloTopology_.product(),caloGeom_.product());
443  std::vector<float> crysCov = EcalClusterTools::localCovariances(seedClus,ebRecHits_.product(),caloTopology_.product());
444  clusShapeData.sigmaPhiPhi = sqrt(stdCov[2]);
445  clusShapeData.sigmaIPhiIPhi = sqrt(crysCov[2]);
446  }else{
447  std::vector<float> stdCov = EcalClusterTools::covariances(seedClus,eeRecHits_.product(),caloTopology_.product(),caloGeom_.product());
448  std::vector<float> crysCov = EcalClusterTools::localCovariances(seedClus,eeRecHits_.product(),caloTopology_.product());
449 
450  clusShapeData.sigmaPhiPhi = sqrt(stdCov[2]);
451  clusShapeData.sigmaIPhiIPhi = sqrt(crysCov[2]);
452  }
453 }
454 
455 int OffHelper::setTrigInfo(const edm::Event & edmEvent, egHLT::OffEvt& offEvent, const TrigCodes& trigCodes)
456 {
458  //the l1 prescale paths dont have a filter with I can figure out if it passed or failed with so have to use TriggerResults
459  if(l1PreScaledPaths_.size()==l1PreScaledFilters_.size()){ //check to ensure both vectors have same number of events incase of screw ups
460  const edm::TriggerNames & triggerNames = edmEvent.triggerNames(*trigResults_);
461  for(size_t pathNr=0;pathNr<l1PreScaledPaths_.size();pathNr++){ //now we have to check the prescaled l1 trigger paths
462  unsigned int pathIndex = triggerNames.triggerIndex(l1PreScaledPaths_[pathNr]);
463  if(pathIndex<trigResults_->size() && trigResults_->accept(pathIndex)){
464  evtTrigBits |= trigCodes.getCode(l1PreScaledFilters_[pathNr]);
465  }
466  }
467  }
468 
469  offEvent.setEvtTrigBits(evtTrigBits);
470 
473  return 0;
474 }
size
Write out results.
void setTrigCutsCutCodes(const std::vector< std::pair< TrigCodes::TrigBitSet, int > > &trigCutsCutCodes)
Definition: EgHLTOffPho.h:95
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
void fillHLTposition(T &obj, U &hltData, const std::vector< std::string > &filters, const trigger::TriggerEvent *trigEvt, const std::string &hltTag)
double hltEMIsolEtaSliceEB_
edm::Handle< reco::TrackCollection > isolTrks_
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:205
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
int fillOffPhoVec(std::vector< OffPho > &offPhos)
double hltPhoTrkIsolRSpan_
TrigBitSet getCode(const char *descript) const
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken
float e5x5() const
Definition: Photon.h:234
float hcalTowerSumEtConeDR03() const
Hcal isolation sum.
Definition: Photon.h:441
void setLooseCutCode(int code)
Definition: EgHLTOffEle.h:109
OffEgSel phoLooseCuts_
void fillClusShapeData(const reco::GsfElectron &ele, OffEle::ClusShapeData &clusShapeData)
edm::Handle< reco::PhotonCollection > recoPhos_
std::vector< std::pair< TrigCodes::TrigBitSet, OffEgSel > > trigCuts_
int getCutCode(const OffEle &ele, int cutMask=~0x0) const
int setTrigInfo(const edm::Event &edmEvent, egHLT::OffEvt &offEvent, const TrigCodes &trigCodes)
double hltEMIsolOuterCone_
bool accept() const
Has at least one path accepted the event?
OffEgSel eleLooseCuts_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
float e1x5() const
Shower shape variables.
Definition: Photon.h:231
edm::EDGetTokenT< HBHERecHitCollection > hbheHitsToken
std::vector< std::string > l1PreScaledPaths_
EgammaHLTTrackIsolation * hltPhoTrkIsolAlgo_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< std::pair< std::string, std::string > > l1PreAndSeedFilters_
double hltEleTrkIsolOuterCone_
void clear()
Definition: EgHLTOffEvt.cc:5
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
void fillIsolData(const reco::GsfElectron &ele, OffEle::IsolData &isolData)
int photonTrackCount(const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
float dr03HcalDepth2TowerSumEt() const
Definition: GsfElectron.h:556
void fillHLTData(const reco::GsfElectron &ele, OffEle::HLTData &hltData)
float trkSumPtHollowConeDR03() const
Definition: Photon.h:455
float e2x5Max() const
Definition: GsfElectron.h:443
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::EDGetTokenT< reco::TrackCollection > isolTrkToken
double hltEMIsolInnerConeEE_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void setEvtTrigBits(TrigCodes::TrigBitSet bits)
Definition: EgHLTOffEvt.h:57
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken
std::vector< edm::ParameterSet > trigCutParams_
double hltEleTrkIsolInnerCone_
edm::Handle< HBHERecHitCollection > hbheHits_
double hltPhoTrkIsolPtMin_
double hltEleTrkIsolZSpan_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken
void fillHLTDataPho(const reco::Photon &pho, OffPho::HLTData &hltData)
float sigmaIetaIeta() const
Definition: GsfElectron.h:440
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
double hltHadIsolInnerCone_
float electronPtSum(const reco::Track *const tr, const reco::TrackCollection *isoTracks)
Get Pt sum of tracks inside an isolation cone for electrons.
void setup(const edm::ParameterSet &)
T sqrt(T t)
Definition: SSEVec.h:18
std::string getL1SeedFilterOfPath(const HLTConfigProvider &hltConfig, const std::string &path)
double hltPhoTrkIsolZSpan_
std::vector< std::pair< std::string, int > > hltFiltersUsedWithNrCandsCut_
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEEToken
double hltEleTrkIsolRSpan_
float sigmaIetaIeta() const
Definition: Photon.h:237
double hltHadIsolOuterCone_
std::vector< int > getMinNrObjsRequiredByFilter(const std::vector< std::string > &filterName)
edm::EDGetTokenT< reco::PhotonCollection > photonsToken
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
float dr03TkSumPt() const
Definition: GsfElectron.h:552
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_
float dr03HcalDepth1TowerSumEt() const
Definition: GsfElectron.h:555
void setLooseCutCode(int code)
Definition: EgHLTOffPho.h:92
float e2x5() const
Definition: Photon.h:232
edm::Handle< std::vector< reco::CaloJet > > recoJets_
float sigmaEtaEta() const
Definition: Photon.h:236
double hltEleTrkIsolPtMin_
TrigCodes::TrigBitSet getFiltersPassed(const std::vector< std::pair< std::string, int > > &filters, const trigger::TriggerEvent *trigEvt, const std::string &hltTag, const TrigCodes &trigCodes)
int nTrkHollowConeDR03() const
Definition: Photon.h:459
void setCutCode(int code)
Definition: EgHLTOffEle.h:108
edm::ESHandle< MagneticField > magField_
edm::Handle< trigger::TriggerEvent > trigEvt_
edm::ESHandle< CaloGeometry > caloGeom_
const std::vector< OffPho > & phos() const
Definition: EgHLTOffEvt.h:50
double hltPhoTrkIsolInnerCone_
Definition: DetId.h:18
void setCutCode(int code)
Definition: EgHLTOffPho.h:91
double hltEMIsolEtaSliceEE_
double hltEMIsolInnerConeEB_
edm::Handle< reco::GsfElectronCollection > recoEles_
edm::EDGetTokenT< edm::TriggerResults > trigResultsToken
T const * product() const
Definition: Handle.h:74
edm::EDGetTokenT< HFRecHitCollection > hfHitsToken
edm::Handle< edm::TriggerResults > trigResults_
edm::ESHandle< CaloTopology > caloTopology_
float e1x5() const
Definition: GsfElectron.h:442
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
int makeOffEvt(const edm::Event &edmEvent, const edm::EventSetup &setup, egHLT::OffEvt &offEvent, const TrigCodes &trigCodes)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken
std::vector< std::string > l1PreScaledFilters_
float ecalEnergy() const
Definition: GsfElectron.h:860
void setJets(edm::Handle< std::vector< reco::CaloJet > > jets)
Definition: EgHLTOffEvt.h:58
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:554
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEBToken
edm::Handle< EcalRecHitCollection > eeRecHits_
const std::vector< OffEle > & eles() const
Definition: EgHLTOffEvt.h:48
float e5x5() const
Definition: GsfElectron.h:444
void setTrigCutsCutCodes(const std::vector< std::pair< TrigCodes::TrigBitSet, int > > &trigCutsCutCodes)
Definition: EgHLTOffEle.h:111
int getHandles(const edm::Event &event, const edm::EventSetup &setup)
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
double hltPhoTrkIsolOuterCone_
float ecalRecHitSumEtConeDR03() const
Isolation variables in cone dR=0.3.
Definition: Photon.h:439
edm::Handle< CaloTowerCollection > caloTowers_
edm::Handle< EcalRecHitCollection > ebRecHits_
std::vector< std::string > hltFiltersUsed_
edm::Handle< reco::VertexCollection > recoVertices_
T get() const
Definition: EventSetup.h:71
float r9() const
Definition: Photon.h:240
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
edm::ESHandle< EcalSeverityLevelAlgo > ecalSeverityLevel_
void setupTriggers(const HLTConfigProvider &config, const std::vector< std::string > &hltFiltersUsed, const TrigCodes &trigCodes)
EgammaHLTTrackIsolation * hltEleTrkIsolAlgo_
const Point & position() const
position
Definition: BeamSpot.h:62
edm::Handle< reco::BeamSpot > beamSpot_
std::string hltTag_
void setFiltersObjPasses(std::vector< T > &objs, const std::vector< std::string > &filters, const std::vector< std::pair< std::string, std::string > > &l1PreAndSeedFilters, const TrigCodes::TrigBitSet &evtTrigBits, const TrigCodes &trigCodes, const trigger::TriggerEvent *trigEvt, const std::string &hltTag)
std::bitset< maxNrBits_ > TrigBitSet
T const * product() const
Definition: ESHandle.h:86
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
float photonPtSum(const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
void translateFiltersToPathNames(const HLTConfigProvider &hltConfig, const std::vector< std::string > &filters, std::vector< std::string > &paths)
Definition: event.py:1
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
float sigmaEtaEta() const
Definition: GsfElectron.h:439
edm::EDGetTokenT< reco::VertexCollection > vertexToken
int fillOffEleVec(std::vector< OffEle > &offEles)