37 uint16_t chan_shift = 0;
43 vector<string> channel_map;
44 vector<string> spec_thr;
51 po::options_description desc(
"Options");
52 desc.add_options()(
"CHANNEL_MAP.channels", po::value<vector<string>>(&channel_map)->multitoken(),
53 "ADC channel -> strip map")(
"SIGNAL_CONFIGURATION.spec_thr",
54 po::value<vector<string>>(&spec_thr)->multitoken(),
55 "ADC channel -> strip map")(
56 "SIGNAL_CONFIGURATION.Threshold", po::value<Double_t>(&final_thr)->default_value(30),
"ADC final threshold")(
57 "SIGNAL_CONFIGURATION.ThresholdDif", po::value<Double_t>(&thr_dif)->default_value(15),
"ADC final threshold")(
58 "SIGNAL_CONFIGURATION.NIterations", po::value<Int_t>(&n_iters)->default_value(5),
"ADC final threshold")(
59 "SIGNAL_CONFIGURATION.CModCut", po::value<Double_t>(&cmod_cut)->default_value(0),
"ADC final threshold");
64 LOG(info) <<
"name " << name;
65 LOG(info) <<
"Loading CSC Map: Period " <<
fPeriod <<
", Run " <<
fRun <<
" " << name;
66 ifstream config_file(name.
Data(), ifstream::in);
67 if (!config_file.is_open()) {
68 LOG(error) <<
"Error opening map-file (" << name <<
")!";
71 po::store(po::parse_config_file(config_file, desc), vm);
81 for (
auto& str : spec_thr) {
82 istringstream ss(str);
83 ss >> std::hex >> ser >> std::dec >> ch >> thr;
85 LOGF(debug,
"Serial 0x%08X Channel %2d Threshold %3.3f", ser, ch, thr);
89 for (
auto& str : channel_map) {
90 istringstream ss(str);
91 ss >> std::hex >> ser >> std::dec >> ch_lo >> ch_hi >> chan_shift >> station >> mod >> lay >> prefix;
105 p.first->second.shift_map.insert(make_pair(make_pair(mod, lay), chan_shift));
108 lcsc.
shift_map.insert(make_pair(make_pair(mod, lay), chan_shift));
115 inner.insert(make_pair(record->
channel_low - 1,
nullptr));
117 fOuterMap.insert(make_pair(ser, move(inner)));
121 auto innerItLo = inner.find(record->
channel_low - 1);
122 if (innerItHi == inner.end()) {
125 if (innerItHi->second ==
nullptr) {
126 inner.erase(innerItHi);
134 if (innerItLo == inner.end()) {
135 inner.insert(make_pair(record->
channel_low - 1,
nullptr));
170 const string& prefix = map_el.first.first;
175 uint16_t iMod = p.first.first;
176 int8_t iLay = p.first.second;
177 uint16_t chan_shift = p.second;
178 Int_t written_layer = ((iMod == 1) && (
fPeriod < 8)) ? ((iLay + 2) % 4) : iLay;
179 string map_file_name = string(getenv(
"VMCWORKDIR")) +
"/input/" + string(
fDetName.Data()) + prefix +
"m"
180 + to_string(iMod) +
"l" + to_string(written_layer) +
".txt";
183 printf(
"Error reading %s\n", map_file_name.data());
247 auto innerIt = inner.lower_bound(iCh);
248 if (innerIt == inner.end())
253 uint16_t station = rec->
station;
254 uint16_t module = rec->
module;
255 for (uint16_t iSmpl = 0; iSmpl <
GetNSamples(); ++iSmpl) {
260 MapStrip(rec, iCh, iSmpl, layer, strip);
270 for (UInt_t iMod = 0; iMod < (UInt_t)st->GetNModules(); ++iMod) {
271 auto* mod = st->GetModule(iMod);
272 for (
Int_t iLay = 0; iLay < mod->GetNStripLayers(); ++iLay) {
273 auto& lay = mod->GetStripLayer(iLay);
274 Int_t kNBunches = lay.GetNStrips() / kNStripsInBunch;
276 for (
Int_t iBunch = 0; iBunch < kNBunches; ++iBunch) {
278 for (
Int_t iStrip = 0; iStrip < kNStripsInBunch - 1; ++iStrip) {
279 Int_t strip = iStrip + iBunch * kNStripsInBunch;
286 mean /= kNStripsInBunch;
287 for (
Int_t iStrip = 0; iStrip < kNStripsInBunch - 1; ++iStrip) {
288 Int_t strip = iStrip + iBunch * kNStripsInBunch;
294 if (kNThresh * mean <
Abs(next - mean))
307 auto innerIt = inner.lower_bound(iCh);
308 if (innerIt == inner.end())
313 uint16_t station = rec->
station;
314 uint16_t module = rec->
module;
315 for (uint16_t iSmpl = 0; iSmpl <
GetNSamples(); ++iSmpl) {
318 MapStrip(rec, iCh, iSmpl, layer, strip);
348 auto innerIt = it->second.lower_bound(iCh);
349 if (innerIt == it->second.end())
355 uint16_t station = rec->
station;
356 uint16_t module = rec->
module;
363 SpecThr = itThr->second;
364 for (uint16_t iSmpl = 0; iSmpl <
GetNSamples(); ++iSmpl) {
372 MapStrip(rec, iCh, iSmpl, layer, strip);
388 fSigProf[station][module][layer]->Fill(strip);