5 #include "KVReconDataAnalyser.h"
7 #include "KVMultiDetArray.h"
8 #include "KVDataAnalysisTask.h"
13 #include "KVAvailableRunsFile.h"
16 #include <KVClassFactory.h>
17 #include <KVTriggerConditions.h>
27 : fSelector(
nullptr), theChain(
nullptr)
42 TotalEntriesToRead = 0;
59 cout <<
"============> Analysis summary <=============" << endl;
60 cout <<
"Analysis of runs " << GetRunList().GetList() <<
" with the class ";
61 cout <<
"\"" << GetUserClass().name <<
"\"." << endl;
62 if (GetNbEventToRead()) {
63 cout << GetNbEventToRead() <<
" events will be processed." << endl;
66 cout <<
"All events will be processed." << endl;
68 cout <<
"=============================================" << endl;
90 theChain =
new TChain(
"ReconEvents");
91 theChain->SetDirectory(0);
96 for (
auto& run : GetRunList()) {
98 cout <<
"Opening file " << fullPathToRunfile << endl;
100 cout <<
"Adding file " << fullPathToRunfile;
101 cout <<
" to the TChain." << endl;
102 dynamic_cast<TChain*
>(theChain)->
Add(fullPathToRunfile);
103 if (
f && !
f->IsZombie()) {
107 if (!((
TTree*)
f->Get(
"ReconEvents"))) {
108 Error(
"SubmitTask",
"No tree named ReconEvents is present in the current file");
115 TString username = treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"");
119 Info(
"SubmitTask",
"No TEnv object associated to the tree");
124 TotalEntriesToRead = theChain->GetEntries();
125 TString option =
Form(
"EventsReadInterval=%lld,", GetAnalysisTask()->GetStatusUpdateInterval());
126 option +=
Form(
"FullRunList=%s", GetFullRunList().GetList().Data());
129 if (GetUserClassOptions() !=
"") {
131 option += GetUserClassOptions();
134 TObject* new_selector = GetInstanceOfUserClass();
136 if (!new_selector || !new_selector->
InheritsFrom(
"TSelector")) {
137 cout <<
"The selector \"" << GetUserClassName() <<
"\" is not valid." << endl;
138 cout <<
"Process aborted." << endl;
143 Info(
"SubmitTask",
"Beginning TChain::Process...");
145 if (GetProofMode() != KVDataAnalyser::EProofMode::None)
dynamic_cast<TChain*
>(theChain)->SetProof(
kTRUE);
150 if (GetAnalysisTask()->WithUserClass())
151 analysis_class.
Form(
"%s%s", GetUserClass().full_path_imp().Data(), GetACliCMode());
152 else analysis_class = GetUserClassName();
154 if (GetNbEventToRead()) {
155 theChain->Process(analysis_class,
option.Data(), GetNbEventToRead());
158 theChain->Process(analysis_class,
option.Data());
201 if (fSelector->IsOptGiven(
"WithCalibInfos"))
202 physics_parameters_only = (fSelector->GetOpt(
"WithCalibInfos") !=
"yes");
204 Int_t run = GetRunNumberFromFileName(theChain->GetCurrentFile()->GetName());
209 SetCurrentRun(CurrentRun);
210 fSelector->SetCurrentRun(CurrentRun);
212 cout << endl <<
" =================== New Run =================== " <<
221 cout << endl <<
" ================================================= " <<
225 Info(
"preInitRun",
"Data written with series %s, release %d", GetDataSeries().Data(),
226 GetDataReleaseNumber());
227 fRustines.InitializePatchList(GetDataSet()->GetName(),
GetDataType(), run, GetDataSeries(),
228 GetDataReleaseNumber(), theChain->GetCurrentFile()->GetStreamerInfoCache());
240 if (fRustines.HasActivePatches()) fRustines.Apply(fSelector->GetEvent());
249 return (
TEnv*)theChain->GetTree()->GetUserInfo()->
FindObject(
"TEnv");
289 Info(
"SetTriggerConditionsForRun",
290 "No definition of trigger conditions available for dataset %s",
291 GetDataSet()->GetName());
295 trig->SetTriggerConditionsForRun(fSelector, run);
306 TEnv* treeInfos = GetReconDataTreeInfos();
307 if (!treeInfos)
return;
308 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
309 cout <<
"INFORMATIONS ON VERSION OF KALIVEDA USED TO GENERATE FILE:" << endl << endl;
310 fDataVersion = treeInfos->
GetValue(
"KVBase::GetKVVersion()",
"(unknown)");
311 cout <<
"version = " << fDataVersion << endl ;
312 cout <<
"build date = " << treeInfos->
GetValue(
"KVBase::GetKVBuildDate()",
"(unknown)") << endl ;
313 cout <<
"source directory = " << treeInfos->
GetValue(
"KVBase::GetKVSourceDir()",
"(unknown)") << endl ;
314 cout <<
"KVROOT = " << treeInfos->
GetValue(
"KVBase::GetKVRoot()",
"(unknown)") << endl ;
315 if (strcmp(treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)"),
"(unknown)")) {
316 cout <<
"BZR branch name = " << treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)") << endl ;
317 cout <<
"BZR revision #" << treeInfos->
GetValue(
"KVBase::bzrRevisionNumber()",
"(unknown)") << endl ;
318 cout <<
"BZR revision ID = " << treeInfos->
GetValue(
"KVBase::bzrRevisionId()",
"(unknown)") << endl ;
319 cout <<
"BZR revision date = " << treeInfos->
GetValue(
"KVBase::bzrRevisionDate()",
"(unknown)") << endl ;
321 else if (strcmp(treeInfos->
GetValue(
"KVBase::gitBranch()",
"(unknown)"),
"(unknown)")) {
322 cout <<
"git branch = " << treeInfos->
GetValue(
"KVBase::gitBranch()",
"(unknown)") << endl;
323 cout <<
"git commit = " << treeInfos->
GetValue(
"KVBase::gitCommit()",
"(unknown)") << endl;
325 cout << endl <<
"INFORMATIONS ON GENERATION OF FILE:" << endl << endl;
326 cout <<
"Generated by : " << treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"(unknown)") << endl ;
327 cout <<
"Analysis task : " << treeInfos->
GetValue(
"AnalysisTask",
"(unknown)") << endl ;
328 cout <<
"Job name : " << treeInfos->
GetValue(
"BatchSystem.JobName",
"(unknown)") << endl ;
329 cout <<
"Job submitted from : " << treeInfos->
GetValue(
"LaunchDirectory",
"(unknown)") << endl ;
330 cout <<
"Runs : " << treeInfos->
GetValue(
"Runs",
"(unknown)") << endl ;
331 cout <<
"Number of events requested : " << treeInfos->
GetValue(
"NbToRead",
"(unknown)") << endl ;
332 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
340 if (fDataVersion !=
"(unknown)") {
341 if (fDataVersion.Contains(
"/")) {
342 if (sscanf(fDataVersion.Data(),
"%d.%d/%d", &
a, &
b, &
c) == 3) {
343 fDataSeries.Form(
"%d.%d",
a,
b);
348 if (sscanf(fDataVersion.Data(),
"%d.%d.%d", &
a, &
b, &
c) == 3) {
349 fDataSeries.Form(
"%d.%d",
a,
b);
356 fDataReleaseNum = -1;
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
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void Print(Option_t *opt="") const override
Handles lists of available runs for different datasets and types of data.
Bool_t InfosNeedUpdate(const run_index_t &run, const KVString &filename)
void UpdateInfos(const run_index_t &run, const KVString &filename, const KVString &kvversion, const KVString &username)
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Description of an experimental run in database ,,.
void Print(Option_t *option="") const override
KVDBSystem * GetSystem() const
KV2Body * GetKinematics()
virtual Bool_t CheckTaskVariables()
TString GetFullPathToRunfile(const KVString &type, const run_index_t &run) const
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
KVString GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
FileType * OpenRunfile(const KVString &type, const run_index_t &run)
KVDBRun * GetDBRun(Int_t number) const
static void SetMakeMultiDetectorPhysicsParametersOnly(Bool_t on=kTRUE)
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
Manages user analysis of reconstructed experimental data.
void preAnalysis() override
apply any required patches to data
TEnv * GetReconDataTreeInfos() const
void PrintTreeInfos()
Print informations on currently analysed TTree.
void preInitRun() override
Bool_t CheckTaskVariables(void) override
Checks the task variables.
virtual void SetTriggerConditionsForRun(int) override
void SubmitTask() override
void Reset() override
Reset task variables.
Set trigger conditions for analysis of reconstructed data.
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
Longptr_t ExecPlugin(int nargs)
void Form(const char *fmt,...)
virtual const char * BaseName(const char *pathname)
BinData::ErrorType GetDataType(const TGraph *gr, DataOptions &fitOpt)