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() <<
"\"." << 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);
99 while (!GetRunList().
End()) {
100 run = GetRunList().Next();
102 cout <<
"Opening file " << fullPathToRunfile << endl;
104 cout <<
"Adding file " << fullPathToRunfile;
105 cout <<
" to the TChain." << endl;
106 dynamic_cast<TChain*
>(theChain)->
Add(fullPathToRunfile);
107 if (
f && !
f->IsZombie()) {
111 if (!((
TTree*)
f->Get(
"ReconEvents"))) {
112 Error(
"SubmitTask",
"No tree named ReconEvents is present in the current file");
119 TString username = treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"");
123 Info(
"SubmitTask",
"No TEnv object associated to the tree");
128 TotalEntriesToRead = theChain->GetEntries();
129 TString option =
Form(
"EventsReadInterval=%lld,", GetAnalysisTask()->GetStatusUpdateInterval());
130 option +=
Form(
"FullRunList=%s", GetFullRunList().GetList());
133 if (GetUserClassOptions() !=
"") {
135 option += GetUserClassOptions();
138 TObject* new_selector = GetInstanceOfUserClass();
140 if (!new_selector || !new_selector->
InheritsFrom(
"TSelector")) {
141 cout <<
"The selector \"" << GetUserClass() <<
"\" is not valid." << endl;
142 cout <<
"Process aborted." << endl;
147 Info(
"SubmitTask",
"Beginning TChain::Process...");
149 if (GetProofMode() != KVDataAnalyser::EProofMode::None)
dynamic_cast<TChain*
>(theChain)->SetProof(
kTRUE);
154 if (GetAnalysisTask()->WithUserClass()) analysis_class.
Form(
"%s%s", GetUserClassImp().Data(), GetACliCMode());
155 else analysis_class = GetUserClass();
157 if (GetNbEventToRead()) {
158 theChain->Process(analysis_class,
option.Data(), GetNbEventToRead());
161 theChain->Process(analysis_class,
option.Data());
204 if (fSelector->IsOptGiven(
"WithCalibInfos"))
205 physics_parameters_only = (fSelector->GetOpt(
"WithCalibInfos") !=
"yes");
207 Int_t run = GetRunNumberFromFileName(theChain->GetCurrentFile()->GetName());
212 SetCurrentRun(CurrentRun);
213 fSelector->SetCurrentRun(CurrentRun);
215 cout << endl <<
" =================== New Run =================== " <<
224 cout << endl <<
" ================================================= " <<
228 Info(
"preInitRun",
"Data written with series %s, release %d", GetDataSeries().Data(),
229 GetDataReleaseNumber());
230 fRustines.InitializePatchList(GetDataSet()->GetName(),
GetDataType(), run, GetDataSeries(),
231 GetDataReleaseNumber(), theChain->GetCurrentFile()->GetStreamerInfoCache());
243 if (fRustines.HasActivePatches()) fRustines.Apply(fSelector->GetEvent());
252 return (
TEnv*)theChain->GetTree()->GetUserInfo()->
FindObject(
"TEnv");
292 Info(
"SetTriggerConditionsForRun",
293 "No definition of trigger conditions available for dataset %s",
294 GetDataSet()->GetName());
298 trig->SetTriggerConditionsForRun(fSelector, run);
309 TEnv* treeInfos = GetReconDataTreeInfos();
310 if (!treeInfos)
return;
311 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
312 cout <<
"INFORMATIONS ON VERSION OF KALIVEDA USED TO GENERATE FILE:" << endl << endl;
313 fDataVersion = treeInfos->
GetValue(
"KVBase::GetKVVersion()",
"(unknown)");
314 cout <<
"version = " << fDataVersion << endl ;
315 cout <<
"build date = " << treeInfos->
GetValue(
"KVBase::GetKVBuildDate()",
"(unknown)") << endl ;
316 cout <<
"source directory = " << treeInfos->
GetValue(
"KVBase::GetKVSourceDir()",
"(unknown)") << endl ;
317 cout <<
"KVROOT = " << treeInfos->
GetValue(
"KVBase::GetKVRoot()",
"(unknown)") << endl ;
318 if (strcmp(treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)"),
"(unknown)")) {
319 cout <<
"BZR branch name = " << treeInfos->
GetValue(
"KVBase::bzrBranchNick()",
"(unknown)") << endl ;
320 cout <<
"BZR revision #" << treeInfos->
GetValue(
"KVBase::bzrRevisionNumber()",
"(unknown)") << endl ;
321 cout <<
"BZR revision ID = " << treeInfos->
GetValue(
"KVBase::bzrRevisionId()",
"(unknown)") << endl ;
322 cout <<
"BZR revision date = " << treeInfos->
GetValue(
"KVBase::bzrRevisionDate()",
"(unknown)") << endl ;
324 else if (strcmp(treeInfos->
GetValue(
"KVBase::gitBranch()",
"(unknown)"),
"(unknown)")) {
325 cout <<
"git branch = " << treeInfos->
GetValue(
"KVBase::gitBranch()",
"(unknown)") << endl;
326 cout <<
"git commit = " << treeInfos->
GetValue(
"KVBase::gitCommit()",
"(unknown)") << endl;
328 cout << endl <<
"INFORMATIONS ON GENERATION OF FILE:" << endl << endl;
329 cout <<
"Generated by : " << treeInfos->
GetValue(
"gSystem->GetUserInfo()->fUser",
"(unknown)") << endl ;
330 cout <<
"Analysis task : " << treeInfos->
GetValue(
"AnalysisTask",
"(unknown)") << endl ;
331 cout <<
"Job name : " << treeInfos->
GetValue(
"BatchSystem.JobName",
"(unknown)") << endl ;
332 cout <<
"Job submitted from : " << treeInfos->
GetValue(
"LaunchDirectory",
"(unknown)") << endl ;
333 cout <<
"Runs : " << treeInfos->
GetValue(
"Runs",
"(unknown)") << endl ;
334 cout <<
"Number of events requested : " << treeInfos->
GetValue(
"NbToRead",
"(unknown)") << endl ;
335 cout << endl <<
"----------------------------------------------------------------------------------------------------" << endl;
343 if (fDataVersion !=
"(unknown)") {
344 if (fDataVersion.Contains(
"/")) {
345 if (sscanf(fDataVersion.Data(),
"%d.%d/%d", &
a, &
b, &
c) == 3) {
346 fDataSeries.Form(
"%d.%d",
a,
b);
351 if (sscanf(fDataVersion.Data(),
"%d.%d.%d", &
a, &
b, &
c) == 3) {
352 fDataSeries.Form(
"%d.%d",
a,
b);
359 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
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)
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Description of an experimental run in database ,,.
KVDBSystem * GetSystem() const
virtual void Print(Option_t *option="") const
KV2Body * GetKinematics()
virtual Bool_t CheckTaskVariables()
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
FileType * OpenRunfile(const Char_t *type, Int_t run)
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
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)