Option to read both DATE and ROOT raw data format included. Bug fixes in AliITSvBeamT...
[u/mrichter/AliRoot.git] / ITS / AliITSBeamTestDigSPD.cxx
CommitLineData
38300302 1////////////////////////////////////////////////////
2// Class to define //
3// SPD beam test raw 2 dig conv. //
4// //
5// Origin: Jan Conrad Jan.Conrad@cern.ch //
6// //
7////////////////////////////////////////////////////
8
5ba31760 9#include "AliITS.h"
38300302 10#include "AliITSdigitSPD.h"
8ace09b6 11#include "AliRawReader.h"
12#include "AliRawReader.h"
38300302 13#include "AliRawDataHeader.h"
14#include "AliITSRawStreamSPD.h"
15#include "AliITSBeamTestDigSPD.h"
5ba31760 16#include "AliITSgeom.h"
17#include <TBranch.h>
18#include <TTree.h>
19#include "AliITSEventHeader.h"
38300302 20ClassImp(AliITSBeamTestDigSPD)
21
22
23
24//_____________________________________________________________
25 AliITSBeamTestDigSPD::AliITSBeamTestDigSPD(): AliITSBeamTestDig()
26{
27 //
28 // Constructor
29 //
30
31
32}
33
34//_____________________________________________________________
35 AliITSBeamTestDigSPD::AliITSBeamTestDigSPD(const Text_t* name, const Text_t* title): AliITSBeamTestDig(name,title)
36{
37 //
38 // Constructor
39 //
40
41
42}
43
44//__________________________________________________________________
45AliITSBeamTestDigSPD::~AliITSBeamTestDigSPD()
46{
47 //
48 // Destructor
49 //
50
51 }
52
53
54//_______________________________________________________________________
55void AliITSBeamTestDigSPD::Exec(Option_t* /*opt*/)
56{
57 //Reads raw data for SPD, fill SPD digits tree
58
59
5ba31760 60 TBranch* branch = fTreeD->GetBranch("ITSDigitsSPD");
61
62 AliITSgeom* geom = fBt->GetITSgeom();
63 Int_t nsdd=0;
64 Int_t nspd=0;
65 Int_t nssd=0;
66 for(Int_t nlay=1;nlay<=geom->GetNlayers();nlay++){
67 for(Int_t nlad=1;nlad<=geom->GetNladders(nlay);nlad++){
68 for(Int_t ndet=1;ndet<=geom->GetNdetectors(nlay);ndet++){
69 Int_t index=geom->GetModuleIndex(nlay,nlad,ndet);
70 if(geom->GetModuleTypeName(index)=="kSPD") nspd++;
71 if(geom->GetModuleTypeName(index)=="kSDD") nsdd++;
72 if(geom->GetModuleTypeName(index)=="kSSD") nssd++;
73 }
74 }
75 }
76 Int_t maxn=nspd+nsdd+nssd;
77
78 TClonesArray** newdigits = new TClonesArray*[maxn];
38300302 79
38300302 80
5ba31760 81 Int_t* idig = new Int_t[maxn];
38300302 82
5ba31760 83 for (Int_t idet =0; idet <maxn;idet++){
38300302 84 newdigits[idet]=new TClonesArray("AliITSdigitSPD");
85 idig[idet]=0;
86 }
87
88
8ace09b6 89 AliITSRawStreamSPD str(fReader);
38300302 90
8ace09b6 91 fReader->SelectEquipment(17,211,211);
38300302 92
93 while(str.Next()){
94
8ace09b6 95 const AliRawDataHeader* rdh = fReader->GetDataHeader();
96 UChar_t blockAttributes = fReader->GetBlockAttributes();
97 UInt_t statusBits = fReader->GetStatusBits();
38300302 98 UInt_t orbitNumber = rdh->fEventID2;
99 UShort_t bunchCross = rdh->fEventID1;
100 // UInt_t DataSize = rdh->fSize;
101 //UChar_t L1TrigType = rdh->fL1TriggerType;
102 //UInt_t MiniEvId = rdh->GetMiniEventID();
103 // ULong64_t TriggerCL = rdh->GetTriggerClasses();
104 //ULong64_t ROI = rdh->GetROI();
105 // UChar_t Version =rdh->fVersion;
106
107
108 Int_t modID = str.GetModuleID();
109 // Int_t triggernumber = str.GetTriggerEventNumber();
110
111 Int_t row = str.GetRow();
112 Int_t col = str.GetColumn();
113
5ba31760 114 const Int_t kdgt[3]={col,row,1};
38300302 115 // newdigits = new TClonesArray*[fBt->GetNSPD()];
116
117 new ((*newdigits[modID])[idig[modID]]) AliITSdigitSPD(kdgt);
118
119 idig[modID]++;
120
121 fITSHeader->SetOrbitNumber(0,orbitNumber);
122 fITSHeader->SetStatusBits(0,statusBits);
123 fITSHeader->SetBlockAttributes(0,blockAttributes);
124 fITSHeader->SetBunchCross(0,bunchCross);
125 //fITSHeader->SetTriggerClass(0,TriggerCL);
126 //fITSHeader->SetSubDet(0,
127 //fITSHeader->SetMiniEvId(0,MiniEvId);
128 //fITSHeader->SetVersion(0,Version);
129 //fITSHeader->SetSubDet(0,Subdets);
130 //fITSHeader->SetL1TriggerType(0,L1TrigType);
131
132 // fITSHeader->SetOrbitNumberSPD(OrbitNumber);
133 //printf("Bunch Crossing = %x\n ",BunchCross);
134 if ( blockAttributes != 0x3a ) {
135 Info("Exec","Block Attribs = %x\n ",blockAttributes);
136 }
137
138
139
140 } // while(str.Next());
141
142
5ba31760 143 for(Int_t n=0;n<maxn;n++){
38300302 144 branch->SetAddress(&newdigits[n]);
5ba31760 145 branch->Fill();
146
38300302 147 }
148
5ba31760 149 fTreeD->SetEntries(maxn);
38300302 150
151
8ace09b6 152 fReader->Reset();
38300302 153 fTreeD->AutoSave();
154
155
5ba31760 156 for(Int_t n=0;n<maxn;n++){
157 delete newdigits[n];
38300302 158 }
159
160 delete[] newdigits;
161 delete[] idig;
162
163}
164
165