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(fParameters);
84  //set angles
86  for (KVReconstructedEvent::Iterator it = begin(); it != end(); ++it) {
87  par = it.get_pointer();
88  if (HasMeanAngles())
90  else
92 
93  // apply identification & calibration code selection
94  gMultiDetArray->AcceptParticleForAnalysis(par);
95  }
96  }
97  }
98  else {
100  }
101 }
102 
103 
104 
105 
106 
107 
114 
116 {
117  // Print out detailed information on each particle in the event.
118  //
119  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
120  // particles shown to those which correspond to the given criteria. This also
121  // affects the displayed event multiplicity.
122 
123  cout << " ***//*** RECONSTRUCTED EVENT #" << GetNumber() << " ***//***" << endl;
124  cout << GetTitle() << endl; //system
125  cout << GetName() << endl; //run
126  cout << "MULTIPLICITY = " << ((KVReconstructedEvent*) this)->
127  GetMult(option) << endl << endl;
128 
129  int i = 1;
130  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
131  auto& frag = it.get_const_reference();
132  cout << "RECONSTRUCTED PARTICLE #" << i++ << endl;
133  frag.Print();
134  cout << endl;
135  }
136 
137 }
138 
139 
140 
147 
149 {
150  // Print out compact listing of all particles in event.
151  //
152  // \param[in] option if given, will be used as argument to GetNextParticleIterator() to limit
153  // particles shown to those which correspond to the given criteria. This also
154  // affects the displayed event multiplicity.
155 
156  printf(":::%s #%07d M=%03d\n", ClassName(), GetNumber(), GetMult());
157  GetParameters()->Print();
158  int i(1);
159  for (auto it = GetNextParticleIterator(option); it != end(); ++it) {
160  auto& nuc = it.get_const_reference();
161  printf(" %3d", i);
162  nuc.ls();
163  ++i;
164  }
165 }
166 
167 
168 
182 
184 {
185  // Merge all events in the list into one event (this one)
186  // First we clear this event, then we fill it with copies of each particle in each event
187  // in the list.
188  // If option "opt" is given, it is given as argument to each call to
189  // KVEvent::Clear() - this option is then passed on to the Clear()
190  // method of each particle in each event.
191  // NOTE: the events in the list will be empty and useless after this!
192  //
193  // This method overrides the one defined in KVEvent. As KVReconstructedNucleus objects
194  // are referenced by the detectors used in their reconstruction, we also have to update
195  // the references in the detectors otherwise they will still reference the particles
196  // in the events in the list, which will no longer be valid after this operation.
197 
198  Clear(opt);
199  TIter it(events);
201  while ((e = (KVReconstructedEvent*)it())) {
202  if (e->GetMult()) {
203  for (auto& n : ReconEventIterator(e)) {
205  }
206  }
207  GetParameters()->Merge(*(e->GetParameters()));
208  e->Clear(opt);
209  }
210 }
211 
212 
213 
214 
215 
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:179
KVNameValueList fParameters
general-purpose list of parameters
Definition: KVEvent.h:72
void Clear(Option_t *opt="") override
Definition: KVEvent.h:238
void CustomStreamer()
Definition: KVEvent.h:174
virtual void SetRawDataFromReconEvent(KVNameValueList &)
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
Nuclei reconstructed from data measured by a detector array .
void CopyAndMoveReferences(const KVReconstructedNucleus *)
virtual void GetAnglesFromReconstructionTrajectory(Option_t *opt="random")
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)