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