CMS 3D CMS Logo

Public Member Functions | Private Attributes

HTrackVariables Class Reference

#include <Histograms.h>

List of all members.

Public Member Functions

MonitorElementcharge ()
double computeEfficiency (HTrackVariables *sim)
MonitorElementcomputeEfficiency (MonitorElement *reco, MonitorElement *sim)
int entries ()
MonitorElementeta ()
void Fill (double p, double pt, double eta, double phi, double charge)
void Fill (double pt, double eta, double phi)
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_, TrackerOfflineValidation_Dqm_cff::dirName, hCharge, hDeltaR, hEta, hEtaVsGen, hP, hPhi, hPhiVsGen, hPt, hPtVsGen, cmsCodeRules::cppFunctionSkipper::operator, Geom::pi(), DQMStore::setCurrentFolder(), theEntries, theName, and where.

                                                                           :theName(name.c_str()),where(whereIs.c_str()){
    dbe_ = edm::Service<DQMStore>().operator->();
    dbe_->cd();
    std::string dirName=dirName_;
    //dirName+="/";
    //dirName+=name.c_str();
    
    dbe_->setCurrentFolder(dirName.c_str());
    
    hEta = dbe_->book1D(theName+"_Eta_"+where,"#eta at "+where,120,-3.,3.);
    hPhi = dbe_->book1D(theName+"_Phi_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
    hP   = dbe_->book1D(theName+"_P_"+where,"p_{t} at "+where,1000,0,2000);
    hPt  = dbe_->book1D(theName+"_Pt_"+where,"p_{t} at "+where,1000,0,2000);
    hCharge = dbe_->book1D(theName+"_charge_"+where,"Charge at "+where,4,-2.,2.);

    hEtaVsGen = dbe_->book1D(theName+"_EtaVsGen_"+where,"#eta at "+where,120,-3.,3.);
    hPhiVsGen = dbe_->book1D(theName+"_PhiVsGen_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
    hPtVsGen  = dbe_->book1D(theName+"_PtVsGen_"+where,"p_{t} at "+where,1000,0,2000);

    hDeltaR = dbe_->book1D(theName+"_DeltaR_"+where,"Delta R w.r.t. sim track for "+where,1000,0,20);

    theEntries = 0;
  }
HTrackVariables::~HTrackVariables ( ) [inline]

Definition at line 64 of file Histograms.h.

{}

Member Function Documentation

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

Definition at line 70 of file Histograms.h.

References hCharge.

{return hCharge;}
double HTrackVariables::computeEfficiency ( HTrackVariables sim) [inline]

Definition at line 92 of file Histograms.h.

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

                                                {
    
    efficiencyHistos.push_back(computeEfficiency(hEtaVsGen,sim->eta()));
    efficiencyHistos.push_back(computeEfficiency(hPhiVsGen,sim->phi()));
    //    efficiencyHistos.push_back(computeEfficiency(p(),sim->p()));
    efficiencyHistos.push_back(computeEfficiency(hPtVsGen,sim->pt()));
    //    efficiencyHistos.push_back(computeEfficiency(charge(),sim->charge()));

    double efficiency = 100*entries()/sim->entries();
    return efficiency;
  }
MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim 
) [inline]

Definition at line 104 of file Histograms.h.

References newFWLiteAna::bin, DQMStore::book1D(), dbe_, error, MonitorElement::getTH1F(), AlCaRecoCosmics_cfg::name, mathSSE::sqrt(), and indexGen::title.

                                                                              {
    
    TH1F* hReco = reco->getTH1F();
    TH1F* hSim  = sim->getTH1F();

    std::string name = hReco->GetName();
    std::string title = hReco->GetTitle();
    
    MonitorElement * me = dbe_->book1D(
                                       "Eff_"+name,
                                       "Efficiecny as a function of "+title,
                                       hSim->GetNbinsX(),
                                       hSim->GetXaxis()->GetXmin(),
                                       hSim->GetXaxis()->GetXmax()
                                       );
    
    me->getTH1F()->Divide(hReco,hSim,1.,1.,"b");
    
    // Set the error accordingly to binomial statistics
    int nBinsEta = me->getTH1F()->GetNbinsX();
    for(int bin = 1; bin <=  nBinsEta; bin++) {
      float nSimHit = hSim->GetBinContent(bin);
      float eff = me->getTH1F()->GetBinContent(bin);
      float error = 0;
      if(nSimHit != 0 && eff <= 1) {
        error = sqrt(eff*(1-eff)/nSimHit);
      }
      me->getTH1F()->SetBinError(bin, error);
    }
    
    return me;
  }
int HTrackVariables::entries ( ) [inline]

Definition at line 71 of file Histograms.h.

References theEntries.

Referenced by computeEfficiency().

{return theEntries;}
MonitorElement* HTrackVariables::eta ( void  ) [inline]

Definition at line 66 of file Histograms.h.

References hEta.

Referenced by computeEfficiency().

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

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(), and HTrack::Fill().

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

Definition at line 88 of file Histograms.h.

References MonitorElement::Fill(), and hDeltaR.

Referenced by HTrack::FillDeltaR().

MonitorElement* HTrackVariables::p ( ) [inline]

Definition at line 68 of file Histograms.h.

References hP.

{return hP;}
MonitorElement* HTrackVariables::phi ( void  ) [inline]

Definition at line 67 of file Histograms.h.

References hPhi.

Referenced by computeEfficiency().

{return hPhi;}
MonitorElement* HTrackVariables::pt ( ) [inline]

Definition at line 69 of file Histograms.h.

References hPt.

Referenced by computeEfficiency().

{return hPt;}

Member Data Documentation

Definition at line 139 of file Histograms.h.

Referenced by computeEfficiency(), and HTrackVariables().

Definition at line 158 of file Histograms.h.

Referenced by computeEfficiency().

Definition at line 150 of file Histograms.h.

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

Definition at line 156 of file Histograms.h.

Referenced by FillDeltaR(), and HTrackVariables().

Definition at line 146 of file Histograms.h.

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

Definition at line 152 of file Histograms.h.

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

Definition at line 148 of file Histograms.h.

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

Definition at line 147 of file Histograms.h.

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

Definition at line 153 of file Histograms.h.

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

Definition at line 149 of file Histograms.h.

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

Definition at line 154 of file Histograms.h.

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

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