CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
testAnalyzer Class Reference
Inheritance diagram for testAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 testAnalyzer (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void endJob () override
 

Private Attributes

int DoubleTrigger_
 
TH1D * h_EtaDist_Pt80_
 
TH1D * h_numberMuon_
 
TH1D * h_numberMuon_ptStudy_
 
TH1D * h_numberTrigMuon_
 
TH1D * h_numberTrigMuon_ptStudy_
 
TH1D * h_pt_distribution_
 
double maxEta_
 
double maxPt_
 
double minEta_
 
double minPt_
 
int nbinsEta_
 
int nbinsEtaPt_
 
int nbinsPt_
 
int NoTrigger_
 
string pathName_
 
EDGetTokenT< vector< pat::Muon > > selectMuonToken_
 
int SingleTrigger_
 
vector< double > vectorEta
 
vector< double > vectorPt
 
int zmumuIncrement_
 
EDGetTokenT< CandidateViewzMuMuToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file triggerEfficiency.cc.

Constructor & Destructor Documentation

◆ testAnalyzer()

testAnalyzer::testAnalyzer ( const edm::ParameterSet pset)

Definition at line 54 of file triggerEfficiency.cc.

55  : selectMuonToken_(consumes<vector<pat::Muon> >(pset.getParameter<InputTag>("selectMuon"))),
56  zMuMuToken_(consumes<CandidateView>(pset.getParameter<InputTag>("ZMuMu"))),
57  pathName_(pset.getParameter<string>("pathName")),
58  nbinsEta_(pset.getParameter<int>("EtaBins")),
59  minEta_(pset.getParameter<double>("minEta")),
60  maxEta_(pset.getParameter<double>("maxEta")),
61  nbinsPt_(pset.getParameter<int>("PtBins")),
62  minPt_(pset.getParameter<double>("minPt")),
63  maxPt_(pset.getParameter<double>("maxPt")),
64  nbinsEtaPt_(pset.getParameter<int>("EtaPt80Bins")) {
65  SingleTrigger_ = 0;
66  DoubleTrigger_ = 0;
67  NoTrigger_ = 0;
68  zmumuIncrement_ = 0;
70  h_pt_distribution_ = fs->make<TH1D>("PtResolution ", "Pt Resolution", 200, -4., 4.);
71  h_numberMuon_ = fs->make<TH1D>("Denominatore", "Number of Muons vs Eta", nbinsEta_, minEta_, maxEta_);
73  fs->make<TH1D>("NumeratoreTrigMuon", "Number of Triggered Muons vs Eta", nbinsEta_, minEta_, maxEta_);
74  h_numberMuon_ptStudy_ = fs->make<TH1D>("DenominatorePtStudy", "Number of Muons vs Pt", nbinsPt_, minPt_, maxPt_);
76  fs->make<TH1D>("NumeratoreTrigMuonPtStudy", "Number of Triggered Muons vs Pt", nbinsPt_, minPt_, maxPt_);
77  h_EtaDist_Pt80_ = fs->make<TH1D>("EtaDistr", "Eta distribution (Pt>80)", nbinsEtaPt_, minEta_, maxEta_);
78 }

References DoubleTrigger_, h_EtaDist_Pt80_, h_numberMuon_, h_numberMuon_ptStudy_, h_numberTrigMuon_, h_numberTrigMuon_ptStudy_, h_pt_distribution_, TFileService::make(), maxEta_, maxPt_, minEta_, minPt_, nbinsEta_, nbinsEtaPt_, nbinsPt_, NoTrigger_, SingleTrigger_, and zmumuIncrement_.

Member Function Documentation

◆ analyze()

void testAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 80 of file triggerEfficiency.cc.

80  {
81  Handle<vector<pat::Muon> > selectMuon;
82  event.getByToken(selectMuonToken_, selectMuon);
84  event.getByToken(zMuMuToken_, zMuMu);
85  int zmumuSize = zMuMu->size();
86  if (zmumuSize > 0) {
87  for (int i = 0; i < zmumuSize; ++i) {
88  bool singleTrigFlag0 = false;
89  bool singleTrigFlag1 = false;
91  const Candidate& zMuMuCand = (*zMuMu)[i];
92  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
93  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
94  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0); //cast in patMuon
95  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
98  double EtaPatMu0 = mu0.eta();
99  double EtaPatMu1 = mu1.eta();
100  double PtPatMu0 = mu0.pt();
101  double PtPatMu1 = mu1.pt();
102  h_numberMuon_->Fill(EtaPatMu0);
103  h_numberMuon_->Fill(EtaPatMu1);
104  h_numberMuon_ptStudy_->Fill(PtPatMu0);
105  h_numberMuon_ptStudy_->Fill(PtPatMu1);
106  int dimTrig0 = mu0HLTMatches.size();
107  int dimTrig1 = mu1HLTMatches.size();
108  if (dimTrig0 != 0) {
109  for (int j = 0; j < dimTrig0; ++j) {
110  singleTrigFlag0 = true;
111  h_numberTrigMuon_->Fill(EtaPatMu0);
112  h_numberTrigMuon_ptStudy_->Fill(PtPatMu0);
113  double PtTrig = mu0HLTMatches[j].pt();
114  double PtDif = PtTrig - PtPatMu0;
115  h_pt_distribution_->Fill(PtDif);
116  }
117  } else {
118  if (PtPatMu0 > 80) {
119  h_EtaDist_Pt80_->Fill(EtaPatMu0);
120  vectorPt.push_back(PtPatMu0);
121  vectorEta.push_back(EtaPatMu0);
122  }
123  }
124  if (dimTrig1 != 0) {
125  for (int j = 0; j < dimTrig1; ++j) {
126  singleTrigFlag1 = true;
127  h_numberTrigMuon_->Fill(EtaPatMu1);
128  h_numberTrigMuon_ptStudy_->Fill(PtPatMu1);
129  double PtTrig = mu0HLTMatches[j].pt();
130  double PtDif = PtTrig - PtPatMu1;
131  h_pt_distribution_->Fill(PtDif);
132  }
133  } else {
134  if (PtPatMu0 > 80) {
135  h_EtaDist_Pt80_->Fill(EtaPatMu1);
136  vectorPt.push_back(PtPatMu0);
137  vectorEta.push_back(EtaPatMu0);
138  }
139  }
140 
141  if (singleTrigFlag0 && singleTrigFlag1)
142  DoubleTrigger_++;
143  if (singleTrigFlag0 && !singleTrigFlag1)
144  SingleTrigger_++;
145  if (!singleTrigFlag0 && singleTrigFlag1)
146  SingleTrigger_++;
147  if (!singleTrigFlag0 && !singleTrigFlag1)
148  NoTrigger_++;
149 
150  } //end loop on ZMuMu candidates
151  } //end check on ZMuMu
152 }

References reco::Candidate::daughter(), DoubleTrigger_, reco::LeafCandidate::eta(), h_EtaDist_Pt80_, h_numberMuon_, h_numberMuon_ptStudy_, h_numberTrigMuon_, h_numberTrigMuon_ptStudy_, h_pt_distribution_, mps_fire::i, dqmiolumiharvest::j, reco::Candidate::masterClone(), NoTrigger_, pathName_, reco::LeafCandidate::pt(), selectMuonToken_, SingleTrigger_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), vectorEta, vectorPt, ZMuMuAnalysisNtupler_cff::zMuMu, zmumuIncrement_, and zMuMuToken_.

◆ endJob()

void testAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file triggerEfficiency.cc.

154  {
155  cout << "DoubleTrigger = " << DoubleTrigger_ << " , SingleTrigger = " << SingleTrigger_
156  << " , NoTrigger = " << NoTrigger_ << " ,zmumuIncrement = " << zmumuIncrement_ << endl;
157  double OneTrig = (double)SingleTrigger_ / (double)zmumuIncrement_;
158  double DoubleTrig = (double)DoubleTrigger_ / (double)zmumuIncrement_;
159  cout << "eps^2 = " << DoubleTrig << endl;
160  cout << "2eps(1 - eps) = " << OneTrig << endl;
161  int dimVec = vectorPt.size();
162  for (int i = 0; i < dimVec; ++i)
163  cout << "Pt = " << vectorPt[i] << " ==> Eta = " << vectorEta[i] << endl;
164 }

References gather_cfg::cout, DoubleTrigger_, mps_fire::i, NoTrigger_, SingleTrigger_, vectorEta, vectorPt, and zmumuIncrement_.

Member Data Documentation

◆ DoubleTrigger_

int testAnalyzer::DoubleTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze(), endJob(), and testAnalyzer().

◆ h_EtaDist_Pt80_

TH1D* testAnalyzer::h_EtaDist_Pt80_
private

Definition at line 50 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ h_numberMuon_

TH1D * testAnalyzer::h_numberMuon_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ h_numberMuon_ptStudy_

TH1D * testAnalyzer::h_numberMuon_ptStudy_
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ h_numberTrigMuon_

TH1D* testAnalyzer::h_numberTrigMuon_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ h_numberTrigMuon_ptStudy_

TH1D* testAnalyzer::h_numberTrigMuon_ptStudy_
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ h_pt_distribution_

TH1D* testAnalyzer::h_pt_distribution_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

◆ maxEta_

double testAnalyzer::maxEta_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ maxPt_

double testAnalyzer::maxPt_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ minEta_

double testAnalyzer::minEta_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ minPt_

double testAnalyzer::minPt_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ nbinsEta_

int testAnalyzer::nbinsEta_
private

Definition at line 42 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ nbinsEtaPt_

int testAnalyzer::nbinsEtaPt_
private

Definition at line 46 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ nbinsPt_

int testAnalyzer::nbinsPt_
private

Definition at line 44 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

◆ NoTrigger_

int testAnalyzer::NoTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze(), endJob(), and testAnalyzer().

◆ pathName_

string testAnalyzer::pathName_
private

Definition at line 41 of file triggerEfficiency.cc.

Referenced by analyze().

◆ selectMuonToken_

EDGetTokenT<vector<pat::Muon> > testAnalyzer::selectMuonToken_
private

Definition at line 39 of file triggerEfficiency.cc.

Referenced by analyze().

◆ SingleTrigger_

int testAnalyzer::SingleTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze(), endJob(), and testAnalyzer().

◆ vectorEta

vector<double> testAnalyzer::vectorEta
private

Definition at line 51 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

◆ vectorPt

vector<double> testAnalyzer::vectorPt
private

Definition at line 51 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

◆ zmumuIncrement_

int testAnalyzer::zmumuIncrement_
private

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze(), endJob(), and testAnalyzer().

◆ zMuMuToken_

EDGetTokenT<CandidateView> testAnalyzer::zMuMuToken_
private

Definition at line 40 of file triggerEfficiency.cc.

Referenced by analyze().

reco::Candidate::daughter
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
testAnalyzer::minEta_
double minEta_
Definition: triggerEfficiency.cc:43
testAnalyzer::nbinsEtaPt_
int nbinsEtaPt_
Definition: triggerEfficiency.cc:46
mps_fire.i
i
Definition: mps_fire.py:355
ZMuMuAnalysisNtupler_cff.zMuMu
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
Definition: ZMuMuAnalysisNtupler_cff.py:340
testAnalyzer::maxPt_
double maxPt_
Definition: triggerEfficiency.cc:45
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
testAnalyzer::h_numberTrigMuon_
TH1D * h_numberTrigMuon_
Definition: triggerEfficiency.cc:48
edm::Handle
Definition: AssociativeIterator.h:50
testAnalyzer::nbinsEta_
int nbinsEta_
Definition: triggerEfficiency.cc:42
testAnalyzer::DoubleTrigger_
int DoubleTrigger_
Definition: triggerEfficiency.cc:38
testAnalyzer::pathName_
string pathName_
Definition: triggerEfficiency.cc:41
testAnalyzer::h_numberMuon_
TH1D * h_numberMuon_
Definition: triggerEfficiency.cc:48
testAnalyzer::selectMuonToken_
EDGetTokenT< vector< pat::Muon > > selectMuonToken_
Definition: triggerEfficiency.cc:39
testAnalyzer::vectorEta
vector< double > vectorEta
Definition: triggerEfficiency.cc:51
testAnalyzer::vectorPt
vector< double > vectorPt
Definition: triggerEfficiency.cc:51
testAnalyzer::nbinsPt_
int nbinsPt_
Definition: triggerEfficiency.cc:44
testAnalyzer::minPt_
double minPt_
Definition: triggerEfficiency.cc:45
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
testAnalyzer::zMuMuToken_
EDGetTokenT< CandidateView > zMuMuToken_
Definition: triggerEfficiency.cc:40
testAnalyzer::h_numberMuon_ptStudy_
TH1D * h_numberMuon_ptStudy_
Definition: triggerEfficiency.cc:49
edm::Service< TFileService >
pat::TriggerObjectStandAloneCollection
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
Definition: TriggerObjectStandAlone.h:219
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
testAnalyzer::maxEta_
double maxEta_
Definition: triggerEfficiency.cc:43
reco::Candidate
Definition: Candidate.h:27
testAnalyzer::zmumuIncrement_
int zmumuIncrement_
Definition: triggerEfficiency.cc:38
edm::RefToBase< Candidate >
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
testAnalyzer::SingleTrigger_
int SingleTrigger_
Definition: triggerEfficiency.cc:38
testAnalyzer::NoTrigger_
int NoTrigger_
Definition: triggerEfficiency.cc:38
testAnalyzer::h_numberTrigMuon_ptStudy_
TH1D * h_numberTrigMuon_ptStudy_
Definition: triggerEfficiency.cc:49
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
testAnalyzer::h_EtaDist_Pt80_
TH1D * h_EtaDist_Pt80_
Definition: triggerEfficiency.cc:50
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
testAnalyzer::h_pt_distribution_
TH1D * h_pt_distribution_
Definition: triggerEfficiency.cc:47