Line data Source code
1 : #ifndef AliHMPIDHit_h
2 : #define AliHMPIDHit_h
3 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 : //.
6 : // HMPID base class to produce hits
7 : //.
8 : //.
9 : #include <AliHit.h> //base class
10 : #include <TVector3.h> //ctor
11 : #include "AliHMPIDDigit.h" //QdcTot()
12 :
13 : #include <TRandom.h>
14 :
15 : class AliHMPIDHit : public AliHit // TObject-AliHit-AliHMPIDHit
16 : {
17 : public:
18 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19 : AliHMPIDHit():
20 137 : AliHit(),
21 137 : fCh(-1),
22 137 : fPid(-1),
23 137 : fQ(-1),
24 137 : fLx(0),
25 137 : fLy(0),
26 137 : fT(0)
27 822 : {} //default ctor
28 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29 : AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time, const TVector3 &p):
30 294 : AliHit(0,tid),
31 294 : fCh(c),
32 294 : fPid(pid),
33 294 : fQ(0 ),
34 294 : fLx(x),
35 294 : fLy(y),
36 294 : fT(time)
37 2058 : {e=QdcTot(e,time);fX=p.X();fY=p.Y();fZ=p.Z();}
38 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 : AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time):
40 0 : AliHit(),
41 0 : fCh(c),
42 0 : fPid(pid),
43 0 : fQ(0),
44 0 : fLx(x),
45 0 : fLy(y),
46 0 : fT(time)
47 0 : {e=QdcTot(e,time);fTrack=tid;}//manual ctor
48 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
49 : AliHMPIDHit& operator=(const AliHMPIDHit& h)
50 : {
51 : //
52 : // Assignment operator
53 : //
54 0 : if(this!=&h){
55 0 : AliHit::operator=(h);
56 0 : fCh = h.fCh;
57 0 : fPid = h.fPid;
58 0 : fQ = h.fQ;
59 0 : fLx = h.fLx;
60 0 : fLy = h.fLy;
61 0 : fT = h.fT;
62 0 : }
63 0 : return *this;
64 : }
65 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66 : AliHMPIDHit(const AliHMPIDHit &h):
67 0 : AliHit(h),
68 0 : fCh(h.fCh),
69 0 : fPid(h.fPid),
70 0 : fQ(h.fQ),
71 0 : fLx(h.fLx),
72 0 : fLy(h.fLy),
73 0 : fT(h.fT)
74 0 : {}//copy ctor
75 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 1230 : virtual ~AliHMPIDHit() {}
77 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78 : //framework part
79 : void Print(Option_t *opt="")const; //from TObject to print current status
80 : void Draw (Option_t *opt=""); //from TObject to Draw this hit
81 : //private part
82 70 : Int_t Ch ( )const{return fCh; } //Chamber
83 : void Hit2Sdi(TClonesArray *pSdiLst,Int_t n=1)const; //add sdigits of this hit to the list
84 70 : Float_t LorsX ( )const{return fLx; } //hit X position in LORS, [cm]
85 70 : Float_t LorsY ( )const{return fLy; } //hit Y position in LORS, [cm]
86 0 : Float_t HitTime( )const{return fT; } //hit formation time, [sec]
87 1176 : Int_t Pid ( )const{return fPid; } //PID
88 70 : Float_t Q ( )const{return fQ; } //total charge, [QDC]
89 : inline Float_t QdcTot (Float_t e, Float_t time ); //calculate total charge of the hit
90 0 : Int_t Tid ( )const{return fTrack; } //TID
91 0 : void SetQ (Float_t q ) {fQ=q; } //for debugging...
92 : protected: //AliHit has fTrack,fX,fY,fZ
93 : Int_t fCh; //Chamber
94 : Int_t fPid; //PID
95 : Float_t fQ; //total charge [QDC]
96 : Float_t fLx; //hit X position in chamber LORS, [cm]
97 : Float_t fLy; //hit Y position in chamber LORS, [cm]
98 : Float_t fT; //hit formation time, [sec]
99 18 : ClassDef(AliHMPIDHit,5) //HMPID hit class
100 : };//class AliHMPIDhit
101 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
102 : Float_t AliHMPIDHit::QdcTot(Float_t e, Float_t time)
103 : {
104 : // Samples total charge of the hit
105 : // Arguments: e- hit energy [GeV] for mip Eloss for photon Etot
106 : // Returns: total QDC
107 588 : Int_t pc,px,py;
108 294 : AliHMPIDParam::Lors2Pad(fLx,fLy,pc,px,py);
109 294 : if(py<0) fQ=0;
110 : else {
111 294 : Float_t y=AliHMPIDParam::LorsY(pc,py);
112 294 : fLy=((y-fLy)>0)?y-0.2:y+0.2; //shift to the nearest anod wire
113 :
114 294 : Float_t x=(fLx > 66.6)? fLx-66.6:fLx; //sagita is for PC (0-64) and not for chamber
115 294 : Float_t qdcEle=34.06311+0.2337070*x+5.807476e-3*x*x-2.956471e-04*x*x*x+2.310001e-06*x*x*x*x; //reparametrised from DiMauro
116 :
117 294 : Int_t iNele=Int_t((e/26e-9)*0.6); if(iNele<1) iNele = 1; //number of electrons created by hit, if photon e=0 implies iNele=1
118 294 : fQ=0;
119 2446 : for(Int_t i=1;i<=iNele;i++){
120 929 : Double_t rnd=gRandom->Rndm(); if(rnd==0) rnd=1e-12; //1e-12 is a protection against 0 from rndm
121 929 : fQ-=qdcEle*TMath::Log(rnd);
122 : }
123 : }
124 294 : if(time>1.2e-6) fQ=0;
125 :
126 588 : return fQ;
127 294 : }
128 : //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129 :
130 : #endif
|