]>
Commit | Line | Data |
---|---|---|
d3da6dc4 | 1 | #ifndef AliHMPIDDigit_h |
2 | #define AliHMPIDDigit_h | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
ea925242 | 6 | // Class of HMPID to manage digits ---> pads |
7 | // | |
8 | // | |
9 | ||
10 | ||
d3da6dc4 | 11 | #include <AliDigit.h> //base class |
ea925242 | 12 | #include "TMath.h" //Mathieson() |
13 | #include "TRandom.h" //IsOverTh() | |
d3da6dc4 | 14 | #include <AliBitPacking.h> //Raw() |
1d4857c5 | 15 | |
d3da6dc4 | 16 | |
d3da6dc4 | 17 | class TClonesArray; //Hit2Sdi() |
3c6274c1 | 18 | |
d3da6dc4 | 19 | class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit |
20 | { | |
21 | public: | |
a1d55ff3 | 22 | enum EChamberData{kMinCh=0,kMaxCh=6,kMinPc=0,kMaxPc=5}; //Segmenation |
23 | enum EPadxData{kPadPcX=80,kMinPx=0,kMaxPx=79,kMaxPcx=159}; //Segmentation structure along x | |
24 | enum EPadyData{kPadPcY=48,kMinPy=0,kMaxPy=47,kMaxPcy=143}; //Segmentation structure along y | |
d3da6dc4 | 25 | //ctor&dtor |
1d4857c5 | 26 | AliHMPIDDigit( ):AliDigit( ),fPad(Abs(-1,-1,-1,-1)),fQ(-1) {} //default ctor |
27 | AliHMPIDDigit(Int_t pad,Int_t q,Int_t *t):AliDigit(t),fPad(pad ),fQ(q ) {} //digit ctor | |
28 | AliHMPIDDigit(const AliHMPIDDigit &d ):AliDigit(d),fPad(d.fPad),fQ(d.fQ) {} //copy ctor | |
29 | virtual ~AliHMPIDDigit() {} //dtor | |
d3da6dc4 | 30 | //framework part |
31 | Bool_t IsSortable ( )const{return kTRUE;} //provision to use TObject::Sort() | |
32 | inline Int_t Compare (const TObject *pObj )const; //provision to use TObject::Sort() | |
d1bf51e1 | 33 | void Draw (Option_t *opt="" ); //TObject::Draw() overloaded |
d3da6dc4 | 34 | void Print (Option_t *opt="" )const; //TObject::Print() overloaded |
35 | //private part | |
c5c19d6a | 36 | 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 |
1d4857c5 | 37 | static Int_t A2C (Int_t pad ) {return pad/100000000; } //abs pad -> chamber |
38 | static Int_t A2P (Int_t pad ) {return pad%100000000/1000000; } //abs pad -> pc | |
39 | static Int_t A2X (Int_t pad ) {return pad%1000000/1000; } //abs pad -> pad X | |
40 | static Int_t A2Y (Int_t pad ) {return pad%1000; } //abs pad -> pad Y | |
41 | void AddTidOffset(Int_t offset ) {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset; } //needed for merging | |
42 | Int_t Ch ( )const{return A2C(fPad); } //chamber number | |
ea925242 | 43 | static Bool_t IsOverTh (Float_t q ) {return q >= fgSigmas; } //is digit over threshold???? |
a591e55f | 44 | static Bool_t IsInside (Float_t x,Float_t y,Float_t margin=0){return x>-margin&&y>-margin&&x<SizeAllX()+margin&&y<SizeAllY()+margin;} //is point inside chamber boundary? |
1d4857c5 | 45 | Float_t LorsX ( )const{return LorsX(A2P(fPad),A2X(fPad)); } //center of the pad x, [cm] |
d1bf51e1 | 46 | static Float_t LorsX (Int_t pc,Int_t padx ) {return (padx +0.5)*SizePadX()+(pc %2)*(SizePcX()+SizeDead());} //center of the pad x, [cm] |
1d4857c5 | 47 | Float_t LorsY ( )const{return LorsY(A2P(fPad),A2Y(fPad)); } //center of the pad y, [cm] |
d1bf51e1 | 48 | static Float_t LorsY (Int_t pc,Int_t pady ) {return (pady +0.5)*SizePadY()+(pc /2)*(SizePcY()+SizeDead());} //center of the pad y, [cm] |
c5c19d6a | 49 | inline Float_t IntMathieson(Float_t x,Float_t y )const; //Mathieson distribution |
3c6274c1 | 50 | Int_t PadPcX ( )const{return A2X(fPad);} //pad pc x # 0..79 |
51 | Int_t PadPcY ( )const{return A2Y(fPad);} //pad pc y # 0..47 | |
52 | Int_t PadChX ( )const{return (Pc()%2)*kPadPcX+PadPcX();} //pad ch x # 0..159 | |
53 | Int_t PadChY ( )const{return (Pc()/2)*kPadPcY+PadPcY();} //pad ch y # 0..143 | |
d3da6dc4 | 54 | Int_t Pad ( )const{return fPad;} //absolute id of this pad |
d3da6dc4 | 55 | Int_t Pc ( )const{return A2P(fPad);} //PC position number |
da08475b | 56 | Float_t Q ( )const{return fQ;} //charge, [QDC] |
1d4857c5 | 57 | inline void Raw (UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a)const; //digit->(w32,ddl,r,d,a) |
58 | inline void Raw (UInt_t w32,Int_t ddl ); //(w32,ddl)->digit | |
f3bae3e2 | 59 | inline Bool_t Set (Int_t c,Int_t p,Int_t x,Int_t y,Int_t tid=0); //manual creation |
60 | void SetQ (Float_t q ) {fQ=q;} //manual creation | |
ea925242 | 61 | void SetSigmas (Int_t sigmas ) {fgSigmas=sigmas;} //manual creation |
1d4857c5 | 62 | static void WriteRaw (TObjArray *pDigLst ); //write as raw stream |
d3da6dc4 | 63 | |
ea925242 | 64 | static Float_t CathAnoCath ( ) {return 0.445;} //Cathode-Anode-cathode pitch |
65 | static Float_t MaxPcX (Int_t iPc ) {return fgkMaxPcX[iPc];} // PC limits | |
66 | static Float_t MaxPcY (Int_t iPc ) {return fgkMaxPcY[iPc];} // PC limits | |
67 | static Float_t MinPcX (Int_t iPc ) {return fgkMinPcX[iPc];} // PC limits | |
68 | static Float_t MinPcY (Int_t iPc ) {return fgkMinPcY[iPc];} // PC limits | |
69 | static Int_t Sigmas ( ) {return fgSigmas;} // Getter n. sigmas for noise | |
70 | static Float_t SizeAllX ( ) {return fgkMaxPcX[5];} //all PCs size x, [cm] | |
71 | static Float_t SizeAllY ( ) {return fgkMaxPcY[5];} //all PCs size y, [cm] | |
1d4857c5 | 72 | static Float_t SizeArea ( ) {return SizePcX()*SizePcY()*(kMaxPc-kMinPc+1);} //sence area, [cm^2] |
d3da6dc4 | 73 | static Float_t SizeDead ( ) {return 2.6;} //dead zone size x, [cm] |
74 | static Float_t SizeGap ( ) {return 8; } | |
75 | static Float_t SizePadX ( ) {return 0.8;} //pad size x, [cm] | |
76 | static Float_t SizePadY ( ) {return 0.84;} //pad size y, [cm] | |
ea925242 | 77 | static Float_t SizePcX ( ) {return fgkMaxPcX[0];} //PC size x, [cm] |
78 | static Float_t SizePcY ( ) {return fgkMaxPcY[0];} //PC size y, [cm] | |
da08475b | 79 | static Float_t SizeWin ( ) {return 0.5;} //Quartz window width |
80 | static Float_t SizeRad ( ) {return 1.5;} //Rad width | |
ea925242 | 81 | inline static Bool_t IsInDead(Float_t x,Float_t y ); //is point in dead area? |
82 | inline static void Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py); //(x,y)->(pc,px,py) | |
c5c19d6a | 83 | protected: //AliDigit has fTracks[3] |
ea925242 | 84 | static Int_t fgSigmas; //sigma cut on charge |
85 | static const Float_t fgkMinPcX[6]; //limits PC | |
86 | static const Float_t fgkMinPcY[6]; //limits PC | |
87 | static const Float_t fgkMaxPcX[6]; //limits PC | |
88 | static const Float_t fgkMaxPcY[6]; //limits PC | |
89 | static const Float_t fgk1; //Mathieson parameters | |
90 | static const Float_t fgk2; // | |
91 | static const Float_t fgkSqrtK3; // | |
92 | static const Float_t fgk4; // | |
c5c19d6a | 93 | Int_t fPad; //absolute pad number |
94 | Float_t fQ; //QDC value, fractions are permitted for summable procedure | |
95 | ClassDef(AliHMPIDDigit,4) //HMPID digit class | |
96 | };//class AliHMPIDDigit | |
cf7e313e | 97 | |
d3da6dc4 | 98 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1d4857c5 | 99 | void AliHMPIDDigit::Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py) |
d3da6dc4 | 100 | { |
1d4857c5 | 101 | // Check the pad of given position |
102 | // Arguments: x,y- position [cm] in LORS; pc,px,py- pad where to store the result | |
103 | // Returns: none | |
104 | pc=px=py=-1; | |
3c6274c1 | 105 | if (x>= 0 && x<= SizePcX() ) {pc=0; px=Int_t( x / SizePadX());}//PC 0 or 2 or 4 |
106 | else if(x>=SizePcX()+SizeDead() && x<= SizeAllX() ) {pc=1; px=Int_t((x- SizePcX()- SizeDead()) / SizePadX());}//PC 2 or 4 or 6 | |
1d4857c5 | 107 | else return; |
3c6274c1 | 108 | if (y>= 0 && y<= SizePcY() ) { py=Int_t( y / SizePadY());}//PC 0 or 1 |
109 | else if(y>=SizePcY()+SizeDead() && y<=2*SizePcY()+SizeDead() ) {pc+=2;py=Int_t((y- SizePcY()- SizeDead()) / SizePadY());}//PC 2 or 3 | |
110 | else if(y>=SizeAllY()-SizePcY() && y<= SizeAllY() ) {pc+=4;py=Int_t((y-2*SizePcY()-2*SizeDead()) / SizePadY());}//PC 4 or 5 | |
1d4857c5 | 111 | else return; |
112 | } | |
d3da6dc4 | 113 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
114 | Int_t AliHMPIDDigit::Compare(const TObject *pObj) const | |
115 | { | |
116 | // Used in Sort() method to compare to objects. Note that abs pad structure is first x then y, hence will be sorted on column basis. | |
117 | // This feature is used in digitizer to facilitate finding of sdigits for the same pad since they all will come together after sorting. | |
118 | // Arguments: pObj - pointer to object to compare with | |
119 | // Retunrs: -1 if AbsPad less then in pObj, 1 if more and 0 if they are the same | |
120 | if (fPad==((AliHMPIDDigit*)pObj)->Pad()) return 0; | |
121 | else if(fPad >((AliHMPIDDigit*)pObj)->Pad()) return 1; | |
da08475b | 122 | else return -1; |
d3da6dc4 | 123 | } |
124 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
125 | Bool_t AliHMPIDDigit::IsInDead(Float_t x,Float_t y) | |
126 | { | |
127 | // Check is the current point is outside of sensitive area or in dead zones | |
128 | // Arguments: x,y -position | |
129 | // Returns: 1 if not in sensitive zone | |
130 | if(x<0 || x>SizeAllX() || y<0 || y>SizeAllY()) return kTRUE; //out of pc | |
131 | ||
132 | if(x>SizePcX() && x<SizePcX()+SizeDead()) return kTRUE; //in dead zone along x | |
133 | ||
134 | if(y>SizePcY() && y<SizePcY()+SizeDead()) return kTRUE; //in first dead zone along y | |
135 | if(y>SizeAllY()-SizePcY()-SizeDead() && y<SizeAllY()-SizePcY()) return kTRUE; //in second dead zone along y | |
136 | return kFALSE; | |
137 | } | |
138 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
c5c19d6a | 139 | Float_t AliHMPIDDigit::IntMathieson(Float_t x,Float_t y)const |
d3da6dc4 | 140 | { |
c5c19d6a | 141 | // Integration of Mathieson. |
d3da6dc4 | 142 | // This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603) |
143 | // Arguments: x,y- position of the center of Mathieson distribution | |
144 | // Returns: a charge fraction [0-1] imposed into the pad | |
c5c19d6a | 145 | // K1 =0.28278796 |
146 | // K2 =0.96242952 | |
147 | // SqrtK3=0.77459667 | |
148 | // K4 =0.37932926 | |
d3da6dc4 | 149 | |
ea925242 | 150 | Float_t ux1=fgkSqrtK3*TMath::TanH(fgk2*(x-LorsX()+0.5*SizePadX())/CathAnoCath()); |
151 | Float_t ux2=fgkSqrtK3*TMath::TanH(fgk2*(x-LorsX()-0.5*SizePadX())/CathAnoCath()); | |
152 | Float_t uy1=fgkSqrtK3*TMath::TanH(fgk2*(y-LorsY()+0.5*SizePadY())/CathAnoCath()); | |
153 | Float_t uy2=fgkSqrtK3*TMath::TanH(fgk2*(y-LorsY()-0.5*SizePadY())/CathAnoCath()); | |
154 | return 4*fgk4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fgk4*(TMath::ATan(uy2)-TMath::ATan(uy1)); | |
d3da6dc4 | 155 | } |
156 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1d4857c5 | 157 | void AliHMPIDDigit::Raw(UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a)const |
d3da6dc4 | 158 | { |
159 | // Convert digit structure to raw word format | |
1d4857c5 | 160 | // Arguments: w32,ddl,r,d,a where to write the results |
161 | // Returns: none | |
162 | Int_t y2a[6]={5,3,1,0,2,4}; | |
163 | ||
164 | ddl=2*Ch()+Pc()%2; //DDL# 0..13 | |
165 | Int_t tmp=1+Pc()/2*8+PadPcY()/6; r=(Pc()%2)? 25-tmp:tmp; //row r=1..24 | |
166 | d=1+PadPcX()/8; //DILOGIC# 1..10 | |
167 | a=y2a[PadPcY()%6]+6*(PadPcX()%8); //ADDRESS 0..47 | |
168 | ||
169 | w32=0; | |
170 | AliBitPacking::PackWord((UInt_t)fQ,w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) | |
171 | AliBitPacking::PackWord( a ,w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) | |
172 | AliBitPacking::PackWord( d ,w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) | |
173 | AliBitPacking::PackWord( r ,w32,22,26); // Row number bits (22..26) counts (1..24) | |
d3da6dc4 | 174 | } |
175 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1d4857c5 | 176 | void AliHMPIDDigit::Raw(UInt_t w32,Int_t ddl) |
d3da6dc4 | 177 | { |
178 | // Converts a given raw data word to a digit | |
179 | // Arguments: w32 - 32 bits raw data word | |
180 | // ddl - DDL idx 0 1 2 3 4 ... 13 | |
181 | // Returns: none | |
1d4857c5 | 182 | Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip) |
183 | Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24); // Row number (1..24) | |
184 | Int_t d = AliBitPacking::UnpackWord(w32,18,21); assert(1<=d&&d<=10); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC number (1..10) | |
185 | Int_t a = AliBitPacking::UnpackWord(w32,12,17); assert(0<=a&&a<=47); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC address (0..47) | |
186 | Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc (0..4095) | |
187 | Int_t ch=ddl/2; | |
188 | Int_t tmp=(r-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; | |
189 | Int_t px=(d-1)*8+a/6; | |
190 | tmp=(ddl%2)?(24-r):r-1; Int_t py=6*(tmp%8)+a2y[a%6]; | |
191 | fPad=Abs(ch,pc,px,py);fQ=q; | |
d3da6dc4 | 192 | } |
193 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
f3bae3e2 | 194 | Bool_t AliHMPIDDigit::Set(Int_t ch,Int_t pc,Int_t px,Int_t py,Int_t tid) |
1d4857c5 | 195 | { |
196 | // Manual creation of digit | |
197 | // Arguments: ch,pc,px,py,qdc,tid | |
f3bae3e2 | 198 | // Returns: kTRUE if wrong digit |
1d4857c5 | 199 | if(px<kMinPx || px>kMaxPx) return kTRUE; |
200 | if(py<kMinPy || py>kMaxPy) return kTRUE; | |
201 | ||
f3bae3e2 | 202 | fPad=Abs(ch,pc,px,py);fTracks[0]=tid; |
203 | fQ=0; | |
1d4857c5 | 204 | return kFALSE; |
205 | } | |
d3da6dc4 | 206 | #endif |