BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnDataToRoot.C
Go to the documentation of this file.
1// file: full path to raw file
2// nEvents: if 0 then decode all events
3// doConvert: convert RAW --> ROOT before decoding or use file converted before
5 TString outfile = "",
6 Long_t nEvents = 0,
7 Bool_t doConvert = kTRUE,
8 Bool_t doHoldRawRoot = kFALSE)
9{
10 gSystem->ExpandPathName(file);
11 gSystem->ExpandPathName(outfile);
12
13 Int_t iVerbose = 1; ///<- Verbosity level: 0 - Progress Bar; 1 - short info on passed events
14 UInt_t period = 7;
15 BmnRawDataDecoder* decoder = new BmnRawDataDecoder(file, outfile, nEvents, period);
16 // use kSRCSETUP for Short-Range Correlation program and kBMNSETUP otherwise
17 BmnSetup stp = (decoder->GetRunId() >= 2041 && decoder->GetRunId() <= 3588) ? kSRCSETUP : kBMNSETUP;
18 decoder->SetBmnSetup(stp);
19 decoder->SetVerbose(iVerbose);
20
21 Bool_t setup[11]; // array of flags to determine BM@N setup
22 // Just put "0" to exclude detector from decoding
23 setup[0] = 1; // TRIGGERS
24 setup[1] = 0; // MWPC
25 setup[2] = 0; // SILICON
26 setup[3] = 0; // GEM
27 setup[4] = 0; // TOF-400
28 setup[5] = 0; // TOF-700
29 setup[6] = 0; // DCH
30 setup[7] = 0; // ZDC
31 setup[8] = 1; // ECAL
32 setup[9] = 0; // LAND
33 setup[10] = 0; // CSC
34 decoder->SetDetectorSetup(setup);
35 decoder->SetAdcDecoMode(kBMNADCMK);
36
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->SetGemMapping(TString("GEM_map_run") + PeriodSetupExt);
42 // decoder->SetCSCMapping(TString("CSC_map_period") + PeriodSetupExt);
43 decoder->SetMSCMapping(TString("MSC_map_Run") + PeriodSetupExt);
44 ////in case comment out the line decoder->SetTof400Mapping("...")
45 ////the maps of TOF400 will be read from DB (only for JINR network)
46 // decoder->SetTOF700ReferenceRun(-1);
47 // decoder->SetTof700Geom(TString("TOF700_geometry_run") + PeriodSetupExt);
48 // decoder->SetTof400Mapping(TString("TOF400_PlaceMap_RUN") +PeriodSetupExt, TString("TOF400_StripMap_RUN")
49 // +PeriodSetupExt); if (decoder->GetRunId() >= 4278 && decoder->GetPeriodId() == 7)
50 // decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d_from_run_4278.txt", period));
51 // else
52 // decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d.txt", period));
53 decoder->SetZDCMapping("ZDC_map_period_5.txt");
54 decoder->SetZDCCalibration("zdc_muon_calibration.txt");
55 decoder->SetECALMapping(TString("ECAL_map_period_") + PeriodSetupExt);
56 decoder->SetECALCalibration("");
57 // decoder->SetMwpcMapping(TString("MWPC_map_period") + ((period == 6 && decoder->GetRunId() < 1397) ? 5 :
58 // PeriodSetupExt)); decoder->SetLANDMapping("land_mapping_jinr_triplex.txt");
59 // decoder->SetLANDPedestal("r0030_land_clock.hh");
60 // decoder->SetLANDTCal("r0030_land_tcal.hh");
61 // decoder->SetLANDDiffSync("r352_cosmic1.hh");
62 // decoder->SetLANDVScint("neuland_sync_2.txt");
63 decoder->InitMaps(); /// <- should be run after all mappings set
64 if (doConvert)
65 decoder
66 ->ConvertRawToRoot(); // Convert raw data in .data format into adc-,tdc-, ..., sync-digits in .root format
67 BmnStatus decoStatus = decoder->DecodeDataToDigi(); // Decode data into detector-digits using current mappings.
68 if (!doHoldRawRoot)
69 gSystem->Exec(TString::Format("rm -f %s", decoder->GetRootFileName().Data()));
70 if (decoStatus == kBMNSUCCESS)
71 printf("\tMacro finished successfully!\n\n"); // marker of successfully execution for software testing systems
72
73 delete decoder;
74}
bool Bool_t
int Int_t
long Long_t
unsigned int UInt_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
BmnStatus
Define status code.
Definition BmnEnums.h:93
@ kBMNSUCCESS
Success.
Definition BmnEnums.h:94
BmnSetup
Define experimental setup.
Definition BmnEnums.h:165
@ kSRCSETUP
Definition BmnEnums.h:167
@ kBMNSETUP
Definition BmnEnums.h:166
void SetDetectorSetup(std::map< DetectorId, bool > setup)
void SetVerbose(Int_t v)
void SetBmnSetup(BmnSetup v)
UInt_t GetRunId() const
const char * Data() const
static TString Format(const char *fmt,...)
void BmnDataToRoot(TString file, TString outfile="", Long_t nEvents=0, Bool_t doConvert=kTRUE, Bool_t doHoldRawRoot=kFALSE)