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 330 of file TotemRPDQMSource.cc.

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

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

346 {
347 }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 425 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.

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

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

Implements DQMEDAnalyzer.

Definition at line 357 of file TotemRPDQMSource.cc.

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

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

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 983 of file TotemRPDQMSource.cc.

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 989 of file TotemRPDQMSource.cc.

References DEFINE_FWK_MODULE.

990 {
991 }

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