KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVINDRADB.cpp
Go to the documentation of this file.
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 
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 
84 KVINDRADB::KVINDRADB(const Char_t* name): KVExpDB(name,
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->SetParameters((Double_t) 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  TIter next_run(system->GetRuns());
782  KVINDRADBRun* run;
783  while ((run = (KVINDRADBRun*) next_run())) {
784 
785  if (run->GetTrigger() != mult_trig)
786  continue; //skip runs with bad trigger
787  sum_xsec +=
788  run->GetNIncidentIons(Q_apres_cible,
789  Coul_par_top) * (1. - run->GetTempsMort());
790 
791  }
792  //average X-section [mb] per event = 1e27 / (no. atoms in target * SUM(no. of projectile nuclei * (1 - temps mort)))
793  return (1.e27 / (targ->GetAtomsPerCM2() * sum_xsec));
794 }
795 
796 
797 
798 
803 
805  Int_t mult_trig,
806  Double_t Q_apres_cible,
807  Double_t Coul_par_top) const
808 {
809  //Returns calculated total cross-section [mb] for all events in all runs of the named system* with trigger multiplicity 'mul_trig'.
810  // *to see the list of all system names, use gIndraDB->GetSystems()->ls()
811  //See KVINDRADBRun::GetNIncidentIons() for meaning of other arguments
812 
813  KVDBSystem* system = GetSystem(system_name);
814  if (!system) {
815  Error("GetTotalCrossSection",
816  "System %s unknown. Check list of systems (gIndraDB->GetSystems()->ls()).",
817  system_name);
818  return 0.;
819  }
820  Int_t sum = 0;
821  //loop over all runs of system, only using those with correct trigger multiplicity
822  TIter next_run(system->GetRuns());
823  KVINDRADBRun* run;
824  while ((run = (KVINDRADBRun*) next_run())) {
825 
826  if (run->GetTrigger() != mult_trig)
827  continue; //skip runs with bad trigger
828  sum += run->GetEvents();
829  }
830 
831  return sum * GetEventCrossSection(system_name, mult_trig, Q_apres_cible,
832  Coul_par_top);
833 }
834 
835 
836 
837 
842 
843 Double_t KVINDRADB::GetTotalCrossSection(TH1* events_histo, Double_t Q_apres_cible, Double_t Coul_par_top)
844 {
845  // Calculate the cross-section [mb] for a given selection of events in several runs,
846  // given by the TH1, which is a distribution of run numbers (i.e. a histogram filled with
847  // the number of selected events for each run, the run number is on the x-axis of the histogram).
848 
849  Info("GetTotalCrossSection", "Calculating cross-section for q=%f", Q_apres_cible);
850  Double_t xsec = 0, ninc = 0;
851  KVTarget* targ = 0;
852  for (int i = 1; i <= events_histo->GetNbinsX(); i++) {
853  Double_t events = events_histo->GetBinContent(i);
854  if (events == 0) continue;
855  int run_num = events_histo->GetBinCenter(i);
856  KVINDRADBRun* run = GetRun(run_num);
857  if (!targ) targ = run->GetTarget();
858  ninc +=
859  run->GetNIncidentIons(Q_apres_cible,
860  Coul_par_top);
861  xsec += events / (1. - run->GetTempsMort());
862  cout << "Run#" << run_num << " Events : " << events
863  << " Dead time : " << run->GetTempsMort() << endl;
864  }
865  return (1.e27 / (ninc * targ->GetAtomsPerCM2())) * xsec;
866 }
867 
868 
869 
873 
875 {
876  // Return mean frequency of Gene_Direct for run
877  // If not defined for dataset, returns 0
878 
879  if (!fMeanGDir) {
881  if (!fMeanGDir) return 0;
882  }
883  return fMeanGDir->Eval(run);
884 }
885 
886 
887 
888 
892 
894 {
895 
896  //Use KVINDRARunListReader utility subclass to read complete runlist
897 
898  //get full path to runlist file, using environment variables for the current dataset
899  TString runlist_fullpath;
900  KVBase::SearchKVFile(GetDBEnv("Runlist"), runlist_fullpath, fDataSet.Data());
901 
902  //set comment character for current dataset runlist
903  SetRLCommentChar(GetDBEnv("Runlist.Comment")[0]);
904 
905  //set field separator character for current dataset runlist
906  if (!strcmp(GetDBEnv("Runlist.Separator"), "<TAB>"))
907  SetRLSeparatorChar('\t');
908  else
909  SetRLSeparatorChar(GetDBEnv("Runlist.Separator")[0]);
910 
911  //by default we set two keys for both recognising the 'header' lines and deciding
912  //if we have a good run line: the "Run" and "Events" fields must be present
913  GetLineReader()->SetFieldKeys(GetDBEnv("Runlist.Run"), GetDBEnv("Runlist.Events"));
914  GetLineReader()->SetRunKeys(GetDBEnv("Runlist.Run"), GetDBEnv("Runlist.Events"));
915 
916  ReadRunList(runlist_fullpath.Data());
917  //new style runlist
918  if (IsNewRunList()) {
919  ReadNewRunList();
920  };
921 
922  ReadSystemList();
924  ReadGainList();
925  ReadChannelVolt();
927  ReadCalibCsI();
932 
933  // read all available mean pulser data and store in tree
936  fPulserData->Build();
937 
939 }
940 
941 
942 
943 
946 
948 {
949  //Read new-style runlist (written using KVDBRun v.10 or later)
950 
951  ifstream fin;
952  if (!OpenCalibFile("Runlist", fin)) {
953  Error("ReadNewRunList()", "Could not open file %s",
954  GetCalibFileName("Runlist").Data());
955  return;
956  }
957 
958  Info("ReadNewRunList()", "Reading run parameters ...");
959 
960  KVString line;
961  KVINDRADBRun* run;
962 
963  while (fin.good() && !fin.eof()) {
964  line.ReadLine(fin);
965 
966  if (line.Length() > 1 && !line.BeginsWith("#") && !line.BeginsWith("Version")) {
967  run = new KVINDRADBRun;
968  run->ReadRunListLine(line);
969  if (run->GetNumber() < 1) {
970  delete run;
971  }
972  else {
973  AddRun(run);
974  }
975  }
976  }
977  fin.close();
978 }
979 
980 
981 
988 
990 {
991  //For each "good run line" in the run list file, we:
992  // add a KVINDRADBRun to the database if it doesn't already exist
993  // add a KVDBTape to the database if the "tape" field is active and if it doesn't already exist
994  // set properties of run and tape objects
995  //kFirstRun & kLastRun are set
996 
997  KVRunListLine* csv_line = GetLineReader();
998 
999  //run number
1000  Int_t run_n = csv_line->GetIntField(GetDBEnv("Runlist.Run"));
1001 
1002  if (!run_n) {
1003  cout << "run_n = 0 ????????? line number =" << GetRLLineNumber() <<
1004  endl;
1005  GetLineReader()->Print();
1006  return;
1007  }
1008 
1009  /*********************************************
1010  IF LINE HAS A TAPE NUMBER WE
1011  LOOK FOR THE TAPE IN THE DATA
1012  BASE. IF IT DOESN'T EXIST WE
1013  CREATE IT.
1014  *********************************************/
1015  KVDBTape* tape = 0;
1016  //tape number (if tape field is filled)
1017  if (csv_line->HasFieldValue(GetDBEnv("Runlist.Tape"))) {
1018  Int_t tape_n = csv_line->GetIntField(GetDBEnv("Runlist.Tape"));
1019  //already exists ?
1020  tape = GetTape(tape_n);
1021  if (!tape) {
1022  tape = new KVDBTape(tape_n);
1023  AddTape(tape);
1024  }
1025  }
1026 
1027  /*********************************************
1028  WE CREATE A NEW RUN AND ADD
1029  IT TO THE DATABASE. WE SET ALL
1030  AVAILABLE INFORMATIONS ON
1031  RUN FROM THE FILE. ERROR IF
1032  DBASE RUN ALREADY EXISTS =>
1033  SAME RUN APPEARS TWICE
1034  *********************************************/
1035  KVINDRADBRun* run = GetRun(run_n);
1036  if (!run) {
1037 
1038  run = new KVINDRADBRun(run_n);
1039  AddRun(run);
1040 
1041  //add run to tape ?
1042  if (tape)
1043  tape->AddRun(run);
1044 
1045  TString key = GetDBEnv("Runlist.Buffers");
1046  if (csv_line->HasFieldValue(key.Data()))
1047  run->SetScaler("Buffers", csv_line->GetIntField(key.Data()));
1048  key = GetDBEnv("Runlist.Events");
1049  if (csv_line->HasFieldValue(key.Data()))
1050  run->SetEvents(csv_line->GetIntField(key.Data()));
1051  key = GetDBEnv("Runlist.Far1");
1052  if (csv_line->HasFieldValue(key.Data()))
1053  run->SetScaler("Faraday 1", csv_line->GetIntField(key.Data()));
1054  key = GetDBEnv("Runlist.Far2");
1055  if (csv_line->HasFieldValue(key.Data()))
1056  run->SetScaler("Faraday 2", csv_line->GetIntField(key.Data()));
1057  key = GetDBEnv("Runlist.Time");
1058  if (csv_line->HasFieldValue(key.Data()))
1059  run->SetTime(csv_line->GetFloatField(key.Data()));
1060  key = GetDBEnv("Runlist.Size");
1061  if (csv_line->HasFieldValue(key.Data()))
1062  run->SetSize(csv_line->GetFloatField(key.Data()));
1063  key = GetDBEnv("Runlist.GDir");
1064  if (csv_line->HasFieldValue(key.Data()))
1065  run->SetScaler("Gene DIRECT", csv_line->GetIntField(key.Data()));
1066  key = GetDBEnv("Runlist.GLas");
1067  if (csv_line->HasFieldValue(key.Data()))
1068  run->SetScaler("Gene LASER", csv_line->GetIntField(key.Data()));
1069  key = GetDBEnv("Runlist.GElec");
1070  if (csv_line->HasFieldValue(key.Data()))
1071  run->SetScaler("Gene ELECT", csv_line->GetIntField(key.Data()));
1072  key = GetDBEnv("Runlist.GTest");
1073  if (csv_line->HasFieldValue(key.Data()))
1074  run->SetScaler("Gene TEST", csv_line->GetIntField(key.Data()));
1075  key = GetDBEnv("Runlist.GMarq");
1076  if (csv_line->HasFieldValue(key.Data()))
1077  run->SetScaler("Gene MARQ", csv_line->GetIntField(key.Data()));
1078  key = GetDBEnv("Runlist.GTM");
1079  if (csv_line->HasFieldValue(key.Data()))
1080  run->SetScaler("Gene TM", csv_line->GetIntField(key.Data()));
1081  key = GetDBEnv("Runlist.DEC");
1082  if (csv_line->HasFieldValue(key.Data()))
1083  run->SetScaler("DEC", csv_line->GetIntField(key.Data()));
1084  key = GetDBEnv("Runlist.FC");
1085  if (csv_line->HasFieldValue(key.Data()))
1086  run->SetScaler("FC", csv_line->GetIntField(key.Data()));
1087  key = GetDBEnv("Runlist.OK");
1088  if (csv_line->HasFieldValue(key.Data()))
1089  run->SetScaler("OK", csv_line->GetIntField(key.Data()));
1090  key = GetDBEnv("Runlist.FT");
1091  if (csv_line->HasFieldValue(key.Data()))
1092  run->SetScaler("FT", csv_line->GetIntField(key.Data()));
1093  key = GetDBEnv("Runlist.AVL");
1094  if (csv_line->HasFieldValue(key.Data()))
1095  run->SetScaler("AVL", csv_line->GetIntField(key.Data()));
1096  key = GetDBEnv("Runlist.OCD");
1097  if (csv_line->HasFieldValue(key.Data()))
1098  run->SetScaler("OCD", csv_line->GetIntField(key.Data()));
1099  key = GetDBEnv("Runlist.OA");
1100  if (csv_line->HasFieldValue(key.Data()))
1101  run->SetScaler("OA", csv_line->GetIntField(key.Data()));
1102  key = GetDBEnv("Runlist.RAZ");
1103  if (csv_line->HasFieldValue(key.Data()))
1104  run->SetScaler("RAZ", csv_line->GetIntField(key.Data()));
1105  key = GetDBEnv("Runlist.PlastAll");
1106  if (csv_line->HasFieldValue(key.Data()))
1107  run->SetScaler("Plast All", csv_line->GetIntField(key.Data()));
1108  key = GetDBEnv("Runlist.PlastG");
1109  if (csv_line->HasFieldValue(key.Data()))
1110  run->SetScaler("Plast G", csv_line->GetIntField(key.Data()));
1111  key = GetDBEnv("Runlist.PlastC");
1112  if (csv_line->HasFieldValue(key.Data()))
1113  run->SetScaler("Plast C", csv_line->GetIntField(key.Data()));
1114  key = GetDBEnv("Runlist.PlastD");
1115  if (csv_line->HasFieldValue(key.Data()))
1116  run->SetScaler("Plast D", csv_line->GetIntField(key.Data()));
1117  key = GetDBEnv("Runlist.TMpc");
1118  if (csv_line->HasFieldValue(key.Data()))
1119  run->SetTMpercent(csv_line->GetFloatField(key.Data()));
1120  key = GetDBEnv("Runlist.Trigger");
1121  if (csv_line->HasField(key.Data()))
1122  run->SetTrigger(GetRunListTrigger(key.Data(), "M>=%d"));
1123  key = GetDBEnv("Runlist.Start");
1124  if (csv_line->HasField(key.Data()))
1125  run->SetStartDate(csv_line->GetField(key.Data()));
1126  key = GetDBEnv("Runlist.End");
1127  if (csv_line->HasField(key.Data()))
1128  run->SetEndDate(csv_line->GetField(key.Data()));
1129  key = GetDBEnv("Runlist.Comments");
1130  if (csv_line->HasField(key.Data()))
1131  run->SetComments(csv_line->GetField(key.Data()));
1132  key = GetDBEnv("Runlist.Log");
1133  if (csv_line->HasField(key.Data()))
1134  run->SetLogbook(csv_line->GetField(key.Data()));
1135 
1136  }
1137  else {
1138  Error("GoodRunLine", "Run %d already exists", run_n);
1139  }
1140 }
1141 
1142 
1143 
1144 
1147 
1149 {
1150  // Write associated objects (i.e. KVINDRAPulserDataTree's TTree) in file
1152 }
1153 
1154 
1155 
1156 
1159 
1161 {
1162  // Read associated objects (i.e. KVINDRAPulserDataTree's TTree) from file
1165 }
1166 
1167 
1168 
1173 
1175 {
1176  // Using the mean frequency of the Selecteur internal clock (Gene DIRECT)
1177  // and the total measured number of ticks for the run,
1178  // calculate the length of the run in seconds
1179 
1180  Double_t g_dir_frq = GetMeanGDirFreq(run);
1181  if (g_dir_frq == 0) {
1182  Error("GetRunLengthFromGeneDirect", "Mean frequency of G_DIR unknown for this dataset");
1183  return 0;
1184  }
1185  KVINDRADBRun* dbr = GetRun(run);
1186  if (!dbr) {
1187  Error("GetRunLengthFromGeneDirect", "Run %d not in database", run);
1188  return 0;
1189  }
1190  Double_t g_dir = dbr->GetScaler("Gene DIRECT");
1191  if (g_dir == 0) {
1192  Error("GetRunLengthFromGeneDirect", "Gene DIRECT total not known for run");
1193  return 0;
1194  }
1195  return g_dir / g_dir_frq;
1196 }
1197 
1198 
1199 
1200 
1230 
1232 {
1233  // Read in gain corrections for CsI total light output.
1234  // Looks for directory
1235  // $KVROOT/KVFiles/[dataset name]/[lumcorrdir]
1236  // where [lumcorrdir] is defined in .kvrootrc by one of the two variables
1237  // INDRADB.CsILumCorr: [lumcorrdir]
1238  // [dataset name].INDRADB.CsILumCorr: [lumcorrdir]
1239  // the latter value takes precedence for a given dataset over the former, generic, value.
1240  //
1241  // If the directory is not found we look for a compressed archive file
1242  // $KVROOT/KVFiles/[dataset name]/[lumcorrdir].tgz
1243  //
1244  // The files in the directory containing the corrections for each run have
1245  // names with the format given by
1246  // INDRADB.CsILumCorr.FileName: [format]
1247  // [dataset name].INDRADB.CsILumCorr.FileName: [format]
1248  // the latter value takes precedence for a given dataset over the former, generic, value.
1249  // The [format] should include a placeholder for the run number, e.g.
1250  // INDRADB.CsILumCorr.FileName: run%04d.cor
1251  // INDRADB.CsILumCorr.FileName: Run%d.corrLum
1252  // etc. etc.
1253  //
1254  // The contents of each file should be in the following format:
1255  // CSI_0221_R 1.00669
1256  // CSI_0321_R 1.01828
1257  // CSI_0322_R 1.00977
1258  // i.e.
1259  // name_of_detector correction
1260  //Any other lines are ignored.
1261 
1262  Info("ReadCsITotalLightGainCorrections",
1263  "Reading corrections...");
1264 
1265  // get name of directory for this dataset from .kvrootrc
1266  TString search;
1267  search = GetDBEnv("CsILumCorr");
1268  if (search == "") {
1269  Error("ReadCsITotalLightGainCorrections", "INDRADB.CsILumCorr is not defined. Check .kvrootrc files.");
1270  }
1271 
1272  KVTarArchive gain_cor(search.Data(), GetDataSetDir());
1273  if (!gain_cor.IsOK()) {
1274  Info("ReadCsITotalLightGainCorrections", "No corrections found");
1275  return;
1276  }
1277 
1278  TString filefmt;
1279  filefmt = GetDBEnv("CsILumCorr.FileName");
1280  if (filefmt == "") {
1281  Error("ReadCsITotalLightGainCorrections", "INDRADB.CsILumCorr.FileName is not defined. Check .kvrootrc files.");
1282  }
1283 
1284  // boucle sur tous les runs
1285  TIter next_run(GetRuns());
1286  KVINDRADBRun* run = 0;
1287  while ((run = (KVINDRADBRun*)next_run())) {
1288 
1289  Int_t run_num = run->GetNumber();
1290  TString filepath;
1291  filepath.Form(filefmt.Data(), run_num);
1292  filepath.Prepend("/");
1293  filepath.Prepend(search.Data());
1294  ifstream filereader;
1295  if (KVBase::SearchAndOpenKVFile(filepath, filereader, fDataSet.Data())) {
1296 
1297  KVString line;
1298  line.ReadLine(filereader);
1299  while (filereader.good()) {
1300 
1301  line.Begin(" ");
1302  if (line.End()) {
1303  line.ReadLine(filereader);
1304  continue;
1305  }
1306  KVString det_name = line.Next(kTRUE);
1307  if (!det_name.BeginsWith("CSI_")) {
1308  line.ReadLine(filereader);
1309  continue;
1310  }
1311  if (line.End()) {
1312  line.ReadLine(filereader);
1313  continue;
1314  }
1315  Double_t correction = line.Next(kTRUE).Atof();
1316 
1317  KVDBParameterSet* cps = new KVDBParameterSet(det_name.Data(),
1318  "CsI Total Light Gain Correction", 1);
1319 
1320  cps->SetParameters(correction);
1321  fCsILumCorr->AddRecord(cps);
1322  cps->AddLink("Runs", run);
1323  line.ReadLine(filereader);
1324  }
1325  filereader.close();
1326  }
1327  else {
1328  Warning("ReadCsITotalLightGainCorrections", "Run %d: no correction", run_num);
1329  }
1330 
1331  }
1332 
1333 }
1334 
1335 
1336 
1342 
1344 {
1345  //Read Channel-Volt calibrations for ChIo and Si detectors (including Etalons).
1346  //The parameter filenames are taken from the environment variables
1347  // [dataset name].INDRADB.ElectronicCalibration: [chio & si detectors]
1348  // [dataset name].INDRADB.ElectronicCalibration.Etalons: [etalons]
1349 
1350  ifstream fin;
1351  if (!OpenCalibFile("ElectronicCalibration", fin)) {
1352  Error("ReadChannelVolt()", "Could not open file %s",
1353  GetCalibFileName("ElectronicCalibration").Data());
1354  return;
1355  }
1356  Info("ReadChannelVolt()",
1357  "Reading electronic calibration for ChIo and Si...");
1358 
1359  TString sline;
1360 
1361  UInt_t frun = 0, lrun = 0;
1362  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
1363  UInt_t rr_number = 0;
1364  Bool_t prev_rr = kFALSE; // was the last line a run range indication ?
1365 
1366  UInt_t cour, modu, sign;
1367  Float_t a0, a1, a2, dum1, dum2;
1368 
1369  Char_t det_name[80];
1370  Char_t cal_type[80];
1371  KVDBParameterSet* parset;
1372  TList* par_list = new TList();
1373 
1374 
1375  while (fin.good()) { //reading the file
1376  sline.ReadLine(fin);
1377  if (fin.eof()) { //fin du fichier
1378  LinkListToRunRanges(par_list, rr_number, run_ranges);
1379  par_list->Clear();
1380  break;
1381  }
1382  if (sline.BeginsWith("Run Range :")) { // Run Range found
1383  if (!prev_rr) { // new run ranges set
1384  if (par_list->GetSize() > 0)
1385  LinkListToRunRanges(par_list, rr_number, run_ranges);
1386  par_list->Clear();
1387  rr_number = 0;
1388  }
1389  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
1390  Warning("ReadChannelVolt()",
1391  "Bad format in line :\n%s\nUnable to read run range values",
1392  sline.Data());
1393  }
1394  else {
1395  prev_rr = kTRUE;
1396  run_ranges[rr_number][0] = frun;
1397  run_ranges[rr_number][1] = lrun;
1398  rr_number++;
1399  if (rr_number == MAX_NUM_RUN_RANGES) {
1400  Error("ReadChannelVolt", "Too many run ranges (>%d)",
1401  rr_number);
1402  rr_number--;
1403  }
1404  }
1405  } //Run Range foundTObjString
1406  else if (sline.Sizeof() > 1 && !sline.BeginsWith("#")) { //non void nor comment line
1407  if (sscanf(sline.Data(), "%u %u %u %f %f %f %f %f",
1408  &cour, &modu, &sign, &a0, &a1, &a2, &dum1,
1409  &dum2) != 8) {
1410  Warning("ReadChannelVolt()",
1411  "Bad format in line :\n%s\nUnable to read",
1412  sline.Data());
1413  }
1414  else { //parameters correctly read
1415  // naming detector
1416  switch (sign) {
1417  case ChIo_GG:
1418  sprintf(det_name, "CI_%02u%02u_GG", cour, modu);
1419  strcpy(cal_type, "Channel-Volt GG");
1420  break;
1421  case ChIo_PG:
1422  sprintf(det_name, "CI_%02u%02u_PG", cour, modu);
1423  strcpy(cal_type, "Channel-Volt PG");
1424  break;
1425  case Si_GG:
1426  sprintf(det_name, "SI_%02u%02u_GG", cour, modu);
1427  strcpy(cal_type, "Channel-Volt GG");
1428  break;
1429  case Si_PG:
1430  sprintf(det_name, "SI_%02u%02u_PG", cour, modu);
1431  strcpy(cal_type, "Channel-Volt PG");
1432  break;
1433  }
1434  parset = new KVDBParameterSet(det_name, cal_type, 5);
1435  parset->SetParameters(a0, a1, a2, dum1, dum2);
1436  prev_rr = kFALSE;
1437  fChanVolt->AddRecord(parset);
1438  par_list->Add(parset);
1439  } //parameters correctly read
1440  } //non void nor comment line
1441  } //reading the file
1442  delete par_list;
1443  fin.close();
1444 
1445  /********** ETALONS ***************/
1446 
1447  ifstream fin2;
1448  if (!OpenCalibFile("ElectronicCalibration.Etalons", fin2)) {
1449  Error("ReadChannelVolt()", "Could not open file %s",
1450  GetCalibFileName("ElectronicCalibration.Etalons").Data());
1451  return;
1452  }
1453  Info("ReadChannelVolt()",
1454  "Reading electronic calibration for Si75 and SiLi...");
1455  frun = lrun = 0;
1456  rr_number = 0;
1457  prev_rr = kFALSE; // was the last line a run range indication ?
1458  par_list = new TList;
1459  TObjArray* toks = 0;
1460  while (fin2.good()) { //reading the file
1461  sline.ReadLine(fin2);
1462  if (fin2.eof()) { //fin du fichier
1463  LinkListToRunRanges(par_list, rr_number, run_ranges);
1464  par_list->Clear();
1465  delete par_list;
1466  fin2.close();
1467  return;
1468  }
1469  if (sline.BeginsWith("Run Range :")) { // Run Range found
1470  if (!prev_rr) { // new run ranges set
1471  if (par_list->GetSize() > 0)
1472  LinkListToRunRanges(par_list, rr_number, run_ranges);
1473  par_list->Clear();
1474  rr_number = 0;
1475  }
1476  if (sscanf(sline.Data(), "Run Range : %u %u", &frun, &lrun) != 2) {
1477  Warning("ReadChannelVolt()",
1478  "Bad format in line :\n%s\nUnable to read run range values",
1479  sline.Data());
1480  }
1481  else {
1482  prev_rr = kTRUE;
1483  run_ranges[rr_number][0] = frun;
1484  run_ranges[rr_number][1] = lrun;
1485  rr_number++;
1486  if (rr_number == MAX_NUM_RUN_RANGES) {
1487  Error("ReadChannelVolt", "Too many run ranges (>%d)",
1488  rr_number);
1489  rr_number--;
1490  }
1491  }
1492  } //Run Range found
1493  else if (sline.Sizeof() > 1 && !sline.BeginsWith("#")) { //non void nor comment line
1494  if (sscanf(sline.Data(), "%s %f %f %f",
1495  det_name, &a0, &a1, &a2) != 4) {
1496  Warning("ReadChannelVolt()",
1497  "Bad format in line :\n%s\nUnable to read",
1498  sline.Data());
1499  }
1500  else { //parameters correctly read
1501  KVString gain;
1502  gain.Form("%s", det_name);
1503  toks = gain.Tokenize("_");
1504  KVString scal_type;
1505  scal_type.Form("Channel-Volt %s", ((TObjString*)toks->At(2))->GetString().Data());
1506  delete toks;
1507  parset = new KVDBParameterSet(det_name, scal_type.Data(), 3);
1508  parset->SetParameters(a0, a1, a2);
1509  prev_rr = kFALSE;
1510  fChanVolt->AddRecord(parset);
1511  par_list->Add(parset);
1512  } //parameters correctly read
1513  } //non void nor comment line
1514  } //reading the file
1515  delete par_list;
1516 }
1517 
1518 
1519 
1520 
1525 
1527 {
1528  //Read Volt-Energy(MeV) calibrations for ChIo and Si detectors.
1529  //The parameter filename is taken from the environment variable
1530  // [dataset name].INDRADB.ChIoSiVoltMeVCalib:
1531 
1532  ifstream fin;
1533  if (!OpenCalibFile("ChIoSiVoltMeVCalib", fin)) {
1534  Error("ReadVoltEnergyChIoSi()", "Could not open file %s",
1535  GetCalibFileName("ChIoSiVoltMevCalib").Data());
1536  return;
1537  }
1538  Info("ReadVoltEnergyChIoSi()",
1539  "Reading ChIo/Si calibration parameters...");
1540 
1541  TString sline;
1542 
1543  UInt_t frun = 0, lrun = 0;
1544  UInt_t run_ranges[MAX_NUM_RUN_RANGES][2];
1545  UInt_t rr_number = 0;
1546  Bool_t prev_rr = kFALSE; // was the last line a run range indication ?
1547 
1548  Char_t det_name[80];
1549  KVDBParameterSet* parset;
1550  TList* par_list = new TList();
1551 
1552  Float_t a0, a1, chi; // calibration parameters
1553 
1554  while (fin.good()) { //reading the file
1555  sline.ReadLine(fin);
1556  if (fin.eof()) { //fin du fichier
1557  LinkListToRunRanges(par_list, rr_number, run_ranges);
1558  par_list->Clear();
1559  delete par_list;
1560  fin.close();
1561  return;
1562  }
1563  if (sline.BeginsWith("Run Range :")) { // Run Range found
1564  if (!prev_rr) { // new run ranges set
1565  if (par_list->GetSize() > 0)
1566  LinkListToRunRanges(par_list, rr_number, run_ranges);
1567  par_list->Clear();
1568  rr_number = 0;
1569  }
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",
1573  sline.Data());
1574  }
1575  else {
1576  prev_rr = kTRUE;
1577  run_ranges[rr_number][0] = frun;
1578  run_ranges[rr_number][1] = lrun;
1579  rr_number++;
1580  if (rr_number == MAX_NUM_RUN_RANGES) {
1581  Error("ReadVoltEnergyAlpha", "Too many run ranges (>%d)",
1582  rr_number);
1583  rr_number--;
1584  }
1585  }
1586  } //Run Range found
1587  if (sline.BeginsWith("SI") || sline.BeginsWith("CI")) { //data line
1588  if (sscanf(sline.Data(), "%7s %f %f %f", det_name, &a0, &a1, &chi)
1589  != 4) {
1590  Warning("ReadVoltEnergyAlpha()",
1591  "Bad format in line :\n%s\nUnable to read parameters",
1592  sline.Data());
1593  }
1594  else { //parameters correctly read
1595  parset = new KVDBParameterSet(det_name, "Volt-Energy", 3);
1596  parset->SetParameters(a0, a1, chi);
1597  prev_rr = kFALSE;
1598  fVoltMeVChIoSi->AddRecord(parset);
1599  par_list->Add(parset);
1600  } //parameters correctly read
1601  } //data line
1602  } //reading the file
1603  delete par_list;
1604  fin.close();
1605 }
1606 
1607 
1608 
1609 
1614 
1616 {
1617  //Read the names of pedestal files to use for each run range, found
1618  //in file with name defined by the environment variable:
1619  // [dataset name].INDRADB.Pedestals: ...
1620 
1621  ifstream fin;
1622  if (!OpenCalibFile("Pedestals", fin)) {
1623  Error("ReadPedestalList()", "Could not open file %s",
1624  GetCalibFileName("Pedestals").Data());
1625  return;
1626  }
1627  Info("ReadPedestalList()", "Reading pedestal file list...");
1628 
1629  KVString line;
1630  Char_t filename_chio[80], filename_csi[80];
1631  UInt_t runlist[1][2];
1632 
1633  while (fin.good()) { //lecture du fichier
1634 
1635  // lecture des informations
1636  line.ReadLine(fin);
1637 
1638  //recherche une balise '+'
1639  if (line.BeginsWith('+')) { //balise trouvee
1640 
1641  line.Remove(0, 1);
1642 
1643  if (sscanf
1644  (line.Data(), "Run Range : %u %u", &runlist[0][0],
1645  &runlist[0][1]) != 2) {
1646  Warning("ReadPedestalList()", "Format problem in line \n%s",
1647  line.Data());
1648  }
1649 
1650  line.ReadLine(fin);
1651 
1652  sscanf(line.Data(), "%s", filename_chio);
1653 
1654  line.ReadLine(fin);
1655 
1656  sscanf(line.Data(), "%s", filename_csi);
1657 
1658  TList RRList;
1659  KVDBRecord* dummy = 0;
1660  dummy =
1661  new KVDBRecord(filename_chio, "ChIo/Si/Etalons pedestals");
1662  dummy->AddKey("Runs", "Runs for which to use this pedestal file");
1663  fPedestals->AddRecord(dummy);
1664  RRList.Add(dummy);
1665  dummy = new KVDBRecord(filename_csi, "CsI pedestals");
1666  dummy->AddKey("Runs", "Runs for which to use this pedestal file");
1667  fPedestals->AddRecord(dummy);
1668  RRList.Add(dummy);
1669  LinkListToRunRanges(&RRList, 1, runlist);
1670  } // balise trouvee
1671  } // lecture du fichier
1672  fin.close();
1673  cout << "Pedestals Read" << endl;
1674 }
1675 
1676 
1677 
1678 
1685 
1687 {
1688  //Read CsI Light-Energy calibrations for Z=1 and Z>1
1689  //The parameter filenames are taken from the environment variables
1690  // [dataset name].INDRADB.CalibCsI.Z=1
1691  // [dataset name].INDRADB.CalibCsI.Z>1
1692  //These calibrations are valid for all runs
1695 }
1696 
1697 
1698 
1703 
1705 {
1706  //Read CsI Light-Energy calibrations for Z=1 (zrange="Z=1") or Z>1 (zrange="Z>1")
1707  //and add them to the KVDBTable whose pointer is given as 2nd argument.
1708  //These calibrations are valid for all runs
1709 
1710  ifstream fin;
1711  TString filename;
1712  filename.Form("CalibCsI.%s", zrange);
1713  if (!OpenCalibFile(filename.Data(), fin)) {
1714  Error("ReadLightEnergyCsI()", "Could not open file %s",
1715  GetCalibFileName(filename.Data()).Data());
1716  return;
1717  }
1718  Info("ReadLightEnergyCsI()",
1719  "Reading Light-Energy CsI calibration parameters (%s)...", zrange);
1720 
1721  //need description of INDRA geometry
1722  if (!gIndra) {
1724  }
1725  //gIndra exists, but has it been built ?
1726  if (!gIndra->IsBuilt())
1727  gIndra->Build();
1728 
1729  TString sline;
1730 
1731  KVDBParameterSet* parset;
1732  TList* par_list = new TList();
1733 
1734  Float_t a2, a1, a3, a4; // calibration parameters
1735  Int_t ring, mod;
1736 
1737  while (fin.good()) { //reading the file
1738  sline.ReadLine(fin);
1739  if (fin.good()) {
1740  if (!sline.BeginsWith("#")) { //skip comments
1741  if (sscanf
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",
1746  sline.Data());
1747  return;
1748  }
1749  else { //parameters correctly read
1750  KVCsI* csi =
1751  (KVCsI*) gIndra->GetDetectorByType(ring, mod, CsI_R);
1752  if (!csi) {
1753  Warning("ReadLightEnergyCsI()", "Read calibration for non-existent detector CSI_%02d%02d",
1754  ring, mod);
1755  }
1756  else {
1757  parset =
1758  new KVDBParameterSet(csi->GetName(), Form("Light-Energy CsI %s", zrange),
1759  4);
1760  parset->SetParameters(a1, a2, a3, a4);
1761  table->AddRecord(parset);
1762  par_list->Add(parset);
1763  }
1764  } //parameters correctly read
1765  } //data line
1766  } //if(fin.good
1767  } //reading the file
1768  fin.close();
1769 
1770  //these calibrators are valid for all runs
1771  LinkListToRunRange(par_list, GetRunList());
1772  par_list->Clear();
1773  delete par_list;
1774 }
1775 
1776 
1777 
1778 
1784 
1786  Double_t Q_apres_cible,
1787  Double_t Coul_par_top) const
1788 {
1789  // Returns calculated average cross-section [mb] per event for the runs in question.
1790  // It is assumed that all runs correspond to the same reaction,
1791  // with the same beam & target characteristics and multiplicity trigger.
1792  // The target thickness etc. are taken from the first run.
1793 
1794  runs.Begin();
1795  Int_t run1 = runs.Next();
1796  KVTarget* targ = GetRun(run1)->GetTarget();
1797  if (!targ) {
1798  Error("GetEventCrossSection", "No target for run %d", run1);
1799  return 0;
1800  }
1801  Double_t sum_xsec = 0;
1802  runs.Begin();
1803  while (!runs.End()) {
1804 
1805  int run = runs.Next();
1806  if (!GetRun(run))
1807  continue; //skip non-existent runs
1808  sum_xsec +=
1809  GetRun(run)->GetNIncidentIons(Q_apres_cible,
1810  Coul_par_top) * (1. - GetRun(run)->GetTempsMort());
1811  }
1812 
1813  //average X-section [mb] per event = 1e27 / (no. atoms in target * SUM(no. of projectile nuclei * (1 - TM)) )
1814  return (1.e27 / (targ->GetAtomsPerCM2() * sum_xsec));
1815 }
1816 
1817 
1818 
1819 
1824 
1826  Double_t Q_apres_cible,
1827  Double_t Coul_par_top) const
1828 {
1829  //Returns calculated total measured cross-section [mb] for the runs in question.
1830  //This is SUM (GetEventCrossSection(run1,run2) * SUM( events )
1831  //where SUM(events) is the total number of events measured in all the runs
1832  Int_t sum = 0;
1833  runs.Begin();
1834  while (!runs.End()) {
1835  int run = runs.Next();
1836  if (!GetRun(run))
1837  continue; //skip non-existent runs
1838  sum += GetRun(run)->GetEvents();
1839 
1840  }
1841  return sum * GetEventCrossSection(runs, Q_apres_cible,
1842  Coul_par_top);
1843 }
1844 
1845 
1846 
1847 
1851 
1853 {
1854  //Lit le fichier ou sont listés les détecteurs retirés au cours
1855  //de la manip
1856  TString fp;
1857  if (!KVBase::SearchKVFile(GetCalibFileName("AbsentDet"), fp, fDataSet.Data())) {
1858  Error("ReadAbsentDetectors", "Fichier %s, inconnu au bataillon", GetCalibFileName("AbsentDet").Data());
1859  return;
1860  }
1861  Info("ReadAbsentDetectors()", "Lecture des detecteurs absents...");
1862  fAbsentDet = AddTable("Absent Detectors", "Name of physically absent detectors");
1863 
1864  KVDBRecord* dbrec = 0;
1865  TEnv env;
1866  TEnvRec* rec = 0;
1867  env.ReadFile(fp.Data(), kEnvAll);
1868  TIter it(env.GetTable());
1869 
1870  while ((rec = (TEnvRec*)it.Next())) {
1871  KVString srec(rec->GetName());
1872  KVNumberList nl(rec->GetValue());
1873  cout << rec->GetValue() << endl;
1874  if (srec.Contains(",")) {
1875  srec.Begin(",");
1876  while (!srec.End()) {
1877  dbrec = new KVDBRecord(srec.Next(), "Absent Detector");
1878  dbrec->AddKey("Runs", "List of Runs");
1879  fAbsentDet->AddRecord(dbrec);
1880  LinkRecordToRunRange(dbrec, nl);
1881  }
1882  }
1883  else {
1884  dbrec = new KVDBRecord(rec->GetName(), "Absent Detector");
1885  dbrec->AddKey("Runs", "List of Runs");
1886  fAbsentDet->AddRecord(dbrec);
1887  LinkRecordToRunRange(dbrec, nl);
1888  }
1889  }
1890 
1891 }
1892 
1893 
1894 
1898 
1900 {
1901 
1902  //Lit le fichier ou sont listés les détecteurs ne marchant plus au cours
1903  //de la manip
1904  TString fp;
1905  if (!KVBase::SearchKVFile(GetCalibFileName("OoODet"), fp, fDataSet.Data())) {
1906  Error("ReadOoODetectors", "Fichier %s, inconnu au bataillon", GetCalibFileName("OoODet").Data());
1907  return;
1908  }
1909  Info("ReadOoODetectors()", "Lecture des detecteurs hors service ...");
1910  fOoODet = AddTable("OoO Detectors", "Name of out of order detectors");
1911 
1912  KVDBRecord* dbrec = 0;
1913  TEnv env;
1914  TEnvRec* rec = 0;
1915  env.ReadFile(fp.Data(), kEnvAll);
1916  TIter it(env.GetTable());
1917 
1918  while ((rec = (TEnvRec*)it.Next())) {
1919  KVString srec(rec->GetName());
1920  KVNumberList nl(rec->GetValue());
1921  cout << rec->GetValue() << endl;
1922  if (srec.Contains(",")) {
1923  srec.Begin(",");
1924  while (!srec.End()) {
1925  dbrec = new KVDBRecord(srec.Next(), "OoO Detector");
1926  dbrec->AddKey("Runs", "List of Runs");
1927  fOoODet->AddRecord(dbrec);
1928  LinkRecordToRunRange(dbrec, nl);
1929  }
1930  }
1931  else {
1932  dbrec = new KVDBRecord(rec->GetName(), "OoO Detector");
1933  dbrec->AddKey("Runs", "List of Runs");
1934  fOoODet->AddRecord(dbrec);
1935  LinkRecordToRunRange(dbrec, nl);
1936  }
1937  }
1938 
1939 }
1940 
1941 
1942 
1946 
1948 {
1949 
1950  //Lit le fichier ou sont listés les parametres d acquisition ne marchant plus au cours
1951  //de la manip
1952  TString fp;
1953  if (!KVBase::SearchKVFile(GetCalibFileName("OoOACQPar"), fp, fDataSet.Data())) {
1954  Error("ReadNotWorkingACQParams", "Fichier %s, inconnu au bataillon", GetCalibFileName("OoOACQPar").Data());
1955  return;
1956  }
1957  Info("ReadNotWorkingACQParams()", "Lecture des parametres d acq hors service ...");
1958  fOoOACQPar = AddTable("OoO ACQPars", "Name of not working acq parameters");
1959 
1960  KVDBRecord* dbrec = 0;
1961  TEnv env;
1962  TEnvRec* rec = 0;
1963  env.ReadFile(fp.Data(), kEnvAll);
1964  TIter it(env.GetTable());
1965 
1966  while ((rec = (TEnvRec*)it.Next())) {
1967  KVString srec(rec->GetName());
1968  KVNumberList nl(rec->GetValue());
1969  cout << rec->GetValue() << endl;
1970  if (srec.Contains(",")) {
1971  srec.Begin(",");
1972  while (!srec.End()) {
1973  dbrec = new KVDBRecord(srec.Next(), "OoO ACQPar");
1974  dbrec->AddKey("Runs", "List of Runs");
1975  fOoOACQPar->AddRecord(dbrec);
1976  LinkRecordToRunRange(dbrec, nl);
1977  }
1978  }
1979  else {
1980  dbrec = new KVDBRecord(rec->GetName(), "OoO ACQPar");
1981  dbrec->AddKey("Runs", "List of Runs");
1982  fOoOACQPar->AddRecord(dbrec);
1983  LinkRecordToRunRange(dbrec, nl);
1984  }
1985  }
1986 
1987 }
1988 
1989 
1990 
int Int_t
unsigned int UInt_t
#define PEAK_THORON_2
Definition: KVDBAlphaPeak.h:24
#define PEAK_THORON_1
Definition: KVDBAlphaPeak.h:23
KVINDRADB * gIndraDB
Definition: KVINDRADB.cpp:38
#define MAX_NUM_RUN_RANGES
dimension of run_range arrays
Definition: KVINDRADB.h:34
KVINDRA * gIndra
Definition: KVINDRA.cpp:78
@ Si_PG
Definition: KVINDRA.h:47
@ ChIo_PG
Definition: KVINDRA.h:44
@ ChIo_T
Definition: KVINDRA.h:45
@ ChIo_GG
Definition: KVINDRA.h:43
@ CsI_R
Definition: KVINDRA.h:49
@ Si_GG
Definition: KVINDRA.h:46
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define SafeDelete(p)
char Char_t
const Bool_t kFALSE
bool Bool_t
double Double_t
float Float_t
const Bool_t kTRUE
kEnvAll
char * Form(const char *fmt,...)
static const Char_t * GetDataSetEnv(const Char_t *dataset, const Char_t *type, const Char_t *defval)
Definition: KVBase.cpp:1582
static Bool_t SearchAndOpenKVFile(const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
Definition: KVBase.cpp:601
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:541
CsI(Tl) scintillation detectors of the INDRA multidetector array.
Definition: KVCsI.h:15
Wrapper for KVDBPeak describing alpha (thoron) peaks for calibration.
Definition: KVDBAlphaPeak.h:34
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.
Definition: KVDBPeak.h:34
void SetSigType(const Char_t *sig)
Definition: KVDBPeak.h:74
void SetGain(Float_t gain)
Definition: KVDBPeak.h:83
Float_t GetEnergy() const
Definition: KVDBPeak.h:96
void SetRing(UChar_t ring)
Definition: KVDBPeak.h:101
void SetModule(UChar_t mod)
Definition: KVDBPeak.h:110
void SetEnergy(Float_t e)
Definition: KVDBPeak.h:92
void SetGas(Bool_t avec=kTRUE)
Definition: KVDBPeak.h:56
Record folder for the database.
Definition: KVDBRecord.h:42
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:72
Description of an experimental run in database ,.
Definition: KVDBRun.h:35
void SetEvents(ULong64_t evt_number)
Definition: KVDBRun.h:169
void SetTime(Double_t time)
Definition: KVDBRun.h:173
ULong64_t GetEvents() const
Definition: KVDBRun.h:133
void SetSize(Double_t s)
Definition: KVDBRun.h:177
KVTarget * GetTarget() const
Return target used for this run (actually target of KVDBSystem associated to run)
Definition: KVDBRun.h:164
void SetComments(const KVString &comments)
Definition: KVDBRun.h:181
KVDBSystem * GetSystem() const
Definition: KVDBRun.cpp:242
void SetStartDate(const KVString &date)
Definition: KVDBRun.h:185
void SetEndDate(const KVString &d)
Definition: KVDBRun.h:193
Int_t GetTrigger() const
Definition: KVDBRun.h:103
void SetTrigger(Int_t trig)
Definition: KVDBRun.h:98
virtual void ReadRunListLine(const KVString &)
Definition: KVDBRun.cpp:143
virtual Int_t GetScaler(const Char_t *name) const
Get value of scaler with the given name for this run.
Definition: KVDBRun.h:214
virtual void SetScaler(const Char_t *name, Int_t val)
Set value for the scaler with the given name for this run.
Definition: KVDBRun.h:208
Database class used to store information on different colliding systems studied during an experiment.
Definition: KVDBSystem.h:51
KVTarget * GetTarget() const
Definition: KVDBSystem.h:78
Float_t GetEbeam() const
Definition: KVDBSystem.h:196
KVList * GetRuns() const
Returns a sorted list of all the runs associated with this system.
Definition: KVDBSystem.h:116
UInt_t GetZbeam() const
Definition: KVDBSystem.h:176
UInt_t GetAbeam() const
Definition: KVDBSystem.h:181
Table in a database.
Definition: KVDBTable.h:33
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:24
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:158
virtual Bool_t AddTable(KVDBTable *table)
Definition: KVDataBase.cpp:84
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Base class to describe database of an experiment ,.
Definition: KVExpDB.h:18
virtual KVDBSystem * GetSystem(const Char_t *system) const
Definition: KVExpDB.h:83
virtual void ReadSystemList()
Definition: KVExpDB.cpp:248
virtual void cd()
Definition: KVExpDB.cpp:547
void AddRun(KVDBRun *r)
Definition: KVExpDB.h:65
virtual KVSeqCollection * GetRuns() const
Definition: KVExpDB.h:70
TString GetCalibFileName(const Char_t *type) const
Definition: KVExpDB.h:107
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:163
const KVNumberList & GetRunList() const
Definition: KVExpDB.h:78
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:199
const Char_t * GetDataSetDir() const
Definition: KVExpDB.h:134
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
Definition: KVExpDB.cpp:86
virtual TString GetDBEnv(const Char_t *) const
Definition: KVExpDB.cpp:650
Bool_t OpenCalibFile(const Char_t *type, std::ifstream &fs) const
Definition: KVExpDB.cpp:432
TString fDataSet
the name of the dataset to which this database is associated
Definition: KVExpDB.h:21
Database entry for each run of an INDRA experiment.
Definition: KVINDRADBRun.h:29
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)
Definition: KVINDRADBRun.h:63
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
DataBase of parameters for an INDRA campaign.
Definition: KVINDRADB.h:58
KVDBTable * fOoODet
(optional) Liste les detecteurs hors service
Definition: KVINDRADB.h:78
void CloseCalibrationPeakFile()
Close file containing database of calibration peaks.
Definition: KVINDRADB.cpp:406
virtual void cd()
Definition: KVINDRADB.cpp:105
virtual void ReadObjects(TFile *)
Read associated objects (i.e. KVINDRAPulserDataTree's TTree) from file.
Definition: KVINDRADB.cpp:1160
void AddTape(KVDBTape *r)
Definition: KVINDRADB.h:118
KVDBTable * fChanVolt
ChIo/Si channel-volt calibration parameters.
Definition: KVINDRADB.h:73
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:62
virtual void GoodRunLine()
Definition: KVINDRADB.cpp:989
KVDBTable * fLitEnerCsI
CsI light-energy calibration for Z>1.
Definition: KVINDRADB.h:75
virtual void ReadOoOACQParams()
Definition: KVINDRADB.cpp:1947
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:1343
KVDBTable * fAbsentDet
(optional) Liste les detecteurs absents
Definition: KVINDRADB.h:77
void ReadNewRunList()
Read new-style runlist (written using KVDBRun v.10 or later)
Definition: KVINDRADB.cpp:947
std::ifstream & GetPeakFileStream()
Definition: KVINDRADB.h:100
Bool_t OpenCalibrationPeakFile()
calibration peaks database
Definition: KVINDRADB.cpp:384
virtual void ReadPedestalList()
Definition: KVINDRADB.cpp:1615
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:71
virtual void WriteObjects(TFile *)
Write associated objects (i.e. KVINDRAPulserDataTree's TTree) in file.
Definition: KVINDRADB.cpp:1148
KVDBTable * fOoOACQPar
(optional) Liste des parametres d acquisition ne marchant pas
Definition: KVINDRADB.h:79
KVINDRAPulserDataTree * fPulserData
mean values of pulsers for all detectors & runs
Definition: KVINDRADB.h:81
virtual void ReadVoltEnergyChIoSi()
Definition: KVINDRADB.cpp:1526
virtual void ReadOoODetectors()
Definition: KVINDRADB.cpp:1899
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:122
TF1 * fMeanGDir
mean frequency of GENE_DIRECT vs. run number
Definition: KVINDRADB.h:103
void init()
Definition: KVINDRADB.cpp:49
virtual void ReadCsITotalLightGainCorrections()
Definition: KVINDRADB.cpp:1231
KVDBTable * fPedestals
table of pedestal files
Definition: KVINDRADB.h:72
KVDBTable * fVoltMeVChIoSi
ChIo/Si volt-energy calibration.
Definition: KVINDRADB.h:74
KVDBTable * fGains
(optional) table of detector gains, in case they change from run to run
Definition: KVINDRADB.h:69
virtual void ReadLightEnergyCsI(const Char_t *, KVDBTable *)
Definition: KVINDRADB.cpp:1704
virtual void ReadAbsentDetectors()
Definition: KVINDRADB.cpp:1852
virtual void ReadChIoPressures()
Definition: KVINDRADB.cpp:538
virtual Double_t GetRunLengthFromGeneDirect(int run) const
Definition: KVINDRADB.cpp:1174
Double_t GetMeanGDirFreq(Int_t run) const
Definition: KVINDRADB.cpp:874
KVINDRADBRun * GetRun(Int_t run) const
Definition: KVINDRADB.h:132
virtual void ReadCalibCsI()
Definition: KVINDRADB.cpp:1686
KVDBTable * fLitEnerCsIZ1
CsI light-energy calibration for Z=1.
Definition: KVINDRADB.h:76
virtual void Build()
Definition: KVINDRADB.cpp:893
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.
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)
Definition: KVINDRA.cpp:380
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:74
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
Definition: KVINDRA.cpp:651
Extended TList class which owns its objects by default.
Definition: KVList.h:27
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.
Definition: KVNumberList.h:83
Bool_t End(void) const
Definition: KVNumberList.h:196
void Begin(void) const
Int_t Next(void) const
Wrapper for TRefArray adding some functionality.
Definition: KVRList.h:36
Base class for reading runlists for experiments ,.
Definition: KVRunListLine.h:25
Bool_t HasFieldValue(const Char_t *) const
Float_t GetFloatField(const Char_t *)
virtual void Print() const
void SetRunKeys()
Definition: KVRunListLine.h:43
void SetFieldKeys()
Definition: KVRunListLine.h:39
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....
Definition: KVString.h:72
void Begin(TString delim) const
Definition: KVString.cpp:562
Bool_t End() const
Definition: KVString.cpp:625
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:675
Handles directories stored in .tgz archive files.
Definition: KVTarArchive.h:21
Bool_t IsOK() const
Definition: KVTarArchive.h:36
Calculation/correction of energy losses of particles through an experimental target.
Definition: KVTarget.h:126
Double_t GetAtomsPerCM2() const
virtual UInt_t GetUnits() const;
Definition: KVTarget.cpp:932
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
TObject * Next()
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
Double_t Atof() 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)
TLine * line
const Double_t sigma
Double_t Abs(Double_t d)
Double_t Range(Double_t lb, Double_t ub, Double_t x)
const char * String