KaliVeda
Toolkit for HIC analysis
KVINDRADB1.cpp
1 /***************************************************************************
2 $Id: KVINDRADB1.cpp,v 1.19 2007/04/26 16:40:57 franklan Exp $
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  ***************************************************************************/
10 #include "Riostream.h"
11 #include "KVINDRA.h"
12 #include "KVINDRADB1.h"
13 #include "KVINDRADBRun.h"
14 #include "KVDBParameterSet.h"
15 #include "KVRunListLine.h"
16 #include "TString.h"
17 
18 using namespace std;
19 
21 
22 
23 
26 KVINDRADB1::KVINDRADB1(const Char_t* name): KVINDRADB(name)
27 {
28  //default ctor
29 }
30 
31 
32 
33 
36 
37 void KVINDRADB1::Build(bool minimal)
38 {
39 
40  //Use KVINDRARunListReader utility subclass to read complete runlist
41  TString runlist_fullpath;
42  KVBase::SearchKVFile(GetDBEnv("Runlist"), runlist_fullpath, fDataSet);
43  SetRLCommentChar(GetDBEnv("Runlist.Comment")[0]);
44  if (!strcmp(GetDBEnv("Runlist.Separator"), "<TAB>"))
45  SetRLSeparatorChar('\t');
46  else
47  SetRLSeparatorChar(GetDBEnv("Runlist.Separator")[0]);
48  GetLineReader()->SetFieldKeys("tape", "run", "events");
49  GetLineReader()->SetRunKeys("run", "events");
50  ReadRunList(runlist_fullpath.Data());
51 
52  ReadSystemList();
53 
54  if(minimal)
55  return;
56 
57  ReadChIoPressures();
58 
59  if (!gIndra) KVMultiDetArray::MakeMultiDetector(fDataSet);
60  gIndra->MakeCalibrationTables(this);
61 }
62 
63 
64 
65 
72 
74 {
75  //For each "good run line" in the run list file, we:
76  // add a KVINDRADBRun to the database if it doesn't already exist
77  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
78  // set properties of run and tape objects
79  //kFirstRun & kLastRun are set
80 
81  KVRunListLine* csv_line = GetLineReader();
82 
83  //run number
84  Int_t run_n = csv_line->GetIntField("run");
85 
86  if (!run_n) {
87  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
88  endl;
89  GetLineReader()->Print();
90  return;
91  }
92 
93  /*********************************************
94  IF LINE HAS A TAPE NUMBER WE
95  LOOK FOR THE TAPE IN THE DATA
96  BASE. IF IT DOESN'T EXIST WE
97  CREATE IT.
98  *********************************************/
99  KVDBTape* tape = 0;
100  //tape number (if tape field is filled)
101  if (csv_line->HasFieldValue("tape")) {
102  Int_t tape_n = csv_line->GetIntField("tape");
103  //already exists ?
104  tape = GetTape(tape_n);
105  if (!tape) {
106  tape = new KVDBTape(tape_n);
107  AddTape(tape);
108  }
109  }
110  else {
111  Error("GoodRunLine", "No tape field ? run=%d", run_n);
112  }
113 
114  /*********************************************
115  WE CREATE A NEW RUN AND ADD
116  IT TO THE DATABASE. WE SET ALL
117  AVAILABLE INFORMATIONS ON
118  RUN FROM THE FILE. ERROR IF
119  DBASE RUN ALREADY EXISTS =>
120  SAME RUN APPEARS TWICE
121  *********************************************/
122  KVINDRADBRun* run = GetRun(run_n);
123  if (!run) {
124 
125  run = new KVINDRADBRun(run_n);
126  AddRun(run);
127 
128  //add run to tape ?
129  if (tape)
130  tape->AddRun(run);
131 
132  if (csv_line->HasFieldValue("events"))
133  run->SetEvents(csv_line->GetIntField("events"));
134  else
135  Error("GoodRunLine", "No events field ? run=%d", run_n);
136  if (csv_line->HasFieldValue("FAR"))
137  run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
138  else
139  Error("GoodRunLine", "No FAR field ? run=%d", run_n);
140  if (csv_line->HasFieldValue("MFI"))
141  run->SetScaler("MFI", csv_line->GetIntField("MFI"));
142  else
143  Error("GoodRunLine", "No MFI field ? run=%d", run_n);
144  if (csv_line->HasFieldValue("blocs"))
145  run->SetScaler("Buffers", csv_line->GetIntField("blocs"));
146  else
147  Error("GoodRunLine", "No blocs field ? run=%d", run_n);
148  if (csv_line->HasFieldValue("G. dir"))
149  run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
150  else
151  Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
152  if (csv_line->HasFieldValue("G. marq"))
153  run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
154  else
155  Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
156  if (csv_line->HasFieldValue("G. TM"))
157  run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
158  else
159  Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
160  if (csv_line->HasFieldValue("TM %"))
161  run->SetTMpercent(csv_line->GetFloatField("TM %"));
162  else
163  Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
164  if (csv_line->HasField("Decl"))
165  run->SetTrigger(GetRunListTrigger("Decl", "M>=%d"));
166  else
167  Error("GoodRunLine", "No Decl field ? run=%d", run_n);
168  if (csv_line->HasFieldValue("Remarque"))
169  run->SetComments(csv_line->GetField("Remarque"));
170 
171  }
172  else {
173  Error("GoodRunLine", "Run %d already exists", run_n);
174  }
175 }
176 
177 
int Int_t
char Char_t
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:533
void SetComments(const KVString &comments)
Definition: KVDBRun.h:272
void SetTrigger(Int_t trig)
Definition: KVDBRun.h:244
virtual void SetScaler(const Char_t *name, Int_t val)
Definition: KVDBRun.h:286
Database entry describing a data storage tape used to store raw data.
Definition: KVDBTape.h:25
void AddRun(KVDBRun *run)
add run to list of runs stored on this tape
Definition: KVDBTape.cpp:52
DataBase of parameters for 1st campaign of INDRA.
Definition: KVINDRADB1.h:32
void GoodRunLine() override
Definition: KVINDRADB1.cpp:73
void Build(bool=false) override
Use KVINDRARunListReader utility subclass to read complete runlist.
Definition: KVINDRADB1.cpp:37
Database entry for each run of an INDRA experiment.
Definition: KVINDRADBRun.h:30
void SetTMpercent(Float_t tmp)
Definition: KVINDRADBRun.h:54
void SetEvents(ULong64_t evt_number)
Definition: KVINDRADBRun.h:112
DataBase of parameters for an INDRA campaign.
Definition: KVINDRADB.h:59
void MakeCalibrationTables(KVExpDB *) override
Override base method in order to read ChIo pressures for each run.
Definition: KVINDRA.cpp:1004
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray", KVExpDB *db=nullptr)
Base class for reading runlists for experiments ,.
Definition: KVRunListLine.h:26
Bool_t HasFieldValue(const Char_t *) const
Float_t GetFloatField(const Char_t *)
Bool_t HasField(const Char_t *) const
INLINES_______________________________________________________________________________.
Int_t GetIntField(const Char_t *)
virtual const Char_t * GetField(const Char_t *) const
const char * Data() const
void Error(const char *location, const char *fmt,...)
ClassImp(TPyArg)