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