]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSBeamTestDigSPD.cxx
c8e16a438821079ca04ff48bc53c464c84b69dc4
[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 "AliITS.h"
10 #include "AliITSdigitSPD.h"
11 #include "AliRawReaderDate.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   TBranch* branch = fTreeD->GetBranch("ITSDigitsSPD");
60
61   AliITSgeom* geom = fBt->GetITSgeom();
62   Int_t nsdd=0;
63   Int_t nspd=0;
64   Int_t nssd=0;
65   for(Int_t nlay=1;nlay<=geom->GetNlayers();nlay++){
66     for(Int_t nlad=1;nlad<=geom->GetNladders(nlay);nlad++){
67       for(Int_t ndet=1;ndet<=geom->GetNdetectors(nlay);ndet++){
68         Int_t index=geom->GetModuleIndex(nlay,nlad,ndet);
69         if(geom->GetModuleTypeName(index)=="kSPD") nspd++;
70         if(geom->GetModuleTypeName(index)=="kSDD") nsdd++;
71         if(geom->GetModuleTypeName(index)=="kSSD") nssd++;
72       }
73     }
74   }
75   Int_t maxn=nspd+nsdd+nssd;
76
77   TClonesArray** newdigits = new TClonesArray*[maxn];
78
79
80   Int_t* idig = new Int_t[maxn];
81
82   for (Int_t idet =0; idet <maxn;idet++){
83      newdigits[idet]=new TClonesArray("AliITSdigitSPD");
84      idig[idet]=0;  
85    }
86   
87
88   AliITSRawStreamSPD str(fReaderDate);
89
90   fReaderDate->SelectEquipment(17,211,211);
91
92   while(str.Next()){  
93
94     const AliRawDataHeader* rdh = fReaderDate->GetDataHeader();
95     UChar_t blockAttributes = fReaderDate->GetBlockAttributes();     
96     UInt_t statusBits = fReaderDate->GetStatusBits();     
97     UInt_t orbitNumber = rdh->fEventID2;                         
98     UShort_t  bunchCross = rdh->fEventID1;      
99       // UInt_t DataSize = rdh->fSize;                                
100       //UChar_t L1TrigType = rdh->fL1TriggerType;                             
101       //UInt_t MiniEvId = rdh->GetMiniEventID();                              
102       // ULong64_t TriggerCL = rdh->GetTriggerClasses();     
103       //ULong64_t ROI = rdh->GetROI();
104       //      UChar_t Version =rdh->fVersion;                                 
105       
106
107     Int_t modID = str.GetModuleID();
108     //    Int_t triggernumber = str.GetTriggerEventNumber();
109
110     Int_t row = str.GetRow();
111     Int_t col = str.GetColumn();
112
113     const Int_t kdgt[3]={col,row,1};
114     //    newdigits = new TClonesArray*[fBt->GetNSPD()];
115
116     new ((*newdigits[modID])[idig[modID]]) AliITSdigitSPD(kdgt);
117     
118     idig[modID]++;
119     
120       fITSHeader->SetOrbitNumber(0,orbitNumber);
121       fITSHeader->SetStatusBits(0,statusBits);
122       fITSHeader->SetBlockAttributes(0,blockAttributes);
123       fITSHeader->SetBunchCross(0,bunchCross);
124       //fITSHeader->SetTriggerClass(0,TriggerCL);
125       //fITSHeader->SetSubDet(0,
126       //fITSHeader->SetMiniEvId(0,MiniEvId);
127       //fITSHeader->SetVersion(0,Version);
128       //fITSHeader->SetSubDet(0,Subdets);
129       //fITSHeader->SetL1TriggerType(0,L1TrigType);
130
131    // fITSHeader->SetOrbitNumberSPD(OrbitNumber);
132          //printf("Bunch Crossing  = %x\n ",BunchCross);
133      if ( blockAttributes != 0x3a ) {
134        Info("Exec","Block Attribs  = %x\n ",blockAttributes);
135      }  
136     
137      
138     
139     } // while(str.Next());
140     
141
142     for(Int_t n=0;n<maxn;n++){
143       branch->SetAddress(&newdigits[n]);
144       branch->Fill(); 
145
146    }
147     
148     fTreeD->SetEntries(maxn);
149   
150         
151     fReaderDate->Reset();
152     fTreeD->AutoSave();
153    
154
155     for(Int_t n=0;n<maxn;n++){
156       delete newdigits[n];
157     }
158
159     delete[] newdigits;
160     delete[] idig;
161
162 }
163
164