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