KaliVeda
Toolkit for HIC analysis
KVINDRAGeneDataAnalyser.cpp
1 /*
2 $Id: KVINDRAGeneDataAnalyser.cpp,v 1.4 2007/11/15 14:59:45 franklan Exp $
3 $Revision: 1.4 $
4 $Date: 2007/11/15 14:59:45 $
5 */
6 
7 //Created by KVClassFactory on Mon Jun 4 19:24:11 2007
8 //Author: e_ivamos
9 
10 #include "KVINDRAGeneDataAnalyser.h"
11 #include "TChain.h"
12 #include "KVDataSet.h"
13 #include "KVINDRAGeneDataSelector.h"
14 #include <KVINDRADBRun.h>
15 
16 using namespace std;
17 
19 
20 
21 
22 
26 {
27  //Default constructor
28 }
29 
30 
31 
34 
36 {
37  //Destructor
38 }
39 
40 
41 
42 
47 
49 {
50  //Run the interactive analysis
51 
52  //make the chosen dataset the active dataset ( = gDataSet; note this also opens database
53  //and positions gDataBase & gIndraDB).
54  GetDataSet()->cd();
55 
56  TChain* t = new TChain("GeneData");
57  t->SetDirectory(0);//we handle delete
58 
59  GetRunList().Begin();
60  Int_t run;
61  while (!GetRunList().End()) {
62 
63  run = GetRunList().Next();
64  cout << "Adding file " << gDataSet->GetFullPathToRunfile(GetDataType(),
65  run);
66  cout << " to the TChain." << endl;
67  t->Add(gDataSet->GetFullPathToRunfile(GetDataType(), run), -1);
68  }
69 
70  KVINDRAGeneDataSelector* selector = (KVINDRAGeneDataSelector*)GetInstanceOfUserClass();
71 
72  if (!selector || !selector->InheritsFrom("KVINDRAGeneDataSelector")) {
73  cout << "The selector \"" << GetUserClass() << "\" is not valid." << endl;
74  cout << "Process aborted." << endl;
75  }
76  else {
77  if (GetNbEventToRead()) {
78  t->Process(GetUserClass(), "", GetNbEventToRead());
79  }
80  else {
81  t->Process(GetUserClass());
82  }
83  }
84  if (selector) delete selector;
85  delete t;
86 }
87 
88 
89 
94 
96 {
97  //Prints list of available runs, sorted according to multiplicity
98  //trigger, for selected dataset, data type/analysis task, and system
99  //Returns list containing all run numbers
100 
101  KVNumberList all_runs =
102  GetDataSet()->GetRunList(datatype.Data(), GetSystem());
103  KVINDRADBRun* dbrun;
104 
105  //first read list and find what triggers are available
106  vector<int> triggers;
107  all_runs.Begin();
108  while (!all_runs.End()) {
109  dbrun = (KVINDRADBRun*)GetDataSet()->GetDataBase()->GetDBRun(all_runs.Next());
110  if (triggers.size() == 0
111  || std::find(triggers.begin(), triggers.end(), dbrun->GetTrigger()) != triggers.end()) {
112  triggers.push_back(dbrun->GetTrigger());
113  }
114  }
115  //sort triggers in ascending order
116  std::sort(triggers.begin(), triggers.end());
117 
118 
119  for (std::vector<int>::iterator it = triggers.begin(); it != triggers.end(); ++it) {
120  cout << " ---> Trigger M>" << *it << endl;
121  all_runs.Begin();
122  while (!all_runs.End()) {
123  dbrun = (KVINDRADBRun*)GetDataSet()->GetDataBase()->GetDBRun(all_runs.Next());
124  if (dbrun->GetTrigger() == *it) {
125  cout << " " << Form("%4d", dbrun->GetNumber());
126  cout << Form("\t(%9llu events)", dbrun->GetEvents());
127  cout << "\t[File written: " << dbrun->GetDatime().
128  AsString() << "]";
129  if (dbrun->GetComments())
130  cout << "\t" << dbrun->GetComments();
131  cout << endl;
132  }
133  }
134  cout << endl;
135  }
136  return all_runs;
137 }
138 
139 
int Int_t
char * Form(const char *fmt,...)
virtual Int_t GetNumber() const
Definition: KVDBRecord.h:73
ULong64_t GetEvents() const
Definition: KVDBRun.h:134
const TDatime & GetDatime() const
Definition: KVDBRun.h:114
Int_t GetTrigger() const
Definition: KVDBRun.h:104
const Char_t * GetComments() const
Definition: KVDBRun.h:147
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
Definition: KVDataSet.cpp:897
Database entry for each run of an INDRA experiment.
Definition: KVINDRADBRun.h:30
For analysing INDRA gene (pulser) data.
virtual ~KVINDRAGeneDataAnalyser()
Destructor.
virtual KVNumberList PrintAvailableRuns(KVString &datatype)
For analysing INDRA pulser & laser data.
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Bool_t End(void) const
Definition: KVNumberList.h:199
void Begin(void) const
Int_t Next(void) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) override
void SetDirectory(TDirectory *dir) override
virtual Bool_t InheritsFrom(const char *classname) const
const char * Data() const
BinData::ErrorType GetDataType(const TGraph *gr, DataOptions &fitOpt)
void End()
ClassImp(TPyArg)