]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliModule.cxx
Updated V2 stream of tracking (Yu.Belikov). The new long waited features are: 1)...
[u/mrichter/AliRoot.git] / STEER / AliModule.cxx
index 51714b44553ac2e433857d49a3c1c3c4e896945f..f42e96606f24910e774dd33b05e13b3115959328 100644 (file)
 
 /*
 $Log$
+Revision 1.16  2001/05/16 14:57:22  alibrary
+New files for folders and Stack
+
+Revision 1.15  2001/03/20 06:36:28  alibrary
+100 parameters now allowed for geant shapes
+
+Revision 1.14  2001/01/26 19:58:48  hristov
+Major upgrade of AliRoot code
+
+Revision 1.13  2000/11/30 07:12:49  alibrary
+Introducing new Rndm and QA classes
+
+Revision 1.12  2000/10/02 21:28:14  fca
+Removal of useless dependecies via forward declarations
+
+Revision 1.11  2000/07/12 08:56:25  fca
+Coding convention correction and warning removal
+
+Revision 1.10  2000/07/11 18:24:59  fca
+Coding convention corrections + few minor bug fixes
+
+Revision 1.9  2000/05/16 08:45:08  fca
+Correct dtor, thanks to J.Belikov
+
 Revision 1.8  2000/02/23 16:25:22  fca
 AliVMC and AliGeant3 classes introduced
 ReadEuclid moved from AliRun to AliModule
@@ -41,13 +65,14 @@ Introduction of the Copyright and cvs Log
 //End_Html
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
+#include <TNode.h>
+#include "TSystem.h"
+
 #include "AliModule.h"
 #include "AliRun.h"
-#include "AliHit.h"
-#include "AliPoints.h"
-#include <TClass.h>
-#include <TNode.h>
-#include <TRandom.h>
+#include "AliMagF.h"
+#include "AliMC.h"
+#include "AliConfig.h"
 
 ClassImp(AliModule)
  
@@ -59,6 +84,9 @@ AliModule::AliModule()
   //
   fHistograms = 0;
   fNodes      = 0;
+  fIdtmed     = 0;
+  fIdmate     = 0;
+  fDebug      = 0;
 }
  
 //_____________________________________________________________________________
@@ -98,8 +126,21 @@ AliModule::AliModule(const char* name,const char *title):TNamed(name,title)
   // Prepare to find the tracking media range
   fLoMedium = 65536;
   fHiMedium = 0;
+
+  AliConfig::Instance()->Add(this);    
+    
+  SetDebug(gAlice->GetDebug());
 }
  
+//_____________________________________________________________________________
+AliModule::AliModule(const AliModule &mod)
+{
+  //
+  // Copy constructor
+  //
+  mod.Copy(*this);
+}
+
 //_____________________________________________________________________________
 AliModule::~AliModule()
 {
@@ -119,6 +160,15 @@ AliModule::~AliModule()
   delete fIdmate;
 }
  
+//_____________________________________________________________________________
+void AliModule::Copy(AliModule & /* mod */) const
+{
+  //
+  // Copy *this onto mod, not implemented for AliModule
+  //
+  Fatal("Copy","Not implemented!\n");
+}
+
 //_____________________________________________________________________________
 void AliModule::Disable()
 {
@@ -132,7 +182,7 @@ void AliModule::Disable()
   // Loop through geometry to disable all
   // nodes for this Module
   while((node = (TNode*)next())) {
-    node->SetVisibility(0);
+    node->SetVisibility(-1);
   }   
 }
 
@@ -159,7 +209,7 @@ void AliModule::Enable()
   // Loop through geometry to enable all
   // nodes for this Module
   while((node = (TNode*)next())) {
-    node->SetVisibility(1);
+    node->SetVisibility(3);
   }   
 }
 
@@ -294,6 +344,25 @@ void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
   gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3); 
 } 
 
+//_____________________________________________________________________________
+AliModule& AliModule::operator=(const AliModule &mod)
+{
+  mod.Copy(*this);
+  return (*this);
+}
+
+//_____________________________________________________________________________
+Float_t AliModule::ZMin() const
+{
+  return -500;
+}
+
+//_____________________________________________________________________________
+Float_t AliModule::ZMax() const
+{
+  return 500;
+}
+
 //_____________________________________________________________________________
 void AliModule::SetEuclidFile(char* material, char* geometry)
 {
@@ -338,11 +407,11 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
   char key[5], card[77], natmed[21];
   char name[5], mother[5], shape[5], konly[5], volst[7000][5];
   char *filtmp;
-  Float_t par[50];
+  Float_t par[100];
   Float_t teta1, phi1, teta2, phi2, teta3, phi3, orig, step;
   Float_t xo, yo, zo;
-  const Int_t maxrot=5000;
-  Int_t idrot[maxrot],istop[7000];
+  const Int_t kMaxRot=5000;
+  Int_t idrot[kMaxRot],istop[7000];
   FILE *lun;
   //
   // *** The input filnam name will be with extension '.euc'
@@ -355,7 +424,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
   }
   //* --- definition of rotation matrix 0 ---  
   TArrayI &idtmed = *fIdtmed;
-  for(i=1; i<maxrot; ++i) idrot[i]=-99;
+  for(i=1; i<kMaxRot; ++i) idrot[i]=-99;
   idrot[0]=0;
   nvol=0;
  L10:
@@ -386,7 +455,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
     //*
   } else if (!strcmp(key,"ROTM")) {
     sscanf(&card[4],"%d %f %f %f %f %f %f",&irot,&teta1,&phi1,&teta2,&phi2,&teta3,&phi3);
-    if( irot<=0 || irot>=maxrot ) {
+    if( irot<=0 || irot>=kMaxRot ) {
       Error("ReadEuclid","ROTM rotation matrix number %d illegal\n",irot);
       exit(1);
     }
@@ -421,7 +490,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
     //*
   } else if (!strcmp(key,"POSI")) {
     sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']'", name, &nr, mother, &xo, &yo, &zo, &irot, konly);
-    if( irot<0 || irot>=maxrot ) {
+    if( irot<0 || irot>=kMaxRot ) {
       Error("ReadEuclid","POSI %s#%d rotation matrix number %d illegal\n",name,nr,irot);
       exit(1);
     }
@@ -438,7 +507,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
     //*
   } else if (!strcmp(key,"POSP")) {
     sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']' %d", name, &nr, mother, &xo, &yo, &zo, &irot, konly, &npar);
-    if( irot<0 || irot>=maxrot ) {
+    if( irot<0 || irot>=kMaxRot ) {
       Error("ReadEuclid","POSP %s#%d rotation matrix number %d illegal\n",name,nr,irot);
       exit(1);
     }
@@ -467,7 +536,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
     }
     if (istop[i] && !flag) {
       strcpy(topvol,volst[i]);
-      printf(" *** GREUCL *** volume %s taken as a top volume\n",topvol);
+      if(fDebug) printf("%s::ReadEuclid: volume %s taken as a top volume\n",ClassName(),topvol);
       flag=1;
     }
   }
@@ -477,7 +546,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol)
   fclose (lun);
   //*
   //*     commented out only for the not cernlib version
-  printf(" *** GREUCL *** file: %s is now read in\n",filnam);
+  if(fDebug) printf("%s::ReadEuclid: file: %s is now read in\n",ClassName(),filnam);
   //
   return;
   //*
@@ -515,7 +584,7 @@ void AliModule::ReadEuclidMedia(const char* filnam)
   }
   //
   // *** The input filnam name will be with extension '.euc'
-  printf("The file name is %s\n",filnam); //Debug
+  if(fDebug) printf("%s::ReadEuclid: The file name is %s\n",ClassName(),filnam); //Debug
   filtmp=gSystem->ExpandPathName(filnam);
   lun=fopen(filtmp,"r");
   delete [] filtmp;
@@ -525,8 +594,8 @@ void AliModule::ReadEuclidMedia(const char* filnam)
   }
   //
   // Retrieve Mag Field parameters
-  Int_t ISXFLD=gAlice->Field()->Integ();
-  Float_t SXMGMX=gAlice->Field()->Max();
+  Int_t globField=gAlice->Field()->Integ();
+  Float_t globMaxField=gAlice->Field()->Max();
   //  TArrayI &idtmed = *fIdtmed;
   //
  L10:
@@ -560,7 +629,7 @@ void AliModule::ReadEuclidMedia(const char* filnam)
     while(i<20) natmed[i++]=' ';
     natmed[i]='\0';
     //
-    AliMedium(itmed,natmed,nmat,isvol,ISXFLD,SXMGMX,tmaxfd,
+    AliMedium(itmed,natmed,nmat,isvol,globField,globMaxField,tmaxfd,
                   stemax,deemax,epsil,stmin,ubuf,nwbuf);
     //    (*fImedia)[idtmed[itmed]-1]=id_det;
     //*
@@ -570,7 +639,8 @@ void AliModule::ReadEuclidMedia(const char* filnam)
   fclose (lun);
   //*
   //*     commented out only for the not cernlib version
-  Warning("ReadEuclidMedia","file: %s is now read in\n",filnam);
+  if(fDebug) printf("%s::ReadEuclidMedia: file %s is now read in\n",
+       ClassName(),filnam);
   //*
   return;
   //*
@@ -578,36 +648,4 @@ void AliModule::ReadEuclidMedia(const char* filnam)
   Warning("ReadEuclidMedia","reading error or premature end of file\n");
 } 
  
-//_____________________________________________________________________________
-void AliModule::Streamer(TBuffer &R__b)
-{
-  //
-  // Stream an object of class Module.
-  //
-  if (R__b.IsReading()) {
-    Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-    TNamed::Streamer(R__b);
-    TAttLine::Streamer(R__b);
-    TAttMarker::Streamer(R__b);
-    fEuclidMaterial.Streamer(R__b);
-    fEuclidGeometry.Streamer(R__b);
-    R__b >> fActive;
-    R__b >> fHistograms;
-    //
-    // Stream the pointers but not the TClonesArrays
-    R__b >> fNodes; // diff
-  } else {
-    R__b.WriteVersion(AliModule::IsA());
-    TNamed::Streamer(R__b);
-    TAttLine::Streamer(R__b);
-    TAttMarker::Streamer(R__b);
-    fEuclidMaterial.Streamer(R__b);
-    fEuclidGeometry.Streamer(R__b);
-    R__b << fActive;
-    R__b << fHistograms;
-    //
-    // Stream the pointers but not the TClonesArrays
-    R__b << fNodes; // diff
-  }
-}