CMS 3D CMS Logo

CTPPSDiamondDQMSource.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of CTPPS offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 * Nicola Minafra
7 * Laurent Forthomme
8 *
9 ****************************************************************************/
10 
17 
21 
27 
30 
33 
34 #include <string>
35 
36 //----------------------------------------------------------------------------------------------------
37 
39 {
40  public:
42  virtual ~CTPPSDiamondDQMSource();
43 
44  protected:
45  void dqmBeginRun( const edm::Run&, const edm::EventSetup& ) override;
46  void bookHistograms( DQMStore::IBooker&, const edm::Run&, const edm::EventSetup& ) override;
47  void analyze( const edm::Event&, const edm::EventSetup& );
50  void endRun( const edm::Run&, const edm::EventSetup& );
51 
52  private:
53  // Constants
54  static const double SEC_PER_LUMI_SECTION; // Number of seconds per lumisection: used to compute hit rates in Hz
55  static const int CHANNEL_OF_VFAT_CLOCK; // Channel ID of the VFAT that contains clock data
56  static const double DISPLAY_RESOLUTION_FOR_HITS_MM; // Bin width of histograms showing hits and tracks (in mm)
58  static const double HPTDC_BIN_WIDTH_NS; // ns per HPTDC bin
59  static const int CTPPS_NUM_OF_ARMS;
60  static const int CTPPS_DIAMOND_STATION_ID;
61  static const int CTPPS_DIAMOND_RP_ID;
62  static const int CTPPS_NEAR_RP_ID;
63  static const int CTPPS_FAR_RP_ID;
64  static const int CTPPS_DIAMOND_NUM_OF_PLANES;
66  static const int CTPPS_FED_ID_45;
67  static const int CTPPS_FED_ID_56;
68 
75 
79  std::vector< std::pair<edm::EventRange, int> > runParameters_;
81  unsigned int verbosity_;
82 
84  struct GlobalPlots
85  {
87 
89  GlobalPlots( DQMStore::IBooker& ibooker );
90  };
91 
93 
95  struct PotPlots
96  {
97  MonitorElement* activity_per_bx = NULL;
98  MonitorElement* activity_per_bx_plus1 = NULL;
99  MonitorElement* activity_per_bx_minus1 = NULL;
100 
101  MonitorElement* hitDistribution2d = NULL;
102  MonitorElement* hitDistribution2dOOT = NULL;
103  MonitorElement* hitDistribution2dOOT_le = NULL;
104  MonitorElement* hitDistribution2dOOT_te = NULL;
105  MonitorElement* activePlanes = NULL;
106 
107  MonitorElement* trackDistribution = NULL;
108  MonitorElement* trackDistributionOOT = NULL;
109 
110  MonitorElement* stripTomographyAllFar = NULL;
111  MonitorElement* stripTomographyAllFar_plus1 = NULL;
112  MonitorElement* stripTomographyAllFar_minus1 = NULL;
113 
114  MonitorElement* leadingEdgeCumulative_both = NULL, *leadingEdgeCumulative_le = NULL;
115  MonitorElement* timeOverThresholdCumulativePot = NULL, *leadingTrailingCorrelationPot = NULL;
116  MonitorElement* leadingWithoutTrailingCumulativePot = NULL;
117 
118  MonitorElement* ECCheck = NULL;
119 
120  MonitorElement* HPTDCErrorFlags_cumulative = NULL;
121 
122  MonitorElement* clock_Digi1_le = NULL;
123  MonitorElement* clock_Digi1_te = NULL;
124  MonitorElement* clock_Digi3_le = NULL;
125  MonitorElement* clock_Digi3_te = NULL;
126 
127  PotPlots() {};
128  PotPlots( DQMStore::IBooker& ibooker, unsigned int id );
129  };
130 
131  std::unordered_map<unsigned int, PotPlots> potPlots_;
133 
135  struct PlanePlots
136  {
137  MonitorElement* digiProfileCumulativePerPlane = NULL;
138  MonitorElement* hitProfile = NULL;
139  MonitorElement* hit_multiplicity = NULL;
140 
141  MonitorElement* stripTomography_far = NULL;
142 
144  PlanePlots( DQMStore::IBooker& ibooker, unsigned int id );
145  };
146 
147  std::unordered_map<unsigned int, PlanePlots> planePlots_;
148 
151  {
152  MonitorElement* activity_per_bx = NULL;
153  MonitorElement* activity_per_bx_plus1 = NULL;
154  MonitorElement* activity_per_bx_minus1 = NULL;
155 
157  MonitorElement* leadingEdgeCumulative_both = NULL, *leadingEdgeCumulative_le = NULL;
158  MonitorElement* TimeOverThresholdCumulativePerChannel = NULL;
159  MonitorElement* LeadingTrailingCorrelationPerChannel = NULL;
160  MonitorElement* leadingWithoutTrailing = NULL;
161  MonitorElement* stripTomography_far = NULL;
162  MonitorElement* hit_rate = NULL;
163  MonitorElement* ECCheckPerChannel = NULL;
165 
166  ChannelPlots() : hitsCounterPerLumisection( 0 ) {}
167  ChannelPlots( DQMStore::IBooker &ibooker, unsigned int id );
168  };
169 
170  std::unordered_map<unsigned int, ChannelPlots> channelPlots_;
171 };
172 
173 //----------------------------------------------------------------------------------------------------
174 
175 // Values for all constants
180 const double CTPPSDiamondDQMSource::HPTDC_BIN_WIDTH_NS = 25./1024;
190 
191 //----------------------------------------------------------------------------------------------------
192 
194 {
195  ibooker.setCurrentFolder( "CTPPS" );
196 
197  h_trackCorr_hor = ibooker.book2D( "track correlation all hor", "rp, all, hor", 6, -0.5, 5.5, 6, -0.5, 5.5 );
198  TH2F* hist = h_trackCorr_hor->getTH2F();
199  TAxis* xa = hist->GetXaxis(), *ya = hist->GetYaxis();
200  xa->SetBinLabel( 6, "45, 210, near" ); ya->SetBinLabel( 1, "45, 210, near" );
201  xa->SetBinLabel( 5, "45, 210, far" ); ya->SetBinLabel( 2, "45, 210, far" );
202  xa->SetBinLabel( 4, "45, 220, cyl" ); ya->SetBinLabel( 3, "45, 220, cyl" );
203  xa->SetBinLabel( 3, "56, 210, near" ); ya->SetBinLabel( 4, "56, 210, near" );
204  xa->SetBinLabel( 2, "56, 210, far" ); ya->SetBinLabel( 5, "56, 210, far" );
205  xa->SetBinLabel( 1, "56, 220, cyl" ); ya->SetBinLabel( 6, "56, 220, cyl" );
206 }
207 
208 //----------------------------------------------------------------------------------------------------
209 
210 
212 {
215  ibooker.setCurrentFolder( path );
216 
218 
219  activity_per_bx = ibooker.book1D( "activity per BX", title+" activity per BX;Event.BX", 4002, -1.5, 4000. + 0.5 );
220  activity_per_bx_plus1 = ibooker.book1D( "activity per BX OOT +1", title+" activity per BX OOT +1;Event.BX", 4002, -1.5, 4000. + 0.5 );
221  activity_per_bx_minus1 = ibooker.book1D( "activity per BX OOT -1", title+" activity per BX OOT -1;Event.BX", 4002, -1.5, 4000. + 0.5 );
222 
223  hitDistribution2d = ibooker.book2D( "hits in planes", title+" hits in planes;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
224  hitDistribution2dOOT= ibooker.book2D( "hits with OOT in planes", title+" hits with OOT in planes;plane number + 0.1 OOT;x (mm)", 41, -0.1, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
225  hitDistribution2dOOT_le= ibooker.book2D( "hits with OOT in planes (le only)", title+" hits with OOT in planes (le only);plane number + 0.1 OOT;x (mm)", 41, -0.1, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
226  hitDistribution2dOOT_te= ibooker.book2D( "hits with OOT in planes (te only)", title+" hits with OOT in planes (te only);plane number + 0.1 OOT;x (mm)", 41, -0.1, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
227  activePlanes = ibooker.book1D( "active planes", title+" active planes;number of active planes", 6, -0.5, 5.5 );
228 
229  trackDistribution = ibooker.book1D( "tracks", title+" tracks;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
230  trackDistributionOOT = ibooker.book2D( "tracks with OOT", title+" tracks with OOT;plane number;x (mm)", 9, -0.5, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
231 
232  stripTomographyAllFar = ibooker.book2D( "tomography all far", title+" tomography with strips far (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 24, -2, 10 );
233  stripTomographyAllFar_plus1 = ibooker.book2D( "tomography all far OOT +1", title+" tomography with strips far (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 24, -2, 10 );
234  stripTomographyAllFar_minus1 = ibooker.book2D( "tomography all far OOT -1", title+" tomography with strips far (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 24, -2, 10 );
235 
236  leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (le and te); leading edge (ns)", 125, 0, 125 );
237  leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (le only); leading edge (ns)", 125, 0, 125 );
238  timeOverThresholdCumulativePot = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 100, -100, 100 );
239  leadingTrailingCorrelationPot = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 100, 0, 100, 100, 0, 100 );
240 
241  leadingWithoutTrailingCumulativePot = ibooker.book1D( "leading edges without trailing", title+" leading edges without trailing;leading edges without trailing", 4, 0.5, 4.5 );
242  leadingWithoutTrailingCumulativePot->getTH1F()->GetXaxis()->SetBinLabel( 1, "Nothing" );
243  leadingWithoutTrailingCumulativePot->getTH1F()->GetXaxis()->SetBinLabel( 2, "Leading only" );
244  leadingWithoutTrailingCumulativePot->getTH1F()->GetXaxis()->SetBinLabel( 3, "Trailing only" );
245  leadingWithoutTrailingCumulativePot->getTH1F()->GetXaxis()->SetBinLabel( 4, "Both" );
246 
247  ECCheck = ibooker.book1D( "optorxEC(8bit) - vfatEC", title+" EC Error;optorxEC-vfatEC", 512, -256, 256 );
248 
249  HPTDCErrorFlags_cumulative = ibooker.book1D( "HPTDC Errors", title+" HPTDC Errors", 16, -0.5, 16.5 );
250  for ( unsigned short error_index=1; error_index<16; ++error_index )
251  HPTDCErrorFlags_cumulative->getTH1F()->GetXaxis()->SetBinLabel( error_index, HPTDCErrorFlags::getHPTDCErrorName( error_index-1 ).c_str() );
252  HPTDCErrorFlags_cumulative->getTH1F()->GetXaxis()->SetBinLabel( 16, "MH" );
253 
254 
255  ibooker.setCurrentFolder( path+"/clock/" );
256  clock_Digi1_le = ibooker.book1D( "clock1 leading edge", title+" clock1;leading edge (ns)", 125, 0, 125 );
257  clock_Digi1_te = ibooker.book1D( "clock1 trailing edge", title+" clock1;trailing edge (ns)", 125, 0, 125 );
258  clock_Digi3_le = ibooker.book1D( "clock3 leading edge", title+" clock3;leading edge (ns)", 1000, 0, 125 );
259  clock_Digi3_te = ibooker.book1D( "clock3 trailing edge", title+" clock3;trailing edge (ns)", 125, 0, 125 );
260 }
261 
262 //----------------------------------------------------------------------------------------------------
263 
265 {
268  ibooker.setCurrentFolder( path );
269 
271 
272  digiProfileCumulativePerPlane = ibooker.book1D( "digi profile", title+" digi profile; ch number", 12, -0.5, 11.5 );
273  hitProfile = ibooker.book1D( "hit profile", title+" hit profile;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 );
274  hit_multiplicity = ibooker.book1D( "channels per plane", title+" channels per plane; ch per plane", 13, -0.5, 12.5 );
275 
276  stripTomography_far = ibooker.book2D( "tomography far", title+" tomography with strips far;x + 25 OOT (mm);y (mm)", 150, -50, 100, 24, -2, 10 );
277 }
278 
279 //----------------------------------------------------------------------------------------------------
280 
281 CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, unsigned int id ) : hitsCounterPerLumisection(0)
282 {
285  ibooker.setCurrentFolder( path );
286 
288 
289  leadingWithoutTrailing = ibooker.book1D( "Leading Edges Without Trailing", title+" leading edges without trailing", 4, 0.5, 4.5 );
290  leadingWithoutTrailing->getTH1F()->GetXaxis()->SetBinLabel( 1, "Nothing" );
291  leadingWithoutTrailing->getTH1F()->GetXaxis()->SetBinLabel( 2, "Leading only" );
292  leadingWithoutTrailing->getTH1F()->GetXaxis()->SetBinLabel( 3, "Trailer only" );
293  leadingWithoutTrailing->getTH1F()->GetXaxis()->SetBinLabel( 4, "Full" );
294 
295  activity_per_bx = ibooker.book1D( "activity per BX", title+" activity per BX;Event.BX", 4002, -1.5, 4000. + 0.5 );
296  activity_per_bx_plus1 = ibooker.book1D( "activity per BX OOT +1", title+" activity per BX OOT +1;Event.BX", 4002, -1.5, 4000. + 0.5 );
297  activity_per_bx_minus1 = ibooker.book1D( "activity per BX OOT -1", title+" activity per BX OOT -1;Event.BX", 4002, -1.5, 4000. + 0.5 );
298 
299  HPTDCErrorFlags = ibooker.book1D( "hptdc_Errors", title+" HPTDC Errors", 16, -0.5, 16.5 );
300  for ( unsigned short error_index=1; error_index<16; ++error_index )
301  HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( error_index, HPTDCErrorFlags::getHPTDCErrorName( error_index-1 ).c_str() );
302  HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( 16, "MH" );
303 
304  leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge; leading edge (ns)", 100, 0, 200 );
305  leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge; leading edge (ns)", 200, 0, 200 );
306  TimeOverThresholdCumulativePerChannel = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 100, -100, 100 );
307  LeadingTrailingCorrelationPerChannel = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 100, 0, 100, 100, 0, 100 );
308 
309  ECCheckPerChannel = ibooker.book1D("optorxEC(8bit) - vfatEC vs optorxEC", title+" EC Error;optorxEC-vfatEC", 512, -256, 256 );
310 
311  stripTomography_far = ibooker.book2D( "tomography far", "tomography with strips far;x + 25 OOT (mm);y (mm)", 150, -50, 100, 24, -2, 10 );
312 
313  hit_rate = ibooker.book1D( "hit rate", title+"hit rate;rate (Hz)", 10, 0, 100 );
314 }
315 
316 //----------------------------------------------------------------------------------------------------
317 
319  tokenStatus_ ( consumes< edm::DetSetVector<TotemVFATStatus> > ( ps.getParameter<edm::InputTag>( "tagStatus" ) ) ),
320  tokenLocalTrack_ ( consumes< edm::DetSetVector<TotemRPLocalTrack> > ( ps.getParameter<edm::InputTag>( "tagLocalTrack" ) ) ),
321  tokenDigi_ ( consumes< edm::DetSetVector<CTPPSDiamondDigi> > ( ps.getParameter<edm::InputTag>( "tagDigi" ) ) ),
322  tokenDiamondHit_ ( consumes< edm::DetSetVector<CTPPSDiamondRecHit> > ( ps.getParameter<edm::InputTag>( "tagDiamondRecHits" ) ) ),
323  tokenDiamondTrack_( consumes< edm::DetSetVector<CTPPSDiamondLocalTrack> >( ps.getParameter<edm::InputTag>( "tagDiamondLocalTracks" ) ) ),
324  tokenFEDInfo_ ( consumes< std::vector<TotemFEDInfo> > ( ps.getParameter<edm::InputTag>( "tagFEDInfo" ) ) ),
325  excludeMultipleHits_ ( ps.getParameter<bool>( "excludeMultipleHits" ) ),
326  minimumStripAngleForTomography_( ps.getParameter<double>( "minimumStripAngleForTomography" ) ),
327  maximumStripAngleForTomography_( ps.getParameter<double>( "maximumStripAngleForTomography" ) ),
328  centralOOT_( -999 ),
329  verbosity_ ( ps.getUntrackedParameter<unsigned int>( "verbosity", 0 ) ),
330  EC_difference_56_( -500 ), EC_difference_45_( -500 )
331 {
332  for ( const auto& pset : ps.getParameter< std::vector<edm::ParameterSet> >( "offsetsOOT" ) ) {
333  runParameters_.emplace_back( std::make_pair( pset.getParameter<edm::EventRange>( "validityRange" ), pset.getParameter<int>( "centralOOT" ) ) );
334  }
335 }
336 
337 //----------------------------------------------------------------------------------------------------
338 
340 {}
341 
342 //----------------------------------------------------------------------------------------------------
343 
344 void
346 {
347  centralOOT_ = -999;
348  for ( const auto& oot : runParameters_ ) {
349  if ( edm::contains( oot.first, edm::EventID( iRun.run(), 0, 1 ) ) ) {
350  centralOOT_ = oot.second; break;
351  }
352  }
353 }
354 
355 
356 //----------------------------------------------------------------------------------------------------
357 
358 void
360 {
361  ibooker.cd();
362  ibooker.setCurrentFolder( "CTPPS" );
363 
364  globalPlot_= GlobalPlots( ibooker );
365 
366  for ( unsigned short arm = 0; arm < CTPPS_NUM_OF_ARMS; ++arm ) {
368  potPlots_[rpId] = PotPlots( ibooker, rpId );
369  for ( unsigned short pl = 0; pl < CTPPS_DIAMOND_NUM_OF_PLANES; ++pl ) {
371  planePlots_[plId] = PlanePlots( ibooker, plId);
372  for ( unsigned short ch = 0; ch < CTPPS_DIAMOND_NUM_OF_CHANNELS; ++ch ) {
374  channelPlots_[chId] = ChannelPlots( ibooker, chId );
375  }
376  }
377  }
378 }
379 
380 
381 //----------------------------------------------------------------------------------------------------
382 
383 void
385 {
386  for ( auto& plot : channelPlots_ ) {
387  if ( plot.second.hitsCounterPerLumisection != 0 ) {
388  plot.second.hit_rate->Fill( (double) plot.second.hitsCounterPerLumisection / SEC_PER_LUMI_SECTION );
389  }
390  plot.second.hitsCounterPerLumisection = 0;
391  }
392 }
393 
394 //----------------------------------------------------------------------------------------------------
395 
396 void
398 {
399  // get event data
401  event.getByToken( tokenStatus_, diamondVFATStatus );
402 
404  event.getByToken( tokenLocalTrack_, stripTracks );
405 
407  event.getByToken( tokenDigi_, diamondDigis );
408 
410  event.getByToken( tokenFEDInfo_, fedInfo );
411 
413  event.getByToken( tokenDiamondHit_, diamondRecHits );
414 
416  event.getByToken( tokenDiamondTrack_, diamondLocalTracks );
417 
418  // check validity
419  bool valid = true;
420  valid &= diamondVFATStatus.isValid();
421  valid &= diamondDigis.isValid();
422  valid &= fedInfo.isValid();
423 
424  if ( !valid ) {
425  if ( verbosity_ ) {
426  edm::LogProblem("CTPPSDiamondDQMSource")
427  << "ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n"
428  << " diamondVFATStatus.isValid = " << diamondVFATStatus.isValid() << "\n"
429  << " diamondDigis.isValid = " << diamondDigis.isValid() << "\n"
430  << " fedInfo.isValid = " << fedInfo.isValid();
431  }
432 
433  return;
434  }
435 
436  //------------------------------
437  // RP Plots
438  //------------------------------
439 
440  // if (event.bunchCrossing() > 100) return;
441 
442  //------------------------------
443  // Correlation Plots
444  //------------------------------
445 
446  for ( const auto& ds1 : *stripTracks ) {
447  for ( const auto& tr1 : ds1 ) {
448  if ( ! tr1.isValid() ) continue;
449 
450  CTPPSDetId rpId1( ds1.detId() );
451  unsigned int arm1 = rpId1.arm();
452  unsigned int stNum1 = rpId1.station();
453  unsigned int rpNum1 = rpId1.rp();
454  if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) ) continue;
455  unsigned int idx1 = arm1*3 + rpNum1-2;
456 
457  for ( const auto& ds2 : *stripTracks ) {
458  for ( const auto& tr2 : ds2 ) {
459  if ( ! tr2.isValid() ) continue;
460 
461  CTPPSDetId rpId2(ds2.detId());
462  unsigned int arm2 = rpId2.arm();
463  unsigned int stNum2 = rpId2.station();
464  unsigned int rpNum2 = rpId2.rp();
465  if (stNum2 != 0 || ( rpNum2 != 2 && rpNum2 != 3 ) ) continue;
466  unsigned int idx2 = arm2*3 + rpNum2-2;
467 
468  if ( idx1 >= idx2 ) globalPlot_.h_trackCorr_hor->Fill( 5-idx1, idx2 ); // strips-strips
469  }
470  }
471  for ( const auto& ds2 : *diamondLocalTracks ) {
472  for ( const auto& tr2 : ds2 ) {
473  if ( ! tr2.isValid() ) continue;
474  if ( centralOOT_ != -999 && tr2.getOOTIndex() != centralOOT_ ) continue;
475  if ( excludeMultipleHits_ && tr2.getMultipleHits() > 0 ) continue;
476 
477  CTPPSDetId diamId2( ds2.detId() );
478  unsigned int arm2 = diamId2.arm();
479  if ( idx1 >= arm2*3+2 )
480  globalPlot_.h_trackCorr_hor->Fill( 5-idx1, arm2*3+2 ); // strips-diamonds
481  else
482  globalPlot_.h_trackCorr_hor->Fill( 5-(arm2*3+2 ),idx1 ); // strips-diamonds
483  }
484  }
485  }
486  }
487 
488  for ( const auto& ds1 : *diamondLocalTracks ) {
489  for ( const auto& tr1 : ds1 ) {
490  if ( ! tr1.isValid() ) continue;
491  if ( excludeMultipleHits_ && tr1.getMultipleHits() > 0 ) continue;
492  if ( centralOOT_ != -999 && tr1.getOOTIndex() != centralOOT_ ) continue;
493 
494  CTPPSDetId diamId1( ds1.detId() );
495  unsigned int arm1 = diamId1.arm();
496 
497  globalPlot_.h_trackCorr_hor->Fill( 5-(arm1*3+2), arm1*3+2 ); // diamonds-diamonds
498 
499  for ( const auto& ds2 : *diamondLocalTracks ) {
500  for ( const auto& tr2 : ds2 ) {
501  if ( ! tr2.isValid() ) continue;
502  if ( excludeMultipleHits_ && tr2.getMultipleHits() > 0 ) continue;
503  if ( centralOOT_ != -999 && tr2.getOOTIndex() != centralOOT_ ) continue;
504 
505  CTPPSDetId diamId2( ds2.detId() );
506  unsigned int arm2 = diamId2.arm();
507  if ( arm1 > arm2 ) globalPlot_.h_trackCorr_hor->Fill( 5-(arm1*3+2), arm2*3+2 ); // diamonds-diamonds
508  }
509  }
510  }
511  }
512 
513 
514  // Using CTPPSDiamondDigi
515  for ( const auto& digis : *diamondDigis ) {
516  const CTPPSDiamondDetId detId( digis.detId() );
517  CTPPSDiamondDetId detId_pot( digis.detId() );
518 
519  for ( const auto& digi : digis ) {
520  detId_pot.setPlane( 0 );
521  detId_pot.setChannel( 0 );
522  if ( detId.channel() == CHANNEL_OF_VFAT_CLOCK ) continue;
523  if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue;
524  //Leading without trailing investigation
525  if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 ) potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 1 );
526  else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 2 );
527  else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 3 );
528  else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) potPlots_[detId_pot].leadingWithoutTrailingCumulativePot->Fill( 4 );
529 
530  // HPTDC Errors
531  const HPTDCErrorFlags hptdcErrors = digi.getHPTDCErrorFlags();
532  for ( unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
533  if ( hptdcErrors.getErrorId( hptdcErrorIndex-1 ) ) potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( hptdcErrorIndex );
534  if ( digi.getMultipleHit() ) potPlots_[detId_pot].HPTDCErrorFlags_cumulative->Fill( 16 );
535  }
536  }
537 
538  // EC Errors
539  for ( const auto& vfat_status : *diamondVFATStatus ) {
540  const CTPPSDiamondDetId detId( vfat_status.detId() );
541  CTPPSDiamondDetId detId_pot( vfat_status.detId() );
542  detId_pot.setPlane( 0 );
543  detId_pot.setChannel( 0 );
544  for ( const auto& status : vfat_status ) {
545  if ( !status.isOK() ) continue;
546  if ( potPlots_.find(detId_pot) == potPlots_.end() ) continue;
547 
548  // Check Event Number
549  for ( const auto& optorx : *fedInfo ) {
550  if ( detId.arm() == 1 && optorx.getFEDId() == CTPPS_FED_ID_56 ) {
551  potPlots_[detId_pot].ECCheck->Fill((int)((optorx.getLV1()& 0xFF)-((unsigned int) status.getEC() & 0xFF)) & 0xFF);
552  if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-status.getEC() ) != EC_difference_56_ ) && ( static_cast<uint8_t>( ( optorx.getLV1() & 0xFF )-status.getEC() ) < 128 ) )
553  EC_difference_56_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>( status.getEC() ) & 0xFF );
554  if ( EC_difference_56_ != 1 && EC_difference_56_ != -500 && EC_difference_56_ < 128 && EC_difference_56_ > -128 )
555  if (verbosity_)
556  edm::LogProblem("CTPPSDiamondDQMSource") << "FED " << CTPPS_FED_ID_56 << ": ECError at EV: 0x"<< std::hex << optorx.getLV1()
557  << "\t\tVFAT EC: 0x"<< static_cast<unsigned int>( status.getEC() )
558  << "\twith ID: " << std::dec << detId
559  << "\tdiff: " << EC_difference_56_;
560  }
561  else if ( detId.arm() == 0 && optorx.getFEDId()== CTPPS_FED_ID_45 ) {
562  potPlots_[detId_pot].ECCheck->Fill((int)((optorx.getLV1()& 0xFF)-status.getEC()) & 0xFF);
563  if ( ( static_cast<int>( ( optorx.getLV1() & 0xFF )-status.getEC() ) != EC_difference_45_ ) && ( static_cast<uint8_t>( ( optorx.getLV1() & 0xFF )-status.getEC() ) < 128 ) )
564  EC_difference_45_ = static_cast<int>( optorx.getLV1() & 0xFF )-( static_cast<unsigned int>( status.getEC() ) & 0xFF );
565  if ( EC_difference_45_ != 1 && EC_difference_45_ != -500 && EC_difference_45_ < 128 && EC_difference_45_ > -128 )
566  if (verbosity_)
567  edm::LogProblem("CTPPSDiamondDQMSource") << "FED " << CTPPS_FED_ID_45 << ": ECError at EV: 0x"<< std::hex << optorx.getLV1()
568  << "\t\tVFAT EC: 0x"<< static_cast<unsigned int>( status.getEC() )
569  << "\twith ID: " << std::dec << detId
570  << "\tdiff: " << EC_difference_45_;
571  }
572  }
573  }
574  }
575 
576  // Using CTPPSDiamondRecHit
577  std::unordered_map<unsigned int, std::set<unsigned int> > planes;
578 
579  for ( const auto& rechits : *diamondRecHits ) {
580  CTPPSDiamondDetId detId_pot( rechits.detId() );
581  detId_pot.setPlane( 0 );
582  detId_pot.setChannel( 0 );
583  const CTPPSDiamondDetId detId( rechits.detId() );
584 
585  for ( const auto& rechit : rechits ) {
586  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
587  planes[detId_pot].insert( detId.plane() );
588 
589  if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue;
590 
591  float UFSDShift = 0.0;
592  if ( rechit.getYWidth() < 3 ) UFSDShift = 0.5; // Display trick for UFSD that have 2 pixels with same X
593 
594  if ( rechit.getToT() != 0 && centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) {
595  TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F();
596  TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
597  int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
598  int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
599  for ( int i=0; i<numOfBins; ++i) {
600  hitHistoTmp->Fill( detId.plane(), hitHistoTmpYAxis->GetBinCenter(startBin+i) + UFSDShift );
601  }
602  }
603 
604  if ( rechit.getToT() != 0 ) {
605  // Both
606  potPlots_[detId_pot].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
607  potPlots_[detId_pot].timeOverThresholdCumulativePot->Fill( rechit.getToT() );
608 
609  TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT->getTH2F();
610  TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
611  int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
612  int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
613  for ( int i=0; i<numOfBins; ++i) {
614  hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) );
615  }
616  }
617  else {
618  if ( rechit.getT() == 0 ) {
619  // Only trailing
620  TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_te->getTH2F();
621  TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
622  int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
623  int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
624  for ( int i=0; i<numOfBins; ++i) {
625  hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) );
626  }
627  }
628  else {
629  // Only leading
630  potPlots_[detId_pot].leadingEdgeCumulative_le->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
631 
632  TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F();
633  TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis();
634  int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
635  int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
636  for ( int i=0; i<numOfBins; ++i) {
637  hitHistoOOTTmp->Fill( detId.plane() + 0.1 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) );
638  }
639  }
640  }
641 
642  if ( rechit.getToT() != 0 ) {
643  switch ( rechit.getOOTIndex() - ( ( centralOOT_ != -999 ) ? centralOOT_ : 0 ) ) {
644  case -1:
645  potPlots_[detId_pot].activity_per_bx_minus1->Fill( event.bunchCrossing() );
646  break;
647  case 0:
648  potPlots_[detId_pot].activity_per_bx->Fill( event.bunchCrossing() );
649  break;
650  case 1:
651  potPlots_[detId_pot].activity_per_bx_plus1->Fill( event.bunchCrossing() );
652  break;
653  }
654 
655  } // End if (complete hits)
656  }
657  }
658 
659  for ( const auto& plt : potPlots_ ) {
660  plt.second.activePlanes->Fill( planes[plt.first].size() );
661  }
662 
663  // Using CTPPSDiamondLocalTrack
664  for ( const auto& tracks : *diamondLocalTracks ) {
665  CTPPSDiamondDetId detId_pot( tracks.detId() );
666  detId_pot.setPlane( 0 );
667  detId_pot.setChannel( 0 );
668  const CTPPSDiamondDetId detId( tracks.detId() );
669 
670  for ( const auto& track : tracks ) {
671  if ( ! track.isValid() ) continue;
672  if ( excludeMultipleHits_ && track.getMultipleHits() > 0 ) continue;
673  if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue;
674 
675  TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F();
676  TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis();
677  int startBin = trackHistoOOTTmpYAxis->FindBin( track.getX0() - track.getX0Sigma() );
678  int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
679  for ( int i=0; i<numOfBins; ++i) {
680  trackHistoOOTTmp->Fill( track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+i) );
681  }
682 
683  if ( centralOOT_ != -999 && track.getOOTIndex() == centralOOT_ ) {
684  TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
685  int startBin = trackHistoInTimeTmp->FindBin( track.getX0() - track.getX0Sigma() );
686  int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
687  for ( int i=0; i<numOfBins; ++i) {
688  trackHistoInTimeTmp->Fill( trackHistoInTimeTmp->GetBinCenter(startBin+i) );
689  }
690  }
691  }
692  }
693 
694  // Tomography of diamonds using strips
695  for ( const auto& rechits : *diamondRecHits ) {
696  CTPPSDiamondDetId detId_pot( rechits.detId() );
697  detId_pot.setPlane( 0 );
698  detId_pot.setChannel( 0 );
699  const CTPPSDiamondDetId detId( rechits.detId() );
700 
701  for ( const auto& rechit : rechits ) {
702  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
703  if ( rechit.getToT() == 0 ) continue;
704  if ( !stripTracks.isValid() ) continue;
705  if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue;
706 
707  for ( const auto& ds : *stripTracks ) {
708  const CTPPSDetId stripId( ds.detId() );
709  for ( const auto& striplt : ds ) {
710  if ( !striplt.isValid() ) continue;
711  if ( stripId.arm() != detId_pot.arm() ) continue;
712  if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue;
713  if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue;
714  if ( stripId.rp() == CTPPS_FAR_RP_ID ) {
715  switch ( rechit.getOOTIndex() - ( ( centralOOT_ != -999 ) ? centralOOT_ : 0 ) ) {
716  case -1: {
717  potPlots_[detId_pot].stripTomographyAllFar_minus1->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
718  } break;
719  case 0: {
720  potPlots_[detId_pot].stripTomographyAllFar->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
721  } break;
722  case 1: {
723  potPlots_[detId_pot].stripTomographyAllFar_plus1->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() );
724  } break;
725  }
726  }
727  }
728  }
729  }
730  }
731 
732  //------------------------------
733  // Clock Plots
734  //------------------------------
735 
736  for ( const auto& digis : *diamondDigis ) {
737  const CTPPSDiamondDetId detId( digis.detId() );
738  CTPPSDiamondDetId detId_pot( digis.detId() );
739  if ( detId.channel() == CHANNEL_OF_VFAT_CLOCK ) {
740  detId_pot.setPlane( 0 );
741  detId_pot.setChannel( 0 );
742  for ( const auto& digi : digis ) {
743  if ( digi.getLeadingEdge() != 0 ) {
744  if ( detId.plane() == 1 ) {
745  potPlots_[detId_pot].clock_Digi1_le->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
746  potPlots_[detId_pot].clock_Digi1_te->Fill( HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
747  }
748  if ( detId.plane() == 3 ) {
749  potPlots_[detId_pot].clock_Digi3_le->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() );
750  potPlots_[detId_pot].clock_Digi3_te->Fill( HPTDC_BIN_WIDTH_NS * digi.getTrailingEdge() );
751  }
752  }
753  }
754  }
755  }
756 
757  //------------------------------
758  // Plane Plots
759  //------------------------------
760 
761  // Using CTPPSDiamondDigi
762  std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
763  for ( const auto& digis : *diamondDigis ) {
764  const CTPPSDiamondDetId detId( digis.detId() );
765  CTPPSDiamondDetId detId_plane( digis.detId() );
766  for ( const auto& digi : digis ) {
767  detId_plane.setChannel( 0 );
768  if ( detId.channel() == CHANNEL_OF_VFAT_CLOCK ) continue;
769  if ( planePlots_.find( detId_plane ) == planePlots_.end() ) continue;
770 
771  if ( digi.getLeadingEdge() != 0 ) {
772  planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill( detId.channel() );
773  if ( channelsPerPlane.find(detId_plane) != channelsPerPlane.end() ) channelsPerPlane[detId_plane]++;
774  else channelsPerPlane[detId_plane] = 0;
775  }
776  }
777  }
778 
779  for ( const auto& plt : channelsPerPlane ) {
780  planePlots_[plt.first].hit_multiplicity->Fill( plt.second );
781  }
782 
783  // Using CTPPSDiamondRecHit
784  for ( const auto& rechits : *diamondRecHits ) {
785  CTPPSDiamondDetId detId_plane( rechits.detId() );
786  detId_plane.setChannel( 0 );
787  for ( const auto& rechit : rechits ) {
788  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
789  if ( rechit.getToT() == 0 ) continue;
790  if ( planePlots_.find( detId_plane ) != planePlots_.end() ) {
791  if ( centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) {
792  TH1F *hitHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F();
793  int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() );
794  int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
795  for ( int i=0; i<numOfBins; ++i) {
796  hitHistoTmp->Fill( hitHistoTmp->GetBinCenter(startBin+i) );
797  }
798  }
799  }
800  }
801  }
802 
803  // Tomography of diamonds using strips
804  for ( const auto& rechits : *diamondRecHits ) {
805  CTPPSDiamondDetId detId_plane( rechits.detId() );
806  detId_plane.setChannel( 0 );
807  for ( const auto& rechit : rechits ) {
808  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
809  if ( rechit.getToT() == 0 ) continue;
810  if ( !stripTracks.isValid() ) continue;
811  if (planePlots_.find(detId_plane) == planePlots_.end()) continue;
812 
813  for ( const auto& ds : *stripTracks ) {
814  const CTPPSDetId stripId(ds.detId());
815  for ( const auto& striplt : ds ) {
816  if (! striplt.isValid()) continue;
817  if ( stripId.arm() != detId_plane.arm() ) continue;
818  if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue;
819  if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue;
820  if ( stripId.rp() == CTPPS_FAR_RP_ID ) {
821  planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*(rechit.getOOTIndex() - ( ( centralOOT_ != -999 ) ? centralOOT_ : 0 ) +1), striplt.getY0() );
822  }
823  }
824  }
825  }
826  }
827  //------------------------------
828  // Channel Plots
829  //------------------------------
830 
831  //Check Event Number
832  for ( const auto& vfat_status : *diamondVFATStatus ) {
833  const CTPPSDiamondDetId detId( vfat_status.detId() );
834  for ( const auto& status : vfat_status ) {
835  if ( !status.isOK() ) continue;
836  if ( channelPlots_.find(detId) != channelPlots_.end() ) {
837  for ( const auto& optorx : *fedInfo ) {
838  if ( ( detId.arm() == 1 && optorx.getFEDId() == CTPPS_FED_ID_56 ) || ( detId.arm() == 0 && optorx.getFEDId() == CTPPS_FED_ID_45 ) ) {
839  channelPlots_[detId].ECCheckPerChannel->Fill((int)((optorx.getLV1()& 0xFF)-((unsigned int) status.getEC() & 0xFF)) & 0xFF);
840  }
841  }
842  }
843  }
844  }
845 
846  // digi profile cumulative
847  for ( const auto& digis : *diamondDigis ) {
848  const CTPPSDiamondDetId detId( digis.detId() );
849  for ( const auto& digi : digis ) {
850  if ( detId.channel() == CHANNEL_OF_VFAT_CLOCK ) continue;
851  if ( channelPlots_.find( detId ) != channelPlots_.end() ) {
852  // HPTDC Errors
853  const HPTDCErrorFlags hptdcErrors = digi.getHPTDCErrorFlags();
854  for ( unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex )
855  if ( hptdcErrors.getErrorId( hptdcErrorIndex-1 ) ) channelPlots_[detId].HPTDCErrorFlags->Fill( hptdcErrorIndex );
856  if ( digi.getMultipleHit() ) channelPlots_[detId].HPTDCErrorFlags->Fill( 16 );
857 
858  // Check dropped trailing edges
859  if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 ) channelPlots_[detId].leadingWithoutTrailing->Fill( 1 );
860  else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) channelPlots_[detId].leadingWithoutTrailing->Fill( 2 );
861  else if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() != 0 ) channelPlots_[detId].leadingWithoutTrailing->Fill( 3 );
862  else if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() != 0 ) channelPlots_[detId].leadingWithoutTrailing->Fill( 4 );
863  }
864  }
865  }
866 
867  // Using CTPPSDiamondRecHit
868  for ( const auto& rechits : *diamondRecHits ) {
869  CTPPSDiamondDetId detId( rechits.detId() );
870  for ( const auto& rechit : rechits ) {
871  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
872  if ( channelPlots_.find( detId ) != channelPlots_.end() ) {
873  if ( rechit.getToT() != 0 ) {
874  channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
875  channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() );
876  }
877  else if ( rechit.getT() != 0 ) channelPlots_[detId].leadingEdgeCumulative_le->Fill( rechit.getT() + 25*rechit.getOOTIndex() );
878  channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill( rechit.getT() + 25*rechit.getOOTIndex(), rechit.getT() + 25*rechit.getOOTIndex() + rechit.getToT() );
879  ++(channelPlots_[detId].hitsCounterPerLumisection);
880  }
881 
882  if ( rechit.getToT() != 0 ) {
883  switch ( rechit.getOOTIndex() - ( ( centralOOT_ != -999 ) ? centralOOT_ : 0 ) ) {
884  case -1: {
885  channelPlots_[detId].activity_per_bx_minus1->Fill( event.bunchCrossing() );
886  } break;
887  case 0: {
888  channelPlots_[detId].activity_per_bx->Fill( event.bunchCrossing() );
889  } break;
890  case 1: {
891  channelPlots_[detId].activity_per_bx_plus1->Fill( event.bunchCrossing() );
892  } break;
893  }
894  }
895  }
896 
897  }
898 
899  // Tomography of diamonds using strips
900  for ( const auto& rechits : *diamondRecHits ) {
901  const CTPPSDiamondDetId detId( rechits.detId() );
902  for ( const auto& rechit : rechits ) {
903  if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue;
904  if ( stripTracks.isValid() ) {
905  if (channelPlots_.find(detId) == channelPlots_.end()) continue;
906  for ( const auto& ds : *stripTracks ) {
907  for ( const auto& striplt : ds ) {
908  CTPPSDetId stripId(ds.detId());
909  if ( !striplt.isValid() ) continue;
910  if ( stripId.arm() != detId.arm() ) continue;
911  if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue;
912  if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue;
913  if ( stripId.rp() == CTPPS_FAR_RP_ID ) {
914  channelPlots_[detId].stripTomography_far->Fill( striplt.getX0() + 25*(rechit.getOOTIndex() - ( ( centralOOT_ != -999 ) ? centralOOT_ : 0 ) +1), striplt.getY0() );
915  }
916  }
917  }
918  }
919  }
920  }
921 }
922 
923 //----------------------------------------------------------------------------------------------------
924 
925 void
927 {}
928 
929 //----------------------------------------------------------------------------------------------------
930 
931 void
933 {}
934 
935 //----------------------------------------------------------------------------------------------------
936 
static const int CTPPS_FED_ID_56
OptoRx headers and footers.
Definition: TotemFEDInfo.h:15
plots related to one Diamond plane
T getParameter(std::string const &) const
plots related to one Diamond detector package
static const int CHANNEL_OF_VFAT_CLOCK
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
RunNumber_t run() const
Definition: RunBase.h:40
static const double DISPLAY_RESOLUTION_FOR_HITS_MM
static const int CTPPS_DIAMOND_NUM_OF_PLANES
void setPlane(uint32_t channel)
void cd(void)
Definition: DQMStore.cc:269
Reconstructed hit in diamond detectors.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void setChannel(uint32_t channel)
void channelName(std::string &name, NameFlag flag=nFull) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondDigi > > tokenDigi_
CTPPSDiamondDQMSource(const edm::ParameterSet &)
bool getErrorId(unsigned short id) const
static const int CTPPS_NUM_OF_ARMS
plots related to the whole system
int bunchCrossing() const
Definition: EventBase.h:66
#define NULL
Definition: scimark2.h:8
static const int CTPPS_DIAMOND_NUM_OF_CHANNELS
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
void endRun(const edm::Run &, const edm::EventSetup &)
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
A track fit through a single RP.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void Fill(long long x)
static const int CTPPS_DIAMOND_STATION_ID
void analyze(const edm::Event &, const edm::EventSetup &)
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
std::vector< std::pair< edm::EventRange, int > > runParameters_
static const int CTPPS_NEAR_RP_ID
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void rpName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:139
plots related to one Diamond channel
uint32_t arm() const
Definition: CTPPSDetId.h:52
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > tokenDiamondTrack_
static const double HPTDC_BIN_WIDTH_NS
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH1F * getTH1F(void) const
void planeName(std::string &name, NameFlag flag=nFull) const
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
std::unordered_map< unsigned int, PotPlots > potPlots_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > tokenDiamondHit_
HLT enums.
static const int CTPPS_FAR_RP_ID
static const double SEC_PER_LUMI_SECTION
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< unsigned int, PlanePlots > planePlots_
TH2F * getTH2F(void) const
static const int CTPPS_DIAMOND_RP_ID
static std::string getHPTDCErrorName(const unsigned short id)
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const int CTPPS_FED_ID_45
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus_
Definition: event.py:1
Definition: Run.h:42