KaliVeda
Toolkit for HIC analysis
KVINDRAReconEvent.cpp
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 "KVDetector.h"
24 #include "KVCsI.h"
25 #include "KVSilicon.h"
26 #include "KVDetectorEvent.h"
27 #include "KVINDRAReconNuc.h"
28 #include "KVINDRA.h"
29 #include "TStreamerInfo.h"
30 #include "KVIDCsI.h"
31 #include "KVIDGCsI.h"
32 #include "KVDataSet.h"
33 #include "KVChIo.h"
34 
35 using namespace std;
36 
38 
39 
42 
44 {
45  //default initialisations
46  fCodeMask = 0;
47  fHitGroups = 0;
48 }
49 
50 
51 
53 
55  : KVReconstructedEvent(mult)
56 {
57  init();
58  // KLUDGE: we have to destroy the TClonesArray in order to change
59  // the class used for particles from KVReconstructedNucleus to
60  // KVINDRAReconNuc
61  delete fParticles;
64 }
65 
66 
67 
69 
70 KVINDRAReconEvent::~KVINDRAReconEvent()
71 {
72  if (fCodeMask) {
73  delete fCodeMask;
74  fCodeMask = 0;
75  }
77 };
78 
79 
80 
82 
91 
93 {
94  // Stream an object of class KVINDRAReconEvent.
95  // If acceptable ID/E codes have been set with methods AcceptIDCodes()/
96  // AcceptECodes(), we loop over the newly-read particles in order to set
97  // their IsOK() status according to these choices.
98  // If not, it will have already been set according to the default code
99  // selection (defined by [DataSet].INDRA.ReconstructedNuclei.AcceptID/ECodes)
100  // in KVReconstructedNucleus::Streamer
101 
102  if (R__b.IsReading()) {
104  if (fCodeMask && !fCodeMask->IsNull()) {
105  KVINDRAReconNuc* par;
106  while ((par = (KVINDRAReconNuc*)GetNextParticle())) {
107  par->SetIsOK(CheckCodes(par->GetCodes()));
108  }
109  }
110  }
111  else {
113  }
114 }
115 
116 
117 
121 
123 {
124  //Print out list of particles in the event.
125  //If option="ok" only particles with IsOK=kTRUE are included.
126 
127  cout << GetTitle() << endl; //system
128  cout << GetName() << endl; //run
129  cout << "Event number: " << GetNumber() << endl << endl;
130  cout << "MULTIPLICITY = " << ((KVINDRAReconEvent*) this)->
131  GetMult(option) << endl << endl;
132 
133  KVINDRAReconNuc* frag = 0;
134  while ((frag = (KVINDRAReconNuc*)GetNextParticle(option))) {
135  frag->Print();
136  }
137 }
138 
139 
140 
141 
157 
159 {
160  //Changes the mass formula used to calculate A from Z for all nuclei in event
161  //For the values of mass_formula, see KVNucleus::GetAFromZ
162  //
163  //The fragment energy is modified in proportion to its mass, this is due to the
164  //contribution from the CsI light-energy calibration:
165  //
166  // E -> E + E_CsI*( newA/oldA - 1 )
167  //
168  //From an original lunch by Remi Bougault.
169  //
170  //Only particles with 'acceptable' ID & E codes stopping in (or passing through)
171  //a CsI detector are affected; particles whose mass was measured
172  //(i.e. having KVReconstructedNucleus::IsAMeasured()==kTRUE)
173  //are not affected by the change of mass formula.
174 
176  KVINDRAReconNuc* frag;
177  while ((frag = (KVINDRAReconNuc*)GetNextParticle("ok"))) {
178 
179  if (!frag->IsAMeasured()) {
180 
181  Float_t oldA = (Float_t)frag->GetA();
182  frag->SetMassFormula(mass_formula);
183 
184  if (frag->GetCsI()) {
185  Float_t oldECsI = frag->GetEnergyCsI();
186  Float_t oldE = frag->GetEnergy();
187  Float_t newECsI = oldECsI * ((Float_t)frag->GetA() / oldA);
188  frag->GetCsI()->SetEnergy(newECsI);
189  frag->SetEnergy(oldE - oldECsI + newECsI);
190  }
191  }
192  }
193 
194 }
195 
196 
197 //____________________________________________________________________________
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
int Int_t
#define SafeDelete(p)
unsigned char UChar_t
float Float_t
const char Option_t
Option_t Option_t option
UInt_t GetNumber() const
Definition: KVBase.h:219
TClonesArray * fParticles
array of particles in event
Definition: KVEvent.h:71
void CustomStreamer()
Definition: KVEvent.h:174
Bool_t IsNull() const
Event reconstructed from energy losses in INDRA multidetector.
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 Print(Option_t *option="") const override
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
Float_t GetEnergyCsI()
void Print(Option_t *option="") const override
Int_t GetA() const
Definition: KVNucleus.cpp:792
void SetMassFormula(UChar_t mt)
Definition: KVNucleus.h:341
void SetIsOK(Bool_t flag=kTRUE)
Definition: KVParticle.cpp:371
Double_t GetEnergy() const
Definition: KVParticle.h:624
void SetEnergy(Double_t e)
Definition: KVParticle.h:602
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=nullptr)=0
Bool_t IsReading() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
static TClass * Class()
const char * GetName() const override
void Streamer(TBuffer &) override
const char * GetTitle() const override
static TClass * Class()
friend friend class TClonesArray
ClassImp(TPyArg)