X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STRUCT%2FAliALIFE.cxx;h=37dad7f74e2a76cec96f86233bda38bf30a60acd;hb=b7980dfe7f95c317715bf8f6af9129780af1b1e0;hp=63c1954f0b857e9f295147200aeee3824e6ca722;hpb=9b62c5969f04f47b58168419617f0632a155fd4e;p=u%2Fmrichter%2FAliRoot.git diff --git a/STRUCT/AliALIFE.cxx b/STRUCT/AliALIFE.cxx index 63c1954f0b8..37dad7f74e2 100644 --- a/STRUCT/AliALIFE.cxx +++ b/STRUCT/AliALIFE.cxx @@ -25,33 +25,52 @@ ClassImp(AliALIFE) - -AliALIFE::AliALIFE(const char* file1, const char* file2) +AliALIFE::AliALIFE(const char* file1, const char* file2): + fNBodies(0), + fNVolumes(0), + fBodyFile(file1), + fVolumeFile(file2), + fFile1(fopen(fBodyFile,"w")), + fFile2(fopen(fVolumeFile,"w")), + fDefaultVolume1("DEFAU1"), + fDefaultVolume2("DEFAU2") { // Constructor - fNBodies = 0; - fNVolumes= 0; - fBodyFile = file1; // File for Fluka bodies - fVolumeFile = file2; - fFile1=fopen(fBodyFile,"w"); - fFile2=fopen(fVolumeFile,"w"); BodyHeader(); VolumeHeader(); - fDefaultVolume1 = "DEFAU1"; - fDefaultVolume2 = "DEFAU2"; } -AliALIFE::AliALIFE() +AliALIFE::AliALIFE(): + fNBodies(0), + fNVolumes(0), + fBodyFile("FlukaBody.inp"), + fVolumeFile("FlukaVolume.inp"), + fFile1(fopen(fBodyFile,"w")), + fFile2(fopen(fVolumeFile,"w")), + fDefaultVolume1("DEFAU1"), + fDefaultVolume2("DEFAU2") { // Default constructor - fBodyFile = "FlukaBody.inp"; - fVolumeFile = "FlukaVolume.inp"; - fFile1=fopen(fBodyFile,"w"); - fFile2=fopen(fVolumeFile,"w"); BodyHeader(); VolumeHeader(); } + +AliALIFE::AliALIFE(const AliALIFE &rhs): + TObject(rhs), + fNBodies(0), + fNVolumes(0), + fBodyFile(0), + fVolumeFile(0), + fFile1(0), + fFile2(0), + fDefaultVolume1(0), + fDefaultVolume2(0) +{ + // Copy Constructor + rhs.Copy(*this); +} + void AliALIFE::BodyHeader() { // Write header for body definitions @@ -78,13 +97,15 @@ void AliALIFE::VolumeHeader() void AliALIFE:: Cylinder(Float_t rmin, Float_t rmax, Float_t zmin, Float_t zmax, Float_t pos[3], - char* Material, char* Field, char* Cuts) + const char* Material, + const char* Field, + const char* Cuts) { // Simple cylinder // // Bodies // ^^^^^^ - char name1[5], name2[5], name3[5], name4[5]; + char name1[6], name2[6], name3[6], name4[6]; // outer radius sprintf(name1, "R%4.4d", fNBodies++); @@ -114,8 +135,8 @@ void AliALIFE:: Cylinder(Float_t rmin, Float_t rmax, } void AliALIFE::OnionCylinder(Float_t* r, Int_t nr, Float_t zmin, Float_t zmax, - Float_t pos[3], char** Materials, - char** Fields, char** Cuts) + Float_t pos[3], const char** Materials, + const char** Fields, const char** Cuts) { // // Concentric cylinders @@ -174,7 +195,9 @@ void AliALIFE::Cone(Float_t rmin1, Float_t rmin2, Float_t rmax1, Float_t rmax2, Float_t zmin, Float_t zmax, Float_t pos[3], - char* Material, char* Field, char* Cuts) + const char* Material, + const char* Field, + const char* Cuts) { // Simple cone @@ -265,8 +288,8 @@ void AliALIFE::Cone(Float_t rmin1, Float_t rmin2, void AliALIFE::OnionCone (Float_t* r1, Float_t* r2, Int_t nr, Float_t zmin, Float_t zmax, - Float_t pos[3], char** Materials, char** Fields, - char** Cuts) + Float_t pos[3], const char** Materials, + const char** Fields, const char** Cuts) { // Concentric cones // @@ -381,7 +404,9 @@ void AliALIFE::OnionCone (Float_t* r1, Float_t* r2, Int_t nr, void AliALIFE::PolyCone(Float_t* rmin, Float_t* rmax, Float_t* z, Int_t nz, Float_t pos[3], - char* Material, char* Field, char* Cuts) + const char* Material, + const char* Field, + const char* Cuts) { // // Equivalent to the Geant3 PCON @@ -397,7 +422,8 @@ 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, char** Cuts) + const char** Materials, + const char** Fields,const char** Cuts) { // // Concentric PCONS @@ -419,7 +445,7 @@ void AliALIFE::OnionPolyCone(Float_t** r, Float_t* z, } } -void AliALIFE::Comment(char* Comment) +void AliALIFE::Comment(const char* Comment) { // Insert comment line fprintf(fFile1,"*%s\n", Comment); @@ -427,7 +453,7 @@ void AliALIFE::Comment(char* Comment) } -void AliALIFE::Finish() +void AliALIFE::Finish(Bool_t iremove) { // Finish geometry definition char s[BUFSIZ]; @@ -440,9 +466,13 @@ void AliALIFE::Finish() fclose(fFile1); fclose(fFile2); + if (iremove) { + remove(fVolumeFile); + remove(fBodyFile); + } } -void AliALIFE::Copy(AliALIFE&) const +void AliALIFE::Copy(TObject&) const { // // Copy