34 : fSelector(
nullptr), fOldSelector(
nullptr), theChain(
nullptr),
35 theRawData(
nullptr), theGeneData(
nullptr),
36 ParVal(
nullptr), ParNum(
nullptr), parList(
nullptr)
51 theGeneData =
nullptr;
55 fOldSelector =
nullptr;
56 TotalEntriesToRead = 0;
64 KVINDRAReconDataAnalyser::~KVINDRAReconDataAnalyser()
67 if (ParVal)
delete [] ParVal;
68 if (ParNum)
delete [] ParNum;
85 cout <<
"============> Analysis summary <=============" << endl;
86 cout <<
"Analysis of runs " << GetRunList().
87 GetList() <<
" with the class ";
88 cout <<
"\"" << GetUserClass() <<
"\"." << endl;
89 if (GetNbEventToRead()) {
90 cout << GetNbEventToRead() <<
" events will be processed." << endl;
93 cout <<
"All events will be processed." << endl;
95 cout <<
"=============================================" << endl;
116 fOldSelector =
nullptr;
118 theChain =
new TChain(
"ReconstructedEvents");
119 theChain->SetDirectory(0);
121 GetRunList().Begin();
127 while (!GetRunList().
End()) {
128 run = GetRunList().Next();
130 cout <<
"Opening file " << fullPathToRunfile << endl;
132 cout <<
"Adding file " << fullPathToRunfile;
133 cout <<
" to the TChain." << endl;
134 dynamic_cast<TChain*
>(theChain)->
Add(fullPathToRunfile);
135 if (
f && !
f->IsZombie()) {
139 if (!((
TTree*)
f->Get(
"ReconstructedEvents"))) {
140 Error(
"SubmitTask",
"No tree named ReconstructedEvents is present in the current file");
147 TString username = treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"");
151 Info(
"SubmitTask",
"No TEnv object associated to the tree");
156 TotalEntriesToRead = theChain->GetEntries();
160 if (!(option.
IsNull())) option +=
",";
161 option +=
Form(
"FullRunList=%s", GetFullRunList().GetList());
164 if (GetUserClassOptions() !=
"") {
166 option += GetUserClassOptions();
169 set_up_analyser_for_task(
this);
174 TObject* new_selector = GetInstanceOfUserClass(
"KVOldINDRASelector,KVReconEventSelector");
176 if (!new_selector || !new_selector->
InheritsFrom(
"TSelector")) {
177 cout <<
"The selector \"" << GetUserClass() <<
"\" is not valid." << endl;
178 cout <<
"Process aborted." << endl;
183 Info(
"SubmitTask",
"Beginning TChain::Process...");
185 if (GetProofMode() != KVDataAnalyser::EProofMode::None)
dynamic_cast<TChain*
>(theChain)->SetProof(
kTRUE);
190 if (GetAnalysisTask()->WithUserClass()) analysis_class.
Form(
"%s%s", GetUserClassImp().Data(), GetACliCMode());
191 else analysis_class = GetUserClass();
193 if (GetNbEventToRead()) {
194 theChain->Process(analysis_class, option.
Data(), GetNbEventToRead());
197 theChain->Process(analysis_class, option.
Data());
202 fOldSelector =
nullptr;
223 GetBatchInfoFile()->SetValue(
"UserClassAlternativeBaseClass",
"KVOldINDRASelector");
224 if (save) GetBatchInfoFile()->SaveLevel(
kEnvUser);
241 GetDataSet()->GetRunList(datatype.
Data(), GetSystem());
245 vector<int> triggers;
247 while (!all_runs.
End()) {
248 dbrun = (
KVINDRADBRun*)GetDataSet()->GetDataBase()->GetDBRun(all_runs.
Next());
249 if (triggers.size() == 0
250 || std::find(triggers.begin(), triggers.end(), dbrun->
GetTrigger()) != triggers.end()) {
255 std::sort(triggers.begin(), triggers.end());
257 for (std::vector<int>::iterator it = triggers.begin(); it != triggers.end(); ++it) {
258 cout <<
" ---> Trigger M>" << *it << endl;
260 while (!all_runs.
End()) {
261 dbrun = (
KVINDRADBRun*)GetDataSet()->GetDataBase()->GetDBRun(all_runs.
Next());
265 cout <<
"\t[File written: " << dbrun->
GetDatime().
306 if (fSelector) fSelector->SetBranchName(
"INDRAReconEvent");
307 else Warning(
"preInitAnalysis",
"could not set branch name correctly");
317 if (fSelector->InheritsFrom(
"KVINDRAEventSelector"))
320 else if (fSelector->InheritsFrom(
"KVReconEventSelector"))
324 fOldSelector->SetCurrentRun(CurrentRun);
349 Int_t run = GetRunNumberFromFileName(theChain->GetCurrentFile()->GetName());
352 SetCurrentRun(CurrentRun);
353 SetSelectorCurrentRun(CurrentRun);
354 cout << endl <<
" =================== New Run =================== " <<
364 cout << endl <<
" ================================================= " <<
367 ConnectRawDataTree();
368 ConnectGeneDataTree();
370 Info(
"preInitRun",
"Data written with series %s, release %d", GetDataSeries().Data(),
371 GetDataReleaseNumber());
372 fRustines.InitializePatchList(GetDataSet()->GetName(),
GetDataType(), run, GetDataSeries(),
373 GetDataReleaseNumber(), theChain->GetCurrentFile()->GetStreamerInfoCache());
383 Long64_t rawEntry = (fSelector ? fSelector->GetEventNumber() - 1
384 : fOldSelector->GetEventNumber() - 1);
395 return (fSelector ?
dynamic_cast<KVReconstructedEvent*
>(fSelector->GetEvent()) : fOldSelector->GetEvent());
421 if (!theRawData)
return;
423 Long64_t rawEntry = GetRawEntryNumber();
429 theRawData->GetEntry(rawEntry);
430 for (
int i = 0; i < NbParFired; i++) {
441 if (fRustines.HasActivePatches()) fRustines.Apply(
event);
461 theRawData = (
TTree*)theChain->GetCurrentFile()->Get(
"RawData");
463 Warning(
"ConnectRawDataTree",
"RawData tree not found in file; raw data parameters of detectors will not be available in analysis");
467 Info(
"ConnectRawDataTree",
"Found RawData tree in file");
468 Int_t maxNopar = theRawData->GetMaximum(
"NbParFired");
469 if (ParVal)
delete [] ParVal;
470 if (ParNum)
delete [] ParNum;
472 ParNum =
new UInt_t[maxNopar];
473 parList = (
TObjArray*)theRawData->GetUserInfo()->FindObject(
"ParameterList");
474 theRawData->SetBranchAddress(
"NbParFired", &NbParFired);
475 theRawData->SetBranchAddress(
"ParNum", ParNum);
476 theRawData->SetBranchAddress(
"ParVal", ParVal);
477 Info(
"ConnectRawDataTree",
"Connected raw data parameters");
494 theGeneData = (
TTree*)theChain->GetCurrentFile()->Get(
"GeneData");
496 cout <<
" --> No pulser & laser data for this run !!!" << endl << endl;
499 cout <<
" --> Pulser & laser data tree contains " << theGeneData->GetEntries()
500 <<
" events" << endl << endl;
510 return (
TEnv*)theChain->GetTree()->GetUserInfo()->
FindObject(
"TEnv");
521 TEnv* treeInfos = GetReconDataTreeInfos();
522 if (!treeInfos)
return;
523 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
524 cout <<
"INFORMATIONS ON VERSION OF KALIVEDA USED TO GENERATE FILE:" << endl << endl;
525 fDataVersion = treeInfos->
GetValue(
"KVBase::GetKVVersion()",
"(unknown)");
526 cout <<
"version = " << fDataVersion << endl ;
527 cout <<
"build date = " << treeInfos->
GetValue(
"KVBase::GetKVBuildDate()",
"(unknown)") << endl ;
528 cout <<
"source directory = " << treeInfos->
GetValue(
"KVBase::GetKVSourceDir()",
"(unknown)") << endl ;
529 cout <<
"KVROOT = " << treeInfos->
GetValue(
"KVBase::GetKVRoot()",
"(unknown)") << endl ;
530 cout <<
"BZR branch name = " << treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)") << endl ;
531 cout <<
"BZR revision #" << treeInfos->
GetValue(
"KVBase::bzrRevisionNumber()",
"(unknown)") << endl ;
532 cout <<
"BZR revision ID = " << treeInfos->
GetValue(
"KVBase::bzrRevisionId()",
"(unknown)") << endl ;
533 cout <<
"BZR revision date = " << treeInfos->
GetValue(
"KVBase::bzrRevisionDate()",
"(unknown)") << endl ;
534 cout << endl <<
"INFORMATIONS ON GENERATION OF FILE:" << endl << endl;
535 cout <<
"Generated by : " << treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"(unknown)") << endl ;
536 cout <<
"Analysis task : " << treeInfos->
GetValue(
"AnalysisTask",
"(unknown)") << endl ;
537 cout <<
"Job name : " << treeInfos->
GetValue(
"BatchSystem.JobName",
"(unknown)") << endl ;
538 cout <<
"Job submitted from : " << treeInfos->
GetValue(
"LaunchDirectory",
"(unknown)") << endl ;
539 cout <<
"Runs : " << treeInfos->
GetValue(
"Runs",
"(unknown)") << endl ;
540 cout <<
"Number of events requested : " << treeInfos->
GetValue(
"NbToRead",
"(unknown)") << endl ;
541 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
547 if (fDataVersion !=
"(unknown)") {
548 if (sscanf(fDataVersion.Data(),
"%d.%d.%d", &
a, &
b, &
c) == 3) {
549 fDataSeries.Form(
"%d.%d",
a,
b);
555 fDataReleaseNum = -1;
565 if (theRawData) theRawData->CloneTree(-1,
"fast");
566 if (theGeneData) theGeneData->CloneTree(-1,
"fast");
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
R__EXTERN TProof * gProof
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void Print(Option_t *opt="") const
GANIL VXI/VME acquisition parameter.
void SetData(UShort_t val)
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
ULong64_t GetEvents() const
KVDBSystem * GetSystem() const
const TDatime & GetDatime() const
virtual void Print(Option_t *option="") const
const Char_t * GetComments() const
KV2Body * GetKinematics()
virtual Bool_t CheckIfUserClassIsValid(const KVString &alternative_base_class="")
virtual Bool_t CheckTaskVariables()
void WriteBatchEnvFile(const Char_t *jobname, Bool_t save=kTRUE)
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
FileType * OpenRunfile(const Char_t *type, Int_t run)
TString GetFullPathToRunfile(const Char_t *type, Int_t run) 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 SetTriggerConditionsForRun(int)
virtual void Reset()
Reset task variables.
void SetSelectorCurrentRun(KVINDRADBRun *CurrentRun)
void CloneRawAndGeneTrees()
TEnv * GetReconDataTreeInfos() const
virtual void SubmitTask()
void PrintTreeInfos()
Print informations on currently analysed TTree.
KVReconstructedEvent * GetReconstructedEvent()
void ConnectRawDataTree()
virtual Bool_t CheckTaskVariables(void)
Checks the task variables.
void ConnectGeneDataTree()
virtual void WriteBatchEnvFile(const Char_t *, Bool_t sav=kTRUE)
virtual KVNumberList PrintAvailableRuns(KVString &datatype)
Long64_t GetRawEntryNumber()
virtual Bool_t CheckIfUserClassIsValid(const KVString &="")
Event reconstructed from energy losses in INDRA multidetector.
Set trigger conditions for analysis of reconstructed INDRA data.
void SetTriggerConditionsForRun(KVEventSelector *, int)
void SetMinimumOKMultiplicity(KVEvent *) const
const KVSeqCollection * GetACQParams() const
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")
KVACQParam * GetACQParam(const Char_t *name) const
Strings used to represent a set of ranges of values.
Base class for user analysis of reconstructed data.
void SetCurrentRun(KVDBRun *r)
Physical event reconstructed from data measured with a detector array using implemented identificatio...
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)
virtual const char * GetValue(const char *name, const char *dflt) const
virtual TObject * FindObject(const char *name) const
virtual Bool_t InheritsFrom(const char *classname) const
const char * Data() const
void Form(const char *fmt,...)
virtual const char * BaseName(const char *pathname)
void Add(RHist< DIMENSIONS, PRECISION, STAT_TO... > &to, const RHist< DIMENSIONS, PRECISION, STAT_FROM... > &from)
BinData::ErrorType GetDataType(const TGraph *gr, DataOptions &fitOpt)