]>
Commit | Line | Data |
---|---|---|
0fe8fa07 | 1 | #ifndef AliRICHDigit_h |
2 | #define AliRICHDigit_h | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
0422a446 | 6 | #include <AliDigit.h> //base class |
db910db9 | 7 | #include <AliBitPacking.h> //ToRaw(), FromRaw() |
8 | #include <TVector.h> //ctor | |
0fe8fa07 | 9 | |
9de8d990 | 10 | class AliRICHDigit :public AliDigit //TObject-AliDigit-AliRICHDigit |
0fe8fa07 | 11 | { |
12 | public: | |
9de8d990 | 13 | enum EAbsPad {kChamAbs=10000000,kSecAbs=1000000,kPadAbsX=1000,kPadAbsY=1}; //absolute pad number structure |
14 | enum ERawData{kDiloX=8,kDiloY=6,kNdilo=10}; //DILOGIC structure | |
db910db9 | 15 | enum EPadData{kFirstPad=1,kPadsSecX=80,kPadsSecY=48,kPadsChamX=160,kPadsChamY=144,kSecX=2,kSecY=3}; //Segmentation structure |
9de8d990 | 16 | enum EDdlData{kNddls=14}; //DDL structure |
db910db9 | 17 | //ctor&dtor |
18 | AliRICHDigit() :AliDigit(),fCFM(-1) ,fChamber(-1 ) ,fPadX(-1) ,fPadY(-1) ,fQdc(-1) {} | |
19 | AliRICHDigit(Int_t pad,Double_t qdc,Int_t cfm=-1,Int_t tid=-1):AliDigit(),fCFM(cfm),fChamber(P2C(pad)) ,fPadX(P2X(pad)),fPadY(P2Y(pad)),fQdc(qdc) {fTracks[0]=tid;} | |
20 | AliRICHDigit(TVector pad,Double_t q ):AliDigit(),fCFM(-1) ,fChamber(-1) ,fPadX((Int_t)pad[0]) ,fPadY((Int_t)pad[1]) ,fQdc(q) {} | |
21 | AliRICHDigit(Int_t c,TVector pad,Double_t q,Int_t cfm,Int_t tid0,Int_t tid1,Int_t tid2):fCFM(cfm),fChamber(c) | |
22 | {fPadX=(Int_t)pad[0];fPadY=(Int_t)pad[1];fQdc=q;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;} | |
0fe8fa07 | 23 | virtual ~AliRICHDigit() {;} |
0422a446 | 24 | //framework part |
db910db9 | 25 | Bool_t IsSortable ( )const{return kTRUE;} //provision to use TObject::Sort() |
26 | inline Int_t Compare (const TObject *pObj )const; //provision to use TObject::Sort() | |
9de8d990 | 27 | void Print (Option_t *opt="" )const; //TObject::Print() overloaded |
0fe8fa07 | 28 | //private part |
9de8d990 | 29 | Int_t A ( )const{return (PadY()-1)%kDiloY*kDiloX+(PadX()-1)%kDiloX;} //DILOGIC address 0..47 invented ????? |
db910db9 | 30 | void AddTidOffset(Int_t offset ) {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;}; //needed for merging |
31 | Int_t Cfm ( )const{return fCFM;} //ckov-feed-mip mixture | |
32 | Int_t Chamber ( )const{return fChamber;} //chamber number | |
33 | Int_t C ( )const{return fChamber;} //chamber number | |
9de8d990 | 34 | Int_t D ( )const{return 1+(PadX()-1)/kDiloX;} //DILOGIC chip number 1..10 |
35 | Int_t Ddl ( )const{return (PadX()<=kPadsSecX) ? 2*C()-1 : 2*C();} //DDL number 0..13 | |
db910db9 | 36 | inline Int_t Dig2Raw ( UInt_t &w )const; //returns DDL ID and fill raw word |
37 | Int_t PadX ( )const{return fPadX;} //x position of the pad | |
38 | Int_t PadY ( )const{return fPadY;} //y postion of the pad | |
39 | TVector Pad ( )const{Float_t v[2]={fPadX,fPadY}; return TVector(2,v);} | |
40 | Int_t PadAbs ( )const{return fChamber*kChamAbs+fPadX*kPadAbsX+fPadY;} //absolute id of this pad | |
41 | static inline Int_t Pad2Sec (Int_t x,Int_t y ); | |
42 | static Int_t P2A (Int_t c, Int_t x,Int_t y) {Int_t s=Pad2Sec(x,y);return c*kChamAbs+s*kSecAbs+x*kPadAbsX+y;} //(cham,padx,pady)-> abs pad | |
43 | static Int_t P2A (Int_t c,Int_t s,Int_t x,Int_t y) {return Pad2Sec(x,y)==s?c*kChamAbs+s*kSecAbs+x*kPadAbsX+y:-1;} //(cham,sec,padx,pady)-> abs pad | |
44 | static Int_t P2C (Int_t pad ) {return pad/kChamAbs;} //abs pad -> chamber | |
45 | static Int_t P2S (Int_t pad ) {return pad%kChamAbs/kSecAbs;} //abs pad -> sector | |
46 | static Int_t P2X (Int_t pad ) {return pad%kSecAbs/kPadAbsX;} //abs pad -> pad X | |
47 | static Int_t P2Y (Int_t pad ) {return pad%kPadAbsX;} //abs pad number-> pad Y | |
48 | Double_t Qdc ( )const{return fQdc;} //charge, QDC | |
9de8d990 | 49 | Int_t R ( )const{return 1+(PadY()-1)/kDiloY;} //DILOGIC row number 1..24 |
db910db9 | 50 | inline void Raw2Dig (Int_t ddl,UInt_t w32 ); //(DDL,w32)->(ch,sec,x,y,QDC) |
51 | Int_t S ( )const{return -1;} //sector number ????? | |
52 | static void Test ( ); //test raw-digit manipulations | |
0fe8fa07 | 53 | protected: |
db910db9 | 54 | Int_t fCFM; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips |
9de8d990 | 55 | Int_t fChamber; //chamber number |
56 | Int_t fPadX; //pad along X counts from kFirstPad to kPadsChamX | |
57 | Int_t fPadY; //pad along Y counts from kFirstPad to kPadsChamY | |
0fe8fa07 | 58 | Double_t fQdc; //QDC value, fractions are permitted for summable procedure |
59 | ClassDef(AliRICHDigit,3) //RICH digit class | |
60 | };//class AliRICHDigit | |
9de8d990 | 61 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
0422a446 | 62 | Int_t AliRICHDigit::Compare(const TObject *pObj) const |
63 | { | |
9de8d990 | 64 | // 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. |
65 | // This feature is used in digitizer to facilitate finding of sdigits for the same pad since they all will come together after sorting. | |
66 | // Arguments: pObj - pointer to object to compare with | |
67 | // Retunrs: -1 if AbsPad less then in pObj, 1 if more and 0 if they are the same | |
db910db9 | 68 | if (PadAbs()==((AliRICHDigit*)pObj)->PadAbs()) return 0; |
69 | else if(PadAbs() >((AliRICHDigit*)pObj)->PadAbs()) return 1; | |
70 | else return -1; | |
0422a446 | 71 | } |
9de8d990 | 72 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
0422a446 | 73 | void AliRICHDigit::Raw2Dig(Int_t ddl,UInt_t w32) |
74 | { | |
db910db9 | 75 | //Converts a given raw data word to a digit |
76 | //Arguments: w32 - 32 bits raw data word | |
0422a446 | 77 | // ddl - DDL file number 0 1 2 3 4 ... 13 |
78 | // Returns: none | |
db910db9 | 79 | fQdc = AliBitPacking::UnpackWord(w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) |
80 | UInt_t a = AliBitPacking::UnpackWord(w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) | |
81 | UInt_t d = AliBitPacking::UnpackWord(w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) | |
82 | UInt_t r = AliBitPacking::UnpackWord(w32,22,26); // Row number bits (22..26) counts (1..24) | |
0422a446 | 83 | |
db910db9 | 84 | fPadY = (r-1)*kDiloY+a/kDiloX+1; |
85 | fPadX = (d-1)*kDiloX+a%kDiloX+1; fPadX+=(ddl%2)*kDiloX*kNdilo;//if ddl is odd then right half of the chamber | |
86 | fChamber = (ddl+2)/2; // ddl 0..13 to chamber 1..7 | |
0422a446 | 87 | } |
9de8d990 | 88 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
0422a446 | 89 | Int_t AliRICHDigit::Dig2Raw(UInt_t &w32)const |
90 | { | |
9de8d990 | 91 | // Convert digit structure to raw word format |
92 | // Arguments: 32 bits raw word to fill | |
93 | // Returns: DDL ID where to write this digit | |
0422a446 | 94 | w32=0; |
db910db9 | 95 | AliBitPacking::PackWord((UInt_t)fQdc,w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) |
9de8d990 | 96 | AliBitPacking::PackWord( A(),w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) |
97 | AliBitPacking::PackWord( D(),w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) | |
98 | AliBitPacking::PackWord( R(),w32,22,26); // Row number bits (22..26) counts (1..24) | |
99 | return Ddl(); //ddl 0..13 where to write this digit | |
0422a446 | 100 | } |
9de8d990 | 101 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
db910db9 | 102 | Int_t AliRICHDigit::Pad2Sec(Int_t padx,Int_t pady) |
103 | { | |
9de8d990 | 104 | // Determines sector containing the given pad. |
105 | // Arguments: padx,pady - pad number | |
106 | // Returns: sector number | |
107 | // y ^ 5 6 sectors map as seen from outside (IP is behind the page) | |
108 | // | 3 4 | |
109 | // | 1 2 | |
db910db9 | 110 | // -------> x |
9de8d990 | 111 | Int_t sector=-1; |
112 | if (padx >= kFirstPad && padx <= kPadsSecX ) sector=1; | |
113 | else if(padx > kPadsSecX && padx <= kPadsChamX) sector=2; | |
114 | else return -1;//padx out of range | |
115 | if (pady >= kFirstPad && pady <= kPadsSecY ) return sector; | |
116 | else if(pady > kPadsSecY && pady <= 2*kPadsSecY ) return sector+2; | |
117 | else if(pady >2*kPadsSecY && pady <= kPadsChamY) return sector+4; | |
118 | else return -1; //pady out of range | |
db910db9 | 119 | }//Pad2Sec() |
9de8d990 | 120 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
0fe8fa07 | 121 | #endif |