]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDParam.h
compilation warnings fixed
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDParam.h
CommitLineData
d3da6dc4 1#ifndef AliHMPIDParam_h
2#define AliHMPIDParam_h
3010c308 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
d3da6dc4 5
3010c308 6/* $Id$ */
7
8#include <TMath.h>
d3da6dc4 9#include <TNamed.h> //base class
10#include <TGeoManager.h> //Instance()
11#include <TVector3.h> //Lors2Mars() Mars2Lors()
12
d3da6dc4 13// Class providing all the needed parametrised information
14// to construct the geometry, to define segmentation and to provide response model
15// In future will also provide all the staff needed for alignment and calibration
16
17class AliHMPIDParam :public TNamed
18{
19public:
20//ctor&dtor
21 virtual ~AliHMPIDParam() {for(Int_t i=0;i<7;i++) delete fM[i]; delete fgInstance; fgInstance=0;}
22 void Print(Option_t *opt="") const; //print current parametrization
23 static inline AliHMPIDParam* Instance(); //pointer to AliHMPIDParam singleton
58fc9564 24 static inline AliHMPIDParam* InstanceNoGeo(); //pointer to AliHMPIDParam singleton without geometry.root for MOOD, displays, ...
ae5a42aa 25//geo info
26 enum EChamberData{kMinCh=0,kMaxCh=6,kMinPc=0,kMaxPc=5}; //Segmenation
27 enum EPadxData{kPadPcX=80,kMinPx=0,kMaxPx=79,kMaxPcx=159}; //Segmentation structure along x
28 enum EPadyData{kPadPcY=48,kMinPy=0,kMaxPy=47,kMaxPcy=143}; //Segmentation structure along y
29
30 static Float_t SizePadX ( ) {return fgCellX; /*return 0.804;*/} //pad size x, [cm]
31 static Float_t SizePadY ( ) {return fgCellY; /*0.84*/} //pad size y, [cm]
32
33 static Float_t SizePcX ( ) {return fgPcX;} // PC size x
34 static Float_t SizePcY ( ) {return fgPcY;} // PC size y
35 static Float_t MaxPcX (Int_t iPc ) {return fgkMaxPcX[iPc];} // PC limits
36 static Float_t MaxPcY (Int_t iPc ) {return fgkMaxPcY[iPc];} // PC limits
37 static Float_t MinPcX (Int_t iPc ) {return fgkMinPcX[iPc];} // PC limits
38 static Float_t MinPcY (Int_t iPc ) {return fgkMinPcY[iPc];} // PC limits
39 static Int_t Nsig ( ) {return fgSigmas;} //Getter n. sigmas for noise
40 static Float_t SizeAllX ( ) {return fgAllX/*fgkMaxPcX[5]*/;} //all PCs size x, [cm]
41 static Float_t SizeAllY ( ) {return fgAllY/*fgkMaxPcY[5]*/;} //all PCs size y, [cm]
42
43 static Float_t LorsX (Int_t pc,Int_t padx ) {return (padx +0.5)*SizePadX()+fgkMinPcX[pc]; } //center of the pad x, [cm]
44
45 static Float_t LorsY (Int_t pc,Int_t pady ) {return (pady +0.5)*SizePadY()+fgkMinPcY[pc]; } //center of the pad y, [cm]
46
47 inline static void Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py); //(x,y)->(pc,px,py)
48
49 static Int_t Abs (Int_t ch,Int_t pc,Int_t x,Int_t y) {return ch*100000000+pc*1000000+x*1000+y; } //(ch,pc,padx,pady)-> abs pad
50 static Int_t A2C (Int_t pad ) {return pad/100000000; } //abs pad -> chamber
51 static Int_t A2P (Int_t pad ) {return pad%100000000/1000000; } //abs pad -> pc
52 static Int_t A2X (Int_t pad ) {return pad%1000000/1000; } //abs pad -> pad X
53 static Int_t A2Y (Int_t pad ) {return pad%1000; } //abs pad -> pad Y
54
55 static Bool_t IsOverTh (Float_t q ) {return q >= fgSigmas; } //is digit over threshold?
56
57 inline static Bool_t IsInDead(Float_t x,Float_t y ); //is point in dead area?
58 static Bool_t IsInside (Float_t x,Float_t y,Float_t d=0) {return x>-d&&y>-d&&x<fgkMaxPcX[kMaxPc]+d&&y<fgkMaxPcY[kMaxPc]+d; } //is point inside chamber boundary?
59
60
61 Double_t MeanIdxRad ()const {return 1.29204;} //<--TEMPORAR--> to be removed in future Mean ref index C6F14
62 Double_t MeanIdxWin ()const {return 1.57819;} //<--TEMPORAR--> to be removed in future. Mean ref index quartz
63 Float_t DistCut ()const {return 1.0;} //<--TEMPORAR--> to be removed in future. Cut for MIP-TRACK residual
64 Float_t QCut ()const {return 100;} //<--TEMPORAR--> to be removed in future. Separation PHOTON-MIP charge
65 Float_t MultCut ()const {return 200;} //<--TEMPORAR--> to be removed in future. Multiplicity cut to activate WEIGHT procedure
66
67
68
d3da6dc4 69 static Int_t Stack(Int_t evt=-1,Int_t tid=-1); //Print stack info for event and tid
70 static Int_t StackCount(Int_t pid,Int_t evt); //Counts stack particles of given sort in given event
1d4857c5 71 static void IdealPosition(Int_t iCh,TGeoHMatrix *m); //ideal position of given chamber
72 //trasformation methodes
d3da6dc4 73 void Lors2Mars (Int_t c,Float_t x,Float_t y,Double_t *m,Int_t pl=kPc)const{Double_t z=0; switch(pl){case kPc:z=8.0;break; case kAnod:z=7.806;break; case kRad:z=-1.25; break;} Double_t l[3]={x-fX,y-fY,z}; fM[c]->LocalToMaster(l,m); }
74 TVector3 Lors2Mars (Int_t c,Float_t x,Float_t y, Int_t pl=kPc)const{Double_t m[3];Lors2Mars(c,x,y,m,pl); return TVector3(m); }//MRS->LRS
59d9d4b3 75 void Mars2Lors (Int_t c,Double_t *m,Float_t &x ,Float_t &y )const{Double_t l[3];fM[c]->MasterToLocal(m,l);x=l[0]+fX;y=l[1]+fY;}//MRS->LRS
86568433 76 void Mars2LorsVec(Int_t c,Double_t *m,Float_t &th,Float_t &ph )const{Double_t l[3]; fM[c]->MasterToLocalVect(m,l);
77 Float_t pt=TMath::Sqrt(l[0]*l[0]+l[1]*l[1]);
78 th=TMath::ATan(pt/l[2]);
79 ph=TMath::ATan2(l[1],l[0]);}
d3da6dc4 80 TVector3 Norm (Int_t c )const{Double_t n[3]; Norm(c,n); return TVector3(n); }//norm
81 void Norm (Int_t c,Double_t *n )const{Double_t l[3]={0,0,1};fM[c]->LocalToMasterVect(l,n); }//norm
59d9d4b3 82 void Point (Int_t c,Double_t *p,Int_t plane )const{Lors2Mars(c,0,0,p,plane);} //point of given chamber plane
58fc9564 83
d3da6dc4 84 enum EPlaneId {kPc,kRad,kAnod}; //3 planes in chamber
ae5a42aa 85
86 static Int_t fgSigmas; //sigma Cut
87
58fc9564 88
d3da6dc4 89protected:
ae5a42aa 90 static /*const*/ Float_t fgkMinPcX[6]; //limits PC
91 static /*const*/ Float_t fgkMinPcY[6]; //limits PC
92 static /*const*/ Float_t fgkMaxPcX[6]; //limits PC
93 static /*const*/ Float_t fgkMaxPcY[6];
94
95 static Float_t fgCellX, fgCellY, fgPcX, fgPcY, fgAllX, fgAllY;
58fc9564 96 AliHMPIDParam(Bool_t noGeo); //default ctor is protected to enforce it to be singleton
ae5a42aa 97
d3da6dc4 98 static AliHMPIDParam *fgInstance; //static pointer to instance of AliHMPIDParam singleton
ae5a42aa 99
423554a3 100 TGeoHMatrix *fM[7]; //pointers to matrices defining HMPID chambers rotations-translations
101 Float_t fX; //x shift of LORS with respect to rotated MARS
102 Float_t fY; //y shift of LORS with respect to rotated MARS
ae5a42aa 103
58fc9564 104
105
d3da6dc4 106 ClassDef(AliHMPIDParam,0) //HMPID main parameters class
107};
cf7e313e 108
d3da6dc4 109//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
110AliHMPIDParam* AliHMPIDParam::Instance()
111{
112// Return pointer to the AliHMPIDParam singleton.
113// Arguments: none
114// Returns: pointer to the instance of AliHMPIDParam or 0 if no geometry
58fc9564 115 if(!fgInstance) new AliHMPIDParam(kFALSE); //default setting for reconstruction, if no geometry.root -> AliFatal
116 return fgInstance;
117}//Instance()
118//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
119AliHMPIDParam* AliHMPIDParam::InstanceNoGeo()
120{
121// Return pointer to the AliHMPIDParam singleton without the geometry.root.
122// Arguments: none
123// Returns: pointer to the instance of AliHMPIDParam or 0 if no geometry
124 if(!fgInstance) new AliHMPIDParam(kTRUE); //to avoid AliFatal, for MOOD and displays, use ideal geometry parameters
d3da6dc4 125 return fgInstance;
126}//Instance()
127//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ae5a42aa 128Bool_t AliHMPIDParam::IsInDead(Float_t x,Float_t y)
129{
130// Check is the current point is outside of sensitive area or in dead zones
131// Arguments: x,y -position
132// Returns: 1 if not in sensitive zone
133 for(Int_t iPc=0;iPc<6;iPc++)
134 if(x>=fgkMinPcX[iPc] && x<=fgkMaxPcX[iPc] && y>=fgkMinPcY[iPc] && y<=fgkMaxPcY [iPc]) return kFALSE; //in current pc
135
136 return kTRUE;
137}
138//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
139void AliHMPIDParam::Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py)
140{
141// Check the pad of given position
142// Arguments: x,y- position [cm] in LORS; pc,px,py- pad where to store the result
143// Returns: none
144 pc=px=py=-1;
145 if (x>fgkMinPcX[0] && x<fgkMaxPcX[0]) {pc=0; px=Int_t( x / SizePadX());}//PC 0 or 2 or 4
146 else if(x>fgkMinPcX[1] && x<fgkMaxPcX[1]) {pc=1; px=Int_t((x-fgkMinPcX[1]) / SizePadX());}//PC 1 or 3 or 5
147 else return;
148 if (y>fgkMinPcY[0] && y<fgkMaxPcY[0]) { py=Int_t( y / SizePadY());}//PC 0 or 1
149 else if(y>fgkMinPcY[2] && y<fgkMaxPcY[2]) {pc+=2;py=Int_t((y-fgkMinPcY[2]) / SizePadY());}//PC 2 or 3
150 else if(y>fgkMinPcY[4] && y<fgkMaxPcY[4]) {pc+=4;py=Int_t((y-fgkMinPcY[4]) / SizePadY());}//PC 4 or 5
151 else return;
152}
d3da6dc4 153#endif