FairRoot/PandaRoot
PndEmcHit.cxx
Go to the documentation of this file.
1 //
3 // PndEmcHit
4 //
5 // Emc digitised hit
6 //
7 // Created 14/08/06 by S.Spataro
8 //
10 
11 #include "PndEmcHit.h"
12 #include "PndDetectorList.h"
13 #include <iostream>
14 
15 using namespace std;
16 
17 // ----- Default constructor -------------------------------------------
19  :FairHit(), fEnergy(0), fMcList(0), fPointList(0), fTrackEntering(), fTrackExiting()
20 {
21  fMcList.clear();
22  fPointList.clear();
23 }
24 // -------------------------------------------------------------------------
25 
26 // ----- Constructor -------------------------------------------
27 PndEmcHit::PndEmcHit(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t X, Float_t Y, Float_t Z)
28  :FairHit(), fEnergy(energy), fMcList(0), fPointList(0), fTrackEntering(), fTrackExiting()
29 {
30  SetTime(time);
31  fRefIndex = trackid;
32  fDetectorID = id;
33  fX = X; fY = Y; fZ = Z;
34  fDx = 0.; fDy = 0.; fDz = 0.;
35  fMcList.clear();
36  fPointList.clear();
37 }
38 // ----- Constructor -------------------------------------------
39 PndEmcHit::PndEmcHit(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t X, Float_t Y, Float_t Z, std::vector<Int_t> McList, FairMultiLinkedData enteringTracks, FairMultiLinkedData exitingTracks)
40  :FairHit(), fEnergy(energy), fMcList(McList), fPointList(0), fTrackEntering(enteringTracks), fTrackExiting(exitingTracks)
41 {
42  SetTime(time);
43  fRefIndex = trackid;
44  fDetectorID = id;
45  fX = X; fY = Y; fZ = Z;
46  fDx = 0.; fDy = 0.; fDz = 0.;
47  //SetLinks(FairMultiLinkedData("MCTrack", McList));
48  //SetLinks(enteringTracks);
49 }
50 // ----- Constructor -------------------------------------------
51 PndEmcHit::PndEmcHit(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t X, Float_t Y, Float_t Z, std::vector<PndEmcPoint*> PointList)
52  :FairHit(), fEnergy(energy), fMcList(0), fPointList(PointList), fTrackEntering(), fTrackExiting()
53 {
54  SetTime(time);
55  fRefIndex = trackid;
56  fDetectorID = id;
57  fX = X; fY = Y; fZ = Z;
58  fDx = 0.; fDy = 0.; fDz = 0.;
59 }
60 
61 //Copy
63  FairHit(copy),fEnergy(copy.fEnergy), fMcList(0), fPointList(0), fTrackEntering(copy.fTrackEntering), fTrackExiting(copy.fTrackExiting)
64 {
65  fRefIndex=copy.fRefIndex;
66  fDetectorID=copy.fDetectorID;
67  fX=copy.fX;
68  fY=copy.fY;
69  fZ=copy.fZ;
70  // PointList and McList not copied...
71 }
72 // ----- Destructor ----------------------------------------------------
74 // -------------------------------------------------------------------------
75 
76 
77 // ----- Public method Print -------------------------------------------
78 void PndEmcHit::Print(const Option_t* ) const {
79  cout << "EMC hit: cellid=" << GetDetectorID() << ", Energy=" << fEnergy;
80  if (fRefIndex>0) cout << ", TrackID= " << fRefIndex << std::endl;
81  cout << " TrackEntering: " << fTrackEntering << std::endl;
82  cout << "TrackExiting: " << fTrackExiting << std::endl;
83 // cout << ", x=" << GetX() << ", y=" << GetY() << endl << flush;
84 }
85 // -------------------------------------------------------------------------
86 
87 Short_t PndEmcHit::GetXPad() const {
88  // Return the X pad value for clusterization
89 
90  // Barrel EMC
91  if (GetModule()==1 || GetModule()==2)
92  return (GetCrystal()+(GetCopy()-1)*10);
93 
94  // BwEndCap and forward EMC
95  if ((GetModule()==4) || (GetModule()==5))
96  {
97  if (GetCopy()==1) { return -GetRow()+1;}
98  if (GetCopy()==2) { return -GetRow()+1; }
99  if (GetCopy()==3) { return GetRow();}
100  if (GetCopy()==4) { return GetRow();}
101  }
102 
103  // FwEndCap
104  if (GetModule()==3)
105  return -(GetCrystal()-36); //the minus sign before the paranthesis is introduced since the geometry of FwEndCap gets rotated by 180 deg around the y-axis in PndEmc.cxx;
106  //this rotation was done in turn due to the way the geometry was defined in the geometry file of the forward end cap
107 
108  /*
109  if (GetModule()==3 && GetCrystal()==999 && GetRow()==999)
110  return GetCrystal();
111  */
112 
113  // Test EMC
114  if (GetModule()==6)
115  return (GetRow());
116 
117  return -1000; // failure
118 }
119 
120 Short_t PndEmcHit::GetYPad() const {
121  // Return the Y pad value for clusterization
122 
123  // Barrel EMC
124  if (GetModule()==1)
125  return (GetRow()+29);
126 
127  if (GetModule()==2)
128  return (-GetRow()+30);
129 
130  // BwEndCap and forward EMC
131  if ((GetModule()==4) || (GetModule()==5))
132  {
133  if (GetCopy()==1) { return GetCrystal(); }
134  if (GetCopy()==2) { return -GetCrystal()+1; }
135  if (GetCopy()==3) { return -GetCrystal()+1; }
136  if (GetCopy()==4) { return GetCrystal(); }
137  }
138 
139  // FwEndCap
140  if (GetModule()==3)
141  return GetRow()-37;
142 
143  /*
144  if (GetModule()==3 && GetCrystal()==999 && GetRow()==999)
145  return GetRow();
146  */
147 
148  // Test EMC
149  if (GetModule()==6)
150  return (GetCrystal());
151 
152  return -1000; // failure
153 }
Short_t GetCrystal() const
Definition: PndEmcHit.h:60
Short_t GetXPad() const
Definition: PndEmcHit.cxx:87
Double_t fX
Definition: PndCaloDraw.cxx:34
FairMultiLinkedData fTrackExiting
Definition: PndEmcHit.h:78
virtual ~PndEmcHit()
Definition: PndEmcHit.cxx:73
double Y
Definition: anaLmdDigi.C:68
Double_t fZ
Definition: PndCaloDraw.cxx:34
Short_t GetYPad() const
Definition: PndEmcHit.cxx:120
std::vector< PndEmcPoint * > fPointList
Definition: PndEmcHit.h:76
virtual void Print(const Option_t *opt="") const
Definition: PndEmcHit.cxx:78
std::vector< Int_t > fMcList
Definition: PndEmcHit.h:75
double X
Definition: anaLmdDigi.C:68
represents the deposited energy of one emc crystal from simulation
Definition: PndEmcHit.h:26
Double_t fY
Definition: PndCaloDraw.cxx:34
Short_t GetRow() const
Definition: PndEmcHit.h:59
FairMultiLinkedData fTrackEntering
Definition: PndEmcHit.h:77
ClassImp(PndAnaContFact)
double Z
Definition: anaLmdDigi.C:68
Short_t GetCopy() const
Definition: PndEmcHit.h:61
virtual void SetTime(Double32_t time)
Definition: PndEmcHit.h:51
Short_t GetModule() const
Definition: PndEmcHit.h:58
Double32_t fEnergy
Definition: PndEmcHit.h:72
Double_t energy
Definition: plot_dirc.C:15