]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSInitGeometry.cxx
Updating CMake files
[u/mrichter/AliRoot.git] / ITS / AliITSInitGeometry.cxx
index 1579ad952864cbe1396a8d1df72ad4255f1702f9..34bebcd7b8c6304ddddea7585bf80f3280f5b5d1 100644 (file)
@@ -27,6 +27,7 @@ $Id$
 #include <TArrayF.h>
 #include <TStopwatch.h>
 #include <TGeoManager.h>
+#include <TGeoMatrix.h>
 #include <TGeoVolume.h>
 #include <TGeoShape.h>
 #include <TGeoBBox.h>
@@ -50,21 +51,20 @@ $Id$
 #include "AliITSsegmentationSPD.h"
 #include "AliITSsegmentationSDD.h"
 #include "AliITSsegmentationSSD.h"
-#include "AliITSgeom.h"
 #include "AliITSInitGeometry.h"
 #include <TDatime.h>
 
 ClassImp(AliITSInitGeometry)
 
-const Bool_t AliITSInitGeometry::fgkOldSPDbarrel = kTRUE;
+const Bool_t AliITSInitGeometry::fgkOldSPDbarrel = kFALSE;
 const Bool_t AliITSInitGeometry::fgkOldSDDbarrel = kFALSE;
 const Bool_t AliITSInitGeometry::fgkOldSSDbarrel = kFALSE;
-const Bool_t AliITSInitGeometry::fgkOldSDDcone   = kTRUE;
-const Bool_t AliITSInitGeometry::fgkOldSSDcone   = kTRUE;
-const Bool_t AliITSInitGeometry::fgkOldSPDshield = kTRUE;
+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  = kTRUE;
+const Bool_t AliITSInitGeometry::fgkOldServices  = kFALSE;
 const Bool_t AliITSInitGeometry::fgkOldSupports  = kTRUE;
 //______________________________________________________________________
 AliITSInitGeometry::AliITSInitGeometry():
@@ -561,7 +561,7 @@ Bool_t AliITSInitGeometry::InitAliITSgeomSSD03(AliITSgeom *geom){
     return kTRUE;
 }
 //______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomITS04(AliITSgeom *geom){
+Bool_t AliITSInitGeometry::InitAliITSgeomITS04(AliITSgeom *geom) const{
     // Initilizes the geometry transformation class AliITSgeom
     // to values appropreate to this specific geometry. Now that
     // the segmentation is part of AliITSgeom, the detector
@@ -714,8 +714,8 @@ Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
         "%sIT56_1/I569_%d/I566_%d/ITS6_%d/"},// lay=6
 //     {"%sIT12_1/I12B_%d/I10B_%d/I107_%d/I101_1/ITS1_1", // lay=1
 //      "%sIT12_1/I12B_%d/I20B_%d/I1D7_%d/I1D1_1/ITS2_1", // lay=2
-       {"%sIT12_1/I12B_%d/I10B_%d/L1H-STAVE%d_1/I107_%d/I101_1/ITS1_1", // lay=1
-        "%sIT12_1/I12B_%d/I20B_%d/L2H-STAVE%d_1/I1D7_%d/I1D1_1/ITS2_1", // lay=2
+       {"%sIT12_1/I12B_%d/I10B_%d/L1H-STAVE%d_1/I107_%d/I101_1/ITS1_1",//lay=1
+        "%sIT12_1/I12B_%d/I20B_%d/L2H-STAVE%d_1/I1D7_%d/I1D1_1/ITS2_1",//lay=2
         "%sIT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
         "%sIT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4
         "%sIT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
@@ -744,7 +744,8 @@ Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
         geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot);
         RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det.
 
-       if (kIdet[lay-1]==kSPD) { // we need 1 more copy number because of the half-stave
+       if (kIdet[lay-1]==kSPD) { // we need 1 more copy number because 
+                                  // of the half-stave
          if (det<3) cpnHS = 0; else cpnHS = 1;
          path.Form(kNames[fMinorVersion-1][lay-1].Data(),kPathbase.Data(),
                    cpn0,cpn1,cpnHS,cpn2);
@@ -800,8 +801,8 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
 
   char *pathSPDsens1, *pathSPDsens2;
   if (SPDIsTGeoNative()) {
-    pathSPDsens1="%sITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/LAY1_STAVE_%d/HALF-STAVE%d_1/LAY1_LADDER_%d/LAY1_SENSOR_1";
-    pathSPDsens2="%sITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/LAY2_STAVE_%d/HALF-STAVE%d_1/LAY2_LADDER_%d/LAY2_SENSOR_1";
+    pathSPDsens1="%sITSSPD_1/ITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay1-Stave_%d/ITSSPDhalf-Stave%d_1/ITSSPDlay1-Ladder_%d/ITSSPDlay1-sensor_1";
+    pathSPDsens2="%sITSSPD_1/ITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay2-Stave_%d/ITSSPDhalf-Stave%d_1/ITSSPDlay2-Ladder_%d/ITSSPDlay2-sensor_1";
   } else{
     pathSPDsens1 = "%sITSD_1/IT12_1/I12B_%d/I10B_%d/L1H-STAVE%d_1/I107_%d/I101_1/ITS1_1";
     pathSPDsens2 = "%sITSD_1/IT12_1/I12B_%d/I20B_%d/L2H-STAVE%d_1/I1D7_%d/I1D1_1/ITS2_1";
@@ -818,8 +819,8 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
 
   char *pathSSDsens1, *pathSSDsens2;
   if (SSDIsTGeoNative()) {
-    pathSSDsens1 = "%sITSssdLayer5_1/ITSssdLay5Ladd_%d/ITSsddSensor5_%d/ITSsddSensitivL5_1";
-    pathSSDsens2 = "%sITSssdLayer6_1/ITSssdLay6Ladd_%d/ITSsddSensor6_%d/ITSsddSensitivL6_1";
+    pathSSDsens1 = "%sITSssdLayer5_1/ITSssdLay5Ladd_%d/ITSssdSensor5_%d/ITSssdSensitivL5_1";
+    pathSSDsens2 = "%sITSssdLayer6_1/ITSssdLay6Ladd_%d/ITSssdSensor6_%d/ITSssdSensitivL6_1";
   } else{
     pathSSDsens1 = "%sITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d";
     pathSSDsens2 = "%sITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d";
@@ -1002,15 +1003,16 @@ Bool_t AliITSInitGeometry::InitGeomShapePPRasymmFMD(AliITSDetector idet,
        initSeg[idet] = kTRUE;
        AliITSgeomSPD *geomSPD = new AliITSgeomSPD425Short();
        Float_t bx[256],bz[280];
-       for(i=000;i<256;i++) bx[i] =  50.0*kmicron2cm; // in x all are 50 microns.
-       for(i=000;i<160;i++) bz[i] = 425.0*kmicron2cm; // most are 425 microns
+       for(i=000;i<256;i++) bx[i] = 50.0*kmicron2cm;//in x all are 50 microns.
+       for(i=000;i<160;i++) bz[i] =425.0*kmicron2cm; // most are 425 microns
        // except below
        for(i=160;i<280;i++) bz[i] =   0.0*kmicron2cm; // Outside of detector.
        bz[ 31] = bz[ 32] = 625.0*kmicron2cm; // first chip boundry
        bz[ 63] = bz[ 64] = 625.0*kmicron2cm; // first chip boundry
        bz[ 95] = bz[ 96] = 625.0*kmicron2cm; // first chip boundry
        bz[127] = bz[128] = 625.0*kmicron2cm; // first chip boundry
-       bz[160] = 425.0*kmicron2cm;// Set so that there is no zero pixel size for fNz.
+       bz[160] = 425.0*kmicron2cm;// Set so that there is no zero 
+                                   // pixel size for fNz.
        geomSPD->ReSetBins(shapeParF[1],256,bx,160,bz);
        geom->ReSetShape(idet,geomSPD);
     }break;
@@ -1094,8 +1096,6 @@ Bool_t AliITSInitGeometry::InitSegmentationPPRasymmFMD(AliITSDetector idet,
        segSSD->SetPadSize(95.,0.); // strip x pitch in microns
        segSSD->SetNPads(768,2); // number of strips on each side, sides.
        segSSD->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
-       segSSD->SetAnglesLay5(0.0075,0.0275);//strip angels rad P and N
-       segSSD->SetAnglesLay6(0.0275,0.0075);//strip angels rad P and N
        geom->ReSetShape(idet,segSSD);
     }break;
     default:{// Others, Note no kSDDp or kSSDp in this geometry.
@@ -1624,7 +1624,7 @@ void AliITSInitGeometry::DecodeDetectorvSPD02(
 }
 //______________________________________________________________________
 void AliITSInitGeometry::RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
+                                        Int_t &cpn1,Int_t &cpn2) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -1654,7 +1654,7 @@ void AliITSInitGeometry::RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0,
 }
 //______________________________________________________________________
 void AliITSInitGeometry::DecodeDetectorLayersvSPD02(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
+                                            Int_t &lad,Int_t &det) const{
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose. Note, this use of layer ladder
@@ -1704,7 +1704,7 @@ void AliITSInitGeometry::DecodeDetectorvSDD03(
 }
 //______________________________________________________________________
 void AliITSInitGeometry::RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
+                                        Int_t &cpn1,Int_t &cpn2) const{
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -1727,7 +1727,7 @@ void AliITSInitGeometry::RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0,
 }
 //______________________________________________________________________
 void AliITSInitGeometry::DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
+                                                 Int_t &lad,Int_t &det) const{
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose. Note, this use of layer ladder
@@ -1774,7 +1774,7 @@ void AliITSInitGeometry::DecodeDetectorvSSD03(
 }
 //______________________________________________________________________
 void AliITSInitGeometry::RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
+                                        Int_t &cpn1,Int_t &cpn2) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -1797,7 +1797,7 @@ void AliITSInitGeometry::RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0,
 }
 //______________________________________________________________________
 void AliITSInitGeometry::DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
+                                                Int_t &lad,Int_t &det) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose. Note, this use of layer ladder
@@ -1841,7 +1841,7 @@ void AliITSInitGeometry::DecodeDetectorvITS04(
 }
 //______________________________________________________________________
 void AliITSInitGeometry::RecodeDetectorvITS04(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
+                                        Int_t &cpn1,Int_t &cpn2) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -1874,7 +1874,7 @@ void AliITSInitGeometry::RecodeDetectorvITS04(Int_t mod,Int_t &cpn0,
 }
 //______________________________________________________________________
 void AliITSInitGeometry::DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
+                                             Int_t &lad,Int_t &det) const{
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose. Note, this use of layer ladder
@@ -1912,8 +1912,8 @@ void AliITSInitGeometry::DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
     return;
 }
 //______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t layer,Int_t cpn0,
-                                        Int_t cpn1,Int_t cpn2) const {
+void AliITSInitGeometry::DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t layer,
+                                    Int_t cpn0,Int_t cpn1,Int_t cpn2) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -2165,8 +2165,8 @@ void AliITSInitGeometry::DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay,
     return;
 }
 //______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer,Int_t cpn0,
-                                        Int_t cpn1,Int_t cpn2) const {
+void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer,
+                                 Int_t cpn0,Int_t cpn1,Int_t cpn2) const {
     // decode geometry into detector module number
     // Inputs:
     //    Int_t layer    The ITS layer
@@ -2186,8 +2186,8 @@ void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer,Int_t cp
   switch(layer) {
   case 1: case 2:{
     if (SPDIsTGeoNative()) {
-      lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1)+1;
-      det = cpn2 + 1;
+      lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1);
+      det = cpn2;
     } else {
       lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1);
       det = cpn2;
@@ -2291,40 +2291,38 @@ void AliITSInitGeometry::RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0,
     //    Int_t cpn2     the highest copy number (SPD ladder or 1 for SDD/SSD)
     // Return:
     //    none.
+    const Int_t kDetPerLadderSPD[2]={2,4};
+    Int_t lay,lad,det;
 
-  const Int_t kDetPerLadderSPD[2]={2,4};
-  Int_t lay,lad,det;
-  DecodeDetectorLayersv11Hybrid(mod,lay,lad,det);
-
-  if (lay<3) { // SPD
-    cpn2 = det;     // Detector 1-4
-    cpn0 = (lad+kDetPerLadderSPD[lay-1]-1)/kDetPerLadderSPD[lay-1];
-    cpn1 = (lad+kDetPerLadderSPD[lay-1]-1)%kDetPerLadderSPD[lay-1] + 1;
-    if (SPDIsTGeoNative()) {
-      cpn2--;
-      cpn1--;
-    }
-  } else { // SDD and SSD
-    cpn2 = 1;
-    cpn1 = det;
-    cpn0 = lad;
-    if (lay<5) { // SDD
-      if (SDDIsTGeoNative()) {
-       cpn1--;
-       cpn0--;
-      }
-    } else { //SSD
-      if (SSDIsTGeoNative()) {
-       cpn1--;
-       cpn0--;
-      }
-    }
-  }
+    DecodeDetectorLayersv11Hybrid(mod,lay,lad,det);
+    if (lay<3) { // SPD
+        cpn2 = det;     // Detector 1-4
+        cpn0 = (lad+kDetPerLadderSPD[lay-1]-1)/kDetPerLadderSPD[lay-1];
+        cpn1 = (lad+kDetPerLadderSPD[lay-1]-1)%kDetPerLadderSPD[lay-1] + 1;
+        //if (SPDIsTGeoNative()) {
+        //    cpn2--;
+        //    cpn1--;
+        //}
+    } else { // SDD and SSD
+        cpn2 = 1;
+        cpn1 = det;
+        cpn0 = lad;
+        if (lay<5) { // SDD
+            if (SDDIsTGeoNative()) {
+                cpn1--;
+                cpn0--;
+            } // end if SDDIsTGeoNative()
+        } else { //SSD
+            if (SSDIsTGeoNative()) {
+                cpn1--;
+                cpn0--;
+            }// end if SSDIsTGeoNative()
+        } // end if Lay<5/else
+    } // end if lay<3/else
+    /*printf("AliITSInitGeometry::RecodeDetectorv11Hybrid:"
+           "mod=%d lay=%d lad=%d det=%d cpn0=%d cpn1=%d cpn2=%d\n",
+           mod,lay,lad,det,cpn0,cpn1,cpn2);*/
 }
-
-
-
-
 // //______________________________________________________________________
 // void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,
 //                                               Int_t &lad,Int_t &det) {
@@ -2400,10 +2398,10 @@ void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,
   lad = mod2/kDetPerLadder[lay-1];
 
   if(lad>=kLadPerLayer[lay-1]||lad<0) Error("DecodeDetectorLayers",
-                                           "lad=%d not in the correct range",lad);
+                                     "lad=%d not in the correct range",lad);
   det = (mod2 - lad*kDetPerLadder[lay-1])+1;
   if(det>kDetPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers",
-                                           "det=%d not in the correct range",det);
+                                     "det=%d not in the correct range",det);
   lad++;
 }
 
@@ -2428,9 +2426,25 @@ Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,
     //                        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+
@@ -2438,7 +2452,7 @@ Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,
         +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,cvsDate,
+                        "cvsRevision=%s[%d] n=%d\n",length,i,min,cvslikedate,
                         cvsDateLength,cvsRevision,cvsRevisionLength,n);
     if(i<0) n++;
     if(min<0) n++;
@@ -2453,14 +2467,16 @@ Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,
         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] = cvsDate[6+i]; else cvsdate[i] = 0;
+        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;
     sprintf(str,"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;
     return kTRUE;
@@ -2502,8 +2518,8 @@ Bool_t AliITSInitGeometry::ReadVersionString(const Char_t *str,Int_t length,
     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",
+    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",