HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoSimEvent.cxx
Go to the documentation of this file.
1 //
2 // File HarpoSimEvent.cxx
3 //
14 #include "HarpoSimEvent.h"
15 #include "HarpoDccMap.h"
16 #include "HarpoDebug.h"
17 #include "TpcSimIonisationTrack.h"
18 #include <cstdlib>
19 #include <cstring>
20 #include <iostream>
21 #include <cassert>
22 // for swab
23 #include <unistd.h>
24 
25 ClassImp(HarpoSimEvent)
26 
28 {
29  if(gHarpoDebug>1)
30  Info("HarpoSimEvent()","Creating Sim Event");
31  fIonisationTracks = new TClonesArray("TpcSimIonisationTrack",fkMaxNtracks);
32  // fStrips = NULL;//new TClonesArray("HarpoSimStrips",fkMaxNtracks);
33 
34  fNtracks = 0;
35  fNstrips = 0;
36 
37  fMCEvent = (TpcSimMCEvent*) NULL;
38 
39  if(gHarpoDebug>1)
40  Info("HarpoSimEvent()","Sim Event Created");
41 }
42 
44 {
45  if(gHarpoDebug>1) Info("~HarpoSimEvent","Deleting");
46  fIonisationTracks->Delete();
47  delete fIonisationTracks;
48  //fStrips->Delete();
49  if(fMCEvent)
50  fMCEvent->Delete();
51 
52 }
53 
55 {
56 
57  if(fNtracks != iTr){
58  return 0;
59  }
61  return -1;
62  }
63 
64  fMCEvent->AddTrack(tr);
65  if(gHarpoDebug>1)
66  Info("AddIonisationTrack","%d",fNtracks);
67  new((*fIonisationTracks)[fNtracks]) TpcSimIonisationTrack(*tr);
68  fNtracks++;
69  // Info("AddIonisationTrack","%d %d",fNtracks,fIonisationTracks->GetEntries());
70 
71 
72  return fNtracks;
73 
74 }
75 
77 {
78 
79  if(iTr < 0)
80  return 0;
81  if(iTr >= fNtracks)
82  return 0;
83 
84  return (TpcSimIonisationTrack*)fIonisationTracks->At(iTr);
85 
86 }
87 
88 
89 Int_t HarpoSimEvent::AddStrips(Int_t /* iTr */ , HarpoSimStrips* /* strips*/ )
90 {
91 
92  // if(fNstrips != iTr){
93  // //std::cout << "fNstrips (" << fNstrips
94  // return 0;
95  // }
96  // if(fNstrips>=fkMaxNtracks){
97  // return -1;
98  // }
99 
100  // new((*fStrips)[fNstrips]) HarpoSimStrips(*strips);
101  fNstrips++;
102  return fNstrips;
103 
104 }
105 
106 void HarpoSimEvent::SetHeader(UInt_t len, UInt_t evnum)
107 {
109  fEventHeader.eventNumb=evnum;
110 }
111 
112 
114 {
115  std::cout << "Header num : " << fEventHeader.eventNumb
116  << " : size : " << fEventHeader.eventSize << std::endl;
117 }
118 
120 {
121  Info("GetTimeStamp","0");
122  return (ULong_t) 0;
123 }
void SetHeader(UInt_t len, UInt_t evnum)
virtual ~HarpoSimEvent()
TpcSimIonisationTrack * GetIonisationTrack(Int_t iTr)
static const Int_t fkMaxNtracks
Definition: HarpoSimEvent.h:71
ULong_t GetTimeStamp(Int_t=0)
TpcSimMCEvent * fMCEvent
Definition: HarpoSimEvent.h:76
UInt_t eventSize
Raw Event size.
Definition: HarpoDetEvent.h:28
EventHeader_t fEventHeader
Definition: HarpoDetEvent.h:60
A class store HARPO row DCC event data and header. End provide access metods to the row data...
Definition: HarpoSimEvent.h:24
TClonesArray * fIonisationTracks
Definition: HarpoSimEvent.h:75
Int_t AddIonisationTrack(Int_t iTr, TpcSimIonisationTrack *tr)
Int_t AddStrips(Int_t iTr, HarpoSimStrips *strips)
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
void AddTrack(TpcSimMCTrack *tr)
void print() const
UInt_t eventNumb
Event number in run.
Definition: HarpoDetEvent.h:29