ClassImp(AliITSInitGeometry)
-const Bool_t AliITSInitGeometry::fgkOldSPDbarrel = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSDDbarrel = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSSDbarrel = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSDDcone = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSSDcone = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSPDshield = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSDDshield = kTRUE;
-const Bool_t AliITSInitGeometry::fgkOldSSDshield = kTRUE;
-const Bool_t AliITSInitGeometry::fgkOldServices = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSupports = kFALSE;
//______________________________________________________________________
AliITSInitGeometry::AliITSInitGeometry():
TObject(), // Base Class
fName(0), // Geometry name
-fMinorVersion(-1), // Minor version number/type
fMajorVersion(kvDefault), // Major versin number
fTiming(kFALSE), // Flag to start inilization timing
fSegGeom(kFALSE), // Flag to switch between the old use of
fName = "Undefined";
}
//______________________________________________________________________
-AliITSInitGeometry::AliITSInitGeometry(AliITSVersion_t version,
- Int_t minorversion):
+AliITSInitGeometry::AliITSInitGeometry(AliITSVersion_t version):
TObject(), // Base Class
fName(0), // Geometry name
-fMinorVersion(minorversion), // Minor version number/type
-fMajorVersion(version), // Major versin number
+fMajorVersion(version), // Major version number
fTiming(kFALSE), // Flag to start inilization timing
fSegGeom(kFALSE), // Flag to switch between the old use of
// AliITSgeomS?D class, or AliITSsegmentation
break;
case kvDefault:
default:
- AliFatal(Form("Undefined geometry: fMajorVersion=%d, "
- "fMinorVersion= %d",(Int_t)fMajorVersion,fMinorVersion));
+ AliFatal(Form("Undefined geometry: fMajorVersion=%d, ",(Int_t)fMajorVersion));
fName = "Undefined";
break;
} // switch
return 0;
}// end if
const Char_t *title = itsV->GetTitle();
- if(!ReadVersionString(title,(Int_t)strlen(title),version,minor,
- datetime))
+ if(!ReadVersionString(title,version))
Warning("UpdateInternalGeometry","Can't read title=%s\n",title);
SetTiming(kFALSE);
SetSegGeom(kFALSE);
SetDecoding(kFALSE);
- AliITSgeom *geom = CreateAliITSgeom(version,minor);
+ AliITSgeom *geom = CreateAliITSgeom(version);
AliDebug(1,"AliITSgeom object has been initialized from TGeo\n");
return geom;
}
//______________________________________________________________________
-AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(Int_t major,Int_t minor){
+AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(Int_t major){
// Creates and Initilizes the geometry transformation class AliITSgeom
// to values appropreate to this specific geometry. Now that
// the segmentation is part of AliITSgeom, the detector
// segmentations are also defined here.
// Inputs:
// Int_t major major version, see AliITSVersion_t
- // Int_t minor minor version
+ //
// Outputs:
// none.
// Return:
switch(major){
case kv11:
SetGeometryName("AliITSv11");
- SetVersion(kv11,minor);
+ SetVersion(kv11);
break;
case kvDefault:
default:
SetGeometryName("Undefined");
- SetVersion(kvDefault,minor);
+ SetVersion(kvDefault);
break;
} // end switch
AliITSgeom *geom = new AliITSgeom();
}
//______________________________________________________________________
-Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,
- AliITSVersion_t maj,Int_t min,
- const Char_t *cvsDate,const Char_t *cvsRevision)const{
- // fills the string str with the major and minor version number
+Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,AliITSVersion_t maj)const{
+ // fills the string str with the major version number
// Inputs:
- // Char_t *str The character string to hold the major
- // and minor version numbers in
+ // Char_t *str The character string to hold the major version number
// Int_t length The maximum number of characters which
- // can be accomidated by this string.
- // str[length-1] must exist and will be set to zero
+ // can be accommodated by this string.
+ // str[length-1] must exist
// AliITSVersion_t maj The major number
- // Int_t min The minor number
- // Char_t *cvsDate The date string from cvs
- // Char_t *cvsRevision The Revision string from cvs
- // Outputs:
- // Char_t *str The character string holding the major and minor
- // version numbers. str[length-1] must exist
- // and will be set to zero
- // Return:
- // kTRUE if no errors
- Char_t cvslikedate[30];
- Int_t i,n,cvsDateLength,cvsRevisionLength;
-
- cvsDateLength = (Int_t)strlen(cvsDate);
- if(cvsDateLength>30){ // svn string, make a cvs like string
- i=0;n=0;
- do{
- cvslikedate[i] = cvsDate[i];
- if(cvsDate[i]=='+' || cvsDate[i++]=='-'){
- n++; // count number of -
- cvslikedate[i-1] = '/'; // replace -'s by /'s.
- } // end if
- } while(n<3&&i<30); // once additonal - of time zone reach exit
- cvslikedate[i-1] = '$'; // put $ at end then zero.
- for(;i<30;i++) cvslikedate[i]=0;// i starts wher do loop left off.
- }else{
- for(i=0;i<cvsDateLength&&i<30;i++) cvslikedate[i]=cvsDate[i];
- }// end if
- cvsDateLength = (Int_t)strlen(cvslikedate);
- cvsRevisionLength = (Int_t)strlen(cvsRevision);
- i = (Int_t)maj;
- n = 50+(Int_t)(TMath::Log10(TMath::Abs((Double_t)i)))+1+
- (Int_t)(TMath::Log10(TMath::Abs((Double_t)min)))+1
- +cvsDateLength-6+cvsRevisionLength-10;
- if(GetDebug()>1) printf("AliITSInitGeometry::WriteVersionString:"
- "length=%d major=%d minor=%d cvsDate=%s[%d] "
- "cvsRevision=%s[%d] n=%d\n",length,i,min,cvslikedate,
- cvsDateLength,cvsRevision,cvsRevisionLength,n);
- if(i<0) n++;
- if(min<0) n++;
- if(length<n){// not enough space to write in output string.
- Warning("WriteVersionString","Output string not long enough "
- "lenght=%d must be at least %d long\n",length,n);
- return kFALSE;
- } // end if length<n
- char *cvsrevision = new char[cvsRevisionLength-10];
- char *cvsdate = new char[cvsDateLength-6];
- for(i=0;i<cvsRevisionLength-10;i++)
- if(10+i<cvsRevisionLength-1)
- cvsrevision[i] = cvsRevision[10+i]; else cvsrevision[i] = 0;
- for(i=0;i<cvsDateLength-6;i++) if(6+i<cvsDateLength-1)
- cvsdate[i] = cvslikedate[6+i]; else cvsdate[i] = 0;
- for(i=0;i<length;i++) str[i] = 0; // zero it out for now.
- i = (Int_t)maj;
- snprintf(str,length-1,"Major Version= %d Minor Version= %d Revision: %s Date: %s",i,min,cvsrevision,cvsdate);
- /* this gives compilation warnings on some compilers: descriptor zu
- if(GetDebug()>1)printf("AliITSInitGeometry::WriteVersionString: "
- "n=%d str=%s revision[%zu] date[%zu]\n",
- n,str,strlen(cvsrevision),strlen(cvsdate));
- */
- delete[] cvsrevision;
- delete[] cvsdate;
+
+
+ Int_t i = (Int_t)maj;
+
+ snprintf(str,length-1,"Major Version= %d",i);
return kTRUE;
}
//______________________________________________________________________
-Bool_t AliITSInitGeometry::ReadVersionString(const Char_t *str,Int_t length,
- AliITSVersion_t &maj,Int_t &min,
- TDatime &dt)const{
+Bool_t AliITSInitGeometry::ReadVersionString(const Char_t *str,AliITSVersion_t &maj)const{
// fills the string str with the major and minor version number
// Inputs:
- // Char_t *str The character string to holding the major and minor
- // version numbers in
+ // Char_t *str The character string to holding the major version number
// Int_t length The maximum number of characters which can be
- // accomidated by this string. str[length-1] must exist
+ // accommodated by this string. str[length-1] must exist
// Outputs:
- // Char_t *str The character string holding the major and minor
- // version numbers unchanged. str[length-1] must exist.
// AliITSVersion_t maj The major number
- // Int_t min The minor number
- // TDatime dt The date and time of the cvs commit
+
// Return:
// kTRUE if no errors
- Bool_t ok;
- Char_t cvsRevision[10],cvsDate[11],cvsTime[9];
- Int_t i,m,n=strlen(str),year,month,day,hours,minuits,seconds;
- memset(cvsRevision,0,10*sizeof(Char_t));
- memset(cvsDate,0,11*sizeof(Char_t));
- memset(cvsTime,0,9*sizeof(Char_t));
-
- if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString:"
- "str=%s length=%d\n",
- str,length);
- if(n<35) return kFALSE; // not enough space for numbers
- m = sscanf(str,"Major Version= %d Minor Version= %d Revision: %9s "
- "Date: %10s %8s",&i,&min,cvsRevision,cvsDate,cvsTime);
-
- // v11Hybrid geometry is treated as a v11 geometry
- if(i == 110)i=11;
-
- ok = m==5;
- if(!ok) return !ok;
- m = sscanf(cvsDate,"%d/%d/%d",&year,&month,&day);
- ok = m==3;
- if(!ok) return !ok;
- m = sscanf(cvsTime,"%d:%d:%d",&hours,&minuits,&seconds);
- ok = m==3;
- if(!ok) return !ok;
- dt.Set(year,month,day,hours,minuits,seconds);
- if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: i=%d "
- "min=%d cvsRevision=%s cvsDate=%s cvsTime=%s m=%d\n",
- i,min,cvsRevision,cvsDate,cvsTime,m);
- if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: year=%d"
- " month=%d day=%d hours=%d minuits=%d seconds=%d\n",
- year,month,day,hours,minuits,seconds);
- switch (i){
- case kv11:{
- maj = kv11;
- } break;
- default:{
- maj = kvDefault;
- } break;
- } // end switch
- return ok;
+
+ Bool_t retcode=kFALSE;
+ Int_t n=strlen(str);
+ if(n<15) return retcode; // not enough space for numbers
+ Int_t m,i;
+ m = sscanf(str,"Major Version= %d",&i);
+ maj = kvDefault;
+ if(m>0){
+ retcode = kTRUE;
+ if(i==11){
+ maj = kv11;
+ }
+ }
+ return retcode;
}
+
+
public:
AliITSInitGeometry();//Default Constructor
- AliITSInitGeometry(AliITSVersion_t version,
- Int_t minorversion=2);//Standard Constructor
+ AliITSInitGeometry(AliITSVersion_t version);//Standard Constructor
//virtual ~AliITSInitGeometry(); // Destructor
//
// Create and initialize geometry from TGeo
AliITSgeom* CreateAliITSgeom();
- AliITSgeom* CreateAliITSgeom(Int_t major,Int_t minor);
+ AliITSgeom* CreateAliITSgeom(Int_t major);
Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize geometry from gGeoManager
// Getters and Setters
// Getters and Setters
- void SetVersion(AliITSVersion_t maj,Int_t min) {// Set Major and Minor versions
- fMajorVersion=maj;fMinorVersion=min;}
+ void SetVersion(AliITSVersion_t maj) {// Set version
+ fMajorVersion=maj;}
TString GetGeometryName()const {return fName;}// Return geometry name
void SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name
Int_t GetMajorVersion()const {return (Int_t)fMajorVersion;} // Return geometry major version
- Int_t GetMinorVersion()const{return fMinorVersion;}// Return geometry minor version
Bool_t GetTiming()const{return fTiming;} // return routine timing flag
void SetTiming(Bool_t time=kTRUE){fTiming=time;}// Set routine timing (on)
Bool_t GetSegGeom()const{return fSegGeom;} // return flag indecating the use of AliITSsegmentation or AliITSgeomS?D class in fShape.
Int_t cpn1,Int_t cpn2) const;
// Given module number, find copy numbers.
void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2);
- // fills the string str with the major and minor version number
+ // fills the string str with the version number
Bool_t WriteVersionString(Char_t *str,Int_t length,
- AliITSVersion_t maj,Int_t min,
- const Char_t *cvsDate,const Char_t *cvsRev)const;
- // decodes the string str with the major and minor version number
- Bool_t ReadVersionString(const Char_t *str,Int_t length,
- AliITSVersion_t &maj,Int_t &min,TDatime &dt)const;
-
- static Bool_t SPDIsTGeoNative() {return !fgkOldSPDbarrel;}
- static Bool_t SDDIsTGeoNative() {return !fgkOldSDDbarrel;}
- static Bool_t SSDIsTGeoNative() {return !fgkOldSSDbarrel;}
-
- static Bool_t SDDconeIsTGeoNative() {return ! fgkOldSDDcone;}
- static Bool_t SSDconeIsTGeoNative() {return ! fgkOldSSDcone;}
- static Bool_t SPDshieldIsTGeoNative() {return ! fgkOldSPDshield;}
- static Bool_t SDDshieldIsTGeoNative() {return ! fgkOldSDDshield; }
- static Bool_t SSDshieldIsTGeoNative() {return ! fgkOldSSDshield;}
- static Bool_t ServicesAreTGeoNative() {return ! fgkOldServices;}
- static Bool_t SupportIsTGeoNative() {return ! fgkOldSupports;}
+ AliITSVersion_t maj)const;
private:
+ // decodes the string str with the version number
+ Bool_t ReadVersionString(const Char_t *str,AliITSVersion_t &maj)const;
+
// Decode module number into old layer, ladder, and detector numbers
void DecodeDetectorLayersv11(Int_t mod,Int_t &lay,
Int_t &lad,Int_t &det);
void TransposeTGeoHMatrix(TGeoHMatrix *m) const;
TString fName; // Geometry name
- Int_t fMinorVersion; // Geometry minor version
AliITSVersion_t fMajorVersion; // Geometry swich value
Bool_t fTiming; // Flag to start inilization timing
Bool_t fSegGeom; // Flag to switch between the old use of
Bool_t fDecode; // Flag for new/old decoding
Int_t fDebug; // Debug flag
- static const Bool_t fgkOldSPDbarrel; // use old geo for SPD ?
- static const Bool_t fgkOldSDDbarrel; // use old geo for SDD ?
- static const Bool_t fgkOldSSDbarrel; // use old geo for SSD ?
- static const Bool_t fgkOldSDDcone; // use old geo for SDD cone ?
- static const Bool_t fgkOldSSDcone; // use old geo for SSD cone?
- static const Bool_t fgkOldSPDshield; // use old geo for SPD shield ?
- static const Bool_t fgkOldSDDshield; // use old geo for SDD shield ?
- static const Bool_t fgkOldSSDshield; // use old geo for SDD shield ?
- static const Bool_t fgkOldServices; // use old geo for services ?
- static const Bool_t fgkOldSupports; // use old geo for supports ?
ClassDef(AliITSInitGeometry,0) // create/Init AliITSgeom
// 0 in ClassDef indicates that this class will not be "saved" in a file.