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