2#include <boost/program_options.hpp>
6namespace po = boost::program_options;
23 for (
auto& inner : it.second)
29 ifstream inFile(FileName.data());
30 if (!inFile.is_open()) {
31 cout <<
"Error opening map-file (" << FileName <<
")!" << endl;
37 while (inFile >> chan) {
38 Strips[chan] = iStrip++;
51 info.
strips = &(it->second);
53 string map_file_name =
54 string(getenv(
"VMCWORKDIR")) +
"/input/" + string(
fDetName.Data()) +
"_" + info.
channel_name +
".txt";
56 LOGF(info,
"Reading: %s", map_file_name.data());
69 Int_t strip_shift = 0;
76 vector<string> channel_map;
77 vector<string> spec_thr;
84 po::options_description desc(
"Options");
85 desc.add_options()(
"CHANNEL_MAP.channels", po::value<vector<string>>(&channel_map)->multitoken(),
86 "ADC channel -> strip map")(
"SIGNAL_CONFIGURATION.spec_thr",
87 po::value<vector<string>>(&spec_thr)->multitoken(),
88 "ADC channel -> strip map")(
89 "SIGNAL_CONFIGURATION.Threshold", po::value<Double_t>(&final_thr)->default_value(950),
"ADC final threshold")(
90 "SIGNAL_CONFIGURATION.ThresholdDif", po::value<Double_t>(&thr_dif)->default_value(50),
"ADC final threshold")(
91 "SIGNAL_CONFIGURATION.NIterations", po::value<Int_t>(&n_iters)->default_value(6),
"ADC final threshold")(
92 "SIGNAL_CONFIGURATION.CModCut", po::value<Double_t>(&cmod_cut)->default_value(0),
"ADC final threshold");
97 LOG(info) <<
"Loading SiBT Map: Period " <<
fPeriod <<
", Run " <<
fRun <<
" " << name;
98 ifstream config_file(name.
Data(), ifstream::in);
99 if (!config_file.is_open()) {
100 LOG(error) <<
"Error opening map-file (" << name <<
")!";
103 po::store(po::parse_config_file(config_file, desc), vm);
113 for (
auto& str : spec_thr) {
114 istringstream ss(str);
115 ss >> std::hex >> ser >> std::dec >> ch >> thr;
117 LOGF(debug,
"Serial 0x%08X Channel %2d Threshold %3.3f", ser, ch, thr);
121 for (
auto& str : channel_map) {
122 istringstream ss(str);
123 ss >> std::hex >> ser >> std::dec >> ch_lo >> strip_shift >> ch_name >> mod >> lay >> station;
128 .strip_shift = strip_shift,
129 .channel_name = ch_name,
131 .strips =
nullptr}));
190 for (
Int_t iMod = 0; iMod < st->GetNModules(); ++iMod) {
191 auto* mod = st->GetModule(iMod);
192 for (
Int_t iLay = 0; iLay < mod->GetNStripLayers(); ++iLay) {
195 auto& lay = mod->GetStripLayer(iLay);
196 Int_t kNBunches = lay.GetNStrips() / kNStripsInBunch;
197 for (
Int_t iBunch = 0; iBunch < kNBunches; ++iBunch) {
199 for (
Int_t iStrip = 0; iStrip < kNStripsInBunch; ++iStrip) {
200 Int_t strip = iStrip + iBunch * kNStripsInBunch;
207 mean /= kNStripsInBunch;
208 for (
Int_t iStrip = 0; iStrip < kNStripsInBunch; ++iStrip) {
209 Int_t strip = iStrip + iBunch * kNStripsInBunch;
215 if ((kNThresh *
Abs(mean) <
Abs(curr - mean)) ) {
216 LOGF(debug2,
"profile noise on iSt %d iMod %d iLay %d strip %d", iSt, iMod, iLay, strip);
252 SpecThr = itThr->second;
261 LOGF(debug2,
"noisy %4d %4d %4d", iCr, iCh, iSmpl);
277 fSigProf[station][module][layer]->Fill(strip);
BmnStatus
Define status code.
void DeleteStripNoiseArrays(SST &ss)
void InitStripNoiseArrays(SST &ss)
map< PlMapKey, Double_t > fSpecThreshMap
Double_t *** GetPedestalsRMS()
void CalcEventMods_simd()
BmnAdcProcessor(uint32_t period, uint32_t run, TString det, uint16_t nCh, const uint16_t nSmpl, BmnSetup setup=kBMNSETUP)
void SetThreshold(Double_t final_thr, Double_t thr_dif=-1, Double_t n_iters=-1, Double_t cmod_cut=-1)
Bool_t **** fNoisyChannels
void GrabNewSerial(UInt_t serial)
const uint16_t GetNChannels()
void InitChipNoiseArrays()
const uint16_t GetNSamples()
Bool_t *** GetNoisyChipChannels()
void(BmnAdcProcessor::* PrecalcEventModsImp)(TClonesArray *adc)
vector< uint32_t > & GetSerials()
BmnStatus FillNoisyChannels()
map< Char_t, StripMap > fLocalMaps
BmnStatus ReadLocalMap(string &FileName, StripMap &Strips)
void ProcessAdc(TClonesArray *silicon, Bool_t doFill)
Int_t MapStrip(BmnSiBTMapping &v, Short_t &iSmpl)
BmnSiBTRaw2Digit(Int_t period, Int_t run, TString MapFileName, BmnSetup bmnSetup=kBMNSETUP)
map< UInt_t, InChanMapSiBT > fOuterMap
BmnStatus FillEvent(TClonesArray *adc, TClonesArray *sts)
virtual ~BmnSiBTRaw2Digit()
BmnStatus ReadLocalMaps()
map< PlMapKey, BmnSiBTMapping > fGlobalMap
// serial map
unique_ptr< BmnSiBTStationSet > fSiBTStationSet
BmnStatus FillProfiles(TClonesArray *adc)
void SetIsGoodDigit(Bool_t tmp)
virtual Double_t GetBinContent(Int_t bin) const
Int_t GetEntriesFast() const
const char * Data() const
#define ADC_SIBT_N_SAMPLES
Double_t Max(Double_t a, Double_t b)