1 ////////////////////////////////////////////////////
3 // SDD beam test raw 2 dig conv. //
4 // Origin: E. Crescio crescio@to.infn.it //
7 ////////////////////////////////////////////////////
9 #include "AliITSdigitSDD.h"
10 #include "AliRawReader.h"
11 #include "AliVMERawStream.h"
12 #include "AliITSRawStreamSDDv2.h"
13 #include "AliITSRawStreamSDDv3.h"
14 #include "AliITSRawStreamSDD.h"
15 #include "AliITSBeamTestDigSDD.h"
16 #include "AliITSEventHeader.h"
17 #include "AliITSgeom.h"
21 ClassImp(AliITSBeamTestDigSDD)
23 //_____________________________________________________________
24 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(): AliITSBeamTestDig()
30 fSubEventAttributes=0;
35 //_____________________________________________________________
36 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const Text_t* name, const Text_t* title): AliITSBeamTestDig(name,title)
42 fSubEventAttributes=0;
47 //__________________________________________________________________
48 AliITSBeamTestDigSDD::~AliITSBeamTestDigSDD()
53 if(fSubEventAttributes) delete fSubEventAttributes;
54 if(fStreamer) delete fStreamer;
58 //_______________________________________________________________________
59 void AliITSBeamTestDigSDD::Exec(Option_t* /*opt*/)
62 // Reads raw data and fills the tree of digits
64 TBranch* branch = fTreeD->GetBranch("ITSDigitsSDD");
66 AliITSgeom* geom = fBt->GetITSgeom();
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++;
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++){
85 digits[idet]=new TClonesArray("AliITSdigitSDD");
91 fStreamer = new AliITSRawStreamSDDv3(fReader);
94 AliVMERawStream vmeStreamer(fReader);
95 fReader->RequireHeader(kFALSE);
96 while(fReader->ReadHeader()){
97 fSubEventAttributes = fReader->GetSubEventAttributes();
100 fSDDEvType=GetEventType();
101 if(fSDDEvType==1) fITSHeader->SetEventTypeSDD(kReal);
102 if(fSDDEvType==2) fITSHeader->SetEventTypeSDD(kCalibration1);
103 if(fSDDEvType==3) fITSHeader->SetEventTypeSDD(kCalibration2);
105 fStreamer = new AliITSRawStreamSDDv2(fReader);
110 fStreamer->SetLowCarlosThreshold(fThreshold,0);
111 fStreamer->SetLowCarlosThreshold(fThreshold,1);
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()){
118 if(GetBtPeriod()==kNov04) ndet=fStreamer->GetChannel()+nspd;
119 if(GetBtPeriod()==kAug04) ndet=fStreamer->GetChannel();
120 Int_t anode = fStreamer->GetCoord1();
122 /* if we are reading only one det, two wings
123 if(fStreamer.GetChannel()==1) anode+=256; //wing 1 0-255, wing 2 256-511
126 /* bt august 2004 and november 2004: with only 1 carlos
127 channel 0 for one wing of one
128 det, channel 1 for the wing of the second det*/
130 const Int_t kdgt[3]={anode,fStreamer->GetCoord2(),-1000};
131 const Int_t ktracks[10]={0,0,0,0,0,0,0,0,0,0};
132 const Int_t khits[10]={0,0,0,0,0,0,0,0,0,0};
133 const Float_t kcharges[10]={0,0,0,0,0,0,0,0,0,0};
136 new ((*digits[ndet])[idig[ndet]]) AliITSdigitSDD(0,kdgt,ktracks,khits,kcharges,fStreamer->GetSignal());
140 if(GetBtPeriod()==kNov04){
141 Int_t jitter=fStreamer->ReadJitter();
142 fITSHeader->SetJitterSDD(jitter);
144 for(Int_t n = 0;n<maxn;n++){
145 branch->SetAddress(&digits[n]);
150 fTreeD->SetEntries(maxn);
154 for(Int_t n=0;n<maxn;n++){
165 //______________________________________
166 Int_t AliITSBeamTestDigSDD::GetEventType(){
168 // defines the SDD event type:
169 // 1: physics event (kReal)
170 // 2: calibration 1 (kCalibration1, injector pulse)
171 // 3: calibration 2 (kCalibration2, test pulse)
174 if(fSubEventAttributes[0]==0 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 1;
175 if(fSubEventAttributes[0]==1 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 2;
177 if(fSubEventAttributes[0]==2 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 3;
182 //______________________________________________________________________
183 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const AliITSBeamTestDigSDD &bt):AliITSBeamTestDig(bt){
186 fSDDEvType = bt.fSDDEvType;
187 fSubEventAttributes = bt.fSubEventAttributes;
189 fThreshold = bt.fThreshold;
190 fStreamer = bt.fStreamer;
192 //______________________________________________________________________
193 AliITSBeamTestDigSDD& AliITSBeamTestDigSDD::operator=(const AliITSBeamTestDigSDD &source){
194 // Assignment operator. This is a function which is not allowed to be
195 // done to the ITS beam test dig. It exits with an error.
197 if(this==&source) return *this;
198 Error("operator=","You are not allowed to make a copy of the AliITSBeamTestDig");
200 return *this; //fake return