7 cout <<
"Loading Profilometer Map: Period " << period <<
", Run " << run <<
"..." << endl;
8 string dir = string(getenv(
"VMCWORKDIR")) +
"/input/";
32 TString gPathConfig = getenv(
"VMCWORKDIR");
36 xmlConfFileName =
"ProfRun8.xml";
39 printf(
"Error! Unknown config!\n");
43 TString gPathSiliconConfig = gPathConfig +
"/parameters/profilometer/XMLConfigs/";
44 return std::make_unique<BmnSiProfStationSet>(gPathSiliconConfig + xmlConfFileName);
55 ifstream inFile(name);
56 if (!inFile.is_open())
57 cout <<
"Error opening map-file (" << name <<
")!" << endl;
60 getline(inFile, dummy);
62 while (inFile >> std::hex >> ser >> std::dec >> ch >> station >> mod >> layer) {
66 auto itLayer = it->second.find(layer);
67 if (itLayer == it->second.end())
71 auto itGlobal =
fGlobalMap.find(make_pair(ser, ch));
73 auto pair =
fGlobalMap.insert(make_pair(make_pair(ser, ch),
ProfiInfo{station, mod, &LayerInfo}));
75 itGlobal = pair.first;
78 cout <<
"ser: " << std::hex << ser << std::dec <<
" ch: " << ch << endl;
88 pt::read_json(name, conf);
89 pt::ptree pads = conf.get_child(
"modules");
90 for (
auto v = pads.begin();
v != pads.end();
v++) {
93 uint8_t mod = (*v).second.get<uint8_t>(
"moduleNumber");
94 pt::ptree maps = (*v).second.get_child(
"channelMapping");
95 for (
auto m = maps.begin();
m != maps.end();
m++) {
100 printf(
"adding %d to the map\n", mod);
102 modIter = pair.first;
104 auto& localMap = modIter->second;
105 ProfiLocal loc{.ChannelName = (*m).second.get<
char>(
"adcChName"),
106 .LayerType = (*m).second.get<
char>(
"layerType")};
108 auto locPair = localMap.insert(make_pair(loc.
LayerId, loc));
110 printf(
"adding %d : %d to the map\n", mod, loc.
LayerId);
111 auto& stripArray = locPair.first->second.StripMap;
112 pt::ptree strips = (*m).second.get_child(
"stripsMapping");
113 for (
auto stripNode = strips.begin(); stripNode != strips.end(); stripNode++) {
114 auto it = (*stripNode).second.begin();
117 int stripId = (it)->second.get_value<int16_t>();
118 int chanlId = (++it)->second.get_value<int16_t>();
119 stripArray[chanlId] = stripId;
123 }
catch (boost::exception& e) {
124 cerr << boost::diagnostic_information(e);
125 cout <<
"Unable to parse the channel map!\n" << endl;
175 const Int_t kNThresh = 3;
185 uint16_t station = 0;
189 MapStrip(info, iCh, iSmpl, station, module, layer, strip);
195 for (
Int_t iSt = 0; iSt < fSiProfStationSet->GetNStations(); ++iSt) {
196 auto* st = fSiProfStationSet->GetStation(iSt);
197 for (
Int_t iMod = 0; iMod < st->GetNModules(); ++iMod) {
198 auto* mod = st->GetModule(iMod);
199 for (
Int_t iLay = 0; iLay < mod->GetNStripLayers(); ++iLay) {
200 auto& lay = mod->GetStripLayer(iLay);
203 for (
Int_t iStrip = 0; iStrip < lay.GetNStrips(); ++iStrip) {
211 mean /= lay.GetNStrips();
212 for (
Int_t iStrip = 0; iStrip < lay.GetNStrips(); ++iStrip) {
218 if (kNThresh * mean <
Abs(next - mean))
232 uint16_t station = 0;
236 MapStrip(info, iCh, iSmpl, station, module, layer, strip);
250 for (
Int_t iCr = 0; iCr < fNSerials; ++iCr) {
260 uint16_t station = 0;
264 MapStrip(info, iCh, iSmpl, station, module, layer, strip);
288 fSigProf[station][module][layer]->Fill(strip);
map< uint16_t, ProfiLocal > LayerIdProfiMap
char * Form(const char *fmt,...)
BmnStatus
Define status code.
void DeleteStripNoiseArrays(SST &ss)
void InitStripNoiseArrays(SST &ss)
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)
Bool_t **** fNoisyChannels
const uint16_t fNChannels
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 ReadGlobalMapFile(string name)
BmnStatus FillNoisyChannels()
GlobalProfiMap fGlobalMap
static unique_ptr< BmnSiProfStationSet > GetProfStationSet(Int_t period)
Mod2LocalProfiMap fChannelMaps
BmnStatus FillProfiles(TClonesArray *adc)
string fGlobalMapFileName
BmnProfRaw2Digit(Int_t period, Int_t run)
BmnStatus FillEvent(TClonesArray *adc, TClonesArray *csc)
void ProcessAdc(TClonesArray *adc, TClonesArray *csc, Bool_t doFill)
void MapStrip(ProfiInfo &info, uint16_t ch, Int_t iSmpl, uint16_t &station, uint16_t &mod, uint16_t &lay, int16_t &strip)
BmnStatus ReadLocalMapFile(string name)
void SetIsGoodDigit(Bool_t tmp)
virtual Double_t GetBinContent(Int_t bin) const
Int_t GetEntriesFast() const
#define ADC_PROF_N_CHANNELS
Double_t Max(Double_t a, Double_t b)
int16_t StripMap[BmnProfRawTools::ChannelCnt()]