New TOF version with holes for PHOS/RICH
authorvicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 May 2000 16:52:18 +0000 (16:52 +0000)
committervicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 May 2000 16:52:18 +0000 (16:52 +0000)
20 files changed:
TOF/AliTOF.cxx
TOF/AliTOF.h
TOF/AliTOFD.cxx [new file with mode: 0644]
TOF/AliTOFD.h [new file with mode: 0644]
TOF/AliTOFv0.cxx
TOF/AliTOFv0.h
TOF/AliTOFv1.cxx
TOF/AliTOFv1.h
TOF/AliTOFv2.cxx
TOF/AliTOFv2.h
TOF/AliTOFv3.cxx
TOF/AliTOFv3.h
TOF/AliTOFv4.cxx
TOF/AliTOFv4.h
TOF/AliTOFv5.cxx [deleted file]
TOF/AliTOFv5.h [deleted file]
TOF/AliTOFv6.cxx [deleted file]
TOF/AliTOFv6.h [deleted file]
TOF/Makefile
TOF/TOFLinkDef.h

index ed1e4aee156793fad4c0445424745e6b5a73b94e..30833fc9c98947000a8356f23cb3cb6358c8e234 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.11.2.1  2000/05/10 09:37:15  vicinanz
+New version with Holes for PHOS/RICH
+
 Revision 1.11  1999/11/05 22:39:06  fca
 New hits structure
 
@@ -57,10 +60,14 @@ Introduction of the Copyright and cvs Log
 #include <iostream.h>
 
 #include "AliTOF.h"
-#include "TNode.h"
+#include "AliTOFD.h"
 #include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
+#include "TRandom.h"
 #include "AliRun.h"
 #include "AliConst.h"
+
  
 ClassImp(AliTOF)
  
@@ -80,515 +87,82 @@ AliTOF::AliTOF(const char *name, const char *title)
   //
   // AliTOF standard constructor
   // 
+  // Here are fixed some important parameters
+  //
+
+  // Initialization of hits and digits array
+  //
   fHits   = new TClonesArray("AliTOFhit",  405);
-  gAlice->AddHitList(fHits);
+  fIshunt  = 0;
+  fDigits = new TClonesArray("AliTOFdigit",405);
+  //
+  // Digitization parameters
   //
-  fIshunt     =  0;
+  // (Transfer Functions to be inserted here)
   //
   SetMarkerColor(7);
   SetMarkerStyle(2);
   SetMarkerSize(0.4);
+
+// General Geometrical Parameters
+  fNTof    =  18;
+  fRmax    = 399.0;//cm
+  fRmin    = 370.0;//cm
+  fZlenC   = 177.5;//cm
+  fZlenB   = 141.0;//cm
+  fZlenA   = 106.0;//cm
+  fZtof    = 370.5;//cm
+
+// Strip Parameters
+  fStripLn = 122.0;//cm  Strip Length
+  fSpace   =   5.5;//cm  Space Beetween the strip and the bottom of the plate 
+  fDeadBndZ=   1.5;//cm  Dead Boundaries of a Strip along Z direction (width)
+  fDeadBndX=   1.0;//cm  Dead Boundaries of a Strip along X direction (length)
+  fXpad    =   2.5;//cm  X size of a pad
+  fZpad    =   3.5;//cm  Z size of a pad
+  fGapA    =   4.; //cm  Gap beetween tilted strip in A-type plate
+  fGapB    =   6.; //cm  Gap beetween tilted strip in B-type plate
+  fOverSpc =  15.3;//cm Space available for sensitive layers in radial direction
+  fNpadX   =  48;  // Number of pads in a strip along the X direction
+  fNpadZ   =   2;  // Number of pads in a strip along the Z direction
+  fPadXStr = fNpadX*fNpadZ; //Number of pads per strip
+  fNStripA = 0;
+  fNStripB = 0;
+  fNStripC = 0;
+// Physical performances
+  fTimeRes = 100.;//ps
+  fChrgRes = 100.;//pC
+
+// DAQ characteristics
+  fPadXSector = 1932;
+  fNRoc       = 14;
+  fNFec       = 32;
+  fNTdc       = 32;
+  fNPadXRoc   = (Int_t)fPadXSector/fNRoc;
 }
 
 //_____________________________________________________________________________
-void AliTOF::AddHit(Int_t track, Int_t sector, Int_t plate, Int_t pad_x,Int_t pad_z, Float_t *hits)
+void AliTOF::AddHit(Int_t track, Int_t *vol, Float_t *hits)
 {
   //
   // Add a TOF hit
   //
   TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliTOFhit(fIshunt,track,sector,plate,pad_x,pad_z,hits);
+  new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits);
 }
  
 //_____________________________________________________________________________
-void AliTOF::BuildGeometry()
+void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
 {
   //
-  // Build TOF ROOT geometry for the ALICE event viewver
-  //
-  TNode *Node, *Top;
-  const int kColorTOF  = 27;
-  //
-  // Find top TNODE
-  Top=gAlice->GetGeometry()->GetNode("alice");
-  //
-  // Define rotation matrixes
-  new TRotMatrix("rot501","rot501",90,-20,90,90-20,0,0);
-  new TRotMatrix("rot502","rot502",90,-40,90,90-40,0,0);
-  new TRotMatrix("rot503","rot503",90,-60,90,90-60,0,0);
-  new TRotMatrix("rot504","rot504",90,-80,90,90-80,0,0);
-  new TRotMatrix("rot505","rot505",90,-100,90,90-100,0,0);
-  new TRotMatrix("rot506","rot506",90,-120,90,90-120,0,0);
-  new TRotMatrix("rot507","rot507",90,-140,90,90-140,0,0);
-  new TRotMatrix("rot508","rot508",90,-160,90,90-160,0,0);
-  new TRotMatrix("rot509","rot509",90,-180,90,90-180,0,0);
-  new TRotMatrix("rot510","rot510",90,-200,90,90-200,0,0);
-  new TRotMatrix("rot511","rot511",90,-220,90,90-220,0,0);
-  new TRotMatrix("rot512","rot512",90,-240,90,90-240,0,0);
-  new TRotMatrix("rot513","rot513",90,-260,90,90-260,0,0);
-  new TRotMatrix("rot514","rot514",90,-280,90,90-280,0,0);
-  new TRotMatrix("rot515","rot515",90,-300,90,90-300,0,0);
-  new TRotMatrix("rot516","rot516",90,-320,90,90-320,0,0);
-  new TRotMatrix("rot517","rot517",90,-340,90,90-340,0,0);
-  new TRotMatrix("rot518","rot518",90,-360,90,90-360,0,0);
-  //
-  // Position the different copies
-  const Float_t rtof=(399+370)/2;
-  const Int_t ntof=18;
-  const Float_t kPi = TMath::Pi();
-  const Float_t angle=2*kPi/ntof;
-  Float_t ang;
-  //
-  // Define TOF basic volume
-  
-  Float_t zlen1 = 152.5;
-  Float_t zlen2 = 147.0;
-  Float_t zlen3 = 117.0;
-  
-  new TBRIK("S_TOF1","TOF box","void",130/2,29/2,zlen1/2);
-  //
-  // Position it
-  //
-  Top->cd();
-  ang=3.5*angle;
-  Node = new TNode("FTO001","FTO001","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot501");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO101","FTO101","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot501");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=2.5*angle;
-  Node = new TNode("FTO002","FTO002","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot502");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO102","FTO102","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot502");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=1.5*angle;
-  Node = new TNode("FTO003","FTO003","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot503");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO103","FTO103","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot503");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();  
-  ang=0.5*angle;
-  Node = new TNode("FTO004","FTO004","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot504");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node);
-  //
-  Top->cd();
-  Node = new TNode("FTO104","FTO104","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot504");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-0.5*angle;
-  Node = new TNode("FTO005","FTO005","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot505");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO105","FTO105","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot505");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-1.5*angle;
-  Node = new TNode("FTO006","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot506");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO106","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot506");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-2.5*angle;
-  Node = new TNode("FTO007","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot507");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO107","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot507");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-3.5*angle;
-  Node = new TNode("FTO008","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot508");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO108","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot508");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-4.5*angle;
-  Node = new TNode("FTO009","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot509");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO109","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot509");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-5.5*angle;
-  Node = new TNode("FTO010","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot510");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO110","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot510");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-6.5*angle;
-  Node = new TNode("FTO011","FTO006","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot511");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO111","FTO106","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot511");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();  
-  ang=-7.5*angle;
-  Node = new TNode("FTO012","FTO012","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot512");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO112","FTO112","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot512");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-8.5*angle;
-  Node = new TNode("FTO013","FTO013","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot513");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO113","FTO113","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot513");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPI-0.5*angle;
-  Node = new TNode("FTO014","FTO04","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot514");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO114","FTO114","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot514");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPI-1.5*angle;
-  Node = new TNode("FTO015","FTO015","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot515");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO115","FTO115","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot515");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPI-2.5*angle;
-  Node = new TNode("FTO016","FTO016","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot516");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO116","FTO116","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot516");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-3.5*angle;
-  Node = new TNode("FTO017","FTO017","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot517");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO117","FTO117","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot517");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi/2;
-  Node = new TNode("FTO018","FTO018","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),299.15,"rot518");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO118","FTO118","S_TOF1",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-299.15,"rot518");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  //
-  // Define second TOF volume
-  new TBRIK("S_TOF2","TOF box","void",130/2,29/2,zlen2/2);
-  //
-  // Position the volume
-  //
-  Top->cd();
-  ang=2.5*angle;
-  Node = new TNode("FTO202","FTO202","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot502");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO402","FTO402","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot502");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=1.5*angle;
-  Node = new TNode("FTO203","FTO203","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot503");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO403","FTO403","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot503");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=0.5*angle;
-  Node = new TNode("FTO204","FTO204","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot504");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO404","FTO404","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot504");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-0.5*angle;
-  Node = new TNode("FTO205","FTO205","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot505");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO405","FTO405","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot505");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-1.5*angle;
-  Node = new TNode("FTO206","FTO206","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot506");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO406","FTO406","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot506");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-2.5*angle;
-  Node = new TNode("FTO207","FTO207","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot507");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO407","FTO407","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot507");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  //
-  Top->cd();
-  ang=-3.5*angle;
-  Node = new TNode("FTO208","FTO208","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot508");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO408","FTO408","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot508");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-kPi/2;
-  Node = new TNode("FTO209","FTO209","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot509");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO409","FTO409","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot509");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-kPi/2-angle;
-  Node = new TNode("FTO210","FTO210","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot510");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO410","FTO410","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot510");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-kPi/2-2*angle;
-  Node = new TNode("FTO211","FTO211","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot511");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO411","FTO411","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot511");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-kPi/2-3*angle;
-  Node = new TNode("FTO212","FTO212","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot512");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO412","FTO412","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot512");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  //
-  Top->cd();
-  ang=-kPi/2-4*angle;
-  Node = new TNode("FTO213","FTO213","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot513");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO413","FTO413","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot513");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-0.5*angle;
-  Node = new TNode("FTO214","FTO214","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot514");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO414","FTO414","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot514");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-1.5*angle;
-  Node = new TNode("FTO215","FTO215","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot515");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO415","FTO415","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot515");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-2.5*angle;
-  Node = new TNode("FTO216","FTO216","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),146.45,"rot516");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  Node = new TNode("FTO416","FTO416","S_TOF2",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),-146.45,"rot516");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-
-  // Define third TOF volume
-  new TBRIK("S_TOF3","TOF box","void",130/2.,29/2,zlen3/2.);
-  //
-  // Position it
-  //
-  Top->cd();
-  ang=2.5*angle;
-  Node = new TNode("FTO302","FTO302","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot502");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=1.5*angle;
-  Node = new TNode("FTO303","FTO303","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot503");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=0.5*angle;
-  Node = new TNode("FTO304","FTO304","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot504");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-0.5*angle;
-  Node = new TNode("FTO305","FTO305","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot505");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=-1.5*angle;
-  Node = new TNode("FTO306","FTO306","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot506");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  //
-  Top->cd();
-  ang=kPi+1.5*angle;
-  Node = new TNode("FTO312","FTO312","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot512");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi+0.5*angle;
-  Node = new TNode("FTO313","FTO313","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot513");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-0.5*angle;
-  Node = new TNode("FTO314","FTO314","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot514");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-1.5*angle;
-  Node = new TNode("FTO315","FTO315","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot515");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-  //
-  Top->cd();
-  ang=kPi-2.5*angle;
-  Node = new TNode("FTO316","FTO316","S_TOF3",rtof*TMath::Cos(ang),rtof*TMath::Sin(ang),0.,"rot516");
-  Node->SetLineColor(kColorTOF);
-  fNodes->Add(Node); 
-
+  // Add a TOF digit
+  //
+  TClonesArray &ldigits = *fDigits;
+  new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits);
 }
 
+
 //_____________________________________________________________________________
 void AliTOF::CreateGeometry()
 {
@@ -601,34 +175,20 @@ void AliTOF::CreateGeometry()
   */
   //End_Html
   //
-
   const Double_t kPi=TMath::Pi();
-  const Double_t kDegrad=kPi/180;
+  const Double_t kDegrad=kPi/180.;
   //
-  Float_t xtof, ytof;
-  Float_t ztof0;
-  Float_t rmin, rmax, dwall;
+  Float_t xTof, yTof, Wall;
 
-  // barrel iner radius 
-  rmin = 370.;//cm
-  // barrel outer radius 
-  rmax = rmin+29;
-  
   // frame inbetween TOF modules
-  dwall = 4.;//cm
-  // Sizes of TOF module with its support etc..
-  xtof = 2.*(rmin*TMath::Tan(10*kDegrad)-dwall/2-.5);
-  ytof = rmax-rmin;
-  ztof0 = 375.5;//cm
-
-// TOF size  (CO2)
+  Wall = 4.;//cm
 
-  Float_t zlen1 = 159.5;//cm
-  Float_t zlen2 = 154.0;//cm
-  Float_t zlen3 = 124.0;//cm
+  // Sizes of TOF module with its support etc..
+  xTof = 2.*(fRmin*TMath::Tan(10*kDegrad)-Wall/2-.5);
+  yTof = fRmax-fRmin;
 
 //  TOF module internal definitions 
-  TOFpc(xtof, ytof, zlen1, zlen2, zlen3, ztof0);
+  TOFpc(xTof, yTof, fZlenC, fZlenB, fZlenA, fZtof);
 }
 
 //_____________________________________________________________________________
@@ -646,16 +206,13 @@ void AliTOF::DrawModule()
   gMC->Gsatt("ALIC","SEEN",0);
   //
   // Set the volumes visible
-  gMC->Gsatt("FBAR","SEEN",0);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
   //
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
@@ -674,7 +231,8 @@ void AliTOF::CreateMaterials()
 {
   //
   // Defines TOF materials for all versions
-  // Authors :   Maxim Martemianov, Boris Zagreev (ITEP)   18/09/98 
+  // Authors :   Maxim Martemianov, Boris Zagreev (ITEP) 
+  //            18/09/98 
   //
   Int_t   ISXFLD = gAlice->Field()->Integ();
   Float_t SXMGMX = gAlice->Field()->Max();
@@ -686,15 +244,15 @@ void AliTOF::CreateMaterials()
   Float_t   dq = 2.20;
   Int_t nq = -2;
   // --- Freon
-  Float_t afre[2]  = { 12.011,18.9984032 };
-  Float_t zfre[2]  = { 6.,9. };
-  Float_t wfre[2]  = { 5.,12. };
+  Float_t afre[2]  = {12.011,18.9984032 };
+  Float_t zfre[2]  = { 6., 9.};
+  Float_t wfre[2]  = { 5.,12.};
   Float_t densfre  = 1.5;
   Int_t nfre = -2;
   // --- CO2 
-  Float_t ac[2]   = { 12.,16. };
-  Float_t zc[2]   = { 6.,8. };
-  Float_t wc[2]   = { 1.,2. };
+  Float_t ac[2]   = {12.,16.};
+  Float_t zc[2]   = { 6., 8.};
+  Float_t wc[2]   = { 1., 2.};
   Float_t dc = .001977;
   Int_t nc = -2;
    // For mylar (C5H4O2) 
@@ -711,19 +269,19 @@ void AliTOF::CreateMaterials()
   Int_t npe = -2;
   // --- G10 
   Float_t ag10[4] = { 12.,1.,16.,28. };
-  Float_t zg10[4] = { 6.,1.,8.,14. };
+  Float_t zg10[4] = {  6.,1., 8.,14. };
   Float_t wmatg10[4] = { .259,.288,.248,.205 };
   Float_t densg10  = 1.7;
   Int_t nlmatg10 = -4;
   // --- DME 
   Float_t adme[5] = { 12.,1.,16.,19.,79. };
-  Float_t zdme[5] = { 6.,1.,8.,9.,35. };
+  Float_t zdme[5] = {  6.,1., 8., 9.,35. };
   Float_t wmatdme[5] = { .4056,.0961,.2562,.1014,.1407 };
   Float_t densdme  = .00205;
   Int_t nlmatdme = 5;
   // ---- ALUMINA (AL203) 
-  Float_t aal[2] = { 27.,16. };
-  Float_t zal[2] = { 13.,8. };
+  Float_t aal[2] = { 27.,16.};
+  Float_t zal[2] = { 13., 8.};
   Float_t wmatal[2] = { 2.,3. };
   Float_t densal  = 2.3;
   Int_t nlmatal = -2;
@@ -735,46 +293,48 @@ void AliTOF::CreateMaterials()
   Int_t nwa = -2;
   //
   //AliMaterial(0, "Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
-  AliMaterial(1, "Air$",14.61,7.3,0.001205,30423.24,67500.);
-  AliMaterial(2, "Cu $",  63.54, 29.0, 8.96, 1.43, 14.8);
-  AliMaterial(3, "C  $",  12.01,  6.0, 2.265,18.8, 74.4);
-  AliMixture(4, "Polyethilene$", ape, zpe, dpe, npe, wpe);
-  AliMixture(5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
-  AliMixture(6, "DME ", adme, zdme, densdme, nlmatdme, wmatdme);
-  AliMixture(7, "CO2$", ac, zc, dc, nc, wc);
-  AliMixture(8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal);
-  AliMaterial(9, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial( 1, "Air$",14.61,7.3,0.001205,30423.24,67500.);
+  AliMaterial( 2, "Cu $",  63.54, 29.0, 8.96, 1.43, 14.8);
+  AliMaterial( 3, "C  $",  12.01,  6.0, 2.265,18.8, 74.4);
+  AliMixture ( 4, "Polyethilene$", ape, zpe, dpe, npe, wpe);
+  AliMixture ( 5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
+  AliMixture ( 6, "DME ", adme, zdme, densdme, nlmatdme, wmatdme);
+  AliMixture ( 7, "CO2$", ac, zc, dc, nc, wc);
+  AliMixture ( 8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal);
+  AliMaterial( 9, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
   AliMaterial(10, "C-TRD$", 12.01, 6., 2.265*18.8/69.282*15./100, 18.8, 74.4); // for 15%
-  AliMixture(11, "Mylar$",  amy, zmy, dmy, nmy, wmy);
-  AliMixture(12, "Freon$",  afre, zfre, densfre, nfre, wfre);
-  AliMixture(13, "Quartz$", aq, zq, dq, nq, wq);
-  AliMixture(14, "Water$",  awa, zwa, dwa, nwa, wwa);
+  AliMixture (11, "Mylar$",  amy, zmy, dmy, nmy, wmy);
+  AliMixture (12, "Freon$",  afre, zfre, densfre, nfre, wfre);
+  AliMixture (13, "Quartz$", aq, zq, dq, nq, wq);
+  AliMixture (14, "Water$",  awa, zwa, dwa, nwa, wwa);
 
   Float_t epsil, stmin, deemax, stemax;
-  //       Previous data 
+  //   Previous data
   //       EPSIL  =  0.1   ! Tracking precision, 
   //       STEMAX = 0.1      ! Maximum displacement for multiple scattering
   //       DEEMAX = 0.1    ! Maximum fractional energy loss, DLS 
   //       STMIN  = 0.1 
-  //       New data from 
-  epsil  = .001;
-  stemax = -1.;
-  deemax = -.3;
+  //
+  //   New data  
+  epsil  = .001;  // Tracking precision,
+  stemax = -1.;   // Maximum displacement for multiple scattering
+  deemax = -.3;   // Maximum fractional energy loss, DLS
   stmin  = -.8;
 
-  AliMedium(1, "Air$", 1, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(2, "Cu $", 2, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(3, "C  $", 3, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(4, "Pol$", 4, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(5, "G10$", 5, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(6, "DME$", 6, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(7, "CO2$", 7, 0, ISXFLD, SXMGMX, 10., -.01, -.1, .01, -.01);
-  AliMedium(8, "ALUMINA$", 8, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(9, "Al Frame$", 9, 0, ISXFLD, SXMGMX, 10, stemax, deemax, epsil, stmin);
-  AliMedium(10, "DME-S$", 6, 1, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 1, "Air$"  ,  1, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 2, "Cu $"  ,  2, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 3, "C  $"  ,  3, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 4, "Pol$"  ,  4, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 5, "G10$"  ,  5, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 6, "DME$"  ,  6, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 7, "CO2$"  ,  7, 0, ISXFLD, SXMGMX, 10., -.01, -.1, .01, -.01);
+  AliMedium( 8,"ALUMINA$", 8, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 9,"Al Frame$",9, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium(10, "DME-S$",  6, 1, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
   AliMedium(11, "C-TRD$", 10, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(12, "Myl$", 11, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
-  AliMedium(13, "Fre$", 12, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium(12, "Myl$"  , 11, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
+  AliMedium(13, "Fre$"  , 12, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
   AliMedium(14, "Fre-S$", 12, 1, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
   AliMedium(15, "Glass$", 13, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
   AliMedium(16, "Water$", 14, 0, ISXFLD, SXMGMX, 10., stemax, deemax, epsil, stmin);
@@ -795,40 +355,416 @@ void AliTOF::Init()
   //
   // Initialise TOF detector after it has been built
   //
-  //
   // Set id of TOF sensitive volume
   if (IsVersion() !=0) fIdSens=gMC->VolId("FPAD");
   //
 }
 
+//____________________________________________________________________________
+void AliTOF::MakeBranch(Option_t* option)
+//
+// Initializes the Branches of the TOF inside the 
+// trees written for each event. 
+//  AliDetector::MakeBranch initializes just the 
+// Branch inside TreeH. Here we add the branch in 
+// TreeD.
+//
+{
+
+  AliDetector::MakeBranch(option);
+
+  Int_t buffersize = 4000;
+  Char_t branchname[10];
+  sprintf(branchname,"%s",GetName());
+  char *D = strstr(option,"D");
+
+  if (fDigits && gAlice->TreeD() && D){
+     gAlice->TreeD()->Branch(branchname,&fDigits,buffersize);
+     printf("Making Branch %s for digits \n",branchname);
+  }
+}
+
+//____________________________________________________________________________
+void AliTOF::FinishEvent()
+{
+//  Hits2Digits();
+}
+
+
+//____________________________________________________________________________
+void AliTOF::Hits2Digits(Int_t evNumber)
+//
+//  Starting from the Hits Tree (TreeH), this
+// function writes the Digits Tree (TreeD) storing 
+// the digits informations.
+// Has to be called just at the end of an event or 
+// at the end of a whole run.
+//  It could  also be called by AliTOF::Finish Event()
+// but it can be too heavy.
+// Just for MC events. 
+//
+// Called by the macro H2D.C
+//
+{
+  AliTOFhit* currentHit;
+  TTree    *TD, *TH;
+  Int_t    tracks[3];
+  Int_t    vol[5];
+  Float_t  digit[2];
+  TClonesArray* TOFhits=this->Hits();
+
+  Int_t nparticles = gAlice->GetEvent(evNumber); 
+  if (nparticles <= 0) return;
+
+  TD = gAlice->TreeD();
+  TH = gAlice->TreeH();
+  Int_t    ntracks =(Int_t) TH->GetEntries();
+  Int_t    nbytes, nhits;
+  TRandom *rnd = new TRandom();
+
+  for (Int_t ntk=0; ntk<ntracks; ntk++){
+
+     nbytes = TH->GetEvent(ntk);
+     nhits  = TOFhits->GetEntriesFast();
+
+     for (Int_t hit=0; hit<nhits; hit++){
+
+        currentHit = (AliTOFhit*)(TOFhits->At(hit));
+
+        vol[0] = currentHit->GetSector();
+        vol[1] = currentHit->GetPlate();
+        vol[2] = currentHit->GetPad_x();
+        vol[3] = currentHit->GetPad_z();
+        vol[4] = currentHit->GetStrip();
+
+        Float_t IdealTime = currentHit->GetTof();
+        Float_t TDCTime   = rnd->Gaus(IdealTime, fTimeRes);    
+        digit[0] = TDCTime;
+
+        Float_t IdealCharge = currentHit->GetEdep();
+        Float_t ADCcharge = rnd->Gaus(IdealCharge, fChrgRes);
+        digit[1] = ADCcharge;
+
+        Int_t Track = currentHit -> GetTrack();
+        tracks[0] = Track;
+       tracks[1] = 0;
+       tracks[2] = 0;
+
+        Bool_t Overlap = CheckOverlap(vol, digit, Track);
+        if(!Overlap) AddDigit(tracks, vol, digit);
+     }
+  }
+  TD->Fill();
+  TD->Write();  
+}
+
+//___________________________________________________________________________
+Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
+//
+// Checks if 2 or more hits belong to the same pad.
+// In this case the data assigned to the digit object
+// are the ones of the first hit in order of Time.
+//
+// Called only by Hits2Digits.
+//
+{
+        Bool_t Overlap = 0;
+        Int_t  vol2[5];
+
+        for (Int_t ndig=0; ndig<fNdigits; ndig++){
+          AliTOFdigit* currentDigit = (AliTOFdigit*)(fDigits->UncheckedAt(ndig));
+           currentDigit->GetLocation(vol2);
+           Bool_t Idem=1;
+           for (Int_t i=0;i<=4;i++){
+               if (vol[i]!=vol2[i]) Idem=0;}
+           if (Idem){
+             Float_t TDC2 = digit[0];
+              Float_t TDC1 = currentDigit->GetTdc();
+              if (TDC1>TDC2){
+                  currentDigit->SetTdc(TDC2); 
+                  currentDigit->SetAdc(digit[1]);
+              }
+              currentDigit->AddTrack(Track);
+              Overlap = 1;
+           }
+        }
+        return Overlap;
+}
+
+
+//____________________________________________________________________________
+void AliTOF::Digits2Raw(Int_t evNumber)
+//
+// Starting from digits, writes the 
+// Raw Data objects, i.e. a 
+// TClonesArray of 18 AliTOFRawSector objects
+//
+
+{
+  TTree* TD;
+
+  Int_t nparticles = gAlice->GetEvent(evNumber); 
+  if (nparticles <= 0) return;
+
+  TD = gAlice->TreeD();
+  
+  TClonesArray* TOFdigits = this->Digits();
+  Int_t ndigits = TOFdigits->GetEntriesFast();
+
+  TClonesArray* Raw = new TClonesArray("AliTOFRawSector",fNTof+2); 
+
+  for (Int_t isect=1;isect<=fNTof;isect++){
+     AliTOFRawSector* currentSector = (AliTOFRawSector*)Raw->UncheckedAt(isect);
+     TClonesArray* RocData = (TClonesArray*)currentSector->GetRocData();
+
+     for (Int_t digit=0; digit<ndigits; digit++){
+        AliTOFdigit* currentDigit = (AliTOFdigit*)TOFdigits->UncheckedAt(digit);
+        Int_t sector = currentDigit->GetSector();
+        if (sector==isect){
+           Int_t   Pad    = currentDigit -> GetTotPad();
+           Int_t   Roc    = (Int_t)(Pad/fNPadXRoc)-1;
+           if (Roc>=fNRoc) printf("Wrong n. of ROC ! Roc = %i",Roc);
+            Int_t   PadRoc = (Int_t) Pad%fNPadXRoc;
+           Int_t   Fec    = (Int_t)(PadRoc/fNFec)-1;
+            Int_t   Tdc    = (Int_t)(PadRoc%fNFec)-1;
+            Float_t Time   = currentDigit->GetTdc();
+            Float_t Charge = currentDigit->GetAdc();
+           AliTOFRoc* currentROC = (AliTOFRoc*)RocData->UncheckedAt(Roc);
+           Int_t Error    = 0;
+            currentROC->AddItem(Fec, Tdc, Error, Charge, Time);
+       }
+     }
+     
+     UInt_t TotSize=16,RocSize=0;
+     UInt_t RocHead[14],RocChek[14];
+     UInt_t GlobalCheckSum=0;
+
+     for (UInt_t iRoc = 1; iRoc<(UInt_t)fNRoc; iRoc++){
+        AliTOFRoc* currentRoc = (AliTOFRoc*)RocData->UncheckedAt(iRoc); 
+       RocSize  = currentRoc->Items*2+1;
+       TotSize += RocSize*4;
+       if (RocSize>=pow(2,16)) RocSize=0;
+       RocHead[iRoc]   = iRoc<<28;
+       RocHead[iRoc]  += RocSize;
+       RocChek[iRoc]   = currentRoc->GetCheckSum();
+        Int_t HeadCheck = currentRoc->BitCount(RocHead[iRoc]);
+       GlobalCheckSum += HeadCheck;
+       GlobalCheckSum += RocChek[iRoc];
+     }
+     
+     AliTOFRoc* DummyRoc = new AliTOFRoc();
+     TotSize *= 4;
+     if (TotSize>=pow(2,24)) TotSize=0;
+     UInt_t Header = TotSize;
+     UInt_t SectId = ((UInt_t)isect)<<24;
+     Header += SectId;
+     GlobalCheckSum += DummyRoc->BitCount(Header);
+     currentSector->SetGlobalCS(GlobalCheckSum);
+     currentSector->SetHeader(Header);
+  }  
+}
+//____________________________________________________________________________
+void AliTOF::Raw2Digits(Int_t evNumber)
+//
+//  Converts Raw Data objects into digits objects.
+//  We schematize the raw data with a 
+//  TClonesArray of 18 AliTOFRawSector objects
+//
+{
+  TTree    *TD;
+  Int_t    vol[5];
+  Int_t    tracks[3];
+  Float_t  digit[2];
+  tracks[0]=0;
+  tracks[1]=0;
+  tracks[2]=0;
  
+  Int_t nparticles = gAlice->GetEvent(evNumber); 
+  if (nparticles <= 0) return;
+
+  TD = gAlice->TreeD();
+  
+  TClonesArray* Raw = new TClonesArray("AliTOFRawSector",fNTof+2);
+  
+  for(Int_t nSec=1; nSec<=fNTof; nSec++){
+     AliTOFRawSector* currentSector = (AliTOFRawSector*)Raw->UncheckedAt(nSec);
+     TClonesArray* RocData = (TClonesArray*)currentSector->GetRocData();
+     for(Int_t nRoc=1; nRoc<=14; nRoc++){
+        AliTOFRoc* currentRoc = (AliTOFRoc*)RocData->UncheckedAt(nRoc);
+        Int_t currentItems = currentRoc->GetItems();
+        for(Int_t item=1; item<currentItems; item++){ 
+           Int_t nPad = currentRoc->GetTotPad(item);        
+          vol[0] = nSec;
+          Int_t nStrip = (Int_t)(nPad/fPadXStr)+1;
+          Int_t nPlate = 5;
+          if (nStrip<=fNStripC+2*fNStripB+fNStripA) nPlate = 4;
+          if (nStrip<=fNStripC+fNStripB+fNStripA)   nPlate = 3;
+          if (nStrip<=fNStripC+fNStripB)            nPlate = 2;
+          if (nStrip<=fNStripC)                     nPlate=1;
+          vol[1] = nPlate;
+          switch (nPlate){
+          case 1: break;
+          case 2: nStrip -= (fNStripC);
+                  break;
+          case 3: nStrip -= (fNStripC+fNStripB);
+                  break;
+          case 4: nStrip -= (fNStripC+fNStripB+fNStripA);
+                  break;
+          case 5: nStrip -= (fNStripC+2*fNStripB+fNStripA);
+                  break;
+          }
+           vol[2] = nStrip;
+           Int_t Pad = nPad%fPadXStr;
+          if (Pad==0) Pad=fPadXStr;
+          Int_t nPadX=0, nPadZ=0;
+          (Pad>fNpadX)? nPadX -= fNpadX : nPadX = Pad ;
+          vol[3] = nPadX;
+          (Pad>fNpadX)? nPadZ = 2 : nPadZ = 1 ;
+          vol[4] = nPadZ;
+          UInt_t error=0;
+          Float_t TDC = currentRoc->GetTime(item,error);
+          if (!error) digit[0]=TDC;
+          digit[1] = currentRoc->GetCharge(item);
+          AddDigit(tracks,vol,digit);
+        }
+     }
+  }
+  TD->Fill();
+  TD->Write();
+} 
+
+
+/******************************************************************************/
+
 ClassImp(AliTOFhit)
  
-//___________________________________________
-AliTOFhit::AliTOFhit(Int_t shunt, Int_t track, Int_t sector, Int_t plate, Int_t pad_x, Int_t pad_z, Float_t *hits):
-  AliHit(shunt, track)
+//______________________________________________________________________________
+AliTOFhit::AliTOFhit(Int_t shunt, Int_t track, Int_t *vol,
+                     Float_t *hits)
+:AliHit(shunt, track)
+//
+// Constructor of hit object
+//
 {
   //
   // Store a TOF hit
+  // _______________
   //
-  
-  fSector=sector;
-  fPlate=plate;
-  fPad_x=pad_x;
-  fPad_z=pad_z;
+  // Hit Volume
+  // 
+  fSector= vol[0];
+  fPlate = vol[1];
+  fStrip = vol[2];
+  fPad_x = vol[3];
+  fPad_z = vol[4];
   //
-  // Position
-  fX=hits[0];
-  fY=hits[1];
-  fZ=hits[2];
+  //Position
+  fX = hits[0];
+  fY = hits[1];
+  fZ = hits[2];
   //
   // Momentum
-  fPx=hits[3];
-  fPy=hits[4];
-  fPz=hits[5];
-  fPmom=hits[6];
+  fPx  = hits[3];
+  fPy  = hits[4];
+  fPz  = hits[5];
+  fPmom= hits[6];
   //
   // Time Of Flight
-  fTof=hits[7];
+  fTof = hits[7];   //TOF[s]
+  //
+  // Other Data
+  fDx  = hits[8];   //Distance from the edge along x axis
+  fDy  = hits[9];   //Y cohordinate of the hit
+  fDz  = hits[10];  //Distance from the edge along z axis
+  fIncA= hits[11];  //Incidence angle
+  fEdep= hits[12];  //Energy loss in TOF pad
+}
+
+//******************************************************************************
+
+ClassImp(AliTOFdigit)
+
+//______________________________________________________________________________
+AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
+:AliDigit(tracks)
+//
+// Constructor of digit object
+//
+{
+  fSector = vol[0];
+  fPlate  = vol[1];
+  fStrip  = vol[2];
+  fPad_x  = vol[3];
+  fPad_z  = vol[4];
+  fTdc    = digit[0];
+  fAdc    = digit[1];
+}
+
+//______________________________________________________________________________
+void AliTOFdigit::GetLocation(Int_t *Loc)
+//
+// Get the cohordinates of the digit
+// in terms of Sector - Plate - Strip - Pad
+//
+{
+   Loc[0]=fSector;
+   Loc[1]=fPlate;
+   Loc[2]=fStrip;
+   Loc[3]=fPad_x;
+   Loc[4]=fPad_z;
+}
+
+//______________________________________________________________________________
+Int_t AliTOFdigit::GetTotPad()
+//
+// Get the "total" index of the pad inside a Sector
+// starting from the digits data.
+//
+{
+  AliTOF* TOF;
+  
+  if(gAlice){
+     TOF =(AliTOF*) gAlice->GetDetector("TOF");
+  }else{
+     printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting");
+     return 0;
+  }
+  
+  Int_t Pad = fPad_x+TOF->fNpadX*(fPad_z-1);
+  Int_t Before=0;
+
+  switch(fPlate){ 
+  case 1: Before = 0;
+          break;
+  case 2: Before = TOF->fNStripC;
+          break;
+  case 3: Before = TOF->fNStripB + TOF->fNStripC;
+          break;
+  case 4: Before = TOF->fNStripA + TOF->fNStripB + TOF->fNStripC;
+          break;
+  case 5: Before = TOF->fNStripA + 2*TOF->fNStripB + TOF->fNStripC;
+          break;
+  }
+  
+  Int_t Strip = fStrip+Before;
+  Int_t PadTot = TOF->fPadXStr*(Strip-1)+Pad;
+  return PadTot;
+}
+
+//______________________________________________________________________________
+void AliTOFdigit::AddTrack(Int_t track)
+//
+// Add a track to the digit 
+//
+{
+  if (fTracks[1]==0){
+     fTracks[1] = track;
+  }else if (fTracks[2]==0){
+     fTracks[2] = track;
+  }else{
+     printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
+  }
 }
 
index 31a36eca79dcef75ec7fcbebde51f048aee83823..fc94a7286483711778adda570fc7f72fe92abbc3 100644 (file)
@@ -6,35 +6,80 @@
 /* $Id$ */
 
 ////////////////////////////////////////////////
-//  Manager and hits classes for set:TOF     //
+//  Manager and hits classes for set: TOF     //
 ////////////////////////////////////////////////
  
 #include "AliDetector.h"
 #include "AliHit.h"
+#include "AliDigit.h" 
+#include "TObject.h"
+#include "AliTOFD.h"
+
 class AliTOF : public AliDetector {
 
 protected:
-   Int_t fIdSens;
+  Int_t   fIdSens;
+
+public:
+  Int_t   fNTof;
+  Float_t fRmax;
+  Float_t fRmin;
+  Float_t fZlenA;
+  Float_t fZlenB;
+  Float_t fZlenC;
+  Float_t fZtof;
+   
+  Float_t fStripLn;
+  Float_t fSpace;
+  Float_t fDeadBndZ;
+  Float_t fDeadBndX;
+  Float_t fXpad;
+  Float_t fZpad;
+  Float_t fGapA;
+  Float_t fGapB;
+  Float_t fOverSpc;
+  Int_t   fNpadX;
+  Int_t   fNpadZ;
+  Int_t   fPadXStr;
+
+  Int_t   fNStripA;
+  Int_t   fNStripB;
+  Int_t   fNStripC;
+
+  Float_t fTimeRes;
+  Float_t fChrgRes;
+  
+  Int_t   fPadXSector;
+  Int_t   fNRoc;
+  Int_t   fNFec;
+  Int_t   fNTdc;
+  Int_t   fNPadXRoc;
+
+
 public:
   AliTOF();
   AliTOF(const char *name, const char *title);
   virtual        ~AliTOF() {}
-  virtual void    AddHit(Int_t, Int_t, Int_t, Int_t, Int_t, Float_t*);
-  virtual void    AddHit(Int_t track, Int_t *vol, Float_t*hits)
-  { AddHit(track, vol[0], vol[1], vol[2], vol[3], hits);}
-  virtual void    BuildGeometry();
+  virtual void    AddHit(Int_t track, Int_t* vol, Float_t* hits);
+  virtual void    AddDigit(Int_t*, Int_t*, Float_t*);
   virtual void    CreateGeometry();
   virtual void    CreateMaterials();
   virtual void    Init();
+  virtual void    MakeBranch(Option_t*);
+  virtual void    FinishEvent();
   virtual Int_t   IsVersion() const =0;
   Int_t           DistancetoPrimitive(Int_t px, Int_t py);
   virtual void    StepManager()=0;
-  virtual void    TOFpc(Float_t, Float_t, Float_t, Float_t, Float_t,Float_t) {}
+  virtual void    TOFpc(Float_t, Float_t, Float_t,
+                        Float_t, Float_t,Float_t) {}
   virtual void    DrawModule();
+          void    Hits2Digits(Int_t evNumber=0);
+          void    Digits2Raw (Int_t evNumber=0);
+          void    Raw2Digits (Int_t evNumber=0);
   
+private:
+       Bool_t    CheckOverlap(Int_t*, Float_t*, Int_t);
+
   ClassDef(AliTOF,1)  // Time Of Flight base class
 };
  
@@ -44,20 +89,69 @@ class AliTOFhit : public AliHit {
 public:
   Int_t      fSector;  // number of sector 
   Int_t      fPlate;   // number of plate
+  Int_t      fStrip;   // number of strip
   Int_t      fPad_x;   // number of pad along x
   Int_t      fPad_z;   // number of pad along z
-  Float_t    fPx;         // px in TOF
-  Float_t    fPy;         // py in TOF
-  Float_t    fPz;         // pz in TOF
-  Float_t    fPmom;       // P in TOF
-  Float_t    fTof;        // Time of Flight
+  Float_t    fPx;      // px in TOF
+  Float_t    fPy;      // py in TOF
+  Float_t    fPz;      // pz in TOF
+  Float_t    fPmom;    // P in TOF
+  Float_t    fTof;     // Time of Flight
+  Float_t    fDx;      // x of impact point in pad r.s.
+  Float_t    fDy;      // y of impact point in pad r.s.
+  Float_t    fDz;      // z of impact point in pad r.s.
+  Float_t    fIncA;    // Incidence angle
+  Float_t    fEdep;    // Energy lost in tof layer
  
 public:
   AliTOFhit() {}
-  AliTOFhit(Int_t shunt, Int_t track, Int_t sector, Int_t plate, Int_t pad_x, Int_t pad_z, Float_t *hits);
+  AliTOFhit(Int_t shunt, Int_t track, Int_t* vol, 
+            Float_t *hits);
   virtual ~AliTOFhit() {}
+
+  inline  Int_t   GetSector() {return fSector;}
+  inline  Int_t   GetPlate()  {return fPlate;}
+  inline  Int_t   GetPad_x()  {return fPad_x;}
+  inline  Int_t   GetPad_z()  {return fPad_z;}
+  inline  Int_t   GetStrip()  {return (Int_t)(fPad_z*0.5);}
+  inline  Float_t GetTof()    {return fTof;}
+  inline  Float_t GetMom()    {return fPmom;}
+  inline  Float_t GetDx()     {return fDx;}
+  inline  Float_t GetDz()     {return fDz;}
+  inline  Float_t GetIncA()   {return fIncA;}
+  inline  Float_t GetEdep()   {return fEdep;}
+
   ClassDef(AliTOFhit,1)  // Hits for Time Of Flight
 };
+
+//_______________________________________________________
+
+class AliTOFdigit : public AliDigit {
+
+ public:
+  Int_t   fSector;
+  Int_t   fPlate;
+  Int_t   fStrip;
+  Int_t   fPad_x;
+  Int_t   fPad_z;
+  Float_t fTdc;
+  Float_t fAdc;
+
+ public:
+  AliTOFdigit(){}
+  AliTOFdigit(Int_t*, Int_t*, Float_t*);
+  virtual ~AliTOFdigit(){}
+  void            GetLocation(Int_t*);
+  Int_t           GetTotPad();
+  void            AddTrack(Int_t);
+
+  inline  Float_t GetTdc()           {return fTdc;}
+  inline  Float_t GetAdc()           {return fAdc;}
+  inline  Int_t   GetSector()        {return fSector;}
+  inline  void    SetTdc(Float_t TDC){fTdc = TDC;}
+  inline  void    SetAdc(Float_t ADC){fAdc = ADC;}
+
+  ClassDef(AliTOFdigit,2)  // Digits for Time Of Flight
+};
+
 #endif
diff --git a/TOF/AliTOFD.cxx b/TOF/AliTOFD.cxx
new file mode 100644 (file)
index 0000000..d2e1247
--- /dev/null
@@ -0,0 +1,309 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+#include "AliTOF.h"
+#include "AliTOFD.h"
+#include "TObject.h"
+
+//******************************************************************************
+
+ClassImp(AliTOFRawDigit)
+
+//______________________________________________________________________________
+AliTOFRawDigit::AliTOFRawDigit()
+//
+// Constructor of AliTOFRawDigit class
+//
+{
+  fTreeD     = 0;
+  fRawDigits = 0;
+}
+
+//******************************************************************************
+
+ClassImp(AliTOFRoc)
+
+//______________________________________________________________________________
+AliTOFRoc::AliTOFRoc()
+//
+// Constructor of AliTOFRoc class
+// The class represents a ROC in the TARODA system
+//
+{
+  Items = 0;
+  Size  = 0;
+}
+
+//______________________________________________________________________________
+AliTOFRoc::~AliTOFRoc(){}
+
+//______________________________________________________________________________
+Int_t AliTOFRoc::AddItem(Int_t Fec, Int_t Tdc, Int_t Error,
+                         Float_t Charge, Float_t Time)
+//
+// Adds an item (i.e. the charge, the TOF and the 
+// cohordinates of a hit pad) to the ROC class.
+//
+{
+   Items++;
+   SetCharge(Items,Fec,Tdc,Charge);
+   SetTime  (Items,Error,Time);
+   return Items;   
+}
+
+//______________________________________________________________________________
+void AliTOFRoc::SetHeader()
+//
+// Calculate the header line of the ROC in the raw data file
+//
+{
+   Header  = NRoc<<28;
+   Header += Size;
+}
+
+
+//______________________________________________________________________________
+void AliTOFRoc::SetTime(UInt_t Item, UInt_t Error, Float_t RealTime)
+//
+// Calculate the raw data line relative to the TDC
+// output of a pad in the current ROC.
+//
+{
+   UInt_t Itime;
+   Itime = (UInt_t)(RealTime/50.);
+   if (Itime >= pow(2,24)) Itime = 2^24-1;
+   Error <<= 24;
+   TimeRow[Item]= Error+Itime;
+}
+
+//______________________________________________________________________________
+void AliTOFRoc::SetCharge(UInt_t Item, UInt_t Fec, UInt_t Tdc, Float_t RealCharge)
+//
+// Calculate the raw data line relative to the ADC 
+// output of a pad in the current ROC.
+//
+{
+   UInt_t ICharge;
+   if (NRoc>=pow(2,4)) NRoc = 0;
+   NRoc <<= 28;
+   if (Fec >=pow(2,6))  Fec = 0;
+   Fec  <<= 22;
+   if (Tdc >=pow(2,6))  Tdc = 0;
+   Tdc  <<= 16;
+   ICharge = (UInt_t)(RealCharge/50.);
+   if(ICharge>=pow(2,16)) ICharge = (UInt_t)pow(2,16)-1;
+   ChrgRow[Item] = ICharge+NRoc+Fec+Tdc;
+}
+
+//______________________________________________________________________________
+void AliTOFRoc::SetTime(UInt_t Item, UInt_t tir)
+//
+// Writes the raw data line relative to the TDC
+//
+{
+   ChrgRow[Item]=tir;
+}
+
+//______________________________________________________________________________
+void AliTOFRoc::SetCharge(UInt_t Item, UInt_t chr)
+//
+// Writes the raw data line relative to the ADC
+//
+{
+   ChrgRow[Item]=chr;
+}
+
+//______________________________________________________________________________
+Float_t AliTOFRoc::GetCharge(Int_t Item)
+//
+// Reads the effective value of the charge starting
+// from the line of the raw data
+//
+{
+   UInt_t  Charge  = ChrgRow[Item]&0x0000ffff;
+   Float_t ACharge = (Float_t)Charge*50.;
+   return ACharge;
+}
+
+//______________________________________________________________________________
+Float_t AliTOFRoc::GetTime(Int_t Item, UInt_t& Error)
+//
+// Reads the effective value of the time of flight starting
+// from the line of the raw data
+//
+{
+   UInt_t  Time  = TimeRow[Item]&0x00ffffff;
+   Float_t ATime = (Float_t)Time*50.;
+   Error = TimeRow[Item]>>24;
+   return ATime; 
+}
+
+//______________________________________________________________________________
+Int_t AliTOFRoc::GetTotPad(Int_t Item)
+//
+// Reads the cohordinates of the pad starting
+// from the line of the raw data
+//
+{
+   UInt_t NRoc = (ChrgRow[Item]&0xf0000000)>>28;
+   UInt_t NFec = (ChrgRow[Item]&0x0fc00000)>>22;
+   UInt_t NTdc = (ChrgRow[Item]&0x003f0000)>>16;
+   UInt_t Pad = NRoc*32*32+NFec*32+NTdc;
+   return Pad; 
+}
+
+//______________________________________________________________________________
+UInt_t AliTOFRoc::GetCheckSum()
+//
+// Calculate the checksum word of the current ROC
+// 
+{
+   UInt_t CheckSum=0;
+   for(Int_t i=0; i<Items; i++){
+      CheckSum += BitCount(GetChrgRow(i));
+      CheckSum += BitCount(GetTimeRow(i));
+   }
+   return CheckSum;
+}
+
+//______________________________________________________________________________
+UInt_t AliTOFRoc::BitCount(UInt_t x)
+//
+// Count the "1" bit in the current word
+//
+{
+   UInt_t count=0;
+   for (count=0; x!=0; x>>=1){
+      if(x&0x00000001) count++;
+   }
+   return count;
+}
+
+//______________________________________________________________________________
+UInt_t AliTOFRoc::SetSize()
+//
+// Reads the size of data from current ROC starting
+// from the header line of the raw data
+//
+{
+   Size = Header&0x0000ffff;
+   Items = (Size-4)/4;
+   return Size;
+}
+
+
+//******************************************************************************
+
+ClassImp(AliTOFRawSector)
+
+//______________________________________________________________________________
+AliTOFRawSector::AliTOFRawSector()
+//
+// Constructor of AliTOFRawSector class
+// Each sector is in effect a 
+// TClonesArray of 14 AliTOFRoc Objects
+//
+{
+   fRocData = new TClonesArray("AliTOFRoc",14);   
+}
+
+//______________________________________________________________________________
+AliTOFRawSector::~AliTOFRawSector()
+{
+   delete fRocData;
+}
+
+//______________________________________________________________________________
+void AliTOFRawSector::WriteSector()
+//
+// Starting from the raw data objects writes a binary file
+// similar to real raw data.
+//
+{
+    FILE *rawfile;
+    rawfile = fopen("rawdata.dat","w");
+    
+//    fprintf(rawfile,Header);
+    
+    Int_t nRoc;
+    
+    for(nRoc=1; nRoc<=14; nRoc++){
+       AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc);
+       currentRoc->SetHeader;
+       UInt_t RocHeader = currentRoc->Header;
+//      fprintf(rawfile,RocHeader);
+    }
+    
+    for(nRoc=1; nRoc<=14; nRoc++){
+       AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc);
+       Int_t rocItems = currentRoc->Items;
+
+       for(Int_t nItem=1; nItem<=rocItems;nItem++){
+          UInt_t TimeRow = currentRoc->GetTimeRow(nItem);
+//          fprintf(rawfile,TimeRow);
+          UInt_t ChrgRow = currentRoc->GetTimeRow(nItem);
+//          fprintf(rawfile,ChrgRow);
+       }
+    }
+    
+    UInt_t EndOfSector = GlobalCheckSum;
+//    fprintf(rawfile,EndOfSector);
+}
+
+//______________________________________________________________________________
+void AliTOFRawSector::ReadSector()
+//
+// Starting from raw data initialize and write the 
+// Raw Data objects 
+//(i.e. a TClonesArray of 18 AliTOFRawSector)
+//
+{
+    FILE *rawfile;
+    rawfile = fopen("rawdata.dat","r");
+    
+//    fscanf(rawfile,Header);
+    Int_t nRoc;
+    
+    for(nRoc=1; nRoc<=14; nRoc++){
+       AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc);
+       UInt_t RocHeader;
+ //      fscanf(rawfile,RocHeader);
+       currentRoc->SetHeader(RocHeader);
+    }
+    
+    UInt_t SCMWord;
+//    fscanf(rawfile,SCMWord);
+    
+    for(nRoc=1; nRoc<=14; nRoc++){
+       AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc);
+       Int_t Size = currentRoc->SetSize();
+       Int_t nItems = currentRoc->Items;
+       for(Int_t nrow=0; nrow<=nItems; nrow++){
+          UInt_t charRow,timeRow;
+//       fscanf(rawfile, charRow);
+         currentRoc->SetTime(nrow, charRow);
+//         fscanf(rawfile, timeRow);
+         currentRoc->SetTime(nrow, timeRow);
+       }
+       Int_t FinalWord;
+//       fscanf(rawfile,FinalWord);              
+    }
+//    fscanf(rawfile,GlobalCheckSum);
+}
+
diff --git a/TOF/AliTOFD.h b/TOF/AliTOFD.h
new file mode 100644 (file)
index 0000000..257462b
--- /dev/null
@@ -0,0 +1,107 @@
+#ifndef TOFD_H
+#define TOFD_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  Digitization classes for set: TOF     //
+////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "TClonesArray.h"
+#include "AliTOF.h"
+//_______________________________________________________
+
+class AliTOFRoc : public TObject {
+
+ public:
+  Int_t   Items;
+  Int_t   Size;
+  Int_t   NRoc;
+  UInt_t  Header;
+  
+/*  class ChargeRow
+  {
+  public:
+    UInt_t RocID:4;
+    UInt_t FecID:6;
+    UInt_t TdcID:6;
+    Int_t  ChADC:16;
+  }Charge[1024];
+  
+  class TimeRow
+  {
+  public:
+    UInt_t Error:12;
+    Int_t  TDC  :24;
+  }Time[1024];
+*/
+  UInt_t ChrgRow[1024];
+  UInt_t TimeRow[1024];
+
+ public:
+  AliTOFRoc();
+  virtual ~AliTOFRoc();
+  Int_t   AddItem  (Int_t, Int_t, Int_t, Float_t, Float_t);
+//  Int_t   AddItem  (Int_t, UInt_t);
+  void    SetHeader();
+  void    SetTime  (UInt_t, UInt_t, Float_t);
+  void    SetTime  (UInt_t, UInt_t);
+  void    SetCharge(UInt_t, UInt_t,UInt_t,Float_t);  
+  void    SetCharge(UInt_t, UInt_t);  
+  Float_t GetTime  (Int_t,UInt_t&);
+  Float_t GetCharge(Int_t);
+  Int_t   GetTotPad(Int_t);
+  UInt_t  GetCheckSum();
+  UInt_t  BitCount (UInt_t);
+  UInt_t  SetSize  ();
+  
+  inline Int_t  GetSize()          {return Items*8+4;}
+  inline Int_t  GetItems()         {return Items;}
+  inline UInt_t GetChrgRow(Int_t i){return ChrgRow[i];}
+  inline UInt_t GetTimeRow(Int_t i){return TimeRow[i];} 
+  inline void   SetHeader(UInt_t head){Header=head;}
+  ClassDef(AliTOFRoc,2)
+};
+
+//_______________________________________________________
+class AliTOFRawDigit : public TObject{
+
+public:
+  Int_t fTreeD;
+  Int_t fRawDigits;
+  
+public:
+  AliTOFRawDigit();
+  virtual ~AliTOFRawDigit(){};
+  
+  ClassDef(AliTOFRawDigit,2)
+};
+
+
+//_______________________________________________________
+class AliTOFRawSector : public TObject{
+
+ public:
+  TClonesArray  *fRocData;
+  UInt_t        Header;
+  UInt_t        GlobalCheckSum;
+
+ public:
+  AliTOFRawSector();
+  virtual ~AliTOFRawSector();
+  void   WriteSector();
+  void   ReadSector();
+  
+  inline TClonesArray  *GetRocData() {return fRocData;}
+  inline void SetGlobalCS(UInt_t gcs){GlobalCheckSum=gcs;}
+  inline void SetHeader  (UInt_t hdr){Header = hdr;}
+  
+  ClassDef(AliTOFRawSector,2)
+};
+
+#endif
index 960c801949744e54121ab0b241795c3971aee376..85324ca1d54ea183d2a5a73f6fccd4597e56a20d 100644 (file)
 
 /*
 $Log$
+Revision 1.14.2.1  2000/05/10 09:37:16  vicinanz
+New version with Holes for PHOS/RICH
+
 Revision 1.14  1999/11/05 22:39:06  fca
 New hits structure
 
-Revision 1.13  1999/11/01 20:41:57  fca
+Revision 1.13  1999/11/02 11:26:39  fca
+added stdlib.h for exit
+
+Revision 1.12  1999/11/01 20:41:57  fca
 Added protections against using the wrong version of FRAME
 
-Revision 1.12  1999/10/22 08:04:14  fca
+Revision 1.11  1999/10/22 08:04:14  fca
 Correct improper use of negative parameters
 
-Revision 1.11  1999/10/16 19:30:05  fca
+Revision 1.10  1999/10/16 19:30:06  fca
 Corrected Rotation Matrix and CVS log
 
-Revision 1.10  1999/10/15 15:35:20  fca
+Revision 1.9  1999/10/15 15:35:20  fca
 New version for frame1099 with and without holes
 
-Revision 1.9  1999/09/29 09:24:33  fca
+Revision 1.8  1999/09/29 09:24:33  fca
 Introduction of the Copyright and cvs Log
 
 */
@@ -43,12 +49,10 @@ Introduction of the Copyright and cvs Log
 //
 //  VERSION WITH 5 MODULES AND TILTED STRIPS 
 //  
-//   WITH HOLES FOR PHOS AND HMPID inside the 
-//   SPACE FRAME WITH HOLES
-//
+//   FULL COVERAGE VERSION
 //
 //   Authors:
-//  
+//
 //   Alessio Seganti
 //   Domenico Vicinanza
 //
@@ -67,6 +71,9 @@ Introduction of the Copyright and cvs Log
 #include <stdlib.h>
 
 #include "AliTOFv0.h"
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
 #include "AliRun.h"
 #include "AliConst.h"
  
@@ -78,15 +85,7 @@ AliTOFv0::AliTOFv0()
   //
   // Default constructor
   //
-}
-//_____________________________________________________________________________
-AliTOFv0::AliTOFv0(const char *name, const char *title)
-       : AliTOF(name,title)
-{
-  //
-  // Standard constructor
-  //
+
   //
   // Check that FRAME is there otherwise we have no place where to
   // put TOF
@@ -94,14 +93,104 @@ AliTOFv0::AliTOFv0(const char *name, const char *title)
   if(!FRAME) {
     Error("Ctor","TOF needs FRAME to be present\n");
     exit(1);
-  } else 
-    if(FRAME->IsVersion()!=0) {
-      Error("Ctor","FRAME version 0 needed with this version of TOF\n");
+  } else
+    if(FRAME->IsVersion()!=1) {
+      Error("Ctor","FRAME version 1 needed with this version of TOF\n");
       exit(1);
     }
 
 }
  
+//_____________________________________________________________________________
+AliTOFv0::AliTOFv0(const char *name, const char *title)
+       : AliTOF(name,title)
+{
+  //
+  // Standard constructor
+  //
+}
+//_____________________________________________________________________________
+void AliTOFv0::BuildGeometry()
+{
+  // Build TOF ROOT geometry for the ALICE event viewver
+  //
+  TNode *Node, *Top;
+  const int kColorTOF  = 27;
+
+  // Find top TNODE
+  Top = gAlice->GetGeometry()->GetNode("alice");
+
+  // Position the different copies
+  const Float_t rTof  =(fRmax+fRmin)/2;
+  const Float_t hTof  = fRmax-fRmin;
+  const Int_t   fNTof = 18;
+  const Float_t kPi   = TMath::Pi();
+  const Float_t angle = 2*kPi/fNTof;
+  Float_t ang;
+
+  // Define TOF basic volume
+  
+  char NodeName0[6], NodeName1[6], NodeName2[6]; 
+  char NodeName3[6], NodeName4[6], RotMatNum[6];
+
+  new TBRIK("S_TOF_C","TOF box","void",
+            120*0.5,hTof*0.5,fZlenC*0.5);
+  new TBRIK("S_TOF_B","TOF box","void",
+            120*0.5,hTof*0.5,fZlenB*0.5);
+  new TBRIK("S_TOF_A","TOF box","void",
+            120*0.5,hTof*0.5,fZlenA*0.5);
+
+  for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
+     
+      if (NodeNum<10) {
+           sprintf(RotMatNum,"rot50%i",NodeNum);
+           sprintf(NodeName0,"FTO00%i",NodeNum);
+           sprintf(NodeName1,"FTO10%i",NodeNum);
+           sprintf(NodeName2,"FTO20%i",NodeNum);
+           sprintf(NodeName3,"FTO30%i",NodeNum);
+           sprintf(NodeName4,"FTO40%i",NodeNum);
+      }
+      if (NodeNum>9) {
+           sprintf(RotMatNum,"rot5%i",NodeNum);
+           sprintf(NodeName0,"FTO0%i",NodeNum);
+           sprintf(NodeName1,"FTO1%i",NodeNum);
+           sprintf(NodeName2,"FTO2%i",NodeNum);
+           sprintf(NodeName3,"FTO3%i",NodeNum);
+           sprintf(NodeName4,"FTO4%i",NodeNum);
+      }
+      new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
+      ang = (4.5-NodeNum) * angle;
+
+      Top->cd();
+      Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd(); 
+      Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+  }
+}
+
 //_____________________________________________________________________________
 void AliTOFv0::CreateGeometry()
 {
@@ -120,123 +209,123 @@ void AliTOFv0::CreateGeometry()
 }
  
 //_____________________________________________________________________________
-void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
+void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
+                    Float_t zlenB, Float_t zlenA, Float_t ztof0)
 {
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
   
-  Float_t  ycoor;
+  Float_t  ycoor, zcoor;
   Float_t par[10];
+  Int_t *idtmed = fIdtmed->GetArray()-499;
   Int_t idrotm[100];
   Int_t nrot = 0;
   
-  Int_t *idtmed = fIdtmed->GetArray()-499;
+  Float_t Radius = fRmin+2.;//cm
 
-
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenC * 0.5;
+  gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenB * 0.5;
+  gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
 
 
 // Positioning of modules
 
-   Float_t zcoor;
-
-   Float_t zcor1 = ztof0 - zlen1/2;
-   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
+   Float_t zcor1 = ztof0 - zlenC*0.5;
+   Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
    Float_t zcor3 = 0.;
 
    AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
    AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   zcoor = (zlen1/2.);
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-   zcoor = 0.;
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcoor, 0, idrotm[0], "ONLY");
-   
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   zcoor = -zlen2/2.;
-   gMC->Gspos("FTO2", 0, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-
-// Subtraction the distance to TOF module boundaries 
-
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
-
-  xFLT = xtof -(.5 +.5)*2;
+   gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
+
+  Float_t db = 0.5;//cm
+  Float_t xFLT, yFLT, zFLTA, zFLTB, zFLTC;
+
+  xFLT = 122.0;//cm
   yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
-    
+  zFLTA = zlenA - db*0.5;
+  zFLTB = zlenB - db*0.5;
+  zFLTC = zlenC - db*0.5;
+
 // Sizes of MRPC pads
 
-  Float_t yPad = 0.505; 
+  Float_t yPad = 0.505;//cm 
   
 // Large not sensitive volumes with CO2 
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
 
   cout <<"************************* TOF geometry **************************"<<endl;
 
-  par[2] = (zFLT1 / 2.);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTA *0.5);
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT2 / 2.);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTB * 0.5);
+  gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT3 / 2.); 
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTC * 0.5); 
+  gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
 
 ////////// Layers before detector ////////////////////
 
-// Alluminium layer in front 1.0 mm thick at the beginning
+// MYlar layer in front 1.0 mm thick at the beginning
   par[0] = -1;
-  par[1] = 0.1;
+  par[1] = 0.1;//cm
   par[2] = -1;
   ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
+  gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium 
+  gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// honeycomb (special Polyethilene Layer of 1cm)
   ycoor = ycoor + par[1];
   par[0] = -1;
-  par[1] = 0.5;
+  par[1] = 0.5;//cm
   par[2] = -1;
   ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 ///////////////// Detector itself //////////////////////
 
-  const Float_t StripWidth = 7.81;//cm
-  const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
-  const Int_t nx = 40; // number of pads along x
-  const Int_t nz = 2;  // number of pads along z
-  const Float_t Gap=4.; //cm  distance between the strip axis
-  const Float_t Space = 5.5; //cm distance from the front plate of the box
+  const Float_t  StripWidth = 10.0;//cm
+  const Float_t  DeadBound  =  1.5;//cm non-sensitive between the pad edge 
+                                   //and the boundary of the strip
+  const Int_t    nx   = 48;        // number of pads along x
+  const Int_t    nz   =  2;        // number of pads along z
+  const Float_t  Space=  5.5;      //cm distance from the front plate of the box
 
   Float_t zSenStrip;
   zSenStrip = StripWidth-2*DeadBound;//cm
@@ -245,186 +334,243 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
   par[1] = yPad/2; 
   par[2] = StripWidth/2.;
   
-  // Glass Layer of detector
+  // glass layer of detector STRip
   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
 
-  // Freon for non-sesitive boundaries
-  par[0] = xFLT/2;
-  par[1] = 0.110/2;
+  // Non-Sesitive Freon boundaries
+  par[0] =  xFLT*0.5;
+  par[1] =  0.110*0.5;//cm
   par[2] = -1;
   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
-  gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
-  // Mylar for non-sesitive boundaries
-  par[1] = 0.025;
+  gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
+
+  // MYlar for Internal non-sesitive boundaries
+  par[1] = 0.025;//cm
   gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
-  gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
+  gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
 
-  // Mylar for outer layers
-  par[1] = 0.035/2;
-  ycoor = -yPad/2.+par[1];
+  // MYlar eXternal layers
+  par[1] = 0.035*0.5;//cm
+  ycoor = -yPad*0.5+par[1];
   gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
-  gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
   ycoor += par[1];
  
-  // Graphyte layers
-  par[1] = 0.003/2;
+  // GRaphyte Layers
+  par[1] = 0.003*0.5;
   ycoor += par[1];
   gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
-  gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
 
-  // Freon sensitive layer
+  // freon sensitive layer (Chlorine-Fluorine-Carbon)
   par[0] = -1;
-  par[1] = 0.110/2.;
-  par[2] = zSenStrip/2.;
+  par[1] =  0.110*0.5;
+  par[2] = zSenStrip*0.5;
   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
-  gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
+  gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
   
   // Pad definition x & z
   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
 
+  // MRPC PAD itself 
+  par[0] = -1;
+  par[1] = -1; 
+  par[2] = -1;
+  gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
+  gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
+
 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
-  // 3 (Central) Plate 
-  Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
+  // Plate A (Central) 
+  
+  Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
+
+  Float_t Gap  =  4.; //cm  distance between the strip axis
   Float_t zpos = 0;
-  Float_t ang;
-  Float_t Offset;  
+  Float_t ang  = 0;
   Float_t last;
-  nrot = 0;
   Int_t i=1,j=1;
-  zcoor=0;
-  Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
+  nrot  = 0;
+  zcoor = 0;
+  ycoor = -14.5 + Space ; //2 cm over front plate
+
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
+  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  zcoor -= zSenStrip;
+
+  j++;
+  Int_t UpDown = -1; // UpDown=-1 -> Upper strip
+                     // UpDown=+1 -> Lower strip
   do{
-     ang = atan(zcoor/t);
-     ang = ang * kRaddeg;
+     ang = atan(zcoor/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
-     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90.,ang, 90.);
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+     ang /= kRaddeg;
      ycoor = -14.5+ Space; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     gMC->Gspos("FSTR",j  ,"FLT3",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-     gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     ang = ang / kRaddeg;
-     
-     zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
+     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+     j += 2;
      UpDown*= -1; // Alternate strips 
-     i++;
-     j+=2;
-  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
+     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+             UpDown*Gap*TMath::Tan(ang)-
+            (zSenStrip/2)/TMath::Cos(ang);
+  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
   
-  ycoor = -29./2.+ Space; //2 cm over front plate
+  zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)+
+          (zSenStrip/2)/TMath::Cos(ang);
+         
+  Gap = 6.;
+  zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)-
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  ang = atan(zcoor/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+  ang /= kRaddeg;
+         
+  ycoor = -14.5+ Space; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  
+  ycoor = -29./2.+ Space;//2 cm over front plate
+
+  // Plate  B
 
-  // Plate  2
-  zpos = -zFLT3/2-7.;
-  ang  = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2;
-  zpos -= Offset;
   nrot = 0;
   i=1;
-  // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
+  UpDown *= -1;
+  
+  zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
+         UpDown*Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang)-0.5/TMath::Cos(ang);
+
+  ang = atan(zpos/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ang /= kRaddeg;
+  ycoor = -29.*0.5+ Space ; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+  gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+  i++;
+  UpDown*=-1;
 
   do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang * kRaddeg;
+     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+            UpDown*Gap*TMath::Tan(ang)-
+           (zSenStrip/2)/TMath::Cos(ang);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
-     ycoor = -29./2.+ Space ; //2 cm over front plate
+     ang /= kRaddeg;
+     ycoor = -29.*0.5+ Space ; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
-     gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang / kRaddeg;
-     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2;
+     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      UpDown*=-1;
-     i++; 
-  } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
-
-  // Plate  1
-  zpos = -t+zFLT1+3.5;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2.;
-  zpos -= Offset;
-  nrot = 0;
-  i=0;
-  ycoor= -29./2.+Space+Gap/2;
+     i++;
+  } while (TMath::Abs(ang*kRaddeg)<22.5);//till we reach a tilting angle of 22.5 degrees
 
- do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang * kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ycoor = -29.*0.5+ Space ; //2 cm over front plate
+
+  do {
      i++;
-     zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
-     gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang / kRaddeg;
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTB/2+zFLTA/2+db);
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      last = StripWidth*TMath::Cos(ang)/2.;
-  }  while (zpos>-t+7.+last);
+  }  while (zpos>-t+zFLTC+db);
+
+  // Plate  C
+
+  zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+         Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang);
+
+  nrot = 0;
+  i=0;
+  ycoor= -29.*0.5+Space+Gap;
 
-printf("#######################################################\n");
-printf("     Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
+  do {
+     i++;
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
+     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      zpos = zpos - zSenStrip/TMath::Cos(ang);
-printf("NEXT Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-printf("#######################################################\n");
+     last = StripWidth*TMath::Cos(ang)*0.5;
+  }  while (zpos>-t+last);
+
 
 ////////// Layers after detector /////////////////
 
-// Honeycomb layer after (3cm)
+// honeycomb (Polyethilene) Layer after (3cm)
 
-  Float_t OverSpace = Space + 7.3;
-///  StripWidth*TMath::Sin(ang) + 1.3;
+  Float_t OverSpace = 15.30;//cm
 
   par[0] = -1;
   par[1] = 0.6;
   par[2] = -1;
   ycoor = -yFLT/2 + OverSpace + par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 // Electronics (Cu) after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
+  par[1] = 1.43*0.05*0.5; // 5% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
+  gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// cooling WAter after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
+  par[1] = 36.1*0.02*0.5; // 2% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
+  gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+//Back Plate honycomb (2cm)
   par[0] = -1;
-  par[1] = 2 / 2.;
+  par[1] = 2 *0.5;
   par[2] = -1;
   ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 }
 
 //_____________________________________________________________________________
@@ -441,33 +587,29 @@ void AliTOFv0::DrawModule()
   //
   // Set the volumes visible
   gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
+
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FPLA","SEEN",1);
+  gMC->Gsatt("FPLB","SEEN",1);
+  gMC->Gsatt("FPLC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
+  gMC->Gsatt("FPEA","SEEN",1);
+  gMC->Gsatt("FPEB","SEEN",1);
+  gMC->Gsatt("FPEC","SEEN",1);
+  
+  gMC->Gsatt("FLZ1","SEEN",0);
+  gMC->Gsatt("FLZ2","SEEN",0);
+  gMC->Gsatt("FLZ3","SEEN",0);
+  gMC->Gsatt("FLX1","SEEN",0);
+  gMC->Gsatt("FLX2","SEEN",0);
+  gMC->Gsatt("FLX3","SEEN",0);
+  gMC->Gsatt("FPAD","SEEN",0);
+
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
   gMC->Gsatt("*", "fill", 7);
@@ -498,16 +640,17 @@ void AliTOFv0::Init()
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
-  printf("\n     Version 0 of TOF initialing, "
-        "with openings for PHOS and RICH\n\n");
+  printf("\n   Version 0 of TOF initialing, "
+             "symmetric TOF\n");
 
   AliTOF::Init();
 
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
+  fIdFTOA = gMC->VolId("FTOA");
+  fIdFTOB = gMC->VolId("FTOB");
+  fIdFTOC = gMC->VolId("FTOC");
+  fIdFLTA = gMC->VolId("FLTA");
+  fIdFLTB = gMC->VolId("FLTB");
+  fIdFLTC = gMC->VolId("FLTC");
 
   printf("**************************************"
         "  TOF  "
@@ -520,20 +663,19 @@ void AliTOFv0::StepManager()
   //
   // Procedure called at each step in the Time Of Flight
   //
-  TLorentzVector mom, pos;
   Float_t hits[8],rho,phi,phid,z;
-  Int_t sector, plate, pad_x, pad_z, strip;
-  Int_t copy, pad_z_id, pad_x_id, strip_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
+  Int_t   sector, plate, pad_x, pad_z, strip;
+  Int_t   copy, pad_z_id, pad_x_id, strip_id, i;
+  Int_t   vol[4];
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  TLorentzVector mom, pos;
   
   
   if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
      && gMC->CurrentVolID(copy)==fIdSens) 
-  {
-    TClonesArray &lhits = *fHits;
-    
-    //_________getting information about hit volumes_____________
+  {    
+// getting information about hit volumes
     
     pad_z_id=gMC->CurrentVolOffID(2,copy);
     pad_z=copy;  
@@ -556,26 +698,37 @@ void AliTOFv0::StepManager()
 
     z = pos[2];
    
-    if (z<=  62. && z>=-62.) plate = 3;
-    if (z<= 216. && z>62.)   plate = 4;
-    if (z>=-216. && z<-62.)  plate = 2;
-    if (z>216.)  plate = 5;
-    if (z<-216.) plate = 1;
+    plate = 0;
+    Float_t limA = fZlenA*0.5;
+    Float_t limB = fZlenB+limA;
+    
+    if (TMath::Abs(z)<=limA) plate = 3;
+    if (z<= limB && z> limA) plate = 2;
+    if (z>=-limB && z<-limA) plate = 4;
+    if (z> limB)             plate = 1;
+    if (z<-limB)             plate = 5;
+
+    if (plate==3)  pad_z -= 2;
 
-    phid = phi*kRaddeg;
+    phid   = phi*kRaddeg;
     sector = Int_t (phid/20.);
     sector++;
 
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
+    Double_t ptot = mom.Rho();
+    Double_t norm = 1/ptot;
     for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
+      hits[i]   = pos[i];
+      hits[i+3] = mom[i]*norm;
     }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);
+    hits[6] = ptot;
+    hits[7] = pos[3];
+    
+    vol[0] = sector;
+    vol[1] = plate;
+    vol[2] = pad_x;
+    vol[3] = pad_z;
+    
+    Int_t track = gAlice->CurrentTrack();
+    AliTOF::AddHit(track,vol, hits);
   }
 }
-
-
index e050a866055fe487b7527ef1cffe6ea83c506c4d..31305387ed53c4fa806709e8b632183e8322a7e6 100644 (file)
@@ -6,7 +6,7 @@
 /* $Id$ */
 
 ///////////////////////////////////////////////////////
-//  Manager and hits classes for set:TOF  version 1  //
+//  Manager and hits classes for set:TOF  version 0  //
 ///////////////////////////////////////////////////////
  
 #include "AliTOF.h"
 class AliTOFv0 : public AliTOF {
 
 private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
+  Int_t fIdFTOA;
+  Int_t fIdFTOB;
+  Int_t fIdFTOC;
+  Int_t fIdFLTA;
+  Int_t fIdFLTB;
+  Int_t fIdFLTC;
  
 public:
   AliTOFv0();
   AliTOFv0(const char *name, const char *title);
   virtual       ~AliTOFv0() {}
+  virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
   virtual void   Init();
index 3af1a9f3c5a67be20d8aa4f1e255558aca55fa41..e4e1c8953d8c62f0a6dce40d794d4c5395c18e89 100644 (file)
 
 /*
 $Log$
+Revision 1.14.2.1  2000/05/10 09:37:16  vicinanz
+New version with Holes for PHOS/RICH
+
 Revision 1.14  1999/11/05 22:39:06  fca
 New hits structure
 
-Revision 1.13  1999/11/01 20:41:57  fca
+Revision 1.13  1999/11/02 11:26:39  fca
+added stdlib.h for exit
+
+Revision 1.12  1999/11/01 20:41:57  fca
 Added protections against using the wrong version of FRAME
 
-Revision 1.12  1999/10/22 08:04:14  fca
+Revision 1.11  1999/10/22 08:04:14  fca
 Correct improper use of negative parameters
 
-Revision 1.11  1999/10/16 19:30:05  fca
+Revision 1.10  1999/10/16 19:30:06  fca
 Corrected Rotation Matrix and CVS log
 
-Revision 1.10  1999/10/15 15:35:20  fca
+Revision 1.9  1999/10/15 15:35:20  fca
 New version for frame1099 with and without holes
 
-Revision 1.9  1999/09/29 09:24:33  fca
+Revision 1.8  1999/09/29 09:24:33  fca
 Introduction of the Copyright and cvs Log
 
 */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-//  Time Of Flight: design of C.Williams                FCA                  //
+//  Time Of Flight: design of C.Williams                             
+//
 //  This class contains the functions for version 1 of the Time Of Flight    //
 //  detector.                                                                //
 //
 //  VERSION WITH 5 MODULES AND TILTED STRIPS 
 //  
-//   WITH HOLES FOR PHOS AND HMPID inside the 
-//   SPACE FRAME WITH HOLES
-//
+//  HOLES FOR PHOS DETECTOR
 //
 //   Authors:
-//  
+//
 //   Alessio Seganti
 //   Domenico Vicinanza
 //
@@ -67,8 +72,12 @@ Introduction of the Copyright and cvs Log
 #include <stdlib.h>
 
 #include "AliTOFv1.h"
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
 #include "AliRun.h"
 #include "AliConst.h"
+
  
 ClassImp(AliTOFv1)
  
@@ -82,12 +91,11 @@ AliTOFv1::AliTOFv1()
  
 //_____________________________________________________________________________
 AliTOFv1::AliTOFv1(const char *name, const char *title)
-       : AliTOF(name,title)
+        : AliTOF(name,title)
 {
   //
   // Standard constructor
   //
-
   //
   // Check that FRAME is there otherwise we have no place where to
   // put TOF
@@ -95,13 +103,100 @@ AliTOFv1::AliTOFv1(const char *name, const char *title)
   if(!FRAME) {
     Error("Ctor","TOF needs FRAME to be present\n");
     exit(1);
-  } else 
-    if(FRAME->IsVersion()!=0) {
-      Error("Ctor","FRAME version 0 needed with this version of TOF\n");
+  } else
+    if(FRAME->IsVersion()!=1) {
+      Error("Ctor","FRAME version 1 needed with this version of TOF\n");
       exit(1);
     }
 
+
+
+}
+
+//_____________________________________________________________________________
+void AliTOFv1::BuildGeometry()
+{
+  //
+  // Build TOF ROOT geometry for the ALICE event display
+  //
+  TNode *Node, *Top;
+  const int kColorTOF  = 27;
+
+  // Find top TNODE
+  Top = gAlice->GetGeometry()->GetNode("alice");
+
+  // Position the different copies
+  const Float_t rTof  =(fRmax+fRmin)/2;
+  const Float_t hTof  = fRmax-fRmin;
+  const Int_t   fNTof = 18;
+  const Float_t kPi   = TMath::Pi();
+  const Float_t angle = 2*kPi/fNTof;
+  Float_t ang;
+
+  // Define TOF basic volume
+  
+  char NodeName0[6], NodeName1[6], NodeName2[6]; 
+  char NodeName3[6], NodeName4[6], RotMatNum[6];
+
+  new TBRIK("S_TOF_C","TOF box","void",
+            120*0.5,hTof*0.5,fZlenC*0.5);
+  new TBRIK("S_TOF_B","TOF box","void",
+            120*0.5,hTof*0.5,fZlenB*0.5);
+  new TBRIK("S_TOF_A","TOF box","void",
+            120*0.5,hTof*0.5,fZlenA*0.5);
+
+  for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
+     
+      if (NodeNum<10) {
+           sprintf(RotMatNum,"rot50%i",NodeNum);
+           sprintf(NodeName0,"FTO00%i",NodeNum);
+           sprintf(NodeName1,"FTO10%i",NodeNum);
+           sprintf(NodeName2,"FTO20%i",NodeNum);
+           sprintf(NodeName3,"FTO30%i",NodeNum);
+           sprintf(NodeName4,"FTO40%i",NodeNum);
+      }
+      if (NodeNum>9) {
+           sprintf(RotMatNum,"rot5%i",NodeNum);
+           sprintf(NodeName0,"FTO0%i",NodeNum);
+           sprintf(NodeName1,"FTO1%i",NodeNum);
+           sprintf(NodeName2,"FTO2%i",NodeNum);
+           sprintf(NodeName3,"FTO3%i",NodeNum);
+           sprintf(NodeName4,"FTO4%i",NodeNum);
+      }
+      new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
+      ang = (4.5-NodeNum) * angle;
+
+      Top->cd();
+      Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd(); 
+      Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+if (NodeNum<8 || NodeNum>12) {
+      Top->cd();
+      Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+     } // Modules A which are not to be installed for PHOS holes.
+  }
 }
+
+
  
 //_____________________________________________________________________________
 void AliTOFv1::CreateGeometry()
@@ -121,319 +216,397 @@ void AliTOFv1::CreateGeometry()
 }
  
 //_____________________________________________________________________________
-void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
+void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
+                    Float_t zlenB, Float_t zlenA, Float_t ztof0)
 {
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
   
-  Float_t  ycoor;
-  Float_t par[10];
-  Int_t idrotm[100];
-  Int_t nrot = 0;
+  Float_t  ycoor, zcoor;
+  Float_t  par[10];
+  Int_t    *idtmed = fIdtmed->GetArray()-499;
+  Int_t    idrotm[100];
+  Int_t    nrot = 0;
+  Float_t  hTof = fRmax-fRmin;
   
-  Int_t *idtmed = fIdtmed->GetArray()-499;
+  Float_t Radius = fRmin+2.;//cm
 
-
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenC * 0.5;
+  gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenB * 0.5;
+  gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
 
 
 // Positioning of modules
 
-   Float_t zcoor;
-
-   Float_t zcor1 = ztof0 - zlen1/2;
-   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
+   Float_t zcor1 = ztof0 - zlenC*0.5;
+   Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
    Float_t zcor3 = 0.;
 
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   zcoor = (zlen1/2.);
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-   zcoor = 0.;
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcoor, 0, idrotm[0], "ONLY");
-   
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   zcoor = -zlen2/2.;
-   gMC->Gspos("FTO2", 0, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-
-// Subtraction the distance to TOF module boundaries 
+   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90,-90.);
+   AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
+   gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
+
+  Float_t db = 0.5;//cm
+  Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
+
+  xFLT = fStripLn;
+  yFLT = ytof;
+  zFLTA = zlenA;
+  zFLTB = zlenB;
+  zFLTC = zlenC;
 
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
+  xFST = xFLT-fDeadBndX*2;//cm
 
-  xFLT = xtof -(.5 +.5)*2;
-  yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
-    
 // Sizes of MRPC pads
 
-  Float_t yPad = 0.505; 
+  Float_t yPad = 0.505;//cm 
   
 // Large not sensitive volumes with CO2 
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
 
   cout <<"************************* TOF geometry **************************"<<endl;
 
-  par[2] = (zFLT1 / 2.);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTA *0.5);
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT2 / 2.);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTB * 0.5);
+  gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT3 / 2.); 
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTC * 0.5); 
+  gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
 
 ////////// Layers before detector ////////////////////
 
-// Alluminium layer in front 1.0 mm thick at the beginning
+// MYlar layer in front 1.0 mm thick at the beginning
   par[0] = -1;
-  par[1] = 0.1;
+  par[1] = 0.1;//cm
   par[2] = -1;
   ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
+  gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium 
+  gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// honeycomb (special Polyethilene Layer of 1cm)
   ycoor = ycoor + par[1];
   par[0] = -1;
-  par[1] = 0.5;
+  par[1] = 0.5;//cm
   par[2] = -1;
   ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 ///////////////// Detector itself //////////////////////
 
-  const Float_t StripWidth = 7.81;//cm
-  const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
-  const Int_t nx = 40; // number of pads along x
-  const Int_t nz = 2;  // number of pads along z
-  const Float_t Gap=4.; //cm  distance between the strip axis
-  const Float_t Space = 5.5; //cm distance from the front plate of the box
+  const Float_t  DeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
+                                          //and the boundary of the strip
+  const Int_t    nx    = fNpadX;          // number of pads along x
+  const Int_t    nz    = fNpadZ;          // number of pads along z
+  const Float_t  Space = fSpace;            //cm distance from the front plate of the box
 
-  Float_t zSenStrip;
-  zSenStrip = StripWidth-2*DeadBound;//cm
+  Float_t zSenStrip  = fZpad*fNpadZ;//cm
+  Float_t StripWidth = zSenStrip + 2*DeadBound;
 
-  par[0] = xFLT/2;
-  par[1] = yPad/2
-  par[2] = StripWidth/2.;
+  par[0] = xFLT*0.5;
+  par[1] = yPad*0.5
+  par[2] = StripWidth*0.5;
   
-  // Glass Layer of detector
+  // glass layer of detector STRip
   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
 
-  // Freon for non-sesitive boundaries
-  par[0] = xFLT/2;
-  par[1] = 0.110/2;
+  // Non-Sesitive Freon boundaries
+  par[0] =  xFLT*0.5;
+  par[1] =  0.110*0.5;//cm
   par[2] = -1;
   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
-  gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
-  // Mylar for non-sesitive boundaries
-  par[1] = 0.025;
-  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
-  gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
-
-  // Mylar for outer layers
-  par[1] = 0.035/2;
-  ycoor = -yPad/2.+par[1];
+  gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
+
+  // MYlar for Internal non-sesitive boundaries
+//  par[1] = 0.025;//cm
+//  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
+//  gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"MANY");
+
+  // MYlar eXternal layers
+  par[1] = 0.035*0.5;//cm
+  ycoor = -yPad*0.5+par[1];
   gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
-  gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
   ycoor += par[1];
  
-  // Graphyte layers
-  par[1] = 0.003/2;
+  // GRaphyte Layers
+  par[1] = 0.003*0.5;
   ycoor += par[1];
   gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
-  gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
 
-  // Freon sensitive layer
-  par[0] = -1;
-  par[1] = 0.110/2.;
-  par[2] = zSenStrip/2.;
+  // freon sensitive layer (Chlorine-Fluorine-Carbon)
+  par[0] = xFST*0.5;
+  par[1] =  0.110*0.5;
+  par[2] = zSenStrip*0.5;
   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
-  gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
+  gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
   
   // Pad definition x & z
   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
 
-  // MRPC pixel itself 
+  // MRPC PAD itself 
   par[0] = -1;
   par[1] = -1; 
   par[2] = -1;
   gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
-  gMC->Gspos("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
-
+  gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
 
 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
-  // 3 (Central) Plate 
-  Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
+  // Plate A (Central) 
+  
+  Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
+
+  Float_t Gap  = fGapA; //cm  distance between the strip axis
   Float_t zpos = 0;
-  Float_t ang;
-  Float_t Offset;  
-  Float_t last;
-  nrot = 0;
+  Float_t ang  = 0;
   Int_t i=1,j=1;
-  zcoor=0;
-  Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
+  nrot  = 0;
+  zcoor = 0;
+  ycoor = -14.5 + Space ; //2 cm over front plate
+
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
+  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  zcoor -= zSenStrip;
+  j++;
+  Int_t UpDown = -1; // UpDown=-1 -> Upper strip
+                     // UpDown=+1 -> Lower strip
   do{
-     ang = atan(zcoor/t);
-     ang = ang * kRaddeg;
+     ang = atan(zcoor/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
-     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90.,ang, 90.);
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+     ang /= kRaddeg;
      ycoor = -14.5+ Space; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     gMC->Gspos("FSTR",j  ,"FLT3",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-     gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     ang = ang / kRaddeg;
-     
-     zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
+     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     j += 2;
      UpDown*= -1; // Alternate strips 
-     i++;
-     j+=2;
-  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
+     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+             UpDown*Gap*TMath::Tan(ang)-
+            (zSenStrip/2)/TMath::Cos(ang);
+  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
   
-  ycoor = -29./2.+ Space; //2 cm over front plate
+  zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
+          UpDown*Gap*TMath::Tan(ang)+
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  Gap = fGapB;
+  zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)-
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  ang = atan(zcoor/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+  ang /= kRaddeg;
+         
+  ycoor = -14.5+ Space; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  ycoor = -hTof/2.+ Space;//2 cm over front plate
+
+  // Plate  B
 
-  // Plate  2
-  zpos = -zFLT3/2-7.;
-  ang  = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2;
-  zpos -= Offset;
   nrot = 0;
   i=1;
-  // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
+  UpDown = 1;
+  Float_t DeadRegion = 1.0;//cm
+  
+  zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
+         UpDown*Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang)-
+        DeadRegion/TMath::Cos(ang);
+
+  ang = atan(zpos/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ang /= kRaddeg;
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+  gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  i++;
+  UpDown*=-1;
 
   do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang * kRaddeg;
+     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+            UpDown*Gap*TMath::Tan(ang)-
+           (zSenStrip/2)/TMath::Cos(ang);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
-     ycoor = -29./2.+ Space ; //2 cm over front plate
+     ang /= kRaddeg;
+     ycoor = -hTof*0.5+ Space ; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
-     gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang / kRaddeg;
-     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2;
+     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
      UpDown*=-1;
-     i++; 
-  } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
-
-  // Plate  1
-  zpos = -t+zFLT1+3.5;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2.;
-  zpos -= Offset;
+     i++;
+  } while (TMath::Abs(ang*kRaddeg)<22.5);
+  //till we reach a tilting angle of 22.5 degrees
+
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  zpos = zpos - zSenStrip/TMath::Cos(ang);
+
+  do {
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTB/2+zFLTA/2+db);
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     zpos = zpos - zSenStrip/TMath::Cos(ang);
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     i++;
+
+  }  while (zpos-StripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
+
+  // Plate  C
+  
+  zpos = zpos + zSenStrip/TMath::Cos(ang);
+
+  zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
+         Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang);
+
   nrot = 0;
   i=0;
-  ycoor= -29./2.+Space+Gap/2;
+  ycoor= -hTof*0.5+Space+Gap;
 
- do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang * kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  do {
      i++;
-     zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
-     gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang / kRaddeg;
-     zpos = zpos - zSenStrip/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2.;
-  }  while (zpos>-t+7.+last);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
+     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
 
-printf("#######################################################\n");
-printf("     Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
      zpos = zpos - zSenStrip/TMath::Cos(ang);
-printf("NEXT Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-printf("#######################################################\n");
+  }  while (zpos-StripWidth*TMath::Cos(ang)*0.5>-t);
+
 
 ////////// Layers after detector /////////////////
 
-// Honeycomb layer after (3cm)
+// honeycomb (Polyethilene) Layer after (3cm)
 
-  Float_t OverSpace = Space + 7.3;
-///  StripWidth*TMath::Sin(ang) + 1.3;
+  Float_t OverSpace = fOverSpc;//cm
 
   par[0] = -1;
   par[1] = 0.6;
   par[2] = -1;
   ycoor = -yFLT/2 + OverSpace + par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 // Electronics (Cu) after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
+  par[1] = 1.43*0.05*0.5; // 5% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
+  gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// cooling WAter after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
+  par[1] = 36.1*0.02*0.5; // 2% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
+  gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+//Back Plate honycomb (2cm)
   par[0] = -1;
-  par[1] = 2 / 2.;
+  par[1] = 2 *0.5;
   par[2] = -1;
   ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 }
 
 //_____________________________________________________________________________
@@ -450,33 +623,29 @@ void AliTOFv1::DrawModule()
   //
   // Set the volumes visible
   gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
+
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FPLA","SEEN",1);
+  gMC->Gsatt("FPLB","SEEN",1);
+  gMC->Gsatt("FPLC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
+  gMC->Gsatt("FPEA","SEEN",1);
+  gMC->Gsatt("FPEB","SEEN",1);
+  gMC->Gsatt("FPEC","SEEN",1);
+  
+  gMC->Gsatt("FLZ1","SEEN",0);
+  gMC->Gsatt("FLZ2","SEEN",0);
+  gMC->Gsatt("FLZ3","SEEN",0);
+  gMC->Gsatt("FLX1","SEEN",0);
+  gMC->Gsatt("FLX2","SEEN",0);
+  gMC->Gsatt("FLX3","SEEN",0);
+  gMC->Gsatt("FPAD","SEEN",0);
+
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
   gMC->Gsatt("*", "fill", 7);
@@ -507,16 +676,17 @@ void AliTOFv1::Init()
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
-  printf("\n     Version 1 of TOF initialing, "
-        "with openings for PHOS and RICH\n\n");
+  printf("\n   Version 1 of TOF initialing, "
+             "TOF with holes for PHOS detector\n");
 
   AliTOF::Init();
 
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
+  fIdFTOA = gMC->VolId("FTOA");
+  fIdFTOB = gMC->VolId("FTOB");
+  fIdFTOC = gMC->VolId("FTOC");
+  fIdFLTA = gMC->VolId("FLTA");
+  fIdFLTB = gMC->VolId("FLTB");
+  fIdFLTC = gMC->VolId("FLTC");
 
   printf("**************************************"
         "  TOF  "
@@ -530,19 +700,19 @@ void AliTOFv1::StepManager()
   // Procedure called at each step in the Time Of Flight
   //
   TLorentzVector mom, pos;
-  Float_t hits[8],rho,phi,phid,z;
-  Int_t sector, plate, pad_x, pad_z, strip;
-  Int_t copy, pad_z_id, pad_x_id, strip_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  
+  Float_t xm[3],pm[3],xpad[3],ppad[3];
+  Float_t hits[13],phi,phid,z;
+  Int_t   vol[5];
+  Int_t   sector, plate, pad_x, pad_z, strip;
+  Int_t   copy, pad_z_id, pad_x_id, strip_id, i;
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  Float_t IncidenceAngle;
   
   if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
      && gMC->CurrentVolID(copy)==fIdSens) 
-  {
-    TClonesArray &lhits = *fHits;
-    
-    //_________getting information about hit volumes_____________
+  {    
+    // getting information about hit volumes
     
     pad_z_id=gMC->CurrentVolOffID(2,copy);
     pad_z=copy;  
@@ -553,38 +723,62 @@ void AliTOFv1::StepManager()
     strip_id=gMC->CurrentVolOffID(5,copy);
     strip=copy;  
 
-    pad_z = (strip-1)*2+pad_z;
-
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
 
-    rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-    phi = TMath::ACos(pos[0]/rho);
-    Float_t as = TMath::ASin(pos[1]/rho);
-    if (as<0) phi = 2*3.141592654-phi;
+//    Double_t NormPos=1./pos.Rho();
+    Double_t NormMom=1./mom.Rho();
+
+//  getting the cohordinates in pad ref system
+    xm[0] = (Float_t)pos.X();
+    xm[1] = (Float_t)pos.Y();
+    xm[2] = (Float_t)pos.Z();
+
+    pm[0] = (Float_t)mom.X()*NormMom;
+    pm[1] = (Float_t)mom.Y()*NormMom;
+    pm[2] = (Float_t)mom.Z()*NormMom;
+    gMC->Gmtod(xm,xpad,1);
+    gMC->Gmtod(pm,ppad,2);
+
+    IncidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
 
     z = pos[2];
-   
-    if (z<=62. && z>=-62) plate = 3;
-    if (z<=216. && z>62.)   plate = 4;
-    if (z>=-216. && z<-62.) plate = 2;
-    if (z>216.)  plate = 5;
-    if (z<-216.) plate = 1;
-
-    phid = phi*kRaddeg;
+
+    plate = 0;   
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    if (z < (fZlenA*0.5+fZlenB) && 
+        z >  fZlenA*0.5)               plate = 4;
+    if (z >-(fZlenA*0.5+fZlenB) &&
+        z < -fZlenA*0.5)               plate = 2;
+    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+
+    phi = pos.Phi();
+    phid = phi*kRaddeg+180.;
     sector = Int_t (phid/20.);
     sector++;
 
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
     for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
+      hits[i]   = pos[i];
+      hits[i+3] = pm[i];
     }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);
+
+    hits[6] = mom.Rho();
+    hits[7] = pos[3];
+    hits[8] = xpad[0];
+    hits[9] = xpad[1];
+    hits[10]= xpad[2];
+    hits[11]= IncidenceAngle;
+    hits[12]= gMC->Edep();
+    
+    vol[0]= sector;
+    vol[1]= plate;
+    vol[2]= strip;
+    vol[3]= pad_x;
+    vol[4]= pad_z;
+    
+    AddHit(gAlice->CurrentTrack(),vol, hits);
   }
 }
 
-
index 36a82772d5a4f65934ba2498e630d1d4461d6a5c..54e366a14922e1a6ea8c0364ce69693b7a976057 100644 (file)
 class AliTOFv1 : public AliTOF {
 
 private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
+  Int_t fIdFTOA;
+  Int_t fIdFTOB; // First sensitive volume identifier
+  Int_t fIdFTOC; // Second sensitive volume identifier
+  Int_t fIdFLTA; // Third sensitive volume identifier
+  Int_t fIdFLTB; // Fourth sensitive volume identifier
+  Int_t fIdFLTC; // Fifth sensitive volume identifier
  
 public:
   AliTOFv1();
   AliTOFv1(const char *name, const char *title);
   virtual       ~AliTOFv1() {}
+  virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
   virtual void   Init();
index 4c57fa17552a5a597588cd8e634258147fd4d31c..cce50d43643df0beece5835bb3fa14b90b78a1cd 100644 (file)
 
 /*
 $Log$
+Revision 1.14.2.1  2000/05/10 09:37:16  vicinanz
+New version with Holes for PHOS/RICH
+
 Revision 1.14  1999/11/05 22:39:06  fca
 New hits structure
 
-Revision 1.13  1999/11/01 20:41:57  fca
+Revision 1.13  1999/11/02 11:26:39  fca
+added stdlib.h for exit
+
+Revision 1.12  1999/11/01 20:41:57  fca
 Added protections against using the wrong version of FRAME
 
-Revision 1.12  1999/10/22 08:04:14  fca
+Revision 1.11  1999/10/22 08:04:14  fca
 Correct improper use of negative parameters
 
-Revision 1.11  1999/10/16 19:30:05  fca
+Revision 1.10  1999/10/16 19:30:06  fca
 Corrected Rotation Matrix and CVS log
 
-Revision 1.10  1999/10/15 15:35:20  fca
+Revision 1.9  1999/10/15 15:35:20  fca
 New version for frame1099 with and without holes
 
-Revision 1.9  1999/09/29 09:24:33  fca
+Revision 1.8  1999/09/29 09:24:33  fca
 Introduction of the Copyright and cvs Log
 
 */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-//  Time Of Flight: design of C.Williams                FCA                  //
+//  Time Of Flight: design of C.Williams                    
+//
 //  This class contains the functions for version 1 of the Time Of Flight    //
 //  detector.                                                                //
 //
 //  VERSION WITH 5 MODULES AND TILTED STRIPS 
 //  
-//   WITH HOLES FOR PHOS AND HMPID 
-//   INSIDE A FULL COVERAGE SPACE FRAME
+//  HOLES FOR PHOS AND RICH DETECTOR
 //
-//
-//   Authors: 
+//   Authors:
 //
 //   Alessio Seganti
 //   Domenico Vicinanza
@@ -55,7 +60,6 @@ Introduction of the Copyright and cvs Log
 //   University of Salerno - Italy
 //
 //
-//
 //Begin_Html
 /*
 <img src="picts/AliTOFv2Class.gif">
@@ -68,8 +72,12 @@ Introduction of the Copyright and cvs Log
 #include <stdlib.h>
 
 #include "AliTOFv2.h"
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
 #include "AliRun.h"
 #include "AliConst.h"
+
  
 ClassImp(AliTOFv2)
  
@@ -83,7 +91,7 @@ AliTOFv2::AliTOFv2()
  
 //_____________________________________________________________________________
 AliTOFv2::AliTOFv2(const char *name, const char *title)
-       : AliTOF(name,title)
+        : AliTOF(name,title)
 {
   //
   // Standard constructor
@@ -95,13 +103,102 @@ AliTOFv2::AliTOFv2(const char *name, const char *title)
   if(!FRAME) {
     Error("Ctor","TOF needs FRAME to be present\n");
     exit(1);
-  } else 
+  } else
     if(FRAME->IsVersion()!=1) {
       Error("Ctor","FRAME version 1 needed with this version of TOF\n");
       exit(1);
     }
 
 }
+
+//_____________________________________________________________________________
+void AliTOFv2::BuildGeometry()
+{
+  //
+  // Build TOF ROOT geometry for the ALICE event display
+  //
+  TNode *Node, *Top;
+  const int kColorTOF  = 27;
+
+  // Find top TNODE
+  Top = gAlice->GetGeometry()->GetNode("alice");
+
+  // Position the different copies
+  const Float_t rTof  =(fRmax+fRmin)/2;
+  const Float_t hTof  = fRmax-fRmin;
+  const Int_t   fNTof = 18;
+  const Float_t kPi   = TMath::Pi();
+  const Float_t angle = 2*kPi/fNTof;
+  Float_t ang;
+
+  // Define TOF basic volume
+  
+  char NodeName0[6], NodeName1[6], NodeName2[6]; 
+  char NodeName3[6], NodeName4[6], RotMatNum[6];
+
+  new TBRIK("S_TOF_C","TOF box","void",
+            120*0.5,hTof*0.5,fZlenC*0.5);
+  new TBRIK("S_TOF_B","TOF box","void",
+            120*0.5,hTof*0.5,fZlenB*0.5);
+  new TBRIK("S_TOF_A","TOF box","void",
+            120*0.5,hTof*0.5,fZlenA*0.5);
+
+  for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
+     
+      if (NodeNum<10) {
+           sprintf(RotMatNum,"rot50%i",NodeNum);
+           sprintf(NodeName0,"FTO00%i",NodeNum);
+           sprintf(NodeName1,"FTO10%i",NodeNum);
+           sprintf(NodeName2,"FTO20%i",NodeNum);
+           sprintf(NodeName3,"FTO30%i",NodeNum);
+           sprintf(NodeName4,"FTO40%i",NodeNum);
+      }
+      if (NodeNum>9) {
+           sprintf(RotMatNum,"rot5%i",NodeNum);
+           sprintf(NodeName0,"FTO0%i",NodeNum);
+           sprintf(NodeName1,"FTO1%i",NodeNum);
+           sprintf(NodeName2,"FTO2%i",NodeNum);
+           sprintf(NodeName3,"FTO3%i",NodeNum);
+           sprintf(NodeName4,"FTO4%i",NodeNum);
+      }
+      new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
+      ang = (4.5-NodeNum) * angle;
+
+      Top->cd();
+      Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd(); 
+      Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+if (NodeNum !=1 && NodeNum!=2 && NodeNum !=18)
+    {
+      Top->cd();
+      Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+  } // Holes for RICH detector
+
+if ((NodeNum<8 || NodeNum>12) && NodeNum !=1 && NodeNum!=2 && NodeNum
+!=18)
+    { 
+      Top->cd();
+      Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+     } // Holes for PHOS detector (+ Holes for RICH detector, central part)
+  }
+}
+
+
  
 //_____________________________________________________________________________
 void AliTOFv2::CreateGeometry()
@@ -121,317 +218,394 @@ void AliTOFv2::CreateGeometry()
 }
  
 //_____________________________________________________________________________
-void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
+void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
+                    Float_t zlenB, Float_t zlenA, Float_t ztof0)
 {
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
   
-  Int_t idrotm[100];
-  Int_t nrot = 0;
   Float_t  ycoor, zcoor;
-  Float_t par[10];
+  Float_t  par[10];
+  Int_t    *idtmed = fIdtmed->GetArray()-499;
+  Int_t    idrotm[100];
+  Int_t    nrot = 0;
+  Float_t  hTof = fRmax-fRmin;
   
-  Int_t *idtmed = fIdtmed->GetArray()-499;
+  Float_t Radius = fRmin+2.;//cm
 
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenC * 0.5;
+  gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenB * 0.5;
+  gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
 
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
 
+// Positioning of modules
 
-// Position of modules
-  Float_t zcor1 = ztof0 - zlen1/2;
-  Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
-  Float_t zcor3 = 0.;
+   Float_t zcor1 = ztof0 - zlenC*0.5;
+   Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
+   Float_t zcor3 = 0.;
 
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
+   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90,-90.);
+   AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
+   gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
 
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
 
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
 
-// Subtraction the distance to TOF module boundaries 
+  Float_t db = 0.5;//cm
+  Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
 
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3; 
-
-  xFLT = xtof -(.5 +.5)*2;
+  xFLT = fStripLn;
   yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
+  zFLTA = zlenA;
+  zFLTB = zlenB;
+  zFLTC = zlenC;
+
+  xFST = xFLT-fDeadBndX*2;//cm
 
-  
 // Sizes of MRPC pads
 
-  Float_t yPad = 0.505; 
+  Float_t yPad = 0.505;//cm 
   
 // Large not sensitive volumes with CO2 
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
 
   cout <<"************************* TOF geometry **************************"<<endl;
 
-  par[2] = (zFLT1 / 2.);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTA *0.5);
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT2 / 2.);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTB * 0.5);
+  gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT3 / 2.); 
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTC * 0.5); 
+  gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
 
 ////////// Layers before detector ////////////////////
 
-// Alluminium layer in front 1.0 mm thick at the beginning
+// MYlar layer in front 1.0 mm thick at the beginning
   par[0] = -1;
-  par[1] = 0.1;
+  par[1] = 0.1;//cm
   par[2] = -1;
   ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
+  gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium 
+  gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// honeycomb (special Polyethilene Layer of 1cm)
   ycoor = ycoor + par[1];
   par[0] = -1;
-  par[1] = 0.5;
+  par[1] = 0.5;//cm
   par[2] = -1;
   ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 ///////////////// Detector itself //////////////////////
 
-  const Float_t StripWidth = 7.81;//cm
-  const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
-  const Int_t nx = 40; // number of pads along x
-  const Int_t nz = 2;  // number of pads along z
-  const Float_t Gap=4.; //cm  distance between the strip axis
-  const Float_t Space = 5.5; //cm distance from the front plate of the box
+  const Float_t  DeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
+                                          //and the boundary of the strip
+  const Int_t    nx    = fNpadX;          // number of pads along x
+  const Int_t    nz    = fNpadZ;          // number of pads along z
+  const Float_t  Space = fSpace;            //cm distance from the front plate of the box
 
-  Float_t zSenStrip;
-  zSenStrip = StripWidth-2*DeadBound;//cm
+  Float_t zSenStrip  = fZpad*fNpadZ;//cm
+  Float_t StripWidth = zSenStrip + 2*DeadBound;
 
-  par[0] = xFLT/2;
-  par[1] = yPad/2
-  par[2] = StripWidth/2.;
+  par[0] = xFLT*0.5;
+  par[1] = yPad*0.5
+  par[2] = StripWidth*0.5;
   
-  // Glass Layer of detector
+  // glass layer of detector STRip
   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
 
-  // Freon for non-sesitive boundaries
-  par[0] = xFLT/2;
-  par[1] = 0.110/2;
+  // Non-Sesitive Freon boundaries
+  par[0] =  xFLT*0.5;
+  par[1] =  0.110*0.5;//cm
   par[2] = -1;
   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
-  gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
-  // Mylar for non-sesitive boundaries
-  par[1] = 0.025;
-  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
-  gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
-
-  // Mylar for outer layers
-  par[1] = 0.035/2;
-  ycoor = -yPad/2.+par[1];
+  gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
+
+  // MYlar for Internal non-sesitive boundaries
+//  par[1] = 0.025;//cm
+//  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
+//  gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"MANY");
+
+  // MYlar eXternal layers
+  par[1] = 0.035*0.5;//cm
+  ycoor = -yPad*0.5+par[1];
   gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
-  gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
   ycoor += par[1];
  
-  // Graphyte layers
-  par[1] = 0.003/2;
+  // GRaphyte Layers
+  par[1] = 0.003*0.5;
   ycoor += par[1];
   gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
-  gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
 
-  // Freon sensitive layer
-  par[0] = -1;
-  par[1] = 0.110/2.;
-  par[2] = zSenStrip/2.;
+  // freon sensitive layer (Chlorine-Fluorine-Carbon)
+  par[0] = xFST*0.5;
+  par[1] =  0.110*0.5;
+  par[2] = zSenStrip*0.5;
   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
-  gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
+  gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
   
   // Pad definition x & z
   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
 
-  // MRPC pixel itself 
+  // MRPC PAD itself 
   par[0] = -1;
   par[1] = -1; 
   par[2] = -1;
   gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
-  gMC->Gspos("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
-
+  gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
 
 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
-  // 3 (Central) Plate 
-  Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
+  // Plate A (Central) 
+  
+  Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
+
+  Float_t Gap  = fGapA; //cm  distance between the strip axis
   Float_t zpos = 0;
-  Float_t ang;
-  Float_t Offset;  
-  Float_t last;
-  nrot = 0;
+  Float_t ang  = 0;
   Int_t i=1,j=1;
-  zcoor=0;
-  Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
+  nrot  = 0;
+  zcoor = 0;
+  ycoor = -14.5 + Space ; //2 cm over front plate
+
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
+  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  zcoor -= zSenStrip;
+  j++;
+  Int_t UpDown = -1; // UpDown=-1 -> Upper strip
+                     // UpDown=+1 -> Lower strip
   do{
-     ang = atan(zcoor/t);
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot]  ,90.,  0.,90.-ang,90.,-ang,90.);
-     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90.,ang,90.);
-     ycoor = -29./2.+ Space; //2 cm over front plate
+     ang = atan(zcoor/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+     ang /= kRaddeg;
+     ycoor = -14.5+ Space; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     gMC->Gspos("FSTR",j,"FLT3",0.,ycoor,zcoor,idrotm[nrot],"ONLY");
-     gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     ang  = ang/kRaddeg;
-     
-     zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
+     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     j += 2;
      UpDown*= -1; // Alternate strips 
-     i++;
-     j+=2;
-  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
+     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+             UpDown*Gap*TMath::Tan(ang)-
+            (zSenStrip/2)/TMath::Cos(ang);
+  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
   
-  ycoor = -29./2.+ Space; //2 cm over front plate
+  zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
+          UpDown*Gap*TMath::Tan(ang)+
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  Gap = fGapB;
+  zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)-
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  ang = atan(zcoor/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+  ang /= kRaddeg;
+         
+  ycoor = -14.5+ Space; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  ycoor = -hTof/2.+ Space;//2 cm over front plate
+
+  // Plate  B
 
-  // Plate  2
-  zpos = -zFLT3/2-7;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2;
-  zpos -= Offset;
   nrot = 0;
   i=1;
-  // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
+  UpDown = 1;
+  Float_t DeadRegion = 1.0;//cm
+  
+  zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
+         UpDown*Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang)-
+        DeadRegion/TMath::Cos(ang);
+
+  ang = atan(zpos/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ang /= kRaddeg;
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+  gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  i++;
+  UpDown*=-1;
 
   do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
+     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+            UpDown*Gap*TMath::Tan(ang)-
+           (zSenStrip/2)/TMath::Cos(ang);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
-     ycoor = -29./2.+ Space ; //2 cm over front plate
+     ang /= kRaddeg;
+     ycoor = -hTof*0.5+ Space ; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
-     gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang/kRaddeg;
-     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2;
+     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
      UpDown*=-1;
-     i++; 
-  } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
-
-  // Plate  1
-  zpos = -t+zFLT1+3.5;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2.;
-  zpos -= Offset;
+     i++;
+  } while (TMath::Abs(ang*kRaddeg)<22.5);
+  //till we reach a tilting angle of 22.5 degrees
+
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  zpos = zpos - zSenStrip/TMath::Cos(ang);
+
+  do {
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTB/2+zFLTA/2+db);
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     zpos = zpos - zSenStrip/TMath::Cos(ang);
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     i++;
+
+  }  while (zpos-StripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
+
+  // Plate  C
+  
+  zpos = zpos + zSenStrip/TMath::Cos(ang);
+
+  zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
+         Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang);
+
   nrot = 0;
   i=0;
-  ycoor= -29./2.+Space+Gap/2;
+  ycoor= -hTof*0.5+Space+Gap;
 
- do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  do {
      i++;
-     zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
-     gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang /kRaddeg;
-     zpos = zpos - zSenStrip/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2.;
-  }  while (zpos>-t+7.+last);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
+     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
 
-printf("#######################################################\n");
-printf("     Distance from the bound of the FLT3: zFLT3- %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
      zpos = zpos - zSenStrip/TMath::Cos(ang);
-printf("NEXT Distance from the bound of the FLT3: zFLT3- %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-printf("#######################################################\n");
+  }  while (zpos-StripWidth*TMath::Cos(ang)*0.5>-t);
+
 
 ////////// Layers after detector /////////////////
 
-// Honeycomb layer after (3cm)
+// honeycomb (Polyethilene) Layer after (3cm)
 
-  Float_t OverSpace = Space + 7.3;
-///  StripWidth*TMath::Sin(ang) + 1.3;
+  Float_t OverSpace = fOverSpc;//cm
 
   par[0] = -1;
   par[1] = 0.6;
   par[2] = -1;
   ycoor = -yFLT/2 + OverSpace + par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 // Electronics (Cu) after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
+  par[1] = 1.43*0.05*0.5; // 5% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
+  gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// cooling WAter after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
+  par[1] = 36.1*0.02*0.5; // 2% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
+  gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+//Back Plate honycomb (2cm)
   par[0] = -1;
-  par[1] = 2 / 2.;
+  par[1] = 2 *0.5;
   par[2] = -1;
   ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 }
 
 //_____________________________________________________________________________
@@ -448,33 +622,29 @@ void AliTOFv2::DrawModule()
   //
   // Set the volumes visible
   gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
+
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FPLA","SEEN",1);
+  gMC->Gsatt("FPLB","SEEN",1);
+  gMC->Gsatt("FPLC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
+  gMC->Gsatt("FPEA","SEEN",1);
+  gMC->Gsatt("FPEB","SEEN",1);
+  gMC->Gsatt("FPEC","SEEN",1);
+  
+  gMC->Gsatt("FLZ1","SEEN",0);
+  gMC->Gsatt("FLZ2","SEEN",0);
+  gMC->Gsatt("FLZ3","SEEN",0);
+  gMC->Gsatt("FLX1","SEEN",0);
+  gMC->Gsatt("FLX2","SEEN",0);
+  gMC->Gsatt("FLX3","SEEN",0);
+  gMC->Gsatt("FPAD","SEEN",0);
+
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
   gMC->Gsatt("*", "fill", 7);
@@ -505,16 +675,18 @@ void AliTOFv2::Init()
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
-  printf("\n     Version 2 of TOF initialing, "
-        "with openings for PHOS and RICH in symmetric frame\n\n");
+  printf("\n   Version 2 of TOF initialing, "
+             "TOF with holes for PHOS and RICH \n");
 
   AliTOF::Init();
 
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
+  fIdFTOA = gMC->VolId("FTOA");
+  fIdFTOB = gMC->VolId("FTOB");
+  fIdFTOC = gMC->VolId("FTOC");
+  fIdFLTA = gMC->VolId("FLTA");
+  fIdFLTB = gMC->VolId("FLTB");
+  fIdFLTC = gMC->VolId("FLTC");
+
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
@@ -527,19 +699,19 @@ void AliTOFv2::StepManager()
   // Procedure called at each step in the Time Of Flight
   //
   TLorentzVector mom, pos;
-  Float_t hits[8],rho,phi,phid,z;
-  Int_t sector, plate, pad_x, pad_z, strip;
-  Int_t copy, pad_z_id, pad_x_id, strip_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  
+  Float_t xm[3],pm[3],xpad[3],ppad[3];
+  Float_t hits[13],phi,phid,z;
+  Int_t   vol[5];
+  Int_t   sector, plate, pad_x, pad_z, strip;
+  Int_t   copy, pad_z_id, pad_x_id, strip_id, i;
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  Float_t IncidenceAngle;
   
   if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
      && gMC->CurrentVolID(copy)==fIdSens) 
-  {
-    TClonesArray &lhits = *fHits;
-    
-    //_________getting information about hit volumes_____________
+  {    
+    // getting information about hit volumes
     
     pad_z_id=gMC->CurrentVolOffID(2,copy);
     pad_z=copy;  
@@ -550,38 +722,61 @@ void AliTOFv2::StepManager()
     strip_id=gMC->CurrentVolOffID(5,copy);
     strip=copy;  
 
-    pad_z = (strip-1)*2+pad_z;
-
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
 
-    rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-    phi = TMath::ACos(pos[0]/rho);
-    Float_t as = TMath::ASin(pos[1]/rho);
-    if (as<0) phi = 2*3.141592654-phi;
+//    Double_t NormPos=1./pos.Rho();
+    Double_t NormMom=1./mom.Rho();
+
+//  getting the cohordinates in pad ref system
+    xm[0] = (Float_t)pos.X();
+    xm[1] = (Float_t)pos.Y();
+    xm[2] = (Float_t)pos.Z();
+
+    pm[0] = (Float_t)mom.X()*NormMom;
+    pm[1] = (Float_t)mom.Y()*NormMom;
+    pm[2] = (Float_t)mom.Z()*NormMom;
+    gMC->Gmtod(xm,xpad,1);
+    gMC->Gmtod(pm,ppad,2);
+
+    IncidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
 
     z = pos[2];
-   
-    if (z<=62. && z>=-62) plate = 3;
-    if (z<=216. && z>62.)   plate = 4;
-    if (z>=-216. && z<-62.) plate = 2;
-    if (z>216.)  plate = 5;
-    if (z<-216.) plate = 1;
-
-    phid = phi*kRaddeg;
+
+    plate = 0;   
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    if (z < (fZlenA*0.5+fZlenB) && 
+        z >  fZlenA*0.5)               plate = 4;
+    if (z >-(fZlenA*0.5+fZlenB) &&
+        z < -fZlenA*0.5)               plate = 2;
+    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+
+    phi = pos.Phi();
+    phid = phi*kRaddeg+180.;
     sector = Int_t (phid/20.);
     sector++;
 
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
     for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
+      hits[i]   = pos[i];
+      hits[i+3] = pm[i];
     }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);
+
+    hits[6] = mom.Rho();
+    hits[7] = pos[3];
+    hits[8] = xpad[0];
+    hits[9] = xpad[1];
+    hits[10]= xpad[2];
+    hits[11]= IncidenceAngle;
+    hits[12]= gMC->Edep();
+    
+    vol[0]= sector;
+    vol[1]= plate;
+    vol[2]= strip;
+    vol[3]= pad_x;
+    vol[4]= pad_z;
+    
+    AddHit(gAlice->CurrentTrack(),vol, hits);
   }
 }
-
-
index 8f7b6b13267a3769444e0bf4c935848fc702c7ed..d06aa35722709ba511b892877b990963cb9a5ca6 100644 (file)
@@ -6,7 +6,7 @@
 /* $Id$ */
 
 ///////////////////////////////////////////////////////
-//  Manager and hits classes for set:TOF  version 1  //
+//  Manager and hits classes for set:TOF  version 2  //
 ///////////////////////////////////////////////////////
  
 #include "AliTOF.h"
 class AliTOFv2 : public AliTOF {
 
 private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
+  Int_t fIdFTOA;
+  Int_t fIdFTOB;
+  Int_t fIdFTOC;
+  Int_t fIdFLTA;
+  Int_t fIdFLTB;
+  Int_t fIdFLTC;
  
 public:
   AliTOFv2();
   AliTOFv2(const char *name, const char *title);
   virtual       ~AliTOFv2() {}
+  virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
   virtual void   Init();
@@ -35,6 +37,6 @@ public:
   virtual void   DrawModule();
  
    ClassDef(AliTOFv2,1)  //Time Of Flight version 2
-   };
+};
  
 #endif
index b7691b94874f907247d9d1bc1a83c4e96c03b4a7..d2faa91491e983ab0361214e5c70d2ddbe60e92c 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.14.2.1  2000/05/10 09:37:16  vicinanz
+New version with Holes for PHOS/RICH
+
 Revision 1.14  1999/11/05 22:39:06  fca
 New hits structure
 
@@ -40,13 +43,14 @@ Introduction of the Copyright and cvs Log
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-//  Time Of Flight: design of C.Williams                FCA                  //
+//  Time Of Flight: design of C.Williams                    
+//
 //  This class contains the functions for version 1 of the Time Of Flight    //
 //  detector.                                                                //
 //
 //  VERSION WITH 5 MODULES AND TILTED STRIPS 
 //  
-//   FULL COVERAGE VERSION
+//  HOLES FOR RICH DETECTOR
 //
 //   Authors:
 //
@@ -68,8 +72,12 @@ Introduction of the Copyright and cvs Log
 #include <stdlib.h>
 
 #include "AliTOFv3.h"
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
 #include "AliRun.h"
 #include "AliConst.h"
+
  
 ClassImp(AliTOFv3)
  
@@ -83,7 +91,7 @@ AliTOFv3::AliTOFv3()
  
 //_____________________________________________________________________________
 AliTOFv3::AliTOFv3(const char *name, const char *title)
-       : AliTOF(name,title)
+        : AliTOF(name,title)
 {
   //
   // Standard constructor
@@ -95,13 +103,101 @@ AliTOFv3::AliTOFv3(const char *name, const char *title)
   if(!FRAME) {
     Error("Ctor","TOF needs FRAME to be present\n");
     exit(1);
-  } else 
+  } else
     if(FRAME->IsVersion()!=1) {
       Error("Ctor","FRAME version 1 needed with this version of TOF\n");
       exit(1);
     }
 
 }
+
+//_____________________________________________________________________________
+void AliTOFv3::BuildGeometry()
+{
+  //
+  // Build TOF ROOT geometry for the ALICE event display
+  //
+  TNode *Node, *Top;
+  const int kColorTOF  = 27;
+
+  // Find top TNODE
+  Top = gAlice->GetGeometry()->GetNode("alice");
+
+  // Position the different copies
+  const Float_t rTof  =(fRmax+fRmin)/2;
+  const Float_t hTof  = fRmax-fRmin;
+  const Int_t   fNTof = 18;
+  const Float_t kPi   = TMath::Pi();
+  const Float_t angle = 2*kPi/fNTof;
+  Float_t ang;
+
+  // Define TOF basic volume
+  
+  char NodeName0[6], NodeName1[6], NodeName2[6]; 
+  char NodeName3[6], NodeName4[6], RotMatNum[6];
+
+  new TBRIK("S_TOF_C","TOF box","void",
+            120*0.5,hTof*0.5,fZlenC*0.5);
+  new TBRIK("S_TOF_B","TOF box","void",
+            120*0.5,hTof*0.5,fZlenB*0.5);
+  new TBRIK("S_TOF_A","TOF box","void",
+            120*0.5,hTof*0.5,fZlenA*0.5);
+
+  for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
+     
+      if (NodeNum<10) {
+           sprintf(RotMatNum,"rot50%i",NodeNum);
+           sprintf(NodeName0,"FTO00%i",NodeNum);
+           sprintf(NodeName1,"FTO10%i",NodeNum);
+           sprintf(NodeName2,"FTO20%i",NodeNum);
+           sprintf(NodeName3,"FTO30%i",NodeNum);
+           sprintf(NodeName4,"FTO40%i",NodeNum);
+      }
+      if (NodeNum>9) {
+           sprintf(RotMatNum,"rot5%i",NodeNum);
+           sprintf(NodeName0,"FTO0%i",NodeNum);
+           sprintf(NodeName1,"FTO1%i",NodeNum);
+           sprintf(NodeName2,"FTO2%i",NodeNum);
+           sprintf(NodeName3,"FTO3%i",NodeNum);
+           sprintf(NodeName4,"FTO4%i",NodeNum);
+      }
+      new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
+      ang = (4.5-NodeNum) * angle;
+
+      Top->cd();
+      Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd(); 
+      Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+if (NodeNum !=1 && NodeNum!=2 && NodeNum !=18)
+    {
+      Top->cd();
+      Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+  } // Holes for RICH detector
+
+if (NodeNum !=1 && NodeNum !=2 && NodeNum !=18)
+    { 
+      Top->cd();
+      Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+     } // Holes for RICH detector, central part
+  }
+}
+
+
  
 //_____________________________________________________________________________
 void AliTOFv3::CreateGeometry()
@@ -121,322 +217,395 @@ void AliTOFv3::CreateGeometry()
 }
  
 //_____________________________________________________________________________
-void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
+void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
+                    Float_t zlenB, Float_t zlenA, Float_t ztof0)
 {
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
   
   Float_t  ycoor, zcoor;
-  Float_t par[10];
-  
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-
-  Int_t idrotm[100];
-  Int_t nrot = 0;
+  Float_t  par[10];
+  Int_t    *idtmed = fIdtmed->GetArray()-499;
+  Int_t    idrotm[100];
+  Int_t    nrot = 0;
+  Float_t  hTof = fRmax-fRmin;
   
+  Float_t Radius = fRmin+2.;//cm
 
-
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenC * 0.5;
+  gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenB * 0.5;
+  gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
 
 
 // Positioning of modules
 
-   Float_t zcor1 = ztof0 - zlen1/2;
-   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
+   Float_t zcor1 = ztof0 - zlenC*0.5;
+   Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
    Float_t zcor3 = 0.;
 
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
-
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
+   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90,-90.);
+   AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
+   gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
 
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO3", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO3", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
 
-// Subtraction the distance to TOF module boundaries 
+   gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
 
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
+  Float_t db = 0.5;//cm
+  Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
 
-  xFLT = xtof -(.5 +.5)*2;
+  xFLT = fStripLn;
   yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
+  zFLTA = zlenA;
+  zFLTB = zlenB;
+  zFLTC = zlenC;
+
+  xFST = xFLT-fDeadBndX*2;//cm
 
 // Sizes of MRPC pads
 
-  Float_t yPad = 0.505; 
+  Float_t yPad = 0.505;//cm 
   
 // Large not sensitive volumes with CO2 
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
 
   cout <<"************************* TOF geometry **************************"<<endl;
 
-  par[2] = (zFLT1 / 2.);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTA *0.5);
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT2 / 2.);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTB * 0.5);
+  gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT3 / 2.); 
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
+  par[2] = (zFLTC * 0.5); 
+  gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
 
 ////////// Layers before detector ////////////////////
 
-// Alluminium layer in front 1.0 mm thick at the beginning
+// MYlar layer in front 1.0 mm thick at the beginning
   par[0] = -1;
-  par[1] = 0.1;
+  par[1] = 0.1;//cm
   par[2] = -1;
   ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
+  gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium 
+  gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// honeycomb (special Polyethilene Layer of 1cm)
   ycoor = ycoor + par[1];
   par[0] = -1;
-  par[1] = 0.5;
+  par[1] = 0.5;//cm
   par[2] = -1;
   ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 ///////////////// Detector itself //////////////////////
 
-  const Float_t StripWidth = 7.81;//cm
-  const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
-  const Int_t nx = 40; // number of pads along x
-  const Int_t nz = 2;  // number of pads along z
-  const Float_t Gap=4.; //cm  distance between the strip axis
-  const Float_t Space = 5.5; //cm distance from the front plate of the box
+  const Float_t  DeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
+                                          //and the boundary of the strip
+  const Int_t    nx    = fNpadX;          // number of pads along x
+  const Int_t    nz    = fNpadZ;          // number of pads along z
+  const Float_t  Space = fSpace;            //cm distance from the front plate of the box
 
-  Float_t zSenStrip;
-  zSenStrip = StripWidth-2*DeadBound;//cm
+  Float_t zSenStrip  = fZpad*fNpadZ;//cm
+  Float_t StripWidth = zSenStrip + 2*DeadBound;
 
-  par[0] = xFLT/2;
-  par[1] = yPad/2
-  par[2] = StripWidth/2.;
+  par[0] = xFLT*0.5;
+  par[1] = yPad*0.5
+  par[2] = StripWidth*0.5;
   
-  // Glass Layer of detector
+  // glass layer of detector STRip
   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
 
-  // Freon for non-sesitive boundaries
-  par[0] = xFLT/2;
-  par[1] = 0.110/2;
+  // Non-Sesitive Freon boundaries
+  par[0] =  xFLT*0.5;
+  par[1] =  0.110*0.5;//cm
   par[2] = -1;
   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
-  gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
-  // Mylar for non-sesitive boundaries
-  par[1] = 0.025;
-  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
-  gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
-
-  // Mylar for outer layers
-  par[1] = 0.035/2;
-  ycoor = -yPad/2.+par[1];
+  gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
+
+  // MYlar for Internal non-sesitive boundaries
+//  par[1] = 0.025;//cm
+//  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
+//  gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"MANY");
+
+  // MYlar eXternal layers
+  par[1] = 0.035*0.5;//cm
+  ycoor = -yPad*0.5+par[1];
   gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
-  gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
   ycoor += par[1];
  
-  // Graphyte layers
-  par[1] = 0.003/2;
+  // GRaphyte Layers
+  par[1] = 0.003*0.5;
   ycoor += par[1];
   gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
-  gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
-  gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
 
-  // Freon sensitive layer
-  par[0] = -1;
-  par[1] = 0.110/2.;
-  par[2] = zSenStrip/2.;
+  // freon sensitive layer (Chlorine-Fluorine-Carbon)
+  par[0] = xFST*0.5;
+  par[1] =  0.110*0.5;
+  par[2] = zSenStrip*0.5;
   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
-  gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
+  gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
   
   // Pad definition x & z
   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
 
-  // MRPC pixel itself 
+  // MRPC PAD itself 
   par[0] = -1;
   par[1] = -1; 
   par[2] = -1;
   gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
-  gMC->Gspos("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
-
+  gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
 
 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
-  // 3 (Central) Plate 
-  Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
+  // Plate A (Central) 
+  
+  Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
+
+  Float_t Gap  = fGapA; //cm  distance between the strip axis
   Float_t zpos = 0;
-  Float_t ang;
-  Float_t Offset;  
-  Float_t last;
-  nrot = 0;
+  Float_t ang  = 0;
   Int_t i=1,j=1;
-  zcoor=0;
-  Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
+  nrot  = 0;
+  zcoor = 0;
+  ycoor = -14.5 + Space ; //2 cm over front plate
+
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
+  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  zcoor -= zSenStrip;
+  j++;
+  Int_t UpDown = -1; // UpDown=-1 -> Upper strip
+                     // UpDown=+1 -> Lower strip
   do{
-     ang = atan(zcoor/t);
-     ang = ang * kRaddeg;
-     AliMatrix (idrotm[nrot]  ,90.,  0.,90.-ang,90.,-ang,90.);
-     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang,90.);
-     ycoor = -29./2.+ Space; //2 cm over front plate
+     ang = atan(zcoor/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+     ang /= kRaddeg;
+     ycoor = -14.5+ Space; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     gMC->Gspos("FSTR",j,"FLT3",0.,ycoor,zcoor,idrotm[nrot],"ONLY");
-     gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     ang  = ang / kRaddeg;     
-     zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
+     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     j += 2;
      UpDown*= -1; // Alternate strips 
-     i++;
-     j+=2;
-  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
+     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+             UpDown*Gap*TMath::Tan(ang)-
+            (zSenStrip/2)/TMath::Cos(ang);
+  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
   
-  ycoor = -29./2.+ Space; //2 cm over front plate
+  zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
+          UpDown*Gap*TMath::Tan(ang)+
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  Gap = fGapB;
+  zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)-
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  ang = atan(zcoor/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+  ang /= kRaddeg;
+         
+  ycoor = -14.5+ Space; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  ycoor = -hTof/2.+ Space;//2 cm over front plate
+
+  // Plate  B
 
-  // Plate  2
-  zpos = -zFLT3/2-7;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2;
-  zpos -= Offset;
   nrot = 0;
   i=1;
-  // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
+  UpDown = 1;
+  Float_t DeadRegion = 1.0;//cm
+  
+  zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
+         UpDown*Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang)-
+        DeadRegion/TMath::Cos(ang);
+
+  ang = atan(zpos/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ang /= kRaddeg;
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+  gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  i++;
+  UpDown*=-1;
 
   do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
+     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+            UpDown*Gap*TMath::Tan(ang)-
+           (zSenStrip/2)/TMath::Cos(ang);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
-     ycoor = -29./2.+ Space ; //2 cm over front plate
+     ang /= kRaddeg;
+     ycoor = -hTof*0.5+ Space ; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
-     zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
-     gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang/kRaddeg;
-     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2;
+     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
      UpDown*=-1;
-     i++; 
-  } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
-
-  // Plate  1
-  zpos = -t+zFLT1+3.5;
-  ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-  Offset = StripWidth*TMath::Cos(ang)/2.;
-  zpos -= Offset;
+     i++;
+  } while (TMath::Abs(ang*kRaddeg)<22.5);
+  //till we reach a tilting angle of 22.5 degrees
+
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  zpos = zpos - zSenStrip/TMath::Cos(ang);
+
+  do {
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTB/2+zFLTA/2+db);
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     zpos = zpos - zSenStrip/TMath::Cos(ang);
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     i++;
+
+  }  while (zpos-StripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
+
+  // Plate  C
+  
+  zpos = zpos + zSenStrip/TMath::Cos(ang);
+
+  zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
+         Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang);
+
   nrot = 0;
   i=0;
-  ycoor= -29./2.+Space+Gap/2;
+  ycoor= -hTof*0.5+Space+Gap;
 
- do {
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  do {
      i++;
-     zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
-     gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang/kRaddeg;
-     zpos = zpos - zSenStrip/TMath::Cos(ang);
-     last = StripWidth*TMath::Cos(ang)/2.;
-  }  while (zpos>-t+7.+last);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
+     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
 
-printf("#######################################################\n");
-printf("     Distance from the bound of the FLT3: %f cm \n",t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-     ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
      zpos = zpos - zSenStrip/TMath::Cos(ang);
-printf("NEXT Distance from the bound of the FLT3: %f cm \n",t+zpos-(zSenStrip/2)/TMath::Cos(ang));
-printf("#######################################################\n");
+  }  while (zpos-StripWidth*TMath::Cos(ang)*0.5>-t);
+
 
 ////////// Layers after detector /////////////////
 
-// Honeycomb layer after (3cm)
+// honeycomb (Polyethilene) Layer after (3cm)
 
-  Float_t OverSpace = Space + 7.3;
-///  StripWidth*TMath::Sin(ang) + 1.3;
+  Float_t OverSpace = fOverSpc;//cm
 
   par[0] = -1;
   par[1] = 0.6;
   par[2] = -1;
   ycoor = -yFLT/2 + OverSpace + par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 // Electronics (Cu) after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
+  par[1] = 1.43*0.05*0.5; // 5% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
+  gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// cooling WAter after
   ycoor += par[1];
   par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
+  par[1] = 36.1*0.02*0.5; // 2% of X0
   par[2] = -1;
   ycoor += par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
+  gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+//Back Plate honycomb (2cm)
   par[0] = -1;
-  par[1] = 2 / 2.;
+  par[1] = 2 *0.5;
   par[2] = -1;
   ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 }
 
 //_____________________________________________________________________________
@@ -453,33 +622,29 @@ void AliTOFv3::DrawModule()
   //
   // Set the volumes visible
   gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
+
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FPLA","SEEN",1);
+  gMC->Gsatt("FPLB","SEEN",1);
+  gMC->Gsatt("FPLC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
+  gMC->Gsatt("FPEA","SEEN",1);
+  gMC->Gsatt("FPEB","SEEN",1);
+  gMC->Gsatt("FPEC","SEEN",1);
+  
+  gMC->Gsatt("FLZ1","SEEN",0);
+  gMC->Gsatt("FLZ2","SEEN",0);
+  gMC->Gsatt("FLZ3","SEEN",0);
+  gMC->Gsatt("FLX1","SEEN",0);
+  gMC->Gsatt("FLX2","SEEN",0);
+  gMC->Gsatt("FLX3","SEEN",0);
+  gMC->Gsatt("FPAD","SEEN",0);
+
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
   gMC->Gsatt("*", "fill", 7);
@@ -510,16 +675,17 @@ void AliTOFv3::Init()
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
-  printf("\n     Version 3 of TOF initialing, "
-        "symmetric TOF\n\n");
+  printf("\n   Version 3 of TOF initialing, "
+             "TOF with holes for RICH detector\n");
 
   AliTOF::Init();
 
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
+  fIdFTOA = gMC->VolId("FTOA");
+  fIdFTOB = gMC->VolId("FTOB");
+  fIdFTOC = gMC->VolId("FTOC");
+  fIdFLTA = gMC->VolId("FLTA");
+  fIdFLTB = gMC->VolId("FLTB");
+  fIdFLTC = gMC->VolId("FLTC");
 
   printf("**************************************"
         "  TOF  "
@@ -533,19 +699,19 @@ void AliTOFv3::StepManager()
   // Procedure called at each step in the Time Of Flight
   //
   TLorentzVector mom, pos;
-  Float_t hits[8],rho,phi,phid,z;
-  Int_t sector, plate, pad_x, pad_z, strip;
-  Int_t copy, pad_z_id, pad_x_id, strip_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  
+  Float_t xm[3],pm[3],xpad[3],ppad[3];
+  Float_t hits[13],phi,phid,z;
+  Int_t   vol[5];
+  Int_t   sector, plate, pad_x, pad_z, strip;
+  Int_t   copy, pad_z_id, pad_x_id, strip_id, i;
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  Float_t IncidenceAngle;
   
   if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
      && gMC->CurrentVolID(copy)==fIdSens) 
-  {
-    TClonesArray &lhits = *fHits;
-    
-    //_________getting information about hit volumes_____________
+  {    
+    // getting information about hit volumes
     
     pad_z_id=gMC->CurrentVolOffID(2,copy);
     pad_z=copy;  
@@ -556,37 +722,61 @@ void AliTOFv3::StepManager()
     strip_id=gMC->CurrentVolOffID(5,copy);
     strip=copy;  
 
-    pad_z = (strip-1)*2+pad_z;
-
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
 
-    rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-    phi = TMath::ACos(pos[0]/rho);
-    Float_t as = TMath::ASin(pos[1]/rho);
-    if (as<0) phi = 2*3.141592654-phi;
+//    Double_t NormPos=1./pos.Rho();
+    Double_t NormMom=1./mom.Rho();
+
+//  getting the cohordinates in pad ref system
+    xm[0] = (Float_t)pos.X();
+    xm[1] = (Float_t)pos.Y();
+    xm[2] = (Float_t)pos.Z();
+
+    pm[0] = (Float_t)mom.X()*NormMom;
+    pm[1] = (Float_t)mom.Y()*NormMom;
+    pm[2] = (Float_t)mom.Z()*NormMom;
+    gMC->Gmtod(xm,xpad,1);
+    gMC->Gmtod(pm,ppad,2);
+
+    IncidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
 
     z = pos[2];
-   
-    if (z<=62. && z>=-62) plate = 3;
-    if (z<=216. && z>62.)   plate = 4;
-    if (z>=-216. && z<-62.) plate = 2;
-    if (z>216.)  plate = 5;
-    if (z<-216.) plate = 1;
-
-    phid = phi*kRaddeg;
+
+    plate = 0;   
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    if (z < (fZlenA*0.5+fZlenB) && 
+        z >  fZlenA*0.5)               plate = 4;
+    if (z >-(fZlenA*0.5+fZlenB) &&
+        z < -fZlenA*0.5)               plate = 2;
+    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+
+    phi = pos.Phi();
+    phid = phi*kRaddeg+180.;
     sector = Int_t (phid/20.);
     sector++;
 
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
     for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
+      hits[i]   = pos[i];
+      hits[i+3] = pm[i];
     }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);
+
+    hits[6] = mom.Rho();
+    hits[7] = pos[3];
+    hits[8] = xpad[0];
+    hits[9] = xpad[1];
+    hits[10]= xpad[2];
+    hits[11]= IncidenceAngle;
+    hits[12]= gMC->Edep();
+    
+    vol[0]= sector;
+    vol[1]= plate;
+    vol[2]= strip;
+    vol[3]= pad_x;
+    vol[4]= pad_z;
+    
+    AddHit(gAlice->CurrentTrack(),vol, hits);
   }
 }
-
index eef794f41b5570820b0846733fbb4bb92a9ea73b..7adda200898162cd32dd9c8b67bbc8b7e6933fbe 100644 (file)
 class AliTOFv3 : public AliTOF {
 
 private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
+  Int_t fIdFTOA;
+  Int_t fIdFTOB;
+  Int_t fIdFTOC;
+  Int_t fIdFLTA;
+  Int_t fIdFLTB;
+  Int_t fIdFLTC;
  
 public:
   AliTOFv3();
   AliTOFv3(const char *name, const char *title);
   virtual       ~AliTOFv3() {}
+  virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
   virtual void   Init();
index b6a524f6917b9b5ed431abd0550607e03bf2cf3a..c8e467e81b29f6349aa7c941990bce0c8b7bc8fc 100644 (file)
 
 /*
 $Log$
-Revision 1.4  1999/11/05 22:39:06  fca
+Revision 1.4.2.1  2000/05/10 09:37:16  vicinanz
+New version with Holes for PHOS/RICH
+
+Revision 1.14  1999/11/05 22:39:06  fca
 New hits structure
 
-Revision 1.3  1999/11/01 20:41:57  fca
+Revision 1.13  1999/11/02 11:26:39  fca
+added stdlib.h for exit
+
+Revision 1.12  1999/11/01 20:41:57  fca
 Added protections against using the wrong version of FRAME
 
-Revision 1.2  1999/10/16 19:22:18  fca
+Revision 1.11  1999/10/22 08:04:14  fca
+Correct improper use of negative parameters
+
+Revision 1.10  1999/10/16 19:30:06  fca
 Corrected Rotation Matrix and CVS log
 
-Revision 1.1  1999/10/15 15:35:20  fca
+Revision 1.9  1999/10/15 15:35:20  fca
 New version for frame1099 with and without holes
 
+Revision 1.8  1999/09/29 09:24:33  fca
+Introduction of the Copyright and cvs Log
+
 */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-//  Time Of Flight: design of C.Williams                FCA                  //
+//  Time Of Flight: design of C.Williams                  
+//
 //  This class contains the functions for version 1 of the Time Of Flight    //
 //  detector.                                                                //
 //
-//  VERSION WITH 5 MODULES AND FLAT PLATE
+//  VERSION WITH 5 MODULES AND TILTED STRIP
 //  
-//   WITH HOLES FOR PHOS AND HMPID inside the 
-//   SPACE FRAME WITH HOLES
+//   FULL COVERAGE VERSION
 //
 //   Authors:
 //
 //   Alessio Seganti
-//   Domenico Vicinanza 
+//   Domenico Vicinanza
 //
 //   University of Salerno - Italy
 //
@@ -60,8 +72,12 @@ New version for frame1099 with and without holes
 #include <stdlib.h>
 
 #include "AliTOFv4.h"
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TObject.h"
 #include "AliRun.h"
 #include "AliConst.h"
+
  
 ClassImp(AliTOFv4)
  
@@ -75,7 +91,7 @@ AliTOFv4::AliTOFv4()
  
 //_____________________________________________________________________________
 AliTOFv4::AliTOFv4(const char *name, const char *title)
-       : AliTOF(name,title)
+        : AliTOF(name,title)
 {
   //
   // Standard constructor
@@ -87,13 +103,96 @@ AliTOFv4::AliTOFv4(const char *name, const char *title)
   if(!FRAME) {
     Error("Ctor","TOF needs FRAME to be present\n");
     exit(1);
-  } else 
-    if(FRAME->IsVersion()!=0) {
-      Error("Ctor","FRAME version 0 needed with this version of TOF\n");
+  } else
+    if(FRAME->IsVersion()!=1) {
+      Error("Ctor","FRAME version 1 needed with this version of TOF\n");
       exit(1);
     }
+}
+
+//_____________________________________________________________________________
+void AliTOFv4::BuildGeometry()
+{
+  //
+  // Build TOF ROOT geometry for the ALICE event display
+  //
+  TNode *Node, *Top;
+  const int kColorTOF  = 27;
+
+  // Find top TNODE
+  Top = gAlice->GetGeometry()->GetNode("alice");
 
+  // Position the different copies
+  const Float_t rTof  =(fRmax+fRmin)/2;
+  const Float_t hTof  = fRmax-fRmin;
+  const Int_t   fNTof = 18;
+  const Float_t kPi   = TMath::Pi();
+  const Float_t angle = 2*kPi/fNTof;
+  Float_t ang;
+
+  // Define TOF basic volume
+  
+  char NodeName0[6], NodeName1[6], NodeName2[6]; 
+  char NodeName3[6], NodeName4[6], RotMatNum[6];
+
+  new TBRIK("S_TOF_C","TOF box","void",
+            120*0.5,hTof*0.5,fZlenC*0.5);
+  new TBRIK("S_TOF_B","TOF box","void",
+            120*0.5,hTof*0.5,fZlenB*0.5);
+  new TBRIK("S_TOF_A","TOF box","void",
+            120*0.5,hTof*0.5,fZlenA*0.5);
+
+  for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
+     
+      if (NodeNum<10) {
+           sprintf(RotMatNum,"rot50%i",NodeNum);
+           sprintf(NodeName0,"FTO00%i",NodeNum);
+           sprintf(NodeName1,"FTO10%i",NodeNum);
+           sprintf(NodeName2,"FTO20%i",NodeNum);
+           sprintf(NodeName3,"FTO30%i",NodeNum);
+           sprintf(NodeName4,"FTO40%i",NodeNum);
+      }
+      if (NodeNum>9) {
+           sprintf(RotMatNum,"rot5%i",NodeNum);
+           sprintf(NodeName0,"FTO0%i",NodeNum);
+           sprintf(NodeName1,"FTO1%i",NodeNum);
+           sprintf(NodeName2,"FTO2%i",NodeNum);
+           sprintf(NodeName3,"FTO3%i",NodeNum);
+           sprintf(NodeName4,"FTO4%i",NodeNum);
+      }
+      new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
+      ang = (4.5-NodeNum) * angle;
+
+      Top->cd();
+      Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd(); 
+      Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+
+      Top->cd();
+      Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
+      Node->SetLineColor(kColorTOF);
+      fNodes->Add(Node); 
+  }
 }
+
+
  
 //_____________________________________________________________________________
 void AliTOFv4::CreateGeometry()
@@ -113,220 +212,398 @@ void AliTOFv4::CreateGeometry()
 }
  
 //_____________________________________________________________________________
-void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
+void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
+                    Float_t zlenB, Float_t zlenA, Float_t ztof0)
 {
   //
   // Definition of the Time Of Fligh Resistive Plate Chambers
   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
   
-  Int_t idrotm[100];
   Float_t  ycoor, zcoor;
-  Float_t par[10];
-  Float_t yFREON, xp, yp, zp;
+  Float_t  par[10];
+  Int_t    *idtmed = fIdtmed->GetArray()-499;
+  Int_t    idrotm[100];
+  Int_t    nrot = 0;
+  Float_t  hTof = fRmax-fRmin;
   
-  Int_t *idtmed = fIdtmed->GetArray()-499;
+  Float_t Radius = fRmin+2.;//cm
 
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
+  par[0] =  xtof * 0.5;
+  par[1] =  ytof * 0.5;
+  par[2] = zlenC * 0.5;
+  gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenB * 0.5;
+  gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
+  par[2] = zlenA * 0.5;
+  gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
 
 
 // Positioning of modules
 
-   Float_t zcor1 = ztof0 - zlen1/2;
-   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
+   Float_t zcor1 = ztof0 - zlenC*0.5;
+   Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
    Float_t zcor3 = 0.;
 
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   zcoor = (zlen1/2.);
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-   zcoor = 0.;
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcoor, 0, idrotm[0], "ONLY");
-   
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   zcoor = -zlen2/2.;
-   gMC->Gspos("FTO2", 0, "BTO2", 0,  zcoor, 0, idrotm[0], "ONLY");
-
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-
-// Subtraction the distance to TOF module boundaries 
-
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
-
-  xFLT = xtof -(.5 +.5)*2;
+   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90,-90.);
+   AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
+   gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
+   gMC->Gspos("FTOB", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
+
+   gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
+   gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
+
+  Float_t db = 0.5;//cm
+  Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
+
+  xFLT = fStripLn;
   yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
-  
+  zFLTA = zlenA;
+  zFLTB = zlenB;
+  zFLTC = zlenC;
 
-  
-// freon gaps in MRPC chamber 
-  yFREON = .11; //cm
+  xFST = xFLT-fDeadBndX*2;//cm
 
 // Sizes of MRPC pads
 
-  xp = 3.0; 
-  yp = 12.3*0.05; // 5% X0 of glass 
-  zp = 3.0;
-
-//  Subtraction of dead boundaries in X=2 cm and Z=7/2 cm 
-
-cout <<"************************* TOF geometry **************************"<<endl;
-
-  Int_t nz1, nz2, nz3, nx; //- numbers of pixels
-  nx = Int_t (xFLT/xp);
+  Float_t yPad = 0.505;//cm 
+  
+// Large not sensitive volumes with CO2 
+  par[0] = xFLT*0.5;
+  par[1] = yFLT*0.5;
 
-  printf("Number of pixel along x axis = %i",nx);
+  cout <<"************************* TOF geometry **************************"<<endl;
 
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
-  par[2] = (zFLT1 / 2.);
-  nz1 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 1) = %i",nz1);
+  par[2] = (zFLTA *0.5);
+  gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT2 / 2.);
-  nz2 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 2) = %i",nz2);
+  par[2] = (zFLTB * 0.5);
+  gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
 
-  par[2] = (zFLT3 / 2.); 
-  nz3 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 3) = %i",nz3);
+  par[2] = (zFLTC * 0.5); 
+  gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
+  gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
 
 ////////// Layers before detector ////////////////////
 
-// Alluminium layer in front 1.0 mm thick at the beginning
+// MYlar layer in front 1.0 mm thick at the beginning
   par[0] = -1;
-  par[1] = 0.1;
+  par[1] = 0.1;//cm
   par[2] = -1;
   ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
+  gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
+  gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium 
+  gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// honeycomb (special Polyethilene Layer of 1cm)
   ycoor = ycoor + par[1];
   par[0] = -1;
-  par[1] = 0.5;
+  par[1] = 0.5;//cm
   par[2] = -1;
   ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 ///////////////// Detector itself //////////////////////
 
-  const Float_t SpaceBefore=2.; // Space Beetween detector &  Front Panel
+  const Float_t  DeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
+                                          //and the boundary of the strip
+  const Int_t    nx    = fNpadX;          // number of pads along x
+  const Int_t    nz    = fNpadZ;          // number of pads along z
+  const Float_t  Space = fSpace;            //cm distance from the front plate of the box
 
-  par[0] = -1;
-  par[1] = yp/2; // 5 %X0 thick of glass  
+  Float_t zSenStrip  = fZpad*fNpadZ;//cm
+  Float_t StripWidth = zSenStrip + 2*DeadBound;
+
+  par[0] = xFLT*0.5;
+  par[1] = yPad*0.5; 
+  par[2] = StripWidth*0.5;
+  
+  // glass layer of detector STRip
+  gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
+
+  // Non-Sesitive Freon boundaries
+  par[0] =  xFLT*0.5;
+  par[1] =  0.110*0.5;//cm
   par[2] = -1;
-  ycoor = -yFLT/2 + SpaceBefore;
-  gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-  gMC->Gsdvn("FLZ1", "FLD1", nz1, 3); //pixel size xp=zp=3
-  gMC->Gsdvn("FLZ2", "FLD2", nz2, 3); 
-  gMC->Gsdvn("FLZ3", "FLD3", nz3, 3); 
-  gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
-  gMC->Gsdvn("FLX2", "FLZ2", nx, 1); 
-  gMC->Gsdvn("FLX3", "FLZ3", nx, 1); 
-
-// MRPC pixel itself 
-  par[0] = -1;//xp/2;
-  par[1] = -1;//yp/2; // 5 %X0 thick of glass  
-  par[2] = -1;//zp/2;
-  gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
-  gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
-
-// Freon gas sencitive vol.ume
+  gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
+  gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
+
+  // MYlar for Internal non-sesitive boundaries
+//  par[1] = 0.025;//cm
+//  gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
+//  gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"MANY");
+
+  // MYlar eXternal layers
+  par[1] = 0.035*0.5;//cm
+  ycoor = -yPad*0.5+par[1];
+  gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
+  gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+  ycoor += par[1];
+  // GRaphyte Layers
+  par[1] = 0.003*0.5;
+  ycoor += par[1];
+  gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
+  gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
+  gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
+
+  // freon sensitive layer (Chlorine-Fluorine-Carbon)
+  par[0] = xFST*0.5;
+  par[1] =  0.110*0.5;
+  par[2] = zSenStrip*0.5;
+  gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
+  gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
+  
+  // Pad definition x & z
+  gMC->Gsdvn("FLZ","FCFC", nz, 3); 
+  gMC->Gsdvn("FLX","FLZ" , nx, 1); 
+
+  // MRPC PAD itself 
   par[0] = -1;
-  par[1] = yFREON/2;
+  par[1] = -1; 
   par[2] = -1;
-  gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);// Freon 
-  gMC->Gspos("FPAD", 0, "FPA0", 0., 0., 0., 0, "ONLY");
+  gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
+  gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
 
-////////// Layers after detector ////////////////////
+////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
-  const Float_t SpaceAfter = 6.; //Space beetween detector & Back Panel
+  // Plate A (Central) 
+  
+  Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
+
+  Float_t Gap  = fGapA; //cm  distance between the strip axis
+  Float_t zpos = 0;
+  Float_t ang  = 0;
+  Int_t i=1,j=1;
+  nrot  = 0;
+  zcoor = 0;
+  ycoor = -14.5 + Space ; //2 cm over front plate
+
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
+  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  zcoor -= zSenStrip;
+  j++;
+  Int_t UpDown = -1; // UpDown=-1 -> Upper strip
+                     // UpDown=+1 -> Lower strip
+  do{
+     ang = atan(zcoor/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+     ang /= kRaddeg;
+     ycoor = -14.5+ Space; //2 cm over front plate
+     ycoor += (1-(UpDown+1)/2)*Gap;
+     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     j += 2;
+     UpDown*= -1; // Alternate strips 
+     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+             UpDown*Gap*TMath::Tan(ang)-
+            (zSenStrip/2)/TMath::Cos(ang);
+  } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
+  
+  zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
+          UpDown*Gap*TMath::Tan(ang)+
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  Gap = fGapB;
+  zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+          UpDown*Gap*TMath::Tan(ang)-
+          (zSenStrip/2)/TMath::Cos(ang);
+
+  ang = atan(zcoor/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
+  ang /= kRaddeg;
+         
+  ycoor = -14.5+ Space; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+
+     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  ycoor = -hTof/2.+ Space;//2 cm over front plate
+
+  // Plate  B
+
+  nrot = 0;
+  i=1;
+  UpDown = 1;
+  Float_t DeadRegion = 1.0;//cm
   
-// Honeycomb layer after (3cm)
+  zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
+         UpDown*Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang)-
+        DeadRegion/TMath::Cos(ang);
+
+  ang = atan(zpos/Radius);
+  ang *= kRaddeg;
+  AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+  ang /= kRaddeg;
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  ycoor += (1-(UpDown+1)/2)*Gap;
+  zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+  gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+  i++;
+  UpDown*=-1;
+
+  do {
+     zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
+            UpDown*Gap*TMath::Tan(ang)-
+           (zSenStrip/2)/TMath::Cos(ang);
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+     ycoor += (1-(UpDown+1)/2)*Gap;
+     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     UpDown*=-1;
+     i++;
+  } while (TMath::Abs(ang*kRaddeg)<22.5);
+  //till we reach a tilting angle of 22.5 degrees
+
+  ycoor = -hTof*0.5+ Space ; //2 cm over front plate
+  zpos = zpos - zSenStrip/TMath::Cos(ang);
+
+  do {
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTB/2+zFLTA/2+db);
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     zpos = zpos - zSenStrip/TMath::Cos(ang);
+     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     i++;
+
+  }  while (zpos-StripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
+
+  // Plate  C
+  
+  zpos = zpos + zSenStrip/TMath::Cos(ang);
+
+  zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
+         Gap*TMath::Tan(ang)-
+        (zSenStrip/2)/TMath::Cos(ang);
+
+  nrot = 0;
+  i=0;
+  ycoor= -hTof*0.5+Space+Gap;
+
+  do {
+     i++;
+     ang = atan(zpos/Radius);
+     ang *= kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
+     ang /= kRaddeg;
+     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
+     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+
+     printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+
+     zpos = zpos - zSenStrip/TMath::Cos(ang);
+  }  while (zpos-StripWidth*TMath::Cos(ang)*0.5>-t);
+
+
+////////// Layers after detector /////////////////
+
+// honeycomb (Polyethilene) Layer after (3cm)
+
+  Float_t OverSpace = fOverSpc;//cm
+
   par[0] = -1;
   par[1] = 0.6;
   par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter - par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  ycoor = -yFLT/2 + OverSpace + par[1];
+  gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 
 // Electronics (Cu) after
+  ycoor += par[1];
   par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
+  par[1] = 1.43*0.05*0.5; // 5% of X0
   par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter +par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
-  ycoor = ycoor+par[1];
+  ycoor += par[1];
+  gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
+  gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+// cooling WAter after
+  ycoor += par[1];
   par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
+  par[1] = 36.1*0.02*0.5; // 2% of X0
   par[2] = -1;
-  ycoor = ycoor+par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
+  ycoor += par[1];
+  gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
+  gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
+
+//Back Plate honycomb (2cm)
   par[0] = -1;
-  par[1] = 1.;
+  par[1] = 2 *0.5;
   par[2] = -1;
   ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
+  gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
+  gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
 }
 
 //_____________________________________________________________________________
@@ -343,33 +620,29 @@ void AliTOFv4::DrawModule()
   //
   // Set the volumes visible
   gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
+
+  gMC->Gsatt("FTOA","SEEN",1);
+  gMC->Gsatt("FTOB","SEEN",1);
+  gMC->Gsatt("FTOC","SEEN",1);
+  gMC->Gsatt("FLTA","SEEN",1);
+  gMC->Gsatt("FLTB","SEEN",1);
+  gMC->Gsatt("FLTC","SEEN",1);
+  gMC->Gsatt("FPLA","SEEN",1);
+  gMC->Gsatt("FPLB","SEEN",1);
+  gMC->Gsatt("FPLC","SEEN",1);
+  gMC->Gsatt("FSTR","SEEN",1);
+  gMC->Gsatt("FPEA","SEEN",1);
+  gMC->Gsatt("FPEB","SEEN",1);
+  gMC->Gsatt("FPEC","SEEN",1);
+  
+  gMC->Gsatt("FLZ1","SEEN",0);
+  gMC->Gsatt("FLZ2","SEEN",0);
+  gMC->Gsatt("FLZ3","SEEN",0);
+  gMC->Gsatt("FLX1","SEEN",0);
+  gMC->Gsatt("FLX2","SEEN",0);
+  gMC->Gsatt("FLX3","SEEN",0);
+  gMC->Gsatt("FPAD","SEEN",0);
+
   gMC->Gdopt("hide", "on");
   gMC->Gdopt("shad", "on");
   gMC->Gsatt("*", "fill", 7);
@@ -400,16 +673,18 @@ void AliTOFv4::Init()
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
-  printf("\n     Version 4 of TOF initialing, "
-        "with openings for PHOS and RICH\n\n");
+  printf("\n   Version 4 of TOF initialing, "
+             "symmetric TOF - Full Coverage version\n");
 
   AliTOF::Init();
 
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
+  fIdFTOA = gMC->VolId("FTOA");
+  fIdFTOB = gMC->VolId("FTOB");
+  fIdFTOC = gMC->VolId("FTOC");
+  fIdFLTA = gMC->VolId("FLTA");
+  fIdFLTB = gMC->VolId("FLTB");
+  fIdFLTC = gMC->VolId("FLTC");
+
   printf("**************************************"
         "  TOF  "
         "**************************************\n");
@@ -422,52 +697,84 @@ void AliTOFv4::StepManager()
   // Procedure called at each step in the Time Of Flight
   //
   TLorentzVector mom, pos;
-  Float_t hits[8],rho,z,phi,phid;
-  Int_t sector, plate, pad_x, pad_z;
-  Int_t copy, pad_x_id, pad_z_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  if(gMC->GetMedium()==idtmed[514-1] && 
+  Float_t xm[3],pm[3],xpad[3],ppad[3];
+  Float_t hits[13],phi,phid,z;
+  Int_t   vol[5];
+  Int_t   sector, plate, pad_x, pad_z, strip;
+  Int_t   copy, pad_z_id, pad_x_id, strip_id, i;
+  Int_t   *idtmed = fIdtmed->GetArray()-499;
+  Float_t IncidenceAngle;
+  
+  if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
-     && gMC->CurrentVolID(copy)==fIdSens) {
-    TClonesArray &lhits = *fHits;
-
-
-    //_________getting information about hit volumes_____________
+     && gMC->CurrentVolID(copy)==fIdSens) 
+  {    
+    // getting information about hit volumes
     
-    pad_z_id=gMC->CurrentVolOffID(3,copy);
+    pad_z_id=gMC->CurrentVolOffID(2,copy);
     pad_z=copy;  
     
-    pad_x_id=gMC->CurrentVolOffID(2,copy);
+    pad_x_id=gMC->CurrentVolOffID(1,copy);
     pad_x=copy;  
     
-   gMC->TrackPosition(pos);
-   gMC->TrackMomentum(mom);
-
-   rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-   phi = TMath::ACos(pos[0]/rho);
-   Float_t as = TMath::ASin(pos[1]/rho);
-   if (as<0) phi = 2*3.141592654-phi;
-
-   z = pos[2];
-   
-   if (z<=62. && z>=-62)  plate = 3;
-   if (z<=216. && z>62.)   plate = 4;
-   if (z>=-216. && z<-62.) plate = 2;
-   if (z>216.)  plate = 5;
-   if (z<-216.) plate = 1;
-
-   phid = phi*kRaddeg;
-   sector = Int_t (phid/20.);
-   sector++;
-
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
+    strip_id=gMC->CurrentVolOffID(5,copy);
+    strip=copy;  
+
+    gMC->TrackPosition(pos);
+    gMC->TrackMomentum(mom);
+
+//    Double_t NormPos=1./pos.Rho();
+    Double_t NormMom=1./mom.Rho();
+
+//  getting the cohordinates in pad ref system
+    xm[0] = (Float_t)pos.X();
+    xm[1] = (Float_t)pos.Y();
+    xm[2] = (Float_t)pos.Z();
+
+    pm[0] = (Float_t)mom.X()*NormMom;
+    pm[1] = (Float_t)mom.Y()*NormMom;
+    pm[2] = (Float_t)mom.Z()*NormMom;
+    gMC->Gmtod(xm,xpad,1);
+    gMC->Gmtod(pm,ppad,2);
+
+    IncidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
+
+    z = pos[2];
+
+    plate = 0;   
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    if (z < (fZlenA*0.5+fZlenB) && 
+        z >  fZlenA*0.5)               plate = 4;
+    if (z >-(fZlenA*0.5+fZlenB) &&
+        z < -fZlenA*0.5)               plate = 2;
+    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+
+    phi = pos.Phi();
+    phid = phi*kRaddeg+180.;
+    sector = Int_t (phid/20.);
+    sector++;
+
     for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
+      hits[i]   = pos[i];
+      hits[i+3] = pm[i];
     }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector,plate,pad_x,pad_z,hits);
+
+    hits[6] = mom.Rho();
+    hits[7] = pos[3];
+    hits[8] = xpad[0];
+    hits[9] = xpad[1];
+    hits[10]= xpad[2];
+    hits[11]= IncidenceAngle;
+    hits[12]= gMC->Edep();
+    
+    vol[0]= sector;
+    vol[1]= plate;
+    vol[2]= strip;
+    vol[3]= pad_x;
+    vol[4]= pad_z;
+    
+    AddHit(gAlice->CurrentTrack(),vol, hits);
   }
 }
index 4491955311c4f7c9827b2743f0290d2148dc5f75..0cfdb40b8aa904c78c779c631a6893427ada7330 100644 (file)
 class AliTOFv4 : public AliTOF {
 
 private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
+  Int_t fIdFTOA;
+  Int_t fIdFTOB;
+  Int_t fIdFTOC;
+  Int_t fIdFLTA;
+  Int_t fIdFLTB;
+  Int_t fIdFLTC;
  
 public:
   AliTOFv4();
   AliTOFv4(const char *name, const char *title);
   virtual       ~AliTOFv4() {}
+  virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
   virtual void   Init();
diff --git a/TOF/AliTOFv5.cxx b/TOF/AliTOFv5.cxx
deleted file mode 100644 (file)
index 83545ce..0000000
+++ /dev/null
@@ -1,475 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/*
-$Log$
-Revision 1.4  1999/11/05 22:39:06  fca
-New hits structure
-
-Revision 1.3  1999/11/01 20:41:58  fca
-Added protections against using the wrong version of FRAME
-
-Revision 1.2  1999/10/16 19:21:57  fca
-Corrected Rotation Matrix and CVS logAliTOFv4.cxx
-
-Revision 1.1  1999/10/15 15:35:20  fca
-New version for frame1099 with and without holes
-
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  Time Of Flight: design of C.Williams                FCA                  //
-//  This class contains the functions for version 1 of the Time Of Flight    //
-//  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND FLAT PLATES 
-//  
-//   WITH HOLES FOR PHOS AND HMPID 
-//   INSIDE A FULL COVERAGE SPACE FRAME
-//
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv5Class.gif">
-*/
-//End_Html
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include <iostream.h>
-#include <stdlib.h>
-
-#include "AliTOFv5.h"
-#include "AliRun.h"
-#include "AliConst.h"
-ClassImp(AliTOFv5)
-//_____________________________________________________________________________
-AliTOFv5::AliTOFv5()
-{
-  //
-  // Default constructor
-  //
-}
-//_____________________________________________________________________________
-AliTOFv5::AliTOFv5(const char *name, const char *title)
-       : AliTOF(name,title)
-{
-  //
-  // Standard constructor
-  //
-  //
-  // Check that FRAME is there otherwise we have no place where to
-  // put TOF
-  AliModule* FRAME=gAlice->GetModule("FRAME");
-  if(!FRAME) {
-    Error("Ctor","TOF needs FRAME to be present\n");
-    exit(1);
-  } else 
-    if(FRAME->IsVersion()!=1) {
-      Error("Ctor","FRAME version 1 needed with this version of TOF\n");
-      exit(1);
-    }
-
-}
-//_____________________________________________________________________________
-void AliTOFv5::CreateGeometry()
-{
-  //
-  // Create geometry for Time Of Flight version 0
-  //
-  //Begin_Html
-  /*
-    <img src="picts/AliTOFv5.gif">
-  */
-  //End_Html
-  //
-  // Creates common geometry
-  //
-  AliTOF::CreateGeometry();
-}
-//_____________________________________________________________________________
-void AliTOFv5::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
-{
-  //
-  // Definition of the Time Of Fligh Resistive Plate Chambers
-  // xFLT, yFLT, zFLT - sizes of TOF modules (large)
-  
-  Float_t  ycoor;
-  Float_t par[10];
-  Int_t idrotm[100];
-  
-  Float_t yFREON, xp, yp, zp;
-  
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-
-
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
-
-
-// Position of modules
-  Float_t zcor1 = ztof0 - zlen1/2;
-  Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
-  Float_t zcor3 = 0.;
-
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
-
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
-
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-
-// Subtraction the distance to TOF module boundaries 
-
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
-
-
-  xFLT = xtof -(.5 +.5)*2;
-  yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
-
-  
-// fron gaps in MRPC chamber 
-  yFREON = .11; //cm
-
-// Sizes of MRPC pads
-
-  xp = 3.0; 
-  yp = 12.3*0.05; // 5% X0 of glass 
-  zp = 3.0;
-
-//  Subtraction of dead boundaries in X=2 cm and Z=7/2 cm 
-
-cout <<"************************* TOF geometry **************************"<<endl;
-
-  Int_t nz1, nz2, nz3, nx; //- numbers of pixels
-  nx = Int_t (xFLT/xp);
-
-  printf("Number of pixel along x axis = %i",nx);
-
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
-  par[2] = (zFLT1 / 2.);
-  nz1 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 1) = %i",nz1);
-
-  par[2] = (zFLT2 / 2.);
-  nz2 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 2) = %i",nz2);
-
-  par[2] = (zFLT3 / 2.); 
-  nz3 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 3) = %i",nz3);
-
-////////// Layers before detector ////////////////////
-
-// Alluminium layer in front 1.0 mm thick at the beginning
-  par[0] = -1;
-  par[1] = 0.1;
-  par[2] = -1;
-  ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
-  ycoor = ycoor + par[1];
-  par[0] = -1;
-  par[1] = 1. / 2;
-  par[2] = -1;
-  ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-///////////////// Detector itself //////////////////////
-
-  const Float_t SpaceBefore=2.;
-
-  par[0] = -1;
-  par[1] = yp/2; // 5 %X0 thick of glass  
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceBefore;
-  gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-  gMC->Gsdvn("FLZ1", "FLD1", nz1, 3); //pixel size xp=zp=3
-  gMC->Gsdvn("FLZ2", "FLD2", nz2, 3); 
-  gMC->Gsdvn("FLZ3", "FLD3", nz3, 3); 
-  gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
-  gMC->Gsdvn("FLX2", "FLZ2", nx, 1); 
-  gMC->Gsdvn("FLX3", "FLZ3", nx, 1); 
-
-// MRPC pixel itself 
-  par[0] = -1;//xp/2;
-  par[1] = -1;//yp/2; // 5 %X0 thick of glass  
-  par[2] = -1;//zp/2;
-  gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
-  gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
-
-// Freon gas sencitive vol.ume
-  par[0] = -1;
-  par[1] = yFREON/2;
-  par[2] = -1;
-  gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);// Freon 
-  gMC->Gspos("FPAD", 0, "FPA0", 0., 0., 0., 0, "ONLY");
-
-////////// Layers after detector ////////////////////
-
-  const Float_t SpaceAfter=6.;
-
-// Honeycomb layer after (3cm)
-  par[0] = -1;
-  par[1] = 0.6;
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter - par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Electronics (Cu) after
-  par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter +par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
-  ycoor = ycoor+par[1];
-  par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
-  par[2] = -1;
-  ycoor = ycoor+par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
-  par[0] = -1;
-  par[1] = 2 / 2.;
-  par[2] = -1;
-  ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");}
-
-//_____________________________________________________________________________
-void AliTOFv5::DrawModule()
-{
-  //
-  // Draw a shaded view of the Time Of Flight version 1
-  //
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  // 
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN",0);
-  //
-  // Set the volumes visible
-  gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
-  gMC->Gdhead(1111, "Time Of Flight");
-  gMC->Gdman(18, 4, "MAN");
-  gMC->Gdopt("hide","off");
-}
-
-//_____________________________________________________________________________
-void AliTOFv5::CreateMaterials()
-{
-  //
-  // Define materials for the Time Of Flight
-  //
-  AliTOF::CreateMaterials();
-}
-//_____________________________________________________________________________
-void AliTOFv5::Init()
-{
-  //
-  // Initialise the detector after the geometry has been defined
-  //
-  printf("**************************************"
-        "  TOF  "
-        "**************************************\n");
-  printf("\n     Version 5 of TOF initialing, "
-        "with openings for PHOS and RICH in symmetric frame\n\n");
-
-  AliTOF::Init();
-
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
-
-  printf("**************************************"
-        "  TOF  "
-        "**************************************\n");
-}
-//_____________________________________________________________________________
-void AliTOFv5::StepManager()
-{
-  //
-  // Procedure called at each step in the Time Of Flight
-  //
-  TLorentzVector mom, pos;
-  Float_t hits[8],rho,z,phi,phid;
-  Int_t sector, plate, pad_x, pad_z;
-  Int_t copy, pad_x_id, pad_z_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  if(gMC->GetMedium()==idtmed[514-1] && 
-     gMC->IsTrackEntering() && gMC->TrackCharge()
-     && gMC->CurrentVolID(copy)==fIdSens) {
-    TClonesArray &lhits = *fHits;
-
-
-    //_________getting information about hit volumes_____________
-    
-    pad_z_id=gMC->CurrentVolOffID(3,copy);
-    pad_z=copy;  
-    
-    pad_x_id=gMC->CurrentVolOffID(2,copy);
-    pad_x=copy;  
-    
-   gMC->TrackPosition(pos);
-   gMC->TrackMomentum(mom);
-
-   rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-   phi = TMath::ACos(pos[0]/rho);
-   Float_t as = TMath::ASin(pos[1]/rho);
-   if (as<0) phi = 2*3.141592654-phi;
-
-   z = pos[2];
-   
-   if (z<=62. && z>=-62)  plate = 3;
-   if (z<=216. && z>62.)   plate = 4;
-   if (z>=-216. && z<-62.) plate = 2;
-   if (z>216.)  plate = 5;
-   if (z<-216.) plate = 1;
-
-   phid = phi*kRaddeg;
-   sector = Int_t (phid/20.);
-   sector++;
-
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
-    for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
-    }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector,plate,pad_x,pad_z,hits);
-  }
-}
diff --git a/TOF/AliTOFv5.h b/TOF/AliTOFv5.h
deleted file mode 100644 (file)
index 06ac884..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef TOFv5_H
-#define TOFv5_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-///////////////////////////////////////////////////////
-//  Manager and hits classes for set:TOF  version 5  //
-///////////////////////////////////////////////////////
-#include "AliTOF.h"
-#include "AliHit.h"
-class AliTOFv5 : public AliTOF {
-
-private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
-public:
-  AliTOFv5();
-  AliTOFv5(const char *name, const char *title);
-  virtual       ~AliTOFv5() {}
-  virtual void   CreateGeometry();
-  virtual void   CreateMaterials();
-  virtual void   Init();
-  virtual Int_t  IsVersion() const {return 5;}
-  virtual void   TOFpc(Float_t,Float_t,Float_t,Float_t,Float_t,Float_t);
-  virtual void   StepManager();
-  virtual void   DrawModule();
-   ClassDef(AliTOFv5,1)  //Time Of Flight version 1
-};
-#endif
diff --git a/TOF/AliTOFv6.cxx b/TOF/AliTOFv6.cxx
deleted file mode 100644 (file)
index 6d82d6c..0000000
+++ /dev/null
@@ -1,482 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/*
-$Log$
-Revision 1.4  1999/11/05 22:39:06  fca
-New hits structure
-
-Revision 1.3  1999/11/01 20:41:58  fca
-Added protections against using the wrong version of FRAME
-
-Revision 1.2  1999/10/16 19:21:57  fca
-Corrected Rotation Matrix and CVS logAliTOFv4.cxx
-
-Revision 1.1  1999/10/15 15:35:20  fca
-New version for frame1099 with and without holes
-
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  Time Of Flight: design of C.Williams                                //
-//  This class contains the functions for version 1 of the Time Of Flight    //
-//  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND FLAT PLATES
-//  
-//   WITH HOLES FOR PHOS AND HMPID 
-//   INSIDE THE FULL COVERAGE SPACE FRAME
-//
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv6Class.gif">
-*/
-//End_Html
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include <iostream.h>
-#include <stdlib.h>
-
-#include "AliTOFv6.h"
-#include "AliRun.h"
-#include "AliConst.h"
-ClassImp(AliTOFv6)
-//_____________________________________________________________________________
-AliTOFv6::AliTOFv6()
-{
-  //
-  // Default constructor
-  //
-}
-//_____________________________________________________________________________
-AliTOFv6::AliTOFv6(const char *name, const char *title)
-       : AliTOF(name,title)
-{
-  //
-  // Standard constructor
-  //
-  //
-  // Check that FRAME is there otherwise we have no place where to
-  // put TOF
-  AliModule* FRAME=gAlice->GetModule("FRAME");
-  if(!FRAME) {
-    Error("Ctor","TOF needs FRAME to be present\n");
-    exit(1);
-  } else 
-    if(FRAME->IsVersion()!=1) {
-      Error("Ctor","FRAME version 1 needed with this version of TOF\n");
-      exit(1);
-    }
-}
-//_____________________________________________________________________________
-void AliTOFv6::CreateGeometry()
-{
-  //
-  // Create geometry for Time Of Flight version 0
-  //
-  //Begin_Html
-  /*
-    <img src="picts/AliTOFv6.gif">
-  */
-  //End_Html
-  //
-  // Creates common geometry
-  //
-  AliTOF::CreateGeometry();
-}
-//_____________________________________________________________________________
-void AliTOFv6::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
-                    Float_t zlen2, Float_t zlen3, Float_t ztof0)
-{
-  //
-  // Definition of the Time Of Fligh Resistive Plate Chambers
-  // xFLT, yFLT, zFLT - sizes of TOF modules (large)
-  
-  Float_t ycoor;
-  Float_t par[10];
-  Int_t idrotm[100];
-
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  
-
-  par[0] =  xtof / 2.;
-  par[1] =  ytof / 2.;
-  par[2] = zlen1 / 2.;
-  gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen2 / 2.;
-  gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
-  par[2] = zlen3 / 2.;
-  gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
-
-
-// Positioning of modules
-
-   Float_t zcor1 = ztof0 - zlen1/2;
-   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
-   Float_t zcor3 = 0.;
-
-   AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
-   AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
-   gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
-
-   gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
-   gMC->Gspos("FTO2", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO2", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
-
-   gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO3", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
-   gMC->Gspos("FTO3", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
-
-// Subtraction the distance to TOF module boundaries 
-
-  Float_t db = 7.;
-  Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
-
-  xFLT = xtof -(.5 +.5)*2;
-  yFLT = ytof;
-  zFLT1 = zlen1 - db;
-  zFLT2 = zlen2 - db;
-  zFLT3 = zlen3 - db;
-
-  // Definition of the Time Of Fligh Resistive Plate Chambers
-  // xFLT, yFLT, zFLT - sizes of TOF modules (large)
-  
-  Float_t yFREON, xp, yp, zp;
-  
-// fron gaps in MRPC chamber 
-  yFREON = .11; //cm
-
-// Sizes of MRPC pads
-
-  xp = 3.0; 
-  yp = 12.3*0.05; // 5% X0 of glass 
-  zp = 3.0;
-
-//  Subtraction of dead boundaries in X=2 cm and Z=7/2 cm 
-
-cout <<"************************* TOF geometry **************************"<<endl;
-
-  Int_t nz1, nz2, nz3, nx; //- numbers of pixels
-  nx = Int_t (xFLT/xp);
-
-  printf("Number of pixel along x axis = %i",nx);
-
-  par[0] = xFLT/2;
-  par[1] = yFLT/2;
-  par[2] = (zFLT1 / 2.);
-  nz1 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 1) = %i",nz1);
-
-  par[2] = (zFLT2 / 2.);
-  nz2 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 2) = %i",nz2);
-
-  par[2] = (zFLT3 / 2.); 
-  nz3 = Int_t (par[2]*2/zp);
-  gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
-  gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
-  printf("Number of pixel along z axis (module 3) = %i",nz3);
-
-////////// Layers before detector ////////////////////
-
-// Alluminium layer in front 1.0 mm thick at the beginning
-  par[0] = -1;
-  par[1] = 0.1;
-  par[2] = -1;
-  ycoor = -yFLT/2 + par[1];
-  gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
-  gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
-  gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Honeycomb layer (1cm of special polyethilene)
-  ycoor = ycoor + par[1];
-  par[0] = -1;
-  par[1] = 0.5;
-  par[2] = -1;
-  ycoor = ycoor + par[1];
-  gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-///////////////// Detector itself //////////////////////
-
-  const Float_t SpaceBefore = 2.;
-
-  par[0] = -1;
-  par[1] = yp/2; // 5 %X0 thick of glass  
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceBefore;
-  gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
-  gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-  gMC->Gsdvn("FLZ1", "FLD1", nz1, 3); //pixel size xp=zp=3
-  gMC->Gsdvn("FLZ2", "FLD2", nz2, 3); 
-  gMC->Gsdvn("FLZ3", "FLD3", nz3, 3); 
-  gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
-  gMC->Gsdvn("FLX2", "FLZ2", nx, 1); 
-  gMC->Gsdvn("FLX3", "FLZ3", nx, 1); 
-
-// MRPC pixel itself 
-  par[0] = -1;//xp/2;
-  par[1] = -1;//yp/2; // 5 %X0 thick of glass  
-  par[2] = -1;//zp/2;
-  gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
-  gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
-
-// Freon gas sencitive vol.ume
-  par[0] = -1;
-  par[1] = yFREON/2;
-  par[2] = -1;
-  gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);// Freon 
-  gMC->Gspos("FPAD", 0, "FPA0", 0., 0., 0., 0, "ONLY");
-
-////////// Layers after detector ////////////////////
-
-  const Float_t SpaceAfter=6.;
-
-// Honeycomb layer after (3cm)
-  par[0] = -1;
-  par[1] = 0.6;
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter - par[1];
-  gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Electronics (Cu) after
-  par[0] = -1;
-  par[1] = 1.43*0.05 / 2.; // 5% of X0
-  par[2] = -1;
-  ycoor = -yFLT/2 + SpaceAfter +par[1];
-  gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
-  gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-// Cooling water after
-  ycoor = ycoor+par[1];
-  par[0] = -1;
-  par[1] = 36.1*0.02 / 2.; // 2% of X0
-  par[2] = -1;
-  ycoor = ycoor+par[1];
-  gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
-  gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-//back plate honycomb (2cm)
-  par[0] = -1;
-  par[1] = 2 / 2.;
-  par[2] = -1;
-  ycoor = yFLT/2 - par[1];
-  gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
-  gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
-  gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
-
-
-}
-
-//_____________________________________________________________________________
-void AliTOFv6::DrawModule()
-{
-  //
-  // Draw a shaded view of the Time Of Flight version 1
-  //
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  // 
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN",0);
-  //
-  // Set the volumes visible
-  gMC->Gsatt("ALIC","SEEN",0);
-  gMC->Gsatt("FBAR","SEEN",1);
-  gMC->Gsatt("FTO1","SEEN",1);
-  gMC->Gsatt("FTO2","SEEN",1);
-  gMC->Gsatt("FTO3","SEEN",1);
-  gMC->Gsatt("FBT1","SEEN",1);
-  gMC->Gsatt("FBT2","SEEN",1);
-  gMC->Gsatt("FBT3","SEEN",1);
-  gMC->Gsatt("FDT1","SEEN",1);
-  gMC->Gsatt("FDT2","SEEN",1);
-  gMC->Gsatt("FDT3","SEEN",1);
-  gMC->Gsatt("FLT1","SEEN",1);
-  gMC->Gsatt("FLT2","SEEN",1);
-  gMC->Gsatt("FLT3","SEEN",1);
-  gMC->Gsatt("FPL1","SEEN",1);
-  gMC->Gsatt("FPL2","SEEN",1);
-  gMC->Gsatt("FPL3","SEEN",1);
-  gMC->Gsatt("FLD1","SEEN",1);
-  gMC->Gsatt("FLD2","SEEN",1);
-  gMC->Gsatt("FLD3","SEEN",1);
-  gMC->Gsatt("FLZ1","SEEN",1);
-  gMC->Gsatt("FLZ2","SEEN",1);
-  gMC->Gsatt("FLZ3","SEEN",1);
-  gMC->Gsatt("FLX1","SEEN",1);
-  gMC->Gsatt("FLX2","SEEN",1);
-  gMC->Gsatt("FLX3","SEEN",1);
-  gMC->Gsatt("FPA0","SEEN",1);
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
-  gMC->Gdhead(1111, "Time Of Flight");
-  gMC->Gdman(18, 4, "MAN");
-  gMC->Gdopt("hide","off");
-}
-
-//_____________________________________________________________________________
-void AliTOFv6::CreateMaterials()
-{
-  //
-  // Define materials for the Time Of Flight
-  //
-  AliTOF::CreateMaterials();
-}
-//_____________________________________________________________________________
-void AliTOFv6::Init()
-{
-  //
-  // Initialise the detector after the geometry has been defined
-  //
-  printf("**************************************"
-        "  TOF  "
-        "**************************************\n");
-  printf("\n     Version 6 of TOF initialing, "
-        "symmetric TOF\n\n");
-
-  AliTOF::Init();
-
-  fIdFTO2=gMC->VolId("FTO2");
-  fIdFTO3=gMC->VolId("FTO3");
-  fIdFLT1=gMC->VolId("FLT1");
-  fIdFLT2=gMC->VolId("FLT2");
-  fIdFLT3=gMC->VolId("FLT3");
-
-  printf("**************************************"
-        "  TOF  "
-        "**************************************\n");
-}
-//_____________________________________________________________________________
-void AliTOFv6::StepManager()
-{
-  //
-  // Procedure called at each step in the Time Of Flight
-  //
-  TLorentzVector mom, pos;
-  Float_t hits[8],rho,z,phi,phid;
-  Int_t sector, plate, pad_x, pad_z;
-  Int_t copy, pad_x_id, pad_z_id, i;
-  Int_t *idtmed = fIdtmed->GetArray()-499;
-  if(gMC->GetMedium()==idtmed[514-1] && 
-     gMC->IsTrackEntering() && gMC->TrackCharge()
-     && gMC->CurrentVolID(copy)==fIdSens) {
-    TClonesArray &lhits = *fHits;
-
-
-    //_________getting information about hit volumes_____________
-    
-    pad_z_id=gMC->CurrentVolOffID(3,copy);
-    pad_z=copy;  
-    
-    pad_x_id=gMC->CurrentVolOffID(2,copy);
-    pad_x=copy;  
-    
-   gMC->TrackPosition(pos);
-   gMC->TrackMomentum(mom);
-
-   rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
-   phi = TMath::ACos(pos[0]/rho);
-   Float_t as = TMath::ASin(pos[1]/rho);
-   if (as<0) phi = 2*3.141592654-phi;
-
-   z = pos[2];
-   
-   if (z<=62. && z>=-62)  plate = 3;
-   if (z<=216. && z>62.)   plate = 4;
-   if (z>=-216. && z<-62.) plate = 2;
-   if (z>216.)  plate = 5;
-   if (z<-216.) plate = 1;
-
-   phid = phi*kRaddeg;
-   sector = Int_t (phid/20.);
-   sector++;
-
-    Double_t ptot=mom.Rho();
-    Double_t norm=1/ptot;
-    for(i=0;i<3;++i) {
-      hits[i]=pos[i];
-      hits[i+3]=mom[i]*norm;
-    }
-    hits[6]=ptot;
-    hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector,plate,pad_x,pad_z,hits);
-  }
-}
diff --git a/TOF/AliTOFv6.h b/TOF/AliTOFv6.h
deleted file mode 100644 (file)
index b61f190..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef TOFv6_H
-#define TOFv6_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-///////////////////////////////////////////////////////
-//  Manager and hits classes for set:TOF  version 1  //
-///////////////////////////////////////////////////////
-#include "AliTOF.h"
-#include "AliHit.h"
-class AliTOFv6 : public AliTOF {
-
-private:
-  Int_t fIdFTO2; // First sensitive volume identifier
-  Int_t fIdFTO3; // Second sensitive volume identifier
-  Int_t fIdFLT1; // Third sensitive volume identifier
-  Int_t fIdFLT2; // Fourth sensitive volume identifier
-  Int_t fIdFLT3; // Fifth sensitive volume identifier
-public:
-  AliTOFv6();
-  AliTOFv6(const char *name, const char *title);
-  virtual       ~AliTOFv6() {}
-  virtual void   CreateGeometry();
-  virtual void   CreateMaterials();
-  virtual void   Init();
-  virtual Int_t  IsVersion() const {return 6;}
-  virtual void   TOFpc(Float_t,Float_t,Float_t,Float_t,Float_t,Float_t);
-  virtual void   StepManager();
-  virtual void   DrawModule();
-   ClassDef(AliTOFv6,1)  //Time Of Flight version 6
-};
-#endif
index 31de1504b1188518785f3d7c8ef8d5dbbe2ebd67..5fcd970ea4d7324612bcf949a515216163295a6c 100644 (file)
@@ -9,7 +9,7 @@ PACKAGE = TOF
 
 # C++ sources
 
-SRCS  = AliTOF.cxx  AliTOFv0.cxx  AliTOFv1.cxx  AliTOFv2.cxx  AliTOFv3.cxx  AliTOFv4.cxx  AliTOFv5.cxx  AliTOFv6.cxx
+SRCS  = AliTOF.cxx  AliTOFv0.cxx  AliTOFv1.cxx  AliTOFv2.cxx AliTOFv3.cxx AliTOFv4.cxx AliTOFD.cxx
 
 # C++ Headers
 
index bcb618bb622f8be3bb7103da71e92471d9ce79d9..f9189cf29f15206f97657673c7651031bfc7497a 100644 (file)
 #pragma link C++ class  AliTOFv2;
 #pragma link C++ class  AliTOFv3;
 #pragma link C++ class  AliTOFv4;
-#pragma link C++ class  AliTOFv5;
-#pragma link C++ class  AliTOFv6;
 
 #pragma link C++ class  AliTOFhit;
 
+#pragma link C++ class  AliTOFdigit;
+#pragma link C++ class  AliTOFRoc;
+#pragma link C++ class  AliTOFRawSector;
+#pragma link C++ class  AliTOFRawDigit;
+
 #endif