KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVINDRADB1.cpp
Go to the documentation of this file.
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 
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  ReadChIoPressures();
54 }
55 
56 
57 
58 
65 
67 {
68  //For each "good run line" in the run list file, we:
69  // add a KVINDRADBRun to the database if it doesn't already exist
70  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
71  // set properties of run and tape objects
72  //kFirstRun & kLastRun are set
73 
74  KVRunListLine* csv_line = GetLineReader();
75 
76  //run number
77  Int_t run_n = csv_line->GetIntField("run");
78 
79  if (!run_n) {
80  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
81  endl;
82  GetLineReader()->Print();
83  return;
84  }
85 
86  /*********************************************
87  IF LINE HAS A TAPE NUMBER WE
88  LOOK FOR THE TAPE IN THE DATA
89  BASE. IF IT DOESN'T EXIST WE
90  CREATE IT.
91  *********************************************/
92  KVDBTape* tape = 0;
93  //tape number (if tape field is filled)
94  if (csv_line->HasFieldValue("tape")) {
95  Int_t tape_n = csv_line->GetIntField("tape");
96  //already exists ?
97  tape = GetTape(tape_n);
98  if (!tape) {
99  tape = new KVDBTape(tape_n);
100  AddTape(tape);
101  }
102  }
103  else {
104  Error("GoodRunLine", "No tape field ? run=%d", run_n);
105  }
106 
107  /*********************************************
108  WE CREATE A NEW RUN AND ADD
109  IT TO THE DATABASE. WE SET ALL
110  AVAILABLE INFORMATIONS ON
111  RUN FROM THE FILE. ERROR IF
112  DBASE RUN ALREADY EXISTS =>
113  SAME RUN APPEARS TWICE
114  *********************************************/
115  KVINDRADBRun* run = GetRun(run_n);
116  if (!run) {
117 
118  run = new KVINDRADBRun(run_n);
119  AddRun(run);
120 
121  //add run to tape ?
122  if (tape)
123  tape->AddRun(run);
124 
125  if (csv_line->HasFieldValue("events"))
126  run->SetEvents(csv_line->GetIntField("events"));
127  else
128  Error("GoodRunLine", "No events field ? run=%d", run_n);
129  if (csv_line->HasFieldValue("FAR"))
130  run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
131  else
132  Error("GoodRunLine", "No FAR field ? run=%d", run_n);
133  if (csv_line->HasFieldValue("MFI"))
134  run->SetScaler("MFI", csv_line->GetIntField("MFI"));
135  else
136  Error("GoodRunLine", "No MFI field ? run=%d", run_n);
137  if (csv_line->HasFieldValue("blocs"))
138  run->SetScaler("Buffers", csv_line->GetIntField("blocs"));
139  else
140  Error("GoodRunLine", "No blocs field ? run=%d", run_n);
141  if (csv_line->HasFieldValue("G. dir"))
142  run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
143  else
144  Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
145  if (csv_line->HasFieldValue("G. marq"))
146  run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
147  else
148  Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
149  if (csv_line->HasFieldValue("G. TM"))
150  run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
151  else
152  Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
153  if (csv_line->HasFieldValue("TM %"))
154  run->SetTMpercent(csv_line->GetFloatField("TM %"));
155  else
156  Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
157  if (csv_line->HasField("Decl"))
158  run->SetTrigger(GetRunListTrigger("Decl", "M>=%d"));
159  else
160  Error("GoodRunLine", "No Decl field ? run=%d", run_n);
161  if (csv_line->HasFieldValue("Remarque"))
162  run->SetComments(csv_line->GetField("Remarque"));
163 
164  }
165  else {
166  Error("GoodRunLine", "Run %d already exists", run_n);
167  }
168 }
169 
170 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:538
void SetEvents(ULong64_t evt_number)
Definition: KVDBRun.h:169
void SetComments(const KVString &comments)
Definition: KVDBRun.h:181
void SetTrigger(Int_t trig)
Definition: KVDBRun.h:98
virtual void SetScaler(const Char_t *name, Int_t val)
Set value for the scaler with the given name for this run.
Definition: KVDBRun.h:208
Database entry describing a data storage tape used to store raw data.
Definition: KVDBTape.h:24
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:31
virtual void Build()
Use KVINDRARunListReader utility subclass to read complete runlist.
Definition: KVINDRADB1.cpp:37
virtual void GoodRunLine()
Definition: KVINDRADB1.cpp:66
Database entry for each run of an INDRA experiment.
Definition: KVINDRADBRun.h:29
void SetTMpercent(Float_t tmp)
Definition: KVINDRADBRun.h:54
DataBase of parameters for an INDRA campaign.
Definition: KVINDRADB.h:58
Base class for reading runlists for experiments ,.
Definition: KVRunListLine.h:25
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 *va_(fmt),...)