]>
Commit | Line | Data |
---|---|---|
38300302 | 1 | //////////////////////////////////////////////////// |
2 | // Class to define // | |
3 | // SDD beam test raw 2 dig conv. // | |
4 | // Origin: E. Crescio crescio@to.infn.it // | |
5 | // // | |
6 | // // | |
7 | //////////////////////////////////////////////////// | |
5ba31760 | 8 | #include "AliITS.h" |
38300302 | 9 | #include "AliITSdigitSDD.h" |
10 | #include "AliRawReaderDate.h" | |
5ba31760 | 11 | #include "AliVMERawStream.h" |
38300302 | 12 | #include "AliITSRawStreamSDDv2.h" |
13 | #include "AliITSRawStreamSDDv3.h" | |
14 | #include "AliITSRawStreamSDD.h" | |
15 | #include "AliITSBeamTestDigSDD.h" | |
5ba31760 | 16 | #include "AliITSEventHeader.h" |
17 | #include "AliITSgeom.h" | |
18 | #include <TBranch.h> | |
19 | #include <TTree.h> | |
38300302 | 20 | |
21 | ClassImp(AliITSBeamTestDigSDD) | |
22 | ||
23 | //_____________________________________________________________ | |
24 | AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(): AliITSBeamTestDig() | |
25 | { | |
26 | // | |
27 | // Constructor | |
28 | // | |
29 | SetBtPeriod(); | |
30 | fSubEventAttributes=0; | |
31 | fThreshold=0; | |
32 | fStreamer=0; | |
33 | } | |
34 | ||
35 | //_____________________________________________________________ | |
36 | AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const Text_t* name, const Text_t* title): AliITSBeamTestDig(name,title) | |
37 | { | |
38 | // | |
39 | // Constructor | |
40 | // | |
41 | SetBtPeriod(); | |
42 | fSubEventAttributes=0; | |
43 | fThreshold=0; | |
44 | fStreamer=0; | |
45 | } | |
46 | ||
47 | //__________________________________________________________________ | |
48 | AliITSBeamTestDigSDD::~AliITSBeamTestDigSDD() | |
49 | { | |
50 | // | |
51 | // Destructor | |
52 | // | |
53 | if(fSubEventAttributes) delete fSubEventAttributes; | |
54 | if(fStreamer) delete fStreamer; | |
55 | } | |
56 | ||
57 | ||
58 | //_______________________________________________________________________ | |
59 | void AliITSBeamTestDigSDD::Exec(Option_t* /*opt*/) | |
60 | { | |
61 | ||
62 | // Reads raw data and fills the tree of digits | |
63 | ||
5ba31760 | 64 | TBranch* branch = fTreeD->GetBranch("ITSDigitsSDD"); |
65 | Int_t maxn=0; | |
66 | AliITSgeom* geom = fBt->GetITSgeom(); | |
67 | Int_t nsdd=0; | |
68 | Int_t nspd=0; | |
69 | Int_t nssd=0; | |
70 | for(Int_t nlay=1;nlay<=geom->GetNlayers();nlay++){ | |
71 | for(Int_t nlad=1;nlad<=geom->GetNladders(nlay);nlad++){ | |
72 | for(Int_t ndet=1;ndet<=geom->GetNdetectors(nlay);ndet++){ | |
73 | Int_t index=geom->GetModuleIndex(nlay,nlad,ndet); | |
74 | if(geom->GetModuleTypeName(index)=="kSPD") nspd++; | |
75 | if(geom->GetModuleTypeName(index)=="kSDD") nsdd++; | |
76 | if(geom->GetModuleTypeName(index)=="kSSD") nssd++; | |
77 | } | |
78 | } | |
79 | } | |
80 | if(GetBtPeriod()==kAug04) maxn=nsdd; | |
81 | if(GetBtPeriod()==kNov04) maxn=nspd+nsdd+nssd; | |
82 | TClonesArray** digits = new TClonesArray*[maxn]; | |
83 | Int_t* idig = new Int_t[maxn]; | |
84 | for(Int_t idet=0;idet<maxn;idet++){ | |
38300302 | 85 | digits[idet]=new TClonesArray("AliITSdigitSDD"); |
86 | idig[idet]=0; | |
87 | } | |
88 | ||
38300302 | 89 | switch(fBtPer){ |
90 | case kNov04: | |
91 | fStreamer = new AliITSRawStreamSDDv3(fReaderDate); | |
92 | break; | |
93 | case kAug04: | |
5ba31760 | 94 | AliVMERawStream vmeStreamer(fReaderDate); |
38300302 | 95 | fReaderDate->RequireHeader(kFALSE); |
5ba31760 | 96 | while(fReaderDate->ReadHeader()){ |
38300302 | 97 | fSubEventAttributes = fReaderDate->GetSubEventAttributes(); |
5ba31760 | 98 | } |
99 | ||
100 | fSDDEvType=GetEventType(); | |
38300302 | 101 | if(fSDDEvType==1) fITSHeader->SetEventTypeSDD(kReal); |
102 | if(fSDDEvType==2) fITSHeader->SetEventTypeSDD(kCalibration1); | |
103 | if(fSDDEvType==3) fITSHeader->SetEventTypeSDD(kCalibration2); | |
104 | fReaderDate->Reset(); | |
5ba31760 | 105 | fStreamer = new AliITSRawStreamSDDv2(fReaderDate); |
38300302 | 106 | break; |
107 | } | |
108 | ||
5ba31760 | 109 | |
110 | fStreamer->SetLowCarlosThreshold(fThreshold,0); | |
111 | fStreamer->SetLowCarlosThreshold(fThreshold,1); | |
38300302 | 112 | |
113 | //from raw data the signal is already decompressed.. | |
114 | //set compressed fSignal of AliITSdigitSDD to -1000 | |
115 | //set expanded fSignalExpanded of AliITSdigitSDD equal to fStreamer.GetSignal() | |
116 | while(fStreamer->Next()){ | |
117 | ||
5ba31760 | 118 | Int_t ndet =0; |
119 | if(GetBtPeriod()==kNov04) ndet=fStreamer->GetChannel()+nspd; | |
120 | if(GetBtPeriod()==kAug04) ndet=fStreamer->GetChannel(); | |
38300302 | 121 | Int_t anode = fStreamer->GetCoord1(); |
122 | ||
123 | /* if we are reading only one det, two wings | |
124 | if(fStreamer.GetChannel()==1) anode+=256; //wing 1 0-255, wing 2 256-511 | |
125 | */ | |
126 | ||
127 | /* bt august 2004 and november 2004: with only 1 carlos | |
128 | channel 0 for one wing of one | |
129 | det, channel 1 for the wing of the second det*/ | |
130 | ||
131 | const Int_t kdgt[3]={anode,fStreamer->GetCoord2(),-1000}; | |
132 | const Int_t ktracks[10]={0,0,0,0,0,0,0,0,0,0}; | |
133 | const Int_t khits[10]={0,0,0,0,0,0,0,0,0,0}; | |
134 | const Float_t kcharges[10]={0,0,0,0,0,0,0,0,0,0}; | |
135 | ||
136 | ||
137 | new ((*digits[ndet])[idig[ndet]]) AliITSdigitSDD(0,kdgt,ktracks,khits,kcharges,fStreamer->GetSignal()); | |
138 | idig[ndet]++; | |
38300302 | 139 | } |
140 | ||
141 | if(GetBtPeriod()==kNov04){ | |
142 | Int_t jitter=fStreamer->ReadJitter(); | |
143 | fITSHeader->SetJitterSDD(jitter); | |
144 | } | |
5ba31760 | 145 | for(Int_t n = 0;n<maxn;n++){ |
38300302 | 146 | branch->SetAddress(&digits[n]); |
147 | branch->Fill(); | |
5ba31760 | 148 | |
38300302 | 149 | } |
150 | ||
5ba31760 | 151 | fTreeD->SetEntries(maxn); |
38300302 | 152 | fReaderDate->Reset(); |
153 | fTreeD->AutoSave(); | |
154 | ||
5ba31760 | 155 | for(Int_t n=0;n<maxn;n++){ |
38300302 | 156 | delete digits[n]; |
157 | } | |
158 | ||
159 | ||
160 | delete[] digits; | |
161 | delete[] idig; | |
162 | delete fStreamer; | |
163 | } | |
164 | ||
165 | ||
166 | //______________________________________ | |
167 | Int_t AliITSBeamTestDigSDD::GetEventType(){ | |
168 | ||
169 | // defines the SDD event type: | |
170 | // 1: physics event (kReal) | |
171 | // 2: calibration 1 (kCalibration1, injector pulse) | |
172 | // 3: calibration 2 (kCalibration2, test pulse) | |
173 | ||
5ba31760 | 174 | fSDDEvType=0; |
38300302 | 175 | if(fSubEventAttributes[0]==0 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 1; |
5ba31760 | 176 | if(fSubEventAttributes[0]==1 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 2; |
38300302 | 177 | |
178 | if(fSubEventAttributes[0]==2 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 3; | |
179 | ||
38300302 | 180 | return fSDDEvType; |
181 | } | |
182 | ||
183 | //______________________________________________________________________ | |
184 | AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const AliITSBeamTestDigSDD &bt):AliITSBeamTestDig(bt){ | |
185 | // Copy constructor. | |
186 | ||
187 | fSDDEvType = bt.fSDDEvType; | |
188 | fSubEventAttributes = bt.fSubEventAttributes; | |
189 | fBtPer = bt.fBtPer; | |
190 | fThreshold = bt.fThreshold; | |
191 | fStreamer = bt.fStreamer; | |
192 | } | |
193 | //______________________________________________________________________ | |
5ba31760 | 194 | AliITSBeamTestDigSDD& AliITSBeamTestDigSDD::operator=(const AliITSBeamTestDigSDD &source){ |
38300302 | 195 | // Assignment operator. This is a function which is not allowed to be |
196 | // done to the ITS beam test dig. It exits with an error. | |
197 | // Inputs: | |
5ba31760 | 198 | if(this==&source) return *this; |
38300302 | 199 | Error("operator=","You are not allowed to make a copy of the AliITSBeamTestDig"); |
200 | exit(1); | |
201 | return *this; //fake return | |
202 | } | |
203 | ||
204 | ||
205 | ||
206 |