FMD geometry with pad and SDigits
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Mar 2001 07:23:23 +0000 (07:23 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Mar 2001 07:23:23 +0000 (07:23 +0000)
FMD/AliFMD.cxx
FMD/AliFMD.h
FMD/AliFMDhit.cxx
FMD/AliFMDhit.h
FMD/AliFMDv0.cxx
FMD/AliFMDv1.cxx
FMD/AliFMDv1.h

index 52a7986..c972a6d 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include <TTUBE.h>
-#include <TNode.h>
+#define DEBUG
+#include <TMath.h>
 #include <TGeometry.h>
+#include <TTUBE.h>
 #include <TTree.h>
+#include <TNode.h>
+
+#include <TClonesArray.h>
+#include <TLorentzVector.h>
+#include "AliFMDv1.h"
 #include "AliRun.h"
 #include "AliMC.h"
-#include "AliFMD.h"
+#include <iostream.h>
+#include <fstream.h>
+#include "AliMagF.h"
 #include "AliFMDhit.h"
+#include "AliFMDdigit.h"
+#include <stdlib.h>
+
 
 ClassImp(AliFMD)
  
-//_____________________________________________________________________________
-AliFMD::AliFMD(): AliDetector()
+  //_____________________________________________________________________________
+  AliFMD::AliFMD(): AliDetector()
 {
   //
   // Default constructor for class AliFMD
@@ -58,7 +69,7 @@ AliFMD::AliFMD(): AliDetector()
  
 //_____________________________________________________________________________
 AliFMD::AliFMD(const char *name, const char *title)
-       : AliDetector(name,title)
+  : AliDetector(name,title)
 {
   //
   // Standard constructor for Forward Multiplicity Detector
@@ -67,6 +78,9 @@ AliFMD::AliFMD(const char *name, const char *title)
   //
   // Initialise Hit array
   fHits     = new TClonesArray("AliFMDhit", 1000);
+  // Digits for each Si disk
+  fDigits   = new TClonesArray("AliFMDdigit", 1000);
+  fSDigits  = new TClonesArray("AliFMDdigit", 1000) ; 
   gAlice->AddHitList(fHits);
 
   fIshunt     =  0;
@@ -78,7 +92,13 @@ AliFMD::AliFMD(const char *name, const char *title)
 
 AliFMD::~AliFMD()
 {
-  delete fHits;
+  if (fHits) {
+      fHits->Delete();
+      delete fHits;
+  }
+  delete fDigits ;
+  delete fSDigits ;
+   
 }
 //_____________________________________________________________________________
 void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
@@ -90,6 +110,18 @@ void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
   new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
 }
 //_____________________________________________________________________________
+void AliFMD::AddDigit( Int_t *digits) 
+{
+  // add a real digit - as coming from data
+
+  // printf("AddDigit\n");
+
+   TClonesArray &ldigits = *fDigits;
+   // new((*fDigits)[fNdigits++]) AliFMDdigit(digits);
+  new(ldigits[fNdigits++]) AliFMDdigit(digits);
+
+}
+//_____________________________________________________________________________
 void AliFMD::BuildGeometry()
 {
   //
@@ -151,8 +183,21 @@ Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
   //
   return 9999;
 }
-//_____________________________________________________________________________
+//___________________________________________
+void AliFMD::ResetHits()
+{
+  // Reset number of clusters and the cluster array for this detector
+  AliDetector::ResetHits();
+}
+
+//____________________________________________
+void AliFMD::ResetDigits()
+{
+    //
+    // Reset number of digits and the digits array for this detector
+   AliDetector::ResetHits();
+   //
+}
 
 //-------------------------------------------------------------------------
 void AliFMD::Init()
@@ -171,41 +216,108 @@ void AliFMD::Init()
   // Here the FMD initialisation code (if any!)
   for(i=0;i<80;i++) printf("*");
   printf("\n");
- //
- //
-  fIdSens1=pMC->VolId("GFSI"); //Si sensetive volume
+  //
+  //
+  fIdSens1=pMC->VolId("GRIN"); //Si sensetive volume
 
 }
 //---------------------------------------------------------------------
-void AliFMD::MakeBranch(Option_t* option)
+void AliFMD::MakeBranch(Option_t* option, char *file)
 {
   // Create Tree branches for the FMD.
-  Int_t buffersize = 4000;
+  const Int_t kBufferSize = 4000;
   char branchname[10];
   sprintf(branchname,"%s",GetName());
 
-  AliDetector::MakeBranch(option);
+  AliDetector::MakeBranch(option,file);
+
+  const char *cD = strstr(option,"D");
+  if (cD) {
+    
+     gAlice->MakeBranchInTree(gAlice->TreeD(), 
+                                   branchname, &fDigits, kBufferSize, file) ;    
 
-  if (fDigits   && gAlice->TreeD()) {
-    gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
     printf("Making Branch %s for digits\n",branchname);
+    gAlice->TreeD()->Print();
   }
 }
  
+//_____________________________________________________________________________
+void AliFMD::SetTreeAddress()
+{
+  // Set branch address for the Hits and Digits Tree.
+  char branchname[30];
+  AliDetector::SetTreeAddress();
+
+  TBranch *branch;
+  TTree *treeD = gAlice->TreeD();
+
+
+  if (treeD) {
+       if (fDigits) {
+             branch = treeD->GetBranch(branchname);
+             if (branch) branch->SetAddress(&fDigits);
+        }
+      
+  }
+  if(fSDigits)
+    fSDigits->Clear();
+
+  if (gAlice->TreeS()  && fSDigits ) {
+    branch = gAlice->TreeS()->GetBranch("FMD");
+    if (branch) branch->SetAddress(&fSDigits) ;
+  } 
+
+
+}
+
+//---------------------------------------------------------------------
+/*
+void AliFMD::SDigits2Digits() 
+{
+     Int_t  ibg=0, bgr=0;
+    Int_t nbgr_ev= 0;
+       
+    if (ibg) {
+         printf("nbgr_ev %d\n",nbgr_ev);
+ //        Hit2Digits(nbgr_ev,"Add"," ","galice_bgr.root");
+    } 
+       else {
+   //      Hit2Digits(nbgr_ev,"rien","",""); 
+    }
+
+}
+*/
 //---------------------------------------------------------------------
 
+
+
 void AliFMD::Eta2Radius(Float_t eta, Float_t zDisk, Float_t *radius)
 {
-   Float_t expEta=TMath::Exp(-eta);
-   Float_t theta=TMath::ATan(expEta);
-   theta=2.*theta;
-   Float_t rad=zDisk*(TMath::Tan(theta));
-   *radius=rad;
+  Float_t expEta=TMath::Exp(-eta);
+  Float_t theta=TMath::ATan(expEta);
+  theta=2.*theta;
+  Float_t rad=zDisk*(TMath::Tan(theta));
+  *radius=rad;
    
-   printf(" eta %f radius %f\n", eta, rad);
+  printf(" eta %f radius %f\n", eta, rad);
 }
 
-    
+//---------------------------------------------------------------------
+
+void AliFMD::Hits2SDigits(){
+#ifdef DEBUG
+  cout<<"ALiFMD::Hits2SDigits> start...\n";
+#endif
+  char * fileSDigits = 0 ;
+  char * fileHeader=0 ;
+  AliFMDSDigitizer * sd = new AliFMDSDigitizer("mgalice.root","FMD.SDigit.root") ;
+  sd->Exec("") ;
+  sd->Print("");
+  
+  delete sd ;
+}
+
+
+
index 2895593..9de0658 100644 (file)
@@ -8,27 +8,39 @@
 ////////////////////////////////////////////////
  
 #include "AliDetector.h"
+#include "TString.h"
  
-class AliFMD : public AliDetector {
+ class TFile;
+ class TTree;
+ class AliFMD : public AliDetector {
  
 public:
   AliFMD();
   AliFMD(const char *name, const char *title);
   virtual       ~AliFMD(); 
   virtual void   AddHit(Int_t, Int_t*, Float_t*);
+  virtual void   AddDigit(Int_t*);
   virtual void   BuildGeometry();
-  virtual void   CreateGeometry()=0;
+  virtual void   CreateGeometry() {}
   virtual void   CreateMaterials()=0; 
   virtual Int_t  DistanceToPrimitive(Int_t px, Int_t py);
   virtual Int_t  IsVersion() const =0;
   virtual void   Init();
-  virtual void   MakeBranch(Option_t *opt=" ");
+  virtual void   MakeBranch(Option_t *opt=" ",char *file=0);
+  virtual void   SetTreeAddress();
+  virtual void   ResetHits();
+  virtual void   ResetDigits();
   virtual void   DrawDetector()=0;
-  virtual void   StepManager()=0;
+  virtual void   StepManager() {}
   void  Eta2Radius(Float_t, Float_t, Float_t*);
-  
+  void Hits2SDigits();//
+   // Digitisation
+  TClonesArray *SDigits() const {return fSDigits;}
+//  virtual void   SDigits2Digits();
+       
  protected:
   Int_t fIdSens1;     //Si sensetive volume
-  ClassDef(AliFMD,1)  //Class for the FMD detector
+  TClonesArray *fSDigits      ; // List of summable digits
+  ClassDef(AliFMD,2)  //Class for the FMD detector
 };
-#endif
+#endif // AliFMD_H
index 0381da4..4d75aa1 100644 (file)
@@ -21,6 +21,8 @@ AliFMDhit::AliFMDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
 {
 //Normal FMD  hit ctor
   fVolume = vol[0];
+  fNumberOfSector=vol[1];
+  fNumberOfRing=vol[2];
   fX=hits[0];
   fY=hits[1];
   fZ=hits[2];
index c74ea94..c00ec1b 100644 (file)
@@ -73,6 +73,8 @@ class AliFMDhit : public AliHit {
 
 private:
   Int_t      fVolume;       //Volume copy identifier
+  Int_t    fNumberOfSector;
+  Int_t    fNumberOfRing;
   Int_t      fParticle;     //Particle identificator
   Float_t    fEdep;         //Energy deposition
   Float_t    fPx;            // Particle's momentum X
@@ -85,16 +87,19 @@ public:
   AliFMDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
   virtual ~AliFMDhit() {}
   Int_t Volume();
+  Int_t NumberOfSector();
+  Int_t NumberOfRing();
   Float_t Particle();
   Float_t Edep();
   Float_t Px();
   Float_t Py();
   Float_t Pz();
   Float_t Time();
-
-  ClassDef(AliFMDhit,1)  //Hits for detector FMD
+  ClassDef(AliFMDhit,2)  //Hits for detector FMD
 };
 inline Int_t AliFMDhit::Volume(){return fVolume;} 
+inline Int_t AliFMDhit::NumberOfSector(){return fNumberOfSector;} 
+inline Int_t AliFMDhit::NumberOfRing(){return fNumberOfRing;} 
 inline Float_t AliFMDhit::Particle(){return fParticle;} 
 inline Float_t AliFMDhit::Edep(){return fEdep;} 
 inline Float_t AliFMDhit::Px(){return fPx;} 
index f5fab4c..b98cecd 100644 (file)
@@ -35,7 +35,7 @@
 #include "AliMC.h"
 #include <iostream.h>
 #include <fstream.h>
-
+//#include <AliRandom.h>
 #include "AliMagF.h"
 #include "AliFMDhit.h"
 #include <stdlib.h>
@@ -218,7 +218,6 @@ AliMC* gMC=AliMC::GetMC();
 AliFMD::Init();
 fIdSens1=gMC->VolId("GFSI");
 printf("*** FMD version 0 initialized ***\n");
 }
 
 //-------------------------------------------------------------------
index 1d16ff0..82e90ef 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
-/*
-$Log$
-Revision 1.11  2000/12/22 11:17:39  hristov
-New FMD code from Alla + code cleaning
-
-Revision 1.10  2000/10/02 21:28:07  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.9  2000/05/10 21:56:07  fca
-Avoid clashes with ITS and add supports
-
-Revision 1.7  1999/09/29 09:24:14  fca
-Introduction of the Copyright and cvs Log
-
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  Forward Multiplicity Detector version 1                                  //
-//                                                                           //
-//Begin_Html
+ /////////////////////////////////////////////////////////////////////
+//                                                                 //
+// Forward Multiplicity detector based on Silicon version 0        //
+//
+//Begin Html       
 /*
-<img src="picts/AliFMDv1Class.gif">
-</pre>
-<br clear=left>
-<font size=+2 color=red>
-<p>The responsible person for this module is
-<a href="mailto:Valeri.Kondratiev@cern.ch">Valeri Kondratiev</a>.
-</font>
-<pre>
+<img src="gif/AliFMDv0Class.gif">
 */
-//End_Html
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include "AliRun.h"
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+#include <TGeometry.h>
+#include <TTUBE.h>
+#include <TFile.h>
+#include <TTree.h>
+#include <TNode.h>
+#include <TClonesArray.h>
+#include <TLorentzVector.h>
+#include <TDirectory.h>
 #include "AliFMDv1.h"
+#include "AliRun.h"
 #include "AliMC.h"
+#include <iostream.h>
+#include <fstream.h>
 #include "AliMagF.h"
+#include "AliFMDhit.h"
+#include "AliFMDdigit.h"
 #include <stdlib.h>
+//#include "TGeant3.h"
+//class TGeant3;
 ClassImp(AliFMDv1)
-//_____________________________________________________________________________
-AliFMDv1::AliFMDv1()
-{
-  //
-  // Default constructor for FMD version 1
-  //
-}
-//_____________________________________________________________________________
-AliFMDv1::AliFMDv1(const char *name, const char *title)
-  : AliFMD(name,title)
+
+//--------------------------------------------------------------------
+AliFMDv1::AliFMDv1(const char *name, const char *title):
+ AliFMD(name,title)
 {
   //
-  // Standard constructor for FMD version 1
+  // Standart constructor for Forward Multiplicity Detector version 0
   //
-  AliModule *start = gAlice->GetModule("START");
-  if(start) {
-    Error("ctor","This version of FMD is incompatible with START\n");
-    exit(1);
-  }
+  fIdSens1=0;
+//  setBufferSize(128000);
 }
-//___________________________________________
+//-------------------------------------------------------------------------
 void AliFMDv1::CreateGeometry()
 {
+ //
+  // Create the geometry of Forward Multiplicity Detector version 0
   //
-  // Creation of the geometry of the FMD version 1
-  //
-  //Begin_Html
-  /*
-    <img src="picts/AliFMDv1Tree.gif">
-  */
-  //End_Html
-  //Begin_Html
+  //Detector consists of 6 volumes: 
+  // 1st covered pseudorapidity interval from 3.3 to 2.0
+  // and placed on 65cm in Z-direction;
+  // 2nd - from 2.0 to 1.6 and Z=85 cm;
+  // 3d  - the same pseudorapidity interval as the 1st 
+  // but on the other side from the interaction point z=-65cm;
+  // 4th - simmetricaly with the 2nd : 
+  // pseudorapidity from 2.0 to 1.6, Z=-85cm   
+  // 5th - from 3.6 to 4.7, Z=-270cm
+  // 6th - from 4.5 to 5.5 , Z=-630cm.
+  // Each part has 400mkm Si (sensetive area, detector itself),
+  // 0.75cm of plastic simulated electronics material,
+  // Al support ring 2cm thickness and 1cm width placed on 
+  // the outer radius of each Si disk;
+  //    
+  // begin Html
   /*
-    <img src="picts/AliFMDv1.gif">
-  */
-  //End_Html
-
-  
-  Float_t rout, z;
-  Float_t par[3], rin;
-
-  Int_t irotm[100];
-  
-  TArrayI &idtmed = *fIdtmed;    
-  
-  // ******************************************************** 
-  //       DEFINE DISK#3  OF FMD 
-  // ******************************************************** 
-  
-  gMC->Gsvolu("BR3_", "BOX ", idtmed[4], par, 0);
-  gMC->Gsvolu("CB3_", "BOX ", idtmed[5], par, 0);
-  gMC->Gsvolu("BR5_", "BOX ", idtmed[4], par, 0);
-  gMC->Gsvolu("CB5_", "BOX ", idtmed[5], par, 0);
-
-  //       Define parameters for the right disk 
-  
-  rin  = 4.5;
-  rout = 10.5;
-  z    = 77.;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1R3", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1R3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2R3", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2R3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3R3", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3R3", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[11], 90., 0., 161.2, 90., 71.2, 90.);
-  gMC->Gsposp("BR3_",1,"ALIC", 0., 25.25, 85.0, irotm[11],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",1,"ALIC", 0., 25.41, 84.53,irotm[11],"ONLY",par,3); 
-
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[12], 90., 180., 161.2, 270., 71.2, 270.);
-  gMC->Gsposp("BR3_",2,"ALIC", 0.,-25.25, 85.0, irotm[12],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",2,"ALIC", 0.,-25.41, 84.53,irotm[12],"ONLY",par,3); 
-
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[13], 90., 270., 161.2, 0., 71.2, 0.);
-  gMC->Gsposp("BR3_",3,"ALIC", 25.25, 0., 85.0, irotm[13],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",3,"ALIC", 25.41, 0., 84.53,irotm[13],"ONLY",par,3); 
-
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[14], 90., 90., 161.2, 180., 71.2, 180.);
-  gMC->Gsposp("BR3_",4,"ALIC", -25.25, 0., 85.0, irotm[14],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",4,"ALIC", -25.41, 0., 84.53,irotm[14],"ONLY",par,3); 
+   <img src="gif/AliFMDv0.gif">
+   */
+  //
 
-  //       Right support ring 
+  Int_t *idtmed = fIdtmed->GetArray();
+   
+  Int_t ifmd;
+  Int_t idrotm[999];
+  Float_t zfmd,par[3];
+  char name[5];
+
+  Float_t rin[6], rout[6],zpos;
+  Float_t etain[6]= {3.3, 2.0, 3.3, 2.0, 4.7, 5.5};
+  Float_t etaout[6]={2.0, 1.6, 2.0, 1.6, 3.6, 4.5};
+  Float_t z[6]={64., 85., -64., -85., -270., -630};
+  Float_t zDet=0.04;
+  Float_t zElectronic=0.75;
+  Float_t zSupport=1.;
+  Float_t zFMD=3.;
+//-------------------------------------------------------------------
+ //  FMD 
+ //------------------------------------------------------------------
+
+  AliMatrix(idrotm[901], 90, 0, 90, 90, 180, 0);
+
+  gMC->Gsvolu("GFSI","TUBE", idtmed[1], par, 0);
+  gMC->Gsvolu("GEL ","TUBE", idtmed[4], par, 0);
+  gMC->Gsvolu("GSUP","TUBE", idtmed[2], par, 0);
+
+  for (ifmd =0; ifmd < 4; ifmd++){
+
+    sprintf(name,"FMD%d",ifmd);
+    printf(name);
+    
+    zfmd=TMath::Abs(z[ifmd]);
+    printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]);
+    AliFMD::Eta2Radius(etain[ifmd],zfmd,&rin[ifmd]);
+    AliFMD::Eta2Radius(etaout[ifmd],zfmd,&rout[ifmd]);
+    
+    par[0]=rin[ifmd]; // pipe size
+    par[1]=rout[ifmd];
+    par[2]=zFMD/2;
+    gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3);
+    
+    printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]);
+    if (z[ifmd] < 0){  
+      gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],0, "ONLY");}
+    else { 
+      gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],idrotm[901], "ONLY");}
+  //Silicon detector
+    par[2]=zDet/2;
+    zpos=zFMD/2 -par[2];
+    gMC->Gsposp("GFSI",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+     
+    //Plastic slice for electronics
+    par[2]=zElectronic/2;
+    zpos=zpos-zDet/2-par[2];
+    gMC->Gsposp("GEL ",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+
+   //Simple Al support
+   par[1]=rout[ifmd];
+   par[0]=rout[ifmd]-2;
+   par[2]=zSupport/2;
+   zpos=zpos-zElectronic/2-par[2];
+   gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+   
+
+  }  
+   
+   //Silicon
+
+
+  gMC->Gsdvn("GSEC", "GFSI", 16, 2);
+  gMC->Gsdvn("GRIN", "GSEC", 128, 1); 
+   /*
+      for (Int_t i=0; i<16; i++){
+      sprintf(ring,"GR%d",i);
+      printf(ring);
+      gMC->Gsdvn(ring, "GSEC", 128, 1);
+    }
+      */
+
+}    
+//------------------------------------------------------------------------
+void AliFMDv1::CreateMaterials()
+{
+ Int_t isxfld   = gAlice->Field()->Integ();
+ Float_t sxmgmx = gAlice->Field()->Max();
+
+ // Plastic CH
+ Float_t aPlastic[2]={1.01,12.01};
+ Float_t zPlastic[2]={1,6};
+ Float_t wPlastic[2]={1,1};
+ Float_t denPlastic=1.03;
+   //
+ //*** Definition Of avaible FMD materials ***
+ AliMaterial(0, "Si chip$", 28.0855,14.,2.33,9.36,999);
+ AliMaterial(1, "Al supprt$", 26.980,13.,2.70,8.9,999);
+ AliMaterial(2, "FMD Air$", 14.61, 7.3, .001205, 30423.,999); 
+ AliMixture( 5, "Plastic$",aPlastic,zPlastic,denPlastic,-2,wPlastic);
 
-  par[0] = 39.;
-  par[1] = 41.;
-  par[2] = .5;
-  gMC->Gsvolu("R1SP", "TUBE", idtmed[4], par, 3);
-  gMC->Gspos("R1SP", 1, "ALIC", 0., 0., 89.5, 0, "ONLY");
+//**
+ AliMedium(1, "Si chip$", 0, 1, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+ AliMedium(2, "Al support$", 1, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+ AliMedium(3, "FMD air$", 2, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+ AliMedium(4, "Plastic$", 5, 0,isxfld, sxmgmx,  10., .01, 1., .003, .003);
 
-  //       Define parameters for the left disk
-  
-  rin  = 4.5;
-  rout = 10.5;
-  z    = -77.;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1L3", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1L3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2L3", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2L3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3L3", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3L3", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[61], 90., 0., 180.-161.2, 90., 180.-71.2, 90.);
-  gMC->Gsposp("BR3_",5,"ALIC", 0., 25.25, -85.0, irotm[61],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",5,"ALIC", 0., 25.41, -84.53,irotm[61],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[91], 90., 0., 90.-10.6, 90., 180.-10.6, 90.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",1,"ALIC", 0., 55.0, -170.0,irotm[91],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",1,"ALIC", 0., 55.5, -169.5,irotm[91],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[62], 90., 180., 180.-161.2, 270., 180.-71.2, 270.);
-  gMC->Gsposp("BR3_",6,"ALIC", 0.,-25.25, -85.0,irotm[62],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",6,"ALIC", 0.,-25.41, -84.53,irotm[62],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[92], 90., 180., 90.-10.6, 270., 180.-10.6, 270.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",2,"ALIC", 0., -55.0, -170.0,irotm[92],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",2,"ALIC", 0., -55.5, -169.5,irotm[92],"ONLY",par,3); 
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[63], 90., 270., 180.-161.2, 0., 180.-71.2, 0.);
-  gMC->Gsposp("BR3_",7,"ALIC", 25.25, 0., -85.0, irotm[63],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",7,"ALIC", 25.41, 0., -84.53,irotm[63],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[93], 90., 270., 90.-10.6, 0., 180.-10.6, 0.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",3,"ALIC", 55., 0., -170.,irotm[93],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",3,"ALIC", 55.5, 0., -169.5,irotm[93],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 15.35;
-  gMC->Matrix(irotm[64], 90., 90., 180.-161.2, 180., 180.-71.2, 180.);
-  gMC->Gsposp("BR3_",8,"ALIC", -25.25, 0., -85., irotm[64],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB3_",8,"ALIC", -25.41, 0., -84.53,irotm[64],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[94], 90., 90., 90.-10.6, 180., 180.-10.6, 180.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",4,"ALIC", -55., 0., -170.,irotm[94],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",4,"ALIC", -55.5, 0., -169.5,irotm[94],"ONLY",par,3); 
-
-  //       Central support ring 
-
-  par[0] = 39.;
-  par[1] = 41.;
-  par[2] = .5;
-  gMC->Gsvolu("R2SP", "TUBE", idtmed[4], par, 3);
-  gMC->Gspos("R2SP", 1, "ALIC", 0., 0., -89.5, 0, "ONLY");
-
-  //        Left support ring 
-
-  par[0] = 69.;
-  par[1] = 71.;
-  par[2] = .5;
-  gMC->Gsvolu("R3SP", "TUBE", idtmed[4], par, 3);
-  gMC->Gspos("R3SP", 1, "ALIC", 0., 0., -249.5, 0, "ONLY");
-
-  // ******************************************************** 
-  //       DEFINE  DISK#2  OF FMD 
-  // ******************************************************** 
-  
-  gMC->Gsvolu("BR2_", "BOX ", idtmed[4], par, 0);
-  gMC->Gsvolu("CB2_", "BOX ", idtmed[5], par, 0);
 
-  //       Define parameters for right disk #2
-  
-  rin  = 7.7;
-  rout = 13.7;
-  z    = 64.4;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1R2", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1R2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2R2", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2R2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3R2", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3R2", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[21], 90., 30., 139.3, 120., 49.3, 120.);
-  gMC->Gsposp("BR2_",1,"ALIC", -13.4, 23.3, 78.7, irotm[21],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",1,"ALIC", -13.56, 23.6, 78.4, irotm[21],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[22], 90., 210., 139.3, 300., 49.3, 300.);
-  gMC->Gsposp("BR2_",2,"ALIC", 13.4,-23.3, 78.7, irotm[22],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",2,"ALIC", 13.5,-23.6, 78.4,irotm[22],"ONLY",par,3); 
-
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[23], 90., 300., 139.3, 30., 49.3, 30.);
-  gMC->Gsposp("BR2_",3,"ALIC", 23.3, 13.4, 78.7, irotm[23],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",3,"ALIC", 23.6, 13.56, 78.4,irotm[23],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[24], 90., 120., 139.3, 210., 49.3, 210.);
-  gMC->Gsposp("BR2_",4,"ALIC", -23.3, -13.4, 78.7,irotm[24],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",4,"ALIC", -23.6, -13.56, 78.4,irotm[24],"ONLY",par,3); 
-
-  //       Define parameters for left disk
-  
-  rin  = 7.7;
-  rout = 13.7;
-  z    = -64.4;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1L2", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1L2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2L2", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2L2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3L2", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3L2", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[51], 90., 30., 180.-139.3, 120., 180.-49.3, 120.);
-  gMC->Gsposp("BR2_",5,"ALIC", -13.4, 23.3, -78.7, irotm[51],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",5,"ALIC", -13.56, 23.6, -78.4,irotm[51],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[81], 90., 30., 90.-10.6, 120., 180.-10.6, 120.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",5,"ALIC", -27.5, 47.6, -170.0,irotm[81],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",5,"ALIC", -27.85, 48., -169.5,irotm[81],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[52], 90., 210., 180.-139.3, 300., 180.-49.3, 300.);
-  gMC->Gsposp("BR2_",6,"ALIC", 13.4, -23.3, -78.7,irotm[52],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",6,"ALIC", 13.56, -23.6, -78.4,irotm[52],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[82], 90., 210., 90.-10.6, 300., 180.-10.6, 300.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",6,"ALIC", 27.5, -47.6, -170.0,irotm[82],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",6,"ALIC", 27.85, -48., -169.5,irotm[82],"ONLY",par,3); 
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[53], 90., 300., 180.-139.3, 30., 180.-49.3, 30.);
-  gMC->Gsposp("BR2_",7,"ALIC", 23.3, 13.4, -78.7, irotm[53],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",7,"ALIC", 23.6, 13.56, -78.4,irotm[53],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[83], 90., 300., 90.-10.6, 30., 180.-10.6, 30.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",7,"ALIC", 47.6, 27.5, -170.,irotm[83],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",7,"ALIC", 48., 27.85, -169.5,irotm[83],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.35;
-  gMC->Matrix(irotm[54], 90., 120., 180.-139.3, 210., 180.-49.3, 210.);
-  gMC->Gsposp("BR2_",8,"ALIC", -23.3, -13.4, -78.7, irotm[54],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB2_",8,"ALIC", -23.6, -13.56, -78.4,irotm[54],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[84], 90., 120., 90.-10.6, 210., 180.-10.6, 210.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",8,"ALIC", -47.6, -27.5, -170.,irotm[84],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",8,"ALIC", -48., -27.85, -169.5,irotm[84],"ONLY",par,3); 
-
-  // ******************************************************** 
-  //       DEFINE  DISK#1  OF FMD 
-  // ******************************************************** 
-  
-  gMC->Gsvolu("BR1_", "BOX ", idtmed[4], par, 0);
-  gMC->Gsvolu("CB1_", "BOX ", idtmed[5], par, 0);
-  
-  //       Define parameters for right disk #1
-  
-  rin  = 12.4;
-  rout = 18.4;
-  z    = 59.4;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1R1", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1R1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2R1", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2R1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3R1", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3R1", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[31], 90., 60., 128., 150., 38., 150.);
-  gMC->Gsposp("BR1_",1,"ALIC", -25.3, 14.6, 76.2, irotm[31],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",1,"ALIC", -25.35, 14.8, 75.9, irotm[31],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[32], 90., 240., 128., 330., 38., 330.);
-  gMC->Gsposp("BR1_",2,"ALIC", 25.3, -14.6, 76.2, irotm[32],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",2,"ALIC", 25.35, -14.8, 75.9,irotm[32],"ONLY",par,3); 
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[33], 90., 330., 128., 60., 38., 60.);
-  gMC->Gsposp("BR1_",3,"ALIC", 14.6, 25.3, 76.2, irotm[33],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",3,"ALIC", 14.8, 25.35, 75.9,irotm[33],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[34], 90., 150., 128., 240., 38., 240.);
-  gMC->Gsposp("BR1_",4,"ALIC", -14.6, -25.3, 76.2,irotm[34],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",4,"ALIC", -14.8, -25.35, 75.9,irotm[34],"ONLY",par,3); 
-
-  //       Define parameters for left disk #1
-  
-  rin  = 12.4;
-  rout = 18.4;
-  z    = -59.4;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1L1", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1L1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2L1", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2L1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3L1", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3L1", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[41], 90., 60., 180.-128., 150., 180.-38.0, 150.);
-  gMC->Gsposp("BR1_",5,"ALIC", -25.3, 14.6, -76.2, irotm[41],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",5,"ALIC", -25.35, 14.8, -75.9,irotm[41],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[1], 90., 60., 90.-10.6, 150., 180.-10.6, 150.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",9,"ALIC", -47.6, 27.5, -170.,irotm[1],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",9,"ALIC", -48., 27.85, -169.5,irotm[1],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[42], 90., 240., 180.-128., 330., 180.-38., 330.);
-  gMC->Gsposp("BR1_",6,"ALIC", 25.3,-14.6, -76.2,irotm[42],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",6,"ALIC", 25.35,-14.8, -75.9,irotm[42],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[2], 90., 240., 90.-10.6, 330., 180.-10.6, 330.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",10,"ALIC", 47.6, -27.5, -170.0,irotm[2],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",10,"ALIC", 48., -27.85, -169.5,irotm[2],"ONLY",par,3); 
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[43], 90., 330., 180.-128., 60., 180.-38., 60.);
-  gMC->Gsposp("BR1_",7,"ALIC", 14.6, 25.3, -76.2, irotm[43],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",7,"ALIC", 14.8, 25.35, -75.9,irotm[43],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[3], 90., 330., 90.-10.6, 60., 180.-10.6, 60.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",11,"ALIC", 27.5, 47.6, -170.,irotm[3],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",11,"ALIC", 27.85, 48., -169.5,irotm[3],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 17.5;
-  gMC->Matrix(irotm[44], 90., 150., 180.-128., 240., 180.-38., 240.);
-  gMC->Gsposp("BR1_",8,"ALIC", -14.6, -25.3, -76.2, irotm[44],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB1_",8,"ALIC", -14.8, -25.35, -75.9,irotm[44],"ONLY",par,3); 
-
-  gMC->Matrix(irotm[4], 90., 150., 90.-10.6, 240., 180.-10.6, 240.);
-  par[1] = 0.1;
-  par[2] = 81.4;
-  gMC->Gsposp("BR5_",12,"ALIC", -27.5, -47.6, -170.,irotm[4],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB5_",12,"ALIC", -27.85, -48., -169.5,irotm[4],"ONLY",par,3); 
-
-  // *********************************************************** 
-  //       DEFINE LEFT DISK#4 OF FMD 
-  // *********************************************************** 
-
-  gMC->Gsvolu("BR4_", "BOX ", idtmed[4], par, 0);
-  gMC->Gsvolu("CB4_", "BOX ", idtmed[5], par, 0);
-
-  //       Define parameters 
-
-  rin  = 4.5;
-  rout = 10.5;
-  z    = -229.5;
-
-  //       Ring #1 
-
-  par[0] = rin;
-  par[1] = rout;
-  par[2] = 1.5;
-  gMC->Gsvolu("R1L4", "TUBE", idtmed[1], par, 3);
-  gMC->Gspos("R1L4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #2 
-
-  par[0] = rout;
-  par[1] = rout + .65;
-  par[2] = 1.5;
-  gMC->Gsvolu("R2L4", "TUBE", idtmed[2], par, 3);
-  gMC->Gspos("R2L4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
-
-  //       Ring #3 
-
-  par[0] = rout + .65;
-  par[1] = rout + 5.65;
-  par[2] = .025;
-  gMC->Gsvolu("R3L4", "TUBE", idtmed[3], par, 3);
-  gMC->Gspos("R3L4", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
-
-  //       Bracket #1
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 31.25;
-  gMC->Matrix(irotm[71], 90., 0., 90.-71., 90., 180.-71., 90.);
-  gMC->Gsposp("BR4_",1,"ALIC", 0., 40.25, -240., irotm[71],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB4_",1,"ALIC", 0., 40.75, -239.5, irotm[71],"ONLY",par,3); 
-
-  //       Bracket #2
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 31.25;
-  gMC->Matrix(irotm[72], 90., 180., 90.-71., 270., 180.-71., 270.);
-  gMC->Gsposp("BR4_",2,"ALIC", 0., -40.25, -240., irotm[72],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB4_",2,"ALIC", 0., -40.75, -239.5,irotm[72],"ONLY",par,3); 
-
-  //       Bracket #3
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 31.25;
-  gMC->Matrix(irotm[73], 90., 270., 90.-71., 0., 180.-71., 0.);
-  gMC->Gsposp("BR4_",3,"ALIC", 40.25, 0., -240., irotm[73],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB4_",3,"ALIC", 40.75, 0., -239.5,irotm[73],"ONLY",par,3); 
-
-  //       Bracket #4
-
-  par[0] = 1.5;
-  par[1] = 0.1;
-  par[2] = 31.25;
-  gMC->Matrix(irotm[74], 90., 90., 90.-71., 180., 180.-71., 180.);
-  gMC->Gsposp("BR4_",4,"ALIC", -40.25, 0., -240.,irotm[74],"ONLY",par,3); 
-  par[1] = 0.5;
-  gMC->Gsposp("CB4_",4,"ALIC", -40.75, 0., -239.5,irotm[74],"ONLY",par,3); 
 }
-
-//_____________________________________________________________________________
-void AliFMDv1::DrawModule()
+//---------------------------------------------------------------------
+void AliFMDv1::DrawDetector()
 {
-  //
-  // Draw a shaded view of the FMD version 1
-  //
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  // 
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN",0);
-  //
-  // Set the volumes visible
-  gMC->Gsatt("R1R3","SEEN",1);
-  gMC->Gsatt("R2R3","SEEN",1);
-  gMC->Gsatt("R3R3","SEEN",1);
-  gMC->Gsatt("R1L3","SEEN",1);
-  gMC->Gsatt("R2L3","SEEN",1);
-  gMC->Gsatt("R3L3","SEEN",1);
-  gMC->Gsatt("R1R2","SEEN",1);
-  gMC->Gsatt("R2R2","SEEN",1);
-  gMC->Gsatt("R3R2","SEEN",1);
-  gMC->Gsatt("R1L2","SEEN",1);
-  gMC->Gsatt("R2L2","SEEN",1);
-  gMC->Gsatt("R3L2","SEEN",1);
-  gMC->Gsatt("R1R1","SEEN",1);
-  gMC->Gsatt("R2R1","SEEN",1);
-  gMC->Gsatt("R3R1","SEEN",1);
-  gMC->Gsatt("R1L1","SEEN",1);
-  gMC->Gsatt("R2L1","SEEN",1);
-  gMC->Gsatt("R3L1","SEEN",1);
-  gMC->Gsatt("R1L4","SEEN",1);
-  gMC->Gsatt("R2L4","SEEN",1);
-  gMC->Gsatt("R3L4","SEEN",1);
-  gMC->Gsatt("BR1_","SEEN",1);
-  gMC->Gsatt("BR2_","SEEN",1);
-  gMC->Gsatt("BR3_","SEEN",1);
-  gMC->Gsatt("BR4_","SEEN",1);
-  gMC->Gsatt("BR5_","SEEN",1);
-  gMC->Gsatt("CB1_","SEEN",1);
-  gMC->Gsatt("CB2_","SEEN",1);
-  gMC->Gsatt("CB3_","SEEN",1);
-  gMC->Gsatt("CB4_","SEEN",1);
-  gMC->Gsatt("CB5_","SEEN",1);
-  gMC->Gsatt("R1SP","SEEN",1);
-  gMC->Gsatt("R2SP","SEEN",1);
-  gMC->Gsatt("R3SP","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, 6, 9, .08, .08);
-  gMC->Gdhead(1111, "Forward Multiplicity Detector version 1");
-  gMC->Gdman(13, 9, "MAN");
+//
+// Draw a shaded view of the Forward multiplicity detector version 0
+//
+
+AliMC* pMC = AliMC::GetMC();
+
+//Set ALIC mother transparent
+pMC->Gsatt("ALIC","SEEN",0);
+//
+//Set volumes visible
+gMC->Gsatt("FMD0","SEEN",1);
+gMC->Gsatt("FMD1","SEEN",1);
+gMC->Gsatt("FMD2","SEEN",1);
+gMC->Gsatt("FMD3","SEEN",1);
+gMC->Gsatt("FMD4","SEEN",1);
+gMC->Gsatt("FMD5","SEEN",1);
+
+//
+gMC->Gdopt("hide","on");
+gMC->Gdopt("shad","on");
+gMC->SetClipBox(".");
+gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
+gMC->DefaultRange();
+gMC->Gdraw("alic",40,30,0,12,9.5,.2,0.2);
+gMC->Gdhead(1111,"Forward multiplicity detector");
+gMC->Gdopt("hide","off");
+}
+//-------------------------------------------------------------------
+void AliFMDv1::Init()
+{
+// Initialises version 0 of the Forward Multiplicity Detector
+//
+AliMC* gMC=AliMC::GetMC();
+AliFMD::Init();
+fIdSens1=gMC->VolId("GRIN");
+printf("*** FMD version 1 initialized ***\n");
 }
 
-//_____________________________________________________________________________
-void AliFMDv1::CreateMaterials()
+//-------------------------------------------------------------------
+
+void AliFMDv1::StepManager()
 {
   //
-  // Create Materials for version 1 of FMD
+  // Called for every step in the Forward Multiplicity Detector
   //
+  Int_t id,copy,copy1,copy2;
+  static Float_t hits[9];
+  static Int_t vol[3];
+  static Float_t de;
+  TLorentzVector pos;
+  TLorentzVector mom;
 
-  //     Material for ring #1 
-  Float_t ar1[8] = { 55.8,58.7,52.,47.9,16.,28.,207.2,27. };
-  Float_t zr1[8] = { 26.,28.,24.,22.,8.,14.,82.,13. };
-  Float_t wr1[8] = { .27,.081,.054,.045,.18,.25,.06,.06 };
-  //     Material for ring #2 
-  Float_t ar2[3] = { 55.8,27.,16. };
-  Float_t zr2[3] = { 26.,13.,8. };
-  Float_t wr2[3] = { .35,.34,.31 };
-  //     Material for ring #3 
-  Float_t ar3[3] = { 28.,27.,16. };
-  Float_t zr3[3] = { 14.,13.,8. };
-  Float_t wr3[3] = { .37,.33,.3 };
-  //     Material for brackets 
-  Float_t abr[2] = { 1.,12. };
-  Float_t zbr[2] = { 1.,6. };
-  Float_t wbr[2] = { .1,.9 };
-  //     Material for cables 
-  Float_t acb[4] = { 1.,12.,37.,63.54 };
-  Float_t zcb[4] = { 1.,6.,17.,2.9 };
-  Float_t wcb[4] = { .02,.14,.12,.72 };
-  
-  Float_t epsil, stmin, deemax, tmaxfd, stemax;
-  
-  Int_t   isxfld = gAlice->Field()->Integ();
-  Float_t sxmgmx = gAlice->Field()->Max();
-  
-  //     Ring #1 
-  
-  AliMixture(1, "FMD_R1$", ar1, zr1, 2.69, 8, wr1);
-  
-  //     Ring #2 
-  
-  AliMixture(2, "FMD_R2$", ar2, zr2, 2.63, 3, wr2);
-  
-  //     Ring #3 
-  
-  AliMixture(3, "FMD_R3$", ar3, zr3, 3.15, 3, wr3);
 
-  //     Brackets 
-  
-  AliMixture(4, "FMD_BR$", abr, zbr, 1.8, 2, wbr);
+  TClonesArray &lhits = *fHits;
+  AliMC* gMC=AliMC::GetMC();
+  if(!gMC->IsTrackAlive()) return; // particle has disappeared
 
-  //     Cables
+  Float_t charge = gMC->TrackCharge();
+  if(TMath::Abs(charge)<=0.) return; //take only charged particles
+
+  //  printf(" in StepManeger \n");
+  id=gMC->CurrentVolID(copy);
   
-  AliMixture(5, "FMD_CB$", acb, zcb, 3.11, 4, wcb);
-
-  // ******************************************************* 
-  //     Defines tracking media parameters. 
-  // ******************************************************* 
-  epsil  = .001; // Tracking precision, DLS 
-  stemax = -1.;  // Maximum displacement for multiple scattering 
-  tmaxfd = -20.; // Maximum angle due to field deflection 
-  deemax = -.3;  // Maximum fractional energy loss, DLS 
-  stmin  = -.8;
-  // ******************************************************** 
-  AliMedium(1, "FMD_R1_L3        ", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(2, "FMD_R2_L3        ", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(3, "FMD_R3_L3        ", 3, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(4, "FMD_BR_L3        ", 4, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-  AliMedium(5, "FMD_CB_L3        ", 5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
-}
+// Check the sensetive volume
+   if(id==fIdSens1)
+     {
+       if(gMC->IsTrackEntering())
+        {
+          //      ((TGeant3*)gMC)->Gpcxyz();
+          vol[2]=copy;
+          gMC->CurrentVolOffID(1,copy1);
+          vol[1]=copy1;
+          gMC->CurrentVolOffID(2,copy2);
+          vol[0]=copy2;
+          gMC->TrackPosition(pos);
+          hits[0]=pos[0];
+          hits[1]=pos[1];
+          hits[2]=pos[2];
+          gMC->TrackMomentum(mom);
+          hits[3]=mom[0];
+          hits[4]=mom[1];
+          hits[5]=mom[2];
+
+          Int_t iPart= gMC->TrackPid();
+          Int_t partId=gMC->IdFromPDG(iPart);
+          hits[7]=partId;
+          hits[8]=1e9*gMC->TrackTime();
+          de=0.;
+          //      for(i=0; i<9; i++) printf(" hits %f \n",hits[i]);
+        }
+       if(gMC->IsTrackInside()){
+          de=de+1000.*gMC->Edep();
+       }
+       
+       if(gMC->IsTrackExiting()
+         ||gMC->IsTrackDisappeared()||
+         gMC->IsTrackStop())
+        {
+            hits[6]=de+1000.*gMC->Edep();
+    new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+        } // IsTrackExiting()
+     }
+  }
+
+
+
+
 
 
index efe2994..2fcc2dc 100644 (file)
@@ -3,28 +3,37 @@
 /* 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:FMD     //
 ////////////////////////////////////////////////
  
 #include "AliFMD.h"
+#include "AliFMDSDigitizer.h"
  
 class AliFMDv1 : public AliFMD {
   
 public:
-  AliFMDv1();
+  AliFMDv1() {};
   AliFMDv1(const char *name, const char *title);
   virtual       ~AliFMDv1() {}
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
-  virtual void   DrawModule();
-  virtual Int_t  IsVersion() const {return 1;}
-  virtual void   DrawDetector() {}
-  virtual void   StepManager() {}
-  ClassDef(AliFMDv1,1)  //Class for FMD version 1
+  virtual void   DrawDetector();
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  virtual void   StepManager();
+
+protected:
+   Int_t fIdSens1; // Sensetive volume  in FMD
+   
+// Background event for event mixing
+   Text_t *fFileName;           // ! File with background hits
+   TTree *fTrH1;                // Hits Tree for background event
+   TClonesArray *fHits2;        // List of hits for one track only
+  
+   ClassDef(AliFMDv1,2)  //Class for FMD version 0
 };
 
 #endif
+
+