CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
modules::ZHLTMatchFilter Struct Reference

Public Member Functions

bool operator() (const reco::Candidate &z) const
 
 ZHLTMatchFilter (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 

Private Attributes

std::string cond_
 
std::string hltPath_
 

Detailed Description

Definition at line 18 of file ZHLTMatchFilter.cc.

Constructor & Destructor Documentation

modules::ZHLTMatchFilter::ZHLTMatchFilter ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)
inline

Definition at line 19 of file ZHLTMatchFilter.cc.

19  :
20  cond_(cfg.getParameter<std::string >("condition")),
21  hltPath_(cfg.getParameter<std::string >("hltPath")){ }
T getParameter(std::string const &) const

Member Function Documentation

bool modules::ZHLTMatchFilter::operator() ( const reco::Candidate z) const
inline

Definition at line 22 of file ZHLTMatchFilter.cc.

References assert(), edm::errors::Configuration, reco::Candidate::daughter(), reco::Candidate::isGlobalMuon(), reco::Candidate::isStandAloneMuon(), reco::Candidate::isTrackerMuon(), reco::Candidate::masterClone(), reco::Candidate::numberOfDaughters(), and pat::PATObject< ObjectType >::triggerObjectMatchesByPath().

22  {
23  assert(z.numberOfDaughters()==2);
24  bool singleTrigFlag0 = false;
25  bool singleTrigFlag1 = false;
26  bool exactlyOneTriggerFlag = false;
27  bool bothTriggerFlag = false;
28  bool atLeastOneTriggerFlag=false;
29  bool FirstTriggerFlag = false;
30  bool globalisTriggerFlag =false;
31  if((((cond_ !="exactlyOneMatched" && cond_!="atLeastOneMatched") && cond_ !="bothMatched") && cond_ != "firstMatched") && cond_ != "globalisMatched")
33  << "Invalid condition type: " << cond_ << ". Valid types are:"
34  << " exactlyOneMatched, atLeastOneMatched, bothMatched, firstMatched,globalisMatched\n";
35  const reco::Candidate* dau0 = z.daughter(0);
36  const reco::Candidate * m0 = &*dau0->masterClone();
37  const pat::Muon * mu0 = dynamic_cast<const pat::Muon*>(m0);//cast in patMuon
38  bool firstismuon = (dau0->isGlobalMuon() ? true : false);
39  bool firstisStandAlone = (dau0->isStandAloneMuon() ? true : false);
40  bool firstisTrackerMuon = (dau0->isTrackerMuon() ? true : false);
41  if(mu0 != 0 && (firstismuon ||firstisStandAlone||firstisTrackerMuon )){
42  // get the vector of trigger objects matched to the muon corresponding to hltPath_
43  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
45 
46  int dimTrig0 = mu0HLTMatches.size();
47  if(dimTrig0 !=0 ){
48  singleTrigFlag0 = true;
49  }
50  }
51  const reco::Candidate* dau1 = z.daughter(1);
52  const reco::Candidate * m1 = &*dau1->masterClone();
53  bool secondismuon = (dau1->isGlobalMuon() ? true : false);
54  bool secondisStandAlone = (dau1->isStandAloneMuon() ? true : false);
55  bool secondisTrackerMuon = (dau1->isTrackerMuon() ? true : false);
56  const pat::Muon * mu1 = dynamic_cast<const pat::Muon*>(m1);
57  if(mu1 != 0 && (secondismuon ||secondisStandAlone||secondisTrackerMuon ) ){
58  // get the vector of trigger objects matched to the muon corresponding to hltPath_
59  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
61 
62  int dimTrig1 = mu1HLTMatches.size();
63  if(dimTrig1 !=0){
64  singleTrigFlag1 = true;
65  }
66  }
67  if(!singleTrigFlag0 && !singleTrigFlag1)return false;
68  if((singleTrigFlag0 && singleTrigFlag1) && firstismuon && secondismuon ) bothTriggerFlag = true;
69  if(((singleTrigFlag0 && !singleTrigFlag1) && firstismuon && secondismuon) || ((!singleTrigFlag0 && singleTrigFlag1) && firstismuon && secondismuon)) exactlyOneTriggerFlag = true;
70  if((((singleTrigFlag0 && firstismuon) && (secondisStandAlone || secondisTrackerMuon ) ) && !secondismuon ) || (((singleTrigFlag1 && secondismuon) && (firstisStandAlone|| firstisTrackerMuon) ) && !firstismuon))globalisTriggerFlag = true;
71 
72  if((singleTrigFlag0 && !singleTrigFlag1) && !secondismuon) FirstTriggerFlag = true;
73  if((singleTrigFlag0 || singleTrigFlag1) && firstismuon && secondismuon) atLeastOneTriggerFlag=true;
74  if(cond_=="exactlyOneMatched") return exactlyOneTriggerFlag;
75  if(cond_=="atLeastOneMatched") return atLeastOneTriggerFlag;
76  if(cond_=="bothMatched") return bothTriggerFlag;
77  if(cond_=="firstMatched") return FirstTriggerFlag;
78  if(cond_=="globalisMatched") return globalisTriggerFlag;
79 
80  return false;
81  }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
assert(m_qm.get())
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
virtual size_type numberOfDaughters() const =0
number of daughters
virtual bool isStandAloneMuon() const =0
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:610
virtual bool isTrackerMuon() const =0
Analysis-level muon class.
Definition: Muon.h:49
virtual bool isGlobalMuon() const =0
virtual const CandidateBaseRef & masterClone() const =0

Member Data Documentation

std::string modules::ZHLTMatchFilter::cond_
private

Definition at line 84 of file ZHLTMatchFilter.cc.

std::string modules::ZHLTMatchFilter::hltPath_
private

Definition at line 85 of file ZHLTMatchFilter.cc.