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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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.

387  tokenRecHit_(
389  tokenTrack_(
391  tokenFEDInfo_(consumes<std::vector<TotemFEDInfo>>(ps.getUntrackedParameter<edm::InputTag>("tagFEDInfo"))),
392  ctppsGeometryRunToken_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord, edm::Transition::BeginRun>()),
393  samplesForNoise_(ps.getUntrackedParameter<unsigned int>("samplesForNoise", 5)),
394  verbosity_(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
395  plotOnline_(ps.getUntrackedParameter<bool>("plotOnline", true)),
396  perLSsaving_(ps.getUntrackedParameter<bool>("perLSsaving", false)),
397  trackCorrelationThreshold_(ps.getUntrackedParameter<unsigned int>("trackCorrelationThreshold", 3)),
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 402 of file DiamondSampicDQMSource.cc.

402 {}

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 468 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_2023v12_cff::track, trackCorrelationThreshold_, pwdgSkimBPark_cfi::tracks, validateGeometry_cfg::valid, verbosity_, and y.

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

427  {
428  ibooker.cd();
429  ibooker.setCurrentFolder("CTPPS/DiamondSampic");
430 
432  for (auto it = geom->beginSensor(); it != geom->endSensor(); ++it) {
433  if (!CTPPSDiamondDetId::check(it->first))
434  continue;
435  const CTPPSDiamondDetId detid(it->first);
436 
437  sectorPlots_[detid.armId()] = SectorPlots(ibooker, detid.armId(), plotOnline_);
438 
439  const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp());
440  potPlots_[rpId] = PotPlots(ibooker, rpId, plotOnline_);
441 
442  if (plotOnline_) {
443  globalPlot_ = GlobalPlots(ibooker);
444  const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(), detid.plane());
445  planePlots_[plId] = PlanePlots(ibooker, plId);
446 
447  const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel());
448  channelPlots_[chId] = ChannelPlots(ibooker, chId);
449  }
450  }
451 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::unordered_map< unsigned int, PlanePlots > planePlots_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
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 406 of file DiamondSampicDQMSource.cc.

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

406  {
407  // Get detector shifts from the geometry (if present)
409  for (auto it = geom->beginSensor(); it != geom->endSensor(); it++) {
410  if (!CTPPSDiamondDetId::check(it->first))
411  continue;
412  const CTPPSDiamondDetId detid(it->first);
413 
414  const DetGeomDesc *det = geom->sensorNoThrow(detid);
415  if (det)
416  horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth;
417  else
418  edm::LogProblem("DiamondSampicCalibrationDQMSource") << "ERROR: no descriptor for detId";
419  }
420  //horizontalShiftOfDiamond_=0;//unlock the shift
421 }
const Translation & translation() const
Definition: DetGeomDesc.h:80
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
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 455 of file DiamondSampicDQMSource.cc.

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

456  {
457  auto d = std::make_shared<totemds::Cache>();
458  d->hitDistribution2dMap.reserve(potPlots_.size());
459  if (!perLSsaving_ && plotOnline_)
460  for (auto &plot : potPlots_)
461  d->hitDistribution2dMap[plot.first] =
462  std::unique_ptr<TH2F>(static_cast<TH2F *>(plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
463  return d;
464 }
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 715 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_.

715  {
716  auto lumiCache = luminosityBlockCache(iLumi.index());
717  if (!perLSsaving_ && plotOnline_) {
718  for (auto &plot : potPlots_)
719  *(plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[plot.first]);
721  for (auto &plot : sectorPlots_)
722  plot.second.digiSentPercentage->Reset();
723  TH2F *hitHistoGlobalTmp = globalPlot_.digiSentPercentage->getTH2F();
724  for (auto &plot : potPlots_) {
725  TH2F *hitHistoTmp = plot.second.digiSentPercentage->getTH2F();
726  TH2F *histoSent = plot.second.digiSent->getTH2F();
727  TH2F *histoAll = plot.second.digiAll->getTH2F();
728 
729  hitHistoTmp->Divide(histoSent, histoAll);
730  hitHistoTmp->Scale(100);
731  hitHistoGlobalTmp->Add(hitHistoTmp, 1);
732 
733  plot.second.baseline->Reset();
734  plot.second.noiseRMS->Reset();
735  plot.second.meanAmplitude->Reset();
736  plot.second.cellOfMax->Reset();
737  //plot.second.hitRate->Reset();
738  CTPPSDiamondDetId rpId(plot.first);
739  TH2F *hitHistoSectorTmp = sectorPlots_[rpId.armId()].digiSentPercentage->getTH2F();
740  hitHistoSectorTmp->Add(hitHistoTmp, 1);
741 
742  for (auto &chPlot : channelPlots_) {
743  CTPPSDiamondDetId chId(chPlot.first);
744  if (chId.arm() == rpId.arm() && chId.rp() == rpId.rp()) {
745  plot.second.baseline->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetMean());
746  plot.second.noiseRMS->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetRMS());
747  plot.second.meanAmplitude->Fill(chId.plane(), chId.channel(), chPlot.second.amplitude->getTH1F()->GetMean());
748  plot.second.cellOfMax->Fill(chId.plane(), chId.channel(), chPlot.second.cellOfMax->getTH1F()->GetMean());
749  //auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[chPlot.first];
750  //plot.second.hitRate->Fill(chId.plane(), chId.channel(), (double)hitsCounterPerLumisection * HIT_RATE_FACTOR);
751  }
752  }
753  }
754 
755  // for (auto &plot : channelPlots_) {
756  // auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[plot.first];
757  // if (hitsCounterPerLumisection != 0) {
758  // plot.second.hitRate->Fill((double)hitsCounterPerLumisection * HIT_RATE_FACTOR);
759  // }
760  // }
761  }
762 }
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().