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