CMS 3D CMS Logo

Public Member Functions | Protected Attributes

HParticle Class Reference

#include <Histograms.h>

Inheritance diagram for HParticle:
Histograms

List of all members.

Public Member Functions

virtual void Clear ()
virtual void Fill (const reco::Particle::LorentzVector &p4, const double &weight=1.)
virtual void Fill (const CLHEP::HepLorentzVector &momentum, const double &weight=1.)
virtual void Fill (unsigned int number)
 HParticle (const TString &name, const double &minMass=0., const double &maxMass=200., const double &maxPt=100.)
 HParticle (TFile *outputFile, const TString &name, const double &minMass=0., const double &maxMass=200., const double &maxPt=100.)
 Constructor that puts the histograms inside a TDirectory.
 HParticle (const TString &name, TFile *file)
virtual void Write ()
 ~HParticle ()

Protected Attributes

TH1F * hEta_
TH1F * hMass_
TH1F * hNumber_
TH1F * hPhi_
TH1F * hPt_
TH2F * hPtVsEta_

Detailed Description

Definition at line 221 of file Histograms.h.


Constructor & Destructor Documentation

HParticle::HParticle ( const TString &  name,
const double &  minMass = 0.,
const double &  maxMass = 200.,
const double &  maxPt = 100. 
) [inline]

Definition at line 223 of file Histograms.h.

                                                                                                                             :
    Histograms(name),
    // Kinematical variables
    hPt_(      new TH1F (name+"_Pt",      "transverse momentum", 100, 0, maxPt) ),
    hPtVsEta_( new TH2F (name+"_PtVsEta", "transverse momentum vs #eta", 100, 0, maxPt, 100, -3.0, 3.0) ),
    hEta_(     new TH1F (name+"_Eta",     "pseudorapidity", 60, -3.0, 3.0) ),
    hPhi_(     new TH1F (name+"_Phi",     "phi angle", 64, -3.2, 3.2) ),
    hMass_(    new TH1F (name+"_Mass",    "mass", 10000, minMass, maxMass) ),
    // hMass_fine_ = new TH1F (name+"_Mass_fine", "low mass fine binning", 4000, 0., 20. ); //Removed to avoid too many histos (more binning added to hMass)
    hNumber_( new TH1F (name+"_Number", "number", 20, -0.5, 19.5) )
  {}
HParticle::HParticle ( TFile *  outputFile,
const TString &  name,
const double &  minMass = 0.,
const double &  maxMass = 200.,
const double &  maxPt = 100. 
) [inline]

Constructor that puts the histograms inside a TDirectory.

Definition at line 236 of file Histograms.h.

References hEta_, hMass_, hNumber_, hPhi_, hPt_, and hPtVsEta_.

                                                                                                                                                :
    Histograms(outputFile, name)
  {
    // Kinematical variables
    hPt_ =      new TH1F (name+"_Pt", "transverse momentum", 100, 0, maxPt);
    hPtVsEta_ = new TH2F (name+"_PtVsEta", "transverse momentum vs #eta", 100, 0, maxPt, 100, -3.0, 3.0);
    hEta_ =     new TH1F (name+"_Eta", "pseudorapidity", 60, -3.0, 3.0);
    hPhi_ =     new TH1F (name+"_Phi", "phi angle", 64, -3.2, 3.2);
    hMass_ =    new TH1F (name+"_Mass", "mass", 40000, minMass, maxMass);
    // hMass_fine_ = new TH1F (name+"_Mass_fine", "low mass fine binning", 4000, 0., 20. ); //Removed to avoid too many histos (more binning added to hMass)
    hNumber_ = new TH1F (name+"_Number", "number", 20, -0.5, 19.5);
  }
HParticle::HParticle ( const TString &  name,
TFile *  file 
) [inline]

Definition at line 249 of file Histograms.h.

                                                 :
    Histograms(name),
    hPt_(      (TH1F *) file->Get(name_+"_Pt") ),
    hPtVsEta_( (TH2F *) file->Get(name_+"_PtVsEta") ),
    hEta_(     (TH1F *) file->Get(name_+"_Eta") ),
    hPhi_(     (TH1F *) file->Get(name_+"_Phi") ),
    hMass_(    (TH1F *) file->Get(name_+"_Mass") ),
    //hMass_fine_ = (TH1F *) file->Get(name_+"_Mass_fine");
    hNumber_( (TH1F *) file->Get(name_+"_Number") )
  {}
HParticle::~HParticle ( ) [inline]

Definition at line 260 of file Histograms.h.

References hEta_, hMass_, hNumber_, hPhi_, hPt_, and hPtVsEta_.

  {
    delete hPt_;
    delete hPtVsEta_;
    delete hEta_;
    delete hPhi_;
    delete hMass_;
    // delete hMass_fine_;
    delete hNumber_;
  }

Member Function Documentation

virtual void HParticle::Clear ( ) [inline, virtual]

Implements Histograms.

Definition at line 303 of file Histograms.h.

References hEta_, hMass_, hNumber_, hPhi_, hPt_, and hPtVsEta_.

  {
    hPt_->Clear();
    hPtVsEta_->Clear();
    hEta_->Clear();    
    hPhi_->Clear();
    hMass_->Clear();
    //hMass_fine_->Clear();
    hNumber_->Clear();
  }
virtual void HParticle::Fill ( const CLHEP::HepLorentzVector &  momentum,
const double &  weight = 1. 
) [inline, virtual]

Reimplemented from Histograms.

Definition at line 276 of file Histograms.h.

References hEta_, hMass_, hPhi_, hPt_, hPtVsEta_, and CommonMethods::weight().

  {
    hPt_->Fill(momentum.perp(), weight);
    hPtVsEta_->Fill(momentum.perp(), momentum.eta(), weight);
    hEta_->Fill(momentum.eta(), weight);
    hPhi_->Fill(momentum.phi(), weight);
    hMass_->Fill(momentum.m(), weight);
    //hMass_fine_->Fill(momentum.m(), weight);
  }
virtual void HParticle::Fill ( const reco::Particle::LorentzVector p4,
const double &  weight = 1. 
) [inline, virtual]

Reimplemented from Histograms.

Definition at line 271 of file Histograms.h.

References CommonMethods::weight().

  {
    Fill(CLHEP::HepLorentzVector(p4.x(),p4.y(),p4.z(),p4.t()), weight);
  }
virtual void HParticle::Fill ( unsigned int  number) [inline, virtual]

Reimplemented from Histograms.

Definition at line 286 of file Histograms.h.

References hNumber_.

  {
    hNumber_->Fill(number);
  }
virtual void HParticle::Write ( ) [inline, virtual]

Implements Histograms.

Definition at line 291 of file Histograms.h.

References hEta_, Histograms::histoDir_, hMass_, hNumber_, hPhi_, hPt_, and hPtVsEta_.

  {
    if(histoDir_ != 0) histoDir_->cd();
    hPt_->Write();
    hPtVsEta_->Write();
    hEta_->Write();    
    hPhi_->Write();
    hMass_->Write();
    //hMass_fine_->Write();
    hNumber_->Write();
  }

Member Data Documentation

TH1F* HParticle::hEta_ [protected]

Definition at line 317 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().

TH1F* HParticle::hMass_ [protected]

Definition at line 319 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().

TH1F* HParticle::hNumber_ [protected]

Definition at line 321 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().

TH1F* HParticle::hPhi_ [protected]

Definition at line 318 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().

TH1F* HParticle::hPt_ [protected]

Definition at line 315 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().

TH2F* HParticle::hPtVsEta_ [protected]

Definition at line 316 of file Histograms.h.

Referenced by Clear(), Fill(), HParticle(), Write(), and ~HParticle().