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"), GetDataSet()->GetName());
55 
56  fRecFile = OutputDataset->NewRunfile("recon", fRunNumber);
57 
58  std::cout << "Writing \"recon\" events in ROOT file " << fRecFile->GetName() << std::endl;
59 
60  //tree for reconstructed events
61  fRecTree = new TTree("ReconEvents", Form("%s : %s : %s",
62  gMultiDetArray->GetName(),
63  gExpDB->GetDBRun(fRunNumber)->GetTitle(),
64  gExpDB->GetDBRun(fRunNumber)->GetName())
65  );
66 
67  //leaves for reconstructed events
69 
70  Info("InitRun", "Created reconstructed data tree %s : %s", fRecTree->GetName(), fRecTree->GetTitle());
71 }
72 
73 
74 
76 
78 {
79  if (gMultiDetArray->HandledRawData()) {
80  fEvRecon->ReconstructEvent(gMultiDetArray->GetFiredDetectors());
81  fEvRecon->GetEvent()->SetNumber(GetEventNumber());
82  fRecTree->Fill();
83  //if(fEvRecon->GetEvent()->GetMult()) fEvRecon->GetEvent()->ls();
84  fEvRecon->GetEvent()->Clear();
85  }
86 
87  return kTRUE;
88 }
89 
90 
91 
93 
95 {
96  Info("KVRawDataReconstructor", "EndRun");
97  fRecev->Clear();
98  fRecFile->cd();
100  fRecTree->Write();
101 
102  // get dataset to which we must associate new run
103  KVDataSet* OutputDataset =
104  gDataRepositoryManager->GetDataSet(GetDataSet()->GetOutputRepository("Reconstruction"), GetDataSet()->GetName());
105  //add new file to repository
106  OutputDataset->CommitRunfile("recon", fRunNumber, fRecFile);
107 }
108 
109 
110 
112 
114 {
115  Info("KVRawDataReconstructor", "EndAnalysis");
116 }
117 
118 
119 //____________________________________________________________________________//
120 
121 
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:35
void CommitRunfile(const Char_t *type, Int_t run, TFile *file)
Definition: KVDataSet.cpp:1321
TFile * NewRunfile(const Char_t *type, Int_t run)
Definition: KVDataSet.cpp:1067
Base class for event reconstruction from array data.
void Clear(Option_t *opt="")
Definition: KVEvent.h:238
static void MakeEventBranch(TTree *tree, const TString &branchname, T &event, Int_t bufsize=10000000)
Definition: KVEvent.h:210
KVDBRun * GetDBRun(Int_t number) const
Definition: KVExpDB.h:76
Bool_t HandledRawData() const
const KVSeqCollection * GetFiredDetectors() const
Abstract base class for user analysis of raw data.
Int_t fRunNumber
run number of current file
Long64_t GetEventNumber() const
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)