]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSBeamTestDigSSD.cxx
Measured field map as objects of type AliMagFCheb (R. Shahoyan)
[u/mrichter/AliRoot.git] / ITS / AliITSBeamTestDigSSD.cxx
1 /////////////////////////////////////////
2 // Class for SSD raw2digits conv       //
3 //                                     //
4 // Author: Enrico Fragiacomo           //
5 // Date: October 2004                  //
6 ////////////////////////////////////////
7
8 #include "AliITSgeom.h"
9 #include "AliITSdigitSSD.h"
10 #include "AliRawReader.h"
11 #include "AliITSRawStreamSSDv1.h"
12 #include "AliITSBeamTestDigSSD.h"
13 #include <TBranch.h>
14 #include <TTree.h>
15
16 ClassImp(AliITSBeamTestDigSSD)
17
18 //_____________________________________________________________
19 AliITSBeamTestDigSSD::AliITSBeamTestDigSSD(): AliITSBeamTestDig(),
20 fFlagHeader(0) 
21 {
22   //
23   // Constructor
24   //  
25 }
26
27 //_____________________________________________________________
28 AliITSBeamTestDigSSD::AliITSBeamTestDigSSD(const Text_t* name, const Text_t* title): AliITSBeamTestDig(name,title),
29 fFlagHeader(0){
30   //
31   // Constructor
32   //
33 }
34
35 //__________________________________________________________________
36 AliITSBeamTestDigSSD::~AliITSBeamTestDigSSD() {
37   //
38   // Destructor
39   //
40 }
41
42 //_______________________________________________________________________
43 void AliITSBeamTestDigSSD::Exec(Option_t* /*opt*/) {
44   //Reads raw data for SSD, fill SSD digits tree, returns 1 if real data,
45   //returns 2 if calibration (injector) data, returns 3 if calibration (test pul  //se) event
46
47   TBranch* branch = fTreeD->GetBranch("ITSDigitsSSD");
48   if(!fITSgeom){
49     Error("Exec","fITSgeom is null!");
50     return;
51   }
52
53   Int_t nsdd=0;
54   Int_t nspd=0;
55   Int_t nssd=0;
56   for(Int_t nlay=1;nlay<=fITSgeom->GetNlayers();nlay++){
57     for(Int_t nlad=1;nlad<=fITSgeom->GetNladders(nlay);nlad++){
58       for(Int_t ndet=1;ndet<=fITSgeom->GetNdetectors(nlay);ndet++){
59         Int_t index=fITSgeom->GetModuleIndex(nlay,nlad,ndet);
60         if(fITSgeom->GetModuleTypeName(index)=="kSPD") nspd++;
61         if(fITSgeom->GetModuleTypeName(index)=="kSDD") nsdd++;
62         if(fITSgeom->GetModuleTypeName(index)=="kSSD") nssd++;
63       }
64     }
65   }
66   Int_t maxn=nspd+nsdd+nssd;
67
68   TClonesArray** newdigits = new TClonesArray*[maxn];
69
70   Int_t* idig = new Int_t[maxn];
71
72   for (Int_t idet =0; idet <maxn;idet++) {
73      newdigits[idet] = new TClonesArray("AliITSdigitSSD");
74      idig[idet]=0;  
75    }
76   
77   // this constructor sets the flag to select SSD data only 
78   // the Next method below will then jump to SSD data for this event
79   AliITSRawStreamSSDv1 str(fReader);
80
81   // no selection of equipment 
82   //fReader->SelectEquipment(-1);
83   //fReader->SelectEquipment(17,102,102);
84
85   while(str.Next()){   
86     
87     //if((str.GetADModule()!=2)&&(str.GetADModule()!=6)) continue;
88   
89     Int_t side = str.GetSideFlag();
90     Int_t strip = str.GetStrip();
91     Int_t signal = str.GetSignal();
92     Int_t module = str.GetModuleID();
93     Int_t module1= module-10+nsdd+nspd;
94      if( (module<10) || (module>13) ) continue;
95      if(module1>7) continue;
96     const Int_t kdgt[3]={side,strip,signal};
97      //  SSD modules 10, 11, 12 and 13
98     new ( (*newdigits[module1])[idig[module1]] ) AliITSdigitSSD(kdgt);    
99     idig[module1]++;
100   } // end while
101   
102   for(Int_t n=0;n<maxn;n++){
103     branch->SetAddress(&newdigits[n]);
104     branch->Fill();  
105   }
106   
107   fTreeD->SetEntries(maxn);
108     
109   fReader->Reset();
110   
111   fTreeD->AutoSave();
112   
113   for(Int_t n=0;n<maxn;n++){
114     delete newdigits[n];
115   }
116   
117   delete [] newdigits;
118   delete idig;
119 }
120
121   
122