KaliVeda
Toolkit for HIC analysis
KVFAZIA.h
1 
4 #ifndef __KVFAZIA_H
5 #define __KVFAZIA_H
6 
7 #include "KVMultiDetArray.h"
8 
9 #include <KVGeoImport.h>
10 #include <KVEnv.h>
11 #include <KVSignal.h>
12 #include "KVFAZIATrigger.h"
13 
14 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,32,0)
15 #include "TGeoMatrix.h"
16 #endif
17 
18 class KVDetectorEvent;
19 #ifdef WITH_PROTOBUF
20 #ifndef __CINT__
21 namespace DAQ {
22  class FzEvent;
23 }
24 #endif
25 #endif
26 
33 class KVFAZIA : public KVMultiDetArray {
34 protected:
53  int fQuartet[8][2];
54  int fTelescope[8][2];
55 
61 
64 
66  double oldfaziats = -1.;
67 
68  void SetTriggerPatternsForDataSet(const TString& dataset);
69  void SetTriggerPattern(uint16_t fp)
70  {
72  }
73 
75  virtual void BuildFAZIA();
76  virtual void GetGeometryParameters();
78 
79  virtual void BuildTarget();
81  virtual void SetNameOfDetectors(KVEnv& env);
82 
84 
85 #ifdef WITH_MFM
86  Bool_t handle_raw_data_event_mfmframe(const MFMCommonFrame&) override;
87 #endif
89  {
97  }
98 
100 
101  void CreateCorrespondence();
102 #ifdef WITH_PROTOBUF
104 #ifndef __CINT__
105  Bool_t treat_event(const DAQ::FzEvent&);
106 #endif
107  Double_t TreatEnergy(Int_t sigid, Int_t eid, UInt_t val);
108 #endif
109  TString GetSignalName(Int_t bb, Int_t qq, Int_t tt, Int_t idsig);
110 
111  void ReadTriggerPatterns(KVExpDB* db);
112 
114  {
118  }
119  void SetIDCodeForIDTelescope(KVIDTelescope*) const override;
120 
124  {
126  return ECodes::NORMAL_CALIBRATION;
127  }
128 public:
129  enum IDCodes {
134  ID_GAMMA = 0,
135  ID_SI1_PSA = 11,
136  ID_SI1_SI2 = 12,
137  ID_SI1_CSI = 13,
138  ID_SI2_PSA = 22,
139  ID_SI2_CSI = 23,
140  ID_SI12_CSI = 123,
141  ID_CSI_PSA = 33,
146  ID_INCOHERENT = 666
147  };
149  {
150  return IDCodes::ID_STOPPED_IN_FIRST_STAGE;
151  }
152  UShort_t GetBadIDCode() const override
153  {
154  return IDCodes::NO_IDENTIFICATION;
155  }
156 
157  TString GetIDCodeMeaning(Int_t idc) const override
158  {
159  switch (idc) {
160  case NO_IDENTIFICATION:
161  return "NO_IDENTIFICATION";
162  case ID_GAMMA:
163  return "ID_GAMMA";
164  case ID_SI1_PSA:
165  return "ID_SI1_PSA";
166  case ID_SI2_PSA:
167  return "ID_SI2_PSA";
168  case ID_SI1_SI2:
169  return "ID_SI1_SI2";
170  case ID_SI2_CSI:
171  return "ID_SI2_CSI";
172  case ID_SI1_CSI:
173  return "ID_SI1_CSI";
174  case ID_SI12_CSI:
175  return "ID_SI12_CSI";
176  case ID_CSI_PSA:
177  return "ID_CSI_PSA";
179  return "ID_STOPPED_IN_FIRST_STAGE";
181  return "ID_SI1_SI2_MAYBE_PUNCH_THROUGH";
183  return "ID_SI1_SI2_PUNCH_THROUGH";
185  return "ID_SI1_PUNCH_THROUGH";
186  default:
187  return Form("(unknown:%d)", idc);
188  }
189  }
190  enum ECodes {
199  };
200  TString GetECodeMeaning(Int_t ec) const override
201  {
202  switch (ec) {
204  return "NO_CALIBRATION_ATTEMPTED";
205  case NORMAL_CALIBRATION:
206  return "NORMAL_CALIBRATION";
208  return "SOME_ENERGY_LOSSES_CALCULATED";
210  return "WARNING_CSI_MAX_ENERGY";
212  return "ENERGY_LOSSES_TENTATIVELY_CALCULATED (for Z=1,2 stopped in uncalibrated CsI)";
213  default:
214  return Form("(unknown:%d)", ec);
215  }
216  }
217 
218  KVFAZIA(const Char_t* title = "");
219  virtual ~KVFAZIA();
220  void AddDetectorLabel(const Char_t* label);
221 
222  void Build(Int_t = -1) override;
223 
224  void GetDetectorEvent(KVDetectorEvent* detev, const TSeqCollection* dets) override;
226  {
227  return fNblocks;
228  }
229  void IncludeTargetInGeometry(Bool_t include = kTRUE)
230  {
231  fBuildTarget = include;
232  }
233 
235  {
236  return fDetectorLabels;
237  }
238  const Char_t* GetSignalTypes() const
239  {
240  return fSignalTypes.Data();
241  }
242 
243  void SetGeometryImportParameters(Double_t dt = 0.25, Double_t dp = 1.0, Double_t tmin = 2., Double_t pmin = 0, Double_t tmax = 20., Double_t pmax = 360.,
244  Double_t xorg = 0, Double_t yorg = 0, Double_t zorg = 0)
245  {
248  fImport_dPhi = dp;
249  fImport_dTheta = dt;
250  fImport_PhiMax = pmax;
251  fImport_PhiMin = pmin;
252  fImport_ThetaMax = tmax;
253  fImport_ThetaMin = tmin;
254  fImport_Xorg = xorg;
255  fImport_Yorg = yorg;
256  fImport_Zorg = zorg;
257  }
258  void FillDetectorList(KVReconstructedNucleus* rnuc, KVHashList* DetList, const KVString& DetNames) override;
259 
260  KVGroupReconstructor* GetReconstructorForGroup(const KVGroup*) const override;
261  Double_t GetSetupParameter(const Char_t* parname);
262 
263  const KVFAZIATrigger& GetTrigger() const
264  {
265  return fTrigger;
266  }
268  void MakeCalibrationTables(KVExpDB*) override;
269 
270  std::string GetTriggerForCurrentRun() const;
272 
273  static TGeoHMatrix* GetFAZIAVolumePositioningMatrix(Double_t distance, Double_t theta, Double_t phi, TGeoTranslation* postTrans = nullptr)
274  {
297 
298  TGeoRotation rot1, rot2;
299  TGeoTranslation trans;
300  phi += 90;
301  rot1.SetAngles(-phi, 0, 0) ;
302  rot2.SetAngles(phi, theta, 0) ;
303  trans.SetDz(distance) ;
304  TGeoHMatrix h;
305  if (postTrans) h = (*postTrans) * rot2 * trans * rot1 ;
306  else h = rot2 * trans * rot1;
307  TGeoHMatrix* ph = new TGeoHMatrix(h);
308  return ph;
309  }
310  ClassDefOverride(KVFAZIA, 1) //Base class for description of the FAZIA set up
311 };
312 
314 R__EXTERN KVFAZIA* gFazia;
315 
316 #endif
int Int_t
unsigned int UInt_t
#define R__EXTERN
bool Bool_t
unsigned short UShort_t
unsigned char UChar_t
char Char_t
double Double_t
#define ClassDefOverride(name, id)
char * Form(const char *fmt,...)
List of hit groups in a multidetector array.
Extension of TEnv to allow the writing of comments in the file.
Definition: KVEnv.h:17
Base class to describe database of an experiment ,,.
Definition: KVExpDB.h:20
The trigger pattern for each FAZIA event.
void SetTriggerPattern(uint16_t tp)
Description of a FAZIA detector geometry.
Definition: KVFAZIA.h:33
Double_t fImport_Xorg
for geometry import
Definition: KVFAZIA.h:50
void PerformClosedROOTGeometryOperations() override
Definition: KVFAZIA.cpp:385
Double_t fImport_ThetaMin
for geometry import
Definition: KVFAZIA.h:46
UChar_t GetNormalCalibrationCode() const override
Definition: KVFAZIA.h:123
Double_t fFDist
distance of FAZIA detectors from target (in cm)
Definition: KVFAZIA.h:36
Double_t fQ2risetime
Definition: KVFAZIA.h:58
Double_t fQH1risetime
values of trapezoidal filter rise time set in the fpgas defined in .kvrootrc
Definition: KVFAZIA.h:57
Double_t TreatEnergy(Int_t sigid, Int_t eid, UInt_t val)
Definition: KVFAZIA.cpp:702
Double_t fQ3slowrisetime
Definition: KVFAZIA.h:59
void SetTriggerPatternsForDataSet(const TString &dataset)
Definition: KVFAZIA.cpp:444
TString fFGeoType
type of FAZIA geometry (="compact",...)
Definition: KVFAZIA.h:35
void SetGeometryImportParameters(Double_t dt=0.25, Double_t dp=1.0, Double_t tmin=2., Double_t pmin=0, Double_t tmax=20., Double_t pmax=360., Double_t xorg=0, Double_t yorg=0, Double_t zorg=0)
Definition: KVFAZIA.h:243
int fQuartet[8][2]
quartet number from #FEE and #FPGA
Definition: KVFAZIA.h:53
Double_t GetSetupParameter(const Char_t *parname)
Definition: KVFAZIA.cpp:75
Double_t fImport_dTheta
for geometry import
Definition: KVFAZIA.h:44
UShort_t GetBadIDCode() const override
Definition: KVFAZIA.h:152
Bool_t handle_raw_data_event_mfmframe(const MFMCommonFrame &) override
Definition: KVFAZIA.cpp:897
Double_t fFThetaMin
minimum polar angle for compact geometry (in degrees)
Definition: KVFAZIA.h:37
void SetIDCodeForIDTelescope(KVIDTelescope *) const override
Set the FAZIA-specific general identification code for the given telescope.
Definition: KVFAZIA.cpp:1022
ECodes
Calibration quality codes attributed to particles reconstructed from data.
Definition: KVFAZIA.h:190
@ NO_CALIBRATION_ATTEMPTED
particle stopped in detectors with no available calibration
Definition: KVFAZIA.h:194
@ NORMAL_CALIBRATION
normal well-calibrated particle with no problems
Definition: KVFAZIA.h:195
@ WARNING_CSI_MAX_ENERGY
particle calibration OK, although apparent energy would mean punching through the CsI
Definition: KVFAZIA.h:197
@ ENERGY_LOSSES_TENTATIVELY_CALCULATED
particle calibration OK, with some detector energies tentatively calculated (Z<2)
Definition: KVFAZIA.h:198
@ SOME_ENERGY_LOSSES_CALCULATED
particle calibration OK, with some detector energies calculated
Definition: KVFAZIA.h:196
TString GetIDCodeMeaning(Int_t idc) const override
Definition: KVFAZIA.h:157
std::string GetTriggerForCurrentRun() const
Definition: KVFAZIA.cpp:126
void AddDetectorLabel(const Char_t *label)
Definition: KVFAZIA.cpp:304
TString GetECodeMeaning(Int_t ec) const override
Definition: KVFAZIA.h:200
const KVFAZIATrigger & GetTrigger() const
Definition: KVFAZIA.h:263
void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *dets) override
Definition: KVFAZIA.cpp:550
virtual void BuildTarget()
Definition: KVFAZIA.cpp:492
Int_t GetNumberOfBlocks() const
Definition: KVFAZIA.h:225
void Build(Int_t=-1) override
Build the FAZIA array.
Definition: KVFAZIA.cpp:515
static TGeoHMatrix * GetFAZIAVolumePositioningMatrix(Double_t distance, Double_t theta, Double_t phi, TGeoTranslation *postTrans=nullptr)
Definition: KVFAZIA.h:273
Int_t GetIDCodeForParticlesStoppingInFirstStageOfTelescopes() const override
Definition: KVFAZIA.h:148
Int_t fStartingBlockNumber
Definition: KVFAZIA.h:39
TString fCorrespondanceFile
Bool_t fBuildTarget; //kTRUE to include target frame in the geometry.
Definition: KVFAZIA.h:41
Double_t fImport_PhiMax
for geometry import
Definition: KVFAZIA.h:49
virtual void SetNameOfDetectors(KVEnv &env)
Definition: KVFAZIA.cpp:354
Double_t fImport_Zorg
for geometry import
Definition: KVFAZIA.h:52
virtual void BuildFAZIA()
methods to be implemented in child classes
Definition: KVFAZIA.cpp:481
void DeduceIdentificationTelescopesFromGeometry() override
Definition: KVFAZIA.cpp:180
KVFAZIA(const Char_t *title="")
Default constructor.
Definition: KVFAZIA.cpp:51
void FillDetectorList(KVReconstructedNucleus *rnuc, KVHashList *DetList, const KVString &DetNames) override
Definition: KVFAZIA.cpp:596
void ReadTriggerPatterns(KVExpDB *db)
Definition: KVFAZIA.cpp:979
virtual void DefineStructureFormats(KVGeoImport &)
Definition: KVFAZIA.h:83
void GenerateCorrespondanceFile()
Definition: KVFAZIA.cpp:316
Double_t fQ3fastrisetime
Definition: KVFAZIA.h:60
KVString fSignalTypes
Definition: KVFAZIA.h:43
Bool_t treat_event(const DAQ::FzEvent &)
Read raw data for an event.
Definition: KVFAZIA.cpp:733
virtual ~KVFAZIA()
Destructor.
Definition: KVFAZIA.cpp:293
Double_t fImport_dPhi
for geometry import
Definition: KVFAZIA.h:45
Double_t fImport_ThetaMax
for geometry import
Definition: KVFAZIA.h:47
int fTelescope[8][2]
telescope number from #FEE and #FPGA
Definition: KVFAZIA.h:54
KVFAZIATrigger fTrigger
trigger pattern read from data for each event
Definition: KVFAZIA.h:63
KVGroupReconstructor * GetReconstructorForGroup(const KVGroup *) const override
Specialized group reconstructor for FAZIA.
Definition: KVFAZIA.cpp:644
void SetRawDataFromReconEvent(KVNameValueList &) override
Overrides base method in order to set the value of the trigger bit pattern for the event.
Definition: KVFAZIA.cpp:89
virtual void GetGeometryParameters()
Called by the Build method.
Definition: KVFAZIA.cpp:416
void SetTriggerPattern(uint16_t fp)
Definition: KVFAZIA.h:69
double oldfaziats
dummy ts to control trigger info transmission rate
Definition: KVFAZIA.h:66
Bool_t handle_raw_data_event_protobuf(KVProtobufDataReader &) override
Definition: KVFAZIA.cpp:693
void copy_fired_parameters_to_recon_param_list() override
Definition: KVFAZIA.h:88
TString GetSignalName(Int_t bb, Int_t qq, Int_t tt, Int_t idsig)
Definition: KVFAZIA.cpp:661
Double_t fImport_PhiMin
for geometry import
Definition: KVFAZIA.h:48
IDCodes
Identification quality codes attributed to particles reconstructed from data.
Definition: KVFAZIA.h:129
@ ID_SI12_CSI
particle identified in (SI1+SI2)-CSI telescope
Definition: KVFAZIA.h:140
@ ID_SI1_SI2_MAYBE_PUNCH_THROUGH
possible ambiguity of particle identification in SI1-SI2 due to unvetoed punch-through
Definition: KVFAZIA.h:143
@ ID_CSI_PSA
particle identified by pulse shape analysis in CSI
Definition: KVFAZIA.h:141
@ ID_STOPPED_IN_FIRST_STAGE
particle stopped in SI1, no identification possible better than estimation of minimum Z
Definition: KVFAZIA.h:142
@ ID_SI1_SI2_PUNCH_THROUGH
particle punching through SI2, identified Z is a minimum value
Definition: KVFAZIA.h:144
@ ID_SI1_CSI
particle identified in SI1-SI2 telescope
Definition: KVFAZIA.h:137
@ ID_SI1_PSA
particle identified by pulse shape analysis in SI1
Definition: KVFAZIA.h:135
@ ID_SI1_PUNCH_THROUGH
particle partially identified by pulse shape analysis in SI1, although it is punching through (no SI2...
Definition: KVFAZIA.h:145
@ ID_SI2_PSA
particle identified by pulse shape analysis in SI1
Definition: KVFAZIA.h:138
@ NO_IDENTIFICATION
no identification possible for particle
Definition: KVFAZIA.h:133
@ ID_GAMMA
'gamma' particle identified by pulse shape analysis in CSI
Definition: KVFAZIA.h:134
@ ID_SI2_CSI
particle identified in SI2-CSI telescope
Definition: KVFAZIA.h:139
@ ID_INCOHERENT
particle with incoherent identifications (CCode>=0)
Definition: KVFAZIA.h:146
@ ID_SI1_SI2
particle identified in SI1-SI2 telescope
Definition: KVFAZIA.h:136
const Char_t * GetSignalTypes() const
Definition: KVFAZIA.h:238
void IncludeTargetInGeometry(Bool_t include=kTRUE)
Definition: KVFAZIA.h:229
Int_t fNblocks
number of blocks
Definition: KVFAZIA.h:38
KVString GetDetectorLabels() const
Definition: KVFAZIA.h:234
void prepare_to_handle_new_raw_data()
Definition: KVFAZIA.h:113
Double_t fImport_Yorg
for geometry import
Definition: KVFAZIA.h:51
KVString fDetectorLabels
Definition: KVFAZIA.h:42
void CreateCorrespondence()
Definition: KVFAZIA.cpp:934
void MakeCalibrationTables(KVExpDB *) override
Override base method in order to read FAZIA trigger for each run.
Definition: KVFAZIA.cpp:102
Import detector array described by ROOT geometry and set up corresponding KVMultiDetArray object.
Definition: KVGeoImport.h:69
Base class for particle reconstruction in one group of a detector array.
Group of detectors which can be treated independently of all others in array.
Definition: KVGroup.h:19
Extended version of ROOT THashList.
Definition: KVHashList.h:29
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:84
Base class for describing the geometry of a detector array.
void prepare_to_handle_new_raw_data()
reset acquisition parameters etc. before reading new raw data event
static Bool_t fBuildTarget
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Read Google Protobuf DAQ files.
Nuclei reconstructed from data measured by a detector array .
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
void SetDz(Double_t dz) override
const char * Data() const
TH1 * h