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 Member Functions | Private Attributes
testAnalyzer Class Reference
Inheritance diagram for testAnalyzer:
edm::EDAnalyzer

Public Member Functions

 testAnalyzer (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

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_
 
InputTag selectMuon_
 
int SingleTrigger_
 
vector< double > vectorEta
 
vector< double > vectorPt
 
InputTag zMuMu_
 
int zmumuIncrement_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 31 of file triggerEfficiency.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file triggerEfficiency.cc.

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

52  :
53  selectMuon_( pset.getParameter<InputTag>( "selectMuon" ) ),
54  zMuMu_( pset.getParameter<InputTag>( "ZMuMu" ) ),
55  pathName_( pset.getParameter<string>( "pathName" ) ),
56  nbinsEta_( pset.getParameter<int>( "EtaBins" ) ),
57  minEta_( pset.getParameter<double>( "minEta" ) ),
58  maxEta_( pset.getParameter<double>( "maxEta" ) ),
59  nbinsPt_( pset.getParameter<int>( "PtBins" ) ),
60  minPt_( pset.getParameter<double>( "minPt" ) ),
61  maxPt_( pset.getParameter<double>( "maxPt" ) ),
62  nbinsEtaPt_( pset.getParameter<int>( "EtaPt80Bins" ) ){
63  SingleTrigger_= 0;
64  DoubleTrigger_= 0;
65  NoTrigger_= 0;
68  h_pt_distribution_ = fs->make<TH1D>("PtResolution ","Pt Resolution",200,-4.,4.);
69  h_numberMuon_ = fs->make<TH1D>("Denominatore","Number of Muons vs Eta",nbinsEta_,minEta_,maxEta_);
70  h_numberTrigMuon_ = fs->make<TH1D>("NumeratoreTrigMuon","Number of Triggered Muons vs Eta",nbinsEta_ ,minEta_,maxEta_);
71  h_numberMuon_ptStudy_ = fs->make<TH1D>("DenominatorePtStudy","Number of Muons vs Pt",nbinsPt_,minPt_,maxPt_);
72  h_numberTrigMuon_ptStudy_ = fs->make<TH1D>("NumeratoreTrigMuonPtStudy","Number of Triggered Muons vs Pt",nbinsPt_,minPt_,maxPt_);
73  h_EtaDist_Pt80_ = fs->make<TH1D>("EtaDistr","Eta distribution (Pt>80)",nbinsEtaPt_,minEta_,maxEta_);
74 }
T getParameter(std::string const &) const
TH1D * h_numberMuon_ptStudy_
TH1D * h_numberTrigMuon_
TH1D * h_pt_distribution_
TH1D * h_numberTrigMuon_ptStudy_
T * make() const
make new ROOT object
InputTag selectMuon_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 76 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_, i, j, reco::Candidate::masterClone(), NoTrigger_, pathName_, reco::LeafCandidate::pt(), selectMuon_, SingleTrigger_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), vectorEta, vectorPt, ZMuMuAnalysisNtupler_cff::zMuMu, zMuMu_, and zmumuIncrement_.

76  {
77  Handle<vector<pat::Muon> > selectMuon;
78  event.getByLabel(selectMuon_, selectMuon);
80  event.getByLabel(zMuMu_, zMuMu);
81  int zmumuSize = zMuMu->size();
82  if(zmumuSize > 0){
83  for( int i = 0; i < zmumuSize ; ++i){
84  bool singleTrigFlag0 = false;
85  bool singleTrigFlag1 = false;
87  const Candidate & zMuMuCand = (*zMuMu)[i];
88  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
89  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
90  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
91  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
92  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
94  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
96  double EtaPatMu0 = mu0.eta();
97  double EtaPatMu1 = mu1.eta();
98  double PtPatMu0 = mu0.pt();
99  double PtPatMu1 = mu1.pt();
100  h_numberMuon_->Fill(EtaPatMu0);
101  h_numberMuon_->Fill(EtaPatMu1);
102  h_numberMuon_ptStudy_->Fill(PtPatMu0);
103  h_numberMuon_ptStudy_->Fill(PtPatMu1);
104  int dimTrig0 = mu0HLTMatches.size();
105  int dimTrig1 = mu1HLTMatches.size();
106  if(dimTrig0 !=0){
107  for(int j = 0; j < dimTrig0 ; ++j){
108  singleTrigFlag0 = true;
109  h_numberTrigMuon_->Fill(EtaPatMu0);
110  h_numberTrigMuon_ptStudy_->Fill(PtPatMu0);
111  double PtTrig = mu0HLTMatches[j].pt();
112  double PtDif = PtTrig-PtPatMu0;
113  h_pt_distribution_->Fill(PtDif);
114  }
115  }
116  else{
117  if(PtPatMu0>80) {
118  h_EtaDist_Pt80_->Fill(EtaPatMu0);
119  vectorPt.push_back(PtPatMu0);
120  vectorEta.push_back(EtaPatMu0);
121  }
122  }
123  if(dimTrig1 !=0){
124  for(int j = 0; j < dimTrig1 ; ++j){
125  singleTrigFlag1 = true;
126  h_numberTrigMuon_->Fill(EtaPatMu1);
127  h_numberTrigMuon_ptStudy_->Fill(PtPatMu1);
128  double PtTrig = mu0HLTMatches[j].pt();
129  double PtDif = PtTrig-PtPatMu1;
130  h_pt_distribution_->Fill(PtDif);
131  }
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)DoubleTrigger_++;
142  if(singleTrigFlag0 && !singleTrigFlag1)SingleTrigger_++;
143  if(!singleTrigFlag0 && singleTrigFlag1)SingleTrigger_++;
144  if(!singleTrigFlag0 && !singleTrigFlag1)NoTrigger_++;
145 
146  }//end loop on ZMuMu candidates
147  }//end check on ZMuMu
148 
149 }
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
TH1D * h_numberMuon_ptStudy_
vector< double > vectorEta
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
virtual double eta() const
momentum pseudorapidity
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=true) const
Definition: PATObject.h:584
TH1D * h_numberTrigMuon_
int j
Definition: DBlmapReader.cc:9
virtual double pt() const
transverse momentum
TH1D * h_pt_distribution_
TH1D * h_numberTrigMuon_ptStudy_
InputTag selectMuon_
Analysis-level muon class.
Definition: Muon.h:47
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
vector< double > vectorPt
virtual const CandidateBaseRef & masterClone() const =0
void testAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file triggerEfficiency.cc.

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

151  {
152  cout<< "DoubleTrigger = " << DoubleTrigger_ << " , SingleTrigger = " << SingleTrigger_ << " , NoTrigger = "<< NoTrigger_ <<" ,zmumuIncrement = "<< zmumuIncrement_ << endl;
153  double OneTrig = (double)SingleTrigger_/(double)zmumuIncrement_;
154  double DoubleTrig = (double)DoubleTrigger_/(double)zmumuIncrement_;
155  cout<< "eps^2 = " << DoubleTrig << endl;
156  cout<< "2eps(1 - eps) = " << OneTrig << endl;
157  int dimVec =vectorPt.size();
158  for(int i = 0; i<dimVec; ++i) cout << "Pt = " << vectorPt[i] << " ==> Eta = " << vectorEta[i] << endl;
159 }
int i
Definition: DBlmapReader.cc:9
vector< double > vectorEta
tuple cout
Definition: gather_cfg.py:41
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 48 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_
private

Definition at line 46 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D * testAnalyzer::h_numberMuon_ptStudy_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_
private

Definition at line 46 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_numberTrigMuon_ptStudy_
private

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

TH1D* testAnalyzer::h_pt_distribution_
private

Definition at line 45 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

double testAnalyzer::maxEta_
private

Definition at line 41 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::maxPt_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minEta_
private

Definition at line 41 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

double testAnalyzer::minPt_
private

Definition at line 43 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEta_
private

Definition at line 40 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsEtaPt_
private

Definition at line 44 of file triggerEfficiency.cc.

Referenced by testAnalyzer().

int testAnalyzer::nbinsPt_
private

Definition at line 42 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 39 of file triggerEfficiency.cc.

Referenced by analyze().

InputTag testAnalyzer::selectMuon_
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 49 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

vector<double> testAnalyzer::vectorPt
private

Definition at line 49 of file triggerEfficiency.cc.

Referenced by analyze(), and endJob().

InputTag testAnalyzer::zMuMu_
private

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze().

int testAnalyzer::zmumuIncrement_
private

Definition at line 37 of file triggerEfficiency.cc.

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