CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripMonitorTrack.cc
Go to the documentation of this file.
2 
5 
18 
20 
22 #include "TMath.h"
23 
25  dbe(edm::Service<DQMStore>().operator->()),
26  conf_(conf),
27  tracksCollection_in_EventTree(true),
28  firstEvent(-1),
29  genTriggerEventFlag_(new GenericTriggerEventFlag(conf, consumesCollector()))
30 {
31  Cluster_src_ = conf.getParameter<edm::InputTag>("Cluster_src");
32  Mod_On_ = conf.getParameter<bool>("Mod_On");
33  Trend_On_ = conf.getParameter<bool>("Trend_On");
34  flag_ring = conf.getParameter<bool>("RingFlag_On");
35  TkHistoMap_On_ = conf.getParameter<bool>("TkHistoMap_On");
36 
37  TrackProducer_ = conf_.getParameter<std::string>("TrackProducer");
38  TrackLabel_ = conf_.getParameter<std::string>("TrackLabel");
39 
40  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
41 
42  clusterToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(Cluster_src_);
43  trackToken_ = consumes<reco::TrackCollection>(edm::InputTag(TrackProducer_,TrackLabel_) );
44  trackTrajToken_ = consumes<TrajTrackAssociationCollection>(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 
81 {
82  //Retrieve tracker topology from geometry
84  es.get<IdealGeometryRecord>().get(tTopoHandle);
85  const TrackerTopology* const tTopo = tTopoHandle.product();
86  book(ibooker , tTopo);
87 }
88 
89 //------------------------------------------------------------------------
91 {
92  if(conf_.getParameter<bool>("OutputMEsInRootFile")){
93  //dbe->showDirStructure();
94  dbe->save(conf_.getParameter<std::string>("OutputFileName"));
95  }
96 }
97 
98 // ------------ method called to produce the data ------------
100 {
101  // Filter out events if DCS checking is requested
102  if (dcsStatus_ && !dcsStatus_->getStatus(e,es)) return;
103 
104  // Filter out events if Trigger Filtering is requested
105  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( e, es) ) return;
106 
107  //initialization of global quantities
108  LogDebug("SiStripMonitorTrack") << "[SiStripMonitorTrack::analyse] " << "Run " << e.id().run() << " Event " << e.id().event() << std::endl;
109  eventNb = e.id().event();
110 // vPSiStripCluster.clear();
111  vPSiStripCluster.clear();
112 
113  iOrbitSec = e.orbitNumber()/11223.0;
114 
115  // initialise # of clusters
116  for (std::map<std::string, SubDetMEs>::iterator iSubDet = SubDetMEsMap.begin();
117  iSubDet != SubDetMEsMap.end(); iSubDet++) {
118  iSubDet->second.totNClustersOnTrack = 0;
119  iSubDet->second.totNClustersOffTrack = 0;
120  }
121 
122  //Perform track study
123  trackStudy(e, es);
124 
125  //Perform Cluster Study (irrespectively to tracks)
126 
127  AllClusters(e, es); //analyzes the off Track Clusters
128 
129  //Summary Counts of clusters
130  std::map<std::string, MonitorElement*>::iterator iME;
131  std::map<std::string, LayerMEs>::iterator iLayerME;
132 
133  for (std::map<std::string, SubDetMEs>::iterator iSubDet = SubDetMEsMap.begin();
134  iSubDet != SubDetMEsMap.end(); iSubDet++) {
135  SubDetMEs subdet_mes = iSubDet->second;
136  if (subdet_mes.totNClustersOnTrack > 0) {
137  fillME(subdet_mes.nClustersOnTrack, subdet_mes.totNClustersOnTrack);
138  }
139  fillME(subdet_mes.nClustersOffTrack, subdet_mes.totNClustersOffTrack);
140  if (Trend_On_) {
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  }
159  //******** TkHistoMaps
160 
161  std::vector<uint32_t> vdetId_;
162  SiStripDetCabling_->addActiveDetectorsRawIds(vdetId_);
163  //Histos for each detector, layer and module
164  for (std::vector<uint32_t>::const_iterator detid_iter=vdetId_.begin();detid_iter!=vdetId_.end();detid_iter++){ //loop on all the active detid
165  uint32_t detid = *detid_iter;
166 
167  if (detid < 1){
168  edm::LogError("SiStripMonitorTrack")<< "[" <<__PRETTY_FUNCTION__ << "] invalid detid " << detid<< std::endl;
169  continue;
170  }
171 
172 
174 
175  // book Layer and RING plots
176  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,flag_ring);
177 
178  SiStripHistoId hidmanager;
179  std::string layer_id = hidmanager.getSubdetid(detid, tTopo, flag_ring);
180  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_id);
181  if(iLayerME==LayerMEsMap.end()){
182  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, flag_ring);
183  bookLayerMEs(ibooker , detid, layer_id);
184  }
185  // book sub-detector plots
186  std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
187  if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
188  ibooker.setCurrentFolder(sdet_pair.first);
189  bookSubDetMEs(ibooker , sdet_pair.second);
190  }
191  // book module plots
192  if(Mod_On_) {
193  folder_organizer.setDetectorFolder(detid,tTopo);
194  bookModMEs(ibooker , *detid_iter);
195  }
196  }//end loop on detectors detid
197 }
198 
199 //--------------------------------------------------------------------------------
200 void SiStripMonitorTrack::bookModMEs(DQMStore::IBooker & ibooker , const uint32_t & id)//Histograms at MODULE level
201 {
202  std::string name = "det";
203  SiStripHistoId hidmanager;
204  std::string hid = hidmanager.createHistoId("",name,id);
205  std::map<std::string, ModMEs>::iterator iModME = ModMEsMap.find(hid);
206  if(iModME==ModMEsMap.end()){
207  ModMEs theModMEs;
208  theModMEs.ClusterStoNCorr = 0;
209  theModMEs.ClusterCharge = 0;
210  theModMEs.ClusterChargeCorr = 0;
211  theModMEs.ClusterWidth = 0;
212  theModMEs.ClusterPos = 0;
213  theModMEs.ClusterPGV = 0;
214 
215  // Cluster Width
216  theModMEs.ClusterWidth=bookME1D(ibooker , "TH1ClusterWidth", hidmanager.createHistoId("ClusterWidth_OnTrack",name,id).c_str());
217  ibooker.tag(theModMEs.ClusterWidth,id);
218  // Cluster Charge
219  theModMEs.ClusterCharge=bookME1D(ibooker , "TH1ClusterCharge", hidmanager.createHistoId("ClusterCharge_OnTrack",name,id).c_str());
220  ibooker.tag(theModMEs.ClusterCharge,id);
221  // Cluster Charge Corrected
222  theModMEs.ClusterChargeCorr=bookME1D(ibooker , "TH1ClusterChargeCorr", hidmanager.createHistoId("ClusterChargeCorr_OnTrack",name,id).c_str());
223  ibooker.tag(theModMEs.ClusterChargeCorr,id);
224  // Cluster StoN Corrected
225  theModMEs.ClusterStoNCorr=bookME1D(ibooker , "TH1ClusterStoNCorrMod", hidmanager.createHistoId("ClusterStoNCorr_OnTrack",name,id).c_str());
226  ibooker.tag(theModMEs.ClusterStoNCorr,id);
227  // Cluster Position
228  short total_nr_strips = SiStripDetCabling_->nApvPairs(id) * 2 * 128;
229  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);
230  ibooker.tag(theModMEs.ClusterPos,id);
231  // Cluster PGV
232  theModMEs.ClusterPGV=bookMEProfile(ibooker , "TProfileClusterPGV", hidmanager.createHistoId("PGV_OnTrack",name,id).c_str());
233  ibooker.tag(theModMEs.ClusterPGV,id);
234 
235  ModMEsMap[hid]=theModMEs;
236  }
237 }
238 //
239 // -- Book Layer Level Histograms and Trend plots
240 //
241 void SiStripMonitorTrack::bookLayerMEs(DQMStore::IBooker & ibooker , const uint32_t& mod_id, std::string& layer_id)
242 {
243  std::string name = "layer";
244  std::string hname;
245  SiStripHistoId hidmanager;
246 
247  LayerMEs theLayerMEs;
248  theLayerMEs.ClusterStoNCorrOnTrack = 0;
249  theLayerMEs.ClusterChargeCorrOnTrack = 0;
250  theLayerMEs.ClusterChargeOnTrack = 0;
251  theLayerMEs.ClusterChargeOffTrack = 0;
252  theLayerMEs.ClusterNoiseOnTrack = 0;
253  theLayerMEs.ClusterNoiseOffTrack = 0;
254  theLayerMEs.ClusterWidthOnTrack = 0;
255  theLayerMEs.ClusterWidthOffTrack = 0;
256  theLayerMEs.ClusterPosOnTrack = 0;
257  theLayerMEs.ClusterPosOffTrack = 0;
258 
259  // Cluster StoN Corrected
260  hname = hidmanager.createHistoLayer("Summary_ClusterStoNCorr",name,layer_id,"OnTrack");
261  theLayerMEs.ClusterStoNCorrOnTrack = bookME1D(ibooker , "TH1ClusterStoNCorr", hname.c_str());
262 
263  // Cluster Charge Corrected
264  hname = hidmanager.createHistoLayer("Summary_ClusterChargeCorr",name,layer_id,"OnTrack");
265  theLayerMEs.ClusterChargeCorrOnTrack = bookME1D(ibooker , "TH1ClusterChargeCorr", hname.c_str());
266 
267  // Cluster Charge (On and Off Track)
268  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,layer_id,"OnTrack");
269  theLayerMEs.ClusterChargeOnTrack = bookME1D(ibooker , "TH1ClusterCharge", hname.c_str());
270 
271  hname = hidmanager.createHistoLayer("Summary_ClusterCharge",name,layer_id,"OffTrack");
272  theLayerMEs.ClusterChargeOffTrack = bookME1D(ibooker , "TH1ClusterCharge", hname.c_str());
273 
274  // Cluster Noise (On and Off Track)
275  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,layer_id,"OnTrack");
276  theLayerMEs.ClusterNoiseOnTrack = bookME1D(ibooker , "TH1ClusterNoise", hname.c_str());
277 
278  hname = hidmanager.createHistoLayer("Summary_ClusterNoise",name,layer_id,"OffTrack");
279  theLayerMEs.ClusterNoiseOffTrack = bookME1D(ibooker , "TH1ClusterNoise", hname.c_str());
280 
281  // Cluster Width (On and Off Track)
282  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,layer_id,"OnTrack");
283  theLayerMEs.ClusterWidthOnTrack = bookME1D(ibooker , "TH1ClusterWidth", hname.c_str());
284 
285  hname = hidmanager.createHistoLayer("Summary_ClusterWidth",name,layer_id,"OffTrack");
286  theLayerMEs.ClusterWidthOffTrack = bookME1D(ibooker , "TH1ClusterWidth", hname.c_str());
287 
288  //Cluster Position
289  short total_nr_strips = SiStripDetCabling_->nApvPairs(mod_id) * 2 * 128;
290  if (layer_id.find("TEC") != std::string::npos && !flag_ring) total_nr_strips = 3 * 2 * 128;
291 
292  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,layer_id,"OnTrack");
293  theLayerMEs.ClusterPosOnTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
294 
295  hname = hidmanager.createHistoLayer("Summary_ClusterPosition",name,layer_id,"OffTrack");
296  theLayerMEs.ClusterPosOffTrack = ibooker.book1D(hname, hname, total_nr_strips, 0.5,total_nr_strips+0.5);
297 
298  //bookeeping
299  LayerMEsMap[layer_id]=theLayerMEs;
300 }
301 //
302 // -- Book Histograms at Sub-Detector Level
303 //
305 
307  subdet_tag = "__" + name;
308  std::string completeName;
309 
310  SubDetMEs theSubDetMEs;
311  theSubDetMEs.totNClustersOnTrack = 0;
312  theSubDetMEs.totNClustersOffTrack = 0;
313  theSubDetMEs.nClustersOnTrack = 0;
314  theSubDetMEs.nClustersTrendOnTrack = 0;
315  theSubDetMEs.nClustersOffTrack = 0;
316  theSubDetMEs.nClustersTrendOffTrack = 0;
317  theSubDetMEs.ClusterStoNCorrOnTrack = 0;
318  theSubDetMEs.ClusterChargeOnTrack = 0;
319  theSubDetMEs.ClusterChargeOffTrack = 0;
320  theSubDetMEs.ClusterStoNOffTrack = 0;
321 
322  // TotalNumber of Cluster OnTrack
323  completeName = "Summary_TotalNumberOfClusters_OnTrack" + subdet_tag;
324  theSubDetMEs.nClustersOnTrack = bookME1D(ibooker , "TH1nClustersOn", completeName.c_str());
325  theSubDetMEs.nClustersOnTrack->getTH1()->StatOverflows(kTRUE);
326 
327  // TotalNumber of Cluster OffTrack
328  completeName = "Summary_TotalNumberOfClusters_OffTrack" + subdet_tag;
329  theSubDetMEs.nClustersOffTrack = bookME1D(ibooker , "TH1nClustersOff", completeName.c_str());
330  theSubDetMEs.nClustersOffTrack->getTH1()->StatOverflows(kTRUE);
331 
332  // Cluster StoN On Track
333  completeName = "Summary_ClusterStoNCorr_OnTrack" + subdet_tag;
334  theSubDetMEs.ClusterStoNCorrOnTrack = bookME1D(ibooker , "TH1ClusterStoNCorr", completeName.c_str());
335 
336  // Cluster Charge On Track
337  completeName = "Summary_ClusterCharge_OnTrack" + subdet_tag;
338  theSubDetMEs.ClusterChargeOnTrack=bookME1D(ibooker , "TH1ClusterCharge", completeName.c_str());
339 
340  // Cluster Charge Off Track
341  completeName = "Summary_ClusterCharge_OffTrack" + subdet_tag;
342  theSubDetMEs.ClusterChargeOffTrack=bookME1D(ibooker , "TH1ClusterCharge", completeName.c_str());
343 
344  // Cluster Charge StoN Off Track
345  completeName = "Summary_ClusterStoN_OffTrack" + subdet_tag;
346  theSubDetMEs.ClusterStoNOffTrack = bookME1D(ibooker , "TH1ClusterStoN", completeName.c_str());
347 
348  if(Trend_On_){
349  // TotalNumber of Cluster
350  completeName = "Trend_TotalNumberOfClusters_OnTrack" + subdet_tag;
351  theSubDetMEs.nClustersTrendOnTrack = bookMETrend(ibooker , "TH1nClustersOn", completeName.c_str());
352  completeName = "Trend_TotalNumberOfClusters_OffTrack" + subdet_tag;
353  theSubDetMEs.nClustersTrendOffTrack = bookMETrend(ibooker , "TH1nClustersOff", completeName.c_str());
354  }
355  //bookeeping
356  SubDetMEsMap[name]=theSubDetMEs;
357 }
358 //--------------------------------------------------------------------------------
359 
360 MonitorElement* SiStripMonitorTrack::bookME1D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
361 {
362  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
363  // std::cout << "[SiStripMonitorTrack::bookME1D] pwd: " << dbe->pwd() << std::endl;
364  // std::cout << "[SiStripMonitorTrack::bookME1D] HistoName: " << HistoName << std::endl;
365  return ibooker.book1D(HistoName,HistoName,
366  Parameters.getParameter<int32_t>("Nbinx"),
367  Parameters.getParameter<double>("xmin"),
368  Parameters.getParameter<double>("xmax")
369  );
370 }
371 
372 //--------------------------------------------------------------------------------
373 MonitorElement* SiStripMonitorTrack::bookME2D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
374 {
375  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
376  return ibooker.book2D(HistoName,HistoName,
377  Parameters.getParameter<int32_t>("Nbinx"),
378  Parameters.getParameter<double>("xmin"),
379  Parameters.getParameter<double>("xmax"),
380  Parameters.getParameter<int32_t>("Nbiny"),
381  Parameters.getParameter<double>("ymin"),
382  Parameters.getParameter<double>("ymax")
383  );
384 }
385 
386 //--------------------------------------------------------------------------------
387 MonitorElement* SiStripMonitorTrack::bookME3D(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
388 {
389  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
390  return ibooker.book3D(HistoName,HistoName,
391  Parameters.getParameter<int32_t>("Nbinx"),
392  Parameters.getParameter<double>("xmin"),
393  Parameters.getParameter<double>("xmax"),
394  Parameters.getParameter<int32_t>("Nbiny"),
395  Parameters.getParameter<double>("ymin"),
396  Parameters.getParameter<double>("ymax"),
397  Parameters.getParameter<int32_t>("Nbinz"),
398  Parameters.getParameter<double>("zmin"),
399  Parameters.getParameter<double>("zmax")
400  );
401 }
402 
403 //--------------------------------------------------------------------------------
404 MonitorElement* SiStripMonitorTrack::bookMEProfile(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
405 {
406  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
407  return ibooker.bookProfile(HistoName,HistoName,
408  Parameters.getParameter<int32_t>("Nbinx"),
409  Parameters.getParameter<double>("xmin"),
410  Parameters.getParameter<double>("xmax"),
411  Parameters.getParameter<int32_t>("Nbiny"),
412  Parameters.getParameter<double>("ymin"),
413  Parameters.getParameter<double>("ymax"),
414  "" );
415 }
416 
417 //--------------------------------------------------------------------------------
418 MonitorElement* SiStripMonitorTrack::bookMETrend(DQMStore::IBooker & ibooker , const char* ParameterSetLabel, const char* HistoName)
419 {
420  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
421  edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
422  MonitorElement* me = ibooker.bookProfile(HistoName,HistoName,
423  ParametersTrend.getParameter<int32_t>("Nbins"),
424  0,
425  ParametersTrend.getParameter<int32_t>("Nbins"),
426  100, //that parameter should not be there !?
427  Parameters.getParameter<double>("xmin"),
428  Parameters.getParameter<double>("xmax"),
429  "" );
430  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetBit(TH1::kCanRebin);
431 
432  if(!me) return me;
433  me->setAxisTitle("Event Time in Seconds",1);
434  return me;
435 }
436 
437 //------------------------------------------------------------------------------------------
438 //void SiStripMonitorTrack::trajectoryStudy(const edm::Ref<std::vector<Trajectory> > traj, reco::TrackRef trackref, const edm::EventSetup& es) {
439 void SiStripMonitorTrack::trajectoryStudy(const edm::Ref<std::vector<Trajectory> > traj, const edm::EventSetup& es) {
440 
441 
442  const std::vector<TrajectoryMeasurement> & measurements = traj->measurements();
443  std::vector<TrajectoryMeasurement>::const_iterator traj_mes_iterator;
444  for(std::vector<TrajectoryMeasurement>::const_iterator traj_mes_iterator= measurements.begin(), traj_mes_end=measurements.end();
445  traj_mes_iterator!=traj_mes_end;traj_mes_iterator++){//loop on measurements
446  //trajectory local direction and position on detector
447  LocalVector statedirection;
448 
449  TrajectoryStateOnSurface updatedtsos=traj_mes_iterator->updatedState();
450  ConstRecHitPointer ttrh=traj_mes_iterator->recHit();
451 
452  if (!ttrh->isValid()) continue;
453 
454  const ProjectedSiStripRecHit2D* projhit = dynamic_cast<const ProjectedSiStripRecHit2D*>( ttrh->hit() );
455  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>( ttrh->hit() );
456  const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( ttrh->hit() );
457  const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( ttrh->hit() );
458  // std::cout << "[SiStripMonitorTrack::trajectoryStudy] RecHit DONE" << std::endl;
459 
460  // RecHitType type=Single;
461 
462  if(matchedhit){
463  LogTrace("SiStripMonitorTrack")<<"\nMatched recHit found"<< std::endl;
464  // type=Matched;
465 
466  GluedGeomDet * gdet=(GluedGeomDet *)tkgeom_->idToDet(matchedhit->geographicalId());
467  GlobalVector gtrkdirup=gdet->toGlobal(updatedtsos.localMomentum());
468  //mono side
469  const GeomDetUnit * monodet=gdet->monoDet();
470  statedirection=monodet->toLocal(gtrkdirup);
471  SiStripRecHit2D m = matchedhit->monoHit();
472  // if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,trackref,es);
473  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,es);
474  //stereo side
475  const GeomDetUnit * stereodet=gdet->stereoDet();
476  statedirection=stereodet->toLocal(gtrkdirup);
477  SiStripRecHit2D s = matchedhit->stereoHit();
478  // if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,trackref,es);
479  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,es);
480  }
481  else if(projhit){
482  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found"<< std::endl;
483  // type=Projected;
484  GluedGeomDet * gdet=(GluedGeomDet *)tkgeom_->idToDet(projhit->geographicalId());
485 
486  GlobalVector gtrkdirup=gdet->toGlobal(updatedtsos.localMomentum());
487  const SiStripRecHit2D originalhit=projhit->originalHit();
488  const GeomDetUnit * det;
489  if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
490  //mono side
491  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found MONO"<< std::endl;
492  det=gdet->monoDet();
493  statedirection=det->toLocal(gtrkdirup);
494  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
495  }
496  else{
497  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found STEREO"<< std::endl;
498  //stereo side
499  det=gdet->stereoDet();
500  statedirection=det->toLocal(gtrkdirup);
501  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
502  }
503  }else if (hit2D){
504  statedirection=updatedtsos.localMomentum();
505  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,es);
506  } else if (hit1D) {
507  statedirection=updatedtsos.localMomentum();
508  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,es);
509  } else {
510  LogDebug ("SiStripMonitorTrack")
511  << " LocalMomentum: "<<statedirection
512  << "\nLocal x-z plane angle: "<<atan2(statedirection.x(),statedirection.z());
513  }
514 
515  }
516 
517 }
518 
520  const ProjectedSiStripRecHit2D* projhit,
521  const SiStripMatchedRecHit2D* matchedhit,
522  const SiStripRecHit2D* hit2D,
523  const SiStripRecHit1D* hit1D,
524  LocalVector localMomentum
525  ) {
526  LocalVector statedirection;
527  if(matchedhit){ // type=Matched;
528  LogTrace("SiStripMonitorTrack")<<"\nMatched recHit found"<< std::endl;
529 
530  GluedGeomDet * gdet=(GluedGeomDet *)tkgeom_->idToDet(matchedhit->geographicalId());
531 
532  GlobalVector gtrkdirup=gdet->toGlobal(localMomentum);
533 
534  //mono side
535  const GeomDetUnit * monodet=gdet->monoDet();
536  statedirection=monodet->toLocal(gtrkdirup);
537  SiStripRecHit2D m = matchedhit->monoHit();
538  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,es);
539 
540  //stereo side
541  const GeomDetUnit * stereodet=gdet->stereoDet();
542  statedirection=stereodet->toLocal(gtrkdirup);
543  SiStripRecHit2D s = matchedhit->stereoHit();
544  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,es);
545  }
546  else if(projhit){ // type=Projected;
547  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found"<< std::endl;
548 
549  GluedGeomDet * gdet=(GluedGeomDet *)tkgeom_->idToDet(projhit->geographicalId());
550 
551  GlobalVector gtrkdirup=gdet->toGlobal(localMomentum);
552  const SiStripRecHit2D originalhit=projhit->originalHit();
553 
554  const GeomDetUnit * det;
555  if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
556  //mono side
557  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found MONO"<< std::endl;
558  det=gdet->monoDet();
559  statedirection=det->toLocal(gtrkdirup);
560  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
561  }
562  else{
563  LogTrace("SiStripMonitorTrack")<<"\nProjected recHit found STEREO"<< std::endl;
564  //stereo side
565  det=gdet->stereoDet();
566  statedirection=det->toLocal(gtrkdirup);
567  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
568  }
569  } else if (hit2D){ // type=2D
570  statedirection=localMomentum;
571  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,es);
572  } else if (hit1D) { // type=1D
573  statedirection=localMomentum;
574  if(statedirection.mag() != 0) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,es);
575  } else {
576  LogDebug ("SiStripMonitorTrack")
577  << " LocalMomentum: "<<statedirection
578  << "\nLocal x-z plane angle: "<<atan2(statedirection.x(),statedirection.z());
579  }
580 
581 }
582 
584 
585 using namespace std;
586 using namespace edm;
587 using namespace reco;
588 
589  // trajectory input
590  edm::Handle<TrajTrackAssociationCollection> TItkAssociatorCollection;
591  ev.getByToken(trackTrajToken_, TItkAssociatorCollection);
592  if( TItkAssociatorCollection.isValid()){
593  trackStudyFromTrajectory(TItkAssociatorCollection,es);
594  } else {
595  edm::LogError("SiStripMonitorTrack")<<"Association not found ... try w/ track collection"<<std::endl;
596 
597  // edm::Handle<std::vector<Trajectory> > trajectories;
598  // ev.getByToken(trajectoryToken_, trajectories);
599  // std::cout << "trajectories isValid ? " << ( trajectories->isValid() ? "YES" : "NOPE" )<< std::endl;
600  // std::cout << "trajectories: " << trajectories->size() << std::endl;
601 
602  // track input
603  edm::Handle<reco::TrackCollection > trackCollectionHandle;
604  ev.getByToken(trackToken_, trackCollectionHandle);//takes the track collection
605  if (!trackCollectionHandle.isValid()){
606  edm::LogError("SiStripMonitorTrack")<<"also Track Collection is not valid !! " << TrackLabel_<<std::endl;
607  return;
608  } else {
609  trackStudyFromTrack(trackCollectionHandle,es);
610  }
611  }
612 
613 }
614 
616 
617  // edm::ESHandle<TransientTrackBuilder> builder;
618  // es.get<TransientTrackRecord>().get("TransientTrackBuilder",builder);
619  // const TransientTrackBuilder* transientTrackBuilder = builder.product();
620 
621  reco::TrackCollection trackCollection = *trackCollectionHandle;
622  for (reco::TrackCollection::const_iterator track = trackCollection.begin(), etrack = trackCollection.end();
623  track!=etrack; ++track) {
624 
625  // const reco::TransientTrack transientTrack = transientTrackBuilder->build(track);
626 
627 
628  for (trackingRecHit_iterator hit = track->recHitsBegin(), ehit = track->recHitsEnd();
629  hit!=ehit; ++hit) {
630  if (!(*hit)->isValid()) continue;
631  DetId detID = (*hit)->geographicalId();
632  if (detID.det() != DetId::Tracker) continue;
633  const TrackingRecHit* theHit = (*hit);
634  const ProjectedSiStripRecHit2D* projhit = dynamic_cast<const ProjectedSiStripRecHit2D*>( (theHit) );
635  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*> ( (theHit) );
636  const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*> ( (theHit) );
637  const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*> ( (theHit) );
638 
639  // GlobalPoint globalPoint = hit->globalPosition();
640  // std::cout << "globalPosition: " << globalPosition << std::endl;
641  // reco::TrajectoryStateOnSurface stateOnSurface = transientTrack->stateOnSurface(globalPoint);
642 
643  LocalVector localMomentum;
644  hitStudy(es,projhit,matchedhit,hit2D,hit1D,localMomentum);
645  }
646 
647 
648 
649  // hit pattern of the track
650  const reco::HitPattern & hitsPattern = track->hitPattern();
651  // loop over the hits of the track
652  // for (int i=0; i<hitsPattern.numberOfHits(); i++) {
653  for (int i=0; i<hitsPattern.numberOfHits(reco::HitPattern::TRACK_HITS); i++) {
654  uint32_t hit = hitsPattern.getHitPattern(reco::HitPattern::TRACK_HITS,i);
655 
656  // if the hit is valid and in pixel barrel, print out the layer
657  if (hitsPattern.validHitFilter(hit) && hitsPattern.pixelBarrelHitFilter(hit))
658  // std::cout << "valid hit found in pixel barrel layer "
659  // << hitsPattern.getLayer(hit) << std::endl;
660 
661  if (!hitsPattern.validHitFilter(hit)) continue;
662 // if (hitsPattern.pixelHitFilter(hit)) std::cout << "pixel" << std::endl; // pixel
663 // if (hitsPattern.pixelBarrelHitFilter(hit)) std::cout << "pixel barrel" << std::endl; // pixel barrel
664 // if (hitsPattern.pixelEndcapHitFilter(hit)) std::cout << "pixel endcap" << std::endl; // pixel endcap
665 // if (hitsPattern.stripHitFilter(hit)) std::cout << "strip" << std::endl; // strip
666 // if (hitsPattern.stripTIBHitFilter(hit)) std::cout << "TIB" << std::endl; // strip TIB
667 // if (hitsPattern.stripTIDHitFilter(hit)) std::cout << "TID" << std::endl; // strip TID
668 // if (hitsPattern.stripTOBHitFilter(hit)) std::cout << "TOB" << std::endl; // strip TOB
669 // if (hitsPattern.stripTECHitFilter(hit)) std::cout << "TEC" << std::endl; // strip TEC
670 // if (hitsPattern.muonDTHitFilter(hit)) std::cout << "DT" << std::endl; // muon DT
671 // if (hitsPattern.muonCSCHitFilter(hit)) std::cout << "CSC" << std::endl; // muon CSC
672 // if (hitsPattern.muonRPCHitFilter(hit)) std::cout << "RPC" << std::endl; // muon RPC
673 //
674 // // expert level: printout the hit in 10-bit binary format
675 // std::cout << "hit in 10-bit binary format = ";
676 // for (int j=9; j>=0; j--) {
677 // int bit = (hit >> j) & 0x1;
678 // std::cout << bit;
679 // }
680 // std::cout << std::endl;
681  }
682  }
683 }
684 
686  //Perform track study
687  int i=0;
688  for(TrajTrackAssociationCollection::const_iterator it = TItkAssociatorCollection->begin();it != TItkAssociatorCollection->end(); ++it){
689  const edm::Ref<std::vector<Trajectory> > traj_iterator = it->key;
690 
691  // Trajectory Map, extract Trajectory for this track
692  reco::TrackRef trackref = it->val;
693  LogDebug("SiStripMonitorTrack")
694  << "Track number "<< i+1 << std::endl;
695  // << "\n\tmomentum: " << trackref->momentum()
696  // << "\n\tPT: " << trackref->pt()
697  // << "\n\tvertex: " << trackref->vertex()
698  // << "\n\timpact parameter: " << trackref->d0()
699  // << "\n\tcharge: " << trackref->charge()
700  // << "\n\tnormalizedChi2: " << trackref->normalizedChi2()
701  // <<"\n\tFrom EXTRA : "
702  // <<"\n\t\touter PT "<< trackref->outerPt()<<std::endl;
703  i++;
704 
705  // trajectoryStudy(traj_iterator,trackref,es);
706  trajectoryStudy(traj_iterator,es);
707 
708  }
709 }
710 
711 template <class T> void SiStripMonitorTrack::RecHitInfo(const T* tkrecHit, LocalVector LV, const edm::EventSetup& es){
712 
713  // std::cout << "[SiStripMonitorTrack::RecHitInfo] starting" << std::endl;
714 
715  if(!tkrecHit->isValid()){
716  LogTrace("SiStripMonitorTrack") <<"\t\t Invalid Hit " << std::endl;
717  return;
718  }
719 
720  const uint32_t& detid = tkrecHit->geographicalId().rawId();
721 
722  LogTrace("SiStripMonitorTrack")
723  <<"\n\t\tRecHit on det "<<tkrecHit->geographicalId().rawId()
724  <<"\n\t\tRecHit in LP "<<tkrecHit->localPosition()
725  <<"\n\t\tRecHit in GP "<<tkgeom_->idToDet(tkrecHit->geographicalId())->surface().toGlobal(tkrecHit->localPosition())
726  <<"\n\t\tRecHit trackLocal vector "<<LV.x() << " " << LV.y() << " " << LV.z() <<std::endl;
727 
728 
729  //Retrieve tracker topology from geometry
730  edm::ESHandle<TrackerTopology> tTopoHandle;
731  es.get<IdealGeometryRecord>().get(tTopoHandle);
732  const TrackerTopology* const tTopo = tTopoHandle.product();
733 
734  //Get SiStripCluster from SiStripRecHit
735  if ( tkrecHit != NULL ){
736  const SiStripCluster* SiStripCluster_ = &*(tkrecHit->cluster());
737  SiStripClusterInfo SiStripClusterInfo_(*SiStripCluster_,es,detid);
738 
739  // std::cout << "[SiStripMonitorTrack::RecHitInfo] SiStripClusterInfo DONE" << std::endl;
740 
741  if ( clusterInfos(&SiStripClusterInfo_,detid, tTopo, OnTrack, LV ) )
742  {
743  vPSiStripCluster.insert(SiStripCluster_);
744  }
745  }
746  else
747  {
748  edm::LogError("SiStripMonitorTrack") << "NULL hit" << std::endl;
749  }
750  }
751 
752 //------------------------------------------------------------------------
753 
755 {
756 
757  // std::cout << "[SiStripMonitorTrack::AllClusters] starting .. " << std::endl;
758  //Retrieve tracker topology from geometry
759  edm::ESHandle<TrackerTopology> tTopoHandle;
760  es.get<IdealGeometryRecord>().get(tTopoHandle);
761  const TrackerTopology* const tTopo = tTopoHandle.product();
762 
764  ev.getByToken( clusterToken_, siStripClusterHandle);
765  if (!siStripClusterHandle.isValid()){
766  edm::LogError("SiStripMonitorTrack")<< "ClusterCollection is not valid!!" << std::endl;
767  return;
768  }
769  else
770  {
771  // std::cout << "[SiStripMonitorTrack::AllClusters] OK cluster collection: " << siStripClusterHandle->size() << std::endl;
772 
773  //Loop on Dets
774  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=siStripClusterHandle->begin();
775  DSViter!=siStripClusterHandle->end();
776  DSViter++)
777  {
778  uint32_t detid=DSViter->id();
779 
780  LogDebug("SiStripMonitorTrack") << "on detid "<< detid << " N Cluster= " << DSViter->size();
781 
782  //Loop on Clusters
784  ClusIter!=DSViter->end();
785  ClusIter++)
786  {
787  if (vPSiStripCluster.find(&*ClusIter) == vPSiStripCluster.end())
788  {
789  SiStripClusterInfo SiStripClusterInfo_(*ClusIter,es,detid);
790  clusterInfos(&SiStripClusterInfo_,detid,tTopo,OffTrack,LV);
791  }
792  }
793  }
794  }
795 }
796 
797 //------------------------------------------------------------------------
799 {
800 
801  // std::cout << "[SiStripMonitorTrack::clusterInfos] input collection: " << Cluster_src_ << std::endl;
802  // std::cout << "[SiStripMonitorTrack::clusterInfos] starting flag " << flag << std::endl;
803  if (cluster==NULL) return false;
804  // if one imposes a cut on the clusters, apply it
805  if( (applyClusterQuality_) &&
806  (cluster->signalOverNoise() < sToNLowerLimit_ ||
807  cluster->signalOverNoise() > sToNUpperLimit_ ||
808  cluster->width() < widthLowerLimit_ ||
809  cluster->width() > widthUpperLimit_) ) return false;
810  // std::cout << "[SiStripMonitorTrack::clusterInfos] pass clusterQuality detID: " << detid;
811  // start of the analysis
812 
813  std::pair<std::string,std::string> sdet_pair = folderOrganizer_.getSubDetFolderAndTag(detid,tTopo);
814  // std::cout << " --> " << sdet_pair.second << " " << sdet_pair.first << std::endl;
815  // std::cout << "[SiStripMonitorTrack::clusterInfos] SubDetMEsMap: " << SubDetMEsMap.size() << std::endl;
816  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(sdet_pair.second);
817  // std::cout << "[SiStripMonitorTrack::clusterInfos] iSubdet: " << iSubdet->first << std::endl;
818  if(iSubdet != SubDetMEsMap.end()){
819  // std::cout << "[SiStripMonitorTrack::clusterInfos] adding cluster" << std::endl;
820  if (flag == OnTrack) iSubdet->second.totNClustersOnTrack++;
821  else if (flag == OffTrack) iSubdet->second.totNClustersOffTrack++;
822  }
823 
824  // std::cout << "[SiStripMonitorTrack::clusterInfos] iSubdet->second.totNClustersOnTrack: " << iSubdet->second.totNClustersOnTrack << std::endl;
825  // std::cout << "[SiStripMonitorTrack::clusterInfos] iSubdet->second.totNClustersOffTrack: " << iSubdet->second.totNClustersOffTrack << std::endl;
826 
827  float cosRZ = -2;
828  LogDebug("SiStripMonitorTrack")<< "\n\tLV " << LV.x() << " " << LV.y() << " " << LV.z() << " " << LV.mag() << std::endl;
829  if (LV.mag()!=0){
830  cosRZ= fabs(LV.z())/LV.mag();
831  LogDebug("SiStripMonitorTrack")<< "\n\t cosRZ " << cosRZ << std::endl;
832  }
834 
835  // Filling SubDet/Layer Plots (on Track + off Track)
836  fillMEs(cluster,detid,tTopo,cosRZ,flag);
837 
838 
839  //******** TkHistoMaps
840  if (TkHistoMap_On_) {
841  uint32_t adet=cluster->detId();
842  float noise = cluster->noiseRescaledByGain();
843  if(flag==OnTrack){
844  tkhisto_NumOnTrack->add(adet,1.);
845  if(noise > 0.0) tkhisto_StoNCorrOnTrack->fill(adet,cluster->signalOverNoise()*cosRZ);
846  if(noise == 0.0)
847  LogDebug("SiStripMonitorTrack") << "Module " << detid << " in Event " << eventNb << " noise " << noise << std::endl;
848  }
849  else if(flag==OffTrack){
850  tkhisto_NumOffTrack->add(adet,1.);
851  if(cluster->charge() > 250){
852  LogDebug("SiStripMonitorTrack") << "Module firing " << detid << " in Event " << eventNb << std::endl;
853  }
854  }
855  }
856 
857  // Module plots filled only for onTrack Clusters
858  if(Mod_On_){
859  if(flag==OnTrack){
860  SiStripHistoId hidmanager2;
861  name =hidmanager2.createHistoId("","det",detid);
862  fillModMEs(cluster,name,cosRZ);
863  }
864  }
865  return true;
866 }
867 
868 //--------------------------------------------------------------------------------
870 {
871  std::map<std::string, ModMEs>::iterator iModME = ModMEsMap.find(name);
872  if(iModME!=ModMEsMap.end()){
873 
874  float StoN = cluster->signalOverNoise();
875  uint16_t charge = cluster->charge();
876  uint16_t width = cluster->width();
877  float position = cluster->baryStrip();
878 
879  float noise = cluster->noiseRescaledByGain();
880  if(noise > 0.0) fillME(iModME->second.ClusterStoNCorr ,StoN*cos);
881  if(noise == 0.0) LogDebug("SiStripMonitorTrack") << "Module " << name << " in Event " << eventNb << " noise " << noise << std::endl;
882  fillME(iModME->second.ClusterCharge,charge);
883 
884  fillME(iModME->second.ClusterChargeCorr,charge*cos);
885 
886  fillME(iModME->second.ClusterWidth ,width);
887  fillME(iModME->second.ClusterPos ,position);
888 
889  //fill the PGV histo
890  float PGVmax = cluster->maxCharge();
891  int PGVposCounter = cluster->maxIndex();
892  for (int i= int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmin"));i<PGVposCounter;++i)
893  fillME(iModME->second.ClusterPGV, i,0.);
894  for (auto it=cluster->stripCharges().begin();it<cluster->stripCharges().end();++it) {
895  fillME(iModME->second.ClusterPGV, PGVposCounter++,(*it)/PGVmax);
896  }
897  for (int i= PGVposCounter;i<int(conf_.getParameter<edm::ParameterSet>("TProfileClusterPGV").getParameter<double>("xmax"));++i)
898  fillME(iModME->second.ClusterPGV, i,0.);
899  //end fill the PGV histo
900  }
901 }
902 
903 //------------------------------------------------------------------------
905 {
906  std::pair<std::string,int32_t> SubDetAndLayer = folderOrganizer_.GetSubDetAndLayer(detid,tTopo,flag_ring);
907  SiStripHistoId hidmanager1;
908  std::string layer_id = hidmanager1.getSubdetid(detid,tTopo,flag_ring);
909 
910  std::pair<std::string,std::string> sdet_pair = folderOrganizer_.getSubDetFolderAndTag(detid,tTopo);
911  float StoN = cluster->signalOverNoise();
912  float noise = cluster->noiseRescaledByGain();
913  uint16_t charge = cluster->charge();
914  uint16_t width = cluster->width();
915  float position = cluster->baryStrip();
916 
917  std::map<std::string, LayerMEs>::iterator iLayer = LayerMEsMap.find(layer_id);
918  if (iLayer != LayerMEsMap.end()) {
919  if(flag==OnTrack){
920  // std::cout << "[SiStripMonitorTrack::fillMEs] filling OnTrack" << std::endl;
921  if(noise > 0.0) fillME(iLayer->second.ClusterStoNCorrOnTrack, StoN*cos);
922  if(noise == 0.0) LogDebug("SiStripMonitorTrack") << "Module " << detid << " in Event " << eventNb << " noise " << cluster->noiseRescaledByGain() << std::endl;
923  fillME(iLayer->second.ClusterChargeCorrOnTrack, charge*cos);
924  fillME(iLayer->second.ClusterChargeOnTrack, charge);
925  fillME(iLayer->second.ClusterNoiseOnTrack, noise);
926  fillME(iLayer->second.ClusterWidthOnTrack, width);
927  fillME(iLayer->second.ClusterPosOnTrack, position);
928  } else {
929  // std::cout << "[SiStripMonitorTrack::fillMEs] filling OffTrack" << std::endl;
930  fillME(iLayer->second.ClusterChargeOffTrack, charge);
931  fillME(iLayer->second.ClusterNoiseOffTrack, noise);
932  fillME(iLayer->second.ClusterWidthOffTrack, width);
933  fillME(iLayer->second.ClusterPosOffTrack, position);
934  }
935  }
936  std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(sdet_pair.second);
937  if(iSubdet != SubDetMEsMap.end() ){
938  if(flag==OnTrack){
939  fillME(iSubdet->second.ClusterChargeOnTrack,charge);
940  if(noise > 0.0) fillME(iSubdet->second.ClusterStoNCorrOnTrack,StoN*cos);
941  } else {
942  fillME(iSubdet->second.ClusterChargeOffTrack,charge);
943  if(noise > 0.0) fillME(iSubdet->second.ClusterStoNOffTrack,StoN);
944  }
945  }
946 }
947 //
948 // -- Get Subdetector Tag from the Folder name
949 //
950 /* mia: what am I supposed to do w/ thi function ? */
952 
953  tag = folder_name.substr(folder_name.find("MechanicalView")+15);
954  if (tag.find("side_") != std::string::npos) {
955  tag.replace(tag.find_last_of("/"),1,"_");
956  }
957 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
MonitorElement * bookMETrend(DQMStore::IBooker &, const char *, const char *)
uint8_t maxCharge() const
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
TkHistoMap * tkhisto_NumOffTrack
SiStripMonitorTrack(const edm::ParameterSet &)
void setSiStripFolderName(std::string name)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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_
void trackStudyFromTrajectory(edm::Handle< TrajTrackAssociationCollection > TItkAssociatorCollection, const edm::EventSetup &es)
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
void fillME(MonitorElement *ME, float value1)
SiStripDCSStatus * dcsStatus_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
void hitStudy(const edm::EventSetup &es, const ProjectedSiStripRecHit2D *projhit, const SiStripMatchedRecHit2D *matchedhit, const SiStripRecHit2D *hit2D, const SiStripRecHit1D *hit1D, LocalVector localMomentum)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
float noiseRescaledByGain() const
void book(DQMStore::IBooker &, const TrackerTopology *tTopo)
void AllClusters(const edm::Event &ev, const edm::EventSetup &es)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
float baryStrip() const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
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:67
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 bookLayerMEs(DQMStore::IBooker &, const uint32_t &, std::string &)
bool ev
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
key_type key() const
Accessor for product key.
Definition: Ref.h:266
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
uint16_t maxIndex() const
void trajectoryStudy(const edm::Ref< std::vector< Trajectory > > traj, const edm::EventSetup &es)
static bool pixelBarrelHitFilter(uint16_t pattern)
Definition: HitPattern.h:516
auto stripCharges() const -> decltype(cluster() ->amplitudes())
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:698
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
LocalVector localMomentum() const
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
void fillMEs(SiStripClusterInfo *, uint32_t detid, const TrackerTopology *tTopo, float, enum ClusterFlags)
T mag() const
Definition: PV3DBase.h:67
vector< ParameterSet > Parameters
edm::EventNumber_t eventNb
uint16_t hitPattern[ARRAY_LENGTH]
Definition: HitPattern.h:418
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
uint16_t charge() const
std::unordered_set< const SiStripCluster * > vPSiStripCluster
std::map< std::string, SubDetMEs > SubDetMEsMap
void fillModMEs(SiStripClusterInfo *, std::string, float)
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.
const std::string subdet_tag("SubDet")
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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:286
TH1 * getTH1(void) const
void bookSubDetMEs(DQMStore::IBooker &, std::string &name)
MonitorElement * bookME3D(DQMStore::IBooker &, const char *, const char *)
int orbitNumber() const
Definition: EventBase.h:63
SiStripFolderOrganizer folderOrganizer_
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
bool isValid() const
Definition: HandleBase.h:76
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
#define LogTrace(id)
tuple conf
Definition: dbtoconf.py:185
SiStripRecHit2D originalHit() const
void getSubDetTag(std::string &folder_name, std::string &tag)
Definition: DetId.h:18
edm::EDGetTokenT< TrajTrackAssociationCollection > trackTrajToken_
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:274
SiStripRecHit2D stereoHit() const
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
void bookModMEs(DQMStore::IBooker &, const uint32_t &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &es)
std::map< std::string, ModMEs > ModMEsMap
std::pair< std::string, std::string > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
std::string HistoName
TkHistoMap * tkhisto_NumOnTrack
SiStripRecHit2D monoHit() const
bool clusterInfos(SiStripClusterInfo *cluster, const uint32_t &detid, const TrackerTopology *tTopo, enum ClusterFlags flags, LocalVector LV)
uint32_t detId() const
GenericTriggerEventFlag * genTriggerEventFlag_
void RecHitInfo(const T *tkrecHit, LocalVector LV, const edm::EventSetup &)
edm::EventID id() const
Definition: EventBase.h:56
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2562
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * bookMEProfile(DQMStore::IBooker &, const char *, const char *)
TkHistoMap * tkhisto_StoNCorrOnTrack
DetId geographicalId() const
virtual void endJob(void)
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:456
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 add(uint32_t &detid, float value)
Definition: TkHistoMap.cc:213
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:41
int numberOfHits(HitCategory category) const
Definition: HitPattern.h:718
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterToken_
std::map< std::string, LayerMEs > LayerMEsMap