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