]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv5asymm.cxx
Strings compared instead of pointers
[u/mrichter/AliRoot.git] / ITS / AliITSv5asymm.cxx
index 4fbbb7d58a3da1a2ba80531ea7aadf1507b9665b..92ccd97d0d607e7d8fcbf7189365e9fa2a9a0305 100644 (file)
 
 /*
 $Log$
+Revision 1.16  2001/05/30 14:04:31  hristov
+Dynamic cast replaced (F.Carminati)
+
+Revision 1.15  2001/05/25 06:47:16  hristov
+Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both a proper shape entry and a default, should there be future changes. This bug was related to fMinorVersion=3 was not antisipated. (B.Nilsen)
+
+Revision 1.14  2001/05/16 14:57:16  alibrary
+New files for folders and Stack
+
+Revision 1.13  2001/05/09 01:00:19  nilsen
+Fixed up a typo in the cout of Init(). Now properly indecates which version
+of code is being used.
+
+Revision 1.12  2001/04/18 12:06:02  barbera
+Number of modules in layer 5 and 6 re-set to 23 and 26
+
+Revision 1.11  2001/03/23 00:12:23  nilsen
+Set Reading of AliITSgeom data from Geant3 common blocks as the default and
+not a .det file. Removed redundent calls to BuildGeometry.
+
+Revision 1.10  2001/02/14 14:22:58  nilsen
+Now looking in the right director for the old .det.
+
+Revision 1.9  2001/02/14 14:12:43  nilsen
+Forgot about the nonexisting v in ITSgeometry_5.det.
+
+Revision 1.8  2001/02/14 14:06:23  nilsen
+Wrong default .det file name for old .det file format.
+
+Revision 1.7  2001/02/13 16:53:35  nilsen
+Fixed a but when trying to use GEANT4. Needed to replace
+if(!((TGeant3*)gMC)) with if(!(dynamic_casst<TGeant3*>(gMC)))
+because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer
+did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed
+to fix a bug in the initilizers and a bug in BuildGeometry. This is now done
+in the same way as in AliITSv5.cxx.
+
+Revision 1.6  2001/02/09 20:06:26  nilsen
+Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter.
+
 Revision 1.5  2001/02/09 00:05:31  nilsen
 Added fMajor/MinorVersion variables and made other changes to better make
 use of the new code changes in AliITSgeom related classes.
@@ -120,8 +160,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';
@@ -147,8 +187,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';
@@ -156,7 +196,7 @@ 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);
 }
@@ -202,8 +242,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];
@@ -218,7 +259,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;
@@ -555,8 +596,6 @@ void AliITSv5asymm::CreateGeometry(){
 //
 //    Read a file containing the geometry for the ITS version 5.
 ////////////////////////////////////////////////////////////////////////
-
-    Int_t size;
     char topvol[5];
     char *filtmp;
 
@@ -565,14 +604,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
@@ -585,27 +623,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;
 }
 
 //______________________________________________________________________
@@ -644,12 +662,13 @@ 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(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];
@@ -676,7 +695,8 @@ 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]);
@@ -690,7 +710,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++){
@@ -714,9 +734,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
@@ -756,9 +783,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);
@@ -771,8 +800,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(){