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