CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingMonitor.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Suchandra Dutta , Giorgia Mila
5  */
6 
13 
21 
24 
32 
34 
35 #include <string>
36 
37 // TrackingMonitor
38 // ----------------------------------------------------------------------------------//
39 
41  : conf_ ( iConfig )
42  , theTrackBuildingAnalyzer( new TrackBuildingAnalyzer(conf_) )
43  , NumberOfTracks(NULL)
44  , NumberOfMeanRecHitsPerTrack(NULL)
45  , NumberOfMeanLayersPerTrack(NULL)
46  // , NumberOfGoodTracks(NULL)
47  , FractionOfGoodTracks(NULL)
48  , NumberOfSeeds(NULL)
49  , NumberOfSeeds_lumiFlag(NULL)
50  , NumberOfTrackCandidates(NULL)
51  // , NumberOfGoodTrkVsClus(NULL)
52  , NumberEventsOfVsLS(NULL)
53  , NumberOfTracksVsLS(NULL)
54  // , NumberOfGoodTracksVsLS(NULL)
55  , GoodTracksFractionVsLS(NULL)
56  // , GoodTracksNumberOfRecHitsPerTrackVsLS(NULL)
57  // ADD by Mia for PU monitoring
58  // vertex plots to be moved in ad hoc class
59  , NumberOfGoodPVtxVsLS(NULL)
60  , NumberOfGoodPVtxWO0VsLS(NULL)
61  , NumberEventsOfVsBX (NULL)
62  , NumberOfTracksVsBX(NULL)
63  , GoodTracksFractionVsBX(NULL)
64  , NumberOfRecHitsPerTrackVsBX(NULL)
65  , NumberOfGoodPVtxVsBX(NULL)
66  , NumberOfGoodPVtxWO0VsBX(NULL)
67  , NumberOfTracksVsBXlumi(NULL)
68  , NumberOfTracksVsGoodPVtx(NULL)
69  , NumberOfTracksVsPUPVtx(NULL)
70  , NumberEventsOfVsGoodPVtx(NULL)
71  , GoodTracksFractionVsGoodPVtx(NULL)
72  , NumberOfRecHitsPerTrackVsGoodPVtx(NULL)
73  , NumberOfPVtxVsGoodPVtx(NULL)
74  , NumberEventsOfVsLUMI(NULL)
75  , NumberOfTracksVsLUMI(NULL)
76  , GoodTracksFractionVsLUMI(NULL)
77  , NumberOfRecHitsPerTrackVsLUMI(NULL)
78  , NumberOfGoodPVtxVsLUMI(NULL)
79  , NumberOfGoodPVtxWO0VsLUMI(NULL)
80  , NumberOfTracks_lumiFlag(NULL)
81  // , NumberOfGoodTracks_lumiFlag(NULL)
82 
83  , builderName ( conf_.getParameter<std::string>("TTRHBuilder"))
84  , doTrackerSpecific_ ( conf_.getParameter<bool>("doTrackerSpecific") )
85  , doLumiAnalysis ( conf_.getParameter<bool>("doLumiAnalysis"))
86  , doProfilesVsLS_ ( conf_.getParameter<bool>("doProfilesVsLS"))
87  , doAllPlots ( conf_.getParameter<bool>("doAllPlots"))
88  , doGeneralPropertiesPlots_( conf_.getParameter<bool>("doGeneralPropertiesPlots"))
89  , doHitPropertiesPlots_ ( conf_.getParameter<bool>("doHitPropertiesPlots"))
90  , doPUmonitoring_ ( conf_.getParameter<bool>("doPUmonitoring") )
91  , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("genericTriggerEventPSet"),consumesCollector(), *this))
92  , numSelection_ (conf_.getParameter<std::string>("numCut"))
93  , denSelection_ (conf_.getParameter<std::string>("denCut"))
94  , pvNDOF_ ( conf_.getParameter<int> ("pvNDOF") )
95 {
96 
99 
100  // input tags for collections from the configuration
101  bsSrc_ = conf_.getParameter<edm::InputTag>("beamSpot");
102  pvSrc_ = conf_.getParameter<edm::InputTag>("primaryVertex");
103  bsSrcToken_ = consumes<reco::BeamSpot>(bsSrc_);
104  pvSrcToken_ = mayConsume<reco::VertexCollection>(pvSrc_);
105 
106  lumiscalersToken_ = consumes<LumiScalersCollection>(conf_.getParameter<edm::InputTag>("scal") );
107 
108  edm::InputTag alltrackProducer = conf_.getParameter<edm::InputTag>("allTrackProducer");
110  edm::InputTag tcProducer = conf_.getParameter<edm::InputTag>("TCProducer");
111  edm::InputTag seedProducer = conf_.getParameter<edm::InputTag>("SeedProducer");
112  allTrackToken_ = consumes<reco::TrackCollection>(alltrackProducer);
113  trackToken_ = consumes<reco::TrackCollection>(trackProducer);
114  trackCandidateToken_ = consumes<TrackCandidateCollection>(tcProducer);
115  seedToken_ = consumes<edm::View<TrajectorySeed> >(seedProducer);
116 
119  stripClustersToken_ = mayConsume<edmNew::DetSetVector<SiStripCluster> > (stripClusterInputTag_);
120  pixelClustersToken_ = mayConsume<edmNew::DetSetVector<SiPixelCluster> > (pixelClusterInputTag_);
121 
122  doFractionPlot_ = true;
123  if (alltrackProducer.label()==trackProducer.label()) doFractionPlot_ = false;
124 
125  Quality_ = conf_.getParameter<std::string>("Quality");
126  AlgoName_ = conf_.getParameter<std::string>("AlgoName");
127 
128  // get flag from the configuration
129  doPlotsVsBXlumi_ = conf_.getParameter<bool>("doPlotsVsBXlumi");
130  if ( doPlotsVsBXlumi_ )
131  theLumiDetails_ = new GetLumi( iConfig.getParameter<edm::ParameterSet>("BXlumiSetup"), c );
132  doPlotsVsGoodPVtx_ = conf_.getParameter<bool>("doPlotsVsGoodPVtx");
133  doPlotsVsLUMI_ = conf_.getParameter<bool>("doPlotsVsLUMI");
134  doPlotsVsBX_ = conf_.getParameter<bool>("doPlotsVsBX");
135 
136  if ( doPUmonitoring_ ) {
137 
138  std::vector<edm::InputTag> primaryVertexInputTags = conf_.getParameter<std::vector<edm::InputTag> >("primaryVertexInputTags");
139  std::vector<edm::InputTag> selPrimaryVertexInputTags = conf_.getParameter<std::vector<edm::InputTag> >("selPrimaryVertexInputTags");
140  std::vector<std::string> pvLabels = conf_.getParameter<std::vector<std::string> > ("pvLabels");
141 
142  if (primaryVertexInputTags.size()==pvLabels.size() and primaryVertexInputTags.size()==selPrimaryVertexInputTags.size()) {
143  for (size_t i=0; i<primaryVertexInputTags.size(); i++) {
144  edm::InputTag iPVinputTag = primaryVertexInputTags[i];
145  edm::InputTag iSelPVinputTag = selPrimaryVertexInputTags[i];
146  std::string iPVlabel = pvLabels[i];
147 
148  theVertexMonitor.push_back(new VertexMonitor(conf_,iPVinputTag,iSelPVinputTag,iPVlabel,c) );
149  }
150  }
151  }
152 
153 }
154 
155 
157 {
160  if ( doPUmonitoring_ )
161  for (size_t i=0; i<theVertexMonitor.size(); i++)
162  if (theVertexMonitor[i]) delete theVertexMonitor[i];
164 }
165 
166 
168 {
169 
170 
171 }
172 
174  edm::Run const & iRun,
175  edm::EventSetup const & iSetup)
176 {
177  // parameters from the configuration
180  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
181 
182  // test for the Quality veriable validity
183  if( Quality_ != "") {
184  if( Quality_ != "highPurity" && Quality_ != "tight" && Quality_ != "loose") {
185  edm::LogWarning("TrackingMonitor") << "Qualty Name is invalid, using no quality criterea by default";
186  Quality_ = "";
187  }
188  }
189 
190  // use the AlgoName and Quality Name
191  std::string CategoryName = Quality_ != "" ? AlgoName_ + "_" + Quality_ : AlgoName_;
192 
193  // get binning from the configuration
194  int TKNoBin = conf_.getParameter<int>( "TkSizeBin");
195  double TKNoMin = conf_.getParameter<double>("TkSizeMin");
196  double TKNoMax = conf_.getParameter<double>("TkSizeMax");
197 
198  int TCNoBin = conf_.getParameter<int>( "TCSizeBin");
199  double TCNoMin = conf_.getParameter<double>("TCSizeMin");
200  double TCNoMax = conf_.getParameter<double>("TCSizeMax");
201 
202  int TKNoSeedBin = conf_.getParameter<int>( "TkSeedSizeBin");
203  double TKNoSeedMin = conf_.getParameter<double>("TkSeedSizeMin");
204  double TKNoSeedMax = conf_.getParameter<double>("TkSeedSizeMax");
205 
206  int MeanHitBin = conf_.getParameter<int>( "MeanHitBin");
207  double MeanHitMin = conf_.getParameter<double>("MeanHitMin");
208  double MeanHitMax = conf_.getParameter<double>("MeanHitMax");
209 
210  int MeanLayBin = conf_.getParameter<int>( "MeanLayBin");
211  double MeanLayMin = conf_.getParameter<double>("MeanLayMin");
212  double MeanLayMax = conf_.getParameter<double>("MeanLayMax");
213 
214  int LSBin = conf_.getParameter<int>( "LSBin");
215  int LSMin = conf_.getParameter<double>("LSMin");
216  int LSMax = conf_.getParameter<double>("LSMax");
217 
218  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
219  if (
220  StateName != "OuterSurface" &&
221  StateName != "InnerSurface" &&
222  StateName != "ImpactPoint" &&
223  StateName != "default" &&
224  StateName != "All"
225  ) {
226  // print warning
227  edm::LogWarning("TrackingMonitor") << "State Name is invalid, using 'ImpactPoint' by default";
228  }
229 
230  ibooker.setCurrentFolder(MEFolderName);
231 
232  // book the General Property histograms
233  // ---------------------------------------------------------------------------------//
234 
236 
237  ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties");
238 
239  histname = "NumberOfTracks_" + CategoryName;
240  // MODIFY by Mia in order to cope w/ high multiplicity
241  NumberOfTracks = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5);
242  NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1);
243  NumberOfTracks->setAxisTitle("Number of Events", 2);
244 
245  histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName;
246  NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax);
247  NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1);
249 
250  histname = "NumberOfMeanLayersPerTrack_" + CategoryName;
251  NumberOfMeanLayersPerTrack = ibooker.book1D(histname, histname, MeanLayBin, MeanLayMin, MeanLayMax);
252  NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per Track", 1);
254 
255  if (doFractionPlot_) {
256  histname = "FractionOfGoodTracks_" + CategoryName;
257  FractionOfGoodTracks = ibooker.book1D(histname, histname, 101, -0.005, 1.005);
258  FractionOfGoodTracks->setAxisTitle("Fraction of Tracks (w.r.t. generalTracks)", 1);
259  FractionOfGoodTracks->setAxisTitle("Entries", 2);
260  }
261  }
262 
263  if ( doLumiAnalysis ) {
264  // add by Mia in order to deal with LS transitions
265  ibooker.setCurrentFolder(MEFolderName+"/LSanalysis");
266 
267  histname = "NumberOfTracks_lumiFlag_" + CategoryName;
268  NumberOfTracks_lumiFlag = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5);
269  NumberOfTracks_lumiFlag->setAxisTitle("Number of Tracks per Event", 1);
270  NumberOfTracks_lumiFlag->setAxisTitle("Number of Events", 2);
271 
272  }
273 
274  // book profile plots vs LS :
275  //---------------------------
276 
277 
278  if ( doProfilesVsLS_ || doAllPlots) {
279 
280  ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties");
281 
282  histname = "NumberOfTracksVsLS_"+ CategoryName;
283  NumberOfTracksVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax, TKNoMin, (TKNoMax+0.5)*3.-0.5,"");
284  NumberOfTracksVsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
285  NumberOfTracksVsLS->setAxisTitle("#Lumi section",1);
286  NumberOfTracksVsLS->setAxisTitle("Number of Tracks",2);
287 
288  histname = "NumberOfRecHitsPerTrackVsLS_" + CategoryName;
289  NumberOfRecHitsPerTrackVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0.,40.,"");
290  NumberOfRecHitsPerTrackVsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
291  NumberOfRecHitsPerTrackVsLS->setAxisTitle("#Lumi section",1);
292  NumberOfRecHitsPerTrackVsLS->setAxisTitle("Mean number of Valid RecHits per track",2);
293 
294  histname = "NumberEventsVsLS_" + CategoryName;
295  NumberEventsOfVsLS = ibooker.book1D(histname,histname, LSBin,LSMin,LSMax);
296  NumberEventsOfVsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
297  NumberEventsOfVsLS->setAxisTitle("#Lumi section",1);
298  NumberEventsOfVsLS->setAxisTitle("Number of events",2);
299 
300  double GoodPVtxMin = conf_.getParameter<double>("GoodPVtxMin");
301  double GoodPVtxMax = conf_.getParameter<double>("GoodPVtxMax");
302 
303  histname = "NumberOfGoodPVtxVsLS_" + CategoryName;
304  NumberOfGoodPVtxVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,GoodPVtxMax,"");
305  NumberOfGoodPVtxVsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
306  NumberOfGoodPVtxVsLS->setAxisTitle("#Lumi section",1);
307  NumberOfGoodPVtxVsLS->setAxisTitle("Mean number of good PV",2);
308 
309  histname = "NumberOfGoodPVtxWO0VsLS_" + CategoryName;
310  NumberOfGoodPVtxWO0VsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,GoodPVtxMax,"");
311  NumberOfGoodPVtxWO0VsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
312  NumberOfGoodPVtxWO0VsLS->setAxisTitle("#Lumi section",1);
313  NumberOfGoodPVtxWO0VsLS->setAxisTitle("Mean number of good PV",2);
314 
315  if (doFractionPlot_) {
316  histname = "GoodTracksFractionVsLS_"+ CategoryName;
317  GoodTracksFractionVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0,1.1,"");
318  GoodTracksFractionVsLS->getTH1()->SetCanExtend(TH1::kAllAxes);
319  GoodTracksFractionVsLS->setAxisTitle("#Lumi section",1);
320  GoodTracksFractionVsLS->setAxisTitle("Fraction of Good Tracks",2);
321  }
322 
323  if ( doPlotsVsBX_ || doAllPlots ) {
324  ibooker.setCurrentFolder(MEFolderName+"/BXanalysis");
325  int BXBin = 3564; double BXMin = 0.5; double BXMax = 3564.5;
326 
327  histname = "NumberEventsVsBX_" + CategoryName;
328  NumberEventsOfVsBX = ibooker.book1D(histname,histname, BXBin,BXMin,BXMax);
329  NumberEventsOfVsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
331  NumberEventsOfVsBX->setAxisTitle("Number of events",2);
332 
333  histname = "NumberOfTracksVsBX_"+ CategoryName;
334  NumberOfTracksVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax, TKNoMin, (TKNoMax+0.5)*3.-0.5,"");
335  NumberOfTracksVsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
337  NumberOfTracksVsBX->setAxisTitle("Number of Tracks",2);
338 
339  histname = "NumberOfRecHitsPerTrackVsBX_" + CategoryName;
340  NumberOfRecHitsPerTrackVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0.,40.,"");
341  NumberOfRecHitsPerTrackVsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
343  NumberOfRecHitsPerTrackVsBX->setAxisTitle("Mean number of Valid RecHits per track",2);
344 
345  histname = "NumberOfGoodPVtxVsBX_" + CategoryName;
346  NumberOfGoodPVtxVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,GoodPVtxMax,"");
347  NumberOfGoodPVtxVsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
349  NumberOfGoodPVtxVsBX->setAxisTitle("Mean number of good PV",2);
350 
351  histname = "NumberOfGoodPVtxWO0VsBX_" + CategoryName;
352  NumberOfGoodPVtxWO0VsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,GoodPVtxMax,"");
353  NumberOfGoodPVtxWO0VsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
355  NumberOfGoodPVtxWO0VsBX->setAxisTitle("Mean number of good PV",2);
356 
357  if (doFractionPlot_) {
358  histname = "GoodTracksFractionVsBX_"+ CategoryName;
359  GoodTracksFractionVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0,1.1,"");
360  GoodTracksFractionVsBX->getTH1()->SetCanExtend(TH1::kAllAxes);
362  GoodTracksFractionVsBX->setAxisTitle("Fraction of Good Tracks",2);
363  }
364  }
365 
366  }
367 
368  // book PU monitoring plots :
369  //---------------------------
370 
371  if ( doPUmonitoring_ ) {
372 
373  for (size_t i=0; i<theVertexMonitor.size(); i++)
374  theVertexMonitor[i]->initHisto(ibooker);
375  }
376 
377  if ( doPlotsVsGoodPVtx_ ) {
378  ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring");
379  // get binning from the configuration
380  int GoodPVtxBin = conf_.getParameter<int>("GoodPVtxBin");
381  double GoodPVtxMin = conf_.getParameter<double>("GoodPVtxMin");
382  double GoodPVtxMax = conf_.getParameter<double>("GoodPVtxMax");
383 
384  histname = "NumberOfTracksVsGoodPVtx";
385  NumberOfTracksVsGoodPVtx = ibooker.bookProfile(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax,TKNoMin, (TKNoMax+0.5)*3.-0.5,"");
386  NumberOfTracksVsGoodPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
387  NumberOfTracksVsGoodPVtx->setAxisTitle("Number of PV",1);
388  NumberOfTracksVsGoodPVtx->setAxisTitle("Mean number of Tracks per Event",2);
389 
390  histname = "NumberOfTracksVsPUPVtx";
391  NumberOfTracksVsPUPVtx = ibooker.bookProfile(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax,0., 100.,"");
392  NumberOfTracksVsPUPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
393  NumberOfTracksVsPUPVtx->setAxisTitle("Number of PU",1);
394  NumberOfTracksVsPUPVtx->setAxisTitle("Mean number of Tracks per PUvtx",2);
395 
396  histname = "NumberEventsVsGoodPVtx";
397  NumberEventsOfVsGoodPVtx = ibooker.book1D(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax);
398  NumberEventsOfVsGoodPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
399  NumberEventsOfVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1);
400  NumberEventsOfVsGoodPVtx->setAxisTitle("Number of events",2);
401 
402  if (doFractionPlot_) {
403  histname = "GoodTracksFractionVsGoodPVtx";
404  GoodTracksFractionVsGoodPVtx = ibooker.bookProfile(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax,0., 400.,"");
405  GoodTracksFractionVsGoodPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
406  GoodTracksFractionVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1);
407  GoodTracksFractionVsGoodPVtx->setAxisTitle("Mean fraction of good tracks",2);
408  }
409 
410  histname = "NumberOfRecHitsPerTrackVsGoodPVtx";
411  NumberOfRecHitsPerTrackVsGoodPVtx = ibooker.bookProfile(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax,0., 100.,"");
412  NumberOfRecHitsPerTrackVsGoodPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
413  NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1);
414  NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Mean number of valid rechits per Tracks",2);
415 
416  histname = "NumberOfPVtxVsGoodPVtx";
417  NumberOfPVtxVsGoodPVtx = ibooker.bookProfile(histname,histname,GoodPVtxBin,GoodPVtxMin,GoodPVtxMax,0., 100.,"");
418  NumberOfPVtxVsGoodPVtx->getTH1()->SetCanExtend(TH1::kAllAxes);
419  NumberOfPVtxVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1);
420  NumberOfPVtxVsGoodPVtx->setAxisTitle("Mean number of vertices",2);
421  }
422 
423 
424  if ( doPlotsVsLUMI_ || doAllPlots ) {
425  ibooker.setCurrentFolder(MEFolderName+"/LUMIanalysis");
426  int LUMIBin = conf_.getParameter<int>("LUMIBin");
427  float LUMIMin = conf_.getParameter<double>("LUMIMin");
428  float LUMIMax = conf_.getParameter<double>("LUMIMax");
429 
430  histname = "NumberEventsVsLUMI";
431  NumberEventsOfVsLUMI = ibooker.book1D(histname,histname,LUMIBin,LUMIMin,LUMIMax);
432  NumberEventsOfVsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
433  NumberEventsOfVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
434  NumberEventsOfVsLUMI->setAxisTitle("Number of events",2);
435 
436  histname = "NumberOfTracksVsLUMI";
437  NumberOfTracksVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 400.,"");
438  NumberOfTracksVsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
439  NumberOfTracksVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
440  NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices",2);
441 
442  if (doFractionPlot_) {
443  histname = "GoodTracksFractionVsLUMI";
444  GoodTracksFractionVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 100.,"");
445  GoodTracksFractionVsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
446  GoodTracksFractionVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
447  GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices",2);
448  }
449 
450  histname = "NumberOfRecHitsPerTrackVsLUMI";
451  NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 20.,"");
452  NumberOfRecHitsPerTrackVsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
453  NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
454  NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices",2);
455 
456  double GoodPVtxMin = conf_.getParameter<double>("GoodPVtxMin");
457  double GoodPVtxMax = conf_.getParameter<double>("GoodPVtxMax");
458 
459  histname = "NumberOfGoodPVtxVsLUMI";
460  NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,GoodPVtxMin,GoodPVtxMax,"");
461  NumberOfGoodPVtxVsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
462  NumberOfGoodPVtxVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
463  NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices",2);
464 
465  histname = "NumberOfGoodPVtxWO0VsLUMI";
466  NumberOfGoodPVtxWO0VsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,GoodPVtxMin,GoodPVtxMax,"");
467  NumberOfGoodPVtxWO0VsLUMI->getTH1()->SetCanExtend(TH1::kAllAxes);
468  NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1);
469  NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices",2);
470  }
471 
472 
473  if ( doPlotsVsBXlumi_ ) {
474  ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring");
475  // get binning from the configuration
476  edm::ParameterSet BXlumiParameters = conf_.getParameter<edm::ParameterSet>("BXlumiSetup");
477  int BXlumiBin = BXlumiParameters.getParameter<int>("BXlumiBin");
478  double BXlumiMin = BXlumiParameters.getParameter<double>("BXlumiMin");
479  double BXlumiMax = BXlumiParameters.getParameter<double>("BXlumiMax");
480 
481  histname = "NumberOfTracksVsBXlumi_"+ CategoryName;
482  NumberOfTracksVsBXlumi = ibooker.bookProfile(histname,histname, BXlumiBin,BXlumiMin,BXlumiMax, TKNoMin, TKNoMax,"");
483  NumberOfTracksVsBXlumi->getTH1()->SetCanExtend(TH1::kAllAxes);
484  NumberOfTracksVsBXlumi->setAxisTitle("lumi BX [10^{30}Hzcm^{-2}]",1);
485  NumberOfTracksVsBXlumi->setAxisTitle("Mean number of Tracks",2);
486 
487  }
488 
489 
490  theTrackAnalyzer->initHisto(ibooker, iSetup);
491 
492  // book the Seed Property histograms
493  // ---------------------------------------------------------------------------------//
494 
495  ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding");
496 
497  doAllSeedPlots = conf_.getParameter<bool>("doSeedParameterHistos");
498  doSeedNumberPlot = conf_.getParameter<bool>("doSeedNumberHisto");
499  doSeedLumiAnalysis_ = conf_.getParameter<bool>("doSeedLumiAnalysis");
500  doSeedVsClusterPlot = conf_.getParameter<bool>("doSeedVsClusterHisto");
501  // if (doAllPlots) doAllSeedPlots=true;
502 
503  runTrackBuildingAnalyzerForSeed=(doAllSeedPlots || conf_.getParameter<bool>("doSeedPTHisto") ||conf_.getParameter<bool>("doSeedETAHisto") || conf_.getParameter<bool>("doSeedPHIHisto") || conf_.getParameter<bool>("doSeedPHIVsETAHisto") || conf_.getParameter<bool>("doSeedThetaHisto") || conf_.getParameter<bool>("doSeedQHisto") || conf_.getParameter<bool>("doSeedDxyHisto") || conf_.getParameter<bool>("doSeedDzHisto") || conf_.getParameter<bool>("doSeedNRecHitsHisto") || conf_.getParameter<bool>("doSeedNVsPhiProf")|| conf_.getParameter<bool>("doSeedNVsEtaProf"));
504 
505  edm::InputTag seedProducer = conf_.getParameter<edm::InputTag>("SeedProducer");
506 
507  if (doAllSeedPlots || doSeedNumberPlot){
508  ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding");
509  histname = "NumberOfSeeds_"+ seedProducer.label() + "_"+ CategoryName;
510  NumberOfSeeds = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax);
511  NumberOfSeeds->setAxisTitle("Number of Seeds per Event", 1);
512  NumberOfSeeds->setAxisTitle("Number of Events", 2);
513 
514  if ( doSeedLumiAnalysis_ ) {
515  ibooker.setCurrentFolder(MEFolderName+"/LSanalysis");
516  histname = "NumberOfSeeds_lumiFlag_"+ seedProducer.label() + "_"+ CategoryName;
517  NumberOfSeeds_lumiFlag = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax);
518  NumberOfSeeds_lumiFlag->setAxisTitle("Number of Seeds per Event", 1);
519  NumberOfSeeds_lumiFlag->setAxisTitle("Number of Events", 2);
520  }
521 
522  }
523 
524  if (doAllSeedPlots || doSeedVsClusterPlot){
525  ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding");
526 
527  ClusterLabels= conf_.getParameter<std::vector<std::string> >("ClusterLabels");
528 
529  std::vector<double> histoMin,histoMax;
530  std::vector<int> histoBin; //these vectors are for max min and nbins in histograms
531 
532  int NClusPxBin = conf_.getParameter<int>( "NClusPxBin");
533  double NClusPxMin = conf_.getParameter<double>("NClusPxMin");
534  double NClusPxMax = conf_.getParameter<double>("NClusPxMax");
535 
536  int NClusStrBin = conf_.getParameter<int>( "NClusStrBin");
537  double NClusStrMin = conf_.getParameter<double>("NClusStrMin");
538  double NClusStrMax = conf_.getParameter<double>("NClusStrMax");
539 
540  setMaxMinBin(histoMin,histoMax,histoBin,NClusStrMin,NClusStrMax,NClusStrBin,NClusPxMin,NClusPxMax,NClusPxBin);
541 
542  for (uint i=0; i<ClusterLabels.size(); i++){
543  histname = "SeedsVsClusters_" + seedProducer.label() + "_Vs_" + ClusterLabels[i] + "_" + CategoryName;
544  SeedsVsClusters.push_back(dynamic_cast<MonitorElement*>(ibooker.book2D(histname, histname, histoBin[i], histoMin[i], histoMax[i],
545  TKNoSeedBin, TKNoSeedMin, TKNoSeedMax)));
546  SeedsVsClusters[i]->setAxisTitle("Number of Clusters", 1);
547  SeedsVsClusters[i]->setAxisTitle("Number of Seeds", 2);
548  SeedsVsClusters[i]->getTH2F()->SetCanExtend(TH1::kAllAxes);
549  }
550  }
551 
552  doTkCandPlots=conf_.getParameter<bool>("doTrackCandHistos");
553  // if (doAllPlots) doTkCandPlots=true;
554 
555  if (doTkCandPlots){
556  ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding");
557 
558  edm::InputTag tcProducer = conf_.getParameter<edm::InputTag>("TCProducer");
559 
560  histname = "NumberOfTrackCandidates_"+ tcProducer.label() + "_"+ CategoryName;
561  NumberOfTrackCandidates = ibooker.book1D(histname, histname, TCNoBin, TCNoMin, TCNoMax);
562  NumberOfTrackCandidates->setAxisTitle("Number of Track Candidates per Event", 1);
563  NumberOfTrackCandidates->setAxisTitle("Number of Event", 2);
564  }
565 
567 
568 
569  if (doLumiAnalysis) {
570  if ( NumberOfTracks_lumiFlag ) NumberOfTracks_lumiFlag -> setLumiFlag();
572  }
573 
574  if(doAllSeedPlots || doSeedNumberPlot){
575  if ( doSeedLumiAnalysis_ )
577  }
578 
580 
581  ClusterLabels= conf_.getParameter<std::vector<std::string> >("ClusterLabels");
582 
583  std::vector<double> histoMin,histoMax;
584  std::vector<int> histoBin; //these vectors are for max min and nbins in histograms
585 
586  int NClusStrBin = conf_.getParameter<int>( "NClusStrBin");
587  double NClusStrMin = conf_.getParameter<double>("NClusStrMin");
588  double NClusStrMax = conf_.getParameter<double>("NClusStrMax");
589 
590  int NClusPxBin = conf_.getParameter<int>( "NClusPxBin");
591  double NClusPxMin = conf_.getParameter<double>("NClusPxMin");
592  double NClusPxMax = conf_.getParameter<double>("NClusPxMax");
593 
594  int NTrk2DBin = conf_.getParameter<int>( "NTrk2DBin");
595  double NTrk2DMin = conf_.getParameter<double>("NTrk2DMin");
596  double NTrk2DMax = conf_.getParameter<double>("NTrk2DMax");
597 
598  setMaxMinBin(histoMin,histoMax,histoBin,
599  NClusStrMin,NClusStrMax,NClusStrBin,
600  NClusPxMin, NClusPxMax, NClusPxBin);
601 
602  ibooker.setCurrentFolder(MEFolderName+"/HitProperties");
603 
604  for (uint i=0; i<ClusterLabels.size(); i++){
605 
606  ibooker.setCurrentFolder(MEFolderName+"/HitProperties");
607  histname = "TracksVs" + ClusterLabels[i] + "Cluster_" + CategoryName;
608  NumberOfTrkVsClusters.push_back(dynamic_cast<MonitorElement*>(ibooker.book2D(histname, histname,
609  histoBin[i], histoMin[i], histoMax[i],
610  NTrk2DBin,NTrk2DMin,NTrk2DMax
611  )));
612  std::string title = "Number of " + ClusterLabels[i] + " Clusters";
613  if(ClusterLabels[i].compare("Tot")==0)
614  title = "# of Clusters in (Pixel+Strip) Detectors";
615  NumberOfTrkVsClusters[i]->setAxisTitle(title, 1);
616  NumberOfTrkVsClusters[i]->setAxisTitle("Number of Tracks", 2);
617  NumberOfTrkVsClusters[i]->getTH1()->SetCanExtend(TH1::kXaxis);
618  }
619  }
620 
621  // Initialize the GenericTriggerEventFlag
622  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
623 
624 }
625 
626 /*
627 // -- BeginRun
628 //---------------------------------------------------------------------------------//
629 void TrackingMonitor::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
630 {
631 
632 }
633 */
634 
635 // - BeginLumi
636 // ---------------------------------------------------------------------------------//
638 
639  if (doLumiAnalysis) {
642  }
644  if ( doSeedLumiAnalysis_ )
646  }
647 }
648 
649 // -- Analyse
650 // ---------------------------------------------------------------------------------//
652 {
653 
654  // Filter out events if Trigger Filtering is requested
655  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
656 
657  float lumi = -1.;
659  iEvent.getByToken(lumiscalersToken_, lumiScalers);
660  if ( lumiScalers.isValid() && lumiScalers->size() ) {
661  LumiScalersCollection::const_iterator scalit = lumiScalers->begin();
662  lumi = scalit->instantLumi();
663  } else
664  lumi = -1.;
665 
666  if (doPlotsVsLUMI_ || doAllPlots)
667  NumberEventsOfVsLUMI->Fill(lumi);
668 
669  // Analyse the tracks
670  // if the collection is empty, do not fill anything
671  // ---------------------------------------------------------------------------------//
672 
673  size_t bx = iEvent.bunchCrossing();
674  if ( doPlotsVsBX_ || doAllPlots )
676 
677  // get the track collection
679  iEvent.getByToken(trackToken_, trackHandle);
680 
681  int numberOfTracks_den = 0;
682  edm::Handle<reco::TrackCollection> allTrackHandle;
683  iEvent.getByToken(allTrackToken_,allTrackHandle);
684  if (allTrackHandle.isValid()) {
685  for (reco::TrackCollection::const_iterator track = allTrackHandle->begin();
686  track!=allTrackHandle->end(); ++track) {
687  if ( denSelection_(*track) )
688  numberOfTracks_den++;
689  }
690  }
691 
693  iEvent.getByToken(pvSrcToken_, pvHandle );
694  reco::Vertex const * pv0 = nullptr;
695  if (pvHandle.isValid()) {
696  pv0 = &pvHandle->front();
697  //--- pv fake (the pv collection should have size==1 and the pv==beam spot)
698  if ( pv0->isFake() || pv0->tracksSize()==0
699  // definition of goodOfflinePrimaryVertex
700  || pv0->ndof() < pvNDOF_ || pv0->z() > 24.) pv0 = nullptr;
701  }
702 
703 
704  if (trackHandle.isValid()) {
705 
706  int numberOfTracks = trackHandle->size();
707  int numberOfTracks_num = 0;
708  int numberOfTracks_pv0 = 0;
709 
710  reco::TrackCollection trackCollection = *trackHandle;
711  // calculate the mean # rechits and layers
712  int totalRecHits = 0, totalLayers = 0;
713 
715  theTrackAnalyzer->setBX(iEvent);
716  theTrackAnalyzer->setLumi(iEvent,iSetup);
717  for (reco::TrackCollection::const_iterator track = trackCollection.begin();
718  track!=trackCollection.end(); ++track) {
719 
720  if ( doPlotsVsBX_ || doAllPlots )
721  NumberOfRecHitsPerTrackVsBX->Fill(bx,track->numberOfValidHits());
722  if ( numSelection_(*track) ) {
723  numberOfTracks_num++;
724  if (pv0 && std::abs(track->dz(pv0->position()))<0.15) ++numberOfTracks_pv0;
725  }
726 
727  if ( doProfilesVsLS_ || doAllPlots)
728  NumberOfRecHitsPerTrackVsLS->Fill(static_cast<double>(iEvent.id().luminosityBlock()),track->numberOfValidHits());
729 
730  if (doPlotsVsLUMI_ || doAllPlots)
731  NumberOfRecHitsPerTrackVsLUMI->Fill(lumi,track->numberOfValidHits());
732 
733  totalRecHits += track->numberOfValidHits();
734  totalLayers += track->hitPattern().trackerLayersWithMeasurement();
735 
736  // do analysis per track
737  theTrackAnalyzer->analyze(iEvent, iSetup, *track);
738  }
739 
740  double frac = -1.;
741  // if (numberOfAllTracks > 0) frac = static_cast<double>(numberOfTracks)/static_cast<double>(numberOfAllTracks);
742  if (numberOfTracks_den > 0) frac = static_cast<double>(numberOfTracks_num)/static_cast<double>(numberOfTracks_den);
743 
745  NumberOfTracks -> Fill(numberOfTracks);
746  if ( doPlotsVsBX_ || doAllPlots )
747  NumberOfTracksVsBX -> Fill(bx,numberOfTracks);
748  if (doPlotsVsLUMI_ || doAllPlots)
749  NumberOfTracksVsLUMI -> Fill(lumi,numberOfTracks);
750  if (doFractionPlot_) {
751  FractionOfGoodTracks -> Fill(frac);
752 
753  if (doFractionPlot_) {
754  if ( doPlotsVsBX_ || doAllPlots )
755  GoodTracksFractionVsBX -> Fill(bx, frac);
756  if (doPlotsVsLUMI_ || doAllPlots)
757  GoodTracksFractionVsLUMI -> Fill(lumi,frac);
758  }
759  }
760  if( numberOfTracks > 0 ) {
761  double meanRecHits = static_cast<double>(totalRecHits) / static_cast<double>(numberOfTracks);
762  double meanLayers = static_cast<double>(totalLayers) / static_cast<double>(numberOfTracks);
763  NumberOfMeanRecHitsPerTrack -> Fill(meanRecHits);
764  NumberOfMeanLayersPerTrack -> Fill(meanLayers);
765  }
766  }
767 
768  if ( doProfilesVsLS_ || doAllPlots) {
769  float nLS = static_cast<double>(iEvent.id().luminosityBlock());
770  NumberEventsOfVsLS ->Fill(nLS);
771  NumberOfTracksVsLS ->Fill(nLS,numberOfTracks);
772  if (doFractionPlot_)
773  GoodTracksFractionVsLS->Fill(nLS,frac);
774  }
775 
776  if ( doLumiAnalysis ) {
777  NumberOfTracks_lumiFlag -> Fill(numberOfTracks);
778  }
779 
780 
781  // Analyse the Track Building variables
782  // if the collection is empty, do not fill anything
783  // ---------------------------------------------------------------------------------//
784 
785 
786  // fill the TrackCandidate info
787  if (doTkCandPlots) {
788  // magnetic field
790  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
791 
792  // get the candidate collection
794  iEvent.getByToken( trackCandidateToken_, theTCHandle );
795  const TrackCandidateCollection& theTCCollection = *theTCHandle;
796 
797  if (theTCHandle.isValid()) {
798 
799  // get the beam spot
800  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
801  iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle );
802  const reco::BeamSpot& bs = *recoBeamSpotHandle;
803 
804  NumberOfTrackCandidates->Fill(theTCCollection.size());
806  for( TrackCandidateCollection::const_iterator cand = theTCCollection.begin(); cand != theTCCollection.end(); ++cand) {
807 
808  theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *cand, bs, theMF, theTTRHBuilder);
809  }
810  } else {
811  edm::LogWarning("TrackingMonitor") << "No Track Candidates in the event. Not filling associated histograms";
812  }
813  }
814 
815  //plots for trajectory seeds
816 
818 
819  // get the seed collection
821  iEvent.getByToken(seedToken_, seedHandle );
822  const edm::View<TrajectorySeed>& seedCollection = *seedHandle;
823 
824  // fill the seed info
825  if (seedHandle.isValid()) {
826 
828  NumberOfSeeds->Fill(seedCollection.size());
829  if ( doSeedLumiAnalysis_ )
830  NumberOfSeeds_lumiFlag->Fill(seedCollection.size());
831  }
832 
834 
835  std::vector<int> NClus;
836  setNclus(iEvent,NClus);
837  for (uint i=0; i< ClusterLabels.size(); i++){
838  SeedsVsClusters[i]->Fill(NClus[i],seedCollection.size());
839  }
840  }
841 
843 
844  //here duplication of mag field and be informations is needed to allow seed and track cand histos to be independent
845  // magnetic field
847  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
848 
849  // get the beam spot
850  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
851  iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle );
852  const reco::BeamSpot& bs = *recoBeamSpotHandle;
853 
855  for(size_t i=0; i < seedHandle->size(); ++i) {
856 
858  theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *seed, bs, theMF, theTTRHBuilder);
859  }
860  }
861 
862  } else {
863  edm::LogWarning("TrackingMonitor") << "No Trajectory seeds in the event. Not filling associated histograms";
864  }
865  }
866 
867 
869 
870  std::vector<int> NClus;
871  setNclus(iEvent,NClus);
872  for (uint i=0; i< ClusterLabels.size(); i++) {
873  NumberOfTrkVsClusters[i]->Fill(NClus[i],numberOfTracks);
874  }
875  }
876 
877  if ( doPUmonitoring_ ) {
878 
879  // do vertex monitoring
880  for (size_t i=0; i<theVertexMonitor.size(); i++)
881  theVertexMonitor[i]->analyze(iEvent, iSetup);
882  }
883  if ( doPlotsVsGoodPVtx_ ) {
884 
885  size_t totalNumGoodPV = 0;
886  if (pvHandle.isValid()) {
887 
888  for (reco::VertexCollection::const_iterator pv = pvHandle->begin();
889  pv != pvHandle->end(); ++pv) {
890 
891  //--- pv fake (the pv collection should have size==1 and the pv==beam spot)
892  if (pv->isFake() || pv->tracksSize()==0) continue;
893 
894  // definition of goodOfflinePrimaryVertex
895  if (pv->ndof() < pvNDOF_ || pv->z() > 24.) continue;
896  totalNumGoodPV++;
897  }
898 
899  NumberEventsOfVsGoodPVtx -> Fill( float(totalNumGoodPV) );
900  NumberOfTracksVsGoodPVtx -> Fill( float(totalNumGoodPV), numberOfTracks );
901  if (totalNumGoodPV>1) NumberOfTracksVsPUPVtx-> Fill( totalNumGoodPV-1, double(numberOfTracks-numberOfTracks_pv0)/double(totalNumGoodPV-1) );
902  NumberOfPVtxVsGoodPVtx -> Fill(float(totalNumGoodPV),pvHandle->size());
903 
904  for (reco::TrackCollection::const_iterator track = trackCollection.begin();
905  track!=trackCollection.end(); ++track) {
906  NumberOfRecHitsPerTrackVsGoodPVtx -> Fill(float(totalNumGoodPV), track->numberOfValidHits());
907  }
908 
909  if ( doProfilesVsLS_ || doAllPlots)
910  NumberOfGoodPVtxVsLS->Fill(static_cast<double>(iEvent.id().luminosityBlock()),totalNumGoodPV);
911  if ( doPlotsVsBX_ || doAllPlots )
912  NumberOfGoodPVtxVsBX->Fill(bx, float(totalNumGoodPV));
913 
914  if (doFractionPlot_)
915  GoodTracksFractionVsGoodPVtx->Fill(float(totalNumGoodPV),frac);
916 
917  if ( doPlotsVsLUMI_ || doAllPlots )
918  NumberOfGoodPVtxVsLUMI->Fill(lumi,float(totalNumGoodPV));
919  }
920 
921 
922  if ( doPlotsVsBXlumi_ ) {
923  double bxlumi = theLumiDetails_->getValue(iEvent);
924  NumberOfTracksVsBXlumi -> Fill( bxlumi, numberOfTracks );
925  }
926 
927  if ( doProfilesVsLS_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLS -> Fill(static_cast<double>(iEvent.id().luminosityBlock()),float(totalNumGoodPV));
928  if ( doPlotsVsBX_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsBX -> Fill(bx, float(totalNumGoodPV));
929  if ( doPlotsVsLUMI_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLUMI-> Fill(lumi,float(totalNumGoodPV));
930 
931  } // PU monitoring
932 
933  } // trackHandle is valid
934 
935 }
936 
937 
939 {
940 }
941 
942 void TrackingMonitor::setMaxMinBin(std::vector<double> &arrayMin, std::vector<double> &arrayMax, std::vector<int> &arrayBin, double smin, double smax, int sbin, double pmin, double pmax, int pbin)
943 {
944  arrayMin.resize(ClusterLabels.size());
945  arrayMax.resize(ClusterLabels.size());
946  arrayBin.resize(ClusterLabels.size());
947 
948  for (uint i=0; i<ClusterLabels.size(); ++i) {
949 
950  if (ClusterLabels[i].compare("Pix")==0 ) {arrayMin[i]=pmin; arrayMax[i]=pmax; arrayBin[i]=pbin;}
951  else if(ClusterLabels[i].compare("Strip")==0) {arrayMin[i]=smin; arrayMax[i]=smax; arrayBin[i]=sbin;}
952  else if(ClusterLabels[i].compare("Tot")==0 ) {arrayMin[i]=smin; arrayMax[i]=smax+pmax; arrayBin[i]=sbin;}
953  else {edm::LogWarning("TrackingMonitor") << "Cluster Label " << ClusterLabels[i] << " not defined, using strip parameters ";
954  arrayMin[i]=smin; arrayMax[i]=smax; arrayBin[i]=sbin;}
955 
956  }
957 
958 }
959 
960 void TrackingMonitor::setNclus(const edm::Event& iEvent,std::vector<int> &arrayNclus)
961 {
962 
963  int ncluster_pix=-1;
964  int ncluster_strip=-1;
965 
967  iEvent.getByToken(stripClustersToken_, strip_clusters );
969  iEvent.getByToken(pixelClustersToken_, pixel_clusters );
970 
971  if (strip_clusters.isValid() && pixel_clusters.isValid()) {
972  ncluster_pix = (*pixel_clusters).dataSize();
973  ncluster_strip = (*strip_clusters).dataSize();
974  }
975 
976  arrayNclus.resize(ClusterLabels.size());
977  for (uint i=0; i<ClusterLabels.size(); ++i){
978 
979  if (ClusterLabels[i].compare("Pix")==0 ) arrayNclus[i]=ncluster_pix ;
980  else if(ClusterLabels[i].compare("Strip")==0) arrayNclus[i]=ncluster_strip;
981  else if(ClusterLabels[i].compare("Tot")==0 ) arrayNclus[i]=ncluster_pix+ncluster_strip;
982  else {edm::LogWarning("TrackingMonitor") << "Cluster Label " << ClusterLabels[i] << " not defined using stri parametrs ";
983  arrayNclus[i]=ncluster_strip ;}
984  }
985 
986 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken_
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > NumberOfTrkVsClusters
MonitorElement * FractionOfGoodTracks
virtual void setMaxMinBin(std::vector< double > &, std::vector< double > &, std::vector< int > &, double, double, int, double, double, int)
MonitorElement * NumberOfTracksVsBX
TrackAnalyzer * theTrackAnalyzer
MonitorElement * NumberOfRecHitsPerTrackVsBX
MonitorElement * NumberOfRecHitsPerTrackVsLUMI
edm::ParameterSet conf_
virtual void setNclus(const edm::Event &, std::vector< int > &)
edm::EDGetTokenT< reco::TrackCollection > allTrackToken_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MonitorElement * NumberEventsOfVsGoodPVtx
GetLumi * theLumiDetails_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
tuple lumi
Definition: fjr2json.py:35
std::vector< TrackCandidate > TrackCandidateCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
int bunchCrossing() const
Definition: EventBase.h:65
edm::InputTag pvSrc_
size_type size() const
#define NULL
Definition: scimark2.h:8
MonitorElement * GoodTracksFractionVsLUMI
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
MonitorElement * NumberOfPVtxVsGoodPVtx
MonitorElement * NumberOfMeanRecHitsPerTrack
MonitorElement * NumberOfTracksVsGoodPVtx
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
const Point & position() const
position
Definition: Vertex.h:99
MonitorElement * GoodTracksFractionVsLS
void setLumi(const edm::Event &, const edm::EventSetup &iSetup)
void Fill(long long x)
double getValue(const edm::Event &)
Definition: GetLumi.cc:64
std::string Quality_
MonitorElement * NumberOfGoodPVtxWO0VsLUMI
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrajectorySeed &seed, const reco::BeamSpot &bs, const edm::ESHandle< MagneticField > &theMF, const edm::ESHandle< TransientTrackingRecHitBuilder > &theTTRHBuilder)
edm::InputTag bsSrc_
MonitorElement * NumberOfSeeds
int iEvent
Definition: GenABIO.cc:230
MonitorElement * NumberOfGoodPVtxVsLS
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * NumberOfGoodPVtxVsLUMI
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
void setBX(const edm::Event &)
virtual void initHisto(DQMStore::IBooker &ibooker)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * NumberOfTracksVsLS
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * NumberOfGoodPVtxWO0VsLS
double z() const
y coordinate
Definition: Vertex.h:105
TH1 * getTH1(void) const
MonitorElement * NumberOfTracksVsPUPVtx
edm::EDGetTokenT< LumiScalersCollection > lumiscalersToken_
MonitorElement * NumberEventsOfVsBX
bool runTrackBuildingAnalyzerForSeed
bool isValid() const
Definition: HandleBase.h:75
std::vector< MonitorElement * > SeedsVsClusters
MonitorElement * NumberOfRecHitsPerTrackVsLS
MonitorElement * GoodTracksFractionVsGoodPVtx
virtual void endRun(const edm::Run &, const edm::EventSetup &)
double ndof() const
Definition: Vertex.h:95
MonitorElement * NumberOfRecHitsPerTrackVsGoodPVtx
std::string histname
std::vector< VertexMonitor * > theVertexMonitor
MonitorElement * NumberOfTracksVsBXlumi
edm::InputTag stripClusterInputTag_
bool doGeneralPropertiesPlots_
TrackBuildingAnalyzer * theTrackBuildingAnalyzer
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
bool isFake() const
Definition: Vertex.h:64
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
std::string AlgoName_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< TrackCandidateCollection > trackCandidateToken_
MonitorElement * NumberOfMeanLayersPerTrack
StringCutObjectSelector< reco::Track, true > denSelection_
const T & get() const
Definition: EventSetup.h:56
StringCutObjectSelector< reco::Track, true > numSelection_
GenericTriggerEventFlag * genTriggerEventFlag_
MonitorElement * GoodTracksFractionVsBX
edm::InputTag pixelClusterInputTag_
std::string const & label() const
Definition: InputTag.h:36
MonitorElement * NumberOfSeeds_lumiFlag
edm::EventID id() const
Definition: EventBase.h:59
TrackingMonitor(const edm::ParameterSet &)
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
virtual void beginJob(void)
MonitorElement * NumberOfTrackCandidates
virtual void initHisto(DQMStore::IBooker &ibooker, const edm::EventSetup &)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
void Reset(std::vector< TH2F > &depth)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClustersToken_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
MonitorElement * NumberOfGoodPVtxVsBX
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
MonitorElement * NumberEventsOfVsLUMI
void setNumberOfGoodVertices(const edm::Event &)
MonitorElement * NumberOfTracks_lumiFlag
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
MonitorElement * NumberOfTracks
size_t tracksSize() const
number of tracks
Definition: Vertex.cc:34
edm::EDGetTokenT< reco::VertexCollection > pvSrcToken_
Definition: Run.h:43
MonitorElement * NumberEventsOfVsLS
MonitorElement * NumberOfTracksVsLUMI
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &eSetup)
std::vector< std::string > ClusterLabels
MonitorElement * NumberOfGoodPVtxWO0VsBX
std::string builderName