]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSgeomSPD.cxx
LUTs mapping symnames and original global matrices removed from AliGeomManager, which...
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSPD.cxx
index e9b7acf2c6f8f9d720f456a0a075f1039571b0a8..f33042a6c0e23b4cdc78164a773cbb846359d8da 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.14  2001/10/19 21:32:35  nilsen
-Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
-cleanded up a little bit of code.
-
-Revision 1.13  2001/10/12 22:07:20  nilsen
-A patch for C++ io manipulation functions so that they will work both
-with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
-other platforms.
-
-Revision 1.12  2001/08/24 21:06:37  nilsen
-Added more documentation, fixed up some coding violations, and some
-forward declorations.
-
-Revision 1.11  2001/05/16 08:17:49  hristov
-Bug fixed in the StepManager to account for the difference in the geometry 
-tree for the ITS pixels. This fixes both the funny distribution of pixel 
-coordinates and the missing hits/digits/points in many sectors of the ITS 
-pixel barrel. Also included is a patch to properly get and use the detector 
-dimensions through out the ITS code. (B.Nilsen)
-
-Revision 1.10  2001/04/26 22:44:34  nilsen
-Bug fix.
-
-Revision 1.9  2001/02/09 00:00:57  nilsen
-Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
-bugs in iostream based streamers used to read and write .det files. Fixed
-some detector sizes. Fixed bugs in some default-special constructors.
-
-Revision 1.8  2001/02/03 00:00:30  nilsen
-New version of AliITSgeom and related files. Now uses automatic streamers,
-set up for new formatted .det file which includes detector information.
-Additional smaller modifications are still to come.
-
-*/
+/* $Id$ */
 
 ////////////////////////////////////////////////////////////////////////
 // This class is for the Silicon Pixel Detector, SPD, specific geometry.
@@ -57,8 +22,8 @@ Additional smaller modifications are still to come.
 // initilize this one with predefined values.
 ////////////////////////////////////////////////////////////////////////
 
-#include <iostream.h>
-#include <iomanip.h>
+#include <Riostream.h>
+#include <TGeometry.h>
 #include <TShape.h>
 #include <TMath.h>
 
@@ -66,25 +31,36 @@ Additional smaller modifications are still to come.
 
 ClassImp(AliITSgeomSPD)
 
-AliITSgeomSPD::AliITSgeomSPD(){
+AliITSgeomSPD::AliITSgeomSPD():
+TObject(),
+fName(),
+fTitle(),
+fMat(),
+fDx(0.0),
+fDy(0.0),
+fDz(0.0),
+fNbinx(0),
+fNbinz(0),
+fLowBinEdgeX(0),
+fLowBinEdgeZ(0){
 // Default Constructor. Set everthing to null.
-
-    fShapeSPD    = 0;
-    fNbinx       = 0;
-    fNbinz       = 0;
-    fLowBinEdgeX = 0;
-    fLowBinEdgeZ = 0;
 }
 //______________________________________________________________________
 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
-                            Int_t nz,Float_t *bz){
+                            Int_t nz,Float_t *bz):
+TObject(),
+fName(),
+fTitle(),
+fMat(),
+fDx(0.0),
+fDy(0.0),
+fDz(0.0),
+fNbinx(0),
+fNbinz(0),
+fLowBinEdgeX(0),
+fLowBinEdgeZ(0){
 // Standard Constructor. Set everthing to null.
 
-    fShapeSPD    = 0;
-    fNbinx       = 0;
-    fNbinz       = 0;
-    fLowBinEdgeX = 0;
-    fLowBinEdgeZ = 0;
     ReSetBins(dy,nx,bx,nz,bz);
     return;
 }
@@ -101,9 +77,10 @@ void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
     dx *= 0.5;
     dz *= 0.5;
 
-    delete fShapeSPD; // delete existing shape
-    if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
-    if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
+    if(fLowBinEdgeX) delete[] fLowBinEdgeX; // delete existing
+    if(fLowBinEdgeZ) delete[] fLowBinEdgeZ; // delete existing
+    fLowBinEdgeX = 0;
+    fLowBinEdgeZ = 0;
 
     SetNbinX(nx);
     SetNbinZ(nz);
@@ -113,47 +90,72 @@ void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
     fLowBinEdgeZ[0] = -dz;
     for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
     for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
-    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
+    SetShape("ActiveSPD","Active volume of SPD","",dx,dy,dz);
     return;
 }
 //______________________________________________________________________
-AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
+AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source) : TObject(source),
+fName(source.fName),
+fTitle(source.fTitle),
+fMat(source.fMat),
+fDx(source.fDx),
+fDy(source.fDy),
+fDz(source.fDz),
+fNbinx(source.fNbinx),
+fNbinz(source.fNbinz),
+fLowBinEdgeX(0),
+fLowBinEdgeZ(0){
     // Copy constructor
+  InitLowBinEdgeX();
+  InitLowBinEdgeZ();
+  for(Int_t i=0;i<fNbinx;i++) fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
+  for(Int_t i=0;i<fNbinz;i++) fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
 
-    *this = source; // just use the = operator for now.
-    return;
+  
 }
 //______________________________________________________________________
 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
     // = operator
-    Int_t i;
-
-    if(&source == this) return *this;
-    this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
-    if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
-    if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
-    this->fNbinx = source.fNbinx;
-    this->fNbinz = source.fNbinz;
-    this->InitLowBinEdgeX();
-    this->InitLowBinEdgeZ();
-    for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
-    for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
-    return *this;
+  this->~AliITSgeomSPD();
+  new(this) AliITSgeomSPD(source);
+  return *this;
 }
 //______________________________________________________________________
 AliITSgeomSPD::~AliITSgeomSPD(){
 // Destructor
 
-    delete fShapeSPD;
-    if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
-    if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
-    fShapeSPD    = 0;
+    if(fLowBinEdgeX) delete[] fLowBinEdgeX;
+    if(fLowBinEdgeZ) delete[] fLowBinEdgeZ;
     fNbinx       = 0;
     fNbinz       = 0;
     fLowBinEdgeX = 0;
     fLowBinEdgeZ = 0;
 }
 //______________________________________________________________________
+void AliITSgeomSPD::SetShape(const char *name,const char *title,
+                            const char * /*mat*/,Float_t dx,Float_t dy,Float_t dz){
+    // Delete any existing shape info and replace it with a new
+    // shape information.
+    // Inputs:
+    //   char * name  Name of the shape
+    //   char * title Title of the shape
+    //   char * mat   Material name for the shape
+    //   Float_t dx   half width of the shape [cm]
+    //   Float_t dy   half thickness of the shape [cm]
+    //   Float_t dz   half length of the shape [cm]
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
+    fName  = name;
+    fTitle = title;
+    fDx    = dx;
+    fDy    = dy;
+    fDz    = dz;
+    return;
+}
+//______________________________________________________________________
 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
 // Returns the row and column pixel numbers for a given local coordinate
 // system. If they are outside then it will return -1 or fNbinx/z.
@@ -194,7 +196,7 @@ void AliITSgeomSPD::Print(ostream *os) const {
     Int_t fmt;
 #endif
 #else
-#if defined __ICC
+#if defined __ICC || defined __ECC || defined __xlC__
     ios::fmtflags fmt;
 #else
     Int_t fmt;
@@ -224,8 +226,7 @@ void AliITSgeomSPD::Read(istream *is){
     *is >> shape;
     if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
     *is >> dx >> dy >> dz;
-    if(fShapeSPD!=0) delete fShapeSPD;
-    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
+    SetShape("ActiveSPD","Active volume of SPD","",dx,dy,dz);
     *is >> i >> j;
     SetNbinX(i);
     SetNbinZ(j);
@@ -255,56 +256,6 @@ istream &operator>>(istream &is,AliITSgeomSPD &r){
 }
 //=====================================================================
 
-/*
-$Log$
-Revision 1.14  2001/10/19 21:32:35  nilsen
-Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
-cleanded up a little bit of code.
-
-Revision 1.13  2001/10/12 22:07:20  nilsen
-A patch for C++ io manipulation functions so that they will work both
-with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
-other platforms.
-
-Revision 1.12  2001/08/24 21:06:37  nilsen
-Added more documentation, fixed up some coding violations, and some
-forward declorations.
-
-Revision 1.11  2001/05/16 08:17:49  hristov
-Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
-
-Revision 1.10  2001/04/26 22:44:34  nilsen
-Bug fix.
-
-Revision 1.9  2001/02/09 00:00:57  nilsen
-Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
-bugs in iostream based streamers used to read and write .det files. Fixed
-some detector sizes. Fixed bugs in some default-special constructors.
-
-Revision 1.8  2001/02/03 00:00:30  nilsen
-New version of AliITSgeom and related files. Now uses automatic streamers,
-set up for new formatted .det file which includes detector information.
-Additional smaller modifications are still to come.
-
-Revision 1.7  2000/10/02 16:32:35  barbera
-Forward declaration added
-
-Revision 1.1.2.8  2000/10/02 15:52:05  barbera
-Forward declaration added
-
-Revision 1.6  2000/07/10 16:07:18  fca
-Release version of ITS code
-
-Revision 1.4  2000/06/10 20:34:37  nilsen
-Fixed compilation warning with HP unix.
-
-Revision 1.3  2000/06/10 10:43:04  nilsen
-Fixed bug in copy and operator =.
-
-*/
-
-//#include "AliITSgeomSPD300.h"
-
 ClassImp(AliITSgeomSPD300)
 
 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
@@ -325,8 +276,6 @@ const Int_t   knbinz = 279;    // number of pixels along z direction.
     Int_t i;
     Float_t dx=0.0,dz=0.0;
 
-//    cout << "AliITSgeomSPD300 default creator called: start" << endl;
-
     SetNbinX(knbinx); // default number of bins in x.
     SetNbinZ(knbinz); // default number of bins in z.
 
@@ -346,8 +295,7 @@ const Int_t   knbinz = 279;    // number of pixels along z direction.
 
     if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) 
        Warning("Default Creator","Detector size may not be write.");
-    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
-//    cout << "AliITSgeomSPD300 default creator called: end" << endl;
+    SetShape("ActiveSPD","Active volume of SPD","",dx,kdy,dz);
 }
 //----------------------------------------------------------------------
 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
@@ -368,56 +316,6 @@ istream &operator>>(istream &is,AliITSgeomSPD300 &r){
     return is;
 }
 //=====================================================================
-/*
-$Log$
-Revision 1.14  2001/10/19 21:32:35  nilsen
-Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
-cleanded up a little bit of code.
-
-Revision 1.13  2001/10/12 22:07:20  nilsen
-A patch for C++ io manipulation functions so that they will work both
-with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
-other platforms.
-
-Revision 1.12  2001/08/24 21:06:37  nilsen
-Added more documentation, fixed up some coding violations, and some
-forward declorations.
-
-Revision 1.11  2001/05/16 08:17:49  hristov
-Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
-
-Revision 1.10  2001/04/26 22:44:34  nilsen
-Bug fix.
-
-Revision 1.9  2001/02/09 00:00:57  nilsen
-Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
-bugs in iostream based streamers used to read and write .det files. Fixed
-some detector sizes. Fixed bugs in some default-special constructors.
-
-Revision 1.8  2001/02/03 00:00:30  nilsen
-New version of AliITSgeom and related files. Now uses automatic streamers,
-set up for new formatted .det file which includes detector information.
-Additional smaller modifications are still to come.
-
-Revision 1.7  2000/10/02 16:32:35  barbera
-Forward declaration added
-
-Revision 1.1.2.8  2000/10/02 15:52:05  barbera
-Forward declaration added
-
-Revision 1.6  2000/07/10 16:07:18  fca
-Release version of ITS code
-
-Revision 1.4  2000/06/10 20:34:22  nilsen
-Fixed compilation warning with HP unix.
-
-Revision 1.3  2000/06/10 10:42:49  nilsen
-Fixed bug in copy and operator =.
-
-
-*/
-
-//#include "AliITSgeomSPD425Short.h"
 
 ClassImp(AliITSgeomSPD425Short)
 
@@ -479,7 +377,12 @@ AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) :
     for(i=0;i<knbinz;i++) dz += binSizeZ[i];
     dz *= 0.5;
 
-    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",
+    if(npar<3){
+       Error("AliITSgeomSPD425Short",
+              "npar=%d<3 array par must be at least [3] or larger",npar);
+       return;
+    } // end if
+    SetShape("ActiveSPD","Active volume of SPD","",
             par[0],par[1],par[2]);
     if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) 
        Warning("Default Creator","Detector size may not be write.");
@@ -511,57 +414,6 @@ istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
 }
 //======================================================================
 
-/*
-$Log$
-Revision 1.14  2001/10/19 21:32:35  nilsen
-Minor changes to remove compliation warning on gcc 2.92.2 compiler, and
-cleanded up a little bit of code.
-
-Revision 1.13  2001/10/12 22:07:20  nilsen
-A patch for C++ io manipulation functions so that they will work both
-with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
-other platforms.
-
-Revision 1.12  2001/08/24 21:06:37  nilsen
-Added more documentation, fixed up some coding violations, and some
-forward declorations.
-
-Revision 1.11  2001/05/16 08:17:49  hristov
-Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
-
-Revision 1.10  2001/04/26 22:44:34  nilsen
-Bug fix.
-
-Revision 1.9  2001/02/09 00:00:57  nilsen
-Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
-bugs in iostream based streamers used to read and write .det files. Fixed
-some detector sizes. Fixed bugs in some default-special constructors.
-
-Revision 1.8  2001/02/03 00:00:30  nilsen
-New version of AliITSgeom and related files. Now uses automatic streamers,
-set up for new formatted .det file which includes detector information.
-Additional smaller modifications are still to come.
-
-Revision 1.7  2000/10/02 16:32:35  barbera
-Forward declaration added
-
-Revision 1.1.2.8  2000/10/02 15:52:05  barbera
-Forward declaration added
-
-Revision 1.6  2000/07/10 16:07:18  fca
-Release version of ITS code
-
-Revision 1.4  2000/06/10 20:34:22  nilsen
-Fixed compilation warning with HP unix.
-
-Revision 1.3  2000/06/10 10:42:49  nilsen
-Fixed bug in copy and operator =.
-
-
-*/
-
-//#include "AliITSgeomSPD425Long.h"
-
 ClassImp(AliITSgeomSPD425Long)
 
 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
@@ -615,7 +467,7 @@ AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
     for(i=0;i<knbinz;i++) dz += binSizeZ[i];
     dz *= 0.5;
 
-    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
+    SetShape("ActiveSPD","Active volume of SPD","",dx,kdy,dz);
     if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4) 
        Warning("Default Creator","Detector size may not be write.");