#ifndef ADETPARAMS_H_INCLUDED #define ADETPARAMS_H_INCLUDED #include #include // just a container of information class achannel_t { public: achannel_t() : myID(-1), tfall(4600.f), trise(800.f), egain(1.f), sgain(1.f), emink(10.f), tmove(0), tfast(35.f), oGainSG(1.f), oGainCC(1.f), lambdaE(0), lambdaH(0), cGainSG(1.f), cGainCC(1.f) {} int myID; // detector/channel sequential number float tfall; // main pole of the exponential (samples) float trise; // risetime of the trapezoid (samples) float egain; // energy calibration (keV/chan) float sgain; // amplitude calibration of traces (keV/chan) float emink; // energy threshold (keV) float tmove; // T0 shift calibration of traces (ns) float tfast; // preamplifier response (ns) float oGainSG; // extra gain before correction float oGainCC; // extra gain before correction float lambdaE; // electron-trapping correction lambdaE float lambdaH; // hole-trapping correction lambdaH float cGainSG; // extra gain after correction float cGainCC; // extra gain after correction }; //#SG gainSG_orig gainCC_orig factorE factorH gainSG_corr gainCC_corr (factor = 1/lambda ??) //template // too complicated class adetParams { static const int NCC = 2; // number of core signals static const int NSG = 36; // total number of segments static const int NSLI = 6; // number of slices (faster index) static const int NSEC = 6; // number of sectors (slower index) public: adetParams() : vtrig(-1000.f), itrig(0), nCC(NCC), nSG(NSG), doecalF2(false), bSegEmin(false), vSegEmin(0), tntFactor(2097152.f) { // 2^21 for(int nn = 0; nn < nCC; nn++) pCC[nn].myID = nn; for(int nn = 0; nn < nSG; nn++) pSG[nn].myID = nn; for(int nn = 0; nn < nSG; nn++) { memset(xTalkProp[nn], 0, sizeof(float)*nSG); memset(xTalkDiff[nn], 0, sizeof(float)*nSG); } memset(xTalkAver, 0, sizeof(float)*nSG); } float vtrig; // discriminator level (meaningful only for cores) int itrig; // which core is triggering int nCC; // number of core channels int nSG; // number of segments achannel_t pCC[NCC]; // parameters of the cores achannel_t pSG[NSG]; // parameters of the segments float xTalkProp[NSG][NSG]; // proportional cross-talk float xTalkDiff[NSG][NSG]; // differential cross-talk float xTalkAver[NSG]; // average proportional xTalk bool doecalF2; // flag to enable this correction bool bSegEmin; float vSegEmin; float tntFactor; // usually 2^21 = 2097152 void SetTriggerLevel(float value) {vtrig = value;} void SetSegMinEnergy(float value) {vSegEmin = value; bSegEmin = true;} bool ReadCalibCoeffs(std::string setupFile, bool verbose); bool ReadCalibV01(std::ifstream &cfg, std::string *keys, bool verbose); bool ReadCalibV02(std::ifstream &cfg, std::string *keys, bool verbose); bool ReadXtalkCoeffs(std::string cname, bool verbose); bool ReadTrappingCal(std::string cname, bool verbose); void CalcDifferentialXtalk(float xfactor); }; #endif // ADETPARAMS_H_INCLUDED