KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVReconstructedEvent.cpp
Go to the documentation of this file.
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  *classname): KVEvent(mult,
52  classname)
53 {
54  init();
55  CustomStreamer(); //because KVReconstructedNucleus has a customised streamer
56 }
57 
58 
59 
60 
65 
66 void KVReconstructedEvent::Streamer(TBuffer& R__b)
67 {
68  //Stream an object of class KVReconstructedEvent.
69  //We set the particles' angles depending on whether mean or random angles
70  //are wanted (fMeanAngles = kTRUE or kFALSE)
71 
72  if (R__b.IsReading()) {
73  R__b.ReadClassBuffer(KVReconstructedEvent::Class(), this);
74  // if the multidetector object exists, update some informations
75  // concerning the detectors etc. hit by this particle
76  if (gMultiDetArray) {
77  // reset raw data in detectors if found in parameter list
79  //set angles
81  for (KVEvent::Iterator it = begin(); it != end(); ++it) {
82  par = it.get_pointer<KVReconstructedNucleus>();
83  if (HasMeanAngles())
85  else
87  //reconstruct fAnalStatus information for unidentified KVReconstructedNucleus
88  if (!par->IsIdentified() && par->GetStatus() == 99) //AnalStatus has not been set for particles in group
89  if (par->GetGroup())
91  // apply identification & calibration code selection
93  }
94  }
95  }
96  else {
97  R__b.WriteClassBuffer(KVReconstructedEvent::Class(), this);
98  }
99 }
100 
101 
102 
103 
104 
115 
117 {
118  // Loop over detectors in list
119  // if any detector has fired, start construction of new detected particle
120  // More precisely: If detector has fired,
121  // making sure fired detector hasn't already been used to reconstruct
122  // a particle, then we create and fill a new detected particle.
123  // In order to avoid creating spurious particles when reading data,
124  // by default we ask that ALL coder values be non-zero here i.e. data and time-marker.
125  // This can be changed by calling SetPartSeedCond("any"): in this case,
126  // particles will be reconstructed starting from detectors with at least 1 fired parameter.
127 
128  KVDetector* d;
129  TIter next(kvtl);
130  while ((d = (KVDetector*)next())) {
131  /*
132  If detector has fired,
133  making sure fired detector hasn't already been used to reconstruct
134  a particle, then we create and fill a new detected particle.
135  */
136  if ((d->Fired(fPartSeedCond.Data()) && !d->IsAnalysed())) {
137 
139  //add all active detector layers in front of this one
140  //to the detected particle's list
141  kvdp->Reconstruct(d);
142 
143  //set detector state so it will not be used again
144  d->SetAnalysed(kTRUE);
145  }
146  }
147 
148  return kTRUE;
149 }
150 
151 
152 
153 
157 
159 {
160  //Print out list of particles in the event.
161  //If option="ok" only particles with IsOK=kTRUE are included.
162 
163  cout << " ***//*** RECONSTRUCTED EVENT #" << GetNumber() << " ***//***" << endl;
164  cout << GetTitle() << endl; //system
165  cout << GetName() << endl; //run
166  cout << "MULTIPLICITY = " << ((KVReconstructedEvent*) this)->
167  GetMult(option) << endl << endl;
168 
169  KVReconstructedNucleus* frag = 0;
170  int i = 0;
171  ((KVReconstructedEvent*) this)->ResetGetNextParticle();
172  while ((frag =
173  ((KVReconstructedEvent*) this)->GetNextParticle(option))) {
174  cout << "RECONSTRUCTED PARTICLE #" << ++i << endl;
175  frag->Print();
176  cout << endl;
177  }
178 
179 }
180 
181 
182 
185 
187 {
188  // compact listing of reconstructed event
189  printf(":::%s #%07d M=%03d\n", ClassName(), GetNumber(), GetMult());
190  GetParameters()->Print();
191  int i(0);
192  for (KVEvent::Iterator it = begin(); it != end(); ++it) {
193  KVReconstructedNucleus& nuc = it.get_reference<KVReconstructedNucleus>();
194  printf(" %3d", i);
195  nuc.ls();
196  ++i;
197  }
198 }
199 
200 
201 
202 
209 
211 {
212  //All particles which have not been previously identified (IsIdentified=kFALSE), and which
213  //may be identified independently of all other particles in their group according to the 1st
214  //order coherency analysis (KVReconstructedNucleus::GetStatus=0), will be identified.
215  //Particles stopping in first member of a telescope (KVReconstructedNucleus::GetStatus=3) will
216  //have their Z estimated from the energy loss in the detector (if calibrated).
217 
218  Obsolete("IdentifyEvent", "1.13", "1.15");
219 // KVReconstructedNucleus* d;
220 // while ((d = GetNextParticle())) {
221 // if (!d->IsIdentified()) {
222 // if (d->GetStatus() == KVReconstructedNucleus::kStatusOK) {
223 // // identifiable particles
224 // d->Identify();
225 // }
226 // else if (d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
227 // // particles stopped in first member of a telescope
228 // // estimation of Z (minimum) from energy loss (if detector is calibrated)
229 // UInt_t zmin = d->GetStoppingDetector()->FindZmin(-1., d->GetMassFormula());
230 // if (zmin) {
231 // d->SetZ(zmin);
232 // d->SetIsIdentified();
233 // // "Identifying" telescope is taken from list of ID telescopes
234 // // to which stopping detector belongs
235 // d->SetIdentifyingTelescope((KVIDTelescope*)d->GetStoppingDetector()->GetIDTelescopes()->At(0));
236 // }
237 // }
238 // }
239 // }
240 }
241 
242 
243 
244 
254 
256 {
257  // Calculate and set energies of all identified particles in event.
258  //
259  // This will call the KVReconstructedNucleus::Calibrate() method of each
260  // uncalibrated particle (those for which KVReconstructedNucleus::IsCalibrated()
261  // returns kFALSE).
262  //
263  // In order to make sure that target energy loss corrections are correctly
264  // calculated, we first set the state of the target in the current multidetector
265 
267  if (t) {
268  t->SetIncoming(kFALSE);
269  t->SetOutgoing(kTRUE);
270  }
271 
273 
274  while ((d = GetNextParticle())) {
275 
276  if (d->IsIdentified() && !d->IsCalibrated()) {
277  d->Calibrate();
278  }
279 
280  }
281 
282 }
283 
284 
285 
299 
301 {
302  // Merge all events in the list into one event (this one)
303  // First we clear this event, then we fill it with copies of each particle in each event
304  // in the list.
305  // If option "opt" is given, it is given as argument to each call to
306  // KVEvent::Clear() - this option is then passed on to the Clear()
307  // method of each particle in each event.
308  // NOTE: the events in the list will be empty and useless after this!
309  //
310  // This method overrides the one defined in KVEvent. As KVReconstructedNucleus objects
311  // are referenced by the detectors used in their reconstruction, we also have to update
312  // the references in the detectors otherwise they will still reference the particles
313  // in the events in the list, which will no longer be valid after this operation.
314 
315  Clear(opt);
316  TIter it(events);
318  while ((e = (KVReconstructedEvent*)it())) {
320  if (e->GetMult()) {
321  e->ResetGetNextParticle();
322  while ((n = e->GetNextParticle())) {
324  }
325  }
326  GetParameters()->Merge(*(e->GetParameters()));
327  e->Clear(opt);
328  }
329 }
330 
331 
332 
333 
334 
int Int_t
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define d(i)
#define e(i)
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
const char Option_t
UInt_t GetNumber() const
Definition: KVBase.h:213
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Base class container for multi-particle events.
Definition: KVEvent.h:176
KVNameValueList * GetParameters() const
Definition: KVEvent.h:391
Iterator begin() const
Definition: KVEvent.h:423
KVNameValueList fParameters
general-purpose list of parameters
Definition: KVEvent.h:181
virtual void Clear(Option_t *opt="")
Definition: KVEvent.cpp:200
Iterator end() const
Definition: KVEvent.h:428
virtual Int_t GetMult(Option_t *opt="") const
Definition: KVEvent.cpp:278
void CustomStreamer()
Definition: KVEvent.h:443
KVTarget * GetTarget()
virtual void SetRawDataFromReconEvent(KVNameValueList &)
virtual void AcceptParticleForAnalysis(KVReconstructedNucleus *) const
virtual void Print(Option_t *opt="") const
void Merge(const KVNameValueList &)
Physical event reconstructed from data measured with a detector array using implemented identificatio...
virtual Bool_t AnalyseDetectors(TList *kvtl)
TString fPartSeedCond
condition used in AnalyseTelescopes for seeding new reconstructed particle
void ls(Option_t *="") const
compact listing of reconstructed event
KVReconstructedNucleus * AddParticle()
virtual void Print(Option_t *t="") const
void MergeEventFragments(TCollection *, Option_t *opt="")
KVReconstructedEvent(Int_t mult=50, const char *classname="KVReconstructedNucleus")
KVReconstructedNucleus * GetNextParticle(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 *)
void ls(Option_t *="") const
virtual void Print(Option_t *option="") const
Display nucleus parameters.
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:126
void SetIncoming(Bool_t r=kTRUE)
Definition: KVTarget.h:216
void SetOutgoing(Bool_t r=kTRUE)
Definition: KVTarget.h:237
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Bool_t IsReading() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual const char * GetName() const
virtual const char * GetTitle() const
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