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