1 #include <mdet/FrontEndSiPM.h>
4 #include <mdet/MHierarchyInfo.h>
5 #include <fwk/RandomEngineRegistry.h>
6 #include <CLHEP/Random/RandGauss.h>
7 #include <CLHEP/Random/RandFlat.h>
31 Register(fMeanSampleRatePeriod);
32 Register(fPreT1BufferLength);
33 Register(fPostT1BufferLength);
34 Register(fTrueRangeLowThreshold);
35 Register(fFalseRangeHiThreshold);
36 Register(fSampleTimeADC);
38 Register(fBaseLineFluctuationLG);
39 Register(fBaseLineFluctuationHG);
40 Register(fDelayBinaryADCMean);
41 Register(fDelayBinaryADCSigma);
42 fChannels.Update(GetIdsMap());
155 return GetData<BrokenChannelContainer,utl::ThrowOnZeroDereference,utl::ShadowPtr>(
fBrokenChannels,
"channelsBroken");
162 std::ostringstream msg;
166 std::bitset<64> bit_mask;
173 for ( BrokenChannelContainer::const_iterator chIt = channels->begin(), chIte = channels->end();
174 chIt != chIte; ++chIt ){
175 msg << *chIt <<
" " ;
177 mask |= ULong64_t(1) << *chIt;
181 msg <<
"MD MASK -- " << std::setw( 10 ) << std::setfill(
' ')
183 <<
" ==> (" << bit_mask.count() <<
")\n";
184 msg <<
"mask in decimal: " << std::endl;
185 msg << mask << std::endl;
204 unsigned short counts = (value/
GetStepADC() + 0.5);
242 double chance = CLHEP::RandFlat::shoot(& rnd.
GetEngine(), 0, 1.0);
262 return CLHEP::RandFlat::shoot(& rnd.
GetEngine(), 0,
fChannels.GetNumberOfComponents());
286 if (v >= fFrontEndSiPM.GetTrueRangeLowThreshold())
288 else if (v <= fFrontEndSiPM.GetFalseRangeHiThreshold())
302 if ( invalidateData )
double GetDigitalBackGroundProbability() const
Noise in digital channel.
utl::Validated< double > fDigitalBackGroundWidthStdDev
std::vector< int > BrokenChannelContainer
double GetDelayBinaryADCMean() const
Delay between the binary trace and the ADC traces.
double GetSampleTimeADC() const
ADC Sample Time and delay.
double GetDigitalBackGroundWidthMean() const
void Update(bool invalidateData, bool invalidateComponents)
Forward to channels and to base-class.
utl::Validated< double > fDigitalBackGroundProbability
RandomEngineType & GetEngine()
double GetStepADC() const
ADC resolution.
short GetInjectDigitalNoiseBin() const
unsigned short GetADCBaseLineFluctuationLG() const
Noise injection for binary and ADC channels.
static const char *const kComponentName
static const char *const kComponentsNames[13]
utl::Validated< double > fBaseLineFluctuationHG
double GetTrueRangeLowThreshold() const
Low end-point of the range where the voltage is taken as a true-value by the FPGA sampling proccess...
det::DetectorComponent< C, MManagerProvider > Type
Type specializing det::DetectorComponent for Muon hierarchy.
utl::Validated< double > fDelayBinaryADCSigma
unsigned short GetInjectDigitalNoiseWidth() const
double GetBaseLineFluctuationHG() const
void Update(std::vector< double > &init, const std::vector< double > &res)
utl::Validated< double > fFalseRangeHiThreshold
static const char *const kComponentsIds[13]
double GetDelayBinaryADC() const
Encapsulates the sampling logic.
Sampler MakeSampler() const
Create a new sampler object.
utl::Validated< double > fDelayBinaryADCMean
const VManager::IndexMap & GetIdsMap() const
The id identifying this component within its detector hierarhy.
T & GetData(P< T > &d, const std::string &p) const
Common utility function for configuration.
Electronic front-end for the modules.
double GetBaseLineFluctuationLG() const
utl::Validated< double > fStepADC
FrontEndSiPM(int fId, const det::VManager::IndexMap &parentMap, const Module &parent)
Constructs the electronic front-end.
Sampler(const FrontEndSiPM &fe)
Construct with the associated FrontEndSiPM.
Wraps the random number engine used to generate distributions.
utl::Validated< double > fBaseLineFluctuationLG
utl::Validated< double > fDigitalBackGroundWidthMean
double GetMeanSampleRatePeriod() const
Mean electronic sample rate period.
ULong64_t GetMask() const
Size of the (cyclic) external memory buffer associated to each module.
unsigned int GetPreT1BufferLength() const
Number of bins of the (cyclic) pre-T1 buffer.
utl::ShadowPtr< BrokenChannelContainer > fBrokenChannels
unsigned int GetPostT1BufferLength() const
Number of bins of the post-T1 buffer.
bool operator()(double v)
Digitally sample the voltage.
const BrokenChannelContainer & GetBrokenChannels() const
List of broken channels.
utl::Validated< double > fSampleTimeADC
double GetDelayBinaryADCSigma() const
double GetDigitalBackGroundWidthStdDev() const
unsigned short GetADCCounts(double value) const
utl::Validated< int > fPreT1BufferLength
std::map< std::string, std::string > IndexMap
static const char *const kComponentId
double GetFalseRangeHiThreshold() const
Hi end-point of the range where the voltage is taken as a false-value by the FPGA sampling process...
unsigned short GetADCBaseLineFluctuationHG() const
const Module & GetModule() const
The module to which this FrontEndSiPM belongs.
utl::Validated< double > fMeanSampleRatePeriod
utl::Validated< double > fTrueRangeLowThreshold
unsigned short GetInjectDigitalNoiseChannel() const
utl::Validated< int > fPostT1BufferLength