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