]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv5asymm.cxx
Corrected setting of magnetic field
[u/mrichter/AliRoot.git] / ITS / AliITSv5asymm.cxx
index 3de83887c9f1f9006d9a78ce76e32c55db57cf2c..fc0510f989f362e16f0dbb54922edbb02bcaf6fe 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4  2001/02/02 23:57:29  nilsen
-Added include file that are no londer included in AliITSgeom.h
-
-Revision 1.3  2001/01/30 09:23:13  hristov
-Streamers removed (R.Brun)
-
-Revision 1.2  2000/11/30 11:13:11  barbera
- Added changes suggested by Federico Carminati on nov, 30, 2000
-
-Revision 1.1  2000/10/07 15:46:38  barbera
-Version 5 of the geometry with asymmetric services
-
-Revision 1.25  2000/10/05 20:50:00  nilsen
-Now using root generated streamers.
-
-Revision 1.14.4.12  2000/10/02 16:04:03  barbera
-Forward declarations added
-
-Revision 1.22  2000/07/10 16:07:19  fca
-Release version of ITS code
-
-Revision 1.14.4.4  2000/05/19 10:10:21  nilsen
-fix for bug with HP and Sun unix + fix for event display in ITS-working branch
-
-Revision 1.14.4.3  2000/03/04 23:46:38  nilsen
-Fixed up the comments/documentation.
-
-Revision 1.14.4.2  2000/03/02 21:53:02  nilsen
-To make it compatable with the changes in AliRun/AliModule.
-
-Revision 1.14.4.1  2000/01/12 19:03:33  nilsen
-This is the version of the files after the merging done in December 1999.
-See the ReadMe110100.txt file for details
-
-Revision 1.14  1999/10/22 08:16:49  fca
-Correct destructors, thanks to I.Hrivnacova
-
-Revision 1.13  1999/10/06 10:15:19  fca
-Correct bug in allocation of layer name and add destructor
-
-Revision 1.12  1999/10/05 08:05:09  fca
-Minor corrections for uninitialised variables.
-
-Revision 1.11  1999/09/29 09:24:20  fca
-Introduction of the Copyright and cvs Log
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -73,34 +25,35 @@ Introduction of the Copyright and cvs Log
 // Created October 7 2000.
 //
 ///////////////////////////////////////////////////////////////////////////////
-#include <iostream.h>
-#include <iomanip.h>
+#include <Riostream.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <TMath.h>
+
+#include <TBRIK.h>
+#include <TCanvas.h>
+#include <TClonesArray.h>
+#include <TFile.h>    // only required for Tracking function?
 #include <TGeometry.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
 #include <TNode.h>
-#include <TTUBE.h>
-#include <TFile.h>    // only required for Tracking function?
-#include <TCanvas.h>
 #include <TObjArray.h>
 #include <TObjString.h>
-#include <TClonesArray.h>
-#include <TLorentzVector.h>
-#include <TBRIK.h>
 #include <TSystem.h>
+#include <TTUBE.h>
+#include <TVirtualMC.h>
 
-#include "AliMC.h"
 #include "AliRun.h"
-#include "../TGeant3/TGeant3.h"
 #include "AliITShit.h"
 #include "AliITSGeant3Geometry.h"
-#include "AliITS.h"
-#include "AliITSv5asymm.h"
 #include "AliITSgeom.h"
-#include "AliITSgeomSPD.h"
 #include "AliITSgeomSDD.h"
+#include "AliITSgeomSPD.h"
 #include "AliITSgeomSSD.h"
+#include "AliITShit.h"
+#include "AliITSv5asymm.h"
+#include "AliRun.h"
+#include "AliMC.h"
 
 ClassImp(AliITSv5asymm)
  
@@ -116,8 +69,8 @@ AliITSv5asymm::AliITSv5asymm() {
     fIdSens = 0;
     fEuclidOut    = kFALSE; // Don't write Euclide file
     fGeomDetOut   = kFALSE; // Don't write .det file
-    fGeomDetIn    = kFALSE; // Read .det file
-    fGeomOldDetIn = kTRUE;  // Read old formatted .det file
+    fGeomDetIn    = kFALSE; // Don't Read .det file
+    fGeomOldDetIn = kFALSE; // Don't Read old formatted .det file
     fMajorVersion = IsVersion();
     fMinorVersion = 3;
     for(i=0;i<60;i++) fRead[i] = '\0';
@@ -143,8 +96,8 @@ AliITSv5asymm::AliITSv5asymm(const char *name, const char *title) : AliITS(name,
     for (i=0;i<fIdN;i++) fIdSens[i] = 0;
     fEuclidOut    = kFALSE; // Don't write Euclide file
     fGeomDetOut   = kFALSE; // Don't write .det file
-    fGeomDetIn    = kFALSE; // Read .det file
-    fGeomOldDetIn = kTRUE;  // Read old formatted .det file
+    fGeomDetIn    = kFALSE; // Don't Read .det file
+    fGeomOldDetIn = kFALSE; // Don't Read old formatted .det file
     fMajorVersion = IsVersion();
     fMinorVersion = 3;
     for(i=0;i<60;i++) fRead[i] = '\0';
@@ -152,12 +105,12 @@ AliITSv5asymm::AliITSv5asymm(const char *name, const char *title) : AliITS(name,
 
     fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5asymm.tme";
     fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5asymm.euc";
-    strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_v5asymm.det",60);
+    strncpy(fEuclidGeomDet,"$ALICE_ROOT/Euclid/ITSgeometry_5.det",60);
     strncpy(fRead,fEuclidGeomDet,60);
     strncpy(fWrite,fEuclidGeomDet,60);
 }
 //____________________________________________________________________________
-AliITSv5asymm::AliITSv5asymm(const AliITSv5asymm &source){
+AliITSv5asymm::AliITSv5asymm(const AliITSv5asymm &source):AliITS(source){
 ////////////////////////////////////////////////////////////////////////
 //     Copy Constructor for ITS version 5.
 ////////////////////////////////////////////////////////////////////////
@@ -181,9 +134,6 @@ AliITSv5asymm::~AliITSv5asymm() {
 ////////////////////////////////////////////////////////////////////////
 //    Standard destructor for the ITS version 5.
 ////////////////////////////////////////////////////////////////////////
-    if(fRead!=0) delete fRead;
-    if(fWrite!=0) delete fWrite;
-    if(fEuclidGeomDet!=0) delete fEuclidGeomDet;
 }
 //_____________________________________________________________________________
 void AliITSv5asymm::BuildGeometry(){
@@ -201,8 +151,9 @@ void AliITSv5asymm::BuildGeometry(){
   //const int kColorITSSDD=kGreen;
   const int kColorITSSSD=kBlue;
   //
-  top=gAlice->GetGeometry()->GetNode("alice");
   AliITSgeom  *gm = this->GetITSgeom();
+  if(gm==0) return;
+  top=gAlice->GetGeometry()->GetNode("alice");
 
   Int_t       lay,lad,det,i;
   Text_t      name[10];
@@ -217,7 +168,7 @@ void AliITSv5asymm::BuildGeometry(){
    for(lad=1;lad<=gm->GetNladders(lay);lad++)
     for(det=1;det<=gm->GetNdetectors(lay);det++){
           try {
-              box  = new TBRIK ("ActiveSPD","Active volume of SPD","SPD SI DET",
+              box  = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
                                    0.64,0.0075,4.19); 
           } catch (...) {
              cout << "EXCEPTION in box = new TBRIK" << endl;
@@ -554,8 +505,6 @@ void AliITSv5asymm::CreateGeometry(){
 //
 //    Read a file containing the geometry for the ITS version 5.
 ////////////////////////////////////////////////////////////////////////
-
-    Int_t size;
     char topvol[5];
     char *filtmp;
 
@@ -564,14 +513,13 @@ void AliITSv5asymm::CreateGeometry(){
   delete [] filtmp;
   if(file) {
     fclose(file);
-    printf("Ready to read Euclid geometry file\n");
+    if(fDebug) cout << ClassName() << ": Ready to read Euclid geometry file" << endl;
     ReadEuclid(fEuclidGeometry.Data(),topvol);
-    printf("Read in euclid geometries\n");
-  } else {
-    Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
+    if(fDebug) cout << ClassName() << ": Read in euclid geometries" << endl;
+  } else 
+    Fatal("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
          fEuclidGeometry.Data());
-    exit(1);
-  } // end if(file)
+  // end if(file)
   //
   // Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
   // invisible
@@ -584,27 +532,7 @@ void AliITSv5asymm::CreateGeometry(){
       gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
     } // end if (fEuclidOut)
 
-    // read in the file containing the transformations for the active
-    // volumes for the ITS version 5. This is expected to be in a file
-    // ending in .det. This geometry is kept in the AliITSgeom class.
-    filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
-    size = strlen(filtmp);
-    if(size>4){
-       filtmp[size-3] = 'd'; // change from .euc to .det
-        filtmp[size-2] = 'e';
-        filtmp[size-1] = 't';
-       file = fopen(filtmp,"r");
-       if(file){ // if file exists use it to fill AliITSgeom structure.
-           fclose(file);
-           printf("ready to read .det file %s\n",filtmp);
-           fITSgeom = new AliITSgeom(filtmp);
-       }else{
-           fITSgeom = 0;
-           // fill AliITSgeom structure from geant structure just filled above
-       }// end if(file)
-        delete [] filtmp;
-    }// end if(size>4)
-    printf("finished with euclid geometrys\n");
+    if(fDebug) cout << ClassName() << ": finished with euclid geometrys" << endl;
 }
 
 //______________________________________________________________________
@@ -643,12 +571,14 @@ void AliITSv5asymm::InitAliITSgeom(){
 //     Based on the geometry tree defined in Geant 3.21, this
 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
 // sturture.
-    if(!((TGeant3*)gMC)) {
+//    if(gMC->IsA()!=TGeant3::Class()) {
+    if(strcmp(gMC->GetName(),"TGeant3")) {
        Error("InitAliITSgeom",
                "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
        return;
     } // end if
-    cout << "Reading Geometry transformation directly from Geant 3." << endl;
+    if(fDebug) cout << ClassName() 
+                   << ": Reading Geometry transformation directly from Geant 3." << endl;
     const Int_t nlayers = 6;
     const Int_t ndeep = 7;
     Int_t itsGeomTreeNames[nlayers][ndeep],lnam[20],lnum[20];
@@ -675,10 +605,12 @@ void AliITSv5asymm::InitAliITSgeom(){
     // Sorry, but this is not very pritty code. It should be replaced
     // at some point with a version that can search through the geometry
     // tree its self.
-    cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
+    if(fDebug) cout << ClassName() 
+                   << ": Reading Geometry informaton from Geant3 common blocks" << endl;
     for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
-    for(i=0;i<nlayers;i++)for(j=0;j<ndeep;j++) 
-       itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
+    for(i=0;i<nlayers;i++)for(j=0;j<ndeep;j++)
+        strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4); 
+    // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
     mod = 0;
     for(i=0;i<nlayers;i++){
        k = 1;
@@ -689,7 +621,7 @@ void AliITSv5asymm::InitAliITSgeom(){
 
     if(fITSgeom!=0) delete fITSgeom;
     nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
-    ndet[0]=4;ndet[1]=4;ndet[2]=6;ndet[3]=8;ndet[4]=22;ndet[5]=25;
+    ndet[0]=4;ndet[1]=4;ndet[2]=6;ndet[3]=8;ndet[4]=23;ndet[5]=26;
     fITSgeom = new AliITSgeom(0,6,nlad,ndet,mod);
     mod = -1;
     for(lay=1;lay<=nlayers;lay++){
@@ -713,9 +645,16 @@ void AliITSv5asymm::InitAliITSgeom(){
                            if(fMinorVersion==1){
                              fITSgeom->ReSetShape(kSPD,
                                                  new AliITSgeomSPD300());
-                           } else if(fMinorVersion==2)
+                           } else if(fMinorVersion==2){
                              fITSgeom->ReSetShape(kSPD,
                                                  new AliITSgeomSPD300());
+                           }else if(fMinorVersion==3){
+                             fITSgeom->ReSetShape(kSPD,
+                                                 new AliITSgeomSPD425Long());
+                           }else{
+                             fITSgeom->ReSetShape(kSPD,
+                                                 new AliITSgeomSPD300());
+                           } // end if
                    } // end for det
                } // end for k
             } // end for j
@@ -755,9 +694,11 @@ void AliITSv5asymm::Init(){
 ////////////////////////////////////////////////////////////////////////
     Int_t i;
 
-    cout << endl;
-    for(i=0;i<30;i++) cout << "*";cout << " ITSv5_Init ";
-    for(i=0;i<30;i++) cout << "*";cout << endl;
+    if(fDebug) {
+      cout << endl << ClassName() << ": ";
+      for(i=0;i<28;i++) cout << "*";cout << " ITSv5_Init ";
+      for(i=0;i<27;i++) cout << "*";cout << endl;
+    }
 //
     if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
     if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
@@ -770,8 +711,11 @@ void AliITSv5asymm::Init(){
     if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
     AliITS::Init();
 //
-    for(i=0;i<72;i++) cout << "*";
-    cout << endl;
+    if(fDebug) {
+      cout << ClassName() << ": ";
+      for(i=0;i<72;i++) cout << "*";
+      cout << endl;
+    }
 } 
 //_____________________________________________________________________________
 void AliITSv5asymm::StepManager(){
@@ -872,6 +816,6 @@ void AliITSv5asymm::StepManager(){
   hits[6]=gMC->Edep();
   hits[7]=gMC->TrackTime();
   // Fill hit structure with this new hit.
-  new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+  new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
   return;
 }