50 #ifdef WITH_BUILTIN_GRU
58 #include "MFMEbyedatFrame.h"
60 #include "MFMMesytecMDPPFrame.h"
61 #include "mesytec_buffer_reader.h"
99 fChIo->SetCleanup(
kTRUE);
101 fSi->SetCleanup(
kTRUE);
103 fCsI->SetCleanup(
kTRUE);
105 fPhoswich->SetCleanup(
kTRUE);
109 fSelecteur =
nullptr;
128 if (fChIo && fChIo->TestBit(kNotDeleted)) {
133 if (fSi && fSi->TestBit(kNotDeleted)) {
138 if (fCsI && fCsI->TestBit(kNotDeleted)) {
143 if (fPhoswich && fPhoswich->TestBit(kNotDeleted)) {
148 if (fSelecteur)
delete fSelecteur;
185 TString path =
Form(
"indra-struct.%s.env", fDataSet.Data());
186 TString path2 = GetDataSetEnv(fDataSet,
"INDRA.StructureFile",
"");
188 if (!SearchKVFile(path.
Data(), path2,
"data")) {
189 path =
"indra-struct.env";
190 SearchKVFile(path.
Data(), path2,
"data");
193 fStrucInfos.ReadFile(path2,
kEnvAll);
195 KVString lruns = fStrucInfos.GetValue(
"AddOnForRuns",
"");
199 while (!lruns.
End()) {
204 path = fStrucInfos.GetValue(sruns.
Data(),
"");
205 Info(
"BuildGeometry",
"Additional geometry for run=%d in file #%s#", fCurrentRun, path.
Data());
206 SearchKVFile(path.
Data(), path2,
"data");
208 Warning(
"BuildGeometry",
"fichier %s inconnu", path.
Data());
216 SetName(fStrucInfos.GetValue(
"INDRA.Name",
""));
217 SetTitle(fStrucInfos.GetValue(
"INDRA.Title",
""));
219 KVString layers = fStrucInfos.GetValue(
"INDRA.Layers",
"");
221 while (!layers.
End()) BuildLayer(layers.
Next());
234 Int_t number = fStrucInfos.GetValue(
Form(
"INDRA.Layer.%s.Number", name), 0);
238 Info(
"BuildLayer",
"Building layer %d:%s", number, name);
239 KVNumberList rings = fStrucInfos.GetValue(
Form(
"INDRA.Layer.%s.Rings", name),
"");
241 while (!rings.
End()) {
243 TString prefix =
Form(
"INDRA.Layer.%s.Ring.%d", name, ring_num);
244 KVRing* ring = BuildRing(ring_num, prefix);
259 Info(
"BuildRing",
"Building ring %d (%s)", number, prefix);
261 Double_t thmin = fStrucInfos.GetValue(
Form(
"%s.ThMin", prefix), 0.0);
262 Double_t thmax = fStrucInfos.GetValue(
Form(
"%s.ThMax", prefix), 0.0);
263 Double_t phi_0 = fStrucInfos.GetValue(
Form(
"%s.Phi0", prefix), 0.0);
264 Int_t ntel = fStrucInfos.GetValue(
Form(
"%s.Ntel", prefix), 0);
265 Int_t step = fStrucInfos.GetValue(
Form(
"%s.Step", prefix), 1);
266 Int_t num_first = fStrucInfos.GetValue(
Form(
"%s.Nfirst", prefix), 1);
267 Double_t dphi = fStrucInfos.GetValue(
Form(
"%s.Dphi", prefix), -1.0);
273 phi_min = (phi_min < 0. ? phi_min + 360. : phi_min);
274 dphi = (dphi < 0. ? 360. / ntel : dphi);
277 phi_max = (phi_max > 360. ? phi_max - 360. : phi_max);
282 UInt_t counter = num_first;
283 for (
int i = 0; i < ntel; i++) {
286 phi = (phi + dphi > 360. ? (phi + dphi - 360.) : (phi + dphi));
291 if (i + 1 < ntel) kvt = BuildTelescope(prefix, counter);
309 KVString telescopes = fStrucInfos.GetValue(
Form(
"%s.Telescope", prefix),
"");
310 telescopes.
Begin(
" ");
312 while (!telescopes.
End()) {
313 name = telescopes.
Next();
314 KVNumberList mods = fStrucInfos.GetValue(
Form(
"%s.Telescope.%s.Modules", prefix, name.
Data()),
"1-100");
318 KVString detectors = fStrucInfos.GetValue(
Form(
"INDRA.Telescope.%s.Detectors", name.
Data()),
"");
319 Double_t aziwidth = fStrucInfos.GetValue(
Form(
"INDRA.Telescope.%s.AziWidth", name.
Data()), 1.0);
322 detectors.
Begin(
" ");
324 while (!detectors.
End()) {
326 detector.
Begin(
"()");
331 Double_t depth = fStrucInfos.GetValue(
Form(
"INDRA.Telescope.%s.Depth.%s", name.
Data(), dettype.
Data()), 0.);
360 TIter it_traj(GetTrajectories());
399 MakeListOfDetectors();
401 SetGroupsAndIDTelescopes();
403 SetNamesOfIDTelescopes();
405 SetDetectorThicknesses();
407 SetIdentifications();
412 SetPinLasersForCsI();
414 SetExpectedDetectorSignalNames();
417 TIter next_det(GetDetectors());
422 fEbyedatParamDetMap.SetValue(det_name +
"_PG", det_name);
423 fEbyedatParamDetMap.SetValue(det_name +
"_GG", det_name);
425 fEbyedatParamDetMap.SetValue(det_name +
"_R", det_name);
426 fEbyedatParamDetMap.SetValue(det_name +
"_L", det_name);
431 fEbyedatParamDetMap.SetValue(det_name + time_marker_type, det_name);
511 FillListsOfDetectorsByType();
527 TIter next_det(GetDetectors());
561 CalculateGroupsFromGeometry();
564 CreateIDTelescopesInGroups();
596 return (
KVLayer*)GetStructure(
"LAYER",
"CHIO");
674 sprintf(nom_det,
"PHOS_%02d", mod);
682 sprintf(nom_det,
"CI_%02d%02d", cou, mod);
686 sprintf(nom_det,
"SI_%02d%02d", cou, mod);
690 sprintf(nom_det,
"SILI_%02d", cou);
694 sprintf(nom_det,
"SI75_%02d", cou);
698 sprintf(nom_det,
"CSI_%02d%02d", cou, mod);
719 if (
de->InheritsFrom(
"KVSiLi") &&
e->InheritsFrom(
"KVCsI")) {
741 TIter it(GetListOfIDTelescopes());
743 const TString etalon_numbers[] = {
"1002",
"1102",
"1202",
"1304",
"1403",
"1503",
"1602",
"1702"};
750 if (de_type ==
"PHOS") {
759 if (csi_id_name_fmt.
Contains(
"R_L")) {
769 if (e_type ==
"SILI" || e_type ==
"SI75") {
777 dynamic_cast<KVHashList*
>(GetListOfIDTelescopes())->Rehash();
790 CreateROOTGeometry();
803 if (fEbyedatParamDetMap.HasParameter(param_name)) {
804 det = GetDetector(fEbyedatParamDetMap.GetStringValue(param_name));
807 std::string lab(param_name);
808 sig_type = lab.substr(lab.rfind(
'_') + 1);
810 sig_type = param_name;
812 add_and_set_detector_signal(det, detname, val, sig_type);
834 if (fMesytecData) fReconParameters.SetValue(
"INDRA.MESYTEC",
kTRUE);
835 else if (fEbyedatData) fReconParameters.SetValue(
"INDRA.EBYEDAT",
kTRUE);
840 #ifdef WITH_BUILTIN_GRU
851 fEbyedatData =
kTRUE;
856 handle_ebyedat_raw_data_parameter(eby_par->
GetName(), eby_par->
GetData());
899 fEbyedatData =
kTRUE;
904 for (
int i = 0; i <
f.GetNbItems(); ++i) {
905 f.GetDataItem(i, lab, val);
906 handle_ebyedat_raw_data_parameter(lab.c_str(), val);
910 if (ts != 0) fReconParameters.SetValue64bit(
"INDRA.TS", ts);
912 if (en != 0) fReconParameters.SetValue64bit(
"INDRA.EN", en);
913 int npars = fReconParameters.GetNpar();
914 std::vector<TString> names;
915 for (
int i = 0; i < npars; ++i) {
916 TString name = fReconParameters.GetParameter(i)->GetName();
917 if (name.
EndsWith(
"_UP")) names.push_back(name);
920 for (std::vector<TString>::iterator it = names.begin(); it != names.end(); ++it) {
924 ULong64_t par_up = fReconParameters.GetIntValue(name_up);
925 ULong64_t par = fReconParameters.GetIntValue(name);
926 UInt_t par32 = (par_up << 16) + par;
927 fReconParameters.RemoveParameter(name_up);
928 fReconParameters.RemoveParameter(name);
929 fReconParameters.SetValue64bit(name, par32);
954 Error(
"SetIDCodeForIDTelescope",
"Request for telescope name=%s of unknown class=%s",
1017 Info(
"SetPinLasersForCsI",
"Setting correspondance CsI-PinLaser using file %s.",
1021 line.ReadLine(pila_file);
1022 while (pila_file.good()) {
1023 if (!
line.BeginsWith(
"#")) {
1032 line.ReadLine(pila_file);
1036 Info(
"SetPinLasersForCsI",
"File %s not found. Correspondance Csi-PinLaser is unknown.",
1121 if (((fired_dets && fired_dets->
GetEntries()) || fFiredDetectors.GetEntries())
1122 && (GetTriggerInfo() && !GetTriggerInfo()->IsINDRAEvent()))
return;
1207 Error(
"CreateROOTGeometry",
"gIndra has to be build first");
1210 if (!GetNavigator()) {
1213 GetNavigator()->SetNameCorrespondanceList(
"INDRA.names");
1217 Info(
"CreateROOTGeometry",
"Scanning geometry shapes and matrices...");
1224 TIter next(GetDetectors());
1232 Info(
"CreateROOTGeometry",
"Volume checking for %s", det->
GetName());
1235 for (
Double_t TH = theta0 - 0.5; TH <= theta0 + 0.5; TH += 0.1) {
1236 for (
Double_t PH = phi0 - 10; PH <= phi0 + 10; PH += 1) {
1247 Info(
"CreateROOTGeometry",
"Volume checking failed for : %s", det->
GetName());
1257 Info(
"CreateROOTGeometry",
"Trajectory checking for %s", det->
GetName());
1260 for (
Double_t TH = theta0 - 0.5; TH <= theta0 + 0.5; TH += 0.1) {
1261 for (
Double_t PH = phi0 - 10; PH <= phi0 + 10; PH += 1) {
1276 Info(
"CreateROOTGeometry",
"ROOT geometry initialised for %d/%d detectors", nrootgeo, GetDetectors()->GetEntries());
1279 TIter it(GetDetectors());
1281 while ((
d = (
KVDetector*)it()))
d->GetNode()->RehashLists();
1282 AssociateTrajectoriesAndNodes();
1283 DeduceGroupsFromTrajectories();
1284 FillTrajectoryIDTelescopeLists();
1285 CalculateReconstructionTrajectories();
1286 GetNavigator()->AbsorbDetectorPaths(&gimp);
1304 if (fCloseGeometryNow) PerformClosedROOTGeometryOperations();
1321 if (GetTrigger() > 0)
e->SetMinimumOKMultiplicity(GetTrigger());
1340 if (GetGroup(
g->GetName())) {
1342 if (
g->GetDetectorByType(
"SILI") ||
g->GetDetectorByType(
"SI75"))
1363 if (GetReconParameters().HasValue64bit(
"INDRA.EN"))
e->SetNumber(GetReconParameters().GetValue64bit(
"INDRA.EN"));
1381 if (!
l.GetBoolValue(
"INDRA.MESYTEC") && !
l.GetBoolValue(
"INDRA.EBYEDAT")) {
1384 fEbyedatData =
kTRUE;
1385 prepare_to_handle_new_raw_data();
1387 int N =
l.GetNpar();
1388 for (
int i = 0; i <
N; ++i) {
1398 if (name.
Next() !=
"INDRA")
continue;
1399 std::string parname(name.
Next());
1403 if (parname.find(
'_') !=
kNPOS) {
1405 detname = parname.substr(0, parname.rfind(
'_'));
1406 sig_type = parname.substr(parname.rfind(
'_') + 1);
1407 det = GetDetector(detname);
1411 add_and_set_detector_signal(det, detname, np->
GetDouble(), sig_type);
1415 fMesytecData =
l.GetBoolValue(
"INDRA.MESYTEC");
1416 fEbyedatData =
l.GetBoolValue(
"INDRA.EBYEDAT");
1438 if (
r->GetDataFormat() ==
"MFM") {
1441 Info(
"InitialiseRawDataReading",
"Setting Mesytec crate config for run %d, raw run number=%d",
1442 GetCurrentRunNumber(),
r->GetRunNumberReadFromFile());
1445 if (channel_conf_list !=
"") {
1448 Fatal(
"InitialiseRawDataReading",
1449 "Could not open file containing names of Mesytec channel config for each run: %s",
1454 while (!files.
End()) {
1457 if (runlist.
Contains(
r->GetRunNumberReadFromFile())) {
1459 Info(
"InitialiseRawDataReading",
"Using file %s for raw run number %d",
1460 next_file.
Data(),
r->GetRunNumberReadFromFile());
1468 Fatal(
"InitialiseRawDataReading",
1469 "Name of file containing names of Mesytec channel config for each run should be defined in dataset variable %s.MesytecChannelsConf",
1470 GetDataSet().Data());
1489 Bool_t KVINDRA::handle_raw_data_event_mfmframe_mesytec_mdpp(
const MFMMesytecMDPPFrame& f)
1497 if (!fMesytecData) {
1499 mesytec::module::set_data_type_alias(
"qdc_long",
"TotLight");
1500 mesytec::module::set_data_type_alias(
"qdc_short",
"R");
1501 mesytec::module::set_data_type_alias(
"tdc",
"T");
1502 mesytec::module::set_data_type_alias(
"adc",
"ADC");
1504 fMesytecData =
kTRUE;
1506 fReconParameters.SetValue64bit(
"INDRA.TS",
f.GetTimeStamp());
1508 mfmfilereader->GetMesytecBufferReader().read_event_in_buffer(
1509 (
const uint8_t*)
f.GetPointUserData(),
f.GetBlobSize(),
1510 [ = ](
const mesytec::mdpp::event & evt) {
1511 auto& setup = mfmfilereader->GetMesytecBufferReader().get_setup();
1513 for (
auto& mdat : evt.modules) {
1514 auto mod_id = mdat.module_id;
1515 auto& current_module = setup.get_module(mod_id);
1516 if (current_module.is_mdpp_module()) {
1518 for (
auto& voie : mdat.data) {
1519 KVString detname(setup.get_detector(mod_id, voie.channel));
1522 add_and_set_detector_signal(GetDetector(detname), detname, sig_data, sig_type);
1524 }
else if (current_module.is_mvlc_scaler()) {
1528 if (mdat.data.size() == 4) {
1531 for (
auto& d : mdat.data)
x += ((uint64_t)
d.data_word) << (16 * (i++));
1532 fReconParameters.SetValue64bit(current_module.name.c_str(),
x);
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
Build INDRA geometry from Huguet CAO infos.
void Build(Bool_t withTarget=kTRUE, Bool_t closeGeometry=kTRUE)
void MakeListOfDetectors()
virtual void SetNumber(UInt_t num)
virtual void SetType(const Char_t *str)
static const Char_t * GetDataSetEnv(const Char_t *dataset, const Char_t *type, const Char_t *defval)
virtual Bool_t IsCalled(const Char_t *name) const
Ionisation chamber detectors of the INDRA multidetector array.
CsI(Tl) scintillation detectors of the INDRA multidetector array.
void SetPinLaser(Int_t n)
const Char_t * 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)
Base class for detector geometry description.
void SetNameOfArray(const TString &n)
static KVDetector * MakeDetector(const Char_t *name, Float_t thick)
KVList * GetAlignedIDTelescopes()
Double_t GetTheta() const
KVGeoDetectorNode * GetNode()
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
Abstract base class container for multi-particle events.
Reads GANIL acquisition files (EBYEDAT)
const KVSeqCollection & GetFiredDataParameters() const
Path taken by particles through multidetector geometry.
Bool_t ContainsAll(const TCollection *l) const
KVSeqCollection * AccessIDTelescopeList()
KVGeoDetectorNode * GetNodeInFront(const KVGeoDetectorNode *n) const
KVGeoDetectorNode * GetNodeAt(Int_t i) const
KVDetector * GetDetector() const
Int_t GetNDetsInFront() const
Returns number of detectors directly in front of this one.
Import detector array described by ROOT geometry and set up corresponding KVMultiDetArray object.
void SetLastDetector(KVDetector *)
void PropagateEvent(KVEvent *, TVector3 *TheOrigin=0)
void SetNameCorrespondanceList(const Char_t *)
virtual void Add(KVBase *)
Base class for particle reconstruction in one group of a detector array.
static KVGroupReconstructor * Factory(const TString &plugin="")
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)
const KVList * GetDetectors() const
Base class for detectors of INDRA array.
UInt_t GetRingNumber() const
KVINDRADetector * GetChIo() const
static TString CSI_ID_TYPE
Base class for telescopes in INDRA array.
INDRA multidetector array geometry.
virtual void Build(Int_t run=-1)
void InitialiseRawDataReading(KVRawDataReader *)
virtual KVChIo * GetChIoOf(const Char_t *detname)
void handle_ebyedat_raw_data_parameter(const char *param_name, uint16_t val)
KVINDRATelescope * BuildTelescope(const Char_t *prefix, Int_t mod)
virtual Bool_t handle_raw_data_event_ebyedat(KVGANILDataReader &)
void CreateROOTGeometry()
void SetRawDataFromReconEvent(KVNameValueList &)
void SetPinLasersForCsI()
void copy_fired_parameters_to_recon_param_list()
KVGroupReconstructor * GetReconstructorForGroup(const KVGroup *) const
virtual void SetGroupsAndIDTelescopes()
Int_t GetIDTelescopes(KVDetector *, KVDetector *, TCollection *)
virtual void SetROOTGeometry(Bool_t on=kTRUE)
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.
virtual void MakeListOfDetectors()
Overrides KVASMultiDetArray method to add FillListsOfDetectorsByType()
void FillTrajectoryIDTelescopeLists()
void SetIDCodeForIDTelescope(KVIDTelescope *) const
Set the INDRA-specific general identification code for the given telescope.
void PerformClosedROOTGeometryOperations()
void SetReconParametersInEvent(KVReconstructedEvent *) const
If "INDRA.EN" parameter has been set, we use it to set the event number.
void SetTrigger(UChar_t trig)
Bool_t handle_raw_data_event_mfmframe_ebyedat(const MFMEbyedatFrame &)
KVRing * BuildRing(Int_t number, const Char_t *prefix)
Build ring with infos in file "$KVROOT/KVFiles/data/indra-struct.[dataset].env".
virtual KVINDRADetector * GetDetectorByType(UInt_t cou, UInt_t mod, UInt_t type) const
void SetNamesOfIDTelescopes() const
virtual void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *fired_dets=0)
void BuildLayer(const Char_t *name)
Build layer 'name' with infos in file "$KVROOT/KVFiles/data/indra-struct.[dataset]....
virtual void BuildGeometry()
void SetMinimumOKMultiplicity(KVEvent *) const
Set of detectors at a similar distance from target (obsolete)
Read MFM format acquisition data.
static KVIonRangeTable * GetRangeTable()
virtual void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *fired_params=0)
virtual void InitialiseRawDataReading(KVRawDataReader *)
virtual void copy_fired_parameters_to_recon_param_list()
virtual Int_t GetIDTelescopes(KVDetector *, KVDetector *, TCollection *list)
virtual void SetRawDataFromReconEvent(KVNameValueList &)
virtual void SetROOTGeometry(Bool_t on=kTRUE)
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.
Double_t GetDouble() const
An event container for KVNucleus objects.
Description of properties and kinematics of atomic nuclei.
void SetZAandE(Int_t z, Int_t a, Double_t ekin)
Set atomic number, mass number, and kinetic energy in MeV.
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
void SetTheta(Double_t theta)
void SetPhi(Double_t phi)
virtual void SetAzimuthalMinMax(Double_t min, Double_t max)
Set min and max azimuthal angles and calculate (mean) phi.
Bool_t ROOTGeo() const
Returns kTRUE if ROOT geometry is used, kFALSE if not.
void SetDistance(Double_t d)
Double_t GetAzimuthalWidth(Double_t phmin=-1., Double_t phimax=-1.) const
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
Propagate particles through array geometry calculating energy losses.
Abstract base class for reading raw (DAQ) data.
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Ring in INDRA array (obsolete)
void Add(KVBase *)
Only KVTelescope-derived structures can be placed in a KVRing.
virtual void Add(TObject *obj)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Int_t GetNValues(TString delim) const
void SetDepth(UInt_t ndet, Float_t depth)
set the depth of detector number ndet(=1,2,...) in mm.
void Add(KVBase *element)
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
virtual void SetAzimuthalWidth(Double_t aw)
virtual Int_t GetEntries() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
virtual const char * GetName() const
virtual void SetName(const char *name)
virtual TObject * FindObject(const char *name) const
virtual Bool_t InheritsFrom(const char *classname) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
const char * Data() const
TString & Prepend(char c, Ssiz_t rep=1)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
unsigned long long ULong64_t
const long double g
masses
void Add(RHist< DIMENSIONS, PRECISION, STAT_TO... > &to, const RHist< DIMENSIONS, PRECISION, STAT_FROM... > &from)
double dist(AxisAngle const &r1, AxisAngle const &r2)