KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVINDRADB2.cpp
Go to the documentation of this file.
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 
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  ReadChIoPressures();
67 }
68 
69 
70 
71 
72 
79 
81 {
82  //For each "good run line" in the run list file, we:
83  // add a KVINDRADBRun to the database if it doesn't already exist
84  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
85  // set properties of run and tape objects
86  //kFirstRun & kLastRun are set
87 
88  KVRunListLine* csv_line = GetLineReader();
89 
90  //run number
91  Int_t run_n = csv_line->GetIntField("Run");
92 
93  if (!run_n) {
94  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
95  endl;
96  GetLineReader()->Print();
97  return;
98  }
99 
100  /*********************************************
101  IF LINE HAS A TAPE NUMBER WE
102  LOOK FOR THE TAPE IN THE DATA
103  BASE. IF IT DOESN'T EXIST WE
104  CREATE IT.
105  *********************************************/
106  KVDBTape* tape = 0;
107  //tape number (if tape field is filled)
108  if (csv_line->HasFieldValue("Tape")) {
109  Int_t tape_n = csv_line->GetIntField("Tape");
110  //already exists ?
111  tape = GetTape(tape_n);
112  if (!tape) {
113  tape = new KVDBTape(tape_n);
114  AddTape(tape);
115  }
116  }
117 
118  /*********************************************
119  WE CREATE A NEW RUN AND ADD
120  IT TO THE DATABASE. WE SET ALL
121  AVAILABLE INFORMATIONS ON
122  RUN FROM THE FILE. ERROR IF
123  DBASE RUN ALREADY EXISTS =>
124  SAME RUN APPEARS TWICE
125  *********************************************/
126  KVINDRADBRun* run = (KVINDRADBRun*) GetRun(run_n);
127  if (!run) {
128 
129  run = new KVINDRADBRun(run_n);
130  AddRun(run);
131 
132  //add run to tape ?
133  if (tape)
134  tape->AddRun(run);
135 
136  if (csv_line->HasFieldValue("Events"))
137  run->SetEvents(csv_line->GetIntField("Events"));
138  else
139  Error("GoodRunLine", "No Events field ? run=%d", run_n);
140  if (csv_line->HasFieldValue("FAR"))
141  run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
142  else
143  Error("GoodRunLine", "No FAR field ? run=%d", run_n);
144  if (csv_line->HasFieldValue("MFI"))
145  run->SetScaler("MFI", csv_line->GetIntField("MFI"));
146  if (csv_line->HasFieldValue("Blocs"))
147  run->SetScaler("Buffers", csv_line->GetIntField("Blocs"));
148  else
149  Error("GoodRunLine", "No Blocs field ? run=%d", run_n);
150  if (csv_line->HasFieldValue("G. dir"))
151  run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
152  else
153  Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
154  if (csv_line->HasFieldValue("G. marq"))
155  run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
156  else
157  Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
158  if (csv_line->HasFieldValue("G. TM"))
159  run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
160  else
161  Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
162  if (csv_line->HasFieldValue("TM %"))
163  run->SetTMpercent(csv_line->GetFloatField("TM %"));
164  else
165  Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
166  if (csv_line->HasField("Trigger"))
167  run->SetTrigger(GetRunListTrigger("Trigger", "M>=%d"));
168  else
169  Error("GoodRunLine", "No Trigger field ? run=%d", run_n);
170  if (csv_line->HasFieldValue("NB"))
171  run->SetComments(csv_line->GetField("NB"));
172 
173  }
174  else {
175  Error("GoodRunLine", "Run %d already exists", run_n);
176  }
177 }
178 
179 
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:541
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 2nd campaign of INDRA.
Definition: KVINDRADB2.h:32
virtual void GoodRunLine()
Definition: KVINDRADB2.cpp:80
virtual void Build()
Use KVINDRARunListReader utility subclass to read complete runlist.
Definition: KVINDRADB2.cpp:54
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),...)