53 fChIoPressures = AddTable(
"ChIo Pressures",
"Pressures of ChIo");
54 fTapes = AddTable(
"Tapes",
"List of data storage tapes");
55 fCsILumCorr = AddTable(
"CsIGainCorr",
"CsI gain corrections for total light output");
56 fPedestals = AddTable(
"Pedestals",
"List of pedestal files");
58 AddTable(
"Channel-Volt",
59 "Calibration parameters for Channel-Volts conversion");
61 AddTable(
"Volt-Energy ChIo-Si",
62 "Calibration parameters for ChIo-Si Volts-Energy conversion");
64 AddTable(
"Light-Energy CsI Z=1",
65 "Calibration parameters for CsI detectors");
67 AddTable(
"Light-Energy CsI Z>1",
68 "Calibration parameters for CsI detectors");
85 "INDRA experiment parameter database")
96 "INDRA experiment parameter database")
117 KVINDRADB::~KVINDRADB()
177 Error(
"GetCalibrationPeaks",
178 "No KVINDRA object found. You need to build INDRA before using this method.");
184 Error(
"GetCalibrationPeaks",
185 "Calibration peak file not defined or not found");
198 Int_t frun = 0, lrun = 0;
204 Int_t cour, modu, sign, typ2,
first, last, entries;
213 if (sscanf(sline.
Data(),
"Run Range : %d %d", &frun, &lrun) != 2) {
215 "Bad format in line :\n%s\nUnable to read run range values",
220 ok_for_this_run =
kTRUE;
226 else if (!sline.
BeginsWith(
"#") && ok_for_this_run) {
230 if (sscanf(sline.
Data(),
"%d %d %d %d %f %f %f %d %f %d %d",
231 &cour, &modu, &sign, &typ2, &mean, &error, &
sigma,
232 &entries, &constante, &
first, &last) != 11) {
233 Warning(
"GetCalibrationPeaks()",
234 "Bad format in line :\n%s\nUnable to read peak parameters",
248 if (detector && detector != pic_det)
252 if (peak_type > 0 && peak_type != typ2)
256 if (signal_type && signal_type != sign)
306 if (peak && peak_energy > 0) {
307 if (typ2 == kElastic) {
339 peak_list->
Add(peak);
352 FindObjectByName(pic_det->
GetName());
394 Error(
"OpenCalibrationPeakFile",
"File already open");
429 fMeanGDir =
new TF1(
"INDRA_MeanGDIR", formula, 1, 10000);
444 Error(
"ReadGainList()",
"Could not open file %s",
448 Info(
"ReadGainList()",
"Reading gains ...");
455 UInt_t frun = 0, lrun = 0;
482 if (sscanf(sline.
Data(),
"Run Range : %u %u", &frun, &lrun) != 2) {
484 "Bad format in line :\n%s\nUnable to read run range values",
486 cout <<
"sscanf=" << sscanf(sline.
Data(),
"Run Range : %u %u",
487 &frun, &lrun) << endl;
491 run_ranges[rr_number][0] = frun;
492 run_ranges[rr_number][1] = lrun;
495 Error(
"ReadGainList",
"Too many run ranges (>%d)",
502 if (sscanf(sline.
Data(),
"%7s %f", det_name, &gain) != 2) {
504 "Bad format in line :\n%s\nUnable to read",
512 par_list->
Add(parset);
556 Error(
"ReadChIoPressures()",
"Could not open file %s",
560 Info(
"ReadChIoPressures()",
"Reading ChIo pressures parameters...");
563 UInt_t frun = 0, lrun = 0;
573 Float_t pressure[5] = { 0, 0, 0, 0, 0 };
585 par_list->
Add(parset);
588 for (
int zz = 0; zz < 5; zz++) pressure[zz] = 0.;
594 if (sscanf(sline.
Data(),
"Run Range : %u %u", &frun, &lrun) != 2) {
596 "Bad format in line :\n%s\nUnable to read run range values",
601 run_ranges[rr_number][0] = frun;
602 run_ranges[rr_number][1] = lrun;
605 Error(
"ReadChIoPressures",
"Too many run ranges (>%d)",
616 par_list->
Add(parset);
619 for (
int zz = 0; zz < 5; zz++) pressure[zz] = 0.;
636 read_pressure =
kTRUE;
638 if (chio ==
"2_3") pressure[0] = press.
Atof();
639 else if (chio ==
"4_5") pressure[1] = press.
Atof();
640 else if (chio ==
"6_7") pressure[2] = press.
Atof();
641 else if (chio ==
"8_12") pressure[3] = press.
Atof();
642 else if (chio ==
"13_17") pressure[4] = press.
Atof();
643 else read_pressure =
kFALSE;
705 Error(
"GetEventCrossSection",
"No target for run %d", run1);
709 for (
int run = run1; run <= run2; run++) {
737 for (
int run = run1; run <= run2; run++) {
768 Error(
"GetEventCrossSection",
769 "System %s unknown. Check list of systems (gIndraDB->GetSystems()->ls()).",
775 Error(
"GetEventCrossSection",
"No target defined for system %s",
815 Error(
"GetTotalCrossSection",
816 "System %s unknown. Check list of systems (gIndraDB->GetSystems()->ls()).",
849 Info(
"GetTotalCrossSection",
"Calculating cross-section for q=%f", Q_apres_cible);
852 for (
int i = 1; i <= events_histo->
GetNbinsX(); i++) {
854 if (events == 0)
continue;
862 cout <<
"Run#" << run_num <<
" Events : " << events
906 if (!strcmp(
GetDBEnv(
"Runlist.Separator"),
"<TAB>"))
953 Error(
"ReadNewRunList()",
"Could not open file %s",
958 Info(
"ReadNewRunList()",
"Reading run parameters ...");
963 while (fin.good() && !fin.eof()) {
966 if (
line.Length() > 1 && !
line.BeginsWith(
"#") && !
line.BeginsWith(
"Version")) {
1105 key =
GetDBEnv(
"Runlist.PlastAll");
1129 key =
GetDBEnv(
"Runlist.Comments");
1138 Error(
"GoodRunLine",
"Run %d already exists", run_n);
1181 if (g_dir_frq == 0) {
1182 Error(
"GetRunLengthFromGeneDirect",
"Mean frequency of G_DIR unknown for this dataset");
1187 Error(
"GetRunLengthFromGeneDirect",
"Run %d not in database", run);
1192 Error(
"GetRunLengthFromGeneDirect",
"Gene DIRECT total not known for run");
1195 return g_dir / g_dir_frq;
1262 Info(
"ReadCsITotalLightGainCorrections",
1263 "Reading corrections...");
1269 Error(
"ReadCsITotalLightGainCorrections",
"INDRADB.CsILumCorr is not defined. Check .kvrootrc files.");
1273 if (!gain_cor.
IsOK()) {
1274 Info(
"ReadCsITotalLightGainCorrections",
"No corrections found");
1279 filefmt =
GetDBEnv(
"CsILumCorr.FileName");
1280 if (filefmt ==
"") {
1281 Error(
"ReadCsITotalLightGainCorrections",
"INDRADB.CsILumCorr.FileName is not defined. Check .kvrootrc files.");
1291 filepath.
Form(filefmt.
Data(), run_num);
1294 ifstream filereader;
1298 line.ReadLine(filereader);
1299 while (filereader.good()) {
1303 line.ReadLine(filereader);
1308 line.ReadLine(filereader);
1312 line.ReadLine(filereader);
1318 "CsI Total Light Gain Correction", 1);
1323 line.ReadLine(filereader);
1328 Warning(
"ReadCsITotalLightGainCorrections",
"Run %d: no correction", run_num);
1352 Error(
"ReadChannelVolt()",
"Could not open file %s",
1356 Info(
"ReadChannelVolt()",
1357 "Reading electronic calibration for ChIo and Si...");
1361 UInt_t frun = 0, lrun = 0;
1367 Float_t a0, a1, a2, dum1, dum2;
1375 while (fin.good()) {
1389 if (sscanf(sline.
Data(),
"Run Range : %u %u", &frun, &lrun) != 2) {
1391 "Bad format in line :\n%s\nUnable to read run range values",
1396 run_ranges[rr_number][0] = frun;
1397 run_ranges[rr_number][1] = lrun;
1400 Error(
"ReadChannelVolt",
"Too many run ranges (>%d)",
1407 if (sscanf(sline.
Data(),
"%u %u %u %f %f %f %f %f",
1408 &cour, &modu, &sign, &a0, &a1, &a2, &dum1,
1411 "Bad format in line :\n%s\nUnable to read",
1418 sprintf(det_name,
"CI_%02u%02u_GG", cour, modu);
1419 strcpy(cal_type,
"Channel-Volt GG");
1422 sprintf(det_name,
"CI_%02u%02u_PG", cour, modu);
1423 strcpy(cal_type,
"Channel-Volt PG");
1426 sprintf(det_name,
"SI_%02u%02u_GG", cour, modu);
1427 strcpy(cal_type,
"Channel-Volt GG");
1430 sprintf(det_name,
"SI_%02u%02u_PG", cour, modu);
1431 strcpy(cal_type,
"Channel-Volt PG");
1438 par_list->
Add(parset);
1448 if (!
OpenCalibFile(
"ElectronicCalibration.Etalons", fin2)) {
1449 Error(
"ReadChannelVolt()",
"Could not open file %s",
1453 Info(
"ReadChannelVolt()",
1454 "Reading electronic calibration for Si75 and SiLi...");
1458 par_list =
new TList;
1460 while (fin2.good()) {
1476 if (sscanf(sline.
Data(),
"Run Range : %u %u", &frun, &lrun) != 2) {
1478 "Bad format in line :\n%s\nUnable to read run range values",
1483 run_ranges[rr_number][0] = frun;
1484 run_ranges[rr_number][1] = lrun;
1487 Error(
"ReadChannelVolt",
"Too many run ranges (>%d)",
1494 if (sscanf(sline.
Data(),
"%s %f %f %f",
1495 det_name, &a0, &a1, &a2) != 4) {
1497 "Bad format in line :\n%s\nUnable to read",
1502 gain.
Form(
"%s", det_name);
1505 scal_type.
Form(
"Channel-Volt %s", ((
TObjString*)toks->
At(2))->GetString().Data());
1511 par_list->
Add(parset);
1534 Error(
"ReadVoltEnergyChIoSi()",
"Could not open file %s",
1538 Info(
"ReadVoltEnergyChIoSi()",
1539 "Reading ChIo/Si calibration parameters...");
1543 UInt_t frun = 0, lrun = 0;
1554 while (fin.good()) {
1570 if (sscanf(sline.
Data(),
"Run Range : %u %u", &frun, &lrun) != 2) {
1571 Warning(
"ReadVoltEnergyAlpha()",
1572 "Bad format in line :\n%s\nUnable to read run range values",
1577 run_ranges[rr_number][0] = frun;
1578 run_ranges[rr_number][1] = lrun;
1581 Error(
"ReadVoltEnergyAlpha",
"Too many run ranges (>%d)",
1588 if (sscanf(sline.
Data(),
"%7s %f %f %f", det_name, &a0, &a1, &chi)
1590 Warning(
"ReadVoltEnergyAlpha()",
1591 "Bad format in line :\n%s\nUnable to read parameters",
1599 par_list->
Add(parset);
1623 Error(
"ReadPedestalList()",
"Could not open file %s",
1627 Info(
"ReadPedestalList()",
"Reading pedestal file list...");
1630 Char_t filename_chio[80], filename_csi[80];
1633 while (fin.good()) {
1639 if (
line.BeginsWith(
'+')) {
1644 (
line.Data(),
"Run Range : %u %u", &runlist[0][0],
1645 &runlist[0][1]) != 2) {
1646 Warning(
"ReadPedestalList()",
"Format problem in line \n%s",
1652 sscanf(
line.Data(),
"%s", filename_chio);
1656 sscanf(
line.Data(),
"%s", filename_csi);
1661 new KVDBRecord(filename_chio,
"ChIo/Si/Etalons pedestals");
1662 dummy->
AddKey(
"Runs",
"Runs for which to use this pedestal file");
1665 dummy =
new KVDBRecord(filename_csi,
"CsI pedestals");
1666 dummy->
AddKey(
"Runs",
"Runs for which to use this pedestal file");
1673 cout <<
"Pedestals Read" << endl;
1712 filename.
Form(
"CalibCsI.%s", zrange);
1714 Error(
"ReadLightEnergyCsI()",
"Could not open file %s",
1718 Info(
"ReadLightEnergyCsI()",
1719 "Reading Light-Energy CsI calibration parameters (%s)...", zrange);
1737 while (fin.good()) {
1742 (sline.
Data(),
"%d %d %f %f %f %f", &ring, &mod, &a1,
1743 &a2, &a3, &a4) != 6) {
1744 Warning(
"ReadLightEnergyCsI()",
1745 "Bad format in line :\n%s\nUnable to read parameters",
1753 Warning(
"ReadLightEnergyCsI()",
"Read calibration for non-existent detector CSI_%02d%02d",
1762 par_list->
Add(parset);
1798 Error(
"GetEventCrossSection",
"No target for run %d", run1);
1803 while (!runs.
End()) {
1805 int run = runs.
Next();
1834 while (!runs.
End()) {
1835 int run = runs.
Next();
1858 Error(
"ReadAbsentDetectors",
"Fichier %s, inconnu au bataillon",
GetCalibFileName(
"AbsentDet").Data());
1861 Info(
"ReadAbsentDetectors()",
"Lecture des detecteurs absents...");
1876 while (!srec.
End()) {
1878 dbrec->
AddKey(
"Runs",
"List of Runs");
1885 dbrec->
AddKey(
"Runs",
"List of Runs");
1909 Info(
"ReadOoODetectors()",
"Lecture des detecteurs hors service ...");
1910 fOoODet =
AddTable(
"OoO Detectors",
"Name of out of order detectors");
1924 while (!srec.
End()) {
1926 dbrec->
AddKey(
"Runs",
"List of Runs");
1933 dbrec->
AddKey(
"Runs",
"List of Runs");
1954 Error(
"ReadNotWorkingACQParams",
"Fichier %s, inconnu au bataillon",
GetCalibFileName(
"OoOACQPar").Data());
1957 Info(
"ReadNotWorkingACQParams()",
"Lecture des parametres d acq hors service ...");
1972 while (!srec.
End()) {
1974 dbrec->
AddKey(
"Runs",
"List of Runs");
1981 dbrec->
AddKey(
"Runs",
"List of Runs");
#define MAX_NUM_RUN_RANGES
dimension of run_range arrays
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char * Form(const char *fmt,...)
static const Char_t * GetDataSetEnv(const Char_t *dataset, const Char_t *type, const Char_t *defval)
static Bool_t SearchAndOpenKVFile(const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
CsI(Tl) scintillation detectors of the INDRA multidetector array.
Wrapper for KVDBPeak describing alpha (thoron) peaks for calibration.
CHIO pressure parameters.
Wrapper for KVDBPeak describing elastic peaks for calibration.
To store calibration parameters in a database ,.
void SetParamName(UShort_t i, const Char_t *name)
Double_t GetParameter(UShort_t i=0) const
void SetParameters(Double_t val,...)
Calibration peak in database.
void SetSigType(const Char_t *sig)
void SetGain(Float_t gain)
Float_t GetEnergy() const
void SetRing(UChar_t ring)
void SetModule(UChar_t mod)
void SetEnergy(Float_t e)
void SetGas(Bool_t avec=kTRUE)
Record folder for the database.
virtual Bool_t AddKey(KVDBKey *key, Bool_t check=kTRUE)
virtual Bool_t AddLink(const Char_t *key_name, KVDBRecord *rec, Bool_t linkback=kTRUE)
virtual KVRList * GetLinks(const Char_t *key) const
Returns the list of records linked to this record in table "key".
virtual Int_t GetNumber() const
Description of an experimental run in database ,.
void SetEvents(ULong64_t evt_number)
void SetTime(Double_t time)
ULong64_t GetEvents() const
KVTarget * GetTarget() const
Return target used for this run (actually target of KVDBSystem associated to run)
void SetComments(const KVString &comments)
KVDBSystem * GetSystem() const
void SetStartDate(const KVString &date)
void SetEndDate(const KVString &d)
void SetTrigger(Int_t trig)
virtual void ReadRunListLine(const KVString &)
virtual Int_t GetScaler(const Char_t *name) const
Get value of scaler with the given name for this run.
virtual void SetScaler(const Char_t *name, Int_t val)
Set value for the scaler with the given name for this run.
Database class used to store information on different colliding systems studied during an experiment.
KVTarget * GetTarget() const
KVList * GetRuns() const
Returns a sorted list of all the runs associated with this system.
virtual Bool_t AddRecord(KVDBRecord *add)
Database entry describing a data storage tape used to store raw data.
void AddRun(KVDBRun *run)
add run to list of runs stored on this tape
virtual KVDBTable * GetTable(const Char_t *table) const
virtual Bool_t AddTable(KVDBTable *table)
Base class for detector geometry description, interface to energy-loss calculations.
Base class to describe database of an experiment ,.
virtual KVDBSystem * GetSystem(const Char_t *system) const
virtual void ReadSystemList()
virtual KVSeqCollection * GetRuns() const
TString GetCalibFileName(const Char_t *type) const
virtual void LinkListToRunRanges(TList *list, UInt_t rr_number, UInt_t run_ranges[][2])
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
const KVNumberList & GetRunList() const
virtual void LinkListToRunRange(TList *list, const KVNumberList &nl)
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
const Char_t * GetDataSetDir() const
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
virtual TString GetDBEnv(const Char_t *) const
Bool_t OpenCalibFile(const Char_t *type, std::ifstream &fs) const
TString fDataSet
the name of the dataset to which this database is associated
Database entry for each run of an INDRA experiment.
Double_t GetNIncidentIons(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
Double_t GetTempsMort() const
Double_t GetEventCrossSection(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void SetLogbook(const Char_t *log)
Double_t GetTotalCrossSection(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void SetTMpercent(Float_t tmp)
DataBase of parameters for an INDRA campaign.
KVDBTable * fOoODet
(optional) Liste les detecteurs hors service
void CloseCalibrationPeakFile()
Close file containing database of calibration peaks.
virtual void ReadObjects(TFile *)
Read associated objects (i.e. KVINDRAPulserDataTree's TTree) from file.
void AddTape(KVDBTape *r)
KVDBTable * fChanVolt
ChIo/Si channel-volt calibration parameters.
Double_t GetEventCrossSection(Int_t run, Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
std::ifstream __ifpeaks
ifstream for calibration peaks file
virtual void GoodRunLine()
KVDBTable * fLitEnerCsI
CsI light-energy calibration for Z>1.
virtual void ReadOoOACQParams()
Double_t GetTotalCrossSection(Int_t run, Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void _init_MeanGDir_func() const
virtual void ReadChannelVolt()
KVDBTable * fAbsentDet
(optional) Liste les detecteurs absents
void ReadNewRunList()
Read new-style runlist (written using KVDBRun v.10 or later)
std::ifstream & GetPeakFileStream()
Bool_t OpenCalibrationPeakFile()
calibration peaks database
virtual void ReadPedestalList()
virtual void ReadGainList()
Read the file listing any detectors whose gain value changes during exeriment.
KVDBTable * fCsILumCorr
table of CsI gain corrections for total light output
virtual void WriteObjects(TFile *)
Write associated objects (i.e. KVINDRAPulserDataTree's TTree) in file.
KVDBTable * fOoOACQPar
(optional) Liste des parametres d acquisition ne marchant pas
KVINDRAPulserDataTree * fPulserData
mean values of pulsers for all detectors & runs
virtual void ReadVoltEnergyChIoSi()
virtual void ReadOoODetectors()
KVList * GetCalibrationPeaks(Int_t run, KVDetector *detector=0, Int_t peak_type=-1, Int_t signal_type=0, Double_t peak_energy=-1.0)
virtual KVDBTape * GetTape(Int_t tape) const
TF1 * fMeanGDir
mean frequency of GENE_DIRECT vs. run number
virtual void ReadCsITotalLightGainCorrections()
KVDBTable * fPedestals
table of pedestal files
KVDBTable * fVoltMeVChIoSi
ChIo/Si volt-energy calibration.
KVDBTable * fGains
(optional) table of detector gains, in case they change from run to run
virtual void ReadLightEnergyCsI(const Char_t *, KVDBTable *)
virtual void ReadAbsentDetectors()
virtual void ReadChIoPressures()
virtual Double_t GetRunLengthFromGeneDirect(int run) const
Double_t GetMeanGDirFreq(Int_t run) const
KVINDRADBRun * GetRun(Int_t run) const
virtual void ReadCalibCsI()
KVDBTable * fLitEnerCsIZ1
CsI light-energy calibration for Z=1.
KVINDRADetector * GetChIo() const
Handles TTree with mean pulser data for every run.
void SetRunList(KVSeqCollection *runs)
void ReadTree(TFile *)
Read pulser data tree from file.
Bool_t IsNewRunList() const
Int_t GetRLLineNumber() const
void SetRLCommentChar(Char_t c)
KVRunListLine * GetLineReader() const
void ReadRunList(const Char_t *name="")
Int_t GetRunListTrigger(const Char_t *field, const Char_t *fmt)
void SetRLSeparatorChar(Char_t c)
virtual void Build(Int_t run=-1)
static Char_t SignalTypes[16][3]
Use this static array to translate EBaseIndra_type signal type to a string giving the signal type.
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
Extended TList class which owns its objects by default.
virtual Bool_t IsBuilt() const
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
Strings used to represent a set of ranges of values.
Wrapper for TRefArray adding some functionality.
Base class for reading runlists for experiments ,.
Bool_t HasFieldValue(const Char_t *) const
Float_t GetFloatField(const Char_t *)
virtual void Print() const
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 Add(TObject *obj)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Handles directories stored in .tgz archive files.
Calculation/correction of energy losses of particles through an experimental target.
Double_t GetAtomsPerCM2() const
virtual UInt_t GetUnits() const;
virtual Int_t GetSize() const
const char * GetName() const
const char * GetValue() const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
THashList * GetTable() const
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual Double_t GetBinCenter(Int_t bin) const
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
virtual void Add(TObject *obj)
virtual void Clear(Option_t *option="")
virtual const char * GetName() const
TObject * At(Int_t idx) const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
TSubString Strip(EStripType s=kTrailing, char c=' ') const
TObjArray * Tokenize(const TString &delim) const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
const char * Data() const
TString & Prepend(char c, Ssiz_t rep=1)
virtual Int_t Sizeof() const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
Double_t Range(Double_t lb, Double_t ub, Double_t x)