CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1Muon2RecoTreeProducer Class Reference
Inheritance diagram for L1Muon2RecoTreeProducer:
edm::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void empty_hlt ()
 
 L1Muon2RecoTreeProducer (const edm::ParameterSet &)
 
double match_trigger (std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon &mu)
 
 ~L1Muon2RecoTreeProducer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

L1Analysis::L1AnalysisRecoMuon2muon
 
L1Analysis::L1AnalysisRecoMuon2DataFormatmuon_data
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

edm::Service< TFileServicefs_
 
HLTConfigProvider hltConfig_
 
std::vector< int > isoTriggerIndices_
 
std::vector< std::string > isoTriggerNames_
 
edm::Handle< std::vector< std::string > > isoTriggerNamesToken_
 
edm::Handle< edm::TriggerResultsisoTriggerToken_
 
unsigned int maxMuon_
 
edm::EDGetTokenT< reco::PFMETCollectionmetToken_
 
edm::EDGetTokenT< reco::MuonCollectionMuonToken_
 
TTree * tree_
 
std::vector< int > triggerIndices_
 
bool triggerMatching_
 
double triggerMaxDeltaR_
 
std::vector< std::string > triggerNames_
 
std::string triggerProcessLabel_
 
edm::EDGetTokenT< edm::TriggerResultsTriggerResultsToken_
 
edm::EDGetTokenT< trigger::TriggerEventtriggerSummaryLabelToken_
 
edm::EDGetTokenT< reco::VertexCollectionVtxToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 85 of file L1Muon2RecoTreeProducer.cc.

Constructor & Destructor Documentation

◆ L1Muon2RecoTreeProducer()

L1Muon2RecoTreeProducer::L1Muon2RecoTreeProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 145 of file L1Muon2RecoTreeProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::kSharedResource, and AlCaHLTBitMon_QueryRunRegistry::string.

145  {
146  usesResource(TFileService::kSharedResource);
147 
148  maxMuon_ = iConfig.getParameter<unsigned int>("maxMuon");
149  isoTriggerNames_ = iConfig.getParameter<std::vector<std::string>>("isoTriggerNames");
150  // isoTriggerToken_ = iConfig.getParameter<std::vector<std::string>>("isoTriggerNames");
151  // TriggerToken_ = iConfig.getParameter<std::vector<std::string>>("triggerNames");
152  MuonToken_ = consumes<reco::MuonCollection>(iConfig.getUntrackedParameter("MuonToken", edm::InputTag("muons")));
153  VtxToken_ = consumes<reco::VertexCollection>(
154  iConfig.getUntrackedParameter("VertexToken", edm::InputTag("offlinePrimaryVertices")));
155 
156  TriggerResultsToken_ = consumes<edm::TriggerResults>(
157  iConfig.getUntrackedParameter("TriggerResultsToken", edm::InputTag("TriggerResults", "", "HLT")));
158  triggerSummaryLabelToken_ = consumes<trigger::TriggerEvent>(
159  iConfig.getUntrackedParameter("triggerSummaryLabelToken", edm::InputTag("hltTriggerSummaryAOD", "", "HLT")));
160  // TriggerResultsToken_ = consumes<edm::TriggerResults>(iConfig.getUntrackedParameter("TriggerResultsToken",edm::InputTag("triggerSummaryLabel")));
161  // triggerSummaryLabelToken_ = consumes<trigger::TriggerEvent>(iConfig.getUntrackedParameter("triggerSummaryLabelToken",edm::InputTag("triggerSummaryLabel")));
162  //iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
163  metToken_ = consumes<reco::PFMETCollection>(iConfig.getUntrackedParameter("metToken", edm::InputTag("pfMet")));
164 
166  muon_data = muon->getData();
167 
168  tree_ = fs_->make<TTree>("Muon2RecoTree", "Muon2RecoTree");
169  tree_->Branch("Muon", "L1Analysis::L1AnalysisRecoMuon2DataFormat", &muon_data, 32000, 3);
170 
171  triggerMaxDeltaR_ = iConfig.getParameter<double>("triggerMaxDeltaR");
172  triggerMatching_ = iConfig.getUntrackedParameter<bool>("triggerMatching");
173  triggerProcessLabel_ = iConfig.getUntrackedParameter<std::string>("triggerProcessLabel");
174  isoTriggerNames_ = iConfig.getParameter<std::vector<std::string>>("isoTriggerNames");
175  triggerNames_ = iConfig.getParameter<std::vector<std::string>>("triggerNames");
176 
177  // triggerMatching_ = iConfig.getUntrackedParameter<bool>("triggerMatching");
178  // _ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
179  // triggerProcessLabel_ = iConfig.getUntrackedParameter<std::string>("triggerProcessLabel");
180  // triggerNames_ = iConfig.getParameter<std::vector<std::string> > ("triggerNames");
181  // isoTriggerNames_ = iConfig.getParameter<std::vector<std::string> > ("isoTriggerNames");
182  // triggerMaxDeltaR_ = iConfig.getParameter<double> ("triggerMaxDeltaR");
183 }
static const std::string kSharedResource
Definition: TFileService.h:76
L1Analysis::L1AnalysisRecoMuon2DataFormat * muon_data
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::MuonCollection > MuonToken_
edm::Service< TFileService > fs_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::TriggerResults > TriggerResultsToken_
edm::EDGetTokenT< reco::VertexCollection > VtxToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryLabelToken_
std::vector< std::string > triggerNames_
edm::EDGetTokenT< reco::PFMETCollection > metToken_
std::vector< std::string > isoTriggerNames_

◆ ~L1Muon2RecoTreeProducer()

L1Muon2RecoTreeProducer::~L1Muon2RecoTreeProducer ( )
override

Definition at line 185 of file L1Muon2RecoTreeProducer.cc.

185  {
186  // do anything here that needs to be done at desctruction time
187  // (e.g. close files, deallocate resources etc.)
188 }

Member Function Documentation

◆ analyze()

void L1Muon2RecoTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 194 of file L1Muon2RecoTreeProducer.cc.

References trigger::TriggerEvent::getObjects(), iEvent, edm::HandleBase::isValid(), hltdqm::passTrig(), hltMonBTagIPClient_cfi::pathName, AlCaHLTBitMon_QueryRunRegistry::string, triggerMatchMonitor_cfi::triggerObjects, triggerResults, trigNames, and AlignmentTracksFromVertexSelector_cfi::vertices.

194  {
195  muon->init(iSetup);
196 
197  muon->Reset();
199  iEvent.getByToken(MuonToken_, recoMuons);
200 
202  iEvent.getByToken(VtxToken_, vertices);
203 
206 
207  edm::Handle<trigger::TriggerEvent> triggerSummaryLabel_;
208  iEvent.getByToken(triggerSummaryLabelToken_, triggerSummaryLabel_);
209 
211  iEvent.getByToken(metToken_, metLabel_);
212 
213  int counter_met = 0;
214 
215  double METx = 0.;
216  double METy = 0.;
217 
218  for (reco::PFMETCollection::const_iterator imet = metLabel_->begin();
219  imet != metLabel_->end() && (unsigned)counter_met < 1;
220  imet++) {
221  METx = imet->px();
222  METy = imet->py();
223  }
224 
225  if (recoMuons.isValid()) {
226  muon->SetMuon(iEvent, iSetup, recoMuons, vertices, METx, METy, maxMuon_);
227  } else {
228  }
229 
230  int counter_mu = 0;
231  for (reco::MuonCollection::const_iterator imu = recoMuons->begin();
232  imu != recoMuons->end() && (unsigned)counter_mu < maxMuon_;
233  imu++) {
234  //---------------------------------------------------------------------
235  // TRIGGER MATCHING:
236  // if specified the reconstructed muons are matched to a trigger
237  //---------------------------------------------------------------------
238  if (triggerMatching_) {
239  double isoMatchDeltaR = 9999.;
240  double matchDeltaR = 9999.;
241  int hasIsoTriggered = 0;
242  int hasTriggered = 0;
243 
244  int passesSingleMuonFlag = 0;
245 
246  // first check if the trigger results are valid:
247  if (triggerResults.isValid()) {
248  if (triggerSummaryLabel_.isValid()) {
249  const edm::TriggerNames &trigNames = iEvent.triggerNames(*triggerResults);
250  // for(UInt_t iPath = 0 ; iPath < trigNames.size() ; ++iPath)
251  // {
252  // cout<<iPath<<": "<<trigNames.triggerName(iPath)<<endl;
253  // }
254 
255  for (UInt_t iPath = 0; iPath < isoTriggerNames_.size(); ++iPath) {
256  if (passesSingleMuonFlag == 1)
257  continue;
259 
260  bool passTrig = false;
261  //cout<<"testing pathName = "<<pathName<<endl;
262  //cout<<"trigNames.triggerIndex(pathName) = "<<trigNames.triggerIndex(pathName)<<endl;
263  // cout<<"trigNames.triggerIndex(pathName)<trigNames.size()= "<<(trigNames.triggerIndex(pathName)<trigNames.size())<<endl;
264 
265  if (trigNames.triggerIndex(pathName) < trigNames.size())
266  passTrig = triggerResults->accept(trigNames.triggerIndex(pathName));
267  // cout<<"pass = "<<passTrig<<endl;
268  if (passTrig)
269  passesSingleMuonFlag = 1;
270  }
271 
272  if (triggerSummaryLabel_.isValid()) {
273  // get trigger objects:
274  const trigger::TriggerObjectCollection triggerObjects = triggerSummaryLabel_->getObjects();
275 
276  matchDeltaR = match_trigger(triggerIndices_, triggerObjects, triggerSummaryLabel_, (*imu));
277  if (matchDeltaR < triggerMaxDeltaR_)
278  hasTriggered = 1;
279 
280  // cout<<"isoTriggerIndices_.size() = "<<isoTriggerIndices_.size()<<endl;
281  // cout<<"triggerObjects.size() = "<<triggerObjects.size()<<endl;
282  // cout<<"imu->eta() = "<<imu->eta()<<endl;
283 
284  isoMatchDeltaR = match_trigger(isoTriggerIndices_, triggerObjects, triggerSummaryLabel_, (*imu));
285  if (isoMatchDeltaR < triggerMaxDeltaR_)
286  hasIsoTriggered = 1;
287 
288  } // end if (triggerEvent.isValid())
289 
290  } // end if (triggerResults.isValid())
291 
292  } // end if (triggerResults.isValid())
293 
294  // fill trigger matching variables:
295  muon_data->hlt_isomu.push_back(hasIsoTriggered);
296  muon_data->hlt_mu.push_back(hasTriggered);
297  muon_data->hlt_isoDeltaR.push_back(isoMatchDeltaR);
298  muon_data->hlt_deltaR.push_back(matchDeltaR);
299  muon_data->passesSingleMuon.push_back(passesSingleMuonFlag);
300 
301  } else {
302  empty_hlt();
303  } // end if (triggerMatching_)
304  }
305 
306  tree_->Fill();
307 }
L1Analysis::L1AnalysisRecoMuon2DataFormat * muon_data
double match_trigger(std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon &mu)
edm::EDGetTokenT< reco::MuonCollection > MuonToken_
int iEvent
Definition: GenABIO.cc:224
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
static std::string const triggerResults
Definition: EdmProvDump.cc:44
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::TriggerResults > TriggerResultsToken_
edm::EDGetTokenT< reco::VertexCollection > VtxToken_
std::vector< int > isoTriggerIndices_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryLabelToken_
edm::EDGetTokenT< reco::PFMETCollection > metToken_
bool passTrig(const float objEta, float objPhi, const trigger::TriggerEvent &trigEvt, const std::string &filterName, const std::string &processName)
Definition: UtilFuncs.h:14
std::vector< std::string > isoTriggerNames_

◆ beginJob()

void L1Muon2RecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 310 of file L1Muon2RecoTreeProducer.cc.

310 {}

◆ beginRun()

void L1Muon2RecoTreeProducer::beginRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 359 of file L1Muon2RecoTreeProducer.cc.

References cms::cuda::assert(), gather_cfg::cout, options_cfi::eventSetup, createfilelist::int, and writedatasetfile::run.

359  {
360  // Prepare for trigger matching for each new run:
361  // Look up triggetIndices in the HLT config for the different paths
362  if (triggerMatching_) {
363  bool changed = true;
365  // if you can't initialize hlt configuration, crash!
366  std::cout << "Error: didn't find process" << triggerProcessLabel_ << std::endl;
367  assert(false);
368  }
369 
370  bool enableWildcard = true;
371  for (size_t iTrig = 0; iTrig < triggerNames_.size(); ++iTrig) {
372  // prepare for regular expression (with wildcards) functionality:
373  TString tNameTmp = TString(triggerNames_[iTrig]);
374  TRegexp tNamePattern = TRegexp(tNameTmp, enableWildcard);
375  int tIndex = -1;
376  // find the trigger index:
377  for (unsigned ipath = 0; ipath < hltConfig_.size(); ++ipath) {
378  // use TString since it provides reg exp functionality:
379  TString tmpName = TString(hltConfig_.triggerName(ipath));
380  if (tmpName.Contains(tNamePattern)) {
381  tIndex = int(ipath);
382  triggerIndices_.push_back(tIndex);
383  }
384  }
385  if (tIndex < 0) { // if can't find trigger path at all, give warning:
386  std::cout << "Warning: Could not find trigger" << triggerNames_[iTrig] << std::endl;
387  //assert(false);
388  }
389  } // end for triggerNames
390  for (size_t iTrig = 0; iTrig < isoTriggerNames_.size(); ++iTrig) {
391  // prepare for regular expression functionality:
392  TString tNameTmp = TString(isoTriggerNames_[iTrig]);
393  TRegexp tNamePattern = TRegexp(tNameTmp, enableWildcard);
394  int tIndex = -1;
395  // find the trigger index:
396  for (unsigned ipath = 0; ipath < hltConfig_.size(); ++ipath) {
397  // use TString since it provides reg exp functionality:
398  TString tmpName = TString(hltConfig_.triggerName(ipath));
399  if (tmpName.Contains(tNamePattern)) {
400  tIndex = int(ipath);
401  isoTriggerIndices_.push_back(tIndex);
402  }
403  }
404  if (tIndex < 0) { // if can't find trigger path at all, give warning:
405  std::cout << "Warning: Could not find trigger" << isoTriggerNames_[iTrig] << std::endl;
406  //assert(false);
407  }
408  } // end for isoTriggerNames
409  } // end if (triggerMatching_)
410 }
const std::string & triggerName(unsigned int triggerIndex) const
assert(be >=bs)
unsigned int size() const
number of trigger paths in trigger table
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< int > isoTriggerIndices_
std::vector< std::string > triggerNames_
std::vector< std::string > isoTriggerNames_

◆ empty_hlt()

void L1Muon2RecoTreeProducer::empty_hlt ( )

Definition at line 315 of file L1Muon2RecoTreeProducer.cc.

315  {
316  muon_data->hlt_isomu.push_back(-9999);
317  muon_data->hlt_mu.push_back(-9999);
318  muon_data->hlt_isoDeltaR.push_back(-9999);
319  muon_data->hlt_deltaR.push_back(-9999);
320 }
L1Analysis::L1AnalysisRecoMuon2DataFormat * muon_data

◆ endJob()

void L1Muon2RecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 313 of file L1Muon2RecoTreeProducer.cc.

313 {}

◆ endRun()

void L1Muon2RecoTreeProducer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 94 of file L1Muon2RecoTreeProducer.cc.

94 {}

◆ match_trigger()

double L1Muon2RecoTreeProducer::match_trigger ( std::vector< int > &  trigIndices,
const trigger::TriggerObjectCollection trigObjs,
edm::Handle< trigger::TriggerEvent > &  triggerEvent,
const reco::Muon mu 
)

Definition at line 322 of file L1Muon2RecoTreeProducer.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, amptDefaultParameters_cff::mu, PDWG_DiPhoton_SD_cff::triggerEvent, and TriggerAnalyzer::trigObjs.

325  {
326  double matchDeltaR = 9999;
327 
328  for (size_t iTrigIndex = 0; iTrigIndex < trigIndices.size(); ++iTrigIndex) {
329  int triggerIndex = trigIndices[iTrigIndex];
330  const std::vector<std::string> moduleLabels(hltConfig_.moduleLabels(triggerIndex));
331  // find index of the last module:
332  const unsigned moduleIndex = hltConfig_.size(triggerIndex) - 2;
333  // find index of HLT trigger name:
334  const unsigned hltFilterIndex =
335  triggerEvent->filterIndex(edm::InputTag(moduleLabels[moduleIndex], "", triggerProcessLabel_));
336 
337  if (hltFilterIndex < triggerEvent->sizeFilters()) {
338  const trigger::Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
339  const trigger::Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
340 
341  const unsigned nTriggers = triggerVids.size();
342  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
343  // loop over all trigger objects:
344  const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
345 
346  double dRtmp = deltaR(mu, trigObject);
347 
348  if (dRtmp < matchDeltaR) {
349  matchDeltaR = dRtmp;
350  }
351 
352  } // loop over different trigger objects
353  } // if trigger is in event (should apply hltFilter with used trigger...)
354  } // loop over muon candidates
355 
356  return matchDeltaR;
357 }
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
unsigned int size() const
number of trigger paths in trigger table
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< size_type > Keys
std::vector< int > Vids

Member Data Documentation

◆ fs_

edm::Service<TFileService> L1Muon2RecoTreeProducer::fs_
private

Definition at line 110 of file L1Muon2RecoTreeProducer.cc.

◆ hltConfig_

HLTConfigProvider L1Muon2RecoTreeProducer::hltConfig_
private

Definition at line 132 of file L1Muon2RecoTreeProducer.cc.

◆ isoTriggerIndices_

std::vector<int> L1Muon2RecoTreeProducer::isoTriggerIndices_
private

Definition at line 141 of file L1Muon2RecoTreeProducer.cc.

◆ isoTriggerNames_

std::vector<std::string> L1Muon2RecoTreeProducer::isoTriggerNames_
private

Definition at line 139 of file L1Muon2RecoTreeProducer.cc.

◆ isoTriggerNamesToken_

edm::Handle<std::vector<std::string> > L1Muon2RecoTreeProducer::isoTriggerNamesToken_
private

Definition at line 129 of file L1Muon2RecoTreeProducer.cc.

◆ isoTriggerToken_

edm::Handle<edm::TriggerResults> L1Muon2RecoTreeProducer::isoTriggerToken_
private

Definition at line 128 of file L1Muon2RecoTreeProducer.cc.

◆ maxMuon_

unsigned int L1Muon2RecoTreeProducer::maxMuon_
private

Definition at line 135 of file L1Muon2RecoTreeProducer.cc.

◆ metToken_

edm::EDGetTokenT<reco::PFMETCollection> L1Muon2RecoTreeProducer::metToken_
private

Definition at line 120 of file L1Muon2RecoTreeProducer.cc.

◆ muon

L1Analysis::L1AnalysisRecoMuon2* L1Muon2RecoTreeProducer::muon

Definition at line 98 of file L1Muon2RecoTreeProducer.cc.

◆ muon_data

L1Analysis::L1AnalysisRecoMuon2DataFormat* L1Muon2RecoTreeProducer::muon_data

Definition at line 100 of file L1Muon2RecoTreeProducer.cc.

◆ MuonToken_

edm::EDGetTokenT<reco::MuonCollection> L1Muon2RecoTreeProducer::MuonToken_
private

Definition at line 116 of file L1Muon2RecoTreeProducer.cc.

◆ tree_

TTree* L1Muon2RecoTreeProducer::tree_
private

Definition at line 113 of file L1Muon2RecoTreeProducer.cc.

◆ triggerIndices_

std::vector<int> L1Muon2RecoTreeProducer::triggerIndices_
private

Definition at line 142 of file L1Muon2RecoTreeProducer.cc.

◆ triggerMatching_

bool L1Muon2RecoTreeProducer::triggerMatching_
private

Definition at line 137 of file L1Muon2RecoTreeProducer.cc.

◆ triggerMaxDeltaR_

double L1Muon2RecoTreeProducer::triggerMaxDeltaR_
private

Definition at line 136 of file L1Muon2RecoTreeProducer.cc.

◆ triggerNames_

std::vector<std::string> L1Muon2RecoTreeProducer::triggerNames_
private

Definition at line 140 of file L1Muon2RecoTreeProducer.cc.

◆ triggerProcessLabel_

std::string L1Muon2RecoTreeProducer::triggerProcessLabel_
private

Definition at line 138 of file L1Muon2RecoTreeProducer.cc.

◆ TriggerResultsToken_

edm::EDGetTokenT<edm::TriggerResults> L1Muon2RecoTreeProducer::TriggerResultsToken_
private

Definition at line 117 of file L1Muon2RecoTreeProducer.cc.

◆ triggerSummaryLabelToken_

edm::EDGetTokenT<trigger::TriggerEvent> L1Muon2RecoTreeProducer::triggerSummaryLabelToken_
private

Definition at line 118 of file L1Muon2RecoTreeProducer.cc.

◆ VtxToken_

edm::EDGetTokenT<reco::VertexCollection> L1Muon2RecoTreeProducer::VtxToken_
private

Definition at line 119 of file L1Muon2RecoTreeProducer.cc.