CMS 3D CMS Logo

SiStripMonitorTrack.cc
Go to the documentation of this file.
2 
6 
20 
23 
25 #include "TMath.h"
26 
28  conf_(conf),
29  tracksCollection_in_EventTree(true),
30  firstEvent(-1),
31  genTriggerEventFlag_(new GenericTriggerEventFlag(conf.getParameter<edm::ParameterSet>("genericTriggerEventPSet"), consumesCollector(), *this))
32 {
33  Cluster_src_ = conf.getParameter<edm::InputTag>("Cluster_src");
34  Mod_On_ = conf.getParameter<bool>("Mod_On");
35  Trend_On_ = conf.getParameter<bool>("Trend_On");
36  TkHistoMap_On_ = conf.getParameter<bool>("TkHistoMap_On");
37  Digi_On_ = conf.getParameter<bool>("Digi_On");
38 
39  TrackProducer_ = conf_.getParameter<std::string>("TrackProducer");
40  TrackLabel_ = conf_.getParameter<std::string>("TrackLabel");
41 
42  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
43 
44  if (Digi_On_)
45  digiToken_ = consumes<edm::DetSetVector<SiStripDigi>> ( conf.getParameter<edm::InputTag>("ADCDigi_src") );
46  clusterToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(Cluster_src_);
47  trackToken_ = consumes<reco::TrackCollection>(edm::InputTag(TrackProducer_,TrackLabel_) );
48 
49  // cluster quality conditions
50  edm::ParameterSet cluster_condition = conf_.getParameter<edm::ParameterSet>("ClusterConditions");
51  applyClusterQuality_ = cluster_condition.getParameter<bool>("On");
52  sToNLowerLimit_ = cluster_condition.getParameter<double>("minStoN");
53  sToNUpperLimit_ = cluster_condition.getParameter<double>("maxStoN");
54  widthLowerLimit_ = cluster_condition.getParameter<double>("minWidth");
55  widthUpperLimit_ = cluster_condition.getParameter<double>("maxWidth");
56 
57 
58  // Create DCS Status
59  bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
60  if (checkDCS) dcsStatus_ = new SiStripDCSStatus(consumesCollector());
61  else dcsStatus_ = 0;
62 }
63 
64 //------------------------------------------------------------------------
66  if (dcsStatus_) delete dcsStatus_;
68 }
69 
70 //------------------------------------------------------------------------
72 {
73  //get geom
75  LogDebug("SiStripMonitorTrack") << "[SiStripMonitorTrack::beginRun] There are "<<tkgeom_->detUnits().size() <<" detectors instantiated in the geometry" << std::endl;
77 
78 
79  // Initialize the GenericTriggerEventFlag
81 }
82 
83 //------------------------------------------------------------------------
85 {
86  //Retrieve tracker topology from geometry
88  es.get<TrackerTopologyRcd>().get(tTopoHandle);
89  const TrackerTopology* const tTopo = tTopoHandle.product();
90  book(ibooker , tTopo);
91 }
92 
93 // ------------ method called to produce the data ------------
95 {
96  // Filter out events if DCS checking is requested
97  if (dcsStatus_ && !dcsStatus_->getStatus(e,es)) return;
98 
99  // Filter out events if Trigger Filtering is requested
100  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( e, es) ) return;
101 
102  //initialization of global quantities
103  LogDebug("SiStripMonitorTrack") << "[SiStripMonitorTrack::analyse] " << "Run " << e.id().run() << " Event " << e.id().event() << std::endl;
104  eventNb = e.id().event();
105  vPSiStripCluster.clear();
106 
107  iLumisection = e.orbitNumber()/262144.0;
108 
109  // initialise # of clusters
110  for (std::map<std::string, SubDetMEs>::iterator iSubDet = SubDetMEsMap.begin();
111  iSubDet != SubDetMEsMap.end(); iSubDet++) {
112  iSubDet->second.totNClustersOnTrack = 0;
113  iSubDet->second.totNClustersOffTrack = 0;
114  }
115 
116  //Perform track study
117  trackStudy(e, es);
118 
119  //Perform Cluster Study (irrespectively to tracks)
120 
121  AllClusters(e, es); //analyzes the off Track Clusters
122 
123  //Summary Counts of clusters
124  std::map<std::string, MonitorElement*>::iterator iME;
125  std::map<std::string, LayerMEs>::iterator iLayerME;
126 
127  if (Trend_On_) {
128  // for (std::map<std::string, SubDetMEs>::iterator iSubDet = SubDetMEsMap.begin(), iterEnd=SubDetMEsMaps.end();
129  // iSubDet != iterEnd; ++iSubDet) {
130  for (auto const &iSubDet : SubDetMEsMap) {
131  SubDetMEs subdet_mes = iSubDet.second;
132  if (subdet_mes.totNClustersOnTrack > 0) {
133  fillME(subdet_mes.nClustersOnTrack, subdet_mes.totNClustersOnTrack);
134  }
135  fillME(subdet_mes.nClustersOffTrack, subdet_mes.totNClustersOffTrack);
138  }
139  } else {
140  for (auto const &iSubDet : SubDetMEsMap) {
141  SubDetMEs subdet_mes = iSubDet.second;
142  if (subdet_mes.totNClustersOnTrack > 0) {
143  fillME(subdet_mes.nClustersOnTrack, subdet_mes.totNClustersOnTrack);
144  }
145  fillME(subdet_mes.nClustersOffTrack, subdet_mes.totNClustersOffTrack);
146  }
147  }
148 }
149 
150 //------------------------------------------------------------------------
152 {
153 
154  SiStripFolderOrganizer folder_organizer;
155  folder_organizer.setSiStripFolderName(topFolderName_);
156  //******** TkHistoMaps
157  if (TkHistoMap_On_) {
158  tkhisto_StoNCorrOnTrack = new TkHistoMap(ibooker , topFolderName_ ,"TkHMap_StoNCorrOnTrack", 0.0,true);
159  tkhisto_NumOnTrack = new TkHistoMap(ibooker , topFolderName_, "TkHMap_NumberOfOnTrackCluster", 0.0,true);
160  tkhisto_NumOffTrack = new TkHistoMap(ibooker , topFolderName_, "TkHMap_NumberOfOfffTrackCluster",0.0,true);
161  tkhisto_ClChPerCMfromTrack = new TkHistoMap(ibooker , topFolderName_, "TkHMap_ChargePerCMfromTrack",0.0,true);
162  tkhisto_NumMissingHits = new TkHistoMap(ibooker , topFolderName_, "TkHMap_NumberMissingHits",0.0,true);
163  tkhisto_NumberInactiveHits = new TkHistoMap(ibooker , topFolderName_, "TkHMap_NumberInactiveHits",0.0,true);
164  tkhisto_NumberValidHits = new TkHistoMap(ibooker , topFolderName_, "TkHMap_NumberValidHits",0.0,true);
165  }
167  tkhisto_ClChPerCMfromOrigin = new TkHistoMap(ibooker , topFolderName_, "TkHMap_ChargePerCMfromOrigin",0.0,true);
168  //******** TkHistoMaps
169 
170  std::vector<uint32_t> vdetId_;
172  const char* tec = "TEC";
173  const char* tid = "TID";
174  //Histos for each detector, layer and module
175  SiStripHistoId hidmanager;
176 
177  if(Mod_On_) {
178  for (std::vector<uint32_t>::const_iterator detid_iter=vdetId_.begin(),detid_end=vdetId_.end();detid_iter!=detid_end;++detid_iter){ //loop on all the active detid
179  uint32_t detid = *detid_iter;
180 
181  if (detid < 1){
182  edm::LogError("SiStripMonitorTrack")<< "[" <<__PRETTY_FUNCTION__ << "] invalid detid " << detid<< std::endl;
183  continue;
184  }
185 
186 
187  //std::string name;
188 
189  // book Layer and RING plots
190  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,false);
191  /*
192  std::string thickness;
193  std::pair<std::string,int32_t> det_layer_pair_test = folder_organizer.GetSubDetAndLayerThickness(detid,tTopo,thickness);
194  std::cout << "[SiStripMonitorTrack::book] det_layer_pair " << det_layer_pair.first << " " << det_layer_pair.second << " " << thickness << std::endl;
195  */
196 
197  std::string layer_id = hidmanager.getSubdetid(detid, tTopo, false);
198 
199  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_id);
200  if(iLayerME==LayerMEsMap.end()){
201  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, false);
202  bookLayerMEs(ibooker , detid, layer_id);
203  }
204 
205  const char* subdet = det_layer_pair.first.c_str();
206  if ( std::strstr(subdet, tec) != NULL || std::strstr(subdet, tid) != NULL ) {
207  std::string ring_id = hidmanager.getSubdetid(detid, tTopo, true);
208  std::map<std::string, RingMEs>::iterator iRingME = RingMEsMap.find(ring_id);
209  if(iRingME==RingMEsMap.end()){
210  std::pair<std::string,int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,true);
211  folder_organizer.setLayerFolder(detid, tTopo, det_ring_pair.second, true);
212  bookRingMEs(ibooker , detid, ring_id);
213  }
214  }
215 
216  // book sub-detector plots
217  std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
218  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
219  ibooker.setCurrentFolder(sdet_pair.first);
220  bookSubDetMEs(ibooker , sdet_pair.second);
221  }
222  // book module plots
223  folder_organizer.setDetectorFolder(detid,tTopo);
224  bookModMEs(ibooker , *detid_iter);
225  }//end loop on detectors detid
226  } else {
227  for (std::vector<uint32_t>::const_iterator detid_iter=vdetId_.begin(),detid_end=vdetId_.end();detid_iter!=detid_end;++detid_iter){ //loop on all the active detid
228  uint32_t detid = *detid_iter;
229 
230  if (detid < 1){
231  edm::LogError("SiStripMonitorTrack")<< "[" <<__PRETTY_FUNCTION__ << "] invalid detid " << detid<< std::endl;
232  continue;
233  }
234 
235 
236  //std::string name;
237 
238  // book Layer and RING plots
239  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,false);
240  /*
241  std::string thickness;
242  std::pair<std::string,int32_t> det_layer_pair_test = folder_organizer.GetSubDetAndLayerThickness(detid,tTopo,thickness);
243  std::cout << "[SiStripMonitorTrack::book] det_layer_pair " << det_layer_pair.first << " " << det_layer_pair.second << " " << thickness << std::endl;
244  */
245 
246  std::string layer_id = hidmanager.getSubdetid(detid, tTopo, false);
247 
248  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_id);
249  if(iLayerME==LayerMEsMap.end()){
250  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, false);
251  bookLayerMEs(ibooker , detid, layer_id);
252  }
253 
254  const char* subdet = det_layer_pair.first.c_str();
255  if ( std::strstr(subdet, tec) != NULL || std::strstr(subdet, tid) != NULL ) {
256  std::string ring_id = hidmanager.getSubdetid(detid, tTopo, true);
257  std::map<std::string, RingMEs>::iterator iRingME = RingMEsMap.find(ring_id);
258  if(iRingME==RingMEsMap.end()){
259  std::pair<std::string,int32_t> det_ring_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,true);
260  folder_organizer.setLayerFolder(detid, tTopo, det_ring_pair.second, true);
261  bookRingMEs(ibooker , detid, ring_id);
262  }
263  }
264 
265  // book sub-detector plots
266  std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
267  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
268  ibooker.setCurrentFolder(sdet_pair.first);
269  bookSubDetMEs(ibooker , sdet_pair.second);
270  }
271  }//end loop on detectors detid
272  }
273 }
274 
275 //--------------------------------------------------------------------------------
276 void SiStripMonitorTrack::bookModMEs(DQMStore::IBooker & ibooker , const uint32_t id)//Histograms at MODULE level
277 {
278  std::string name = "det";
279  SiStripHistoId hidmanager;
280  std::string hid = hidmanager.createHistoId("",name,id);
281  std::map<std::string, ModMEs>::iterator iModME = ModMEsMap.find(hid);
282  if(iModME==ModMEsMap.end()){
283  ModMEs theModMEs;
284 
285  // Cluster Width
286  theModMEs.ClusterWidth=bookME1D(ibooker , "TH1ClusterWidth", hidmanager.createHistoId("ClusterWidth_OnTrack",name,id).c_str());
287  ibooker.tag(theModMEs.ClusterWidth,id);
288  // Cluster Gain
289  theModMEs.ClusterGain=bookME1D(ibooker , "TH1ClusterGain", hidmanager.createHistoId("ClusterGain",name,id).c_str());
290  ibooker.tag(theModMEs.ClusterGain,id);
291  // Cluster Charge
292  theModMEs.ClusterCharge=bookME1D(ibooker , "TH1ClusterCharge", hidmanager.createHistoId("ClusterCharge_OnTrack",name,id).c_str());
293  ibooker.tag(theModMEs.ClusterCharge,id);
294 
295  // Cluster Charge Raw (no gain )
296  theModMEs.ClusterChargeRaw=bookME1D(ibooker , "TH1ClusterChargeRaw", hidmanager.createHistoId("ClusterChargeRaw_OnTrack",name,id).c_str());
297  ibooker.tag(theModMEs.ClusterChargeRaw,id);
298 
299  // Cluster Charge Corrected
300  theModMEs.ClusterChargeCorr=bookME1D(ibooker , "TH1ClusterChargeCorr", hidmanager.createHistoId("ClusterChargeCorr_OnTrack",name,id).c_str());
301  ibooker.tag(theModMEs.ClusterChargeCorr,id);
302  // Cluster StoN Corrected
303  theModMEs.ClusterStoNCorr=bookME1D(ibooker , "TH1ClusterStoNCorrMod", hidmanager.createHistoId("ClusterStoNCorr_OnTrack",name,id).c_str());
304  ibooker.tag(theModMEs.ClusterStoNCorr,id);
305  // Cluster Position
306  short total_nr_strips = SiStripDetCabling_->nApvPairs(id) * 2 * 128;
307  theModMEs.ClusterPos=ibooker.book1D(hidmanager.createHistoId("ClusterPosition_OnTrack",name,id).c_str(),hidmanager.createHistoId("ClusterPosition_OnTrack",name,id).c_str(),total_nr_strips,0.5,total_nr_strips+0.5);
308  ibooker.tag(theModMEs.ClusterPos,id);
309  // Cluster PGV
310  theModMEs.ClusterPGV=bookMEProfile(ibooker , "TProfileClusterPGV", hidmanager.createHistoId("PGV_OnTrack",name,id).c_str());
311  ibooker.tag(theModMEs.ClusterPGV,id);
312  // Cluster Charge per cm
313  theModMEs.ClusterChargePerCMfromTrack = bookME1D(ibooker , "TH1ClusterChargePerCM", hidmanager.createHistoId("ClusterChargePerCMfromTrack",name,id).c_str());
314  ibooker.tag(theModMEs.ClusterChargePerCMfromTrack,id);
315 
316  theModMEs.ClusterChargePerCMfromOrigin = bookME1D(ibooker , "TH1ClusterChargePerCM", hidmanager.createHistoId("ClusterChargePerCMfromOrigin",name,id).c_str());
317  ibooker.tag(theModMEs.ClusterChargePerCMfromOrigin,id);
318 
319  ModMEsMap[hid]=theModMEs;
320  }
321 }
322 
324 
325  MonitorElement* me = NULL;
326  bool view = false;
327  view = (conf_.getParameter<edm::ParameterSet>(histoParameters.c_str())).getParameter<bool>(viewParameter.c_str());
328  if ( id.find("TEC") == std::string::npos && id.find("TID") == std::string::npos ) {
329  me = bookME1D(ibooker , histoParameters.c_str(), histoName.c_str());
330  } else {
331  if (view) {
332  // histoName = histoName + "__" + thickness;
333  me = bookME1D(ibooker , histoParameters.c_str(), histoName.c_str());
334  }
335  }
336  return me;
337 }
338 
339 //
340 // -- Book Layer Level Histograms and Trend plots
341 //
342 //------------------------------------------------------------------------
343 void SiStripMonitorTrack::bookLayerMEs(DQMStore::IBooker & ibooker , const uint32_t mod_id, std::string& layer_id)
344 {
345  std::string name = "layer";
346  std::string view = "layerView";
347  std::string hname;
348  std::string hpar;
349  SiStripHistoId hidmanager;
350 
351  LayerMEs theLayerMEs;
352 
353  // Signal/Noise (w/ cluster harge corrected)
354  hname = hidmanager.createHistoLayer("Summary_ClusterStoNCorr",name,layer_id,"OnTrack");
355  hpar = "TH1ClusterStoNCorr";
356  theLayerMEs.ClusterStoNCorrOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
357 
358  // Cluster Gain
359  hname = hidmanager.createHistoLayer("Summary_ClusterGain",name,layer_id,"");
360  hpar = "TH1ClusterGain";
361  theLayerMEs.ClusterGain = handleBookMEs(ibooker,view,layer_id,hpar,hname);
362 
363  // Cluster Charge Corrected
364  hname = hidmanager.createHistoLayer("Summary_ClusterChargeCorr",name,layer_id,"OnTrack");
365  hpar = "TH1ClusterChargeCorr";
366  theLayerMEs.ClusterChargeCorrOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
367 
368  // Cluster Charge (On and Off Track)
369  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,layer_id,"OnTrack");
370  hpar = "TH1ClusterCharge";
371  theLayerMEs.ClusterChargeOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
372 
373  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,layer_id,"OffTrack");
374  hpar = "TH1ClusterCharge";
375  theLayerMEs.ClusterChargeOffTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
376 
377  // Cluster Charge Raw (On and Off Track)
378  hname = hidmanager.createHistoLayer("Summary_ClusterChargeRaw",name,layer_id,"OnTrack");
379  hpar = "TH1ClusterChargeRaw";
380  theLayerMEs.ClusterChargeRawOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
381 
382  hname = hidmanager.createHistoLayer("Summary_ClusterChargeRaw",name,layer_id,"OffTrack");
383  hpar = "TH1ClusterChargeRaw";
384  theLayerMEs.ClusterChargeRawOffTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
385 
386  // Cluster Noise (On and Off Track)
387  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,layer_id,"OnTrack");
388  hpar = "TH1ClusterNoise";
389  theLayerMEs.ClusterNoiseOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
390 
391  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,layer_id,"OffTrack");
392  hpar = "TH1ClusterNoise";
393  theLayerMEs.ClusterNoiseOffTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
394 
395  // Cluster Width (On and Off Track)
396  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,layer_id,"OnTrack");
397  hpar = "TH1ClusterWidth";
398  theLayerMEs.ClusterWidthOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
399 
400  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,layer_id,"OffTrack");
401  hpar = "TH1ClusterWidth";
402  theLayerMEs.ClusterWidthOffTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
403 
404  //Cluster Position
405  short total_nr_strips = SiStripDetCabling_->nApvPairs(mod_id) * 2 * 128;
406  if (layer_id.find("TEC") != std::string::npos) total_nr_strips = 3 * 2 * 128;
407 
408  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,layer_id,"OnTrack");
409  hpar = "TH1ClusterPos";
410  if ( layer_id.find("TIB") != std::string::npos || layer_id.find("TOB") != std::string::npos || (conf_.getParameter<edm::ParameterSet>(hpar.c_str())).getParameter<bool>(view.c_str()) ) theLayerMEs.ClusterPosOnTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
411 
412  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,layer_id,"OffTrack");
413  hpar = "TH1ClusterPos";
414  if ( layer_id.find("TIB") != std::string::npos || layer_id.find("TOB") != std::string::npos || (conf_.getParameter<edm::ParameterSet>(hpar.c_str())).getParameter<bool>(view.c_str()) ) theLayerMEs.ClusterPosOffTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
415 
416  // dQ/dx
417  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromTrack",name,layer_id,"");
418  hpar = "TH1ClusterChargePerCM";
419  theLayerMEs.ClusterChargePerCMfromTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
420 
421  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromOrigin",name,layer_id,"OnTrack");
422  hpar = "TH1ClusterChargePerCM";
423  theLayerMEs.ClusterChargePerCMfromOriginOnTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
424 
425  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromOrigin",name,layer_id,"OffTrack");
426  hpar = "TH1ClusterChargePerCM";
427  theLayerMEs.ClusterChargePerCMfromOriginOffTrack = handleBookMEs(ibooker,view,layer_id,hpar,hname);
428 
429  //bookeeping
430  LayerMEsMap[layer_id]=theLayerMEs;
431 
432 }
433 
435 {
436 
437  std::string name = "ring";
438  std::string view = "ringView";
439  std::string hname;
440  std::string hpar;
441  SiStripHistoId hidmanager;
442 
443  RingMEs theRingMEs;
444 
445  hname = hidmanager.createHistoLayer("Summary_ClusterStoNCorr",name,ring_id,"OnTrack");
446  hpar = "TH1ClusterStoNCorr";
447  theRingMEs.ClusterStoNCorrOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
448 
449  // Cluster Gain
450  hname = hidmanager.createHistoLayer("Summary_ClusterGain",name,ring_id,"");
451  hpar = "TH1ClusterGain";
452  theRingMEs.ClusterGain = handleBookMEs(ibooker,view,ring_id,hpar,hname);
453 
454  // Cluster Charge Corrected
455  hname = hidmanager.createHistoLayer("Summary_ClusterChargeCorr",name,ring_id,"OnTrack");
456  hpar = "TH1ClusterChargeCorr";
457  theRingMEs.ClusterChargeCorrOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
458 
459  // Cluster Charge (On and Off Track)
460  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,ring_id,"OnTrack");
461  hpar = "TH1ClusterCharge";
462  theRingMEs.ClusterChargeOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
463 
464  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,ring_id,"OffTrack");
465  hpar = "TH1ClusterCharge";
466  theRingMEs.ClusterChargeOffTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
467 
468  // Cluster Charge Raw (no-gain), On and off track
469  hname = hidmanager.createHistoLayer("Summary_ClusterChargeRaw",name,ring_id,"OnTrack");
470  hpar = "TH1ClusterChargeRaw";
471  theRingMEs.ClusterChargeRawOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
472 
473  hname = hidmanager.createHistoLayer("Summary_ClusterChargeRaw",name,ring_id,"OffTrack");
474  hpar = "TH1ClusterChargeRaw";
475  theRingMEs.ClusterChargeRawOffTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
476 
477  // Cluster Noise (On and Off Track)
478  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,ring_id,"OnTrack");
479  hpar = "TH1ClusterNoise";
480  theRingMEs.ClusterNoiseOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
481 
482  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,ring_id,"OffTrack");
483  hpar = "TH1ClusterNoise";
484  theRingMEs.ClusterNoiseOffTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
485 
486  // Cluster Width (On and Off Track)
487  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,ring_id,"OnTrack");
488  hpar = "TH1ClusterWidth";
489  theRingMEs.ClusterWidthOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
490 
491  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,ring_id,"OffTrack");
492  hpar = "TH1ClusterWidth";
493  theRingMEs.ClusterWidthOffTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
494 
495  //Cluster Position
496  short total_nr_strips = SiStripDetCabling_->nApvPairs(mod_id) * 2 * 128;
497  if (ring_id.find("TEC") != std::string::npos) total_nr_strips = 3 * 2 * 128;
498 
499  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,ring_id,"OnTrack");
500  hpar = "TH1ClusterPos";
501  if ( (conf_.getParameter<edm::ParameterSet>(hpar.c_str())).getParameter<bool>(view.c_str()) ) theRingMEs.ClusterPosOnTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
502 
503  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,ring_id,"OffTrack");
504  hpar = "TH1ClusterPos";
505  if ( (conf_.getParameter<edm::ParameterSet>(hpar.c_str())).getParameter<bool>(view.c_str()) ) theRingMEs.ClusterPosOffTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
506 
507  // dQ/dx
508  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromTrack",name,ring_id,"");
509  hpar = "TH1ClusterChargePerCM";
510  theRingMEs.ClusterChargePerCMfromTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
511 
512  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromOrigin",name,ring_id,"OnTrack");
513  hpar = "TH1ClusterChargePerCM";
514  theRingMEs.ClusterChargePerCMfromOriginOnTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
515 
516  hname = hidmanager.createHistoLayer("Summary_ClusterChargePerCMfromOrigin",name,ring_id,"OffTrack");
517  hpar = "TH1ClusterChargePerCM";
518  theRingMEs.ClusterChargePerCMfromOriginOffTrack = handleBookMEs(ibooker,view,ring_id,hpar,hname);
519 
520  //bookeeping
521  RingMEsMap[ring_id]=theRingMEs;
522 
523 }
524 //------------------------------------------------------------------------
525 //
526 // -- Book Histograms at Sub-Detector Level
527 //
529 
531  subdet_tag = "__" + name;
532  std::string completeName;
533  std::string axisName;
534 
535  SubDetMEs theSubDetMEs;
536 
537  // TotalNumber of Cluster OnTrack
538  completeName = "Summary_TotalNumberOfClusters_OnTrack" + subdet_tag;
539  axisName = "Number of on-track clusters in " + name;
540  theSubDetMEs.nClustersOnTrack = bookME1D(ibooker , "TH1nClustersOn", completeName.c_str());
541  theSubDetMEs.nClustersOnTrack->setAxisTitle(axisName.c_str());
542  theSubDetMEs.nClustersOnTrack->getTH1()->StatOverflows(kTRUE);
543 
544  // TotalNumber of Cluster OffTrack
545  completeName = "Summary_TotalNumberOfClusters_OffTrack" + subdet_tag;
546  axisName = "Number of off-track clusters in " + name;
547  theSubDetMEs.nClustersOffTrack = bookME1D(ibooker , "TH1nClustersOff", completeName.c_str());
548  theSubDetMEs.nClustersOffTrack->setAxisTitle(axisName.c_str());
549  theSubDetMEs.nClustersOffTrack->getTH1()->StatOverflows(kTRUE);
550 
551  // Cluster Gain
552  completeName = "Summary_ClusterGain" + subdet_tag;
553  theSubDetMEs.ClusterGain=bookME1D(ibooker , "TH1ClusterGain", completeName.c_str());
554 
555  // Cluster StoN On Track
556  completeName = "Summary_ClusterStoNCorr_OnTrack" + subdet_tag;
557  theSubDetMEs.ClusterStoNCorrOnTrack = bookME1D(ibooker , "TH1ClusterStoNCorr", completeName.c_str());
558 
559  completeName = "Summary_ClusterStoNCorrThin_OnTrack" + subdet_tag;
560  if ( subdet_tag.find("TEC") != std::string::npos ) theSubDetMEs.ClusterStoNCorrThinOnTrack = bookME1D(ibooker , "TH1ClusterStoNCorr", completeName.c_str());
561 
562  completeName = "Summary_ClusterStoNCorrThick_OnTrack" + subdet_tag;
563  if ( subdet_tag.find("TEC") != std::string::npos ) theSubDetMEs.ClusterStoNCorrThickOnTrack = bookME1D(ibooker , "TH1ClusterStoNCorr", completeName.c_str());
564 
565  // Cluster Charge Corrected
566  completeName = "Summary_ClusterChargeCorr_OnTrack" + subdet_tag;
567  theSubDetMEs.ClusterChargeCorrOnTrack = bookME1D(ibooker , "TH1ClusterChargeCorr", completeName.c_str());
568 
569  completeName = "Summary_ClusterChargeCorrThin_OnTrack" + subdet_tag;
570  if ( subdet_tag.find("TEC") != std::string::npos ) theSubDetMEs.ClusterChargeCorrThinOnTrack = bookME1D(ibooker , "TH1ClusterChargeCorr", completeName.c_str());
571 
572  completeName = "Summary_ClusterChargeCorrThick_OnTrack" + subdet_tag;
573  if ( subdet_tag.find("TEC") != std::string::npos ) theSubDetMEs.ClusterChargeCorrThickOnTrack = bookME1D(ibooker , "TH1ClusterChargeCorr", completeName.c_str());
574 
575  // Cluster Charge On Track
576  completeName = "Summary_ClusterCharge_OnTrack" + subdet_tag;
577  theSubDetMEs.ClusterChargeOnTrack=bookME1D(ibooker , "TH1ClusterCharge", completeName.c_str());
578 
579  // Cluster Charge On Track, Raw (no-gain)
580  completeName = "Summary_ClusterChargeRaw_OnTrack" + subdet_tag;
581  theSubDetMEs.ClusterChargeRawOnTrack=bookME1D(ibooker , "TH1ClusterChargeRaw", completeName.c_str());
582 
583  // Cluster Charge Off Track
584  completeName = "Summary_ClusterCharge_OffTrack" + subdet_tag;
585  theSubDetMEs.ClusterChargeOffTrack=bookME1D(ibooker , "TH1ClusterCharge", completeName.c_str());
586 
587  // Cluster Charge Off Track, Raw (no-gain)
588  completeName = "Summary_ClusterChargeRaw_OffTrack" + subdet_tag;
589  theSubDetMEs.ClusterChargeRawOffTrack=bookME1D(ibooker , "TH1ClusterChargeRaw", completeName.c_str());
590 
591  // Cluster Charge StoN Off Track
592  completeName = "Summary_ClusterStoN_OffTrack" + subdet_tag;
593  theSubDetMEs.ClusterStoNOffTrack = bookME1D(ibooker , "TH1ClusterStoN", completeName.c_str());
594 
595  // cluster charge per cm on track
596  completeName = "Summary_ClusterChargePerCMfromTrack" + subdet_tag;
597  theSubDetMEs.ClusterChargePerCMfromTrack=bookME1D(ibooker , "TH1ClusterChargePerCM", completeName.c_str());
598 
599  // cluster charge per cm on track
600  completeName = "Summary_ClusterChargePerCMfromOrigin_OnTrack" + subdet_tag;
601  theSubDetMEs.ClusterChargePerCMfromOriginOnTrack=bookME1D(ibooker , "TH1ClusterChargePerCM", completeName.c_str());
602 
603  // cluster charge per cm off track
604  completeName = "Summary_ClusterChargePerCMfromOrigin_OffTrack" + subdet_tag;
605  theSubDetMEs.ClusterChargePerCMfromOriginOffTrack=bookME1D(ibooker , "TH1ClusterChargePerCM", completeName.c_str());
606 
607  if(Trend_On_){
608  // TotalNumber of Cluster
609  completeName = "Trend_TotalNumberOfClusters_OnTrack" + subdet_tag;
610  theSubDetMEs.nClustersTrendOnTrack = bookMETrend(ibooker , completeName.c_str());
611  completeName = "Trend_TotalNumberOfClusters_OffTrack" + subdet_tag;
612  theSubDetMEs.nClustersTrendOffTrack = bookMETrend(ibooker , completeName.c_str());
613  }
614 
615  //bookeeping
616  SubDetMEsMap[name]=theSubDetMEs;
617 
618 }
619 //--------------------------------------------------------------------------------
620 
621 inline MonitorElement* SiStripMonitorTrack::bookME1D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
622 {
623  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
624  return ibooker.book1D(HistoName,HistoName,
625  Parameters.getParameter<int32_t>("Nbinx"),
626  Parameters.getParameter<double>("xmin"),
627  Parameters.getParameter<double>("xmax")
628  );
629 }
630 
631 //--------------------------------------------------------------------------------
632 inline MonitorElement* SiStripMonitorTrack::bookME2D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
633 {
634  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
635  return ibooker.book2D(HistoName,HistoName,
636  Parameters.getParameter<int32_t>("Nbinx"),
637  Parameters.getParameter<double>("xmin"),
638  Parameters.getParameter<double>("xmax"),
639  Parameters.getParameter<int32_t>("Nbiny"),
640  Parameters.getParameter<double>("ymin"),
641  Parameters.getParameter<double>("ymax")
642  );
643 }
644 
645 //--------------------------------------------------------------------------------
646 inline MonitorElement* SiStripMonitorTrack::bookME3D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
647 {
648  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
649  return ibooker.book3D(HistoName,HistoName,
650  Parameters.getParameter<int32_t>("Nbinx"),
651  Parameters.getParameter<double>("xmin"),
652  Parameters.getParameter<double>("xmax"),
653  Parameters.getParameter<int32_t>("Nbiny"),
654  Parameters.getParameter<double>("ymin"),
655  Parameters.getParameter<double>("ymax"),
656  Parameters.getParameter<int32_t>("Nbinz"),
657  Parameters.getParameter<double>("zmin"),
658  Parameters.getParameter<double>("zmax")
659  );
660 }
661 
662 //--------------------------------------------------------------------------------
663 inline MonitorElement* SiStripMonitorTrack::bookMEProfile(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
664 {
665  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
666  return ibooker.bookProfile(HistoName,HistoName,
667  Parameters.getParameter<int32_t>("Nbinx"),
668  Parameters.getParameter<double>("xmin"),
669  Parameters.getParameter<double>("xmax"),
670  Parameters.getParameter<int32_t>("Nbiny"),
671  Parameters.getParameter<double>("ymin"),
672  Parameters.getParameter<double>("ymax"),
673  "" );
674 }
675 
676 //--------------------------------------------------------------------------------
678 {
679  edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
680  MonitorElement* me = ibooker.bookProfile(HistoName,HistoName,
681  ParametersTrend.getParameter<int32_t>("Nbins"),
682  ParametersTrend.getParameter<double>("xmin"),
683  ParametersTrend.getParameter<double>("xmax"),
684  0 , 0 , "" );
685  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetCanExtend(TH1::kAllAxes);
686 
687  if(!me) return me;
688  me->setAxisTitle("Lumisection",1);
689  return me;
690 }
691 
692 //------------------------------------------------------------------------------------------
694  const reco::Track & track,
695  const edm::Event& ev,
696  const edm::EventSetup& es,
697  bool track_ok
698 ) {
699 
700  auto const & trajParams = track.extra()->trajParams();
701  assert(trajParams.size()==track.recHitsSize());
702  auto hb = track.recHitsBegin();
703  for(unsigned int h=0;h<track.recHitsSize();h++){
704  auto ttrh = *(hb+h);
705 
706 
707  if (TkHistoMap_On_ ) {
708  uint32_t thedetid=ttrh->rawId();
709  if ( SiStripDetId(thedetid).subDetector() >=3 && SiStripDetId(thedetid).subDetector() <=6) { //TIB/TID + TOB + TEC only
710  if ( (ttrh->getType()==1) )
711  tkhisto_NumMissingHits->add(thedetid,1.);
712  if ( (ttrh->getType()==2) )
713  tkhisto_NumberInactiveHits->add(thedetid,1.);
714  if ( (ttrh->getType()==0) )
715  tkhisto_NumberValidHits->add(thedetid,1.);
716  }
717  }
718 
719  if (!ttrh->isValid()) continue;
720 
721  //trajectory local direction and position on detector
722  auto statedirection = trajParams[h].momentum();
723 
724 
725  const ProjectedSiStripRecHit2D* projhit = dynamic_cast<const ProjectedSiStripRecHit2D*>( ttrh->hit() );
726  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>( ttrh->hit() );
727  const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( ttrh->hit() );
728  const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( ttrh->hit() );
729 
730  // RecHitType type=Single;
731 
732  if(matchedhit){
733  LogTrace("SiStripMonitorTrack")<<"\nMatched recHit found"<< std::endl;
734  // type=Matched;
735 
736  const GluedGeomDet * gdet=static_cast<const GluedGeomDet *>(tkgeom_->idToDet(matchedhit->geographicalId()));
737  GlobalVector gtrkdirup=gdet->toGlobal(statedirection);
738  //mono side
739  const GeomDetUnit * monodet=gdet->monoDet();
740  statedirection=monodet->toLocal(gtrkdirup);
741  SiStripRecHit2D m = matchedhit->monoHit();
742  // if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,trackref,es);
743  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&m,statedirection,ev,es,track_ok);
744  //stereo side
745  const GeomDetUnit * stereodet=gdet->stereoDet();
746  statedirection=stereodet->toLocal(gtrkdirup);
747  SiStripRecHit2D s = matchedhit->stereoHit();
748  // if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,trackref,es);
749  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&s,statedirection,ev,es,track_ok);
750  }
751  else if(projhit){
752  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found"<< std::endl;
753  // type=Projected;
754  const GluedGeomDet * gdet=static_cast<const GluedGeomDet *>(tkgeom_->idToDet(projhit->geographicalId()));
755 
756  GlobalVector gtrkdirup=gdet->toGlobal(statedirection);
757  const SiStripRecHit2D originalhit=projhit->originalHit();
758  const GeomDetUnit * det;
759  if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
760  //mono side
761  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found MONO"<< std::endl;
762  det=gdet->monoDet();
763  statedirection=det->toLocal(gtrkdirup);
764  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,ev,es,track_ok);
765  }
766  else{
767  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found STEREO"<< std::endl;
768  //stereo side
769  det=gdet->stereoDet();
770  statedirection=det->toLocal(gtrkdirup);
771  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,ev,es,track_ok);
772  }
773  }else if (hit2D){
774  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,ev,es,track_ok);
775  } else if (hit1D) {
776  if(statedirection.mag()) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,ev,es,track_ok);
777  } else {
778  LogDebug ("SiStripMonitorTrack")
779  << " LocalMomentum: "<<statedirection
780  << "\nLocal x-z plane angle: "<<atan2(statedirection.x(),statedirection.z());
781  }
782 
783  }
784 
785 }
786 //------------------------------------------------------------------------
788  const edm::Event& ev,
789  const edm::EventSetup& es,
790  const ProjectedSiStripRecHit2D* projhit,
791  const SiStripMatchedRecHit2D* matchedhit,
792  const SiStripRecHit2D* hit2D,
793  const SiStripRecHit1D* hit1D,
794  LocalVector localMomentum,
795  const bool track_ok
796 ) {
797  LocalVector statedirection;
798  if(matchedhit){ // type=Matched;
799  LogTrace("SiStripMonitorTrack")<<"\nMatched recHit found"<< std::endl;
800 
801  const GluedGeomDet * gdet=static_cast<const GluedGeomDet *>(tkgeom_->idToDet(matchedhit->geographicalId()));
802 
803  GlobalVector gtrkdirup=gdet->toGlobal(localMomentum);
804 
805  //mono side
806  const GeomDetUnit * monodet=gdet->monoDet();
807  statedirection=monodet->toLocal(gtrkdirup);
808  SiStripRecHit2D m = matchedhit->monoHit();
809  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&m,statedirection,ev,es,track_ok);
810 
811  //stereo side
812  const GeomDetUnit * stereodet=gdet->stereoDet();
813  statedirection=stereodet->toLocal(gtrkdirup);
814  SiStripRecHit2D s = matchedhit->stereoHit();
815  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&s,statedirection,ev,es,track_ok);
816  }
817  else if(projhit){ // type=Projected;
818  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found"<< std::endl;
819 
820  const GluedGeomDet * gdet=static_cast<const GluedGeomDet *>(tkgeom_->idToDet(projhit->geographicalId()));
821 
822  GlobalVector gtrkdirup=gdet->toGlobal(localMomentum);
823  const SiStripRecHit2D originalhit=projhit->originalHit();
824 
825  const GeomDetUnit * det;
826  if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
827  //mono side
828  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found MONO"<< std::endl;
829  det=gdet->monoDet();
830  statedirection=det->toLocal(gtrkdirup);
831  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,ev,es,track_ok);
832  }
833  else{
834  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found STEREO"<< std::endl;
835  //stereo side
836  det=gdet->stereoDet();
837  statedirection=det->toLocal(gtrkdirup);
838  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,ev,es,track_ok);
839  }
840  } else if (hit2D){ // type=2D
841  statedirection=localMomentum;
842  if(statedirection.mag()) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,ev,es,track_ok);
843  } else if (hit1D) { // type=1D
844  statedirection=localMomentum;
845  if(statedirection.mag()) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,ev,es,track_ok);
846  } else {
847  LogDebug ("SiStripMonitorTrack")
848  << " LocalMomentum: "<<statedirection
849  << "\nLocal x-z plane angle: "<<atan2(statedirection.x(),statedirection.z());
850  }
851 
852 }
853 //------------------------------------------------------------------------
855 
856 using namespace std;
857 using namespace edm;
858 using namespace reco;
859 
860 
861  // edm::Handle<std::vector<Trajectory> > trajectories;
862  // ev.getByToken(trajectoryToken_, trajectories);
863 
864  // track input
865  edm::Handle<reco::TrackCollection > trackCollectionHandle;
866  ev.getByToken(trackToken_, trackCollectionHandle);//takes the track collection
867  if (trackCollectionHandle.isValid()){
868  trackStudyFromTrajectory(trackCollectionHandle,ev, es);
869  } else {
870  edm::LogError("SiStripMonitorTrack")<<"also Track Collection is not valid !! " << TrackLabel_<<std::endl;
871  return;
872  }
873 }
874 
875 //------------------------------------------------------------------------
876 // Should return true if the track is good, false if it should be discarded.
878  if (track.pt() < 0.8) return false;
879  if (track.p() < 2.0) return false;
880  if (track.hitPattern().numberOfValidTrackerHits() <= 6) return false;
881  if (track.normalizedChi2() > 10.0) return false;
882  return true;
883 }
884 //------------------------------------------------------------------------
886  edm::Handle<reco::TrackCollection > trackCollectionHandle,
887  const edm::Event& ev,
888  const edm::EventSetup& es
889 ) {
890 
891  // edm::ESHandle<TransientTrackBuilder> builder;
892  // es.get<TransientTrackRecord>().get("TransientTrackBuilder",builder);
893  // const TransientTrackBuilder* transientTrackBuilder = builder.product();
894 
895  //numTracks = trackCollectionHandle->size();
896  reco::TrackCollection trackCollection = *trackCollectionHandle;
897  for (reco::TrackCollection::const_iterator track = trackCollection.begin(), etrack = trackCollection.end();
898  track!=etrack; ++track) {
899 
900  bool track_ok = trackFilter(*track);
901  // const reco::TransientTrack transientTrack = transientTrackBuilder->build(track);
902 
903  for (trackingRecHit_iterator hit = track->recHitsBegin(), ehit = track->recHitsEnd();
904  hit!=ehit; ++hit) {
905 
906  if (TkHistoMap_On_ ) {
907  uint32_t thedetid=(*hit)->rawId();
908  if ( SiStripDetId(thedetid).subDetector() >=3 && SiStripDetId(thedetid).subDetector() <=6) { //TIB/TID + TOB + TEC only
909  if ( ((*hit)->getType()==1) )
910  tkhisto_NumMissingHits->add(thedetid,1.);
911  if ( ((*hit)->getType()==2) )
912  tkhisto_NumberInactiveHits->add(thedetid,1.);
913  if ( ((*hit)->getType()==0) )
914  tkhisto_NumberValidHits->add(thedetid,1.);
915  }
916  }
917 
918  if (!(*hit)->isValid()) continue;
919  DetId detID = (*hit)->geographicalId();
920  if (detID.det() != DetId::Tracker) continue;
921  const TrackingRecHit* theHit = (*hit);
922  const ProjectedSiStripRecHit2D* projhit = dynamic_cast<const ProjectedSiStripRecHit2D*>( (theHit) );
923  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*> ( (theHit) );
924  const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*> ( (theHit) );
925  const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*> ( (theHit) );
926 
927  // GlobalPoint globalPoint = hit->globalPosition();
928  // reco::TrajectoryStateOnSurface stateOnSurface = transientTrack->stateOnSurface(globalPoint);
929 
930  LocalVector localMomentum;
931  hitStudy(ev,es,projhit,matchedhit,hit2D,hit1D,localMomentum,track_ok);
932  }
933 
934  // hit pattern of the track
935  // const reco::HitPattern & hitsPattern = track->hitPattern();
936  // loop over the hits of the track
937  // for (int i=0; i<hitsPattern.numberOfHits(); i++) {
938  // for (int i=0; i<hitsPattern.numberOfHits(reco::HitPattern::TRACK_HITS); i++) {
939  // uint32_t hit = hitsPattern.getHitPattern(reco::HitPattern::TRACK_HITS,i);
940 
941  // if the hit is valid and in pixel barrel, print out the layer
942  // if (hitsPattern.validHitFilter(hit) && hitsPattern.pixelBarrelHitFilter(hit))
943 
944  // if (!hitsPattern.validHitFilter(hit)) continue;
945 // if (hitsPattern.pixelHitFilter(hit)) std::cout << "pixel" << std::endl; // pixel
946 // if (hitsPattern.pixelBarrelHitFilter(hit)) std::cout << "pixel barrel" << std::endl; // pixel barrel
947 // if (hitsPattern.pixelEndcapHitFilter(hit)) std::cout << "pixel endcap" << std::endl; // pixel endcap
948 // if (hitsPattern.stripHitFilter(hit)) std::cout << "strip" << std::endl; // strip
949 // if (hitsPattern.stripTIBHitFilter(hit)) std::cout << "TIB" << std::endl; // strip TIB
950 // if (hitsPattern.stripTIDHitFilter(hit)) std::cout << "TID" << std::endl; // strip TID
951 // if (hitsPattern.stripTOBHitFilter(hit)) std::cout << "TOB" << std::endl; // strip TOB
952 // if (hitsPattern.stripTECHitFilter(hit)) std::cout << "TEC" << std::endl; // strip TEC
953 // if (hitsPattern.muonDTHitFilter(hit)) std::cout << "DT" << std::endl; // muon DT
954 // if (hitsPattern.muonCSCHitFilter(hit)) std::cout << "CSC" << std::endl; // muon CSC
955 // if (hitsPattern.muonRPCHitFilter(hit)) std::cout << "RPC" << std::endl; // muon RPC
956 //
957 // // expert level: printout the hit in 10-bit binary format
958 // std::cout << "hit in 10-bit binary format = ";
959 // for (int j=9; j>=0; j--) {
960 // int bit = (hit >> j) & 0x1;
961 // std::cout << bit;
962 // }
963 // std::cout << std::endl;
964  // }
965  }
966 }
967 //------------------------------------------------------------------------
969  edm::Handle<reco::TrackCollection > trackCollectionHandle,
970  const edm::Event& ev,
971  const edm::EventSetup& es
972 ) {
973  //Perform track study
974  int i=0;
975  reco::TrackCollection trackCollection = *trackCollectionHandle;
976  numTracks = trackCollection.size();
977  for (reco::TrackCollection::const_iterator track = trackCollection.begin(), etrack = trackCollection.end();
978  track!=etrack; ++track) {
979 
980  LogDebug("SiStripMonitorTrack")
981  << "Track number "<< ++i << std::endl;
982  // << "\n\tmomentum: " << trackref->momentum()
983  // << "\n\tPT: " << trackref->pt()
984  // << "\n\tvertex: " << trackref->vertex()
985  // << "\n\timpact parameter: " << trackref->d0()
986  // << "\n\tcharge: " << trackref->charge()
987  // << "\n\tnormalizedChi2: " << trackref->normalizedChi2()
988  // <<"\n\tFrom EXTRA : "
989  // <<"\n\t\touter PT "<< trackref->outerPt()<<std::endl;
990 
991  // trajectoryStudy(traj_iterator,trackref,es);
992  bool track_ok = trackFilter(*track);
993  trajectoryStudy(*track,ev,es,track_ok);
994 
995  }
996 }
997 //------------------------------------------------------------------------
998 template <class T> void SiStripMonitorTrack::RecHitInfo(const T* tkrecHit, LocalVector LV, const edm::Event& ev, const edm::EventSetup& es, bool track_ok){
999 
1000  if(!tkrecHit->isValid()){
1001  LogTrace("SiStripMonitorTrack") <<"\t\t Invalid Hit " << std::endl;
1002  return;
1003  }
1004 
1005  const uint32_t& detid = tkrecHit->geographicalId().rawId();
1006 
1007  LogTrace("SiStripMonitorTrack")
1008  <<"\n\t\tRecHit on det "<<detid
1009  <<"\n\t\tRecHit in LP "<<tkrecHit->localPosition()
1010  <<"\n\t\tRecHit in GP "<<tkgeom_->idToDet(tkrecHit->geographicalId())->surface().toGlobal(tkrecHit->localPosition())
1011  <<"\n\t\tRecHit trackLocal vector "<<LV.x() << " " << LV.y() << " " << LV.z() <<std::endl;
1012 
1013  // FIXME: MOVE ALL THE EV AND ES ACCESS OUTSIDE THE LOOP!!!!
1014 
1015  //Retrieve tracker topology from geometry
1016  edm::ESHandle<TrackerTopology> tTopoHandle;
1017  es.get<TrackerTopologyRcd>().get(tTopoHandle);
1018  const TrackerTopology* const tTopo = tTopoHandle.product();
1019 
1020  // Getting SiStrip Gain settings
1021  edm::ESHandle<SiStripGain> gainHandle;
1022  es.get<SiStripGainRcd>().get( gainHandle );
1023  const SiStripGain* const stripGain = gainHandle.product();
1024 
1025  edm::ESHandle<SiStripQuality> qualityHandle;
1026  es.get<SiStripQualityRcd>().get("",qualityHandle);
1027  const SiStripQuality* stripQuality = qualityHandle.product();
1028 
1030  if (Digi_On_)
1031  ev.getByToken( digiToken_, digihandle );
1033  auto const & digilist = ( digihandle.isValid() ? *digihandle : dummy );
1034 
1035  //Get SiStripCluster from SiStripRecHit
1036  if ( tkrecHit != NULL ){
1037  const SiStripCluster* SiStripCluster_ = &*(tkrecHit->cluster());
1038  SiStripClusterInfo SiStripClusterInfo_(*SiStripCluster_,es,detid);
1039 
1040  const Det2MEs MEs = findMEs(tTopo, detid);
1041  // if (clusterInfos(&SiStripClusterInfo_,detid, OnTrack, track_ok, LV, MEs, tTopo,stripGain,stripQuality,*digihandle))
1042  if (clusterInfos(&SiStripClusterInfo_,detid, OnTrack, track_ok, LV, MEs, tTopo,stripGain,stripQuality,digilist))
1043  {
1044  vPSiStripCluster.insert(SiStripCluster_);
1045  }
1046  }
1047  else
1048  {
1049  edm::LogError("SiStripMonitorTrack") << "NULL hit" << std::endl;
1050  }
1051  }
1052 
1053 //------------------------------------------------------------------------
1055 {
1056 
1057  //Retrieve tracker topology from geometry
1058  edm::ESHandle<TrackerTopology> tTopoHandle;
1059  es.get<TrackerTopologyRcd>().get(tTopoHandle);
1060  const TrackerTopology* const tTopo = tTopoHandle.product();
1061 
1062  edm::ESHandle<SiStripGain> gainHandle;
1063  es.get<SiStripGainRcd>().get( gainHandle );
1064  const SiStripGain* stripGain = gainHandle.product();
1065 
1066  edm::ESHandle<SiStripQuality> qualityHandle;
1067  es.get<SiStripQualityRcd>().get("",qualityHandle);
1068  const SiStripQuality* stripQuality = qualityHandle.product();
1069 
1071  if (Digi_On_)
1072  ev.getByToken( digiToken_, digihandle );
1074  auto digilist = ( digihandle.isValid() ? *digihandle : dummy );
1075 
1077  ev.getByToken( clusterToken_, siStripClusterHandle);
1078  if (siStripClusterHandle.isValid()){
1079  //Loop on Dets
1080  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=siStripClusterHandle->begin(), DSVEnd=siStripClusterHandle->end();
1081  DSViter!=DSVEnd; ++DSViter) {
1082 
1083  uint32_t detid=DSViter->id();
1084  const Det2MEs MEs = findMEs(tTopo, detid);
1085 
1086  LogDebug("SiStripMonitorTrack") << "on detid "<< detid << " N Cluster= " << DSViter->size();
1087 
1088  //Loop on Clusters
1089  for(edmNew::DetSet<SiStripCluster>::const_iterator ClusIter = DSViter->begin(), ClusEnd = DSViter->end();
1090  ClusIter!=ClusEnd; ++ClusIter) {
1091 
1092  if (vPSiStripCluster.find(&*ClusIter) == vPSiStripCluster.end()) {
1093  SiStripClusterInfo SiStripClusterInfo_(*ClusIter,es,detid);
1094  // clusterInfos(&SiStripClusterInfo_,detid,OffTrack, /*track_ok*/ false,LV,MEs, tTopo,stripGain,stripQuality,*digihandle);
1095  clusterInfos(&SiStripClusterInfo_,detid,OffTrack, /*track_ok*/ false,LV,MEs, tTopo,stripGain,stripQuality,digilist);
1096  }
1097  }
1098  }
1099  } else {
1100  edm::LogError("SiStripMonitorTrack")<< "ClusterCollection is not valid!!" << std::endl;
1101  return;
1102  }
1103 }
1104 
1105 //------------------------------------------------------------------------
1107  SiStripHistoId hidmanager1;
1108 
1109  std::string layer_id = hidmanager1.getSubdetid(detid, tTopo, false);
1110  std::string ring_id = hidmanager1.getSubdetid(detid, tTopo, true);
1111  std::string sdet_tag = folderOrganizer_.getSubDetFolderAndTag(detid, tTopo).second;
1112 
1113  Det2MEs me;
1114  me.iLayer = nullptr;
1115  me.iRing = nullptr;
1116  me.iSubdet = nullptr;
1117 
1118  std::map<std::string, LayerMEs>::iterator iLayer = LayerMEsMap.find(layer_id);
1119  if (iLayer != LayerMEsMap.end()) {
1120  me.iLayer = &(iLayer->second);
1121  }
1122 
1123  std::map<std::string, RingMEs>::iterator iRing = RingMEsMap.find(ring_id);
1124  if (iRing != RingMEsMap.end()) {
1125  me.iRing = &(iRing->second);
1126  }
1127 
1128  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(sdet_tag);
1129  if (iSubdet != SubDetMEsMap.end()) {
1130  me.iSubdet = &(iSubdet->second);
1131  }
1132 
1133  return me;
1134 }
1135 
1136 //------------------------------------------------------------------------
1139  SiStripClusterInfo* cluster,
1140  const uint32_t detid,
1141  enum ClusterFlags flag,
1142  bool track_ok,
1143  const LocalVector LV,
1144  const Det2MEs& MEs ,
1145  const TrackerTopology* tTopo,
1146  const SiStripGain* stripGain,
1147  const SiStripQuality* stripQuality,
1148  const edm::DetSetVector<SiStripDigi>& digilist
1149 )
1150 {
1151 
1152  if (cluster==NULL) return false;
1153  // if one imposes a cut on the clusters, apply it
1154  if( (applyClusterQuality_) &&
1155  (cluster->signalOverNoise() < sToNLowerLimit_ ||
1156  cluster->signalOverNoise() > sToNUpperLimit_ ||
1157  cluster->width() < widthLowerLimit_ ||
1158  cluster->width() > widthUpperLimit_) ) return false;
1159  // start of the analysis
1160 
1161  float cosRZ = -2;
1162  LogDebug("SiStripMonitorTrack")<< "\n\tLV " << LV.x() << " " << LV.y() << " " << LV.z() << " " << LV.mag() << std::endl;
1163  if (LV.mag()){
1164  cosRZ= fabs(LV.z())/LV.mag();
1165  LogDebug("SiStripMonitorTrack")<< "\n\t cosRZ " << cosRZ << std::endl;
1166  }
1167 
1168  // Filling SubDet/Layer Plots (on Track + off Track)
1169  float StoN = cluster->signalOverNoise();
1170  float noise = cluster->noiseRescaledByGain();
1171  uint16_t charge = cluster->charge();
1172  uint16_t width = cluster->width();
1173  float position = cluster->baryStrip();
1174 
1175  // Getting raw charge with strip gain.
1176  double chargeraw = 0;
1177  double clustergain = 0 ;
1178  auto digi_it = digilist.find(detid); //(digilist.isValid() ? digilist.find(detid) : digilist.end());
1179  // SiStripClusterInfo.stripCharges() <==> SiStripCluster.amplitudes()
1180  for( size_t chidx = 0 ; chidx < cluster->stripCharges().size() ; ++chidx ){
1181  if( cluster->stripCharges().at(chidx) <= 0 ){ continue ; } // nonzero amplitude
1182  if( stripQuality->IsStripBad(stripQuality->getRange(detid), cluster->firstStrip()+chidx)) { continue ; }
1183  clustergain += stripGain->getStripGain(cluster->firstStrip()+chidx, stripGain->getRange(detid));
1184  // Getting raw adc charge from digi collections
1185  if( digi_it == digilist.end() ){
1186  continue;
1187  } // skipping if not found
1188  for( const auto& digiobj : *digi_it ){
1189  if( digiobj.strip() == cluster->firstStrip() + chidx ){
1190  chargeraw += digiobj.adc();
1191  }
1192  }
1193  }
1194  clustergain /= double(cluster->stripCharges().size()) ; // calculating average gain inside cluster
1195 
1196 
1197  // new dE/dx (chargePerCM)
1198  // https://indico.cern.ch/event/342236/session/5/contribution/10/material/slides/0.pdf
1199  float dQdx_fromTrack = siStripClusterTools::chargePerCM(detid, *cluster, LV);
1200  // from straigth line origin-sensor centre
1201  const StripGeomDetUnit* DetUnit = static_cast<const StripGeomDetUnit*>(tkgeom_->idToDetUnit(DetId(detid)));
1202  LocalPoint locVtx = DetUnit->toLocal(GlobalPoint(0.0, 0.0, 0.0));
1203  LocalVector locDir(locVtx.x(), locVtx.y(), locVtx.z());
1204  float dQdx_fromOrigin = siStripClusterTools::chargePerCM(detid, *cluster, locDir);
1205 
1206  if (TkHistoMap_On_ && (flag == OnTrack)) {
1207  uint32_t adet=cluster->detId();
1208  if(track_ok) tkhisto_ClChPerCMfromTrack->fill(adet,dQdx_fromTrack);
1209  }
1210  if (clchCMoriginTkHmap_On_ && (flag == OffTrack)){
1211  uint32_t adet=cluster->detId();
1212  if(track_ok) tkhisto_ClChPerCMfromOrigin->fill(adet,dQdx_fromOrigin);
1213  }
1214 
1215  if(flag==OnTrack){
1216  if (MEs.iSubdet != nullptr) MEs.iSubdet->totNClustersOnTrack++;
1217  // layerMEs
1218  if (MEs.iLayer != nullptr) {
1219  if(noise > 0.0) fillME(MEs.iLayer->ClusterStoNCorrOnTrack, StoN*cosRZ);
1220  if(noise == 0.0) LogDebug("SiStripMonitorTrack") << "Module " << detid << " in Event " << eventNb << " noise " << cluster->noiseRescaledByGain() << std::endl;
1221  fillME(MEs.iLayer->ClusterGain, clustergain);
1222  fillME(MEs.iLayer->ClusterChargeCorrOnTrack, charge*cosRZ);
1223  fillME(MEs.iLayer->ClusterChargeOnTrack, charge);
1224  fillME(MEs.iLayer->ClusterChargeRawOnTrack, chargeraw);
1225  fillME(MEs.iLayer->ClusterNoiseOnTrack, noise);
1226  fillME(MEs.iLayer->ClusterWidthOnTrack, width);
1227  fillME(MEs.iLayer->ClusterPosOnTrack, position);
1228  if(track_ok) fillME(MEs.iLayer->ClusterChargePerCMfromTrack, dQdx_fromTrack);
1229  if(track_ok) fillME(MEs.iLayer->ClusterChargePerCMfromOriginOnTrack, dQdx_fromOrigin);
1230  }
1231  // ringMEs
1232  if (MEs.iRing != nullptr) {
1233  if(noise > 0.0) fillME(MEs.iRing->ClusterStoNCorrOnTrack, StoN*cosRZ);
1234  if(noise == 0.0) LogDebug("SiStripMonitorTrack") << "Module " << detid << " in Event " << eventNb << " noise " << cluster->noiseRescaledByGain() << std::endl;
1235  fillME(MEs.iRing->ClusterGain, clustergain);
1236  fillME(MEs.iRing->ClusterChargeCorrOnTrack, charge*cosRZ);
1237  fillME(MEs.iRing->ClusterChargeOnTrack, charge);
1238  fillME(MEs.iRing->ClusterChargeRawOnTrack, chargeraw);
1239  fillME(MEs.iRing->ClusterNoiseOnTrack, noise);
1240  fillME(MEs.iRing->ClusterWidthOnTrack, width);
1241  fillME(MEs.iRing->ClusterPosOnTrack, position);
1242  if(track_ok) fillME(MEs.iRing->ClusterChargePerCMfromTrack, dQdx_fromTrack);
1243  if(track_ok) fillME(MEs.iRing->ClusterChargePerCMfromOriginOnTrack, dQdx_fromOrigin);
1244  }
1245  // subdetMEs
1246  if(MEs.iSubdet != nullptr){
1247  fillME(MEs.iSubdet->ClusterGain, clustergain);
1248  fillME(MEs.iSubdet->ClusterChargeOnTrack,charge);
1249  fillME(MEs.iSubdet->ClusterChargeRawOnTrack,chargeraw);
1250  if(noise > 0.0) fillME(MEs.iSubdet->ClusterStoNCorrOnTrack,StoN*cosRZ);
1251  fillME(MEs.iSubdet->ClusterChargeCorrOnTrack, charge*cosRZ);
1252  if(track_ok) fillME(MEs.iSubdet->ClusterChargePerCMfromTrack,dQdx_fromTrack);
1253  if(track_ok) fillME(MEs.iSubdet->ClusterChargePerCMfromOriginOnTrack,dQdx_fromOrigin);
1254  if( tTopo->moduleGeometry(detid) == SiStripDetId::ModuleGeometry::W5 || tTopo->moduleGeometry(detid) == SiStripDetId::ModuleGeometry::W6 || tTopo->moduleGeometry(detid) == SiStripDetId::ModuleGeometry::W7) {
1255  if(noise > 0.0) fillME(MEs.iSubdet->ClusterStoNCorrThickOnTrack, StoN*cosRZ);
1256  fillME(MEs.iSubdet->ClusterChargeCorrThickOnTrack, charge*cosRZ);
1257  } else {
1258  if(noise > 0.0) fillME(MEs.iSubdet->ClusterStoNCorrThinOnTrack, StoN*cosRZ);
1259  fillME(MEs.iSubdet->ClusterChargeCorrThinOnTrack, charge*cosRZ);
1260  }
1261  }
1262  //******** TkHistoMaps
1263  if (TkHistoMap_On_) {
1264  uint32_t adet=cluster->detId();
1265  tkhisto_NumOnTrack->add(adet,1.);
1266  if(noise > 0.0) tkhisto_StoNCorrOnTrack->fill(adet,cluster->signalOverNoise()*cosRZ);
1267  if(noise == 0.0)
1268  LogDebug("SiStripMonitorTrack") << "Module " << detid << " in Event " << eventNb << " noise " << noise << std::endl;
1269  }
1270  // Module plots filled only for onTrack Clusters
1271  if(Mod_On_){
1272  SiStripHistoId hidmanager2;
1273  std::string name = hidmanager2.createHistoId("","det",detid);
1274  //fillModMEs
1275  std::map<std::string, ModMEs>::iterator iModME = ModMEsMap.find(name);
1276  if(iModME!=ModMEsMap.end()){
1277  if(noise > 0.0) fillME(iModME->second.ClusterStoNCorr ,StoN*cosRZ);
1278  if(noise == 0.0) LogDebug("SiStripMonitorTrack") << "Module " << name << " in Event " << eventNb << " noise " << noise << std::endl;
1279  fillME(iModME->second.ClusterGain, clustergain);
1280  fillME(iModME->second.ClusterCharge,charge);
1281  fillME(iModME->second.ClusterChargeRaw,chargeraw);
1282 
1283  fillME(iModME->second.ClusterChargeCorr,charge*cosRZ);
1284 
1285  fillME(iModME->second.ClusterWidth ,width);
1286  fillME(iModME->second.ClusterPos ,position);
1287 
1288  if(track_ok) fillME(iModME->second.ClusterChargePerCMfromTrack, dQdx_fromTrack);
1289  if(track_ok) fillME(iModME->second.ClusterChargePerCMfromOrigin, dQdx_fromOrigin);
1290 
1291  //fill the PGV histo
1292  float PGVmax = cluster->maxCharge();
1293  int PGVposCounter = cluster->maxIndex();
1294  for (int i= int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmin"));i<PGVposCounter;++i)
1295  fillME(iModME->second.ClusterPGV, i,0.);
1296  for (auto it=cluster->stripCharges().begin();it<cluster->stripCharges().end();++it) {
1297  fillME(iModME->second.ClusterPGV, PGVposCounter++,(*it)/PGVmax);
1298  }
1299  for (int i= PGVposCounter;i<int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmax"));++i)
1300  fillME(iModME->second.ClusterPGV, i,0.);
1301  //end fill the PGV histo
1302  }
1303  }
1304  } else {
1305  if (flag == OffTrack) {
1306  if (MEs.iSubdet != nullptr) MEs.iSubdet->totNClustersOffTrack++;
1307  //******** TkHistoMaps
1308  if (TkHistoMap_On_) {
1309  uint32_t adet=cluster->detId();
1310  tkhisto_NumOffTrack->add(adet,1.);
1311  if(charge > 250){
1312  LogDebug("SiStripMonitorTrack") << "Module firing " << detid << " in Event " << eventNb << std::endl;
1313  }
1314  }
1315  }
1316  // layerMEs
1317  if (MEs.iLayer != nullptr) {
1318  fillME(MEs.iLayer->ClusterGain, clustergain);
1319  fillME(MEs.iLayer->ClusterChargeOffTrack, charge);
1320  fillME(MEs.iLayer->ClusterChargeRawOffTrack, chargeraw);
1321  fillME(MEs.iLayer->ClusterNoiseOffTrack, noise);
1322  fillME(MEs.iLayer->ClusterWidthOffTrack, width);
1323  fillME(MEs.iLayer->ClusterPosOffTrack, position);
1324  fillME(MEs.iLayer->ClusterChargePerCMfromOriginOffTrack, dQdx_fromOrigin);
1325  }
1326  // ringMEs
1327  if (MEs.iRing != nullptr) {
1328  fillME(MEs.iRing->ClusterGain, clustergain);
1329  fillME(MEs.iRing->ClusterChargeOffTrack, charge);
1330  fillME(MEs.iRing->ClusterChargeRawOffTrack, chargeraw);
1331  fillME(MEs.iRing->ClusterNoiseOffTrack, noise);
1332  fillME(MEs.iRing->ClusterWidthOffTrack, width);
1333  fillME(MEs.iRing->ClusterPosOffTrack, position);
1334  fillME(MEs.iRing->ClusterChargePerCMfromOriginOffTrack, dQdx_fromOrigin);
1335  }
1336  // subdetMEs
1337  if(MEs.iSubdet != nullptr){
1338  fillME(MEs.iSubdet->ClusterGain, clustergain);
1339  fillME(MEs.iSubdet->ClusterChargeOffTrack,charge);
1340  fillME(MEs.iSubdet->ClusterChargeRawOffTrack,chargeraw);
1341  if(noise > 0.0) fillME(MEs.iSubdet->ClusterStoNOffTrack,StoN);
1342  fillME(MEs.iSubdet->ClusterChargePerCMfromOriginOffTrack,dQdx_fromOrigin);
1343  }
1344  }
1345  return true;
1346 }
1347 //--------------------------------------------------------------------------------
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
uint8_t maxCharge() const
double p() const
momentum vector magnitude
Definition: TrackBase.h:610
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Det2MEs findMEs(const TrackerTopology *tTopo, const uint32_t detid)
void trackStudyFromTrack(edm::Handle< reco::TrackCollection > trackCollectionHandle, const edm::Event &ev, const edm::EventSetup &es)
MonitorElement * ClusterChargePerCMfromTrack
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
TkHistoMap * tkhisto_NumOffTrack
uint16_t firstStrip() const
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
SiStripMonitorTrack(const edm::ParameterSet &)
iterator find(det_id_type id)
Definition: DetSetVector.h:290
void setSiStripFolderName(std::string name)
void trackStudy(const edm::Event &ev, const edm::EventSetup &es)
edm::EDGetTokenT< reco::TrackCollection > trackToken_
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void fillME(MonitorElement *ME, float value1)
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
SiStripDCSStatus * dcsStatus_
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:556
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
float noiseRescaledByGain() const
void book(DQMStore::IBooker &, const TrackerTopology *tTopo)
void AllClusters(const edm::Event &ev, const edm::EventSetup &es)
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
bool IsStripBad(const uint32_t &detid, const short &strip) const
std::map< std::string, RingMEs > RingMEsMap
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
void RecHitInfo(const T *tkrecHit, LocalVector LV, const edm::Event &, const edm::EventSetup &, bool ok)
float chargePerCM(DetId detid, Iter a, Iter b)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
float baryStrip() const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ParameterSet conf_
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
MonitorElement * bookME1D(DQMStore::IBooker &, const char *, const char *)
#define NULL
Definition: scimark2.h:8
MonitorElement * ClusterChargePerCMfromTrack
bool ev
SiStripDetId::ModuleGeometry moduleGeometry(const DetId &id) const
MonitorElement * ClusterChargeCorrOnTrack
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
data_type const * const_iterator
Definition: DetSetNew.h:30
bool trackFilter(const reco::Track &track)
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
void bookLayerMEs(DQMStore::IBooker &, const uint32_t, std::string &)
uint16_t maxIndex() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MonitorElement * ClusterChargePerCMfromOriginOffTrack
bool clusterInfos(SiStripClusterInfo *cluster, const uint32_t detid, enum ClusterFlags flags, bool track_ok, LocalVector LV, const Det2MEs &MEs, const TrackerTopology *tTopo, const SiStripGain *stripGain, const SiStripQuality *stripQuality, const edm::DetSetVector< SiStripDigi > &digilist)
MonitorElement * ClusterChargeCorrThinOnTrack
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::ESHandle< TrackerGeometry > tkgeom_
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
edmNew::DetSet< SiStripCluster >::const_iterator ClusIter
math::XYZTLorentzVectorD LV
float signalOverNoise() const
T mag() const
Definition: PV3DBase.h:67
MonitorElement * ClusterChargeRawOnTrack
vector< ParameterSet > Parameters
edm::EventNumber_t eventNb
TkHistoMap * tkhisto_NumMissingHits
uint16_t charge() const
std::unordered_set< const SiStripCluster * > vPSiStripCluster
void hitStudy(const edm::Event &ev, const edm::EventSetup &es, const ProjectedSiStripRecHit2D *projhit, const SiStripMatchedRecHit2D *matchedhit, const SiStripRecHit2D *hit2D, const SiStripRecHit1D *hit1D, LocalVector localMomentum, const bool track_ok)
std::map< std::string, SubDetMEs > SubDetMEsMap
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:68
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:180
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
double pt() const
track transverse momentum
Definition: TrackBase.h:616
const std::string subdet_tag("SubDet")
T z() const
Definition: PV3DBase.h:64
MonitorElement * bookME2D(DQMStore::IBooker &, const char *, const char *)
uint16_t width() const
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:289
TH1 * getTH1(void) const
void bookSubDetMEs(DQMStore::IBooker &, std::string &name)
MonitorElement * bookME3D(DQMStore::IBooker &, const char *, const char *)
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &es) override
int orbitNumber() const
Definition: EventBase.h:65
MonitorElement * ClusterChargePerCMfromOrigin
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
MonitorElement * ClusterChargePerCMfromOriginOffTrack
SiStripFolderOrganizer folderOrganizer_
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * ClusterChargePerCMfromTrack
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > digiToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
#define LogTrace(id)
MonitorElement * ClusterChargeCorrThickOnTrack
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
void bookModMEs(DQMStore::IBooker &, const uint32_t)
TkHistoMap * tkhisto_NumberInactiveHits
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
void trackStudyFromTrajectory(edm::Handle< reco::TrackCollection > trackCollectionHandle, const edm::Event &ev, const edm::EventSetup &es)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
TkHistoMap * tkhisto_ClChPerCMfromOrigin
SiStripRecHit2D stereoHit() const
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * ClusterChargePerCMfromTrack
const T & get() const
Definition: EventSetup.h:56
std::map< std::string, ModMEs > ModMEsMap
MonitorElement * bookMETrend(DQMStore::IBooker &, const char *)
TkHistoMap * tkhisto_ClChPerCMfromTrack
std::string HistoName
int numberOfValidTrackerHits() const
Definition: HitPattern.h:828
TkHistoMap * tkhisto_NumOnTrack
SiStripRecHit2D monoHit() const
uint32_t detId() const
GenericTriggerEventFlag * genTriggerEventFlag_
const uint16_t nApvPairs(uint32_t det_id) const
MonitorElement * ClusterChargePerCMfromOriginOnTrack
edm::EventID id() const
Definition: EventBase.h:58
fixed size matrix
const Range getRange(const uint32_t detID) const
HLT enums.
MonitorElement * handleBookMEs(DQMStore::IBooker &, std::string &, std::string &, std::string &, std::string &)
static int position[264][3]
Definition: ReadPGInfo.cc:509
void trajectoryStudy(const reco::Track &track, const edm::Event &ev, const edm::EventSetup &es, bool track_ok)
MonitorElement * bookMEProfile(DQMStore::IBooker &, const char *, const char *)
TkHistoMap * tkhisto_StoNCorrOnTrack
DetId geographicalId() const
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
MonitorElement * ClusterChargePerCMfromOriginOnTrack
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:151
long double T
T x() const
Definition: PV3DBase.h:62
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void bookRingMEs(DQMStore::IBooker &, const uint32_t, std::string &)
T const * product() const
Definition: ESHandle.h:86
MonitorElement * ClusterStoNCorrThickOnTrack
MonitorElement * ClusterChargePerCMfromOriginOnTrack
void add(uint32_t &detid, float value)
Definition: TkHistoMap.cc:213
TkHistoMap * tkhisto_NumberValidHits
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
Definition: Run.h:42
const TrackerGeomDet * idToDet(DetId) const
MonitorElement * ClusterChargeRawOffTrack
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:66
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterToken_
std::map< std::string, LayerMEs > LayerMEsMap
const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
MonitorElement * ClusterChargePerCMfromOriginOffTrack