1 ////////////////////////////////////////////////////
3 // SDD beam test raw 2 dig conv. //
4 // Origin: E. Crescio crescio@to.infn.it //
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"
16 ClassImp(AliITSBeamTestDigSDD)
18 //_____________________________________________________________
19 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(): AliITSBeamTestDig()
25 fSubEventAttributes=0;
30 //_____________________________________________________________
31 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const Text_t* name, const Text_t* title): AliITSBeamTestDig(name,title)
37 fSubEventAttributes=0;
42 //__________________________________________________________________
43 AliITSBeamTestDigSDD::~AliITSBeamTestDigSDD()
48 if(fSubEventAttributes) delete fSubEventAttributes;
49 if(fStreamer) delete fStreamer;
53 //_______________________________________________________________________
54 void AliITSBeamTestDigSDD::Exec(Option_t* /*opt*/)
57 // Reads raw data and fills the tree of digits
59 TBranch* branch = fTreeD->GetBranch("ITSDigitSDD");
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");
71 fStreamer = new AliITSRawStreamSDDv3(fReaderDate);
74 fStreamer = new AliITSRawStreamSDDv2(fReaderDate);
75 fReaderDate->RequireHeader(kFALSE);
76 fReaderDate->ReadHeader();
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);
89 fStreamer->SetLowCarlosThreshold(fThreshold,0);
90 fStreamer->SetLowCarlosThreshold(fThreshold,1);
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()){
97 Int_t ndet = fStreamer->GetChannel()+fBt->GetNSPD();
98 Int_t anode = fStreamer->GetCoord1();
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
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*/
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};
114 new ((*digits[ndet])[idig[ndet]]) AliITSdigitSDD(0,kdgt,ktracks,khits,kcharges,fStreamer->GetSignal());
119 if(GetBtPeriod()==kNov04){
120 Int_t jitter=fStreamer->ReadJitter();
121 fITSHeader->SetJitterSDD(jitter);
123 for(Int_t n = fBt->GetNSPD();n<fBt->GetNSDD()+fBt->GetNSPD();n++){
124 branch->SetAddress(&digits[n]);
128 fTreeD->SetEntries(fBt->GetNSPD()+fBt->GetNSDD()+fBt->GetNSSD());
129 fReaderDate->Reset();
132 for(Int_t n=0;n<fBt->GetNSPD()+fBt->GetNSDD();n++){
143 //______________________________________
144 Int_t AliITSBeamTestDigSDD::GetEventType(){
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)
152 if(fSubEventAttributes[0]==0 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 1;
154 if(fSubEventAttributes[0]==2 && fSubEventAttributes[1]==0 && fSubEventAttributes[2]==0) fSDDEvType = 3;
156 fSubEventAttributes = 0;
160 //______________________________________________________________________
161 AliITSBeamTestDigSDD::AliITSBeamTestDigSDD(const AliITSBeamTestDigSDD &bt):AliITSBeamTestDig(bt){
164 fSDDEvType = bt.fSDDEvType;
165 fSubEventAttributes = bt.fSubEventAttributes;
167 fThreshold = bt.fThreshold;
168 fStreamer = bt.fStreamer;
170 //______________________________________________________________________
171 AliITSBeamTestDigSDD& 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.
175 if(this==&bt) return *this;
176 Error("operator=","You are not allowed to make a copy of the AliITSBeamTestDig");
178 return *this; //fake return