BmnRoot 26.10.0-18-g4e3414f9
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.ru
7
8 ROOT data export macro
9*/
10
11#ifndef __CLING__
12#include "BmnRootIterator.h"
13#include "BmnRun8DetModel.h"
14#include "TStopwatch.h"
15
16#include <fstream>
17#endif
18
19#define BMN_IN_FILELIST "cfg/dstDataExample.txt"
20#define BMN_EXPORT_FILE "data.csv"
21
22int expdata(int argc = 0, char** argv = nullptr)
23{
24 TStopwatch timer;
25
26 // prepare ROOT file readers and histograms
27 BmnRun8DetModel detModel;
28 detModel.Init();
29 BmnRootIterator data(BMN_IN_FILELIST, detModel);
30
31 // prepare export file
32 std::ofstream f(BMN_EXPORT_FILE, std::ofstream::out);
33 f << "trackID,detectorID,x,y,z,wx,wy\n";
34
35 // process ROOT data
36 Int_t trackID{0}, hitCnt{0};
37 data.ResetAll();
38 while (!data.EndOfTracks()) {
39 while (!data.EndOfHits()) {
40 f << trackID << "," << data.HitDetectorID() << "," << data.HitX() << "," << data.HitY() << ","
41 << data.HitZ() << "," << data.HitWx() << "," << data.HitWy() << "\n";
42 hitCnt++;
43 data.NextHit();
44 }
45 trackID++;
46 data.NextTrack();
47 }
48 std::cout << "Tracks exported: " << trackID << std::endl;
49 std::cout << "Hits exported: " << hitCnt << std::endl;
50
51 f.close();
52 // no memory cleanup in ROOT macro mode
53 std::cout << "Done in " << timer.RealTime() << "s" << std::endl;
54 return 0;
55}
int Int_t
Bool_t EndOfTracks() const noexcept
Bool_t EndOfHits() const noexcept
virtual Double_t HitY() const override
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:20
#define BMN_IN_FILELIST
Definition expdata.C:19
int expdata(int argc=0, char **argv=nullptr)
Definition expdata.C:22