11#include "KVINDRAReconDataAnalyser.h"
12#include "KVINDRADBRun.h"
14#include "KVDataAnalysisTask.h"
19#include "KVAvailableRunsFile.h"
22#include "KVINDRATriggerConditions.h"
23#include "KVINDRAEventSelector.h"
25#include <KVReconEventSelector.h>
35 : fSelector(
nullptr), fOldSelector(
nullptr), theChain(
nullptr),
36 theRawData(
nullptr), theGeneData(
nullptr),
37 ParVal(
nullptr), ParNum(
nullptr), parList(
nullptr)
74 cout <<
"============> Analysis summary <=============" << endl;
76 GetList() <<
" with the class ";
82 cout <<
"All events will be processed." << endl;
84 cout <<
"=============================================" << endl;
119 cout <<
"Opening file " << fullPathToRunfile << endl;
121 cout <<
"Adding file " << fullPathToRunfile;
122 cout <<
" to the TChain." << endl;
124 if (
f && !
f->IsZombie()) {
128 if (!((
TTree*)
f->Get(
"ReconstructedEvents"))) {
129 Error(
"SubmitTask",
"No tree named ReconstructedEvents is present in the current file");
136 TString username = treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"");
140 Info(
"SubmitTask",
"No TEnv object associated to the tree");
165 if (!new_selector || !new_selector->
InheritsFrom(
"TSelector")) {
166 cout <<
"The selector \"" <<
GetUserClass() <<
"\" is not valid." << endl;
167 cout <<
"Process aborted." << endl;
172 Info(
"SubmitTask",
"Beginning TChain::Process...");
235 vector<int> triggers;
237 while (!all_runs.
End()) {
239 if (triggers.size() == 0
240 || std::find(triggers.begin(), triggers.end(), dbrun->
GetTrigger()) != triggers.end()) {
245 std::sort(triggers.begin(), triggers.end());
247 for (std::vector<int>::iterator it = triggers.begin(); it != triggers.end(); ++it) {
248 cout <<
" ---> Trigger M>" << *it << endl;
250 while (!all_runs.
End()) {
255 cout <<
"\t[File written: " << dbrun->
GetDatime().
297 else Warning(
"preInitAnalysis",
"could not set branch name correctly");
355 physics_parameters_only = (
fSelector->
GetOpt(
"WithCalibInfos") !=
"yes");
362 cout << endl <<
" =================== New Run =================== " <<
372 cout << endl <<
" ================================================= " <<
378 Info(
"preInitRun",
"Data written with series %s, release %d",
GetDataSeries().Data(),
462 Warning(
"ConnectRawDataTree",
"RawData tree not found in file; raw data parameters of detectors will not be available in analysis");
466 Info(
"ConnectRawDataTree",
"Found RawData tree in file");
476 Info(
"ConnectRawDataTree",
"Connected raw data parameters");
495 cout <<
" --> No pulser & laser data for this run !!!" << endl << endl;
499 <<
" events" << endl << endl;
521 if (!treeInfos)
return;
522 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
523 cout <<
"INFORMATIONS ON VERSION OF KALIVEDA USED TO GENERATE FILE:" << endl << endl;
526 cout <<
"build date = " << treeInfos->
GetValue(
"KVBase::GetKVBuildDate()",
"(unknown)") << endl ;
527 cout <<
"source directory = " << treeInfos->
GetValue(
"KVBase::GetKVSourceDir()",
"(unknown)") << endl ;
528 cout <<
"KVROOT = " << treeInfos->
GetValue(
"KVBase::GetKVRoot()",
"(unknown)") << endl ;
529 cout <<
"BZR branch name = " << treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)") << endl ;
530 cout <<
"BZR revision #" << treeInfos->
GetValue(
"KVBase::bzrRevisionNumber()",
"(unknown)") << endl ;
531 cout <<
"BZR revision ID = " << treeInfos->
GetValue(
"KVBase::bzrRevisionId()",
"(unknown)") << endl ;
532 cout <<
"BZR revision date = " << treeInfos->
GetValue(
"KVBase::bzrRevisionDate()",
"(unknown)") << endl ;
533 cout << endl <<
"INFORMATIONS ON GENERATION OF FILE:" << endl << endl;
534 cout <<
"Generated by : " << treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"(unknown)") << endl ;
535 cout <<
"Analysis task : " << treeInfos->
GetValue(
"AnalysisTask",
"(unknown)") << endl ;
536 cout <<
"Job name : " << treeInfos->
GetValue(
"BatchSystem.JobName",
"(unknown)") << endl ;
537 cout <<
"Job submitted from : " << treeInfos->
GetValue(
"LaunchDirectory",
"(unknown)") << endl ;
538 cout <<
"Runs : " << treeInfos->
GetValue(
"Runs",
"(unknown)") << endl ;
539 cout <<
"Number of events requested : " << treeInfos->
GetValue(
"NbToRead",
"(unknown)") << endl ;
540 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
R__EXTERN TProof * gProof
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void Print(Option_t *opt="") const
Handles lists of available runs for different datasets and types of data.
virtual void UpdateInfos(Int_t run, const Char_t *filename, const Char_t *kvversion, const Char_t *username)
virtual Bool_t InfosNeedUpdate(Int_t run, const Char_t *filename)
virtual Int_t GetNumber() const
const Char_t * GetComments() const
ULong64_t GetEvents() const
KVDBSystem * GetSystem() const
virtual void Print(Option_t *option="") const
const TDatime & GetDatime() const
KV2Body * GetKinematics()
const KVString & GetUserClassOptions() const
const Char_t * GetACliCMode()
virtual Bool_t CheckIfUserClassIsValid(const KVString &alternative_base_class="")
const Char_t * GetUserClass()
KVDataAnalysisTask * GetAnalysisTask() const
virtual Bool_t CheckTaskVariables()
const KVString & GetUserClassImp() const
const KVString & GetDataType() const
EProofMode GetProofMode() const
Long64_t GetNbEventToRead(void) const
TObject * GetInstanceOfUserClass(const KVString &alternative_base_class="")
TEnv * GetBatchInfoFile() const
virtual Bool_t WithUserClass() const
Bool_t HasActivePatches() const
void Print(Option_t *="") const
Print list of currently active patches.
void InitializePatchList(TString dataset, TString datatype, Int_t runnumber, TString dataseries, Int_t datareleasenumber, const TList *streamerinfolist)
Fill lists of active patches for given data.
void Apply(KVReconstructedEvent *)
Apply all currently active patches to event.
void SetCurrentRun(KVDBRun *r)
const KVNumberList & GetRunList() const
virtual void set_up_analyser_for_task(KVDataAnalyser *the_analyser)
void WriteBatchEnvFile(const TString &jobname, Bool_t save=kTRUE)
const KVDBSystem * GetSystem() const
const KVDataSet * GetDataSet() const
Int_t GetRunNumberFromFileName(const Char_t *)
Get the run number from the filename.
void SetSystem(KVDBSystem *syst)
Set the System used in the analysis.
const KVNumberList & GetFullRunList() const
FileType * OpenRunfile(const Char_t *type, Int_t run)
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
KVNumberList GetRunList(const Char_t *data_type, const KVDBSystem *sys=0) const
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
KVExpDB * GetDataBase(Option_t *opt="") const
KVEvent * GetEvent() const
void SetBranchName(const Char_t *n)
Bool_t IsOptGiven(const Char_t *option)
TString GetOpt(const Char_t *option) const
Int_t GetEventNumber() const
KVDBRun * GetDBRun(Int_t number) const
Database entry for each run of an INDRA experiment.
KVINDRADBRun * GetRun(Int_t run) const
Base class for analysis of reconstructed INDRA events.
Manage analysis of reconstructed INDRA data.
void preInitAnalysis() override
void SetTriggerConditionsForRun(int) override
void SetSelectorCurrentRun(KVINDRADBRun *CurrentRun)
Int_t GetDataReleaseNumber() const
TTree * theChain
chain of TTrees to be analysed
void SubmitTask() override
void CloneRawAndGeneTrees()
void WriteBatchEnvFile(const TString &, Bool_t sav=kTRUE) override
KVDataPatchList fRustines
patches to be applied to correct data before analysis
TEnv * GetReconDataTreeInfos() const
void preInitRun() override
TTree * theGeneData
gene data TTree in recon file
KVOldINDRASelector * fOldSelector
backwards compatibility
void PrintTreeInfos()
Print informations on currently analysed TTree.
KVReconstructedEvent * GetReconstructedEvent()
void ConnectRawDataTree()
Long64_t TotalEntriesToRead
void preAnalysis() override
Int_t fDataReleaseNum
KV release number used to write analysed data.
TTree * theRawData
raw data TTree in recon file
void ConnectGeneDataTree()
Bool_t CheckIfUserClassIsValid(const KVString &="") override
Bool_t CheckTaskVariables(void) override
Checks the task variables.
void Reset() override
Reset task variables.
Long64_t GetRawEntryNumber()
KVString fDataVersion
KV version used to write analysed data.
KVEventSelector * fSelector
the data analysis class
KVString fDataSeries
KV series used to write analysed data.
KVString GetDataSeries() const
virtual KVNumberList PrintAvailableRuns(KVString &datatype) override
Event reconstructed from energy losses in INDRA multidetector.
Set trigger conditions for analysis of reconstructed INDRA data.
void SetTriggerConditionsForRun(KVEventSelector *, Int_t, Bool_t=kFALSE)
void handle_ebyedat_raw_data_parameter(const char *param_name, uint16_t val)
void prepare_to_handle_new_raw_data()
reset acquisition parameters etc. before reading new raw data event
virtual void SetParameters(UInt_t n, Bool_t physics_parameters_only=kFALSE)
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
Strings used to represent a set of ranges of values.
KVINDRAReconEvent * GetEvent()
void SetCurrentRun(KVINDRADBRun *r)
Base class for user analysis of reconstructed data.
void SetCurrentRun(KVDBRun *r)
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
virtual void SetProof(Bool_t on=kTRUE, Bool_t refresh=kFALSE, Bool_t gettreeheader=kFALSE)
T * Get(const char *namecycle)
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
virtual void SaveLevel(EEnvLevel level)
const TList * GetStreamerInfoCache()
TObject * FindObject(const char *name) const override
const char * GetName() const override
virtual const char * GetName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual TObject * FindObject(const char *name) const
virtual Bool_t InheritsFrom(const char *classname) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
void Form(const char *fmt,...)
virtual const char * BaseName(const char *pathname)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TFile * GetCurrentFile() const
virtual Double_t GetMaximum(const char *columname)
virtual void SetDirectory(TDirectory *dir)
virtual Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
virtual Long64_t GetEntries() const
virtual TTree * CloneTree(Long64_t nentries=-1, Option_t *option="")
virtual TTree * GetTree() const
virtual TList * GetUserInfo()
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)