1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.1.2.8 2000/10/05 20:28:18 nilsen
19 Now using root generated streamer function.
21 Revision 1.1.2.7 2000/07/31 13:51:22 barbera
22 Updated from the release
24 Revision 1.2 2000/07/10 16:07:19 fca
25 Release version of ITS code
27 Revision 1.1.2.2 2000/03/02 21:53:36 nilsen
28 to make it compatable with the changes in AliRun/AliModule.
30 Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
31 The changes made with this latest inclusion of code is very large.
32 Many of the new files were added just in December when P. Cerello added his
33 SDD simulations to the distrobutions. Also added are some file of P. Skowronski
34 for SSD cluster finding and ghost RecPoints. None of this "new" code has been
35 proporly tested. Other code new to this cvs repository is explained in the
36 ITS Off-line web page. In general the changes are too large to give a resonable
37 discription of them but probably should be taken as the starting point for
38 the developement branch (ITS-working).
41 Revision 1.13 1999/10/16 19:49:00 BSN
47 ///////////////////////////////////////////////////////////////////////////////
49 // Inner Traking System version Test //
50 // This class contains the base procedures for the Inner Tracking System //
52 // Authors: R. Barbera, B. S. Nilsen. //
54 // Created October 16 1999. //
56 ///////////////////////////////////////////////////////////////////////////////
60 #include <TGeometry.h>
63 #include <TFile.h> // only required for Tracking function?
65 #include <TObjArray.h>
66 #include <TObjString.h>
67 #include <TClonesArray.h>
68 #include <TLorentzVector.h>
74 #include "AliITShit.h"
76 #include "AliITSvtest.h"
77 #include "AliITSgeom.h"
81 //_____________________________________________________________________________
82 AliITSvtest::AliITSvtest() {
84 // Standard constructor for the ITS
92 //____________________________________________________________________________
93 AliITSvtest::AliITSvtest(const AliITSvtest &source){
94 ////////////////////////////////////////////////////////////////////////
95 // Copy Constructor for ITS test version.
96 ////////////////////////////////////////////////////////////////////////
97 if(&source == this) return;
98 printf("Not allowed to copy AliITSvtest\n");
101 //_____________________________________________________________________________
102 AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
103 ////////////////////////////////////////////////////////////////////////
104 // Assignment operator for the ITS version 1.
105 ////////////////////////////////////////////////////////////////////////
106 if(&source == this) return *this;
107 printf("Not allowed to copy AliITSvtest\n");
110 //_____________________________________________________________________________
111 AliITSvtest::~AliITSvtest() {
113 // Standard destructor for the ITS
116 //_____________________________________________________________________________
117 AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
118 const char *name, const char *title)
119 : AliITS(name, title){
121 // Standard constructor for the ITS
125 // TObjArray of TObjStrings
126 fIdName = new TObjArray(fIdN);
127 fIdName->AddAt(new TObjString("ITS1"),0);
128 fIdName->AddAt(new TObjString("ITS2"),1);
129 fIdName->AddAt(new TObjString("ITS3"),2);
130 fIdName->AddAt(new TObjString("ITS4"),3);
131 fIdName->AddAt(new TObjString("ITS5"),4);
132 fIdName->AddAt(new TObjString("ITS6"),5);
134 // Array of TStrings.
135 fIdName = new TString[fIdN];
142 fIdSens = new Int_t[fIdN];
143 for (Int_t i=0;i<fIdN;i++) fIdSens[i] = 0;
147 fEuclidMaterial = filetme;
148 fEuclidGeometry = fileeuc;
149 // The .det file for the geometry must have the same name as fileeuc with
150 // .euc replaced by .det.
154 //_____________________________________________________________________________
155 void AliITSvtest::CreateMaterials(){
157 // Read materials for the ITS
161 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
162 // FILE *file = fopen(fEuclidMaterial.Data(),"r");
163 FILE *file = fopen(filtmp,"r");
166 // ReadEuclidMedia(fEuclidMaterial.Data(),this);
167 ReadEuclidMedia(filtmp);
169 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
170 // fEuclidMaterial.Data());
176 //_____________________________________________________________________________
177 void AliITSvtest::CreateGeometry(){
178 //////////////////////////////////////////////////////////////////////
179 ////////////////////////////////////////////////////////////////////////
180 // Read geometry for the ITS
187 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
188 FILE *file = fopen(filtmp,"r");
192 printf("Ready to read Euclid geometry file\n");
193 ReadEuclid(fEuclidGeometry.Data(),topvol);
194 printf("Read in euclid geometries\n");
196 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
197 fEuclidGeometry.Data());
201 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
204 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
206 //---Outputs the geometry tree in the EUCLID/CAD format
209 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
210 } // end if (fEuclidOut)
212 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
213 size = strlen(filtmp);
215 filtmp[size-3] = 'd'; // change from .euc to .det
216 filtmp[size-2] = 'e';
217 filtmp[size-1] = 't';
218 file = fopen(filtmp,"r");
219 if(file){ // if file exists use it to fill AliITSgeom structure.
221 printf("ready to read .det file %s\n",filtmp);
222 fITSgeom = new AliITSgeom(filtmp);
225 // fill AliITSgeom structure from geant structure just filled above
229 printf("finished with euclid geometrys\n");
232 //_____________________________________________________________________________
233 void AliITSvtest::Init(){
235 // Initialise the ITS after it has been created
242 //_____________________________________________________________________________
243 void AliITSvtest::StepManager(){
245 // Called for every step in the ITS
251 TLorentzVector position, momentum;
252 TClonesArray &lhits = *fHits;
256 if(gMC->IsTrackInside()) vol[3] += 1;
257 if(gMC->IsTrackEntering()) vol[3] += 2;
258 if(gMC->IsTrackExiting()) vol[3] += 4;
259 if(gMC->IsTrackOut()) vol[3] += 8;
260 if(gMC->IsTrackDisappeared()) vol[3] += 16;
261 if(gMC->IsTrackStop()) vol[3] += 32;
262 if(gMC->IsTrackAlive()) vol[3] += 64;
264 // Fill hit structure.
265 if(!(gMC->TrackCharge())) return;
267 // Only entering charged tracks
268 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
270 id = gMC->CurrentVolOffID(0,copy);
271 //detector copy in the ladder = 1<->4 (ITS1)
273 gMC->CurrentVolOffID(1,copy1);
274 //ladder copy in the module = 1<->2 (I186)
275 gMC->CurrentVolOffID(2,copy2);
276 //module copy in the layer = 1<->10 (I132)
277 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
278 } else if(id == fIdSens[1]){
280 id = gMC->CurrentVolOffID(0,copy);
281 //detector copy in the ladder = 1<->4 (ITS2)
283 gMC->CurrentVolOffID(1,copy1);
284 //ladder copy in the module = 1<->4 (I131)
285 gMC->CurrentVolOffID(2,copy2);
286 //module copy in the layer = 1<->10 (I132)
287 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
288 } else if(id == fIdSens[2]){
290 id = gMC->CurrentVolOffID(1,copy);
291 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
293 id = gMC->CurrentVolOffID(2,copy);
294 //ladder copy in the layer = 1<->12 (I316)
296 } else if(id == fIdSens[3]){
298 id = gMC->CurrentVolOffID(1,copy);
299 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
301 id = gMC->CurrentVolOffID(2,copy);
302 //ladder copy in the layer = 1<->22 (I417)
304 }else if(id == fIdSens[4]){
306 id = gMC->CurrentVolOffID(1,copy);
307 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
309 id = gMC->CurrentVolOffID(2,copy);
310 //ladder copy in the layer = 1<->34 (I565)
312 }else if(id == fIdSens[5]){
314 id = gMC->CurrentVolOffID(1,copy);
315 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
317 id = gMC->CurrentVolOffID(2,copy);
318 //ladder copy in the layer = 1<->38 (I569)
321 return; // not an ITS volume?
322 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
324 gMC->TrackPosition(position);
325 gMC->TrackMomentum(momentum);
333 hits[7]=gMC->TrackTime();
334 // Fill hit structure with this new hit.
335 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
339 //____________________________________________________________________________
340 void AliITSvtest::Streamer(TBuffer &R__b)
342 // Stream an object of class AliITSvtest.
344 if (R__b.IsReading()) {
345 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
346 AliITS::Streamer(R__b);
348 R__b.WriteVersion(AliITSvtest::IsA());
349 AliITS::Streamer(R__b);