1414// / \brief Task To monitor data converted from TOF compressor, and check the diagnostic words of TOF crates received trough the TOF compressor.
1515// / Here are defined the counters to check the diagnostics words of the TOF crates obtained from the compressor.
1616// / This is why the class derives from DecoderBase: it reads data from the decoder.
17+ // / This tasks also perform a basic noise monitoring to check the fraction of noisy channels
1718// / \since 20-11-2020
1819// /
1920
@@ -49,47 +50,39 @@ class RawDataDecoder final : public DecoderBase
4950 ~RawDataDecoder () = default ;
5051
5152 // / Function to run decoding of raw data
52- void decode ();
53+ void decode () { DecoderBase::run (); } ;
5354
5455 // / Counters to fill
55- static constexpr unsigned int ncrates = 72 ; // / Number of crates
56- static constexpr unsigned int ntrms = 10 ; // / Number of TRMs per crate
57- static constexpr unsigned int ntrmschains = 2 ; // / Number of TRMChains per TRM
58- static constexpr unsigned int nsectors = 18 ; // / Number of sectors
59- static constexpr unsigned int nstrips = 91 ; // / Number of strips per sector
60- static constexpr unsigned int nwords = 32 ; // / Number of diagnostic words of a slot card
61- static constexpr unsigned int nslots = 12 ; // / Number of slots in a crate
62-
63- // / Initialize noise analysis variables
64- Int_t mTimeMin = 0 , mTimeMax = -1 ;
65- Double_t max_noise = 1 .e+3 /* [Hz] */ , tdc_width = 24.3660e-12 /* [s] */ ;
56+ static constexpr unsigned int ncrates = 72 ; // / Number of crates
57+ static constexpr unsigned int ntrms = 10 ; // / Number of TRMs per crate
58+ static constexpr unsigned int ntrmschains = 2 ; // / Number of TRMChains per TRM
59+ static constexpr unsigned int nsectors = 18 ; // / Number of sectors
60+ static constexpr unsigned int nstrips = 91 ; // / Number of strips per sector
61+ static constexpr unsigned int nwords = 32 ; // / Number of diagnostic words of a slot card
62+ static constexpr unsigned int nslots = 12 ; // / Number of slots in a crate
63+ static constexpr unsigned int nequipments = 172800 ; // / Number of equipment in the electronic indexing scheme
6664
6765 // / Set parameters for noise analysis
68- void setTimeMin (std::string min) { mTimeMin = atoi (min.c_str ()); }
69- void setTimeMax (std::string max) { mTimeMax = atoi (max.c_str ()); }
70- void setMaxNoise (std::string thresholdnoise) { max_noise = atoi (thresholdnoise.c_str ()); }
66+ void setTimeWindowMin (std::string min) { mTimeMin = atoi (min.c_str ()); }
67+ void setTimeWindowMax (std::string max) { mTimeMax = atoi (max.c_str ()); }
68+ void setNoiseThreshold (std::string thresholdnoise) { mNoiseThreshold = atof (thresholdnoise.c_str ()); }
7169
7270 // Names of diagnostic counters
7371 static const char * RDHDiagnosticsName[2 ]; // / RDH Counter names
7472 static const char * DRMDiagnosticName[nwords]; // / DRM Counter names
7573 static const char * LTMDiagnosticName[nwords]; // / LTM Counter names
7674 static const char * TRMDiagnosticName[nwords]; // / TRM Counter names
7775 // Diagnostic counters
78- Counter<2 , RDHDiagnosticsName> mRDHCounter [ncrates]; // / RDH Counters
79- Counter<nwords, DRMDiagnosticName> mDRMCounter [ncrates]; // / DRM Counters
80- Counter<nwords, LTMDiagnosticName> mLTMCounter [ncrates]; // / LTM Counters
81- Counter<nwords, TRMDiagnosticName> mTRMCounter [ncrates][ntrms]; // / TRM Counters
76+ Counter<2 , RDHDiagnosticsName> mCounterRDH [ncrates]; // / RDH Counters
77+ Counter<nwords, DRMDiagnosticName> mCounterDRM [ncrates]; // / DRM Counters
78+ Counter<nwords, LTMDiagnosticName> mCounterLTM [ncrates]; // / LTM Counters
79+ Counter<nwords, TRMDiagnosticName> mCounterTRM [ncrates][ntrms]; // / TRM Counters
8280 // Global counters
83- Counter<172800 , nullptr > mCounterIndexEquipment ; // / Counter for the single electronic index
84- Counter<172800 , nullptr > mCounterIndexEquipmentInTimeWin ; // / Counter for the single electronic index for noise analysis
85- Counter<172800 , nullptr > mCounterNoisyChannels ; // / Counter for noisy channels
86- Counter<1024 , nullptr > mCounterTimeBC ; // / Counter for the Bunch Crossing Time
87- Counter<91 , nullptr > mCounterNoiseMap [ncrates][4 ]; // / Counter for the Noise Hit Map
88-
89- // / Histograms to fill
90- std::map<std::string, std::shared_ptr<TH1 >> mHistos ;
91-
92- Int_t rdhread = 0 ; // / Number of times a RDH is read
81+ Counter<nequipments, nullptr > mCounterIndexEquipment ; // / Counter for the single electronic index
82+ Counter<nequipments, nullptr > mCounterIndexEquipmentInTimeWin ; // / Counter for the single electronic index for noise analysis
83+ Counter<nequipments, nullptr > mCounterNoisyChannels ; // / Counter for noisy channels
84+ Counter<1024 , nullptr > mCounterTimeBC ; // / Counter for the Bunch Crossing Time
85+ Counter<91 , nullptr > mCounterNoiseMap [ncrates][4 ]; // / Counter for the Noise Hit Map
9386
9487 // / Function to init histograms
9588 void initHistograms ();
@@ -101,19 +94,18 @@ class RawDataDecoder final : public DecoderBase
10194 void estimateNoise (std::shared_ptr<TH1F > hIndexEquipmentIsNoise);
10295
10396 // Histograms filled in the decoder to be kept to the bare bone so as to increase performance
104- std::shared_ptr<TH1F > mHits ; // / Number of TOF hits
105- std::shared_ptr<TH1F > mTime ; // / Time
106- std::shared_ptr<TH1F > mTOT ; // / Time-Over-Threshold
107- std::shared_ptr<TH2F > mSlotPartMask ; // / Participating slot
108- std::shared_ptr<TH2F > mDiagnostic ; // / Diagnostic words
109- std::shared_ptr<TH1F > mNErrors ; // / Number of errors
110- std::shared_ptr<TH1F > mErrorBits ; // / Bits of errors
111- std::shared_ptr<TH2F > mError ; // / Errors in slot and TDC
112- std::shared_ptr<TH1F > mNTests ; // / Number of tests
113- std::shared_ptr<TH2F > mTest ; // / Tests in slot and TDC
114- std::shared_ptr<TH2F > mOrbitID ; // / Orbit ID for the header and trailer words
115- std::shared_ptr<TH2F > mNoiseMap ; // / Noise map per FEA cards
116- std::shared_ptr<TH1F > mIndexEquipmentHitRate ; // / Noise rate x channel
97+ std::shared_ptr<TH1F > mHistoHits ; // / Number of TOF hits
98+ std::shared_ptr<TH1F > mHistoTime ; // / Time
99+ std::shared_ptr<TH1F > mHistoTOT ; // / Time-Over-Threshold
100+ std::shared_ptr<TH2F > mHistoDiagnostic ; // / Diagnostic words
101+ std::shared_ptr<TH1F > mHistoNErrors ; // / Number of errors
102+ std::shared_ptr<TH1F > mHistoErrorBits ; // / Bits of errors
103+ std::shared_ptr<TH2F > mHistoError ; // / Errors in slot and TDC
104+ std::shared_ptr<TH1F > mHistoNTests ; // / Number of tests
105+ std::shared_ptr<TH2F > mHistoTest ; // / Tests in slot and TDC
106+ std::shared_ptr<TH2F > mHistoOrbitID ; // / Orbit ID for the header and trailer words
107+ std::shared_ptr<TH2F > mHistoNoiseMap ; // / Noise map per FEA cards
108+ std::shared_ptr<TH1F > mHistoIndexEquipmentHitRate ; // / Noise rate x channel
117109
118110 private:
119111 /* * decoding handlers **/
@@ -124,6 +116,13 @@ class RawDataDecoder final : public DecoderBase
124116 void trailerHandler (const CrateHeader_t* crateHeader, const CrateOrbit_t* crateOrbit,
125117 const CrateTrailer_t* crateTrailer, const Diagnostic_t* diagnostics,
126118 const Error_t* errors) override ;
119+
120+ // Decoder parameters
121+ // / Noise analysis variables
122+ int mTimeMin = 0 ; // / Start of the time window in bins of the TDC
123+ int mTimeMax = -1 ; // / End of the time window in bins of the TDC
124+ static constexpr double mTDCWidth = 24.3660e-12 ; // / Width of the TDC bins in [s]
125+ double mNoiseThreshold = 1 .e+3 ; // / Threshold used to defined noise in [Hz]
127126};
128127
129128// / \brief TOF Quality Control DPL Task for TOF Compressed data
@@ -148,19 +147,20 @@ class TaskRaw final : public TaskInterface
148147 private:
149148 // Histograms
150149 // Diagnostic words
151- std::shared_ptr<TH2F > mRDHHisto ; // / Words per RDH
152- std::shared_ptr<TH2F > mDRMHisto ; // / Words per DRM
153- std::shared_ptr<TH2F > mLTMHisto ; // / Words per LTM
154- std::shared_ptr<TH2F > mTRMHisto [RawDataDecoder::ntrms]; // / Words per TRM
155- std::shared_ptr<TH2F > mCrateHisto [RawDataDecoder::ncrates]; // / Words of each slot in a crate
150+ std::shared_ptr<TH2F > mHistoRDH ; // / Words per RDH
151+ std::shared_ptr<TH2F > mHistoDRM ; // / Words per DRM
152+ std::shared_ptr<TH2F > mHistoLTM ; // / Words per LTM
153+ std::shared_ptr<TH2F > mHistoTRM [RawDataDecoder::ntrms]; // / Words per TRM
154+ std::shared_ptr<TH2F > mHistoCrate [RawDataDecoder::ncrates]; // / Words of each slot in a crate
155+ std::shared_ptr<TH2F > mHistoSlotParticipating ; // / Participating slot per crate
156156
157157 // Indices in the electronic scheme
158- std::shared_ptr<TH1F > mIndexEquipment ; // / Index in electronic
159- std::shared_ptr<TH1F > mIndexEquipmentInTimeWin ; // / Index in electronic for noise analysis
160- std::shared_ptr<TH1F > mIndexEquipmentIsNoise ; // / Noise hit map x channel
158+ std::shared_ptr<TH1F > mHistoIndexEquipment ; // / Index in electronic
159+ std::shared_ptr<TH1F > mHistoIndexEquipmentInTimeWin ; // / Index in electronic for noise analysis
160+ std::shared_ptr<TH1F > mHistoIndexEquipmentIsNoise ; // / Noise hit map x channel
161161
162162 // Other observables
163- std::shared_ptr<TH1F > mTimeBC ; // / Time in Bunch Crossing
163+ std::shared_ptr<TH1F > mHistoTimeBC ; // / Time in Bunch Crossing
164164
165165 RawDataDecoder mDecoderRaw ; // / Decoder for TOF Compressed data useful for the Task and filler of histograms for compressed raw data
166166};
0 commit comments