]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixed bug with HP and no unget in iostream.h. Now using putback instead.
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Feb 2001 20:23:21 +0000 (20:23 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Feb 2001 20:23:21 +0000 (20:23 +0000)
Other changes and fixes also included.

ITS/AliITSgeom.cxx
ITS/AliITSgeom.h

index eda68aef36d163f7ab1846bdd51e6c54143723a2..6ca49f380e3915ec824b23cd92f6d0ae56ccbad3 100644 (file)
 
 /*
 $Log$
+Revision 1.14  2001/02/03 00:00:29  nilsen
+New version of AliITSgeom and related files. Now uses automatic streamers,
+set up for new formatted .det file which includes detector information.
+Additional smaller modifications are still to come.
+
 Revision 1.11  2000/10/02 16:32:35  barbera
 Forward declaration added
 
@@ -230,8 +235,8 @@ AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets,
     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);
+    fShape    = new TObjArray(5); // default value
+    for(i=0;i<5;i++) fShape->AddAt(0,i);
     strcpy(fVersion,"test");
     return;
 }
@@ -277,9 +282,9 @@ AliITSgeom::~AliITSgeom(){
 //______________________________________________________________________
 void AliITSgeom::ReadNewFile(const char *filename){
     Int_t ncmd=9;
-    char *cmda[]={"Version"        ,"fTrans"  ,"fNmodules",
-                 "fNlayers"       ,"fNladers","fNdetectors",
-                 "fNDetectorTypes","fShape"  ,"Matrix"};
+    const char *cmda[]={"Version"        ,"fTrans"  ,"fNmodules",
+                       "fNlayers"       ,"fNladers","fNdetectors",
+                       "fNDetectorTypes","fShape"  ,"Matrix"};
     Int_t i,j,lNdetTypes,ldet;
     char cmd[20],c;
     AliITSgeomSPD *spd;
@@ -290,6 +295,7 @@ void AliITSgeom::ReadNewFile(const char *filename){
     char *filtmp;
 
     filtmp = gSystem->ExpandPathName(filename);
+    cout << "AliITSgeom, Reading New .det file " << filtmp << endl;
     fp = new ifstream(filtmp,ios::in);  // open file to write
     while(fp->get(c)!=NULL){ // for ever loop
        if(c==' ') continue; // remove blanks
@@ -308,7 +314,8 @@ void AliITSgeom::ReadNewFile(const char *filename){
                } // end if c=='*'
            } // end if second /
        } // end if first /
-       fp->unget();
+       fp->putback(c);
+//     fp->unget();
        *fp >> cmd;
        for(i=0;i<ncmd;i++) if(strcmp(cmd,cmda[i])==0) break;
        switch (i){
@@ -349,7 +356,7 @@ void AliITSgeom::ReadNewFile(const char *filename){
            break;
        case 7:  // fShape
            *fp >> ldet;
-           if(fShape==0) fShape = new TObjArray(4,0);
+           if(fShape==0) fShape = new TObjArray(5,0);
            switch (ldet){
            case kSPD :
                ReSetShape(ldet,(TObject*) new AliITSgeomSPD());
@@ -403,6 +410,7 @@ void AliITSgeom::WriteNewFile(const char *filename){
     char *filtmp;
 
     filtmp = gSystem->ExpandPathName(filename);
+    cout << "AliITSgeom, Writing New .det file " << filtmp << endl;
     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;
@@ -410,7 +418,8 @@ void AliITSgeom::WriteNewFile(const char *filename){
     *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 << ", kSSDp=" << (Int_t) kSSDp << ", and kSDDp=" << (Int_t) kSDDp;
+    *fp << "*/" << endl;
     *fp << "Version " << fVersion << endl;//This should be consistant with the
                                            // geometry version.
     *fp << "fTrans " << fTrans << endl;
@@ -466,6 +475,7 @@ AliITSgeom::AliITSgeom(const char *filename){
    char *filtmp;
 
    filtmp = gSystem->ExpandPathName(filename);
+   cout << "AliITSgeom reading old .det file " << filtmp << endl;
    fShape = 0;
    strcpy(fVersion,"DefauleV5");
    pf = fopen(filtmp,"r");
index 77b64937c17cddf936370affd19bd4ee82fd007f..bb8f52dec27f590148a88a31ba862a4ecf5858a5 100644 (file)
@@ -17,6 +17,7 @@
 // the information needed to do the coordinate transformation are kept in
 // a specialized structure for ease of implementation.
 /////////////////////////////////////////////////////////////////////////
+#include <iostream.h>
 #include <TObjArray.h>
 #include <TVector.h>
 
@@ -26,7 +27,7 @@ class ifstream;
 class ofstream;
 
 
-typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3} AliITSDetector;
+typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
 
 //_______________________________________________________________________
 
@@ -67,7 +68,7 @@ class AliITSgeom : public TObject {
     // 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;}
+       if(fShape!=0){return ((fShape->At(ishape))!=0);}else return kFALSE;}
 //
     //     This function returns a pointer to the particular AliITSgeomMatrix
     // class for a specific module index.