CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronMcSignalPostValidator.cc
Go to the documentation of this file.
1 
5 
8  {}
9 
11  {}
12 
14  { setBookIndex(-1) ; }
15 
17  {
18  setBookPrefix("h_ele") ;
19 
20  edm::LogInfo("ElectronMcSignalPostValidator::finalize") << "efficiency calculation" ;
21  bookH1andDivide("etaEff","mc_Eta_matched","mc_Eta","#eta","Efficiency","","true");
22  bookH1andDivide("zEff","mc_Z_matched","mc_Z","z (cm)","Efficiency","","true");
23  bookH1andDivide("absetaEff","mc_AbsEta_matched","mc_AbsEta","|#eta|","Efficiency","","true");
24  bookH1andDivide("ptEff","mc_Pt_matched","mc_Pt","p_{T} (GeV/c)","Efficiency","","true");
25  bookH1andDivide("phiEff","mc_Phi_matched","mc_Phi","#phi (rad)","Efficiency","","true");
26  bookH2andDivide("ptEtaEff","mc_PtEta_matched","mc_PtEta","#eta","p_{T} (GeV/c)","");
27 
28  edm::LogInfo("ElectronMcSignalPostValidator::finalize") << "q-misid calculation" ;
29  bookH1andDivide("etaQmisid","mc_Eta_matched_qmisid","mc_Eta","#eta","q misId","","");
30  bookH1andDivide("zQmisid","mc_Z_matched_qmisid","mc_Z","z (cm)","q misId","","");
31  bookH1andDivide("absetaQmisid","mc_AbsEta_matched_qmisid","mc_AbsEta","|#eta|","q misId","","");
32  bookH1andDivide("ptQmisid","mc_Pt_matched_qmisid","mc_Pt","p_{T} (GeV/c)","q misId","","");
33 
34  edm::LogInfo("ElectronMcSignalPostValidator::finalize") << "all reco electrons" ;
35  bookH1andDivide("etaEff_all","vertexEta_all","h_mc_Eta","#eta","N_{rec}/N_{gen}","","");
36  bookH1andDivide("ptEff_all","vertexPt_all","h_mc_Pt","p_{T} (GeV/c)","N_{rec}/N_{gen}","","");
37 
38  edm::LogInfo("ElectronMcSignalPostValidator::finalize") << "classes" ;
39  bookH1andDivide("eta_goldenFrac","eta_golden","h_ele_eta","|#eta|","Fraction of electrons","fraction of golden electrons vs eta","");
40  bookH1andDivide("eta_bbremFrac" ,"eta_bbrem","h_ele_eta","|#eta|","Fraction of electrons","fraction of big brem electrons vs eta","");
41  bookH1andDivide("eta_showerFrac","eta_shower","h_ele_eta","|#eta|","Fraction of electrons","fraction of showering electrons vs eta","");
42 
43  // fbrem
44  MonitorElement * p1_ele_fbremVsEta_mean = get("fbremvsEtamean") ;
45  if( p1_ele_fbremVsEta_mean ) {
46  TAxis * etaAxis = p1_ele_fbremVsEta_mean->getTProfile()->GetXaxis() ;
47  MonitorElement * h1_ele_xOverX0VsEta = bookH1withSumw2("xOverx0VsEta","mean X/X_0 vs eta",etaAxis->GetNbins(),etaAxis->GetXmin(),etaAxis->GetXmax());
48  for (int ibin=1;ibin<etaAxis->GetNbins()+1;ibin++) {
49  double xOverX0 = 0.;
50  if (p1_ele_fbremVsEta_mean->getBinContent(ibin)>0.)
51  { xOverX0 = -log(p1_ele_fbremVsEta_mean->getBinContent(ibin)) ; }
52  h1_ele_xOverX0VsEta->setBinContent(ibin,xOverX0) ;
53  }
54  }
55 
56  // profiles from 2D histos
57  profileX("PoPtrueVsEta","mean ele momentum / gen momentum vs eta","#eta","<P/P_{gen}>");
58  profileX("PoPtrueVsPhi","mean ele momentum / gen momentum vs phi","#phi (rad)","<P/P_{gen}>");
59  profileX("EoEtruePfVsEg","mean pflow sc energy / true energy vs e/g sc energy","E/E_{gen} (e/g)","<E/E_{gen}> (pflow)") ;
60  profileY("EoEtruePfVsEg","mean e/g sc energy / true energy vs pflow sc energy","E/E_{gen} (pflow)","<E/E_{gen}> (eg)") ;
61  profileX("EtaMnEtaTrueVsEta","mean ele eta - gen eta vs eta","#eta","<#eta_{rec} - #eta_{gen}>");
62  profileX("EtaMnEtaTrueVsPhi","mean ele eta - gen eta vs phi","#phi (rad)","<#eta_{rec} - #eta_{gen}>");
63  profileX("PhiMnPhiTrueVsEta","mean ele phi - gen phi vs eta","#eta","<#phi_{rec} - #phi_{gen}> (rad)");
64  profileX("PhiMnPhiTrueVsPhi","mean ele phi - gen phi vs phi","#phi (rad)","");
65  profileX("vertexPtVsEta","mean ele transverse momentum vs eta","#eta","<p_{T}> (GeV/c)");
66  profileX("vertexPtVsPhi","mean ele transverse momentum vs phi","#phi (rad)","<p_{T}> (GeV/c)");
67  profileX("EoPVsEta","mean ele E/p vs eta","#eta","<E/P_{vertex}>");
68  profileX("EoPVsPhi","mean ele E/p vs phi","#phi (rad)","<E/P_{vertex}>");
69  profileX("EoPoutVsEta","mean ele E/pout vs eta","#eta","<E_{seed}/P_{out}>");
70  profileX("EoPoutVsPhi","mean ele E/pout vs phi","#phi (rad)","<E_{seed}/P_{out}>");
71  profileX("EeleOPoutVsEta","mean ele Eele/pout vs eta","#eta","<E_{ele}/P_{out}>");
72  profileX("EeleOPoutVsPhi","mean ele Eele/pout vs phi","#phi (rad)","<E_{ele}/P_{out}>");
73  profileX("HoEVsEta","mean ele H/E vs eta","#eta","<H/E>");
74  profileX("HoEVsPhi","mean ele H/E vs phi","#phi (rad)","<H/E>");
75  profileX("chi2VsEta","mean ele track chi2 vs eta","#eta","<#Chi^{2}>");
76  profileX("chi2VsPhi","mean ele track chi2 vs phi","#phi (rad)","<#Chi^{2}>");
77  profileX("ambiguousTracksVsEta","mean ele # ambiguous tracks vs eta","#eta","<N_{ambiguous}>");
78  profileX("foundHitsVsEta","mean ele track # found hits vs eta","#eta","<N_{hits}>");
79  profileX("foundHitsVsPhi","mean ele track # found hits vs phi","#phi (rad)","<N_{hits}>");
80  profileX("lostHitsVsEta","mean ele track # lost hits vs eta","#eta","<N_{hits}>");
81  profileX("lostHitsVsPhi","mean ele track # lost hits vs phi","#phi (rad)","<N_{hits}>");
82  profileX("vertexTIPVsEta","mean tip (wrt gen vtx) vs eta","#eta","<TIP> (cm)");
83  profileX("vertexTIPVsPhi","mean tip (wrt gen vtx) vs phi","#phi","<TIP> (cm)");
84  profileX("vertexTIPVsPt","mean tip (wrt gen vtx) vs phi","p_{T} (GeV/c)","<TIP> (cm)");
85  profileX("seedDphi2_VsEta","mean ele seed dphi 2nd layer vs eta","#eta","<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)",-0.004,0.004);
86  profileX("seedDphi2_VsPt","mean ele seed dphi 2nd layer vs pt","p_{T} (GeV/c)","<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)",-0.004,0.004);
87  profileX("seedDrz2_VsEta","mean ele seed dr(dz) 2nd layer vs eta","#eta","<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)",-0.15,0.15);
88  profileX("seedDrz2_VsPt","mean ele seed dr(dz) 2nd layer vs pt","p_{T} (GeV/c)","<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)",-0.15,0.15);
89  profileX("seedDphi2Pos_VsEta","mean ele seed dphi 2nd layer positron vs eta","#eta","<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)",-0.004,0.004);
90  profileX("seedDphi2Pos_VsPt","mean ele seed dphi 2nd layer positron vs pt","p_{T} (GeV/c)","<#phi_{pred} - #phi_{hit}, 2nd layer> (rad)",-0.004,0.004);
91  profileX("seedDrz2Pos_VsEta","mean ele seed dr(dz) 2nd layer positron vs eta","#eta","<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)",-0.15,0.15);
92  profileX("seedDrz2Pos_VsPt","mean ele seed dr(dz) 2nd layer positron vs pt","p_{T} (GeV/c)","<r(z)_{pred} - r(z)_{hit}, 2nd layer> (cm)",-0.15,0.15);
93 
94 // // investigation
95 // TH2F * h2 = get("PoPtrueVsEta")->getTH2F() ;
96 // std::cout<<"H2 entries : "<<h2->GetEntries()<<std::endl ;
97 // std::cout<<"H2 effective entries : "<<h2->GetEffectiveEntries()<<std::endl ;
98 // Int_t ix, nx = h2->GetNbinsX(), iy, ny = h2->GetNbinsY(), is, nu = 0, no = 0, nb = 0 ;
99 // for ( iy = 0 ; iy<=(ny+1) ; ++iy )
100 // for ( ix = 0 ; ix<=(nx+1) ; ++ix )
101 // {
102 // is = iy*(nx+2) + ix ;
103 // if (h2->IsBinUnderflow(is)) ++nu ;
104 // if (h2->IsBinOverflow(is)) ++no ;
105 // }
106 // ix = 0 ;
107 // for ( iy = 0 ; iy<=(ny+1) ; ++iy )
108 // {
109 // is = iy*(nx+2) + ix ;
110 // nb += (*h2->GetSumw2())[is] ;
111 // }
112 // ix = nx+1 ;
113 // for ( iy = 0 ; iy<=(ny+1) ; ++iy )
114 // {
115 // is = iy*(nx+2) + ix ;
116 // nb += (*h2->GetSumw2())[is] ;
117 // }
118 // for ( ix = 1 ; ix<=nx ; ++ix )
119 // {
120 // iy = 0 ;
121 // is = iy*(nx+2) + ix ;
122 // nb += (*h2->GetSumw2())[is] ;
123 // iy = ny+1 ;
124 // is = iy*(nx+2) + ix ;
125 // nb += (*h2->GetSumw2())[is] ;
126 // }
127 // std::cout<<"H2 nx : "<<nx<<std::endl ;
128 // std::cout<<"H2 ny : "<<ny<<std::endl ;
129 // std::cout<<"H2 nsumw2 : "<<(*h2->GetSumw2()).fN<<std::endl ;
130 // std::cout<<"H2 nu : "<<nu<<std::endl ;
131 // std::cout<<"H2 no : "<<no<<std::endl ;
132 // std::cout<<"H2 outside : "<<nb<<std::endl ;
133 // std::cout<<"PFX entries : "<<h2->ProfileX()->GetEntries()<<std::endl ;
134 // std::cout<<"PFX effective entries : "<<h2->ProfileX()->GetEffectiveEntries()<<std::endl ;
135 }
136 
137 
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * profileY(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
MonitorElement * bookH1withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
ElectronMcSignalPostValidator(const edm::ParameterSet &conf)
MonitorElement * profileX(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
void setBookPrefix(const std::string &)
MonitorElement * bookH1andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="", const std::string &setEfficiencyFlag="")
tuple conf
Definition: dbtoconf.py:185
MonitorElement * bookH2andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
double getBinContent(int binx) const
get content of bin (1-D)
TProfile * getTProfile(void) const