KaliVeda
Toolkit for HIC analysis
KVINDRADB2.cpp
1 /***************************************************************************
2 $Id: KVINDRADB2.cpp,v 1.16 2007/04/26 16:40:58 franklan Exp $
3  KVINDRADB2.cpp - description
4  -------------------
5  begin : mars 2004
6  copyright : (C) 2004 by daniel cussol
7  email : cussol@in2p3.fr
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #include "Riostream.h"
19 #include "KVINDRA.h"
20 #include "KVINDRADB2.h"
21 #include "KVINDRADBRun.h"
22 #include "KVDBParameterSet.h"
23 #include "TString.h"
24 
25 using namespace std;
26 
28 
29 
30 
33 KVINDRADB2::KVINDRADB2(const Char_t* name): KVINDRADB(name)
34 {
35  //default ctor
36 }
37 
38 
39 
40 
42 
43 KVINDRADB2::~KVINDRADB2()
44 {
45 
46 }
47 
48 
49 
50 
53 
54 void KVINDRADB2::Build(bool minimal)
55 {
56  //Use KVINDRARunListReader utility subclass to read complete runlist
57  TString runlist_fullpath;
58  KVBase::SearchKVFile(GetCalibFileName("Runlist"), runlist_fullpath,
59  fDataSet);
60  SetRLCommentChar('#');
61  SetRLSeparatorChar('\t');
62  GetLineReader()->SetFieldKeys("Tape", "Run", "Events");
63  GetLineReader()->SetRunKeys("Run", "Events");
64  ReadRunList(runlist_fullpath.Data());
65  ReadSystemList();
66 
67  if(minimal)
68  return;
69 
70  ReadChIoPressures();
71 
72  if (!gIndra) KVMultiDetArray::MakeMultiDetector(fDataSet);
73  gIndra->MakeCalibrationTables(this);
74 }
75 
76 
77 
78 
79 
86 
88 {
89  //For each "good run line" in the run list file, we:
90  // add a KVINDRADBRun to the database if it doesn't already exist
91  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
92  // set properties of run and tape objects
93  //kFirstRun & kLastRun are set
94 
95  KVRunListLine* csv_line = GetLineReader();
96 
97  //run number
98  Int_t run_n = csv_line->GetIntField("Run");
99 
100  if (!run_n) {
101  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
102  endl;
103  GetLineReader()->Print();
104  return;
105  }
106 
107  /*********************************************
108  IF LINE HAS A TAPE NUMBER WE
109  LOOK FOR THE TAPE IN THE DATA
110  BASE. IF IT DOESN'T EXIST WE
111  CREATE IT.
112  *********************************************/
113  KVDBTape* tape = 0;
114  //tape number (if tape field is filled)
115  if (csv_line->HasFieldValue("Tape")) {
116  Int_t tape_n = csv_line->GetIntField("Tape");
117  //already exists ?
118  tape = GetTape(tape_n);
119  if (!tape) {
120  tape = new KVDBTape(tape_n);
121  AddTape(tape);
122  }
123  }
124 
125  /*********************************************
126  WE CREATE A NEW RUN AND ADD
127  IT TO THE DATABASE. WE SET ALL
128  AVAILABLE INFORMATIONS ON
129  RUN FROM THE FILE. ERROR IF
130  DBASE RUN ALREADY EXISTS =>
131  SAME RUN APPEARS TWICE
132  *********************************************/
133  KVINDRADBRun* run = (KVINDRADBRun*) GetRun(run_n);
134  if (!run) {
135 
136  run = new KVINDRADBRun(run_n);
137  AddRun(run);
138 
139  //add run to tape ?
140  if (tape)
141  tape->AddRun(run);
142 
143  if (csv_line->HasFieldValue("Events"))
144  run->SetEvents(csv_line->GetIntField("Events"));
145  else
146  Error("GoodRunLine", "No Events field ? run=%d", run_n);
147  if (csv_line->HasFieldValue("FAR"))
148  run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
149  else
150  Error("GoodRunLine", "No FAR field ? run=%d", run_n);
151  if (csv_line->HasFieldValue("MFI"))
152  run->SetScaler("MFI", csv_line->GetIntField("MFI"));
153  if (csv_line->HasFieldValue("Blocs"))
154  run->SetScaler("Buffers", csv_line->GetIntField("Blocs"));
155  else
156  Error("GoodRunLine", "No Blocs field ? run=%d", run_n);
157  if (csv_line->HasFieldValue("G. dir"))
158  run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
159  else
160  Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
161  if (csv_line->HasFieldValue("G. marq"))
162  run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
163  else
164  Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
165  if (csv_line->HasFieldValue("G. TM"))
166  run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
167  else
168  Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
169  if (csv_line->HasFieldValue("TM %"))
170  run->SetTMpercent(csv_line->GetFloatField("TM %"));
171  else
172  Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
173  if (csv_line->HasField("Trigger"))
174  run->SetTrigger(GetRunListTrigger("Trigger", "M>=%d"));
175  else
176  Error("GoodRunLine", "No Trigger field ? run=%d", run_n);
177  if (csv_line->HasFieldValue("NB"))
178  run->SetComments(csv_line->GetField("NB"));
179 
180  }
181  else {
182  Error("GoodRunLine", "Run %d already exists", run_n);
183  }
184 }
185 
186 
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 2nd campaign of INDRA.
Definition: KVINDRADB2.h:33
void Build(bool=false) override
Use KVINDRARunListReader utility subclass to read complete runlist.
Definition: KVINDRADB2.cpp:54
void GoodRunLine() override
Definition: KVINDRADB2.cpp:87
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)