Cluster finding improved.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDDigit.cxx
CommitLineData
d3da6dc4 1// **************************************************************************
2// * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3// * *
4// * Author: The ALICE Off-line Project. *
5// * Contributors are mentioned in the code where appropriate. *
6// * *
7// * Permission to use, copy, modify and distribute this software and its *
8// * documentation strictly for non-commercial purposes is hereby granted *
9// * without fee, provided that the above copyright notice appears in all *
10// * copies and that both the copyright notice and this permission notice *
11// * appear in the supporting documentation. The authors make no claims *
12// * about the suitability of this software for any purpose. It is *
13// * provided "as is" without express or implied warranty. *
14// **************************************************************************
15
16#include "AliHMPIDDigit.h" //class header
d1bf51e1 17#include <TClonesArray.h> //Hit2Sdi()
18#include <TMarker.h> //Draw()
d3da6dc4 19ClassImp(AliHMPIDDigit)
20
d1bf51e1 21const Float_t AliHMPIDDigit::fMinPcX[]={0,SizePcX() + SizeDead(),0,SizePcX() + SizeDead(), 0,SizePcX() + SizeDead()};
22const Float_t AliHMPIDDigit::fMinPcY[]={0, 0,SizePcY()+SizeDead(),SizePcY() + SizeDead(),2*(SizePcY()+SizeDead()),2*(SizePcY()+SizeDead())};
23
24const Float_t AliHMPIDDigit::fMaxPcX[]={SizePcX(),SizeAllX(),SizePcX(),SizeAllX(),SizePcX(),SizeAllX()};
25const Float_t AliHMPIDDigit::fMaxPcY[]={SizePcY(),SizePcY(),SizeAllY() - SizePcY(),SizeAllY() - SizePcY(),SizeAllY(),SizeAllY()};
26
27
d3da6dc4 28/*
da08475b 29Preface: all geometrical information (like left-right sides) is reported as seen from electronic side.
d3da6dc4 30
da08475b 31
32The DDL file starts with common header which size and structure is standartized and mandatory for all detectors.
d3da6dc4 33The header contains among other words, so called Equipment ID word. This unique value for each D-RORC is calculated as detector ID << 8 + DDL index.
34For HMPID the detector ID is 6 (reffered in the code as kRichRawId) while DDL indexes are from 0 to 13.
35
36Common header might be followed by the private one although HMPID has no any private header, just uses the common one.
37
da08475b 38Single HMPID D-RORC (with 2 channels) serves a single chamber so that channel 0 serves left half (PCs 0-2-4)
39 1 serves right half(PCs 1-3-5)
d3da6dc4 40
41So the LDC -chamber-ddl map is:
da08475b 42DDL index 0 -> ch 0 left -> DDL ID 0x600 DDL index 1 -> ch 1 right -> DDL ID 0x601
43DDL index 2 -> ch 1 left -> DDL ID 0x602 DDL index 3 -> ch 2 right -> DDL ID 0x603
44DDL index 4 -> ch 2 left -> DDL ID 0x604 DDL index 5 -> ch 3 right -> DDL ID 0x605
45DDL index 6 -> ch 3 left -> DDL ID 0x606 DDL index 7 -> ch 4 right -> DDL ID 0x607
46DDL index 8 -> ch 4 left -> DDL ID 0x608 DDL index 9 -> ch 5 right -> DDL ID 0x609
47DDL index 10 -> ch 5 left -> DDL ID 0x60a DDL index 11 -> ch 6 right -> DDL ID 0x60b
48DDL index 12 -> ch 6 left -> DDL ID 0x60c DDL index 13 -> ch 7 right -> DDL ID 0x60d
d3da6dc4 49
50HMPID FEE as seen by single D-RORC is composed from a number of DILOGIC chips organized in vertical stack of rows.
da08475b 51Each DILOGIC chip serves 48 channels for the 8x6 pads Channels counted from 0 to 47.
d3da6dc4 52
53The mapping inside DILOGIC chip has the following structure (see from electronics side):
da08475b 54pady
d3da6dc4 55
da08475b 565 04 10 16 22 28 34 40 46 due to repetition in column structure we may introduce per column map:
574 02 08 14 20 26 32 38 44 pady= 0 1 2 3 4 5
583 00 06 12 18 24 30 36 42 addr= 5 3 1 0 2 4
592 01 07 13 19 25 31 37 43 or vice versa
601 03 09 15 21 27 33 39 45 addr= 0 1 2 3 4 5
610 05 11 17 23 29 35 41 47 pady= 3 2 4 1 5 0
d3da6dc4 62
63 0 1 2 3 4 5 6 7 padx
64
6510 DILOGIC chips composes so called "row" in horizontal direction (reffered in the code as kNdil), so the row is 80x6 pads structure.
66DILOGIC chips in the row are counted from right to left as seen from electronics side, from 1 to 10.
6724 rows are piled up forming the whole FEE served by single D-RORC, so one DDL sees 80x144 pads separated in 3 photocathodes.
68Rows are counted from 1 to 24 from top to bottom for right half of the chamber (PCs 1-3-5) as seen from electronics side, meaning even LDC number
69 and from bottom to top for left half of the chamber (PCs 0-2-4) as seen from electronics side, meaning odd LDC number.
70
71HMPID raw word is 32 bits with the structure:
72 00000 rrrrr dddd aaaaaa qqqqqqqqqqqq
73 5 bits zero 5 bits row number (1..24) 4 bits DILOGIC chip number (1..10) 6 bits DILOGIC address (0..47) 12 bits QDC value (0..4095)
74*/
75//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
d1bf51e1 76void AliHMPIDDigit::Draw(Option_t*)
77{
78 TMarker *pMark=new TMarker(LorsX(),LorsY(),25); pMark->SetMarkerColor(kGreen); pMark->Draw();
79}
80//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3c6274c1 81void AliHMPIDDigit::Hit2Sdi(AliHMPIDHit *pHit,TClonesArray *pSdiLst)
d3da6dc4 82{
83// Creates a list of sdigits out of provided hit
84// Arguments: pHit- hit
85// Returns: none
86
3c6274c1 87 Int_t iSdiCnt=pSdiLst->GetEntries(); //list of sdigits contains sdigits from previous ivocations of Hit2Sdi, do not override them
88 AliHMPIDDigit dig;
d3da6dc4 89 for(Int_t i=0;i<9;i++){ //affected pads loop
3c6274c1 90 dig.Set(pHit,i); //c,q,tid,x,y create tmp sdigit for pad i around hit position
da08475b 91 if(dig.PadPcX()==-1) continue;
d3da6dc4 92 new((*pSdiLst)[iSdiCnt++]) AliHMPIDDigit(dig);
93 }
d3da6dc4 94}//Hit2Sdi()
95//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96void AliHMPIDDigit::Print(Option_t*)const
97{
98// Print current digit
99// Arguments: option string not used
100// Returns: none
da08475b 101 UInt_t w32; Raw(w32);
d1bf51e1 102 Printf("DIG:(%7.3f,%7.3f) Q=%8.3f (ch=%1i,pc=%1i,x=%2i,y=%2i) TID=(%5i,%5i,%5i) ddl=%i raw=0x%x (r=%2i,d=%2i,a=%2i) %s",
103 LorsX(),LorsY(),Q(), A2C(fPad),A2P(fPad),A2X(fPad),A2Y(fPad),
104 fTracks[0],fTracks[1],fTracks[2],DdlIdx(),w32,Row(),Dilogic(),Addr(),
105 (IsOverTh(Q()))?"":"!!!");
d3da6dc4 106}
107//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
108void AliHMPIDDigit::PrintSize()
109{
110// Print all segmentaion related sizes
111// Arguments: none
112// Returns: none
113 Printf("-->pad =(%6.2f,%6.2f) cm dead zone %.2f cm\n"
da08475b 114 "-->PC =(%6.2f,%6.2f) cm (%3i,%3i) pads\n"
115 "-->all PCs=(%6.2f,%6.2f) cm (%3i,%3i) pads",
116 SizePadX(),SizePadY(),SizeDead(),
117 SizePcX() ,SizePcY() ,kPadPcX ,kPadPcY,
118 SizeAllX(),SizeAllY(),kPadAllX,kPadAllY);
d3da6dc4 119}
120//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
da08475b 121void AliHMPIDDigit::Test()
122{
123 AliHMPIDDigit d1,d2; Int_t ddl;UInt_t w32;
124 for(Int_t i=0;i<10000;i++){
125 Int_t ch=Int_t(gRandom->Rndm()*7);
126 Int_t pc=Int_t(gRandom->Rndm()*6);
127 Int_t px=Int_t(gRandom->Rndm()*80);
128 Int_t py=Int_t(gRandom->Rndm()*48);
3c6274c1 129 d1.Manual2(ch,pc,px,py);
da08475b 130 ddl=d1.Raw(w32); d2.Raw(ddl,w32);
131 if(d1.Compare(&d2)) Printf("Problem!!!");
132 }
133 Printf("OK");
134}//Test()
135//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
136