KaliVeda  1.13/01
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 
54 
56  : KVReconstructedEvent(mult)
57 {
58  init();
59  // KLUDGE: we have to destroy the TClonesArray in order to change
60  // the class used for particles from KVReconstructedNucleus to
61  // KVINDRAReconNuc
62  delete fParticles;
63  fParticles = new TClonesArray(KVINDRAReconNuc::Class(), mult);
65 }
66 
67 
68 
70 
71 KVINDRAReconEvent::~KVINDRAReconEvent()
72 {
73  if (fCodeMask) {
74  delete fCodeMask;
75  fCodeMask = 0;
76  }
78 };
79 
80 
81 
83 
92 
93 void KVINDRAReconEvent::Streamer(TBuffer& R__b)
94 {
95  // Stream an object of class KVINDRAReconEvent.
96  // If acceptable ID/E codes have been set with methods AcceptIDCodes()/
97  // AcceptECodes(), we loop over the newly-read particles in order to set
98  // their IsOK() status according to these choices.
99  // If not, it will have already been set according to the default code
100  // selection (defined by [DataSet].INDRA.ReconstructedNuclei.AcceptID/ECodes)
101  // in KVReconstructedNucleus::Streamer
102 
103  if (R__b.IsReading()) {
104  R__b.ReadClassBuffer(KVINDRAReconEvent::Class(), this);
105  if (fCodeMask && !fCodeMask->IsNull()) {
106  KVINDRAReconNuc* par;
107  while ((par = (KVINDRAReconNuc*)GetNextParticle())) {
108  par->SetIsOK(CheckCodes(par->GetCodes()));
109  }
110  }
111  }
112  else {
113  R__b.WriteClassBuffer(KVINDRAReconEvent::Class(), this);
114  }
115 }
116 
117 
118 
122 
124 {
125  //Print out list of particles in the event.
126  //If option="ok" only particles with IsOK=kTRUE are included.
127 
128  cout << GetTitle() << endl; //system
129  cout << GetName() << endl; //run
130  cout << "Event number: " << GetNumber() << endl << endl;
131  cout << "MULTIPLICITY = " << ((KVINDRAReconEvent*) this)->
132  GetMult(option) << endl << endl;
133 
134  KVINDRAReconNuc* frag = 0;
135  while ((frag = (KVINDRAReconNuc*)GetNextParticle(option))) {
136  frag->Print();
137  }
138 }
139 
140 
141 
142 
158 
160 {
161  //Changes the mass formula used to calculate A from Z for all nuclei in event
162  //For the values of mass_formula, see KVNucleus::GetAFromZ
163  //
164  //The fragment energy is modified in proportion to its mass, this is due to the
165  //contribution from the CsI light-energy calibration:
166  //
167  // E -> E + E_CsI*( newA/oldA - 1 )
168  //
169  //From an original lunch by Remi Bougault.
170  //
171  //Only particles with 'acceptable' ID & E codes stopping in (or passing through)
172  //a CsI detector are affected; particles whose mass was measured
173  //(i.e. having KVReconstructedNucleus::IsAMeasured()==kTRUE)
174  //are not affected by the change of mass formula.
175 
177  KVINDRAReconNuc* frag;
178  while ((frag = (KVINDRAReconNuc*)GetNextParticle("ok"))) {
179 
180  if (!frag->IsAMeasured()) {
181 
182  Float_t oldA = (Float_t)frag->GetA();
183  frag->SetMassFormula(mass_formula);
184 
185  if (frag->GetCsI()) {
186  Float_t oldECsI = frag->GetEnergyCsI();
187  Float_t oldE = frag->GetEnergy();
188  Float_t newECsI = oldECsI * ((Float_t)frag->GetA() / oldA);
189  frag->GetCsI()->SetEnergy(newECsI);
190  frag->SetEnergy(oldE - oldECsI + newECsI);
191  }
192  }
193  }
194 
195 }
196 
197 
198 //____________________________________________________________________________
199 
200 //void KVINDRAReconEvent::IdentifyEvent()
201 //{
202 // // Performs event identification (see KVReconstructedEvent::IdentifyEvent), and then
203 // // particles stopping in first member of a telescope (GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) are
204 // // labelled with VEDA ID code kIDCode5 (Zmin)
205 // //
206 // // When CsI identification gives a gamma, we unset the 'analysed' state of all detectors
207 // // in front of the CsI and reanalyse the group in order to reconstruct and identify charged particles
208 // // stopping in them.
209 // //
210 // // Unidentified particles receive the general ID code for non-identified particles (kIDCode14)
211 
212 // KVReconstructedEvent::IdentifyEvent();
213 // KVINDRAReconNuc* d = 0;
214 // int mult = GetMult();
215 // KVUniqueNameList gammaGroups;//list of groups with gammas identified in CsI
216 // ResetGetNextParticle();
217 
218 // while ((d = GetNextParticle())) {
219 // if (d->IsIdentified() && d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
220 // d->SetIDCode(kIDCode5); // Zmin
221 // }
222 // else if (d->IsIdentified() && d->GetCodes().TestIDCode(kIDCode0)) {
223 // // gamma identified in CsI
224 // // reset analysed state of all detectors in front of CsI
225 // if (d->GetCsI()) {
226 // if (d->GetCsI()->GetAlignedDetectors()) {
227 // TIter next(d->GetCsI()->GetAlignedDetectors());
228 // KVDetector* det = (KVDetector*)next(); //first detector = CsI
229 // while ((det = (KVDetector*)next())) det->SetAnalysed(kFALSE);
230 // gammaGroups.Add(d->GetGroup());
231 // }
232 // else {
233 // Error("IdentifyEvent", "particule id gamma, no aligned detectors???");
234 // d->Print();
235 // }
236 // }
237 // else {
238 // Error("IdentifyEvent", "particule identified as gamma, has no CsI!!");
239 // d->Print();
240 // }
241 // }
242 // }
243 
244 // // perform secondary reconstruction in groups with detected gammas
245 // int ngamG = gammaGroups.GetEntries();
246 // if (ngamG) {
247 // for (int i = 0; i < ngamG; i++) {
248 // gIndra->AnalyseGroupAndReconstructEvent(this, (KVGroup*)gammaGroups.At(i));
249 // }
250 // }
251 // if (GetMult() > mult) {
252 // /*Info("IdentifyEvent", "Event#%d: Secondary reconstruction (gammas) -> %d new particles",
253 // GetNumber(), GetMult()-mult);*/
254 
255 // // identify new particles generated in secondary reconstruction
256 // KVReconstructedEvent::IdentifyEvent();
257 // ResetGetNextParticle();
258 
259 // while ((d = GetNextParticle())) {
260 // if (d->IsIdentified() && d->GetStatus() == KVReconstructedNucleus::kStatusStopFirstStage) {
261 // d->SetIDCode(kIDCode5); // Zmin
262 // }
263 // else if (!d->IsIdentified()) {
264 // d->SetIDCode(kIDCode14);
265 // }
266 // }
267 // /*
268 // for(int i=mult+1; i<=GetMult(); i++){
269 // d = GetParticle(i);
270 // if(d->IsIdentified())
271 // printf("\t%2d: Ring %2d Module %2d Z=%2d A=%3d code=%d\n",i,d->GetRingNumber(),
272 // d->GetModuleNumber(),d->GetZ(),d->GetA(),d->GetCodes().GetVedaIDCode());
273 // else
274 // printf("\t%2d: Ring %2d Module %2d UNIDENTIFIED status=%d\n", i,d->GetRingNumber(),
275 // d->GetModuleNumber(), d->GetStatus());
276 // }
277 // */
278 // }
279 //}
280 
281 //void KVINDRAReconEvent::SecondaryIdentCalib()
282 //{
283 // // Perform identifications and calibrations of particles not included
284 // // in first round (methods IdentifyEvent() and CalibrateEvent()).
285 // //
286 // // Here we treat particles with GetStatus()==KVReconstructedNucleus::kStatusOKafterSub
287 // // after subtracting the energy losses of all previously calibrated particles in group from the
288 // // measured energy losses in the detectors they crossed.
289 
290 // if (!fHitGroups)
291 // fHitGroups = new KVUniqueNameList;
292 // else
293 // fHitGroups->Clear();
294 // // build list of hit groups
295 // KVINDRAReconNuc* d;
296 // while ((d = GetNextParticle())) fHitGroups->Add(d->GetGroup());
297 
298 // //loop over hit groups
299 // TIter next_grp(fHitGroups);
300 // KVGroup* grp;
301 // while ((grp = (KVGroup*)next_grp())) {
302 // SecondaryAnalyseGroup(grp);
303 // }
304 
305 // // set "unidentified" code for any remaining unidentified particle
306 // ResetGetNextParticle();
307 // while ((d = GetNextParticle())) {
308 // if (!d->IsIdentified()) {
309 // d->SetIDCode(kIDCode14);
310 // }
311 // }
312 //}
313 
314 //void KVINDRAReconEvent::SecondaryAnalyseGroup(KVGroup*)
315 //{
316 // Obsolete("SecondaryAnalyseGroup", "1.11", "2.0");
317 //}
318 
319 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define SafeDelete(p)
unsigned char UChar_t
float Float_t
const char Option_t
UInt_t GetNumber() const
Definition: KVBase.h:219
virtual void SetEnergy(Double_t e) const
Definition: KVDetector.h:360
TClonesArray * fParticles
array of particles in event
Definition: KVEvent.h:70
void CustomStreamer()
Definition: KVEvent.h:198
Bool_t IsNull() const
Event reconstructed from energy losses in INDRA multidetector.
virtual void Print(Option_t *option="") const
Bool_t CheckCodes(KVINDRACodeMask &code)
void ChangeFragmentMasses(UChar_t mass_formula)
KVUniqueNameList * fHitGroups
non-persistent pointer to list of hit groups used in SecondaryIdentAndCalib()
void init()
default initialisations
KVINDRAReconEvent(Int_t mult=50)
KVINDRACodeMask * fCodeMask
VEDA codes accepted for "good" particles (IsOK)
Nuclei reconstructed from data measured in the INDRA array.
KVINDRACodes & GetCodes() const
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:344
void SetIsOK(Bool_t flag=kTRUE)
Definition: KVParticle.cpp:339
Double_t GetEnergy() const
Definition: KVParticle.h:623
void SetEnergy(Double_t e)
Definition: KVParticle.h:601
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
virtual Bool_t IsAMeasured() const
KVReconstructedNucleus * GetNextParticle(Option_t *opt="") const
virtual Int_t GetMult(Option_t *opt="") const
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
friend friend class TClonesArray