#include <ESElectronicsSimFast.h>
Public Types | |
enum | { MAXADC = 4095 } |
enum | { MINADC = 0 } |
Public Member Functions | |
virtual void | analogToDigital (const CaloSamples &cs, ESDataFrame &df, bool wasEmpty, CLHEP::RandGeneral *histoDistribution, double hInf, double hSup, double hBin) const |
void | digitalToAnalog (const ESDataFrame &df, CaloSamples &cs) const |
ESElectronicsSimFast (bool addNoise) | |
void | newEvent () |
anything that needs to be done once per event | |
void | setGain (const int gain) |
void | setMIPs (const ESIntercalibConstants *mips) |
void | setMIPToGeV (const double MIPToGeV) |
void | setPedestals (const ESPedestals *peds) |
Private Member Functions | |
double | decode (const ESSample &sample, const DetId &detId) const |
std::vector< ESSample > | fastEncode (const CaloSamples &timeframe, CLHEP::RandGeneral *histoDistribution, double hInf, double hSup, double hBin) const |
std::vector< ESSample > | standEncode (const CaloSamples &timeframe) const |
Private Attributes | |
bool | addNoise_ |
int | gain_ |
const ESIntercalibConstants * | mips_ |
double | MIPToGeV_ |
const ESPedestals * | peds_ |
Definition at line 14 of file ESElectronicsSimFast.h.
anonymous enum |
anonymous enum |
ESElectronicsSimFast::ESElectronicsSimFast | ( | bool | addNoise | ) |
Definition at line 13 of file ESElectronicsSimFast.cc.
void ESElectronicsSimFast::analogToDigital | ( | const CaloSamples & | cs, |
ESDataFrame & | df, | ||
bool | wasEmpty, | ||
CLHEP::RandGeneral * | histoDistribution, | ||
double | hInf, | ||
double | hSup, | ||
double | hBin | ||
) | const [virtual] |
Definition at line 22 of file ESElectronicsSimFast.cc.
References fastEncode(), i, ESDataFrame::setSample(), ESDataFrame::setSize(), ESDataFrame::size(), CaloSamples::size(), and standEncode().
Referenced by ESFastTDigitizer::run().
double ESElectronicsSimFast::decode | ( | const ESSample & | sample, |
const DetId & | detId | ||
) | const [private] |
Definition at line 450 of file EcalDumpRaw.cc.
References EcalDumpRaw::adc_, EcalDumpRaw::amplCut_, EcalDumpRaw::bx_, ExpressReco_HICollisions_FallBack::cerr, colorNames, pyrootRender::da, ExpressReco_HICollisions_FallBack::dataType, EcalDumpRaw::dccCh_, EcalDumpRaw::dccId_, detailedTrigNames, EcalDumpRaw::detailedTrigType_, EcalDumpRaw::dump_, EcalDumpRaw::dumpAdc_, EcalDumpRaw::ebmTcc_, EcalDumpRaw::ebpTcc_, EcalDumpRaw::eeInnerTcc_, EcalDumpRaw::eeOuterTcc_, EcalDumpRaw::feBx_, EcalDumpRaw::fedId_, EcalDumpRaw::fedStart_, EcalDumpRaw::feL1a_, EcalDumpRaw::feRuId_, g, i, EcalDumpRaw::iRu_, EcalDumpRaw::iSrWord64_, EcalDumpRaw::iTcc_, EcalDumpRaw::iTccWord64_, EcalDumpRaw::iTowerWord64_, prof2calltree::l, EcalDumpRaw::l1a_, EcalDumpRaw::lastOrbit_, EcalDumpRaw::lme(), EcalDumpRaw::max(), max(), EcalDumpRaw::maxTccsPerDcc_, EcalDumpRaw::maxTpgsPerTcc_, mgpaGainFactors, EcalDumpRaw::min(), EcalDumpRaw::nDccs_, EcalDumpRaw::nRu_, EcalDumpRaw::nTpgs_, EcalDumpRaw::nTts_, EcalDumpRaw::orbit0_, EcalDumpRaw::orbit0Set_, EcalDumpRaw::orbit_, asciidump::s, EcalDumpRaw::side_, EcalDumpRaw::sideOfRu(), EcalDumpRaw::simpleTrigType_, EcalDumpRaw::srpBx_, EcalDumpRaw::srpL1a_, EcalDumpRaw::srRange(), EcalDumpRaw::tccBlockLen64_, EcalDumpRaw::tccId_, EcalDumpRaw::tccL1a_, EcalDumpRaw::tccType_, EcalDumpRaw::towerBlockLength_, EcalDumpRaw::tpg_, EcalDumpRaw::tpgTag(), trigNames, EcalDumpRaw::ttfTag(), and ttsNames.
Referenced by digitalToAnalog().
{ bool rc = true; const bool d = dump_; if(iWord64==0){//start of event iSrWord64_ = 0; iTccWord64_ = 0; iTowerWord64_ = 0; } int dataType = (data[1] >>28) & 0xF; const int boe = 5; const int eoe = 10; if(dataType==boe){//Begin of Event header /********************************************************************** * DAQ header * **********************************************************************/ simpleTrigType_ = (data[1] >>24) & 0xF; l1a_ = (data[1]>>0 ) & 0xFFffFF; bx_ = (data[0] >>20) & 0xFFF; fedId_ = (data[0] >>8 ) & 0xFFF; if(d) out << "Trigger type: " << simpleTrigType_ << "(" << trigNames[(data[1]>>24) & 0xF] << ")" << " L1A: " << l1a_ << " BX: " << bx_ << " FED ID: " << fedId_ << " FOV: " << ((data[0] >>4 ) & 0xF) << " H: " << ((data[0] >>3 ) & 0x1); } else if((dataType>>2)==0){//DCC header /********************************************************************** * ECAL DCC header * **********************************************************************/ int dccHeaderId = (data[1] >>24) & 0x3F; switch(dccHeaderId){ case 1: if(d) out << "Run #: " << ((data[1] >>0 ) & 0xFFFFFF) << " DCC Err: " << ((data[0] >>24) & 0xFF) << " Evt Len: " << ((data[0] >>0 ) & 0xFFFFFF); break; case 2: side_ = (data[1] >>11) & 0x1; detailedTrigType_ = (data[1] >>8 ) & 0x7; dccId_ = (data[1] >>0 ) & 0x3F; if(d) out << "DCC FOV: " << ((data[1] >>16) & 0xF) << " Side: " << side_ << " Trig.: " << detailedTrigType_ << " (" << detailedTrigNames[(data[1]>>8)&0x7] << ")" << " Color: " << ((data[1] >>6 ) & 0x3) << " (" << colorNames[(data[1]>>6)&0x3] << ")" << " DCC ID: " << dccId_; int l; if(dccId_>=10 && dccId_<=46 && side_ <= 1){ // side >= 0, since side is unsigned l = lme(dccId_, side_); } else{ l = -1;//indicates error } break; case 3: { if(d) out << "TCC Status ch<4..1>: 0x" << hex << ((data[1]>>8) & 0xFFFF) << dec << " SR status: " << ((data[1] >>4 ) & 0xF) << " TZS: " << ((data[1] >>2 ) & 0x1) << " ZS: " << ((data[1] >>1 ) & 0x1) << " SR: " << ((data[1] >>0 ) & 0x1); orbit_ = data[0]; if(d) out << " Orbit: " << orbit_; if(!orbit0Set_){ orbit0_ = orbit_; orbit0Set_ = true; } int iDcc0 = fedId_-fedStart_; if((unsigned)iDcc0<nDccs_){ if(lastOrbit_[iDcc0]!=numeric_limits<uint32_t>::max()){ if(d) out << " (+" << (int)orbit_-(int)lastOrbit_[iDcc0] <<")"; } lastOrbit_[iDcc0] = orbit_; } } break; case 4: case 5: case 6: case 7: case 8: { int chOffset = (dccHeaderId-4)*14; if(d) out << "FE CH status:" << " #" << 14+chOffset << ":" << ((data[1] >>20) & 0xF) << " #" << 13+chOffset << ":" << ((data[1] >>16) & 0xF) << " #" << 12+chOffset << ":" << ((data[1] >>12) & 0xF) << " #" << 11+chOffset << ":" << ((data[1] >>8 ) & 0xF) << " #" << 10+chOffset << ":" << ((data[1] >>4 ) & 0xF) << " #" << 9+chOffset << ":" << ((data[1] >>0) & 0xF) << " #" << 8+chOffset << ":" << ((data[0] >>28) & 0xF) << " #" << 7+chOffset << ":" << ((data[0] >>24) & 0xF) << " #" << 6+chOffset << ":" << ((data[0] >>20) & 0xF) << " #" << 5+chOffset << ":" << ((data[0] >>16) & 0xF) << " #" << 4+chOffset << ":" << ((data[0] >>12) & 0xF) << " #" << 3+chOffset << ":" << ((data[0] >>8 ) & 0xF) << " #" << 2+chOffset << ":" << ((data[0] >>4 ) & 0xF) << " #" << 1+chOffset << ":" << ((data[0] >>0 ) & 0xF); } break; default: if(d) out << " bits<63..62>=0 (DCC header) bits<61..56>=" << dccHeaderId << "(unknown=>ERROR?)"; } } else if((dataType>>1)==3){//TCC block /********************************************************************** * TCC block * **********************************************************************/ if(iTccWord64_==0){ //header tccL1a_ = (data[1] >>0 ) & 0xFFF; tccId_ = ((data[0] >>0 ) & 0xFF); nTts_ = ((data[1] >>16) & 0x7F); if(iTcc_ < maxTccsPerDcc_) nTpgs_[iTcc_] = nTts_; ++iTcc_; if(d) out << "LE1: " << ((data[1] >>28) & 0x1) << " LE0: " << ((data[1] >>27) & 0x1) << " N_samples: " << ((data[1] >>23) & 0x1F) << " N_TTs: " << nTts_ << " E1: " << ((data[1] >>12) & 0x1) << " L1A: " << tccL1a_ << " '3': " << ((data[0] >>29) & 0x7) << " E0: " << ((data[0] >>28) & 0x1) << " Bx: " << ((data[0] >>16) & 0xFFF) << " TTC ID: " << tccId_; if(nTts_==68){ //EB TCC (TCC68) if(fedId_ < 628) tccType_ = ebmTcc_; else tccType_ = ebpTcc_; } else if(nTts_ == 16){//Inner EE TCC (TCC48) tccType_ = eeInnerTcc_; } else if(nTts_ == 28){//Outer EE TCC (TCC48) tccType_ = eeOuterTcc_; } else { cerr << "Error in #TT field of TCC block." "This field is normally used to determine type of TCC " "(TCC48 or TCC68). Type of TCC will be deduced from the TCC ID.\n"; if(tccId_ < 19) tccType_ = eeInnerTcc_; else if(tccId_ < 37) tccType_ = eeOuterTcc_; else if(tccId_ < 55) tccType_ = ebmTcc_; else if(tccId_ < 73) tccType_ = ebpTcc_; else if(tccId_ < 91) tccType_ = eeOuterTcc_; else if(tccId_ < 109) tccType_ = eeInnerTcc_; else{ cerr << "TCC ID is also invalid. EB- TCC type will be assumed.\n"; tccType_ = ebmTcc_; } } tccBlockLen64_ = (tccType_==ebmTcc_ || tccType_==ebpTcc_) ? 18 : 9; } else{// if(iTccWord64_<18){ int tpgOffset = (iTccWord64_-1)*4; if(iTcc_ > maxTccsPerDcc_){ out << "Too many TCC blocks"; } else if(tpgOffset > (maxTpgsPerTcc_ - 4)){ out << "Too many TPG in one TCC block"; } else{ tpg_[iTcc_-1][3+tpgOffset] = (data[1] >>16) & 0x1FF; tpg_[iTcc_-1][2+tpgOffset] = (data[1] >>0 ) & 0x1FF; tpg_[iTcc_-1][1+tpgOffset] = (data[0] >>16) & 0x1FF; tpg_[iTcc_-1][0+tpgOffset] = (data[0] >>0 ) & 0x1FF; //int n[2][4] = {{1,2,3,4}, // {4,3,2,1}}; //int iorder = (628<=fedId_ && fedId_<=645)?1:0; if(d) out << ttfTag(tccType_, 3+tpgOffset) << ":" //"TTF# " << setw(2) << ttId_[3 + tpgOffset] << ":" << ((data[1] >>25) & 0x7) << " " << tpgTag(tccType_, 3+tpgOffset) << ":" //" TPG# "<< setw(2) << ttId_[3 + tpgOffset] << ":" << setw(3) << tpg_[iTcc_-1][3+tpgOffset] << " " << ttfTag(tccType_, 2+tpgOffset) << ":" //" TTF# "<< setw(2) << ttId_[2 + tpgOffset] << ":" << ((data[1] >>9 ) & 0x7) << " " << tpgTag(tccType_, 2+tpgOffset) << ":" //" TPG# "<< setw(2) << ttId_[2 + tpgOffset] << ":" << setw(3) << tpg_[iTcc_-1][2+tpgOffset] << " " << " '3': " << ((data[0] >>29) & 0x7) << " " << ttfTag(tccType_, 1+tpgOffset) << ":" //" TTF# "<< setw(2) << ttId_[1 + tpgOffset] << ":" << ((data[0] >>25) & 0x7) << " " << setw(3) << tpgTag(tccType_, 1+tpgOffset) << ": "//" TPG# "<< setw(2) << ttId_[1 + tpgOffset] << ":" << tpg_[iTcc_-1][1+tpgOffset] << " " << ttfTag(tccType_, 0+tpgOffset) << ":" //" TTF# "<< setw(2) << ttId_[0 + tpgOffset] << ":" << ((data[0] >>9 ) & 0x7) << " " << setw(3) << tpgTag(tccType_, 0+tpgOffset) << ":" //" TPG# "<< setw(2) << ttId_[0 + tpgOffset] << ":" << tpg_[iTcc_-1][0+tpgOffset]; } }// else{ // if(d) out << "ERROR"; //} ++iTccWord64_; if(iTccWord64_ >= (unsigned)tccBlockLen64_) iTccWord64_ = 0; } else if((dataType>>1)==4){//SRP block /********************************************************************** * SRP block * **********************************************************************/ if(iSrWord64_==0){//header srpL1a_ = (data[1] >>0 ) & 0xFFF; srpBx_ = (data[0] >>16) & 0xFFF; if(d) out << "LE1: " << ((data[1] >>28) & 0x1) << " LE0: " << ((data[1] >>27) & 0x1) << " N_SRFs: " << ((data[1] >>16) & 0x7F) << " E1: " << ((data[1] >>12) & 0x1) << " L1A: " << srpL1a_ << " '4': " << ((data[0] >>29) & 0x7) << " E0: " << ((data[0] >>28) & 0x1) << " Bx: " << srpBx_ << " SRP ID: " << ((data[0] >>0 ) & 0xFF); } else if(iSrWord64_<6){ int ttfOffset = (iSrWord64_-1)*16; if(d){ if(iSrWord64_<5){ out <<"SRF# " << setw(6) << right << srRange(12+ttfOffset)/*16+ttfOffset << "..#" << 13+ttfOffset*/ << ": " << oct << ((data[1] >>16) & 0xFFF) << dec << " SRF# " << srRange(8+ttfOffset) /*12+ttfOffset << "..#" << 9+ttfOffset*/ << ": " << oct << ((data[1] >>0 ) & 0xFFF) << dec << " '4':" << ((data[0] >>29) & 0x7) << " SRF# " << srRange(4+ttfOffset) /*8+ttfOffset << "..#" << 5+ttfOffset*/ << ": " << oct << ((data[0] >>16) & 0xFFF) << dec; } else{//last 64-bit word has only 4 SRFs. out << " "; } out << " SRF# " << srRange(ttfOffset) /*4+ttfOffset << "..#" << 1+ttfOffset*/ << ": " << oct << ((data[0] >>0 ) & 0xFFF) << dec; } } else{ if(d) out << "ERROR"; } ++iSrWord64_; } else if((dataType>>2)==3){//Tower block /********************************************************************** * "Tower" block (crystal channel data from a RU (=1 FE cards)) * **********************************************************************/ if(iTowerWord64_==0){//header towerBlockLength_ = (data[1]>>16) & 0x1FF; int l1a; int bx; l1a = (data[1] >>0 ) & 0xFFF; bx = (data[0] >>16) & 0xFFF; dccCh_=(data[0] >>0 ) & 0xFF; if(d) out << "Block Len: " << towerBlockLength_ << " E1: " << ((data[1] >>12) & 0x1) << " L1A: " << l1a << " '3': " << ((data[0] >>30) & 0x3) << " E0: " << ((data[0] >>28) & 0x1) << " Bx: " << bx << " N_samples: " << ((data[0] >>8 ) & 0x7F) << " RU ID: " << dccCh_; if(iRu_ < nRu_){ feL1a_[iRu_] = l1a; feBx_[iRu_] = bx; feRuId_[iRu_] = dccCh_; ++iRu_; } } else if((unsigned)iTowerWord64_<towerBlockLength_){ if(!dumpAdc_){ //no output. rc = false; } const bool da = dumpAdc_ && dump_; switch((iTowerWord64_-1)%3){ int s[4]; int g[4]; case 0: s[0]=(data[0] >>16) & 0xFFF; g[0]=(data[0] >>28) & 0x3; s[1]=(data[1] >>0 ) & 0xFFF; g[1]=(data[1] >>12) & 0x3; s[2]=(data[1] >>16) & 0xFFF; g[2]=(data[1] >>28) & 0x3; fill(adc_.begin(), adc_.end(), 0.); if(da) out << "GMF: " << ((data[0] >>11) & 0x1) << " SMF: " << ((data[0] >>9 ) & 0x1) << " M: " << ((data[0] >>8 ) & 0x1) << " XTAL: " << ((data[0] >>4 ) & 0x7) << " STRIP: " << ((data[0] >>0 ) & 0x7) << " " << setw(4) << s[0] << "G" << g[0] << " " << setw(4) << s[1] << "G" << g[1] << " " << setw(4) << s[2] << "G" << g[2]; for(int i=0; i<3; ++i) adc_[i] = s[i]*mgpaGainFactors[g[i]]; break; case 1: s[0]=(data[0] >>0 ) & 0xFFF; g[0]=(data[0] >>12) & 0x3; s[1]=(data[0] >>16) & 0xFFF; g[1]=(data[0] >>28) & 0x3; s[2]=(data[1] >>0 ) & 0xFFF; g[2]=(data[1] >>12) & 0x3; s[3]=(data[1] >>16) & 0xFFF; g[3]=(data[1] >>28) & 0x3; if(da) out << " " << " " << setw(4) << s[0] << "G" << g[0] << " " << setw(4) << s[1] << "G" << g[1] << " " << setw(4) << s[2] << "G" << g[2] << " " << setw(4) << s[3] << "G" << g[3]; for(int i=0; i<4; ++i) adc_[i+3] = s[i]*mgpaGainFactors[g[i]]; break; case 2: if(da) out << "TZS: " << ((data[1] >>14) & 0x1); s[0]=(data[0] >>0 ) & 0xFFF; g[0]=(data[0] >>12) & 0x3; s[1]=(data[0] >>16) & 0xFFF; g[1]=(data[0] >>28) & 0x3; s[2]=(data[1] >>0 ) & 0xFFF; g[2]=(data[1] >>12) & 0x3 ; for(int i=0; i<3; ++i) adc_[i+7] = s[i]*mgpaGainFactors[g[i]]; if(dccCh_<=68){ unsigned bom0; //Bin of Maximum, starting counting from 0 double ampl = max(adc_, bom0)-min(adc_); if(da) out << " Ampl: " << setw(4) << ampl << (ampl>amplCut_?"*":" ") << " BoM:" << setw(2) << (bom0+1) << " "; if(fedId_ == dccId_ + 600 //block of the read-out SM //if laser, only one side: && (detailedTrigType_!=4 || sideOfRu(dccCh_)==(int)side_) ){ } } else{ if(da) out << setw(29) << ""; } if(da) out << " " << setw(4) << s[0] << "G" << g[0] << " " << setw(4) << s[1] << "G" << g[1] << " " << setw(4) << s[2] << "G" << g[2]; break; default: assert(false); } } else { if(d) out << "ERROR"; } ++iTowerWord64_; if(iTowerWord64_>=towerBlockLength_){ iTowerWord64_-=towerBlockLength_; ++dccCh_; } } else if(dataType==eoe){//End of event trailer /********************************************************************** * Event DAQ trailer * **********************************************************************/ int tts = (data[0] >>4) & 0xF; if(d) out << "Evt Len.: " << ((data[1] >>0 ) & 0xFFFFFF) << " CRC16: " << ((data[0] >>16) & 0xFFFF) << " Evt Status: " << ((data[0] >>8 ) & 0xF) << " TTS: " << tts << " (" << ttsNames[tts] << ")" << " T:" << ((data[0] >>3) & 0x1); } else{ if(d) out << " incorrect 64-bit word type marker (see MSBs)"; } return rc; }
void ESElectronicsSimFast::digitalToAnalog | ( | const ESDataFrame & | df, |
CaloSamples & | cs | ||
) | const |
Definition at line 34 of file ESElectronicsSimFast.cc.
References decode(), i, ESDataFrame::id(), and ESDataFrame::size().
std::vector< ESSample > ESElectronicsSimFast::fastEncode | ( | const CaloSamples & | timeframe, |
CLHEP::RandGeneral * | histoDistribution, | ||
double | hInf, | ||
double | hSup, | ||
double | hBin | ||
) | const [private] |
Definition at line 93 of file ESElectronicsSimFast.cc.
References ecalMGPA::adc(), newFWLiteAna::bin, ESCondObjectContainer< T >::find(), CaloSamples::id(), MAXADC, MINADC, peds_, python::entryComment::results, CaloSamples::size(), and tablePrinter::width.
Referenced by analogToDigital().
{ std::vector<ESSample> results; results.reserve(timeframe.size()); int bin[3]; double hBin2 = hBin*hBin; double hBin3 = hBin*hBin*hBin; double width = (hSup - hInf)/hBin; double thisRnd = histoDistribution->fire(); int thisRndCell = (int)((hBin3)*(thisRnd)/width); bin[2] = (int)(thisRndCell/hBin2); // sample2 - bin [0,N-1] bin[1] = (int)((thisRndCell - hBin2*bin[2])/hBin); // sample1 bin[0] = (int)(thisRndCell - hBin*(bin[1] + hBin*bin[2])); // sample0 ESPedestals::const_iterator it_ped = peds_->find(timeframe.id()); int baseline_ = (int) it_ped->getMean(); int adc[3]; double noi[3]; for(int ii=0; ii<3; ii++){ noi[ii] = hInf + bin[ii]*width; if (noi[ii]>0) noi[ii] += 0.5; else if (noi[ii]<0) noi[ii] -= 0.5; adc[ii] = int(noi[ii]) - 1000 + baseline_; if (adc[ii]>MAXADC) adc[ii] = MAXADC; if (adc[ii]<MINADC) adc[ii] = MINADC; results.push_back(ESSample(adc[ii])); } return results; }
void ESElectronicsSimFast::newEvent | ( | ) | [inline] |
anything that needs to be done once per event
Definition at line 33 of file ESElectronicsSimFast.h.
Referenced by ESFastTDigitizer::run().
{}
void ESElectronicsSimFast::setGain | ( | const int | gain | ) | [inline] |
Definition at line 23 of file ESElectronicsSimFast.h.
References gain_.
Referenced by EcalDigiProducer::checkCalibrations().
{ gain_ = gain; }
void ESElectronicsSimFast::setMIPs | ( | const ESIntercalibConstants * | mips | ) | [inline] |
Definition at line 25 of file ESElectronicsSimFast.h.
References mips_.
Referenced by EcalDigiProducer::checkCalibrations().
{ mips_ = mips; }
void ESElectronicsSimFast::setMIPToGeV | ( | const double | MIPToGeV | ) | [inline] |
Definition at line 26 of file ESElectronicsSimFast.h.
References MIPToGeV_.
Referenced by EcalDigiProducer::checkCalibrations().
{ MIPToGeV_ = MIPToGeV; }
void ESElectronicsSimFast::setPedestals | ( | const ESPedestals * | peds | ) | [inline] |
Definition at line 24 of file ESElectronicsSimFast.h.
References peds_.
Referenced by EcalDigiProducer::checkCalibrations().
{ peds_ = peds; }
std::vector< ESSample > ESElectronicsSimFast::standEncode | ( | const CaloSamples & | timeframe | ) | const [private] |
Definition at line 42 of file ESElectronicsSimFast.cc.
References ecalMGPA::adc(), addNoise_, Exception, ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), i, CaloSamples::id(), edm::Service< T >::isAvailable(), MAXADC, MINADC, mips_, MIPToGeV_, peds_, python::entryComment::results, and CaloSamples::size().
Referenced by analogToDigital().
{ edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable()) { throw cms::Exception("Configuration") << "ESElectroncSimFast requires the RandomNumberGeneratorService\n" "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } std::vector<ESSample> results; results.reserve(timeframe.size()); ESPedestals::const_iterator it_ped = peds_->find(timeframe.id()); ESIntercalibConstantMap::const_iterator it_mip = mips_->getMap().find(timeframe.id()); int baseline_ = (int) it_ped->getMean(); double sigma_ = (double) it_ped->getRms(); double MIPADC_ = (double) (*it_mip); int adc = 0; double ADCGeV = MIPADC_/MIPToGeV_; for (int i=0; i<timeframe.size(); i++) { double noi = 0; double signal = 0; if (addNoise_) { CLHEP::RandGaussQ gaussQDistribution(rng->getEngine(), 0, sigma_); noi = gaussQDistribution.fire(); } signal = timeframe[i]*ADCGeV + noi + baseline_; if (signal>0) signal += 0.5; else if (signal<0) signal -= 0.5; adc = int(signal); if (adc>MAXADC) adc = MAXADC; if (adc<MINADC) adc = MINADC; results.push_back(ESSample(adc)); } return results; }
bool ESElectronicsSimFast::addNoise_ [private] |
Definition at line 37 of file ESElectronicsSimFast.h.
Referenced by standEncode().
int ESElectronicsSimFast::gain_ [private] |
Definition at line 38 of file ESElectronicsSimFast.h.
Referenced by setGain().
const ESIntercalibConstants* ESElectronicsSimFast::mips_ [private] |
Definition at line 40 of file ESElectronicsSimFast.h.
Referenced by setMIPs(), and standEncode().
double ESElectronicsSimFast::MIPToGeV_ [private] |
Definition at line 41 of file ESElectronicsSimFast.h.
Referenced by setMIPToGeV(), and standEncode().
const ESPedestals* ESElectronicsSimFast::peds_ [private] |
Definition at line 39 of file ESElectronicsSimFast.h.
Referenced by fastEncode(), setPedestals(), and standEncode().