645249b3066dcec667d407bddb7a2b2ece09d14b
[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 #include <TMath.h>
10
11 class AliHMPIDHit : public AliHit //   TObject-AliHit-AliHMPIDHit
12 {
13 public:
14   AliHMPIDHit(                                                                         ):AliHit(    ),fCh(-1),fPid(-1),fQ(-1),fLx(0),fLy(0){} //default ctor
15   AliHMPIDHit(Int_t c,Float_t e,Int_t id,Int_t tn,Float_t x,Float_t y,const TVector3 &p):AliHit(0,tn),fCh(c ),fPid(id),fQ(-1),fLx(x),fLy(y){QdcTot(e);fX=p.X();fY=p.Y();fZ=p.Z();}
16   AliHMPIDHit(Int_t c,Float_t e,Int_t id,Int_t tn,Float_t x,Float_t y                  ):             fCh(c ),fPid(id),fQ(-1),fLx(x),fLy(y){QdcTot(e);fTrack=tn;}//manual ctor 
17   virtual ~AliHMPIDHit()                                                                                                                                 {}
18 //framework part
19          void    Print(Option_t *opt="")const;                                                 //from TObject to print current status
20          void    Draw (Option_t *opt="");                                                      //from TObject to Draw this hit in current canvas
21 //private part  
22          Int_t   Ch    (         )const{return fCh;                                    }       //Chamber
23          //clm: hit LorsX and Y were changed for simulation hits
24          Float_t LorsX (         )const{return fLx;                                    }       //hit X position in LORS, [cm]
25          Float_t LorsY (         )const{return fLy;                                    }       //hit Y position in LORS, [cm]
26          Int_t   Pid   (         )const{return fPid;                                   }       //PID
27          Float_t Q     (         )const{return fQ;                                     }       //Eloss for MIP hit or Etot for photon hit, [GeV]
28   inline Float_t QdcTot(Float_t e);                                                            //calculate total charge of the hit          
29          Int_t   Tid   (         )const{return fTrack;                                 }       //TID
30          
31 protected:                                                                     //AliHit has fTid,fX,fY,fZ 
32   Int_t    fCh;                                                                //Chamber
33   Int_t    fPid;                                                               //PID
34   Float_t  fQ;                                                                 //total charge [QDC]
35   Float_t  fLx;                                                                //hit X position in chamber LORS, [cm]
36   Float_t  fLy;                                                                //hit Y position in chamber LORS, [cm]
37   ClassDef(AliHMPIDHit,5)                                                      //HMPID hit class 
38 };//class AliHMPIDhit
39 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
40 Float_t AliHMPIDHit::QdcTot(Float_t e)
41 {
42 // Samples total charge of the hit
43 // Arguments: e- hit energy [GeV]; for mip Eloss for photon Etot   
44 //   Returns: total QDC
45   Float_t  x=(LorsX() > 66.6)? LorsX()-66.6:LorsX();                                                 //sagita is for PC (0-64) and not for chamber   
46   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
47   
48   Int_t iNele=Int_t(e/26e-9);  if(iNele<1) iNele=1;                                                  //number of electrons created by hit
49   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  
50   return fQ;
51 }  
52 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53     
54 typedef AliHMPIDHit AliRICHHit; // for backward compatibility
55     
56 #endif