]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/testITSU/CreateITSU.C
Integrating the Cooked Matrix tracker into the commom reconstruction framework
[u/mrichter/AliRoot.git] / ITS / UPGRADE / testITSU / CreateITSU.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TSystem.h>
3 #include <TMath.h>
4 #endif
5
6 //---------------------------------------
7 double radii2Turbo(double rMin,double rMid,double rMax, double sensW)
8 {
9   // compute turbo angle from radii and sensor width
10   return TMath::ASin((rMax*rMax-rMin*rMin)/(2*rMid*sensW))*TMath::RadToDeg();
11 }
12
13 double radii2Phi(double rMin,double rMid,double rMax, double sensW)
14 {
15   // compute phi coverage
16   return 2*TMath::ACos((rMax+rMin)*
17                        (rMid*rMid+rMin*rMax-sensW*sensW/4.)/
18                        (4.*rMid*rMax*rMin));
19 }
20
21 void CreateITSU()
22 {
23   //
24   gSystem->Load("libITSUpgradeBase.so");
25   gSystem->Load("libITSUpgradeSim.so");
26
27
28   // build ITS upgrade detector
29   // sensitive area 13x15mm (X,Z) with 20x20 micron pitch, 2mm dead zone on readout side and 50 micron guardring
30   const double kSensThick = 18e-4;
31   const double kPitchX = 20e-4;
32   const double kPitchZ = 20e-4;
33   const int    kNRow   = 650; 
34   const int    kNCol   = 750;
35   const int    kNChips = 2;
36   const double kLrThick03 = 120e-4;   // -> effective thickness for ~0.3%X layers
37   const double kLrThick08 = 600e-4;   // -> effective thickness for ~0.8%X layers
38   //
39   const double kReadOutEdge = 0.2;   // width of the readout edge (passive bottom)
40   const double kGuardRing   = 50e-4; // width of passive area on left/right/top of the sensor
41   //
42   const int kNLr = 7;
43   const int kNLrInner = 3;
44   enum {kRmn,kRmd,kRmx,kNModPerStave,kPhi0,kNStave,kNPar};
45   const double tdr5dat[kNLr][kNPar] = { 
46     {2.24, 2.34, 2.67,  9., 16.37, 12}, // for each inner layer: rMin,rMid,rMax,NMod/Stave,phi0, nStave
47     {3.01, 3.15, 3.46,  9., 12.03, 16},
48     {3.78, 3.93, 4.21,  9., 10.02, 20},
49     {-1,   19.4, -1,    28., 0.  , 49},  // for others: -, rMid, -, NMod/Stave, phi0, nStave
50     {-1,   24.7, -1,    28., 0.  , 61},
51     {-1,   35.32,-1,    49., 0.  , 88},
52     {-1,   40.52,-1,    49., 0.  , 100}
53   };
54
55   // create segmentations:
56   AliITSUSegmentationPix* seg0 = new AliITSUSegmentationPix(0,        // segID (0:9)
57                                                             kNChips,  // chips per module
58                                                             kNChips*kNCol,    // ncols (total for module)
59                                                             kNRow,    // nrows
60                                                             kPitchX,  // default row pitch in cm
61                                                             kPitchZ,  // default col pitch in cm
62                                                             kSensThick,  // sensor thickness in cm
63                                                             -1,     // no special left col between chips
64                                                             -1,     // no special right col between chips
65                                                             kGuardRing, // left
66                                                             kGuardRing, // right
67                                                             kGuardRing, // top
68                                                             kReadOutEdge  // bottom
69                                                             );    // see AliITSUSegmentationPix.h for extra options
70   seg0->Store(AliITSUGeomTGeo::GetITSsegmentationFileName());
71   //
72   AliITSUSegmentationPix* seg1 = new AliITSUSegmentationPix(1,        // segID (0:9)
73                                                             kNChips,  // chips per module
74                                                             kNChips*kNCol,    // ncols (total for module)
75                                                             2*kNRow,    // nrows for oute layers
76                                                             kPitchX,  // default row pitch in cm
77                                                             kPitchZ,  // default col pitch in cm
78                                                             kSensThick,  // sensor thickness in cm
79                                                             -1,     // no special left col between chips
80                                                             -1,     // no special right col between chips
81                                                             kGuardRing, // left
82                                                             kGuardRing, // right
83                                                             kReadOutEdge, // top   !!! readout from both sides
84                                                             kReadOutEdge  // bottom
85                                                             );    // see AliITSUSegmentationPix.h for extra options
86   seg1->Store(AliITSUGeomTGeo::GetITSsegmentationFileName());
87   //
88   seg0->Print();
89   seg1->Print();
90   //
91   const double kMinOvl = 0.005; // require active zones overlap
92   const double kTilt = -10.; // tilt in degrees for outer layers
93   double dzLr,rLr,phi0,turbo,thick;
94   AliITSUSegmentationPix* seg=0;
95   int nStaveLr,nModPerStaveLr,idLr;
96   //      virtual void   DefineLayerTurbo(const Int_t nlay, const Double_t r,  const Double_t zlen, const Int_t nladd,   const Int_t nmod, const Double_t width,
97   //                              const Double_t tilt,   const Double_t lthick = 0.,    const Double_t dthick = 0.,   const UInt_t detType=0);
98   AliITSUv0 *ITS  = new AliITSUv0("ITS Upgrade",7);
99   ITS->SetStaveModel(AliITSUv0::kModel22);
100   //
101   const int kNWrapVol = 3;
102   const double wrpRMin[kNWrapVol]  = { 2.1, 15.0, 32.0};
103   const double wrpRMax[kNWrapVol]  = { 7.0, 27.0, 43.0};
104   const double wrpZSpan[kNWrapVol] = {28.0, 86.0, 150.0};
105   ITS->SetNWrapVolumes(kNWrapVol); // define wrapper volumes for layers
106   for (int iw=0;iw<kNWrapVol;iw++) ITS->DefineWrapVolume(iw,wrpRMin[iw],wrpRMax[iw],wrpZSpan[iw]);
107   //
108   for (int idLr=0;idLr<kNLr;idLr++) {
109     rLr   = tdr5dat[idLr][kRmd];
110     phi0  = tdr5dat[idLr][kPhi0]; 
111     if (idLr<kNLrInner) {
112       seg = seg0;
113       turbo = -radii2Turbo(tdr5dat[idLr][kRmn],rLr,tdr5dat[idLr][kRmx],seg->Dx());      
114       thick = kLrThick03;
115     }
116     else {
117       seg   = seg1;
118       turbo = kTilt;
119       thick = kLrThick08;
120     }
121     nStaveLr = TMath::Nint(tdr5dat[idLr][kNStave]);
122     if (nStaveLr<0) nStaveLr = getNStaves(seg,kTilt,rLr,kMinOvl); // calculate automatically
123     nModPerStaveLr =  TMath::Nint(tdr5dat[idLr][kNModPerStave]);
124     ITS->DefineLayerTurbo(idLr, phi0, rLr, nModPerStaveLr*seg->Dz(), nStaveLr, nModPerStaveLr, 
125                           seg->Dx(), turbo, thick, seg->Dy(), seg->GetChipTypeID());
126     printf("Add Lr%d: R=%6.2f DZ:%6.2f Turbo:%+6.2f Staves:%3d NMod/Stave:%3d\n",idLr,rLr,nModPerStaveLr*seg->Dz(),turbo,nStaveLr,nModPerStaveLr);
127     //
128   }
129   //  
130 }
131
132 Int_t getNStaves(AliITSUSegmentationPix* seg, double tilt, double r0, double minOvl)
133 {
134   double dphi = (90.-tilt)*TMath::DegToRad();
135   double cs = TMath::Cos(dphi);
136   double sn = TMath::Sin(dphi);  
137   double dx = seg->Dx();
138   double tL = -dx/2 + seg->GetGuardBot();
139   double tU =  dx/2 - seg->GetGuardTop();
140   //
141   double xL = r0 + cs*tL;
142   double yL =      sn*tL;
143   double xU = r0 + cs*tU;
144   double yU =      sn*tU;
145   double phiL = TMath::ATan2(yL,xL);
146   double phiU = TMath::ATan2(yU,xU);
147   double dphi = TMath::Abs(phiL-phiU);
148   if (dphi>TMath::Pi()) dphi = TMath::Abs(dphi-TMath::Pi()*2);
149   double span = dphi*r0;
150   //
151   double ov = -1;
152   int nStaveLr = 1 + r0*TMath::Pi()*2/span;
153   do { ov = 1.-r0*TMath::Pi()*2/nStaveLr/span; } while ( minOvl>=0 && ov<minOvl && nStaveLr++ );
154   printf("Reccommend %2d staves for R=%5.2f, ActiveOvl=%5.2f\% (%6.f micron)\n",nStaveLr,r0,ov*100,ov*span*1e4);
155   return nStaveLr;
156 }