6#ifndef BMNADCPROCESSOR_H
7#define BMNADCPROCESSOR_H
16#include <unordered_map>
20#include <TClonesArray.h>
25#include <TStopwatch.h>
30#include <FairLogger.h>
32#include "BmnADCDigit.h"
33#include "BmnAliases.h"
34#include "BmnCalibData.h"
37#include <BmnCSCStationSet.h>
38#include <BmnGemStripStationSet.h>
39#include <BmnSiBTStationSet.h>
40#include <BmnSiProfStationSet.h>
41#include <BmnSiliconStationSet.h>
43#define N_EV_FOR_PEDESTALS 500
44#define ADC_N_CHANNELS 64
45#define ADC_PROF_N_CHANNELS 2
46#define ADC_SIBT_N_SAMPLES 64
47#define ADC128_N_SAMPLES 128
48#define ADC32_N_SAMPLES 32
53using std::unordered_map;
60 BmnAdcProcessor(uint32_t period, uint32_t
run, TString det, Int_t nCh,
const Int_t nSmpl);
72 Double_t
CalcCMS(Double_t* samples, Int_t size);
118 return (nSmpl == 128) ? 1542 : 1992;
129 void SetThreshold(Double_t final_thr, Double_t thr_dif = -1, Double_t n_iters = -1, Double_t cmod_cut = -1);
153 template<
typename cl>
157 UInt_t serial = it.first;
158 auto serIter =
fSerMap.find(serial);
159 if (serIter ==
fSerMap.end()) {
161 printf(
"Adding %08X to the map, iSer = %d\n", serial,
fNSerials);
168 template<
typename SST>
171 Int_t kNStations = ss->GetNStations();
174 for (Int_t iSt = 0; iSt < kNStations; ++iSt) {
175 auto* st = ss->GetStation(iSt);
176 UInt_t nModules = st->GetNModules();
177 fSigProf[iSt] =
new TH1F**[nModules];
179 for (UInt_t iMod = 0; iMod < nModules; ++iMod) {
180 auto* mod = st->GetModule(iMod);
181 Int_t nLayers = mod->GetNStripLayers();
182 fSigProf[iSt][iMod] =
new TH1F*[nLayers];
184 for (Int_t iLay = 0; iLay < nLayers; ++iLay) {
185 auto& lay = mod->GetStripLayer(iLay);
186 Int_t nStrips = lay.GetNStrips();
188 histName.Form(
"%s_%d_%d_%d",
fDetName.Data(), iSt, iMod, iLay);
190 printf(
"SigProf %s\n", histName.Data());
191 fSigProf[iSt][iMod][iLay] =
new TH1F(histName, histName, nStrips, 0, nStrips);
192 fSigProf[iSt][iMod][iLay]->SetDirectory(0);
194 for (Int_t iStrip = 0; iStrip < nStrips; ++iStrip)
201 template<
typename SST>
204 Int_t kNStations = ss->GetNStations();
205 for (Int_t iSt = 0; iSt < kNStations; ++iSt) {
206 auto* st = ss->GetStation(iSt);
207 for (Int_t iMod = 0; iMod < st->GetNModules(); ++iMod) {
208 auto* mod = st->GetModule(iMod);
209 for (Int_t iLay = 0; iLay < mod->GetNStripLayers(); ++iLay) {
269 UInt_t*** fAdcProfiles;
void PrecalcEventMods(TClonesArray *adc)
Double_t **** fPedDat
data set to calculate pedestals
BmnStatus RecalculatePedestalsAugmented()
map< PlMapKey, Double_t > fSpecThreshMap
Double_t **** GetPedData()
Double_t *** GetPedestalsRMS()
void CalcEventMods_simd()
Bool_t *** fNoisyChipChannels
void SetNSerials(Int_t n)
vector< UInt_t > & GetSerials()
Float_t GetPedestal(Int_t iSer, Int_t ch, Int_t smpl)
static BmnStatus DrawFilterInfo(BmnCalibData *data)
void SetThreshold(Double_t final_thr, Double_t thr_dif=-1, Double_t n_iters=-1, Double_t cmod_cut=-1)
BmnStatus SaveFilterInfo(TFile *cTalibFile)
vector< vector< TH1 * > > hCMode
Bool_t **** fNoisyChannels
void CopyData2PedMap(TClonesArray *adc, UInt_t ev)
void GrabSerialsFromMap(unordered_map< UInt_t, cl > m)
void GrabNewSerial(UInt_t serial)
vector< UInt_t > fAdcSerials
list of serial id for ADC-detector
void InitNoiseArrays(SST &ss)
void PrecalcEventMods_simd(TClonesArray *adc)
void PrecalcEventModsOld(TClonesArray *adc)
Bool_t *** GetNoisyChipChannels()
unordered_map< UInt_t, Int_t > & GetSerialMap()
Float_t *** GetPedestals()
vector< vector< TH1 * > > hPedLine
void DeleteNoiseArrays(SST &ss)
vector< vector< TH1 * > > hSMode
unordered_map< UInt_t, Int_t > fSerMap
ADC serials map.
vector< vector< TH1 * > > hPedLineSi
void(BmnAdcProcessor::* PrecalcEventModsImp)(TClonesArray *adc)
Double_t CalcCMS(Double_t *samples, Int_t size)
void SetEvForPedestals(UInt_t v)
void SetApplyThreshold(bool b)
virtual ~BmnAdcProcessor()
BmnStatus LoadFilterInfo(TFile *cTalibFile)
UInt_t GetEvForPedestals()
BmnStatus RecalculatePedestals()
void SetNChannels(Int_t n)
UInt_t GetBoundaryRun(UInt_t nSmpl)