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 & itemsToGetFrom (BranchType iType) 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 328 of file TotemRPDQMSource.cc.

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

328  :
329  verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0))
330 {
331  tokenStatus = consumes<DetSetVector<TotemVFATStatus>>(ps.getParameter<edm::InputTag>("tagStatus"));
332 
333  tokenDigi = consumes< DetSetVector<TotemRPDigi> >(ps.getParameter<edm::InputTag>("tagDigi"));
334  tokenCluster = consumes< edm::DetSetVector<TotemRPCluster> >(ps.getParameter<edm::InputTag>("tagCluster"));
335  tokenRecHit = consumes< edm::DetSetVector<TotemRPRecHit> >(ps.getParameter<edm::InputTag>("tagRecHit"));
336  tokenUVPattern = consumes< DetSetVector<TotemRPUVPattern> >(ps.getParameter<edm::InputTag>("tagUVPattern"));
337  tokenLocalTrack = consumes< DetSetVector<TotemRPLocalTrack> >(ps.getParameter<edm::InputTag>("tagLocalTrack"));
338  //tokenMultiTrackColl = consumes< RPMulFittedTrackCollection >(ps.getParameter<edm::InputTag>("tagMultiTrackColl"));
339 }
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 343 of file TotemRPDQMSource.cc.

344 {
345 }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 423 of file TotemRPDQMSource.cc.

References CTPPSDetId::arm(), 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(), TotemRPGeometry::GetRPGlobalTranslation(), CTPPSDetId::getRPId(), globalPlots, TotemRPGeometry::GlobalToLocal(), 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, TotemRPDetId::plane(), planePlots, plot_utils::plots, potPlots, createTree::pp, TotemRPUVPattern::projU, TotemRPUVPattern::projV, CTPPSDetId::rp(), alignCSCRings::s, TotemRPDetId::setPlane(), mps_update::status, tokenCluster, tokenDigi, tokenLocalTrack, tokenRecHit, tokenStatus, tokenUVPattern, l1t::tracks, DetGeomDesc::translation(), mitigatedMETSequence_cff::U, findQualityFiles::v, verbosity, x, and y.

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

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

Implements DQMEDAnalyzer.

Definition at line 355 of file TotemRPDQMSource.cc.

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

356 {
357  ibooker.cd();
358  ibooker.setCurrentFolder("CTPPS");
359 
360  // global plots
361  globalPlots.Init(ibooker);
362 
363  // temporarily disabled
364  /*
365  // initialize diagonals
366  diagonalPlots[1] = DiagonalPlots(ibooker, 1); // 45 bot - 56 top
367  diagonalPlots[2] = DiagonalPlots(ibooker, 2); // 45 top - 45 bot
368 
369  // initialize anti-diagonals
370  diagonalPlots[0] = DiagonalPlots(ibooker, 0); // 45 bot - 56 bot
371  diagonalPlots[3] = DiagonalPlots(ibooker, 3); // 45 top - 56 top
372  */
373 
374  // loop over arms
375  for (unsigned int arm = 0; arm < 2; arm++)
376  {
377  TotemRPDetId armId(arm, 0);
378  armPlots[armId] = ArmPlots(ibooker, armId);
379 
380  // loop over stations
381  for (unsigned int st = 0; st < 3; st += 2)
382  {
383  TotemRPDetId stId(arm, st);
384  stationPlots[stId] = StationPlots(ibooker, stId);
385 
386  // loop over RPs
387  for (unsigned int rp = 0; rp < 6; ++rp)
388  {
389  if (st == 2)
390  {
391  // unit 220-nr is not equipped
392  if (rp <= 2)
393  continue;
394 
395  // RP 220-fr-hr contains pixels
396  if (rp == 3)
397  continue;
398  }
399 
400  TotemRPDetId rpId(arm, st, rp);
401  potPlots[rpId] = PotPlots(ibooker, rpId);
402 
403  // loop over planes
404  for (unsigned int pl = 0; pl < 10; ++pl)
405  {
406  TotemRPDetId plId(arm, st, rp, pl);
407  planePlots[plId] = PlanePlots(ibooker, plId);
408  }
409  }
410  }
411  }
412 }
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 349 of file TotemRPDQMSource.cc.

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 981 of file TotemRPDQMSource.cc.

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 987 of file TotemRPDQMSource.cc.

References DEFINE_FWK_MODULE.

988 {
989 }

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().