KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
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
25using namespace std;
26
28
29
30
32
34{
35 //default ctor
36}
37
38
39
40
42
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);
62 GetLineReader()->SetFieldKeys("Tape", "Run", "Events");
63 GetLineReader()->SetRunKeys("Run", "Events");
64 ReadRunList(runlist_fullpath.Data());
67
69 gIndra->MakeCalibrationTables(this);
70}
71
72
73
74
75
82
84{
85 //For each "good run line" in the run list file, we:
86 // add a KVINDRADBRun to the database if it doesn't already exist
87 // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
88 // set properties of run and tape objects
89 //kFirstRun & kLastRun are set
90
91 KVRunListLine* csv_line = GetLineReader();
92
93 //run number
94 Int_t run_n = csv_line->GetIntField("Run");
95
96 if (!run_n) {
97 cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
98 endl;
100 return;
101 }
102
103 /*********************************************
104 IF LINE HAS A TAPE NUMBER WE
105 LOOK FOR THE TAPE IN THE DATA
106 BASE. IF IT DOESN'T EXIST WE
107 CREATE IT.
108 *********************************************/
109 KVDBTape* tape = 0;
110 //tape number (if tape field is filled)
111 if (csv_line->HasFieldValue("Tape")) {
112 Int_t tape_n = csv_line->GetIntField("Tape");
113 //already exists ?
114 tape = GetTape(tape_n);
115 if (!tape) {
116 tape = new KVDBTape(tape_n);
117 AddTape(tape);
118 }
119 }
120
121 /*********************************************
122 WE CREATE A NEW RUN AND ADD
123 IT TO THE DATABASE. WE SET ALL
124 AVAILABLE INFORMATIONS ON
125 RUN FROM THE FILE. ERROR IF
126 DBASE RUN ALREADY EXISTS =>
127 SAME RUN APPEARS TWICE
128 *********************************************/
129 KVINDRADBRun* run = (KVINDRADBRun*) GetRun(run_n);
130 if (!run) {
131
132 run = new KVINDRADBRun(run_n);
133 AddRun(run);
134
135 //add run to tape ?
136 if (tape)
137 tape->AddRun(run);
138
139 if (csv_line->HasFieldValue("Events"))
140 run->SetEvents(csv_line->GetIntField("Events"));
141 else
142 Error("GoodRunLine", "No Events field ? run=%d", run_n);
143 if (csv_line->HasFieldValue("FAR"))
144 run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
145 else
146 Error("GoodRunLine", "No FAR field ? run=%d", run_n);
147 if (csv_line->HasFieldValue("MFI"))
148 run->SetScaler("MFI", csv_line->GetIntField("MFI"));
149 if (csv_line->HasFieldValue("Blocs"))
150 run->SetScaler("Buffers", csv_line->GetIntField("Blocs"));
151 else
152 Error("GoodRunLine", "No Blocs field ? run=%d", run_n);
153 if (csv_line->HasFieldValue("G. dir"))
154 run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
155 else
156 Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
157 if (csv_line->HasFieldValue("G. marq"))
158 run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
159 else
160 Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
161 if (csv_line->HasFieldValue("G. TM"))
162 run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
163 else
164 Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
165 if (csv_line->HasFieldValue("TM %"))
166 run->SetTMpercent(csv_line->GetFloatField("TM %"));
167 else
168 Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
169 if (csv_line->HasField("Trigger"))
170 run->SetTrigger(GetRunListTrigger("Trigger", "M>=%d"));
171 else
172 Error("GoodRunLine", "No Trigger field ? run=%d", run_n);
173 if (csv_line->HasFieldValue("NB"))
174 run->SetComments(csv_line->GetField("NB"));
175
176 }
177 else {
178 Error("GoodRunLine", "Run %d already exists", run_n);
179 }
180}
181
182
int Int_t
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:170
void SetComments(const KVString &comments)
Definition KVDBRun.h:182
void SetTrigger(Int_t trig)
Definition KVDBRun.h:99
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:209
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
virtual void ReadSystemList()
Definition KVExpDB.cpp:249
void AddRun(KVDBRun *r)
Definition KVExpDB.h:67
TString GetCalibFileName(const Char_t *type) const
Definition KVExpDB.h:109
TString fDataSet
the name of the dataset to which this database is associated
Definition KVExpDB.h:23
DataBase of parameters for 2nd campaign of INDRA.
Definition KVINDRADB2.h:33
virtual void GoodRunLine()
virtual ~KVINDRADB2()
virtual void Build()
Use KVINDRARunListReader utility subclass to read complete runlist.
Database entry for each run of an INDRA experiment.
void SetTMpercent(Float_t tmp)
DataBase of parameters for an INDRA campaign.
Definition KVINDRADB.h:59
void AddTape(KVDBTape *r)
Definition KVINDRADB.h:119
virtual KVDBTape * GetTape(Int_t tape) const
Definition KVINDRADB.h:123
KVINDRADBRun * GetRun(Int_t run) const
Definition KVINDRADB.h:133
virtual void ReadChIoPressures()
void SetRLCommentChar(Char_t c)
void ReadRunList(const Char_t *name="")
Int_t GetRunListTrigger(const Char_t *field, const Char_t *fmt)
KVRunListLine * GetLineReader() const
void SetRLSeparatorChar(Char_t c)
void MakeCalibrationTables(KVExpDB *)
Override base method in order to read ChIo pressures for each run.
Definition KVINDRA.cpp:1595
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
Base class for reading runlists for experiments ,.
Bool_t HasFieldValue(const Char_t *) const
Float_t GetFloatField(const Char_t *)
virtual void Print() const
void SetFieldKeys()
Bool_t HasField(const Char_t *) const
INLINES_______________________________________________________________________________.
Int_t GetIntField(const Char_t *)
virtual const Char_t * GetField(const Char_t *) const
virtual void Error(const char *method, const char *msgfmt,...) const
const char * Data() const
ClassImp(TPyArg)