]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSvSPD02.cxx
Functions reInlined properly. Inlining needed for speed.
[u/mrichter/AliRoot.git] / ITS / AliITSvSPD02.cxx
index 5152df120dea83b4f004b78687095bc02076cdcd..00c77b38ee69077acbfa1892bd3379fb8eb8a7cb 100644 (file)
 #include "AliITSgeomSPD.h"
 #include "AliITSgeomSSD.h"
 #include "AliITSDetType.h"
-#include "AliITSresponseSPDdubna.h"
+#include "AliITSresponseSPD.h"
 #include "AliITSresponseSDD.h"
 #include "AliITSresponseSSD.h"
 #include "AliITSsegmentationSPD.h"
 #include "AliITSsegmentationSDD.h"
 #include "AliITSsegmentationSSD.h"
-#include "AliITSsimulationSPDdubna.h"
+#include "AliITSsimulationSPD.h"
 #include "AliITSsimulationSDD.h"
 #include "AliITSsimulationSSD.h"
 #include "AliMC.h"
@@ -76,16 +76,18 @@ AliITSvSPD02::AliITSvSPD02() {
     fGeomDetIn    = kFALSE; // Don't Read .det file
     fMajorVersion = IsVersion();
     fMinorVersion = -1;
+    fGeomNumber   = 2002; // default value
     for(i=0;i<60;i++) fRead[i] = '\0';
     for(i=0;i<60;i++) fWrite[i] = '\0';
     for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
 }
 //______________________________________________________________________
-AliITSvSPD02::AliITSvSPD02(const char *title) : AliITS("ITS", title){
+AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title){
     ////////////////////////////////////////////////////////////////////////
     //    Standard constructor for the ITS SPD testbeam 2002 version 1.
     // Inputs:
     //    const char *title    title for this ITS geometry.
+    //    Int_t      gn        Geometry version number (year) default 2002.
     // Outputs:
     //    none.
     // Return:
@@ -93,6 +95,7 @@ AliITSvSPD02::AliITSvSPD02(const char *title) : AliITS("ITS", title){
     ////////////////////////////////////////////////////////////////////////
     Int_t i;
 
+    fGeomNumber = gn;
     fIdN = 2;
     fIdName = new TString[fIdN];
     fIdName[0] = "IMBS";
@@ -180,6 +183,38 @@ void AliITSvSPD02::BuildGeometry(){
     //    none.
     ////////////////////////////////////////////////////////////////////////
     // Get the top alice volume.
+
+    switch (fGeomNumber){
+    case 2002:
+        BuildGeometry2002();
+        break;
+    default:
+        BuildGeometry2002();
+        break;
+    } // end switch
+}
+//______________________________________________________________________
+void AliITSvSPD02::BuildGeometry2002(){
+    ////////////////////////////////////////////////////////////////////////
+    //    Geometry builder for the ITS SPD test beam 2002 version 1.
+    //    ALIC    ALICE Mother Volume
+    //     |- ITSV     ITS Mother Volume
+    //         |- IDET       Detector under Test
+    //         |   |- ITS0       SPD Si Chip
+    //         |   |  |- ITST      SPD Sensitivve Volume
+    //         |   |- IPC0 *5    Readout chip
+    //         |- ITEL *4    SPD Telescope
+    //             |- IMB0       SPD Si Chip
+    //             |   |- IMBS     SPD Sensitive volume
+    //             |- ICMB       Chip MiniBus.
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    ////////////////////////////////////////////////////////////////////////
+    // Get the top alice volume.
     TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
     aALIC->cd();
 
@@ -193,8 +228,9 @@ void AliITSvSPD02::BuildGeometry(){
     data[0] = 10.0;
     data[1] = 50.0;
     data[2] = 100.0;
-    TBRIK *iITSVshape = new TBRIK("ITSVshape","ITS Logical Mother Volume","Air",
-                                data[0],data[1],data[2]);
+    TBRIK *iITSVshape = new TBRIK("ITSVshape",
+                                  "ITS Logical Mother Volume","Air",
+                                  data[0],data[1],data[2]);
     TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
                            0.0,0.0,0.0,0,0);
     iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
@@ -314,6 +350,37 @@ void AliITSvSPD02::CreateGeometry(){
     // Return:
     //    none.
     ////////////////////////////////////////////////////////////////////////
+
+    switch (fGeomNumber){
+    case 2002:
+        CreateGeometry2002();
+        break;
+    default:
+        CreateGeometry2002();
+        break;
+    } // end switch
+}
+//______________________________________________________________________
+void AliITSvSPD02::CreateGeometry2002(){
+    ////////////////////////////////////////////////////////////////////////
+    //  This routine defines and Creates the geometry for version 1 of the ITS.
+    //    ALIC    ALICE Mother Volume
+    //     |- ITSV     ITS Mother Volume
+    //         |- IDET       Detector under Test
+    //         |   |- ITS0       SPD Si Chip
+    //         |   |  |- ITST      SPD Sensitivve Volume
+    //         |   |- IPC0 *5    Readout chip
+    //         |- ITEL *4    SPD Telescope
+    //             |- IMB0       SPD Si Chip
+    //             |   |- IMBS     SPD Sensitive volume
+    //             |- ICMB       Chip MiniBus.
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    ////////////////////////////////////////////////////////////////////////
     Float_t data[49];
     // Define media off-set
     Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
@@ -322,6 +389,7 @@ void AliITSvSPD02::CreateGeometry(){
     Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
     Float_t yposition= 0.0;
 
+    if(gMC==0) return;
     // Define Rotation-reflextion Matrixes needed
     // 0 is the unit matrix
     AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
@@ -426,6 +494,37 @@ void AliITSvSPD02::CreateMaterials(){
     // Return:
     //    none.
     /////////////////////////////////////////////////////////////////////////
+
+    switch (fGeomNumber){
+    case 2002:
+        CreateMaterials2002();
+        break;
+    default:
+        CreateMaterials2002();
+        break;
+    } // end switch
+}
+//______________________________________________________________________
+void AliITSvSPD02::CreateMaterials2002(){
+    ////////////////////////////////////////////////////////////////////////
+    //
+    // Create ITS SPD test beam materials
+    //     This function defines the default materials used in the Geant
+    // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
+    // AliITSvSPD02.
+    // In general it is automatically replaced by
+    // the CreatMaterials routine defined in AliITSv?. Should the function
+    // CreateMaterials not exist for the geometry version you are using this
+    // one is used. See the definition found in AliITSv5 or the other routine
+    // for a complete definition.
+    //
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    /////////////////////////////////////////////////////////////////////////
     Float_t tmaxfdSi = 0.1; // Degree
     Float_t stemaxSi = 0.0075; // cm
     Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
@@ -461,12 +560,6 @@ void AliITSvSPD02::InitAliITSgeom(){
     //    none.
     // Return:
     //    none.
-    if(strcmp(gMC->GetName(),"TGeant3")) {
-       Error("InitAliITSgeom",
-               "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
-       return;
-    } // end if
-    cout << "Reading Geometry transformation directly from Geant 3." << endl;
     const Int_t kltypess = 2;
     const Int_t knlayers = 5;
     const Int_t kndeep = 5;
@@ -475,11 +568,43 @@ void AliITSvSPD02::InitAliITSgeom(){
     Double_t t[3],r[10];
     Float_t  par[20],att[20];
     Int_t    npar,natt,idshape,imat,imed;
-    AliITSGeant3Geometry *ig = new AliITSGeant3Geometry();
-    Int_t mod,typ,lay,lad,det,cpy,i,j,k;
+    AliITSGeant3Geometry *ig=0;
+    Int_t mod=0,typ=0,lay=0,lad=0,det=0,cpy=0,i=0,j=0,k=0;
+
+    if(gMC==0) {// No Monti Carlo to init. Default set fITSgeom by hand
+        if(fITSgeom!=0) delete fITSgeom;
+        nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
+        ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
+        fITSgeom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
+        r[0] = 1.0; r[1] =  0.0; r[2] = 0.0;
+        r[3] = 0.0; r[4] =  0.0; r[5] = 1.0;
+        r[6] = 0.0; r[7] = -1.0; r[8] = 0.0; r[9] = 1.0; // not Unit.
+        Double_t tt[5][3]={{0.0,0.0,-37.9625}, // 0,0,P00Z+.5*chipMiniBusY
+                           {0.0,0.0,-35.9625}, // 0,0,P00Z+2+.5*chipMiniBusY
+                           {0.0,0.0,  2.0150}, // 0,0,P01Z+38+SPDchipY
+                           {0.0,0.0, 36.5375}, //0,0,PdetZ+34.5+.5*chipMiniBusY
+                           {0.0,0.0, 38.5375}};// 0,0,P00Z+2+.5*chipMiniBusY
+        for(mod=0;mod<5;mod++){
+            lay = 1;
+            lad = 1;
+            det = mod+1;
+            t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2];
+            fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
+            npar=3;par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
+            fITSgeom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
+        } // end for det
+        return;
+    } // end if gMC==0
+    if(strcmp(gMC->GetName(),"TGeant3")) {
+       Error("InitAliITSgeom",
+               "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
+       return;
+    } // end if
+    cout << "Reading Geometry transformation directly from Geant 3." << endl;
+    ig = new AliITSGeant3Geometry();
     Char_t names[kltypess][kndeep][4];
     Int_t itsGeomTreeCopys[kltypess][kndeep];
-    Char_t *namesA[kltypess][kndeep] = {
+    const char *namesA[kltypess][kndeep] = {
      {"ALIC","ITSV","ITEL","IMB0","IMBS"}, // lay=1
      {"ALIC","ITSV","IDET","ITS0","ITST"}};// Test SPD
     Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,4,1,1},// lay=1
@@ -551,7 +676,8 @@ void AliITSvSPD02::Init(){
 //
     for(i=0;i<72;i++) cout << "*";
     cout << endl;
-    fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
+    if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
+    else fIDMother = 0;
 }
 //______________________________________________________________________
 void AliITSvSPD02::SetDefaults(){
@@ -575,7 +701,7 @@ void AliITSvSPD02::SetDefaults(){
     iDetType=DetType(kSPD);
     // Get shape info. Do it this way for now.
     s0 = (AliITSgeomSPD*) fITSgeom->GetShape(kSPD);
-    AliITSresponse *resp0=new AliITSresponseSPDdubna();
+    AliITSresponse *resp0=new AliITSresponseSPD();
     resp0->SetTemperature();
     resp0->SetDistanceOverVoltage();
     SetResponseModel(kSPD,resp0);
@@ -628,31 +754,31 @@ void AliITSvSPD02::SetDefaultSimulation(){
 
     AliITSDetType *iDetType;
     AliITSsimulation *sim;
-    iDetType=DetType(0);
+    iDetType=DetType(kSPD);
     sim = iDetType->GetSimulationModel();
     if (!sim) {
         AliITSsegmentation *seg0=
             (AliITSsegmentation*)iDetType->GetSegmentationModel();
         AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
-        AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0);
-        SetSimulationModel(0,sim0);
+        AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
+        SetSimulationModel(kSPD,sim0);
     }else{ // simulation exists, make sure it is set up properly.
-        ((AliITSsimulationSPDdubna*)sim)->Init(
+        ((AliITSsimulationSPD*)sim)->Init(
             (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
-            (AliITSresponseSPDdubna*) iDetType->GetResponseModel());
+            (AliITSresponseSPD*) iDetType->GetResponseModel());
 //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
 //            (AliITSresponse*)iDetType->GetResponseModel());
 //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
 //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
     } // end if
-    iDetType=DetType(1);
+    iDetType=DetType(kSDD);
     sim = iDetType->GetSimulationModel();
     if (!sim) {
         AliITSsegmentation *seg1=
             (AliITSsegmentation*)iDetType->GetSegmentationModel();
         AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
         AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
-        SetSimulationModel(1,sim1);
+        SetSimulationModel(kSDD,sim1);
     }else{ // simulation exists, make sure it is set up properly.
         ((AliITSsimulationSDD*)sim)->Init(
             (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
@@ -662,14 +788,14 @@ void AliITSvSPD02::SetDefaultSimulation(){
 //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
 //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
     } //end if
-    iDetType=DetType(2);
+    iDetType=DetType(kSSD);
     sim = iDetType->GetSimulationModel();
     if (!sim) {
         AliITSsegmentation *seg2=
             (AliITSsegmentation*)iDetType->GetSegmentationModel();
         AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
         AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
-        SetSimulationModel(2,sim2);
+        SetSimulationModel(kSDD,sim2);
     }else{ // simulation exists, make sure it is set up properly.
         ((AliITSsimulationSSD*)sim)->Init(
             (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),