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());
148 while ((kvd = (KVDetector*) next_det())) {
149 kvd->SetNameOfArray(
"INDRA");
150 if (kvd->InheritsFrom(
"KVChIo")) {
153 if (kvd->InheritsFrom(
"KVSilicon")) {
156 if (kvd->InheritsFrom(
"KVCsI")) {
159 if (kvd->InheritsFrom(
"KVPhoswich")) {
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") {
339 if (csi_id_name_fmt.
Contains(
"R_L")) {
351 if (e_type ==
"SILI" || e_type ==
"SI75") {
359 dynamic_cast<KVHashList*
>(GetListOfIDTelescopes())->Rehash();
378 fIGB->CheckImportResults(GetDetectors());
380 FillListsOfDetectorsByType();
382 SetNamesOfIDTelescopes();
384 SetIdentifications();
389 SetPinLasersForCsI();
391 SetExpectedDetectorSignalNames();
394 TIter next_det(GetDetectors());
396 while ((det = (KVDetector*)next_det())) {
397 TString det_name(det->GetName());
399 fEbyedatParamDetMap.SetValue(det_name +
"_PG", det_name);
400 fEbyedatParamDetMap.SetValue(det_name +
"_GG", det_name);
403 fEbyedatParamDetMap.SetValue(det_name +
"_R", det_name);
404 fEbyedatParamDetMap.SetValue(det_name +
"_L", det_name);
409 fEbyedatParamDetMap.SetValue(det_name + time_marker_type, det_name);
420 KVDetector* det =
nullptr;
423 if (fEbyedatParamDetMap.HasParameter(param_name)) {
424 det = GetDetector(fEbyedatParamDetMap.GetStringValue(param_name));
425 detname = det->GetName();
427 std::string lab(param_name);
428 sig_type = lab.substr(lab.rfind(
'_') + 1);
431 sig_type = param_name;
433 add_and_set_detector_signal(det, detname, val, sig_type);
455 if (fMesytecData) fReconParameters.SetValue(
"INDRA.MESYTEC",
kTRUE);
456 else if (fEbyedatData) fReconParameters.SetValue(
"INDRA.EBYEDAT",
kTRUE);
512 if (!db->
FindCalibFile(
"Pressures", fullpath,
"INDRA"))
return;
513 Info(
"ReadChIoPressures()",
"Reading INDRA ChIo pressures used during runs...");
515 auto pressure_table = db->
AddTable(
"INDRA.ChIo Pressures",
"INDRA ChIo gas pressures");
517 KVString the_chios[] = {
"CI_02",
"CI_04",
"CI_06",
"CI_08",
"CI_13"};
522 pressure_sets.
Begin(
" ");
523 while (!pressure_sets.
End()) {
524 auto pressure_set = pressure_sets.
Next();
535 for (
auto& chio : the_chios) {
537 if ((P = env.
GetValue(
Form(
"%s.%s", pressure_set.Data(), chio.Data()), 0.0)) > 0.0) {
542 pressure_table->AddRecord(dbp);
568 TIter next_ps(param_list);
569 auto chios = GetListOfChIo();
571 Error(
"SetChIoPressures",
572 "GetListOfChIo() returns null list pointer");
575 cout <<
"--> Setting ChIo pressures" << endl;
576 TIter next_chio(chios);
579 cout <<
" Ring 2/3: " << kvps->
582 cout <<
" Ring 4/5: " << kvps->
585 cout <<
" Ring 6/7: " << kvps->
588 cout <<
" Ring 8/12: " << kvps->
591 cout <<
" Ring 13/17: " << kvps->
593 while ((kvd = (
KVChIo*) next_chio())) {
594 if (!strcmp(kvd->GetType(),
"CI")) {
607 kvd->SetDetecting(
kFALSE);
610 kvd->SetDetecting(
kTRUE);
627 SetChIoPressures(dbr);
639 fIGB->Build(
kFALSE, fCloseGeometryNow);
642 SetTitle(fIGB->GetTitle());
646 #ifdef WITH_BUILTIN_GRU
657 fEbyedatData =
kTRUE;
662 handle_ebyedat_raw_data_parameter(eby_par->
GetName(), eby_par->
GetData());
705 fEbyedatData =
kTRUE;
710 for (
int i = 0; i <
f.GetNbItems(); ++i) {
711 f.GetDataItem(i, lab, val);
712 handle_ebyedat_raw_data_parameter(lab.c_str(), val);
716 if (ts != 0) fReconParameters.SetValue64bit(
"INDRA.TS", ts);
718 if (en != 0) fReconParameters.SetValue64bit(
"INDRA.EN", en);
719 int npars = fReconParameters.GetNpar();
720 std::vector<TString> names;
721 for (
int i = 0; i < npars; ++i) {
722 TString name = fReconParameters.GetParameter(i)->GetName();
723 if (
name.EndsWith(
"_UP")) names.push_back(
name);
726 for (std::vector<TString>::iterator it = names.begin(); it != names.end(); ++it) {
730 ULong64_t par_up = fReconParameters.GetIntValue(name_up);
732 UInt_t par32 = (par_up << 16) + par;
733 fReconParameters.RemoveParameter(name_up);
734 fReconParameters.RemoveParameter(
name);
735 fReconParameters.SetValue64bit(
name, par32);
760 Error(
"SetIDCodeForIDTelescope",
"Request for telescope name=%s of unknown class=%s",
832 Info(
"SetPinLasersForCsI",
"Setting correspondance CsI-PinLaser using file %s.",
833 (
const char*)gDataSet->
GetDataSetEnv(
"INDRADB.CsIPinCorr",
""));
836 line.ReadLine(pila_file);
837 while (pila_file.good()) {
838 if (!
line.BeginsWith(
"#")) {
847 line.ReadLine(pila_file);
852 Info(
"SetPinLasersForCsI",
"File %s not found. Correspondance Csi-PinLaser is unknown.",
873 if (((fired_dets && fired_dets->
GetEntries()) || fFiredDetectors.GetEntries())
874 && (GetTriggerInfo() && !GetTriggerInfo()->IsINDRAEvent()))
return;
907 if (GetGroup(
g->GetName())) {
909 if (
g->GetDetectorByType(
"SILI") ||
g->GetDetectorByType(
"SI75")) {
918 if (
id->GetRingNumber() < 10) {
939 if (GetReconParameters().HasValue64bit(
"INDRA.EN"))
e->SetNumber(GetReconParameters().GetValue64bit(
"INDRA.EN"));
957 if (!
l.GetBoolValue(
"INDRA.MESYTEC") && !
l.GetBoolValue(
"INDRA.EBYEDAT")) {
960 fEbyedatData =
kTRUE;
961 prepare_to_handle_new_raw_data();
964 for (
int i = 0; i <
N; ++i) {
968 if (
name.BeginsWith(
"ACQPAR")) {
970 int dots =
name.GetNValues(
".");
974 if (
name.Next() !=
"INDRA")
continue;
975 std::string parname(
name.Next());
978 KVDetector* det =
nullptr;
979 if (parname.find(
'_') !=
kNPOS) {
981 detname = parname.substr(0, parname.rfind(
'_'));
982 sig_type = parname.substr(parname.rfind(
'_') + 1);
983 det = GetDetector(detname);
988 add_and_set_detector_signal(det, detname,
np->GetDouble(), sig_type);
993 fMesytecData =
l.GetBoolValue(
"INDRA.MESYTEC");
994 fEbyedatData =
l.GetBoolValue(
"INDRA.EBYEDAT");
1010 if (!db->
InheritsFrom(
"KVINDRADB")) ReadChIoPressures(db);
1030 if (
r->GetDataFormat() ==
"MFM") {
1033 Info(
"InitialiseRawDataReading",
"Setting Mesytec crate config for run %d, raw run number=%d",
1034 GetCurrentRunNumber(),
r->GetRunNumberReadFromFile());
1036 auto raw_run_number =
r->GetRunNumberReadFromFile()>0 ?
r->GetRunNumberReadFromFile() : GetCurrentRunNumber();
1038 if (channel_conf_list !=
"") {
1041 Fatal(
"InitialiseRawDataReading",
1042 "Could not open file containing names of Mesytec channel config for each run: %s",
1047 while (!files.
End()) {
1050 if (runlist.
Contains(raw_run_number)) {
1052 Info(
"InitialiseRawDataReading",
"Using file %s for raw run number %d",
1053 next_file.
Data(), raw_run_number);
1062 Fatal(
"InitialiseRawDataReading",
1063 "Name of file containing names of Mesytec channel config for each run should be defined in dataset variable %s.MesytecChannelsConf",
1064 GetDataSet().Data());
1083 if (!fMesytecData) {
1085 mesytec::module::set_data_type_alias(
"qdc_long",
"TotLight");
1086 mesytec::module::set_data_type_alias(
"qdc_short",
"R");
1087 mesytec::module::set_data_type_alias(
"tdc",
"T");
1088 mesytec::module::set_data_type_alias(
"adc",
"ADC");
1090 fMesytecData =
kTRUE;
1092 fReconParameters.SetValue64bit(
"INDRA.TS",
f.GetTimeStamp());
1095 (
const uint8_t*)
f.GetPointUserData(),
f.GetBlobSize(),
1096 #ifdef MESYTEC_DATA_NO_MDPP_NAMESPACE
1097 #ifdef MESYTEC_DATA_BUFFER_READER_CALLBACK_WITH_EVENT_AND_SETUP
1098 [ = ](
const mesytec::event & evt,
const mesytec::experimental_setup & setup) {
1100 [ = ](
const mesytec::event & evt) {
1103 [ = ](
const mesytec::mdpp::event & evt) {
1105 #ifndef MESYTEC_DATA_BUFFER_READER_CALLBACK_WITH_EVENT_AND_SETUP
1106 auto& setup = mfmfilereader->GetMesytecBufferReader().get_setup();
1109 #ifdef MESYTEC_DATA_NO_PUBLIC_MEMBERS
1110 for (
auto& mdat : evt.get_module_data()) {
1111 auto mod_id = mdat.get_module_id();
1113 for (
auto& mdat : evt.modules) {
1114 auto mod_id = mdat.module_id;
1116 auto& current_module = setup.get_module(mod_id);
1117 if (current_module.is_mdpp_module()) {
1119 #ifdef MESYTEC_DATA_NO_PUBLIC_MEMBERS
1120 for (
auto& voie : mdat.get_channel_data()) {
1121 KVString detname(setup.get_detector(mod_id, voie.get_channel_number()));
1122 KVString sig_type(current_module.get_data_type_name(voie.get_data_type()));
1123 Double_t sig_data = voie.get_data();
1125 for (
auto& voie : mdat.data) {
1126 KVString detname(setup.get_detector(mod_id, voie.channel));
1131 add_and_set_detector_signal(GetDetector(detname), detname, sig_data, sig_type);
1134 else if (current_module.is_mvlc_scaler()) {
1138 #ifdef MESYTEC_DATA_NO_PUBLIC_MEMBERS
1139 if (mdat.get_channel_data().size() == 4) {
1141 if (mdat.data.size() == 4) {
1145 #ifdef MESYTEC_DATA_NO_PUBLIC_MEMBERS
1146 for (
auto&
d : mdat.get_channel_data())
x += ((uint64_t)
d.get_data_word()) << (16 * (i++));
1148 for (
auto&
d : mdat.data)
x += ((uint64_t)
d.data_word) << (16 * (i++));
1150 fReconParameters.SetValue64bit(current_module.name.c_str(),
x);
1187 Error(
"SetDetectorThicknesses",
"Problem opening file %s", fullpath.
Data());
1190 Info(
"SetDetectorThicknesses",
"Reading thicknesses of detectors from file %s", fullpath.
Data());
1197 Warning(
"SetDetectorThicknesses",
"Non-numeric value %s given for thickness of detector %s : no change",
1201 if (
TString(
rec->GetName()).BeginsWith(
"SI"))
1204 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 void SetType(const Char_t *str)
static ValType GetDataSetEnv(const KVString &dataset, const KVString &type, const ValType &defval)
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)
KVString GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
TString GetFullPathToDataSetFile(const Char_t *filename)
Bool_t OpenDataSetFile(const Char_t *filename, std::ifstream &file)
List of hit groups in a multidetector array.
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
Bool_t handle_raw_data_event_mfmframe_mesytec_mdpp(const MFMMesytecMDPPFrame &) 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 *)
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 Bool_t InheritsFrom(const char *classname) const
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(char c, Ssiz_t rep=1)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
unsigned long long ULong64_t
const long double torr
pressures