]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDHit.h
c768945c608fe7e20f945cb26dab8006094105a3
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDHit.h
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 #include <AliHit.h>           //base class
7 #include <TVector3.h>         //ctor
8 #include <TRandom.h>          //QdcTot()
9
10 class AliHMPIDHit : public AliHit //   TObject-AliHit-AliHMPIDHit
11 {
12 public:
13   AliHMPIDHit(                                                                             ):AliHit(     ),fCh(-1),fPid(-1  ),fQ(-1),fLorsX(-1),fLorsY(-1) {} //default ctor
14   AliHMPIDHit(Int_t c,Float_t e,Int_t pid,Int_t tid,Float_t xl,Float_t yl,const TVector3 &p):AliHit(0,tid),fCh(c ),fPid(pid ),fQ(-1),fLorsX(xl),fLorsY(yl) {QdcTot(e);fX=p.X();fY=p.Y();fZ=p.Z();}           
15   AliHMPIDHit(Int_t c,Int_t q  ,                    Float_t xl,Float_t yl                  ):              fCh(c ),fPid(2212),fQ(q ),fLorsX(xl),fLorsY(yl) {fTrack=Int_t(1000*gRandom->Rndm());}//manual ctor           
16   virtual ~AliHMPIDHit()                                                                                                {}
17 //framework part
18   void     Print(Option_t *option="")const;                                    //from TObject to print current status
19 //private part  
20          Int_t   Ch    (         )const{return fCh;                                    }       //Chamber
21          Float_t LorsX (         )const{return fLorsX;                                 }       //hit X position in LORS, [cm]
22          Float_t LorsY (         )const{return fLorsY;                                 }       //hit Y position in LORS, [cm]
23          Int_t   Pid   (         )const{return fPid;                                   }       //PID
24          Float_t Q     (         )const{return fQ;                                     }       //Eloss for MIP hit or Etot for photon hit, [GeV]
25   inline Float_t QdcTot(Float_t e);                                                            //calculate total charge of the hit          
26          Int_t   Tid   (         )const{return fTrack;                                 }       //TID
27          
28 protected:                                                                     //AliHit has fTid,fX,fY,fZ 
29   Int_t    fCh;                                                                //Chamber
30   Int_t    fPid;                                                               //PID
31   Float_t  fQ;                                                                 //total charge [QDC]
32   Float_t  fLorsX;                                                             //hit X position in chamber LORS, [cm]
33   Float_t  fLorsY;                                                             //hit Y position in chamber LORS, [cm]
34   ClassDef(AliHMPIDHit,5)                                                      //HMPID hit class 
35 };//class AliHMPIDhit
36 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
37 Float_t AliHMPIDHit::QdcTot(Float_t e)
38 {
39 // Samples total charge of the hit
40 // Arguments: e- hit energy [GeV]; for mip Eloss for photon Etot   
41 //   Returns: total QDC
42   Float_t  x=(LorsX() > 66.6)? LorsX()-66.6:LorsX();                                                 //sagita is for PC (0-64) and not for chamber   
43   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
44   
45   Int_t iNele=Int_t(e/26e-9);  if(iNele<1) iNele=1;                                                  //number of electrons created by hit
46   for(Int_t i=1;i<=iNele;i++) fQ-=qdcEle*TMath::Log(gRandom->Rndm()+1e-6);                           //1e-6 is a protection against 0 from rndm  
47   return fQ;
48 }  
49   
50   
51   
52 typedef AliHMPIDHit AliRICHHit; // for backward compatibility
53     
54 #endif