CMS 3D CMS Logo

HTrackVariables Class Reference

#include <Validation/RecoMuon/src/Histograms.h>

List of all members.

Public Member Functions

MonitorElementcharge ()
MonitorElementcomputeEfficiency (MonitorElement *reco, MonitorElement *sim)
double computeEfficiency (HTrackVariables *sim)
int entries ()
MonitorElementeta ()
void Fill (double pt, double eta, double phi)
void Fill (double p, double pt, double eta, double phi, double charge)
void FillDeltaR (double deltaR)
 HTrackVariables (std::string dirName_, std::string name, std::string whereIs="")
MonitorElementp ()
MonitorElementphi ()
MonitorElementpt ()
 ~HTrackVariables ()

Private Attributes

DQMStoredbe_
std::vector< MonitorElement * > efficiencyHistos
MonitorElementhCharge
MonitorElementhDeltaR
MonitorElementhEta
MonitorElementhEtaVsGen
MonitorElementhP
MonitorElementhPhi
MonitorElementhPhiVsGen
MonitorElementhPt
MonitorElementhPtVsGen
int theEntries
std::string theName
std::string where


Detailed Description

Definition at line 26 of file Histograms.h.


Constructor & Destructor Documentation

HTrackVariables::HTrackVariables ( std::string  dirName_,
std::string  name,
std::string  whereIs = "" 
) [inline]

Definition at line 29 of file Histograms.h.

References DQMStore::book1D(), DQMStore::cd(), dbe_, test_cfg::dirName, hCharge, hDeltaR, hEta, hEtaVsGen, hP, hPhi, hPhiVsGen, hPt, hPtVsGen, Geom::pi(), DQMStore::setCurrentFolder(), theEntries, theName, and where.

00029                                                                            :theName(name.c_str()),where(whereIs.c_str()){
00030     dbe_ = edm::Service<DQMStore>().operator->();
00031     dbe_->cd();
00032     std::string dirName=dirName_;
00033     //dirName+="/";
00034     //dirName+=name.c_str();
00035     
00036     dbe_->setCurrentFolder(dirName.c_str());
00037     
00038     hEta = dbe_->book1D(theName+"_Eta_"+where,"#eta at "+where,120,-3.,3.);
00039     hPhi = dbe_->book1D(theName+"_Phi_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
00040     hP   = dbe_->book1D(theName+"_P_"+where,"p_{t} at "+where,1000,0,2000);
00041     hPt  = dbe_->book1D(theName+"_Pt_"+where,"p_{t} at "+where,1000,0,2000);
00042     hCharge = dbe_->book1D(theName+"_charge_"+where,"Charge at "+where,4,-2.,2.);
00043 
00044     hEtaVsGen = dbe_->book1D(theName+"_EtaVsGen_"+where,"#eta at "+where,120,-3.,3.);
00045     hPhiVsGen = dbe_->book1D(theName+"_PhiVsGen_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
00046     hPtVsGen  = dbe_->book1D(theName+"_PtVsGen_"+where,"p_{t} at "+where,1000,0,2000);
00047 
00048     hDeltaR = dbe_->book1D(theName+"_DeltaR_"+where,"Delta R w.r.t. sim track for "+where,1000,0,20);
00049 
00050     theEntries = 0;
00051   }

HTrackVariables::~HTrackVariables (  )  [inline]

Definition at line 64 of file Histograms.h.

00064 {}


Member Function Documentation

MonitorElement* HTrackVariables::charge ( void   )  [inline]

Definition at line 70 of file Histograms.h.

References hCharge.

00070 {return hCharge;}

MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim 
) [inline]

Definition at line 104 of file Histograms.h.

References DQMStore::book1D(), dbe_, error, MonitorElement::getTH1F(), me, name, funct::sqrt(), and indexGen::title.

00104                                                                               {
00105     
00106     TH1F* hReco = reco->getTH1F();
00107     TH1F* hSim  = sim->getTH1F();
00108 
00109     std::string name = hReco->GetName();
00110     std::string title = hReco->GetTitle();
00111     
00112     MonitorElement * me = dbe_->book1D(
00113                                        "Eff_"+name,
00114                                        "Efficiecny as a function of "+title,
00115                                        hSim->GetNbinsX(),
00116                                        hSim->GetXaxis()->GetXmin(),
00117                                        hSim->GetXaxis()->GetXmax()
00118                                        );
00119     
00120     me->getTH1F()->Divide(hReco,hSim,1.,1.,"b");
00121     
00122     // Set the error accordingly to binomial statistics
00123     int nBinsEta = me->getTH1F()->GetNbinsX();
00124     for(int bin = 1; bin <=  nBinsEta; bin++) {
00125       float nSimHit = hSim->GetBinContent(bin);
00126       float eff = me->getTH1F()->GetBinContent(bin);
00127       float error = 0;
00128       if(nSimHit != 0 && eff <= 1) {
00129         error = sqrt(eff*(1-eff)/nSimHit);
00130       }
00131       me->getTH1F()->SetBinError(bin, error);
00132     }
00133     
00134     return me;
00135   }

double HTrackVariables::computeEfficiency ( HTrackVariables sim  )  [inline]

Definition at line 92 of file Histograms.h.

References efficiencyHistos, entries(), eta(), hEtaVsGen, hPhiVsGen, hPtVsGen, phi(), and pt().

Referenced by HTrack::computeEfficiency().

00092                                                 {
00093     
00094     efficiencyHistos.push_back(computeEfficiency(hEtaVsGen,sim->eta()));
00095     efficiencyHistos.push_back(computeEfficiency(hPhiVsGen,sim->phi()));
00096     //    efficiencyHistos.push_back(computeEfficiency(p(),sim->p()));
00097     efficiencyHistos.push_back(computeEfficiency(hPtVsGen,sim->pt()));
00098     //    efficiencyHistos.push_back(computeEfficiency(charge(),sim->charge()));
00099 
00100     double efficiency = 100*entries()/sim->entries();
00101     return efficiency;
00102   }

int HTrackVariables::entries (  )  [inline]

Definition at line 71 of file Histograms.h.

References theEntries.

Referenced by computeEfficiency().

00071 {return theEntries;}

MonitorElement* HTrackVariables::eta ( void   )  [inline]

Definition at line 66 of file Histograms.h.

References hEta.

Referenced by computeEfficiency().

00066 {return hEta;}

void HTrackVariables::Fill ( double  pt,
double  eta,
double  phi 
) [inline]

Definition at line 82 of file Histograms.h.

References MonitorElement::Fill(), hEtaVsGen, hPhiVsGen, and hPtVsGen.

00082                                               {
00083     hEtaVsGen->Fill(eta);
00084     hPhiVsGen->Fill(phi);
00085     hPtVsGen->Fill(pt);
00086   }

void HTrackVariables::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  charge 
) [inline]

Definition at line 73 of file Histograms.h.

References MonitorElement::Fill(), hCharge, hEta, hP, hPhi, hPt, and theEntries.

Referenced by HTrack::computeResolutionAndPull(), HTrack::Fill(), and MuonTrackAnalyzer::fillPlots().

00073                                                                        {
00074     hEta->Fill(eta);
00075     hPhi->Fill(phi);
00076     hP->Fill(p);
00077     hPt->Fill(pt);
00078     hCharge->Fill(charge);
00079     ++theEntries;
00080   }

void HTrackVariables::FillDeltaR ( double  deltaR  )  [inline]

Definition at line 88 of file Histograms.h.

References MonitorElement::Fill(), and hDeltaR.

Referenced by HTrack::FillDeltaR().

00088                                 {
00089     hDeltaR->Fill(deltaR);
00090   }

MonitorElement* HTrackVariables::p (  )  [inline]

Definition at line 68 of file Histograms.h.

References hP.

00068 {return hP;}

MonitorElement* HTrackVariables::phi ( void   )  [inline]

Definition at line 67 of file Histograms.h.

References hPhi.

Referenced by computeEfficiency().

00067 {return hPhi;}

MonitorElement* HTrackVariables::pt ( void   )  [inline]

Definition at line 69 of file Histograms.h.

References hPt.

Referenced by computeEfficiency().

00069 {return hPt;}


Member Data Documentation

DQMStore* HTrackVariables::dbe_ [private]

Definition at line 139 of file Histograms.h.

Referenced by computeEfficiency(), and HTrackVariables().

std::vector<MonitorElement*> HTrackVariables::efficiencyHistos [private]

Definition at line 158 of file Histograms.h.

Referenced by computeEfficiency().

MonitorElement* HTrackVariables::hCharge [private]

Definition at line 150 of file Histograms.h.

Referenced by charge(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hDeltaR [private]

Definition at line 156 of file Histograms.h.

Referenced by FillDeltaR(), and HTrackVariables().

MonitorElement* HTrackVariables::hEta [private]

Definition at line 146 of file Histograms.h.

Referenced by eta(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hEtaVsGen [private]

Definition at line 152 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hP [private]

Definition at line 148 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and p().

MonitorElement* HTrackVariables::hPhi [private]

Definition at line 147 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and phi().

MonitorElement* HTrackVariables::hPhiVsGen [private]

Definition at line 153 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hPt [private]

Definition at line 149 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and pt().

MonitorElement* HTrackVariables::hPtVsGen [private]

Definition at line 154 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

int HTrackVariables::theEntries [private]

Definition at line 144 of file Histograms.h.

Referenced by entries(), Fill(), and HTrackVariables().

std::string HTrackVariables::theName [private]

Definition at line 141 of file Histograms.h.

Referenced by HTrackVariables().

std::string HTrackVariables::where [private]

Definition at line 142 of file Histograms.h.

Referenced by HTrackVariables().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:24:48 2009 for CMSSW by  doxygen 1.5.4