1#define KVOldINDRASelector_cxx
2#include "KVOldINDRASelector.h"
13#include "KVAvailableRunsFile.h"
15#include "KVClassFactory.h"
16#include "KVDataAnalyser.h"
17#include "KVDataAnalysisTask.h"
18#include "KVINDRAReconNuc.h"
19#include "KVINDRAReconDataAnalyser.h"
54 dataselector_lock.SetTimeout(60);
55 dataselector_lock.SetSuspend(5);
56 dataselector_lock.SetSleeptime(1);
215#ifdef __WITHOUT_TSELECTOR_LONG64_T
249 Abort(
Form(
"Aborting analysis after %d events", totentry), kAbortFile);
258 fChain->GetTree()->GetEntry(fTreeEntry);
265 while ((part = (
KVNucleus*)GetEvent()->GetNextParticle(
"ok"))) {
267 part->
SetIsOK(fPartCond->Test(part));
273 if (TestBit(kChangeMasses)) GetEvent()->ChangeFragmentMasses(fNewMassFormula);
278 if (fCurrentRun->GetSystem() && fCurrentRun->GetSystem()->GetKinematics()) {
280 GetEvent()->SetFrame(
"CM",
281 fCurrentRun->GetSystem()->GetKinematics()->GetCMVelocity());
285 RecalculateGlobalVariables();
291 ok_anal = fKVDataSelector->ProcessCurrentEntry();
294 ok_anal = Analysis();
299 TString mes(
"End of run after ");
307 needToCallEndRun =
kFALSE;
311 SaveCurrentDataSelection();
355 cout << endl <<
" ====================== END ====================== " <<
357 cout <<
" Total number of events read = " <<
totentry << endl;
359 cout <<
" CPU time = " <<
fTimer->
CpuTime() <<
" sec." << endl;
360 cout <<
" Events/Real sec. = " <<
totentry /
362 cout <<
" Events/CPU sec. = " <<
totentry /
364 cout << endl <<
" ====================== END ====================== " <<
441 Error(
"AddGV(KVVarGlob*)",
"KVVarGlob pointer is null");
529 Error(
"AddGV(const Char_t*,const Char_t*)",
530 "Called with class_name=%s.\nClass is unknown: not in standard libraries, and plugin (user-defined class) not found",
539 Error(
"AddGV(const Char_t*,const Char_t*)",
540 "%s is not a valid class deriving from KVVarGlob.",
619#ifdef __WITHOUT_TSELECTOR_LONG64_T
666 Info(
"BuildEventList()",
667 "Building TEventList for the KVDataSelector \"%s\".",
672 cout <<
"Analysis from a chain of trees." << endl;
677 cout <<
"Analysis from a single tree." << endl;
688 new TEventList(
"chainEventList",
"TEvent list for this TChain");
694 cout <<
"File to open : " << fname.
Data() << endl;
695 TFile* fileDataSelector = 0;
701 cout <<
"The file \"" << fname.
702 Data() <<
"\" does not exist." << endl;
709 cout << fname.
Data() << endl;
712 cout <<
"Numero de run " << nrun << endl;
713 cout <<
"Recherche de " <<
Form(
"%s_run%d;1",
717 if (fileDataSelector) {
723 for (
Int_t i = 0; i < revtList->
GetN(); i++) {
729 cout <<
"Liste introuvable..." << endl;
737 cout <<
"Run inconnu..." << endl;
740 if (fileDataSelector) {
741 cout <<
"Closing " << fileDataSelector->
GetName() << endl;
742 fileDataSelector->
Close();
753 Warning(
"BuildEventList()",
"The TEventList is empty...");
784 ok = ok || (nextEntry == -1);
805 cout <<
"Loading KVDataSelector..." << endl;
817#ifdef __WITHOUT_TMACRO
819 Warning(
"LoadDataSelector(void)",
821 (
"No implementation and/or declaration file found for \"%s\".",
830 TFile* fileDataSelector = 0;
836 cout <<
"The file \"" << fname.
837 Data() <<
"\" does not exist." << endl;
841 if (fileDataSelector) {
847 cout << fileC.
Data() <<
" re-generated" << endl;
849 cout << fileh.
Data() <<
" re-generated." << endl;
850 deleteSources =
kTRUE;
853 Warning(
"LoadDataSelector(void)",
854 "No implementation and/or declaration file found for \"%s\".",
857 if (fileDataSelector) {
858 fileDataSelector->
Close();
864 cout <<
"Files " << fileC.
Data() <<
" and " << fileh.
Data() <<
868 gROOT->GetPluginManager()->AddHandler(
"KVDataSelector",
879 Error(
"LoadDataSelector(void)",
880 "Called with class_name=%s.\nClass is unknown: not in standard libraries, and plugin (user-defined class) not found",
888 GetKVSelector() << endl;
893 Error(
"LoadDataSelector(void)",
894 "%s is not a valid class deriving from KVDataSelector.",
902 GetKVSelector() << endl;
906 Data() <<
"*.*\" ..." << endl;
942 cout <<
"File to open : " << fname.
Data() <<
" : " <<
option.
944 TFile* fileDataSelector = 0;
946 if (!fileDataSelector || (fileDataSelector && fileDataSelector->
IsZombie())) {
947 Error(
"SaveCurrentDataSelection(void)",
948 "Opening the file \"%s\" with the option \"%s\" is not possible.\nNothing saved.",
954 GetTEventList()->
GetName() <<
"\"..." << endl;
956 GetN() <<
" entries selected." << endl;
959#ifndef __WITHOUT_TMACRO
968 cout <<
"Saving the source files..." << endl;
972 (
"Implementation file for the KVDataSelector \"%s\".",
978 (
"Declaration file for the KVDataSelector \"%s\".",
984 cout <<
"Done" << endl;
985 fileDataSelector->
Close();
990 cout <<
"No TEventList to save..." << endl;
1015 gEnv->
GetValue(
"DataSelector.fileName",
"ListOfDataSelector.root");
1016 cout <<
"List Of Data Selectors : " << fname.
Data() << endl;
1017 return fname.
Data();
1184 Warning(
"FillHisto",
"%s introuvable", sname.
Data());
1209 h1->
Fill(one, two, three);
1221 h2->
Fill(one, two, three);
1233 h2->
Fill(one, two, three, four);
1255 h3->
Fill(one, two, three, four);
1267 Warning(
"CreateHistos",
"To be redefined child class");
1299 if (IsCreated)
file->Close();
1335 Warning(
"CreateTrees",
"To be redefined child class");
1356 Warning(
"FillTree",
"%s introuvable", sname.
Data());
1387 if (IsCreated)
file->Close();
1469 while (!opt.
End()) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
static const Char_t * FindFile(const Char_t *search, TString &wfil)
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
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)
virtual Int_t GetNumber() const
Fill 3D observables in a dalitz plot ,.
Int_t FillAsDalitz(Double_t a1, Double_t a2, Double_t a3)
virtual void postEndRun()
void DoStatusUpdate(Long64_t nevents) const
Print infos on events treated, disk usage, memory usage.
virtual void preInitAnalysis()
virtual void postAnalysis()
virtual Bool_t CheckStatusUpdateInterval(Long64_t nevents) const
virtual void preAnalysis()
virtual void postInitRun()
static Bool_t AbortProcessingLoop()
virtual void postEndAnalysis()
virtual void preEndAnalysis()
void DeleteBatchStatusFile() const
Delete batch status file (and backup - '.bak') for batch job.
virtual void preInitRun()
virtual void RegisterUserClass(TObject *)
virtual void postInitAnalysis()
Class handling event lists for KVOldINDRASelector analysis of data chains.
virtual const TEventList * GetTEventList(void)
virtual void Reset(Int_t nrun)
virtual void SetKVSelector(KVOldINDRASelector *kvs=0)
Pilots user analysis of experimental data.
#define KVGVLIST_OPTIMIZE_GVLIST
void CalculateGlobalVariables(KVEvent *e)
virtual void Add(TObject *obj)
Extended version of ROOT THashList.
Bool_t Lock(const Char_t *filename="")
virtual void Print(Option_t *opt="") const
void SetValue(const Char_t *name, value_type value)
void RemoveParameter(const Char_t *name)
virtual void Clear(Option_t *opt="")
Bool_t HasParameter(const Char_t *name) const
TString GetTStringValue(const Char_t *name) const
Description of properties and kinematics of atomic nuclei.
Former base analysis class for INDRA data.
KVINDRADBRun * fCurrentRun
current run
virtual const Char_t * GetDataSelectorFileName(void)
virtual void WriteTreeToFile(KVString filename="FileFromKVOldINDRASelector.root", Option_t *option="recreate")
If no filename is specified, assume that the current directory is writable.
KVINDRAReconEvent * data
Declaration of leaves types.
virtual void UnsetOpt(const Char_t *opt)
Removes the option 'opt' from the internal lists, as if it had never been set.
void FillTH3(TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
virtual TString GetOpt(const Char_t *option) const
TH1 * GetHisto(const Char_t *name)
KVNameValueList fOptionList
parsed list of options given to TTree::Process
void FillTH2(TH2 *h2, Double_t one, Double_t two, Double_t three)
virtual void AddGV(KVVarGlob *)
Long64_t fTreeEntry
this is the current TTree entry number, i.e. the argument passed to TSelector::Process(Long64_t entry...
Int_t fCurrentTreeNumber
This is the current tree number.
void FillHisto(KVString sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
virtual void SaveCurrentDataSelection(void)
virtual void RecalculateGlobalVariables()
static KVString fBranchName
name of branch which contains KVINDRAReconEvent objects in the TTree
virtual void CreateHistos()
KVGVList * gvlist
List of global variables.
TString fDataSelector
Name of the KVDataSelector.
UInt_t fNewMassFormula
new mass formula to apply to fragments, if required
virtual ~KVOldINDRASelector()
virtual KVGVList * GetGVList(void)
void FillKVDalitz(KVDalitzPlot *h2, Double_t one, Double_t two, Double_t three)
virtual void SetParticleConditions(const KVParticleCondition &)
virtual Bool_t AtEndOfRun(void)
void FillTProfile2D(TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
virtual void SetGVList(KVGVList *list)
handling global variables for analysis
TTree * fChain
pointer to the analyzed TTree or TChain
Bool_t Process(Long64_t entry)
void FillTree(KVString sname="")
TTree * GetTree(const Char_t *name)
void FillTH1(TH1 *h1, Double_t one, Double_t two)
virtual void SetOpt(const Char_t *option, const Char_t *value)
Set a value for an option.
KVDataSelector * fKVDataSelector
KVDataSelector.
TStopwatch * fTimer
used to time analysis
KVINDRAReconEvent * GetEvent()
KVHashList * GetHistoList()
virtual void CreateTrees()
void SlaveTerminate()
Function called at the end of the event loop in each PROOF slave.
virtual void ChangeFragmentMasses(UInt_t mass_formula)
virtual const Char_t * GetDataSelector(void)
TEventList * fEvtList
this is the current event list.
Bool_t * fTEVLexist
tells if the TEventList exist for each run
virtual Long64_t GetTreeEntry() const
Long64_t * fTreeOffset
this is the current TTree offset table
void FillTProfile(TProfile *h1, Double_t one, Double_t two, Double_t three)
static void Make(const Char_t *kvsname="MyOwnKVOldINDRASelector")
Automatic generation of KVOldINDRASelector-derived class for KaliVeda analysis.
virtual Bool_t IsOptGiven(const Char_t *option)
Returns kTRUE if the option 'opt' has been set.
virtual void LoadDataSelector(void)
virtual void SetDataSelector(const Char_t *dataSel="")
virtual KVVarGlob * GetGV(const Char_t *) const
Bool_t needToSelect
tells if one needs to build the TEventList
TBranch * b_data
List of branches.
KVParticleCondition * fPartCond
(optional) conditions for selecting particles
virtual void EndAnalysis()
KVLockfile dataselector_lock
for locking user's data selector file
KVHashList * GetTreeList()
void SlaveBegin(TTree *tree)
virtual void WriteHistoToFile(KVString filename="FileFromKVOldINDRASelector.root", Option_t *option="recreate")
virtual void InitAnalysis()
virtual void BuildEventList(void)
Bool_t needToCallEndRun
tells if one needs to call EndRun
void SetIsOK(Bool_t flag=kTRUE)
virtual TObject * FindObject(const char *name) const
virtual void Clear(Option_t *option="")
virtual void Execute(const char *method, const char *params, Int_t *error=0)
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
void SetParticleClassName(const Char_t *cl)
Base class for all global variable implementations.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Bool_t InheritsFrom(const char *cl) const override
virtual void SetOwner(Bool_t enable=kTRUE)
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
T * Get(const char *namecycle)
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void Reset(Option_t *option="")
virtual Long64_t GetEntry(Int_t index) const
virtual Int_t GetIndex(Long64_t entry) const
virtual Int_t GetN() const
virtual void Enter(Long64_t entry)
void Close(Option_t *option="") override
virtual Int_t Fill(const char *name, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w)
virtual void SaveSource(const char *filename)
virtual Int_t ReadFile(const char *filename)
virtual void SetTitle(const char *title="")
const char * GetName() const override
virtual void SetName(const char *name)
TClass * IsA() const override
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
virtual const char * GetName() const
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
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
Longptr_t ExecPlugin(int nargs)
virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w=1.)
const char * GetOption() const override
void Start(Bool_t reset=kTRUE)
const char * Data() const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual const char * WorkingDirectory()
TFile * GetCurrentFile() const
virtual void SetMakeClass(Int_t make)
virtual void SetEventList(TEventList *list)
virtual Long64_t GetEntries() const
virtual TTree * GetTree() const
virtual Int_t GetTreeNumber() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
CPYCPPYY_EXTERN bool Exec(const std::string &cmd)