HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoEvent.cxx
Go to the documentation of this file.
1 //
2 // File HarpoEvent.cxx
3 //
19 #include "HarpoEvent.h"
20 #include "HarpoRecoEvent.h"
21 #include "HarpoDccEvent.h"
22 #include "HarpoSimEvent.h"
23 #include <cstdlib>
24 #include <cstring>
25 #include <iostream>
26 // for swab
27 #include <unistd.h>
28 
29 ClassImp(HarpoEvent)
30 
32 {
33  // std::cout << "+++ New Event " << this << std::endl;
34  if(gHarpoDebug>1)
35  Info("HarpoEvent"," ");
36  fEventHeader = NULL;
37  fDetEvent = new HarpoDetEvent *[gkNDetectors];
38  UInt_t nd;
39  for(nd=0;nd<gkNDetectors;nd++) {
40  fDetEvent[nd] = (HarpoDetEvent *) NULL;
41  }
42  fRecoEvent = (HarpoRecoEvent *)NULL;//new HarpoRecoEvent();
43 }
44 
45 
46 HarpoEvent::HarpoEvent(const HarpoEvent &evt): TObject(evt),
47  fEventHeader(evt.fEventHeader), fDetEvent(evt.fDetEvent), fRecoEvent(evt.fRecoEvent)
48 {
49 }
50 
52 {
53  //std::cout << "=== Del Event " << this << std::endl;
54  UInt_t nd;
55  for(nd=0;nd<gkNDetectors;nd++) {
56  if(gHDetSet->isExist(nd)) {
57  if (fDetEvent[nd] != NULL ){
58  if(gHarpoDebug>1)
59  Info("~HarpoEvent","Delete event det %d (%p)",nd,fDetEvent[nd]);
60  fDetEvent[nd]->Delete();
61  //delete fDetEvent[nd];
62  // fDetEvent[nd]->ResetData();
63  } else {
64  std::cout << "---Det " << nd << " data == NULL" << std::endl;
65  }
66  }
67  }
68  delete [] fDetEvent;
69  if(fRecoEvent!=NULL)
70  fRecoEvent->Delete();
71  //delete fRecoEvent;
72  if (fEventHeader != NULL) delete fEventHeader;
73 }
74 
76 {
77  fEventHeader = data;
78 }
79 
81 {
82  return fEventHeader;
83 }
84 
85 void HarpoEvent::SetDetEvent(HarpoDetEvent *event,ULong_t plane) {
86  if ( /* (plane < 0) || */ (plane >= gkNDetectors)) return;
87  if(gHarpoDebug>0) Info("SetDetEvent","%ld",plane);
88  gHDetSet->Set(plane); //Mark detectors as existing
89  fDetEvent[plane] = event;
90  fDetEvent[plane]->SetDet(plane);
91 }
92 
94  // if ((plane < 0) || (plane >= gkNDetectors)) return NULL;
95  if (gHDetSet->isExist(plane))
96  {
97  return fDetEvent[plane];
98  } else {
99  return NULL;
100  }
101 }
102 
103 // void HarpoEvent::SetDccMap(HarpoDccMap *data,Long_t plane) {
104 // if ((plane < 0) || (plane >= gkNDetectors)) return;
105 // fEventData[plane] = data;
106 // }
107 
109  if(gHarpoDebug>2)
110  Info("GetDccMap","%li",plane);
111  // if(gHDetSet->isSim() && fDetEvent[SIMDET] != NULL)
112  // return ((HarpoSimEvent*)fDetEvent[SIMDET])->GetMap(plane);
113  if (gHDetSet->isExist(plane) && fDetEvent[plane] != NULL){
114  if(plane == XDCC)
115  return ((HarpoDccEvent*)fDetEvent[plane])->GetMap();
116  if(plane == YDCC)
117  return ((HarpoDccEvent*)fDetEvent[plane])->GetMap();
118  }// else {
119  return NULL;
120  //}
121 }
122 
124 {
125  // std::cout << "---in Event print " << fEventHeader << std::endl;
126  if ( fEventHeader != NULL ) fEventHeader->print();
127  UInt_t nd;
128  for(nd=0;nd<gkNDetectors;nd++) {
129  if(gHDetSet->isExist(nd)) {
130  if (fDetEvent[nd] != NULL ){
131  fDetEvent[nd]->print();
132  } else {
133  std::cout << "---Det " << nd << " data == NULL" << std::endl;
134  }
135  }
136  }
137 }
138 
139 // Bool_t HarpoEvent::IsZeroSuppressed(Long_t plane)
140 // {
141 // if (gHDetSet->isExist(plane))
142 // {
143 // return fDetEvent[plane]->IsZeroSuppressed();
144 // } else {
145 // return false;
146 // }
147 // }
148 
149 ULong_t HarpoEvent::GetTimeStamp(Long_t plane)
150 {
151 
152  if(gHDetSet->isSim())
153  return 0;//fDetEvent[SIMDET]->GetTimeStamp();
154  if (gHDetSet->isExist(plane))
155  {
156  if(gHarpoDebug>1)
157  std::cout << plane << " => " << fDetEvent[plane] << std::endl;
158  return fDetEvent[plane]->GetTimeStamp();
159  } else {
160  return 0;
161  }
162 }
163 
164 
166 {
167 
168  if (gHDetSet->isExist(SIMDET)) {
169  fDetEvent[SIMDET]->Delete();
170  }
171  fRecoEvent->Delete();
172 
173 }
void print()
Definition: HarpoEvent.cxx:123
A virtual class store event data for un detector.
Definition: HarpoDetEvent.h:32
virtual ULong_t GetTimeStamp(Int_t after=0)=0
void ResetEvent()
Definition: HarpoEvent.cxx:165
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
Dcc Plane X.
Definition: HarpoDet.h:19
Object containing the reconstruction information for one event (with array of HarpoRecoClusters Harpo...
void SetDet(Int_t det)
Definition: HarpoDetEvent.h:43
FullEvent Header not scecific to the detectors The class is ....
Bool_t isSim()
Definition: HarpoDetSet.h:41
virtual void print()
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
HarpoDetEvent * GetDetEvent(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:93
Data from Keller temperuture and pressure sensors.
Definition: HarpoDet.h:22
void SetHeader(HarpoEventHeader *data)
Definition: HarpoEvent.cxx:75
void print() const
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
Unknown Detector.
Definition: HarpoDet.h:18
HarpoEventHeader * fEventHeader
Definition: HarpoEvent.h:65
HarpoEventHeader * GetHeader()
Definition: HarpoEvent.cxx:80
A class store HARPO row event data and header. Provide access metods to the row event data...
Definition: HarpoEvent.h:29
virtual ~HarpoEvent()
Definition: HarpoEvent.cxx:51
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
ULong_t GetTimeStamp(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:149
void SetDetEvent(HarpoDetEvent *event, ULong_t plane=XDCC)
Definition: HarpoEvent.cxx:85
void Set(ULong_t det)
Definition: HarpoDetSet.h:30
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71
HarpoDetEvent ** fDetEvent
Definition: HarpoEvent.h:66
HarpoRecoEvent * fRecoEvent
list of raw events
Definition: HarpoEvent.h:68
A class store HARPO EVENT : header and row data. Its provide also the methods for access to this data...
Definition: HarpoDccEvent.h:22