241 digiSentPercentage = ibooker.
book2D(
242 "sent digis percentage",
"sent digis percentage (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
254 activityPerBX = ibooker.
book1D(
"activity per BX CMS", title +
" Activity per BX;Event.BX", 3600, -1.5, 3598. + 0.5);
257 ibooker.
book2D(
"digi distribution", title +
" digi distribution;plane;channel", 10, -0.5, 4.5, 12, 0, 12);
259 dataSamplesRaw = ibooker.
book1D(
"raw Samples", title +
" Raw Samples; ADC", 256, 0, 256);
261 baseline = ibooker.
book2D(
"baseline", title +
" baseline (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
262 noiseRMS = ibooker.
book2D(
"noise RMS", title +
" noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
265 ibooker.
book2D(
"digis sent", title +
" digi sent (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
267 ibooker.
book2D(
"all digis", title +
" all digis(sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16);
268 digiSentPercentage = ibooker.
book2D(
"sent digis percentage",
269 title +
" sent digis percentage (sampic);board + 0.5 sampic;channel",
277 hitDistribution2d = ibooker.
book2D(
"hits in planes",
278 title +
" hits in planes;plane number;x (mm)",
282 15. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM,
285 hitDistribution2dWithTime = ibooker.
book2D(
"hits in planes with time",
286 title +
" hits in planes with time;plane number;x (mm)",
290 15. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM,
293 hitDistribution2d_lumisection = ibooker.
book2D(
"hits in planes lumisection",
294 title +
" hits in planes in the last lumisection;plane number;x (mm)",
298 15. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM,
302 recHitTime = ibooker.
book1D(
"recHit time", title +
" time in the recHits; t (ns)", 500, -25, 25);
303 amplitude = ibooker.
book1D(
"amplitude", title +
" amplitude above baseline; amplitude (V)", 50, 0, 1);
304 tirggerCellTime = ibooker.
book1D(
"trigger cell time", title +
" Trigger Cell Time; t (ns)", 390, -25, 25);
305 baselineRMS = ibooker.
book2D(
"noise RMS", title +
" noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
307 ibooker.
book2D(
"mean amplitude", title +
" Mean Amplitude (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
308 cellOfMax = ibooker.
book2D(
"cell of max", title +
" cell of max (0-23);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
310 hitRate = ibooker.
book2D(
"hit rate", title +
" hit rate (Hz);plane;channel", 10, -0.5, 4.5, 12, 0, 12);
312 planesWithDigis = ibooker.
book1D(
313 "active planes digis", title +
" active planes with digis sent (per event);number of active planes", 6, -0.5, 5.5);
314 planesWithTime = ibooker.
book1D(
315 "active planes with time", title +
" active planes with time (per event);number of active planes", 6, -0.5, 5.5);
321 ibooker.
book2D(
"tomography 210",
322 title +
" tomography (only with time) with strips 210 (all planes);x + 50*plane(mm);y (mm)",
323 190 / TOMOGRAPHY_RESOLUTION_MM,
326 25 / TOMOGRAPHY_RESOLUTION_MM,
330 ibooker.
book2D(
"tomography 220",
331 title +
" tomography (only with time) with strips 220 (all planes);x + 50*plane(mm);y (mm)",
332 190 / TOMOGRAPHY_RESOLUTION_MM,
335 25 / TOMOGRAPHY_RESOLUTION_MM,
349 digiDistribution = ibooker.
book1D(
"digi distribution", title +
" digi distribution;channel", 12, 0, 12);
351 hitProfile = ibooker.
book1D(
"hit distribution with time",
352 title +
" hit distribution (with time);y (+ 15 for x>3) (mm)",
353 30. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM,
357 hitMultiplicity = ibooker.
book1D(
"channels per plane", title +
" channels per plane; ch per plane", 13, -0.5, 12.5);
359 hitMultiplicityWithTime = ibooker.
book1D(
360 "channels per plane with time", title +
" channels per plane with time; ch per plane", 13, -0.5, 12.5);
372 activityPerBX = ibooker.
book1D(
"activity per BX", title +
" Activity per BX;Event.BX", 1000, -1.5, 998. + 0.5);
373 dataSamplesRaw = ibooker.
book1D(
"raw samples", title +
" Raw Samples; ADC", 256, 0, 256);
374 cellOfMax = ibooker.
book1D(
"cell of max", title +
" cell of max; cell", 24, 0, 24);
376 tirggerCellTime = ibooker.
book1D(
"sampic trigger time", title +
" Sampic Trigger Time; t (ns)", 100, -25, 25);
377 recHitTime = ibooker.
book1D(
"recHit Time", title +
" recHit Time; t (ns)", 500, -25, 25);
378 amplitude = ibooker.
book1D(
"amplitude", title +
" amplitude above baseline; amplitude (V)", 50, 0, 1);
379 noiseSamples = ibooker.
book1D(
"noise samples", title +
" noise samples; V", 50, 0, 1);
381 hitTime = ibooker.
book1D(
"hit time", title +
"hit time;t - t_previous (us)", 100, 0, 10000);
382 hitRate = ibooker.
book1D(
"hit rate", title +
"hit rate;rate (Hz)", 100, 0, 10000);
384 stripTomography210 = ibooker.
book2D(
"tomography 210",
385 title +
" tomography with strips 210;x (mm);y (mm)",
386 20 / TOMOGRAPHY_RESOLUTION_MM,
389 25 / TOMOGRAPHY_RESOLUTION_MM,
392 stripTomography220 = ibooker.
book2D(
"tomography 220",
393 title +
" tomography with strips 220;x (mm);y (mm)",
394 20 / TOMOGRAPHY_RESOLUTION_MM,
397 25 / TOMOGRAPHY_RESOLUTION_MM,
411 minimumStripAngleForTomography_(ps.getParameter<double>(
"minimumStripAngleForTomography")),
412 maximumStripAngleForTomography_(ps.getParameter<double>(
"maximumStripAngleForTomography")),
413 samplesForNoise_(ps.getUntrackedParameter<unsigned
int>(
"samplesForNoise", 5)),
414 verbosity_(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
415 timeOfPreviousEvent_(0) {}
471 auto d = std::make_shared<totemds::Cache>();
472 d->hitDistribution2dMap.reserve(
potPlots_.size());
474 d->hitDistribution2dMap[
plot.first] =
475 std::unique_ptr<TH2F>(
static_cast<TH2F *
>(
plot.second.hitDistribution2d_lumisection->getTH2F()->Clone()));
504 valid &= timingDigis.
isValid();
509 edm::LogProblem(
"TotemTimingDQMSource") <<
"ERROR in TotemTimingDQMSource::analyze > some of the required inputs " 510 "are not valid. Skipping this event.\n" 511 <<
" timingDigis.isValid = " << timingDigis.
isValid() <<
"\n" 512 <<
" fedInfo.isValid = " << fedInfo.
isValid();
519 std::set<uint8_t> boardSet;
520 std::unordered_map<unsigned int, unsigned int> channelsPerPlane;
521 std::unordered_map<unsigned int, unsigned int> channelsPerPlaneWithTime;
524 for (
const auto &digis : *timingDigis) {
528 detId_pot.setChannel(0);
532 for (
const auto &digi : digis) {
537 potPlots_[detId_pot].digiDistribution->Fill(detId.plane(), detId.channel());
539 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
540 potPlots_[detId_pot].dataSamplesRaw->Fill(*it);
542 float boardId = digi.eventInfo().hardwareBoardId() + 0.5 * digi.eventInfo().hardwareSampicId();
543 potPlots_[detId_pot].digiSent->Fill(boardId, digi.hardwareChannelId());
544 if (boardSet.find(digi.eventInfo().hardwareId()) == boardSet.end()) {
546 boardSet.insert(digi.eventInfo().hardwareId());
547 std::bitset<16> chMap(digi.eventInfo().channelMap());
548 for (
int i = 0;
i < 16; ++
i) {
550 potPlots_[detId_pot].digiAll->Fill(boardId,
i);
555 potPlots_[detId_pot].planesWithDigisSet.insert(detId.plane());
560 planePlots_[detId_plane].digiDistribution->Fill(detId.channel());
562 if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end())
563 channelsPerPlane[detId_plane]++;
565 channelsPerPlane[detId_plane] = 0;
572 for (
auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it)
577 unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin();
583 ++(lumiCache->hitsCounterMap[detId]);
589 for (
const auto &
rechits : *timingRecHits) {
593 detId_pot.setChannel(0);
597 for (
const auto &rechit :
rechits) {
599 potPlots_[detId_pot].amplitude->Fill(rechit.amplitude());
601 TH2F *hitHistoTmp =
potPlots_[detId_pot].hitDistribution2d->getTH2F();
602 TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis();
603 float yCorrected = rechit.y();
605 float x_shift = detId.plane();
606 x_shift += (rechit.x() > 2) ? 0.25 : 0;
607 int startBin = hitHistoTmpYAxis->FindBin(yCorrected - 0.5 * rechit.yWidth());
609 for (
int i = 0;
i < numOfBins; ++
i) {
610 potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + 0.25 * (rechit.x() > 2),
611 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
612 potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(x_shift,
613 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
618 for (
int i = 0;
i < numOfBins; ++
i)
619 potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + 0.25 * (rechit.x() > 2),
620 hitHistoTmpYAxis->GetBinCenter(startBin +
i));
622 potPlots_[detId_pot].recHitTime->Fill(rechit.time());
623 potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane());
628 float x_shift = (rechit.x() > 2) ? 15 : 0;
629 TH1F *hitProfileHistoTmp =
planePlots_[detId_plane].hitProfile->getTH1F();
632 float yCorrected = rechit.y() +
verticalShiftTop_ - 0.5 * rechit.yWidth() + x_shift;
633 int startBin = hitProfileHistoTmp->FindBin(yCorrected);
634 for (
int i = 0;
i < numOfBins; ++
i)
635 hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin +
i));
637 float yCorrected = rechit.y() +
verticalShiftBot_ + 0.5 * rechit.yWidth() + (15 - x_shift);
638 int startBin = hitProfileHistoTmp->FindBin(yCorrected);
639 int totBins = hitProfileHistoTmp->GetNbinsX();
640 for (
int i = 0;
i < numOfBins; ++
i)
641 hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(totBins - startBin +
i));
644 if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end())
645 channelsPerPlaneWithTime[detId_plane]++;
647 channelsPerPlaneWithTime[detId_plane] = 0;
651 potPlots_[detId_pot].tirggerCellTime->Fill(rechit.sampicThresholdTime());
652 channelPlots_[detId].tirggerCellTime->Fill(rechit.sampicThresholdTime());
663 for (
const auto &
rechits : *timingRecHits) {
667 detId_pot.setChannel(0);
673 for (
const auto &rechit :
rechits) {
677 for (
const auto &ds : *stripTracks) {
694 for (
const auto &striplt : ds) {
695 if (striplt.isValid() && stripId.arm() == detId.arm()) {
701 double x = striplt.x0() - rp_x;
702 double y = striplt.y0() - rp_y;
704 potPlots_[detId_pot].stripTomography210->Fill(x + detId.plane() * 50, y + y_shift);
705 channelPlots_[detId].stripTomography210->Fill(x, y + y_shift);
707 potPlots_[detId_pot].stripTomography220->Fill(x + detId.plane() * 50, y + y_shift);
708 channelPlots_[detId].stripTomography220->Fill(x, y + y_shift);
720 plt.second.planesWithDigis->Fill(plt.second.planesWithDigisSet.size());
721 plt.second.planesWithDigisSet.clear();
722 plt.second.planesWithTime->Fill(plt.second.planesWithTimeSet.size());
723 plt.second.planesWithTimeSet.clear();
726 for (
const auto &plt : channelsPerPlane) {
727 planePlots_[plt.first].hitMultiplicity->Fill(plt.second);
729 for (
const auto &plt : channelsPerPlaneWithTime) {
730 planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second);
739 auto lumiCache = luminosityBlockCache(iLumi.
index());
741 *(
plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[
plot.first]);
746 for (
auto &
plot : potPlots_) {
747 TH2F *hitHistoTmp =
plot.second.digiSentPercentage->getTH2F();
748 TH2F *histoSent =
plot.second.digiSent->getTH2F();
749 TH2F *histoAll =
plot.second.digiAll->getTH2F();
751 hitHistoTmp->Divide(histoSent, histoAll);
752 hitHistoTmp->Scale(100);
753 hitHistoGlobalTmp->Add(hitHistoTmp, 1);
755 plot.second.baseline->Reset();
756 plot.second.noiseRMS->Reset();
757 plot.second.meanAmplitude->Reset();
758 plot.second.cellOfMax->Reset();
759 plot.second.hitRate->Reset();
763 if (chId.
arm() == rpId.
arm() && chId.
rp() == rpId.
rp()) {
764 plot.second.baseline->Fill(chId.
plane(), chId.
channel(), chPlot.second.noiseSamples->getTH1F()->GetMean());
765 plot.second.noiseRMS->Fill(chId.
plane(), chId.
channel(), chPlot.second.noiseSamples->getTH1F()->GetRMS());
766 plot.second.meanAmplitude->Fill(chId.
plane(), chId.
channel(), chPlot.second.amplitude->getTH1F()->GetMean());
767 plot.second.cellOfMax->Fill(chId.
plane(), chId.
channel(), chPlot.second.cellOfMax->getTH1F()->GetMean());
768 auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[chPlot.first];
775 auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[
plot.first];
776 if (hitsCounterPerLumisection != 0) {
static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM
static const double LHC_CLOCK_PERIOD_NS
Detector ID class for TOTEM Si strip detectors.
OptoRx headers and footers.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
static const int TOTEM_STRIP_MAX_RP_ID
static const int CTPPS_NEAR_RP_ID
static const int TOTEM_STATION_210
Translation translation() const
double minimumStripAngleForTomography_
void channelName(std::string &name, NameFlag flag=nFull) const
void setChannel(uint32_t channel)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::DetSetVector< TotemTimingDigi > > tokenDigi_
LuminosityBlockIndex index() const
std::unordered_map< unsigned int, PlanePlots > planePlots_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
static const int CTPPS_NUM_OF_ARMS
void setCurrentFolder(std::string const &fullpath)
plots related to one Diamond detector package
edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > tokenRecHit_
std::unordered_map< unsigned int, ChannelPlots > channelPlots_
MonitorElement * digiSentPercentage
std::set< unsigned int > planesWithTimeSet
int bunchCrossing() const
void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack_
static const double TOMOGRAPHY_RESOLUTION_MM
std::unordered_map< unsigned int, unsigned long > hitsCounterMap
static const double SAMPIC_SAMPLING_PERIOD_NS
plots related to one Diamond channel
static const double SAMPIC_MAX_NUMBER_OF_SAMPLES
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
static const double HIT_RATE_FACTOR
static const int TOTEM_STATION_220
static const int CTPPS_FAR_RP_ID
A track fit through a single RP.
plots related to the whole system
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
Event setup record containing the real (actual) geometry information.
std::unordered_map< unsigned int, std::unique_ptr< TH2F > > hitDistribution2dMap
static const double DQM_FRACTION_OF_EVENTS
~TotemTimingDQMSource() override
virtual void Reset()
reset ME (ie. contents, errors, etc)
#define DEFINE_FWK_MODULE(type)
static const double SEC_PER_LUMI_SECTION
static const int TOTEM_STRIP_MIN_RP_ID
void setPlane(uint32_t channel)
unsigned int samplesForNoise_
static const int TOTEM_TIMING_STATION_ID
double maximumStripAngleForTomography_
Geometrical description of a sensor.
void rpName(std::string &name, NameFlag flag=nFull) const
LuminosityBlock const & getLuminosityBlock() const
static const int TOTEM_TIMING_TOP_RP_ID
std::unordered_map< unsigned int, PotPlots > potPlots_
unsigned long long TimeValue_t
std::set< unsigned int > planesWithDigisSet
TotemTimingDQMSource(const edm::ParameterSet &)
The manager class for TOTEM RP geometry.
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
static const float COS_8_DEG
void setPlane(uint32_t det)
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
static const double SAMPIC_ADC_V
static const float SIN_8_DEG
static const int TOTEM_TIMING_NUM_OF_PLANES
Base class for CTPPS detector IDs.
ESHandle< TrackerGeometry > geometry
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
edm::TimeValue_t timeOfPreviousEvent_
edm::EDGetTokenT< std::vector< TotemFEDInfo > > tokenFEDInfo_
std::vector< double > params() const
static const int TOTEM_TIMING_FED_ID_45
static const double DISPLAY_RESOLUTION_FOR_HITS_MM
static const int TOTEM_TIMING_BOT_RP_ID
static const int TOTEM_TIMING_FED_ID_56
T const * product() const
void planeName(std::string &name, NameFlag flag=nFull) const
std::shared_ptr< totemds::Cache > globalBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const override
TimeValue_t value() const
void dqmEndRun(const edm::Run &, const edm::EventSetup &) override
edm::Timestamp time() const
static const int TOTEM_TIMING_NUM_OF_CHANNELS
plots related to one Diamond plane
const DetGeomDesc * sensorNoThrow(unsigned int id) const
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...