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 "KVDetector.h"
24 #include "KVTarget.h"
25 #include "KVMultiDetArray.h"
26 #include <iomanip>
27 
28 using namespace std;
29 
31 
32 
33 
37 {
38  //default initialisations
39  UseRandomAngles();
40  fPartSeedCond = "all";
41 }
42 
43 
44 
46 
48 {
49  init();
50  CustomStreamer(); //because KVReconstructedNucleus has a customised streamer
51 }
52 
53 
54 
55 
65 
67 {
68  // Stream an object of class KVReconstructedEvent.
69  //
70  // If the KVMultiDetArray corresponding to the event has been built, we:
71  //
72  // - set the values of raw data parameters in the corresponding detectors
73  //
74  // - set the particles' angles depending on whether mean or random angles
75  // are wanted (fMeanAngles = kTRUE or kFALSE)
76 
77  if (R__b.IsReading()) {
79  // if the multidetector object exists, update some informations
80  // concerning the detectors etc. hit by this particle
81  if (gMultiDetArray) {
82  // reset raw data in detectors if found in parameter list
83  gMultiDetArray->SetRawDataFromReconEvent(*this);
84  //set angles
85  for (auto& par : *this)
86  {
87  if (HasMeanAngles())
88  par.GetAnglesFromReconstructionTrajectory("mean");
89  // else
90  // par->GetAnglesFromReconstructionTrajectory("random");
91 
92  // apply identification & calibration code selection
93  gMultiDetArray->AcceptParticleForAnalysis(&par);
94  }
95  }
96  }
97  else {
99  }
100 }
101 
102 
103 
104 
105 
106 
113 
115 {
116  // Print out detailed information on each particle in the event.
117  //
118  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
119  // particles shown to those which correspond to the given criteria. This also
120  // affects the displayed event multiplicity.
121 
122  cout << " ***//*** RECONSTRUCTED EVENT #" << GetNumber() << " ***//***" << endl;
123  cout << GetTitle() << endl; //system
124  cout << GetName() << endl; //run
125  cout << "MULTIPLICITY = " << ((KVReconstructedEvent*) this)->
126  GetMult(option) << endl << endl;
127 
128  int i = 1;
129  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
130  auto& frag = it.get_const_reference();
131  cout << "RECONSTRUCTED PARTICLE #" << i++ << endl;
132  frag.Print();
133  cout << endl;
134  }
135 
136 }
137 
138 
139 
146 
148 {
149  // Print out compact listing of all particles in event.
150  //
151  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
152  // particles shown to those which correspond to the given criteria. This also
153  // affects the displayed event multiplicity.
154 
155  printf(":::%s #%07d M=%03d\n", ClassName(), GetNumber(), GetMult());
156  GetParameters()->Print();
157  int i(1);
158  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
159  auto& nuc = it.get_const_reference();
160  printf(" %3d", i);
161  nuc.ls();
162  ++i;
163  }
164 }
165 
166 
167 
181 
183 {
184  // Merge all events in the list into one event (this one)
185  // First we clear this event, then we fill it with copies of each particle in each event
186  // in the list.
187  // If option "opt" is given, it is given as argument to each call to
188  // KVEvent::Clear() - this option is then passed on to the Clear()
189  // method of each particle in each event.
190  // NOTE: the events in the list will be empty and useless after this!
191  //
192  // This method overrides the one defined in KVEvent. As KVReconstructedNucleus objects
193  // are referenced by the detectors used in their reconstruction, we also have to update
194  // the references in the detectors otherwise they will still reference the particles
195  // in the events in the list, which will no longer be valid after this operation.
196 
197  Clear(opt);
198  TIter it(events);
200  while ((e = (KVReconstructedEvent*)it())) {
201  if (e->GetMult()) {
202  for (auto& n : ReconEventIterator(e)) {
204  }
205  }
206  GetParameters()->Merge(*(e->GetParameters()));
207  e->Clear(opt);
208  }
209 }
210 
211 
212 
213 
214 
int Int_t
#define e(i)
const char Option_t
Option_t Option_t option
UInt_t GetNumber() const
Definition: KVBase.h:219
KVNameValueList * GetParameters() const
Definition: KVEvent.h:180
void Clear(Option_t *opt="") override
Definition: KVEvent.h:239
void CustomStreamer()
Definition: KVEvent.h:175
virtual void SetRawDataFromReconEvent(const KVReconstructedEvent &)
virtual void AcceptParticleForAnalysis(KVReconstructedNucleus *) const
void Merge(const KVNameValueList &)
void Print(Option_t *opt="") const override
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
void ls(Option_t *option="") const
virtual void Print(Option_t *option="") const
KVReconstructedEvent(Int_t mult=50)
void MergeEventFragments(TCollection *, Option_t *opt="")
void init()
default initialisations
void CopyAndMoveReferences(const KVReconstructedNucleus *)
Base class for event classes (containers for different types of particle objects)
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
const Int_t n
ClassImp(TPyArg)