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