4 #include "KVFAZIASelector.h"
5 #include "KVReconstructedNucleus.h"
6 #include "KVBatchSystem.h"
9 #include "KVDataAnalyser.h"
10 #include "KVFAZIAReconDataAnalyser.h"
11 #include "KVFAZIADetector.h"
13 #include "KVClassFactory.h"
15 #include "KVDataRepositoryManager.h"
16 #include "KVDataSetManager.h"
17 #include "KVFAZIADBRun.h"
18 #include "KVFAZIADB.h"
19 #include "KVFileReader.h"
62 SetReadingOfRawData(
kFALSE);
139 printf(
"KVFAZIASelector-LOG: Start run : %d\n",
fCurrentRun);
168 while ((sig = (
KVSignal*)next_s())) {
235 if (output_path ==
"") {
236 Error(
"CreateOutputFile",
"FAZIASELECTOR_OUTPUTS shell variable has to defined first");
244 Info(
"SetAutomaticManagementOfOutputs",
"Error in the %s directory creation",
fOutputPath.
Data());
299 Error(
"SaveAndCloseOutputFile",
"No file open for writing outputs");
326 printf(
"KVFAZIASelector-LOG: End run : %d\n",
fCurrentRun);
354 op.
Form(
"%s/%s/%s", output_path.
Data(), kvsname, dsname);
355 if (output_path ==
"") {
356 printf(
"Error in CheckListOfEndedRuns : FAZIASELECTOR_OUTPUTS shell variable is not defined\n");
360 printf(
"directory %s does not exist\n", op.
Data());
367 while (!lruns.
End()) {
370 Int_t rep = sscanf(srun.
Data(),
"R%d.root", &run);
375 printf(
"Ended runs for the selector %s and the dataset %s are:\n%s\n", kvsname, dsname, lr.
AsString());
377 printf(
"No runs ended for the selector %s and the dataset %s\n", kvsname, dsname);
433 op.
Form(
"%s/%s/%s", output_path.
Data(), kvsname, dsname);
434 if (output_path ==
"") {
435 printf(
"Error in CheckListOfEndedRuns : FAZIASELECTOR_OUTPUTS shell variable is not defined\n");
439 printf(
"directory %s does not exist\n", op.
Data());
445 gDataRepositoryManager->
Init();
456 while (!lruns.
End()) {
459 Int_t rep = sscanf(srun.
Data(),
"R%d.root", &run);
466 printf(
"creation de la liste associee a : %s\n", fr->
GetSystemName());
467 lsyst->
Add(lpersyst);
486 inst.
Form(
"hadd -f -k -v 0 %s/%s.root %s/R{%s}.root",
494 inst.
Form(
"hadd -f -k -v 0 %s/%s.root %s/R%d.root",
504 std::cout <<
"Creation of output file " << sname.
Data() <<
".root from run list:" << std::endl;
505 std::cout << lpersyst->
AsString() <<
" ..." << std::endl;
507 sroot.
Form(
"%s/%s.root",
514 fruns.
SetValue(
"Selector", kvsname);
518 std::cout <<
" ... done" << std::endl;
520 Form(
"%s/listruns_%s.env",
559 op.
Form(
"%s/%s/%s", output_path.
Data(), kvsname, dsname);
560 if (output_path ==
"") {
561 printf(
"Error in CheckListOfEndedRuns : FAZIASELECTOR_OUTPUTS shell variable is not defined\n");
565 printf(
"directory %s does not exist\n", op.
Data());
571 gDataRepositoryManager->
Init();
577 while (!lenv.
End()) {
589 printf(
"System: %s, Missing Runs %s\n", dbsys->
GetName(), ltot.
AsString());
591 printf(
"System: %s, All runs done\n", dbsys->
GetName());
664 Double_t max_sys_time = 0, max_cpu_time = 0, max_res_mem = 0, max_virt_mem = 0, max_ratio = 0;
665 Double_t sys_time = 0, cpu_time = 0, res_mem = 0, virt_mem = 0;
670 while (!lfiles.
End()) {
682 if (
line.BeginsWith(
"Info in <KVFAZIAReconDataAnalyser::SetRuns>: Accepted runs :")) {
683 line.ReplaceAll(
"Info in <KVFAZIAReconDataAnalyser::SetRuns>: Accepted runs :",
"");
687 else if (
line.BeginsWith(
"Info in <KVFAZIAReconDataAnalyser::SubmitTask>: treatment of run#")) {
688 line.ReplaceAll(
"Info in <KVFAZIAReconDataAnalyser::SubmitTask>: treatment of run#",
"");
691 lstarted_all.
Add(num);
693 else if (
line.BeginsWith(
Form(
"Info in <%s::Process>: End of file reached after ", kvsname))) {
697 else if (
line.BeginsWith(
"CpuSys = ")) {
698 sscanf(
line.Data(),
" CpuSys = %lf s. CpuUser = %lf s. ResMem = %lf MB VirtMem = %lf MB",
699 &sys_time, &cpu_time, &res_mem, &virt_mem);
708 if (ratio > max_ratio) max_ratio = ratio;
710 if (sys_time > max_sys_time) max_sys_time = sys_time;
711 if (cpu_time > max_cpu_time) max_cpu_time = cpu_time;
712 if (res_mem > max_res_mem) max_res_mem = res_mem;
713 if (virt_mem > max_virt_mem) max_virt_mem = virt_mem;
717 printf(
"in %s : runs not started : %s\n",
file.Data(), linit.
AsString());
721 printf(
"in %s : runs not ended : %s\n",
file.Data(), lstarted.
AsString());
724 printf(
"in %s : initial run list is empty\n",
file.Data());
734 env.
SetValue(
"CpuSys(s)", max_sys_time);
735 env.
SetValue(
"CpuUser(s)", max_cpu_time);
736 env.
SetValue(
"CpuPerRun", max_ratio);
737 env.
SetValue(
"ResMem(MB)", max_res_mem);
738 env.
SetValue(
"VirtMem(MB)", max_virt_mem);
740 printf(
"%d log files read\n", nf);
741 printf(
"initial runlist : %s\n", linit_all.
AsString());
742 printf(
"Maximum values\n");
743 printf(
"CpuSys=%lf s\nCpuUser=%lf s (%lf s/run)\nResMem=%lf MB\nVirtMem=%lf MB\n",
753 linit_all.
Remove(lstarted_all);
755 printf(
"\truns not started : %s\n", linit_all.
AsString());
756 lmissing.
Add(linit_all);
757 lstarted_all.
Remove(lended_all);
759 printf(
"\truns not ended : %s\n", lstarted_all.
AsString());
760 lmissing.
Add(lstarted_all);
762 printf(
"\t%d runs to be done : %s with a total time of %lf\n", lmissing.
GetNValues(), lmissing.
AsString(), max_ratio * lmissing.
GetNValues());
767 gROOT->ProcessLine(
Form(
".! rm %s_R*.o*", kvsname));
768 gROOT->ProcessLine(
Form(
".! rm %s.o*", kvsname));
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddImplIncludeFile(const Char_t *filename)
const Char_t * GetSystemName() const
Database class used to store information on different colliding systems studied during an experiment....
virtual void GetRunList(KVNumberList &) const
Fills the KVNumberList object with the list of all run numbers associated with this system.
virtual void preInitAnalysis()
virtual void preInitRun()
Manages access to one or more data repositories.
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
const Char_t * GetBranchName() const
Long64_t fEventsRead
number of events read
TTree * fChain
pointer to the analyzed TTree or TChain
virtual void SlaveBegin(TTree *tree)
TBranch * b_Event
List of branches.
void SetBranchName(const Char_t *n)
virtual void SetAdditionalBranchAddress()
Bool_t IsOptGiven(const Char_t *option)
Bool_t fNotifyCalled
avoid multiple calls to Notify/InitRun
TString GetOpt(const Char_t *option) const
virtual void ParseOptions()
virtual KVDBSystem * GetSystem(const Char_t *system) const
Database entry for a run in a FAZIA experiment.
KVFAZIADBRun * GetRun(Int_t run) const
Base class for FAZIA detectors.
void SetSignal(TGraph *signal, const Char_t *signal_name)
static const Char_t * GetNewName(KVString oldname)
TClonesArray * GetSignals() const
Pilot analysis of reconstructed FAZIA data.
virtual void ParseOptions()
void SetAutomaticManagementOfOutputs(Bool_t automatic=kTRUE)
TString rawdatabranchname
Bool_t NeedToReadRawData() const
virtual void CheckEndOfRun()
Testing whether EndRun() should be called.
KVFAZIARawEvent * RawEvent
static void MergeListOfEndedRuns(const Char_t *kvsname, const Char_t *dsname)
static void CheckListOfWellEndedRuns(const Char_t *kvsname, const Char_t *dsname)
virtual void Init(TTree *tree)
Bool_t SetReadingOfRawData(Bool_t need=kFALSE)
Bool_t SaveAndCloseOutputFile()
static void GetMissingRunsListing(const Char_t *kvsname, const Char_t *dsname)
Bool_t CreateOutputFile()
Int_t GetCurrentRunNumber() const
void ConnectSignalsToDetectors()
static void CheckBatchOutputFiles(const Char_t *kvsname, Bool_t eraseafter=kFALSE)
static void Make(const Char_t *kvsname="MyOwnFAZIASelector")
Automatic generation of KVSelector-derived class for KaliVeda analysis.
Handle reading columns of numeric data in text files.
KVString GetCurrentLine()
ReadStatus ReadLine(const KVString &pattern="")
Bool_t OpenFileToRead(const KVString &filename)
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Strings used to represent a set of ranges of values.
virtual void SetName(const char *name)
Int_t First() const
Returns smallest number included in list.
const Char_t * AsString(Int_t maxchars=0) const
void Remove(Int_t)
Remove value 'n' from the list.
const Char_t * GetExpandedList() const
virtual const char * GetName() const
void Add(Int_t)
Add value 'n' to the list.
const Char_t * GetType() const
const Char_t * GetDetectorName() const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
virtual void SetOwner(Bool_t enable=kTRUE)
virtual Int_t WriteFile(const char *fname, EEnvLevel level=kEnvAll)
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
virtual Bool_t IsOpen() const
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) const override
void Close(Option_t *option="") override
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
const char * GetName() const override
virtual const char * GetName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
static const char * Class_Name()
const char * Data() const
void Form(const char *fmt,...)
TString & ReplaceAll(const char *s1, const char *s2)
virtual const char * Getenv(const char *env)
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
virtual Int_t Exec(const char *shellcmd)
virtual const char * BaseName(const char *pathname)
virtual TString GetFromPipe(const char *command)
virtual TBranch * GetBranch(const char *name)
TFile * GetCurrentFile() const
virtual void SetMakeClass(Int_t make)
virtual Long64_t GetEntries() const
virtual TTree * GetTree() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)