CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

testAnalyzer Class Reference

Inheritance diagram for testAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 testAnalyzer (const edm::ParameterSet &pset)

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_

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_, maxEta_, maxPt_, minEta_, minPt_, nbinsEta_, nbinsEtaPt_, nbinsPt_, NoTrigger_, SingleTrigger_, and zmumuIncrement_.

                                                      : 
  selectMuon_( pset.getParameter<InputTag>( "selectMuon" ) ),
  zMuMu_( pset.getParameter<InputTag>( "ZMuMu" ) ),
  pathName_( pset.getParameter<string>( "pathName" ) ),
  nbinsEta_( pset.getParameter<int>( "EtaBins" ) ),
  minEta_( pset.getParameter<double>( "minEta" ) ),
  maxEta_( pset.getParameter<double>( "maxEta" ) ),
  nbinsPt_( pset.getParameter<int>( "PtBins" ) ),
  minPt_( pset.getParameter<double>( "minPt" ) ),
  maxPt_( pset.getParameter<double>( "maxPt" ) ),
  nbinsEtaPt_( pset.getParameter<int>( "EtaPt80Bins" ) ){
  SingleTrigger_= 0;
  DoubleTrigger_= 0;
  NoTrigger_= 0;
  zmumuIncrement_=0;
  Service<TFileService> fs;
  h_pt_distribution_ = fs->make<TH1D>("PtResolution ","Pt Resolution",200,-4.,4.);
  h_numberMuon_ = fs->make<TH1D>("Denominatore","Number of Muons vs Eta",nbinsEta_,minEta_,maxEta_);
  h_numberTrigMuon_ = fs->make<TH1D>("NumeratoreTrigMuon","Number of Triggered Muons vs Eta",nbinsEta_ ,minEta_,maxEta_); 
  h_numberMuon_ptStudy_ = fs->make<TH1D>("DenominatorePtStudy","Number of Muons vs Pt",nbinsPt_,minPt_,maxPt_);
  h_numberTrigMuon_ptStudy_ = fs->make<TH1D>("NumeratoreTrigMuonPtStudy","Number of Triggered Muons vs Pt",nbinsPt_,minPt_,maxPt_);
  h_EtaDist_Pt80_ = fs->make<TH1D>("EtaDistr","Eta distribution (Pt>80)",nbinsEtaPt_,minEta_,maxEta_);
}

Member Function Documentation

void testAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

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

                                                                            {
  Handle<vector<pat::Muon> > selectMuon;
  event.getByLabel(selectMuon_, selectMuon);
  Handle<CandidateView> zMuMu;
  event.getByLabel(zMuMu_, zMuMu);
  int zmumuSize = zMuMu->size();
  if(zmumuSize > 0){
    for( int i = 0; i < zmumuSize ; ++i){
      bool singleTrigFlag0 = false;
      bool singleTrigFlag1 = false;
      zmumuIncrement_++;
      const Candidate & zMuMuCand = (*zMuMu)[i];
      CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
      CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
      const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
      const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
      const pat::TriggerObjectStandAloneCollection mu0HLTMatches = 
        mu0.triggerObjectMatchesByPath( pathName_ );
      const pat::TriggerObjectStandAloneCollection mu1HLTMatches = 
        mu1.triggerObjectMatchesByPath( pathName_ );
      double EtaPatMu0 = mu0.eta();
      double EtaPatMu1 = mu1.eta();
      double PtPatMu0 = mu0.pt();
      double PtPatMu1 = mu1.pt();
      h_numberMuon_->Fill(EtaPatMu0);
      h_numberMuon_->Fill(EtaPatMu1);
      h_numberMuon_ptStudy_->Fill(PtPatMu0);
      h_numberMuon_ptStudy_->Fill(PtPatMu1);
      int dimTrig0 = mu0HLTMatches.size();
      int dimTrig1 = mu1HLTMatches.size();
      if(dimTrig0 !=0){
        for(int j = 0; j < dimTrig0 ; ++j){
        singleTrigFlag0 = true;
        h_numberTrigMuon_->Fill(EtaPatMu0);
        h_numberTrigMuon_ptStudy_->Fill(PtPatMu0);
        double PtTrig = mu0HLTMatches[j].pt();
        double PtDif = PtTrig-PtPatMu0;
        h_pt_distribution_->Fill(PtDif);
        }
      }
      else{
        if(PtPatMu0>80) {
          h_EtaDist_Pt80_->Fill(EtaPatMu0);
          vectorPt.push_back(PtPatMu0);
          vectorEta.push_back(EtaPatMu0);
        }
      }
      if(dimTrig1 !=0){
        for(int j = 0; j < dimTrig1 ; ++j){
          singleTrigFlag1 = true;
          h_numberTrigMuon_->Fill(EtaPatMu1);
          h_numberTrigMuon_ptStudy_->Fill(PtPatMu1);
          double PtTrig = mu0HLTMatches[j].pt();
          double PtDif = PtTrig-PtPatMu1;
          h_pt_distribution_->Fill(PtDif);
        }
      }  
      else{
        if(PtPatMu0>80) {
          h_EtaDist_Pt80_->Fill(EtaPatMu1);
          vectorPt.push_back(PtPatMu0);
          vectorEta.push_back(EtaPatMu0);
        }
      }
      
      if(singleTrigFlag0 && singleTrigFlag1)DoubleTrigger_++;
      if(singleTrigFlag0 && !singleTrigFlag1)SingleTrigger_++;
      if(!singleTrigFlag0 && singleTrigFlag1)SingleTrigger_++;
      if(!singleTrigFlag0 && !singleTrigFlag1)NoTrigger_++;

    }//end loop on ZMuMu candidates
  }//end check on ZMuMu
 
}  
void testAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file triggerEfficiency.cc.

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

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

Member Data Documentation

Definition at line 37 of file triggerEfficiency.cc.

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

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().

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

Definition at line 46 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

Definition at line 47 of file triggerEfficiency.cc.

Referenced by analyze(), and testAnalyzer().

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().

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().

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze().

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().

Definition at line 38 of file triggerEfficiency.cc.

Referenced by analyze().

Definition at line 37 of file triggerEfficiency.cc.

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