CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
DiamondSampicDQMSource Class Reference
Inheritance diagram for DiamondSampicDQMSource:
DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ChannelPlots
 plots related to one Diamond channel More...
 
struct  GlobalPlots
 plots related to the whole system More...
 
struct  PlanePlots
 plots related to one Diamond plane More...
 
struct  PotPlots
 plots related to one Diamond detector package More...
 
struct  SectorPlots
 

Public Member Functions

 DiamondSampicDQMSource (const edm::ParameterSet &)
 
 ~DiamondSampicDQMSource () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
std::shared_ptr< totemds::CacheglobalBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const override
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Static Private Member Functions

static std::string changePathToSampic (std::string path)
 

Private Attributes

std::unordered_map< unsigned int, ChannelPlotschannelPlots_
 
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordctppsGeometryRunToken_
 
GlobalPlots globalPlot_
 
std::unordered_map< unsigned int, double > horizontalShiftOfDiamond_
 
bool perLSsaving_
 
std::unordered_map< unsigned int, PlanePlotsplanePlots_
 
bool plotOnline_
 
std::unordered_map< unsigned int, PotPlotspotPlots_
 
unsigned int samplesForNoise_
 
std::unordered_map< unsigned int, SectorPlotssectorPlots_
 
edm::TimeValue_t timeOfPreviousEvent_
 
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
 
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
 
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
 
edm::EDGetTokenT< edm::DetSetVector< TotemTimingLocalTrack > > tokenTrack_
 
unsigned int trackCorrelationThreshold_
 
unsigned int verbosity_
 

Static Private Attributes

static const double DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05
 
static const double DQM_FRACTION_OF_EVENTS = 1.
 
static const double HIT_RATE_FACTOR = DQM_FRACTION_OF_EVENTS / SEC_PER_LUMI_SECTION
 
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM
 
static const double LHC_CLOCK_PERIOD_NS = 24.95
 
static const double SAMPIC_ADC_V = 1. / 256
 
static const double SEC_PER_LUMI_SECTION = 23.31
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 49 of file DiamondSampicDQMSource.cc.

Constructor & Destructor Documentation

◆ DiamondSampicDQMSource()

DiamondSampicDQMSource::DiamondSampicDQMSource ( const edm::ParameterSet ps)

Definition at line 383 of file DiamondSampicDQMSource.cc.

388  tokenFEDInfo_(consumes<std::vector<TotemFEDInfo>>(ps.getParameter<edm::InputTag>("tagFEDInfo"))),
389  ctppsGeometryRunToken_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord, edm::Transition::BeginRun>()),
390  samplesForNoise_(ps.getUntrackedParameter<unsigned int>("samplesForNoise", 5)),
391  verbosity_(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
392  plotOnline_(ps.getUntrackedParameter<bool>("plotOnline", true)),
393  perLSsaving_(ps.getUntrackedParameter<bool>("perLSsaving", false)),
394  trackCorrelationThreshold_(ps.getUntrackedParameter<unsigned int>("trackCorrelationThreshold", 3)),
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::TimeValue_t timeOfPreviousEvent_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingLocalTrack > > tokenTrack_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_

◆ ~DiamondSampicDQMSource()

DiamondSampicDQMSource::~DiamondSampicDQMSource ( )
override

Definition at line 399 of file DiamondSampicDQMSource.cc.

399 {}

Member Function Documentation

◆ analyze()

void DiamondSampicDQMSource::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >.

Definition at line 465 of file DiamondSampicDQMSource.cc.

References amcDumpToRaw_cfi::boardId, channelPlots_, horizontalShiftOfDiamond_, mps_fire::i, INV_DISPLAY_RESOLUTION_FOR_HITS_MM, edm::HandleBase::isValid(), TotemTimingRecHit::NO_T_AVAILABLE, perLSsaving_, planePlots_, plotOnline_, potPlots_, HI_PhotonSkim_cff::rechits, SAMPIC_ADC_V, samplesForNoise_, sectorPlots_, CTPPSDiamondDetId::setChannel(), CTPPSDiamondDetId::setPlane(), timeOfPreviousEvent_, tokenDigi_, tokenFEDInfo_, tokenRecHit_, tokenTrack_, HLT_2022v12_cff::track, trackCorrelationThreshold_, tracks, validateGeometry_cfg::valid, verbosity_, and y.

465  {
466  // get event data
468  event.getByToken(tokenDigi_, timingDigis);
469 
471  event.getByToken(tokenFEDInfo_, fedInfo);
472 
474  event.getByToken(tokenRecHit_, timingRecHits);
475 
477  event.getByToken(tokenTrack_, timingLocalTracks);
478 
479  // check validity
480  bool valid = true;
481  valid &= timingDigis.isValid();
482  //valid &= fedInfo.isValid();
483 
484  if (!valid) {
485  if (verbosity_) {
486  edm::LogProblem("DiamondSampicDQMSource")
487  << "ERROR in DiamondSampicDQMSource::analyze > some of the required inputs "
488  "are not valid. Skipping this event.\n"
489  << " timingDigis.isValid = " << timingDigis.isValid() << "\n"
490  << " fedInfo.isValid = " << fedInfo.isValid();
491  }
492 
493  return;
494  }
495 
496  // Using TotemTimingDigi
497  std::set<uint8_t> boardSet;
498  std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
499  std::unordered_map<unsigned int, unsigned int> channelsPerPlaneWithTime;
500 
501  auto lumiCache = luminosityBlockCache(event.getLuminosityBlock().index());
502 
503  for (const auto &digis : *timingDigis) {
504  const CTPPSDiamondDetId detId(digis.detId());
505  CTPPSDiamondDetId detId_pot(digis.detId());
506  detId_pot.setPlane(0);
507  detId_pot.setChannel(0);
508  CTPPSDiamondDetId detId_plane(digis.detId());
509  detId_plane.setChannel(0);
510 
511  for (const auto &digi : digis) {
512  // Pot Plots
513  if (potPlots_.find(detId_pot) != potPlots_.end()) {
514  potPlots_[detId_pot].digiDistribution->Fill(detId.plane(), detId.channel());
515 
516  if (plotOnline_) {
517  potPlots_[detId_pot].activityPerBX->Fill(event.bunchCrossing());
518 
519  for (auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it) {
520  potPlots_[detId_pot].dataSamplesRaw->Fill(*it);
521  }
522 
523  float boardId = digi.eventInfo().hardwareBoardId() + 0.5 * digi.eventInfo().hardwareSampicId();
524  potPlots_[detId_pot].digiSent->Fill(boardId, digi.hardwareChannelId());
525 
526  if (boardSet.find(digi.eventInfo().hardwareId()) == boardSet.end()) {
527  // This guarantees that every board is counted only once
528  boardSet.insert(digi.eventInfo().hardwareId());
529  std::bitset<16> chMap(digi.eventInfo().channelMap());
530  for (int i = 0; i < 16; ++i) {
531  if (chMap.test(i)) {
532  potPlots_[detId_pot].digiAll->Fill(boardId, i);
533  }
534  }
535  }
536 
537  potPlots_[detId_pot].planesWithDigisSet.insert(detId.plane());
538  }
539  }
540 
541  if (plotOnline_) {
542  // Plane Plots
543  if (planePlots_.find(detId_plane) != planePlots_.end()) {
544  planePlots_[detId_plane].digiDistribution->Fill(detId.channel());
545 
546  if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
547  channelsPerPlane[detId_plane]++;
548  else
549  //if it's the first channel, create new map element with the value of 1
550  channelsPerPlane[detId_plane] = 1;
551  }
552 
553  // Channel Plots
554  if (channelPlots_.find(detId) != channelPlots_.end()) {
555  channelPlots_[detId].activityPerBX->Fill(event.bunchCrossing());
556 
557  for (auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
558  channelPlots_[detId].dataSamplesRaw->Fill(*it);
559  for (unsigned short i = 0; i < samplesForNoise_; ++i)
560  channelPlots_[detId].noiseSamples->Fill(SAMPIC_ADC_V * digi.sampleAt(i));
561 
562  unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin();
563  channelPlots_[detId].cellOfMax->Fill((int)cellOfMax);
564 
565  // if (timeOfPreviousEvent_ != 0)
566  // channelPlots_[detId].hitTime->Fill(1e-3 * LHC_CLOCK_PERIOD_NS *
567  // (event.time().value() - timeOfPreviousEvent_));
568  ++(lumiCache->hitsCounterMap[detId]);
569  }
570  }
571  }
572  }
573  // End digis
574 
575  for (const auto &rechits : *timingRecHits) {
576  const CTPPSDiamondDetId detId(rechits.detId());
577  CTPPSDiamondDetId detId_pot(rechits.detId());
578  detId_pot.setPlane(0);
579  detId_pot.setChannel(0);
580  CTPPSDiamondDetId detId_plane(rechits.detId());
581  detId_plane.setChannel(0);
582 
583  for (const auto &rechit : rechits) {
584  if (potPlots_.find(detId_pot) != potPlots_.end()) {
585  float UFSDShift = 0.0;
586  if (rechit.yWidth() < 3)
587  UFSDShift = 0.5;
588 
589  TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F();
590  TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
591  int startBin =
592  hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth());
593  const int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
594  for (int i = 0; i < numOfBins; ++i) {
595  potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift,
596  hitHistoTmpYAxis->GetBinCenter(startBin + i));
597  if (!perLSsaving_ && plotOnline_)
598  potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(detId.plane() + UFSDShift,
599  hitHistoTmpYAxis->GetBinCenter(startBin + i));
600  }
601 
602  //All plots with Time
603  if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) {
604  for (int i = 0; i < numOfBins; ++i)
605  potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + UFSDShift,
606  hitHistoTmpYAxis->GetBinCenter(startBin + i));
607 
608  potPlots_[detId_pot].recHitTime->Fill(rechit.time());
609  if (plotOnline_) {
610  potPlots_[detId_pot].amplitude->Fill(rechit.amplitude());
611  potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane());
612 
613  // Plane Plots
614  if (planePlots_.find(detId_plane) != planePlots_.end()) {
615  TH1F *hitProfileHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F();
616  const int startBin = hitProfileHistoTmp->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] -
617  0.5 * rechit.xWidth());
618  for (int i = 0; i < numOfBins; ++i)
619  hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin + i));
620 
621  if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end())
622  channelsPerPlaneWithTime[detId_plane]++;
623  else
624  //if it's the first channel, create new map element with the value of 1
625  channelsPerPlaneWithTime[detId_plane] = 1;
626  }
627 
628  if (channelPlots_.find(detId) != channelPlots_.end()) {
629  potPlots_[detId_pot].triggerCellTime->Fill(rechit.sampicThresholdTime());
630  channelPlots_[detId].triggerCellTime->Fill(rechit.sampicThresholdTime());
631  channelPlots_[detId].recHitTime->Fill(rechit.time());
632  channelPlots_[detId].amplitude->Fill(rechit.amplitude());
633  }
634  }
635  }
636  }
637  }
638  }
639  // End RecHits
640 
641  // Using CTPPSDiamondLocalTrack
642  for (const auto &tracks : *timingLocalTracks) {
643  CTPPSDiamondDetId detId_pot(tracks.detId());
644  detId_pot.setPlane(0);
645  detId_pot.setChannel(0);
646  const CTPPSDiamondDetId detId_near(tracks.detId());
647 
648  for (const auto &track : tracks) {
649  if (!track.isValid())
650  continue;
651  if (potPlots_.find(detId_pot) == potPlots_.end())
652  continue;
653 
654  TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
655  const int startBin =
656  trackHistoInTimeTmp->FindBin(track.x0() - horizontalShiftOfDiamond_[detId_pot] - track.x0Sigma());
657  const int numOfBins = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
658  for (int i = 0; i < numOfBins; ++i) {
659  trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin + i));
660  }
661 
662  //this plot was made with 2 stations per arm in mind
663  for (const auto &tracks_far : *timingLocalTracks) {
664  CTPPSDiamondDetId detId_far(tracks_far.detId());
665  detId_far.setPlane(0);
666  detId_far.setChannel(0);
667  if (detId_near.arm() != detId_far.arm() || detId_near.station() == detId_far.station())
668  continue;
669  for (const auto &track_far : tracks_far) {
670  if (!track.isValid())
671  continue;
672  if (sectorPlots_.find(detId_far.armId()) == sectorPlots_.end())
673  continue;
674  TH2F *trackHistoTmp = sectorPlots_[detId_far.armId()].trackCorrelation->getTH2F();
675  TAxis *trackHistoTmpXAxis = trackHistoTmp->GetXaxis();
676  TAxis *trackHistoTmpYAxis = trackHistoTmp->GetYaxis();
677  const int startBin_far =
678  trackHistoTmpYAxis->FindBin(track_far.x0() - horizontalShiftOfDiamond_[detId_far] - track_far.x0Sigma());
679  const int numOfBins_far = 2 * track_far.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
680  for (int i = 0; i < numOfBins; ++i) {
681  for (int y = 0; y < numOfBins_far; ++y) {
682  trackHistoTmp->Fill(trackHistoTmpXAxis->GetBinCenter(startBin + i),
683  trackHistoTmpYAxis->GetBinCenter(startBin_far + y));
684  if (tracks.size() < 3 && tracks_far.size() < trackCorrelationThreshold_)
685  sectorPlots_[detId_far.armId()].trackCorrelationLowMultiplicity->Fill(
686  trackHistoTmpXAxis->GetBinCenter(startBin + i), trackHistoTmpYAxis->GetBinCenter(startBin_far + y));
687  }
688  }
689  }
690  }
691  }
692  }
693  if (plotOnline_) {
694  for (auto &plt : potPlots_) {
695  plt.second.planesWithDigis->Fill(plt.second.planesWithDigisSet.size());
696  plt.second.planesWithDigisSet.clear();
697  plt.second.planesWithTime->Fill(plt.second.planesWithTimeSet.size());
698  plt.second.planesWithTimeSet.clear();
699  }
700 
701  for (const auto &plt : channelsPerPlane)
702  planePlots_[plt.first].hitMultiplicity->Fill(plt.second);
703 
704  for (const auto &plt : channelsPerPlaneWithTime)
705  planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second);
706  }
707  timeOfPreviousEvent_ = event.time().value();
708 }
edm::TimeValue_t timeOfPreviousEvent_
void setPlane(uint32_t channel)
void setChannel(uint32_t channel)
std::unordered_map< unsigned int, PlanePlots > planePlots_
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const double SAMPIC_ADC_V
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
auto const & tracks
cannot be loose
std::unordered_map< unsigned int, double > horizontalShiftOfDiamond_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::DetSetVector< TotemTimingLocalTrack > > tokenTrack_
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
std::unordered_map< unsigned int, PotPlots > potPlots_
Definition: event.py:1
Log< level::Error, true > LogProblem
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

◆ bookHistograms()

void DiamondSampicDQMSource::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >.

Definition at line 422 of file DiamondSampicDQMSource.cc.

References CTPPSDetId::arm(), CTPPSDetId::armId(), dqm::implementation::NavigatorBase::cd(), CTPPSDiamondDetId::channel(), channelPlots_, CTPPSDiamondDetId::check(), ctppsGeometryRunToken_, relativeConstraints::geom, edm::EventSetup::getData(), globalPlot_, CTPPSDiamondDetId::plane(), planePlots_, plotOnline_, potPlots_, CTPPSDetId::rp(), sectorPlots_, dqm::implementation::NavigatorBase::setCurrentFolder(), and CTPPSDetId::station().

424  {
425  ibooker.cd();
426  ibooker.setCurrentFolder("CTPPS/DiamondSampic");
427 
429  for (auto it = geom->beginSensor(); it != geom->endSensor(); ++it) {
430  if (!CTPPSDiamondDetId::check(it->first))
431  continue;
432  const CTPPSDiamondDetId detid(it->first);
433 
434  sectorPlots_[detid.armId()] = SectorPlots(ibooker, detid.armId(), plotOnline_);
435 
436  const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp());
437  potPlots_[rpId] = PotPlots(ibooker, rpId, plotOnline_);
438 
439  if (plotOnline_) {
440  globalPlot_ = GlobalPlots(ibooker);
441  const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(), detid.plane());
442  planePlots_[plId] = PlanePlots(ibooker, plId);
443 
444  const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel());
445  channelPlots_[chId] = ChannelPlots(ibooker, chId);
446  }
447  }
448 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::unordered_map< unsigned int, PlanePlots > planePlots_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:30
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< unsigned int, PotPlots > potPlots_
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

◆ changePathToSampic()

std::string DiamondSampicDQMSource::changePathToSampic ( std::string  path)
staticprivate

◆ dqmBeginRun()

void DiamondSampicDQMSource::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< totemds::Cache > >.

Definition at line 403 of file DiamondSampicDQMSource.cc.

References CTPPSDiamondDetId::check(), ctppsGeometryRunToken_, relativeConstraints::geom, edm::EventSetup::getData(), DetGeomDesc::getDiamondDimensions(), horizontalShiftOfDiamond_, CTPPSDetId::rpId(), DetGeomDesc::translation(), and DiamondDimensions::xHalfWidth.

403  {
404  // Get detector shifts from the geometry (if present)
406  for (auto it = geom->beginSensor(); it != geom->endSensor(); it++) {
407  if (!CTPPSDiamondDetId::check(it->first))
408  continue;
409  const CTPPSDiamondDetId detid(it->first);
410 
411  const DetGeomDesc *det = geom->sensorNoThrow(detid);
412  if (det)
413  horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth;
414  else
415  edm::LogProblem("DiamondSampicCalibrationDQMSource") << "ERROR: no descriptor for detId";
416  }
417  //horizontalShiftOfDiamond_=0;//unlock the shift
418 }
const Translation & translation() const
Definition: DetGeomDesc.h:80
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const DiamondDimensions & getDiamondDimensions() const
Definition: DetGeomDesc.h:90
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:30
std::unordered_map< unsigned int, double > horizontalShiftOfDiamond_
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Log< level::Error, true > LogProblem

◆ globalBeginLuminosityBlock()

std::shared_ptr< totemds::Cache > DiamondSampicDQMSource::globalBeginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
) const
overrideprotected

Definition at line 452 of file DiamondSampicDQMSource.cc.

References ztail::d, perLSsaving_, plotFactory::plot, plotOnline_, and potPlots_.

453  {
454  auto d = std::make_shared<totemds::Cache>();
455  d->hitDistribution2dMap.reserve(potPlots_.size());
456  if (!perLSsaving_ && plotOnline_)
457  for (auto &plot : potPlots_)
458  d->hitDistribution2dMap[plot.first] =
459  std::unique_ptr<TH2F>(static_cast<TH2F *>(plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
460  return d;
461 }
d
Definition: ztail.py:151
std::unordered_map< unsigned int, PotPlots > potPlots_

◆ globalEndLuminosityBlock()

void DiamondSampicDQMSource::globalEndLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup  
)
overrideprotected

Definition at line 712 of file DiamondSampicDQMSource.cc.

References CTPPSDetId::arm(), CTPPSDetId::armId(), CTPPSDiamondDetId::channel(), channelPlots_, DiamondSampicDQMSource::GlobalPlots::digiSentPercentage, dqm::impl::MonitorElement::getTH2F(), globalPlot_, edm::LuminosityBlock::index(), perLSsaving_, CTPPSDiamondDetId::plane(), plotFactory::plot, plotOnline_, potPlots_, dqm::impl::MonitorElement::Reset(), CTPPSDetId::rp(), and sectorPlots_.

712  {
713  auto lumiCache = luminosityBlockCache(iLumi.index());
714  if (!perLSsaving_ && plotOnline_) {
715  for (auto &plot : potPlots_)
716  *(plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[plot.first]);
718  for (auto &plot : sectorPlots_)
719  plot.second.digiSentPercentage->Reset();
720  TH2F *hitHistoGlobalTmp = globalPlot_.digiSentPercentage->getTH2F();
721  for (auto &plot : potPlots_) {
722  TH2F *hitHistoTmp = plot.second.digiSentPercentage->getTH2F();
723  TH2F *histoSent = plot.second.digiSent->getTH2F();
724  TH2F *histoAll = plot.second.digiAll->getTH2F();
725 
726  hitHistoTmp->Divide(histoSent, histoAll);
727  hitHistoTmp->Scale(100);
728  hitHistoGlobalTmp->Add(hitHistoTmp, 1);
729 
730  plot.second.baseline->Reset();
731  plot.second.noiseRMS->Reset();
732  plot.second.meanAmplitude->Reset();
733  plot.second.cellOfMax->Reset();
734  //plot.second.hitRate->Reset();
735  CTPPSDiamondDetId rpId(plot.first);
736  TH2F *hitHistoSectorTmp = sectorPlots_[rpId.armId()].digiSentPercentage->getTH2F();
737  hitHistoSectorTmp->Add(hitHistoTmp, 1);
738 
739  for (auto &chPlot : channelPlots_) {
740  CTPPSDiamondDetId chId(chPlot.first);
741  if (chId.arm() == rpId.arm() && chId.rp() == rpId.rp()) {
742  plot.second.baseline->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetMean());
743  plot.second.noiseRMS->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetRMS());
744  plot.second.meanAmplitude->Fill(chId.plane(), chId.channel(), chPlot.second.amplitude->getTH1F()->GetMean());
745  plot.second.cellOfMax->Fill(chId.plane(), chId.channel(), chPlot.second.cellOfMax->getTH1F()->GetMean());
746  //auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[chPlot.first];
747  //plot.second.hitRate->Fill(chId.plane(), chId.channel(), (double)hitsCounterPerLumisection * HIT_RATE_FACTOR);
748  }
749  }
750  }
751 
752  // for (auto &plot : channelPlots_) {
753  // auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[plot.first];
754  // if (hitsCounterPerLumisection != 0) {
755  // plot.second.hitRate->Fill((double)hitsCounterPerLumisection * HIT_RATE_FACTOR);
756  // }
757  // }
758  }
759 }
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
LuminosityBlockIndex index() const
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< unsigned int, PotPlots > potPlots_
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

Member Data Documentation

◆ channelPlots_

std::unordered_map<unsigned int, ChannelPlots> DiamondSampicDQMSource::channelPlots_
private

Definition at line 190 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), bookHistograms(), and globalEndLuminosityBlock().

◆ ctppsGeometryRunToken_

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> DiamondSampicDQMSource::ctppsGeometryRunToken_
private

Definition at line 83 of file DiamondSampicDQMSource.cc.

Referenced by bookHistograms(), and dqmBeginRun().

◆ DISPLAY_RESOLUTION_FOR_HITS_MM

const double DiamondSampicDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05
staticprivate

Definition at line 71 of file DiamondSampicDQMSource.cc.

◆ DQM_FRACTION_OF_EVENTS

const double DiamondSampicDQMSource::DQM_FRACTION_OF_EVENTS = 1.
staticprivate

Definition at line 68 of file DiamondSampicDQMSource.cc.

◆ globalPlot_

GlobalPlots DiamondSampicDQMSource::globalPlot_
private

Definition at line 102 of file DiamondSampicDQMSource.cc.

Referenced by bookHistograms(), and globalEndLuminosityBlock().

◆ HIT_RATE_FACTOR

const double DiamondSampicDQMSource::HIT_RATE_FACTOR = DQM_FRACTION_OF_EVENTS / SEC_PER_LUMI_SECTION
staticprivate

Definition at line 70 of file DiamondSampicDQMSource.cc.

◆ horizontalShiftOfDiamond_

std::unordered_map<unsigned int, double> DiamondSampicDQMSource::horizontalShiftOfDiamond_
private

Definition at line 92 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), and dqmBeginRun().

◆ INV_DISPLAY_RESOLUTION_FOR_HITS_MM

const double DiamondSampicDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM
staticprivate

◆ LHC_CLOCK_PERIOD_NS

const double DiamondSampicDQMSource::LHC_CLOCK_PERIOD_NS = 24.95
staticprivate

Definition at line 67 of file DiamondSampicDQMSource.cc.

◆ perLSsaving_

bool DiamondSampicDQMSource::perLSsaving_
private

◆ planePlots_

std::unordered_map<unsigned int, PlanePlots> DiamondSampicDQMSource::planePlots_
private

Definition at line 167 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ plotOnline_

bool DiamondSampicDQMSource::plotOnline_
private

◆ potPlots_

std::unordered_map<unsigned int, PotPlots> DiamondSampicDQMSource::potPlots_
private

◆ SAMPIC_ADC_V

const double DiamondSampicDQMSource::SAMPIC_ADC_V = 1. / 256
staticprivate

Definition at line 75 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ samplesForNoise_

unsigned int DiamondSampicDQMSource::samplesForNoise_
private

Definition at line 85 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ SEC_PER_LUMI_SECTION

const double DiamondSampicDQMSource::SEC_PER_LUMI_SECTION = 23.31
staticprivate

Definition at line 64 of file DiamondSampicDQMSource.cc.

◆ sectorPlots_

std::unordered_map<unsigned int, SectorPlots> DiamondSampicDQMSource::sectorPlots_
private

Definition at line 112 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), bookHistograms(), and globalEndLuminosityBlock().

◆ timeOfPreviousEvent_

edm::TimeValue_t DiamondSampicDQMSource::timeOfPreviousEvent_
private

Definition at line 90 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ tokenDigi_

edm::EDGetTokenT<edm::DetSetVector<TotemTimingDigi> > DiamondSampicDQMSource::tokenDigi_
private

Definition at line 78 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ tokenFEDInfo_

edm::EDGetTokenT<std::vector<TotemFEDInfo> > DiamondSampicDQMSource::tokenFEDInfo_
private

Definition at line 81 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ tokenLocalTrack_

edm::EDGetTokenT<edm::DetSetVector<TotemRPLocalTrack> > DiamondSampicDQMSource::tokenLocalTrack_
private

Definition at line 77 of file DiamondSampicDQMSource.cc.

◆ tokenRecHit_

edm::EDGetTokenT<edm::DetSetVector<TotemTimingRecHit> > DiamondSampicDQMSource::tokenRecHit_
private

Definition at line 79 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ tokenTrack_

edm::EDGetTokenT<edm::DetSetVector<TotemTimingLocalTrack> > DiamondSampicDQMSource::tokenTrack_
private

Definition at line 80 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ trackCorrelationThreshold_

unsigned int DiamondSampicDQMSource::trackCorrelationThreshold_
private

Definition at line 89 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

◆ verbosity_

unsigned int DiamondSampicDQMSource::verbosity_
private

Definition at line 86 of file DiamondSampicDQMSource.cc.

Referenced by analyze().