]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDHit.h
Add TPC preprocessor (Haavard, Marian)
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDHit.h
CommitLineData
d3da6dc4 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
3c6274c1 8#include <TRandom.h> //QdcTot()
1d4857c5 9#include "AliHMPIDDigit.h" //QdcTot()
d3da6dc4 10
11class AliHMPIDHit : public AliHit // TObject-AliHit-AliHMPIDHit
12{
13public:
1d4857c5 14 AliHMPIDHit( ):AliHit( ),fCh(-1),fPid(-1 ),fQ(-1),fLx(0),fLy(0){} //default ctor
f3bae3e2 15 AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y,const TVector3 &p):AliHit(0,tid),fCh(c ),fPid(pid),fQ(0 ),fLx(x),fLy(y){e=QdcTot(e);fX=p.X();fY=p.Y();fZ=p.Z();}
16 AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y ):AliHit( ),fCh(c ),fPid(pid),fQ(0 ),fLx(x),fLy(y){e=QdcTot(e);fTrack=tid;}//manual ctor
1d4857c5 17 AliHMPIDHit(const AliHMPIDHit &h):AliHit(h),fCh(h.fCh),fPid(h.fPid),fQ(h.fQ),fLx(h.fLx),fLy(h.fLy) {}//copy ctor
d1bf51e1 18 virtual ~AliHMPIDHit() {}
d3da6dc4 19//framework part
1d4857c5 20 void Print(Option_t *opt="")const; //from TObject to print current status
21 void Draw (Option_t *opt=""); //from TObject to Draw this hit
d3da6dc4 22//private part
1d4857c5 23 Int_t Ch ( )const{return fCh; } //Chamber
24 void Hit2Sdi(TClonesArray *pSdiLst,Int_t n=1)const; //add sdigits of this hit to the list
25 Float_t LorsX ( )const{return fLx; } //hit X position in LORS, [cm]
26 Float_t LorsY ( )const{return fLy; } //hit Y position in LORS, [cm]
27 Int_t Pid ( )const{return fPid; } //PID
28 Float_t Q ( )const{return fQ; } //total charge, [QDC]
f3bae3e2 29 inline Float_t QdcTot (Float_t e ); //calculate total charge of the hit
1d4857c5 30 Int_t Tid ( )const{return fTrack; } //TID
f3bae3e2 31 void SetQ (Float_t q ) {fQ=q; } //for debugging...
1d4857c5 32protected: //AliHit has fTrack,fX,fY,fZ
d3da6dc4 33 Int_t fCh; //Chamber
34 Int_t fPid; //PID
3c6274c1 35 Float_t fQ; //total charge [QDC]
d1bf51e1 36 Float_t fLx; //hit X position in chamber LORS, [cm]
37 Float_t fLy; //hit Y position in chamber LORS, [cm]
3c6274c1 38 ClassDef(AliHMPIDHit,5) //HMPID hit class
d3da6dc4 39};//class AliHMPIDhit
3c6274c1 40//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f3bae3e2 41Float_t AliHMPIDHit::QdcTot(Float_t e)
3c6274c1 42{
43// Samples total charge of the hit
1d4857c5 44// Arguments: e- hit energy [GeV] for mip Eloss for photon Etot
3c6274c1 45// Returns: total QDC
1d4857c5 46 Int_t pc,px,py;
47 AliHMPIDDigit::Lors2Pad(fLx,fLy,pc,px,py);
48 Float_t y=AliHMPIDDigit::LorsY(pc,py);
49 fLy=((y-fLy)>0)?y-0.2:y+0.2; //shift to the nearest anod wire
50
51 Float_t x=(fLx > 66.6)? fLx-66.6:fLx; //sagita is for PC (0-64) and not for chamber
3c6274c1 52 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
53
54 Int_t iNele=Int_t(e/26e-9); if(iNele<1) iNele=1; //number of electrons created by hit
1d4857c5 55 fQ=0;
56 for(Int_t i=1;i<=iNele;i++){
57 Double_t rnd=gRandom->Rndm(); if(rnd==0) rnd=1e-12; //1e-12 is a protection against 0 from rndm
58 fQ-=qdcEle*TMath::Log(rnd);
59 }
3c6274c1 60 return fQ;
61}
d1bf51e1 62//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1d4857c5 63
d3da6dc4 64#endif