KaliVeda
Toolkit for HIC analysis
KVINDRADB.cpp
1 /***************************************************************************
2  kvINDRADB.cpp - description
3  -------------------
4  begin : 9/12 2003
5  copyright : (C) 2003 by J.D. Frankland
6  email : frankland@ganil.fr
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #include "Riostream.h"
18 #include "KVINDRA.h"
19 #include "KVINDRADB.h"
20 #include "KVINDRADBRun.h"
21 #include "KVDBSystem.h"
22 #include "KVDBAlphaPeak.h"
23 #include "KVDBElasticPeak.h"
24 #include "KVDBChIoPressures.h"
25 #include "KVDBParameterSet.h"
26 #include "KVRunListLine.h"
27 #include "KVChIo.h"
28 #include "KVString.h"
29 #include "KVTarget.h"
30 #include "TObjArray.h"
31 #include "TEnv.h"
32 #include "KVDataSet.h"
33 #include "KVDataSetManager.h"
34 #include "KVCsI.h"
35 #include "TH1.h"
36 #include "KVNumberList.h"
37 
38 KVINDRADB* gIndraDB;
39 
40 
41 
42 using namespace std;
43 
45 
46 
47 
49 void KVINDRADB::init()
50 {
51  fDBType = "INDRADB";
52 
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");
57  fChanVolt =
58  AddTable("Channel-Volt",
59  "Calibration parameters for Channel-Volts conversion");
60  fVoltMeVChIoSi =
61  AddTable("Volt-Energy ChIo-Si",
62  "Calibration parameters for ChIo-Si Volts-Energy conversion");
63  fLitEnerCsIZ1 =
64  AddTable("Light-Energy CsI Z=1",
65  "Calibration parameters for CsI detectors");
66  fLitEnerCsI =
67  AddTable("Light-Energy CsI Z>1",
68  "Calibration parameters for CsI detectors");
69 
70  fGains = 0;
71  fAbsentDet = 0;
72  fOoODet = 0;
73  fOoOACQPar = 0;
74 
75  fPulserData = 0;
76 
77  fMeanGDir = nullptr;
78 }
79 
80 
81 
83 
85  "INDRA experiment parameter database")
86 {
87  init();
88 }
89 
90 
91 
92 
94 
96  "INDRA experiment parameter database")
97 {
98  init();
99 }
100 
101 
102 
104 
106 {
107 
108  KVExpDB::cd();
109  gIndraDB = this;
110 }
111 
112 
113 
116 
117 KVINDRADB::~KVINDRADB()
118 {
119  //reset global pointer gIndraDB if it was pointing to this database
120 
121  if (gIndraDB == this)
122  gIndraDB = 0;
124 }
125 
126 
127 
128 
150 
152  Int_t peak_type, Int_t signal_type,
153  Double_t peak_energy)
154 {
155  //Use this method to access the 'peaks' (see class KVDBPeak and derivatives)
156  //used for the calibration of detectors in a given run.
157  //
158  //Mandatory argument :
159  // run : number of the run for which calibration peaks are valid
160  //Optional arguments :
161  // detector : detector for which peaks are valid
162  // peak_type : type of peak
163  // peak_type = 1 Thoron alpha peak E=6.062 MeV
164  // peak_type = 2 Thoron alpha peak E=8.785 MeV
165  // peak_type = 3 Elastic scattering peak
166  // peak_type = 4 Thoron alpha peak E=6.062 MeV (no gas in ChIo)
167  // peak_type = 5 Thoron alpha peak E=8.785 MeV (no gas in ChIo)
168  // signal_type : one of the INDRA signal types, see KVINDRA::GetDetectorByType
169  // peak_energy : nominal energy corresponding to peak (incident energy of projectile
170  // in case of elastic scattering peak).
171  //
172  //The peaks are read as and when necessary in the peak database file.
173  //
174  //USER'S RESPONSIBILITY TO DELETE LIST AFTERWARDS.
175 
176  if (!gIndra) {
177  Error("GetCalibrationPeaks",
178  "No KVINDRA object found. You need to build INDRA before using this method.");
179  return 0;
180  }
181 
182  if (!OpenCalibrationPeakFile()) {
183  //Calibration peak file not defined or not found
184  Error("GetCalibrationPeaks",
185  "Calibration peak file not defined or not found");
186  return 0;
187  }
188  //types of peaks
189  enum {
190  kAlpha6MeV = 1,
191  kAlpha8MeV = 2,
192  kElastic = 3,
193  kAlpha6MeVSG = 4,
194  kAlpha8MeVSG = 5
195  };
196 
197  TString sline;
198  Int_t frun = 0, lrun = 0;
199  KVList* peak_list = new KVList();
200 
201  //set to true after reading a run range corresponding to 'run'
202  Bool_t ok_for_this_run = kFALSE;
203 
204  Int_t cour, modu, sign, typ2, first, last, entries;
205  Float_t mean, error, sigma, constante;
206 
207  while (GetPeakFileStream().good()) {
208 
209  sline.ReadLine(GetPeakFileStream());
210 
211  if (sline.BeginsWith("Run Range :")) { // Run Range found
212 
213  if (sscanf(sline.Data(), "Run Range : %d %d", &frun, &lrun) != 2) {
214  Warning("ReadPeakList()",
215  "Bad format in line :\n%s\nUnable to read run range values",
216  sline.Data());
217  }
218  else {
219  if (TMath::Range(frun, lrun, run) == run) { //frun <= run <= lrun
220  ok_for_this_run = kTRUE;
221  }
222  else
223  ok_for_this_run = kFALSE;
224  }
225  } //Run Range found
226  else if (!sline.BeginsWith("#") && ok_for_this_run) {
227 
228  //only analyse (non-commented) lines which follow a valid run range
229 
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",
235  sline.Data());
236  }
237  else { // parameters correctly read
238 
239  //find corresponding detector
240 
241  KVDetector* pic_det =
242  //the chio's in the file are written with the
243  //ring,module of the Si/CsI in coinc
244  (sign > ChIo_T) ? gIndra->GetDetectorByType(cour, modu, sign)
245  : gIndra->GetDetectorByType(cour, modu, CsI_R)->GetChIo();
246 
247  //is it the right detector ?
248  if (detector && detector != pic_det)
249  continue; //read next line
250 
251  //is it the right type of peak ?
252  if (peak_type > 0 && peak_type != typ2)
253  continue;
254 
255  //is it the right signal type ?
256  if (signal_type && signal_type != sign)
257  continue;
258 
259  KVDBPeak* peak = 0;
260  KVDBSystem* sys = 0;
261 
262  switch (typ2) { //what type of peak
263 
264  case kAlpha8MeVSG:
265 
266  peak = new KVDBAlphaPeak(pic_det->GetName());
267  peak->SetGas(kFALSE);
268  peak->SetEnergy(PEAK_THORON_2);
269  break;
270 
271  case kAlpha6MeVSG:
272 
273  peak = new KVDBAlphaPeak(pic_det->GetName());
274  peak->SetGas(kFALSE);
275  peak->SetEnergy(PEAK_THORON_1);
276  break;
277 
278  case kElastic:
279 
280  peak = new KVDBElasticPeak(pic_det->GetName());
281  sys = (KVDBSystem*) GetRun(first)->GetSystem();
282  if (sys) {
283  peak->SetEnergy(sys->GetEbeam() * sys->GetAbeam());
284  ((KVDBElasticPeak*) peak)->SetZproj(sys->GetZbeam());
285  ((KVDBElasticPeak*) peak)->SetAproj(sys->GetAbeam());
286  }
287  break;
288 
289  case kAlpha8MeV:
290 
291  peak = new KVDBAlphaPeak(pic_det->GetName());
292  peak->SetGas(kTRUE);
293  peak->SetEnergy(PEAK_THORON_2);
294  break;
295 
296  case kAlpha6MeV:
297 
298  peak = new KVDBAlphaPeak(pic_det->GetName());
299  peak->SetGas(kTRUE);
300  peak->SetEnergy(PEAK_THORON_1);
301  break;
302 
303  } //what type of peak
304 
305  //test energy of peak if necessary
306  if (peak && peak_energy > 0) {
307  if (typ2 == kElastic) {
308  if (!
309  ((TMath::
310  Abs(peak->GetEnergy() /
311  (((KVDBElasticPeak*) peak)->GetAproj()) -
312  peak_energy))
313  <= 0.1 * (peak->GetEnergy() /
314  ((KVDBElasticPeak*) peak)->GetAproj())))
315  continue; //read next line
316  }
317  else {
318  if (!
319  (TMath::Abs(peak->GetEnergy() - peak_energy) <=
320  0.1 * peak->GetEnergy()))
321  continue;
322  }
323  }
324 
325  if (peak) {
326  peak->SetSigType(KVINDRA::SignalTypes[sign]);
327  peak->SetRing(cour);
328  peak->SetModule(modu);
329  peak->SetParameters({mean, error, sigma, (Double_t) entries,
330  constante, (Double_t) first,
331  (Double_t) last});
332  peak->SetParamName(0, "Mean");
333  peak->SetParamName(1, "Error");
334  peak->SetParamName(2, "Sigma");
335  peak->SetParamName(3, "Peak integral (entries)");
336  peak->SetParamName(4, "Gaussian amplitude");
337  peak->SetParamName(5, "First run");
338  peak->SetParamName(6, "Last run");
339  peak_list->Add(peak);
340 
341  //Set gain associated with peak.
342  //This is the gain of the detector during the first run used to trace the peak.
343  KVDBRun* kvrun = (KVDBRun*) GetRun(first);
344  KVRList* param_list = kvrun->GetLinks("Gains");
345  if (!param_list) {
346  //no gains defined - everybody has gain=1
347  peak->SetGain(1.00);
348  }
349  else {
350  KVDBParameterSet* kvdbps =
351  (KVDBParameterSet*) param_list->
352  FindObjectByName(pic_det->GetName());
353  if (!kvdbps) {
354  //no gain defined for this detector for this run - gain=1
355  peak->SetGain(1.00);
356  }
357  else {
358  peak->SetGain(kvdbps->GetParameter(0));
359  }
360  }
361  } //if (peak)
362 
363  } //parameters correctly read
364 
365  } //Run range found
366 
367  } //while( .good() )
368 
370  return peak_list;
371 }
372 
373 
374 
375 
383 
385 {
386  //Returns kTRUE if calibration peak file is open, connected to
387  //ifstream __ifpeaks (access through GetPeakFileStream()), and ready
388  //for reading.
389  //
390  //The file is opened if not already open.
391  //The stream is repositioned at the beginning of the file if already open.
392 
393  if (GetPeakFileStream().is_open()) {
394  Error("OpenCalibrationPeakFile", "File already open");
395  return kTRUE;
396  }
397  return OpenCalibFile("CalibPeaks", __ifpeaks);
398 }
399 
400 
401 
402 
405 
407 {
408  //Close file containing database of calibration peaks
409  __ifpeaks.close();
410  __ifpeaks.clear();
411 }
412 
413 
414 
418 
420 {
421  // set up TF1 fMeanGDir if function defined for dataset
422  // [dataset].GDir.Freq: [function]
423 
424  TString formula = KVBase::GetDataSetEnv(fDataSet, "GDir.Freq", "");
425  if (formula == "") {
427  return;
428  }
429  fMeanGDir = new TF1("INDRA_MeanGDIR", formula, 1, 10000);
430 }
431 
432 
433 
436 
438 {
439 
440  // Read the file listing any detectors whose gain value changes during exeriment
441 
442  ifstream fin;
443  if (!OpenCalibFile("Gains", fin)) {
444  Error("ReadGainList()", "Could not open file %s",
445  GetCalibFileName("Gains").Data());
446  return;
447  }
448  Info("ReadGainList()", "Reading gains ...");
449 
450  //Add table for gains
451  fGains = AddTable("Gains", "Gains of detectors during runs");
452 
453  TString sline;
454 
455  UInt_t frun = 0, lrun = 0;
456  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
457  UInt_t rr_number = 0;
458  Bool_t prev_rr = kFALSE; // was the last line a run range indication ?
459 
460  Float_t gain;
461 
462  Char_t det_name[80];
463  KVDBParameterSet* parset = 0;
464  TList* par_list = new TList();
465 
466  while (fin.good()) { //reading the file
467  sline.ReadLine(fin);
468  if (fin.eof()) { //fin du fichier
469  LinkListToRunRanges(par_list, rr_number, run_ranges);
470  par_list->Clear();
471  delete par_list;
472  fin.close();
473  return;
474  }
475  if (sline.BeginsWith("Run Range :")) { // Run Range found
476  if (!prev_rr) { // new run ranges set
477  if (par_list->GetSize() > 0)
478  LinkListToRunRanges(par_list, rr_number, run_ranges);
479  par_list->Clear();
480  rr_number = 0;
481  }
482  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
483  Warning("ReadGainList()",
484  "Bad format in line :\n%s\nUnable to read run range values",
485  sline.Data());
486  cout << "sscanf=" << sscanf(sline.Data(), "Run Range : %u %u",
487  &frun, &lrun) << endl;
488  }
489  else {
490  prev_rr = kTRUE;
491  run_ranges[rr_number][0] = frun;
492  run_ranges[rr_number][1] = lrun;
493  rr_number++;
494  if (rr_number == MAX_NUM_RUN_RANGES) {
495  Error("ReadGainList", "Too many run ranges (>%d)",
496  rr_number);
497  rr_number--;
498  }
499  }
500  } //Run Range found
501  else if (sline.Sizeof() > 1 && !sline.BeginsWith("#")) { //non void nor comment line
502  if (sscanf(sline.Data(), "%7s %f", det_name, &gain) != 2) {
503  Warning("ReadGainList()",
504  "Bad format in line :\n%s\nUnable to read",
505  sline.Data());
506  }
507  else { //parameters correctly read
508  parset = new KVDBParameterSet(det_name, "Gains", 1);
509  parset->SetParameter(0, gain);
510  prev_rr = kFALSE;
511  fGains->AddRecord(parset);
512  par_list->Add(parset);
513  } //parameters correctly read
514  } //non void nor comment line
515  } //reading the file
516  delete par_list;
517  fin.close();
518 }
519 
520 
521 
522 
537 
539 {
540  //Read ChIo pressures for different run ranges and enter into database.
541  //Format of file is:
542  //
543  //# some comments
544  //#which start with '#'
545  //Run Range : 6001 6018
546  //ChIos 2_3 50.0
547  //ChIos 4_5 50.0
548  //ChIos 6_7 50.0
549  //ChIos 8_12 30.0
550  //ChIos 13_17 30.0
551  //
552  //Pressures (of C3F8) are given in mbar).
553 
554  ifstream fin;
555  if (!OpenCalibFile("Pressures", fin)) {
556  Error("ReadChIoPressures()", "Could not open file %s",
557  GetCalibFileName("Pressures").Data());
558  return;
559  }
560  Info("ReadChIoPressures()", "Reading ChIo pressures parameters...");
561 
562  TString sline;
563  UInt_t frun = 0, lrun = 0;
564  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
565  UInt_t rr_number = 0;
566  Bool_t prev_rr = kFALSE; //was the previous line a run range indication ?
567  Bool_t read_pressure = kFALSE; // have we read any pressures recently ?
568 
569  KVDBChIoPressures* parset = 0;
570  TList* par_list = new TList();
571 
572  //any ChIo not in list is assumed absent (pressure = 0)
573  Float_t pressure[5] = { 0, 0, 0, 0, 0 };
574 
575  while (fin.good()) { // parcours du fichier
576 
577  sline.ReadLine(fin);
578  if (sline.BeginsWith("Run Range :")) { // run range found
579  if (!prev_rr) { // New set of run ranges to read
580 
581  //have we just finished reading some pressures ?
582  if (read_pressure) {
583  parset = new KVDBChIoPressures(pressure);
584  GetTable("ChIo Pressures")->AddRecord(parset);
585  par_list->Add(parset);
586  LinkListToRunRanges(par_list, rr_number, run_ranges);
587  par_list->Clear();
588  for (int zz = 0; zz < 5; zz++) pressure[zz] = 0.;
589  read_pressure = kFALSE;
590  }
591  rr_number = 0;
592 
593  }
594  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
595  Warning("ReadChIoPressures()",
596  "Bad format in line :\n%s\nUnable to read run range values",
597  sline.Data());
598  }
599  else {
600  prev_rr = kTRUE;
601  run_ranges[rr_number][0] = frun;
602  run_ranges[rr_number][1] = lrun;
603  rr_number++;
604  if (rr_number == MAX_NUM_RUN_RANGES) {
605  Error("ReadChIoPressures", "Too many run ranges (>%d)",
606  rr_number);
607  rr_number--;
608  }
609  }
610  } // Run Range found
611  if (fin.eof()) { //fin du fichier
612  //have we just finished reading some pressures ?
613  if (read_pressure) {
614  parset = new KVDBChIoPressures(pressure);
615  GetTable("ChIo Pressures")->AddRecord(parset);
616  par_list->Add(parset);
617  LinkListToRunRanges(par_list, rr_number, run_ranges);
618  par_list->Clear();
619  for (int zz = 0; zz < 5; zz++) pressure[zz] = 0.;
620  read_pressure = kFALSE;
621  }
622  }
623  if (sline.BeginsWith("ChIos")) { //line with chio pressure data
624 
625  prev_rr = kFALSE;
626 
627  //take off 'ChIos' and any leading whitespace
628  sline.Remove(0, 5);
629  sline.Strip(TString::kLeading);
630  //split up ChIo ring numbers and pressure
631  TObjArray* toks = sline.Tokenize(' ');
632  TString chio = ((TObjString*)(*toks)[0])->String();
633  KVString press = ((TObjString*)(*toks)[1])->String();
634  delete toks;
635 
636  read_pressure = kTRUE;
637 
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;
644 
645  } //line with ChIo pressure data
646  } //parcours du fichier
647  delete par_list;
648  fin.close();
649 }
650 
651 
652 
653 
657 
659  Double_t Coul_par_top) const
660 {
661  //Returns calculated cross-section [mb] per event for the run in question.
662  //See KVINDRADBRun::GetEventCrossSection()
663  if (!GetRun(run))
664  return 0;
665  return GetRun(run)->GetEventCrossSection(Q_apres_cible, Coul_par_top);
666 }
667 
668 
669 
670 
674 
676  Double_t Coul_par_top) const
677 {
678  //Returns calculated total measured cross-section [mb] for the run in question.
679  //See KVINDRADBRun::GetTotalCrossSection()
680  if (!GetRun(run))
681  return 0;
682  return GetRun(run)->GetTotalCrossSection(Q_apres_cible, Coul_par_top);
683 }
684 
685 
686 
687 
693 
695  Double_t Q_apres_cible,
696  Double_t Coul_par_top) const
697 {
698  // Returns calculated average cross-section [mb] per event for the runs in question.
699  // It is assumed that all runs correspond to the same reaction,
700  // with the same beam & target characteristics and multiplicity trigger.
701  // The target thickness etc. are taken from the first run.
702 
703  KVTarget* targ = GetRun(run1)->GetTarget();
704  if (!targ) {
705  Error("GetEventCrossSection", "No target for run %d", run1);
706  return 0;
707  }
708  Double_t sum_xsec = 0;
709  for (int run = run1; run <= run2; run++) {
710 
711  if (!GetRun(run))
712  continue; //skip non-existent runs
713  sum_xsec +=
714  GetRun(run)->GetNIncidentIons(Q_apres_cible,
715  Coul_par_top) * (1. - GetRun(run)->GetTempsMort());
716  }
717  //average X-section [mb] per event = 1e27 / (no. atoms in target * SUM(no. of projectile nuclei * (1 - TM)) )
718  return (1.e27 / (targ->GetAtomsPerCM2() * sum_xsec));
719 }
720 
721 
722 
723 
728 
730  Double_t Q_apres_cible,
731  Double_t Coul_par_top) const
732 {
733  //Returns calculated total measured cross-section [mb] for the runs in question.
734  //This is SUM (GetEventCrossSection(run1,run2) * SUM( events )
735  //where SUM(events) is the total number of events measured in all the runs
736  Int_t sum = 0;
737  for (int run = run1; run <= run2; run++) {
738 
739  if (!GetRun(run))
740  continue; //skip non-existent runs
741  sum += GetRun(run)->GetEvents();
742 
743  }
744  return sum * GetEventCrossSection(run1, run2, Q_apres_cible,
745  Coul_par_top);
746 }
747 
748 
749 
750 
751 
756 
758  Int_t mult_trig,
759  Double_t Q_apres_cible,
760  Double_t Coul_par_top) const
761 {
762  //Returns calculated average cross-section [mb] per event for all runs of the named system* with trigger multiplicity 'mul_trig'.
763  // *to see the list of all system names, use gIndraDB->GetSystems()->ls()
764  //See KVINDRADBRun::GetNIncidentIons() for meaning of other arguments
765 
766  KVDBSystem* system = GetSystem(system_name);
767  if (!system) {
768  Error("GetEventCrossSection",
769  "System %s unknown. Check list of systems (gIndraDB->GetSystems()->ls()).",
770  system_name);
771  return 0.;
772  }
773  KVTarget* targ = system->GetTarget();
774  if (!targ) {
775  Error("GetEventCrossSection", "No target defined for system %s",
776  system_name);
777  return 0;
778  }
779  //loop over all runs of system, only using those with correct trigger multiplicity
780  Double_t sum_xsec = 0;
781  for(auto _run : system->GetRuns())
782  {
783  auto run = dynamic_cast<KVINDRADBRun*>(_run);
784  if (run->GetTrigger() != mult_trig)
785  continue; //skip runs with bad trigger
786  sum_xsec +=
787  run->GetNIncidentIons(Q_apres_cible,
788  Coul_par_top) * (1. - run->GetTempsMort());
789 
790  }
791  //average X-section [mb] per event = 1e27 / (no. atoms in target * SUM(no. of projectile nuclei * (1 - temps mort)))
792  return (1.e27 / (targ->GetAtomsPerCM2() * sum_xsec));
793 }
794 
795 
796 
797 
802 
804  Int_t mult_trig,
805  Double_t Q_apres_cible,
806  Double_t Coul_par_top) const
807 {
808  //Returns calculated total cross-section [mb] for all events in all runs of the named system* with trigger multiplicity 'mul_trig'.
809  // *to see the list of all system names, use gIndraDB->GetSystems()->ls()
810  //See KVINDRADBRun::GetNIncidentIons() for meaning of other arguments
811 
812  KVDBSystem* system = GetSystem(system_name);
813  if (!system) {
814  Error("GetTotalCrossSection",
815  "System %s unknown. Check list of systems (gIndraDB->GetSystems()->ls()).",
816  system_name);
817  return 0.;
818  }
819  Int_t sum = 0;
820  //loop over all runs of system, only using those with correct trigger multiplicity
821  for(auto _run : system->GetRuns())
822  {
823  auto run = dynamic_cast<KVINDRADBRun*>(_run);
824 
825  if (run->GetTrigger() != mult_trig)
826  continue; //skip runs with bad trigger
827  sum += run->GetEvents();
828  }
829 
830  return sum * GetEventCrossSection(system_name, mult_trig, Q_apres_cible,
831  Coul_par_top);
832 }
833 
834 
835 
836 
841 
842 Double_t KVINDRADB::GetTotalCrossSection(TH1* events_histo, Double_t Q_apres_cible, Double_t Coul_par_top)
843 {
844  // Calculate the cross-section [mb] for a given selection of events in several runs,
845  // given by the TH1, which is a distribution of run numbers (i.e. a histogram filled with
846  // the number of selected events for each run, the run number is on the x-axis of the histogram).
847 
848  Info("GetTotalCrossSection", "Calculating cross-section for q=%f", Q_apres_cible);
849  Double_t xsec = 0, ninc = 0;
850  KVTarget* targ = 0;
851  for (int i = 1; i <= events_histo->GetNbinsX(); i++) {
852  Double_t events = events_histo->GetBinContent(i);
853  if (events == 0) continue;
854  int run_num = events_histo->GetBinCenter(i);
855  KVINDRADBRun* run = GetRun(run_num);
856  if (!targ) targ = run->GetTarget();
857  ninc +=
858  run->GetNIncidentIons(Q_apres_cible,
859  Coul_par_top);
860  xsec += events / (1. - run->GetTempsMort());
861  cout << "Run#" << run_num << " Events : " << events
862  << " Dead time : " << run->GetTempsMort() << endl;
863  }
864  return (1.e27 / (ninc * targ->GetAtomsPerCM2())) * xsec;
865 }
866 
867 
868 
872 
874 {
875  // Return mean frequency of Gene_Direct for run
876  // If not defined for dataset, returns 0
877 
878  if (!fMeanGDir) {
880  if (!fMeanGDir) return 0;
881  }
882  return fMeanGDir->Eval(run);
883 }
884 
885 
886 
887 
891 
892 void KVINDRADB::Build(bool minimal)
893 {
894 
895  //Use KVINDRARunListReader utility subclass to read complete runlist
896 
897  //get full path to runlist file, using environment variables for the current dataset
898  TString runlist_fullpath;
899  KVBase::SearchKVFile(GetDBEnv("Runlist"), runlist_fullpath, fDataSet.Data());
900 
901  //set comment character for current dataset runlist
902  SetRLCommentChar(GetDBEnv("Runlist.Comment")[0]);
903 
904  //set field separator character for current dataset runlist
905  if (!strcmp(GetDBEnv("Runlist.Separator"), "<TAB>"))
906  SetRLSeparatorChar('\t');
907  else
908  SetRLSeparatorChar(GetDBEnv("Runlist.Separator")[0]);
909 
910  //by default we set two keys for both recognising the 'header' lines and deciding
911  //if we have a good run line: the "Run" and "Events" fields must be present
912  GetLineReader()->SetFieldKeys(GetDBEnv("Runlist.Run"), GetDBEnv("Runlist.Events"));
913  GetLineReader()->SetRunKeys(GetDBEnv("Runlist.Run"), GetDBEnv("Runlist.Events"));
914 
915  ReadRunList(runlist_fullpath.Data());
916  //new style runlist
917  if (IsNewRunList()) {
918  ReadNewRunList();
919  };
920 
921  ReadSystemList();
922 
923  if(minimal)
924  return;
925 
927  ReadGainList();
928  ReadChannelVolt();
930  ReadCalibCsI();
935 
936  // read all available mean pulser data and store in tree
937 // if (!fPulserData) fPulserData = new KVINDRAPulserDataTree;
938 // fPulserData->SetRunList(GetRuns());
939 // fPulserData->Build();
940 
942 }
943 
944 
945 
946 
949 
951 {
952  //Read new-style runlist (written using KVDBRun v.10 or later)
953 
954  ifstream fin;
955  if (!OpenCalibFile("Runlist", fin)) {
956  Error("ReadNewRunList()", "Could not open file %s",
957  GetCalibFileName("Runlist").Data());
958  return;
959  }
960 
961  Info("ReadNewRunList()", "Reading run parameters ...");
962 
963  KVString line;
964  KVINDRADBRun* run;
965 
966  while (fin.good() && !fin.eof()) {
967  line.ReadLine(fin);
968 
969  if (line.Length() > 1 && !line.BeginsWith("#") && !line.BeginsWith("Version")) {
970  run = new KVINDRADBRun;
971  run->ReadRunListLine(line);
972  if (run->GetNumber() < 1) {
973  delete run;
974  }
975  else {
976  AddRun(run);
977  }
978  }
979  }
980  fin.close();
981 }
982 
983 
984 
991 
993 {
994  //For each "good run line" in the run list file, we:
995  // add a KVINDRADBRun to the database if it doesn't already exist
996  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
997  // set properties of run and tape objects
998  //kFirstRun & kLastRun are set
999 
1000  KVRunListLine* csv_line = GetLineReader();
1001 
1002  //run number
1003  Int_t run_n = csv_line->GetIntField(GetDBEnv("Runlist.Run"));
1004 
1005  if (!run_n) {
1006  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
1007  endl;
1008  GetLineReader()->Print();
1009  return;
1010  }
1011 
1012  /*********************************************
1013  IF LINE HAS A TAPE NUMBER WE
1014  LOOK FOR THE TAPE IN THE DATA
1015  BASE. IF IT DOESN'T EXIST WE
1016  CREATE IT.
1017  *********************************************/
1018  KVDBTape* tape = 0;
1019  //tape number (if tape field is filled)
1020  if (csv_line->HasFieldValue(GetDBEnv("Runlist.Tape"))) {
1021  Int_t tape_n = csv_line->GetIntField(GetDBEnv("Runlist.Tape"));
1022  //already exists ?
1023  tape = GetTape(tape_n);
1024  if (!tape) {
1025  tape = new KVDBTape(tape_n);
1026  AddTape(tape);
1027  }
1028  }
1029 
1030  /*********************************************
1031  WE CREATE A NEW RUN AND ADD
1032  IT TO THE DATABASE. WE SET ALL
1033  AVAILABLE INFORMATIONS ON
1034  RUN FROM THE FILE. ERROR IF
1035  DBASE RUN ALREADY EXISTS =>
1036  SAME RUN APPEARS TWICE
1037  *********************************************/
1038  KVINDRADBRun* run = GetRun(run_n);
1039  if (!run) {
1040 
1041  run = new KVINDRADBRun(run_n);
1042  AddRun(run);
1043 
1044  //add run to tape ?
1045  if (tape)
1046  tape->AddRun(run);
1047 
1048  TString key = GetDBEnv("Runlist.Buffers");
1049  if (csv_line->HasFieldValue(key.Data()))
1050  run->SetScaler("Buffers", csv_line->GetIntField(key.Data()));
1051  key = GetDBEnv("Runlist.Events");
1052  if (csv_line->HasFieldValue(key.Data()))
1053  run->SetEvents(csv_line->GetIntField(key.Data()));
1054  key = GetDBEnv("Runlist.Far1");
1055  if (csv_line->HasFieldValue(key.Data()))
1056  run->SetScaler("Faraday 1", csv_line->GetIntField(key.Data()));
1057  key = GetDBEnv("Runlist.Far2");
1058  if (csv_line->HasFieldValue(key.Data()))
1059  run->SetScaler("Faraday 2", csv_line->GetIntField(key.Data()));
1060  key = GetDBEnv("Runlist.Time");
1061  if (csv_line->HasFieldValue(key.Data()))
1062  run->SetTime(csv_line->GetFloatField(key.Data()));
1063  key = GetDBEnv("Runlist.Size");
1064  if (csv_line->HasFieldValue(key.Data()))
1065  run->SetSize(csv_line->GetFloatField(key.Data()));
1066  key = GetDBEnv("Runlist.GDir");
1067  if (csv_line->HasFieldValue(key.Data()))
1068  run->SetScaler("Gene DIRECT", csv_line->GetIntField(key.Data()));
1069  key = GetDBEnv("Runlist.GLas");
1070  if (csv_line->HasFieldValue(key.Data()))
1071  run->SetScaler("Gene LASER", csv_line->GetIntField(key.Data()));
1072  key = GetDBEnv("Runlist.GElec");
1073  if (csv_line->HasFieldValue(key.Data()))
1074  run->SetScaler("Gene ELECT", csv_line->GetIntField(key.Data()));
1075  key = GetDBEnv("Runlist.GTest");
1076  if (csv_line->HasFieldValue(key.Data()))
1077  run->SetScaler("Gene TEST", csv_line->GetIntField(key.Data()));
1078  key = GetDBEnv("Runlist.GMarq");
1079  if (csv_line->HasFieldValue(key.Data()))
1080  run->SetScaler("Gene MARQ", csv_line->GetIntField(key.Data()));
1081  key = GetDBEnv("Runlist.GTM");
1082  if (csv_line->HasFieldValue(key.Data()))
1083  run->SetScaler("Gene TM", csv_line->GetIntField(key.Data()));
1084  key = GetDBEnv("Runlist.DEC");
1085  if (csv_line->HasFieldValue(key.Data()))
1086  run->SetScaler("DEC", csv_line->GetIntField(key.Data()));
1087  key = GetDBEnv("Runlist.FC");
1088  if (csv_line->HasFieldValue(key.Data()))
1089  run->SetScaler("FC", csv_line->GetIntField(key.Data()));
1090  key = GetDBEnv("Runlist.OK");
1091  if (csv_line->HasFieldValue(key.Data()))
1092  run->SetScaler("OK", csv_line->GetIntField(key.Data()));
1093  key = GetDBEnv("Runlist.FT");
1094  if (csv_line->HasFieldValue(key.Data()))
1095  run->SetScaler("FT", csv_line->GetIntField(key.Data()));
1096  key = GetDBEnv("Runlist.AVL");
1097  if (csv_line->HasFieldValue(key.Data()))
1098  run->SetScaler("AVL", csv_line->GetIntField(key.Data()));
1099  key = GetDBEnv("Runlist.OCD");
1100  if (csv_line->HasFieldValue(key.Data()))
1101  run->SetScaler("OCD", csv_line->GetIntField(key.Data()));
1102  key = GetDBEnv("Runlist.OA");
1103  if (csv_line->HasFieldValue(key.Data()))
1104  run->SetScaler("OA", csv_line->GetIntField(key.Data()));
1105  key = GetDBEnv("Runlist.RAZ");
1106  if (csv_line->HasFieldValue(key.Data()))
1107  run->SetScaler("RAZ", csv_line->GetIntField(key.Data()));
1108  key = GetDBEnv("Runlist.PlastAll");
1109  if (csv_line->HasFieldValue(key.Data()))
1110  run->SetScaler("Plast All", csv_line->GetIntField(key.Data()));
1111  key = GetDBEnv("Runlist.PlastG");
1112  if (csv_line->HasFieldValue(key.Data()))
1113  run->SetScaler("Plast G", csv_line->GetIntField(key.Data()));
1114  key = GetDBEnv("Runlist.PlastC");
1115  if (csv_line->HasFieldValue(key.Data()))
1116  run->SetScaler("Plast C", csv_line->GetIntField(key.Data()));
1117  key = GetDBEnv("Runlist.PlastD");
1118  if (csv_line->HasFieldValue(key.Data()))
1119  run->SetScaler("Plast D", csv_line->GetIntField(key.Data()));
1120  key = GetDBEnv("Runlist.TMpc");
1121  if (csv_line->HasFieldValue(key.Data()))
1122  run->SetTMpercent(csv_line->GetFloatField(key.Data()));
1123  key = GetDBEnv("Runlist.Trigger");
1124  if (csv_line->HasField(key.Data()))
1125  run->SetTrigger(GetRunListTrigger(key.Data(), "M>=%d"));
1126  key = GetDBEnv("Runlist.Start");
1127  if (csv_line->HasField(key.Data()))
1128  run->SetStartDate(csv_line->GetField(key.Data()));
1129  key = GetDBEnv("Runlist.End");
1130  if (csv_line->HasField(key.Data()))
1131  run->SetEndDate(csv_line->GetField(key.Data()));
1132  key = GetDBEnv("Runlist.Comments");
1133  if (csv_line->HasField(key.Data()))
1134  run->SetComments(csv_line->GetField(key.Data()));
1135  key = GetDBEnv("Runlist.Log");
1136  if (csv_line->HasField(key.Data()))
1137  run->SetLogbook(csv_line->GetField(key.Data()));
1138 
1139  }
1140  else {
1141  Error("GoodRunLine", "Run %d already exists", run_n);
1142  }
1143 }
1144 
1145 
1146 
1147 
1150 
1152 {
1153  // Write associated objects (i.e. KVINDRAPulserDataTree's TTree) in file
1155 }
1156 
1157 
1158 
1159 
1162 
1164 {
1165  // Read associated objects (i.e. KVINDRAPulserDataTree's TTree) from file
1168 }
1169 
1170 
1171 
1176 
1178 {
1179  // Using the mean frequency of the Selecteur internal clock (Gene DIRECT)
1180  // and the total measured number of ticks for the run,
1181  // calculate the length of the run in seconds
1182 
1183  Double_t g_dir_frq = GetMeanGDirFreq(run);
1184  if (g_dir_frq == 0) {
1185  Error("GetRunLengthFromGeneDirect", "Mean frequency of G_DIR unknown for this dataset");
1186  return 0;
1187  }
1188  KVINDRADBRun* dbr = GetRun(run);
1189  if (!dbr) {
1190  Error("GetRunLengthFromGeneDirect", "Run %d not in database", run);
1191  return 0;
1192  }
1193  Double_t g_dir = dbr->GetScaler("Gene DIRECT");
1194  if (g_dir == 0) {
1195  Error("GetRunLengthFromGeneDirect", "Gene DIRECT total not known for run");
1196  return 0;
1197  }
1198  return g_dir / g_dir_frq;
1199 }
1200 
1201 
1202 
1203 
1233 
1235 {
1236  // Read in gain corrections for CsI total light output.
1237  // Looks for directory
1238  // $KVROOT/KVFiles/[dataset name]/[lumcorrdir]
1239  // where [lumcorrdir] is defined in .kvrootrc by one of the two variables
1240  // INDRADB.CsILumCorr: [lumcorrdir]
1241  // [dataset name].INDRADB.CsILumCorr: [lumcorrdir]
1242  // the latter value takes precedence for a given dataset over the former, generic, value.
1243  //
1244  // If the directory is not found we look for a compressed archive file
1245  // $KVROOT/KVFiles/[dataset name]/[lumcorrdir].tgz
1246  //
1247  // The files in the directory containing the corrections for each run have
1248  // names with the format given by
1249  // INDRADB.CsILumCorr.FileName: [format]
1250  // [dataset name].INDRADB.CsILumCorr.FileName: [format]
1251  // the latter value takes precedence for a given dataset over the former, generic, value.
1252  // The [format] should include a placeholder for the run number, e.g.
1253  // INDRADB.CsILumCorr.FileName: run%04d.cor
1254  // INDRADB.CsILumCorr.FileName: Run%d.corrLum
1255  // etc. etc.
1256  //
1257  // The contents of each file should be in the following format:
1258  // CSI_0221_R 1.00669
1259  // CSI_0321_R 1.01828
1260  // CSI_0322_R 1.00977
1261  // i.e.
1262  // name_of_detector correction
1263  //Any other lines are ignored.
1264 
1265  Info("ReadCsITotalLightGainCorrections",
1266  "Reading corrections...");
1267 
1268  // get name of directory for this dataset from .kvrootrc
1269  TString search;
1270  search = GetDBEnv("CsILumCorr");
1271  if (search == "") {
1272  Error("ReadCsITotalLightGainCorrections", "INDRADB.CsILumCorr is not defined. Check .kvrootrc files.");
1273  }
1274 
1275  KVTarArchive gain_cor(search.Data(), GetDataSetDir());
1276  if (!gain_cor.IsOK()) {
1277  Info("ReadCsITotalLightGainCorrections", "No corrections found");
1278  return;
1279  }
1280 
1281  TString filefmt;
1282  filefmt = GetDBEnv("CsILumCorr.FileName");
1283  if (filefmt == "") {
1284  Error("ReadCsITotalLightGainCorrections", "INDRADB.CsILumCorr.FileName is not defined. Check .kvrootrc files.");
1285  }
1286 
1287  // boucle sur tous les runs
1288  TIter next_run(GetRuns());
1289  KVINDRADBRun* run = 0;
1290  while ((run = (KVINDRADBRun*)next_run())) {
1291 
1292  Int_t run_num = run->GetNumber();
1293  TString filepath;
1294  filepath.Form(filefmt.Data(), run_num);
1295  filepath.Prepend("/");
1296  filepath.Prepend(search.Data());
1297  ifstream filereader;
1298  if (KVBase::SearchAndOpenKVFile(filepath, filereader, fDataSet.Data())) {
1299 
1300  KVString line;
1301  line.ReadLine(filereader);
1302  while (filereader.good()) {
1303 
1304  line.Begin(" ");
1305  if (line.End()) {
1306  line.ReadLine(filereader);
1307  continue;
1308  }
1309  KVString det_name = line.Next(kTRUE);
1310  if (!det_name.BeginsWith("CSI_")) {
1311  line.ReadLine(filereader);
1312  continue;
1313  }
1314  if (line.End()) {
1315  line.ReadLine(filereader);
1316  continue;
1317  }
1318  Double_t correction = line.Next(kTRUE).Atof();
1319 
1320  KVDBParameterSet* cps = new KVDBParameterSet(det_name.Data(),
1321  "CsI Total Light Gain Correction", 1);
1322 
1323  cps->SetParameter(0,correction);
1324  fCsILumCorr->AddRecord(cps);
1325  cps->AddLink("Runs", run);
1326  line.ReadLine(filereader);
1327  }
1328  filereader.close();
1329  }
1330  else {
1331  Warning("ReadCsITotalLightGainCorrections", "Run %d: no correction", run_num);
1332  }
1333 
1334  }
1335 
1336 }
1337 
1338 
1339 
1345 
1347 {
1348  //Read Channel-Volt calibrations for ChIo and Si detectors (including Etalons).
1349  //The parameter filenames are taken from the environment variables
1350  // [dataset name].INDRADB.ElectronicCalibration: [chio & si detectors]
1351  // [dataset name].INDRADB.ElectronicCalibration.Etalons: [etalons]
1352 
1353  ifstream fin;
1354  if (!OpenCalibFile("ElectronicCalibration", fin)) {
1355  Error("ReadChannelVolt()", "Could not open file %s",
1356  GetCalibFileName("ElectronicCalibration").Data());
1357  return;
1358  }
1359  Info("ReadChannelVolt()",
1360  "Reading electronic calibration for ChIo and Si...");
1361 
1362  TString sline;
1363 
1364  UInt_t frun = 0, lrun = 0;
1365  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
1366  UInt_t rr_number = 0;
1367  Bool_t prev_rr = kFALSE; // was the last line a run range indication ?
1368 
1369  UInt_t cour, modu, sign;
1370  Float_t a0, a1, a2, dum1, dum2;
1371 
1372  Char_t det_name[80];
1373  Char_t cal_type[80];
1374  KVDBParameterSet* parset;
1375  TList* par_list = new TList();
1376 
1377 
1378  while (fin.good()) { //reading the file
1379  sline.ReadLine(fin);
1380  if (fin.eof()) { //fin du fichier
1381  LinkListToRunRanges(par_list, rr_number, run_ranges);
1382  par_list->Clear();
1383  break;
1384  }
1385  if (sline.BeginsWith("Run Range :")) { // Run Range found
1386  if (!prev_rr) { // new run ranges set
1387  if (par_list->GetSize() > 0)
1388  LinkListToRunRanges(par_list, rr_number, run_ranges);
1389  par_list->Clear();
1390  rr_number = 0;
1391  }
1392  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
1393  Warning("ReadChannelVolt()",
1394  "Bad format in line :\n%s\nUnable to read run range values",
1395  sline.Data());
1396  }
1397  else {
1398  prev_rr = kTRUE;
1399  run_ranges[rr_number][0] = frun;
1400  run_ranges[rr_number][1] = lrun;
1401  rr_number++;
1402  if (rr_number == MAX_NUM_RUN_RANGES) {
1403  Error("ReadChannelVolt", "Too many run ranges (>%d)",
1404  rr_number);
1405  rr_number--;
1406  }
1407  }
1408  } //Run Range foundTObjString
1409  else if (sline.Sizeof() > 1 && !sline.BeginsWith("#")) { //non void nor comment line
1410  if (sscanf(sline.Data(), "%u %u %u %f %f %f %f %f",
1411  &cour, &modu, &sign, &a0, &a1, &a2, &dum1,
1412  &dum2) != 8) {
1413  Warning("ReadChannelVolt()",
1414  "Bad format in line :\n%s\nUnable to read",
1415  sline.Data());
1416  }
1417  else { //parameters correctly read
1418  // naming detector
1419  switch (sign) {
1420  case ChIo_GG:
1421  sprintf(det_name, "CI_%02u%02u_GG", cour, modu);
1422  strcpy(cal_type, "Channel-Volt GG");
1423  break;
1424  case ChIo_PG:
1425  sprintf(det_name, "CI_%02u%02u_PG", cour, modu);
1426  strcpy(cal_type, "Channel-Volt PG");
1427  break;
1428  case Si_GG:
1429  sprintf(det_name, "SI_%02u%02u_GG", cour, modu);
1430  strcpy(cal_type, "Channel-Volt GG");
1431  break;
1432  case Si_PG:
1433  sprintf(det_name, "SI_%02u%02u_PG", cour, modu);
1434  strcpy(cal_type, "Channel-Volt PG");
1435  break;
1436  }
1437  parset = new KVDBParameterSet(det_name, cal_type, 5);
1438  parset->SetParameters({a0, a1, a2, dum1, dum2});
1439  prev_rr = kFALSE;
1440  fChanVolt->AddRecord(parset);
1441  par_list->Add(parset);
1442  } //parameters correctly read
1443  } //non void nor comment line
1444  } //reading the file
1445  delete par_list;
1446  fin.close();
1447 
1448  /********** ETALONS ***************/
1449 
1450  ifstream fin2;
1451  if (!OpenCalibFile("ElectronicCalibration.Etalons", fin2)) {
1452  Error("ReadChannelVolt()", "Could not open file %s",
1453  GetCalibFileName("ElectronicCalibration.Etalons").Data());
1454  return;
1455  }
1456  Info("ReadChannelVolt()",
1457  "Reading electronic calibration for Si75 and SiLi...");
1458  frun = lrun = 0;
1459  rr_number = 0;
1460  prev_rr = kFALSE; // was the last line a run range indication ?
1461  par_list = new TList;
1462  TObjArray* toks = 0;
1463  while (fin2.good()) { //reading the file
1464  sline.ReadLine(fin2);
1465  if (fin2.eof()) { //fin du fichier
1466  LinkListToRunRanges(par_list, rr_number, run_ranges);
1467  par_list->Clear();
1468  delete par_list;
1469  fin2.close();
1470  return;
1471  }
1472  if (sline.BeginsWith("Run Range :")) { // Run Range found
1473  if (!prev_rr) { // new run ranges set
1474  if (par_list->GetSize() > 0)
1475  LinkListToRunRanges(par_list, rr_number, run_ranges);
1476  par_list->Clear();
1477  rr_number = 0;
1478  }
1479  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
1480  Warning("ReadChannelVolt()",
1481  "Bad format in line :\n%s\nUnable to read run range values",
1482  sline.Data());
1483  }
1484  else {
1485  prev_rr = kTRUE;
1486  run_ranges[rr_number][0] = frun;
1487  run_ranges[rr_number][1] = lrun;
1488  rr_number++;
1489  if (rr_number == MAX_NUM_RUN_RANGES) {
1490  Error("ReadChannelVolt", "Too many run ranges (>%d)",
1491  rr_number);
1492  rr_number--;
1493  }
1494  }
1495  } //Run Range found
1496  else if (sline.Sizeof() > 1 && !sline.BeginsWith("#")) { //non void nor comment line
1497  if (sscanf(sline.Data(), "%s %f %f %f",
1498  det_name, &a0, &a1, &a2) != 4) {
1499  Warning("ReadChannelVolt()",
1500  "Bad format in line :\n%s\nUnable to read",
1501  sline.Data());
1502  }
1503  else { //parameters correctly read
1504  KVString gain;
1505  gain.Form("%s", det_name);
1506  toks = gain.Tokenize("_");
1507  KVString scal_type;
1508  scal_type.Form("Channel-Volt %s", ((TObjString*)toks->At(2))->GetString().Data());
1509  delete toks;
1510  parset = new KVDBParameterSet(det_name, scal_type.Data(), 3);
1511  parset->SetParameters({a0, a1, a2});
1512  prev_rr = kFALSE;
1513  fChanVolt->AddRecord(parset);
1514  par_list->Add(parset);
1515  } //parameters correctly read
1516  } //non void nor comment line
1517  } //reading the file
1518  delete par_list;
1519 }
1520 
1521 
1522 
1523 
1528 
1530 {
1531  //Read Volt-Energy(MeV) calibrations for ChIo and Si detectors.
1532  //The parameter filename is taken from the environment variable
1533  // [dataset name].INDRADB.ChIoSiVoltMeVCalib:
1534 
1535  ifstream fin;
1536  if (!OpenCalibFile("ChIoSiVoltMeVCalib", fin)) {
1537  Error("ReadVoltEnergyChIoSi()", "Could not open file %s",
1538  GetCalibFileName("ChIoSiVoltMevCalib").Data());
1539  return;
1540  }
1541  Info("ReadVoltEnergyChIoSi()",
1542  "Reading ChIo/Si calibration parameters...");
1543 
1544  TString sline;
1545 
1546  UInt_t frun = 0, lrun = 0;
1547  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
1548  UInt_t rr_number = 0;
1549  Bool_t prev_rr = kFALSE; // was the last line a run range indication ?
1550 
1551  Char_t det_name[80];
1552  KVDBParameterSet* parset;
1553  TList* par_list = new TList();
1554 
1555  Float_t a0, a1, chi; // calibration parameters
1556 
1557  while (fin.good()) { //reading the file
1558  sline.ReadLine(fin);
1559  if (fin.eof()) { //fin du fichier
1560  LinkListToRunRanges(par_list, rr_number, run_ranges);
1561  par_list->Clear();
1562  delete par_list;
1563  fin.close();
1564  return;
1565  }
1566  if (sline.BeginsWith("Run Range :")) { // Run Range found
1567  if (!prev_rr) { // new run ranges set
1568  if (par_list->GetSize() > 0)
1569  LinkListToRunRanges(par_list, rr_number, run_ranges);
1570  par_list->Clear();
1571  rr_number = 0;
1572  }
1573  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
1574  Warning("ReadVoltEnergyAlpha()",
1575  "Bad format in line :\n%s\nUnable to read run range values",
1576  sline.Data());
1577  }
1578  else {
1579  prev_rr = kTRUE;
1580  run_ranges[rr_number][0] = frun;
1581  run_ranges[rr_number][1] = lrun;
1582  rr_number++;
1583  if (rr_number == MAX_NUM_RUN_RANGES) {
1584  Error("ReadVoltEnergyAlpha", "Too many run ranges (>%d)",
1585  rr_number);
1586  rr_number--;
1587  }
1588  }
1589  } //Run Range found
1590  if (sline.BeginsWith("SI") || sline.BeginsWith("CI")) { //data line
1591  if (sscanf(sline.Data(), "%7s %f %f %f", det_name, &a0, &a1, &chi)
1592  != 4) {
1593  Warning("ReadVoltEnergyAlpha()",
1594  "Bad format in line :\n%s\nUnable to read parameters",
1595  sline.Data());
1596  }
1597  else { //parameters correctly read
1598  parset = new KVDBParameterSet(det_name, "Volt-Energy", 3);
1599  parset->SetParameters({a0, a1, chi});
1600  prev_rr = kFALSE;
1601  fVoltMeVChIoSi->AddRecord(parset);
1602  par_list->Add(parset);
1603  } //parameters correctly read
1604  } //data line
1605  } //reading the file
1606  delete par_list;
1607  fin.close();
1608 }
1609 
1610 
1611 
1612 
1617 
1619 {
1620  //Read the names of pedestal files to use for each run range, found
1621  //in file with name defined by the environment variable:
1622  // [dataset name].INDRADB.Pedestals: ...
1623 
1624  ifstream fin;
1625  if (!OpenCalibFile("Pedestals", fin)) {
1626  Error("ReadPedestalList()", "Could not open file %s",
1627  GetCalibFileName("Pedestals").Data());
1628  return;
1629  }
1630  Info("ReadPedestalList()", "Reading pedestal file list...");
1631 
1632  KVString line;
1633  Char_t filename_chio[80], filename_csi[80];
1634  UInt_t runlist[1][2];
1635 
1636  while (fin.good()) { //lecture du fichier
1637 
1638  // lecture des informations
1639  line.ReadLine(fin);
1640 
1641  //recherche une balise '+'
1642  if (line.BeginsWith('+')) { //balise trouvee
1643 
1644  line.Remove(0, 1);
1645 
1646  if (sscanf
1647  (line.Data(), "Run Range : %u %u", &runlist[0][0],
1648  &runlist[0][1]) != 2) {
1649  Warning("ReadPedestalList()", "Format problem in line \n%s",
1650  line.Data());
1651  }
1652 
1653  line.ReadLine(fin);
1654 
1655  sscanf(line.Data(), "%s", filename_chio);
1656 
1657  line.ReadLine(fin);
1658 
1659  sscanf(line.Data(), "%s", filename_csi);
1660 
1661  TList RRList;
1662  KVDBRecord* dummy = 0;
1663  dummy =
1664  new KVDBRecord(filename_chio, "ChIo/Si/Etalons pedestals");
1665  dummy->AddKey("Runs", "Runs for which to use this pedestal file");
1666  fPedestals->AddRecord(dummy);
1667  RRList.Add(dummy);
1668  dummy = new KVDBRecord(filename_csi, "CsI pedestals");
1669  dummy->AddKey("Runs", "Runs for which to use this pedestal file");
1670  fPedestals->AddRecord(dummy);
1671  RRList.Add(dummy);
1672  LinkListToRunRanges(&RRList, 1, runlist);
1673  } // balise trouvee
1674  } // lecture du fichier
1675  fin.close();
1676  cout << "Pedestals Read" << endl;
1677 }
1678 
1679 
1680 
1681 
1688 
1690 {
1691  //Read CsI Light-Energy calibrations for Z=1 and Z>1
1692  //The parameter filenames are taken from the environment variables
1693  // [dataset name].INDRADB.CalibCsI.Z=1
1694  // [dataset name].INDRADB.CalibCsI.Z>1
1695  //These calibrations are valid for all runs
1698 }
1699 
1700 
1701 
1706 
1708 {
1709  //Read CsI Light-Energy calibrations for Z=1 (zrange="Z=1") or Z>1 (zrange="Z>1")
1710  //and add them to the KVDBTable whose pointer is given as 2nd argument.
1711  //These calibrations are valid for all runs
1712 
1713  ifstream fin;
1714  TString filename;
1715  filename.Form("CalibCsI.%s", zrange);
1716  if (!OpenCalibFile(filename.Data(), fin)) {
1717  Error("ReadLightEnergyCsI()", "Could not open file %s",
1718  GetCalibFileName(filename.Data()).Data());
1719  return;
1720  }
1721  Info("ReadLightEnergyCsI()",
1722  "Reading Light-Energy CsI calibration parameters (%s)...", zrange);
1723 
1724  //need description of INDRA geometry
1725  if (!gIndra) {
1727  }
1728  //gIndra exists, but has it been built ?
1729  if (!gIndra->IsBuilt())
1730  gIndra->Build();
1731 
1732  TString sline;
1733 
1734  KVDBParameterSet* parset;
1735  TList* par_list = new TList();
1736 
1737  Float_t a2, a1, a3, a4; // calibration parameters
1738  Int_t ring, mod;
1739 
1740  while (fin.good()) { //reading the file
1741  sline.ReadLine(fin);
1742  if (fin.good()) {
1743  if (!sline.BeginsWith("#")) { //skip comments
1744  if (sscanf
1745  (sline.Data(), "%d %d %f %f %f %f", &ring, &mod, &a1,
1746  &a2, &a3, &a4) != 6) {
1747  Warning("ReadLightEnergyCsI()",
1748  "Bad format in line :\n%s\nUnable to read parameters",
1749  sline.Data());
1750  return;
1751  }
1752  else { //parameters correctly read
1753  KVCsI* csi =
1754  (KVCsI*) gIndra->GetDetectorByType(ring, mod, CsI_R);
1755  if (!csi) {
1756  Warning("ReadLightEnergyCsI()", "Read calibration for non-existent detector CSI_%02d%02d",
1757  ring, mod);
1758  }
1759  else {
1760  parset =
1761  new KVDBParameterSet(csi->GetName(), Form("Light-Energy CsI %s", zrange),
1762  4);
1763  parset->SetParameters({a1, a2, a3, a4});
1764  table->AddRecord(parset);
1765  par_list->Add(parset);
1766  }
1767  } //parameters correctly read
1768  } //data line
1769  } //if(fin.good
1770  } //reading the file
1771  fin.close();
1772 
1773  //these calibrators are valid for all runs
1774  LinkListToRunRange(par_list, GetRunList());
1775  par_list->Clear();
1776  delete par_list;
1777 }
1778 
1779 
1780 
1781 
1787 
1789  Double_t Q_apres_cible,
1790  Double_t Coul_par_top) const
1791 {
1792  // Returns calculated average cross-section [mb] per event for the runs in question.
1793  // It is assumed that all runs correspond to the same reaction,
1794  // with the same beam & target characteristics and multiplicity trigger.
1795  // The target thickness etc. are taken from the first run.
1796 
1797  runs.Begin();
1798  Int_t run1 = runs.Next();
1799  KVTarget* targ = GetRun(run1)->GetTarget();
1800  if (!targ) {
1801  Error("GetEventCrossSection", "No target for run %d", run1);
1802  return 0;
1803  }
1804  Double_t sum_xsec = 0;
1805  runs.Begin();
1806  while (!runs.End()) {
1807 
1808  int run = runs.Next();
1809  if (!GetRun(run))
1810  continue; //skip non-existent runs
1811  sum_xsec +=
1812  GetRun(run)->GetNIncidentIons(Q_apres_cible,
1813  Coul_par_top) * (1. - GetRun(run)->GetTempsMort());
1814  }
1815 
1816  //average X-section [mb] per event = 1e27 / (no. atoms in target * SUM(no. of projectile nuclei * (1 - TM)) )
1817  return (1.e27 / (targ->GetAtomsPerCM2() * sum_xsec));
1818 }
1819 
1820 
1821 
1822 
1827 
1829  Double_t Q_apres_cible,
1830  Double_t Coul_par_top) const
1831 {
1832  //Returns calculated total measured cross-section [mb] for the runs in question.
1833  //This is SUM (GetEventCrossSection(run1,run2) * SUM( events )
1834  //where SUM(events) is the total number of events measured in all the runs
1835  Int_t sum = 0;
1836  runs.Begin();
1837  while (!runs.End()) {
1838  int run = runs.Next();
1839  if (!GetRun(run))
1840  continue; //skip non-existent runs
1841  sum += GetRun(run)->GetEvents();
1842 
1843  }
1844  return sum * GetEventCrossSection(runs, Q_apres_cible,
1845  Coul_par_top);
1846 }
1847 
1848 
1849 
1850 
1854 
1856 {
1857  //Lit le fichier ou sont listés les détecteurs retirés au cours
1858  //de la manip
1859  TString fp;
1860  if (!KVBase::SearchKVFile(GetCalibFileName("AbsentDet"), fp, fDataSet.Data())) {
1861  Error("ReadAbsentDetectors", "Fichier %s, inconnu au bataillon", GetCalibFileName("AbsentDet").Data());
1862  return;
1863  }
1864  Info("ReadAbsentDetectors()", "Lecture des detecteurs absents...");
1865  fAbsentDet = AddTable("Absent Detectors", "Name of physically absent detectors");
1866 
1867  KVDBRecord* dbrec = 0;
1868  TEnv env;
1869  TEnvRec* rec = 0;
1870  env.ReadFile(fp.Data(), kEnvAll);
1871  TIter it(env.GetTable());
1872 
1873  while ((rec = (TEnvRec*)it.Next())) {
1874  KVString srec(rec->GetName());
1875  KVNumberList nl(rec->GetValue());
1876  cout << rec->GetValue() << endl;
1877  if (srec.Contains(",")) {
1878  srec.Begin(",");
1879  while (!srec.End()) {
1880  dbrec = new KVDBRecord(srec.Next(), "Absent Detector");
1881  dbrec->AddKey("Runs", "List of Runs");
1882  fAbsentDet->AddRecord(dbrec);
1883  LinkRecordToRunRange(dbrec, nl);
1884  }
1885  }
1886  else {
1887  dbrec = new KVDBRecord(rec->GetName(), "Absent Detector");
1888  dbrec->AddKey("Runs", "List of Runs");
1889  fAbsentDet->AddRecord(dbrec);
1890  LinkRecordToRunRange(dbrec, nl);
1891  }
1892  }
1893 
1894 }
1895 
1896 
1897 
1901 
1903 {
1904 
1905  //Lit le fichier ou sont listés les détecteurs ne marchant plus au cours
1906  //de la manip
1907  TString fp;
1908  if (!KVBase::SearchKVFile(GetCalibFileName("OoODet"), fp, fDataSet.Data())) {
1909  Error("ReadOoODetectors", "Fichier %s, inconnu au bataillon", GetCalibFileName("OoODet").Data());
1910  return;
1911  }
1912  Info("ReadOoODetectors()", "Lecture des detecteurs hors service ...");
1913  fOoODet = AddTable("OoO Detectors", "Name of out of order detectors");
1914 
1915  KVDBRecord* dbrec = 0;
1916  TEnv env;
1917  TEnvRec* rec = 0;
1918  env.ReadFile(fp.Data(), kEnvAll);
1919  TIter it(env.GetTable());
1920 
1921  while ((rec = (TEnvRec*)it.Next())) {
1922  KVString srec(rec->GetName());
1923  KVNumberList nl(rec->GetValue());
1924  cout << rec->GetValue() << endl;
1925  if (srec.Contains(",")) {
1926  srec.Begin(",");
1927  while (!srec.End()) {
1928  dbrec = new KVDBRecord(srec.Next(), "OoO Detector");
1929  dbrec->AddKey("Runs", "List of Runs");
1930  fOoODet->AddRecord(dbrec);
1931  LinkRecordToRunRange(dbrec, nl);
1932  }
1933  }
1934  else {
1935  dbrec = new KVDBRecord(rec->GetName(), "OoO Detector");
1936  dbrec->AddKey("Runs", "List of Runs");
1937  fOoODet->AddRecord(dbrec);
1938  LinkRecordToRunRange(dbrec, nl);
1939  }
1940  }
1941 
1942 }
1943 
1944 
1945 
1949 
1951 {
1952 
1953  //Lit le fichier ou sont listés les parametres d acquisition ne marchant plus au cours
1954  //de la manip
1955  TString fp;
1956  if (!KVBase::SearchKVFile(GetCalibFileName("OoOACQPar"), fp, fDataSet.Data())) {
1957  Error("ReadNotWorkingACQParams", "Fichier %s, inconnu au bataillon", GetCalibFileName("OoOACQPar").Data());
1958  return;
1959  }
1960  Info("ReadNotWorkingACQParams()", "Lecture des parametres d acq hors service ...");
1961  fOoOACQPar = AddTable("OoO ACQPars", "Name of not working acq parameters");
1962 
1963  KVDBRecord* dbrec = 0;
1964  TEnv env;
1965  TEnvRec* rec = 0;
1966  env.ReadFile(fp.Data(), kEnvAll);
1967  TIter it(env.GetTable());
1968 
1969  while ((rec = (TEnvRec*)it.Next())) {
1970  KVString srec(rec->GetName());
1971  KVNumberList nl(rec->GetValue());
1972  //cout << rec->GetValue() << endl;
1973  if (srec.Contains(",")) {
1974  srec.Begin(",");
1975  while (!srec.End()) {
1976  dbrec = new KVDBRecord(srec.Next(), "OoO ACQPar");
1977  dbrec->AddKey("Runs", "List of Runs");
1978  fOoOACQPar->AddRecord(dbrec);
1979  LinkRecordToRunRange(dbrec, nl);
1980  }
1981  }
1982  else {
1983  dbrec = new KVDBRecord(rec->GetName(), "OoO ACQPar");
1984  dbrec->AddKey("Runs", "List of Runs");
1985  fOoOACQPar->AddRecord(dbrec);
1986  LinkRecordToRunRange(dbrec, nl);
1987  }
1988  }
1989 
1990 }
1991 
1992 
1993 
1994 
2005 
2007 {
2008  // Return mean value of pulser/laser for run.
2009  //
2010  // For detectors, param should be name of an acquisition parameter
2011  // e.g. CI_0201_PG, CSI_1301_L, etc.
2012  // For pin laser diodes, param should be name of associated acquisition parameter
2013  // with either '_laser' or '_gene' appended
2014  // e.g. PILA_05_PG_laser, SI_PIN1_PG_gene
2015  //
2016  // Returns -1.0 if no data available for this parameter/run.
2017 
2018  if (GetPulserData())
2019  return GetPulserData()->GetMean(param, run);
2020  return -1.0;
2021 }
2022 
2023 
int Int_t
unsigned int UInt_t
#define SafeDelete(p)
bool Bool_t
char Char_t
float Float_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
kEnvAll
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
char name[80]
char * Form(const char *fmt,...)
static ValType GetDataSetEnv(const KVString &dataset, const KVString &type, const ValType &defval)
Definition: KVBase.h:304
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:533
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
Definition: KVBase.cpp:644
CsI(Tl) scintillation detectors of the INDRA multidetector array.
Definition: KVCsI.h:16
Wrapper for KVDBPeak describing alpha (thoron) peaks for calibration.
Definition: KVDBAlphaPeak.h:35
CHIO pressure parameters.
Wrapper for KVDBPeak describing elastic peaks for calibration.
To store calibration parameters in a database ,.
void SetParameters(const std::vector< Double_t > &pars)
Double_t GetParameter(UShort_t i=0) const
void SetParamName(UShort_t i, const TString &name)
void SetParameter(UShort_t i, Double_t val)
Calibration peak in database.
Definition: KVDBPeak.h:35
void SetSigType(const Char_t *sig)
Definition: KVDBPeak.h:75
void SetGain(Float_t gain)
Definition: KVDBPeak.h:84
Float_t GetEnergy() const
Definition: KVDBPeak.h:97
void SetRing(UChar_t ring)
Definition: KVDBPeak.h:102
void SetModule(UChar_t mod)
Definition: KVDBPeak.h:111
void SetEnergy(Float_t e)
Definition: KVDBPeak.h:93
void SetGas(Bool_t avec=kTRUE)
Definition: KVDBPeak.h:57
Record folder for the database.
Definition: KVDBRecord.h:43
virtual Bool_t AddKey(KVDBKey *key, Bool_t check=kTRUE)
Definition: KVDBRecord.cpp:65
virtual Bool_t AddLink(const Char_t *key_name, KVDBRecord *rec, Bool_t linkback=kTRUE)
Definition: KVDBRecord.cpp:122
virtual KVRList * GetLinks(const Char_t *key) const
Returns the list of records linked to this record in table "key".
Definition: KVDBRecord.cpp:206
virtual Int_t GetNumber() const
Definition: KVDBRecord.h:73
Description of an experimental run in database ,,.
Definition: KVDBRun.h:41
ULong64_t GetEvents() const
Definition: KVDBRun.h:197
KVTarget * GetTarget() const
Return target used for this run (actually target of KVDBSystem associated to run)
Definition: KVDBRun.h:268
void SetComments(const KVString &comments)
Definition: KVDBRun.h:272
KVDBSystem * GetSystem() const
Definition: KVDBRun.cpp:239
void SetTrigger(Int_t trig)
Definition: KVDBRun.h:244
virtual void ReadRunListLine(const KVString &)
Definition: KVDBRun.cpp:140
virtual Int_t GetScaler(const Char_t *name) const
Definition: KVDBRun.h:292
virtual void SetScaler(const Char_t *name, Int_t val)
Definition: KVDBRun.h:286
Database class used to store information on different colliding systems studied during an experiment....
Definition: KVDBSystem.h:51
KVTarget * GetTarget() const
Definition: KVDBSystem.h:79
Float_t GetEbeam() const
Definition: KVDBSystem.h:207
UInt_t GetZbeam() const
Definition: KVDBSystem.h:187
UInt_t GetAbeam() const
Definition: KVDBSystem.h:192
KVUnownedList GetRuns() const
Returns a sorted list of all the runs associated with this system.
Definition: KVDBSystem.cpp:139
Table in a database.
Definition: KVDBTable.h:34
virtual Bool_t AddRecord(KVDBRecord *add)
Definition: KVDBTable.cpp:74
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 KVDBTable * GetTable(const Char_t *table) const
Definition: KVDataBase.h:159
virtual Bool_t AddTable(KVDBTable *table)
Definition: KVDataBase.cpp:84
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:159
Base class to describe database of an experiment ,,.
Definition: KVExpDB.h:61
virtual KVDBSystem * GetSystem(const Char_t *system) const
Definition: KVExpDB.h:155
virtual void ReadSystemList()
Definition: KVExpDB.cpp:424
virtual void cd()
Definition: KVExpDB.cpp:759
void AddRun(KVDBRun *r)
Definition: KVExpDB.h:126
virtual KVSeqCollection * GetRuns() const
Definition: KVExpDB.h:131
TString GetCalibFileName(const Char_t *type) const
Definition: KVExpDB.h:179
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).
Definition: KVExpDB.cpp:369
const KVNumberList & GetRunList() const
Definition: KVExpDB.h:147
virtual void LinkListToRunRange(TList *list, const KVNumberList &nl)
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
Definition: KVExpDB.cpp:395
const Char_t * GetDataSetDir() const
Definition: KVExpDB.h:206
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
Definition: KVExpDB.cpp:286
virtual TString GetDBEnv(const Char_t *) const
Definition: KVExpDB.cpp:1012
Bool_t OpenCalibFile(const Char_t *type, std::ifstream &fs) const
Definition: KVExpDB.cpp:615
TString fDataSet
the name of the dataset to which this database is associated
Definition: KVExpDB.h:64
Database entry for each run of an INDRA experiment.
Definition: KVINDRADBRun.h:30
Double_t GetNIncidentIons(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void SetEndDate(const KVString &d)
Definition: KVINDRADBRun.h:120
Double_t GetTempsMort() const
Double_t GetEventCrossSection(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void SetSize(Double_t s)
Definition: KVINDRADBRun.h:124
void SetLogbook(const Char_t *log)
Definition: KVINDRADBRun.h:63
void SetStartDate(const KVString &date)
Definition: KVINDRADBRun.h:116
Double_t GetTotalCrossSection(Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
void SetTMpercent(Float_t tmp)
Definition: KVINDRADBRun.h:54
void SetTime(Double_t time)
Definition: KVINDRADBRun.h:128
void SetEvents(ULong64_t evt_number)
Definition: KVINDRADBRun.h:112
DataBase of parameters for an INDRA campaign.
Definition: KVINDRADB.h:59
KVDBTable * fOoODet
(optional) Liste les detecteurs hors service
Definition: KVINDRADB.h:79
void CloseCalibrationPeakFile()
Close file containing database of calibration peaks.
Definition: KVINDRADB.cpp:406
void GoodRunLine() override
Definition: KVINDRADB.cpp:992
void AddTape(KVDBTape *r)
Definition: KVINDRADB.h:119
KVDBTable * fChanVolt
ChIo/Si channel-volt calibration parameters.
Definition: KVINDRADB.h:74
Double_t GetEventCrossSection(Int_t run, Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
Definition: KVINDRADB.cpp:658
std::ifstream __ifpeaks
ifstream for calibration peaks file
Definition: KVINDRADB.h:63
KVDBTable * fLitEnerCsI
CsI light-energy calibration for Z>1.
Definition: KVINDRADB.h:76
virtual void ReadOoOACQParams()
Definition: KVINDRADB.cpp:1950
Double_t GetTotalCrossSection(Int_t run, Double_t Q_apres_cible, Double_t Coul_par_top=1.e-10) const
Definition: KVINDRADB.cpp:675
void _init_MeanGDir_func() const
Definition: KVINDRADB.cpp:419
virtual void ReadChannelVolt()
Definition: KVINDRADB.cpp:1346
KVINDRAPulserDataTree * GetPulserData()
Definition: KVINDRADB.h:169
KVDBTable * fAbsentDet
(optional) Liste les detecteurs absents
Definition: KVINDRADB.h:78
void ReadNewRunList()
Read new-style runlist (written using KVDBRun v.10 or later)
Definition: KVINDRADB.cpp:950
std::ifstream & GetPeakFileStream()
Definition: KVINDRADB.h:101
Float_t GetMeanPulser(const Char_t *, int)
Definition: KVINDRADB.cpp:2006
Bool_t OpenCalibrationPeakFile()
calibration peaks database
Definition: KVINDRADB.cpp:384
void ReadObjects(TFile *) override
Read associated objects (i.e. KVINDRAPulserDataTree's TTree) from file.
Definition: KVINDRADB.cpp:1163
virtual void ReadPedestalList()
Definition: KVINDRADB.cpp:1618
virtual void ReadGainList()
Read the file listing any detectors whose gain value changes during exeriment.
Definition: KVINDRADB.cpp:437
KVDBTable * fCsILumCorr
table of CsI gain corrections for total light output
Definition: KVINDRADB.h:72
KVDBTable * fOoOACQPar
(optional) Liste des parametres d acquisition ne marchant pas
Definition: KVINDRADB.h:80
KVINDRAPulserDataTree * fPulserData
mean values of pulsers for all detectors & runs
Definition: KVINDRADB.h:82
virtual void ReadVoltEnergyChIoSi()
Definition: KVINDRADB.cpp:1529
virtual void ReadOoODetectors()
Definition: KVINDRADB.cpp:1902
void WriteObjects(TFile *) override
Write associated objects (i.e. KVINDRAPulserDataTree's TTree) in file.
Definition: KVINDRADB.cpp:1151
KVList * GetCalibrationPeaks(Int_t run, KVDetector *detector=0, Int_t peak_type=-1, Int_t signal_type=0, Double_t peak_energy=-1.0)
Definition: KVINDRADB.cpp:151
virtual KVDBTape * GetTape(Int_t tape) const
Definition: KVINDRADB.h:123
TF1 * fMeanGDir
mean frequency of GENE_DIRECT vs. run number
Definition: KVINDRADB.h:104
void init()
Definition: KVINDRADB.cpp:49
virtual void ReadCsITotalLightGainCorrections()
Definition: KVINDRADB.cpp:1234
void Build(bool=false) override
Definition: KVINDRADB.cpp:892
KVDBTable * fPedestals
table of pedestal files
Definition: KVINDRADB.h:73
KVDBTable * fVoltMeVChIoSi
ChIo/Si volt-energy calibration.
Definition: KVINDRADB.h:75
KVDBTable * fGains
(optional) table of detector gains, in case they change from run to run
Definition: KVINDRADB.h:70
virtual void ReadLightEnergyCsI(const Char_t *, KVDBTable *)
Definition: KVINDRADB.cpp:1707
void cd() override
Definition: KVINDRADB.cpp:105
virtual void ReadAbsentDetectors()
Definition: KVINDRADB.cpp:1855
virtual void ReadChIoPressures()
Definition: KVINDRADB.cpp:538
virtual Double_t GetRunLengthFromGeneDirect(int run) const
Definition: KVINDRADB.cpp:1177
Double_t GetMeanGDirFreq(Int_t run) const
Definition: KVINDRADB.cpp:873
KVINDRADBRun * GetRun(Int_t run) const
Definition: KVINDRADB.h:133
virtual void ReadCalibCsI()
Definition: KVINDRADB.cpp:1689
KVDBTable * fLitEnerCsIZ1
CsI light-energy calibration for Z=1.
Definition: KVINDRADB.h:77
KVINDRADetector * GetChIo() const
Handles TTree with mean pulser data for every run.
Float_t GetMean(const Char_t *, Int_t)
void ReadTree(TFile *)
Read pulser data tree from file.
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)
void Build(Int_t run=-1) override
Correspondance between CsI detectors and pin lasers is set up if known.
Definition: KVINDRA.cpp:119
static Char_t SignalTypes[16][3]
Use this static array to translate EBaseIndra_type signal type to a string giving the signal type.
Definition: KVINDRA.h:69
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
Definition: KVINDRA.cpp:240
Extended TList class which owns its objects by default.
Definition: KVList.h:22
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray", KVExpDB *db=nullptr)
virtual Bool_t IsBuilt() const
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Bool_t End(void) const
Definition: KVNumberList.h:199
void Begin(void) const
Int_t Next(void) const
Wrapper for TRefArray adding some functionality.
Definition: KVRList.h:37
Base class for reading runlists for experiments ,.
Definition: KVRunListLine.h:26
Bool_t HasFieldValue(const Char_t *) const
Float_t GetFloatField(const Char_t *)
virtual void Print() const
void SetRunKeys()
Definition: KVRunListLine.h:44
void SetFieldKeys()
Definition: KVRunListLine.h:40
Bool_t HasField(const Char_t *) const
INLINES_______________________________________________________________________________.
Int_t GetIntField(const Char_t *)
virtual const Char_t * GetField(const Char_t *) const
void Add(TObject *obj) override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void Begin(TString delim) const
Definition: KVString.cpp:565
Bool_t End() const
Definition: KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
Handles directories stored in .tgz archive files.
Definition: KVTarArchive.h:22
Bool_t IsOK() const
Definition: KVTarArchive.h:37
Calculation/correction of energy losses of particles through an experimental target.
Definition: KVTarget.h:128
Double_t GetAtomsPerCM2() const
virtual UInt_t GetUnits() const;
Definition: KVTarget.cpp:927
virtual Int_t GetSize() const
THashList * GetTable() const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
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
TObject * Next()
void Clear(Option_t *option="") override
void Add(TObject *obj) override
const char * GetName() const override
TObject * At(Int_t idx) const override
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
Double_t Atof() const
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) 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)
TLine * line
const Double_t sigma
rec
Double_t Abs(Double_t d)
Double_t Range(Double_t lb, Double_t ub, Double_t x)
const char * String
ClassImp(TPyArg)