X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HMPID%2FAliHMPIDDigit.h;h=0efc0f88909e00a5c1c3b19685579ae0758cb353;hb=d4916cbf876d7ea0ae19e7f7ea879d1fe2b98a3b;hp=514d345c8f63f155313a183a71018846576059d8;hpb=da08475ba84bafb79f44acfd5d000f246d6fce0e;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDDigit.h b/HMPID/AliHMPIDDigit.h index 514d345c8f6..0efc0f88909 100644 --- a/HMPID/AliHMPIDDigit.h +++ b/HMPID/AliHMPIDDigit.h @@ -8,77 +8,73 @@ #include //IsOverTh() #include //Raw() -class AliHMPIDHit; //Hit2Sdi() + class TClonesArray; //Hit2Sdi() - + class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit { public: - enum EAbsPad {kChAbs=100000000,kPcAbs=1000000,kPadAbsX=1000,kPadAbsY=1}; //absolute pad number structure - enum ERawData{kNddls=14}; //RAW data structure - enum EPadData{kPcX=2,kPcY=3,kPadPcX=80,kPadPcY=48,kPadAllX=kPadPcX*kPcX,kPadAllY=kPadPcY*kPcY,kPcAll=kPcX*kPcY,kPadAll=kPadAllX*kPadAllY}; //Segmentation structure + enum EChamberData{kMinCh=0,kMaxCh=6,kMinPc=0,kMaxPc=5}; //Segmenation + enum EPadxData{kPadPcX=80,kMinPx=0,kMaxPx=79,kMaxPcx=159}; //Segmentation structure along x + enum EPadyData{kPadPcY=48,kMinPy=0,kMaxPy=47,kMaxPcy=143}; //Segmentation structure along y //ctor&dtor - AliHMPIDDigit( ):AliDigit( ),fPad(Abs(-1,-1,-1,-1)),fQ(-1) {} //default ctor - AliHMPIDDigit(Int_t pad,Int_t q,Int_t *t ):AliDigit(t),fPad(pad ),fQ(q ) {} //digit ctor - inline AliHMPIDDigit(Int_t c,Float_t q,Int_t t,Float_t x,Float_t y,Int_t f=0); //sdigit ctor - virtual ~AliHMPIDDigit() {} //dtor + AliHMPIDDigit( ):AliDigit( ),fPad(Abs(-1,-1,-1,-1)),fQ(-1) {} //default ctor + AliHMPIDDigit(Int_t pad,Int_t q,Int_t *t):AliDigit(t),fPad(pad ),fQ(q ) {} //digit ctor + AliHMPIDDigit(const AliHMPIDDigit &d ):AliDigit(d),fPad(d.fPad),fQ(d.fQ) {} //copy ctor + virtual ~AliHMPIDDigit() {} //dtor //framework part Bool_t IsSortable ( )const{return kTRUE;} //provision to use TObject::Sort() inline Int_t Compare (const TObject *pObj )const; //provision to use TObject::Sort() + void Draw (Option_t *opt="" ); //TObject::Draw() overloaded void Print (Option_t *opt="" )const; //TObject::Print() overloaded //private part - static Int_t Abs (Int_t c,Int_t s,Int_t x,Int_t y) {return c*kChAbs+s*kPcAbs+x*kPadAbsX+y*kPadAbsY; } //(ch,pc,padx,pady)-> abs pad - static Int_t A2C (Int_t pad ) {return pad/kChAbs; } //abs pad -> chamber - static Int_t A2P (Int_t pad ) {return pad%kChAbs/kPcAbs; } //abs pad -> pc - static Int_t A2X (Int_t pad ) {return pad%kPcAbs/kPadAbsX; } //abs pad -> pad X - static Int_t A2Y (Int_t pad ) {return pad%kPadAbsX; } //abs pad -> pad Y - Int_t Addr ( )const{Int_t map[6]={5,3,1,0,2,4};return map[A2Y(fPad)%6]+6*(A2X(fPad)%8);}//ADDRESS 0..47 - void AddTidOffset(Int_t offset ) {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;}; //needed for merging - Int_t Ch ( )const{return A2C(fPad); } //chamber number - Int_t Dilogic ( )const{return 1+PadPcX()/8; } //DILOGIC# 1..10 - static void DrawPc (Bool_t isFill=kTRUE ); //draw PCs - static void DrawSeg ( ); //draw segmentation - void DrawZoom ( ); - Int_t DdlIdx ( )const{return 2*Ch()+Pc()%2; } //DDL# 0..13 - Int_t DdlId ( )const{return (6<<8)+DdlIdx(); } //DDL ID 0x600..0x60d - static Float_t Hit2Sdi (AliHMPIDHit *pHit,TClonesArray*); //hit -> 9 sdigits, returns total QDC - static Bool_t IsOverTh (Float_t q ) {return q > 6; } //is digit over threshold???? - static Bool_t IsInside (Float_t x,Float_t y ) {return x>0&&y>0&&x abs pad + static Int_t A2C (Int_t pad ) {return pad/100000000; } //abs pad -> chamber + static Int_t A2P (Int_t pad ) {return pad%100000000/1000000; } //abs pad -> pc + static Int_t A2X (Int_t pad ) {return pad%1000000/1000; } //abs pad -> pad X + static Int_t A2Y (Int_t pad ) {return pad%1000; } //abs pad -> pad Y + void AddTidOffset(Int_t offset ) {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset; } //needed for merging + Int_t Ch ( )const{return A2C(fPad); } //chamber number + static Bool_t IsOverTh (Float_t q ) {return q >= 4; } //is digit over threshold???? + static Bool_t IsInside (Float_t x,Float_t y ) {return x>0&&y>0&&x(ddl,raw32) - inline void Raw (Int_t l,UInt_t raw32 ); //(ddl,raw32)->digit - static Int_t Raw2Ch (UInt_t l ) {return l/2;} //ch=f(ddl) - static Int_t Raw2Pc (UInt_t l,UInt_t r ) {r=(r-1)/8;return (l%2)?5-2*r:2*r;} //pc=f(ddl,r) - static Int_t Raw2X ( UInt_t d,UInt_t a ) { return (d-1)*8+a/6;} //padx=f(d,a) - static Int_t Raw2Y (UInt_t l,UInt_t r,UInt_t a ) {Int_t a2y[6]={3,2,4,1,5,0};r=(l%2)?(24-r):r-1;return 6*(r%8)+a2y[a%6];}//pady=f(ddl,r,a) - Int_t Row ( )const{Int_t r=1+Pc()/2*8+PadPcY()/6; return (Pc()%2)? 25-r:r;} //row r=1..24 - void Set (Int_t c,Int_t s,Int_t x,Int_t y) {fPad=Abs(c,s,x,y);fQ=0xa3;} //set new digit + 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) + inline void Raw (UInt_t w32,Int_t ddl ); //(w32,ddl)->digit + inline Bool_t Set (Int_t c,Int_t p,Int_t x,Int_t y,Float_t q=0,Int_t tid=0); //manual creation + static void WriteRaw (TObjArray *pDigLst ); //write as raw stream - static Float_t SizeAllX ( ) {return SizePadX()*kPadAllX+SizeDead();} //all PCs size x, [cm] - static Float_t SizeAllY ( ) {return SizePadY()*kPadAllY+2*SizeDead();} //all PCs size y, [cm] - static Float_t SizeArea ( ) {return SizePcX()*SizePcY()*kPcAll;} //sence area, [cm^2] + static Float_t SizeAllX ( ) {return fMaxPcX[5];} //all PCs size x, [cm] + static Float_t SizeAllY ( ) {return fMaxPcY[5];} //all PCs size y, [cm] + static Float_t SizeArea ( ) {return SizePcX()*SizePcY()*(kMaxPc-kMinPc+1);} //sence area, [cm^2] static Float_t SizeDead ( ) {return 2.6;} //dead zone size x, [cm] static Float_t SizeGap ( ) {return 8; } static Float_t SizePadX ( ) {return 0.8;} //pad size x, [cm] static Float_t SizePadY ( ) {return 0.84;} //pad size y, [cm] - static Float_t SizePcX ( ) {return SizePadX()*kPadPcX;} //PC size x, [cm] - static Float_t SizePcY ( ) {return SizePadY()*kPadPcY;} //PC size y, [cm] + static Float_t SizePcX ( ) {return fMaxPcX[0];} //PC size x, [cm] + static Float_t SizePcY ( ) {return fMaxPcY[0];} //PC size y, [cm] static Float_t SizeWin ( ) {return 0.5;} //Quartz window width static Float_t SizeRad ( ) {return 1.5;} //Rad width - static void Test ( ); //Test conversions + static const Float_t fMinPcX[6]; + static const Float_t fMinPcY[6]; + static const Float_t fMaxPcX[6]; + static const Float_t fMaxPcY[6]; + + inline static Bool_t IsInDead(Float_t x,Float_t y ); //is point in dead area? + inline static void Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py); //(x,y)->(pc,px,py) + protected: //AliDigit has fTracks[3] - Int_t fPad; //absolute pad number is chamber*kCham + Int_t fPad; //absolute pad number Float_t fQ; //QDC value, fractions are permitted for summable procedure ClassDef(AliHMPIDDigit,4) //HMPID digit class };//class AliHMPIDDigitN @@ -86,37 +82,20 @@ protected: //AliDigit has fTracks[3] typedef AliHMPIDDigit AliRICHDigit; // for backward compatibility //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -AliHMPIDDigit::AliHMPIDDigit(Int_t c,Float_t q,Int_t t,Float_t x,Float_t y,Int_t flag):AliDigit(),fPad(Abs(-1,-1,-1,-1)),fQ(-1) +void AliHMPIDDigit::Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py) { -// Creation of sdigit -// Arguments: c- chamber -// q- total QDC -// t -TID -// x,y - hit position, LORS -// flag- which pad to try -// Returns: none - Int_t pc,padx,pady; - if (x>= 0 && x<= SizePcX() ) {pc=0; padx=Int_t( x / SizePadX());}//PC 0 or 2 or 4 - else if(x>=SizePcX()+SizeDead() && x<= SizeAllX() ) {pc=1; padx=Int_t((x- SizePcX()- SizeDead()) / SizePadX());}//PC 2 or 4 or 6 +// Check the pad of given position +// Arguments: x,y- position [cm] in LORS; pc,px,py- pad where to store the result +// Returns: none + pc=px=py=-1; + if (x>= 0 && x<= SizePcX() ) {pc=0; px=Int_t( x / SizePadX());}//PC 0 or 2 or 4 + else if(x>=SizePcX()+SizeDead() && x<= SizeAllX() ) {pc=1; px=Int_t((x- SizePcX()- SizeDead()) / SizePadX());}//PC 2 or 4 or 6 else return; - if (y>= 0 && y<= SizePcY() ) { pady=Int_t( y / SizePadY());}//PC 0 or 1 - else if(y>=SizePcY()+SizeDead() && y<=2*SizePcY()+SizeDead() ) {pc+=2;pady=Int_t((y- SizePcY()- SizeDead()) / SizePadY());}//PC 2 or 3 - else if(y>=SizeAllY()-SizePcY() && y<= SizeAllY() ) {pc+=4;pady=Int_t((y-2*SizePcY()-2*SizeDead()) / SizePadY());}//PC 4 or 5 + if (y>= 0 && y<= SizePcY() ) { py=Int_t( y / SizePadY());}//PC 0 or 1 + else if(y>=SizePcY()+SizeDead() && y<=2*SizePcY()+SizeDead() ) {pc+=2;py=Int_t((y- SizePcY()- SizeDead()) / SizePadY());}//PC 2 or 3 + else if(y>=SizeAllY()-SizePcY() && y<= SizeAllY() ) {pc+=4;py=Int_t((y-2*SizePcY()-2*SizeDead()) / SizePadY());}//PC 4 or 5 else return; - - switch(flag){ - case 8:padx--;pady++;break; case 1:pady++;break; case 2:padx++; pady++;break; - - case 7: padx--; break; case 0: break; case 3:padx++; break; - - case 6:padx--;pady--;break; case 5:pady--;break; case 4:padx++; pady--;break; - } - if(padx<0 || padx>=kPadPcX) return; - if(pady<0 || pady>=kPadPcY) return; - fPad=Abs(c,pc,padx,pady); - fQ=q*Mathieson(x,y); - fTracks[0]=t; -} +} //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Int_t AliHMPIDDigit::Compare(const TObject *pObj) const { @@ -157,30 +136,52 @@ Float_t AliHMPIDDigit::Mathieson(Float_t x,Float_t y)const return 4*k4*(TMath::ATan(ux2)-TMath::ATan(ux1))*k4*(TMath::ATan(uy2)-TMath::ATan(uy1)); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -Int_t AliHMPIDDigit::Raw(UInt_t &w32)const +void AliHMPIDDigit::Raw(UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a)const { // Convert digit structure to raw word format -// Arguments: 32 bits raw word to fill -// Returns: DDL ID where to write this digit - w32=0; - AliBitPacking::PackWord((UInt_t)fQ ,w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) - AliBitPacking::PackWord( Addr() ,w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) - AliBitPacking::PackWord( Dilogic(),w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) - AliBitPacking::PackWord( Row() ,w32,22,26); // Row number bits (22..26) counts (1..24) - return DdlIdx(); //ddl 0..13 where to write this digit +// Arguments: w32,ddl,r,d,a where to write the results +// Returns: none + Int_t y2a[6]={5,3,1,0,2,4}; + + ddl=2*Ch()+Pc()%2; //DDL# 0..13 + Int_t tmp=1+Pc()/2*8+PadPcY()/6; r=(Pc()%2)? 25-tmp:tmp; //row r=1..24 + d=1+PadPcX()/8; //DILOGIC# 1..10 + a=y2a[PadPcY()%6]+6*(PadPcX()%8); //ADDRESS 0..47 + + w32=0; + AliBitPacking::PackWord((UInt_t)fQ,w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) + AliBitPacking::PackWord( a ,w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) + AliBitPacking::PackWord( d ,w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) + AliBitPacking::PackWord( r ,w32,22,26); // Row number bits (22..26) counts (1..24) } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void AliHMPIDDigit::Raw(Int_t ddl,UInt_t w32) +void AliHMPIDDigit::Raw(UInt_t w32,Int_t ddl) { // Converts a given raw data word to a digit // Arguments: w32 - 32 bits raw data word // ddl - DDL idx 0 1 2 3 4 ... 13 // Returns: none - fQ = AliBitPacking::UnpackWord(w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) - UInt_t a = AliBitPacking::UnpackWord(w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47) - UInt_t d = AliBitPacking::UnpackWord(w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10) - UInt_t r = AliBitPacking::UnpackWord(w32,22,26); // Row number bits (22..26) counts (1..24) - fPad=Abs(Raw2Ch(ddl),Raw2Pc(ddl,r),Raw2X(d,a),Raw2Y(ddl,r,a)); + Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip) + Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24); // Row number (1..24) + 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) + 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) + Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc (0..4095) + Int_t ch=ddl/2; + Int_t tmp=(r-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; + Int_t px=(d-1)*8+a/6; + tmp=(ddl%2)?(24-r):r-1; Int_t py=6*(tmp%8)+a2y[a%6]; + fPad=Abs(ch,pc,px,py);fQ=q; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Bool_t AliHMPIDDigit::Set(Int_t ch,Int_t pc,Int_t px,Int_t py,Float_t qdc,Int_t tid) +{ +// Manual creation of digit +// Arguments: ch,pc,px,py,qdc,tid +// Returns: none + if(pxkMaxPx) return kTRUE; + if(pykMaxPy) return kTRUE; + + fPad=Abs(ch,pc,px,py);fQ=qdc;fTracks[0]=tid; + return kFALSE; +} #endif