BmnRoot 26.10.0-233-gb9bbe585
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
expdata.C
Go to the documentation of this file.
1/*
2 BM@N alignment routine
3 BM@N experiment at NICA complex, JINR, 2025
4
5 Department: Math & Soft Group of HEP lab
6 Author: Igor Polev, polev@jinr.int
7
8 ROOT data export macro
9*/
10
11#ifndef __CLING__
12#include "BmnRootIterator.h"
13#include "BmnRun8cgDM.h"
15#include "TStopwatch.h"
16
17#include <fstream>
18#endif
19
20#define BMN_IN_FILELIST "/home/igor/data.cache/7466.test_01-rl/7466.test_01-rl.list"
21#define BMN_EXPORT_FILE "/home/igor/DATA/bmn/nn/e22.7466.test_01-rl.csv"
22
23int expdata(int argc = 0, char** argv = nullptr)
24{
25 TStopwatch timer;
26
27 // prepare ROOT file readers and histograms
28 BmnRun8cgDM detModel;
29 detModel.Init();
31 BmnRootIterator data(BMN_IN_FILELIST, detModel, &pb);
32
33 // prepare export file
34 std::ofstream f(BMN_EXPORT_FILE, std::ofstream::out);
35 f << "eventID,trackID,detectorID,x,y,z,wx,wy\n";
36
37 // process ROOT data
38 Int_t trackID{0}, hitCnt{0};
39 pb.Init();
40 data.ResetAll();
41 while (!data.EndOfTracks()) {
42 while (!data.EndOfHits()) {
43 f << data.EventID() << "," << trackID << "," << data.HitDetectorID() << "," << data.HitX() << ","
44 << data.HitY() << "," << data.HitZ() << "," << data.HitWx() << "," << data.HitWy() << "\n";
45 hitCnt++;
46 data.NextHit();
47 }
48 trackID++;
49 data.NextTrack();
50 }
51 pb.Clear();
52 std::cout << "Tracks exported: " << trackID << std::endl;
53 std::cout << "Hits exported: " << hitCnt << std::endl;
54
55 f.close();
56 // no memory cleanup in ROOT macro mode
57 std::cout << "Done in " << timer.RealTime() << "s" << std::endl;
58 return 0;
59}
int Int_t
Bool_t EndOfTracks() const noexcept
Bool_t EndOfHits() const noexcept
Bool_t Init(const char *targetGeoFile=nullptr)
virtual Double_t HitY() const override
UInt_t EventID() const noexcept
virtual void ResetAll() override
virtual Double_t HitWy() const override
virtual Int_t HitDetectorID() const override
virtual Double_t HitZ() const override
virtual Double_t HitX() const override
virtual Double_t HitWx() const override
virtual void NextTrack() override
virtual void NextHit() override
Double_t RealTime()
#define BMN_EXPORT_FILE
Definition expdata.C:21
#define BMN_IN_FILELIST
Definition expdata.C:20
int expdata(int argc=0, char **argv=nullptr)
Definition expdata.C:23