/[PAMELA software]/PamVMC_update/trk/src/PamVMCDetTrk.cxx
ViewVC logotype

Annotation of /PamVMC_update/trk/src/PamVMCDetTrk.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Oct 15 15:51:23 2013 UTC (11 years, 1 month ago) by formato
Branch point for: MAIN, rel
Initial revision

1 formato 1.1 #include <fstream>
2     #include "TMath.h"
3     #include "TGeoBBox.h"
4     #include "PamVMCDetTrk.h"
5    
6     using TMath::RadToDeg;
7    
8     ClassImp(PamVMCDetTrk)
9    
10     void PamVMCDetTrk::DefineGeometry(){
11    
12     TGeoMaterial *m=0;
13     TGeoMixture *mx =0;
14     TString s = "ALUMINIUM";
15     m = GetMat(s);
16     if(!m){
17     m = new TGeoMaterial(s,26.98,13,2.7);
18     m->SetUniqueID( 9);
19     }
20    
21     s = "IRON";
22     m = GetMat(s);
23     if(!m){
24     m = new TGeoMaterial(s,55.85,26,7.87);
25     m->SetUniqueID( 10);
26     }
27    
28    
29     s = "N2GAS";
30     m = GetMat(s);
31     if (!m){
32     m = new TGeoMaterial(s,14.01,7,0.1250000E-02);
33     m->SetUniqueID( 19);
34     }
35    
36     s = "SILICON TR";
37     m= GetMat(s);
38     if(!m){
39     m = new TGeoMaterial(s,28.09,14,2.33);
40     m->SetUniqueID( 20);
41     }
42    
43     s = "G10C";
44     mx = (TGeoMixture*)GetMat(s);
45     if(!mx){
46     mx = new TGeoMixture(s,4, 1.70000 );
47     mx->SetUniqueID( 27);
48     mx->DefineElement(0,28.09,14,0.53);
49     mx->DefineElement(1,16,8,0.3);
50     mx->DefineElement(2,12.01,6,0.15);
51     mx->DefineElement(3,1.01,1,0.2000000E-01);
52     }
53    
54     s = "SBAR";
55     mx = (TGeoMixture*)GetMat(s);
56     if(!mx){
57     mx = new TGeoMixture(s,3, 1.49000 );
58     mx->SetUniqueID( 40);
59     //Carbon fiber 90%, Resin 10%
60     mx->DefineElement(0,12.01,6,0.845*0.9+0.545*0.1); //C
61     mx->DefineElement(1,1.01,1,0.043*0.9+0.092*0.1); //H
62     mx->DefineElement(2,16.0,8,0.112*0.9+0.363*0.1); //O
63     }
64    
65    
66     TGeoMedium * n = 0;
67    
68     s="ALUMINIUM";
69     n = (GetMed(s))?GetMed(s): new TGeoMedium(s,1,9,-1,1,40,1,100,0.5000000E-01,0.136283,0.5000000E-03);
70    
71     s = "N2 GAS";
72     n = (GetMed(s))?GetMed(s): new TGeoMedium(s,3,19,-1,1,40,1,0.5000000E-01,0.5000000E-01,0.1000000E-02,0.5000000E-03);
73    
74     s = "IRONTR";
75     n = (GetMed(s))?GetMed(s): new TGeoMedium(s,5,10,-1,1,40,1,0.5000000E-01,0.5000000E-01,0.8000000E-01,0.5000000E-03);
76    
77     s = "FIBER+RESIN";
78     n = (GetMed(s))?GetMed(s): new TGeoMedium(s,29,40,-1,1,40,1,100,0.5000000E-01,0.5000000E-02,0.5000000E-03);
79    
80     s = "SITRACKER";
81     n = (GetMed(s))?GetMed(s): new TGeoMedium(s,12,20,1,1,40,1,0.1000000E-02,0.5000000E-01,0.5000000E-04,0.1569056E-01);
82    
83     s = "G10C";
84     n = (GetMed(s))?GetMed(s):new TGeoMedium(s,17,27,-1,1,40,1,100,0.5000000E-01,0.1200000E-02,0.5000000E-03);
85    
86     TGeoVolume *v = 0;
87    
88    
89     s = "SPEB";
90     v = (GetVol(s))?GetVol(s):gGeoManager->MakeBox(s,GetMed("N2 GAS"),15.,14.4,22.615);
91     for(Int_t i = 1; i<=5; i++){
92     s = "MGF";
93     s += i;
94     v = (GetVol(s))?GetVol(s):gGeoManager->MakeBox(s,GetMed("ALUMINIUM"),15.,14.4,4.45);
95     }
96     s = "MGPL";
97     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("IRONTR"),12.,11.4,4.);
98     s = "MGPI";
99     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("N2 GAS"),8.07,6.57,4.);
100     for(Int_t i = 1; i<=6; i++){
101     s = "TRP";
102     s += i;
103     v = (GetVol(s))?GetVol(s):gGeoManager->MakeBox(s,GetMed("ALUMINIUM"),10.49,12.15,0.365);
104     }
105     for(Int_t i = 1; i<=6; i++){
106     s = "TPA";
107     s += i;
108     v = (GetVol(s))?GetVol(s):gGeoManager->MakeBox(s,GetMed("N2 GAS"),8.2,9.9,0.365);
109     }
110     s = "TPAI";
111     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("ALUMINIUM"),8.144,1.25,0.5E-01);
112     s = "TRSL";
113     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("SITRACKER"),2.6665,3.5,0.15E-01);
114     s = "THBP";
115     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("G10C"),2.6665,2.75,0.15E-01);
116     s = "TSPA";
117     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("SITRACKER"),2.596,3.413,0.15E-01);
118     s = "TRCP";
119     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("FIBER+RESIN"),0.35E-01,9.9,0.25);
120     s = "TBAL";
121     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("ALUMINIUM"),1.49,2.25,0.365);
122     s = "MGPA";
123     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("ALUMINIUM"),8.1,6.6,4.);
124     s = "TPGA";
125     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("N2 GAS"),10.29,10.65,0.4E-01);
126     s = "TPGI";
127     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("N2 GAS"),8.07,6.57,0.15E-01);
128     s = "TPGU";
129     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("N2 GAS"),10.49,12.15,0.1E-01);
130     s = "TPGD";
131     v = (GetVol(s))?GetVol(s): gGeoManager->MakeBox(s,GetMed("N2 GAS"),12.,11.4,0.5E-02);
132    
133    
134     ReadPaddlesPos();
135    
136     //Original, not shifted positions of the paddles TRSL respect to TPAs volumes.
137     Double_t x14,x36,x25, y123, y456, za;
138     x36 = 5.405;
139     x14 = -x36;
140     x25 = 0.;
141     y123 = 6.252;
142     y456 = -0.75;
143     za = 0.15E-01;
144     Double_t xp[6] = {x14, x25, x36, x14, x25, x36};
145     Double_t yp[6] = {y123, y123, y123, y456, y456, y456};
146     Double_t x,y,z;
147    
148    
149     GetVol("TRSL")->AddNode(GetVol("TSPA"),1,gGeoIdentity); //adding sensetive detector first
150     GetVol("MGPL")->AddNode(GetVol("MGPA"),1,gGeoIdentity);
151     GetVol("MGPA")->AddNode(GetVol("MGPI"),1,gGeoIdentity);
152    
153     Double_t zMGF = ((TGeoBBox*)GetVol("SPEB")->GetShape())->GetDZ();
154     for(Int_t i = 1; i<=6; i++){
155     Int_t rot_id, j;
156     TString ss="TRP";
157     if( i<6 ){
158     s = "MGF";
159     s += i;
160     zMGF -= ((TGeoBBox*)GetVol(s)->GetShape())->GetDZ();
161     GetVol("SPEB")->AddNode(GetVol( s ),1,new TGeoTranslation(0.,0., zMGF ));
162     zMGF -= ((TGeoBBox*)GetVol(s)->GetShape())->GetDZ();
163     GetVol( s )->AddNode(GetVol("TPGD"),1,new TGeoTranslation(0.,0.,-4.445));
164     GetVol( s )->AddNode(GetVol("TPGI"),1,new TGeoTranslation(0.,0.,-4.425));
165     GetVol( s )->AddNode(GetVol("MGPL"),1,new TGeoTranslation(0.,0.,-0.41));
166     GetVol( s )->AddNode(GetVol("TPGI"),2,new TGeoTranslation(0.,0.,3.605));
167     GetVol( s )->AddNode(GetVol("TPGA"),1,new TGeoTranslation(0.,-0.75,3.66));
168     ss += i;
169     GetVol( s )->AddNode(GetVol( ss ),1,new TGeoTranslation(dxflo[i-1], -2.25 + dyflo[i-1], 4.065));
170     } else {
171     s = "SPEB";
172     ss += i;
173     GetVol( s )->AddNode(GetVol( ss ),1,new TGeoCombiTrans(dxflo[i-1], 2.25 + dyflo[i-1], -22.25, GetRot("rot10")));
174     }
175     s = "TPA";
176     s += i;
177     GetVol( ss )->AddNode(GetVol( s ),i,new TGeoTranslation(0.,-0.75,0.));
178     GetVol( s )->AddNodeOverlap(GetVol("TRCP"),1,new TGeoTranslation(-8.1075,0.,0.15E-01));
179     GetVol( s )->AddNodeOverlap(GetVol("TRCP"),2,new TGeoTranslation(-2.7025,0.,0.15E-01));
180     GetVol( s )->AddNodeOverlap(GetVol("TRCP"),3,new TGeoTranslation(2.7025,0.,0.15E-01));
181     GetVol( s )->AddNodeOverlap(GetVol("TRCP"),4,new TGeoTranslation(8.1075,0.,0.15E-01));
182     //paddles//
183     j = (i-1)*NP_TRK + 1;
184     Int_t kk;
185    
186     for(Int_t pad = 0; pad<6; pad++){
187     ss = "rot_";
188     rot_id = 50 + j;
189     ss += rot_id;
190     if(i<6) kk = pad;
191     else{
192     j = (i-1)*NP_TRK + pad + 1;
193     if(pad<=2)
194     kk= 3+pad;
195     else
196     kk = pad-3;
197    
198     ss = "rot_";
199     rot_id = 50 + kk + (i-1)*NP_TRK + 1;
200     ss += rot_id;
201     (fctmap.find(rot_id - 50)->second)->fdy *=-1.;
202     (fctmap.find(rot_id - 50)->second)->fdz *=-1.;
203     //cout<<"kk+1="<<kk+1<<"j="<<j<<endl;
204     }
205     x = xp[pad] + (fctmap.find(rot_id - 50)->second)->fdx;
206     y = yp[pad] + (fctmap.find(rot_id - 50)->second)->fdy;
207     z = za + (fctmap.find(rot_id - 50)->second)->fdz;
208    
209     //cout<<"plane ="<<i<<" TRSL="<<j<<"x,y,z"<<x<<","<<y<<","<<z<<"RotName"<<ss<<endl;
210     GetVol( s )->AddNode(GetVol("TRSL"),j ,new TGeoCombiTrans( x,y,z, GetRot( ss )));
211     j++;
212     }
213    
214     GetVol( s )->AddNodeOverlap(GetVol("THBP"),1,new TGeoTranslation(-5.405,-7.0015,0.15E-01));
215     GetVol( s )->AddNodeOverlap(GetVol("THBP"),2,new TGeoTranslation(0.,-7.0015,0.15E-01));
216     GetVol( s )->AddNodeOverlap(GetVol("THBP"),3,new TGeoTranslation(5.405,-7.0015,0.15E-01));
217     GetVol( s )->AddNodeOverlap(GetVol("TPAI"),1,new TGeoTranslation(0.,-8.65,0.315));
218    
219     if(i<6){
220     s = "MGF";
221     s += i;
222     GetVol( s )->AddNode(GetVol("TPGU"),1,new TGeoTranslation(0.,-2.25,4.44));
223     }
224     }
225    
226     GetVol("SPEB")->AddNode(GetVol("TBAL"),1,new TGeoTranslation(5.4,-12.15,-22.25));
227     GetVol("SPEB")->AddNode(GetVol("TBAL"),2,new TGeoTranslation(-5.4,-12.15,-22.25));
228    
229    
230     SetMotherProp(GetVol("SPEB"),1,new TGeoTranslation(0.,0.,49.274));
231     };
232    
233     void PamVMCDetTrk::DefineCuts(){
234    
235     TString s ="ALUMINIUM"; // default GPAMELA parameters
236     if (GetMed(s) && !GetCC(s))
237     SetCC(s, new pCutControl(GetMedID(s), 0.0001, 0.001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
238     0.001, 0.01, 1., 1., 1., 0., 1., 1., 1., 4., 1., 1., 1., 1.));
239     s ="N2 GAS";
240     if (GetMed(s) && !GetCC(s))
241     SetCC(s, new pCutControl(GetMedID(s), 0.0001, 0.001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
242     0.001, 0.01, 1., 1., 1., 0., 0., 1., 1., 4., 1., 1., 2., 1.));
243     s = "IRONTR"; // default GPAMELA parameters
244     if (GetMed(s) && !GetCC(s))
245     SetCC(s, new pCutControl(GetMedID(s), 0.0001, 0.001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
246     0.001, 0.01, 1., 1., 1., 0., 1., 1., 1., 4., 1., 1., 1., 1.));
247     s = "SITRACKER";
248     if (GetMed(s) && !GetCC(s))
249     SetCC(s, new pCutControl(GetMedID(s), 0.0001, 0.001, 0.00001, 0.00001, 0.0001, 0.0001, 0.00001, 0.00001,
250     0.001, 0.01, 1., 1., 1., 0., 1., 1., 1., 1., 1., 1., 1., 2.));
251     s = "FIBER+RESIN";
252     if (GetMed(s) && !GetCC(s)) // default GPAMELA parameters
253     SetCC(s, new pCutControl(GetMedID(s), 0.0001, 0.001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
254     0.001, 0.01, 1., 1., 1., 0., 1., 1., 1., 1., 1., 1., 1., 1.));
255    
256     s = "G10C";
257     if (GetMed(s) && !GetCC(s))
258     SetCC(s, new pCutControl(GetMedID(s), 0.00001, 0.00001, 0.00001, 0.00001, 0.001, 0.001, 0.01, 0.00001,
259     0.00001, 0.01, 1., 1., 1., 0., 1., 1., 1., 1., 1., 1., 1., 2.));
260     }
261    
262     void PamVMCDetTrk::ReadPaddlesPos(){
263     //This method reads from file rotations and shifts of the paddles
264     //The format is: Omega, Beta, Gamma, dx, dy, dz
265    
266     cout<<"Loading POS files for TRK sensors..."<<endl;
267     ifstream fcfile;
268     TString PAM_VMC=gSystem->Getenv("PAM_VMC");
269     TString PLATFORM=gSystem->Getenv("PLATFORM");
270     TString PATH=PAM_VMC+"/lib/tgt_"+PLATFORM+"/parameters_l";
271     Int_t ls, ss;
272    
273     TMap rotshiftmap;
274    
275     for(Int_t ik = 1; ik<=NP_TRK; ik++){
276     TString filename = PATH;
277     if( ik < 4 ){
278     ls = ik;
279     ss = 2;
280     } else{
281     ls = ik-3;
282     ss = 1;
283     }
284     filename += ls;
285     filename += "s";
286     filename += ss;
287     filename += ".dat";
288     cout<<" loading: "<<filename<<endl;
289     fcfile.open(filename);
290     if(!fcfile){
291     cout<<" !!! ERROR, file "<<filename<<" is missed...exiting"<<endl;
292     exit(-1);
293     }
294     //reading from file, create structures and put them in array
295    
296     Double_t om, be, ga, dx, dy, dz;
297     for (Int_t ih = 1; ih <= NP_TRK; ih++){
298     fcfile >> om;
299     fcfile >> be;
300     fcfile >> ga;
301     fcfile >> dx;
302     fcfile >> dy;
303     fcfile >> dz;
304    
305     Int_t ii = (6-ih)*6 +ik;
306     fctmap[ii] = new pCombTrans( om, be, ga, dx, dy, dz );
307     }
308     fcfile.close();
309     }
310    
311     for (Int_t ij = 1; ij<=6; ij++){
312     dxflo[ij-1] = dyflo[ij-1] = 0.;
313     for (Int_t il = 1; il<=6; il++){
314     Int_t ii = (ij-1)*6+il;
315     dxflo[ij-1] += (fctmap.find(ii)->second)->fdx;
316     dyflo[ij-1] += (fctmap.find(ii)->second)->fdy;
317     }
318     dxflo[ij-1] /=6.;
319     dyflo[ij-1] /=6.;
320     }
321    
322     for (Int_t ij = 1; ij<=6; ij++){
323     for (Int_t il = 1; il<=6; il++){
324     Int_t ii = (ij-1)*6+il;
325     (fctmap.find(ii)->second)->fdx = ( (fctmap.find(ii)->second)->fdx - dxflo[ij-1] )*1.E-4;
326     (fctmap.find(ii)->second)->fdy = ( (fctmap.find(ii)->second)->fdy - dyflo[ij-1] )*1.E-4;
327     (fctmap.find(ii)->second)->fdz = ( (fctmap.find(ii)->second)->fdz - 100. )*1.E-4;
328     }
329     dxflo[ij-1] *= 1.E-4;
330     dyflo[ij-1] *= 1.E-4;
331     }
332    
333     for (Int_t ij = 1; ij<=6; ij++){
334     for (Int_t il = 1; il<=6; il++){
335     Int_t ii = (ij-1)*6+il;
336    
337     Double_t om_1 = (fctmap.find(ii)->second)->fomega * 1.E-6;
338     Double_t be_1 = (fctmap.find(ii)->second)->fbeta * 1.E-6;
339     Double_t ga_1 = (fctmap.find(ii)->second)->fgamma * 1.E-6;
340    
341     if(ij==6){
342     om_1 = -om_1;
343     ga_1 = -ga_1;
344     }
345    
346     TVector3 rot1(1.,om_1, -ga_1), rot2(-om_1,1.,be_1), rot3(ga_1,-be_1,1.);
347     Int_t rot_no = 50 + ii;
348     TString nmrot = "rot_";
349     nmrot += rot_no;
350    
351     AddRot(nmrot.Data(), new TGeoRotation( nmrot.Data(),
352     rot1.Theta()*RadToDeg(),rot1.Phi()*RadToDeg(),
353     rot2.Theta()*RadToDeg(),rot2.Phi()*RadToDeg(),
354     rot3.Theta()*RadToDeg(),rot3.Phi()*RadToDeg() ));
355     //cout<<"plno:"<<ij<<" padno:"<<il
356     // <<" t1:"<<rot1.Theta()*RadToDeg()<<" p1:"<<rot1.Phi()*RadToDeg()
357     // <<" t2:"<<rot2.Theta()*RadToDeg()<<" p2:"<<rot2.Phi()*RadToDeg()
358     // <<" t3:"<<rot3.Theta()*RadToDeg()<<" p3:"<<rot3.Phi()*RadToDeg() <<endl;
359     }
360     }
361     }
362    
363    

  ViewVC Help
Powered by ViewVC 1.1.23