CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ZMassHistogrammer Class Reference

Inheritance diagram for ZMassHistogrammer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 ZMassHistogrammer (const edm::ParameterSet &pset)

Private Member Functions

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

Private Attributes

edm::InputTag gen_
TH1F * h_mZ_
TH1F * h_mZMC_
edm::InputTag z_

Detailed Description

Definition at line 5 of file ZMassHistogrammer.cc.


Constructor & Destructor Documentation

ZMassHistogrammer::ZMassHistogrammer ( const edm::ParameterSet pset)

Definition at line 29 of file ZMassHistogrammer.cc.

References gather_cfg::cout, h_mZ_, and h_mZMC_.

                                                             :
  z_(pset.getParameter<InputTag>("z")),
  gen_(pset.getParameter<InputTag>("gen")) { 
  cout << ">>> Z Mass constructor" << endl;
  Service<TFileService> fs;
  h_mZ_ = fs->make<TH1F>("ZMass", "Z mass (GeV/c^{2})", 100,  0, 200);
  h_mZMC_ = fs->make<TH1F>("ZMCMass", "Z MC mass (GeV/c^{2})", 100,  0, 200);
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 38 of file ZMassHistogrammer.cc.

References reco::Candidate::charge(), gather_cfg::cout, reco::Candidate::daughter(), gen_, h_mZ_, h_mZMC_, i, reco::Candidate::mass(), reco::Candidate::numberOfDaughters(), reco::Candidate::pdgId(), reco::Candidate::status(), z, and z_.

                                                                                 { 
  cout << ">>> Z Mass analyze" << endl;
  Handle<CandidateCollection> z;
  Handle<CandidateCollection> gen;
  event.getByLabel(z_, z);
  event.getByLabel(gen_, gen);
  for(unsigned int i = 0; i < z->size(); ++i) {
    const Candidate &zCand = (*z)[i];
    h_mZ_->Fill(zCand.mass());
  }
  for(unsigned int i = 0; i < gen->size(); ++i) {
    const Candidate &genCand = (*gen)[i];
    if((genCand.pdgId() == 23) && (genCand.status() == 2)) //this is an intermediate Z0
      cout << ">>> intermediate Z0 found, with " << genCand.numberOfDaughters() 
           << " daughters" << endl;
    if((genCand.pdgId() == 23)&&(genCand.status() == 3)) { //this is a Z0
      cout << ">>> Z0 found, with " << genCand.numberOfDaughters() 
           << " daughters" << endl;
      h_mZMC_->Fill(genCand.mass());
      if(genCand.numberOfDaughters() == 3) {//Z0 decays in mu+ mu-, the 3rd daughter is the same Z0
        const Candidate * dauGen0 = genCand.daughter(0);
        const Candidate * dauGen1 = genCand.daughter(1);
        const Candidate * dauGen2 = genCand.daughter(2);
        cout << ">>> daughter MC 0 PDG Id " << dauGen0->pdgId() 
             << ", status " << dauGen0->status() 
             << ", charge " << dauGen0->charge() 
             << endl;
        cout << ">>> daughter MC 1 PDG Id " << dauGen1->pdgId() 
             << ", status " << dauGen1->status()
             << ", charge " << dauGen1->charge() 
             << endl;
        cout << ">>> daughter MC 2 PDG Id " << dauGen2->pdgId() 
             << ", status " << dauGen2->status()
             << ", charge " << dauGen2->charge() << endl;
      }
    }
  }
}

Member Data Documentation

Definition at line 10 of file ZMassHistogrammer.cc.

Referenced by analyze().

TH1F* ZMassHistogrammer::h_mZ_ [private]

Definition at line 11 of file ZMassHistogrammer.cc.

Referenced by analyze(), and ZMassHistogrammer().

TH1F * ZMassHistogrammer::h_mZMC_ [private]

Definition at line 11 of file ZMassHistogrammer.cc.

Referenced by analyze(), and ZMassHistogrammer().

Definition at line 10 of file ZMassHistogrammer.cc.

Referenced by analyze().