]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSvtest.cxx
Removing inheritances from TAttLine, TAttMarker and AliRndm in AliModule. The copy...
[u/mrichter/AliRoot.git] / ITS / AliITSvtest.cxx
index 96dda15aad2e4f1381d7f8d033f32fa837832e3a..b14098dd5446321f7051d5a1bd6526800c976e47 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4  2001/01/18 06:25:09  barbera
-ITS geometry using test Euclid files
-
-Revision 1.1.2.8  2000/10/05 20:28:18  nilsen
-Now using root generated streamer function.
-
-Revision 1.1.2.7  2000/07/31 13:51:22  barbera
-Updated from the release
-
-Revision 1.2  2000/07/10 16:07:19  fca
-Release version of ITS code
-
-Revision 1.1.2.2  2000/03/02 21:53:36  nilsen
-to make it compatable with the changes in AliRun/AliModule.
-
-Revision 1.1.2.1  2000/01/12 20:19:03  nilsen
-       The changes made with this latest inclusion of code is very large.
-Many of the new files were added just in December when P. Cerello added his
-SDD simulations to the distrobutions. Also added are some file of P. Skowronski
-for SSD cluster finding and ghost RecPoints. None of this "new" code has been
-proporly tested. Other code new to this cvs repository is explained in the
-ITS Off-line web page. In general the changes are too large to give a resonable
-discription of them but probably should be taken as the starting point for
-the developement branch (ITS-working).
-    B. S. Nilsen
-
-Revision 1.13  1999/10/16 19:49:00  BSN
-$Name$
-$Author$
-$Id$
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -57,64 +25,48 @@ $Id$
 // Created October 16 1999.                                                  //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <TMath.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBE.h>
-#include <TFile.h>    // only required for Tracking function?
-#include <TCanvas.h>
-#include <TObjArray.h>
-#include <TObjString.h>
-#include <TClonesArray.h>
 #include <TLorentzVector.h>
-#include <TBRIK.h>
+#include <TMath.h>
 #include <TSystem.h>
+#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
 
-#include "AliMC.h"
 #include "AliRun.h"
+#include "AliITSgeom.h"
+#include "AliITSgeomSDD.h"
+#include "AliITSgeomSPD.h"
+#include "AliITSgeomSSD.h"
 #include "AliITShit.h"
-#include "AliITS.h"
 #include "AliITSvtest.h"
-#include "AliITSgeom.h"
+#include "AliRun.h"
+#include "AliMC.h"
 
 ClassImp(AliITSvtest)
  
 //_____________________________________________________________________________
 AliITSvtest::AliITSvtest() {
-    //
     // Standard constructor for the ITS
-    //
+    Int_t i;
+
     fIdN    = 0;
     fIdName = 0;
     fIdSens = 0;
-    fMajorVersion = -1;
+    SetEUCLID(kFALSE);
+    fGeomDetOut   = kFALSE; // Don't write .det file
+    fGeomDetIn    = kTRUE; // Read .det file
+    fMajorVersion = IsVersion();
     fMinorVersion = -1;
-}
-//____________________________________________________________________________
-AliITSvtest::AliITSvtest(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-//     Copy Constructor for ITS test version.
-////////////////////////////////////////////////////////////////////////
-    if(&source == this) return;
-    printf("Not allowed to copy AliITSvtest\n");
-    return;
-}
-//_____________________________________________________________________________
-AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-//    Assignment operator for the ITS version 1.
-////////////////////////////////////////////////////////////////////////
-       if(&source == this) return *this;
-       printf("Not allowed to copy AliITSvtest\n");
-       return *this;
+    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';
 }
 //_____________________________________________________________________________
 AliITSvtest::~AliITSvtest() {
-    //
     // Standard destructor for the ITS
-    //
 }
 //_____________________________________________________________________________
 AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
@@ -124,17 +76,6 @@ AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
     // Standard constructor for the ITS
     //
     fIdN    = 6;
-/*
-//  TObjArray of TObjStrings
-    fIdName = new TObjArray(fIdN);
-    fIdName->AddAt(new TObjString("ITS1"),0);
-    fIdName->AddAt(new TObjString("ITS2"),1);
-    fIdName->AddAt(new TObjString("ITS3"),2);
-    fIdName->AddAt(new TObjString("ITS4"),3);
-    fIdName->AddAt(new TObjString("ITS5"),4);
-    fIdName->AddAt(new TObjString("ITS6"),5);
-*/
-//  Array of TStrings.
     fIdName    = new TString[fIdN];
     fIdName[0] = "ITS1";
     fIdName[1] = "ITS2";
@@ -144,11 +85,17 @@ AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
     fIdName[5] = "ITS6";
     fIdSens    = new Int_t[fIdN];
     for (Int_t i=0;i<fIdN;i++) fIdSens[i] = 0;
-    fMajorVersion = -1;
+    fMajorVersion = IsVersion();
     fMinorVersion = 1;
+    SetEUCLID(kFALSE);
+    fGeomDetOut   = kFALSE; // Don't write .det file
+    fGeomDetIn    = kTRUE; // Read .det file
 
     fEuclidMaterial = filetme;
     fEuclidGeometry = fileeuc;
+    strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_PPR.det",60);
+    strncpy(fRead,fEuclidGeomDet,60);
+    strncpy(fWrite,fEuclidGeomDet,60);
 //  The .det file for the geometry must have the same name as fileeuc with
 //  .euc replaced by .det.
 }
@@ -182,8 +129,6 @@ void AliITSvtest::CreateGeometry(){
 ////////////////////////////////////////////////////////////////////////
 // Read geometry for the ITS
 //
-
-    Int_t size;
     char topvol[5];
     char *filtmp;
 //
@@ -211,37 +156,154 @@ void AliITSvtest::CreateGeometry(){
     if (fEuclidOut) {
       gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
     } // end if (fEuclidOut)
-
-    filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
-    size = strlen(filtmp);
-    if(size>4){
-       filtmp[size-3] = 'd'; // change from .euc to .det
-        filtmp[size-2] = 'e';
-        filtmp[size-1] = 't';
-       file = fopen(filtmp,"r");
-       if(file){ // if file exists use it to fill AliITSgeom structure.
-           fclose(file);
-           printf("ready to read .det file %s\n",filtmp);
-           fITSgeom = new AliITSgeom(filtmp);
-       }else{
-           fITSgeom = 0;
-           // fill AliITSgeom structure from geant structure just filled above
-       }// end if(file)
-        delete [] filtmp;
-    }// end if(size>4)
-    printf("finished with euclid geometrys\n");
+    cout <<"finished with euclid geometrys"<< endl;
 }
+//______________________________________________________________________
+void AliITSvtest::InitAliITSgeom(){
+    //     Based on the geometry tree defined in Geant 3.21, this
+    // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
+    // sturture.
+    // Inputs:
+    //   none.
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+    const Int_t knlayers = 6;
+    const Int_t kndeep = 3;
+    const AliITSDetector idet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSDp};
+    const TString names[2][knlayers] = {
+     {"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I10A_%d/I103_%d/I101_1/ITS1_1", // lay=1
+      "/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I20A_%d/I1D3_%d/I1D1_1/ITS2_1", // lay=2
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"},// lay=6
+     {"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_%d/I10B_%d/I107_%d/I101_1/ITS1_1", // lay=1
+      "/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_%d/I20B_%d/I1D7_%d/I1D1_1/ITS2_1", // lay=2
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"}
+    };
+    const Int_t itsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
+                                                     {10, 4, 4},// lay=2
+                                                     {14, 6, 1},// lay=3
+                                                     {22, 8, 1},// lay=4
+                                                     {34,22, 1},// lay=5
+                                                     {38,25, 1}};//lay=6
+    Int_t       nlad[knlayers],ndet[knlayers];
+    Int_t       mod,lay,lad=0,det=0,i,j,k,cp0,cp1,cp2;
+    TString path,shapeName;
+    TGeoHMatrix matrix;
+    Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0};
+    TArrayD shapePar;
+    TArrayF shapeParF;
+    Bool_t shapeDefined[4]={kFALSE,kFALSE,kFALSE,kFALSE};
 
+    AliDebug(1,"Reading Geometry transformation directly from Modler.");
+    mod = 0;
+    for(i=0;i<knlayers;i++){
+        k = 1;
+        for(j=0;j<kndeep;j++) if(itsGeomTreeCopys[i][j]!=0)
+            k *= TMath::Abs(itsGeomTreeCopys[i][j]);
+        mod += k;
+    } // end for i
+
+    SetITSgeom(0);
+    nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
+    ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25;
+    AliITSgeom* geom = new AliITSgeom(0,6,nlad,ndet,mod);
+    SetITSgeom(geom);
+    mod = 0;
+    for(lay=1;lay<=knlayers;lay++){
+        for(cp0=1;cp0<=itsGeomTreeCopys[lay-1][0];cp0++){
+            for(cp1=1;cp1<=itsGeomTreeCopys[lay-1][1];cp1++){
+                for(cp2=1;cp2<=itsGeomTreeCopys[lay-1][2];cp2++){
+                    path.Form(names[fMinorVersion-1][lay-1].Data(),
+                              cp0,cp1,cp2);
+                    switch (lay){
+                    case 1:{
+                        det = cp2;
+                        lad = cp1+2*(cp0-1);
+                    }break;
+                    case 2:{
+                        det = cp2;
+                        lad = cp1+4*(cp0-1);
+                    } break;
+                    case 3: case 4: case 5: case 6:{
+                        det = cp1;
+                        lad = cp0;
+                    } break;
+                    } // end switch
+                         //AliInfo(Form("path=%s lay=%d lad=%d det=%d",
+                         //             path.Data(),lay,lad,det));
+                    gMC->GetTransformation(path.Data(),matrix);
+                    gMC->GetShape(path.Data(),shapeName,shapePar);
+                    shapeParF.Set(shapePar.GetSize());
+                    for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i];
+                    geom->CreateMatrix(mod,lay,lad,det,idet[lay-1],trans,rot);
+                    geom->SetTrans(mod,matrix.GetTranslation());
+                    geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
+                   geom->GetGeomMatrix(mod)->SetPath(path.Data());
+                    switch (lay){
+                    case 1: case 2:
+                       if(!shapeDefined[kSPD]){
+                        geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+                       shapeDefined[kSPD] = kTRUE;
+                    }break;
+                    case 3: case 4:
+                       if(!shapeDefined[kSDD]){
+                        geom->ReSetShape(kSDD,new AliITSgeomSDD256(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+                       shapeDefined[kSDD] = kTRUE;
+                    }break;
+                    case 5:
+                       if(!shapeDefined[kSSD]){
+                        geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+                       shapeDefined[kSSD] = kTRUE;
+                    }break;
+                    case 6:
+                       if(!shapeDefined[kSSDp]){
+                        geom->ReSetShape(kSSDp,new AliITSgeomSSD275and75(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+                       shapeDefined[kSSDp] = kTRUE;
+                    }break;
+                    default:{
+                    }break;
+                    } // end switch
+                    mod++;
+                } /// end for cp2
+            } // end for cp1
+        } // end for cp0
+    } // end for lay
+    return;
+}
 //_____________________________________________________________________________
 void AliITSvtest::Init(){
-    //
-    // Initialise the ITS after it has been created
-    //
+////////////////////////////////////////////////////////////////////////
+//     Initialise the ITS after it has been created.
+////////////////////////////////////////////////////////////////////////
+    Int_t i;
+
+    cout << endl;
+    for(i=0;i<29;i++) cout << "*";cout << " ITSvtest_Init ";
+    for(i=0;i<28;i++) cout << "*";cout << endl;
+//
+    if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
+    if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
+    if(GetITSgeom()!=0) SetITSgeom(0x0);
+    SetITSgeom(new AliITSgeom());
+    if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
+    if(!fGeomDetIn) this->InitAliITSgeom();
+    if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
     AliITS::Init();
-    fMajorVersion = -1;
-    fMinorVersion = 0;
-} 
+//
+    for(i=0;i<72;i++) cout << "*";
+    cout << endl;
+}
 //_____________________________________________________________________________
 void AliITSvtest::StepManager(){
   //
@@ -335,7 +397,7 @@ void AliITSvtest::StepManager(){
   hits[6]=gMC->Edep();
   hits[7]=gMC->TrackTime();
   // Fill hit structure with this new hit.
-  new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+  new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
   return;
 }