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 
44 {
45  TString runlist_fullpath;
46  KVBase::SearchKVFile(GetCalibFileName("Runlist"), runlist_fullpath,
47  fDataSet);
48  SetRLCommentChar('#');
49  SetRLSeparatorChar('\t');
50  GetLineReader()->SetFieldKeys("Tape", "Run", "Events");
51  GetLineReader()->SetRunKeys("Run", "Events");
52  ReadRunList(runlist_fullpath.Data());
53  ReadSystemList();
54 }
55 
56 
57 
59 
61 {
62  ReadChIoPressures();
63 
64  if (!gIndra) KVMultiDetArray::MakeMultiDetector(fDataSet);
65  gIndra->MakeCalibrationTables(this);
66 }
67 
68 
69 
70 
77 
79 {
80  //For each "good run line" in the run list file, we:
81  // add a KVINDRADBRun to the database if it doesn't already exist
82  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
83  // set properties of run and tape objects
84  //kFirstRun & kLastRun are set
85 
86  KVRunListLine* csv_line = GetLineReader();
87 
88  //run number
89  Int_t run_n = csv_line->GetIntField("Run");
90 
91  if (!run_n) {
92  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
93  endl;
94  GetLineReader()->Print();
95  return;
96  }
97 
98  /*********************************************
99  IF LINE HAS A TAPE NUMBER WE
100  LOOK FOR THE TAPE IN THE DATA
101  BASE. IF IT DOESN'T EXIST WE
102  CREATE IT.
103  *********************************************/
104  KVDBTape* tape = 0;
105  //tape number (if tape field is filled)
106  if (csv_line->HasFieldValue("Tape")) {
107  Int_t tape_n = csv_line->GetIntField("Tape");
108  //already exists ?
109  tape = GetTape(tape_n);
110  if (!tape) {
111  tape = new KVDBTape(tape_n);
112  AddTape(tape);
113  }
114  }
115 
116  /*********************************************
117  WE CREATE A NEW RUN AND ADD
118  IT TO THE DATABASE. WE SET ALL
119  AVAILABLE INFORMATIONS ON
120  RUN FROM THE FILE. ERROR IF
121  DBASE RUN ALREADY EXISTS =>
122  SAME RUN APPEARS TWICE
123  *********************************************/
124  KVINDRADBRun* run = (KVINDRADBRun*) GetRun(run_n);
125  if (!run) {
126 
127  run = new KVINDRADBRun(run_n);
128  AddRun(run);
129 
130  //add run to tape ?
131  if (tape)
132  tape->AddRun(run);
133 
134  if (csv_line->HasFieldValue("Events"))
135  run->SetEvents(csv_line->GetIntField("Events"));
136  else
137  Error("GoodRunLine", "No Events field ? run=%d", run_n);
138  if (csv_line->HasFieldValue("FAR"))
139  run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
140  else
141  Error("GoodRunLine", "No FAR field ? run=%d", run_n);
142  if (csv_line->HasFieldValue("MFI"))
143  run->SetScaler("MFI", csv_line->GetIntField("MFI"));
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("Trigger"))
165  run->SetTrigger(GetRunListTrigger("Trigger", "M>=%d"));
166  else
167  Error("GoodRunLine", "No Trigger field ? run=%d", run_n);
168  if (csv_line->HasFieldValue("NB"))
169  run->SetComments(csv_line->GetField("NB"));
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:541
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 extend_minimal_database() override
Definition: KVINDRADB2.cpp:60
void make_minimal_database() override
Definition: KVINDRADB2.cpp:43
void GoodRunLine() override
Definition: KVINDRADB2.cpp:78
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)