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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 31 of file triggerEfficiency.cc.

Constructor & Destructor Documentation

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

Definition at line 54 of file triggerEfficiency.cc.

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_.

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 }
T getParameter(std::string const &) const
TH1D * h_numberMuon_ptStudy_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< vector< pat::Muon > > selectMuonToken_
EDGetTokenT< CandidateView > zMuMuToken_
TH1D * h_numberTrigMuon_
TH1D * h_pt_distribution_
TH1D * h_numberTrigMuon_ptStudy_

Member Function Documentation

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

Definition at line 80 of file triggerEfficiency.cc.

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_, edm::View< T >::size(), pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), vectorEta, vectorPt, ZMuMuAnalysisNtupler_cff::zMuMu, zmumuIncrement_, and zMuMuToken_.

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 }
double eta() const final
momentum pseudorapidity
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
TH1D * h_numberMuon_ptStudy_
vector< double > vectorEta
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
size_type size() const
double pt() const final
transverse momentum
EDGetTokenT< vector< pat::Muon > > selectMuonToken_
EDGetTokenT< CandidateView > zMuMuToken_
TH1D * h_numberTrigMuon_
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
virtual const CandidateBaseRef & masterClone() const =0
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
TH1D * h_pt_distribution_
TH1D * h_numberTrigMuon_ptStudy_
Analysis-level muon class.
Definition: Muon.h:51
vector< double > vectorPt
void testAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file triggerEfficiency.cc.

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

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 }
vector< double > vectorEta
vector< double > vectorPt

Member Data Documentation

int testAnalyzer::DoubleTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

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

TH1D* testAnalyzer::h_EtaDist_Pt80_
private

Definition at line 50 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_ptStudy_
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_ptStudy_
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_pt_distribution_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

double testAnalyzer::maxEta_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::maxPt_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minEta_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minPt_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEta_
private

Definition at line 42 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEtaPt_
private

Definition at line 46 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsPt_
private

Definition at line 44 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::NoTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

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

string testAnalyzer::pathName_
private

Definition at line 41 of file triggerEfficiency.cc.

Referenced by analyze().

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

Definition at line 39 of file triggerEfficiency.cc.

Referenced by analyze().

int testAnalyzer::SingleTrigger_
private

Definition at line 38 of file triggerEfficiency.cc.

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

vector<double> testAnalyzer::vectorEta
private

Definition at line 51 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

vector<double> testAnalyzer::vectorPt
private

Definition at line 51 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

int testAnalyzer::zmumuIncrement_
private

Definition at line 38 of file triggerEfficiency.cc.

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

EDGetTokenT<CandidateView> testAnalyzer::zMuMuToken_
private

Definition at line 40 of file triggerEfficiency.cc.

Referenced by analyze().