196 path = path.substr(path.find(toReplace) + toReplace.length());
197 path =
"CTPPS/DiamondSampic/" +
path;
215 "sent digis percentage",
"sent digis percentage (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
227 trackCorrelation = ibooker.
book2D(
"tracks correlation near-far",
228 title +
" tracks correlation near-far;x (mm);x (mm)",
235 trackCorrelationLowMultiplicity =
236 ibooker.
book2D(
"tracks correlation with low multiplicity near-far",
237 title +
" tracks correlation with low multiplicity near-far;x (mm);x (mm)",
245 digiSentPercentage = ibooker.
book2D(
"sent digis percentage",
246 title +
" sent digis percentage (sampic);board + 0.5 sampic;channel",
265 ibooker.
book2D(
"digi distribution", title +
" digi distribution;plane;channel", 10, -0.5, 4.5, 12, 0, 12);
267 hitDistribution2d = ibooker.
book2D(
"hits in planes",
268 title +
" hits in planes;plane number;x (mm)",
275 hitDistribution2dWithTime = ibooker.
book2D(
"hits in planes with time",
276 title +
" hits in planes with time;plane number;x (mm)",
284 recHitTime = ibooker.
book1D(
"recHit time", title +
" recHit time; t (ns)", 500, -25, 25);
285 trackDistribution = ibooker.
book1D(
289 hitDistribution2d_lumisection =
290 ibooker.
book2D(
"hits in planes lumisection",
291 title +
" hits in planes in the last lumisection;plane number;x (mm)",
298 triggerCellTime = ibooker.
book1D(
"trigger cell time", title +
" Trigger Cell Time; t (ns)", 390, -25, 25);
299 activityPerBX = ibooker.
book1D(
"activity per BX CMS", title +
" Activity per BX;Event.BX", 3600, -1.5, 3598. + 0.5);
300 amplitude = ibooker.
book1D(
"amplitude", title +
" amplitude above baseline; amplitude (V)", 50, 0, 1);
301 baselineRMS = ibooker.
book2D(
"noise RMS", title +
" noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
303 ibooker.
book2D(
"mean amplitude", title +
" Mean Amplitude (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
304 cellOfMax = ibooker.
book2D(
"cell of max", title +
" cell of max (0-23);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
308 planesWithDigis = ibooker.
book1D(
"active planes digis",
309 title +
" active planes with digis sent (per event);number of active planes",
313 planesWithTime = ibooker.
book1D(
314 "active planes with time", title +
" active planes with time (per event);number of active planes", 6, -0.5, 5.5);
316 dataSamplesRaw = ibooker.
book1D(
"raw Samples", title +
" Raw Samples; ADC", 256, 0, 256);
318 baseline = ibooker.
book2D(
"baseline", title +
" baseline (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
319 noiseRMS = ibooker.
book2D(
"noise RMS", title +
" noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
321 digiSent = ibooker.
book2D(
322 "digis sent", title +
" digi sent (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
324 ibooker.
book2D(
"all digis", title +
" all digis(sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
325 digiSentPercentage = ibooker.
book2D(
"sent digis percentage",
326 title +
" sent digis percentage (sampic);board + 0.5 sampic;channel",
345 digiDistribution = ibooker.
book1D(
"digi distribution", title +
" digi distribution;channel", 12, 0, 12);
347 hitProfile = ibooker.
book1D(
"hit distribution with time",
348 title +
" hit distribution (with time);x(mm)",
353 hitMultiplicity = ibooker.
book1D(
"channels per plane", title +
" channels per plane; ch per plane", 13, -0.5, 12.5);
355 hitMultiplicityWithTime = ibooker.
book1D(
356 "channels per plane with time", title +
" channels per plane with time; ch per plane", 13, -0.5, 12.5);
368 activityPerBX = ibooker.
book1D(
"activity per BX", title +
" Activity per BX;Event.BX", 1000, -1.5, 998. + 0.5);
369 dataSamplesRaw = ibooker.
book1D(
"raw samples", title +
" Raw Samples; ADC", 256, 0, 256);
370 cellOfMax = ibooker.
book1D(
"cell of max", title +
" cell of max; cell", 24, 0, 24);
372 triggerCellTime = ibooker.
book1D(
"sampic trigger time", title +
" Sampic Trigger Time; t (ns)", 100, -25, 25);
373 recHitTime = ibooker.
book1D(
"recHit Time", title +
" recHit Time; t (ns)", 500, -25, 25);
374 amplitude = ibooker.
book1D(
"amplitude", title +
" amplitude above baseline; amplitude (V)", 50, 0, 1);
375 noiseSamples = ibooker.
book1D(
"noise samples", title +
" noise samples; V", 50, 0, 1);
390 samplesForNoise_(ps.getUntrackedParameter<unsigned int>(
"samplesForNoise", 5)),
391 verbosity_(ps.getUntrackedParameter<unsigned int>(
"verbosity", 0)),
415 edm::LogProblem(
"DiamondSampicCalibrationDQMSource") <<
"ERROR: no descriptor for detId";
454 auto d = std::make_shared<totemds::Cache>();
455 d->hitDistribution2dMap.reserve(
potPlots_.size());
458 d->hitDistribution2dMap[
plot.first] =
459 std::unique_ptr<TH2F>(
static_cast<TH2F *
>(
plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
481 valid &= timingDigis.
isValid();
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();
497 std::set<uint8_t> boardSet;
498 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
499 std::unordered_map<unsigned int, unsigned int> channelsPerPlaneWithTime;
503 for (
const auto &digis : *timingDigis) {
507 detId_pot.setChannel(0);
511 for (
const auto &digi : digis) {
514 potPlots_[detId_pot].digiDistribution->Fill(detId.plane(), detId.channel());
519 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it) {
520 potPlots_[detId_pot].dataSamplesRaw->Fill(*it);
523 float boardId = digi.eventInfo().hardwareBoardId() + 0.5 * digi.eventInfo().hardwareSampicId();
524 potPlots_[detId_pot].digiSent->Fill(boardId, digi.hardwareChannelId());
526 if (boardSet.find(digi.eventInfo().hardwareId()) == boardSet.end()) {
528 boardSet.insert(digi.eventInfo().hardwareId());
529 std::bitset<16> chMap(digi.eventInfo().channelMap());
530 for (
int i = 0;
i < 16; ++
i) {
532 potPlots_[detId_pot].digiAll->Fill(boardId,
i);
537 potPlots_[detId_pot].planesWithDigisSet.insert(detId.plane());
544 planePlots_[detId_plane].digiDistribution->Fill(detId.channel());
546 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
547 channelsPerPlane[detId_plane]++;
549 channelsPerPlane[detId_plane] = 0;
556 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
561 unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin();
567 ++(lumiCache->hitsCounterMap[detId]);
574 for (
const auto &
rechits : *timingRecHits) {
578 detId_pot.setChannel(0);
582 for (
const auto &rechit :
rechits) {
584 float UFSDShift = 0.0;
585 if (rechit.yWidth() < 3)
588 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
589 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
593 for (
int i = 0;
i < numOfBins; ++
i) {
594 potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift,
595 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
597 potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(detId.plane() + UFSDShift,
598 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
603 for (
int i = 0;
i < numOfBins; ++
i)
604 potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + UFSDShift,
605 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
607 potPlots_[detId_pot].recHitTime->Fill(rechit.time());
609 potPlots_[detId_pot].amplitude->Fill(rechit.amplitude());
610 potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane());
614 TH1F *hitProfileHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
616 0.5 * rechit.xWidth());
617 for (
int i = 0;
i < numOfBins; ++
i)
618 hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin +
i));
620 if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end())
621 channelsPerPlaneWithTime[detId_plane]++;
623 channelsPerPlaneWithTime[detId_plane] = 0;
627 potPlots_[detId_pot].triggerCellTime->Fill(rechit.sampicThresholdTime());
628 channelPlots_[detId].triggerCellTime->Fill(rechit.sampicThresholdTime());
640 for (
const auto &
tracks : *timingLocalTracks) {
643 detId_pot.setChannel(0);
647 if (!
track.isValid())
652 TH1F *trackHistoInTimeTmp =
potPlots_[detId_pot].trackDistribution->getTH1F();
656 for (
int i = 0;
i < numOfBins; ++
i) {
657 trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin +
i));
661 for (
const auto &tracks_far : *timingLocalTracks) {
664 detId_far.setChannel(0);
665 if (detId_near.arm() != detId_far.arm() || detId_near.station() == detId_far.station())
667 for (
const auto &track_far : tracks_far) {
668 if (!
track.isValid())
672 TH2F *trackHistoTmp =
sectorPlots_[detId_far.armId()].trackCorrelation->getTH2F();
673 TAxis *trackHistoTmpXAxis = trackHistoTmp->GetXaxis();
674 TAxis *trackHistoTmpYAxis = trackHistoTmp->GetYaxis();
675 const int startBin_far =
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));
683 sectorPlots_[detId_far.armId()].trackCorrelationLowMultiplicity->Fill(
684 trackHistoTmpXAxis->GetBinCenter(startBin +
i), trackHistoTmpYAxis->GetBinCenter(startBin_far +
y));
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();
699 for (
const auto &plt : channelsPerPlane)
700 planePlots_[plt.first].hitMultiplicity->Fill(plt.second);
702 for (
const auto &plt : channelsPerPlaneWithTime)
703 planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second);
711 auto lumiCache = luminosityBlockCache(iLumi.
index());
714 *(
plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[
plot.first]);
717 plot.second.digiSentPercentage->Reset();
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();
724 hitHistoTmp->Divide(histoSent, histoAll);
725 hitHistoTmp->Scale(100);
726 hitHistoGlobalTmp->Add(hitHistoTmp, 1);
728 plot.second.baseline->Reset();
729 plot.second.noiseRMS->Reset();
730 plot.second.meanAmplitude->Reset();
731 plot.second.cellOfMax->Reset();
734 TH2F *hitHistoSectorTmp = sectorPlots_[rpId.
armId()].digiSentPercentage->getTH2F();
735 hitHistoSectorTmp->Add(hitHistoTmp, 1);
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());
OptoRx headers and footers.
plots related to the whole system
MonitorElement * digiSentPercentage
static const double DISPLAY_RESOLUTION_FOR_HITS_MM
LuminosityBlockIndex index() const
edm::TimeValue_t timeOfPreviousEvent_
virtual void setCurrentFolder(std::string const &fullpath)
const Translation & translation() const
MonitorElement * dataSamplesRaw
void setPlane(uint32_t channel)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
MonitorElement * noiseRMS
void setChannel(uint32_t channel)
std::unordered_map< unsigned int, std::unique_ptr< TH2F > > hitDistribution2dMap
MonitorElement * hitProfile
void channelName(std::string &name, NameFlag flag=nFull) const
const DiamondDimensions & getDiamondDimensions() const
std::unordered_map< unsigned int, PlanePlots > planePlots_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryRunToken_
MonitorElement * planesWithDigis
int bunchCrossing() const
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
std::shared_ptr< totemds::Cache > globalBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const override
auto const & tracks
cannot be loose
MonitorElement * trackCorrelation
mapType::const_iterator beginSensor() const
begin iterator over sensors
MonitorElement * amplitude
MonitorElement * digiSent
plots related to one Diamond plane
MonitorElement * digiSentPercentage
MonitorElement * amplitude
A track fit through a single RP.
MonitorElement * hitDistribution2dWithTime
Event setup record containing the real (actual) geometry information.
plots related to one Diamond detector package
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static const double SEC_PER_LUMI_SECTION
bool getData(T &iHolder) const
MonitorElement * baseline
static const double DQM_FRACTION_OF_EVENTS
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
MonitorElement * activityPerBX
MonitorElement * meanAmplitude
MonitorElement * triggerCellTime
MonitorElement * activityPerBX
const DetGeomDesc * sensorNoThrow(unsigned int id) const noexcept
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
static const double HIT_RATE_FACTOR
MonitorElement * cellOfMax
MonitorElement * cellOfMax
~DiamondSampicDQMSource() override
static const double SAMPIC_ADC_V
MonitorElement * digiDistribution
MonitorElement * maxTimeAfterTrigger
MonitorElement * trackCorrelationLowMultiplicity
void rpName(std::string &name, NameFlag flag=nFull) const
MonitorElement * dataSamplesRaw
LuminosityBlock const & getLuminosityBlock() const
MonitorElement * hitMultiplicityWithTime
MonitorElement * planesWithTime
void armName(std::string &name, NameFlag flag=nFull) const
unsigned long long TimeValue_t
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
The manager class for TOTEM RP geometry.
std::set< unsigned int > planesWithTimeSet
MonitorElement * recHitTime
MonitorElement * triggerCellTime
std::unordered_map< unsigned int, double > horizontalShiftOfDiamond_
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * digiSentPercentage
static std::string changePathToSampic(std::string path)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
mapType::const_iterator endSensor() const
end iterator over sensors
void planeName(std::string &name, NameFlag flag=nFull) const
plots related to one Diamond channel
DiamondSampicDQMSource(const edm::ParameterSet &)
MonitorElement * hitMultiplicity
unsigned int trackCorrelationThreshold_
MonitorElement * recHitTime
std::set< unsigned int > planesWithDigisSet
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
static const double LHC_CLOCK_PERIOD_NS
edm::EDGetTokenT< edm::DetSetVector< TotemTimingLocalTrack > > tokenTrack_
MonitorElement * noiseSamples
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::unordered_map< unsigned int, unsigned long > hitsCounterMap
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
MonitorElement * hitDistribution2d_lumisection
void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::unordered_map< unsigned int, PotPlots > potPlots_
unsigned int samplesForNoise_
MonitorElement * trackDistribution
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
MonitorElement * digiDistribution
Log< level::Error, true > LogProblem
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
MonitorElement * baselineRMS
MonitorElement * hitDistribution2d