]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CRT/AliCRTv0.cxx
Initialization of data members
[u/mrichter/AliRoot.git] / CRT / AliCRTv0.cxx
index 5ef0469cd26dbaabfb9f1abfdde345b362223b70..8408b10daa113112899da264cc239aac039a2626 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-// Alice COsmic Ray Trigger                                                  //
+// ALICE Cosmic Ray Trigger                                                  //
 //                                                                           //
-//  This class contains the functions for version 0 of the Cosmic Rays ALICE //
-//  detector.                                                                //
+//  This class contains the functions for version 0 of the ALICE Cosmic Ray  //
+//  Trigger. This version will be used to simulation comic rays in alice     //
+//  with all the detectors.                                                  //
 //
 //   Authors:
 //
@@ -47,516 +45,312 @@ $Log$
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include <iostream>
+#include "AliCRTv0.h"
 
-#include <TMath.h>
 #include <TGeometry.h>
-#include <TTUBE.h>
+#include <TBRIK.h>
 #include <TNode.h>
-#include <TLorentzVector.h>
-
-#include "AliCRTv0.h"
-#include "AliCRTConstants.h"
+#include <TVirtualMC.h>
 
 #include "AliRun.h"
-#include "AliMC.h"
-#include "AliMagF.h"
 #include "AliConst.h"
-#include "AliPDG.h"
+
+#include "AliCRTConstants.h"
+#include "AliCRTModule.h"
 
 ClassImp(AliCRTv0)
  
 //_____________________________________________________________________________
-AliCRTv0::AliCRTv0() : AliCRT()
+AliCRTv0::AliCRTv0()
+  : AliCRT()
 {
   //
-  // Default constructor for CRT
+  // Default constructor
   //
-  fMucur = 0;
 }
  
 //_____________________________________________________________________________
 AliCRTv0::AliCRTv0(const char *name, const char *title)
-  : AliCRT(name,title)
+  : AliCRT(name, title)
 {
   //
-  // Standard constructor for CRT
+  // Standard constructor
   //
   //Begin_Html
   /*
     <img src="picts/AliCRTv0.gif">
   */
   //End_Html
+  SetMarkerColor(kRed);
+  SetMarkerStyle(kRed);
+  SetMarkerSize(0.4);
 }
 
 //_____________________________________________________________________________
-void AliCRTv0::BuildGeometry()
+AliCRTv0::AliCRTv0(const AliCRTv0& crt)
+  : AliCRT(crt)
 {
-
+  //
+  // Copy constructor
+  //
+  crt.Copy(*this);
 }
 
 //_____________________________________________________________________________
-void AliCRTv0::CreateGeometry()
+AliCRTv0::~AliCRTv0()
 {
   //
-  // Create geometry for the CRT array
+  // Default destructor
   //
+}
 
+//_____________________________________________________________________________
+AliCRTv0& AliCRTv0::operator=(const AliCRTv0& crt)
+{
   //
-  //-- Create the hall
-  CreateHall();
+  // Asingment operator.
+  //
+  crt.Copy(*this);
+  return *this;
+}
 
-  Int_t  idrotm[2499];    // The rotation matrix.
+//_____________________________________________________________________________
+void AliCRTv0::BuildGeometry()
+{
+  //
+  // Create the ROOT TNode geometry for the CRT
+  //
 
-  // idtmed[1099->1198] equivalent to fIdtmed[0->100]
-  Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
+  TNode *node, *top;
 
-  // In order to generate the more correctly the modules (more datails)
-  // we will create a box (air box) as a (sub)mother volume.
-  // Inside this box we'll put the scintillator tiles, the PMTs the frame
-  // and, maybe, some other things.
+  const Int_t kColorCRT = kRed;
 
-  Float_t box[3];
-  box[0] = AliCRTConstants::fgCageLenght/2.; // Half Length of the box along the X axis, cm.
-  box[1] = AliCRTConstants::fgCageHeight/2.; // Half Length of the box along the Y axis, cm.
-  box[2] = AliCRTConstants::fgCageWidth/2.;  // Half Length of the box along the Z axis, cm.
+  // Find the top node alice.
+  top = gAlice->GetGeometry()->GetNode("alice");
 
+  AliCRTConstants* crtConstants = AliCRTConstants::Instance();
 
-  // Define the Scintillators. as a big box.
-  Float_t scint[3];
-  scint[0] = AliCRTConstants::fgActiveAreaLenght/2.;       // Half Length in X
-  scint[1] = AliCRTConstants::fgActiveAreaHeight/2.;       // Half Length in Y
-  scint[2] = AliCRTConstants::fgActiveAreaWidth/2.;        // Half Length in Z
-  gMC->Gsvolu("CRT1", "BOX ", idtmed[1102], scint, 3);  // Scintillators
-  // Divide the modules in 2 planes.
-  //gMC->Gsdvn("CRT2", "CRT1", 2, 2);
-  // Now divide each plane in 8 palettes
-  //gMC->Gsdvn("CRT3", "CRT1", 8, 3);
+  new TBRIK("S_CRT_A", "CRT box", "void", 
+           crtConstants->ActiveAreaLenght()/2., 
+           crtConstants->ActiveAreaHeight()/2., 
+           crtConstants->ActiveAreaWidth()/2.);
 
+  
+  new TRotMatrix("Left", "Left", 90., 315., 90., 45., 0., 337.5);
+  new TRotMatrix("Right", "Right", 90., 45., 90., 315., 180., 202.5);
+  new TRotMatrix("Up", "Up", 90., 0., 90., 90., 0., 90.);
+  top->cd();
 
   //
-  // Define the coordinates where the draw will begin.
-  //
+  // Put 4 modules on the top of the magnet
+  Float_t box = crtConstants->CageWidth()/2.;
+  top->cd();
+  node = new TNode("upper1", "upper1", "S_CRT_A", 0., 790.,  3.*box, "Up");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
 
-  //
-  // -- X axis.
-  // we'll start dawing from the center.
-  Float_t initX = 0.;
+  top->cd();
+  node = new TNode("upper2", "upper2", "S_CRT_A", 0., 790.,    box, "Up");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
 
-  //
-  // -- Y axis
-  Float_t gapY   = 30.;        // 30 cms. above the barrel.
-  // For the height we staimate the from the center of the ceiling,
-  // if were a cilinder, must be about 280cm.
-  Float_t barrel = 790.; // Barrel radius.
-  Float_t height  = barrel + gapY - 30.;
-  Float_t initY = height;
+  top->cd();
+  node = new TNode("upper3", "upper3", "S_CRT_A", 0., 790., -1.*box, "Up");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
 
-  //
-  // -- Z axis.
-  // we'll start dawing from the center.
+  top->cd();
+  node = new TNode("upper4", "upper4", "S_CRT_A", 0., 790., -3.*box, "Up");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
 
-  //
-  // Put 4 modules on the top of the magnet
-  Int_t step = 4;
-  for ( Int_t i = 1 ; i <= 4 ; i++ ) {
-    gMC->Gspos("CRT1", i, "CRTA", initX, initY, (i-step)*box[2], 0, "ONLY");
-    step--;
-  }
 
-  // Modules on the barrel sides.
-  // Because the openenig angle for each face is 22.5, and if we want to
-  //    put the modules right in the middle
+  // Modules on the left side.
   Float_t xtragap = 10.;
-  Float_t initXside = (height+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
-  Float_t initYside = (height+xtragap)*TMath::Cos(2*22.5*kDegrad);
-
-  // Put 4 modules on the left side of the magnet
-  // The rotation matrix parameters, for the left side.
-  AliMatrix(idrotm[232], 90., 315., 90., 45., 0., 337.5);
-  Int_t stepl = 4;
-  for ( Int_t i = 1 ; i <= 4 ; i++ ) {
-    gMC->Gspos("CRT1", i+4, "CRTA", initXside, initYside, (i-stepl)*box[2],
-              idrotm[232], "ONLY");
-    stepl--;
-  }
-
-  // Put 4 modules on the right side of the magnet
-  // The rotation matrix parameters for the right side.
-  AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
-  Int_t stepr = 4;
-  for ( Int_t i = 1 ; i <= 4 ; i++ ) {
-    gMC->Gspos("CRT1", i+8, "CRTA", -initXside, initYside, (i-stepr)*box[2],
-              idrotm[231], "ONLY");
-    stepr--;
-  }
+  Float_t initXside = (790.+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
+  Float_t initYside = (790.+xtragap)*TMath::Cos(2*22.5*kDegrad);
+  top->cd();
+  node = new TNode("upper5", "upper5", "S_CRT_A", initXside, initYside,  3.*box, "Left");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper6", "upper6", "S_CRT_A", initXside, initYside,    box, "Left");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper7", "upper7", "S_CRT_A", initXside, initYside, -1.*box, "Left");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper8", "upper8", "S_CRT_A", initXside, initYside, -3.*box, "Left");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+
+  // Modules on the right side.
+  top->cd();
+  node = new TNode("upper9", "upper9", "S_CRT_A", -initXside, initYside,  3.*box, "Right");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper10", "upper10", "S_CRT_A", -initXside, initYside,    box, "Right");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper11","upper11", "S_CRT_A", -initXside, initYside, -1.*box, "Right");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
+
+  top->cd();
+  node = new TNode("upper12","upper12", "S_CRT_A", -initXside, initYside, -3.*box, "Right");
+  node->SetLineColor(kColorCRT);
+  fNodes->Add(node);
 
 }
 
 //_____________________________________________________________________________
-void AliCRTv0::CreateHall()
-{
-
-  Float_t r2;
-  Float_t phid, phim, pbox[3], h, r, tspar[5];
-  Float_t w1, dh, am, bm, dl,cm, hm, dr, dx, xl;
-  Int_t idrotm[1999];
-  Float_t trdpar[4], trapar[11];
-  Float_t phi;
-  
-  Int_t *idtmed = fIdtmed->GetArray()-1899;
-
-  // Because the BODY,  was "filled with vaccum", we're goin to superimpose
-  // a volume with molasse, then using the boolenaq operations with volumes
-  // we are going the replace, with air, the part closed by the hall walls
-
-  // For the moment, just use the simple mother volume ...
-  Float_t mola[3];
-  mola[0] = 2000.;
-  mola[1] = 2000.;
-  mola[2] = 3000.;
-  gMC->Gsvolu("CRTA", "BOX", idtmed[1905], mola, 3);
-  gMC->Gspos("CRTA", 1, "ALIC", 0., 0., 0., 0, "MANY");
-
-  // Now make a cilinder with the size of the hall (raughtly)
-  // and fill it with air.
-  Float_t hall[3];
-  hall[0] = 0.;    // Inner radius
-  hall[1] = 1170.; // Outer radius
-  hall[2] = 2625. + 200.; // Hall lenght
-  gMC->Gsvolu("CRTB", "TUBE", idtmed[1914], hall, 3);
-  // perform the substraction SMOL - SALL, asigning SMOL as MANY and 
-  // SALL as ONLY.
-  gMC->Gspos("CRTB", 1, "CRTA", 0., 500., -2*375., 0, "ONLY");
-
-  //     RB24/26 TUNNEL FLOOR 
-  
-  r   = 220.;
-  h   = 140.;
-  phi = TMath::ACos(h / r);
-  xl  = r * TMath::Sin(phi);
-  dr  = 100.;
-  dh  = dr * TMath::Cos(phi);
-  dl  = dr * TMath::Sin(phi);
-
-  AliMatrix(idrotm[1900], 90., 0., 0., 0., 90., 90.);
-  AliMatrix(idrotm[1901], 270., 0., 90., 90., 0., 0.);
-  //     END WALL 
-  
-  pbox[0] = 1200.;
-  pbox[1] = 1300.;
-  pbox[2] = 60.;
-  gMC->Gsvolu("CRTC", "BOX ", idtmed[1956], pbox, 3);
-  gMC->Gspos("CRTC", 1, "CRTA", 0., 404., 1960, 0, "ONLY");
-  
-  //     hall floor, the interior part (left)
-  
-  phid      = 16.197;
-  trdpar[0] = 700.;
-  trdpar[1] = TMath::Tan(phid * kDegrad) * 190. + 700.;
-  trdpar[2] = 550.;
-  trdpar[3] = 95.;
-  gMC->Gsvolu("CRTD", "TRD1", idtmed[1956], trdpar, 4);
-  gMC->Gspos("CRTD", 1, "CRTA", 0., -801., 1350., idrotm[1900], "ONLY");
-
-  //     hall floor, the outside part
-  
-  phid      = 16.197;
-  trdpar[0] = 700.;
-  trdpar[1] = TMath::Tan(phid * kDegrad) * 190. + 700.;
-  trdpar[2] = 1325.;
-  trdpar[3] = 95.;
-  gMC->Gsvolu("CRTE", "TRD1", idtmed[1956], trdpar, 4);
-  gMC->Gspos("CRTE", 2, "CRTA", 0., -801., -2125., idrotm[1900], "ONLY");
-  
-  //     hall side walls 
-
-  // Interior walls  
-  trapar[0] = 550.;
-  trapar[1] = 0.;
-  trapar[2] = 0.;
-  trapar[3] = 1273.78/2;
-  trapar[4] = 235.;
-  trapar[5] = 50.;
-  trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
-  trapar[7] = trapar[3];
-  trapar[8] = trapar[4];
-  trapar[9] = trapar[5];
-  trapar[10] = trapar[6];
-  dx = trapar[4] * 1.5 + 700. - trapar[5] * .5;
-  gMC->Gsvolu("CRTF", "TRAP", idtmed[1956], trapar, 11);// interior wall
-  gMC->Gspos("CRTF", 1, "CRTA", dx, -896+trapar[3],  1350., 0, "ONLY");
-  gMC->Gspos("CRTF", 2, "CRTA",-dx, -896+trapar[3],  1350., idrotm[1901], "ONLY");
-
-  // Exterior walls
-  Float_t trapare[11];
-  trapare[0] = 275.;
-  for ( Int_t i = 1 ; i <= 10 ; i++ ) {
-    trapare[i] = trapar[i];
-  }
-  gMC->Gsvolu("CRTG", "TRAP", idtmed[1956], trapare, 11);// exterior wall
-  gMC->Gspos("CRTG", 1, "CRTA", dx, -896+trapar[3],  -1075., 0, "ONLY");
-  gMC->Gspos("CRTG", 2, "CRTA",-dx, -896+trapar[3],  -1075., idrotm[1901], "ONLY");
-
-  pbox[0] = 50.;
-  pbox[1] = (500. - (trapar[3] * 2. - 896.)) / 2.;
-  pbox[2] = 1625.;
-  gMC->Gsvolu("CRTH", "BOX ", idtmed[1956], pbox, 3);
-  gMC->Gspos("CRTH", 1, "CRTA",  1120., 500-pbox[1], 275., 0, "ONLY");
-  gMC->Gspos("CRTH", 2, "CRTA", -1120., 500-pbox[1], 275., 0, "ONLY");
-
-  //     slanted wall close to L3 magnet 
-  
-  phim = 45.;
-  hm   = 790.;
-  //rm   = hm / TMath::Cos(phim / 2. * kDegrad);
-  am   = hm * TMath::Tan(phim / 2. * kDegrad);
-  bm   = (hm + 76.) / hm * am;
-  cm   = bm * 2. / TMath::Sqrt(2.);
-  trapar[0] = 800.;
-  trapar[1] = 0.;
-  trapar[2] = 0.;
-  trapar[3] = (1273.78 - cm) / 2.;
-  trapar[4] = 235. - cm * TMath::Tan(phid * kDegrad) / 2.;
-  trapar[5] = 50.;
-  trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
-  trapar[7] = trapar[3];
-  trapar[8] = trapar[4];
-  trapar[9] = trapar[5];
-  trapar[10] = trapar[6];
-  w1 = trapar[4];
-  dx = cm*TMath::Tan(phid * kDegrad) + 700. + trapar[4] * 1.5 - trapar[5] * .5;
-  gMC->Gsvolu("CRTI", "TRAP", idtmed[1956], trapar, 11);
-  r2 = cm - 896. + trapar[3];
-  gMC->Gspos("CRTI", 1, "CRTA", dx, r2, 0., 0, "ONLY");
-  gMC->Gspos("CRTI", 2, "CRTA",-dx, r2, 0., idrotm[1901], "ONLY");
-  trapar[3]  = cm / 2.;
-  trapar[4]  = w1 + cm / 2.;
-  trapar[5]  = w1;
-  trapar[6]  = TMath::ATan(.5) * kRaddeg;
-  trapar[7]  = trapar[3];
-  trapar[8]  = trapar[4];
-  trapar[9]  = trapar[5];
-  trapar[10] = trapar[6];
-  dx = 1170. - trapar[4] * .5 - trapar[5] * .5;
-  gMC->Gsvolu("CRTJ", "TRAP", idtmed[1956], trapar, 11);
-  r2 = trapar[3] - 896.;
-  gMC->Gspos("CRTJ", 1, "CRTA", dx, r2, 0., 0, "ONLY");
-  gMC->Gspos("CRTJ", 2, "CRTA",-dx, r2, 0., idrotm[1901], "ONLY");
-
-  tspar[0] = 1070.;
-  tspar[1] = 1170.;
-  tspar[2] = pbox[2];
-  tspar[3] = 0.;
-  tspar[4] = 180.;
-  gMC->Gsvolu("CRTK", "TUBS", idtmed[1956], tspar, 5);
-  gMC->Gspos("CRTK", 1, "CRTA", 0., 500., 300., 0, "ONLY");
-  trdpar[0] = 1170 - trapar[4] * 2.;
-  trdpar[1] = trdpar[0] + TMath::Tan(phim * kDegrad) * 76.;
-  trdpar[2] = 800.;
-  trdpar[3] = 38.;
-  gMC->Gsvolu("CRTL", "TRD1", idtmed[1956], trdpar, 4);
-  gMC->Gspos("CRTL", 1, "CRTA", 0., -858., 0., idrotm[1900], "ONLY");
-
-
-
-  // Define the setion tube of the PX24, at the same level of hall
-  // rotate the tubes around X, Z'=Y, Y'=-Z
-  AliMatrix(idrotm[2001], 0., 0., 90., 0., 90., 90.);
-  Float_t pxi[5];
-  pxi[0] = 1150.;              // inside radius
-  pxi[1] = 1250.;              // outside radius
-  pxi[2] = 1300.;              // half lenght in Z
-  pxi[3] = kRaddeg*TMath::ASin(tspar[0]/pxi[0]);//starting angle of the segment
-  pxi[4] = 360.-pxi[3];               // ending angle of the segment
-  gMC->Gsvolu("CRTM", "TUBS", idtmed[1956], pxi, 5);
-  gMC->Gspos("CRTM", 1, "CRTA", 0., 404., -2300., idrotm[2001], "MANY");
-
-  // Define the setion tube of the PX24, above the hall
-  Float_t pxa[3];
-  pxa[0] = pxi[0];
-  pxa[1] = pxi[1];
-  pxa[2] = 2550. - pxi[2]; // Half lenght
-  gMC->Gsvolu("CRTN", "TUBE", idtmed[1956], pxa, 3);
-  gMC->Gspos("CRTN", 1, "CRTA", 0.,pxi[2]+404+pxa[2], -2300., idrotm[2001], "MANY");
-  // Fill this section with air.
-  Float_t pxb[3];
-  pxb[0] = 0.;
-  pxb[1] = pxa[0];
-  pxb[2] = pxa[2];
-  gMC->Gsvolu("CRTO", "TUBE", idtmed[1914], pxb, 3);
-  gMC->Gspos("CRTO", 1, "CRTA", 0., pxi[2]+404+pxa[2], -2300., idrotm[2001], "ONLY");
-
-
-  // PM25 Acces shaft.
-  Float_t pma[3];
-  pma[0] = 910./2.;// Inner radius 
-  pma[1] = pma[0] + 100.; // Outer Radius
-  pma[2] = 5100./2.; // Half lenght 
-  gMC->Gsvolu("CRTP", "TUBE", idtmed[1956], pma, 3);
-  gMC->Gspos("CRTP", 1, "CRTA", -2100., 1654., 0., idrotm[2001], "ONLY");
-  // Fill it with air.
-  Float_t pmb[3];
-  pmb[0] = 0.;
-  pmb[1] = pma[0];
-  pmb[2] = pma[2];
-  gMC->Gsvolu("CRTQ", "TUBE", idtmed[1914], pmb, 3);
-  gMC->Gspos("CRTQ", 1, "CRTA", -2100., 1654., 0., idrotm[2001], "ONLY");
-
-
-  // PGC2 Acces shaft.
-  Float_t pgc[3];
-  pgc[0] = 1200./2.;// Inner Radius 
-  pgc[1] = pgc[0] + 100.; // outer Radius
-  pgc[2] = 5100./2.; // Half lenght 
-  gMC->Gsvolu("CRTR", "TUBE", idtmed[1956], pgc, 3);
-  gMC->Gspos("CRTR", 1, "CRTA", 375., 1654., 4850., idrotm[2001], "ONLY");
-  // Fill it with air.
-  Float_t pgd[3];
-  pgd[0] = 0.;
-  pgd[1] = pgc[0];
-  pgd[2] = pgc[2];
-  gMC->Gsvolu("CRTS", "TUBE", idtmed[1914], pgd, 3);
-  gMC->Gspos("CRTS", 1, "CRTA", 375., 1654., 4850., idrotm[2001], "ONLY");
-
-}
-//_____________________________________________________________________________
-void AliCRTv0::CreateMaterials()
+void AliCRTv0::CreateGeometry()
 {
   //
-  //--
+  // Create geometry for the CRT array
   //
 
-  // Use the standard materials.
-  AliCRT::CreateMaterials();
-}
-
-
-//_____________________________________________________________________________
-void AliCRTv0::DrawDetector()
-{
+  Int_t  idrotm[2499];    // The rotation matrix.
+  Int_t* idtmed = fIdtmed->GetArray() - 1099;
+  AliCRTConstants* crtConstants = AliCRTConstants::Instance();
+
+  // Create the mother volume.
+  // This volume can be seen as the volume which ACORDE will ocupate
+  // above the upper face of the L3 magnet. Inside this volume the detectors
+  // aboce the magnet will be, then there will be two copies of this volume,
+  // one for each side.
+  Float_t box[3];
+  //box[0] = 2*crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
+  box[0] = crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
+  box[1] = crtConstants->MagMaxRadius() - crtConstants->MagMinRadius();
+  box[2] = crtConstants->MagnetLenght()/2;
+  gMC->Gsvolu("CRT1", "BOX", idtmed[1112], box, 3);
+
+  // Check if the AliCRTModule instance have been set, otherwise
+  // use the default values
+  if ( !fModule ) {
+    Info("CreateGeometry", "Using default dimensions");
+    fModule = new AliCRTModule("CRTmod", "Default module dimensions");
+  }
 
-}
+  // The full module volume.
+  // This volume will be ocupied by all the material of the module
+  // the scintillators, the aluminium frame, etc.
+  box[0] = fModule->FrameLength()/2;
+  box[1] = fModule->FrameThickness()/2;
+  box[2] = fModule->FrameWidth()/2;
+  gMC->Gsvolu("CRT2", "BOX", idtmed[1114], box, 3);
+
+  // The scintillators
+  box[0] = crtConstants->SinglePaletteLenght()/4;
+  box[1] = crtConstants->SinglePaletteHeight();
+  box[2] = crtConstants->SinglePaletteWidth()/2;
+  gMC->Gsvolu("CRT3", "BOX", idtmed[1112], box, 3);
+  gMC->Gspos("CRT3", 1, "CRT2", 0, 2, 0, 0, "ONLY");
+
+  // The metallic frame
+  box[0] = fModule->FrameLength()/2;
+  box[1] = fModule->FrameThickness()/2;
+  box[2] = 2;
+  gMC->Gsvolu("CRT4", "BOX", idtmed[1108], box, 3);
+  gMC->Gspos("CRT4", 1, "CRT2", 0, 0,  13 - box[2], 0, "MANY");
+  gMC->Gspos("CRT4", 2, "CRT2", 0, 0, -13 + box[2], 0, "MANY");
+
+  box[0] = 2;
+  box[1] = fModule->FrameThickness()/2;
+  box[2] = fModule->FrameWidth()/2;
+  gMC->Gsvolu("CRT5", "BOX", idtmed[1108], box, 3);
+  gMC->Gspos("CRT5", 1, "CRT2",  140 - box[0], 0, 0, 0, "MANY");
+  gMC->Gspos("CRT5", 2, "CRT2", -140 + box[0], 0, 0, 0, "MANY");
+
+  // The support bars
+  box[0] = 2;
+  box[1] = fModule->FrameThickness()/2;
+  box[2] = 500;
+  gMC->Gsvolu("CRT6", "BOX", idtmed[1108], box, 3);
+
+  // Now put into the volume CR11 all the above volumes.
+  // 20 scintillation modules
+  // 4 support bars
+  Int_t copyNumber = 0;
+  for ( Int_t k = 0; k < fModule->NumberOfRows(); k++ ) {
+    Float_t zCoordinate = k*fModule->ZGap() - 450;
+    gMC->Gspos("CRT2",++copyNumber,"CRT1",-150, 15, zCoordinate, 0, "MANY");
+    gMC->Gspos("CRT2",++copyNumber,"CRT1",150, 15, zCoordinate, 0, "MANY");
 
-//_____________________________________________________________________________
-void AliCRTv0::DrawModule()
-{
-  //
-  // Draw a shaded view of the L3 magnet
-  //
-   cout << "AliCRTv0::DrawModule() : Drawing the module" << endl;
-
-   gMC->Gsatt("*", "seen", -1);
-   gMC->Gsatt("alic", "seen", 0);
-
-   gMC->Gsatt("ALIC","seen",0); // Mother volume, pit ceiling
-   gMC->Gsatt("L3MO","seen",1); // L3 Magnet
-   gMC->Gsatt("CRT1","seen",1); // Scintillators (air) box.
-
-   // Draw the volumes for all the hall.
-   gMC->Gsatt("CRTA","seen",1);
-   gMC->Gsatt("CRTB","seen",1);
-   gMC->Gsatt("CRTC","seen",1);
-   gMC->Gsatt("CRTD","seen",1);
-   gMC->Gsatt("CRTE","seen",1);
-   gMC->Gsatt("CRTF","seen",1);
-   gMC->Gsatt("CRTG","seen",1);
-   gMC->Gsatt("CRTH","seen",1);
-   gMC->Gsatt("CRTI","seen",1);
-   gMC->Gsatt("CRTJ","seen",1);
-   gMC->Gsatt("CRTK","seen",1);
-   gMC->Gsatt("CRTL","seen",1);
-   gMC->Gsatt("CRTM","seen",1);
-   gMC->Gsatt("CRTN","seen",1);
-   gMC->Gsatt("CRTO","seen",1);
-   gMC->Gsatt("CRTP","seen",1);
-   gMC->Gsatt("CRTQ","seen",1);
-   gMC->Gsatt("CRTR","seen",1);
-   gMC->Gsatt("CRTS","seen",1);
-
-
-   gMC->Gdopt("hide", "on");
-   gMC->Gdopt("edge","off");
-   gMC->Gdopt("shad", "on");
-   gMC->Gsatt("*", "fill", 7);
-   gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
-   gMC->DefaultRange();
-   gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
-   gMC->Gdhead(1111, "View of CRT(ACORDE)");
-   gMC->Gdman(18, 4, "MAN");
+  }
 
+  // Put the support bars
+  gMC->Gspos("CRT6", 1, "CRT1",  -75, 5, 0, 0, "ONLY");
+  gMC->Gspos("CRT6", 2, "CRT1", -225, 5, 0, 0, "ONLY");
+  gMC->Gspos("CRT6", 3, "CRT1",   75, 5, 0, 0, "ONLY");
+  gMC->Gspos("CRT6", 4, "CRT1",  225, 5, 0, 0, "ONLY");
 
-}
+  // Now put a copy of CR11 on the 3 upper faces of the magnet
+  // In the right side side of the magnet
+  AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
+  // In the left side side of the magnet
+  AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
 
-//_____________________________________________________________________________
-void AliCRTv0::Init()
-{
-  //
-  // Initialise L3 magnet after it has been built
-  Int_t i;
-  //
-  if(fDebug) {
-    printf("\n%s: ",ClassName());
-    for(i=0;i<35;i++) printf("*");
-    printf(" CRTv0_INIT ");
-    for(i=0;i<35;i++) printf("*");
-    printf("\n%s: ",ClassName());
-    //
-    // Here the CRTv0 initialisation code (if any!)
-    for(i=0;i<80;i++) printf("*");
-    printf("\n");
-  }
+  Float_t x = crtConstants->MagMinRadius()+10;
+  gMC->Gspos("CRT1", 1, "ALIC", 0, x, 0, 0, "MANY");
+  gMC->Gspos("CRT1", 2, "ALIC", -x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[231], "MANY");
+  gMC->Gspos("CRT1", 3, "ALIC",  x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[232], "MANY");
 
 }
 
 //_____________________________________________________________________________
-void AliCRTv0::StepManager()
+void AliCRTv0::DrawDetector() const
 {
   //
-  // Called for every step in the CRT Detector
+  // Draw a shaded view of the L3 magnet
   //
-  Float_t hits[12];
-  Int_t   vol[5];
-
-  // Check if this is the last step of the track in the current volume
-  Bool_t laststepvol = gMC->IsTrackEntering();
-  // Obtain the medium
-  TLorentzVector xyz;
-  gMC->TrackPosition(xyz);
-  TLorentzVector pxyz;
-  gMC->TrackMomentum(pxyz);
-
-  if ( laststepvol && (strcmp(gMC->CurrentVolName(),"CRT1") == 0) ) {
-    if (  gMC->TrackCharge() != 0 || gMC->TrackPid() == kGamma ) {
-      Float_t vert[3];
-
-      hits[0] = fMucur++;
-
-      if ( (gMC->TrackPid() != kMuonPlus) && (gMC->TrackPid() != kMuonMinus)) {
-       hits[1] = -(Float_t)gMC->TrackPid();
-      } else {
-       hits[1] = (Float_t)gMC->TrackPid();
-      }
-
-      TLorentzVector xyz;
-      gMC->TrackPosition(xyz);
-      TLorentzVector pxyz;
-      gMC->TrackMomentum(pxyz);
-
-      hits[2]  = xyz[0]; // X pit
-      hits[3]  = xyz[1]; // Y pit
-      hits[4]  = xyz[2]; // Z pit
-      hits[5]  = pxyz[0]; // pxug
-      hits[6] = pxyz[1]; // pyug
-      hits[7] = pxyz[2]; // pzug
-
-      hits[8] = gMC->GetMedium(); // layer
-      hits[9] = vert[0]; // xver
-      hits[10] = vert[1]; // yver
-      hits[11] = vert[2]; // zver
-    }
-  }
 
-  // Store the hit.
-  AddHit(gAlice->CurrentTrack(),vol, hits);
+  Info("DrawDetector", "Drawing the module");
+
+  gMC->Gsatt("*", "seen", -1);
+
+  gMC->Gsatt("ALIC","seen",0);
+
+  gMC->Gsatt("L3MO","seen",0); // L3 Magnet, Mother
+  gMC->Gsatt("L3CO","seen",1); // Coils
+  gMC->Gsatt("L3C1","seen",1); // Coils
+  gMC->Gsatt("L3YO","seen",1); // Yoke
+  gMC->Gsatt("L3DO","seen",0); // return Yoke (DOOR)
+  gMC->Gsatt("L3FR","seen",1); // DOOR
+  gMC->Gsatt("L3IR","seen",0); // Inner layer
+  gMC->Gsatt("L3O1","seen",1); // Door opening
+  gMC->Gsatt("L3O2","seen",1); // Door opening
+
+  gMC->Gsatt("CRT1", "seen", 0); // CRT Mother
+  gMC->Gsatt("CRT2", "seen", 0); // Module air box
+  gMC->Gsatt("CRT3", "seen", 1); // Scintillators
+  gMC->Gsatt("CRT3", "colo", 2); // Scintillators
+  gMC->Gsatt("CRT4", "seen", 1); // Aluminium frame (long bars)
+  gMC->Gsatt("CRT4", "colo", 3); //
+  gMC->Gsatt("CRT5", "seen", 1); // Aluminium frame (short bars)
+  gMC->Gsatt("CRT5", "colo", 3); //
+  gMC->Gsatt("CRT6", "seen", 1); // Module support
+  gMC->Gsatt("CRT6", "colo", 3); //
+
+  gMC->Gdopt("hide", "on");
+  gMC->Gdopt("edge","off");
+  gMC->Gdopt("shad", "on");
+  gMC->Gsatt("*", "fill", 7);
+  gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
+  gMC->DefaultRange();
+  //gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
+  gMC->Gdraw("alic", 30, 40, 0, -30, -60, .09, .09);
+  gMC->Gdhead(1111, "View of CRT(ACORDE)");
+  gMC->Gdman(18, 4, "MAN");
 }