CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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
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, ChannelPlots
channelPlots_
 
edm::ESGetToken< CTPPSGeometry,
VeryForwardRealGeometryRecord
ctppsGeometryRunToken_
 
GlobalPlots globalPlot_
 
std::unordered_map< unsigned
int, double > 
horizontalShiftOfDiamond_
 
bool perLSsaving_
 
std::unordered_map< unsigned
int, PlanePlots
planePlots_
 
bool plotOnline_
 
std::unordered_map< unsigned
int, PotPlots
potPlots_
 
unsigned int samplesForNoise_
 
std::unordered_map< unsigned
int, SectorPlots
sectorPlots_
 
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 ( 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 getUntrackedParameter(std::string const &, T const &) const
edm::TimeValue_t timeOfPreviousEvent_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::DetSetVector< TotemTimingLocalTrack > > tokenTrack_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
DiamondSampicDQMSource::~DiamondSampicDQMSource ( )
override

Definition at line 399 of file DiamondSampicDQMSource.cc.

399 {}

Member Function Documentation

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 stage2BMTFBufferRaw_cfi::boardId, edm::EventBase::bunchCrossing(), channelPlots_, edm::Event::getLuminosityBlock(), horizontalShiftOfDiamond_, mps_fire::i, edm::LuminosityBlock::index(), 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_FULL_cff::track, trackCorrelationThreshold_, tracks, 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  channelsPerPlane[detId_plane] = 0;
550  }
551 
552  // Channel Plots
553  if (channelPlots_.find(detId) != channelPlots_.end()) {
554  channelPlots_[detId].activityPerBX->Fill(event.bunchCrossing());
555 
556  for (auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
557  channelPlots_[detId].dataSamplesRaw->Fill(*it);
558  for (unsigned short i = 0; i < samplesForNoise_; ++i)
559  channelPlots_[detId].noiseSamples->Fill(SAMPIC_ADC_V * digi.sampleAt(i));
560 
561  unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin();
562  channelPlots_[detId].cellOfMax->Fill((int)cellOfMax);
563 
564  // if (timeOfPreviousEvent_ != 0)
565  // channelPlots_[detId].hitTime->Fill(1e-3 * LHC_CLOCK_PERIOD_NS *
566  // (event.time().value() - timeOfPreviousEvent_));
567  ++(lumiCache->hitsCounterMap[detId]);
568  }
569  }
570  }
571  }
572  // End digis
573 
574  for (const auto &rechits : *timingRecHits) {
575  const CTPPSDiamondDetId detId(rechits.detId());
576  CTPPSDiamondDetId detId_pot(rechits.detId());
577  detId_pot.setPlane(0);
578  detId_pot.setChannel(0);
579  CTPPSDiamondDetId detId_plane(rechits.detId());
580  detId_plane.setChannel(0);
581 
582  for (const auto &rechit : rechits) {
583  if (potPlots_.find(detId_pot) != potPlots_.end()) {
584  float UFSDShift = 0.0;
585  if (rechit.yWidth() < 3)
586  UFSDShift = 0.5;
587 
588  TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F();
589  TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
590  int startBin =
591  hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth());
592  const int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
593  for (int i = 0; i < numOfBins; ++i) {
594  potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift,
595  hitHistoTmpYAxis->GetBinCenter(startBin + i));
596  if (!perLSsaving_ && plotOnline_)
597  potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(detId.plane() + UFSDShift,
598  hitHistoTmpYAxis->GetBinCenter(startBin + i));
599  }
600 
601  //All plots with Time
602  if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) {
603  for (int i = 0; i < numOfBins; ++i)
604  potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + UFSDShift,
605  hitHistoTmpYAxis->GetBinCenter(startBin + i));
606 
607  potPlots_[detId_pot].recHitTime->Fill(rechit.time());
608  if (plotOnline_) {
609  potPlots_[detId_pot].amplitude->Fill(rechit.amplitude());
610  potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane());
611 
612  // Plane Plots
613  if (planePlots_.find(detId_plane) != planePlots_.end()) {
614  TH1F *hitProfileHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F();
615  const int startBin = hitProfileHistoTmp->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] -
616  0.5 * rechit.xWidth());
617  for (int i = 0; i < numOfBins; ++i)
618  hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin + i));
619 
620  if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end())
621  channelsPerPlaneWithTime[detId_plane]++;
622  else
623  channelsPerPlaneWithTime[detId_plane] = 0;
624  }
625 
626  if (channelPlots_.find(detId) != channelPlots_.end()) {
627  potPlots_[detId_pot].triggerCellTime->Fill(rechit.sampicThresholdTime());
628  channelPlots_[detId].triggerCellTime->Fill(rechit.sampicThresholdTime());
629  channelPlots_[detId].recHitTime->Fill(rechit.time());
630  channelPlots_[detId].amplitude->Fill(rechit.amplitude());
631  }
632  }
633  }
634  }
635  }
636  }
637  // End RecHits
638 
639  // Using CTPPSDiamondLocalTrack
640  for (const auto &tracks : *timingLocalTracks) {
641  CTPPSDiamondDetId detId_pot(tracks.detId());
642  detId_pot.setPlane(0);
643  detId_pot.setChannel(0);
644  const CTPPSDiamondDetId detId_near(tracks.detId());
645 
646  for (const auto &track : tracks) {
647  if (!track.isValid())
648  continue;
649  if (potPlots_.find(detId_pot) == potPlots_.end())
650  continue;
651 
652  TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F();
653  const int startBin =
654  trackHistoInTimeTmp->FindBin(track.x0() - horizontalShiftOfDiamond_[detId_pot] - track.x0Sigma());
655  const int numOfBins = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
656  for (int i = 0; i < numOfBins; ++i) {
657  trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin + i));
658  }
659 
660  //this plot was made with 2 stations per arm in mind
661  for (const auto &tracks_far : *timingLocalTracks) {
662  CTPPSDiamondDetId detId_far(tracks_far.detId());
663  detId_far.setPlane(0);
664  detId_far.setChannel(0);
665  if (detId_near.arm() != detId_far.arm() || detId_near.station() == detId_far.station())
666  continue;
667  for (const auto &track_far : tracks_far) {
668  if (!track.isValid())
669  continue;
670  if (sectorPlots_.find(detId_far.armId()) == sectorPlots_.end())
671  continue;
672  TH2F *trackHistoTmp = sectorPlots_[detId_far.armId()].trackCorrelation->getTH2F();
673  TAxis *trackHistoTmpXAxis = trackHistoTmp->GetXaxis();
674  TAxis *trackHistoTmpYAxis = trackHistoTmp->GetYaxis();
675  const int startBin_far =
676  trackHistoTmpYAxis->FindBin(track_far.x0() - horizontalShiftOfDiamond_[detId_far] - track_far.x0Sigma());
677  const int numOfBins_far = 2 * track_far.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM;
678  for (int i = 0; i < numOfBins; ++i) {
679  for (int y = 0; y < numOfBins_far; ++y) {
680  trackHistoTmp->Fill(trackHistoTmpXAxis->GetBinCenter(startBin + i),
681  trackHistoTmpYAxis->GetBinCenter(startBin_far + y));
682  if (tracks.size() < 3 && tracks_far.size() < trackCorrelationThreshold_)
683  sectorPlots_[detId_far.armId()].trackCorrelationLowMultiplicity->Fill(
684  trackHistoTmpXAxis->GetBinCenter(startBin + i), trackHistoTmpYAxis->GetBinCenter(startBin_far + y));
685  }
686  }
687  }
688  }
689  }
690  }
691  if (plotOnline_) {
692  for (auto &plt : potPlots_) {
693  plt.second.planesWithDigis->Fill(plt.second.planesWithDigisSet.size());
694  plt.second.planesWithDigisSet.clear();
695  plt.second.planesWithTime->Fill(plt.second.planesWithTimeSet.size());
696  plt.second.planesWithTimeSet.clear();
697  }
698 
699  for (const auto &plt : channelsPerPlane)
700  planePlots_[plt.first].hitMultiplicity->Fill(plt.second);
701 
702  for (const auto &plt : channelsPerPlaneWithTime)
703  planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second);
704  }
705  timeOfPreviousEvent_ = event.time().value();
706 }
LuminosityBlockIndex index() const
edm::TimeValue_t timeOfPreviousEvent_
void setPlane(uint32_t channel)
void setChannel(uint32_t channel)
std::unordered_map< unsigned int, PlanePlots > planePlots_
int bunchCrossing() const
Definition: EventBase.h:64
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
auto const & tracks
cannot be loose
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const double SAMPIC_ADC_V
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:100
bool isValid() const
Definition: HandleBase.h:70
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
std::unordered_map< unsigned int, double > horizontalShiftOfDiamond_
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_
Log< level::Error, true > LogProblem
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
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(), CTPPSGeometry::beginSensor(), dqm::implementation::NavigatorBase::cd(), CTPPSDiamondDetId::channel(), channelPlots_, CTPPSDiamondDetId::check(), ctppsGeometryRunToken_, CTPPSGeometry::endSensor(), 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_
mapType::const_iterator beginSensor() const
begin iterator over sensors
Definition: CTPPSGeometry.h:67
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
mapType::const_iterator endSensor() const
end iterator over sensors
Definition: CTPPSGeometry.h:69
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_
std::string DiamondSampicDQMSource::changePathToSampic ( std::string  path)
staticprivate
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 CTPPSGeometry::beginSensor(), CTPPSDiamondDetId::check(), ctppsGeometryRunToken_, CTPPSGeometry::endSensor(), relativeConstraints::geom, edm::EventSetup::getData(), DetGeomDesc::getDiamondDimensions(), horizontalShiftOfDiamond_, CTPPSDetId::rpId(), CTPPSGeometry::sensorNoThrow(), 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
const DiamondDimensions & getDiamondDimensions() const
Definition: DetGeomDesc.h:90
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
mapType::const_iterator beginSensor() const
begin iterator over sensors
Definition: CTPPSGeometry.h:67
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const DetGeomDesc * sensorNoThrow(unsigned int id) const noexcept
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_
mapType::const_iterator endSensor() const
end iterator over sensors
Definition: CTPPSGeometry.h:69
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Log< level::Error, true > LogProblem
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_, bigModule::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 }
tuple d
Definition: ztail.py:151
def plot
Definition: bigModule.py:18
std::unordered_map< unsigned int, PotPlots > potPlots_
void DiamondSampicDQMSource::globalEndLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup  
)
overrideprotected

Definition at line 710 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(), bigModule::plot(), plotOnline_, potPlots_, dqm::impl::MonitorElement::Reset(), CTPPSDetId::rp(), and sectorPlots_.

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

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

Definition at line 190 of file DiamondSampicDQMSource.cc.

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

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

Definition at line 83 of file DiamondSampicDQMSource.cc.

Referenced by bookHistograms(), and dqmBeginRun().

const double DiamondSampicDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05
staticprivate

Definition at line 71 of file DiamondSampicDQMSource.cc.

const double DiamondSampicDQMSource::DQM_FRACTION_OF_EVENTS = 1.
staticprivate

Definition at line 68 of file DiamondSampicDQMSource.cc.

GlobalPlots DiamondSampicDQMSource::globalPlot_
private

Definition at line 102 of file DiamondSampicDQMSource.cc.

Referenced by bookHistograms(), and globalEndLuminosityBlock().

const double DiamondSampicDQMSource::HIT_RATE_FACTOR = DQM_FRACTION_OF_EVENTS / SEC_PER_LUMI_SECTION
staticprivate

Definition at line 70 of file DiamondSampicDQMSource.cc.

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

Definition at line 92 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), and dqmBeginRun().

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

Definition at line 67 of file DiamondSampicDQMSource.cc.

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

Definition at line 167 of file DiamondSampicDQMSource.cc.

Referenced by analyze(), and bookHistograms().

bool DiamondSampicDQMSource::plotOnline_
private
std::unordered_map<unsigned int, PotPlots> DiamondSampicDQMSource::potPlots_
private
const double DiamondSampicDQMSource::SAMPIC_ADC_V = 1. / 256
staticprivate

Definition at line 75 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

unsigned int DiamondSampicDQMSource::samplesForNoise_
private

Definition at line 85 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

const double DiamondSampicDQMSource::SEC_PER_LUMI_SECTION = 23.31
staticprivate

Definition at line 64 of file DiamondSampicDQMSource.cc.

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

Definition at line 112 of file DiamondSampicDQMSource.cc.

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

edm::TimeValue_t DiamondSampicDQMSource::timeOfPreviousEvent_
private

Definition at line 90 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

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

Definition at line 78 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

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

Definition at line 81 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

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

Definition at line 77 of file DiamondSampicDQMSource.cc.

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

Definition at line 79 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

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

Definition at line 80 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

unsigned int DiamondSampicDQMSource::trackCorrelationThreshold_
private

Definition at line 89 of file DiamondSampicDQMSource.cc.

Referenced by analyze().

unsigned int DiamondSampicDQMSource::verbosity_
private

Definition at line 86 of file DiamondSampicDQMSource.cc.

Referenced by analyze().