]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDDigit.cxx
Coding Conventions (mail Fed Carm. Date: Fri, 30 Mar 2007 )
[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
1d4857c5 16#include "AliHMPIDDigit.h" //class header
17#include <TClonesArray.h> //WriteRaw()
18#include <TBox.h> //Draw()
8c1bbb8a 19#include <TPolyLine.h> //Draw()
1d4857c5 20#include <AliRawDataHeader.h> //WriteRaw()
21#include <AliDAQ.h> //WriteRaw()
ea925242 22#include "Riostream.h" //WriteRaw()
d3da6dc4 23ClassImp(AliHMPIDDigit)
24
ea925242 25const Float_t AliHMPIDDigit::fgkMinPcX[]={ 0.00 , 66.60 , 0.00 , 66.60 , 0.00 , 66.60};
26const Float_t AliHMPIDDigit::fgkMaxPcX[]={64.00 , 130.60 , 64.00 , 130.60 , 64.00 , 130.60};
d1bf51e1 27
ea925242 28const Float_t AliHMPIDDigit::fgkMinPcY[]={ 0.00 , 0.00 , 42.92 , 42.92, 85.84, 85.84};
29const Float_t AliHMPIDDigit::fgkMaxPcY[]={40.32 , 40.32, 83.24 , 83.24, 126.16, 126.16};
afdc131c 30
ea925242 31const Float_t AliHMPIDDigit::fgk1 =0.28278796;
32const Float_t AliHMPIDDigit::fgk2 =0.96242952;
33const Float_t AliHMPIDDigit::fgkSqrtK3 =0.77459667;
34const Float_t AliHMPIDDigit::fgk4 =0.37932926;
c5c19d6a 35
ea925242 36Int_t AliHMPIDDigit::fgSigmas=4;
d1bf51e1 37
38
d3da6dc4 39/*
b8588e09 40 Preface: all geometrical information (like left-right sides) is reported as seen from electronic side.
41
42 d10 d1 d10 d1
43 _______________ _______________
44r24 | | | |126.16 r1
45 | 4 | | 5 |
46 | | | |
47 |_______________| |_______________|85.84
48 _______________ _______________
49 | | | |83.24
50 | 2 | | 3 |
51 | | | |
52 |_______________| |_______________|42.92
53 _______________ _______________
54 | | | |40.32
55 | 0 | | 1 |
56 | | | |
57r1 |_______________| |_______________|0 r24
58 0 64.0 66.6 130.6
1d4857c5 59
d3da6dc4 60
da08475b 61
62The DDL file starts with common header which size and structure is standartized and mandatory for all detectors.
d3da6dc4 63The 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.
64For HMPID the detector ID is 6 (reffered in the code as kRichRawId) while DDL indexes are from 0 to 13.
65
66Common header might be followed by the private one although HMPID has no any private header, just uses the common one.
67
da08475b 68Single HMPID D-RORC (with 2 channels) serves a single chamber so that channel 0 serves left half (PCs 0-2-4)
69 1 serves right half(PCs 1-3-5)
d3da6dc4 70
71So the LDC -chamber-ddl map is:
da08475b 72DDL index 0 -> ch 0 left -> DDL ID 0x600 DDL index 1 -> ch 1 right -> DDL ID 0x601
73DDL index 2 -> ch 1 left -> DDL ID 0x602 DDL index 3 -> ch 2 right -> DDL ID 0x603
74DDL index 4 -> ch 2 left -> DDL ID 0x604 DDL index 5 -> ch 3 right -> DDL ID 0x605
75DDL index 6 -> ch 3 left -> DDL ID 0x606 DDL index 7 -> ch 4 right -> DDL ID 0x607
76DDL index 8 -> ch 4 left -> DDL ID 0x608 DDL index 9 -> ch 5 right -> DDL ID 0x609
77DDL index 10 -> ch 5 left -> DDL ID 0x60a DDL index 11 -> ch 6 right -> DDL ID 0x60b
78DDL index 12 -> ch 6 left -> DDL ID 0x60c DDL index 13 -> ch 7 right -> DDL ID 0x60d
d3da6dc4 79
80HMPID FEE as seen by single D-RORC is composed from a number of DILOGIC chips organized in vertical stack of rows.
da08475b 81Each DILOGIC chip serves 48 channels for the 8x6 pads Channels counted from 0 to 47.
d3da6dc4 82
83The mapping inside DILOGIC chip has the following structure (see from electronics side):
da08475b 84pady
d3da6dc4 85
da08475b 865 04 10 16 22 28 34 40 46 due to repetition in column structure we may introduce per column map:
874 02 08 14 20 26 32 38 44 pady= 0 1 2 3 4 5
883 00 06 12 18 24 30 36 42 addr= 5 3 1 0 2 4
892 01 07 13 19 25 31 37 43 or vice versa
901 03 09 15 21 27 33 39 45 addr= 0 1 2 3 4 5
910 05 11 17 23 29 35 41 47 pady= 3 2 4 1 5 0
d3da6dc4 92
93 0 1 2 3 4 5 6 7 padx
94
9510 DILOGIC chips composes so called "row" in horizontal direction (reffered in the code as kNdil), so the row is 80x6 pads structure.
96DILOGIC chips in the row are counted from right to left as seen from electronics side, from 1 to 10.
9724 rows are piled up forming the whole FEE served by single D-RORC, so one DDL sees 80x144 pads separated in 3 photocathodes.
98Rows 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
99 and from bottom to top for left half of the chamber (PCs 0-2-4) as seen from electronics side, meaning odd LDC number.
100
101HMPID raw word is 32 bits with the structure:
102 00000 rrrrr dddd aaaaaa qqqqqqqqqqqq
103 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)
104*/
105//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
d1bf51e1 106void AliHMPIDDigit::Draw(Option_t*)
107{
e4a3eae8 108// TMarker *pMark=new TMarker(LorsX(),LorsY(),25); pMark->SetMarkerColor(kGreen);pMark->Draw();
109 TBox *pad = new TBox(LorsX()-0.5*SizePadX(),LorsY()-0.5*SizePadY(),LorsX()+0.5*SizePadX(),LorsY()+0.5*SizePadY());
8c1bbb8a 110 TPolyLine *line=new TPolyLine(5);
111 line->SetPoint(0,LorsX()-0.5*SizePadX(),LorsY()-0.5*SizePadY());
112 line->SetPoint(1,LorsX()-0.5*SizePadX(),LorsY()+0.5*SizePadY());
113 line->SetPoint(2,LorsX()+0.5*SizePadX(),LorsY()+0.5*SizePadY());
114 line->SetPoint(3,LorsX()+0.5*SizePadX(),LorsY()-0.5*SizePadY());
115 line->SetPoint(4,LorsX()-0.5*SizePadX(),LorsY()-0.5*SizePadY());
b8588e09 116 Int_t slice=(Int_t)fQ/20;
117 switch(slice){
118 case 0: pad->SetFillColor(kBlue); break;
119 case 1: pad->SetFillColor(kBlue+4); break;
120 case 2: pad->SetFillColor(kCyan); break;
121 case 3: pad->SetFillColor(kCyan+4); break;
122 case 4: pad->SetFillColor(kGreen); break;
123 case 5: pad->SetFillColor(kGreen+4); break;
124 case 6: pad->SetFillColor(kYellow); break;
125 case 7: pad->SetFillColor(kYellow+4); break;
126 default: pad->SetFillColor(kRed); break;
127 }
128 pad->SetUniqueID((Int_t)fQ);
8c1bbb8a 129 pad->Draw();line->Draw();
d1bf51e1 130}
131//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1d4857c5 132void AliHMPIDDigit::Print(Option_t *opt)const
d3da6dc4 133{
134// Print current digit
135// Arguments: option string not used
136// Returns: none
1d4857c5 137 UInt_t w32; Int_t ddl,r,d,a;
138 Raw(w32,ddl,r,d,a);
139 Printf("%sDIG:(ch=%1i,pc=%1i,x=%2i,y=%2i) (%7.3f,%7.3f) Q=%8.3f TID=(%5i,%5i,%5i) raw=0x%x (ddl=%2i,r=%2i,d=%2i,a=%2i) %s",
140 opt, A2C(fPad),A2P(fPad),A2X(fPad),A2Y(fPad),LorsX(),LorsY(), Q(), fTracks[0],fTracks[1],fTracks[2],w32,ddl,r,d,a, (IsOverTh(Q()))?"":"below thr");
d3da6dc4 141}
142//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1d4857c5 143void AliHMPIDDigit::WriteRaw(TObjArray *pDigAll)
da08475b 144{
1d4857c5 145// Write a list of digits for a given chamber in raw data stream
146// Arguments: pDigAll- list of digits
147// Returns: none
1d4857c5 148 for(Int_t iCh=kMinCh;iCh<=kMaxCh;iCh++){//chambers loop
231e66cd 149 ofstream ddlL,ddlR; //output streams, 2 per chamber
150 Int_t cntL=0,cntR=0; //data words counters for DDLs
151 AliRawDataHeader header; header.SetAttribute(0); //empty DDL header
152
1d4857c5 153 ddlL.open(AliDAQ::DdlFileName("HMPID",2*iCh));
154 ddlR.open(AliDAQ::DdlFileName("HMPID",2*iCh+1)); //open both DDL of this chamber in parallel
155 ddlL.write((char*)&header,sizeof(header)); //write dummy header as place holder, actual
156 ddlR.write((char*)&header,sizeof(header)); //will be rewritten later when total size of DDL is known
157
231e66cd 158 UInt_t w32=0; //32 bits data word
1d4857c5 159 TClonesArray *pDigCh=(TClonesArray *)pDigAll->At(iCh); //list of digits for current chamber
160 for(Int_t iDig=0;iDig<pDigCh->GetEntriesFast();iDig++){//digits loop
161 AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCh->At(iDig);
b512598c 162 if(pDig->Q() < 1) continue;
231e66cd 163 Int_t ddl,r,d,a; //32 bits data word
1d4857c5 164 pDig->Raw(w32,ddl,r,d,a);
165 if(ddl%2){
166 ddlL.write((char*)&w32,sizeof(w32)); cntL++;
167 }else{
168 ddlR.write((char*)&w32,sizeof(w32)); cntR++;
169 }
170 }//digits loop
171
172 header.fSize=sizeof(header)+cntL*sizeof(w32); ddlL.seekp(0); ddlL.write((char*)&header,sizeof(header)); ddlL.close(); //rewrite header with size set to
173 header.fSize=sizeof(header)+cntR*sizeof(w32); ddlR.seekp(0); ddlR.write((char*)&header,sizeof(header)); ddlR.close(); //number of bytes and close file
174 }//chambers loop
175}//WriteRaw()
da08475b 176//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++