11#include <RtypesCore.h>
26 , fLookUpFilename(infile)
68 Double_t charge = 0.0;
85 LOG(fatal) <<
"CbmTrdRawToDigiLookUpCorrR::prepareLookUpTables: Look up mode that reqiures an input file "
86 "requested with empty infile name string!";
97 TFile file(infile.data(),
"READ");
100 TH2* hTimeshiftMap = file.Get<TH2>(hname.data());
101 LOG_IF(fatal, !hTimeshiftMap)
102 <<
"CbmTrdRawToDigiLookUpCorrR::loadLookUpTables: Look up mode that reqiures Timeshift Map "
103 "histogram requested, but the map "
104 << hname <<
" was not found in the given file(" << infile <<
")!";
106 TH2* hMaxAdcMap = file.Get<TH2>(hname.data());
107 LOG_IF(fatal, !hMaxAdcMap) <<
"CbmTrdRawToDigiLookUpCorrR::loadLookUpTables: Look up mode that reqiures MaxAdc Map "
108 "histogram requested, but the map "
109 << hname <<
" was not found in the given file(" << infile <<
")!";
114 if (hMaxAdcMap && hTimeshiftMap) {
116 for (Int_t ibinx = 1; ibinx <=
h->GetNbinsX(); ibinx++) {
117 for (Int_t ibiny = 1; ibiny <=
h->GetNbinsY(); ibiny++) {
118 fMaxAdcLookUpMap[
h->GetXaxis()->GetBinCenter(ibinx)][
h->GetYaxis()->GetBinCenter(ibiny)] =
119 h->GetBinContent(ibinx, ibiny);
124 for (Int_t ibinx = 1; ibinx <=
h->GetNbinsX(); ibinx++) {
125 for (Int_t ibiny = 1; ibiny <=
h->GetNbinsY(); ibiny++) {
127 h->GetBinContent(ibinx, ibiny);
134 LOG(fatal) <<
"CbmTrdRawToDigiLookUpCorrR::loadLookUpTables: Look up mode that reqiures an input file "
135 "requested with a wrong file path! Filepath = "
144 UInt_t chargeFirstSample = 0;
145 UInt_t chargeSecondSample = 0;
147 for (Int_t timeshift = 0; timeshift <
fSpadic->GetClockCycle(); timeshift += 1) {
149 for (UInt_t maxAdc = 1; maxAdc <
fSpadic->GetDynamicRange() * 2; maxAdc++) {
156 auto innerpair = std::make_pair(chargeSecondSample, timeshift);
159 innermap->second.emplace(innerpair);
162 std::map<UInt_t, ULong64_t> newinnermap = {};
163 newinnermap.emplace(innerpair);
164 auto outerpair = std::make_pair(chargeFirstSample, newinnermap);
173 ULong64_t timeshift = 0;
174 std::vector<ULong64_t> timeshiftsvec = {};
175 std::vector<UInt_t> emptyChargeVec = {};
180 for (UInt_t secondsampleCharge = 0; secondsampleCharge <
fSpadic->GetDynamicRange(); secondsampleCharge++) {
181 if (innermap.second.find(secondsampleCharge) == innermap.second.end())
182 emptyChargeVec.emplace_back(secondsampleCharge);
184 timeshift = innermap.second.find(secondsampleCharge)->second;
185 for (
auto emptycharge : emptyChargeVec) {
186 auto pair = std::make_pair(emptycharge, timeshift);
187 innermap.second.emplace(pair);
189 emptyChargeVec.clear();
192 for (
auto emptycharge : emptyChargeVec) {
193 auto pair = std::make_pair(emptycharge, timeshift);
194 innermap.second.emplace(pair);
196 emptyChargeVec.clear();
ClassImp(CbmConverterManager)
Class for extracting information from raw signals to digi level.
Software representation of the SPADIC v2.2+.
Data class with information on a STS local track.
std::shared_ptr< CbmTrdSpadic > fSpadic
Float_t GetBaseline(const std::vector< std::int16_t > *samples)
Get the Baseline value.
ULong64_t fCurrentTimeshift
Bin timeshift for the current sample set in [ns].
CbmTrdRawToDigiLookUpCorrR(std::string infile="", eLookUpModes mode=eLookUpModes::kTwoSamplesFileInput)
Construct a new CbmTrdRawToDigiLookUpCorrR.
std::string fLookUpFilename
File name where the look up histos are stored.
UInt_t fFirstLookUpSamplePos
Position of the first sample used in the look up tables Default corresponds to the value used in the ...
eLookUpModes fLookUpMode
Used look up mode.
bool Init(std::string infile="")
Initialise the method after all settings have been passed.
ULong64_t GetBinTimeShift(const std::vector< std::int16_t > *samples)
Get the Bin Time Shift value.
Float_t GetMaxAdcValue(const std::vector< std::int16_t > *samples)
Get the MaxAdc value.
void loadLookUpTables(std::string infile)
Load the look up tables from the given file.
Int_t fcorrFirstSample
Baseline corrected sample value of the first used sample.
std::map< Int_t, std::map< Int_t, Float_t > > fMaxAdcLookUpMap
Look up map for the max adc values for Keys correspond to charge[fCurrentTimeshift],...
std::map< UInt_t, std::map< UInt_t, ULong64_t > > fTimeshiftLookUpMap
Look up map for the bin time shift value Keys correspond to charge[fFirstLookUpSamplePos],...
UInt_t fSecondLookUpSamplePos
Position of the second sample used in the look up tables Default corresponds to the value used in the...
Int_t fcorrSecondSample
Baseline corrected sample value of the second used sample.
void prepareLookUpTables(std::string infile)
Prepare the look up tables for the used look up mode.
void createAnalyticLookUpTables()
Create a Analytical Look Up Tables.
@ kTwoSamplesFileInput
Look up mode based on two samples and statistical filling. Look up mode based on two samples with map...
@ kTwoSamplesDynamicAnalytic
Look up mode based on two samples and analytical on the fly filling. Look up mode based on two sample...