KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVINDRAReconEvent.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kvindrareconevent.cpp - description
3  -------------------
4  begin : Thu Oct 10 2002
5  copyright : (C) 2002 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 "Riostream.h"
19 #include "TROOT.h"
20 #include "KVINDRAReconEvent.h"
21 #include "KVList.h"
22 #include "KVGroup.h"
23 #include "KVTelescope.h"
24 #include "KVDetector.h"
25 #include "KVCsI.h"
26 #include "KVSilicon.h"
27 #include "KVDetectorEvent.h"
28 #include "KVINDRAReconNuc.h"
29 #include "KVINDRA.h"
30 #include "TStreamerInfo.h"
31 #include "KVIDCsI.h"
32 #include "KVIDGCsI.h"
33 #include "KVDataSet.h"
34 #include "KVChIo.h"
35 
36 using namespace std;
37 
39 
40 
43 
45 {
46  //default initialisations
47  fCodeMask = 0;
48  fHitGroups = 0;
49 }
50 
51 
52 
53 
55 
56 KVINDRAReconEvent::KVINDRAReconEvent(Int_t mult, const char* classname)
57  : KVReconstructedEvent(mult, classname)
58 {
59  init();
60 }
61 
62 
63 
65 
66 KVINDRAReconEvent::~KVINDRAReconEvent()
67 {
68  if (fCodeMask) {
69  delete fCodeMask;
70  fCodeMask = 0;
71  }
73 };
74 
75 
77 
78 
83 
85 {
86  //
87  //Access to event member with index npart (1<=npart<=fMult)
88  //
89 
91 }
92 
93 
95 
96 
99 
101 {
102  //Wrapper for KVEvent::GetNextParticle casting result to KVINDRAReconNuc*
103 
105  return tmp;
106 }
107 
108 
109 
113 
115 {
116  //Print out list of particles in the event.
117  //If option="ok" only particles with IsOK=kTRUE are included.
118 
119  cout << GetTitle() << endl; //system
120  cout << GetName() << endl; //run
121  cout << "Event number: " << GetNumber() << endl << endl;
122  cout << "MULTIPLICITY = " << ((KVINDRAReconEvent*) this)->
123  GetMult(option) << endl << endl;
124 
125  KVINDRAReconNuc* frag = 0;
126  while ((frag = ((KVINDRAReconEvent*) this)->GetNextParticle(option))) {
127  frag->Print();
128  }
129 }
130 
131 
132 
147 
149 {
150  //Use this method to iterate over the list of particles in the event.
151  //
152  //If opt="ok" only the particles whose ID codes and E codes correspond to those set using AcceptIDCodes and
153  //AcceptECodes will be returned, in the order in which they appear in the event.
154  //
155  //After the last particle in the event GetNextParticle() returns a null pointer and
156  //resets itself ready for a new iteration over the particle list.
157  //Therefore, to loop over all particles in an event, use a structure like:
158  //
159  // KVINDRAReconNuc* p;
160  // while( (p = GetNextParticle() ){
161  // ... your code here ...
162  // }
163 
165 }
166 
167 
168 
169 
185 
187 {
188  //Changes the mass formula used to calculate A from Z for all nuclei in event
189  //For the values of mass_formula, see KVNucleus::GetAFromZ
190  //
191  //The fragment energy is modified in proportion to its mass, this is due to the
192  //contribution from the CsI light-energy calibration:
193  //
194  // E -> E + E_CsI*( newA/oldA - 1 )
195  //
196  //From an original lunch by Remi Bougault.
197  //
198  //Only particles with 'acceptable' ID & E codes stopping in (or passing through)
199  //a CsI detector are affected; particles whose mass was measured
200  //(i.e. having KVReconstructedNucleus::IsAMeasured()==kTRUE)
201  //are not affected by the change of mass formula.
202 
204  KVINDRAReconNuc* frag;
205  while ((frag = (KVINDRAReconNuc*)GetNextParticle("ok"))) {
206 
207  if (!frag->IsAMeasured()) {
208 
209  Float_t oldA = (Float_t)frag->GetA();
210  frag->SetMassFormula(mass_formula);
211 
212  if (frag->GetCsI()) {
213  Float_t oldECsI = frag->GetEnergyCsI();
214  Float_t oldE = frag->GetEnergy();
215  Float_t newECsI = oldECsI * ((Float_t)frag->GetA() / oldA);
216  frag->GetCsI()->SetEnergy(newECsI);
217  frag->SetEnergy(oldE - oldECsI + newECsI);
218  }
219  }
220  }
221 
222 }
223 
224 
225 
226 
237 
239 {
240  // Performs event identification (see KVReconstructedEvent::IdentifyEvent), and then
241  // particles stopping in first member of a telescope (GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) are
242  // labelled with VEDA ID code kIDCode5 (Zmin)
243  //
244  // When CsI identification gives a gamma, we unset the 'analysed' state of all detectors
245  // in front of the CsI and reanalyse the group in order to reconstruct and identify charged particles
246  // stopping in them.
247  //
248  // Unidentified particles receive the general ID code for non-identified particles (kIDCode14)
249 
251  KVINDRAReconNuc* d = 0;
252  int mult = GetMult();
253  KVUniqueNameList gammaGroups;//list of groups with gammas identified in CsI
255 
256  while ((d = GetNextParticle())) {
257  if (d->IsIdentified() && d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
258  d->SetIDCode(kIDCode5); // Zmin
259  }
260  else if (d->IsIdentified() && d->GetCodes().TestIDCode(kIDCode0)) {
261  // gamma identified in CsI
262  // reset analysed state of all detectors in front of CsI
263  if (d->GetCsI()) {
264  if (d->GetCsI()->GetAlignedDetectors()) {
265  TIter next(d->GetCsI()->GetAlignedDetectors());
266  KVDetector* det = (KVDetector*)next(); //first detector = CsI
267  while ((det = (KVDetector*)next())) det->SetAnalysed(kFALSE);
268  gammaGroups.Add(d->GetGroup());
269  }
270  else {
271  Error("IdentifyEvent", "particule id gamma, no aligned detectors???");
272  d->Print();
273  }
274  }
275  else {
276  Error("IdentifyEvent", "particule identified as gamma, has no CsI!!");
277  d->Print();
278  }
279  }
280  }
281 
282  // perform secondary reconstruction in groups with detected gammas
283  int ngamG = gammaGroups.GetEntries();
284  if (ngamG) {
285  for (int i = 0; i < ngamG; i++) {
286  gIndra->AnalyseGroupAndReconstructEvent(this, (KVGroup*)gammaGroups.At(i));
287  }
288  }
289  if (GetMult() > mult) {
290  /*Info("IdentifyEvent", "Event#%d: Secondary reconstruction (gammas) -> %d new particles",
291  GetNumber(), GetMult()-mult);*/
292 
293  // identify new particles generated in secondary reconstruction
296 
297  while ((d = GetNextParticle())) {
298  if (d->IsIdentified() && d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
299  d->SetIDCode(kIDCode5); // Zmin
300  }
301  else if (!d->IsIdentified()) {
302  d->SetIDCode(kIDCode14);
303  }
304  }
305  /*
306  for(int i=mult+1; i<=GetMult(); i++){
307  d = GetParticle(i);
308  if(d->IsIdentified())
309  printf("\t%2d: Ring %2d Module %2d Z=%2d A=%3d code=%d\n",i,d->GetRingNumber(),
310  d->GetModuleNumber(),d->GetZ(),d->GetA(),d->GetCodes().GetVedaIDCode());
311  else
312  printf("\t%2d: Ring %2d Module %2d UNIDENTIFIED status=%d\n", i,d->GetRingNumber(),
313  d->GetModuleNumber(), d->GetStatus());
314  }
315  */
316  }
317 }
318 
319 
320 
328 
330 {
331  // Perform identifications and calibrations of particles not included
332  // in first round (methods IdentifyEvent() and CalibrateEvent()).
333  //
334  // Here we treat particles with GetStatus()==KVReconstructedNucleus::kStatusOKafterSub
335  // after subtracting the energy losses of all previously calibrated particles in group from the
336  // measured energy losses in the detectors they crossed.
337 
338  if (!fHitGroups)
340  else
341  fHitGroups->Clear();
342  // build list of hit groups
344  while ((d = GetNextParticle())) fHitGroups->Add(d->GetGroup());
345 
346  //loop over hit groups
347  TIter next_grp(fHitGroups);
348  KVGroup* grp;
349  while ((grp = (KVGroup*)next_grp())) {
351  }
352 
353  // set "unidentified" code for any remaining unidentified particle
355  while ((d = GetNextParticle())) {
356  if (!d->IsIdentified()) {
357  d->SetIDCode(kIDCode14);
358  }
359  }
360 }
361 
362 
363 
365 
367 {
368  Obsolete("SecondaryAnalyseGroup", "1.11", "2.0");
369 }
370 
371 
372 
int Int_t
@ kIDCode5
@ kIDCode14
@ kIDCode0
KVINDRA * gIndra
Definition: KVINDRA.cpp:78
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define SafeDelete(p)
#define d(i)
unsigned char UChar_t
const Bool_t kFALSE
float Float_t
const char Option_t
void AnalyseGroupAndReconstructEvent(KVReconstructedEvent *event, KVGroup *grp)
UInt_t GetNumber() const
Definition: KVBase.h:213
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
virtual void SetEnergy(Double_t e) const
Definition: KVDetector.h:320
void SetAnalysed(Bool_t b=kTRUE)
Definition: KVDetector.h:416
virtual Int_t GetMult(Option_t *opt="") const
Definition: KVEvent.cpp:278
KVNucleus * GetNextParticle(Option_t *opt="") const
Definition: KVEvent.cpp:564
void ResetGetNextParticle() const
Definition: KVEvent.cpp:618
Group of detectors which can be treated independently of all others in array.
Definition: KVGroup.h:19
Event reconstructed from energy losses in INDRA multidetector.
KVINDRAReconNuc * GetParticle(Int_t npart) const
virtual void SecondaryIdentCalib()
void SecondaryAnalyseGroup(KVGroup *grp)
virtual void Print(Option_t *option="") const
KVINDRAReconNuc * GetNextParticle(Option_t *opt="")
void ChangeFragmentMasses(UChar_t mass_formula)
KVUniqueNameList * fHitGroups
non-persistent pointer to list of hit groups used in SecondaryIdentAndCalib()
KVINDRAReconNuc * AddParticle()
Wrapper for KVEvent::GetNextParticle casting result to KVINDRAReconNuc*.
KVINDRAReconEvent(Int_t mult=50, const char *classname="KVINDRAReconNuc")
void init()
default initialisations
KVINDRACodeMask * fCodeMask
VEDA codes accepted for "good" particles (IsOK)
Nuclei reconstructed from data measured in the INDRA array.
void Print(Option_t *option="") const
Display nucleus parameters.
Float_t GetEnergyCsI()
Int_t GetA() const
Definition: KVNucleus.cpp:799
void SetMassFormula(UChar_t mt)
Definition: KVNucleus.h:347
Double_t GetEnergy() const
Definition: KVParticle.h:582
void SetEnergy(Double_t e)
Definition: KVParticle.h:560
Physical event reconstructed from data measured with a detector array using implemented identificatio...
KVReconstructedNucleus * AddParticle()
KVReconstructedNucleus * GetParticle(Int_t npart) const
@ kStatusStopFirstStage
(arbitrarily) between this and the other particle(s) with Status=2
virtual Bool_t IsAMeasured() const
virtual void Clear(Option_t *option="")
virtual TObject * At(Int_t idx) const
Optimised list in which named objects can only be placed once.
virtual void Add(TObject *obj)
virtual Int_t GetEntries() const
virtual const char * GetName() const
virtual const char * GetTitle() const
virtual void Error(const char *method, const char *msgfmt,...) const
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const