20 #include "KVDataSet.h"
21 #include "KVMaterial.h"
22 #include "KVDetector.h"
23 #include "KVIDTelescope.h"
24 #include "KVIDSiCsI.h"
25 #include "KVIDINDRACsI.h"
26 #include "KVIDChIoSi.h"
27 #include "KVIDChIoCsI.h"
28 #include "KVIDChIoSi75.h"
29 #include "KVIDSi75SiLi.h"
30 #include "KVIDPhoswich.h"
34 #include "KVDetectorEvent.h"
36 #include "INDRAGeometryBuilder.h"
37 #include "KVGeoNavigator.h"
38 #include "KVGeoImportINDRA.h"
39 #ifdef WITH_BUILTIN_GRU
40 #include <KVGANILDataReader.h>
42 #include <KVDBChIoPressures.h>
43 #include <KVGeoImport.h>
44 #include <KVRangeTableGeoNavigator.h>
45 #include <KVRawDataReader.h>
47 #include "KVMFMDataFileReader.h"
48 #include "MFMEbyedatFrame.h"
50 #include "MFMMesytecMDPPFrame.h"
51 #include "mesytec_buffer_reader.h"
54 #include "KVGeoImportINDRA.h"
55 #include "KVINDRAGroupReconstructor.h"
89 fChIo.SetCleanup(
kTRUE);
90 fSi.SetCleanup(
kTRUE);
91 fCsI.SetCleanup(
kTRUE);
92 fPhoswich.SetCleanup(
kTRUE);
110 if (gIndra ==
this) gIndra =
nullptr;
128 if (fCloseGeometryNow) {
129 PerformClosedROOTGeometryOperations();
146 TIter next_det(GetDetectors());
194 return (KVLayer*)GetStructure(
"LAYER",
"CHIO");
271 if (
type >= Phos_R &&
type <= Phos_T) {
272 sprintf(nom_det,
"PHOS_%02d", mod);
279 else if (
type >= ChIo_GG &&
type <= ChIo_T) {
280 sprintf(nom_det,
"CI_%02d%02d", cou, mod);
284 else if (
type >= Si_GG &&
type <= Si_T) {
285 sprintf(nom_det,
"SI_%02d%02d", cou, mod);
289 else if (
type >= SiLi_GG &&
type <= SiLi_T) {
290 sprintf(nom_det,
"SILI_%02d", cou);
294 else if (
type >= Si75_GG &&
type <= Si75_T) {
295 sprintf(nom_det,
"SI75_%02d", cou);
299 else if (
type >= CsI_R &&
type <= CsI_T) {
300 sprintf(nom_det,
"CSI_%02d%02d", cou, mod);
320 TIter it(GetListOfIDTelescopes());
322 const TString etalon_numbers[] = {
"1002",
"1102",
"1202",
"1304",
"1403",
"1503",
"1602",
"1702"};
329 if (de_type ==
"PHOS") {
333 else if(de_type ==
"SI")
341 auto csi_id_name_fmt = KVBase::GetDataSetEnv<TString>(fDataSet,
"INDRA.CSI.IDTelescopeNameFormat",
"CSI_%s");
344 if (csi_id_name_fmt.Contains(
"R_L")) {
356 if (e_type ==
"SILI" || e_type ==
"SI75") {
364 dynamic_cast<KVHashList*
>(GetListOfIDTelescopes())->Rehash();
383 fIGB->CheckImportResults(GetDetectors());
385 FillListsOfDetectorsByType();
387 SetNamesOfIDTelescopes();
389 SetIdentifications();
394 SetPinLasersForCsI();
396 SetExpectedDetectorSignalNames();
399 TIter next_det(GetDetectors());
404 fEbyedatParamDetMap.SetValue(det_name +
"_PG", det_name);
405 fEbyedatParamDetMap.SetValue(det_name +
"_GG", det_name);
408 fEbyedatParamDetMap.SetValue(det_name +
"_R", det_name);
409 fEbyedatParamDetMap.SetValue(det_name +
"_L", det_name);
413 time_marker_type.Prepend(
"_");
414 fEbyedatParamDetMap.SetValue(det_name + time_marker_type, det_name);
428 if (fEbyedatParamDetMap.HasParameter(param_name)) {
429 det = GetDetector(fEbyedatParamDetMap.GetStringValue(param_name));
432 std::string lab(param_name);
433 sig_type = lab.substr(lab.rfind(
'_') + 1);
436 sig_type = param_name;
438 add_and_set_detector_signal(det, detname, val, sig_type);
460 if (fMesytecData) fReconParameters.SetValue(
"INDRA.MESYTEC",
kTRUE);
461 else if (fEbyedatData) fReconParameters.SetValue(
"INDRA.EBYEDAT",
kTRUE);
517 if (!db->
FindCalibFile(
"Pressures", fullpath,
"INDRA"))
return;
518 Info(
"ReadChIoPressures()",
"Reading INDRA ChIo pressures used during runs...");
520 auto pressure_table = db->
AddTable(
"INDRA.ChIo Pressures",
"INDRA ChIo gas pressures");
522 KVString the_chios[] = {
"CI_02",
"CI_04",
"CI_06",
"CI_08",
"CI_13"};
527 pressure_sets.
Begin(
" ");
528 while (!pressure_sets.
End()) {
529 auto pressure_set = pressure_sets.
Next();
531 auto units = KVUnits::mbar;
533 units = KVUnits::torr;
540 for (
auto& chio : the_chios) {
542 if ((P = env.
GetValue(
Form(
"%s.%s", pressure_set.Data(), chio.Data()), 0.0)) > 0.0) {
547 pressure_table->AddRecord(dbp);
573 TIter next_ps(param_list);
574 auto chios = GetListOfChIo();
576 Error(
"SetChIoPressures",
577 "GetListOfChIo() returns null list pointer");
580 cout <<
"--> Setting ChIo pressures" << endl;
581 TIter next_chio(chios);
584 cout <<
" Ring 2/3: " << kvps->
585 GetPressure(CHIO_2_3) / KVUnits::mbar <<
" mbar" << endl;
587 cout <<
" Ring 4/5: " << kvps->
588 GetPressure(CHIO_4_5) / KVUnits::mbar <<
" mbar" << endl;
590 cout <<
" Ring 6/7: " << kvps->
591 GetPressure(CHIO_6_7) / KVUnits::mbar <<
" mbar" << endl;
593 cout <<
" Ring 8/12: " << kvps->
594 GetPressure(CHIO_8_12) / KVUnits::mbar <<
" mbar" << endl;
596 cout <<
" Ring 13/17: " << kvps->
597 GetPressure(CHIO_13_17) / KVUnits::mbar <<
" mbar" << endl;
598 while ((kvd = (
KVChIo*) next_chio())) {
599 if (!strcmp(kvd->
GetType(),
"CI")) {
632 SetChIoPressures(dbr);
644 fIGB->Build(
kFALSE, fCloseGeometryNow);
647 SetTitle(fIGB->GetTitle());
651 #ifdef WITH_BUILTIN_GRU
662 fEbyedatData =
kTRUE;
667 handle_ebyedat_raw_data_parameter(eby_par->
GetName(), eby_par->
GetData());
710 fEbyedatData =
kTRUE;
715 for (
int i = 0; i <
f.GetNbItems(); ++i) {
716 f.GetDataItem(i, lab, val);
717 handle_ebyedat_raw_data_parameter(lab.c_str(), val);
721 if (ts != 0) fReconParameters.SetValue64bit(
"INDRA.TS", ts);
723 if (en != 0) fReconParameters.SetValue64bit(
"INDRA.EN", en);
724 int npars = fReconParameters.GetNpar();
725 std::vector<TString> names;
726 for (
int i = 0; i < npars; ++i) {
727 TString name = fReconParameters.GetParameter(i)->GetName();
728 if (
name.EndsWith(
"_UP")) names.push_back(
name);
731 for (std::vector<TString>::iterator it = names.begin(); it != names.end(); ++it) {
735 ULong64_t par_up = fReconParameters.GetIntValue(name_up);
737 UInt_t par32 = (par_up << 16) + par;
738 fReconParameters.RemoveParameter(name_up);
739 fReconParameters.RemoveParameter(
name);
740 fReconParameters.SetValue64bit(
name, par32);
763 else if (idt->
IsType(
"SI75_SILI")) idt->
SetIDCode(IDCodes::ID_SI75_SILI);
764 else if (idt->
IsType(
"SILI_CSI")) idt->
SetIDCode(IDCodes::ID_SILI_CSI);
766 Error(
"SetIDCodeForIDTelescope",
"Request for telescope name=%s of unknown class=%s",
838 Info(
"SetPinLasersForCsI",
"Setting correspondance CsI-PinLaser using file %s.",
842 line.ReadLine(pila_file);
843 while (pila_file.good()) {
844 if (!
line.BeginsWith(
"#")) {
853 line.ReadLine(pila_file);
875 if (((fired_dets && fired_dets->
GetEntries()) || fFiredDetectors.GetEntries())
876 && (GetTriggerInfo() && !GetTriggerInfo()->IsINDRAEvent()))
return;
909 if (GetGroup(
g->GetName())) {
911 if (
g->GetDetectorByType(
"SILI") ||
g->GetDetectorByType(
"SI75")) {
920 if (
id->GetRingNumber() < 10) {
941 if (GetReconParameters().HasValue64bit(
"INDRA.EN"))
e->SetNumber(GetReconParameters().GetValue64bit(
"INDRA.EN"));
959 if (!
l.GetBoolValue(
"INDRA.MESYTEC") && !
l.GetBoolValue(
"INDRA.EBYEDAT")) {
962 fEbyedatData =
kTRUE;
963 prepare_to_handle_new_raw_data();
966 for (
int i = 0; i <
N; ++i) {
970 if (
name.BeginsWith(
"ACQPAR")) {
972 int dots =
name.GetNValues(
".");
976 if (
name.Next() !=
"INDRA")
continue;
977 std::string parname(
name.Next());
981 if (parname.find(
'_') !=
kNPOS) {
983 detname = parname.substr(0, parname.rfind(
'_'));
984 sig_type = parname.substr(parname.rfind(
'_') + 1);
985 det = GetDetector(detname);
990 add_and_set_detector_signal(det, detname,
np->GetDouble(), sig_type);
995 fMesytecData =
l.GetBoolValue(
"INDRA.MESYTEC");
996 fEbyedatData =
l.GetBoolValue(
"INDRA.EBYEDAT");
1012 if (!db->
InheritsFrom(
"KVINDRADB")) ReadChIoPressures(db);
1086 if (
r->GetDataFormat() ==
"MFM") {
1091 throw std::runtime_error(
Form(
"in <KVINDRA::InitialiseRawDataReading>: Mesytec crate map file %s not found in dataset directory %s",
1094 Info(
"InitialiseRawDataReading",
"Setting Mesytec crate config for run %d, raw run number=%d",
1095 GetCurrentRunNumber(),
r->GetRunNumberReadFromFile());
1097 auto raw_run_number =
r->GetRunNumberReadFromFile()>0 ?
r->GetRunNumberReadFromFile() : GetCurrentRunNumber();
1098 auto channel_conf_list = gDataSet->
GetDataSetEnv<
TString>(
"MesytecChannelsConfList",
"mesytec_conf_list.dat");
1106 while (!files.
End()) {
1109 if (runlist.
Contains(raw_run_number)) {
1112 throw std::runtime_error(
Form(
"in <KVINDRA::InitialiseRawDataReading>: Mesytec detector-channel correspondence file %s not found in dataset directory %s",
1115 Info(
"InitialiseRawDataReading",
"Using file %s for raw run number %d",
1116 next_file.
Data(), raw_run_number);
1127 auto conf = gDataSet->
GetDataSetEnv<
TString>(
"MesytecChannelsConf",
"mesytec_detector_correspondence.dat");
1130 throw std::runtime_error(
Form(
"in <KVINDRA::InitialiseRawDataReading>: Mesytec detector-channel correspondence file %s not found in dataset directory %s",
1132 Info(
"InitialiseRawDataReading",
"Using file %s for raw run number %d",
1133 conf.Data(), raw_run_number);
1162 if (!fMesytecData) {
1164 mesytec::module::set_data_type_alias(
"qdc_long",
"TotLight");
1165 mesytec::module::set_data_type_alias(
"qdc_short",
"R");
1166 mesytec::module::set_data_type_alias(
"tdc",
"T");
1167 mesytec::module::set_data_type_alias(
"adc",
"ADC");
1169 fMesytecData =
kTRUE;
1171 fReconParameters.SetValue64bit(
"INDRA.TS",
f.GetTimeStamp());
1174 (
const uint8_t*)
f.GetPointUserData(),
f.GetBlobSize(),
1175 [ = ](
const mesytec::event & evt,
const mesytec::experimental_setup & setup) {
1178 for (
auto& mdat : evt.get_module_data()) {
1179 auto mod_id = mdat.get_module_id();
1180 auto& current_module = setup.get_module(mod_id);
1181 if (current_module.is_mdpp_module()) {
1183 for (
auto& voie : mdat.get_channel_data()) {
1184 KVString detname(setup.get_detector(mod_id, voie.get_channel_number()));
1185 KVString sig_type(current_module.get_data_type_name(voie.get_data_type()));
1186 Double_t sig_data = voie.get_data();
1188 if(voie.get_data_type()==mesytec::module::datatype_t::TDC)
1190 sig_data *= current_module.get_tdc_resolution();
1192 add_and_set_detector_signal(GetDetector(detname), detname, sig_data, sig_type);
1193 if(voie.has_trace())
1196 add_and_set_detector_signal_trace(GetDetector(detname), voie.get_trace(), 12.5);
1200 else if (current_module.is_mvlc_scaler()) {
1204 if (mdat.get_channel_data().size() == 4) {
1207 for (
auto&
d : mdat.get_channel_data())
x += ((uint64_t)
d.get_data_word()) << (16 * (i++));
1208 fReconParameters.SetValue64bit(current_module.name.c_str(),
x);
1259 Error(
"SetDetectorThicknesses",
"Problem opening file %s", fullpath.
Data());
1262 Info(
"SetDetectorThicknesses",
"Reading thicknesses of detectors from file %s", fullpath.
Data());
1269 Warning(
"SetDetectorThicknesses",
"Non-numeric value %s given for thickness of detector %s : no change",
1273 if (
TString(
rec->GetName()).BeginsWith(
"SI"))
1274 fIGB->SetDetectorThickness(
rec->GetName(), val.
Atof()*KVUnits::um);
1276 fIGB->SetDetectorThickness(
rec->GetName(), val.
Atof());
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 np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
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 g
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
Build INDRA geometry from Huguet CAO infos.
virtual const Char_t * GetType() const
virtual Bool_t IsType(const Char_t *typ) const
virtual void SetType(const Char_t *str)
Ionisation chamber detectors of the INDRA multidetector array.
Double_t GetPressure() const override
void SetPressure(Double_t P) override
CsI(Tl) scintillation detectors of the INDRA multidetector array.
void SetPinLaser(Int_t n)
CHIO pressure parameters.
virtual void SetPressure(UInt_t n, Float_t pressure)
virtual Float_t GetPressure(UInt_t chio_number)
virtual KVRList * GetLinks(const Char_t *key) const
Returns the list of records linked to this record in table "key".
Description of an experimental run in database ,,.
virtual Bool_t AddTable(KVDBTable *table)
TString GetFullPathToDataSetFile(const Char_t *filename) const
const Char_t * GetDataSetDir() const
Bool_t OpenDataSetFile(const Char_t *filename, std::ifstream &file)
ValType GetDataSetEnv(const Char_t *type, const ValType &defval={}) const
static Bool_t FindDataSetFile(const TString &dataset, const Char_t *filename)
List of hit groups in a multidetector array.
Base class for detector geometry description, interface to energy-loss calculations.
void SetNameOfArray(const TString &n)
void SetDetecting(Bool_t yes=kTRUE)
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
Base class to describe database of an experiment ,,.
const KVNumberList & GetRunList() const
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
Bool_t FindCalibFile(const Char_t *type, TString &fullpath, const TString &array_name="") const
Reads GANIL acquisition files (EBYEDAT)
const KVSeqCollection & GetFiredDataParameters() const
Specialised geometry importer for INDRA.
void ImportGeometry(std::vector< INDRAGeometryBuilder::theta_phi >)
Use the known (theta,phi) positions of the centre of each CsI/phoswich in order to scan the array.
void SetNameCorrespondanceList(const Char_t *)
Base class for particle reconstruction in one group of a detector array.
static KVGroupReconstructor * Factory(const TString &plugin="", const KVGroup *g=nullptr)
Group of detectors which can be treated independently of all others in array.
Extended version of ROOT THashList.
Base class for all detectors or associations of detectors in array which can identify charged particl...
KVDetector * GetDetector(UInt_t n) const
virtual void SetIDCode(UShort_t c)
Base class for detectors of INDRA array.
UInt_t GetRingNumber() const
KVINDRADetector * GetChIo() const
static TString CSI_ID_TYPE
INDRA multidetector array geometry.
void Build(Int_t run=-1) override
Correspondance between CsI detectors and pin lasers is set up if known.
KVGroupReconstructor * GetReconstructorForGroup(const KVGroup *) const override
virtual KVChIo * GetChIoOf(const Char_t *detname)
void handle_ebyedat_raw_data_parameter(const char *param_name, uint16_t val)
void SetDetectorParametersForRun(KVDBRun *, const TString &="") override
Override base method in order to set ChIo pressures (if defined)
void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *fired_dets=0) override
void SetPinLasersForCsI()
void copy_fired_parameters_to_recon_param_list() override
void SetChIoPressures(KVDBRun *)
static Char_t SignalTypes[16][3]
Use this static array to translate EBaseIndra_type signal type to a string giving the signal type.
void FillListsOfDetectorsByType()
Fill lists of ChIo, Si, CsI and phoswich.
TString GetCsIIDType() const
void SetReconParametersInEvent(KVReconstructedEvent *) const override
If "INDRA.EN" parameter has been set, we use it to set the event number.
void PerformClosedROOTGeometryOperations() override
void SetTrigger(UChar_t trig)
void SetRawDataFromReconEvent(KVNameValueList &) override
void MakeCalibrationTables(KVExpDB *) override
Override base method in order to read ChIo pressures for each run.
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
void SetNamesOfIDTelescopes() const
void SetIDCodeForIDTelescope(KVIDTelescope *) const override
Set the INDRA-specific general identification code for the given telescope.
void ReadChIoPressures(KVExpDB *)
Bool_t handle_raw_data_event_mfmframe_mesytec_mdpp(const MFMMesytecFrame &) override
void InitialiseRawDataReading(KVRawDataReader *) override
void set_detector_thicknesses(const TString &) override
Bool_t handle_raw_data_event_mfmframe_ebyedat(const MFMEbyedatFrame &) override
Bool_t handle_raw_data_event_ebyedat(KVGANILDataReader &) override
Read MFM format acquisition data.
mesytec::buffer_reader & GetMesytecBufferReader() const
static KVIonRangeTable * GetRangeTable()
virtual void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *fired_params=0)
virtual void InitialiseRawDataReading(KVRawDataReader *)
virtual void SetDetectorParametersForRun(KVDBRun *, const TString &="")
virtual void copy_fired_parameters_to_recon_param_list()
virtual void MakeCalibrationTables(KVExpDB *)
virtual void SetRawDataFromReconEvent(KVNameValueList &)
virtual void SetReconParametersInEvent(KVReconstructedEvent *) const
Copy any parameters in fReconParameters in to the reconstructed event parameter list.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
A generic named parameter storing values of different types.
Strings used to represent a set of ranges of values.
Bool_t Contains(Int_t val) const
returns kTRUE if the value 'val' is contained in the ranges defined by the number list
Wrapper for TRefArray adding some functionality.
Abstract base class for reading raw (DAQ) data.
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
virtual Int_t GetEntries() const
THashList * GetTable() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
const char * GetName() const override
virtual void SetName(const char *name)
TClass * IsA() const override
virtual TObject * FindObject(const char *name) const
virtual Bool_t InheritsFrom(const char *classname) const
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
unsigned long long ULong64_t