// and AliITSgeomSSD for a more detailed example.
////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+//#include <stdlib.h>
+//#include <stdio.h>
+//#include <string.h>
+//#include <ctype.h>
#include <TSystem.h>
#include <TRandom.h>
"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;
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:
fclose(pf);
}
//______________________________________________________________________
-AliITSgeom::AliITSgeom(AliITSgeom &source){
+AliITSgeom::AliITSgeom(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 *this;
}
//______________________________________________________________________
+Int_t AliITSgeom::GetNdetectors(Int_t lay) const {
+ // Return the number of detectors/ladder for the given layer
+ // Inputs:
+ // Int_t lay the layer number
+ // Outputs:
+ // none.
+ // Return:
+ // Int_t the number of detectors/ladders for the give layer
+ Int_t ndet;
+
+ ndet = fNdet[lay-1];
+ return ndet;
+}
+//______________________________________________________________________
+Int_t AliITSgeom::GetNladders(Int_t lay) const {
+ // Return the number of ladders for the given layer
+ // Inputs:
+ // Int_t lay the layer number
+ // Outputs:
+ // none.
+ // Return:
+ // Int_t the number of ladders for the give layer
+ Int_t nlad;
+
+ nlad = fNlad[lay-1];
+ return nlad;
+}
+//______________________________________________________________________
Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det){
// This routine computes the module index number from the layer,
// ladder, and detector numbers. The number of ladders and detectors
return 0;
}
//______________________________________________________________________
+void AliITSgeom::GetCenterThetaPhi(Int_t lay,Int_t lad,Int_t det,
+ TVector &x){
+ // This function returns the Cartesian translation [cm] and the
+ // 6 GEANT rotation angles [degrees]for a given layer ladder and
+ // detector number, in the TVector x (at least 9 elements large).
+ // Inputs:
+ // Int_t lay ITS Layer number
+ // Int_t lad ITS Ladder number
+ // Int_t det ITS Detector number
+ // Outputs:
+ // TVector &x The translation vector and the 6 rotaion angles
+ // Return:
+ // none.
+ Double_t t[3],ang[6];
+ Int_t index=GetModuleIndex(lay,lad,det);
+
+ GetTrans(index,t);
+ GetGeantAngles(index,ang);
+ x(0) = t[0];x(1) = t[1];x(2) = t[2];
+ x(3) = ang[0];x(4) = ang[1];x(5) = ang[2];
+ x(6) = ang[3];x(7) = ang[4];x(8) = ang[5];
+}
+//______________________________________________________________________
void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){
// This function was primarily created for diagnostic reasons. It
// print to a file pointed to by the file pointer fp the difference
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;
}
//______________________________________________________________________