Removing warnings (icc)
[u/mrichter/AliRoot.git] / STRUCT / AliALIFE.cxx
index 785153c6ea00e8fa64b4e2d539c2d3e134dfba9d..f33b237b2c1b55fb2af04777b4cd6055f3986c24 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
+
+//----------------------------------------------------------------------
+// Helper class to write geometry in ALIFE format
+// in parallel with Geant geometry definition.
+// Author: A.Morsch
+//----------------------------------------------------------------------
 
 #include <AliALIFE.h>
 
 ClassImp(AliALIFE)
 
-    AliALIFE::AliALIFE(const char* file1, const char* file2)
+
+AliALIFE::AliALIFE(const char* file1, const char* file2)
 {  
 // Constructor
     fNBodies = 0; 
@@ -36,7 +41,7 @@ ClassImp(AliALIFE)
     fDefaultVolume2 = "DEFAU2";    
 }
 
-    AliALIFE::AliALIFE()
+AliALIFE::AliALIFE()
 {
 // Default constructor
     fBodyFile   = "FlukaBody.inp";  
@@ -160,7 +165,7 @@ void AliALIFE::OnionCylinder(Float_t* r, Int_t nr, Float_t zmin, Float_t zmax,
            fprintf(fFile2,"+%5s-%5s+%5s\n", nameZou, nameZin, nameRou);
        }
        fprintf(fFile2,"\n");
-       nameRin=nameRou;
+       strcpy(nameRin,nameRou);
     }
 }
 
@@ -188,6 +193,7 @@ void AliALIFE::Cone(Float_t rmin1, Float_t rmin2,
     
 //  outer radius
     d=zmax-zmin;
+    sprintf(nameCou, "C%4.4d", fNBodies++);
     if (rmax1 >= 0. && rmax2 >= 0.) {
        if (rmax1!=rmax2) {
            if (rmax1 > rmax2) {
@@ -200,22 +206,21 @@ void AliALIFE::Cone(Float_t rmin1, Float_t rmin2,
                r1=rmax2;
                r2=rmax1;
            }
-           sprintf(nameCou, "C%4.4d", fNBodies++);
            fprintf(fFile1,"%5s TRC%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n",
                    nameCou, pos[0], pos[1], pos[2], 0., 0., d); 
            fprintf(fFile1,"         %10.3f%10.3f\n",r1,r2);
        } else {
-           sprintf(nameCou, "C%4.4d", fNBodies++);
            fprintf(fFile1,"%5s ZCC%10.3f%10.3f%10.3f\n",
                    nameCou, pos[0], pos[1], rmax1); 
        } 
     }else {
-       strcpy(nameCou,fDefaultVolume1);
+      fDefaultVolume1 = nameCou;
     }
 
     
     
 // inner radius
+    sprintf(nameCin, "C%4.4d", fNBodies++);
     if (rmin1 >= 0. && rmin2 >= 0.) {
        if (rmin1!=rmin2) {
            if (rmin1 != 0 && rmin2 !=0) {
@@ -230,18 +235,16 @@ void AliALIFE::Cone(Float_t rmin1, Float_t rmin2,
                    r2=rmin1;
                    d=-d;
                }
-               sprintf(nameCin, "C%4.4d", fNBodies++);
                fprintf(fFile1,"%5s TRC%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n",
                        nameCin, pos[0], pos[1], pos[2], 0., 0., d); 
                fprintf(fFile1,"         %10.3f%10.3f\n",r1,r2);
            } 
        } else {
-           sprintf(nameCin, "C%4.4d", fNBodies++);
            fprintf(fFile1,"%5s ZCC%10.3f%10.3f%10.3f\n",
                    nameCin, pos[0], pos[1], rmin1); 
        } 
     }else {
-       strcpy(nameCin,fDefaultVolume2);
+      fDefaultVolume2 = nameCin;
     }
 
 
@@ -312,7 +315,7 @@ void AliALIFE::OnionCone (Float_t* r1, Float_t* r2, Int_t nr,
            }
        }
     } else {
-       strcpy(nameCin,fDefaultVolume1);
+      fDefaultVolume1 = nameCin;
     }
     
     
@@ -346,7 +349,7 @@ void AliALIFE::OnionCone (Float_t* r1, Float_t* r2, Int_t nr,
                        nameCou, pos[0], pos[1], r1[i]); 
            }
        } else {
-           strcpy(nameCou,fDefaultVolume1);
+         fDefaultVolume1 = nameCou;
        }
        
 // Volumes
@@ -360,15 +363,17 @@ void AliALIFE::OnionCone (Float_t* r1, Float_t* r2, Int_t nr,
            fprintf(fFile2,"EMFCUT=%s\n", "$UNSHIELDED");
            fprintf(fFile2,"WW-FACTOR=%s\n", "$UNSHIELDED");
        }
-       if (hasInner) {
-           fprintf(fFile2,"+%5s-%5s+%5s-%5s\n", 
+       if (hasInner || isCylinder) {
+           if (!isCylinder) fprintf(fFile2,"+%5s-%5s+%5s-%5s\n", 
                    nameCou, nameCin, nameZou, nameZin);
+           if (isCylinder)  fprintf(fFile2,"+%5s+%5s-%5s\n",
+                   nameCou, nameZou, nameZin); 
        } else {
            fprintf(fFile2,"+%5s\n", nameCou);
            hasInner=kTRUE;
        }
        fprintf(fFile2,"\n");        
-       nameCin=nameCou;
+       strcpy(nameCin,nameCou);
     }
 }
 
@@ -392,7 +397,7 @@ void AliALIFE::PolyCone(Float_t* rmin, Float_t* rmax, Float_t* z,
 void AliALIFE::OnionPolyCone(Float_t** r, Float_t* z,
                             Int_t nr, Int_t nz,
                             Float_t pos[3], 
-                            char** Materials, char** Fields=0, char** Cuts)
+                            char** Materials, char** Fields, char** Cuts)
 {
 //
 // Concentric PCONS
@@ -422,7 +427,7 @@ void AliALIFE::Comment(char* Comment)
 }
 
 
-void AliALIFE::Finish()
+void AliALIFE::Finish(Bool_t iremove)
 {
 // Finish geometry definition
     char s[BUFSIZ];
@@ -435,8 +440,19 @@ void AliALIFE::Finish()
     
     fclose(fFile1);
     fclose(fFile2);    
+    if (iremove) {
+       remove(fVolumeFile);
+       remove(fBodyFile);
+    }
 }
 
+void AliALIFE::Copy(TObject&) const
+{
+    //
+    // Copy 
+    //
+    Fatal("Copy","Not implemented!\n");
+}