CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Attributes
TotemRPDQMSource Class Reference
Inheritance diagram for TotemRPDQMSource:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  ArmPlots
 plots related to one arm More...
 
struct  DiagonalPlots
 plots related to one (anti)diagonal More...
 
struct  GlobalPlots
 plots related to the whole system More...
 
struct  PlanePlots
 plots related to one RP plane More...
 
struct  PotPlots
 plots related to one RP More...
 
struct  StationPlots
 plots related to one station More...
 

Public Member Functions

 TotemRPDQMSource (const edm::ParameterSet &ps)
 
virtual ~TotemRPDQMSource ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

std::map< unsigned int, ArmPlotsarmPlots
 
std::map< unsigned int, DiagonalPlotsdiagonalPlots
 
GlobalPlots globalPlots
 
std::map< unsigned int, PlanePlotsplanePlots
 
std::map< unsigned int, PotPlotspotPlots
 
std::map< unsigned int, StationPlotsstationPlots
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
 
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
 
unsigned int verbosity
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 39 of file TotemRPDQMSource.cc.

Constructor & Destructor Documentation

TotemRPDQMSource::TotemRPDQMSource ( const edm::ParameterSet ps)

Definition at line 326 of file TotemRPDQMSource.cc.

References edm::ParameterSet::getParameter(), tokenCluster, tokenDigi, tokenLocalTrack, tokenRecHit, tokenStatus, and tokenUVPattern.

326  :
327  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
328 {
329  tokenStatus = consumes<DetSetVector<TotemVFATStatus>>(ps.getParameter<edm::InputTag>("tagStatus"));
330 
331  tokenDigi = consumes< DetSetVector<TotemRPDigi> >(ps.getParameter<edm::InputTag>("tagDigi"));
332  tokenCluster = consumes< edm::DetSetVector<TotemRPCluster> >(ps.getParameter<edm::InputTag>("tagCluster"));
333  tokenRecHit = consumes< edm::DetSetVector<TotemRPRecHit> >(ps.getParameter<edm::InputTag>("tagRecHit"));
334  tokenUVPattern = consumes< DetSetVector<TotemRPUVPattern> >(ps.getParameter<edm::InputTag>("tagUVPattern"));
335  tokenLocalTrack = consumes< DetSetVector<TotemRPLocalTrack> >(ps.getParameter<edm::InputTag>("tagLocalTrack"));
336  //tokenMultiTrackColl = consumes< RPMulFittedTrackCollection >(ps.getParameter<edm::InputTag>("tagMultiTrackColl"));
337 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
unsigned int verbosity
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
TotemRPDQMSource::~TotemRPDQMSource ( )
virtual

Definition at line 341 of file TotemRPDQMSource.cc.

342 {
343 }

Member Function Documentation

void TotemRPDQMSource::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
)
overrideprotectedvirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 410 of file TotemRPDQMSource.cc.

References armPlots, edm::DetSet< T >::begin(), edm::EventBase::bunchCrossing(), python.rootplot.argparse::category, TotemRPDQMSource::GlobalPlots::events_per_bx, TotemRPDQMSource::GlobalPlots::events_per_bx_short, MonitorElement::Fill(), geometry, edm::EventSetup::get(), CTPPSDetId::getArmId(), TotemRPGeometry::GetDetector(), TotemRPDetId::getRPDecimalId(), TotemRPGeometry::GetRPGlobalTranslation(), CTPPSDetId::getRPId(), globalPlots, TotemRPGeometry::GlobalToLocal(), TotemRPDQMSource::PotPlots::h_planes_fit_u, TotemRPDQMSource::PotPlots::h_planes_fit_v, TotemRPDQMSource::ArmPlots::h_trackCorr, TotemRPDQMSource::GlobalPlots::h_trackCorr_hor, TotemRPDQMSource::ArmPlots::h_trackCorr_overlap, TotemRPDQMSource::PotPlots::hit_plane_hist, hfClusterShapes_cfi::hits, edm::eventsetup::heterocontainer::insert(), TotemRPDetId::isStripsCoordinateUDirection(), edm::HandleBase::isValid(), TotemRPGeometry::LocalToGlobalDirection(), match(), TtSemiLepHitFitProducer_Electrons_cfi::mTop, AlCaHLTBitMon_ParallelJobs::p, patterns, TotemRPDQMSource::PotPlots::patterns_u, TotemRPDQMSource::PotPlots::patterns_v, TotemRPDetId::plane(), planePlots, ValidateTausOnQCD_cff::plots, potPlots, createTree::pp, TotemRPUVPattern::projU, TotemRPUVPattern::projV, CTPPSDetId::rp(), alignCSCRings::s, TotemRPDetId::setPlane(), mps_update::status, tokenCluster, tokenDigi, tokenLocalTrack, tokenRecHit, tokenStatus, tokenUVPattern, TotemRPDQMSource::PotPlots::track_u_profile, TotemRPDQMSource::PotPlots::track_v_profile, TotemRPDQMSource::PotPlots::trackHitsCumulativeHist, l1t::tracks, DetGeomDesc::translation(), mitigatedMETSequence_cff::U, findQualityFiles::v, verbosity, x, and y.

411 {
412  // get event setup data
414  eventSetup.get<VeryForwardRealGeometryRecord>().get(geometry);
415 
416  // get event data
418  event.getByToken(tokenStatus, status);
419 
421  event.getByToken(tokenDigi, digi);
422 
424  event.getByToken(tokenCluster, digCluster);
425 
427  event.getByToken(tokenRecHit, hits);
428 
430  event.getByToken(tokenUVPattern, patterns);
431 
433  event.getByToken(tokenLocalTrack, tracks);
434 
435  //Handle< RPMulFittedTrackCollection > multiTracks;
436  //event.getByToken(tokenMultiTrackColl, multiTracks);
437 
438  // check validity
439  bool valid = true;
440  valid &= status.isValid();
441  valid &= digi.isValid();
442  valid &= digCluster.isValid();
443  valid &= hits.isValid();
444  valid &= patterns.isValid();
445  valid &= tracks.isValid();
446  //valid &= multiTracks.isValid();
447 
448  if (!valid)
449  {
450  if (verbosity)
451  {
452  LogProblem("TotemRPDQMSource") <<
453  "ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n"
454  << " status.isValid = " << status.isValid() << "\n"
455  << " digi.isValid = " << digi.isValid() << "\n"
456  << " digCluster.isValid = " << digCluster.isValid() << "\n"
457  << " hits.isValid = " << hits.isValid() << "\n"
458  << " patterns.isValid = " << patterns.isValid() << "\n"
459  << " tracks.isValid = " << tracks.isValid();
460  //<< " multiTracks.isValid = %i\n", multiTracks.isValid()
461  }
462 
463  return;
464  }
465 
466  //------------------------------
467  // Global Plots
468 
469  globalPlots.events_per_bx->Fill(event.bunchCrossing());
470  globalPlots.events_per_bx_short->Fill(event.bunchCrossing());
471 
472  for (auto &ds1 : *tracks)
473  {
474  for (auto &tr1 : ds1)
475  {
476  if (! tr1.isValid())
477  continue;
478 
479  unsigned int rpId1 = ds1.detId();
480  unsigned int arm1 = rpId1 / 100;
481  unsigned int stNum1 = (rpId1 / 10) % 10;
482  unsigned int rpNum1 = rpId1 % 10;
483  if (stNum1 != 0 || (rpNum1 != 2 && rpNum1 != 3))
484  continue;
485  unsigned int idx1 = arm1*2 + rpNum1-2;
486 
487  for (auto &ds2 : *tracks)
488  {
489  for (auto &tr2 : ds2)
490  {
491  if (! tr2.isValid())
492  continue;
493 
494  unsigned int rpId2 = ds2.detId();
495  unsigned int arm2 = rpId2 / 100;
496  unsigned int stNum2 = (rpId2 / 10) % 10;
497  unsigned int rpNum2 = rpId2 % 10;
498  if (stNum2 != 0 || (rpNum2 != 2 && rpNum2 != 3))
499  continue;
500  unsigned int idx2 = arm2*2 + rpNum2-2;
501 
502  globalPlots.h_trackCorr_hor->Fill(idx1, idx2);
503  }
504  }
505  }
506  }
507 
508  //------------------------------
509  // Status Plots
510 
511  for (auto &ds : *status)
512  {
513  TotemRPDetId detId(ds.detId());
514  unsigned int plNum = detId.plane();
515  CTPPSDetId rpId = detId.getRPId();
516 
517  auto &plots = potPlots[rpId];
518 
519  for (auto &s : ds)
520  {
521  if (s.isMissing())
522  {
523  plots.vfat_problem->Fill(plNum, s.getChipPosition());
524  plots.vfat_missing->Fill(plNum, s.getChipPosition());
525  }
526 
527  if (s.isECProgressError() || s.isBCProgressError())
528  {
529  plots.vfat_problem->Fill(plNum, s.getChipPosition());
530  plots.vfat_ec_bc_error->Fill(plNum, s.getChipPosition());
531  }
532 
533  if (s.isIDMismatch() || s.isFootprintError() || s.isCRCError())
534  {
535  plots.vfat_problem->Fill(plNum, s.getChipPosition());
536  plots.vfat_corruption->Fill(plNum, s.getChipPosition());
537  }
538  }
539  }
540 
541  //------------------------------
542  // Plane Plots
543 
544  // digi profile cumulative
545  for (DetSetVector<TotemRPDigi>::const_iterator it = digi->begin(); it != digi->end(); ++it)
546  {
547  TotemRPDetId detId(it->detId());
548  for (DetSet<TotemRPDigi>::const_iterator dit = it->begin(); dit != it->end(); ++dit)
549  planePlots[detId].digi_profile_cumulative->Fill(dit->getStripNumber());
550  }
551 
552  // cluster profile cumulative
553  for (DetSetVector<TotemRPCluster>::const_iterator it = digCluster->begin(); it != digCluster->end(); it++)
554  {
555  TotemRPDetId detId(it->detId());
556  for (DetSet<TotemRPCluster>::const_iterator dit = it->begin(); dit != it->end(); ++dit)
557  planePlots[detId].cluster_profile_cumulative->Fill(dit->getCenterStripPosition());
558  }
559 
560  // hit multiplicity
561  for (DetSetVector<TotemRPCluster>::const_iterator it = digCluster->begin(); it != digCluster->end(); it++)
562  {
563  TotemRPDetId detId(it->detId());
564  planePlots[detId].hit_multiplicity->Fill(it->size());
565  }
566 
567  // cluster size
568  for (DetSetVector<TotemRPCluster>::const_iterator it = digCluster->begin(); it != digCluster->end(); it++)
569  {
570  TotemRPDetId detId(it->detId());
571  for (DetSet<TotemRPCluster>::const_iterator dit = it->begin(); dit != it->end(); ++dit)
572  planePlots[detId].cluster_size->Fill(dit->getNumberOfStrips());
573  }
574 
575  // plane efficiency plots
576  for (auto &ds : *tracks)
577  {
578  unsigned int rpDecId = ds.detId();
579  unsigned int armIdx = rpDecId / 100;
580  unsigned int stIdx = (rpDecId / 10) % 10;
581  unsigned int rpIdx = rpDecId % 10;
582  TotemRPDetId rpId(armIdx, stIdx, rpIdx);
583 
584  for (auto &ft : ds)
585  {
586  if (!ft.isValid())
587  continue;
588 
589  double rp_z = geometry->GetRPGlobalTranslation(rpId).z();
590 
591  for (unsigned int plNum = 0; plNum < 10; ++plNum)
592  {
593  TotemRPDetId plId(armIdx, stIdx, rpIdx, plNum);
594 
595  double ft_z = ft.getZ0();
596  double ft_x = ft.getX0() + ft.getTx() * (ft_z - rp_z);
597  double ft_y = ft.getY0() + ft.getTy() * (ft_z - rp_z);
598 
599  double ft_v = geometry->GlobalToLocal(plId, CLHEP::Hep3Vector(ft_x, ft_y, ft_z)).y();
600 
601  bool hasMatchingHit = false;
602  const auto &hit_ds_it = hits->find(plId);
603  if (hit_ds_it != hits->end())
604  {
605  for (const auto &h : *hit_ds_it)
606  {
607  bool match = (fabs(ft_v - h.getPosition()) < 2.*0.066);
608  if (match)
609  {
610  hasMatchingHit = true;
611  break;
612  }
613  }
614  }
615 
616  auto &pp = planePlots[plId];
617 
618  pp.efficiency_den->Fill(ft_v);
619  if (hasMatchingHit)
620  pp.efficiency_num->Fill(ft_v);
621  }
622  }
623  }
624 
625 
626  //------------------------------
627  // Roman Pots Plots
628 
629  // determine active planes (from RecHits and VFATStatus)
630  map<unsigned int, set<unsigned int> > planes;
631  map<unsigned int, set<unsigned int> > planes_u;
632  map<unsigned int, set<unsigned int> > planes_v;
633  for (const auto &ds : *hits)
634  {
635  if (ds.empty())
636  continue;
637 
638  TotemRPDetId detId(ds.detId());
639  unsigned int planeNum = detId.plane();
640  CTPPSDetId rpId = detId.getRPId();
641 
642  planes[rpId].insert(planeNum);
643  if (detId.isStripsCoordinateUDirection())
644  planes_u[rpId].insert(planeNum);
645  else
646  planes_v[rpId].insert(planeNum);
647  }
648 
649  for (const auto &ds : *status)
650  {
651  bool activity = false;
652  for (const auto &s : ds)
653  {
654  if (s.isNumberOfClustersSpecified() && s.getNumberOfClusters() > 0)
655  {
656  activity = true;
657  break;
658  }
659  }
660 
661  if (!activity)
662  continue;
663 
664  TotemRPDetId detId(ds.detId());
665  unsigned int planeNum = detId.plane();
666  CTPPSDetId rpId = detId.getRPId();
667 
668  planes[rpId].insert(planeNum);
669  if (detId.isStripsCoordinateUDirection())
670  planes_u[rpId].insert(planeNum);
671  else
672  planes_v[rpId].insert(planeNum);
673  }
674 
675  // plane activity histogram
676  for (std::map<unsigned int, PotPlots>::iterator it = potPlots.begin(); it != potPlots.end(); it++)
677  {
678  it->second.activity->Fill(planes[it->first].size());
679  it->second.activity_u->Fill(planes_u[it->first].size());
680  it->second.activity_v->Fill(planes_v[it->first].size());
681 
682  if (planes[it->first].size() >= 6)
683  {
684  it->second.activity_per_bx->Fill(event.bunchCrossing());
685  it->second.activity_per_bx_short->Fill(event.bunchCrossing());
686  }
687  }
688 
689  for (DetSetVector<TotemRPCluster>::const_iterator it = digCluster->begin(); it != digCluster->end(); it++)
690  {
691  TotemRPDetId detId(it->detId());
692  unsigned int planeNum = detId.plane();
693  CTPPSDetId rpId = detId.getRPId();
694 
695  PotPlots &pp = potPlots[rpId];
696  for (DetSet<TotemRPCluster>::const_iterator dit = it->begin(); dit != it->end(); ++dit)
697  pp.hit_plane_hist->Fill(planeNum, dit->getCenterStripPosition());
698  }
699 
700  // recognized pattern histograms
701  for (auto &ds : *patterns)
702  {
703  unsigned int rpDecId = ds.detId();
704  unsigned int armIdx = rpDecId / 100;
705  unsigned int stIdx = (rpDecId / 10) % 10;
706  unsigned int rpIdx = rpDecId % 10;
707  TotemRPDetId rpId(armIdx, stIdx, rpIdx);
708 
709  PotPlots &pp = potPlots[rpId];
710 
711  // count U and V patterns
712  unsigned int u = 0, v = 0;
713  for (auto &p : ds)
714  {
715  if (! p.getFittable())
716  continue;
717 
718  if (p.getProjection() == TotemRPUVPattern::projU)
719  u++;
720 
721  if (p.getProjection() == TotemRPUVPattern::projV)
722  v++;
723  }
724 
725  pp.patterns_u->Fill(u);
726  pp.patterns_v->Fill(v);
727  }
728 
729  // event-category histogram
730  for (auto &it : potPlots)
731  {
732  TotemRPDetId rpId(it.first);
733  auto &pp = it.second;
734 
735  // process hit data for this plot
736  unsigned int pl_u = planes_u[rpId].size();
737  unsigned int pl_v = planes_v[rpId].size();
738 
739  // process pattern data for this pot
740  unsigned int rpDecId = rpId.getRPDecimalId();
741  const auto &rp_pat_it = patterns->find(rpDecId);
742 
743  unsigned int pat_u = 0, pat_v = 0;
744  if (rp_pat_it != patterns->end())
745  {
746  for (auto &p : *rp_pat_it)
747  {
748  if (! p.getFittable())
749  continue;
750 
751  if (p.getProjection() == TotemRPUVPattern::projU)
752  pat_u++;
753 
754  if (p.getProjection() == TotemRPUVPattern::projV)
755  pat_v++;
756  }
757  }
758 
759  // determine category
760  signed int category = -1;
761 
762  if (pl_u == 0 && pl_v == 0) category = 0; // empty
763 
764  if (category == -1 && pat_u + pat_v <= 1)
765  {
766  if (pl_u + pl_v < 6)
767  category = 1; // insuff
768  else
769  category = 4; // shower
770  }
771 
772  if (pat_u == 1 && pat_v == 1) category = 2; // 1-track
773 
774  if (category == -1) category = 3; // multi-track
775 
776  pp.event_category->Fill(category);
777  }
778 
779  // RP track-fit plots
780  for (auto &ds : *tracks)
781  {
782  unsigned int rpDecId = ds.detId();
783  unsigned int armIdx = rpDecId / 100;
784  unsigned int stIdx = (rpDecId / 10) % 10;
785  unsigned int rpIdx = rpDecId % 10;
786  TotemRPDetId rpId(armIdx, stIdx, rpIdx);
787 
788  PotPlots &pp = potPlots[rpId];
789 
790  for (auto &ft : ds)
791  {
792  if (!ft.isValid())
793  continue;
794 
795  // number of planes contributing to (valid) fits
796  unsigned int n_pl_in_fit_u = 0, n_pl_in_fit_v = 0;
797  for (auto &hds : ft.getHits())
798  {
799  TotemRPDetId plId(hds.detId());
800  bool uProj = plId.isStripsCoordinateUDirection();
801 
802  for (auto &h : hds)
803  {
804  h.getPosition(); // just to keep compiler silent
805  if (uProj)
806  n_pl_in_fit_u++;
807  else
808  n_pl_in_fit_v++;
809  }
810  }
811 
812  pp.h_planes_fit_u->Fill(n_pl_in_fit_u);
813  pp.h_planes_fit_v->Fill(n_pl_in_fit_v);
814 
815  // mean position of U and V planes
816  TotemRPDetId plId_V(rpId); plId_V.setPlane(0);
817  TotemRPDetId plId_U(rpId); plId_U.setPlane(1);
818 
819  double rp_x = ( geometry->GetDetector(plId_V)->translation().x() +
820  geometry->GetDetector(plId_U)->translation().x() ) / 2.;
821  double rp_y = ( geometry->GetDetector(plId_V)->translation().y() +
822  geometry->GetDetector(plId_U)->translation().y() ) / 2.;
823 
824  // mean read-out direction of U and V planes
825  CLHEP::Hep3Vector rod_U = geometry->LocalToGlobalDirection(plId_U, CLHEP::Hep3Vector(0., 1., 0.));
826  CLHEP::Hep3Vector rod_V = geometry->LocalToGlobalDirection(plId_V, CLHEP::Hep3Vector(0., 1., 0.));
827 
828  double x = ft.getX0() - rp_x;
829  double y = ft.getY0() - rp_y;
830 
831  pp.trackHitsCumulativeHist->Fill(x, y);
832 
833  double U = x * rod_U.x() + y * rod_U.y();
834  double V = x * rod_V.x() + y * rod_V.y();
835 
836  pp.track_u_profile->Fill(U);
837  pp.track_v_profile->Fill(V);
838  }
839  }
840 
841  //------------------------------
842  // Station Plots
843 
844 
845  //------------------------------
846  // Arm Plots
847  {
848  map<unsigned int, unsigned int> mTop, mHor, mBot;
849 
850  for (auto p : armPlots)
851  {
852  mTop[p.first] = 0;
853  mHor[p.first] = 0;
854  mBot[p.first] = 0;
855  }
856 
857  for (auto &ds : *tracks)
858  {
859  unsigned int rpDecId = ds.detId();
860  unsigned int armIdx = rpDecId / 100;
861  unsigned int stIdx = (rpDecId / 10) % 10;
862  unsigned int rpIdx = rpDecId % 10;
863  TotemRPDetId rpId(armIdx, stIdx, rpIdx);
864 
865  unsigned int rpNum = rpId.rp();
866 
867  TotemRPDetId armId = rpId.getArmId();
868 
869  for (auto &tr : ds)
870  {
871  if (! tr.isValid())
872  continue;
873 
874  if (rpNum == 0 || rpNum == 4)
875  mTop[armId]++;
876  if (rpNum == 2 || rpNum == 3)
877  mHor[armId]++;
878  if (rpNum == 1 || rpNum == 5)
879  mBot[armId]++;
880  }
881  }
882 
883  for (auto &p : armPlots)
884  {
885  p.second.h_numRPWithTrack_top->Fill(mTop[p.first]);
886  p.second.h_numRPWithTrack_hor->Fill(mHor[p.first]);
887  p.second.h_numRPWithTrack_bot->Fill(mBot[p.first]);
888  }
889 
890  // track RP correlation
891  for (auto &ds1 : *tracks)
892  {
893  for (auto &tr1 : ds1)
894  {
895  if (! tr1.isValid())
896  continue;
897 
898  unsigned int rpDecId1 = ds1.detId();
899  unsigned int arm1 = rpDecId1 / 100;
900  unsigned int stNum1 = (rpDecId1 / 10) % 10;
901  unsigned int rpNum1 = rpDecId1 % 10;
902  unsigned int idx1 = stNum1/2 * 7 + rpNum1;
903  bool hor1 = (rpNum1 == 2 || rpNum1 == 3);
904 
905  TotemRPDetId armId(arm1, 0);
906  ArmPlots &ap = armPlots[armId];
907 
908  for (auto &ds2 : *tracks)
909  {
910  for (auto &tr2 : ds2)
911  {
912  if (! tr2.isValid())
913  continue;
914 
915  unsigned int rpDecId2 = ds2.detId();
916  unsigned int arm2 = rpDecId2 / 100;
917  unsigned int stNum2 = (rpDecId2 / 10) % 10;
918  unsigned int rpNum2 = rpDecId2 % 10;
919  unsigned int idx2 = stNum2/2 * 7 + rpNum2;
920  bool hor2 = (rpNum2 == 2 || rpNum2 == 3);
921 
922  if (arm1 != arm2)
923  continue;
924 
925  ap.h_trackCorr->Fill(idx1, idx2);
926 
927  if (hor1 != hor2)
928  ap.h_trackCorr_overlap->Fill(idx1, idx2);
929  }
930  }
931  }
932  }
933  }
934 
935  //------------------------------
936  // RP-system plots
937  // TODO: this code needs
938  // * generalization for more than two RPs per arm
939  // * updating for tracks as DetSetVector
940  /*
941  for (auto &dp : diagonalPlots)
942  {
943  unsigned int id = dp.first;
944  bool top45 = id & 2;
945  bool top56 = id & 1;
946 
947  unsigned int id_45_n = (top45) ? 20 : 21;
948  unsigned int id_45_f = (top45) ? 24 : 25;
949  unsigned int id_56_n = (top56) ? 120 : 121;
950  unsigned int id_56_f = (top56) ? 124 : 125;
951 
952  bool h_45_n = (tracks->find(id_45_n) != tracks->end() && tracks->find(id_45_n)->second.IsValid());
953  bool h_45_f = (tracks->find(id_45_f) != tracks->end() && tracks->find(id_45_f)->second.IsValid());
954  bool h_56_n = (tracks->find(id_56_n) != tracks->end() && tracks->find(id_56_n)->second.IsValid());
955  bool h_56_f = (tracks->find(id_56_f) != tracks->end() && tracks->find(id_56_f)->second.IsValid());
956 
957  if (! (h_45_n && h_45_f && h_56_n && h_56_f) )
958  continue;
959 
960  double x_45_n = tracks->find(id_45_n)->second.X0(), y_45_n = tracks->find(id_45_n)->second.Y0();
961  double x_45_f = tracks->find(id_45_f)->second.X0(), y_45_f = tracks->find(id_45_f)->second.Y0();
962  double x_56_n = tracks->find(id_56_n)->second.X0(), y_56_n = tracks->find(id_56_n)->second.Y0();
963  double x_56_f = tracks->find(id_56_f)->second.X0(), y_56_f = tracks->find(id_56_f)->second.Y0();
964 
965  double dx_45 = x_45_f - x_45_n;
966  double dy_45 = y_45_f - y_45_n;
967  double dx_56 = x_56_f - x_56_n;
968  double dy_56 = y_56_f - y_56_n;
969 
970  DiagonalPlots &pl = dp.second;
971 
972  pl.h_lrc_x_d->Fill(dx_45, dx_56);
973  pl.h_lrc_y_d->Fill(dy_45, dy_56);
974 
975  pl.h_lrc_x_n->Fill(x_45_n, x_56_n);
976  pl.h_lrc_y_n->Fill(y_45_n, y_56_n);
977 
978  pl.h_lrc_x_f->Fill(x_45_f, x_56_f);
979  pl.h_lrc_y_f->Fill(y_45_f, y_56_f);
980  }
981  */
982 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
GlobalPlots globalPlots
CLHEP::Hep3Vector GetRPGlobalTranslation(int copy_no) const
position of a RP package (translation z corresponds to the first plane - TODO check it) ...
std::map< unsigned int, ArmPlots > armPlots
DetGeomDesc * GetDetector(unsigned int) const
returns geometry of a detector performs necessary checks, returns NULL if fails input is raw ID ...
uint32_t plane() const
Definition: TotemRPDetId.h:49
bool isStripsCoordinateUDirection() const
Definition: TotemRPDetId.h:80
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
Event setup record containing the real (actual) geometry information.
const PhiMemoryImage patterns[9]
void Fill(long long x)
std::map< unsigned int, PlanePlots > planePlots
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
unsigned int verbosity
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
DDTranslation translation() const
Definition: DetGeomDesc.h:87
CTPPSDetId getRPId() const
Definition: CTPPSDetId.h:97
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
CLHEP::Hep3Vector GlobalToLocal(DetGeomDesc *gd, const CLHEP::Hep3Vector r) const
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * events_per_bx_short
CLHEP::Hep3Vector LocalToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector dir) const
iterator begin()
Definition: DetSet.h:59
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
CTPPSDetId getArmId() const
Definition: CTPPSDetId.h:87
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
ESHandle< TrackerGeometry > geometry
std::map< unsigned int, PotPlots > potPlots
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
Definition: event.py:1
uint32_t rp() const
Definition: CTPPSDetId.h:74
void TotemRPDQMSource::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  eSetup 
)
overrideprotectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 403 of file TotemRPDQMSource.cc.

405 {
406 }
void TotemRPDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 353 of file TotemRPDQMSource.cc.

References armPlots, DQMStore::IBooker::cd(), globalPlots, TotemRPDQMSource::GlobalPlots::Init(), planePlots, potPlots, DQMStore::IBooker::setCurrentFolder(), and stationPlots.

354 {
355  ibooker.cd();
356  ibooker.setCurrentFolder("CTPPS");
357 
358  // global plots
359  globalPlots.Init(ibooker);
360 
361  // temporarily disabled
362  /*
363  // initialize diagonals
364  diagonalPlots[1] = DiagonalPlots(ibooker, 1); // 45 bot - 56 top
365  diagonalPlots[2] = DiagonalPlots(ibooker, 2); // 45 top - 45 bot
366 
367  // initialize anti-diagonals
368  diagonalPlots[0] = DiagonalPlots(ibooker, 0); // 45 bot - 56 bot
369  diagonalPlots[3] = DiagonalPlots(ibooker, 3); // 45 top - 56 top
370  */
371 
372  // loop over arms
373  for (unsigned int arm = 0; arm < 2; arm++)
374  {
375  TotemRPDetId armId(arm, 0);
376  armPlots[armId] = ArmPlots(ibooker, armId);
377 
378  // loop over stations
379  for (unsigned int st = 0; st < 3; st += 2)
380  {
381  TotemRPDetId stId(arm, st);
382  stationPlots[stId] = StationPlots(ibooker, stId);
383 
384  // loop over RPs
385  for (unsigned int rp = 0; rp < 6; ++rp)
386  {
387  TotemRPDetId rpId(arm, st, rp);
388  potPlots[rpId] = PotPlots(ibooker, rpId);
389 
390  // loop over planes
391  for (unsigned int pl = 0; pl < 10; ++pl)
392  {
393  TotemRPDetId plId(arm, st, rp, pl);
394  planePlots[plId] = PlanePlots(ibooker, plId);
395  }
396  }
397  }
398  }
399 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
GlobalPlots globalPlots
void Init(DQMStore::IBooker &ibooker)
void cd(void)
Definition: DQMStore.cc:269
std::map< unsigned int, ArmPlots > armPlots
std::map< unsigned int, PlanePlots > planePlots
std::map< unsigned int, StationPlots > stationPlots
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::map< unsigned int, PotPlots > potPlots
void TotemRPDQMSource::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 347 of file TotemRPDQMSource.cc.

348 {
349 }
void TotemRPDQMSource::endLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  eSetup 
)
overrideprotectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 986 of file TotemRPDQMSource.cc.

987 {
988 }
void TotemRPDQMSource::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overrideprotectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 992 of file TotemRPDQMSource.cc.

References DEFINE_FWK_MODULE.

993 {
994 }

Member Data Documentation

std::map<unsigned int, ArmPlots> TotemRPDQMSource::armPlots
private

Definition at line 103 of file TotemRPDQMSource.cc.

Referenced by analyze(), and bookHistograms().

std::map<unsigned int, DiagonalPlots> TotemRPDQMSource::diagonalPlots
private

Definition at line 88 of file TotemRPDQMSource.cc.

GlobalPlots TotemRPDQMSource::globalPlots
private

Definition at line 73 of file TotemRPDQMSource.cc.

Referenced by analyze(), and bookHistograms().

std::map<unsigned int, PlanePlots> TotemRPDQMSource::planePlots
private

Definition at line 147 of file TotemRPDQMSource.cc.

Referenced by analyze(), and bookHistograms().

std::map<unsigned int, PotPlots> TotemRPDQMSource::potPlots
private

Definition at line 132 of file TotemRPDQMSource.cc.

Referenced by analyze(), and bookHistograms().

std::map<unsigned int, StationPlots> TotemRPDQMSource::stationPlots
private

Definition at line 112 of file TotemRPDQMSource.cc.

Referenced by bookHistograms().

edm::EDGetTokenT< edm::DetSetVector<TotemRPCluster> > TotemRPDQMSource::tokenCluster
private

Definition at line 58 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

edm::EDGetTokenT< edm::DetSetVector<TotemRPDigi> > TotemRPDQMSource::tokenDigi
private

Definition at line 57 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

edm::EDGetTokenT< edm::DetSetVector<TotemRPLocalTrack> > TotemRPDQMSource::tokenLocalTrack
private

Definition at line 61 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

edm::EDGetTokenT< edm::DetSetVector<TotemRPRecHit> > TotemRPDQMSource::tokenRecHit
private

Definition at line 59 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

edm::EDGetTokenT< edm::DetSetVector<TotemVFATStatus> > TotemRPDQMSource::tokenStatus
private

Definition at line 56 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

edm::EDGetTokenT< edm::DetSetVector<TotemRPUVPattern> > TotemRPDQMSource::tokenUVPattern
private

Definition at line 60 of file TotemRPDQMSource.cc.

Referenced by analyze(), and TotemRPDQMSource().

unsigned int TotemRPDQMSource::verbosity
private

Definition at line 54 of file TotemRPDQMSource.cc.

Referenced by analyze().