CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1ValidatorHists.cc
Go to the documentation of this file.
2 
3 //#include <DataFormats/HepMCCandidate/interface/GenParticle.h>
4 
6 
7 /*#define BOOKHISTS(TYPE) \
8 TYPE ## _N_Pt = new TH2F(#TYPE "_N_Pt", #TYPE " Number", 20, 0, 200); \
9 TYPE ## _N_Eta = new TH2F(#TYPE "_N_Eta", #TYPE " Number", 20, -4, 4); \
10 TYPE ## _Eff_Pt = new TH2F(#TYPE "_Eff_Pt", #TYPE " Number", 20, 0, 200); \
11 TYPE ## _Eff_Eta = new TH2F(#TYPE "_Eff_Eta", #TYPE " Number", 20, -4, 4); \
12 TYPE ## _dR = new TH2F(#TYPE "_dR", #TYPE " Number", 20, 0, 1); \
13 TYPE ## _dPt = new TH2F(#TYPE "_dPt", #TYPE " Number", 20, -1, 1);
14 */
16  Name[0]="IsoEG";
17  Name[1]="NonIsoEG";
18  Name[2]="CenJet";
19  Name[3]="ForJet";
20  Name[4]="TauJet";
21  Name[5]="Muon";
22 }
24 
26  NEvents=0;
27 
28  for(int i=0; i<Type::Number; i++){
29  N[i] = iBooker.book1D( (Name[i]+"_N").c_str(), (Name[i]+" Number").c_str(), 5, -0.5, 4.5);
30 
31  Eff_Pt[i] = iBooker.book1D( (Name[i]+"_Eff_Pt").c_str(), (Name[i]+" Efficiency").c_str(), 20, 0, 100);
32  Eff_Eta[i] = iBooker.book1D( (Name[i]+"_Eff_Eta").c_str(), (Name[i]+" Efficiency").c_str(), 20, -4, 4);
33  TurnOn_15[i] = iBooker.book1D( (Name[i]+"_TurnOn_15").c_str(), (Name[i]+" Turn On (15 GeV)").c_str(), 20, 0, 100);
34  TurnOn_30[i] = iBooker.book1D( (Name[i]+"_TurnOn_30").c_str(), (Name[i]+" Turn On (30 GeV)").c_str(), 20, 0, 100);
35  dR[i] = iBooker.book1D( (Name[i]+"_dR").c_str(), (Name[i]+" dR").c_str(), 20, 0, 1);
36  dPt[i] = iBooker.book1D( (Name[i]+"_dPt").c_str(), (Name[i]+" dPt").c_str(), 20, -1, 1);
37  }
38 
39 }
40 
41 void L1ValidatorHists::Fill(int i, const reco::LeafCandidate *GenPart, const reco::LeafCandidate *RecoPart){
42  if(RecoPart==NULL) return;
43 
44  Eff_Pt[i]->Fill(GenPart->pt());
45  if(RecoPart->pt()>15) TurnOn_15[i]->Fill(GenPart->pt());
46  if(RecoPart->pt()>30) TurnOn_30[i]->Fill(GenPart->pt());
47  Eff_Eta[i]->Fill(GenPart->eta());
48  dR[i]->Fill(reco::deltaR(GenPart->eta(), GenPart->phi(), RecoPart->eta(), RecoPart->phi()));
49  dPt[i]->Fill( (RecoPart->pt()-GenPart->pt()) / GenPart->pt() );
50 }
51 
52 void L1ValidatorHists::FillNumber(int i, int Number){
53  N[i]->Fill(Number);
54 }
55 
57  for(int i=0; i<Type::Number; i++){
58  N[i]->getTH1()->Write();
59  Eff_Pt[i]->getTH1()->Write();
60  Eff_Eta[i]->getTH1()->Write();
61  TurnOn_15[i]->getTH1()->Write();
62  TurnOn_30[i]->getTH1()->Write();
63  dR[i]->getTH1()->Write();
64  dPt[i]->getTH1()->Write();
65  }
66 }
67 
68 /*void L1ValidatorHists::NormalizeSlices(TH2F *Hist){
69  int NBinsX = Hist->GetNbinsX();
70  int NBinsY = Hist->GetNbinsY();
71  for(int i=0; i<NBinsX+2; i++){
72  float Total = Hist->Integral(i, i, 0, -1);
73  if(Total == 0) continue;
74  for(int j=0; j<NBinsY+2; j++){
75  Hist->SetBinContent(i,j, Hist->GetBinContent(i,j)/Total);
76  }
77  }
78 }
79 */
void Fill(int, const reco::LeafCandidate *, const reco::LeafCandidate *)
int i
Definition: DBlmapReader.cc:9
MonitorElement * Eff_Eta[Type::Number]
MonitorElement * N[Type::Number]
std::string Name[6]
MonitorElement * TurnOn_15[Type::Number]
virtual double phi() const final
momentum azimuthal angle
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
void FillNumber(int, int)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * dPt[Type::Number]
TH1 * getTH1(void) const
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
MonitorElement * TurnOn_30[Type::Number]
MonitorElement * dR[Type::Number]
virtual double eta() const final
momentum pseudorapidity
void Book(DQMStore::IBooker &)
MonitorElement * Eff_Pt[Type::Number]
virtual double pt() const final
transverse momentum