CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
VertexHistogramMaker Class Reference

#include <VertexHistogramMaker.h>

Public Member Functions

void beginRun (const edm::Run &iRun)
 
void book (const std::string dirname="")
 
void fill (const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
 
 VertexHistogramMaker (edm::ConsumesCollector &&iC)
 
 VertexHistogramMaker (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 ~VertexHistogramMaker ()
 

Private Member Functions

void fill (const unsigned int orbit, const int bx, const float bxlumi, const reco::VertexCollection &vertices, const double weight=1.)
 

Private Attributes

const bool m_bsConstrained
 
TFileDirectorym_currdir
 
RunHistogramManager m_fhm
 
TH1F * m_haveweight
 
TProfile * m_haveweightvsvtxz
 
TProfile * m_haveweightvsvtxzchk
 
const edm::ParameterSet m_histoParameters
 
TH1F * m_hndof
 
TH2F * m_hndofvstracks
 
TProfile * m_hndofvsvtxz
 
TH1F * m_hnheavytracks
 
TH1F * m_hntracks
 
TProfile * m_hntracksvsvtxz
 
TH1F * m_hntruevtx
 
TProfile * m_hntruevtxvslumi
 
TH2D * m_hntruevtxvslumi2D
 
TH1F * m_hnvtx
 
TProfile ** m_hnvtxvsbxrun
 
TProfile2D ** m_hnvtxvsbxvslumirun
 
TProfile2D ** m_hnvtxvsbxvsorbrun
 
TProfile ** m_hnvtxvsorbrun
 
TH2F ** m_hnvtxvsorbrun2D
 
TH1F * m_hsqsumptsq
 
TH1F * m_hsqsumptsqheavy
 
TH1F * m_hvtxx
 
TH1F ** m_hvtxxrun
 
TH2F ** m_hvtxxvsbx2drun
 
TProfile ** m_hvtxxvsbxrun
 
TProfile ** m_hvtxxvsorbrun
 
TH1F * m_hvtxy
 
TH1F ** m_hvtxyrun
 
TH2F ** m_hvtxyvsbx2drun
 
TProfile ** m_hvtxyvsbxrun
 
TProfile ** m_hvtxyvsorbrun
 
TH1F * m_hvtxz
 
TH1F ** m_hvtxzrun
 
TH2F ** m_hvtxzvsbx2drun
 
TProfile ** m_hvtxzvsbxrun
 
TProfile ** m_hvtxzvsorbrun
 
TH1F * m_hweights
 
edm::EDGetTokenT< LumiDetailsm_lumiDetailsToken
 
const unsigned int m_maxLS
 
RunHistogramManager m_rhm
 
const bool m_runHisto
 
const bool m_runHisto2D
 
const bool m_runHistoBXProfile
 
const bool m_runHistoBXProfile2D
 
const bool m_runHistoProfile
 
const bool m_trueOnly
 
const double m_weightThreshold
 

Detailed Description

Definition at line 23 of file VertexHistogramMaker.h.

Constructor & Destructor Documentation

VertexHistogramMaker::VertexHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 16 of file VertexHistogramMaker.cc.

17  : m_currdir(nullptr), m_maxLS(100), m_weightThreshold(0.5), m_trueOnly(true)
19  , m_bsConstrained(false)
21  , m_rhm(iC)
22  , m_fhm(iC) { }
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
RunHistogramManager m_rhm
const unsigned int m_maxLS
RunHistogramManager m_fhm
VertexHistogramMaker::VertexHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 24 of file VertexHistogramMaker.cc.

25  : m_currdir(nullptr)
26  , m_maxLS(iConfig.getParameter<unsigned int>("maxLSBeforeRebin"))
27  , m_weightThreshold(iConfig.getUntrackedParameter<double>("weightThreshold",0.5))
28  , m_trueOnly(iConfig.getUntrackedParameter<bool>("trueOnly",true))
29  , m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto",true))
30  , m_runHistoProfile(iConfig.getUntrackedParameter<bool>("runHistoProfile",true))
31  , m_runHistoBXProfile(iConfig.getUntrackedParameter<bool>("runHistoBXProfile",true))
32  , m_runHistoBXProfile2D(iConfig.getUntrackedParameter<bool>("runHistoBXProfile2D",false))
33  , m_runHisto2D(iConfig.getUntrackedParameter<bool>("runHisto2D",false))
34  , m_bsConstrained(iConfig.getParameter<bool>("bsConstrained"))
37  , m_rhm(iC, false),m_fhm(iC, true)
38 { }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
RunHistogramManager m_rhm
edm::EDGetTokenT< LumiDetails > m_lumiDetailsToken
const unsigned int m_maxLS
RunHistogramManager m_fhm
VertexHistogramMaker::~VertexHistogramMaker ( )

Definition at line 41 of file VertexHistogramMaker.cc.

References m_currdir.

41  {
42 
43  delete m_currdir;
44 
45 }
TFileDirectory * m_currdir

Member Function Documentation

void VertexHistogramMaker::beginRun ( const edm::Run iRun)

Definition at line 201 of file VertexHistogramMaker.cc.

References RunHistogramManager::beginRun(), m_currdir, m_fhm, m_rhm, m_runHisto, m_runHisto2D, m_runHistoBXProfile, m_runHistoBXProfile2D, m_runHistoProfile, and TFileService::tFileDirectory().

Referenced by AnotherPrimaryVertexAnalyzer::beginRun().

201  {
202 
203  TFileDirectory* currdir = m_currdir;
204  if(currdir==nullptr) {
206  currdir = &(tfserv->tFileDirectory());
207  }
208 
209  m_rhm.beginRun(iRun,*currdir);
210  m_fhm.beginRun(iRun,*currdir);
211 
212 
213  if(m_runHisto) {
214  (*m_hvtxxrun)->GetXaxis()->SetTitle("X [cm]"); (*m_hvtxxrun)->GetYaxis()->SetTitle("Vertices");
215  (*m_hvtxyrun)->GetXaxis()->SetTitle("Y [cm]"); (*m_hvtxyrun)->GetYaxis()->SetTitle("Vertices");
216  (*m_hvtxzrun)->GetXaxis()->SetTitle("Z [cm]"); (*m_hvtxzrun)->GetYaxis()->SetTitle("Vertices");
217 
218  if(m_runHistoProfile) {
219  (*m_hvtxxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxxvsorbrun)->GetYaxis()->SetTitle("X [cm]");
220  (*m_hvtxxvsorbrun)->SetCanExtend(TH1::kAllAxes);
221  (*m_hvtxyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxyvsorbrun)->GetYaxis()->SetTitle("Y [cm]");
222  (*m_hvtxyvsorbrun)->SetCanExtend(TH1::kAllAxes);
223  (*m_hvtxzvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxzvsorbrun)->GetYaxis()->SetTitle("Z [cm]");
224  (*m_hvtxzvsorbrun)->SetCanExtend(TH1::kAllAxes);
225  (*m_hnvtxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hnvtxvsorbrun)->GetYaxis()->SetTitle("Nvertices");
226  (*m_hnvtxvsorbrun)->SetCanExtend(TH1::kAllAxes);
227  }
228 
229  if(m_runHistoBXProfile) {
230  (*m_hvtxxvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxxvsbxrun)->GetYaxis()->SetTitle("X [cm]");
231  (*m_hvtxyvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxyvsbxrun)->GetYaxis()->SetTitle("Y [cm]");
232  (*m_hvtxzvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxzvsbxrun)->GetYaxis()->SetTitle("Z [cm]");
233  (*m_hnvtxvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hnvtxvsbxrun)->GetYaxis()->SetTitle("Nvertices");
235  (*m_hnvtxvsbxvslumirun)->GetXaxis()->SetTitle("BX"); (*m_hnvtxvsbxvslumirun)->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
236  }
237  if(m_runHisto2D) {
238  (*m_hvtxxvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxxvsbx2drun)->GetYaxis()->SetTitle("X [cm]");
239  (*m_hvtxyvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxyvsbx2drun)->GetYaxis()->SetTitle("Y [cm]");
240  (*m_hvtxzvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxzvsbx2drun)->GetYaxis()->SetTitle("Z [cm]");
241  }
242  }
243 
244  if(m_runHisto2D) {
245  (*m_hnvtxvsbxvsorbrun)->GetXaxis()->SetTitle("BX#"); (*m_hnvtxvsbxvsorbrun)->GetYaxis()->SetTitle("time [orbit#]");
246  (*m_hnvtxvsbxvsorbrun)->SetCanExtend(TH1::kAllAxes);
247  (*m_hnvtxvsorbrun2D)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hnvtxvsorbrun2D)->GetYaxis()->SetTitle("Nvertices");
248  (*m_hnvtxvsorbrun2D)->SetCanExtend(TH1::kAllAxes);
249  }
250  }
251 }
TFileDirectory * m_currdir
RunHistogramManager m_rhm
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
void beginRun(const edm::Run &iRun)
RunHistogramManager m_fhm
void VertexHistogramMaker::book ( const std::string  dirname = "")

Definition at line 48 of file VertexHistogramMaker.cc.

References compare_using_db::dirname, edm::ParameterSet::getUntrackedParameter(), m_currdir, m_fhm, m_haveweight, m_haveweightvsvtxz, m_haveweightvsvtxzchk, m_histoParameters, m_hndof, m_hndofvstracks, m_hndofvsvtxz, m_hnheavytracks, m_hntracks, m_hntracksvsvtxz, m_hntruevtx, m_hntruevtxvslumi, m_hntruevtxvslumi2D, m_hnvtx, m_hnvtxvsbxrun, m_hnvtxvsbxvslumirun, m_hnvtxvsbxvsorbrun, m_hnvtxvsorbrun, m_hnvtxvsorbrun2D, m_hsqsumptsq, m_hsqsumptsqheavy, m_hvtxx, m_hvtxxrun, m_hvtxxvsbx2drun, m_hvtxxvsbxrun, m_hvtxxvsorbrun, m_hvtxy, m_hvtxyrun, m_hvtxyvsbx2drun, m_hvtxyvsbxrun, m_hvtxyvsorbrun, m_hvtxz, m_hvtxzrun, m_hvtxzvsbx2drun, m_hvtxzvsbxrun, m_hvtxzvsorbrun, m_hweights, m_maxLS, m_rhm, m_runHisto, m_runHisto2D, m_runHistoBXProfile, m_runHistoBXProfile2D, m_runHistoProfile, m_weightThreshold, TFileDirectory::make(), RunHistogramManager::makeTH1F(), RunHistogramManager::makeTH2F(), RunHistogramManager::makeTProfile(), RunHistogramManager::makeTProfile2D(), TFileService::mkdir(), and TFileService::tFileDirectory().

Referenced by AnotherPrimaryVertexAnalyzer::AnotherPrimaryVertexAnalyzer().

48  {
49 
51  TFileDirectory* currdir = &(tfserv->tFileDirectory());
52 
53  if(dirname!="") {
54  currdir = new TFileDirectory(tfserv->mkdir(dirname));
55  m_currdir = currdir;
56  }
57 
58  edm::LogInfo("HistogramBooking") << "Vertex histogram booking in directory " << dirname;
59 
60  m_hnvtx = currdir->make<TH1F>("nvtx","Number of Vertices",60,-0.5,59.5);
61  m_hnvtx->GetXaxis()->SetTitle("vertices"); m_hnvtx->GetYaxis()->SetTitle("Events");
62 
63  m_hntruevtx = currdir->make<TH1F>("ntruevtx","Number of True Vertices",60,-0.5,59.5);
64  m_hntruevtx->GetXaxis()->SetTitle("vertices"); m_hntruevtx->GetYaxis()->SetTitle("Events");
65 
66  m_hntruevtxvslumi = currdir->make<TProfile>("ntruevtxvslumi","Number of True Vertices vs BX lumi",250,0.,10.);
67  m_hntruevtxvslumi->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_hntruevtxvslumi->GetYaxis()->SetTitle("Vertices");
68 
69  m_hntruevtxvslumi2D = currdir->make<TH2D>("ntruevtxvslumi2D","Number of True Vertices vs BX lumi",250,0.,10.,100,-0.5,99.5);
70  m_hntruevtxvslumi2D->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_hntruevtxvslumi2D->GetYaxis()->SetTitle("Vertices");
71 
72  m_hntracks = currdir->make<TH1F>("ntracks","Number of Tracks",300,-0.5,299.5);
73  m_hntracks->GetXaxis()->SetTitle("tracks"); m_hntracks->GetYaxis()->SetTitle("Vertices");
74 
75  m_hsqsumptsq = currdir->make<TH1F>("sqsumptsq","sqrt(sum pt**2)",1000,0.,1000.);
76  m_hsqsumptsq->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); m_hsqsumptsq->GetYaxis()->SetTitle("Vertices");
77 
78  char htitle[300];
79  sprintf(htitle,"sqrt(sum pt**2) of Tracks weight > %f",m_weightThreshold);
80  m_hsqsumptsqheavy = currdir->make<TH1F>("sqsumptsqheavy",htitle,1000,0.,1000.);
81  m_hsqsumptsqheavy->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); m_hsqsumptsqheavy->GetYaxis()->SetTitle("Vertices");
82 
83  sprintf(htitle,"Number of Tracks weight > %f",m_weightThreshold);
84  m_hnheavytracks = currdir->make<TH1F>("nheavytracks",htitle,200,-0.5,199.5);
85  m_hnheavytracks->GetXaxis()->SetTitle("tracks"); m_hnheavytracks->GetYaxis()->SetTitle("Vertices");
86 
87  m_hndof = currdir->make<TH1F>("ndof","Number of degree of freedom",250,-0.5,499.5);
88  m_hndof->GetXaxis()->SetTitle("ndof"); m_hndof->GetYaxis()->SetTitle("Vertices");
89 
90  m_hndofvstracks = currdir->make<TH2F>("ndofvstracks","Ndof vs Ntracks",300,-0.5,299.5,250,-0.5,499.5);
91  m_hndofvstracks->GetXaxis()->SetTitle("tracks"); m_hndofvstracks->GetYaxis()->SetTitle("ndof");
92 
93  m_hndofvsvtxz = currdir->make<TProfile>("ndofvsvtxz","Ndof vs Vertex Z position",200,
94  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
95  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
96  m_hndofvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hndofvsvtxz->GetYaxis()->SetTitle("ndof");
97 
98  m_hntracksvsvtxz = currdir->make<TProfile>("ntracksvsvtxz","Ntracks vs Vertex Z position",200,
99  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
100  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
101  m_hntracksvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hntracksvsvtxz->GetYaxis()->SetTitle("tracks");
102 
103  m_haveweightvsvtxz = currdir->make<TProfile>("aveweightvsvtxz","Average weight vs Vertex Z position",200,
104  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
105  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
106  m_haveweightvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_haveweightvsvtxz->GetYaxis()->SetTitle("Average weight");
107 
108  m_haveweightvsvtxzchk = currdir->make<TProfile>("aveweightvsvtxzchk","Average weight vs Vertex Z position (check)",200,
109  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
110  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
111  m_haveweightvsvtxzchk->GetXaxis()->SetTitle("Z [cm]"); m_haveweightvsvtxzchk->GetYaxis()->SetTitle("Average weight");
112 
113  m_hweights = currdir->make<TH1F>("weights","Tracks weights",51,0.,1.02);
114  m_hweights->GetXaxis()->SetTitle("weights"); m_hweights->GetYaxis()->SetTitle("Tracks");
115 
116  m_haveweight = currdir->make<TH1F>("aveweight","Tracks average weights sum",51,0.,1.02);
117  m_haveweight->GetXaxis()->SetTitle("Average weight"); m_haveweight->GetYaxis()->SetTitle("Vertices");
118 
119 
120  m_hvtxx = currdir->make<TH1F>("vtxx","Vertex X position",
121  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX",200),
122  m_histoParameters.getUntrackedParameter<double>("xMin",-1.),
123  m_histoParameters.getUntrackedParameter<double>("xMax",1.)
124  );
125  m_hvtxx->GetXaxis()->SetTitle("X [cm]"); m_hvtxx->GetYaxis()->SetTitle("Vertices");
126 
127  m_hvtxy = currdir->make<TH1F>("vtxy","Vertex Y position",
128  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY",200),
129  m_histoParameters.getUntrackedParameter<double>("yMin",-1.),
130  m_histoParameters.getUntrackedParameter<double>("yMax",1.)
131  );
132  m_hvtxy->GetXaxis()->SetTitle("Y [cm]"); m_hvtxy->GetYaxis()->SetTitle("Vertices");
133 
134  m_hvtxz = currdir->make<TH1F>("vtxz","Vertex Z position",
135  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ",200),
136  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
137  m_histoParameters.getUntrackedParameter<double>("zMax",20.)
138  );
139  m_hvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hvtxz->GetYaxis()->SetTitle("Vertices");
140 
141  if(m_runHisto) {
142  m_hvtxxrun = m_rhm.makeTH1F("vtxxrun","Vertex X position",
143  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX",200),
144  m_histoParameters.getUntrackedParameter<double>("xMin",-1.),
145  m_histoParameters.getUntrackedParameter<double>("xMax",1.));
146 
147  m_hvtxyrun = m_rhm.makeTH1F("vtxyrun","Vertex Y position",
148  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY",200),
149  m_histoParameters.getUntrackedParameter<double>("yMin",-1.),
150  m_histoParameters.getUntrackedParameter<double>("yMax",1.));
151 
152  m_hvtxzrun = m_rhm.makeTH1F("vtxzrun","Vertex Z position",
153  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ",200),
154  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
155  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
156 
157  if(m_runHistoProfile) {
158  m_hvtxxvsorbrun = m_rhm.makeTProfile("vtxxvsorbrun","Vertex X position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5);
159  m_hvtxyvsorbrun = m_rhm.makeTProfile("vtxyvsorbrun","Vertex Y position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5);
160  m_hvtxzvsorbrun = m_rhm.makeTProfile("vtxzvsorbrun","Vertex Z position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5);
161  m_hnvtxvsorbrun = m_rhm.makeTProfile("nvtxvsorbrun","Number of true vertices vs orbit number",m_maxLS,0.5,m_maxLS*262144+0.5);
162  }
163 
164  if(m_runHisto2D) {
165  m_hnvtxvsbxvsorbrun = m_rhm.makeTProfile2D("nvtxvsbxvsorbrun","Number of true vertices vs BX vs orbit number",
166  3564,-0.5,3563.5,m_maxLS,0.5,m_maxLS*262144+0.5);
167  m_hnvtxvsorbrun2D = m_rhm.makeTH2F("nvtxvsorbrun2D","Number of true vertices vs orbit number",
168  m_maxLS,0.5,m_maxLS*262144+0.5,60,-0.5,59.5);
169  }
170 
171  if(m_runHistoBXProfile) {
172  m_hvtxxvsbxrun = m_fhm.makeTProfile("vtxxvsbxrun","Vertex X position vs BX number",3564,-0.5,3563.5);
173  m_hvtxyvsbxrun = m_fhm.makeTProfile("vtxyvsbxrun","Vertex Y position vs BX number",3564,-0.5,3563.5);
174  m_hvtxzvsbxrun = m_fhm.makeTProfile("vtxzvsbxrun","Vertex Z position vs BX number",3564,-0.5,3563.5);
175 
176  m_hnvtxvsbxrun = m_rhm.makeTProfile("nvtxvsbxrun","Number of true vertices vs BX number",3564,-0.5,3563.5);
177 
179  m_hnvtxvsbxvslumirun = m_fhm.makeTProfile2D("nvtxvsbxvslumirun","Number of vertices vs BX and BX lumi",3564,-0.5,3563.5,250,0.,10.);
180  }
181  if(m_runHisto2D) {
182  m_hvtxxvsbx2drun = m_fhm.makeTH2F("vtxxvsbx2drun","Vertex X position vs BX number",3564,-0.5,3563.5,
183  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX",200),
184  m_histoParameters.getUntrackedParameter<double>("xMin",-1.),
185  m_histoParameters.getUntrackedParameter<double>("xMax",1.));
186  m_hvtxyvsbx2drun = m_fhm.makeTH2F("vtxyvsbx2drun","Vertex Y position vs BX number",3564,-0.5,3563.5,
187  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY",200),
188  m_histoParameters.getUntrackedParameter<double>("yMin",-1.),
189  m_histoParameters.getUntrackedParameter<double>("yMax",1.));
190  m_hvtxzvsbx2drun = m_fhm.makeTH2F("vtxzvsbx2drun","Vertex Z position vs BX number",3564,-0.5,3563.5,
191  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ",200),
192  m_histoParameters.getUntrackedParameter<double>("zMin",-20.),
193  m_histoParameters.getUntrackedParameter<double>("zMax",20.));
194  }
195  }
196 
197 
198  }
199 }
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
TProfile2D ** m_hnvtxvsbxvsorbrun
RunHistogramManager m_rhm
TProfile2D ** m_hnvtxvsbxvslumirun
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TProfile2D ** makeTProfile2D(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
TH2F ** makeTH2F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
const unsigned int m_maxLS
RunHistogramManager m_fhm
void VertexHistogramMaker::fill ( const edm::Event iEvent,
const reco::VertexCollection vertices,
const double  weight = 1. 
)

Definition at line 356 of file VertexHistogramMaker.cc.

References edm::EventBase::bunchCrossing(), edm::LuminosityBlock::getByToken(), edm::Event::getLuminosityBlock(), LumiDetails::isValid(), edm::HandleBase::isValid(), LumiDetails::kOCC1, LumiDetails::lumiValue(), m_lumiDetailsToken, edm::EventBase::orbitNumber(), electrons_cff::vertices, and mps_merge::weight.

Referenced by AnotherPrimaryVertexAnalyzer::analyze().

356  {
357 
358  // get luminosity
359 
362 
363  float bxlumi = -1.;
364 
365  if(ld.isValid()) {
366  if(ld->isValid()) {
367  bxlumi = ld->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
368  }
369  }
370 
371  fill(iEvent.orbitNumber(),iEvent.bunchCrossing(),bxlumi,vertices,weight);
372 
373 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool isValid() const
Definition: LumiDetails.cc:57
int bunchCrossing() const
Definition: EventBase.h:64
void fill(const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:92
edm::EDGetTokenT< LumiDetails > m_lumiDetailsToken
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:97
int orbitNumber() const
Definition: EventBase.h:65
bool isValid() const
Definition: HandleBase.h:74
void VertexHistogramMaker::fill ( const unsigned int  orbit,
const int  bx,
const float  bxlumi,
const reco::VertexCollection vertices,
const double  weight = 1. 
)
private

Definition at line 253 of file VertexHistogramMaker.cc.

References m_bsConstrained, m_haveweight, m_haveweightvsvtxz, m_haveweightvsvtxzchk, m_hndof, m_hndofvstracks, m_hndofvsvtxz, m_hnheavytracks, m_hntracks, m_hntracksvsvtxz, m_hntruevtx, m_hntruevtxvslumi, m_hntruevtxvslumi2D, m_hnvtx, m_hnvtxvsbxrun, m_hnvtxvsbxvslumirun, m_hnvtxvsbxvsorbrun, m_hnvtxvsorbrun, m_hnvtxvsorbrun2D, m_hsqsumptsq, m_hsqsumptsqheavy, m_hvtxx, m_hvtxxrun, m_hvtxxvsbx2drun, m_hvtxxvsbxrun, m_hvtxxvsorbrun, m_hvtxy, m_hvtxyrun, m_hvtxyvsbx2drun, m_hvtxyvsbxrun, m_hvtxyvsorbrun, m_hvtxz, m_hvtxzrun, m_hvtxzvsbx2drun, m_hvtxzvsbxrun, m_hvtxzvsorbrun, m_hweights, m_runHisto, m_runHisto2D, m_runHistoBXProfile, m_runHistoBXProfile2D, m_runHistoProfile, m_trueOnly, m_weightThreshold, mathSSE::sqrt(), extraflags_cff::vtx, and mps_merge::weight.

253  {
254 
255  m_hnvtx->Fill(vertices.size(),weight);
256 
257  int ntruevtx = 0;
258  for(reco::VertexCollection::const_iterator vtx=vertices.begin();vtx!=vertices.end();++vtx) {
259  if(!vtx->isFake()) ntruevtx++;
260 
261  if(!(m_trueOnly && vtx->isFake())) {
262 
263  double aveweight = m_bsConstrained ? vtx->ndof()/(2.*vtx->tracksSize()) : (vtx->ndof()+3)/(2.*vtx->tracksSize());
264 
265  m_hntracks->Fill(vtx->tracksSize(),weight);
266  m_hndof->Fill(vtx->ndof(),weight);
267  m_haveweight->Fill(aveweight,weight);
268  m_hndofvstracks->Fill(vtx->tracksSize(),vtx->ndof(),weight);
269  m_hndofvsvtxz->Fill(vtx->z(),vtx->ndof(),weight);
270  m_hntracksvsvtxz->Fill(vtx->z(),vtx->tracksSize(),weight);
271  m_haveweightvsvtxz->Fill(vtx->z(),aveweight,weight);
272 
273  m_hvtxx->Fill(vtx->x(),weight);
274  m_hvtxy->Fill(vtx->y(),weight);
275  m_hvtxz->Fill(vtx->z(),weight);
276 
277  if(m_runHisto) {
278  if(m_hvtxxrun && *m_hvtxxrun ) (*m_hvtxxrun)->Fill(vtx->x(),weight);
279  if(m_hvtxyrun && *m_hvtxyrun ) (*m_hvtxyrun)->Fill(vtx->y(),weight);
280  if(m_hvtxzrun && *m_hvtxzrun ) (*m_hvtxzrun)->Fill(vtx->z(),weight);
281  if(m_runHistoProfile) {
282  if(m_hvtxxvsorbrun && *m_hvtxxvsorbrun ) (*m_hvtxxvsorbrun)->Fill(orbit,vtx->x(),weight);
283  if(m_hvtxyvsorbrun && *m_hvtxyvsorbrun ) (*m_hvtxyvsorbrun)->Fill(orbit,vtx->y(),weight);
284  if(m_hvtxzvsorbrun && *m_hvtxzvsorbrun ) (*m_hvtxzvsorbrun)->Fill(orbit,vtx->z(),weight);
285  }
286  if(m_runHistoBXProfile) {
287  if(m_hvtxxvsbxrun && *m_hvtxxvsbxrun ) (*m_hvtxxvsbxrun)->Fill(bx%3564,vtx->x(),weight);
288  if(m_hvtxyvsbxrun && *m_hvtxyvsbxrun ) (*m_hvtxyvsbxrun)->Fill(bx%3564,vtx->y(),weight);
289  if(m_hvtxzvsbxrun && *m_hvtxzvsbxrun ) (*m_hvtxzvsbxrun)->Fill(bx%3564,vtx->z(),weight);
290  if(m_runHisto2D) {
291  if(m_hvtxxvsbx2drun && *m_hvtxxvsbx2drun ) (*m_hvtxxvsbx2drun)->Fill(bx%3564,vtx->x(),weight);
292  if(m_hvtxyvsbx2drun && *m_hvtxyvsbx2drun ) (*m_hvtxyvsbx2drun)->Fill(bx%3564,vtx->y(),weight);
293  if(m_hvtxzvsbx2drun && *m_hvtxzvsbx2drun ) (*m_hvtxzvsbx2drun)->Fill(bx%3564,vtx->z(),weight);
294  }
295  }
296  }
297 
298  int nheavytracks = 0;
299  double sumpt2 = 0.;
300  double sumpt2heavy = 0.;
301 
302  for(reco::Vertex::trackRef_iterator trk=vtx->tracks_begin();trk!=vtx->tracks_end();++trk) {
303 
304  sumpt2 += (*trk)->pt()*(*trk)->pt();
305 
306  if(vtx->trackWeight(*trk) > m_weightThreshold) {
307  nheavytracks++;
308  sumpt2heavy += (*trk)->pt()*(*trk)->pt();
309  }
310 
311  m_hweights->Fill(vtx->trackWeight(*trk),weight);
312  m_haveweightvsvtxzchk->Fill(vtx->z(),vtx->trackWeight(*trk),weight);
313 
314  }
315 
316  m_hnheavytracks->Fill(nheavytracks,weight);
317  m_hsqsumptsq->Fill(sqrt(sumpt2),weight);
318  m_hsqsumptsqheavy->Fill(sqrt(sumpt2heavy),weight);
319 
320 
321  }
322 
323 
324  }
325 
326  m_hntruevtx->Fill(ntruevtx,weight);
327 
328  if(bxlumi >= 0.) {
329  m_hntruevtxvslumi->Fill(bxlumi,ntruevtx,weight);
330  m_hntruevtxvslumi2D->Fill(bxlumi,ntruevtx,weight);
331  }
332 
333  if(m_runHisto) {
334  if(m_runHistoProfile) {
335  if(m_hnvtxvsorbrun && *m_hnvtxvsorbrun ) (*m_hnvtxvsorbrun)->Fill(orbit,ntruevtx,weight);
336  }
337  if(m_runHistoBXProfile) {
338  if(m_hnvtxvsbxrun && *m_hnvtxvsbxrun ) (*m_hnvtxvsbxrun)->Fill(bx%3564,ntruevtx,weight);
340  if(m_hnvtxvsbxvslumirun && *m_hnvtxvsbxvslumirun && bxlumi >= 0.) (*m_hnvtxvsbxvslumirun)->Fill(bx%3564,bxlumi,ntruevtx,weight);
341  }
342  }
343  if(m_runHisto2D) {
344  if(m_hnvtxvsbxvsorbrun && *m_hnvtxvsbxvsorbrun ) (*m_hnvtxvsbxvsorbrun)->Fill(bx%3564,orbit,ntruevtx,weight);
346  if(ntruevtx < (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmax() && ntruevtx > (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmin()) {
347  (*m_hnvtxvsorbrun2D)->Fill(orbit,ntruevtx,weight);
348  }
349  }
350  }
351  }
352 
353 
354 }
TProfile2D ** m_hnvtxvsbxvsorbrun
TProfile2D ** m_hnvtxvsbxvslumirun
Definition: weight.py:1
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37

Member Data Documentation

const bool VertexHistogramMaker::m_bsConstrained
private

Definition at line 48 of file VertexHistogramMaker.h.

Referenced by fill().

TFileDirectory* VertexHistogramMaker::m_currdir
private

Definition at line 39 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and ~VertexHistogramMaker().

RunHistogramManager VertexHistogramMaker::m_fhm
private

Definition at line 53 of file VertexHistogramMaker.h.

Referenced by beginRun(), and book().

TH1F* VertexHistogramMaker::m_haveweight
private

Definition at line 63 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile* VertexHistogramMaker::m_haveweightvsvtxz
private

Definition at line 67 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile* VertexHistogramMaker::m_haveweightvsvtxzchk
private

Definition at line 68 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

const edm::ParameterSet VertexHistogramMaker::m_histoParameters
private

Definition at line 49 of file VertexHistogramMaker.h.

Referenced by book().

TH1F* VertexHistogramMaker::m_hndof
private

Definition at line 62 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2F* VertexHistogramMaker::m_hndofvstracks
private

Definition at line 64 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile* VertexHistogramMaker::m_hndofvsvtxz
private

Definition at line 65 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hnheavytracks
private

Definition at line 61 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hntracks
private

Definition at line 58 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile* VertexHistogramMaker::m_hntracksvsvtxz
private

Definition at line 66 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hntruevtx
private

Definition at line 55 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile* VertexHistogramMaker::m_hntruevtxvslumi
private

Definition at line 56 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2D* VertexHistogramMaker::m_hntruevtxvslumi2D
private

Definition at line 57 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hnvtx
private

Definition at line 54 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hnvtxvsbxrun
private

Definition at line 86 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile2D** VertexHistogramMaker::m_hnvtxvsbxvslumirun
private

Definition at line 88 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile2D** VertexHistogramMaker::m_hnvtxvsbxvsorbrun
private

Definition at line 80 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hnvtxvsorbrun
private

Definition at line 79 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2F** VertexHistogramMaker::m_hnvtxvsorbrun2D
private

Definition at line 81 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hsqsumptsq
private

Definition at line 59 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hsqsumptsqheavy
private

Definition at line 60 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hvtxx
private

Definition at line 70 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F** VertexHistogramMaker::m_hvtxxrun
private

Definition at line 73 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2F** VertexHistogramMaker::m_hvtxxvsbx2drun
private

Definition at line 90 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxxvsbxrun
private

Definition at line 83 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxxvsorbrun
private

Definition at line 76 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hvtxy
private

Definition at line 71 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F** VertexHistogramMaker::m_hvtxyrun
private

Definition at line 74 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2F** VertexHistogramMaker::m_hvtxyvsbx2drun
private

Definition at line 91 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxyvsbxrun
private

Definition at line 84 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxyvsorbrun
private

Definition at line 77 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hvtxz
private

Definition at line 72 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F** VertexHistogramMaker::m_hvtxzrun
private

Definition at line 75 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH2F** VertexHistogramMaker::m_hvtxzvsbx2drun
private

Definition at line 92 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxzvsbxrun
private

Definition at line 85 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TProfile** VertexHistogramMaker::m_hvtxzvsorbrun
private

Definition at line 78 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

TH1F* VertexHistogramMaker::m_hweights
private

Definition at line 69 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

edm::EDGetTokenT<LumiDetails> VertexHistogramMaker::m_lumiDetailsToken
private

Definition at line 50 of file VertexHistogramMaker.h.

Referenced by fill().

const unsigned int VertexHistogramMaker::m_maxLS
private

Definition at line 40 of file VertexHistogramMaker.h.

Referenced by book().

RunHistogramManager VertexHistogramMaker::m_rhm
private

Definition at line 52 of file VertexHistogramMaker.h.

Referenced by beginRun(), and book().

const bool VertexHistogramMaker::m_runHisto
private

Definition at line 43 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const bool VertexHistogramMaker::m_runHisto2D
private

Definition at line 47 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const bool VertexHistogramMaker::m_runHistoBXProfile
private

Definition at line 45 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const bool VertexHistogramMaker::m_runHistoBXProfile2D
private

Definition at line 46 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const bool VertexHistogramMaker::m_runHistoProfile
private

Definition at line 44 of file VertexHistogramMaker.h.

Referenced by beginRun(), book(), and fill().

const bool VertexHistogramMaker::m_trueOnly
private

Definition at line 42 of file VertexHistogramMaker.h.

Referenced by fill().

const double VertexHistogramMaker::m_weightThreshold
private

Definition at line 41 of file VertexHistogramMaker.h.

Referenced by book(), and fill().