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:
35  TString fFGeoType;
36  Double_t fFDist;
37  Double_t fFThetaMin;
38  Int_t fNblocks;
39  Int_t fStartingBlockNumber;
41  TString fCorrespondanceFile;
42  KVString fDetectorLabels;
43  KVString fSignalTypes;
44  Double_t fImport_dTheta;
45  Double_t fImport_dPhi;
46  Double_t fImport_ThetaMin;
47  Double_t fImport_ThetaMax;
48  Double_t fImport_PhiMin;
49  Double_t fImport_PhiMax;
50  Double_t fImport_Xorg;
51  Double_t fImport_Yorg;
52  Double_t fImport_Zorg;
53  int fQuartet[8][2];
54  int fTelescope[8][2];
55 
57  Double_t fQH1risetime;
58  Double_t fQ2risetime;
59  Double_t fQ3slowrisetime;
60  Double_t fQ3fastrisetime;
61 
63  KVFAZIATrigger fTrigger;
64 
66  double oldfaziats = -1.;
67 
68  TString fSiCsI_idtype = "SI2_CSI";
69 
70  void SetTriggerPatternsForDataSet(const TString& dataset);
71  void SetTriggerPattern(uint16_t fp)
72  {
73  fTrigger.SetTriggerPattern(fp);
74  }
75 
77  virtual void BuildFAZIA();
78  virtual void GetGeometryParameters();
80 
81  virtual void BuildTarget();
82  void GenerateCorrespondanceFile();
83  virtual void SetNameOfDetectors(KVEnv& env);
84 
85  virtual void DefineStructureFormats(KVGeoImport&) {}
86 
87 #ifdef WITH_MFM
88  Bool_t handle_raw_data_event_mfmframe(const MFMCommonFrame&) override;
89 #endif
90  void copy_fired_parameters_to_recon_param_list() override
91  {
99  }
100 
101  void PerformClosedROOTGeometryOperations() override;
102 
103  void CreateCorrespondence();
104 #ifdef WITH_PROTOBUF
105  Bool_t handle_raw_data_event_protobuf(KVProtobufDataReader&) override;
106 #ifndef __CINT__
107  Bool_t treat_event(const DAQ::FzEvent&);
108 #endif
109  Double_t TreatEnergy(Int_t sigid, Int_t eid, UInt_t val);
110 #endif
111  TString GetSignalName(Int_t bb, Int_t qq, Int_t tt, Int_t idsig);
112 
113  void ReadTriggerPatterns(KVExpDB* db);
114 
115  void prepare_to_handle_new_raw_data()
116  {
119  SetTriggerPattern(0);
120  }
121  void SetIDCodeForIDTelescope(KVIDTelescope*) const override;
122 
125  UChar_t GetNormalCalibrationCode() const override
126  {
128  return ECodes::NORMAL_CALIBRATION;
129  }
130 public:
131  enum IDCodes {
136  ID_GAMMA = 0,
137  ID_SI1_PSA = 11,
138  ID_SI1_SI2 = 12,
139  ID_SI1_CSI = 13,
140  ID_SI2_PSA = 22,
141  ID_SI2_CSI = 23,
142  ID_SI12_CSI = 123,
143  ID_CSI_PSA = 33,
148  ID_INCOHERENT = 666
149  };
151  {
152  return IDCodes::ID_STOPPED_IN_FIRST_STAGE;
153  }
154  Short_t GetBadIDCode() const override
155  {
156  return IDCodes::NO_IDENTIFICATION;
157  }
158 
159  TString GetIDCodeMeaning(Int_t idc) const override
160  {
161  switch (idc) {
162  case NO_IDENTIFICATION:
163  return "NO_IDENTIFICATION";
164  case ID_GAMMA:
165  return "ID_GAMMA";
166  case ID_SI1_PSA:
167  return "ID_SI1_PSA";
168  case ID_SI2_PSA:
169  return "ID_SI2_PSA";
170  case ID_SI1_SI2:
171  return "ID_SI1_SI2";
172  case ID_SI2_CSI:
173  return "ID_SI2_CSI";
174  case ID_SI1_CSI:
175  return "ID_SI1_CSI";
176  case ID_SI12_CSI:
177  return "ID_SI12_CSI";
178  case ID_CSI_PSA:
179  return "ID_CSI_PSA";
181  return "ID_STOPPED_IN_FIRST_STAGE";
183  return "ID_SI1_SI2_MAYBE_PUNCH_THROUGH";
185  return "ID_SI1_SI2_PUNCH_THROUGH";
187  return "ID_SI1_PUNCH_THROUGH";
188  default:
189  return Form("(unknown:%d)", idc);
190  }
191  }
192  enum ECodes {
201  };
202  TString GetECodeMeaning(Int_t ec) const override
203  {
204  switch (ec) {
206  return "NO_CALIBRATION_ATTEMPTED";
207  case NORMAL_CALIBRATION:
208  return "NORMAL_CALIBRATION";
210  return "SOME_ENERGY_LOSSES_CALCULATED";
212  return "WARNING_CSI_MAX_ENERGY";
214  return "ENERGY_LOSSES_TENTATIVELY_CALCULATED (for Z=1,2 stopped in uncalibrated CsI)";
215  default:
216  return Form("(unknown:%d)", ec);
217  }
218  }
219 
220  KVFAZIA(const Char_t* title = "");
221  virtual ~KVFAZIA();
222  void AddDetectorLabel(const Char_t* label);
223 
224  void Build(Int_t = -1) override;
225 
226  void GetDetectorEvent(KVDetectorEvent* detev, const TSeqCollection* dets) override;
228  {
229  return fNblocks;
230  }
231  void IncludeTargetInGeometry(Bool_t include = kTRUE)
232  {
233  fBuildTarget = include;
234  }
235 
237  {
238  return fDetectorLabels;
239  }
240  const Char_t* GetSignalTypes() const
241  {
242  return fSignalTypes.Data();
243  }
244 
245  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.,
246  Double_t xorg = 0, Double_t yorg = 0, Double_t zorg = 0)
247  {
250  fImport_dPhi = dp;
251  fImport_dTheta = dt;
252  fImport_PhiMax = pmax;
253  fImport_PhiMin = pmin;
254  fImport_ThetaMax = tmax;
255  fImport_ThetaMin = tmin;
256  fImport_Xorg = xorg;
257  fImport_Yorg = yorg;
258  fImport_Zorg = zorg;
259  }
260  void FillDetectorList(KVReconstructedNucleus* rnuc, KVHashList* DetList, const KVString& DetNames) override;
261 
262  KVGroupReconstructor* GetReconstructorForGroup(const KVGroup*) const override;
263  Double_t GetSetupParameter(const Char_t* parname);
264 
265  const KVFAZIATrigger& GetTrigger() const
266  {
267  return fTrigger;
268  }
269  void SetRawDataFromReconEvent(const KVReconstructedEvent& recev) override;
270  void MakeCalibrationTables(KVExpDB*) override;
271 
272  std::string GetTriggerForCurrentRun() const;
274 
275  static TGeoHMatrix* GetFAZIAVolumePositioningMatrix(Double_t distance, Double_t theta, Double_t phi, TGeoTranslation* postTrans = nullptr)
276  {
299 
300  TGeoRotation rot1, rot2;
301  TGeoTranslation trans;
302  phi += 90;
303  rot1.SetAngles(-phi, 0, 0) ;
304  rot2.SetAngles(phi, theta, 0) ;
305  trans.SetDz(distance) ;
306  TGeoHMatrix h;
307  if (postTrans) h = (*postTrans) * rot2 * trans * rot1 ;
308  else h = rot2 * trans * rot1;
309  TGeoHMatrix* ph = new TGeoHMatrix(h);
310  return ph;
311  }
312  void AssociateTrajectoriesAndNodes() override;
313 
315  {
317  return fSiCsI_idtype;
318  }
319 
320  ClassDefOverride(KVFAZIA, 1) //Base class for description of the FAZIA set up
321 };
322 
324 R__EXTERN KVFAZIA* gFazia;
325 
326 #endif
int Int_t
unsigned int UInt_t
#define R__EXTERN
bool Bool_t
unsigned char UChar_t
char Char_t
short Short_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:18
Base class to describe database of an experiment ,,.
Definition: KVExpDB.h:61
The trigger pattern for each FAZIA event.
void SetTriggerPattern(uint16_t tp)
Description of a FAZIA detector geometry.
Definition: KVFAZIA.h:33
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:245
Double_t GetSetupParameter(const Char_t *parname)
Definition: KVFAZIA.cpp:75
ECodes
Calibration quality codes attributed to particles reconstructed from data.
Definition: KVFAZIA.h:192
@ NO_CALIBRATION_ATTEMPTED
particle stopped in detectors with no available calibration
Definition: KVFAZIA.h:196
@ NORMAL_CALIBRATION
normal well-calibrated particle with no problems
Definition: KVFAZIA.h:197
@ WARNING_CSI_MAX_ENERGY
particle calibration OK, although apparent energy would mean punching through the CsI
Definition: KVFAZIA.h:199
@ ENERGY_LOSSES_TENTATIVELY_CALCULATED
particle calibration OK, with some detector energies tentatively calculated (Z<2)
Definition: KVFAZIA.h:200
@ SOME_ENERGY_LOSSES_CALCULATED
particle calibration OK, with some detector energies calculated
Definition: KVFAZIA.h:198
TString GetIDCodeMeaning(Int_t idc) const override
Definition: KVFAZIA.h:159
std::string GetTriggerForCurrentRun() const
Definition: KVFAZIA.cpp:151
void AddDetectorLabel(const Char_t *label)
Definition: KVFAZIA.cpp:375
TString GetECodeMeaning(Int_t ec) const override
Definition: KVFAZIA.h:202
const KVFAZIATrigger & GetTrigger() const
Definition: KVFAZIA.h:265
void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *dets) override
Definition: KVFAZIA.cpp:645
void AssociateTrajectoriesAndNodes() override
Definition: KVFAZIA.cpp:316
Int_t GetNumberOfBlocks() const
Definition: KVFAZIA.h:227
TString GetSiCsIIDType() const
Definition: KVFAZIA.h:314
void Build(Int_t=-1) override
Build the FAZIA array.
Definition: KVFAZIA.cpp:610
static TGeoHMatrix * GetFAZIAVolumePositioningMatrix(Double_t distance, Double_t theta, Double_t phi, TGeoTranslation *postTrans=nullptr)
Definition: KVFAZIA.h:275
Int_t GetIDCodeForParticlesStoppingInFirstStageOfTelescopes() const override
Definition: KVFAZIA.h:150
void DeduceIdentificationTelescopesFromGeometry() override
Definition: KVFAZIA.cpp:205
KVFAZIA(const Char_t *title="")
Default constructor.
Definition: KVFAZIA.cpp:51
void FillDetectorList(KVReconstructedNucleus *rnuc, KVHashList *DetList, const KVString &DetNames) override
Definition: KVFAZIA.cpp:691
virtual ~KVFAZIA()
Destructor.
Definition: KVFAZIA.cpp:364
KVGroupReconstructor * GetReconstructorForGroup(const KVGroup *) const override
Specialized group reconstructor for FAZIA.
Definition: KVFAZIA.cpp:739
IDCodes
Identification quality codes attributed to particles reconstructed from data.
Definition: KVFAZIA.h:131
@ ID_SI12_CSI
particle identified in (SI1+SI2)-CSI telescope
Definition: KVFAZIA.h:142
@ ID_SI1_SI2_MAYBE_PUNCH_THROUGH
possible ambiguity of particle identification in SI1-SI2 due to unvetoed punch-through
Definition: KVFAZIA.h:145
@ ID_CSI_PSA
particle identified by pulse shape analysis in CSI
Definition: KVFAZIA.h:143
@ ID_STOPPED_IN_FIRST_STAGE
particle stopped in SI1, no identification possible better than estimation of minimum Z
Definition: KVFAZIA.h:144
@ ID_SI1_SI2_PUNCH_THROUGH
particle punching through SI2, identified Z is a minimum value
Definition: KVFAZIA.h:146
@ ID_SI1_CSI
particle identified in SI1-SI2 telescope
Definition: KVFAZIA.h:139
@ ID_SI1_PSA
particle identified by pulse shape analysis in SI1
Definition: KVFAZIA.h:137
@ ID_SI1_PUNCH_THROUGH
particle partially identified by pulse shape analysis in SI1, although it is punching through (no SI2...
Definition: KVFAZIA.h:147
@ ID_SI2_PSA
particle identified by pulse shape analysis in SI1
Definition: KVFAZIA.h:140
@ NO_IDENTIFICATION
no identification possible for particle
Definition: KVFAZIA.h:135
@ ID_GAMMA
'gamma' particle identified by pulse shape analysis in CSI
Definition: KVFAZIA.h:136
@ ID_SI2_CSI
particle identified in SI2-CSI telescope
Definition: KVFAZIA.h:141
@ ID_INCOHERENT
particle with incoherent identifications (CCode>=0)
Definition: KVFAZIA.h:148
@ ID_SI1_SI2
particle identified in SI1-SI2 telescope
Definition: KVFAZIA.h:138
const Char_t * GetSignalTypes() const
Definition: KVFAZIA.h:240
void IncludeTargetInGeometry(Bool_t include=kTRUE)
Definition: KVFAZIA.h:231
KVString GetDetectorLabels() const
Definition: KVFAZIA.h:236
void SetRawDataFromReconEvent(const KVReconstructedEvent &recev) override
Set values of all raw data parameters and the value of the trigger bit pattern for the event.
Definition: KVFAZIA.cpp:89
Short_t GetBadIDCode() const override
Definition: KVFAZIA.h:154
void MakeCalibrationTables(KVExpDB *) override
Override base method in order to read FAZIA trigger for each run.
Definition: KVFAZIA.cpp:127
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:20
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:85
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
Read Google Protobuf DAQ files.
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
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
auto * tt