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