]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv5.cxx
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / ITS / AliITSv5.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
a07ced09 18Revision 1.25 2000/10/05 20:50:00 nilsen
19Now using root generated streamers.
20
1ca7869b 21Revision 1.14.4.12 2000/10/02 16:04:03 barbera
22Forward declarations added
23
24Revision 1.22 2000/07/10 16:07:19 fca
25Release version of ITS code
26
855190cc 27Revision 1.14.4.4 2000/05/19 10:10:21 nilsen
28fix for bug with HP and Sun unix + fix for event display in ITS-working branch
fc0f0f90 29
30Revision 1.14.4.3 2000/03/04 23:46:38 nilsen
31Fixed up the comments/documentation.
32
33Revision 1.14.4.2 2000/03/02 21:53:02 nilsen
34To make it compatable with the changes in AliRun/AliModule.
35
36Revision 1.14.4.1 2000/01/12 19:03:33 nilsen
37This is the version of the files after the merging done in December 1999.
38See the ReadMe110100.txt file for details
39
b13db077 40Revision 1.14 1999/10/22 08:16:49 fca
41Correct destructors, thanks to I.Hrivnacova
42
5b8cc8df 43Revision 1.13 1999/10/06 10:15:19 fca
44Correct bug in allocation of layer name and add destructor
45
1ef401ff 46Revision 1.12 1999/10/05 08:05:09 fca
47Minor corrections for uninitialised variables.
48
593d2ea1 49Revision 1.11 1999/09/29 09:24:20 fca
50Introduction of the Copyright and cvs Log
51
4c039060 52*/
53
fe4da5cc 54///////////////////////////////////////////////////////////////////////////////
fc0f0f90 55//
56// Inner Traking System version 5
57// This class contains the base procedures for the Inner Tracking System
58//
58005f18 59// Authors: R. Barbera, B. S. Nilsen.
60// version 5.
61// Created September 17 1999.
fc0f0f90 62//
fe4da5cc 63///////////////////////////////////////////////////////////////////////////////
64
fc0f0f90 65// See AliITSv5::StepManager().
66#define ALIITSPRINTGEOM 0 // default. don't print out gemetry information
67//#define ALIITSPRINTGEOM 1 // print out geometry information
68
58005f18 69#include <stdio.h>
70#include <stdlib.h>
fe4da5cc 71#include <TMath.h>
c9a71be1 72#include <TGeometry.h>
73#include <TNode.h>
74#include <TTUBE.h>
855190cc 75#include <TFile.h> // only required for Tracking function?
76#include <TCanvas.h>
77#include <TObjArray.h>
a07ced09 78#include <TLorentzVector.h>
f7f0c278 79#include <TObjString.h>
855190cc 80#include <TClonesArray.h>
1ca7869b 81#include <TBRIK.h>
f7f0c278 82#include <TSystem.h>
58005f18 83
94de3818 84#include "AliMC.h"
f7f0c278 85#include "AliRun.h"
fc0f0f90 86#if ALIITSPRINTGEOM==1
87#include "../TGeant3/TGeant3.h"
88#endif
58005f18 89#include "AliITShit.h"
90#include "AliITS.h"
91#include "AliITSv5.h"
92#include "AliITSgeom.h"
fe4da5cc 93
94ClassImp(AliITSv5)
95
96//_____________________________________________________________________________
e8189707 97AliITSv5::AliITSv5() {
fc0f0f90 98////////////////////////////////////////////////////////////////////////
99// Standard default constructor for the ITS version 5.
100////////////////////////////////////////////////////////////////////////
481937a6 101
f7f0c278 102 fIdN = 0;
103 fIdName = 0;
104 fIdSens = 0;
e8189707 105 fMajorVersion = 5;
f7f0c278 106 fMinorVersion = -1;
fe4da5cc 107}
855190cc 108//____________________________________________________________________________
109AliITSv5::AliITSv5(const AliITSv5 &source){
110////////////////////////////////////////////////////////////////////////
111// Copy Constructor for ITS version 5.
112////////////////////////////////////////////////////////////////////////
113 if(&source == this) return;
e8189707 114 printf("Not allowed to copy AliITSv5\n");
481937a6 115 return;
855190cc 116}
117//_____________________________________________________________________________
118AliITSv5& AliITSv5::operator=(const AliITSv5 &source){
119////////////////////////////////////////////////////////////////////////
120// Assignment operator for the ITS version 1.
121////////////////////////////////////////////////////////////////////////
e8189707 122
123 if(&source == this) return *this;
124 printf("Not allowed to copy AliITSv3\n");
125 return *this;
126
855190cc 127}
fe4da5cc 128//_____________________________________________________________________________
1ef401ff 129AliITSv5::~AliITSv5() {
fc0f0f90 130////////////////////////////////////////////////////////////////////////
131// Standard destructor for the ITS version 5.
132////////////////////////////////////////////////////////////////////////
1ef401ff 133}
134//_____________________________________________________________________________
58005f18 135AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
fc0f0f90 136////////////////////////////////////////////////////////////////////////
137// Standard constructor for the ITS version 5.
138////////////////////////////////////////////////////////////////////////
f7f0c278 139 fIdN = 6;
140/*
141// TObjArray of TObjStrings
142 fIdName = new TObjArray(fIdN);
143 fIdName->AddAt(new TObjString("ITS1"),0);
144 fIdName->AddAt(new TObjString("ITS2"),1);
145 fIdName->AddAt(new TObjString("ITS3"),2);
146 fIdName->AddAt(new TObjString("ITS4"),3);
147 fIdName->AddAt(new TObjString("ITS5"),4);
148 fIdName->AddAt(new TObjString("ITS6"),5);
149*/
150// Array of TStrings.
151 fIdName = new TString[fIdN];
e8189707 152 fIdName[0] = "ITS1";
153 fIdName[1] = "ITS2";
154 fIdName[2] = "ITS3";
155 fIdName[3] = "ITS4";
156 fIdName[4] = "ITS5";
157 fIdName[5] = "ITS6";
158 fIdSens = new Int_t[fIdN];
f7f0c278 159 for (Int_t i=0;i<fIdN;i++) fIdSens[i] = 0;
e8189707 160 fMajorVersion = 5;
f7f0c278 161 fMinorVersion = 1;
58005f18 162
163 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
164 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
c9a71be1 165}
166//_____________________________________________________________________________
167void AliITSv5::BuildGeometry(){
855190cc 168////////////////////////////////////////////////////////////////////////
169// Geometry builder for the ITS version 5.
170////////////////////////////////////////////////////////////////////////
c9a71be1 171 //
172 // Build ITS TNODE geometry for event display using detailed geometry.
173 // This function builds a simple ITS geometry used by the ROOT macro
174 // ITSdisplay.C.
175
855190cc 176 TNode *top;
c9a71be1 177 TNode *nd;
e8189707 178 //const int kColorITSSPD=kRed;
179 //const int kColorITSSDD=kGreen;
180 const int kColorITSSSD=kBlue;
c9a71be1 181 //
855190cc 182 top=gAlice->GetGeometry()->GetNode("alice");
c9a71be1 183 AliITSgeom *gm = this->GetITSgeom();
184
24314ecd 185 Int_t lay,lad,det,i;
c9a71be1 186 Text_t name[10];
187 Float_t xg[3];
188 Float_t rt[9];
189 Double_t rtd[9];
190 TBRIK *box;
191 TRotMatrix *rm;
192 //TCanvas *c1 = new TCanvas("c1","ITS");
193
24314ecd 194 for(lay=1;lay<=2;lay++)
195 for(lad=1;lad<=gm->GetNladders(lay);lad++)
196 for(det=1;det<=gm->GetNdetectors(lay);det++){
c9a71be1 197 try {
198 box = new TBRIK ("ActiveSPD","Active volume of SPD","SPD SI DET",
199 0.64,0.0075,4.19);
200 } catch (...) {
201 cout << "EXCEPTION in box = new TBRIK" << endl;
202 return;
203 }
204 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
205 gm->GetRotMatrix(lay,lad,det,rt);
206 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
ca9d4947 207 for(i=0;i<9;i++) rtd[i] = rt[i];
c9a71be1 208 try {
209 rm = new TRotMatrix(name,name,rtd);
210 } catch (...) {
211 cout << "EXCEPTION in new TRotMatrix" << endl;
212 return;
213 }
855190cc 214 top->cd();
c9a71be1 215 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
216 try {
217 nd = new TNode("SPD"," ",box,xg[0],xg[1],xg[2],rm);
218 } catch (...) {
219 cout << "EXCEPTION in new TNode" << endl;
220 return;
221 }
855190cc 222 nd->SetLineColor(kColorITSSSD);
c9a71be1 223 fNodes->Add(nd);
224 }
225
24314ecd 226 for(lay=3;lay<=3;lay++)
227 for(lad=1;lad<=gm->GetNladders(lay);lad++)
228 for(det=1;det<=gm->GetNdetectors(lay);det++){
c9a71be1 229 try {
230 box = new TBRIK ("ActiveSDD","Active volume of SDD","SDD SI DET",
231 3.5,0.014,3.763);
232 } catch (...) {
233 cout << "EXCEPTION in box = new TBRIK" << endl;
234 return;
235 }
236 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
237 gm->GetRotMatrix(lay,lad,det,rt);
238 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
ca9d4947 239 for(i=0;i<9;i++) rtd[i] = rt[i];
c9a71be1 240 try {
241 rm = new TRotMatrix(name,name,rtd);
242 } catch (...) {
243 cout << "EXCEPTION in new TRotMatrix" << endl;
244 return;
245 }
855190cc 246 top->cd();
c9a71be1 247 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
248 try {
249 nd = new TNode("SDD"," ",box,xg[0],xg[1],xg[2],rm);
250 } catch (...) {
251 cout << "EXCEPTION in new TNode" << endl;
252 return;
253 }
855190cc 254 nd->SetLineColor(kColorITSSSD);
c9a71be1 255 fNodes->Add(nd);
256 }
257
24314ecd 258 for(lay=4;lay<=4;lay++)
259 for(lad=1;lad<=gm->GetNladders(lay);lad++)
260 for(det=1;det<=gm->GetNdetectors(lay);det++){
c9a71be1 261 try {
262 box = new TBRIK ("ActiveSDD","Active volume of SDD","SDD SI DET",
263 3.5,0.014,3.763);
264 } catch (...) {
265 cout << "EXCEPTION in box = new TBRIK" << endl;
266 return;
267 }
268 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
269 gm->GetRotMatrix(lay,lad,det,rt);
270 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
ca9d4947 271 for(i=0;i<9;i++) rtd[i] = rt[i];
c9a71be1 272 try {
273 rm = new TRotMatrix(name,name,rtd);
274 } catch (...) {
275 cout << "EXCEPTION in new TRotMatrix" << endl;
276 return;
277 }
855190cc 278 top->cd();
c9a71be1 279 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
280 try {
281 nd = new TNode("SDD"," ",box,xg[0],xg[1],xg[2],rm);
282 } catch (...) {
283 cout << "EXCEPTION in new TNode" << endl;
284 return;
285 }
855190cc 286 nd->SetLineColor(kColorITSSSD);
c9a71be1 287 fNodes->Add(nd);
288 }
24314ecd 289 for(lay=5;lay<=5;lay++)
290 for(lad=1;lad<=gm->GetNladders(lay);lad++)
291 for(det=1;det<=gm->GetNdetectors(lay);det++){
c9a71be1 292 try {
293 box = new TBRIK ("ActiveSSD","Active volume of SSD","SSD SI DET",
294 3.65,0.015,2.0);
295 } catch (...) {
296 cout << "EXCEPTION in box = new TBRIK" << endl;
297 return;
298 }
299 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
300 gm->GetRotMatrix(lay,lad,det,rt);
301 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
ca9d4947 302 for(i=0;i<9;i++) rtd[i] = rt[i];
c9a71be1 303 try {
304 rm = new TRotMatrix(name,name,rtd);
305 } catch (...) {
306 cout << "EXCEPTION in new TRotMatrix" << endl;
307 return;
308 }
855190cc 309 top->cd();
c9a71be1 310 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
311 try {
312 nd = new TNode("SSD"," ",box,xg[0],xg[1],xg[2],rm);
313 } catch (...) {
314 cout << "EXCEPTION in new TNode" << endl;
315 return;
316 }
855190cc 317 nd->SetLineColor(kColorITSSSD);
c9a71be1 318 fNodes->Add(nd);
319 }
320
24314ecd 321 for(lay=6;lay<=6;lay++)
322 for(lad=1;lad<=gm->GetNladders(lay);lad++)
323 for(det=1;det<=gm->GetNdetectors(lay);det++){
c9a71be1 324 try {
325 box = new TBRIK ("ActiveSSD","Active volume of SSD","SSD SI DET",
326 3.65,0.015,2.0);
327 } catch (...) {
328 cout << "EXCEPTION in box = new TBRIK" << endl;
329 return;
330 }
331
332 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
333 gm->GetRotMatrix(lay,lad,det,rt);
334 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
24314ecd 335 for(i=0;i<9;i++) rtd[i] = rt[i];
c9a71be1 336 try {
337 rm = new TRotMatrix(name,name,rtd);
338 } catch (...) {
339 cout << "EXCEPTION in new TRotMatrix" << endl;
340 return;
341 }
855190cc 342 top->cd();
c9a71be1 343 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
344 try {
345 nd = new TNode("SSD"," ",box,xg[0],xg[1],xg[2],rm);
346 } catch (...) {
347 cout << "EXCEPTION in new TNode" << endl;
348 return;
349 }
855190cc 350 nd->SetLineColor(kColorITSSSD);
c9a71be1 351 fNodes->Add(nd);
352 }
353
354
855190cc 355}
fe4da5cc 356//_____________________________________________________________________________
58005f18 357void AliITSv5::CreateMaterials(){
fc0f0f90 358////////////////////////////////////////////////////////////////////////
359// Read a file containing the materials for the ITS version 5.
360////////////////////////////////////////////////////////////////////////
58005f18 361 char *filtmp;
fc0f0f90 362
58005f18 363 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
fc0f0f90 364
1808a5a2 365 FILE *file = fopen(filtmp,"r");
fe4da5cc 366 if(file) {
367 fclose(file);
b13db077 368 ReadEuclidMedia(filtmp);
fe4da5cc 369 } else {
fc0f0f90 370 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",filtmp);
fe4da5cc 371 exit(1);
58005f18 372 } // end if(file)
fe4da5cc 373}
fe4da5cc 374//_____________________________________________________________________________
58005f18 375void AliITSv5::CreateGeometry(){
376//////////////////////////////////////////////////////////////////////
377// This is the geometry used for the ITS Pre-TDR and comes from an
378// Euclid to Geant conversion. The only difference
379// is in the details of the ITS supports. The detectors elements,
380// detector numbering, and local and global reference frames are shown in
381// the following figures.
382//Begin_Html
383/*
a92b2b7d 384<img src="picts/ITS/its1+2_convention_front_5.gif">
58005f18 385</pre>
386<br clear=left>
387<font size=+2 color=red>
388<p>This shows the front view of the SPDs.
389</font>
390<pre>
a92b2b7d 391<img src="picts/ITS/its1+2_convention_side_5.gif">
58005f18 392</pre>
393<br clear=left>
394<font size=+2 color=red>
395<p>This shows the perspective view of the SPDs.
396</font>
a92b2b7d 397<img src="picts/ITS/its1+2_tree.gif">
58005f18 398</pre>
399<br clear=left>
400<font size=+2 color=red>
401<p>This shows the geometry Tree for the SPDs.
402</font>
403<pre>
404
405<pre>
a92b2b7d 406<img src="picts/ITS/its3+4_convention_front_5.gif">
58005f18 407</pre>
408<br clear=left>
409<font size=+2 color=red>
410<p>This shows the front view of the SDDs.
411</font>
412<pre>
a92b2b7d 413<img src="picts/ITS/its3+4_convention_side_5.gif">
58005f18 414</pre>
415<br clear=left>
416<font size=+2 color=red>
417<p>This shows the perspective view of the SDDs.
418</font>
a92b2b7d 419<img src="picts/ITS/its3+4_tree.gif">
58005f18 420</pre>
421<br clear=left>
422<font size=+2 color=red>
423<p>This shows the geometry Tree for the SDDs.
424</font>
425<pre>
fe4da5cc 426
58005f18 427<pre>
a92b2b7d 428<img src="picts/ITS/its5+6_convention_front_5.gif">
58005f18 429</pre>
430<br clear=left>
431<font size=+2 color=red>
432<p>This shows the front view of the SSDs.
433</font>
434<pre>
a92b2b7d 435<img src="picts/ITS/its5+6_convention_side_5.gif">
58005f18 436</pre>
437<br clear=left>
438<font size=+2 color=red>
439<p>This shows the perspective view of the SSDs.
440</font>
441<pre>
a92b2b7d 442<img src="picts/ITS/its5+6_tree.gif">
58005f18 443</pre>
444<br clear=left>
445<font size=+2 color=red>
446<p>This shows the geometry Tree for the SSDs.
447</font>
448<pre>
449
450
a92b2b7d 451<img src="picts/ITS/its_layer1-6_2.gif">
58005f18 452</pre>
453<br clear=left>
454<font size=+2 color=red>
455<p>This shows the front view of the whole ITS..
456</font>
457<pre>
458
a92b2b7d 459<img src="picts/ITS/its_layer1-6_1.gif">
58005f18 460</pre>
461<br clear=left>
462<font size=+2 color=red>
463<p>This shows the perspective view of the whole ITS..
464</font>
465<pre>
466
a92b2b7d 467<img src="picts/ITS/its1-6_tree.gif">
58005f18 468</pre>
469<br clear=left>
470<font size=+2 color=red>
471<p>This shows the geometry Tree for the whole ITS.
472</font>
473<pre>
474*/
475//End_Html
476//
fe4da5cc 477//
58005f18 478// Here are shown the details of the ITS support cones and services.
479// First is a GEANT tree showing the organization of all of the volumes
480// that make up the ITS supports and services.
481//Begin_Html
482/*
a92b2b7d 483<img src="picts/ITS/supports_tree.gif">
58005f18 484 */
485//End_Html
486// What follows are a number of figures showing what these support
487// structures look like.
488//Begin_Html
489/*
490
a92b2b7d 491<img src="picts/ITS/supports_3.gif">
58005f18 492</pre>
493<br clear=left>
494<font size=+2 color=red>
495<p>This shows the geometry of the supports for the Drift and Strip layers only.
496</font>
497<pre>
498
a92b2b7d 499<img src="picts/ITS/supports_2.gif">
58005f18 500</pre>
501<br clear=left>
502<font size=+2 color=red>
503<p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
504</font>
505<pre>
506
a92b2b7d 507<img src="picts/ITS/supports_1.gif">
58005f18 508</pre>
509<br clear=left>
510<font size=+2 color=red>
511<p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
512</font>
513<pre>
514
a92b2b7d 515<img src="picts/ITS/suppssd.gif">
58005f18 516</pre>
517<br clear=left>
518<font size=+2 color=red>
519<p>This shows the geometry for the Strip layers supports.
520</font>
521<pre>
522
a92b2b7d 523<img src="picts/ITS/suppsdd.gif">
58005f18 524</pre>
525<br clear=left>
526<font size=+2 color=red>
527<p>This shows the geometry for the Drift layers supports.
528</font>
529<pre>
530 */
531//End_Html
58005f18 532//
fc0f0f90 533// Read a file containing the geometry for the ITS version 5.
534////////////////////////////////////////////////////////////////////////
58005f18 535
536 Int_t size;
537 char topvol[5];
538 char *filtmp;
fc0f0f90 539
58005f18 540 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
fe4da5cc 541 FILE *file = fopen(filtmp,"r");
542 delete [] filtmp;
543 if(file) {
544 fclose(file);
58005f18 545 printf("Ready to read Euclid geometry file\n");
b13db077 546 ReadEuclid(fEuclidGeometry.Data(),topvol);
58005f18 547 printf("Read in euclid geometries\n");
fe4da5cc 548 } else {
58005f18 549 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
550 fEuclidGeometry.Data());
fe4da5cc 551 exit(1);
58005f18 552 } // end if(file)
fe4da5cc 553 //
fc0f0f90 554 // Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
555 // invisible
fe4da5cc 556 //
cfce8870 557 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
fe4da5cc 558 //
fc0f0f90 559 // Outputs the geometry tree in the EUCLID/CAD format if requested to do so
fe4da5cc 560
561 if (fEuclidOut) {
cfce8870 562 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
58005f18 563 } // end if (fEuclidOut)
564
fc0f0f90 565 // read in the file containing the transformations for the active
566 // volumes for the ITS version 5. This is expected to be in a file
567 // ending in .det. This geometry is kept in the AliITSgeom class.
58005f18 568 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
569 size = strlen(filtmp);
570 if(size>4){
571 filtmp[size-3] = 'd'; // change from .euc to .det
572 filtmp[size-2] = 'e';
573 filtmp[size-1] = 't';
574 file = fopen(filtmp,"r");
575 if(file){ // if file exists use it to fill AliITSgeom structure.
576 fclose(file);
577 printf("ready to read .det file %s\n",filtmp);
578 fITSgeom = new AliITSgeom(filtmp);
579 }else{
580 fITSgeom = 0;
581 // fill AliITSgeom structure from geant structure just filled above
582 }// end if(file)
583 delete [] filtmp;
584 }// end if(size>4)
585 printf("finished with euclid geometrys\n");
fe4da5cc 586}
fe4da5cc 587//_____________________________________________________________________________
58005f18 588void AliITSv5::Init(){
fc0f0f90 589////////////////////////////////////////////////////////////////////////
590// Initialise the ITS after it has been created.
591////////////////////////////////////////////////////////////////////////
58005f18 592
593 AliITS::Init();
c9a71be1 594 fMajorVersion = 5;
595 fMinorVersion = 0;
fe4da5cc 596}
fe4da5cc 597//_____________________________________________________________________________
58005f18 598void AliITSv5::StepManager(){
fc0f0f90 599////////////////////////////////////////////////////////////////////////
600// Called for every step in the ITS, then calles the AliITShit class
601// creator with the information to be recoreded about that hit.
602// The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
603// printing of information to a file which can be used to create a .det
604// file read in by the routine CreateGeometry(). If set to 0 or any other
605// value except 1, the default behavior, then no such file is created nor
606// it the extra variables and the like used in the printing allocated.
607////////////////////////////////////////////////////////////////////////
58005f18 608 Int_t copy, id;
609 Int_t copy1,copy2;
610 Float_t hits[8];
611 Int_t vol[4];
0a6d8768 612 TLorentzVector position, momentum;
58005f18 613 TClonesArray &lhits = *fHits;
fc0f0f90 614#if ALIITSPRINTGEOM==1
615 FILE *fp;
616 Int_t i;
617 Float_t xl[3],xt[3],angl[6];
618// Float_t par[20],att[20];
619 Float_t mat[9];
620 static Bool_t first=kTRUE,printit[6][50][50];
621 if(first){ for(copy1=0;copy1<6;copy1++)for(copy2=0;copy2<50;copy2++)
622 for(id=0;id<50;id++) printit[copy1][copy2][id] = kTRUE;
623 first = kFALSE;
624 }
625 // end if first
626#endif
fe4da5cc 627 //
58005f18 628 // Track status
629 vol[3] = 0;
630 if(gMC->IsTrackInside()) vol[3] += 1;
631 if(gMC->IsTrackEntering()) vol[3] += 2;
632 if(gMC->IsTrackExiting()) vol[3] += 4;
633 if(gMC->IsTrackOut()) vol[3] += 8;
634 if(gMC->IsTrackDisappeared()) vol[3] += 16;
635 if(gMC->IsTrackStop()) vol[3] += 32;
636 if(gMC->IsTrackAlive()) vol[3] += 64;
637 //
638 // Fill hit structure.
639 if(!(gMC->TrackCharge())) return;
640 //
641 // Only entering charged tracks
642 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
643 vol[0] = 1;
644 id = gMC->CurrentVolOffID(0,copy);
645 //detector copy in the ladder = 1<->4 (ITS1)
646 vol[1] = copy;
647 gMC->CurrentVolOffID(1,copy1);
648 //ladder copy in the module = 1<->2 (I186)
649 gMC->CurrentVolOffID(2,copy2);
650 //module copy in the layer = 1<->10 (I132)
651 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
652 } else if(id == fIdSens[1]){
653 vol[0] = 2;
654 id = gMC->CurrentVolOffID(0,copy);
655 //detector copy in the ladder = 1<->4 (ITS2)
656 vol[1] = copy;
657 gMC->CurrentVolOffID(1,copy1);
658 //ladder copy in the module = 1<->4 (I131)
659 gMC->CurrentVolOffID(2,copy2);
660 //module copy in the layer = 1<->10 (I132)
661 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
662 } else if(id == fIdSens[2]){
663 vol[0] = 3;
664 id = gMC->CurrentVolOffID(1,copy);
665 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
666 vol[1] = copy;
667 id = gMC->CurrentVolOffID(2,copy);
668 //ladder copy in the layer = 1<->12 (I316)
669 vol[2] = copy;
670 } else if(id == fIdSens[3]){
671 vol[0] = 4;
672 id = gMC->CurrentVolOffID(1,copy);
673 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
674 vol[1] = copy;
675 id = gMC->CurrentVolOffID(2,copy);
676 //ladder copy in the layer = 1<->22 (I417)
677 vol[2] = copy;
678 }else if(id == fIdSens[4]){
679 vol[0] = 5;
680 id = gMC->CurrentVolOffID(1,copy);
681 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
682 vol[1] = copy;
683 id = gMC->CurrentVolOffID(2,copy);
684 //ladder copy in the layer = 1<->34 (I565)
685 vol[2] = copy;
686 }else if(id == fIdSens[5]){
687 vol[0] = 6;
688 id = gMC->CurrentVolOffID(1,copy);
689 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
690 vol[1] = copy;
691 id = gMC->CurrentVolOffID(2,copy);
692 //ladder copy in the layer = 1<->38 (I569)
693 vol[2] = copy;
694 } else {
695 return; // not an ITS volume?
696 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
697//
698 gMC->TrackPosition(position);
699 gMC->TrackMomentum(momentum);
700 hits[0]=position[0];
701 hits[1]=position[1];
702 hits[2]=position[2];
703 hits[3]=momentum[0];
704 hits[4]=momentum[1];
705 hits[5]=momentum[2];
706 hits[6]=gMC->Edep();
707 hits[7]=gMC->TrackTime();
708 // Fill hit structure with this new hit.
709 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
fc0f0f90 710#if ALIITSPRINTGEOM==1
711 if(printit[vol[0]][vol[2]][vol[1]]){
712 printit[vol[0]][vol[2]][vol[1]] = kFALSE;
713 xl[0] = xl[1] = xl[2] = 0.0;
714 gMC->Gdtom(xl,xt,1);
715 for(i=0;i<9;i++) mat[i] = 0.0;
716 mat[0] = mat[4] = mat[8] = 1.0; // default with identity matrix
717 xl[0] = 1.0;
718 xl[1] = xl[2] =0.0;
719 gMC->Gdtom(xl,&(mat[0]),2);
720 xl[1] = 1.0;
721 xl[0] = xl[2] =0.0;
722 gMC->Gdtom(xl,&(mat[3]),2);
723 xl[2] = 1.0;
724 xl[1] = xl[0] =0.0;
725 gMC->Gdtom(xl,&(mat[6]),2);
726
727 angl[0] = TMath::ACos(mat[2]);
728 if(mat[2]==1.0) angl[0] = 0.0;
729 angl[1] = TMath::ATan2(mat[1],mat[0]);
730 if(angl[1]<0.0) angl[1] += 2.0*TMath::Pi();
731
732 angl[2] = TMath::ACos(mat[5]);
733 if(mat[5]==1.0) angl[2] = 0.0;
734 angl[3] = TMath::ATan2(mat[4],mat[3]);
735 if(angl[3]<0.0) angl[3] += 2.0*TMath::Pi();
736
737 angl[4] = TMath::ACos(mat[8]);
738 if(mat[8]==1.0) angl[4] = 0.0;
739 angl[5] = TMath::ATan2(mat[7],mat[6]);
740 if(angl[5]<0.0) angl[5] += 2.0*TMath::Pi();
741
742 for(i=0;i<6;i++) angl[i] *= 180.0/TMath::Pi(); // degrees
743 fp = fopen("ITSgeometry_v5.det","a");
744 fprintf(fp,"%2d %2d %2d %9e %9e %9e %9e %9e %9e %9e %9e %9e ",
745 vol[0],vol[2],vol[1], // layer ladder detector
746 xt[0],xt[1],xt[2], // Translation vector
747 angl[0],angl[1],angl[2],angl[3],angl[4],angl[5] // Geant rotaion
748 // angles (degrees)
749 );
750 fprintf(fp,"%9e %9e %9e %9e %9e %9e %9e %9e %9e",
751 mat[0],mat[1],mat[2],mat[3],mat[4],mat[5],mat[6],mat[7],mat[8]
752 ); // Adding the rotation matrix.
753 fprintf(fp,"\n");
754 fclose(fp);
755 } // end if printit[layer][ladder][detector]
756#endif
58005f18 757 return;
fe4da5cc 758}
f7f0c278 759/*
58005f18 760//____________________________________________________________________________
fc0f0f90 761void AliITSv5::Streamer(TBuffer &R__b){
762////////////////////////////////////////////////////////////////////////
763// A dummy Streamer function for this class AliITSv5. By default it
764// only streams the AliITS class as it is required. Since this class
765// dosen't contain any "real" data to be saved, it doesn't.
766////////////////////////////////////////////////////////////////////////
855190cc 767
58005f18 768 if (R__b.IsReading()) {
fc0f0f90 769 Version_t R__v = R__b.ReadVersion();
770 if (R__v==1) {
771 AliITS::Streamer(R__b);
fc0f0f90 772 }else{
e8189707 773 AliITS::Streamer(R__b);
fc0f0f90 774 } // end if R__v==1
58005f18 775 } else {
776 R__b.WriteVersion(AliITSv5::IsA());
777 AliITS::Streamer(R__b);
fc0f0f90 778 } // end if R__b.IsReading()
58005f18 779}
a07ced09 780*/