KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVINDRADB1.cpp
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
18using namespace std;
19
21
22
23
25
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>"))
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
54
56 gIndra->MakeCalibrationTables(this);
57}
58
59
60
61
68
70{
71 //For each "good run line" in the run list file, we:
72 // add a KVINDRADBRun to the database if it doesn't already exist
73 // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
74 // set properties of run and tape objects
75 //kFirstRun & kLastRun are set
76
77 KVRunListLine* csv_line = GetLineReader();
78
79 //run number
80 Int_t run_n = csv_line->GetIntField("run");
81
82 if (!run_n) {
83 cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
84 endl;
86 return;
87 }
88
89 /*********************************************
90 IF LINE HAS A TAPE NUMBER WE
91 LOOK FOR THE TAPE IN THE DATA
92 BASE. IF IT DOESN'T EXIST WE
93 CREATE IT.
94 *********************************************/
95 KVDBTape* tape = 0;
96 //tape number (if tape field is filled)
97 if (csv_line->HasFieldValue("tape")) {
98 Int_t tape_n = csv_line->GetIntField("tape");
99 //already exists ?
100 tape = GetTape(tape_n);
101 if (!tape) {
102 tape = new KVDBTape(tape_n);
103 AddTape(tape);
104 }
105 }
106 else {
107 Error("GoodRunLine", "No tape field ? run=%d", run_n);
108 }
109
110 /*********************************************
111 WE CREATE A NEW RUN AND ADD
112 IT TO THE DATABASE. WE SET ALL
113 AVAILABLE INFORMATIONS ON
114 RUN FROM THE FILE. ERROR IF
115 DBASE RUN ALREADY EXISTS =>
116 SAME RUN APPEARS TWICE
117 *********************************************/
118 KVINDRADBRun* run = GetRun(run_n);
119 if (!run) {
120
121 run = new KVINDRADBRun(run_n);
122 AddRun(run);
123
124 //add run to tape ?
125 if (tape)
126 tape->AddRun(run);
127
128 if (csv_line->HasFieldValue("events"))
129 run->SetEvents(csv_line->GetIntField("events"));
130 else
131 Error("GoodRunLine", "No events field ? run=%d", run_n);
132 if (csv_line->HasFieldValue("FAR"))
133 run->SetScaler("Faraday 1", csv_line->GetIntField("FAR"));
134 else
135 Error("GoodRunLine", "No FAR field ? run=%d", run_n);
136 if (csv_line->HasFieldValue("MFI"))
137 run->SetScaler("MFI", csv_line->GetIntField("MFI"));
138 else
139 Error("GoodRunLine", "No MFI field ? run=%d", run_n);
140 if (csv_line->HasFieldValue("blocs"))
141 run->SetScaler("Buffers", csv_line->GetIntField("blocs"));
142 else
143 Error("GoodRunLine", "No blocs field ? run=%d", run_n);
144 if (csv_line->HasFieldValue("G. dir"))
145 run->SetScaler("Gene DIRECT", csv_line->GetIntField("G. dir"));
146 else
147 Error("GoodRunLine", "No G. dir field ? run=%d", run_n);
148 if (csv_line->HasFieldValue("G. marq"))
149 run->SetScaler("Gene MARQ", csv_line->GetIntField("G. marq"));
150 else
151 Error("GoodRunLine", "No G. marq field ? run=%d", run_n);
152 if (csv_line->HasFieldValue("G. TM"))
153 run->SetScaler("Gene TM", csv_line->GetIntField("G. TM"));
154 else
155 Error("GoodRunLine", "No G. TM field ? run=%d", run_n);
156 if (csv_line->HasFieldValue("TM %"))
157 run->SetTMpercent(csv_line->GetFloatField("TM %"));
158 else
159 Error("GoodRunLine", "No TM %% field ? run=%d", run_n);
160 if (csv_line->HasField("Decl"))
161 run->SetTrigger(GetRunListTrigger("Decl", "M>=%d"));
162 else
163 Error("GoodRunLine", "No Decl field ? run=%d", run_n);
164 if (csv_line->HasFieldValue("Remarque"))
165 run->SetComments(csv_line->GetField("Remarque"));
166
167 }
168 else {
169 Error("GoodRunLine", "Run %d already exists", run_n);
170 }
171}
172
173
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
virtual TString GetDBEnv(const Char_t *) const
Definition KVExpDB.cpp:680
TString fDataSet
the name of the dataset to which this database is associated
Definition KVExpDB.h:23
DataBase of parameters for 1st campaign of INDRA.
Definition KVINDRADB1.h:32
virtual void Build()
Use KVINDRARunListReader utility subclass to read complete runlist.
virtual void GoodRunLine()
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)