BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnRawToDigi.C
Go to the documentation of this file.
1#include <FairLogger.h>
2
3// file: full path to raw file
4// nEvents: if 0 then decode all events
5
6void BmnRawToDigi(TString file = "", TString outfile = "", Long_t nEvents = 0, UInt_t period = 8)
7{
8
9 Int_t iVerbose = 1; ///<- Verbosity level: 0 - Progress Bar; 1 - short info on passed events
10 FairLogger::GetLogger()->SetLogToScreen(true);
11 FairLogger::GetLogger()->SetLogScreenLevel("INFO");
12
13 TStopwatch timer;
14 timer.Start();
15
16 BmnDecoder* decoder = new BmnDecoder(file, outfile, 0, 8);
17 decoder->SetVerbose(iVerbose);
18 BmnSetup stp = kBMNSETUP;
19 std::map<DetectorId, bool> setup; // flags to determine BM@N setup
20 setup.insert(std::make_pair(kBC, 1)); // TRIGGERS
21 // setup.insert(std::make_pair(kMWPC, 0)); // MWPC
22 setup.insert(std::make_pair(kSILICON, 1)); // SILICON
23 setup.insert(std::make_pair(kGEM, 1)); // GEM
24 setup.insert(std::make_pair(kTOF1, 1)); // TOF-400
25 setup.insert(std::make_pair(kTOF, 1)); // TOF-700
26 setup.insert(std::make_pair(kDCH, 1)); // DCH
27 // setup.insert(std::make_pair(kZDC, 0)); // ZDC
28 // setup.insert(std::make_pair(kECAL, 0)); // ECAL
29 setup.insert(std::make_pair(kCSC, 1)); // CSC
30 setup.insert(std::make_pair(kSCWALL, 1)); // SCWALL
31 setup.insert(std::make_pair(kFHCAL, 1)); // FHCAL
32 setup.insert(std::make_pair(kHODO, 1)); // HODO
33 setup.insert(std::make_pair(kNDET, 1)); // Neutron Calorimeter Prototype
34 setup.insert(std::make_pair(kHGND, 1)); // Neutron Calorimeter
35 setup.insert(std::make_pair(kSiBT, 1)); // SiBD
36 decoder->SetDetectorSetup(setup);
37 TString PeriodSetupExt = Form("%d%s.txt", period, ((stp == kBMNSETUP) ? "" : "_SRC"));
38 decoder->SetTrigPlaceMapping(TString("Trig_PlaceMap_Run") + PeriodSetupExt);
39 decoder->SetTrigChannelMapping(TString("Trig_map_Run") + PeriodSetupExt);
40 decoder->SetSiliconMapping(TString("SILICON_map_run") + PeriodSetupExt);
41 decoder->SetSiBTMapping(TString("SiBT_map_period") + PeriodSetupExt);
42 decoder->SetGemMapping(TString("GEM_map_run") + PeriodSetupExt);
43 decoder->SetCSCMapping(TString("CSC_map_period")
44 + Form("%d%s%s.txt", period, ((stp == kBMNSETUP) ? "" : "_SRC"),
45 (decoder->GetRunId() < 7013 ? "_before_run_7013" : "")));
46 decoder->SetMSCMapping(TString("MSC_map_Run") + PeriodSetupExt);
47 // in case comment out the line decoder->SetTof400Mapping("...")
48 // the maps of TOF400 will be read from DB (only for JINR network)
49 decoder->SetTOF700ReferenceRun(7012);
50 decoder->SetTof700Geom(TString("TOF700_geometry_run") + PeriodSetupExt);
51 decoder->SetTof400Mapping(TString("TOF400_PlaceMap_RUN") + PeriodSetupExt,
52 TString("TOF400_StripMap_RUN") + PeriodSetupExt);
53 if (decoder->GetRunId() >= 4278 && decoder->GetPeriodId() == 7)
54 decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d_from_run_4278.txt", period));
55 else
56 decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d.txt", period));
57 // decoder->SetZDCMapping("ZDC_map_period_5.txt");
58 // decoder->SetZDCCalibration("zdc_muon_calibration.txt");
59 decoder->SetScWallMapping(TString("SCWALL_map_period") + PeriodSetupExt);
60 decoder->SetScWallCalibration(TString("SCWALL_calibration_period") + PeriodSetupExt);
61 decoder->SetFHCalMapping(TString("FHCAL_map_period") + PeriodSetupExt);
62 decoder->SetFHCalCalibration(TString("FHCAL_calibration_period") + PeriodSetupExt);
63 decoder->SetHodoMapping(Form("HODO_map_period%d%s.json", period, ((stp == kBMNSETUP) ? "" : "_SRC")));
64 decoder->SetHodoCalibration(Form("HODO_Q_calibration_period%d%s.json", period, ((stp == kBMNSETUP) ? "" : "_SRC")));
65 decoder->SetNdetMapping(TString("NDET_map_period") + PeriodSetupExt);
66 if ((decoder->GetRunId() >= 7506 && decoder->GetRunId() <= 7534)
67 || (decoder->GetRunId() >= 8203 && decoder->GetRunId() <= 8258))
68 decoder->SetNdetCalibration(TString("NDET_calibration_period")
69 + Form("%d_run_7506_7534_or_8203_8258.txt", period));
70 else
71 decoder->SetNdetCalibration(TString("NDET_calibration_period") + PeriodSetupExt);
72 decoder->SetHgndMapping(Form("HGND_map_period%d.json", period));
73 decoder->SetHgndCalibration(Form("HGND_calibration_period%d.json", period));
74 // decoder->SetECALMapping(TString("ECAL_map_period_") + PeriodSetupExt);
75 // decoder->SetECALCalibration("");
76 // decoder->SetMwpcMapping(TString("MWPC_map_period") + ((period == 6 && decoder->GetRunId() < 1397) ? 5 :
77 // PeriodSetupExt));
78
79 decoder->SetApplyThreshold(kTRUE); // set kFALSE to check pedestals
80 decoder->SetUseCalibFile(kFALSE); // set kTRUE to save and load strip signal calibration data
81 decoder->DecodeDataToDigi();
82
83 timer.Stop();
84 printf("\tMacro finished successfully!\n\n"); // marker of successfully execution for software testing systems
85 Double_t rtime = timer.RealTime();
86 Double_t ctime = timer.CpuTime();
87 printf("Real time %f s, CPU time %f s\n", rtime, ctime);
88 delete decoder;
89}
int Int_t
long Long_t
unsigned int UInt_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
char * Form(const char *fmt,...)
@ kBC
@ kSILICON
@ kNDET
@ kGEM
@ kTOF
@ kHGND
@ kTOF1
@ kFHCAL
@ kSCWALL
@ kCSC
@ kDCH
@ kSiBT
@ kHODO
BmnSetup
Define experimental setup.
Definition BmnEnums.h:165
@ kBMNSETUP
Definition BmnEnums.h:166
void SetApplyThreshold(bool b)
Definition BmnDecoder.h:128
void SetTOF700ReferenceRun(Int_t n)
Definition BmnDecoder.h:120
UInt_t GetPeriodId() const
Definition BmnDecoder.h:134
void SetHgndMapping(TString map)
Definition BmnDecoder.h:217
void SetTof700Geom(TString geom)
Definition BmnDecoder.h:192
void SetFHCalCalibration(TString cal)
Definition BmnDecoder.h:207
void SetHgndCalibration(TString cal)
Definition BmnDecoder.h:219
void SetDetectorSetup(std::map< DetectorId, bool > setup)
Definition BmnDecoder.h:229
void SetFHCalMapping(TString map)
Definition BmnDecoder.h:205
void SetMSCMapping(TString map)
Definition BmnDecoder.h:225
void SetUseCalibFile(bool v)
Definition BmnDecoder.h:243
void SetNdetCalibration(TString cal)
Definition BmnDecoder.h:215
void SetTrigPlaceMapping(TString map)
Definition BmnDecoder.h:160
UInt_t GetRunId() const
Definition BmnDecoder.h:132
void SetGemMapping(TString map)
Definition BmnDecoder.h:174
BmnStatus DecodeDataToDigi()
void SetHodoCalibration(TString cal)
Definition BmnDecoder.h:211
void SetTof700Mapping(TString map)
Definition BmnDecoder.h:190
void SetTrigChannelMapping(TString file)
Definition BmnDecoder.h:168
void SetScWallMapping(TString map)
Definition BmnDecoder.h:201
void SetCSCMapping(TString map)
Definition BmnDecoder.h:166
void SetSiliconMapping(TString map)
Definition BmnDecoder.h:162
void SetVerbose(Int_t v)
Definition BmnDecoder.h:239
void SetTof400Mapping(TString PlaceMap, TString StripMap)
Definition BmnDecoder.h:178
void SetScWallCalibration(TString cal)
Definition BmnDecoder.h:203
void SetHodoMapping(TString map)
Definition BmnDecoder.h:209
void SetNdetMapping(TString map)
Definition BmnDecoder.h:213
void SetSiBTMapping(TString map)
Definition BmnDecoder.h:164
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
Double_t CpuTime()
void Stop()
void BmnRawToDigi(TString file="", TString outfile="", Long_t nEvents=0, UInt_t period=8)
Definition BmnRawToDigi.C:6