]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New version of AliITSgeom and related files. Now uses automatic streamers,
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 3 Feb 2001 00:02:43 +0000 (00:02 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 3 Feb 2001 00:02:43 +0000 (00:02 +0000)
set up for new formatted .det file which includes detector information.
Additional smaller modifications are still to come.

12 files changed:
ITS/AliITSgeom.cxx
ITS/AliITSgeom.h
ITS/AliITSgeomMatrix.cxx
ITS/AliITSgeomMatrix.h
ITS/AliITSgeomSDD.cxx
ITS/AliITSgeomSDD.h
ITS/AliITSgeomSPD.cxx
ITS/AliITSgeomSPD.h
ITS/AliITSgeomSSD.cxx
ITS/AliITSgeomSSD.h
ITS/ITSLinkDef.h
ITS/Makefile

index 7b873ae34e560e99d5bf221891316f015e075565..eda68aef36d163f7ab1846bdd51e6c54143723a2 100644 (file)
@@ -15,9 +15,6 @@
 
 /*
 $Log$
-Revision 1.12  2001/01/17 15:41:27  barbera
-Some corrections suggested by Peter Hristov added
-
 Revision 1.11  2000/10/02 16:32:35  barbera
 Forward declaration added
 
@@ -174,14 +171,18 @@ pixel coordinate system.
 #include <iostream.h>
 #include <fstream.h>
 #include <iomanip.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+
+#include <TSystem.h>
+#include <TVector.h>
 #include <TObject.h>
 #include <TRandom.h>
 
 #include "AliITSgeom.h"
-#include "AliITSgeomMatrix.h"
+//#include "AliITSgeomMatrix.h" // include in AliITSgeom.h
 #include "AliITSgeomSPD.h"
 #include "AliITSgeomSDD.h"
 #include "AliITSgeomSSD.h"
@@ -194,17 +195,62 @@ AliITSgeom::AliITSgeom(){
 //     The default constructor for the AliITSgeom class. It, by default,
 // sets fNlayers to zero and zeros all pointers.
 ////////////////////////////////////////////////////////////////////////
-  // Default constructor.
-  // Do not allocate anything zero everything
-   fTrans   = 0; // standard GEANT global/local coordinate system.
-   fNlayers = 0;
-   fNlad    = 0;
-   fNdet    = 0;
-   fGm      = 0;
-   fShape   = 0;
-   return;
+    // Default constructor.
+    // Do not allocate anything zero everything
+    fTrans   = 0; // standard GEANT global/local coordinate system.
+    fNlayers = 0;
+    fNlad    = 0;
+    fNdet    = 0;
+    fGm      = 0;
+    fShape   = 0;
+    strcpy(fVersion,"test");
+    return;
+}
+//_____________________________________________________________________
+AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets,
+                      Int_t mods){
+////////////////////////////////////////////////////////////////////////
+//     A simple constructor to set basic geometry class variables
+// Input:
+//      itype  the type of transofmation kept.
+//             0 => Standard Geant
+//         bit 1 => ITS tracking
+//         bit 2 => A change in the coordiante system has been made.
+//         others are still to be defined as needed.
+//      nlayers The number of ITS layers also set the size of the arrays
+//      *nlads  an array of the number of ladders for each layer
+//      *ndets  an array of the number of detectors per ladder for each layer.
+////////////////////////////////////////////////////////////////////////
+    Int_t i;
+
+    fTrans    = itype;
+    fNlayers  = nlayers;
+    fNlad     = new Int_t[nlayers];
+    fNdet     = new Int_t[nlayers];
+    for(i=0;i<nlayers;i++){fNlad[i] = nlads[i];fNdet[i] = ndets[i];}
+    fNmodules = mods;
+    fGm       = new TObjArray(mods,0);
+    fShape    = new TObjArray(3); // default value
+    for(i=0;i<3;i++) fShape->AddAt(0,i);
+    strcpy(fVersion,"test");
+    return;
 }
+//______________________________________________________________________
+void AliITSgeom::CreatMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det,
+                            AliITSDetector idet,Double_t tran[3],
+                            Double_t rot[10]){
+    Int_t id[3];
+    Double_t r[3][3] = {{1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
 
+    if(fGm->At(mod)!=0) delete fGm->At(mod);
+    id[0] = lay; id[1] = lad; id[2] = det;
+    if(rot[9]!=0.0) { // null rotation
+       r[0][0] = rot[0]; r[0][1] = rot[1]; r[0][2] = rot[2];
+       r[1][0] = rot[3]; r[1][1] = rot[4]; r[1][2] = rot[5];
+       r[2][0] = rot[6]; r[2][1] = rot[7]; r[2][2] = rot[8];
+    } // end if
+    fGm->AddAt(new AliITSgeomMatrix(idet,id,r,tran),mod);
+}
 //_____________________________________________________________________
 AliITSgeom::~AliITSgeom(){
 ////////////////////////////////////////////////////////////////////////
@@ -217,8 +263,8 @@ AliITSgeom::~AliITSgeom(){
   // Default destructor.
   // if arrays exist delete them. Then set everything to zero.
    if(fGm!=0){
-      for(Int_t i=0;i<fNmodules;i++) delete fGm[i];
-      delete [] fGm;
+      for(Int_t i=0;i<fNlayers;i++) delete fGm->At(i);
+      delete fGm;
    } // end if fGm!=0
    if(fNlad!=0) delete[] fNlad;
    if(fNdet!=0) delete[] fNdet;
@@ -230,7 +276,179 @@ AliITSgeom::~AliITSgeom(){
 }
 //______________________________________________________________________
 void AliITSgeom::ReadNewFile(const char *filename){
-    printf("New file format not defined yet\n");
+    Int_t ncmd=9;
+    char *cmda[]={"Version"        ,"fTrans"  ,"fNmodules",
+                 "fNlayers"       ,"fNladers","fNdetectors",
+                 "fNDetectorTypes","fShape"  ,"Matrix"};
+    Int_t i,j,lNdetTypes,ldet;
+    char cmd[20],c;
+    AliITSgeomSPD *spd;
+    AliITSgeomSDD *sdd;
+    AliITSgeomSSD *ssd;
+    AliITSgeomMatrix *m;
+    ifstream *fp;
+    char *filtmp;
+
+    filtmp = gSystem->ExpandPathName(filename);
+    fp = new ifstream(filtmp,ios::in);  // open file to write
+    while(fp->get(c)!=NULL){ // for ever loop
+       if(c==' ') continue; // remove blanks
+       if(c=='\n') continue;
+       if(c=='#' || c=='!'){for(;fp->get(c)!=NULL,c!='\n';); continue;}
+       if(c=='/'){
+           fp->get(c);{
+               if(c=='/'){for(;fp->get(c)!=NULL,c!='\n';);continue;}
+               if(c=='*'){
+               NotYet:
+                   for(;fp->get(c)!=NULL,c!='*';);
+                   fp->get(c);{
+                       if(c=='/') continue;
+                       goto NotYet;
+                   } //
+               } // end if c=='*'
+           } // end if second /
+       } // end if first /
+       fp->unget();
+       *fp >> cmd;
+       for(i=0;i<ncmd;i++) if(strcmp(cmd,cmda[i])==0) break;
+       switch (i){
+       case 0:   // Version
+           *fp >> fVersion;
+           break;
+       case 1:  // fTrans
+           *fp >> fTrans;
+           break;
+       case 2:  // fNModules
+           *fp >> fNmodules;
+           if(fGm!=0){
+               for(j=0;j<fGm->GetEntriesFast();j++) delete fGm->At(j);
+               delete fGm;
+           } // end if
+           fGm = new TObjArray(fNmodules,0);
+           break;
+       case 3:  // fNlayers
+           *fp >> fNlayers;
+           if(fNlad!=0) delete fNlad;
+           if(fNdet!=0) delete fNdet;
+           fNlad = new Int_t[fNlayers];
+           fNdet = new Int_t[fNlayers];
+           break;
+       case 4:  // fNladers
+           for(j=0;j<fNlayers;j++) *fp >> fNlad[j];
+           break;
+       case 5:  // fNdetectors
+           for(j=0;j<fNlayers;j++) *fp >> fNdet[j];
+           break;
+       case 6:  // fNDetectorTypes
+           *fp >> lNdetTypes;
+           if(fShape!=0){
+               for(j=0;j<fShape->GetEntriesFast();j++) delete fShape->At(j);
+               delete fShape;
+           } // end if
+           fShape = new TObjArray(lNdetTypes,0);
+           break;
+       case 7:  // fShape
+           *fp >> ldet;
+           if(fShape==0) fShape = new TObjArray(4,0);
+           switch (ldet){
+           case kSPD :
+               ReSetShape(ldet,(TObject*) new AliITSgeomSPD());
+               spd = (AliITSgeomSPD*) (fShape->At(ldet));
+               *fp >> *spd;
+               spd = 0;
+               break;
+           case kSDD :
+               ReSetShape(ldet,(TObject*) new AliITSgeomSDD());
+               sdd = (AliITSgeomSDD*) (fShape->At(ldet));
+               *fp >> *sdd;
+               sdd = 0;
+               break;
+           case kSSD : case kSSDp :
+               ReSetShape(ldet,(TObject*) new AliITSgeomSSD());
+               ssd = (AliITSgeomSSD*) (fShape->At(ldet));
+               *fp >> *ssd;
+               ssd = 0;
+               break;
+           default:
+               Error("AliITSgeom::ReadNewFile","Unknown fShape type");
+               for(;fp->get(c)==NULL,c!='\n';); // skip to end of line.
+               break;
+           } // end switch
+           break;
+       case 8:  // Matrix
+           *fp >> ldet;
+           if(fGm==0) fGm = new TObjArray(2270,0);
+           if(fGm->At(ldet)!=0) delete (fGm->At(ldet));
+           fGm->AddAt((TObject*)new AliITSgeomMatrix(),ldet);
+           m = (AliITSgeomMatrix*) fGm->At(ldet);
+           *fp >> *m;
+           m = 0;
+           break;
+       default:
+           Error("AliITSgeom::ReadNewFile","Data line");
+           for(;fp->get(c)==NULL,c!='\n';); // skip this line
+           break;
+       } // end switch i
+    } // end while
+    delete fp;
+
+    return;
+}
+//______________________________________________________________________
+void AliITSgeom::WriteNewFile(const char *filename){
+// Writes AliITSgeom, AliITSgeomMatrix, and the defined AliITSgeomS*D classes
+// to a file in a format that is more readable and commentable.
+    ofstream *fp;
+    Int_t i;
+    char *filtmp;
+
+    filtmp = gSystem->ExpandPathName(filename);
+    fp = new ofstream(filtmp,ios::out);  // open file to write
+    *fp << "//Comment lines begin with two //, one #, or one !" << endl;
+    *fp << "#Blank lines are skipped including /* and */ sections." << endl;
+    *fp << "!and, in principle the order of the lines is not important" <<endl;
+    *fp << "/* In AliITSgeom.h are defined an enumerated type called" << endl;
+    *fp << " AliITSDetectors These are kSPD=" << (Int_t) kSPD ;
+    *fp << ", kSDD=" << (Int_t) kSDD << ", kSSD=" << (Int_t) kSSD;
+    *fp << ", and kSSDp=" << (Int_t) kSSDp << "*/" << endl;
+    *fp << "Version " << fVersion << endl;//This should be consistant with the
+                                           // geometry version.
+    *fp << "fTrans " << fTrans << endl;
+    *fp << "fNmodules " << fNmodules << endl;
+    *fp << "fNlayers " << fNlayers << endl;
+    *fp << "fNladers ";
+    for(i=0;i<fNlayers;i++) *fp << fNlad[i] << " ";
+    *fp << endl;
+    *fp << "fNdetectors ";
+    for(i=0;i<fNlayers;i++) *fp << fNdet[i] << " ";
+    *fp << endl;
+    *fp << "fNDetectorTypes " << fShape->GetEntriesFast() << endl;
+    for(i=0;i<fShape->GetEntriesFast();i++){
+       if(!IsShapeDefined(i)) continue; // only print out used shapes.
+       switch (i){
+       case kSPD :
+           *fp << "fShape " << (Int_t) kSPD << " ";
+           *fp << *((AliITSgeomSPD*)(fShape->At(i)));
+           break;
+       case kSDD :
+           *fp << "fShape " << (Int_t) kSDD << " ";
+           *fp << *((AliITSgeomSDD*)(fShape->At(i)));
+           break;
+       case kSSD : case kSSDp :
+           *fp << "fShape " << i << " ";
+           *fp << *((AliITSgeomSSD*)(fShape->At(i)));
+           break;
+       default:
+           Error("AliITSgeom::WriteNewFile","Unknown Shape value");
+       } // end switch (i)
+    } // end for i
+    for(i=0;i<fNmodules;i++){
+       *fp << "Matrix " << i << " ";
+       *fp << *GetGeomMatrix(i);
+    } // end for i
+    *fp << "//End of File" << endl;;
+
+    delete fp;
     return;
 }
 //_____________________________________________________________________
@@ -239,14 +457,18 @@ AliITSgeom::AliITSgeom(const char *filename){
 //     The constructor for the AliITSgeom class. All of the data to fill
 // this structure is read in from the file given my the input filename.
 ////////////////////////////////////////////////////////////////////////
-   FILE     *pf;
+   FILE     *pf=0;
    Int_t    i,lm=0,id[3];
    Int_t    l,a,d;
    Float_t  x,y,z,o,p,q,r,s,t;
    Double_t rot6[6],tran[3];
    char     buf[200],*buff=0; // input character buffer;
+   char *filtmp;
 
-   pf = fopen(filename,"r");
+   filtmp = gSystem->ExpandPathName(filename);
+   fShape = 0;
+   strcpy(fVersion,"DefauleV5");
+   pf = fopen(filtmp,"r");
 
    fNlayers = 6; // set default number of ladders
 TryAgain:
@@ -288,15 +510,10 @@ TryAgain:
        goto TryAgain;
    } // end if lm>fNlayers
    // counted the number of ladders and detectors now allocate space.
-   fGm = new AliITSgeomMatrix*[fNmodules];
+   fGm = new TObjArray(fNmodules,0);
 
    // Set up Shapes for a default configuration of 6 layers.
    fTrans   = 0; // standard GEANT global/local coordinate system.
-   fShape = new TObjArray(3);
-   AddShape((TObject *) new AliITSgeomSPD());  // shape 0
-   AddShape((TObject *) new AliITSgeomSDD());  // shape 1
-   AddShape((TObject *) new AliITSgeomSPD());  // shape 2
-
    // prepare to read in transforms
    lm = 0; // reuse lm as counter of modules.
    rewind(pf); // start over reading file
@@ -324,13 +541,13 @@ TryAgain:
       rot6[3] = (Double_t)r;rot6[4] = (Double_t)s;rot6[5] = (Double_t)t;
       switch (l){
       case 1: case 2: // layer 1 or2 SPD
-          fGm[lm++] = new AliITSgeomMatrix(rot6,0,id,tran);
+          fGm->AddAt(new AliITSgeomMatrix(rot6,kSPD,id,tran),lm++);
          break;
       case 3: case 4: // layer 3 or 4 SDD
-          fGm[lm++] = new AliITSgeomMatrix(rot6,1,id,tran);
+          fGm->AddAt(new AliITSgeomMatrix(rot6,kSDD,id,tran),lm++);
          break;
       case 5: case 6: // layer 5 or 6 SSD
-          fGm[lm++] = new AliITSgeomMatrix(rot6,2,id,tran);
+          fGm->AddAt(new AliITSgeomMatrix(rot6,kSSD,id,tran),lm++);
          break;
       } // end switch
    } // end while ever loop
@@ -364,7 +581,7 @@ void AliITSgeom::operator=(AliITSgeom &source){
 
    // if there is an old structure allocated delete it first.
    if(this->fGm != 0){
-      for(i=0;i<this->fNmodules;i++) delete this->fGm[i];
+      for(i=0;i<this->fNmodules;i++) delete this->fGm->At(i);
       delete this->fGm;
    } // end if fGm != 0 
    if(fNlad != 0) delete[] fNlad;
@@ -378,9 +595,10 @@ void AliITSgeom::operator=(AliITSgeom &source){
    this->fNdet = new Int_t[fNlayers];
    for(i=0;i<this->fNlayers;i++) this->fNdet[i] = source.fNdet[i];
    this->fShape = new TObjArray(*(source.fShape));//This does not make a proper copy.
-   this->fGm = new AliITSgeomMatrix*[this->fNmodules];
+   this->fGm = new TObjArray(this->fNmodules,0);
    for(i=0;i<this->fNmodules;i++){
-       this->fGm[i] = new AliITSgeomMatrix(*(source.fGm[i]));
+       this->fGm->AddAt(new AliITSgeomMatrix(*(
+          (AliITSgeomMatrix*)(source.fGm->At(i)))),i);
    } // end for i
    return;
 }//_____________________________________________________________________
@@ -398,11 +616,11 @@ Int_t AliITSgeom::GetModuleIndex(const Int_t lay,const Int_t lad,
     j = 0;
     for(k=0;k<lay-1;k++) j += fNdet[k]*fNlad[k];
     i = i+j;
-    fGm[i]->GetIndex(id);
+    GetGeomMatrix(i)->GetIndex(id);
     if(id[0]==lay&&id[1]==lad&&id[2]==det) return i;
     // Array of modules fGm is not in expected order. Search for this index
     for(i=0;i<fNmodules;i++){
-       fGm[i]->GetIndex(id);
+       GetGeomMatrix(i)->GetIndex(id);
        if(id[0]==lay&&id[1]==lad&&id[2]==det) return i;
     } // end for i
     // This layer ladder and detector combination does not exist return -1.
@@ -419,7 +637,7 @@ void AliITSgeom::GetModuleId(const Int_t index,
 ////////////////////////////////////////////////////////////////////////
     Int_t id[3];
 
-    fGm[index]->GetIndex(id);
+    GetGeomMatrix(index)->GetIndex(id);
     lay = id[0]; lad = id[1]; det = id[2];
     return;
 
@@ -500,7 +718,8 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){
 // print to a file pointed to by the file pointer fp the difference
 // between two AliITSgeom classes. The format of the file is basicly,
 // define d? to be the difference between the same element of the two
-// classes. For example dfrx = this->fGm[i][j].frx - other->fGm[i][j].frx.
+// classes. For example dfrx = this->GetGeomMatrix(i)->frx 
+// - other->GetGeomMatrix(i)->frx.
 // if(at least one of dfx0, dfy0, dfz0,dfrx,dfry,dfrz are non zero) then print
 // layer ladder detector dfx0 dfy0 dfz0 dfrx dfry dfrz
 // if(at least one of the 9 elements of dfr[] are non zero) then print
@@ -590,14 +809,8 @@ void AliITSgeom::PrintData(FILE *fp,
 //___________________________________________________________________________
 ofstream & AliITSgeom::PrintGeom(ofstream &R__b){
 ////////////////////////////////////////////////////////////////////////
-//     The default Streamer function "written by ROOT" doesn't write out
-// the arrays referenced by pointers. Therefore, a specific Streamer function
-// has to be written. This function should not be modified but instead added
-// on to so that older versions can still be read. The proper handling of
-// the version dependent streamer function hasn't been written do to the lack
-// of finding an example at the time of writing.
+//     Stream out an object of class AliITSgeom to standard output.
 ////////////////////////////////////////////////////////////////////////
-   // Stream an object of class AliITSgeom.
     Int_t i;
 
     R__b.setf(ios::scientific);
@@ -607,27 +820,21 @@ ofstream & AliITSgeom::PrintGeom(ofstream &R__b){
     for(i=0;i<fNlayers;i++) R__b << fNlad[i] << " ";
     for(i=0;i<fNlayers;i++) R__b << fNdet[i] << "\n";
     for(i=0;i<fNmodules;i++) {
-       R__b <<setprecision(16) << *(fGm[i]) << "\n";
+       R__b <<setprecision(16) << *(GetGeomMatrix(i)) << "\n";
     } // end for i
     return R__b;
 }
 //___________________________________________________________________________
 ifstream & AliITSgeom::ReadGeom(ifstream &R__b){
 ////////////////////////////////////////////////////////////////////////
-//     The default Streamer function "written by ROOT" doesn't write out
-// the arrays referenced by pointers. Therefore, a specific Streamer function
-// has to be written. This function should not be modified but instead added
-// on to so that older versions can still be read. The proper handling of
-// the version dependent streamer function hasn't been written do to the lack
-// of finding an example at the time of writing.
+//     Stream in an object of class AliITSgeom from standard input.
 ////////////////////////////////////////////////////////////////////////
-   // Stream an object of class AliITSgeom.
       Int_t i;
 
       fNlad = new Int_t[fNlayers];
       fNdet = new Int_t[fNlayers];
       if(fGm!=0){
-         for(i=0;i<fNmodules;i++) delete fGm[i];
+         for(i=0;i<fNmodules;i++) delete GetGeomMatrix(i);
          delete fGm;
       } // end if fGm!=0
 
@@ -636,13 +843,14 @@ ifstream & AliITSgeom::ReadGeom(ifstream &R__b){
       fNdet = new Int_t[fNlayers];
       for(i=0;i<fNlayers;i++) R__b >> fNlad[i];
       for(i=0;i<fNlayers;i++) R__b >> fNdet[i];
-      fGm = new AliITSgeomMatrix*[fNmodules];
+      fGm = new TObjArray(fNmodules,0);
       for(i=0;i<fNmodules;i++){
-         fGm[i] = new AliITSgeomMatrix;
-         R__b >> *(fGm[i]);
+         fGm->AddAt(new AliITSgeomMatrix,i);
+         R__b >> *(GetGeomMatrix(i));
       } // end for i
       return R__b;
 }
+//___________________________________________________________________________
 
 //______________________________________________________________________
 //     The following routines modify the transformation of "this"
@@ -826,8 +1034,8 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){
 
    *this = source;  // copy everything
    for(i=0;i<GetIndexMax();i++){
-       fGm[i]->GetIndex(id);
-       fGm[i]->GetMatrix(R0);
+       GetGeomMatrix(i)->GetIndex(id);
+       GetGeomMatrix(i)->GetMatrix(R0);
        if(id[0]==1){ // Layer 1 is treated different from the others.
           for(j=0;j<3;j++) for(k=0;k<3;k++){
               R1[j][k] = 0.;
@@ -839,7 +1047,7 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){
               for(l=0;l<3;l++) R1[j][k] += A1[j][l]*R0[l][k];
           } // end for j,k
        } // end if
-       fGm[i]->SetMatrix(R1);
+       GetGeomMatrix(i)->SetMatrix(R1);
    } // end for i
    this->fTrans = (this->fTrans && 0xfffe) + 1;  // set bit 0 true.
    return;
@@ -857,7 +1065,7 @@ Int_t AliITSgeom::GetNearest(const Double_t g[3],const Int_t lay){
 
      for(i=0;i<fNmodules;i++){
           if(t){GetModuleId(i,l,a,e);if(l!=lay) continue;}
-          if((d=fGm[i]->Distance2(g))<dn){
+          if((d=GetGeomMatrix(i)->Distance2(g))<dn){
                dn = d;
                in = i;
           } // end if
@@ -886,7 +1094,7 @@ void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],const Int_t lay){
      for(i=0;i<fNmodules;i++){
           if(t){GetModuleId(i,l,a,e);if(l!=lay) continue;}
           for(a=0;a<27;a++){
-               d = fGm[i]->Distance2(g);
+               d = GetGeomMatrix(i)->Distance2(g);
                if(d<dn[a]){
                    for(e=26;e>a;e--){dn[e] = dn[e-1];in[e] = in[e-1];}
                    dn[a] = d; in[a] = i;
index 70f1bffb12e47a6caeafffbec2fb570ac2780bcb..77b64937c17cddf936370affd19bd4ee82fd007f 100644 (file)
 // the information needed to do the coordinate transformation are kept in
 // a specialized structure for ease of implementation.
 /////////////////////////////////////////////////////////////////////////
-#include <fstream.h>
 #include <TObjArray.h>
 #include <TVector.h>
 
-#include "AliITSgeomSPD.h"
-#include "AliITSgeomSDD.h"
-#include "AliITSgeomSSD.h"
 #include "AliITSgeomMatrix.h"
 
-typedef enum {kSPD=0, kSDD=1, kSSD=2} AliITSDetector;
+class ifstream;
+class ofstream;
+
+
+typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3} AliITSDetector;
 
 //_______________________________________________________________________
 
@@ -35,17 +35,44 @@ class AliITSgeom : public TObject {
  public:
     AliITSgeom();                      // Default constructor
     AliITSgeom(const char *filename);  // Constructor
-    void ReadNewFile(const char *filename); // Constructor for new format.
+    AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets,
+              Int_t nmods); // Constructor
+    //     this function allocates a AliITSgeomMatrix for a particular
+    // module.
+    void CreatMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det,
+                    AliITSDetector idet,Double_t tran[3],Double_t rot[10]);
+    void ReadNewFile(const char *filename);  // Constructor for new format.
+    void WriteNewFile(const char *filename); // Output for new format.
     AliITSgeom(AliITSgeom &source);    // Copy constructor
     void operator=(AliITSgeom &source);// = operator
     virtual ~AliITSgeom();             // Default destructor
 // Getters
     Int_t GetTransformationType() const {return fTrans;}
 //
+    // returns kTRUE if the tranformation defined by this class is
+    // for Global Geant coordiante system to the local Geant coordinate system
+    // of the detector. These are the transformation used by GEANT.
     Bool_t IsGeantToGeant()     const {return (fTrans == 0);}
+    // returns kTRUE if the tranformation defined by this class is
+    // for Global Geant coordiante system to the local "Tracking" coordinate
+    // system of the detector. These are the transformation used by the
+    // Tracking code.
     Bool_t IsGeantToTracking()  const {return ((fTrans&&0xfffe)!= 0);}
+    // returns kTRUE if the tranformation defined by this class is
+    // for Global Geant coordiante system to the local Geant coordinate system
+    // of the detector but may have been displaced by some typicaly small
+    // abount. These are modified transformation simular to that used by GEANT.
     Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);}
+    // returns kTRUE if the shape defined by ishape has been defined in this
+    // set of transformations. Typical values of ishape are kSPD, kSDD, kSSD,
+    // SSD2.
+    Bool_t IsShapeDefined(Int_t ishape){
+       if(fShape!=0) return (fShape->At(ishape)!=0);else return fShape!=0;}
 //
+    //     This function returns a pointer to the particular AliITSgeomMatrix
+    // class for a specific module index.
+    AliITSgeomMatrix *GetGeomMatrix(Int_t index){
+       return (AliITSgeomMatrix*)(fGm->At(index));}
     //     This function returns the number of detectors/ladder for a give 
     // layer. In particular it returns fNdet[layer-1].
     Int_t GetNdetectors(const Int_t lay) const {return fNdet[lay-1];}
@@ -94,7 +121,7 @@ class AliITSgeom : public TObject {
     //     This function returns the rotation angles for a give module 
     // in the Double point array ang[3]. The angles are in radians
     void  GetAngles(const Int_t index,Double_t *ang) {
-                    fGm[index]->GetAngles(ang);}
+                    GetGeomMatrix(index)->GetAngles(ang);}
     //     This function returns the rotation angles for a give module
     // in the three floating point variables provided. rx = frx,
     // fy = fry, rz = frz. The angles are in radians
@@ -111,13 +138,13 @@ class AliITSgeom : public TObject {
     //     This function returns the 6 GEANT rotation angles for a give 
     // module in the double point array ang[3]. The angles are in degrees
     void  GetGeantAngles(const Int_t index,Double_t *ang){
-                          fGm[index]->SixAnglesFromMatrix(ang);}
+       GetGeomMatrix(index)->SixAnglesFromMatrix(ang);}
 //
     //     This function returns the Cartesian translation for a give
     // module in the Double array t[3]. The units are
     // those of the Monte Carlo, generally cm.
     void  GetTrans(const Int_t index,Double_t *t) {
-                   fGm[index]->GetTranslation(t);}
+                   GetGeomMatrix(index)->GetTranslation(t);}
     //     This function returns the Cartesian translation for a give
     // module index in the three floating point variables provided.
     // x = fx0, y = fy0, z = fz0. The units are those of the Mont
@@ -147,7 +174,7 @@ class AliITSgeom : public TObject {
     //     This function returns the rotation matrix in Double
     // precision for a given module.
     void  GetRotMatrix(const Int_t index,Double_t mat[3][3]){
-          fGm[index]->GetMatrix(mat);}
+          GetGeomMatrix(index)->GetMatrix(mat);}
     //     This function returns the rotation matrix in a Double
     // precision pointer for a given module. mat[i][j] => mat[3*i+j].
     void  GetRotMatrix(const Int_t index,Double_t *mat){
@@ -166,37 +193,44 @@ class AliITSgeom : public TObject {
     //     This function returns the rotation matrix in a floating
     // precision pointer for a given module. mat[i][j] => mat[3*i+j].
     void  GetRotMatrix(const Int_t index,Float_t *mat){
-          Double_t rot[3][3];fGm[index]->GetMatrix(rot);
+          Double_t rot[3][3];
+         GetGeomMatrix(index)->GetMatrix(rot);
           for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
 //
+    //     Will define fShape if it isn't already defined.
+    void DefineShapes(const Int_t size=4)
+       {if(fShape==0) fShape = new TObjArray(size);else fShape->Expand(size);}
+    //     this function returns a pointer to the class decribing a particluar
+    // detectory type based on AliITSDetector value. This will return a pointer
+    // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD,
+    // for example.
+    virtual TObject *GetShape(const AliITSDetector idet)
+       {return fShape->At((Int_t)idet);};
     //     This function returns a pointer to the class describing the
     // detector for a particular module index. This will return a pointer
     // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD,
     // for example.
-    virtual TObject *GetShape(const Int_t index)
-                       {return fShape->At(fGm[index]->GetDetectorIndex());}
+    virtual TObject *GetShape(const Int_t index){
+       return fShape->At(GetGeomMatrix(index)->
+                         GetDetectorIndex());}
     //     This function returns a pointer to the class describing the
     // detector for a particular layer ladder and detector numbers. This
     // will return a pointer to one of the classes AliITSgeomSPD,
     // AliITSgeomSDD, or AliITSgeomSSD, for example.
     virtual TObject *GetShape(const Int_t lay,const Int_t lad,const Int_t det)
                             {return GetShape(GetModuleIndex(lay,lad,det));}
-//
-    //     This function returns a pointer to the particular AliITSgeomMatrix
-    // class for a specific module index.
-    AliITSgeomMatrix *GetGeomMatrix(Int_t index){return fGm[index];}
 //
 //  Setters
     //     Sets the rotation angles and matrix for a give module index
     // via the double precision array a[3] [radians].
     void SetByAngles(const Int_t index,const Double_t a[]){
-       fGm[index]->SetAngles(a);}
+       GetGeomMatrix(index)->SetAngles(a);}
     //     Sets the rotation angles and matrix for a give module index
     // via the 3 floating precision variables rx, ry, and rz [radians].
     void SetByAngles(const Int_t index,
                     const Float_t rx,const Float_t ry,const Float_t rz) {
                      Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz;
-                     fGm[index]->SetAngles(a);}
+                     GetGeomMatrix(index)->SetAngles(a);}
     //     Sets the rotation angles and matrix for a give layer, ladder,
     // and detector numbers via the 3 floating precision variables rx,
     // ry, and rz [radians].
@@ -208,7 +242,7 @@ class AliITSgeom : public TObject {
     // via the Double precision array a[6] [degree]. The angles are those
     // defined by GEANT 3.12.
     void SetByGeantAngles(const Int_t index,const Double_t *ang){
-       fGm[index]->MatrixFromSixAngles(ang);}
+       GetGeomMatrix(index)->MatrixFromSixAngles(ang);}
     //     Sets the rotation angles and matrix for a give layer, ladder
     // and detector, in the array id[3] via the Double precision array
     // a[6] [degree]. The angles are those defined by GEANT 3.12.
@@ -225,7 +259,7 @@ class AliITSgeom : public TObject {
     // array x[3], for the Cartesian coordinate transformation
     // for a give module index.
     void SetTrans(const Int_t index,Double_t x[]){
-       fGm[index]->SetTranslation(x);}
+       GetGeomMatrix(index)->SetTranslation(x);}
     //     This function sets a new translation vector, given by the three
     // variables x, y, and z, for the Cartesian coordinate transformation
     // for the detector defined by layer, ladder and detector.
@@ -269,7 +303,7 @@ class AliITSgeom : public TObject {
     // given in two floating point arrays g[3], and l[3].
     void GtoL(const Int_t index,const Float_t *g,Float_t *l){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
-         fGm[index]->GtoLPosition(dg,dl);
+         GetGeomMatrix(index)->GtoLPosition(dg,dl);
          for(i=0;i<3;i++) l[i] =dl[i];}
     //     Transforms from the ALICE Global coordinate system
     // to the detector local coordinate system for the detector
@@ -292,7 +326,7 @@ class AliITSgeom : public TObject {
     // given in two Double point arrays g[3], and l[3].
     void GtoL(const Int_t index,const Double_t *g,Double_t *l){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
-         fGm[index]->GtoLPosition(dg,dl);
+         GetGeomMatrix(index)->GtoLPosition(dg,dl);
          for(i=0;i<3;i++) l[i] =dl[i];}
 //
     //     Transforms from the ALICE Global coordinate system
@@ -301,7 +335,7 @@ class AliITSgeom : public TObject {
     // coordinate are given in two Double point arrays g[3], and l[3].
     void GtoLtracking(const Int_t index,const Double_t *g,Double_t *l){
         if(IsGeantToTracking()) GtoL(index,g,l);
-        else fGm[index]->GtoLPositionTracking(g,l);}
+        else GetGeomMatrix(index)->GtoLPositionTracking(g,l);}
     //     Transforms from the ALICE Global coordinate system
     // to the detector local coordinate system (used for ITS tracking)
     // for the detector id[3]. The global and local
@@ -331,7 +365,7 @@ class AliITSgeom : public TObject {
     // coordinate are given in two float point arrays g[3], and l[3].
     void GtoLMomentum(const Int_t index,const Float_t *g,Float_t *l){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
-         fGm[index]->GtoLMomentum(dg,dl);
+         GetGeomMatrix(index)->GtoLMomentum(dg,dl);
          for(i=0;i<3;i++) l[i] =dl[i];}
     //     Transforms of momentum types of quantities from the ALICE
     // Global coordinate system to the detector local coordinate system
@@ -347,7 +381,7 @@ class AliITSgeom : public TObject {
     // coordinate are given in two Double point arrays g[3], and l[3].
     void GtoLMomentum(const Int_t index,const Double_t *g,Double_t *l){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
-         fGm[index]->GtoLMomentum(dg,dl);
+         GetGeomMatrix(index)->GtoLMomentum(dg,dl);
          for(i=0;i<3;i++) l[i] =dl[i];}
 //
     //     Transforms of momentum types of quantities from the ALICE
@@ -357,7 +391,7 @@ class AliITSgeom : public TObject {
     // arrays g[3], and l[3].
     void GtoLMomentumTracking(const Int_t index,const Double_t *g,Double_t *l){
          if(IsGeantToTracking()) GtoLMomentum(index,g,l);
-         else fGm[index]->GtoLMomentumTracking(g,l);}
+         else GetGeomMatrix(index)->GtoLMomentumTracking(g,l);}
     //     Transforms of momentum types of quantities from the ALICE
     // Global coordinate system to the detector local coordinate system
     // (used for ITS tracking) for the detector id[3].
@@ -395,7 +429,7 @@ class AliITSgeom : public TObject {
     // given in two floating point arrays g[3], and l[3].
     void LtoG(const Int_t index,const Float_t *l,Float_t *g){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
-         fGm[index]->LtoGPosition(dl,dg);
+         GetGeomMatrix(index)->LtoGPosition(dl,dg);
          for(i=0;i<3;i++) g[i] =dg[i];}
     //     Transforms from the detector local coordinate system
     // to the ALICE Global coordinate system for the detector
@@ -418,7 +452,7 @@ class AliITSgeom : public TObject {
     // given in two Double point arrays g[3], and l[3].
     void LtoG(const Int_t index,const Double_t *l,Double_t *g){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
-         fGm[index]->LtoGPosition(dl,dg);
+         GetGeomMatrix(index)->LtoGPosition(dl,dg);
          for(i=0;i<3;i++) g[i] =dg[i];}
 //
     //     Transforms from the detector local coordinate system (used
@@ -427,7 +461,7 @@ class AliITSgeom : public TObject {
     // coordinate are given in two Double point arrays g[3], and l[3].
     void LtoGtracking(const Int_t index,const Double_t *l,Double_t *g){
         if(IsGeantToTracking()) LtoG(index,l,g);
-        else fGm[index]->LtoGPositionTracking(l,g);}
+        else GetGeomMatrix(index)->LtoGPositionTracking(l,g);}
     //     Transforms from the detector local coordinate system (used
     // for ITS tracking) to the ALICE Global coordinate system 
     // for the detector id[3]. The global and local
@@ -457,7 +491,7 @@ class AliITSgeom : public TObject {
     // coordinate are given in two float point arrays g[3], and l[3].
     void LtoGMomentum(const Int_t index,const Float_t *l,Float_t *g){
          Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
-         fGm[index]->LtoGMomentum(dl,dg);
+         GetGeomMatrix(index)->LtoGMomentum(dl,dg);
          for(i=0;i<3;i++) g[i] =dg[i];}
     //     Transforms of momentum types of quantities from the detector
     // local coordinate system to the ALICE Global coordinate system
@@ -472,7 +506,7 @@ class AliITSgeom : public TObject {
     // for the detector module index number. The global and local
     // coordinate are given in two Double point arrays g[3], and l[3].
     void LtoGMomentum(const Int_t index,const Double_t *l,Double_t *g){
-         fGm[index]->LtoGMomentum(l,g);}
+         GetGeomMatrix(index)->LtoGMomentum(l,g);}
 //
     //     Transforms of momentum types of quantities from the detector 
     // local coordinate system (used for ITS tracking) to the detector
@@ -481,7 +515,7 @@ class AliITSgeom : public TObject {
     // arrays g[3], and l[3].
     void LtoGMomentumTracking(const Int_t index,const Double_t *l,Double_t *g){
          if(IsGeantToTracking()) LtoGMomentum(index,l,g);
-         else fGm[index]->LtoGMomentumTracking(l,g);}
+         else GetGeomMatrix(index)->LtoGMomentumTracking(l,g);}
     //     Transforms of momentum types of quantities from the detector
     // local coordinate system (used for ITS tracking) to the ALICE
     // Global coordinate system for the detector id[3].
@@ -573,7 +607,7 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void GtoLErrorMatrix(const Int_t index,const Double_t **g,Double_t **l){
-         fGm[index]->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);}
+         GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);}
 //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the ALICE Global coordinate system to a detector local coordinate
@@ -581,9 +615,9 @@ class AliITSgeom : public TObject {
     // by the module index number.
     void GtoLErrorMatrixTracking(const Int_t index,const Double_t **g,
                                 Double_t **l){
-       if(IsGeantToTracking()) fGm[index]->GtoLPositionError((
+       if(IsGeantToTracking()) GetGeomMatrix(index)->GtoLPositionError((
            Double_t (*)[3])g,(Double_t (*)[3])l);
-       else fGm[index]->GtoLPositionErrorTracking(
+       else GetGeomMatrix(index)->GtoLPositionErrorTracking(
             (Double_t (*)[3])g,(Double_t (*)[3])l);}
 //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
@@ -591,7 +625,7 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void LtoGErrorMatrix(const Int_t index,const Double_t **l,Double_t **g){
-         fGm[index]->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);}
+         GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);}
 //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the detector local coordinate system (used by ITS tracking) to a
@@ -599,9 +633,9 @@ class AliITSgeom : public TObject {
     // by the module index number.
     void LtoGErrorMatrixTracking(const Int_t index,const Double_t **l,
                                 Double_t **g){
-         if(IsGeantToTracking()) fGm[index]->LtoGPositionError((
+         if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError((
            Double_t (*)[3])g,(Double_t (*)[3])l);
-       else fGm[index]->LtoGPositionErrorTracking((Double_t (*)[3])l,
+       else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l,
                                               (Double_t (*)[3])g);}
 //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
@@ -629,7 +663,7 @@ class AliITSgeom : public TObject {
     // Returns the distance [cm] between the point g[3] and the center of
     // the detector/module specified by the the module index number.
     Double_t Distance(const Int_t index,const Double_t g[3]){
-         return  TMath::Sqrt(fGm[index]->Distance2(g));}
+         return  TMath::Sqrt(GetGeomMatrix(index)->Distance2(g));}
 //  Geometry manipulation
     void GlobalChange(const Float_t  *tran,const Float_t  *rot);
     void GlobalCylindericalChange(const Float_t *tran,const Float_t *rot);
@@ -643,14 +677,15 @@ class AliITSgeom : public TObject {
     ifstream &ReadGeom(ifstream &in);
 
  private:
-    Int_t            fTrans;   //Flag to keep track of which transformation 
-    Int_t            fNlayers; //The number of layers.
-    Int_t            fNmodules;//The total number of modules
-    Int_t            *fNlad;   //[fNlayers] Array of the number of ladders/layer(layer)
-    Int_t            *fNdet;   //[fNlayers] Array of the number of detectors/ladder(layer)
-    AliITSgeomMatrix **fGm;    //[fNmodules] Structure of trans. and rotation.
-    TObjArray        *fShape;  //Array of shapes and detector information.
-    
+    char       fVersion[20];// Transformation version.
+    Int_t      fTrans;   // Flag to keep track of which transformation 
+    Int_t      fNmodules;// The total number of modules
+    Int_t      fNlayers; // The number of layers.
+    Int_t     *fNlad;    //[fNlayers] Array of the number of ladders/layer(layer)
+    Int_t     *fNdet;    //[fNlayers] Array of the number of detectors/ladder(layer)
+    TObjArray *fGm;      // Structure of trans. and rotation.
+    TObjArray *fShape;   // Array of shapes and detector information.
+
     ClassDef(AliITSgeom,2) // ITS geometry class
 };
 
index d980e015fae6c6ffc5b530dfb08bb0bca99c1d71..617eb48221115fa7023c930dd301144fa1683a10 100644 (file)
@@ -41,6 +41,7 @@ A new class to hold the matrix information needed by AliITSgeom.
 
 */
 #include <iostream.h>
+#include <iomanip.h>
 #include <TMath.h>
 #include <TBuffer.h>
 
@@ -608,22 +609,36 @@ void AliITSgeomMatrix::PrintTitles(ostream *os){
     return;
 }
 //----------------------------------------------------------------------
-void AliITSgeomMatrix::print(ostream *os){
+void AliITSgeomMatrix::PrintComment(ostream *os){
+////////////////////////////////////////////////////////////////////////
+//  output format used by Print..
+////////////////////////////////////////////////////////////////////////
+    *os << "fDetectorIndex fid[0] fid[1] fid[2] ftran[0] ftran[1] ftran[2] ";
+    *os << "fm[0][0]  fm[0][1]  fm[0][2]  fm[1][0]  fm[1][1]  fm[1][2]  ";
+    *os << "fm[2][0]  fm[2][1]  fm[2][2] ";
+    return;
+}
+//----------------------------------------------------------------------
+void AliITSgeomMatrix::Print(ostream *os){
 ////////////////////////////////////////////////////////////////////////
 // Standard output format for this class.
 ////////////////////////////////////////////////////////////////////////
     Int_t i,j;
+    ios::fmtflags fmt;
 
+    fmt = os->setf(ios::scientific);  // set scientific floating point output
     *os << fDetectorIndex << " ";
     for(i=0;i<3;i++) *os << fid[i]   << " ";
-    for(i=0;i<3;i++) *os << frot[i]  << " ";
-    for(i=0;i<3;i++) *os << ftran[i] << " ";
-    for(i=0;i<3;i++)for(j=0;j<3;j++)  *os << fm[i][j] << " ";
+//    for(i=0;i<3;i++) *os << frot[i]  << " ";  // Redundant with fm[][].
+    for(i=0;i<3;i++) *os << setprecision(16) << ftran[i] << " ";
+    for(i=0;i<3;i++)for(j=0;j<3;j++)  *os << setprecision(16) << 
+                                         fm[i][j] << " ";
     *os << endl;
+    os->flags(fmt); // reset back to old formating.
     return;
 }
 //----------------------------------------------------------------------
-void AliITSgeomMatrix::read(istream *is){
+void AliITSgeomMatrix::Read(istream *is){
 ////////////////////////////////////////////////////////////////////////
 // Standard input format for this class.
 ////////////////////////////////////////////////////////////////////////
@@ -631,9 +646,10 @@ void AliITSgeomMatrix::read(istream *is){
 
     *is >> fDetectorIndex;
     for(i=0;i<3;i++) *is >> fid[i];
-    for(i=0;i<3;i++) *is >> frot[i];
+//    for(i=0;i<3;i++) *is >> frot[i]; // Redundant with fm[][].
     for(i=0;i<3;i++) *is >> ftran[i];
     for(i=0;i<3;i++)for(j=0;j<3;j++)  *is >> fm[i][j];
+    AngleFromMatrix(); // compute angles frot[].
     return;
 }
 //----------------------------------------------------------------------
@@ -642,7 +658,7 @@ ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
 // Standard output streaming function.
 ////////////////////////////////////////////////////////////////////////
 
-    p.print(&os);
+    p.Print(&os);
     return os;
 }
 //----------------------------------------------------------------------
@@ -651,6 +667,7 @@ istream &operator>>(istream &is,AliITSgeomMatrix &r){
 // Standard input streaming function.
 ////////////////////////////////////////////////////////////////////////
 
-    r.read(&is);
+    r.Read(&is);
     return is;
 }
+//----------------------------------------------------------------------
index 06afcc5ec657e688ecf7bb671ab3e8ac49ae91eb..3791c7a9cbafd28c3a6d5dc690c3ba65aa2b8988 100644 (file)
@@ -11,7 +11,7 @@
 // By Bjorn S. Nilsen
 ////////////////////////////////////////////////////////////////////////
 
-class AliITSgeomMatrix{
+class AliITSgeomMatrix : public TObject {
  public:
        AliITSgeomMatrix(); // Default constructor
        AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
@@ -24,9 +24,10 @@ class AliITSgeomMatrix{
        AliITSgeomMatrix(const AliITSgeomMatrix &source);
        void operator=(const AliITSgeomMatrix &sourse); // copy
        virtual ~AliITSgeomMatrix(){};
-       void print(ostream *os);
+       void PrintComment(ostream *os);
+       void Print(ostream *os);
        void PrintTitles(ostream *os);
-       void read(istream *is);
+       void Read(istream *is);
 
        void SetAngles(const Double_t rot[3]){// [radians]
               for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
@@ -72,7 +73,7 @@ class AliITSgeomMatrix{
  private: // Data members.
        Int_t    fDetectorIndex; // Detector type index (like fShapeIndex was)
        Int_t    fid[3];         // layer, ladder, detector numbers.
-       Double_t frot[3];        // vector of rotations about x,y,z [radians].
+       Double_t frot[3];        //! vector of rotations about x,y,z [radians].
        Double_t ftran[3];       // Translation vector of module x,y,z.
        Double_t fm[3][3];       // Rotation matrix based on frot.
 
index aa5f6b76fa2e9d9c6bc1f6ea79a5476e43378e88..bc32ac912d5a67dbc3184a82b88fc2a08f4b5868 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.8  2000/10/02 16:32:35  barbera
+Forward declaration added
+
 Revision 1.2.4.8  2000/10/02 15:52:05  barbera
 Forward declaration added
 
@@ -32,39 +35,720 @@ Revision 1.2  1999/09/29 09:24:20  fca
 Introduction of the Copyright and cvs Log
 
 */
+#include <iostream.h>
+#include <iomanip.h>
+#include <stdlib.h>
+#include <TShape.h>
+#include <TBRIK.h>
 
 #include "AliITSgeomSDD.h"
-#include <TBRIK.h>
 
 ClassImp(AliITSgeomSDD)
 AliITSgeomSDD::AliITSgeomSDD(){
 ////////////////////////////////////////////////////////////////////////
 //    default constructor
 ////////////////////////////////////////////////////////////////////////
+//    const Float_t kDx = 3.500;//cm. (Geant 3.12 units) Orthonormal to y and z
+//    const Float_t kDy = 0.014;//cm. (Geant 3.12 units) Radialy from the Beam
+//    const Float_t kDz = 3.763;//cm. (Geant 3.12 units) Allong the Beam Pipe
 
-    Float_t fDx = 3.5;  // cm. (Geant 3.12 units) Orthonormal to y and z
-    Float_t fDy = 0.014;  // cm. (Geant 3.12 units) Radialy from the Beam Pipe
-    Float_t fDz = 3.763;  // cm. (Geant 3.12 units) Allong the Beam Pipe
+//    cout << "AliITSgeomSDD default creator called: start" << endl;
+    fPeriod        = 0.0;
+    fDvelocity     = 0.0;
+    fNAnodesL      = 0;
+    fNAnodesR      = 0;
+    fAnodeXL       = 0.0;
+    fAnodeXR       = 0.0;
+    fAnodeLowEdgeL = 0;
+    fAnodeLowEdgeR = 0;
+    fShapeSDD      = 0;
+//    cout << "AliITSgeomSDD default creator called: end" << endl;
+}
+//________________________________________________________________________
+AliITSgeomSDD::AliITSgeomSDD(const Float_t *box,Float_t per,Float_t vel,
+                            Float_t axL,Float_t axR,
+                            Int_t nAL,Float_t *leL,
+                            Int_t nAR,Float_t *leR){
+////////////////////////////////////////////////////////////////////////
+//    Standard constructor
+////////////////////////////////////////////////////////////////////////
+    Int_t i;
 
+    fPeriod        = per;
+    fDvelocity     = vel;
+    fNAnodesL      = nAL;
+    fNAnodesR      = nAR;
+    fAnodeXL       = axL;
+    fAnodeXR       = axR;
+    if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL;
+    fAnodeLowEdgeL = new Float_t[fNAnodesL];
+    if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR;
+    fAnodeLowEdgeR = new Float_t[fNAnodesR];
+    for(i=0;i<fNAnodesL;i++) fAnodeLowEdgeL[i] = leL[i];
+    for(i=0;i<fNAnodesR;i++) fAnodeLowEdgeR[i] = leR[i];
     fShapeSDD = new TBRIK("ActiveSDD","Active volume of SDD","SDD SI DET",
-                           fDx,fDy,fDz);
+                              box[0],box[1],box[2]);
+}
+//________________________________________________________________________
+AliITSgeomSDD::~AliITSgeomSDD(){
+// Destructor
+
+    if(fShapeSDD!=0) delete fShapeSDD;
+    if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL;
+    if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR;
+    fShapeSDD  = 0;
+    fPeriod    = 0.0;
+    fDvelocity = 0.0;
+    fAnodeXL   = 0.0;
+    fAnodeXR   = 0.0;
+    fNAnodesL  = 0;
+    fNAnodesR  = 0;
+    fAnodeLowEdgeL = 0;
+    fAnodeLowEdgeR = 0;
 }
 //________________________________________________________________________
 AliITSgeomSDD::AliITSgeomSDD(AliITSgeomSDD &source){
-  // Copy constructor
-   if(this==&source) return;
-   this->fShapeSDD = new TBRIK(*(source.fShapeSDD));
-   this->fDx = source.fDx;
-   this->fDy = source.fDy;
-   this->fDz = source.fDz;
+    // Copy constructor
+    Int_t i;
+
+    if(this==&source) return;
+    this->fShapeSDD  = new TBRIK(*(source.fShapeSDD));
+    this->fPeriod    = source.fPeriod;
+    this->fDvelocity = source.fDvelocity;
+    this->fNAnodesL  = source.fNAnodesL;
+    this->fNAnodesR  = source.fNAnodesR;
+    this->fAnodeXL  = source.fAnodeXL;
+    this->fAnodeXR  = source.fAnodeXR;
+    if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL;
+    this->fAnodeLowEdgeL = new Float_t[fNAnodesL];
+    if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR;
+    this->fAnodeLowEdgeR = new Float_t[fNAnodesR];
+    for(i=0;i<fNAnodesL;i++)this->fAnodeLowEdgeL[i] = source.fAnodeLowEdgeL[i];
+    for(i=0;i<fNAnodesR;i++)this->fAnodeLowEdgeR[i] = source.fAnodeLowEdgeR[i];
+    return;
 }
 //________________________________________________________________________
 AliITSgeomSDD& AliITSgeomSDD::operator=(AliITSgeomSDD &source){
-  // = operator
-   if(this==&source) return *this;
-   this->fShapeSDD = new TBRIK(*(source.fShapeSDD));
-   this->fDx = source.fDx;
-   this->fDy = source.fDy;
-   this->fDz = source.fDz;
-   return *this;
+    // = operator
+    Int_t i;
+
+    if(this==&source) return *this;
+    this->fShapeSDD  = new TBRIK(*(source.fShapeSDD));
+    this->fPeriod    = source.fPeriod;
+    this->fDvelocity = source.fDvelocity;
+    this->fNAnodesL  = source.fNAnodesL;
+    this->fNAnodesR  = source.fNAnodesR;
+    this->fNAnodesR  = source.fNAnodesR;
+    this->fAnodeXL  = source.fAnodeXL;
+    this->fAnodeXR  = source.fAnodeXR;
+    if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL;
+    this->fAnodeLowEdgeL = new Float_t[fNAnodesL];
+    if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR;
+    this->fAnodeLowEdgeR = new Float_t[fNAnodesR];
+    for(i=0;i<fNAnodesL;i++)this->fAnodeLowEdgeL[i] = source.fAnodeLowEdgeL[i];
+    for(i=0;i<fNAnodesR;i++)this->fAnodeLowEdgeR[i] = source.fAnodeLowEdgeR[i];
+    return *this;
+}
+//______________________________________________________________________
+void AliITSgeomSDD::Local2Det(Float_t xl,Float_t zl,Int_t &a,Int_t &t,Int_t &s){
+// Give the local detector coordinate it returns the anode number, time
+// bucket, and detector side.
+    Int_t i;
+
+    if(xl>0) {
+       if(zl<fAnodeLowEdgeR[0]) i=-1;
+       else for(i=0;i<fNAnodesR;i++) if(zl<fAnodeLowEdgeR[i]) break;
+       a = i;
+       s = 1;
+    } else if(xl<0){
+       if(zl<fAnodeLowEdgeL[0]) i=-1;
+       else for(i=0;i<fNAnodesL;i++) if(zl<fAnodeLowEdgeL[i]) break;
+       a = i;
+       s = 0;
+    } else { // x==0.
+       if(zl<fAnodeLowEdgeR[0]) i=-1;
+       else for(i=0;i<fNAnodesR;i++) if(zl<fAnodeLowEdgeR[i]) break;
+       a = i;
+       if(zl<fAnodeLowEdgeL[0]) i=-1;
+       else for(i=0;i<fNAnodesL;i++) if(zl<fAnodeLowEdgeL[i]) break;
+       s = -i;
+    } // end if
+    t = (Int_t)TMath::Abs((GetAnodeX(a,s)-xl)/fDvelocity/fPeriod);
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSDD::Det2Local(Int_t a,Int_t t,Int_t s,Float_t &xl,Float_t &zl){
+// Give the anode number, time bucket, and detector side, it returns the
+// local detector coordinate.
+
+    zl = 0.5*GetAnodeZ(a,s);
+    if(s==0){
+       xl = GetAnodeX(a,s)+(t+0.5)*fPeriod*fDvelocity;
+    } else { // s==1
+       xl = GetAnodeX(a,s)-(t+0.5)*fPeriod*fDvelocity;
+    } // end if s==0;
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSDD::Print(ostream *os){
+////////////////////////////////////////////////////////////////////////
+// Standard output format for this class.
+////////////////////////////////////////////////////////////////////////
+    Int_t i;
+    ios::fmtflags fmt;
+
+    fmt = os->setf(ios::scientific);  // set scientific floating point output
+    *os << "TBRIK" << " ";
+    *os << setprecision(16) << GetDx() << " ";
+    *os << setprecision(16) << GetDy() << " ";
+    *os << setprecision(16) << GetDz() << " ";
+    *os << setprecision(16) << fPeriod << " ";
+    *os << setprecision(16) << fDvelocity << " ";
+    *os << fNAnodesL << " ";
+    *os << fNAnodesR << " ";
+    *os << fAnodeXL << " ";
+    *os << fAnodeXR << " ";
+    for(i=0;i<fNAnodesL;i++) *os <<setprecision(16)<<fAnodeLowEdgeL[i]<< " ";
+    for(i=0;i<fNAnodesR;i++) *os <<setprecision(16)<<fAnodeLowEdgeR[i]<< " ";
+    *os << endl;
+    os->flags(fmt); // reset back to old formating.
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSDD::Read(istream *is){
+////////////////////////////////////////////////////////////////////////
+// Standard input format for this class.
+////////////////////////////////////////////////////////////////////////
+    Int_t i;
+    Float_t dx,dy,dz;
+    char shp[20];
+
+    *is >> shp;
+    *is >> dx >> dy >> dz;
+    if(fShapeSDD!=0) delete fShapeSDD;
+    fShapeSDD = new TBRIK("ActiveSDD","Active volume of SDD","SDD SI DET",
+                           dx,dy,dz);
+    *is >> fPeriod >> fDvelocity >> fNAnodesL >> fNAnodesR;
+    *is >> fAnodeXL >> fAnodeXR;
+    if(fAnodeLowEdgeL!=0) delete fAnodeLowEdgeL;
+    this->fAnodeLowEdgeL = new Float_t[fNAnodesL];
+    if(fAnodeLowEdgeR!=0) delete fAnodeLowEdgeR;
+    this->fAnodeLowEdgeR = new Float_t[fNAnodesR];
+    for(i=0;i<fNAnodesL;i++) *is >> fAnodeLowEdgeL[i];
+    for(i=0;i<fNAnodesR;i++) *is >> fAnodeLowEdgeR[i];
+    return;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSDD &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSDD &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+/*
+$Log$
+*/
+//#include <iostream.h>
+//#include <TBRIK.h>
+
+//#include "AliITSgeomSDD256.h"
+
+ClassImp(AliITSgeomSDD256)
+
+AliITSgeomSDD256::AliITSgeomSDD256(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor
+/*
+Pads for probe cards in ALICE-D2       /05.03.2000/
+(X,Y) coordinates are quoted in microns and referred to the centers of 
+bonding pads. (0, 0) corrispond to the center of the detector.
+Convention: 
+left is for negative X, right is for positive X;
+DOWN half is for negative Y, UP half is for positive Y.
+
+Detector size: X= 87588 micrometers; Y= 72500 micrometers. 
+Detector corners:
+  LEFT UP: (-43794, 36250)
+RIGHT UP:  (43794, 36250)
+ LEFT DOWN: (-43794, -36250)
+RIGHT DOWN:  (43794, -36250)
+
+       Drift cathodes (n-side)
+
+cathode #0 (Ubias) 
+(-1477, 0), pad size (150, 60)
+   (875, 0), pad size (150, 60)
+(-36570, 0), pad size (200, 70)
+(-37570, 0), pad size (200, 70)
+(36570, 0), pad size (200, 70)
+(37570, 0), pad size (200, 70)
+
+cathode #1 DOWN half 
+(-1477, -120), pad size (150, 60)
+   (875, -120), pad size (150, 60)
+(-36570, -120), pad size (200, 70)
+(-37570, -120), pad size (200, 70)
+(36570, -120), pad size (200, 70)
+(37570, -120), pad size (200, 70)
+
+cathode #2 DOWN half 
+(-1477, -240), pad size (150, 60)
+   (875, -240), pad size (150, 60)
+(-36570, -240), pad size (200, 70)
+(-37570, -240), pad size (200, 70)
+(36570, -240), pad size (200, 70)
+(37570, -240), pad size (200, 70)
+
+cathode #3 DOWN half 
+(-1477, -360), pad size (150, 60)
+   (875, -360), pad size (150, 60)
+(-36570, -360), pad size (200, 70)
+(-37570, -360), pad size (200, 70)
+(36570, -360), pad size (200, 70)
+(37570, -360), pad size (200, 70)
+.....................................
+......................................
+......................................
+cathode #30 DOWN half
+(-1477, -3600), pad size (150, 60)
+   (875, -3600), pad size (150, 60)
+(-36570, -3600), pad size (200, 70)
+(-37570, -3600), pad size (200, 70)
+(36570, -3600), pad size (200, 70)
+(37570, -3600), pad size (200, 70)
+...................................
+cathode #60 DOWN half
+(-1477, -7200), pad size (150, 60)
+   (875, -7200), pad size (150, 60)
+(-36570, -7200), pad size (200, 70)
+(-37570, -7200), pad size (200, 70)
+(36570, -7200), pad size (200, 70)
+(37570, -7200), pad size (200, 70)
+....................................
+cathode #90 DOWN half
+(-1477, -10800), pad size (150, 60)
+   (875, -10800), pad size (150, 60)
+(-36570, -10800), pad size (200, 70)
+(-37570, -10800), pad size (200, 70)
+(36570, -10800), pad size (200, 70)
+(37570, -10800), pad size (200, 70)
+....................................
+cathode #120 DOWN half
+(-1477, -14400), pad size (150, 60)
+   (875, -14400), pad size (150, 60)
+(-36570, -14400), pad size (200, 70)
+(-37570, -14400), pad size (200, 70)
+(36570, -14400), pad size (200, 70)
+(37570, -14400), pad size (200, 70)
+....................................
+cathode #150 DOWN half
+(-1477, -18000), pad size (150, 60)
+   (875, -18000), pad size (150, 60)
+(-36570, -18000), pad size (200, 70)
+(-37570, -18000), pad size (200, 70)
+(36570, -18000), pad size (200, 70)
+(37570, -18000), pad size (200, 70)
+....................................
+cathode #180 DOWN half
+(-1477, -21600), pad size (150, 60)
+   (875, -21600), pad size (150, 60)
+(-36570, -21600), pad size (200, 70)
+(-37570, -21600), pad size (200, 70)
+(36570, -21600), pad size (200, 70)
+(37570, -21600), pad size (200, 70)
+....................................
+cathode #210 DOWN half
+(-1477, -25200), pad size (150, 60)
+   (875, -25200), pad size (150, 60)
+(-36570, -25200), pad size (200, 70)
+(-37570, -25200), pad size (200, 70)
+(36570, -25200), pad size (200, 70)
+(37570, -25200), pad size (200, 70)
+....................................
+cathode #240 DOWN half
+(-1477, -28800), pad size (150, 60)
+   (875, -28800), pad size (150, 60)
+(-36570, -28800), pad size (200, 70)
+(-37570, -28800), pad size (200, 70)
+(36570, -28800), pad size (200, 70)
+(37570, -28800), pad size (200, 70)
+....................................
+cathode #270 DOWN half
+(-1477, -32400), pad size (150, 60)
+   (875, -32400), pad size (150, 60)
+(-36570, -32400), pad size (200, 70)
+(-37570, -32400), pad size (200, 70)
+(36570, -32400), pad size (200, 70)
+(37570, -32400), pad size (200, 70)
+....................................
+cathode #290 DOWN half
+(-1477, -34800), pad size (150, 60)
+   (875, -34800), pad size (150, 60)
+(-36570, -34800), pad size (200, 70)
+(-37570, -34800), pad size (200, 70)
+(36570, -34800), pad size (200, 70)
+(37570, -34800), pad size (200, 70)
+___________________________________________________
+cathode #1 UP half 
+(-1477, 120), pad size (150, 60)
+   (875, 120), pad size (150, 60)
+(-36570, 120), pad size (200, 70)
+(-37570, 120), pad size (200, 70)
+(36570, 120), pad size (200, 70)
+(37570, 120), pad size (200, 70)
+
+cathode #2 UP half 
+(-1477, 240), pad size (150, 60)
+   (875, 240), pad size (150, 60)
+(-36570, 240), pad size (200, 70)
+(-37570, 240), pad size (200, 70)
+(36570, 240), pad size (200, 70)
+(37570, 240), pad size (200, 70)
+
+cathode #3 UP half 
+(-1477, 360), pad size (150, 60)
+   (875, 360), pad size (150, 60)
+(-36570, 360), pad size (200, 70)
+(-37570, 360), pad size (200, 70)
+(36570, 360), pad size (200, 70)
+(37570, 360), pad size (200, 70)
+.....................................
+......................................
+......................................
+cathode #30 UP half
+(-1477, 3600), pad size (150, 60)
+   (875, 3600), pad size (150, 60)
+(-36570, 3600), pad size (200, 70)
+(-37570, 3600), pad size (200, 70)
+(36570, 3600), pad size (200, 70)
+(37570, 3600), pad size (200, 70)
+......................................
+cathode #60 UP half
+(-1477, 7200), pad size (150, 60)
+   (875, 7200), pad size (150, 60)
+(-36570, 7200), pad size (200, 70)
+(-37570, 7200), pad size (200, 70)
+(36570, 7200), pad size (200, 70)
+(37570, 7200), pad size (200, 70)
+......................................
+cathode #90 UP half
+(-1477, 10800), pad size (150, 60)
+   (875, 10800), pad size (150, 60)
+(-36570, 10800), pad size (200, 70)
+(-37570, 10800), pad size (200, 70)
+(36570, 10800), pad size (200, 70)
+(37570, 10800), pad size (200, 70)
+......................................
+cathode #120 UP half
+(-1477, 14400), pad size (150, 60)
+   (875, 14400), pad size (150, 60)
+(-36570, 14400), pad size (200, 70)
+(-37570, 14400), pad size (200, 70)
+(36570, 14400), pad size (200, 70)
+(37570, 14400), pad size (200, 70)
+......................................
+cathode #150 UP half
+(-1477, 18000), pad size (150, 60)
+   (875, 18000), pad size (150, 60)
+(-36570, 18000), pad size (200, 70)
+(-37570, 18000), pad size (200, 70)
+(36570, 18000), pad size (200, 70)
+(37570, 18000), pad size (200, 70)
+......................................
+cathode #180 UP half
+(-1477, 21600), pad size (150, 60)
+   (875, 21600), pad size (150, 60)
+(-36570, 21600), pad size (200, 70)
+(-37570, 21600), pad size (200, 70)
+(36570, 21600), pad size (200, 70)
+(37570, 21600), pad size (200, 70)
+......................................
+cathode #210 UP half
+(-1477, 25200), pad size (150, 60)
+   (875, 25200), pad size (150, 60)
+(-36570, 25200), pad size (200, 70)
+(-37570, 25200), pad size (200, 70)
+(36570, 25200), pad size (200, 70)
+(37570, 25200), pad size (200, 70)
+......................................
+cathode #240 UP half
+(-1477, 28800), pad size (150, 60)
+   (875, 28800), pad size (150, 60)
+(-36570, 28800), pad size (200, 70)
+(-37570, 28800), pad size (200, 70)
+(36570, 28800), pad size (200, 70)
+(37570, 28800), pad size (200, 70)
+......................................
+cathode #270 UP half
+(-1477, 32400), pad size (150, 60)
+   (875, 32400), pad size (150, 60)
+(-36570, 32400), pad size (200, 70)
+(-37570, 32400), pad size (200, 70)
+(36570, 32400), pad size (200, 70)
+(37570, 32400), pad size (200, 70)
+......................................
+cathode #290 UP half
+(-1477, 34800), pad size (150, 60)
+   (875, 34800), pad size (150, 60)
+(-36570, 34800), pad size (200, 70)
+(-37570, 34800), pad size (200, 70)
+(36570, 34800), pad size (200, 70)
+(37570, 34800), pad size (200, 70)
+       Injectors (n-side)
+
+Central line injectors (DOWN half)
+(-1237, -660), pad size (150, 65)
+(1115, -660), pad size (150, 65)
+(37890, -660), pad size (100, 74)
+
+Middle line injectors (DOWN half)
+(-1237, -17460), pad size (150, 80)
+(1115, -17460), pad size (150, 80)
+(37890, -17460), pad size (100, 74)
+
+Bottom line injectors (DOWN half)
+(-1237, -34020), pad size (150, 80)
+(1115, -34020), pad size (150, 80)
+(37890, -34020), pad size (100, 74)
+___________________________________________
+Central line injectors (UP half)
+(-1237, 660), pad size (150, 65)
+(1115, 660), pad size (150, 65)
+(37890, 660), pad size (100, 74)
+
+Middle line injectors (UP half)
+(-1237, 17460), pad size (150, 80)
+(1115, 17460), pad size (150, 80)
+(37890, 17460), pad size (100, 74)
+
+Bottom line injectors (UP half)
+(-1237, 34020), pad size (150, 80)
+(1115, 34020), pad size (150, 80)
+(37890, 34020), pad size (100, 74)
+
+Drift cathodes and injectors of p-side have the bonding pads with the same 
+coordinates as for the n-side (when looking through the masks)
+
+       Cathodes of the collection zone (n-side)
+
+cathode #291 (-40 V) DOWN half
+(-38220, -35055), pad size (120, 160)
+(38190, -34992), pad size (120, 145)
+
+GRID cathode (-15 V) DOWN half
+(-37988, -35085), pad size (144, 210)
+  (37988, -35085), pad size (144, 210)
+
+cathode #292 (-30 V) DOWN half
+(-38245, -35290), pad size (100, 170)
+(38210, -35242), pad size (150, 215)
+
+cathode #293 (-15 V) DOWN half
+(-38055, -35460), pad size (690, 70)
+(36488, -35460), pad size (3805, 70)
+
+n+ bulk contact (GND) DOWN half
+(-38300, -36050), pad size (1000, 395)
+(38300, -36050), pad size (1000, 395)
+
+bonding pad of the last integrated resistor DOWN half
+/it has to be connected to the GND/
+(-38190, -35620) pad size (160, 110)
+________________________________________________ 
+cathode #291 (-40 V) UP half
+(-38220, 35055), pad size (120, 160)
+(38190, 34992), pad size (120, 145)
+
+GRID cathode (-15 V) UP half
+(-37988, 35085), pad size (144, 210)
+  (37988, 35085), pad size (144, 210)
+
+cathode #292 (-30 V) UP half
+(-38245, 35290), pad size (100, 170)
+(38210, 35242), pad size (150, 215)
+
+cathode #293 (-15 V) UP half
+(-38055, 35460), pad size (690, 70)
+(36488, 35460), pad size (3805, 70)
+
+n+ bulk contact (GND) UP half
+(-38300, 36050), pad size (1000, 395)
+(38300, 36050), pad size (1000, 395)
+
+bonding pad of the last integrated resistor UP half
+/it has to be connected to the GND/
+(-38190, 35620) pad size (160, 110)
+
+Cathodes of the collection zone (p-side)
+
+cathode #291 (-40 V) DOWN half
+(-38215, -35055), pad size (120, 160)
+(38190, -34992), pad size (120, 145)
+
+cathode W1 (-60 V) DOWN half
+(-38000, -35110), pad size (140, 240)
+ (38000, -35110), pad size (140, 240)
+
+cathode W2 (-80 V) DOWN half
+( 0, -35090), pad size (75600, 110)
+
+cathode #292 (-40 V) DOWN half
+(-38220, -35290), pad size (150, 170)
+(38210, -35242), pad size (150, 215)
+
+p+ bulk contact (GND) DOWN half
+(-38300, -36050), pad size (1000, 395)
+(38300, -36050), pad size (1000, 395)
+
+It is necessary to connect cathode #291 to cathode #292 in order to
+close the integrated divider to p+ bulk contact (GND).
+
+_______________________________________________
+cathode #291 (-40 V) UP half
+(-38215, 35055), pad size (120, 160)
+(38190, 34992), pad size (120, 145)
+
+cathode W1 (-60 V) UP half
+(-38000, 35110), pad size (140, 240)
+ (38000, 35110), pad size (140, 240)
+
+cathode W2 (-80 V) UP half
+( 0, 35090), pad size (75600, 110)
+
+cathode #292 (-40 V) UP half
+(-38220, 35290), pad size (150, 170)
+(38210, 35242), pad size (150, 215)
+
+p+ bulk contact (GND) UP half
+(-38300, 36050), pad size (1000, 395)
+(38300, 36050), pad size (1000, 395)
+
+It is necessary to connect cathode #291 to cathode #292 in order to
+close the integrated divider to p+ bulk contact (GND).
+
+       Anodes (n-side)
+There are 256 anodes to be bonded to the inputs of front-end electronics. In 
+addition there are 2 anodes (one at the left edge and one at the right edge 
+of the anode array) that have to be bonded to the ground. I call these 2 
+anodes #L and #R. The pitch of all anodes is 294 micrometers.
+
+               DOWN half anodes
+#L             (-37779, -35085), pad size (184, 140)
+#1             (-37485, -35085), pad size (184, 140)
+.........................................
+.........................................
+#256.............(37485, -35085), pad size (184, 140)
+#R              (37779, -35085), pad size (184, 140)
+_____________________________________________
+               UP half anodes
+#L             (-37779, 35085), pad size (184, 140)
+#1             (-37485, 35085), pad size (184, 140)
+.........................................
+.........................................
+#256.............(37485, 35085), pad size (184, 140)
+#R              (37779, 35085), pad size (184, 140)
+*/
+////////////////////////////////////////////////////////////////////////
+    const Float_t kDxyz[]   = {3.6250,0.0150,4.3794};//cm. (Geant 3.12 units)
+                                      // Size of sensitive region of detector
+    const Float_t kPeriod   = 25.0E-09; // 40 MHz sampling frequence
+    const Float_t kVelocity = 5.46875E+03; // cm/s drift velocity
+    const Float_t kAnodeXL  = -3.5085; // cm location in x of anodes left side
+    const Float_t kAnodeXR  =  3.5085; // cm location in x of anodes right side
+    const Int_t   kNAnodes  = 256;  // nuber of anodes connected
+    const Float_t kAnodePitch = 0.0294; // cm
+    const Float_t kAnodesZ  = -3.7485; // cm Starting location of anodes in z
+    Float_t AnodeLowEdges[kNAnodes+1];
+    Int_t i;
+
+//    cout << "AliITSgeomSDD256 default creator called: start" << end;
+    AnodeLowEdges[0] = kAnodesZ;
+    for(i=0;i<kNAnodes;i++) AnodeLowEdges[i+1] = kAnodePitch+AnodeLowEdges[i];
+    AliITSgeomSDD::AliITSgeomSDD(kDxyz,kPeriod,kVelocity,kAnodeXL,kAnodeXR,
+                                kNAnodes+1,AnodeLowEdges,
+                                kNAnodes+1,AnodeLowEdges);
+//    cout << "AliITSgeomSDD256 default creator called: end" << endl;
+}
+//________________________________________________________________________
+ostream &operator<<(ostream &os,AliITSgeomSDD256 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSDD256 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+/*
+$Log$
+*/
+//#include <iostream.h>
+//#include <TBRIK.h>
+
+//#include "AliITSgeomSDD300.h"
+
+ClassImp(AliITSgeomSDD300)
+
+AliITSgeomSDD300::AliITSgeomSDD300() : AliITSgeomSDD(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor
+////////////////////////////////////////////////////////////////////////
+    const Float_t kDxyz[] = {3.500,0.014,3.763};//cm.
+    const Float_t kPeriod = 25.0E-09; // 40 MHz
+    const Float_t kVelocity = 5.46875E+3; // cm/s
+    const Int_t kNAnodes = 300; // number of anodes
+    const Float_t kAnodeXL = -3.500; // cm
+    const Float_t kAnodeXR = +3.500; // cm
+    const Float_t kAnodesZ = -3.75; // cm
+    Float_t AnodeLowEdges[kNAnodes+1];
+    const Float_t kanode = 0.0250;// cm anode separation.
+    Int_t i;
+
+//    cout << "AliITSgeomSDD300 default creator called: start" << endl;
+    AnodeLowEdges[0] = kAnodesZ;
+    for(i=0;i<kNAnodes;i++) AnodeLowEdges[i+1] = kanode+AnodeLowEdges[i];
+    AliITSgeomSDD::AliITSgeomSDD(kDxyz,kPeriod,kVelocity,kAnodeXL,kAnodeXR,
+                                kNAnodes+1,AnodeLowEdges,
+                                kNAnodes+1,AnodeLowEdges);
+//    cout << "AliITSgeomSDD300 default creator called: end" << endl;
+}
+//________________________________________________________________________
+ostream &operator<<(ostream &os,AliITSgeomSDD300 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSDD300 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
 }
+//----------------------------------------------------------------------
index 3cf14396d98e092ce940adeb10a9beb44cb2a7d3..5665644337d1ce4c5d114ed77f91106a4d0d4f5e 100644 (file)
  * See cxx source for full Copyright notice                               */
 
 /* $Id$ */
-
 #include <TObject.h>
-//#include "AliITSgeom.h"
+#include <TBRIK.h>
 
-class TBRIK;
-class AliITSgeom;
+class ostream;
+class istream;
+class TShape;
 
 class AliITSgeomSDD: public TObject {
  public:
     AliITSgeomSDD();
+    AliITSgeomSDD(const Float_t *box,Float_t per,Float_t vel,
+                 Float_t axL,Float_t axR,
+                 Int_t nA0,Float_t *le0,Int_t nA1,Float_t *le1);
     AliITSgeomSDD(AliITSgeomSDD &source);
-    virtual ~AliITSgeomSDD(){};
     AliITSgeomSDD& operator=(AliITSgeomSDD &source);
-    TBRIK *GetShape() const {return fShapeSDD;}
-    Float_t GetDx() {return fDx;}
-    Float_t GetDy() {return fDy;}
-    Float_t GetDz() {return fDz;}
+    virtual ~AliITSgeomSDD();
+    virtual TShape *GetShape() const {return fShapeSDD;}
+    virtual Float_t GetDx() { // Get TBRIK Dx
+       if(fShapeSDD!=0) return fShapeSDD->GetDx();
+       else return 0.0;}
+    virtual Float_t GetDy() {// Get TBRIK Dy
+       if(fShapeSDD!=0) return fShapeSDD->GetDy();
+       else return 0.0;}
+    virtual Float_t GetDz() {// Get TBRIK Dz
+       if(fShapeSDD!=0) return fShapeSDD->GetDz();
+       else return 0.0;}
+    virtual Float_t GetAnodeX(Int_t a,Int_t s){ // returns X position of anode
+       if(s==0) return fAnodeXL; else return fAnodeXR;}
+    virtual Float_t GetAnodeZ(Int_t a,Int_t s){ // returns X position of anode
+       if(s==0) return 0.5*(fAnodeLowEdgeL[a]+fAnodeLowEdgeL[a+1]);
+       else return 0.5*(fAnodeLowEdgeR[a]+fAnodeLowEdgeR[a+1]);}
+    virtual void SetNAnodesL(Int_t s)
+       {fNAnodesL = s;} // sets the number of anodes on side 0.
+    virtual void SetNAnodesR(Int_t s)
+       {fNAnodesR = s;} // sets the anodes spacing for side 1.
+    virtual void SetSamplingPeriod(Float_t s)
+       {fPeriod = s;} // sets the clock sampling period s.
+    virtual void SetDriftVelocity(Float_t s)
+       {fDvelocity = s;} // sets the SDD Drift velocity cm/s.
+    virtual void SetShape(char *name,char *title,char *mat,
+                         Float_t dx,Float_t dy,Float_t dz)
+                        {fShapeSDD = new TBRIK(name,title,mat,dx,dy,dz);}
+    virtual void Local2Det(Float_t xl,Float_t zl,Int_t &a,Int_t &t,Int_t &s);
+    virtual void Det2Local(Int_t a,Int_t t,Int_t s,Float_t &xl,Float_t &zl);
+    virtual void Print(ostream *os);  // Output streamer to standard out.
+    virtual void Read(istream *is);   // Input streamer to standard in.
     // or what other or different information that is needed.
 
- private:
-    // define shape of active area using ROOT shapes so that they can
-    // be easly plotted. Inputs to TBRIK are
-    // Shape name (what ever that is)
-    // Shape title (what ever that means)
-    // name of material (something I took from ITSgeometry.tme file
-    // dx => 1/2 thickness of wafer's active volume (cm)
-    // dy => 1/2 r*phi size of active volume (cm)
-    // dz => 1/2 size of active volume (cm)
-    Float_t fDx;          // Brick half width cm
-    Float_t fDy;          // Brick half thickness cm
-    Float_t fDz;          // Brick half length cm
+ protected:
+    // (L)  -+-> x  (R)
+    //       |
+    //       V z
+    Float_t fPeriod; // ADC sampiling period
+    Float_t fDvelocity; // Drift velocity
+    Int_t   fNAnodesL;  // number of Anodes on size 0
+    Int_t   fNAnodesR;  // number of Anodes on size 1
+    Float_t fAnodeXL;   // Anode location in x Left side
+    Float_t fAnodeXR;   // Anode location in x Right side
+    Float_t *fAnodeLowEdgeL; //[fNAnodesL] Anode spacing left edge
+    Float_t *fAnodeLowEdgeR; //[fNAnodesR] Anode spacing right edge
     TBRIK *fShapeSDD;     // shape of sensitive volume
 
     ClassDef(AliITSgeomSDD,1) // ITS SDD detector geometry class
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSDD &source);
+istream &operator>>(istream &os,AliITSgeomSDD &source);
+#endif
+//======================================================================
+#ifndef ALIITSGEOMSDD256_H
+#define ALIITSGEOMSDD256_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+  $Id$
+*/
+
+//#include "AliITSgeomSDD.h"
+
+class ostream;
+class istream;
+
+class AliITSgeomSDD256 : public AliITSgeomSDD {
+
+ public:
+    AliITSgeomSDD256();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SDD detector geometry.
+    ClassDef(AliITSgeomSDD256,0) // ITS SDD detector geometry class for 256 anodes per side
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSDD256 &source);
+istream &operator>>(istream &os,AliITSgeomSDD256 &source);
+#endif
+//======================================================================
+#ifndef ALIITSGEOMSDD300_H
+#define ALIITSGEOMSDD300_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+  $Id$
+*/
+
+//#include "AliITSgeomSDD.h"
+
+class ostream;
+class istream;
+
+class AliITSgeomSDD300 : public AliITSgeomSDD {
+
+ public:
+    AliITSgeomSDD300();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SDD detector geometry.
+    ClassDef(AliITSgeomSDD300,0) // ITS SDD detector geometry class for 300 anodes per side
+
 };
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSDD300 &source);
+istream &operator>>(istream &os,AliITSgeomSDD300 &source);
 #endif
index 9685c9153289b01ddd0b208f098336bc1841ec33..c2db4c536904ade3410227fd721ee69bd05132f3 100644 (file)
 
 /*
 $Log$
-Revision 1.2.4.7  2000/10/02 15:52:05  barbera
+*/
+
+#include <iostream.h>
+#include <iomanip.h>
+#include <TShape.h>
+
+#include "AliITSgeomSPD.h"
+
+ClassImp(AliITSgeomSPD)
+
+AliITSgeomSPD::AliITSgeomSPD(){
+// 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){
+// Standard Constructor. Set everthing to null.
+
+    fShapeSPD    = 0;
+    fNbinx       = 0;
+    fNbinz       = 0;
+    fLowBinEdgeX = 0;
+    fLowBinEdgeZ = 0;
+    ReSetBins(dy,nx,bx,nz,bz);
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
+                             Int_t nz,Float_t *bz){
+// delets the contents of this and replaces it with the given values.
+    Int_t i;
+    Float_t dx = 0.0, dz = 0.0;
+
+    // Compute size in x and z (based on bins).
+    for(i=0;i<nx;i++) dx += bx[i];
+    for(i=0;i<nz;i++) dz += bz[i];
+    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
+
+    SetNbinX(nx);
+    SetNbinZ(nz);
+    InitLowBinEdgeX();
+    InitLowBinEdgeZ();
+    fLowBinEdgeX[0] = -dx;
+    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);
+    return;
+}
+//______________________________________________________________________
+AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
+    // Copy constructor
+
+    *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;
+}
+//______________________________________________________________________
+AliITSgeomSPD::~AliITSgeomSPD(){
+// Destructor
+
+    delete fShapeSPD;
+    if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
+    if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
+    fShapeSPD    = 0;
+    fNbinx       = 0;
+    fNbinz       = 0;
+    fLowBinEdgeX = 0;
+    fLowBinEdgeZ = 0;
+}
+//______________________________________________________________________
+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.
+    Int_t i;
+
+    if(xl<fLowBinEdgeX[0]) row = -1;
+    else{
+       for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
+       row = i;
+    } //end if too low.
+    if(zl<fLowBinEdgeX[0]) col = -1;
+    else{
+       for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
+       col = i;
+    } //end if too low.
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
+// returns the pixel center local coordinate system location for a given
+// row and column number. It the row or column number is outside of the 
+// defined range then it will return the nearest detector edge.
+
+    if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
+    else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
+    if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
+    else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSPD::Print(ostream *os){
+// Standard output format for this class
+    Int_t i;
+    ios::fmtflags fmt;
+
+    fmt = os->setf(ios::scientific); // set scientific floating point output
+    *os << "TBRIK" << " ";
+    *os << setprecision(16) << GetDx() << " ";
+    *os << setprecision(16) << GetDy() << " ";
+    *os << setprecision(16) << GetDz() << " ";
+    *os << fNbinx-1 << " " << fNbinz-1 << " ";
+    for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
+    for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
+    *os << endl;
+    os->flags(fmt);
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSPD::Read(istream *is){
+// Standard input format for this class
+    Int_t i,j;
+    Float_t dx,dy,dz;
+    char shape[20];
+
+    for(i=0;i<20;i++) shape[i]='\0';
+    *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);
+    *is >> i >> j;
+    SetNbinX(i);
+    SetNbinZ(j);
+    InitLowBinEdgeX();
+    InitLowBinEdgeZ();
+    for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
+    for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
+    return;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSPD &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSPD &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
+}
+//=====================================================================
+
+/*
+$Log$
+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(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor, for ITS TDR geometry. This only consists of
+// a default constructor to construct the defalut TDR SPD detector geometry
+// 256 X 279 300 by 50 micron pixels.
+////////////////////////////////////////////////////////////////////////
+const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
+                                                // size is 2dx wide, 2dz long,
+                                                // and 2dy thick. Geant 3.12
+                                                // units.
+const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
+const Int_t   knbinx = 256;    // number of pixels along x direction.
+const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
+const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
+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.
+
+    for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
+    dx *= 0.5;
+    for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
+    dz += 2.0*(kbinz1-kbinz0);
+    dz *= 0.5;
+    InitLowBinEdgeX();
+    InitLowBinEdgeZ();
+    SetLowBinEdgeX(0,-dx); // Starting position X
+    for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
+    SetLowBinEdgeZ(0,-dz); // Starting position z
+    SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
+    for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
+    SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
+
+    if(dx!=kdx || dz!=kdz) 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;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSPD300 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
+}
+//=====================================================================
+/*
+$Log$
+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.3  2000/03/07 18:46:59  nilsen
-Merged form ITS-working to HEAD. Minor changes
+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)
+
+AliITSgeomSPD425Short::AliITSgeomSPD425Short(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor, for ITS post TDR geometry. This only consists of
+// a default constructor to construct the defalut post TDR SPD detector 
+// geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
+// micron pixels (large detector).
+////////////////////////////////////////////////////////////////////////
+
+    const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
+                                                    // detector size is 2dx
+                                                    //  wide, 2dz long, and
+                                                    //  2dy thick. Geant 3.12
+                                                    // units.
+    const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
+    const Int_t   knbinx = 256;    // number of pixels along x direction.
+    const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
+    const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
+    const Int_t   knbinz = 163;    // number of pixels along z direction.
+    Int_t i;
+    Float_t dx,dz,*binSizeX,*binSizeZ;
 
-Revision 1.2.4.2  2000/03/04 23:55:08  nilsen
-Updated comments/documentation.
+    SetNbinX(knbinx); // default number of bins in x.
+    SetNbinZ(knbinz); // default number of bins in z.
 
-Revision 1.2.4.1  2000/01/12 19:03:32  nilsen
-This is the version of the files after the merging done in December 1999.
-See the ReadMe110100.txt file for details
+    binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
+    for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
+    binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
+    for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
+    binSizeZ[ 31] = kbinz1;
+    binSizeZ[ 32] = kbinz1;
+
+    binSizeZ[ 64] = kbinz1;
+    binSizeZ[ 65] = kbinz1;
+
+    binSizeZ[ 97] = kbinz1;
+    binSizeZ[ 98] = kbinz1;
+
+    binSizeZ[130] = kbinz1;
+    binSizeZ[131] = kbinz1;
+
+    // correct detector size for bin size.
+    dx = 0.0;
+    for(i=0;i<knbinx;i++) dx += binSizeX[i];
+    dx *= 0.5;
+    dz = 0.0;
+    for(i=0;i<knbinz;i++) dz += binSizeZ[i];
+    dz *= 0.5;
+
+    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
+    if(dx!=kdx || dz!=kdz) Warning("AliITSgeomSPD425Short::Default Creator",
+                                  "Detector size may not be write.");
+
+    InitLowBinEdgeX(); // array of bin sizes along x.
+    InitLowBinEdgeZ(); // array of bin sizes along x.
+    SetLowBinEdgeX(0,-dx);
+    SetLowBinEdgeZ(0,-dz);
+    for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
+    for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+
+/*
+$Log$
+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 =.
 
-Revision 1.2  1999/09/29 09:24:20  fca
-Introduction of the Copyright and cvs Log
 
 */
 
-#include "AliITSgeomSPD.h"
+//#include "AliITSgeomSPD425Long.h"
 
-ClassImp(AliITSgeomSPD)
+ClassImp(AliITSgeomSPD425Long)
+
+AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor, for ITS post TDR geometry. This only consists of
+// a default constructor to construct the defalut post TDR SPD detector 
+// geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
+// micron pixels (large detector).
+////////////////////////////////////////////////////////////////////////
+
+    const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
+                                                    // detector size is 2dx
+                                                    //  wide, 2dz long, and
+                                                    //  2dy thick. Geant 3.12
+                                                    // units.
+    const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
+    const Int_t   knbinx = 256;    // number of pixels along x direction.
+    const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
+    const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
+    const Int_t   knbinz = 196;    // number of pixels along z direction.
+    Int_t i;
+    Float_t dx,dz,*binSizeX,*binSizeZ;
+
+    SetNbinX(knbinx); // default number of bins in x.
+    SetNbinZ(knbinz); // default number of bins in z.
+
+    binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
+    for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
+    binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
+    for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
+    binSizeZ[ 31] = kbinz1;
+    binSizeZ[ 32] = kbinz1;
+
+    binSizeZ[ 64] = kbinz1;
+    binSizeZ[ 65] = kbinz1;
+
+    binSizeZ[ 97] = kbinz1;
+    binSizeZ[ 98] = kbinz1;
 
-  /*AliITSgeomSPD::AliITSgeomSPD(){
+    binSizeZ[130] = kbinz1;
+    binSizeZ[131] = kbinz1;
+
+    binSizeZ[163] = kbinz1;
+    binSizeZ[164] = kbinz1;
+
+    // correct detector size for bin size.
+    dx = 0.0;
+    for(i=0;i<knbinx;i++) dx += binSizeX[i];
+    dx *= 0.5;
+    dz = 0.0;
+    for(i=0;i<knbinz;i++) dz += binSizeZ[i];
+    dz *= 0.5;
+
+    SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
+    if(dx!=kdx || dz!=kdz) Warning("AliITSgeomSPD425Long::Default Creator",
+                                  "Detector size may not be write.");
+
+    InitLowBinEdgeX(); // array of bin sizes along x.
+    InitLowBinEdgeZ(); // array of bin sizes along x.
+    SetLowBinEdgeX(0,-dx);
+    SetLowBinEdgeZ(0,-dz);
+    for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
+    for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
 ////////////////////////////////////////////////////////////////////////
-//    default constructor
+// Standard output streaming function.
 ////////////////////////////////////////////////////////////////////////
-    dx = 0.64;    // cm. (Geant 3.12 units) Orthonormal to y and z
-    dy = 0.0075;  // cm. (Geant 3.12 units) Radialy from the Beam Pipe
-    dz = 4.19;    // cm. (Geant 3.12 units) Allong the Beam Pipe
 
-    fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
-                         dx,dy,dz);
-                         }*/
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    r.Read(&is);
+    return is;
+}
+//======================================================================
index fad73cfb8d1e19f2096f5d519a68455a038745bd..99d432bcd646cc477c58c4af90699fb634ccb592 100644 (file)
 
 /* $Id$ */
 
+#include <TObject.h>
+#include <TBRIK.h>
 
-#include "TShape.h"
-#include "TBRIK.h"
+class ostream;
+class istream;
 
-#include "TObject.h"
+class TShape;
 
+class AliITSgeomSPD : public TObject {
 
-class AliITSgeomSPD:public TObject {
+ public:
+    AliITSgeomSPD();
+    AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,Int_t nz,Float_t *bz);
+    AliITSgeomSPD(AliITSgeomSPD &source);
+    AliITSgeomSPD& operator=(AliITSgeomSPD &source);
+    virtual ~AliITSgeomSPD();
+    virtual void ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
+                          Int_t nz,Float_t *bz);
+    virtual TShape *GetShape() const {return fShapeSPD;}
+    virtual Float_t GetDx() { // Get TBRIK Dx
+        if(fShapeSPD!=0) return fShapeSPD->GetDx();
+        else return 0.0;}
+    virtual Float_t GetDy() {// Get TBRIK Dy
+        if(fShapeSPD!=0) return fShapeSPD->GetDy();
+        else return 0.0;}
+    virtual Float_t GetDz() {// Get TBRIK Dz
+        if(fShapeSPD!=0) return fShapeSPD->GetDz();
+        else return 0.0;}
+    virtual Int_t GetNbinxX(){return fNbinx-1;} // returns the number of bins x
+    virtual Int_t GetNbinxZ(){return fNbinz-1;} // returns the number of bins z
+    virtual Float_t GetBinSizeX(Int_t i)
+       {if(i<fNbinx-1&&i>=0) return fLowBinEdgeX[i+1]-fLowBinEdgeX[i];
+       else return 0.0;}; // give size of bin i in x.
+    virtual Float_t GetBinSizeZ(Int_t i)
+       {if(i<fNbinx-1&&i>=0) return fLowBinEdgeZ[i+1]-fLowBinEdgeZ[i];
+       else return 0.0;}; // give size of bin i in z.
+    virtual Float_t GetBinLowEdgeX(Int_t i)
+       {if(i<fNbinx-1&&i>=0) return fLowBinEdgeX[i];
+       else return 0.0;}; // give size of bin i in x.
+    virtual Float_t GetBinLowEdgeZ(Int_t i)
+       {if(i<fNbinz-1&&i>=0) return fLowBinEdgeZ[i];
+       else return 0.0;}; // give size of bin i in z.
+    virtual void InitLowBinEdgeX(){// allocate memory for fLowBinEdgeX.
+       if(fLowBinEdgeX!=0) delete[] fLowBinEdgeX;
+       if(fNbinx>0) fLowBinEdgeX = new Float_t[fNbinx];else fLowBinEdgeX = 0;}
+    virtual void InitLowBinEdgeZ(){// allocate memory for fLowBinEdgeZ.
+       if(fLowBinEdgeZ!=0) delete[] fLowBinEdgeZ;
+       if(fNbinz>0) fLowBinEdgeZ = new Float_t[fNbinz];else fLowBinEdgeZ = 0;}
+    virtual void SetShape(const char *name,const char *title,const char *mat,
+                         Float_t dx,Float_t dy,Float_t dz)
+       {fShapeSPD = new TBRIK(name,title,mat,dx,dy,dz);};
+    virtual void SetNbinX(Int_t i){fNbinx = i+1;} // Set nubmer of pixels in x
+    virtual void SetNbinZ(Int_t i){fNbinz = i+1;} // Set nubmer of pixels in z
+    virtual void SetLowBinEdgeX(Int_t i,Float_t s){//puts value in fLowbinEdgeX
+        if(i>=0&&i<fNbinx) fLowBinEdgeX[i] = s;}
+    virtual void SetLowBinEdgeZ(Int_t i,Float_t s){//puts value in fLowbinEdgeZ
+       if(i>=0&&i<fNbinz) fLowBinEdgeZ[i] = s;};
+    virtual void LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col);
+    virtual void DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl);
+    virtual void Print(ostream *os); // output streamer to standard out.
+    virtual void Read(istream *is); // input streamer from standard in.
+
+ protected:
+    TBRIK  *fShapeSPD; // SPD active area shape
+    Int_t fNbinx;  // the number of elements in fLowBinEdgeX (#bins-1)
+    Int_t fNbinz;  // the number of elements in fLowBinEdgeZ (#bins-1)
+    Float_t *fLowBinEdgeX; //[fNbinx] Array of X lower bin edges for the pixels
+    Float_t *fLowBinEdgeZ; //[fNbinz] Array of Z lower bin edges for the pixels
+
+    ClassDef(AliITSgeomSPD,1) // ITS SPD detector geometry class..
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSPD &source);
+istream &operator>>(istream &os,AliITSgeomSPD &source);
+#endif
+//======================================================================
+
+#ifndef ALIITSGEOMSPD300_H
+#define ALIITSGEOMSPD300_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//#include "AliITSgeomSPD.h"
+
+class ostream;
+class istream;
+
+class AliITSgeomSPD300 : public AliITSgeomSPD {
 
  public:
-    virtual ~AliITSgeomSPD(){}; // destructor
-    virtual TShape *GetShape(){return (TShape*)0;} // get TShape
-    virtual Float_t GetDx(){return 0.0;}; // get width
-    virtual Float_t GetDy(){return 0.0;}; // get thickness
-    virtual Float_t GetDz(){return 0.0;}; // get length
-    virtual Int_t   GetNbinsX(){return 0;}; // get number of x pixels
-    virtual Float_t GetBinSizeX(Int_t i){return 0.0;}; // get x pixel size
-    virtual Int_t   GetNbinsZ(){return 0;}; // get number of z pixels
-    virtual Float_t GetBinSizeZ(Int_t i){return 0.0;}; // get z pixel size
-    virtual void    ReSetBins(Float_t dy,Int_t Nx, Float_t *bx,
-                             Int_t Nz,Float_t *bz){;}; // change pixel sizes
-
-    ClassDef(AliITSgeomSPD,2) // ITS SPD detector geometry class
+    AliITSgeomSPD300();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SPD detector geometry.
+    ClassDef(AliITSgeomSPD300,0) // ITS SPD detector geometry class for 300X50 micron pixel size.
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSPD300 &source);
+istream &operator>>(istream &os,AliITSgeomSPD300 &source);
+#endif
+//======================================================================
+
+#ifndef ALIITSGEOMSPD425SHORT_H
+#define ALIITSGEOMSPD425SHORT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//#include "AliITSgeomSPD.h"
+
+
+// temporary - this will migrate into the segmentation class
+
+class ostream;
+class istream;
+
+class AliITSgeomSPD425Short : public AliITSgeomSPD {
+
+ public:
+    AliITSgeomSPD425Short();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SPD detector geometry.
+    ClassDef(AliITSgeomSPD425Short,0) // ITS SPD detector geometry class for 425X50 micron pixel size Short version.
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSPD425Short &source);
+istream &operator>>(istream &os,AliITSgeomSPD425Short &source);
+#endif
+//======================================================================
+
+#ifndef ALIITSGEOMSPD425LONG_H
+#define ALIITSGEOMSPD425LONG_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//#include "AliITSgeomSPD.h"
+
+
+// temporary - this will migrate into the segmentation class
+
+class ostream;
+class istream;
+
+class AliITSgeomSPD425Long : public AliITSgeomSPD {
+
+ public:
+    AliITSgeomSPD425Long();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SPD detector geometry.
+    ClassDef(AliITSgeomSPD425Long,0) // ITS SPD detector geometry class for 425X50 micron pixel size.
 
 };
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSPD425Long &source);
+istream &operator>>(istream &os,AliITSgeomSPD425Long &source);
 #endif
index 89092fe4df229ec1b108f71cba15ce66ebc3af19..191244160942c0726e18a513516ad158f833384b 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.8  2000/10/02 16:32:43  barbera
+Forward declaration added
+
 Revision 1.2.4.8  2000/10/02 15:53:49  barbera
 Forward declaration added
 
@@ -32,29 +35,67 @@ Revision 1.2  1999/09/29 09:24:20  fca
 Introduction of the Copyright and cvs Log
 
 */
-#include <TBRIK.h> 
+#include <iostream.h>
+#include <iomanip.h>
+#include <stdlib.h>
+#include <TShape.h>
+#include <TBRIK.h>
+
 #include "AliITSgeomSSD.h"
 
 ClassImp(AliITSgeomSSD)
-AliITSgeomSSD::AliITSgeomSSD(){
+AliITSgeomSSD::AliITSgeomSSD(const Float_t *box,Float_t ap,Float_t an,
+                            Int_t np,Float_t *p,Int_t nn,Float_t *n){
 ////////////////////////////////////////////////////////////////////////
-//    default constructor
-////////////////////////////////////////////////////////////////////////
-
-    Float_t dx = 3.65;  // cm. (Geant 3.12 units) Orthonormal to y and z
-    Float_t dy = 0.015; // cm. (Geant 3.12 units) Radialy from the Beam Pipe
-    Float_t dz = 2.0;   // cm. (Geant 3.12 units) Allong the Beam Pipe
+//    Standard Constructor. *box={dx,dy,dz}, ap=anode angle, an=cathode angle,
+// nn= number of cathodes+1,*n= array of cathode low edges+highest edge,
+// np= number of anodes+1, *p= array of anode low edges+lighest edge.
+///////////////////////////////////////////////////////////////////////
+    Int_t i;
 
     fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
-                         dx,dy,dz);   
+                         box[0],box[1],box[2]);
+    if(fLowEdgeP!=0) delete fLowEdgeP;
+    if(fLowEdgeN!=0) delete fLowEdgeN;
+    fNp = np;
+    fNn = nn;
+    fAngleP = ap;
+    fAngleN = an;
+    fLowEdgeP = new Float_t[fNp];
+    fLowEdgeN = new Float_t[fNn];
+    for(i=0;i<fNp;i++) fLowEdgeP[i] = p[i];
+    for(i=0;i<fNn;i++) fLowEdgeN[i] = n[i];
+}
+//______________________________________________________________________
+AliITSgeomSSD::~AliITSgeomSSD(){
+    // Destructor.
+
+    delete fLowEdgeP; fLowEdgeP = 0;
+    delete fLowEdgeN; fLowEdgeN = 0;
+    delete fShapeSSD; fShapeSSD = 0;
+    fNp = 0;
+    fNn = 0;
+    fAngleP = 0.0;
+    fAngleN = 0.0;
 }
-
 AliITSgeomSSD::AliITSgeomSSD(const AliITSgeomSSD &source){
 ////////////////////////////////////////////////////////////////////////
 //    copy  constructor
 ////////////////////////////////////////////////////////////////////////
+    Int_t i;
 
+    if(this == &source) return;
     this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
+    this->fNp = source.fNp;
+    this->fNn = source.fNn;
+    delete fLowEdgeP;
+    delete fLowEdgeN;
+    this->fAngleP = source.fAngleP;
+    this->fAngleN = source.fAngleN;
+    fLowEdgeP = new Float_t[fNp];
+    fLowEdgeN = new Float_t[fNn];
+    for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
+    for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
     return;
 }  
 
@@ -62,46 +103,286 @@ AliITSgeomSSD& AliITSgeomSSD::operator=(const AliITSgeomSSD &source) {
 ////////////////////////////////////////////////////////////////////////
 //    assignment operator
 ////////////////////////////////////////////////////////////////////////
+    Int_t i;
 
+    if(this == &source) return *this;
     this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
+    this->fNp = source.fNp;
+    this->fNn = source.fNn;
+    delete fLowEdgeP;
+    delete fLowEdgeN;
+    this->fAngleP = source.fAngleP;
+    this->fAngleN = source.fAngleN;
+    fLowEdgeP = new Float_t[fNp];
+    fLowEdgeN = new Float_t[fNn];
+    for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
+    for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
     return *this;
 }
+//______________________________________________________________________
+void AliITSgeomSSD::Local2Det(Float_t x,Float_t z,Int_t &a,Int_t &c){
+    Float_t d,b;
+    Int_t i;
+
+    // project on to bonding edges.
+    d = x*TMath::Cos(fAngleP)+z*TMath::Sin(fAngleP);
+    b = x*TMath::Cos(fAngleN)+z*TMath::Sin(fAngleN);
+    if(d<fLowEdgeP[0]) i=-1;
+    else for(i=0;i<fNp;i++){
+       if(fLowEdgeP[i]<d) break;
+    } // end for i
+    a = i;
+    if(b<fLowEdgeN[0]) i=-1;
+    else for(i=0;i<fNn;i++){
+       if(fLowEdgeN[i]<b) break;
+    } // end for i
+    c = i;
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSSD::Det2Local(Int_t a,Int_t c,Float_t &x,Float_t &z){
+//    Float_t d,b;
+//    Int_t i;
 
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSSD::Print(ostream *os){
+////////////////////////////////////////////////////////////////////////
+// Standard output format for this class.
+////////////////////////////////////////////////////////////////////////
+    ios::fmtflags fmt;
+    Int_t i;
+
+    fmt = os->setf(ios::scientific);  // set scientific floating point output
+    *os << "TBRIK" << " ";
+    *os << setprecision(16) << GetDx() << " ";
+    *os << setprecision(16) << GetDy() << " ";
+    *os << setprecision(16) << GetDz() << " ";
+    *os << fNp << " " << fNn << " ";
+    *os << setprecision(16) << fAngleP << " ";
+    *os << setprecision(16) << fAngleN << " ";
+    for(i=0;i<fNp;i++) *os << setprecision(16) << fLowEdgeP[i] << " ";
+    for(i=0;i<fNn;i++) *os << setprecision(16) << fLowEdgeN[i] << " ";
+    *os << endl;
+    os->flags(fmt); // reset back to old formating.
+    return;
+}
+//______________________________________________________________________
+void AliITSgeomSSD::Read(istream *is){
+////////////////////////////////////////////////////////////////////////
+// Standard input format for this class.
+////////////////////////////////////////////////////////////////////////
+    Float_t dx,dy,dz;
+    Int_t i;
+    char shp[20];
 
+    *is >> shp;
+    *is >> dx >> dy >> dz;
+    if(fShapeSSD!=0) delete fShapeSSD;
+    fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
+                           dx,dy,dz);
+    *is >> fNp >> fNn;
+    *is >> fAngleP >> fAngleN;
+    if(fLowEdgeP !=0) delete fLowEdgeP;
+    if(fLowEdgeN !=0) delete fLowEdgeN;
+    fLowEdgeP = new Float_t[fNp];
+    fLowEdgeN = new Float_t[fNn];
+    for(i=0;0<fNp;i++) *is >> fLowEdgeP[i];
+    for(i=0;i<fNn;i++) *is >> fLowEdgeN[i];
+    return;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSgeomSSD &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSSD &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+/*
+$Log$
+*/
 
+//#include "AliITSgeomSSD175.h"
 
+ClassImp(AliITSgeomSSD175)
 
+AliITSgeomSSD175::AliITSgeomSSD175() : AliITSgeomSSD(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor
+////////////////////////////////////////////////////////////////////////
+    const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
+    // Size of sensitive detector area x,y(thickness),z
+    const Float_t kangle   = 0.0175; // angle in rad. of anode and cathodes
+    const Float_t kpitch   = 0.0095;// cm anode separation.
+    const Int_t   kNstrips = 768; // number of anode or cathode strips.
+    Float_t *leA,*leC; // array of low edges anode and cathorde.
+    Int_t i;
+
+    leA = new Float_t[kNstrips+1];
+    leC = new Float_t[kNstrips+1];
+    leA[0] = -kDxyz[0];
+    leA[1] = -kpitch*(0.5*kNstrips-1);
+    leC[0] =  kDxyz[0];
+    leC[1] =  kpitch*(0.5*kNstrips-1);
+    for(i=1;i<kNstrips;i++){
+       leA[i+1] = leA[i] + kpitch;
+       leC[i+1] = leC[i] - kpitch;
+    } // end for i
+    leA[kNstrips] =  kDxyz[0];
+    leC[kNstrips] = -kDxyz[0];
+//    cout << "AliITSgeomSSD175 default creator called: start" << endl;
+    AliITSgeomSSD::AliITSgeomSSD(kDxyz,kangle,-kangle,
+                                kNstrips+1,leA,kNstrips+1,leC);
+    delete leA;
+    delete leC;
+//    cout << "AliITSgeomSSD175 default creator called: end" << endl;
+}
+//________________________________________________________________________
+ostream &operator<<(ostream &os,AliITSgeomSSD175 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSSD175 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+/*
+$Log$
+*/
 
+//#include "AliITSgeomSSD275and75.h"
 
+ClassImp(AliITSgeomSSD275and75)
 
+AliITSgeomSSD275and75::AliITSgeomSSD275and75() : AliITSgeomSSD(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor
+////////////////////////////////////////////////////////////////////////
+    const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
+    // Size of sensitive detector area x,y(thickness),z
+    const Float_t kangleA  = 0.0275; // angle in rad. of anode and cathodes
+    const Float_t kangleC  = 0.0075; // angle in rad. of anode and cathodes
+    const Float_t kpitch   = 0.0095;// cm anode separation.
+    const Int_t   kNstrips = 768; // number of anode or cathode strips.
+    Float_t *leA,*leC; // array of low edges anode and cathorde.
+    Int_t i;
+
+    leA = new Float_t[kNstrips+1];
+    leC = new Float_t[kNstrips+1];
+    leA[0] = -kDxyz[0];
+    leA[1] = -kpitch*(0.5*kNstrips-1);
+    leC[0] =  kDxyz[0];
+    leC[1] =  kpitch*(0.5*kNstrips-1);
+    for(i=1;i<kNstrips;i++){
+       leA[i+1] = leA[i] + kpitch;
+       leC[i+1] = leC[i] - kpitch;
+    } // end for i
+    leA[kNstrips] =  kDxyz[0];
+    leC[kNstrips] = -kDxyz[0];
+//    cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
+    AliITSgeomSSD::AliITSgeomSSD(kDxyz,kangleA,kangleC,
+                                kNstrips+1,leA,kNstrips+1,leC);
+    delete leA;
+    delete leC;
+//    cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
+}
+//________________________________________________________________________
+ostream &operator<<(ostream &os,AliITSgeomSSD275and75 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSSD275and75 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    r.Read(&is);
+    return is;
+}
+//======================================================================
+/*
+$Log$
+*/
+//#include "AliITSgeomSSD75and275.h"
 
+ClassImp(AliITSgeomSSD75and275)
 
+AliITSgeomSSD75and275::AliITSgeomSSD75and275() : AliITSgeomSSD(){
+////////////////////////////////////////////////////////////////////////
+//    default constructor
+////////////////////////////////////////////////////////////////////////
+    const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
+    // Size of sensitive detector area x,y(thickness),z
+    const Float_t kangleA  = 0.0075; // angle in rad. of anode and cathodes
+    const Float_t kangleC  = 0.0275; // angle in rad. of anode and cathodes
+    const Float_t kpitch   = 0.0095;// cm anode separation.
+    const Int_t   kNstrips = 768; // number of anode or cathode strips.
+    Float_t *leA,*leC; // array of low edges anode and cathorde.
+    Int_t i;
+
+    leA = new Float_t[kNstrips+1];
+    leC = new Float_t[kNstrips+1];
+    leA[0] = -kDxyz[0];
+    leA[1] = -kpitch*(0.5*kNstrips-1);
+    leC[0] =  kDxyz[0];
+    leC[1] =  kpitch*(0.5*kNstrips-1);
+    for(i=1;i<kNstrips;i++){
+       leA[i+1] = leA[i] + kpitch;
+       leC[i+1] = leC[i] - kpitch;
+    } // end for i
+    leA[kNstrips] =  kDxyz[0];
+    leC[kNstrips] = -kDxyz[0];
+//    cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
+    AliITSgeomSSD::AliITSgeomSSD(kDxyz,kangleA,kangleC,
+                                kNstrips+1,leA,kNstrips+1,leC);
+    delete leA;
+    delete leC;
+//    cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
+}
+//________________________________________________________________________
+ostream &operator<<(ostream &os,AliITSgeomSSD75and275 &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
 
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSgeomSSD75and275 &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+    r.Read(&is);
+    return is;
+}
+//======================================================================
index b9e68746833ab329f8924a4d286781005e006efb..66f98bfd80c64cff243cd5187a61a9033d9341ee 100644 (file)
 /* $Id$ */
 
 #include <TObject.h>
+#include <TBRIK.h>
 
-//#include "AliITSgeom.h"
+class TShape;
+class ostream;
+class istream;
 
-class TBRIK;
-class AliITSgeom;
-
-class AliITSgeomSSD: public TObject {
+class AliITSgeomSSD : public TObject {
 
  public:
-    AliITSgeomSSD();
-    virtual ~AliITSgeomSSD() {
-      // destructor
-    }
-    AliITSgeomSSD(const AliITSgeomSSD &source); 
-    AliITSgeomSSD& operator=(const AliITSgeomSSD &source); 
-    
-    TBRIK *GetShape() const {
-      // get shape
-      return fShapeSSD;
-    }
-    Float_t GetDx(){
-      // get Dx
-      return fShapeSSD->GetDx();
-    }
-    Float_t GetDy(){
-      // get Dx
-      return fShapeSSD->GetDy();
-    }
-    Float_t GetDz(){
-      // get Dx
-      return fShapeSSD->GetDz();
-    }
-    
- private:
-    // define shape of active area using ROOT shapes so that they can
-    // be easly plotted. Inputs to TBRIK are
-    // Shape name (what ever that is)
-    // Shape title (what ever that means)
-    // name of material (something I took from ITSgeometry.tme file
-    // dx => 1/2 thickness of wafer's active volume (cm)
-    // dy => 1/2 r*phi size of active volume (cm)
-    // dz => 1/2 size of active volume (cm)
+    AliITSgeomSSD(){;}; // default constructor
+    AliITSgeomSSD(const Float_t *box,Float_t ap,Float_t an,
+                 Int_t np,Float_t *p,Int_t nn,Float_t *n); // Constructor
+    virtual ~AliITSgeomSSD(); // Destructor
+    AliITSgeomSSD(const AliITSgeomSSD &source);// copy constructor
+    virtual AliITSgeomSSD& operator=(const AliITSgeomSSD &source); // = opt.
+    virtual TShape *GetShape() const {return fShapeSSD;}// get shape
+    virtual Float_t GetDx(){if(fShapeSSD!=0) return fShapeSSD->GetDx();
+                    else return 0.0;}// get Dx
+    virtual Float_t GetDy(){if(fShapeSSD!=0) return fShapeSSD->GetDy();
+                    else return 0.0;}// get Dy
+    virtual Float_t GetDz(){if(fShapeSSD!=0) return fShapeSSD->GetDz();
+                    else return 0.0;}// get Dz
+    virtual Int_t GetNAnodes() {return fNp-1;}//the number of Anodes "P"
+    virtual Int_t GetNCathodess() {return fNn-1;}//the number of Cathodes "N"
+    virtual Float_t GetAnodePitch(Int_t i=0){ //anode pitch for anode i
+       if(i>=0&&i<fNp) return fLowEdgeP[i+1]-fLowEdgeP[i];else return 0.0;}
+    virtual Float_t GetCathodePitch(Int_t i=0){ // cathode pitch for cathode i
+       if(i>0&&i<fNn) return fLowEdgeN[1]-fLowEdgeN[0];else return 0.0;}
+    virtual Float_t GetAnodeAngle(){return fAngleP;}//anode strip angle.
+    virtual Float_t GetCathodeAngle(){return fAngleN;}//cathode strip angle.
+    virtual void SetShape(char *name,char *title,char *mat,
+                          Float_t dx,Float_t dy,Float_t dz){
+       // defines TBRIK with given paramters
+        fShapeSSD = new TBRIK(name,title,mat,dx,dy,dz);};
+    virtual void SetNAnodes(Int_t n) {// sets the number of Anodes "P" and
+       // allocates array of low edges.
+       fNp=n+1;delete fLowEdgeP;fLowEdgeP = new Float_t[fNp];}
+    virtual void SetNCathotess(Int_t n) {// sets the number of Anodes "N" and 
+       // allocates array of low edges.
+       fNn=n+1;delete fLowEdgeN;fLowEdgeN =new  Float_t[fNn];}
+    virtual void SetAnodeLowEdges(Float_t *p){// sets Anode low edges +1.
+       for(Int_t i=0;i<fNp;i++)fLowEdgeP[i]=p[i];}
+    virtual void SetCathodeLowEdges(Float_t *p){// sets Cathodes low edges +1.
+       for(Int_t i=0;i<fNn;i++)fLowEdgeN[i]=p[i];}
+    virtual void SetAnodeAngle(Float_t a){fAngleP=a;} //sets anode angle.
+    virtual void SetCathodeAngle(Float_t a){fAngleN=a;}//sets cathode  angle.
+
+    virtual void Local2Det(Float_t x,Float_t z,Int_t &a,Int_t &c);
+    virtual void Det2Local(Int_t a,Int_t c,Float_t &x,Float_t &z);
+
+    virtual void Print(ostream *os);  // Output streamer to standard out.
+    virtual void Read(istream *is);   // Input streamer to standard in.
+
+ protected:
+    // -+-> x
+    //  |
+    //  V
+    //  z
     TBRIK *fShapeSSD; // comment
-    // Other infomation like.
-    // Float_t fTopPitch;      // cm
-    // Float_t fTopWidth;      // cm
-    // Float_t fTopLength;     // cm
-    // Float_t fTopAngle;      // cm
-    // Float_t fBottomPitch;   // cm
-    // Float_t fBottomWidth;   // cm
-    // Float_t fBottomLength;  // cm
-    // Float_t fBottomAngle;   // cm
+    Int_t   fNp;      // Number of Anode strips.
+    Int_t   fNn;      // Number of Cathode strips.
+    Float_t *fLowEdgeP;  //[fNp] Anode side strip pitch angle==0.
+    Float_t *fLowEdgeN;  //[fNn] Cathode side strip pich angle==0.
+    Float_t fAngleP;  // Anode side strip angle (rad).
+    Float_t fAngleN;  // Cathode side strip angle (rad).
     // or what other or different information that is needed.
     
     ClassDef(AliITSgeomSSD,1) // ITS SSD detector geometry class
-      };
 
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSSD &source);
+istream &operator>>(istream &os,AliITSgeomSSD &source);
 #endif
-      
+//======================================================================
+#ifndef ALIITSGEOMSSD175_H
+#define ALIITSGEOMSSD175_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
 
+/*
+  $Id$
+*/
 
+//#include "AliITSgeomSSD.h"
 
+class ostream;
+class istream;
 
+class TShape;
 
+class AliITSgeomSSD175 : public AliITSgeomSSD {
 
+ public:
+    AliITSgeomSSD175();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SDD detector geometry.
+    ClassDef(AliITSgeomSSD175,0) // ITS SSD detector with stips at +- 0.0175 rad.
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSSD175 &source);
+istream &operator>>(istream &os,AliITSgeomSSD175 &source);
+#endif
+//======================================================================
+#ifndef ALIITSGEOMSSD27575_H
+#define ALIITSGEOMSSD27575_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
 
+/*
+  $Id$
+*/
 
+//#include "AliITSgeomSSD.h"
 
+class ostream;
+class istream;
 
+class TShape;
 
+class AliITSgeomSSD275and75 : public AliITSgeomSSD {
+
+ public:
+    AliITSgeomSSD275and75();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SDD detector geometry.
+    ClassDef(AliITSgeomSSD275and75,0) // ITS SSD detector with 0.0275 and 0.0075 rad strip angles.
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSSD275and75 &source);
+istream &operator>>(istream &os,AliITSgeomSSD275and75 &source);
+#endif
+//======================================================================
+#ifndef ALIITSGEOMSSD75275_H
+#define ALIITSGEOMSSD75275_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+  $Id$
+*/
+
+//#include "AliITSgeomSSD.h"
+
+class ostream;
+class istream;
+class TShape;
+
+class AliITSgeomSSD75and275 : public AliITSgeomSSD {
+
+ public:
+    AliITSgeomSSD75and275();
+
+    // This clas now has version 0 so that it will not be written to a root
+    // file. This is good since there are no longer any data members to this
+    // class. It is only designed to make it easer to define this standard
+    // SSD detector geometry.
+    ClassDef(AliITSgeomSSD75and275,0) // ITS SSD detector geometry class for 0.0075 and 0.0275 rad angled strips.
+
+};
+// Input and output function for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSgeomSSD75and275 &source);
+istream &operator>>(istream &os,AliITSgeomSSD75and275 &source);
+#endif
index f107e9e4e476f9504d0394fbb5ddaa3043aae51a..52be9886c5ddab752388e4af84e1db62beff35cd 100644 (file)
 #pragma link C++ class  AliITSgeomSPD+;
 #pragma link C++ class  AliITSgeomSDD+;
 #pragma link C++ class  AliITSgeomSSD+;
-
+// Standard ITS detector class initilizers
 #pragma link C++ class AliITSgeomSPD300+;
-#pragma link C++ class AliITSgeomSPD425+;
+#pragma link C++ class AliITSgeomSPD425Short+;
+#pragma link C++ class AliITSgeomSPD425Long+;
+#pragma link C++ class AliITSgeomSDD256+;
+#pragma link C++ class AliITSgeomSDD300+;
+#pragma link C++ class AliITSgeomSSD175+;
+#pragma link C++ class AliITSgeomSSD275and75+;
+#pragma link C++ class AliITSgeomSSD75and275+;
 
 #pragma link C++ class  AliITSmodule+;
 #pragma link C++ class  AliITSRecPoint+;
index 460f67b0008d560213e142507403f21c4ca6e6a6..69805b8bae29ae8607dbc4af3ebc7d039784bbf4 100644 (file)
@@ -34,7 +34,7 @@ SRCS          = AliITS.cxx AliITSv1.cxx AliITSv3.cxx AliITSv5.cxx \
                AliITSClusterFinderSDD.cxx AliITSRawData.cxx \
                AliITSHuffman.cxx AliITSClusterFinderSSD.cxx \
                AliITSclusterSSD.cxx AliITSpackageSSD.cxx \
-               AliITSdictSSD.cxx AliITSgeomSPD300.cxx AliITSgeomSPD425.cxx \
+               AliITSdictSSD.cxx \
                AliITSstatistics.cxx AliITSstatistics2.cxx \
                 AliITStrack.cxx AliITStracking.cxx AliITSiotrack.cxx \
                AliITSvtest.cxx