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

53  :
54  selectMuonToken_( consumes<vector<pat::Muon> >( pset.getParameter<InputTag>( "selectMuon" ) ) ),
55  zMuMuToken_( consumes<CandidateView>( pset.getParameter<InputTag>( "ZMuMu" ) ) ),
56  pathName_( pset.getParameter<string>( "pathName" ) ),
57  nbinsEta_( pset.getParameter<int>( "EtaBins" ) ),
58  minEta_( pset.getParameter<double>( "minEta" ) ),
59  maxEta_( pset.getParameter<double>( "maxEta" ) ),
60  nbinsPt_( pset.getParameter<int>( "PtBins" ) ),
61  minPt_( pset.getParameter<double>( "minPt" ) ),
62  maxPt_( pset.getParameter<double>( "maxPt" ) ),
63  nbinsEtaPt_( pset.getParameter<int>( "EtaPt80Bins" ) ){
64  SingleTrigger_= 0;
65  DoubleTrigger_= 0;
66  NoTrigger_= 0;
69  h_pt_distribution_ = fs->make<TH1D>("PtResolution ","Pt Resolution",200,-4.,4.);
70  h_numberMuon_ = fs->make<TH1D>("Denominatore","Number of Muons vs Eta",nbinsEta_,minEta_,maxEta_);
71  h_numberTrigMuon_ = fs->make<TH1D>("NumeratoreTrigMuon","Number of Triggered Muons vs Eta",nbinsEta_ ,minEta_,maxEta_);
72  h_numberMuon_ptStudy_ = fs->make<TH1D>("DenominatorePtStudy","Number of Muons vs Pt",nbinsPt_,minPt_,maxPt_);
73  h_numberTrigMuon_ptStudy_ = fs->make<TH1D>("NumeratoreTrigMuonPtStudy","Number of Triggered Muons vs Pt",nbinsPt_,minPt_,maxPt_);
74  h_EtaDist_Pt80_ = fs->make<TH1D>("EtaDistr","Eta distribution (Pt>80)",nbinsEtaPt_,minEta_,maxEta_);
75 }
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 77 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, reco::Candidate::masterClone(), NoTrigger_, pathName_, reco::LeafCandidate::pt(), selectMuonToken_, SingleTrigger_, edm::View< T >::size(), pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), vectorEta, vectorPt, zmumuIncrement_, and zMuMuToken_.

77  {
78  Handle<vector<pat::Muon> > selectMuon;
79  event.getByToken(selectMuonToken_, selectMuon);
81  event.getByToken(zMuMuToken_, zMuMu);
82  int zmumuSize = zMuMu->size();
83  if(zmumuSize > 0){
84  for( int i = 0; i < zmumuSize ; ++i){
85  bool singleTrigFlag0 = false;
86  bool singleTrigFlag1 = false;
88  const Candidate & zMuMuCand = (*zMuMu)[i];
89  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
90  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
91  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
92  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
93  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
95  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
97  double EtaPatMu0 = mu0.eta();
98  double EtaPatMu1 = mu1.eta();
99  double PtPatMu0 = mu0.pt();
100  double PtPatMu1 = mu1.pt();
101  h_numberMuon_->Fill(EtaPatMu0);
102  h_numberMuon_->Fill(EtaPatMu1);
103  h_numberMuon_ptStudy_->Fill(PtPatMu0);
104  h_numberMuon_ptStudy_->Fill(PtPatMu1);
105  int dimTrig0 = mu0HLTMatches.size();
106  int dimTrig1 = mu1HLTMatches.size();
107  if(dimTrig0 !=0){
108  for(int j = 0; j < dimTrig0 ; ++j){
109  singleTrigFlag0 = true;
110  h_numberTrigMuon_->Fill(EtaPatMu0);
111  h_numberTrigMuon_ptStudy_->Fill(PtPatMu0);
112  double PtTrig = mu0HLTMatches[j].pt();
113  double PtDif = PtTrig-PtPatMu0;
114  h_pt_distribution_->Fill(PtDif);
115  }
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  }
134  else{
135  if(PtPatMu0>80) {
136  h_EtaDist_Pt80_->Fill(EtaPatMu1);
137  vectorPt.push_back(PtPatMu0);
138  vectorEta.push_back(EtaPatMu0);
139  }
140  }
141 
142  if(singleTrigFlag0 && singleTrigFlag1)DoubleTrigger_++;
143  if(singleTrigFlag0 && !singleTrigFlag1)SingleTrigger_++;
144  if(!singleTrigFlag0 && singleTrigFlag1)SingleTrigger_++;
145  if(!singleTrigFlag0 && !singleTrigFlag1)NoTrigger_++;
146 
147  }//end loop on ZMuMu candidates
148  }//end check on ZMuMu
149 
150 }
double eta() const final
momentum pseudorapidity
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
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
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:612
virtual const CandidateBaseRef & masterClone() const =0
TH1D * h_pt_distribution_
TH1D * h_numberTrigMuon_ptStudy_
Analysis-level muon class.
Definition: Muon.h:50
vector< double > vectorPt
void testAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 152 of file triggerEfficiency.cc.

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

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

Member Data Documentation

int testAnalyzer::DoubleTrigger_
private

Definition at line 37 of file triggerEfficiency.cc.

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

TH1D* testAnalyzer::h_EtaDist_Pt80_
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_ptStudy_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_ptStudy_
private

Definition at line 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_pt_distribution_
private

Definition at line 46 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

double testAnalyzer::maxEta_
private

Definition at line 42 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::maxPt_
private

Definition at line 44 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minEta_
private

Definition at line 42 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minPt_
private

Definition at line 44 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEta_
private

Definition at line 41 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEtaPt_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsPt_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::NoTrigger_
private

Definition at line 37 of file triggerEfficiency.cc.

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

string testAnalyzer::pathName_
private

Definition at line 40 of file triggerEfficiency.cc.

Referenced by analyze().

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

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze().

int testAnalyzer::SingleTrigger_
private

Definition at line 37 of file triggerEfficiency.cc.

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

vector<double> testAnalyzer::vectorEta
private

Definition at line 50 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

vector<double> testAnalyzer::vectorPt
private

Definition at line 50 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

int testAnalyzer::zmumuIncrement_
private

Definition at line 37 of file triggerEfficiency.cc.

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

EDGetTokenT<CandidateView> testAnalyzer::zMuMuToken_
private

Definition at line 39 of file triggerEfficiency.cc.

Referenced by analyze().