KaliVeda
Toolkit for HIC analysis
KVRawDataReconstructor.cpp
1 //Created by KVClassFactory on Mon Jul 16 15:20:21 2018
2 //Author: eindra
3 
4 #include "KVRawDataReconstructor.h"
5 #include "KVDataSet.h"
6 #include "KVDataRepositoryManager.h"
7 
9 
10 
11 
16 {
17  // Default constructor
18  Info("KVRawDataReconstructor", "Constructed");
19 }
20 
21 
22 
23 
26 
28 {
29  // Destructor
30 }
31 
32 
33 
35 
37 {
38  TClass* recev_cl = TClass::GetClass(GetDataSet()->GetReconstructedEventClassName());
39  fRecev = ((KVReconstructedEvent*)recev_cl->New());
40 
41  Info("InitAnalysis", "Reconstructed event container class: %s", recev_cl->GetName());
42 }
43 
44 
45 
47 
49 {
50  fEvRecon.reset(new KVEventReconstructor(gMultiDetArray, fRecev));
51 
52  // get dataset to which we must associate new run
53  KVDataSet* OutputDataset =
54  gDataRepositoryManager->GetDataSet(GetDataSet()->GetOutputRepository("Reconstruction"),
55  GetDataSet()->GetName());
56 
57  fRecFile = OutputDataset->NewRunfile("recon", fRunNumber);
58 
59  std::cout << "Writing \"recon\" events in ROOT file " << fRecFile->GetName() << std::endl;
60 
61  //tree for reconstructed events
62  fRecTree = new TTree("ReconEvents", Form("%s : %s : %s",
63  gMultiDetArray->GetName(),
64  gExpDB->GetDBRunFile(fRunNumber).GetTitle(),
65  gExpDB->GetDBRunFile(fRunNumber).GetName())
66  );
67 
68  //leaves for reconstructed events
70 
71  Info("InitRun", "Created reconstructed data tree %s : %s", fRecTree->GetName(), fRecTree->GetTitle());
72 }
73 
74 
75 
77 
79 {
80  if (gMultiDetArray->HandledRawData()) {
81  fEvRecon->ReconstructEvent(gMultiDetArray->GetFiredDetectors());
82  fEvRecon->GetEvent()->SetNumber(GetEventNumber());
83  fRecTree->Fill();
84  //if(fEvRecon->GetEvent()->GetMult()) fEvRecon->GetEvent()->ls();
85  fEvRecon->GetEvent()->Clear();
86  }
87 
88  return kTRUE;
89 }
90 
91 
92 
94 
96 {
97  Info("KVRawDataReconstructor", "EndRun");
98  fRecev->Clear();
99  fRecFile->cd();
101  fRecTree->Write();
102 
103  // get dataset to which we must associate new run
104  KVDataSet* OutputDataset =
105  gDataRepositoryManager->GetDataSet(GetDataSet()->GetOutputRepository("Reconstruction"), GetDataSet()->GetName());
106  //add new file to repository
107  OutputDataset->CommitRunfile("recon", fRunNumber, fRecFile);
108 }
109 
110 
111 
113 
115 {
116  Info("KVRawDataReconstructor", "EndAnalysis");
117 }
118 
119 
120 //____________________________________________________________________________//
121 
122 
bool Bool_t
constexpr Bool_t kTRUE
char * Form(const char *fmt,...)
void WriteBatchInfo(TTree *)
KVDataSet * GetDataSet(const Char_t *repository, const Char_t *dataset) const
Return pointer to named dataset in the given repository.
const KVDataSet * GetDataSet() const
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:36
void CommitRunfile(const KVString &type, const run_index_t &run, TFile *file)
Definition: KVDataSet.cpp:1372
TFile * NewRunfile(const KVString &type, const run_index_t &run)
Definition: KVDataSet.cpp:1112
Base class for event reconstruction from array data.
static void MakeEventBranch(TTree *tree, const TString &branchname, T &event, Int_t bufsize=10000000)
Definition: KVEvent.h:210
void Clear(Option_t *opt="") override
Definition: KVEvent.h:238
const KVDBRunFile & GetDBRunFile(const run_index_t &r) const
Definition: KVExpDB.h:93
Bool_t HandledRawData() const
const KVSeqCollection * GetFiredDetectors() const
Abstract base class for user analysis of raw data.
Long64_t GetEventNumber() const
run_index_t fRunNumber
run number of current file
Manage task of reconstruction of physical events from raw data.
std::unique_ptr< KVEventReconstructor > fEvRecon
virtual ~KVRawDataReconstructor()
Destructor.
KVReconstructedEvent * fRecev
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
Bool_t cd() override
const char * GetName() const override
const char * GetTitle() const override
virtual const char * GetName() const
virtual void Info(const char *method, const char *msgfmt,...) const
virtual Int_t Fill()
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
void Info(const char *location, const char *fmt,...)
ClassImp(TPyArg)