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