]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/testITSU/CreateITSUsinglesegm.C
store also difference in local Y
[u/mrichter/AliRoot.git] / ITS / UPGRADE / testITSU / CreateITSUsinglesegm.C
CommitLineData
e1f00b9d
RS
1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TSystem.h>
3#include <TMath.h>
4#endif
5
6//---------------------------------------
7double 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
13double 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
21void CreateITSUsinglesegm()
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. , 0}, // for others: -, rMid, -, NMod/Stave, phi0, nStave
50 {-1, 24.7, -1, 28., 0. , 0},
51 {-1, 35.32,-1, 49., 0. , 0},
52 {-1, 40.52,-1, 49., 0. , 0}
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 seg0->Print();
72 //
73 const double kMinOvl = 0.01; // require active zones overlap
74 const double kTilt = -10.; // tilt in degrees for outer layers
75 double dzLr,rLr,phi0,turbo,thick;
76 AliITSUSegmentationPix* seg=0;
77 int nStaveLr,nModPerStaveLr,idLr;
78 // 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,
79 // const Double_t tilt, const Double_t lthick = 0., const Double_t dthick = 0., const UInt_t detType=0);
80 AliITSUv0 *ITS = new AliITSUv0("ITS Upgrade",7);
81 ITS->SetStaveModel(AliITSUv0::kModel22);
82 //
83 const int kNWrapVol = 3;
84 const double wrpRMin[kNWrapVol] = { 2.1, 15.0, 32.0};
85 const double wrpRMax[kNWrapVol] = { 7.0, 27.0, 43.0};
86 const double wrpZSpan[kNWrapVol] = {28.0, 86.0, 150.0};
87 ITS->SetNWrapVolumes(kNWrapVol); // define wrapper volumes for layers
88 for (int iw=0;iw<kNWrapVol;iw++) ITS->DefineWrapVolume(iw,wrpRMin[iw],wrpRMax[iw],wrpZSpan[iw]);
89 //
90 for (int idLr=0;idLr<kNLr;idLr++) {
91 rLr = tdr5dat[idLr][kRmd];
92 phi0 = tdr5dat[idLr][kPhi0];
93 if (idLr<kNLrInner) {
94 seg = seg0;
95 turbo = -radii2Turbo(tdr5dat[idLr][kRmn],rLr,tdr5dat[idLr][kRmx],seg->Dx());
96 thick = kLrThick03;
97 }
98 else {
99 seg = seg0;
100 turbo = kTilt;
101 thick = kLrThick08;
102 }
103 nStaveLr = TMath::Nint(tdr5dat[idLr][kNStave]);
104 if (nStaveLr<1) nStaveLr = getNStaves(seg,kTilt,rLr,kMinOvl); // calculate automatically
105 nModPerStaveLr = TMath::Nint(tdr5dat[idLr][kNModPerStave]);
106 ITS->DefineLayerTurbo(idLr, phi0, rLr, nModPerStaveLr*seg->Dz(), nStaveLr, nModPerStaveLr,
852af72e 107 seg->Dx(), turbo, thick, seg->Dy(), seg->GetChipTypeID());
e1f00b9d
RS
108 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);
109 //
110 }
111 //
112}
113
114Int_t getNStaves(AliITSUSegmentationPix* seg, double tilt, double r0, double minOvl)
115{
116 double dphi = (90.-tilt)*TMath::DegToRad();
117 double cs = TMath::Cos(dphi);
118 double sn = TMath::Sin(dphi);
119 double dx = seg->Dx();
120 double tL = -dx/2 + seg->GetGuardBot();
121 double tU = dx/2 - seg->GetGuardTop();
122 //
123 double xL = r0 + cs*tL;
124 double yL = sn*tL;
125 double xU = r0 + cs*tU;
126 double yU = sn*tU;
127 double phiL = TMath::ATan2(yL,xL);
128 double phiU = TMath::ATan2(yU,xU);
129 double dphi = TMath::Abs(phiL-phiU);
130 if (dphi>TMath::Pi()) dphi = TMath::Abs(dphi-TMath::Pi()*2);
131 double span = dphi*r0;
132 //
133 double ov = -1;
134 int nStaveLr = 1 + r0*TMath::Pi()*2/span;
135 do { ov = 1.-r0*TMath::Pi()*2/nStaveLr/span; } while ( minOvl>=0 && ov<minOvl && nStaveLr++ );
136 printf("Reccommend %2d staves for R=%5.2f, ActiveOvl=%5.2f\% (%6.f micron)\n",nStaveLr,r0,ov*100,ov*span*1e4);
137 return nStaveLr;
138}