]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CRT/AliCRT.cxx
Temporary reverting the changes introduced earlier to store the TGeo geometry. New...
[u/mrichter/AliRoot.git] / CRT / AliCRT.cxx
index 3d9f96ef105416271144b6f4d8837b855097120a..502f411b031152b464de5e579150b86d70716eab 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1  2002/06/16 17:08:19  hristov
-First version of CRT
-
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -43,149 +37,70 @@ First version of CRT
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-
-#include <iostream.h>
-#include <fstream.h>
+#include "AliCRT.h"
 
 #include <TTree.h>
+#include <TVirtualMC.h>
 
-
-#include "AliMC.h"
 #include "AliRun.h"
 #include "AliMagF.h"
+//#include "AliMC.h"
 
-#include "AliCRT.h"
-#include "AliCRTConstants.h"
-#include "AliCRTdigit.h"
-#include "AliCRThit.h"
+//#include "AliCRThit.h"
+#include "AliCRTModule.h"
 
 ClassImp(AliCRT)
 
-
-static  AliCRTdigit *digits;
 //_____________________________________________________________________________
 AliCRT::AliCRT()
+  : AliDetector(),
+    fModule(0)
 {
   //
-  // Default constructor for L3 magnet
+  // Default constructor
   //
-
-  fIshunt   = 1;
-  fHits     = 0;
-  fDigits   = 0;
 }
  
 //_____________________________________________________________________________
 AliCRT::AliCRT(const char *name, const char *title)
-  : AliDetector(name,title)
-{
-  //
-  // Standard constructor for the CRT module
-  //
-
-  fIshunt       =  1; // All hits are associated with primary particles  
-
-  fHits         =  new TClonesArray("AliCRThit",400) ; 
-  fDigits       =  new TClonesArray("AliCRTdigit",400) ; 
-
-  gAlice->AddHitList(fHits);
-
-  SetMarkerColor(7);
-  SetMarkerStyle(2);
-  SetMarkerSize(0.4);
-
-}
-
-//_____________________________________________________________________________
-AliCRT::~AliCRT()
-{
-  //
-  // Standar destructor.
-  //
-  if (fHits) {
-    fHits->Delete();
-    delete fHits;
-  }
-}
-
-//_____________________________________________________________________________
-void AliCRT::AddHit(Int_t track, Int_t *vol, Float_t *hits)
-{
-  //
-  // Add a CRT hit
-  //
-  TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliCRThit(fIshunt,track,vol,hits);
-}
-
-//_____________________________________________________________________________
-void AliCRT::AddDigit(Int_t *tracks,Int_t *digits)
-{
-  
-  //  Add a CRT digit to the list. Dummy function.
-  
-}
-
-//_____________________________________________________________________________
-void AliCRT::Init() const
+  : AliDetector(name, title),
+    fModule(0)
 {
   //
-  // Initialise ...
+  // Standard constructor
   //
-
-  Int_t i;
-  //
-  if(fDebug) {
-    printf("\n%s: ",ClassName());
-    for(i=0;i<35;i++) printf("*");
-    printf(" CRT_INIT ");
-    for(i=0;i<35;i++) printf("*");
-    printf("\n%s: ",ClassName());
-    //
-    // Here the CRT initialisation code (if any!)
-    for(i=0;i<80;i++) printf("*");
-    printf("\n");
-  }
+  //fHits =  new TClonesArray("AliCRThit", 400);
+  //gAlice->GetMCApp()->AddHitList(fHits);
 }
 
 //_____________________________________________________________________________
-void AliCRT::ResetHits ()
-{
-  // Reset number of clusters and the cluster array for this detector
-  AliDetector::ResetHits ();
-}
-
-//_____________________________________________________________________________
-void AliCRT::ResetDigits ()
+AliCRT::AliCRT(const AliCRT& crt)
+  : AliDetector(crt),
+    fModule(crt.fModule)
 {
   //
-  // Reset number of digits and the digits array for this detector
-  AliDetector::ResetDigits ();
+  // Copy constructor
   //
-} 
-
-//____________________________________________________________________________
-void AliCRT::FinishEvent()
-{
-// do nothing
+  crt.Copy(*this);
 }
 
 //_____________________________________________________________________________
-void AliCRT::BuildGeometry()
+AliCRT::~AliCRT()
 {
   //
-  // Build simple ROOT TNode geometry for event display
+  // Default destructor
   //
+  if ( fModule ) { delete fModule; fModule = 0; }
 }
 
 //_____________________________________________________________________________
-void AliCRT::CreateGeometry()
+AliCRT& AliCRT::operator=(const AliCRT& crt)
 {
   //
-  // Build simple ROOT TNode geometry for GEANT simulations
+  // Asingment operator.
   //
+  crt.Copy(*this);
+  return *this;
 }
 
 //_____________________________________________________________________________
@@ -201,10 +116,6 @@ void AliCRT::CreateMaterials()
   Float_t xepsil = 0.1; // Tracking precission in cm. obove the pit
 
   // --- Define the various materials for GEANT --- 
-  Float_t aconc[10] = { 1.,12.01,15.994,22.99,24.305,26.98,28.086,39.1,40.08,55.85 };
-  Float_t zconc[10] = { 1.,6.,8.,11.,12.,13.,14.,19.,20.,26. };
-  Float_t wconc[10] = { .01,.001,.529107,.016,.002,.033872,.337021,.013,.044,.014 };
-  
   Float_t epsil, stmin, tmaxfd, deemax, stemax;
   //
   //     Aluminum 
@@ -221,16 +132,8 @@ void AliCRT::CreateMaterials()
   AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500.);
   AliMaterial(35, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500.);
   AliMaterial(55, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500.);
-  //
-  //     Vacuum 
-  AliMaterial(16, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  AliMaterial(36, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  AliMaterial(56, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  //
-  //     Concrete
-  AliMixture(17, "CONCRETE$", aconc, zconc, 2.35, 10, wconc);
-  AliMixture(37, "CONCRETE$", aconc, zconc, 2.35, 10, wconc);
-  AliMixture(57, "CONCRETE$", aconc, zconc, 2.35, 10, wconc);
+  AliMaterial(75, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500.);
+  AliMaterial(95, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500.);
 
 
   // Scintillator material polystyrene 
@@ -238,18 +141,14 @@ void AliCRT::CreateMaterials()
   Float_t zP[2] = {6.0, 1.0};
   Float_t wP[2] = {1.0, 1.0};
   Float_t dP = 1.032;
-  AliMixture(3, "Polystyrene$", aP, zP, dP, -2, wP);
-  // Standard ROCK, ROCK1 and molasse. 
-  Float_t aRock[1] = {22.};
-  Float_t zRock[1] = {11.};
-  Float_t wRock[1] = {1.};
-  Float_t dRock = 2.65;
-  AliMixture(4, "Standard Rock$", aRock, zRock, dRock, 1, wRock);
-  Float_t dRock1 = 2.2;
-  AliMixture(5, "Rock1$", aRock, zRock, dRock1, 1, wRock);
-  Float_t dMolasse = 2.50;
-  AliMixture(6, "Molasse$", aRock, zRock, dMolasse, 1, wRock);
-  
+  AliMixture(13, "Polystyrene$", aP, zP, dP, -2, wP);
+  // Subalpine Molasse over the ALICE hall. 
+  Float_t aMolasse[10] = { 1., 12.01, 15.994, 22.99, 24.305, 26.98, 28.086, 39.1, 40.08, 55.85 };
+  Float_t zMolasse[10] = {1., 6., 8., 11., 12., 13., 14., 19., 20., 26.};
+  Float_t wMolasse[10] = {0.008, 0.043, 0.485, 0.007, 0.042, 0.037, 0.215, 0.023, 0.1, 0.04};
+  Float_t dMolasse = 2.40;
+  AliMixture(24, "Molasse$", aMolasse, zMolasse, dMolasse, 10, wMolasse);
+
   // **************** 
   //     Defines tracking media parameters. 
   //     Les valeurs sont commentees pour laisser le defaut 
@@ -261,6 +160,11 @@ void AliCRT::CreateMaterials()
   stmin  = -.8;
   // *************** 
 
+  Float_t atmaxfd = 10.;
+  Float_t adeemax = -0.1;
+  Float_t aepsil = 0.1;
+  Float_t astmin = -10.;
+
   //
   //    Aluminum 
   AliMedium(9,  "ALU_C0          ",  9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
@@ -273,58 +177,64 @@ void AliCRT::CreateMaterials()
   AliMedium(50, "FE_C2           ", 50, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   //
   //    Air 
-  AliMedium(15, "AIR_C0          ", 15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(35, "AIR_C1          ", 35, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(55, "AIR_C2          ", 55, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  //
-  //    Vacuum 
-  AliMedium(16, "VA_C0           ", 16, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(36, "VA_C1           ", 36, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(56, "VA_C2           ", 56, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  //
-  //    Concrete 
-  AliMedium(17, "CC_C0           ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(37, "CC_C1           ", 37, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(57, "CC_C2           ", 57, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(15, "AIR_C0          ", 15, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
+  AliMedium(35, "AIR_C1          ", 35, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
+  AliMedium(55, "AIR_C2          ", 55, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
+  AliMedium(75, "AIR_C4          ", 75, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
+  AliMedium(95, "AIR_C5          ", 95, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
+
 
 
   // The scintillator of the CPV made of Polystyrene 
-  // scintillator -> idtmed[1102]
-  AliMedium(3, "CPV scint.          ", 3, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  
-  //     Standard ROCK  -> idtmed[1103]
-  AliMedium(4, "Standard Rock ",  4, 0, xfield, xfieldm, tmaxfd, stemax, deemax, xepsil, stmin);
-  
-  //     ROCK1   -> idtmed[1104]
-  AliMedium(5, "Rock 1                 ", 5, 0, xfield, xfieldm, tmaxfd, stemax, deemax, xepsil, stmin);
+  // scintillator -> idtmed[1112]
+  AliMedium(12 , "CPV scint.      ", 13, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(13 , "CPV scint.      ", 13, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(14 , "CPV scint.      ", 13, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+
+  //     Molasse -> idtmed[1123]
+  AliMedium(24 , "Molasse         ", 24, 0, xfield, xfieldm, tmaxfd, stemax, deemax, xepsil, stmin);
 
+  // Concrete, in case if we need to put hte shafts by ourselves.
 
-  //     Molasse -> idtmed[1105]
-  AliMedium(6, "Molasse          ", 6, 0, xfield, xfieldm, tmaxfd, stemax, deemax, xepsil, stmin);
+  Float_t aconc[10] = { 1.,12.01,15.994,22.99,24.305,26.98,28.086,39.1,40.08,55.85 };
+  Float_t zconc[10] = { 1.,6.,8.,11.,12.,13.,14.,19.,20.,26. };
+  Float_t wconc[10] = { .01,.001,.529107,.016,.002,.033872,.337021,.013,.044,.014 };
 
+  AliMixture(17, "CONCRETE$", aconc, zconc, 2.35, 10, wconc);
+  //    Concrete 
+  AliMedium(17, "CC_C0            ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(27, "CC_C1            ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); // MX24
+  AliMedium(37, "CC_C2            ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); // PM25
+  AliMedium(47, "CC_C3            ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); // PGC2
 
 }
 
 //_____________________________________________________________________________
-void AliCRT::MakeBranch(Option_t* option, const char *file)
+void AliCRT::SetTreeAddress()
 {
-  //
-  // Specific CRT branches
-  //
-  // Create Tree branches for the CRT.
-  Int_t buffersize = 400;
-  char branchname[10];
-  sprintf(branchname,"%s",GetName());
-
-  AliDetector::MakeBranch(option,file);
-
-  const char *cD = strstr(option,"D");
-  
-  if (cD) {
-    digits = new AliCRTdigit();
-    MakeBranchInTree(gAlice->TreeD(), branchname, "AliCRTdigit", 
-                    digits, buffersize, 1, file);
-  } 
 
+  TBranch *branch;
+  char branchname[20];
+  sprintf(branchname,"%s",GetName());
+  // Branch address for hit tree
+  TTree *treeH = fLoader->TreeH();
+  if (treeH ) {
+    branch = treeH->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fHits);
+  }
 }
+
 //_____________________________________________________________________________
+void AliCRT::MakeBranch(Option_t* opt)
+{
+  //
+  // Initializes the branches of the CRT inside the trees written
+  // for each event.
+  //
+  const char* oH = strstr(opt, "H");
+  if ( fLoader->TreeH() && oH && (fHits == 0x0) ) {
+    fHits = new TClonesArray("AliCRThit", 1000);
+    fNhits = 0;
+  }
+  AliDetector::MakeBranch(opt);
+}