// and AliITSgeomSSD for a more detailed example.
////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <TSystem.h>
#include <TRandom.h>
+#include <TSystem.h>
#include "AliITSgeom.h"
-#include "AliITSgeomSPD.h"
#include "AliITSgeomSDD.h"
+#include "AliITSgeomSPD.h"
#include "AliITSgeomSSD.h"
+#include "AliLog.h"
ClassImp(AliITSgeom)
"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;
+ AliITSgeomSPD *spd=0;
+ AliITSgeomSDD *sdd=0;
+ AliITSgeomSSD *ssd=0;
+ AliITSgeomMatrix *m=0;
+ ifstream *fp=0;
+ char *filtmp=0;
filtmp = gSystem->ExpandPathName(filename);
- cout << "AliITSgeom, Reading New .det file " << filtmp << endl;
+ AliInfo(Form("Reading New .det file %s",filtmp));
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=='#' || c=='!') {while(fp->get(c)) if(c=='\n') break; continue;}
if(c=='/'){
fp->get(c);{
- if(c=='/'){for(;fp->get(c)!=NULL,c!='\n';);continue;}
+ if(c=='/') {while(fp->get(c)) if(c=='\n') break; continue;}
if(c=='*'){
NotYet:
- for(;fp->get(c)!=NULL,c!='*';);
+ while(fp->get(c)) if(c=='*') break;
fp->get(c);{
if(c=='/') continue;
goto NotYet;
if(fShape==0) fShape = new TObjArray(5,0);
switch (ldet){
case kSPD :
- ReSetShape(ldet,(TObject*) new AliITSgeomSPD());
- spd = (AliITSgeomSPD*) (fShape->At(ldet));
+ spd = new AliITSgeomSPD();
*fp >> *spd;
+ ReSetShape(ldet,spd);
spd = 0;
break;
- case kSDD :
- ReSetShape(ldet,(TObject*) new AliITSgeomSDD());
- sdd = (AliITSgeomSDD*) (fShape->At(ldet));
+ case kSDD : case kSDDp:
+ sdd = new AliITSgeomSDD();
*fp >> *sdd;
+ ReSetShape(ldet,sdd);
sdd = 0;
break;
case kSSD : case kSSDp :
- ReSetShape(ldet,(TObject*) new AliITSgeomSSD());
- ssd = (AliITSgeomSSD*) (fShape->At(ldet));
+ ssd = new AliITSgeomSSD();
*fp >> *ssd;
+ ReSetShape(ldet,ssd);
ssd = 0;
break;
default:
- Error("ReadNewFile","Unknown fShape type number=%d c=%c",ldet,c);
- for(;fp->get(c)==NULL,c!='\n';); // skip to end of line.
+ AliError(Form("Unknown fShape type number=%d c=%c",ldet,c));
+ while(fp->get(c)) if(c=='\n') break; // skip to end of line.
break;
} // end switch
break;
m = 0;
break;
default:
- Error("ReadNewFile","Data line i=%d c=%c",i,c);
- for(;fp->get(c)==NULL,c!='\n';); // skip this line
+ AliError(Form("ReadNewFile","Data line i=%d c=%c",i,c));
+ while(fp->get(c)) if(c=='\n') break; // skip this line
break;
} // end switch i
} // end while
fclose(pf);
}
//______________________________________________________________________
-AliITSgeom::AliITSgeom(AliITSgeom &source) : TObject(source){
+AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source){
// The copy constructor for the AliITSgeom class. It calls the
// = operator function. See the = operator function for more details.
// Inputs are:
return;
}
//______________________________________________________________________
-AliITSgeom& AliITSgeom::operator=(AliITSgeom &source){
+AliITSgeom& AliITSgeom::operator=(const AliITSgeom &source){
// The = operator function for the AliITSgeom class. It makes an
// independent copy of the class in such a way that any changes made
// to the copied class will not affect the source class in any way.
j = 0;
for(k=0;k<lay-1;k++) j += fNdet[k]*fNlad[k];
i = i+j;
+ if(i>=fNmodules) return -1;
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++) {
rb <<setprecision(16) << *(GetGeomMatrix(i)) << "\n";
} // end for i
+ rb << fShape->GetEntries()<<endl;
+ for(i=0;i<fShape->GetEntries();i++) if(fShape->At(i)!=0) switch (i){
+ case kSPD:
+ rb << kSPD <<","<< (AliITSgeomSPD*)(fShape->At(kSPD));
+ break;
+ case kSDD:
+ rb << kSDD <<","<< (AliITSgeomSDD*)(fShape->At(kSDD));
+ break;
+ case kSSD:
+ rb << kSSD <<","<< (AliITSgeomSSD*)(fShape->At(kSSD));
+ break;
+ case kSSDp:
+ rb << kSSDp <<","<< (AliITSgeomSSD*)(fShape->At(kSSDp));
+ break;
+ case kSDDp:
+ rb << kSDDp <<","<< (AliITSgeomSDD*)(fShape->At(kSDDp));
+ break;
+ } // end for i / switch
return rb;
}
//______________________________________________________________________
// ifstream &rb The input streaming buffer.
// Outputs are:
// ifstream &rb The input streaming buffer.
- Int_t i;
+ Int_t i,j;
fNlad = new Int_t[fNlayers];
fNdet = new Int_t[fNlayers];
fGm->AddAt(new AliITSgeomMatrix,i);
rb >> *(GetGeomMatrix(i));
} // end for i
+ rb >> i;
+ fShape = new TObjArray(i);
+ for(i=0;i<fShape->GetEntries();i++) {
+ rb >> j;
+ switch (j){
+ case kSPD:{
+ AliITSgeomSPD *s = new AliITSgeomSPD();
+ rb >> *s;
+ fShape->AddAt(s,kSPD);}
+ break;
+ case kSDD:{
+ AliITSgeomSDD *s = new AliITSgeomSDD();
+ rb >> *s;
+ fShape->AddAt(s,kSDD);}
+ break;
+ case kSSD:{
+ AliITSgeomSSD *s = new AliITSgeomSSD();
+ rb >> *s;
+ fShape->AddAt(s,kSSD);}
+ break;
+ case kSSDp:{
+ AliITSgeomSSD *s = new AliITSgeomSSD();
+ rb >> *s;
+ fShape->AddAt(s,kSSDp);}
+ break;
+ case kSDDp:{
+ AliITSgeomSDD *s = new AliITSgeomSDD();
+ rb >> *s;
+ fShape->AddAt(s,kSDDp);}
+ break;
+ } // end switch
+ } // end for i
return rb;
}
//______________________________________________________________________