KaliVeda
Toolkit for HIC analysis
KVReconstructedEvent.cpp
1 /***************************************************************************
2  kvreconstructedevent.cpp - description
3  -------------------
4  begin : March 11th 2005
5  copyright : (C) 2005 by J.D. Frankland
6  email : frankland@ganil.fr
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "KVReconstructedEvent.h"
19 #include "KVDetectorEvent.h"
20 #include "KVGroup.h"
21 #include "Riostream.h"
22 #include "KVReconstructedNucleus.h"
23 #include "KVTelescope.h"
24 #include "KVDetector.h"
25 #include "KVTarget.h"
26 #include "KVMultiDetArray.h"
27 #include <iomanip>
28 
29 using namespace std;
30 
32 
33 
34 
35 
38 
40 {
41  //default initialisations
42  UseRandomAngles();
43  fPartSeedCond = "all";
44 }
45 
46 
47 
49 
51 {
52  init();
53  CustomStreamer(); //because KVReconstructedNucleus has a customised streamer
54 }
55 
56 
57 
58 
68 
70 {
71  // Stream an object of class KVReconstructedEvent.
72  //
73  // If the KVMultiDetArray corresponding to the event has been built, we:
74  //
75  // - set the values of raw data parameters in the corresponding detectors
76  //
77  // - set the particles' angles depending on whether mean or random angles
78  // are wanted (fMeanAngles = kTRUE or kFALSE)
79 
80  if (R__b.IsReading()) {
82  // if the multidetector object exists, update some informations
83  // concerning the detectors etc. hit by this particle
84  if (gMultiDetArray) {
85  // reset raw data in detectors if found in parameter list
86  gMultiDetArray->SetRawDataFromReconEvent(fParameters);
87  //set angles
89  for (KVReconstructedEvent::Iterator it = begin(); it != end(); ++it) {
90  par = it.get_pointer();
91  if (HasMeanAngles())
93  else
95  //reconstruct fAnalStatus information for unidentified KVReconstructedNucleus
96  if (!par->IsIdentified() && par->GetStatus() == 99) //AnalStatus has not been set for particles in group
97  if (par->GetGroup())
99  // apply identification & calibration code selection
100  gMultiDetArray->AcceptParticleForAnalysis(par);
101  }
102  }
103  }
104  else {
106  }
107 }
108 
109 
110 
111 
112 
123 
125 {
126  // Loop over detectors in list
127  // if any detector has fired, start construction of new detected particle
128  // More precisely: If detector has fired,
129  // making sure fired detector hasn't already been used to reconstruct
130  // a particle, then we create and fill a new detected particle.
131  // In order to avoid creating spurious particles when reading data,
132  // by default we ask that ALL coder values be non-zero here i.e. data and time-marker.
133  // This can be changed by calling SetPartSeedCond("any"): in this case,
134  // particles will be reconstructed starting from detectors with at least 1 fired parameter.
135 
136  KVDetector* d;
137  TIter next(kvtl);
138  while ((d = (KVDetector*)next())) {
139  /*
140  If detector has fired,
141  making sure fired detector hasn't already been used to reconstruct
142  a particle, then we create and fill a new detected particle.
143  */
144  if ((d->Fired(fPartSeedCond.Data()) && !d->IsAnalysed())) {
145 
147  //add all active detector layers in front of this one
148  //to the detected particle's list
149  kvdp->Reconstruct(d);
150 
151  //set detector state so it will not be used again
152  d->SetAnalysed(kTRUE);
153  }
154  }
155 
156  return kTRUE;
157 }
158 
159 
160 
161 
168 
170 {
171  // Print out detailed information on each particle in the event.
172  //
173  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
174  // particles shown to those which correspond to the given criteria. This also
175  // affects the displayed event multiplicity.
176 
177  cout << " ***//*** RECONSTRUCTED EVENT #" << GetNumber() << " ***//***" << endl;
178  cout << GetTitle() << endl; //system
179  cout << GetName() << endl; //run
180  cout << "MULTIPLICITY = " << ((KVReconstructedEvent*) this)->
181  GetMult(option) << endl << endl;
182 
183  int i = 1;
184  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
185  auto& frag = it.get_const_reference();
186  cout << "RECONSTRUCTED PARTICLE #" << ++i << endl;
187  frag.Print();
188  cout << endl;
189  }
190 
191 }
192 
193 
194 
201 
203 {
204  // Print out compact listing of all particles in event.
205  //
206  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
207  // particles shown to those which correspond to the given criteria. This also
208  // affects the displayed event multiplicity.
209 
210  printf(":::%s #%07d M=%03d\n", ClassName(), GetNumber(), GetMult());
211  GetParameters()->Print();
212  int i(1);
213  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
214  auto& nuc = it.get_const_reference();
215  printf(" %3d", i);
216  nuc.ls();
217  ++i;
218  }
219 }
220 
221 
222 
223 
230 
232 {
233  //All particles which have not been previously identified (IsIdentified=kFALSE), and which
234  //may be identified independently of all other particles in their group according to the 1st
235  //order coherency analysis (KVReconstructedNucleus::GetStatus=0), will be identified.
236  //Particles stopping in first member of a telescope (KVReconstructedNucleus::GetStatus=3) will
237  //have their Z estimated from the energy loss in the detector (if calibrated).
238 
239  Obsolete("IdentifyEvent", "1.13", "1.15");
240 // KVReconstructedNucleus* d;
241 // while ((d = GetNextParticle())) {
242 // if (!d->IsIdentified()) {
243 // if (d->GetStatus() == KVReconstructedNucleus::kStatusOK) {
244 // // identifiable particles
245 // d->Identify();
246 // }
247 // else if (d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
248 // // particles stopped in first member of a telescope
249 // // estimation of Z (minimum) from energy loss (if detector is calibrated)
250 // UInt_t zmin = d->GetStoppingDetector()->FindZmin(-1., d->GetMassFormula());
251 // if (zmin) {
252 // d->SetZ(zmin);
253 // d->SetIsIdentified();
254 // // "Identifying" telescope is taken from list of ID telescopes
255 // // to which stopping detector belongs
256 // d->SetIdentifyingTelescope((KVIDTelescope*)d->GetStoppingDetector()->GetIDTelescopes()->At(0));
257 // }
258 // }
259 // }
260 // }
261 }
262 
263 
264 
265 
275 
277 {
278  // Calculate and set energies of all identified particles in event.
279  //
280  // This will call the KVReconstructedNucleus::Calibrate() method of each
281  // uncalibrated particle (those for which KVReconstructedNucleus::IsCalibrated()
282  // returns kFALSE).
283  //
284  // In order to make sure that target energy loss corrections are correctly
285  // calculated, we first set the state of the target in the current multidetector
286 
287  KVTarget* t = gMultiDetArray->GetTarget();
288  if (t) {
289  t->SetIncoming(kFALSE);
290  t->SetOutgoing(kTRUE);
291  }
292 
294 
295  while ((d = GetNextParticle())) {
296 
297  if (d->IsIdentified() && !d->IsCalibrated()) {
298  d->Calibrate();
299  }
300 
301  }
302 
303 }
304 
305 
306 
320 
322 {
323  // Merge all events in the list into one event (this one)
324  // First we clear this event, then we fill it with copies of each particle in each event
325  // in the list.
326  // If option "opt" is given, it is given as argument to each call to
327  // KVEvent::Clear() - this option is then passed on to the Clear()
328  // method of each particle in each event.
329  // NOTE: the events in the list will be empty and useless after this!
330  //
331  // This method overrides the one defined in KVEvent. As KVReconstructedNucleus objects
332  // are referenced by the detectors used in their reconstruction, we also have to update
333  // the references in the detectors otherwise they will still reference the particles
334  // in the events in the list, which will no longer be valid after this operation.
335 
336  Clear(opt);
337  TIter it(events);
339  while ((e = (KVReconstructedEvent*)it())) {
340  if (e->GetMult()) {
341  for (auto& n : ReconEventIterator(e)) {
343  }
344  }
345  GetParameters()->Merge(*(e->GetParameters()));
346  e->Clear(opt);
347  }
348 }
349 
350 
351 
352 
353 
int Int_t
#define d(i)
#define e(i)
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
const char Option_t
Option_t Option_t option
UInt_t GetNumber() const
Definition: KVBase.h:220
Base class for detector geometry description.
Definition: KVDetector.h:160
KVNameValueList * GetParameters() const
Definition: KVEvent.h:179
KVNameValueList fParameters
general-purpose list of parameters
Definition: KVEvent.h:72
void Clear(Option_t *opt="")
Definition: KVEvent.h:238
void CustomStreamer()
Definition: KVEvent.h:174
KVTarget * GetTarget()
virtual void SetRawDataFromReconEvent(KVNameValueList &)
virtual void AcceptParticleForAnalysis(KVReconstructedNucleus *) const
virtual void Print(Option_t *opt="") const
void Merge(const KVNameValueList &)
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
void ls(Option_t *option="") const
virtual void Print(Option_t *option="") const
virtual Bool_t AnalyseDetectors(TList *kvtl)
TString fPartSeedCond
condition used in AnalyseTelescopes for seeding new reconstructed particle
KVReconstructedEvent(Int_t mult=50)
void MergeEventFragments(TCollection *, Option_t *opt="")
void init()
default initialisations
Nuclei reconstructed from data measured by a detector array .
virtual void Reconstruct(KVDetector *kvd)
void CopyAndMoveReferences(const KVReconstructedNucleus *)
virtual void GetAnglesFromReconstructionTrajectory(Option_t *opt="random")
static void AnalyseParticlesInGroup(KVGroup *grp)
Calculation/correction of energy losses of particles through an experimental target.
Definition: KVTarget.h:127
void SetIncoming(Bool_t r=kTRUE)
Definition: KVTarget.h:217
void SetOutgoing(Bool_t r=kTRUE)
Definition: KVTarget.h:237
Base class for event classes (containers for different types of particle objects)
KVReconstructedNucleus * GetNextParticle(Option_t *opt="") const
Iterator GetNextParticleIterator(Option_t *opt) const
virtual Int_t GetMult(Option_t *opt="") const
KVReconstructedNucleus * AddParticle()
Wrapper class for iterating over nuclei in KVReconstructedEvent accessed through base pointer or refe...
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetName() const override
void Streamer(TBuffer &) override
const char * GetTitle() const override
static TClass * Class()
virtual const char * ClassName() const
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
const char * Data() const
const Int_t n
ClassImp(TPyArg)