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() [1/2]

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

Definition at line 15 of file VertexHistogramMaker.cc.

16  : m_currdir(nullptr),
17  m_maxLS(100),
18  m_weightThreshold(0.5),
19  m_trueOnly(true),
20  m_runHisto(true),
21  m_runHistoProfile(true),
22  m_runHistoBXProfile(true),
23  m_runHistoBXProfile2D(false),
24  m_runHisto2D(false),
25  m_bsConstrained(false),
27  m_rhm(iC),
28  m_fhm(iC) {}
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
RunHistogramManager m_rhm
const unsigned int m_maxLS
RunHistogramManager m_fhm

◆ VertexHistogramMaker() [2/2]

VertexHistogramMaker::VertexHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 30 of file VertexHistogramMaker.cc.

31  : m_currdir(nullptr),
32  m_maxLS(iConfig.getParameter<unsigned int>("maxLSBeforeRebin")),
33  m_weightThreshold(iConfig.getUntrackedParameter<double>("weightThreshold", 0.5)),
34  m_trueOnly(iConfig.getUntrackedParameter<bool>("trueOnly", true)),
35  m_runHisto(iConfig.getUntrackedParameter<bool>("runHisto", true)),
36  m_runHistoProfile(iConfig.getUntrackedParameter<bool>("runHistoProfile", true)),
37  m_runHistoBXProfile(iConfig.getUntrackedParameter<bool>("runHistoBXProfile", true)),
38  m_runHistoBXProfile2D(iConfig.getUntrackedParameter<bool>("runHistoBXProfile2D", false)),
39  m_runHisto2D(iConfig.getUntrackedParameter<bool>("runHisto2D", false)),
40  m_bsConstrained(iConfig.getParameter<bool>("bsConstrained")),
43  m_rhm(iC, false),
44  m_fhm(iC, true) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
RunHistogramManager m_rhm
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< LumiDetails > m_lumiDetailsToken
const unsigned int m_maxLS
RunHistogramManager m_fhm

◆ ~VertexHistogramMaker()

VertexHistogramMaker::~VertexHistogramMaker ( )

Definition at line 46 of file VertexHistogramMaker.cc.

References m_currdir.

46 { delete m_currdir; }
TFileDirectory * m_currdir

Member Function Documentation

◆ beginRun()

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

Definition at line 257 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().

257  {
258  TFileDirectory* currdir = m_currdir;
259  if (currdir == nullptr) {
261  currdir = &(tfserv->tFileDirectory());
262  }
263 
264  m_rhm.beginRun(iRun, *currdir);
265  m_fhm.beginRun(iRun, *currdir);
266 
267  if (m_runHisto) {
268  (*m_hvtxxrun)->GetXaxis()->SetTitle("X [cm]");
269  (*m_hvtxxrun)->GetYaxis()->SetTitle("Vertices");
270  (*m_hvtxyrun)->GetXaxis()->SetTitle("Y [cm]");
271  (*m_hvtxyrun)->GetYaxis()->SetTitle("Vertices");
272  (*m_hvtxzrun)->GetXaxis()->SetTitle("Z [cm]");
273  (*m_hvtxzrun)->GetYaxis()->SetTitle("Vertices");
274 
275  if (m_runHistoProfile) {
276  (*m_hvtxxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
277  (*m_hvtxxvsorbrun)->GetYaxis()->SetTitle("X [cm]");
278  (*m_hvtxxvsorbrun)->SetCanExtend(TH1::kAllAxes);
279  (*m_hvtxyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
280  (*m_hvtxyvsorbrun)->GetYaxis()->SetTitle("Y [cm]");
281  (*m_hvtxyvsorbrun)->SetCanExtend(TH1::kAllAxes);
282  (*m_hvtxzvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
283  (*m_hvtxzvsorbrun)->GetYaxis()->SetTitle("Z [cm]");
284  (*m_hvtxzvsorbrun)->SetCanExtend(TH1::kAllAxes);
285  (*m_hnvtxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
286  (*m_hnvtxvsorbrun)->GetYaxis()->SetTitle("Nvertices");
287  (*m_hnvtxvsorbrun)->SetCanExtend(TH1::kAllAxes);
288  }
289 
290  if (m_runHistoBXProfile) {
291  (*m_hvtxxvsbxrun)->GetXaxis()->SetTitle("BX");
292  (*m_hvtxxvsbxrun)->GetYaxis()->SetTitle("X [cm]");
293  (*m_hvtxyvsbxrun)->GetXaxis()->SetTitle("BX");
294  (*m_hvtxyvsbxrun)->GetYaxis()->SetTitle("Y [cm]");
295  (*m_hvtxzvsbxrun)->GetXaxis()->SetTitle("BX");
296  (*m_hvtxzvsbxrun)->GetYaxis()->SetTitle("Z [cm]");
297  (*m_hnvtxvsbxrun)->GetXaxis()->SetTitle("BX");
298  (*m_hnvtxvsbxrun)->GetYaxis()->SetTitle("Nvertices");
299  if (m_runHistoBXProfile2D) {
300  (*m_hnvtxvsbxvslumirun)->GetXaxis()->SetTitle("BX");
301  (*m_hnvtxvsbxvslumirun)->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
302  }
303  if (m_runHisto2D) {
304  (*m_hvtxxvsbx2drun)->GetXaxis()->SetTitle("BX");
305  (*m_hvtxxvsbx2drun)->GetYaxis()->SetTitle("X [cm]");
306  (*m_hvtxyvsbx2drun)->GetXaxis()->SetTitle("BX");
307  (*m_hvtxyvsbx2drun)->GetYaxis()->SetTitle("Y [cm]");
308  (*m_hvtxzvsbx2drun)->GetXaxis()->SetTitle("BX");
309  (*m_hvtxzvsbx2drun)->GetYaxis()->SetTitle("Z [cm]");
310  }
311  }
312 
313  if (m_runHisto2D) {
314  (*m_hnvtxvsbxvsorbrun)->GetXaxis()->SetTitle("BX#");
315  (*m_hnvtxvsbxvsorbrun)->GetYaxis()->SetTitle("time [orbit#]");
316  (*m_hnvtxvsbxvsorbrun)->SetCanExtend(TH1::kAllAxes);
317  (*m_hnvtxvsorbrun2D)->GetXaxis()->SetTitle("time [orbit#]");
318  (*m_hnvtxvsorbrun2D)->GetYaxis()->SetTitle("Nvertices");
319  (*m_hnvtxvsorbrun2D)->SetCanExtend(TH1::kAllAxes);
320  }
321  }
322 }
TFileDirectory * m_currdir
RunHistogramManager m_rhm
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
void beginRun(const edm::Run &iRun)
RunHistogramManager m_fhm

◆ book()

void VertexHistogramMaker::book ( const std::string  dirname = "")

Definition at line 48 of file VertexHistogramMaker.cc.

References BTVHLTOfflineSource_cfi::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  {
50  TFileDirectory* currdir = &(tfserv->tFileDirectory());
51 
52  if (!dirname.empty()) {
53  currdir = new TFileDirectory(tfserv->mkdir(dirname));
54  m_currdir = currdir;
55  }
56 
57  edm::LogInfo("HistogramBooking") << "Vertex histogram booking in directory " << dirname;
58 
59  m_hnvtx = currdir->make<TH1F>("nvtx", "Number of Vertices", 60, -0.5, 59.5);
60  m_hnvtx->GetXaxis()->SetTitle("vertices");
61  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");
65  m_hntruevtx->GetYaxis()->SetTitle("Events");
66 
67  m_hntruevtxvslumi = currdir->make<TProfile>("ntruevtxvslumi", "Number of True Vertices vs BX lumi", 250, 0., 10.);
68  m_hntruevtxvslumi->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
69  m_hntruevtxvslumi->GetYaxis()->SetTitle("Vertices");
70 
72  currdir->make<TH2D>("ntruevtxvslumi2D", "Number of True Vertices vs BX lumi", 250, 0., 10., 100, -0.5, 99.5);
73  m_hntruevtxvslumi2D->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]");
74  m_hntruevtxvslumi2D->GetYaxis()->SetTitle("Vertices");
75 
76  m_hntracks = currdir->make<TH1F>("ntracks", "Number of Tracks", 300, -0.5, 299.5);
77  m_hntracks->GetXaxis()->SetTitle("tracks");
78  m_hntracks->GetYaxis()->SetTitle("Vertices");
79 
80  m_hsqsumptsq = currdir->make<TH1F>("sqsumptsq", "sqrt(sum pt**2)", 1000, 0., 1000.);
81  m_hsqsumptsq->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)");
82  m_hsqsumptsq->GetYaxis()->SetTitle("Vertices");
83 
84  char htitle[300];
85  sprintf(htitle, "sqrt(sum pt**2) of Tracks weight > %f", m_weightThreshold);
86  m_hsqsumptsqheavy = currdir->make<TH1F>("sqsumptsqheavy", htitle, 1000, 0., 1000.);
87  m_hsqsumptsqheavy->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)");
88  m_hsqsumptsqheavy->GetYaxis()->SetTitle("Vertices");
89 
90  sprintf(htitle, "Number of Tracks weight > %f", m_weightThreshold);
91  m_hnheavytracks = currdir->make<TH1F>("nheavytracks", htitle, 200, -0.5, 199.5);
92  m_hnheavytracks->GetXaxis()->SetTitle("tracks");
93  m_hnheavytracks->GetYaxis()->SetTitle("Vertices");
94 
95  m_hndof = currdir->make<TH1F>("ndof", "Number of degree of freedom", 250, -0.5, 499.5);
96  m_hndof->GetXaxis()->SetTitle("ndof");
97  m_hndof->GetYaxis()->SetTitle("Vertices");
98 
99  m_hndofvstracks = currdir->make<TH2F>("ndofvstracks", "Ndof vs Ntracks", 300, -0.5, 299.5, 250, -0.5, 499.5);
100  m_hndofvstracks->GetXaxis()->SetTitle("tracks");
101  m_hndofvstracks->GetYaxis()->SetTitle("ndof");
102 
103  m_hndofvsvtxz = currdir->make<TProfile>("ndofvsvtxz",
104  "Ndof vs Vertex Z position",
105  200,
106  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
107  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
108  m_hndofvsvtxz->GetXaxis()->SetTitle("Z [cm]");
109  m_hndofvsvtxz->GetYaxis()->SetTitle("ndof");
110 
111  m_hntracksvsvtxz = currdir->make<TProfile>("ntracksvsvtxz",
112  "Ntracks vs Vertex Z position",
113  200,
114  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
115  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
116  m_hntracksvsvtxz->GetXaxis()->SetTitle("Z [cm]");
117  m_hntracksvsvtxz->GetYaxis()->SetTitle("tracks");
118 
119  m_haveweightvsvtxz = currdir->make<TProfile>("aveweightvsvtxz",
120  "Average weight vs Vertex Z position",
121  200,
122  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
123  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
124  m_haveweightvsvtxz->GetXaxis()->SetTitle("Z [cm]");
125  m_haveweightvsvtxz->GetYaxis()->SetTitle("Average weight");
126 
127  m_haveweightvsvtxzchk = currdir->make<TProfile>("aveweightvsvtxzchk",
128  "Average weight vs Vertex Z position (check)",
129  200,
130  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
131  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
132  m_haveweightvsvtxzchk->GetXaxis()->SetTitle("Z [cm]");
133  m_haveweightvsvtxzchk->GetYaxis()->SetTitle("Average weight");
134 
135  m_hweights = currdir->make<TH1F>("weights", "Tracks weights", 51, 0., 1.02);
136  m_hweights->GetXaxis()->SetTitle("weights");
137  m_hweights->GetYaxis()->SetTitle("Tracks");
138 
139  m_haveweight = currdir->make<TH1F>("aveweight", "Tracks average weights sum", 51, 0., 1.02);
140  m_haveweight->GetXaxis()->SetTitle("Average weight");
141  m_haveweight->GetYaxis()->SetTitle("Vertices");
142 
143  m_hvtxx = currdir->make<TH1F>("vtxx",
144  "Vertex X position",
145  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX", 200),
146  m_histoParameters.getUntrackedParameter<double>("xMin", -1.),
147  m_histoParameters.getUntrackedParameter<double>("xMax", 1.));
148  m_hvtxx->GetXaxis()->SetTitle("X [cm]");
149  m_hvtxx->GetYaxis()->SetTitle("Vertices");
150 
151  m_hvtxy = currdir->make<TH1F>("vtxy",
152  "Vertex Y position",
153  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY", 200),
154  m_histoParameters.getUntrackedParameter<double>("yMin", -1.),
155  m_histoParameters.getUntrackedParameter<double>("yMax", 1.));
156  m_hvtxy->GetXaxis()->SetTitle("Y [cm]");
157  m_hvtxy->GetYaxis()->SetTitle("Vertices");
158 
159  m_hvtxz = currdir->make<TH1F>("vtxz",
160  "Vertex Z position",
161  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ", 200),
162  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
163  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
164  m_hvtxz->GetXaxis()->SetTitle("Z [cm]");
165  m_hvtxz->GetYaxis()->SetTitle("Vertices");
166 
167  if (m_runHisto) {
168  m_hvtxxrun = m_rhm.makeTH1F("vtxxrun",
169  "Vertex X position",
170  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX", 200),
171  m_histoParameters.getUntrackedParameter<double>("xMin", -1.),
172  m_histoParameters.getUntrackedParameter<double>("xMax", 1.));
173 
174  m_hvtxyrun = m_rhm.makeTH1F("vtxyrun",
175  "Vertex Y position",
176  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY", 200),
177  m_histoParameters.getUntrackedParameter<double>("yMin", -1.),
178  m_histoParameters.getUntrackedParameter<double>("yMax", 1.));
179 
180  m_hvtxzrun = m_rhm.makeTH1F("vtxzrun",
181  "Vertex Z position",
182  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ", 200),
183  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
184  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
185 
186  if (m_runHistoProfile) {
188  "vtxxvsorbrun", "Vertex X position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5);
190  "vtxyvsorbrun", "Vertex Y position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5);
192  "vtxzvsorbrun", "Vertex Z position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5);
194  "nvtxvsorbrun", "Number of true vertices vs orbit number", m_maxLS, 0.5, m_maxLS * 262144 + 0.5);
195  }
196 
197  if (m_runHisto2D) {
198  m_hnvtxvsbxvsorbrun = m_rhm.makeTProfile2D("nvtxvsbxvsorbrun",
199  "Number of true vertices vs BX vs orbit number",
200  3564,
201  -0.5,
202  3563.5,
203  m_maxLS,
204  0.5,
205  m_maxLS * 262144 + 0.5);
206  m_hnvtxvsorbrun2D = m_rhm.makeTH2F("nvtxvsorbrun2D",
207  "Number of true vertices vs orbit number",
208  m_maxLS,
209  0.5,
210  m_maxLS * 262144 + 0.5,
211  60,
212  -0.5,
213  59.5);
214  }
215 
216  if (m_runHistoBXProfile) {
217  m_hvtxxvsbxrun = m_fhm.makeTProfile("vtxxvsbxrun", "Vertex X position vs BX number", 3564, -0.5, 3563.5);
218  m_hvtxyvsbxrun = m_fhm.makeTProfile("vtxyvsbxrun", "Vertex Y position vs BX number", 3564, -0.5, 3563.5);
219  m_hvtxzvsbxrun = m_fhm.makeTProfile("vtxzvsbxrun", "Vertex Z position vs BX number", 3564, -0.5, 3563.5);
220 
221  m_hnvtxvsbxrun = m_rhm.makeTProfile("nvtxvsbxrun", "Number of true vertices vs BX number", 3564, -0.5, 3563.5);
222 
223  if (m_runHistoBXProfile2D) {
225  "nvtxvsbxvslumirun", "Number of vertices vs BX and BX lumi", 3564, -0.5, 3563.5, 250, 0., 10.);
226  }
227  if (m_runHisto2D) {
228  m_hvtxxvsbx2drun = m_fhm.makeTH2F("vtxxvsbx2drun",
229  "Vertex X position vs BX number",
230  3564,
231  -0.5,
232  3563.5,
233  m_histoParameters.getUntrackedParameter<unsigned int>("nBinX", 200),
234  m_histoParameters.getUntrackedParameter<double>("xMin", -1.),
235  m_histoParameters.getUntrackedParameter<double>("xMax", 1.));
236  m_hvtxyvsbx2drun = m_fhm.makeTH2F("vtxyvsbx2drun",
237  "Vertex Y position vs BX number",
238  3564,
239  -0.5,
240  3563.5,
241  m_histoParameters.getUntrackedParameter<unsigned int>("nBinY", 200),
242  m_histoParameters.getUntrackedParameter<double>("yMin", -1.),
243  m_histoParameters.getUntrackedParameter<double>("yMax", 1.));
244  m_hvtxzvsbx2drun = m_fhm.makeTH2F("vtxzvsbx2drun",
245  "Vertex Z position vs BX number",
246  3564,
247  -0.5,
248  3563.5,
249  m_histoParameters.getUntrackedParameter<unsigned int>("nBinZ", 200),
250  m_histoParameters.getUntrackedParameter<double>("zMin", -20.),
251  m_histoParameters.getUntrackedParameter<double>("zMax", 20.));
252  }
253  }
254  }
255 }
TFileDirectory * m_currdir
const edm::ParameterSet m_histoParameters
TProfile2D ** m_hnvtxvsbxvsorbrun
RunHistogramManager m_rhm
TProfile2D ** m_hnvtxvsbxvslumirun
T getUntrackedParameter(std::string const &, T const &) const
T * make(const Args &...args) const
make new ROOT object
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)
Log< level::Info, false > LogInfo
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

◆ fill() [1/2]

void VertexHistogramMaker::fill ( const edm::Event iEvent,
const reco::VertexCollection vertices,
const double  weight = 1. 
)

Definition at line 440 of file VertexHistogramMaker.cc.

References iEvent, LumiDetails::isValid(), edm::HandleBase::isValid(), LumiDetails::kOCC1, LumiDetails::lumiValue(), m_lumiDetailsToken, AlignmentTracksFromVertexSelector_cfi::vertices, and mps_merge::weight.

Referenced by AnotherPrimaryVertexAnalyzer::analyze().

440  {
441  // get luminosity
442 
444  iEvent.getLuminosityBlock().getByToken(m_lumiDetailsToken, ld);
445 
446  float bxlumi = -1.;
447 
448  if (ld.isValid()) {
449  if (ld->isValid()) {
450  bxlumi = ld->lumiValue(LumiDetails::kOCC1, iEvent.bunchCrossing()) * 6.37;
451  }
452  }
453 
454  fill(iEvent.orbitNumber(), iEvent.bunchCrossing(), bxlumi, vertices, weight);
455 }
void fill(const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
edm::EDGetTokenT< LumiDetails > m_lumiDetailsToken
int iEvent
Definition: GenABIO.cc:224
bool isValid() const
Definition: LumiDetails.cc:44
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:72
bool isValid() const
Definition: HandleBase.h:70

◆ fill() [2/2]

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 324 of file VertexHistogramMaker.cc.

References nano_mu_digi_cff::bx, 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(), AlignmentTracksFromVertexSelector_cfi::vertices, L1BJetProducer_cff::vtx, and mps_merge::weight.

328  {
329  m_hnvtx->Fill(vertices.size(), weight);
330 
331  int ntruevtx = 0;
332  for (reco::VertexCollection::const_iterator vtx = vertices.begin(); vtx != vertices.end(); ++vtx) {
333  if (!vtx->isFake())
334  ntruevtx++;
335 
336  if (!(m_trueOnly && vtx->isFake())) {
337  double aveweight =
338  m_bsConstrained ? vtx->ndof() / (2. * vtx->tracksSize()) : (vtx->ndof() + 3) / (2. * vtx->tracksSize());
339 
340  m_hntracks->Fill(vtx->tracksSize(), weight);
341  m_hndof->Fill(vtx->ndof(), weight);
342  m_haveweight->Fill(aveweight, weight);
343  m_hndofvstracks->Fill(vtx->tracksSize(), vtx->ndof(), weight);
344  m_hndofvsvtxz->Fill(vtx->z(), vtx->ndof(), weight);
345  m_hntracksvsvtxz->Fill(vtx->z(), vtx->tracksSize(), weight);
346  m_haveweightvsvtxz->Fill(vtx->z(), aveweight, weight);
347 
348  m_hvtxx->Fill(vtx->x(), weight);
349  m_hvtxy->Fill(vtx->y(), weight);
350  m_hvtxz->Fill(vtx->z(), weight);
351 
352  if (m_runHisto) {
353  if (m_hvtxxrun && *m_hvtxxrun)
354  (*m_hvtxxrun)->Fill(vtx->x(), weight);
355  if (m_hvtxyrun && *m_hvtxyrun)
356  (*m_hvtxyrun)->Fill(vtx->y(), weight);
357  if (m_hvtxzrun && *m_hvtxzrun)
358  (*m_hvtxzrun)->Fill(vtx->z(), weight);
359  if (m_runHistoProfile) {
361  (*m_hvtxxvsorbrun)->Fill(orbit, vtx->x(), weight);
363  (*m_hvtxyvsorbrun)->Fill(orbit, vtx->y(), weight);
365  (*m_hvtxzvsorbrun)->Fill(orbit, vtx->z(), weight);
366  }
367  if (m_runHistoBXProfile) {
369  (*m_hvtxxvsbxrun)->Fill(bx % 3564, vtx->x(), weight);
371  (*m_hvtxyvsbxrun)->Fill(bx % 3564, vtx->y(), weight);
373  (*m_hvtxzvsbxrun)->Fill(bx % 3564, vtx->z(), weight);
374  if (m_runHisto2D) {
376  (*m_hvtxxvsbx2drun)->Fill(bx % 3564, vtx->x(), weight);
378  (*m_hvtxyvsbx2drun)->Fill(bx % 3564, vtx->y(), weight);
380  (*m_hvtxzvsbx2drun)->Fill(bx % 3564, vtx->z(), weight);
381  }
382  }
383  }
384 
385  int nheavytracks = 0;
386  double sumpt2 = 0.;
387  double sumpt2heavy = 0.;
388 
389  for (reco::Vertex::trackRef_iterator trk = vtx->tracks_begin(); trk != vtx->tracks_end(); ++trk) {
390  sumpt2 += (*trk)->pt() * (*trk)->pt();
391 
392  if (vtx->trackWeight(*trk) > m_weightThreshold) {
393  nheavytracks++;
394  sumpt2heavy += (*trk)->pt() * (*trk)->pt();
395  }
396 
397  m_hweights->Fill(vtx->trackWeight(*trk), weight);
398  m_haveweightvsvtxzchk->Fill(vtx->z(), vtx->trackWeight(*trk), weight);
399  }
400 
401  m_hnheavytracks->Fill(nheavytracks, weight);
402  m_hsqsumptsq->Fill(sqrt(sumpt2), weight);
403  m_hsqsumptsqheavy->Fill(sqrt(sumpt2heavy), weight);
404  }
405  }
406 
407  m_hntruevtx->Fill(ntruevtx, weight);
408 
409  if (bxlumi >= 0.) {
410  m_hntruevtxvslumi->Fill(bxlumi, ntruevtx, weight);
411  m_hntruevtxvslumi2D->Fill(bxlumi, ntruevtx, weight);
412  }
413 
414  if (m_runHisto) {
415  if (m_runHistoProfile) {
417  (*m_hnvtxvsorbrun)->Fill(orbit, ntruevtx, weight);
418  }
419  if (m_runHistoBXProfile) {
421  (*m_hnvtxvsbxrun)->Fill(bx % 3564, ntruevtx, weight);
422  if (m_runHistoBXProfile2D) {
423  if (m_hnvtxvsbxvslumirun && *m_hnvtxvsbxvslumirun && bxlumi >= 0.)
424  (*m_hnvtxvsbxvslumirun)->Fill(bx % 3564, bxlumi, ntruevtx, weight);
425  }
426  }
427  if (m_runHisto2D) {
429  (*m_hnvtxvsbxvsorbrun)->Fill(bx % 3564, orbit, ntruevtx, weight);
431  if (ntruevtx < (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmax() &&
432  ntruevtx > (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmin()) {
433  (*m_hnvtxvsorbrun2D)->Fill(orbit, ntruevtx, weight);
434  }
435  }
436  }
437  }
438 }
TProfile2D ** m_hnvtxvsbxvsorbrun
TProfile2D ** m_hnvtxvsbxvslumirun
Definition: weight.py:1
T sqrt(T t)
Definition: SSEVec.h:23
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

Member Data Documentation

◆ m_bsConstrained

const bool VertexHistogramMaker::m_bsConstrained
private

Definition at line 50 of file VertexHistogramMaker.h.

Referenced by fill().

◆ m_currdir

TFileDirectory* VertexHistogramMaker::m_currdir
private

Definition at line 41 of file VertexHistogramMaker.h.

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

◆ m_fhm

RunHistogramManager VertexHistogramMaker::m_fhm
private

Definition at line 55 of file VertexHistogramMaker.h.

Referenced by beginRun(), and book().

◆ m_haveweight

TH1F* VertexHistogramMaker::m_haveweight
private

Definition at line 65 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_haveweightvsvtxz

TProfile* VertexHistogramMaker::m_haveweightvsvtxz
private

Definition at line 69 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_haveweightvsvtxzchk

TProfile* VertexHistogramMaker::m_haveweightvsvtxzchk
private

Definition at line 70 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_histoParameters

const edm::ParameterSet VertexHistogramMaker::m_histoParameters
private

Definition at line 51 of file VertexHistogramMaker.h.

Referenced by book().

◆ m_hndof

TH1F* VertexHistogramMaker::m_hndof
private

Definition at line 64 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hndofvstracks

TH2F* VertexHistogramMaker::m_hndofvstracks
private

Definition at line 66 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hndofvsvtxz

TProfile* VertexHistogramMaker::m_hndofvsvtxz
private

Definition at line 67 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnheavytracks

TH1F* VertexHistogramMaker::m_hnheavytracks
private

Definition at line 63 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hntracks

TH1F* VertexHistogramMaker::m_hntracks
private

Definition at line 60 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hntracksvsvtxz

TProfile* VertexHistogramMaker::m_hntracksvsvtxz
private

Definition at line 68 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hntruevtx

TH1F* VertexHistogramMaker::m_hntruevtx
private

Definition at line 57 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hntruevtxvslumi

TProfile* VertexHistogramMaker::m_hntruevtxvslumi
private

Definition at line 58 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hntruevtxvslumi2D

TH2D* VertexHistogramMaker::m_hntruevtxvslumi2D
private

Definition at line 59 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtx

TH1F* VertexHistogramMaker::m_hnvtx
private

Definition at line 56 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtxvsbxrun

TProfile** VertexHistogramMaker::m_hnvtxvsbxrun
private

Definition at line 88 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtxvsbxvslumirun

TProfile2D** VertexHistogramMaker::m_hnvtxvsbxvslumirun
private

Definition at line 90 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtxvsbxvsorbrun

TProfile2D** VertexHistogramMaker::m_hnvtxvsbxvsorbrun
private

Definition at line 82 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtxvsorbrun

TProfile** VertexHistogramMaker::m_hnvtxvsorbrun
private

Definition at line 81 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hnvtxvsorbrun2D

TH2F** VertexHistogramMaker::m_hnvtxvsorbrun2D
private

Definition at line 83 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hsqsumptsq

TH1F* VertexHistogramMaker::m_hsqsumptsq
private

Definition at line 61 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hsqsumptsqheavy

TH1F* VertexHistogramMaker::m_hsqsumptsqheavy
private

Definition at line 62 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxx

TH1F* VertexHistogramMaker::m_hvtxx
private

Definition at line 72 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxxrun

TH1F** VertexHistogramMaker::m_hvtxxrun
private

Definition at line 75 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxxvsbx2drun

TH2F** VertexHistogramMaker::m_hvtxxvsbx2drun
private

Definition at line 92 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxxvsbxrun

TProfile** VertexHistogramMaker::m_hvtxxvsbxrun
private

Definition at line 85 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxxvsorbrun

TProfile** VertexHistogramMaker::m_hvtxxvsorbrun
private

Definition at line 78 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxy

TH1F* VertexHistogramMaker::m_hvtxy
private

Definition at line 73 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxyrun

TH1F** VertexHistogramMaker::m_hvtxyrun
private

Definition at line 76 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxyvsbx2drun

TH2F** VertexHistogramMaker::m_hvtxyvsbx2drun
private

Definition at line 93 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxyvsbxrun

TProfile** VertexHistogramMaker::m_hvtxyvsbxrun
private

Definition at line 86 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxyvsorbrun

TProfile** VertexHistogramMaker::m_hvtxyvsorbrun
private

Definition at line 79 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxz

TH1F* VertexHistogramMaker::m_hvtxz
private

Definition at line 74 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxzrun

TH1F** VertexHistogramMaker::m_hvtxzrun
private

Definition at line 77 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxzvsbx2drun

TH2F** VertexHistogramMaker::m_hvtxzvsbx2drun
private

Definition at line 94 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxzvsbxrun

TProfile** VertexHistogramMaker::m_hvtxzvsbxrun
private

Definition at line 87 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hvtxzvsorbrun

TProfile** VertexHistogramMaker::m_hvtxzvsorbrun
private

Definition at line 80 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_hweights

TH1F* VertexHistogramMaker::m_hweights
private

Definition at line 71 of file VertexHistogramMaker.h.

Referenced by book(), and fill().

◆ m_lumiDetailsToken

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

Definition at line 52 of file VertexHistogramMaker.h.

Referenced by fill().

◆ m_maxLS

const unsigned int VertexHistogramMaker::m_maxLS
private

Definition at line 42 of file VertexHistogramMaker.h.

Referenced by book().

◆ m_rhm

RunHistogramManager VertexHistogramMaker::m_rhm
private

Definition at line 54 of file VertexHistogramMaker.h.

Referenced by beginRun(), and book().

◆ m_runHisto

const bool VertexHistogramMaker::m_runHisto
private

Definition at line 45 of file VertexHistogramMaker.h.

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

◆ m_runHisto2D

const bool VertexHistogramMaker::m_runHisto2D
private

Definition at line 49 of file VertexHistogramMaker.h.

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

◆ m_runHistoBXProfile

const bool VertexHistogramMaker::m_runHistoBXProfile
private

Definition at line 47 of file VertexHistogramMaker.h.

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

◆ m_runHistoBXProfile2D

const bool VertexHistogramMaker::m_runHistoBXProfile2D
private

Definition at line 48 of file VertexHistogramMaker.h.

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

◆ m_runHistoProfile

const bool VertexHistogramMaker::m_runHistoProfile
private

Definition at line 46 of file VertexHistogramMaker.h.

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

◆ m_trueOnly

const bool VertexHistogramMaker::m_trueOnly
private

Definition at line 44 of file VertexHistogramMaker.h.

Referenced by fill().

◆ m_weightThreshold

const double VertexHistogramMaker::m_weightThreshold
private

Definition at line 43 of file VertexHistogramMaker.h.

Referenced by book(), and fill().