Geometry framework classes were made independent from the rest of MUON and linked...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Nov 2004 16:16:07 +0000 (16:16 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Nov 2004 16:16:07 +0000 (16:16 +0000)
52 files changed:
MUON/AliMUON.cxx
MUON/AliMUON.h
MUON/AliMUONChamber.cxx
MUON/AliMUONChamber.h
MUON/AliMUONCommonGeometryBuilder.cxx [new file with mode: 0644]
MUON/AliMUONCommonGeometryBuilder.h [new file with mode: 0644]
MUON/AliMUONConstants.cxx
MUON/AliMUONConstants.h
MUON/AliMUONGeometryBuilder.cxx
MUON/AliMUONGeometryBuilder.h
MUON/AliMUONGeometryDEIndexing.cxx [new file with mode: 0644]
MUON/AliMUONGeometryDEIndexing.h [new file with mode: 0644]
MUON/AliMUONGeometryDetElement.cxx [new file with mode: 0644]
MUON/AliMUONGeometryDetElement.h [new file with mode: 0644]
MUON/AliMUONGeometryEnvelopeStore.cxx
MUON/AliMUONGeometryEnvelopeStore.h
MUON/AliMUONGeometryModule.cxx [new file with mode: 0644]
MUON/AliMUONGeometryModule.h [new file with mode: 0644]
MUON/AliMUONGeometrySVMap.cxx
MUON/AliMUONGeometrySVMap.h
MUON/AliMUONGeometrySegmentation.cxx [new file with mode: 0644]
MUON/AliMUONGeometrySegmentation.h [new file with mode: 0644]
MUON/AliMUONGeometryStore.cxx [new file with mode: 0644]
MUON/AliMUONGeometryStore.h [new file with mode: 0644]
MUON/AliMUONSlatGeometryBuilder.cxx
MUON/AliMUONSt12QuadrantSegmentation.cxx [new file with mode: 0644]
MUON/AliMUONSt12QuadrantSegmentation.h [new file with mode: 0644]
MUON/AliMUONSt1GeometryBuilder.cxx
MUON/AliMUONSt1GeometryBuilderV2.cxx
MUON/AliMUONSt2GeometryBuilder.cxx
MUON/AliMUONTest.cxx [new file with mode: 0644]
MUON/AliMUONTest.h [new file with mode: 0644]
MUON/AliMUONTriggerGeometryBuilder.cxx
MUON/AliMUONVGeometryBuilder.cxx
MUON/AliMUONVGeometryBuilder.h
MUON/AliMUONVGeometryDEIndexing.cxx [new file with mode: 0644]
MUON/AliMUONVGeometryDEIndexing.h [new file with mode: 0644]
MUON/AliMUONv0.cxx
MUON/AliMUONv1.cxx
MUON/AliMUONv3.cxx
MUON/MUONLinkDefGeometry.h [new file with mode: 0644]
MUON/MUONTest.C [new file with mode: 0644]
MUON/MUONsimLinkDef.h
MUON/data/transform_st1.dat
MUON/data/transform_st1V2.dat
MUON/data/transform_st2.dat
MUON/data/transform_trigger.dat
MUON/libMUONbase.pkg
MUON/libMUONgeometry.pkg [new file with mode: 0644]
MUON/libMUONmapping.pkg
MUON/libMUONrec.pkg
MUON/libMUONsim.pkg

index 74f787d..05e6176 100644 (file)
@@ -60,7 +60,9 @@
 #include "AliMUONTransientDigit.h"
 #include "AliMUONTriggerCircuit.h"
 #include "AliMUONGeometryBuilder.h"
+#include "AliMUONCommonGeometryBuilder.h"
 #include "AliMUONVGeometryBuilder.h"   
+#include "AliMUONGeometryDEIndexing.h" 
 #include "AliMUONDigitizerv2.h"
 #include "AliMUONSDigitizerv1.h"
 #include "AliMUONRawData.h"
@@ -92,6 +94,7 @@ AliMUON::AliMUON()
     fChambers(0),
     fTriggerCircuits(0),
     fGeometryBuilder(0),
+    fDEIndexing(0),
     fAccCut(kFALSE),
     fAccMin(0.),
     fAccMax(0.),   
@@ -118,6 +121,7 @@ AliMUON::AliMUON(const char *name, const char *title)
     fChambers(0),
     fTriggerCircuits(0),
     fGeometryBuilder(0),
+    fDEIndexing(0),
     fAccCut(kFALSE),
     fAccMin(0.),
     fAccMax(0.),   
@@ -133,6 +137,25 @@ AliMUON::AliMUON(const char *name, const char *title)
   fIshunt =  0;
 
   SetMarkerColor(kRed);//
+    
+  // Geometry builder
+  fGeometryBuilder = new AliMUONGeometryBuilder(this);
+  
+  // Common geometry definitions
+  fGeometryBuilder
+    ->AddBuilder(new AliMUONCommonGeometryBuilder(this));
+
+  // Define the global transformation:
+  // Transformation from the old ALICE coordinate system to a new one:
+  // x->-x, z->-z 
+  TGeoRotation* rotGlobal 
+    = new TGeoRotation("rotGlobal", 90., 180., 90., 90., 180., 0.);
+  fGeometryBuilder
+    ->SetGlobalTransformation (TGeoCombiTrans(0., 0., 0., rotGlobal));
+
+  // Detection elements indexing
+  fDEIndexing = new AliMUONGeometryDEIndexing();
+
 //
 // Creating List of Chambers
     Int_t ch;
@@ -169,9 +192,6 @@ AliMUON::AliMUON(const char *name, const char *title)
     for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
       fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);          
     }
-    
-    // Geometry builder
-    fGeometryBuilder = new AliMUONGeometryBuilder(this);
 }
 
 //____________________________________________________________________
@@ -201,6 +221,7 @@ AliMUON::~AliMUON()
   }
   delete fMUONData;
   delete fGeometryBuilder;
+  delete fDEIndexing;
 }
 
 //________________________________________________________________________
index 41b487a..acbd025 100644 (file)
@@ -33,6 +33,7 @@ class AliMUONReconstHit;
 class AliMUONMerger;
 class AliMUONGeometryBuilder;
 class AliMUONVGeometryBuilder;
+class AliMUONGeometryDEIndexing;
 class AliESD;
 
 class AliMUON : public  AliDetector 
@@ -131,7 +132,8 @@ class AliMUON : public  AliDetector
     Int_t                 fSplitLevel;         // Splitlevel when making branches in outfiles.
     TObjArray*            fChambers;           // List of Tracking Chambers
     TObjArray*            fTriggerCircuits;    // List of Trigger Circuits
-    AliMUONGeometryBuilder*  fGeometryBuilder; // Geometry buiulder 
+    AliMUONGeometryBuilder*     fGeometryBuilder; // Geometry builder 
+    AliMUONGeometryDEIndexing*  fDEIndexing;   // Geometry DE indexing 
    
     //
     Bool_t   fAccCut;          //Transport acceptance cut
@@ -150,7 +152,7 @@ class AliMUON : public  AliDetector
     // Background eent for event mixing
     AliMUONMerger *fMerger;   // ! pointer to merger
     
-    ClassDef(AliMUON,4)  // MUON Detector base class
+    ClassDef(AliMUON,5)  // MUON Detector base class
 };
 #endif
 
index 68e78d3..a934819 100644 (file)
@@ -21,7 +21,7 @@
 
 // --- MUON includes ---
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliLog.h"
 
 ClassImp(AliMUONChamber)       
@@ -64,7 +64,7 @@ AliMUONChamber::AliMUONChamber(Int_t id)
     fSegmentation->AddAt(0,0);
     fSegmentation->AddAt(0,1);
 
-    fGeometry = new AliMUONChamberGeometry(fId);
+    fGeometry = new AliMUONGeometryModule(fId);
 }
 
 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
index dc48ffa..a8e5627 100644 (file)
@@ -13,7 +13,7 @@
 #include "AliMUONResponse.h"
 
 class AliMUONClusterFinderVS;
-class AliMUONChamberGeometry;
+class AliMUONGeometryModule;
 
 class AliMUONChamber : public TObject
 {
@@ -117,8 +117,8 @@ class AliMUONChamber : public TObject
   virtual void SetChargeCorrel(Float_t correl) {fResponse->SetChargeCorrel(correl);}
 
 // geometry  
-  void SetGeometry(AliMUONChamberGeometry* geometry) {fGeometry = geometry;}
-  AliMUONChamberGeometry* GetGeometry() const {return fGeometry; }
+  void SetGeometry(AliMUONGeometryModule* geometry) {fGeometry = geometry;}
+  AliMUONGeometryModule* GetGeometry() const {return fGeometry; }
 
   
  protected:
@@ -138,8 +138,8 @@ class AliMUONChamber : public TObject
   TObjArray              *fSegmentation;    // pointer to segmentation
   AliMUONClusterFinderVS *fReconstruction;  // pointer to reconstruction
   AliMUONResponse        *fResponse;        // pointer to response
-  AliMUONChamberGeometry *fGeometry;        // pointer to geometry
-  ClassDef(AliMUONChamber,2) // Muon tracking chamber class
+  AliMUONGeometryModule  *fGeometry;        // pointer to geometry
+  ClassDef(AliMUONChamber,3) // Muon tracking chamber class
 };
 
 #endif
diff --git a/MUON/AliMUONCommonGeometryBuilder.cxx b/MUON/AliMUONCommonGeometryBuilder.cxx
new file mode 100644 (file)
index 0000000..2ad1362
--- /dev/null
@@ -0,0 +1,240 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *      SigmaEffect_thetadegrees                                                                  *
+ * 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 purpeateose. It is      *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONCommonGeometryBuilder
+// ----------------------------------
+// Geometry construction common to all stations
+// (material definition).
+// separated from AliMUONGeometryBuilder
+
+
+#include <TVirtualMC.h>
+
+#include "AliMUONCommonGeometryBuilder.h"
+#include "AliMUON.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+
+ClassImp(AliMUONCommonGeometryBuilder)
+//______________________________________________________________________________//___________________________________________
+AliMUONCommonGeometryBuilder::AliMUONCommonGeometryBuilder(AliMUON* muon)
+  : AliMUONVGeometryBuilder("", 0),
+    fMUON(muon)
+{
+// Standars constructor
+}
+
+//______________________________________________________________________________//___________________________________________
+AliMUONCommonGeometryBuilder::AliMUONCommonGeometryBuilder() 
+  : AliMUONVGeometryBuilder(),
+    fMUON(0)
+{
+// Default constructor
+} 
+
+//______________________________________________________________________________
+AliMUONCommonGeometryBuilder::AliMUONCommonGeometryBuilder(
+                                 const AliMUONCommonGeometryBuilder& right) 
+  : AliMUONVGeometryBuilder(right) 
+{  
+  // copy constructor (not implemented)
+
+  Fatal("AliMUONCommonGeometryBuilder", "Copy constructor not provided.");
+}
+
+//______________________________________________________________________________
+AliMUONCommonGeometryBuilder::~AliMUONCommonGeometryBuilder()
+{
+// Destructor
+}
+
+//______________________________________________________________________________
+AliMUONCommonGeometryBuilder& 
+AliMUONCommonGeometryBuilder::operator=(const AliMUONCommonGeometryBuilder& right)
+{
+  // assignement operator (not implemented)
+
+  // check assignement to self
+  if (this == &right) return *this;
+
+  Fatal("operator =", "Assignement operator not provided.");
+    
+  return *this;  
+}    
+
+//
+// public functions
+//
+
+//_____________________________________________________________________________
+void AliMUONCommonGeometryBuilder::CreateMaterials()
+{
+  // Definition of common materials
+  // --
+
+  //
+  //     Ar-CO2 gas (80%+20%)
+  Float_t ag1[3]   = { 39.95,12.01,16. };
+  Float_t zg1[3]   = { 18.,6.,8. };
+  Float_t wg1[3]   = { .8,.0667,.13333 };
+  Float_t dg1      = .001821;
+  //
+  //     Ar-buthane-freon gas -- trigger chambers 
+  Float_t atr1[4]  = { 39.95,12.01,1.01,19. };
+  Float_t ztr1[4]  = { 18.,6.,1.,9. };
+  Float_t wtr1[4]  = { .56,.1262857,.2857143,.028 };
+  Float_t dtr1     = .002599;
+  //
+  //     Ar-CO2 gas 
+  Float_t agas[3]  = { 39.95,12.01,16. };
+  Float_t zgas[3]  = { 18.,6.,8. };
+  Float_t wgas[3]  = { .74,.086684,.173316 };
+  Float_t dgas     = .0018327;
+  //
+  //     Ar-Isobutane gas (80%+20%) -- tracking 
+  Float_t ag[3]    = { 39.95,12.01,1.01 };
+  Float_t zg[3]    = { 18.,6.,1. };
+  Float_t wg[3]    = { .8,.057,.143 };
+  Float_t dg       = .0019596;
+  //
+  //     Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger 
+  Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
+  Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
+  Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
+  Float_t dtrig    = .0031463;
+  //
+  //     bakelite: C6 H6 O
+  Float_t abak[3] = {12.01 , 1.01 , 16.};
+  Float_t zbak[3] = {6.     , 1.   , 8.};
+  Float_t wbak[3] = {6.     , 6.   , 1.}; 
+  Float_t dbak = 1.4;
+
+  Int_t iSXFLD   = gAlice->Field()->Integ();
+  Float_t sXMGMX = gAlice->Field()->Max();
+  //
+  // --- Define the various materials for GEANT --- 
+  fMUON->AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
+  fMUON->AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
+  // Air
+  Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
+  Float_t zAir[4]={6.,7.,8.,18.};
+  Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
+  Float_t dAir = 1.20479E-3;
+  fMUON->AliMixture(15, "AIR$      ", aAir,  zAir, dAir,4, wAir);
+  //    fMUON->AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
+  fMUON->AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
+  fMUON->AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
+  fMUON->AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
+  fMUON->AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
+  fMUON->AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
+  fMUON->AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
+
+  // materials for slat: 
+  //     Sensitive area: gas (already defined) 
+  //     PCB: copper 
+  //     insulating material: vetronite -> replacing by G10 Ch. Finck
+  //     spacer: noryl Ch. Finck
+  //     panel sandwich: carbon, nomex, carbon replacing rohacell by nomex Ch. Finck
+
+  // G10: SiO2(60%) + C8H14O4(40%)
+  Float_t aglass[5] = {12.01, 28.09, 16., 1.01,  16.};
+  Float_t zglass[5] = { 6.,   14.,    8., 1.,    8.};
+  Float_t wglass[5] = { 0.22, 0.28, 0.32, 0.03,  0.15};
+  Float_t dglass    = 1.7;
+
+  // rohacell: C9 H13 N1 O2
+  Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
+  Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
+  Float_t wrohac[4] = { 9.,   13.,    1.,     2.};
+  Float_t drohac    = 0.03;
+
+  // Nomex: C22 H10 N2 O5
+  Float_t aNomex[4] = {12.01,  1.01, 14.010, 16.};
+  Float_t zNomex[4] = { 6.,    1.,    7.,     8.};
+  Float_t wNomex[4] = { 22.,   10.,   2.,     5.};
+  Float_t dNomex    = 0.024; //honey comb
+  Float_t dNomex2   = 1.43;  //bulk material
+
+
+  // Noryl: C8 H8 O polyphenylene oxyde (di-methyl not sure)
+  Float_t aNoryl[3] = {12.01,  1.01, 16.};
+  Float_t zNoryl[3] = { 6.,    1.,    8.};
+  Float_t wNoryl[3] = { 8.,    8.,    1.};
+  Float_t dNoryl    = 1.06;
+
+  fMUON->AliMaterial(31, "COPPER$",   63.54,    29.,   8.96,   1.4, 0.);
+  fMUON->AliMixture( 32, "G10$",      aglass, zglass, dglass, -5, wglass);
+  fMUON->AliMaterial(33, "Carbon$",   12.01,     6.,  2.265,  18.8, 49.9);
+  fMUON->AliMixture( 34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac); 
+  fMUON->AliMixture( 35, "Nomex$",    aNomex, zNomex, dNomex, -4, wNomex); 
+  fMUON->AliMixture( 36, "Noryl$",    aNoryl, zNoryl, dNoryl, -3, wNoryl); 
+  fMUON->AliMixture( 37, "Nomex_bulk$",aNomex, zNomex, dNomex2, -4, wNomex); 
+
+  Float_t  epsil  = .001; // Tracking precision, 
+  Float_t  stemax = -1.;  // Maximum displacement for multiple scat 
+  Float_t  tmaxfd = -20.; // Maximum angle due to field deflection 
+  Float_t  deemax = -.3;  // Maximum fractional energy loss, DLS 
+  Float_t  stmin  = -.8;
+  Float_t  maxDestepAlu = fMUON->GetMaxDestepAlu();
+  Float_t  maxDestepGas = fMUON->GetMaxDestepGas();
+  Float_t  maxStepAlu = fMUON->GetMaxStepAlu();
+  Float_t  maxStepGas = fMUON->GetMaxStepGas();
+
+  //
+  //    Air 
+  fMUON->AliMedium(1, "AIR_CH_US         ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+  //
+  //    Aluminum 
+  fMUON->AliMedium(4, "ALU_CH_US          ", 9, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
+                  maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(5, "ALU_CH_US          ", 10, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
+                  maxDestepAlu, epsil, stmin);
+  //
+  //    Ar-isoC4H10 gas 
+  fMUON->AliMedium(6, "AR_CH_US          ", 20, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas, 
+                  maxDestepGas, epsil, stmin);
+  //
+  //    Ar-Isobuthane-Forane-SF6 gas 
+  fMUON->AliMedium(7, "GAS_CH_TRIGGER    ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
+
+  fMUON->AliMedium(8, "BAKE_CH_TRIGGER   ", 19, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
+                  maxDestepAlu, epsil, stmin);
+  //
+  // slat medium
+  fMUON->AliMedium(9, "ARG_CO2   ", 22, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas, 
+                  maxDestepAlu, epsil, stmin);
+  //
+  // tracking media for slats: check the parameters!! 
+  fMUON->AliMedium(11, "PCB_COPPER        ", 31, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(12, "G10               ", 32, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(13, "CARBON            ", 33, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(14, "Rohacell          ", 34, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(15, "Nomex             ", 35, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(16, "Noryl             ", 36, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+  fMUON->AliMedium(17, "Nomex bulk        ", 37, 0, iSXFLD, sXMGMX, tmaxfd, 
+                  maxStepAlu, maxDestepAlu, epsil, stmin);
+}
+
+
diff --git a/MUON/AliMUONCommonGeometryBuilder.h b/MUON/AliMUONCommonGeometryBuilder.h
new file mode 100644 (file)
index 0000000..44e439e
--- /dev/null
@@ -0,0 +1,50 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONCommonGeometryBuilder
+// ----------------------------------
+// Geometry construction common to all stations
+// (material definition).
+// separated from AliMUONGeometryBuilder
+
+#ifndef ALI_MUON_COMMON_GEOMETRY_BUILDER_H
+#define ALI_MUON_COMMON_GEOMETRY_BUILDER_H
+
+#include "AliMUONVGeometryBuilder.h"
+
+class AliMUON;
+
+class AliMUONCommonGeometryBuilder : public AliMUONVGeometryBuilder 
+{
+  public:
+    AliMUONCommonGeometryBuilder(AliMUON* muon);
+    AliMUONCommonGeometryBuilder();
+    virtual  ~AliMUONCommonGeometryBuilder();
+
+    virtual void  CreateMaterials();
+    virtual void  CreateGeometry()      {}
+    virtual void  SetSensitiveVolumes() {}
+    virtual void  SetTransformations()  {}
+
+  protected:
+    AliMUONCommonGeometryBuilder(const AliMUONCommonGeometryBuilder& right);
+    AliMUONCommonGeometryBuilder&  
+                     operator = (const AliMUONCommonGeometryBuilder& right);
+  private:
+    // data members
+    AliMUON*  fMUON; // MUON detector
+
+  ClassDef(AliMUONCommonGeometryBuilder,1)  // Common MUON geometry definitions
+};
+
+#endif //ALI_MUON_COMMON_GEOMETRY_BUILDER_H
+
+
+
+
+
+
+
index b50e3e6..991ff14 100644 (file)
@@ -24,8 +24,6 @@ Int_t   AliMUONConstants::fgNCh = 14;
 Int_t   AliMUONConstants::fgNTrackingCh = 10;
 Int_t   AliMUONConstants::fgNTriggerCh = 4;
 Int_t   AliMUONConstants::fgNTriggerCircuit = 234;
-Int_t   AliMUONConstants::fgNofDetElements[14] =
-{ 4, 4, 4, 4, 18, 18, 26, 26, 26, 26, 18, 18, 18, 18 };
 
 Float_t AliMUONConstants::fgDefaultChamberZ[14] = 
   {-533.5, -546.5, -678.5, -693.5, // St12
@@ -38,27 +36,9 @@ Float_t  AliMUONConstants::fgDzSlat = 8.5/2.;
 
 Float_t  AliMUONConstants::fgDmin[7] = {  36.4,  46.2,  66.0,   80.,   80., 100., 100.};    
 Float_t  AliMUONConstants::fgDmax[7]  = {183., 245., 395.,  560.,  563., 850., 900.};  
-Int_t   AliMUONConstants::fgMaxZoom = 20;
+Int_t    AliMUONConstants::fgMaxZoom = 20;
 
 //______________________________________________________________________________
-Int_t AliMUONConstants::GetChamberId(Int_t detElemId)
-{ 
-// Get chamber Id from detection element Id
-// ---
-
-  return detElemId/100 - 1;
-}  
-
-//______________________________________________________________________________
-Int_t AliMUONConstants::GetFirstDetElemId(Int_t chamberId)
-{
-// Get first detection element Id for chamber specified by chamber Id
-// ---
-
-  return (chamberId+1)*100;
-} 
-//_____________________________________________________________________________
 Int_t AliMUONConstants::ChamberNumber(Float_t z) 
 {
   // return chamber number according z position of hit. Should be taken from geometry ?
index 104a476..602a672 100644 (file)
@@ -18,8 +18,6 @@ class AliMUONConstants : public TObject {
     static Int_t    NTriggerCh() {return fgNTriggerCh;}
     // return number of trigger circuits
     static Int_t    NTriggerCircuit() {return fgNTriggerCircuit;}
-    // return number of detection elements in chamber i
-    static Int_t    NofDetElements(Int_t i) {return fgNofDetElements[i];}
     // return position of chamber i
     static Float_t  DefaultChamberZ(Int_t i) {return fgDefaultChamberZ[i];}
     // return pointer to array of positions
@@ -34,11 +32,6 @@ class AliMUONConstants : public TObject {
     static Float_t    DzCh() {return fgDzCh;}
     // return half-distance between two slats
     static Float_t    DzSlat() {return fgDzSlat;}
-
-    // Conversion functions between chamber Id and detection element Id
-    static  Int_t GetChamberId(Int_t detElemId); 
-    static  Int_t GetFirstDetElemId(Int_t chamberId); 
-
     static  Int_t ChamberNumber(Float_t z); 
 
  protected:
@@ -51,7 +44,6 @@ class AliMUONConstants : public TObject {
     static Int_t  fgNTriggerCh;         //  Number of Trigger Chambers
     static Int_t  fgNTriggerCircuit;    //  Number of Trigger Circuits
 //
-    static Int_t    fgNofDetElements[14];     // ! Number of detection elements in chambers
     static Float_t  fgDefaultChamberZ[14];    // ! Z-positions of chambers
     static Float_t  fgDmin[7];                // ! inner diameter
     static Float_t  fgDmax[7];                // ! outer diameter
index 487dc76..b7e351b 100644 (file)
 //
 // Class AliMUONGeometryBuilder
 // ----------------------------
-// MUON manager class for geometry construction,
-// separated form AliMUONv1
+// Manager class for geometry construction via geometry builders.
 //
 // Author: Ivana Hrivnacova, IPN Orsay
 
-#include <TClonesArray.h>
-#include <TGeoMatrix.h>
+#include <TObjArray.h>
 #include <TVirtualMC.h>
 
 #include "AliMUONGeometryBuilder.h"
-#include "AliMUON.h"
-#include "AliMUONChamber.h"
-#include "AliMUONConstants.h"
 #include "AliMUONVGeometryBuilder.h"   
-#include "AliMUONChamberGeometry.h"    
+#include "AliMUONGeometryModule.h"     
 #include "AliMUONGeometryEnvelope.h"   
 #include "AliMUONGeometryEnvelopeStore.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryStore.h"
 #include "AliMUONGeometryConstituent.h"        
-#include "AliMagF.h"
-#include "AliRun.h"
+#include "AliModule.h"
 #include "AliLog.h"
 
 ClassImp(AliMUONGeometryBuilder)
  
-//______________________________________________________________________________//___________________________________________
-AliMUONGeometryBuilder::AliMUONGeometryBuilder() 
+//______________________________________________________________________________
+AliMUONGeometryBuilder::AliMUONGeometryBuilder(AliModule* module)
   : TObject(),
-    fMUON(0),
+    fModule(module),
     fAlign(false),
-    fGlobalTransformation(0),
+    fGlobalTransformation(), 
     fGeometryBuilders(0)
 {
-// Default constructor
-} 
+// Standard constructor
+
+  fGeometryBuilders = new TObjArray(100);
+}
 
-//______________________________________________________________________________//___________________________________________
-AliMUONGeometryBuilder::AliMUONGeometryBuilder(AliMUON* muon)
+//______________________________________________________________________________
+AliMUONGeometryBuilder::AliMUONGeometryBuilder() 
   : TObject(),
-    fMUON(muon),
+    fModule(0),
     fAlign(false),
-    fGlobalTransformation(0), 
+    fGlobalTransformation(),
     fGeometryBuilders(0)
 {
-// Standars constructor
-
-  // Define the global transformation:
-  // Transformation from the old ALICE coordinate system to a new one:
-  // x->-x, z->-z 
-  TGeoRotation* rotGlobal 
-    = new TGeoRotation("rotGlobal", 90., 180., 90., 90., 180., 0.);
-  fGlobalTransformation = new TGeoCombiTrans(0., 0., 0., rotGlobal);
-
-  fGeometryBuilders = new TObjArray(AliMUONConstants::NCh());
-}
+// Default constructor
+} 
 
 //______________________________________________________________________________
 AliMUONGeometryBuilder::AliMUONGeometryBuilder(const AliMUONGeometryBuilder& right) 
@@ -85,9 +74,6 @@ AliMUONGeometryBuilder::AliMUONGeometryBuilder(const AliMUONGeometryBuilder& rig
 AliMUONGeometryBuilder::~AliMUONGeometryBuilder()
 {
 // Destructor
-
-  delete fGlobalTransformation;
-
   if (fGeometryBuilders){
     fGeometryBuilders->Delete();
     delete fGeometryBuilders;
@@ -121,16 +107,11 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
 // ---
 
   // Do not apply global transformation 
-  // if mother volume == DDIP
-  // (as it is applied on this volume)
+  // if mother volume != ALIC
+  // (as it is applied on the mother volume)
   TGeoHMatrix transform(matrix);
-  if (mName == TString("DDIP")) {
-    transform = (*fGlobalTransformation) * transform;
-               // To be changed to (*fGlobalTransformation).inverse()
-              // when available in TGeo
-              // To make this correct also for a general case when
-              // (*fGlobalTransformation) * *fGlobalTransformation) != 1
-  }           
+  if (mName != TString("ALIC"))
+    transform = fGlobalTransformation.Inverse() * transform;
      
   // Decompose transformation
   const Double_t* xyz = transform.GetTranslation();
@@ -170,7 +151,7 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
     //     << theta2 << " " << phi2 << " "
     //     << theta3 << " " << phi3 << endl;
        
-    fMUON->AliMatrix(krot, theta1, phi1, theta2, phi2, theta3, phi3);
+    fModule->AliMatrix(krot, theta1, phi1, theta2, phi2, theta3, phi3);
   }    
        
   // Place the volume in ALIC
@@ -182,10 +163,68 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
 
 } 
 
+//______________________________________________________________________________
+void AliMUONGeometryBuilder::FillGlobalTransformations(
+                                 AliMUONVGeometryBuilder* builder)
+{
+// Compute and set global transformations to detection elements
+// for each chamber geometry
+// ---
+
+  for (Int_t j=0; j<builder->NofGeometries(); j++) {
+
+    AliMUONGeometryModule* geometry = builder->Geometry(j);
+    AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
+
+    for (Int_t k=0; k<detElements->GetNofEntries(); k++) {
+     
+      AliMUONGeometryDetElement* detElement 
+       = (AliMUONGeometryDetElement*)detElements->GetEntry(k);
+         
+      if (!detElement) AliFatal("Detection element not found.") 
+         
+      const TGeoCombiTrans* localTransform 
+        = detElement->GetLocalTransformation();
+
+      // Compose global transformation
+      TGeoHMatrix total 
+       = fGlobalTransformation *
+         (*geometry->GetTransformation()) * 
+          fGlobalTransformation.Inverse() *
+         (*localTransform);
+                 // !! The local detection element frame is 
+                 // defined wrt the new ALICE coordinate system:
+                 // TGL = Tglobal * Tchamber * Tde
+                 //     =  Tglobal * Tchamber * Tglobal.inv  *  Tglobal * Tde
+                 //     = (Tglobal * Tchamber * Tglobal.inv) * (Tglobal * Tde)
+                 //     = Ttotal * Tde'
+         
+      // Convert TGeoHMatrix to TGeoCombiTrans
+      TGeoCombiTrans globalTransform(localTransform->GetName());
+      globalTransform.SetTranslation(total.GetTranslation());  
+      TGeoRotation rotation;
+      rotation.SetMatrix(total.GetRotationMatrix());
+      globalTransform.SetRotation(rotation);  
+      // Set the global transformation to detection element
+      detElement->SetGlobalTransformation(globalTransform);
+    }
+  }                        
+}           
+
 //
 // public functions
 //
 
+//_____________________________________________________________________________
+void AliMUONGeometryBuilder::AddBuilder(AliMUONVGeometryBuilder* geomBuilder)
+{
+// Adds the geometry builder to the list
+// ---
+
+  fGeometryBuilders->Add(geomBuilder);
+}
+
 //______________________________________________________________________________
 void AliMUONGeometryBuilder::CreateGeometry()
 {
@@ -199,248 +238,96 @@ void AliMUONGeometryBuilder::CreateGeometry()
     AliMUONVGeometryBuilder* builder
       = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
 
-    // Create geometry with each builder
-    if (builder) {
-      if (fAlign) {
-        builder->ReadTransformations();
-        builder->CreateGeometry();
-      }
-      else {  
-        builder->CreateGeometry();
-        builder->SetTransformations();
-      } 
+    // Create geometry + envelopes
+    //
+    if (fAlign) {
+      builder->ReadTransformations();
+      builder->CreateGeometry();
     }
-  }
+    else {  
+      builder->CreateGeometry();
+      builder->SetTransformations();
+    } 
 
-  for (Int_t j=0; j<AliMUONConstants::NCh(); j++) {
+    // Place envelopes
+    //
+    for (Int_t j=0; j<builder->NofGeometries(); j++) {
 
-    AliMUONChamberGeometry* geometry = fMUON->Chamber(j).GetGeometry();
+      AliMUONGeometryModule* geometry = builder->Geometry(j);
+  
+      // Loop over envelopes
+      const TObjArray* kEnvelopes = geometry->GetEnvelopeStore()->GetEnvelopes();
+      for (Int_t k=0; k<kEnvelopes->GetEntriesFast(); k++) {
+
+        // Get envelope
+        AliMUONGeometryEnvelope* env = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
+        const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
+        const char* only = "ONLY";
+        if (env->IsMANY()) only = "MANY";
+
+        if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
+          // virtual envelope + nof constituents = 0 
+          //         => not allowed;
+          //            empty virtual envelope has no sense 
+          AliFatal("Virtual envelope must have constituents.");
+          return;
+        }
 
-    if (!geometry) continue;
-          // Skip chambers with not defined geometry  
-         
-    // Loop over envelopes
-    const TObjArray* kEnvelopes = geometry->GetEnvelopeStore()->GetEnvelopes();
-    for (Int_t k=0; k<kEnvelopes->GetEntriesFast(); k++) {
-
-      // Get envelope
-      AliMUONGeometryEnvelope* env = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
-      const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
-      const char* only = "ONLY";
-      if (env->IsMANY()) only = "MANY";
-
-      if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
-        // virtual envelope + nof constituents = 0 
-        //         => not allowed;
-        //            empty virtual envelope has no sense 
-        AliFatal("Virtual envelope must have constituents.");
-        return;
-      }
-
-      if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
-        // non virtual envelope + nof constituents > 0 
-        //        => not allowed;
-        //           use VMC to place constituents
-        AliFatal("Non virtual envelope cannot have constituents.");
-        return;
-      }
-
-      if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
-        // non virtual envelope + nof constituents = 0 
-        //        => place envelope in ALICE by composed transformation:
-        //           Tglobal * Tch * Tenv
-
-        // Compound chamber transformation with the envelope one
-        TGeoHMatrix total 
-         = (*fGlobalTransformation) * 
-           (*geometry->GetTransformation()) * 
-           (*kEnvTrans);
-        PlaceVolume(env->GetName(), geometry->GetMotherVolume(),
-                   env->GetCopyNo(), total, 0, 0, only);
-      }
-
-      if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
-        // virtual envelope + nof constituents > 0 
-        //         => do not place envelope and place constituents
-        //            in ALICE by composed transformation:
-        //            Tglobal * Tch * Tenv * Tconst   
-
-        for  (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
-          AliMUONGeometryConstituent* constituent
-            = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
-
-          // Compound chamber transformation with the envelope one + the constituent one
+        if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
+          // non virtual envelope + nof constituents > 0 
+          //        => not allowed;
+          //           use VMC to place constituents
+          AliFatal("Non virtual envelope cannot have constituents.");
+          return;
+        }
+
+        if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
+          // non virtual envelope + nof constituents = 0 
+          //        => place envelope in ALICE by composed transformation:
+          //           Tglobal * Tch * Tenv
+
+          // Compound chamber transformation with the envelope one
           TGeoHMatrix total 
-           = (*fGlobalTransformation) *
+           = fGlobalTransformation * 
              (*geometry->GetTransformation()) * 
-             (*kEnvTrans) * 
-             (*constituent->GetTransformation());
+             (*kEnvTrans);
+          PlaceVolume(env->GetName(), geometry->GetMotherVolume(),
+                     env->GetCopyNo(), total, 0, 0, only);
+        }
+
+        if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
+          // virtual envelope + nof constituents > 0 
+          //         => do not place envelope and place constituents
+          //            in ALICE by composed transformation:
+          //            Tglobal * Tch * Tenv * Tconst   
 
-          PlaceVolume(constituent->GetName(), geometry->GetMotherVolume(),
-                     constituent->GetCopyNo(), total,
-                      constituent->GetNpar(), constituent->GetParam(), only);
+          for  (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
+            AliMUONGeometryConstituent* constituent
+              = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
+            // Compound chamber transformation with the envelope one + the constituent one
+            TGeoHMatrix total 
+             = fGlobalTransformation *
+               (*geometry->GetTransformation()) * 
+               (*kEnvTrans) * 
+               (*constituent->GetTransformation());
+
+            PlaceVolume(constituent->GetName(), geometry->GetMotherVolume(),
+                       constituent->GetCopyNo(), total,
+                        constituent->GetNpar(), constituent->GetParam(), only);
+          }
         }
-      }
-    } 
-  }
+      } // end of loop over envelopes
+    } // end of loop over builder geometries
+  } // end of loop over builders
 }
 
 //_____________________________________________________________________________
 void AliMUONGeometryBuilder::CreateMaterials()
 {
-  // Definition of common materials
-  // --
-
-  //
-  //     Ar-CO2 gas (80%+20%)
-  Float_t ag1[3]   = { 39.95,12.01,16. };
-  Float_t zg1[3]   = { 18.,6.,8. };
-  Float_t wg1[3]   = { .8,.0667,.13333 };
-  Float_t dg1      = .001821;
-  //
-  //     Ar-buthane-freon gas -- trigger chambers 
-  Float_t atr1[4]  = { 39.95,12.01,1.01,19. };
-  Float_t ztr1[4]  = { 18.,6.,1.,9. };
-  Float_t wtr1[4]  = { .56,.1262857,.2857143,.028 };
-  Float_t dtr1     = .002599;
-  //
-  //     Ar-CO2 gas 
-  Float_t agas[3]  = { 39.95,12.01,16. };
-  Float_t zgas[3]  = { 18.,6.,8. };
-  Float_t wgas[3]  = { .74,.086684,.173316 };
-  Float_t dgas     = .0018327;
-  //
-  //     Ar-Isobutane gas (80%+20%) -- tracking 
-  Float_t ag[3]    = { 39.95,12.01,1.01 };
-  Float_t zg[3]    = { 18.,6.,1. };
-  Float_t wg[3]    = { .8,.057,.143 };
-  Float_t dg       = .0019596;
-  //
-  //     Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger 
-  Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
-  Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
-  Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
-  Float_t dtrig    = .0031463;
-  //
-  //     bakelite: C6 H6 O
-  Float_t abak[3] = {12.01 , 1.01 , 16.};
-  Float_t zbak[3] = {6.     , 1.   , 8.};
-  Float_t wbak[3] = {6.     , 6.   , 1.}; 
-  Float_t dbak = 1.4;
-
-  Int_t iSXFLD   = gAlice->Field()->Integ();
-  Float_t sXMGMX = gAlice->Field()->Max();
-  //
-  // --- Define the various materials for GEANT --- 
-  fMUON->AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
-  fMUON->AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
-  // Air
-  Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
-  Float_t zAir[4]={6.,7.,8.,18.};
-  Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
-  Float_t dAir = 1.20479E-3;
-  fMUON->AliMixture(15, "AIR$      ", aAir,  zAir, dAir,4, wAir);
-  //    fMUON->AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
-  fMUON->AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
-  fMUON->AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
-  fMUON->AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
-  fMUON->AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
-  fMUON->AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
-  fMUON->AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
-
-  // materials for slat: 
-  //     Sensitive area: gas (already defined) 
-  //     PCB: copper 
-  //     insulating material: vetronite -> replacing by G10 Ch. Finck
-  //     spacer: noryl Ch. Finck
-  //     panel sandwich: carbon, nomex, carbon replacing rohacell by nomex Ch. Finck
-
-  // G10: SiO2(60%) + C8H14O4(40%)
-  Float_t aglass[5] = {12.01, 28.09, 16., 1.01,  16.};
-  Float_t zglass[5] = { 6.,   14.,    8., 1.,    8.};
-  Float_t wglass[5] = { 0.22, 0.28, 0.32, 0.03,  0.15};
-  Float_t dglass    = 1.7;
-
-  // rohacell: C9 H13 N1 O2
-  Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
-  Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
-  Float_t wrohac[4] = { 9.,   13.,    1.,     2.};
-  Float_t drohac    = 0.03;
-
-  // Nomex: C22 H10 N2 O5
-  Float_t aNomex[4] = {12.01,  1.01, 14.010, 16.};
-  Float_t zNomex[4] = { 6.,    1.,    7.,     8.};
-  Float_t wNomex[4] = { 22.,   10.,   2.,     5.};
-  Float_t dNomex    = 0.024; //honey comb
-  Float_t dNomex2   = 1.43;  //bulk material
-
-
-  // Noryl: C8 H8 O polyphenylene oxyde (di-methyl not sure)
-  Float_t aNoryl[3] = {12.01,  1.01, 16.};
-  Float_t zNoryl[3] = { 6.,    1.,    8.};
-  Float_t wNoryl[3] = { 8.,    8.,    1.};
-  Float_t dNoryl    = 1.06;
-
-  fMUON->AliMaterial(31, "COPPER$",   63.54,    29.,   8.96,   1.4, 0.);
-  fMUON->AliMixture( 32, "G10$",      aglass, zglass, dglass, -5, wglass);
-  fMUON->AliMaterial(33, "Carbon$",   12.01,     6.,  2.265,  18.8, 49.9);
-  fMUON->AliMixture( 34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac); 
-  fMUON->AliMixture( 35, "Nomex$",    aNomex, zNomex, dNomex, -4, wNomex); 
-  fMUON->AliMixture( 36, "Noryl$",    aNoryl, zNoryl, dNoryl, -3, wNoryl); 
-  fMUON->AliMixture( 37, "Nomex_bulk$",aNomex, zNomex, dNomex2, -4, wNomex); 
-
-  Float_t  epsil  = .001; // Tracking precision, 
-  Float_t  stemax = -1.;  // Maximum displacement for multiple scat 
-  Float_t  tmaxfd = -20.; // Maximum angle due to field deflection 
-  Float_t  deemax = -.3;  // Maximum fractional energy loss, DLS 
-  Float_t  stmin  = -.8;
-  Float_t  maxDestepAlu = fMUON->GetMaxDestepAlu();
-  Float_t  maxDestepGas = fMUON->GetMaxDestepGas();
-  Float_t  maxStepAlu = fMUON->GetMaxStepAlu();
-  Float_t  maxStepGas = fMUON->GetMaxStepGas();
-
-  //
-  //    Air 
-  fMUON->AliMedium(1, "AIR_CH_US         ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-  //
-  //    Aluminum 
-  fMUON->AliMedium(4, "ALU_CH_US          ", 9, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
-                  maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(5, "ALU_CH_US          ", 10, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
-                  maxDestepAlu, epsil, stmin);
-  //
-  //    Ar-isoC4H10 gas 
-  fMUON->AliMedium(6, "AR_CH_US          ", 20, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas, 
-                  maxDestepGas, epsil, stmin);
-  //
-  //    Ar-Isobuthane-Forane-SF6 gas 
-  fMUON->AliMedium(7, "GAS_CH_TRIGGER    ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
-
-  fMUON->AliMedium(8, "BAKE_CH_TRIGGER   ", 19, 0, iSXFLD, sXMGMX, tmaxfd, maxStepAlu, 
-                  maxDestepAlu, epsil, stmin);
-  //
-  // slat medium
-  fMUON->AliMedium(9, "ARG_CO2   ", 22, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas, 
-                  maxDestepAlu, epsil, stmin);
-  //
-  // tracking media for slats: check the parameters!! 
-  fMUON->AliMedium(11, "PCB_COPPER        ", 31, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(12, "G10               ", 32, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(13, "CARBON            ", 33, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(14, "Rohacell          ", 34, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(15, "Nomex             ", 35, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(16, "Noryl             ", 36, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  fMUON->AliMedium(17, "Nomex bulk        ", 37, 0, iSXFLD, sXMGMX, tmaxfd, 
-                  maxStepAlu, maxDestepAlu, epsil, stmin);
-  //.Materials specific to stations
-  // created via builders
+//
+// Construct materials specific to modules via builders
+//
   
   for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
 
@@ -459,7 +346,6 @@ void AliMUONGeometryBuilder::InitGeometry()
  // Initialize geometry
  // ---
 
-  //
   // Set the chamber (sensitive region) GEANT identifier
   //
   for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
@@ -470,11 +356,14 @@ void AliMUONGeometryBuilder::InitGeometry()
 
     // Set sesitive volumes with each builder
     builder->SetSensitiveVolumes();
-
+    
     // Read sensitive volume map from a file
     builder->ReadSVMap();
     if (!fAlign)  builder->FillTransformations();
-  }
+
+    // Compute global transformations of detection elements
+    FillGlobalTransformations(builder);
+  }  
 }
 
 //______________________________________________________________________________
@@ -512,13 +401,14 @@ void AliMUONGeometryBuilder::WriteSVMaps(Bool_t rebuild)
 }
 
 //_____________________________________________________________________________
-void AliMUONGeometryBuilder::AddBuilder(AliMUONVGeometryBuilder* geomBuilder)
+void  AliMUONGeometryBuilder::SetGlobalTransformation(
+                                       const TGeoCombiTrans& transform)
 {
-// Adds the geometry builder to the list
+// Sets the global transformation
 // ---
 
-  fGeometryBuilders->Add(geomBuilder);
-}
+  fGlobalTransformation = transform;
+}                                     
 
 //_____________________________________________________________________________
 void AliMUONGeometryBuilder::SetAlign(Bool_t align)
@@ -528,15 +418,17 @@ void AliMUONGeometryBuilder::SetAlign(Bool_t align)
 
   fAlign = align; 
 
-  for (Int_t j=0; j<AliMUONConstants::NCh(); j++) {
+  for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
+
+    // Get the builder
+    AliMUONVGeometryBuilder* builder
+      = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
 
-    AliMUONChamberGeometry* geometry = fMUON->Chamber(j).GetGeometry();
+    for (Int_t j=0; j<builder->NofGeometries(); j++) {
 
-    if (!geometry) continue;
-          // Skip chambers with not defined geometry  
-         
-    geometry->SetAlign(align);   
+      AliMUONGeometryModule* geometry = builder->Geometry(j);
+  
+      geometry->SetAlign(align);
+    }            
   }      
 }
-
-
index fea42f2..c27774f 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef ALI_MUON_GEOMETRY_BUILDER_H
-#define ALI_MUON_GEOMETRY_BUILDER_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
@@ -7,39 +5,41 @@
 //
 // Class AliMUONGeometryBuilder
 // ----------------------------
-// MUON manager class for geometry construction,
-// separated form AliMUONv1
+// Manager class for geometry construction via geometry builders.
 //
 // Author: Ivana Hrivnacova, IPN Orsay
 
+#ifndef ALI_MUON_GEOMETRY_BUILDER_H
+#define ALI_MUON_GEOMETRY_BUILDER_H
+
 #include <TObject.h>
+#include <TGeoMatrix.h>
 
-class TGeoCombiTrans;
-class TGeoHMatrix;
 class TObjArray;
 
-class AliMUON;
+class AliModule;
 class AliMUONVGeometryBuilder;
 
 class AliMUONGeometryBuilder : public TObject 
 {
   public:
+    AliMUONGeometryBuilder(AliModule* detector);
     AliMUONGeometryBuilder();
-    AliMUONGeometryBuilder(AliMUON* muon);
     virtual  ~AliMUONGeometryBuilder();
 
+    // methods
+    void  AddBuilder(AliMUONVGeometryBuilder* geomBuilder);
     void  CreateGeometry();
     void  CreateMaterials();
     void  InitGeometry();
     void  WriteTransformations();
     void  WriteSVMaps(Bool_t rebuild = true);
+    void  SetGlobalTransformation(const TGeoCombiTrans& transform);
 
     // Alignement
     virtual Bool_t  GetAlign() const;
     virtual void    SetAlign(Bool_t align);
  
-    void  AddBuilder(AliMUONVGeometryBuilder* geomBuilder);
-   
   protected:
     AliMUONGeometryBuilder(const AliMUONGeometryBuilder& right);
     AliMUONGeometryBuilder&  operator = (const AliMUONGeometryBuilder& right);
@@ -49,16 +49,17 @@ class AliMUONGeometryBuilder : public TObject
     void PlaceVolume(const TString& name, const TString& mName, Int_t copyNo, 
              const TGeoHMatrix& matrix, Int_t npar, Double_t* param,
             const char* only) const;
+    void FillGlobalTransformations(AliMUONVGeometryBuilder* builder);       
 
     // data members
-    AliMUON*        fMUON;                // MUON detector
+    AliModule*      fModule;              // the AliRoot module
     Bool_t          fAlign;               // option to read transformations 
                                           // from a file
-    TGeoCombiTrans* fGlobalTransformation;// global transformation 
+    TGeoCombiTrans  fGlobalTransformation;// global transformation 
                                           // applied to the whole geometry 
     TObjArray*      fGeometryBuilders;    // list of Geometry Builders
 
-  ClassDef(AliMUONGeometryBuilder,3)  // MUON Detector class Version 1
+  ClassDef(AliMUONGeometryBuilder,4)  // Geometry builder
 };
 
 // inline functions
diff --git a/MUON/AliMUONGeometryDEIndexing.cxx b/MUON/AliMUONGeometryDEIndexing.cxx
new file mode 100644 (file)
index 0000000..dd4caa7
--- /dev/null
@@ -0,0 +1,118 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONGeometryDEIndexing
+// -------------------------------
+// The class that provides conversion between the detection element Id
+// and the index in the array.
+// Used in storing DE transformations and segmentations.
+// (See more in the header file.) 
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <Riostream.h>
+#include <TGeoMatrix.h>
+#include <TObjString.h>
+
+#include "AliLog.h"
+
+#include "AliMUONGeometryDEIndexing.h"
+#include "AliMUONConstants.h"
+
+ClassImp(AliMUONGeometryDEIndexing)
+
+const Int_t AliMUONGeometryDEIndexing::fgkHemisphere = 50; 
+
+//______________________________________________________________________________
+AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing(
+                              Int_t moduleId, Int_t nofDetElements)
+ : AliMUONVGeometryDEIndexing(),
+   fModuleId(moduleId),
+   fNofDetElements(nofDetElements)
+{ 
+// Standard constructor
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing()
+ : AliMUONVGeometryDEIndexing(),
+   fModuleId(0),
+   fNofDetElements(0)
+{ 
+// Ddefault constructor
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDEIndexing::~AliMUONGeometryDEIndexing() {
+//
+}
+
+//
+// private methods
+//
+
+//______________________________________________________________________________
+Int_t AliMUONGeometryDEIndexing::GetFirstDetElemId() const
+{
+// Get first detection element Id for chamber specified by moduleId
+// ---
+
+  return (fModuleId+1)*100;
+}  
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+Int_t AliMUONGeometryDEIndexing::GetDetElementIndex(Int_t detElemId) const
+{
+// Returns the index of detector element specified by detElemId
+// ---
+
+  if ( fNofDetElements == 0 ) {
+    AliFatal("The number of detection elements has not been set.");
+    return 0;
+  }  
+
+  Int_t index = detElemId - GetFirstDetElemId();
+  if (index >= fgkHemisphere) 
+    index += - fgkHemisphere + fNofDetElements/2;
+
+  return index;
+}  
+
+//______________________________________________________________________________
+Int_t AliMUONGeometryDEIndexing::GetDetElementId(Int_t detElemIndex) const
+{
+// Returns the ID of detector element specified by index
+// ---
+
+  if ( fNofDetElements == 0 ) {
+    AliFatal("The number of detection elements has not been set.");
+    return 0;
+  }  
+
+  Int_t detElemId = detElemIndex;
+  
+  if ( detElemIndex >=  fNofDetElements/2 ) 
+    detElemId += fgkHemisphere - fNofDetElements/2; 
+
+  detElemId += GetFirstDetElemId();
+
+  return detElemId;
+}  
diff --git a/MUON/AliMUONGeometryDEIndexing.h b/MUON/AliMUONGeometryDEIndexing.h
new file mode 100644 (file)
index 0000000..80b227b
--- /dev/null
@@ -0,0 +1,62 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONGeometryDEIndexing
+// -------------------------------
+// The class that provides conversion between the detection element Id
+// and the index in the array.
+// Used in storing DE transformations and segmentations.
+// The detection elements numbering:
+//    DetElemId = chamberId*100 + [50] + detElemNum
+//                where  chamberId  = 1, 2, ..., 14
+//                       detElemNum = 0, 1, ...
+// The number 50 is added to distinguish detector elements 
+// in the left and the right hemispheres.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_GEOMETRY_DE_INDEXING_H
+#define ALI_MUON_GEOMETRY_DE_INDEXING_H
+
+#include "AliMUONVGeometryDEIndexing.h"
+
+class AliMUONGeometryDEIndexing : public AliMUONVGeometryDEIndexing
+{
+  public:
+    AliMUONGeometryDEIndexing(Int_t moduleId, Int_t nofDetElements);
+    AliMUONGeometryDEIndexing();
+    virtual ~AliMUONGeometryDEIndexing();
+    
+    // methods for conversion between det element Id and index
+    virtual Int_t GetDetElementIndex(Int_t detElemId) const;
+    virtual Int_t GetDetElementId(Int_t detElemIndex) const;
+
+    // set method
+    virtual Int_t GetNofDetElements() const ;
+    virtual void  SetNofDetElements(Int_t  nofDetElements);  
+
+  private:
+    Int_t GetFirstDetElemId() const;
+
+    // static data members
+    static const Int_t  fgkHemisphere;   // The constant to distinguish 
+                                         // the left/right hemispere  
+                                        
+    // data members
+    Int_t  fModuleId;       // module Id                                                  
+    Int_t  fNofDetElements; // number of detection elements in the module                                                 
+
+  ClassDef(AliMUONGeometryDEIndexing,1) // MUON transformations store
+};
+
+// inline functions
+
+inline Int_t AliMUONGeometryDEIndexing::GetNofDetElements() const
+{ return fNofDetElements; }
+
+inline void AliMUONGeometryDEIndexing::SetNofDetElements(Int_t nofDetElements)
+{ fNofDetElements =  nofDetElements; }
+
+#endif //ALI_MUON_GEOMETRY_DE_INDEXING_H
diff --git a/MUON/AliMUONGeometryDetElement.cxx b/MUON/AliMUONGeometryDetElement.cxx
new file mode 100644 (file)
index 0000000..c72e2cf
--- /dev/null
@@ -0,0 +1,268 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONGeometryDetElement
+// --------------------------------------
+// The class defines the detection element.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <TGeoMatrix.h>
+#include <Riostream.h>
+
+#include "AliLog.h"
+
+#include "AliMUONGeometryDetElement.h"
+
+ClassImp(AliMUONGeometryDetElement)
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement::AliMUONGeometryDetElement(
+                                        Int_t detElemId,
+                                        const TString& alignedVolume, 
+                                       const TGeoCombiTrans& relTransform)
+ : TObject(),
+   fAlignedVolume(alignedVolume),
+   fLocalTransformation(0),
+   fGlobalTransformation(0)
+{ 
+// Standard constructor
+
+  SetUniqueID(detElemId);
+  fLocalTransformation = new TGeoCombiTrans(relTransform);
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement::AliMUONGeometryDetElement()
+ : TObject(),
+   fAlignedVolume(),
+   fLocalTransformation(0),
+   fGlobalTransformation(0)
+{
+// Default constructor
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement::AliMUONGeometryDetElement(
+                                   const AliMUONGeometryDetElement& rhs)
+  : TObject(rhs)
+{
+  AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement::~AliMUONGeometryDetElement() {
+//
+  delete fLocalTransformation;
+  delete fGlobalTransformation;
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement& 
+AliMUONGeometryDetElement::operator = (const AliMUONGeometryDetElement& rhs) 
+{
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
+//
+// private methods
+//
+
+//______________________________________________________________________________
+void  AliMUONGeometryDetElement::PrintTransform(
+                                            const TGeoCombiTrans* transform) const
+{
+// Prints the detection element transformation
+// ---
+
+  cout << "DetElemId: " << GetUniqueID();
+  cout << "  name: " << fAlignedVolume << endl;
+
+  const double* translation = transform->GetTranslation();
+  cout << "   translation: "
+#if defined (__DECCXX)
+       << translation[0] << ", " 
+       << translation[1] << ", "
+       << translation[2] << endl;
+#else
+       << std::fixed
+       << std::setw(7) << std::setprecision(4) << translation[0] << ", " 
+       << std::setw(7) << std::setprecision(4) << translation[1] << ", "
+       << std::setw(7) << std::setprecision(4) << translation[2] << endl;
+#endif
+        
+  const double* rotation = transform->GetRotationMatrix();
+  cout << "   rotation matrix:  "
+#if defined (__DECCXX)
+       << rotation[0] << ", " << rotation[1] << ", " << rotation[2] << endl
+       << "                     "          
+       << rotation[3] << ", " << rotation[4] << ", " << rotation[5] << endl        
+       << "                     "          
+       << rotation[6] << ", " << rotation[7] << ", " << rotation[8] << endl;
+#else
+       << std::fixed
+       << std::setw(7) << std::setprecision(4) 
+       << rotation[0] << ", " << rotation[1] << ", " << rotation[2] << endl
+       << "                     "          
+       << rotation[3] << ", " << rotation[4] << ", " << rotation[5] << endl        
+       << "                     "          
+       << rotation[6] << ", " << rotation[7] << ", " << rotation[8] << endl;
+#endif
+}     
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void  AliMUONGeometryDetElement::Global2Local(
+                                  Float_t xg, Float_t yg, Float_t zg, 
+                                  Float_t& xl, Float_t& yl, Float_t& zl) const
+{
+// Transforms point from the global reference frame (ALIC)
+// to the local reference frame of the detection element specified
+// by detElemId.
+// ---
+
+  Double_t dxg = xg;
+  Double_t dyg = yg;
+  Double_t dzg = zg;
+
+  Double_t dxl, dyl, dzl;
+  Global2Local(dxg, dyg, dzg, dxl, dyl, dzl);  
+  
+  xl = dxl;
+  yl = dyl;
+  zl = dzl;
+}
+                                 
+//______________________________________________________________________________
+void  AliMUONGeometryDetElement::Global2Local(
+                                  Double_t xg, Double_t yg, Double_t zg, 
+                                  Double_t& xl, Double_t& yl, Double_t& zl) const
+{
+// Transforms point from the global reference frame (ALIC)
+// to the local reference frame of the detection element specified
+// by detElemId.
+// ---
+
+   // Check transformation
+   if (!fGlobalTransformation) {
+     AliError(Form("Global transformation for detection element %d not defined.",
+                    GetUniqueID()));
+     return;
+   }  
+   
+   // Transform point 
+   Double_t pg[3] = { xg, yg, zg };
+   Double_t pl[3] = { 0., 0., 0. };
+   fGlobalTransformation->MasterToLocal(pg, pl);
+   
+   // Return transformed point
+   xl = pl[0];
+   yl = pl[1];     
+   zl = pl[2];  
+}
+                                 
+//______________________________________________________________________________
+void  AliMUONGeometryDetElement::Local2Global(
+                 Float_t xl, Float_t yl, Float_t zl, 
+                 Float_t& xg, Float_t& yg, Float_t& zg) const
+{
+// Transforms point from the local reference frame of the detection element 
+// specified by detElemId to the global reference frame (ALIC).
+// ---
+
+  Double_t dxl = xl;
+  Double_t dyl = yl;
+  Double_t dzl = zl;
+
+  Double_t dxg, dyg, dzg;
+  Local2Global(dxl, dyl, dzl, dxg, dyg, dzg);  
+  
+  xg = dxg;
+  yg = dyg;
+  zg = dzg;
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometryDetElement::Local2Global(
+                 Double_t xl, Double_t yl, Double_t zl, 
+                 Double_t& xg, Double_t& yg, Double_t& zg) const
+{
+// Transforms point from the local reference frame of the detection element 
+// specified by detElemId to the global reference frame (ALIC).
+// ---
+
+   // Check transformation
+   if (!fGlobalTransformation) {
+     AliError(Form("Global transformation for detection element %d not defined.",
+                    GetUniqueID()));
+     return;
+   }  
+   
+   // Transform point 
+   Double_t pl[3] = { xl, yl, zl };
+   Double_t pg[3] = { 0., 0., 0. };
+   fGlobalTransformation->LocalToMaster(pl, pg);
+   
+   // Return transformed point
+   xg = pg[0];
+   yg = pg[1];     
+   zg = pg[2];  
+}
+
+//______________________________________________________________________________
+void AliMUONGeometryDetElement::SetGlobalTransformation(
+                                                const TGeoCombiTrans& transform)
+{ 
+// Sets global transformation;
+// gives warning if the global transformation is already defined.
+// ---
+  if (fGlobalTransformation) {
+    delete fGlobalTransformation;
+    AliWarning("Global transformation already defined was deleted.");
+  }  
+
+  fGlobalTransformation = new TGeoCombiTrans(transform);
+}  
+                                             
+//______________________________________________________________________________
+void AliMUONGeometryDetElement::PrintLocalTransform() const
+{
+// Prints detection element relative transformation
+// (the transformation wrt module frame)
+//
+
+  PrintTransform(fLocalTransformation);
+}  
+
+//______________________________________________________________________________
+void AliMUONGeometryDetElement::PrintGlobalTransform() const
+{
+// Prints detection element global transformation
+// (the transformation wrt global frame)
+//
+
+  PrintTransform(fLocalTransformation);
+}  
diff --git a/MUON/AliMUONGeometryDetElement.h b/MUON/AliMUONGeometryDetElement.h
new file mode 100644 (file)
index 0000000..0272f9d
--- /dev/null
@@ -0,0 +1,89 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONGeometryDetElement
+// --------------------------------
+// The class defines the detection element.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_GEOMETRY_DET_ELEMENT_H
+#define ALI_MUON_GEOMETRY_DET_ELEMENT_H
+
+#include <TObject.h>
+
+class TGeoCombiTrans;
+
+class AliMUONGeometryDetElement : public TObject
+{
+  public:
+    AliMUONGeometryDetElement(Int_t detElemId,
+                              const TString& alignedVolume, 
+                             const TGeoCombiTrans& relTransform);
+    AliMUONGeometryDetElement();
+    virtual ~AliMUONGeometryDetElement();
+
+    // methods
+    void Global2Local(
+                 Float_t xg, Float_t yg, Float_t zg, 
+                 Float_t& xl, Float_t& yl, Float_t& zl) const;
+    void Global2Local(
+                 Double_t xg, Double_t yg, Double_t zg, 
+                 Double_t& xl, Double_t& yl, Double_t& zl) const;
+
+    void Local2Global(
+                 Float_t xl, Float_t yl, Float_t zl, 
+                 Float_t& xg, Float_t& yg, Float_t& zg) const;
+    void Local2Global(
+                 Double_t xl, Double_t yl, Double_t zl, 
+                 Double_t& xg, Double_t& yg, Double_t& zg) const;
+    void PrintLocalTransform() const;
+    void PrintGlobalTransform() const;
+
+    // set methods
+    void SetGlobalTransformation(const TGeoCombiTrans& transform);
+    
+    // get methods
+    Int_t  GetId() const;
+    const TString&        GetAlignedVolume() const;
+    const TGeoCombiTrans* GetLocalTransformation() const;
+    const TGeoCombiTrans* GetGlobalTransformation() const;
+
+  protected:
+    AliMUONGeometryDetElement(const AliMUONGeometryDetElement& rhs);
+
+    // operators  
+    AliMUONGeometryDetElement& operator = (const AliMUONGeometryDetElement& rhs);
+  
+  private:
+    // methods
+    void PrintTransform(const TGeoCombiTrans* transform) const;
+  
+    // data members
+    TString          fAlignedVolume; // the name of aligned volume or envelope
+                                      // representing this detection element
+    TGeoCombiTrans*  fLocalTransformation;  // the transformation wrt module
+    TGeoCombiTrans*  fGlobalTransformation; // the transformation wrt world
+
+  ClassDef(AliMUONGeometryDetElement,1) // MUON transformations store
+};
+
+// inline functions
+
+inline Int_t AliMUONGeometryDetElement::GetId() const
+{ return GetUniqueID(); }
+
+inline const TString& AliMUONGeometryDetElement::GetAlignedVolume() const
+{ return fAlignedVolume; }
+
+inline const TGeoCombiTrans* 
+AliMUONGeometryDetElement::GetLocalTransformation() const
+{ return fLocalTransformation; }
+
+inline const TGeoCombiTrans* 
+AliMUONGeometryDetElement::GetGlobalTransformation() const
+{ return fGlobalTransformation; }
+
+#endif //ALI_MUON_GEOMETRY_DET_ELEMENT_H
index 628bdda..1f7daac 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
 // $Id$
 //
 // Class AliMUONGeometryEnvelopeStore
@@ -14,8 +29,9 @@
 #include <Riostream.h>
 
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliMUONGeometryTransformStore.h"
 #include "AliMUONGeometryEnvelope.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryStore.h"
 #include "AliMUONConstants.h"
 #include "AliLog.h"
 
@@ -23,10 +39,10 @@ ClassImp(AliMUONGeometryEnvelopeStore)
 
 //______________________________________________________________________________
 AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore(
-                                 AliMUONGeometryTransformStore* transforms)
+                                 AliMUONGeometryStore* detElements)
  : TObject(),
-   fDETransforms(transforms),
    fEnvelopes(0),
+   fDetElements(detElements),
    fDebug(false),
    fAlign(false)
 {
@@ -39,8 +55,8 @@ AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore(
 //______________________________________________________________________________
 AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore()
  : TObject(),
-   fDETransforms(0),
    fEnvelopes(0),
+   fDetElements(0),
    fDebug(false),
    fAlign(false)
 {
@@ -113,13 +129,14 @@ Bool_t AliMUONGeometryEnvelopeStore::AlignEnvelope(
   Int_t detElemId = envelope->GetUniqueID();
   if (detElemId == 0) return false;
   
-  const TGeoCombiTrans* kTransform = fDETransforms->Get(detElemId);
-  if (!kTransform) {
+  AliMUONGeometryDetElement* detElement 
+    = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId);
+  if (!detElement) {
     AliWarning("Transformation not found.");
     return false;
   };
 
-  envelope->SetTransform(*kTransform);
+  envelope->SetTransform(*(detElement->GetLocalTransformation()));
   return true;
 }  
 
@@ -598,3 +615,16 @@ void  AliMUONGeometryEnvelopeStore::AddEnvelopeConstituentParam(const TString& n
   envelope->AddConstituentParam(name, copyNo, transform, npar, param);
 }
 
+//______________________________________________________________________________
+Int_t AliMUONGeometryEnvelopeStore::GetNofDetElements() const
+{
+// Returns the number od envelopes with detElemId>0.
+// ---                                            
+
+  Int_t nofDetElems = 0;
+  
+  for(Int_t i=0; i<fEnvelopes->GetEntriesFast(); i++) 
+    if ( fEnvelopes->At(i)->GetUniqueID() > 0 ) nofDetElems++;
+  
+  return nofDetElems;
+}
index 431ee53..a605745 100644 (file)
@@ -1,7 +1,10 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
 // $Id$
 //
 // Class AliMUONGeometryEnvelopeStore
-// -----------------------------
+// ----------------------------------
 // Class for definititon of the temporary volume envelopes
 // used in geometry construction
 //
@@ -21,18 +24,19 @@ class TArrayI;
 
 class AliMUONChamber;
 class AliMUONGeometryEnvelope;
-class AliMUONGeometryTransformStore;
+class AliMUONGeometryStore;
 
 class AliMUONGeometryEnvelopeStore : public TObject
 {
   public:
-    AliMUONGeometryEnvelopeStore(AliMUONGeometryTransformStore* transforms);
+    AliMUONGeometryEnvelopeStore(AliMUONGeometryStore* detElements);
     AliMUONGeometryEnvelopeStore();
     AliMUONGeometryEnvelopeStore(const AliMUONGeometryEnvelopeStore& rhs);
     virtual ~AliMUONGeometryEnvelopeStore();
 
     // operators  
-    AliMUONGeometryEnvelopeStore& operator = (const AliMUONGeometryEnvelopeStore& rhs);
+    AliMUONGeometryEnvelopeStore& 
+    operator = (const AliMUONGeometryEnvelopeStore& rhs);
   
     // methods
         
@@ -114,6 +118,7 @@ class AliMUONGeometryEnvelopeStore : public TObject
  
     // get methods
     const TObjArray*  GetEnvelopes() const;
+    Int_t             GetNofDetElements() const;
 
   private:
     // methods
@@ -121,13 +126,14 @@ class AliMUONGeometryEnvelopeStore : public TObject
     Bool_t AlignEnvelope(AliMUONGeometryEnvelope* envelope) const;
  
     // data members
-    AliMUONGeometryTransformStore* fDETransforms; // det elements transformations
     TObjArray*  fEnvelopes; // the envelopes names and transformations
                            // wrt to the chamber position in mother volume                                 
+    AliMUONGeometryStore*  fDetElements; // detection elements
+                            // used for alignement of enevelopes
     Bool_t      fDebug;     // Switch for debugging  
     Bool_t      fAlign;     // option to read transformations from a file
  
-  ClassDef(AliMUONGeometryEnvelopeStore,1) // MUON envelope store
+  ClassDef(AliMUONGeometryEnvelopeStore,2) // Geometry envelope store
 };
 
 // inline functions
diff --git a/MUON/AliMUONGeometryModule.cxx b/MUON/AliMUONGeometryModule.cxx
new file mode 100644 (file)
index 0000000..b5c815b
--- /dev/null
@@ -0,0 +1,348 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONGeometryModule
+// -----------------------------
+// Class for definition of the detector module parameters
+// (the transformations of detection elements, mapping between
+//  sensitive volumes and detection elements).
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
+#include <TObjArray.h>
+#include <TArrayI.h>
+#include <Riostream.h>
+
+#include "AliLog.h"    
+
+#include "AliMUONGeometryModule.h"
+#include "AliMUONGeometryEnvelope.h"
+#include "AliMUONGeometryEnvelopeStore.h"
+#include "AliMUONGeometryDetElement.h" 
+#include "AliMUONGeometryStore.h"      
+#include "AliMUONGeometrySVMap.h"      
+#include "AliMUONGeometryDEIndexing.h"
+
+ClassImp(AliMUONGeometryModule)
+
+//______________________________________________________________________________
+AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
+ : TObject(),
+   fModuleId(moduleId),
+   fMotherVolume("ALIC"),
+   fNofSVs(0),
+   fSVVolumeIds(0),
+   fTransformation(0),
+   fEnvelopes(0),
+   fDEIndexing(0),
+   fDetElements(0),
+   fSVMap(0)
+{
+// Standard constructor
+
+  // Chamber transformation
+  fTransformation = new TGeoCombiTrans("");
+
+  // Arrays of volumes Ids
+  fSVVolumeIds = new TArrayI(20);
+
+  // Sensitive volumes map
+  fSVMap = new AliMUONGeometrySVMap(100);
+
+  // Get indexing
+  fDEIndexing = new AliMUONGeometryDEIndexing(fModuleId, 0);
+
+  // Det elements transformation stores
+  fDetElements = new AliMUONGeometryStore(fDEIndexing);
+    
+  // Envelope store
+  fEnvelopes = new AliMUONGeometryEnvelopeStore(fDetElements);  
+}
+
+
+//______________________________________________________________________________
+AliMUONGeometryModule::AliMUONGeometryModule()
+ : TObject(),
+   fModuleId(0),
+   fMotherVolume(),
+   fNofSVs(0),
+   fSVVolumeIds(0),
+   fTransformation(0),
+   fEnvelopes(0),
+   fDEIndexing(0),
+   fDetElements(0),
+   fSVMap(0)
+{
+// Default constructor
+}
+
+
+//______________________________________________________________________________
+AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
+  : TObject(rhs)
+{
+  AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONGeometryModule::~AliMUONGeometryModule() {
+//
+
+  delete fTransformation;
+  delete fSVVolumeIds;
+  delete fEnvelopes;
+  delete fDEIndexing;
+  delete fDetElements;
+  delete fSVMap;
+}
+
+//______________________________________________________________________________
+AliMUONGeometryModule& 
+AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs) 
+{
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
+//
+// private methods
+//
+
+//______________________________________________________________________________
+Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
+{
+// Returns the index of the volume specified by volId
+// if it is present in the list of sensitive volumes 
+// (or -1 if not present).
+  for (Int_t i=0; i<fNofSVs; i++) {
+      if (fSVVolumeIds->At(i) == svVolId) return i;
+  }
+  return -1;
+}
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::Global2Local(Int_t detElemId,
+                                  Float_t xg, Float_t yg, Float_t zg, 
+                                  Float_t& xl, Float_t& yl, Float_t& zl) const
+{
+// Transforms point from the global reference frame (ALIC)
+// to the local reference frame of the detection element specified
+// by detElemId.
+// ---
+
+  // Get detection element
+  AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+  if (!detElement) return;
+   
+  // Transform point
+  detElement->Global2Local(xg, yg, zg, xl, yl, zl);
+}
+                                 
+//______________________________________________________________________________
+void  AliMUONGeometryModule::Global2Local(Int_t detElemId,
+                                  Double_t xg, Double_t yg, Double_t zg, 
+                                  Double_t& xl, Double_t& yl, Double_t& zl) const
+{
+// Transforms point from the global reference frame (ALIC)
+// to the local reference frame of the detection element specified
+// by detElemId.
+// ---
+
+   // Get detection element
+   AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+   if (!detElement) return;
+   
+   // Transform point
+   detElement->Global2Local(xg, yg, zg, xl, yl, zl);
+}
+                                 
+//______________________________________________________________________________
+void  AliMUONGeometryModule::Local2Global(Int_t detElemId,
+                 Float_t xl, Float_t yl, Float_t zl, 
+                 Float_t& xg, Float_t& yg, Float_t& zg) const
+{
+// Transforms point from the local reference frame of the detection element 
+// specified by detElemId to the global reference frame (ALIC).
+// ---
+
+  // Get detection element
+  AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+  if (!detElement) return;
+   
+   // Transform point
+  detElement->Local2Global(xl, yl, zl, xg, yg, zg);  
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::Local2Global(Int_t detElemId,
+                 Double_t xl, Double_t yl, Double_t zl, 
+                 Double_t& xg, Double_t& yg, Double_t& zg) const
+{
+// Transforms point from the local reference frame of the detection element 
+// specified by detElemId to the global reference frame (ALIC).
+// ---
+
+   // Get detection element
+   AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+   if (!detElement) return;
+   
+   // Transform point
+   detElement->Local2Global(xl, yl, zl, xg, yg, zg); 
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::SetTranslation(const TGeoTranslation& translation)
+{
+// Sets the module position wrt world.
+// ---
+
+  fTransformation
+    ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
+}  
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::SetRotation(const TGeoRotation& rotation)
+{
+// Sets the module rotation wrt ALIC.
+// ---
+
+  TGeoRotation* rot = new TGeoRotation();
+  rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
+
+  fTransformation->SetRotation(rot);
+}  
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
+{
+// Adds the volume specified by volId to the list of sensitive
+// volumes
+// ---
+  
+  // Resize TArrayI if needed
+  if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
+
+  fSVVolumeIds->AddAt(svVolId, fNofSVs++);
+}      
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
+{
+// Adds the volume specified by volName to the list of sensitive
+// volumes
+// ---
+
+  SetSensitiveVolume(gMC->VolId(volName));
+}      
+
+//______________________________________________________________________________
+void  AliMUONGeometryModule::SetAlign(Bool_t align)
+{
+// Sets alignement option to enevelope store.
+// ---
+  
+  fEnvelopes->SetAlign(align);
+}  
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement* 
+AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
+{
+// Finds TGeoCombiTrans for the detector element Id specified by aligned volume 
+// ---
+
+  Int_t detElemId = fSVMap->GetDetElemId(sensVolume);
+
+  if (!detElemId) return 0; 
+        // The specified sensitive volume is not in the map   
+  
+  return (AliMUONGeometryDetElement*)fDetElements->Get(detElemId);
+}  
+
+//______________________________________________________________________________
+Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
+{
+// Checks if the volume specified by volId is present in the list
+// of sensitive volumes.
+// ---
+
+  for (Int_t i=0; i<fNofSVs; i++) {
+      if (fSVVolumeIds->At(i) == volId) return kTRUE;
+  }
+  return kFALSE;
+}
+
+//______________________________________________________________________________
+Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
+{
+// Checks if the volume specified by volName  is present in the list
+// of sensitive volumes.
+// ---
+
+  return IsSensitiveVolume(gMC->VolId(volName));
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement*
+AliMUONGeometryModule::GetDetElement(Int_t detElemId) const
+{
+// Returns thethe detection element specified by detElemId.
+// Gives error if detection element is not defined.
+// ---
+
+   // Get detection element
+   AliMUONGeometryDetElement* detElement
+     = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId);
+
+   if (!detElement) {
+     AliError(Form("Detection element %d not found", detElemId));
+     return 0;
+   }  
+
+   return detElement;
+}
+
+/*                               
+//______________________________________________________________________________
+Int_t  AliMUONGeometryModule::GetNofDetElements() const
+{
+// Returns the number of detection elements
+// ---
+
+  return fDEIndexing->GetNofDetElements();
+}   
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometryModule::GetDetElemId(Int_t i) const
+{
+// Returns the i-th detection element id
+// ---
+
+  return fDEIndexing->GetDetElementId(i);
+}   
+*/
diff --git a/MUON/AliMUONGeometryModule.h b/MUON/AliMUONGeometryModule.h
new file mode 100644 (file)
index 0000000..7aee5a0
--- /dev/null
@@ -0,0 +1,133 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+// Revision of includes 07/05/2004
+
+//
+// Class AliMUONGeometryModule
+// -----------------------------
+// Class for definition of the detector module parameters
+// (the transformations of detection elements, mapping between
+//  sensitive volumes and detection elements).
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_MODULE_GEOMETRY_H
+#define ALI_MUON_MODULE_GEOMETRY_H
+
+#include <TObject.h>
+#include <TString.h>
+
+class TGeoTranslation;
+class TGeoRotation;
+class TGeoCombiTrans;
+class TObjArray;
+class TArrayI;
+
+class AliMUONGeometryEnvelope;
+class AliMUONGeometryEnvelopeStore;
+class AliMUONGeometryDetElement;
+class AliMUONGeometryStore;
+class AliMUONGeometrySVMap;
+class AliMUONVGeometryDEIndexing;
+
+class AliMUONGeometryModule : public TObject
+{
+  public:
+    AliMUONGeometryModule(Int_t moduleId);
+    AliMUONGeometryModule();
+    virtual ~AliMUONGeometryModule();
+
+    // methods
+    void Global2Local(Int_t detElemId,
+                 Float_t xg, Float_t yg, Float_t zg, 
+                 Float_t& xl, Float_t& yl, Float_t& zl) const;
+    void Global2Local(Int_t detElemId,
+                 Double_t xg, Double_t yg, Double_t zg, 
+                 Double_t& xl, Double_t& yl, Double_t& zl) const;
+
+    void Local2Global(Int_t detElemId,
+                 Float_t xl, Float_t yl, Float_t zl, 
+                 Float_t& xg, Float_t& yg, Float_t& zg) const;
+    void Local2Global(Int_t detElemId,
+                 Double_t xl, Double_t yl, Double_t zl, 
+                 Double_t& xg, Double_t& yg, Double_t& zg) const;
+
+    // set methods
+    void  SetMotherVolume(const TString& motherVolumeName);
+    void  SetTranslation(const TGeoTranslation& translation);
+    void  SetRotation(const TGeoRotation& rotation);
+    
+    void  SetSensitiveVolume(Int_t volId);
+    void  SetSensitiveVolume(const TString& name);
+    void  SetAlign(Bool_t align);
+    // get methods
+    Int_t                  GetModuleId() const;
+    TString                GetMotherVolume() const;
+    const TGeoCombiTrans*  GetTransformation() const;    
+    AliMUONGeometryDetElement* FindBySensitiveVolume(
+                                         const TString& volumePath) const;
+    AliMUONVGeometryDEIndexing*    GetDEIndexing() const;
+    AliMUONGeometryEnvelopeStore*  GetEnvelopeStore() const;
+    AliMUONGeometryStore*          GetDetElementStore() const;
+    AliMUONGeometryDetElement*     GetDetElement(Int_t detElemId) const;    
+    AliMUONGeometrySVMap*          GetSVMap() const;
+    Bool_t IsSensitiveVolume(Int_t volId) const; 
+    Bool_t IsSensitiveVolume(const TString& volName) const; 
+
+  protected:
+    AliMUONGeometryModule(const AliMUONGeometryModule& rhs);
+    // operators  
+    AliMUONGeometryModule& operator = (const AliMUONGeometryModule& rhs);
+
+  private:
+    // methods
+    Int_t  GetSVIndex(Int_t svVolId) const; 
+  
+    // data members
+    Int_t            fModuleId;      // the module Id
+    TString          fMotherVolume;  // mother volume name
+    Int_t            fNofSVs;        // number of sensitive volumes   
+    TArrayI*         fSVVolumeIds;   // densitive volumes IDs  
+    TGeoCombiTrans*  fTransformation;// the module transformation wrt to mother
+                                     // volume
+    AliMUONGeometryEnvelopeStore* fEnvelopes;  // envelopes                                 
+    AliMUONVGeometryDEIndexing*   fDEIndexing; // DE indexing
+    AliMUONGeometryStore*         fDetElements;// detection elements
+    AliMUONGeometrySVMap*         fSVMap;      // sensitive volumes map
+  ClassDef(AliMUONGeometryModule,2) // MUON geometry module class
+};
+
+// inline functions
+
+inline void  
+AliMUONGeometryModule::SetMotherVolume(const TString& motherVolumeName)
+{ fMotherVolume = motherVolumeName; }
+
+inline Int_t  AliMUONGeometryModule::GetModuleId() const
+{ return fModuleId; }
+
+inline TString  AliMUONGeometryModule::GetMotherVolume() const
+{ return fMotherVolume; }
+
+inline const TGeoCombiTrans* AliMUONGeometryModule::GetTransformation() const 
+{ return fTransformation; }
+
+inline  AliMUONGeometryEnvelopeStore* 
+AliMUONGeometryModule::GetEnvelopeStore() const
+{ return fEnvelopes; }
+
+inline  AliMUONVGeometryDEIndexing* 
+AliMUONGeometryModule::GetDEIndexing() const 
+{ return fDEIndexing; }
+
+inline  AliMUONGeometryStore* AliMUONGeometryModule::GetDetElementStore() const
+{ return fDetElements; }
+
+inline AliMUONGeometrySVMap* AliMUONGeometryModule::GetSVMap() const
+{ return fSVMap; }
+
+#endif //ALI_MUON_MODULE_GEOMETRY_H
index eab7e7f..6761d53 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
 // $Id$
 //
 // Class AliMUONGeometrySVMap
index a4bef5f..90c3e28 100644 (file)
@@ -1,7 +1,10 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
 // $Id$
 //
 // Class AliMUONGeometrySVMap
-// -----------------------------------
+// --------------------------
 // As the detection element frame is different from the
 // frame of the sensitive volume(s) defined in Geant,
 // the sensitive volumes have to be mapped to the detection 
diff --git a/MUON/AliMUONGeometrySegmentation.cxx b/MUON/AliMUONGeometrySegmentation.cxx
new file mode 100644 (file)
index 0000000..83a4bd7
--- /dev/null
@@ -0,0 +1,604 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+//
+// Class AliMUONGeometrySegmentation
+// -------------------------------
+// New class for the module segmentation 
+// composed of the segmentations of detection elements.
+// Applies transformations defined in geometry.
+//
+// Author:Ivana Hrivnacova, IPN Orsay
+
+#include "AliSegmentation.h"
+#include "AliLog.h"
+
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONGeometryModule.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryStore.h"
+
+
+ClassImp(AliMUONGeometrySegmentation)
+
+
+//______________________________________________________________________________
+AliMUONGeometrySegmentation::AliMUONGeometrySegmentation(
+                                  AliMUONGeometryModule* geometry) 
+: TObject(),
+  fCurrentDetElemId(0),
+  fCurrentDetElement(0),
+  fCurrentSegmentation(0),
+  fGeometryModule(geometry),
+  fDESegmentations(0)
+  
+{
+// Normal constructor
+
+  fDESegmentations 
+    = new AliMUONGeometryStore(geometry->GetDEIndexing(), false);
+}
+
+//______________________________________________________________________________
+AliMUONGeometrySegmentation::AliMUONGeometrySegmentation() 
+: TObject(),
+  fCurrentDetElemId(0),
+  fCurrentDetElement(0),
+  fCurrentSegmentation(0),
+  fGeometryModule(0),
+  fDESegmentations(0)
+{
+// Default Constructor
+}
+
+//______________________________________________________________________________
+AliMUONGeometrySegmentation::AliMUONGeometrySegmentation(
+                                  const AliMUONGeometrySegmentation& rhs) 
+  : TObject(rhs)
+{
+// Copy constructor
+  AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONGeometrySegmentation::~AliMUONGeometrySegmentation() {
+// Destructor
+
+  delete fDESegmentations;
+} 
+
+//
+// operators
+//
+
+//______________________________________________________________________________
+AliMUONGeometrySegmentation& 
+AliMUONGeometrySegmentation::operator=(const AliMUONGeometrySegmentation& rhs)
+{
+// Copy operator 
+
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
+//
+// private methods
+//
+
+//______________________________________________________________________________
+Bool_t AliMUONGeometrySegmentation::Notify(Int_t detElemId) const
+{
+// Updates current detection element and segmentation,
+// and checks if they exist.
+// Returns true if success.
+// ---
+
+  if (detElemId != fCurrentDetElemId) {
+
+    // Find detection element and its segmentation
+    AliMUONGeometryDetElement* detElement
+      = fGeometryModule->GetDetElement(detElemId);
+    if (!detElement) {
+      AliError(Form("Detection element %d not defined", detElemId));
+      return false;
+    }     
+
+    AliSegmentation* segmentation 
+      = (AliSegmentation*) fDESegmentations->Get(detElemId);
+    if (!segmentation) {
+      AliError(Form("Segmentation for detection element %d not defined",
+                     detElemId));
+      return false;                 
+    }
+  
+    fCurrentDetElemId = detElemId;
+    fCurrentDetElement = detElement;
+    fCurrentSegmentation = segmentation;
+  }  
+  return true;
+}        
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::Add(Int_t detElemId, 
+                                      AliSegmentation* segmentation)
+{
+// Add detection element segmentation
+// ---
+
+  fDESegmentations->Add(detElemId, segmentation); 
+}  
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::SetPadSize(Float_t p1, Float_t p2)
+{
+// Set pad size Dx*Dy to all detection element segmentations 
+// ---
+
+  for (Int_t i=0; i<fDESegmentations->GetNofEntries(); i++) {
+     AliSegmentation* segmentation
+       = (AliSegmentation*)fDESegmentations->GetEntry(i);
+     segmentation->SetPadSize(p1, p2);
+  }   
+}
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::SetDAnod(Float_t d)
+{
+// Set anod pitch to all detection element segmentations
+// ---
+
+  for (Int_t i=0; i<fDESegmentations->GetNofEntries(); i++) {
+     AliSegmentation* segmentation
+       = (AliSegmentation*)fDESegmentations->GetEntry(i);
+     segmentation->SetDAnod(d);
+  }   
+}
+
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::GetAnod(Int_t detElemId, Float_t xhit) const
+{
+// Anod wire coordinate closest to xhit
+// Returns for a hit position xhit the position of the nearest anode wire
+// !!! xhit is understand a a distance, not as a position in the space
+// CHECK
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  return fCurrentSegmentation->GetAnod(xhit);
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::GetPadI(Int_t detElemId,
+                                        Float_t xg, Float_t yg, Float_t zg, 
+                                        Int_t& ix, Int_t& iy)
+{                                      
+//  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
+
+  fCurrentSegmentation->GetPadI(xl, yl, zl, ix, iy);
+}
+                      
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::GetPadC(Int_t detElemId,
+                                        Int_t ix, Int_t iy, 
+                                        Float_t& xg, Float_t& yg, Float_t& zg)
+{                                      
+// Transform from pad to real coordinates
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  Float_t xl, yl, zl;
+  fCurrentSegmentation->GetPadC(ix, iy, xl , yl, zl);
+
+  fGeometryModule->Local2Global(detElemId, xl, yl, zl, xg, yg, zg); 
+}
+
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::Init(Int_t /*chamber*/)
+{
+// Initialize segmentation.
+// Check that all detection elements have segmanetation set
+// ---
+
+  // Loop over detection elements
+  AliMUONGeometryStore* detElements = fGeometryModule->GetDetElementStore();
+
+  for (Int_t i=0; i<detElements->GetNofEntries(); i++) {
+
+    // Get detction element Id
+    Int_t detElemId = detElements->GetEntry(i)->GetUniqueID();
+
+    // Check segmentation
+    if (! fDESegmentations->Get(detElemId) )
+      AliError(Form("Detection element %d has not a segmentation set.",
+               detElements->GetEntry(i)->GetUniqueID())); 
+  }               
+}
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId) const
+{
+// Get pad size in x
+// ---
+
+  if (!Notify(detElemId)) return 0.;
+  
+  return fCurrentSegmentation->Dpx();
+}
+
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId) const
+{
+// Get pad size in y
+// ---
+
+  if (!Notify(detElemId)) return 0.;
+
+  return fCurrentSegmentation->Dpy();
+}
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId, Int_t isector) const
+{
+// Pad size in x by sector
+// ---
+
+  if (!Notify(detElemId)) return 0.;
+
+  return fCurrentSegmentation->Dpx(isector);
+} 
+
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId, Int_t isector) const
+{
+// Pad size in x, y by Sector 
+// ---
+
+  if (!Notify(detElemId)) return 0.;
+
+  return fCurrentSegmentation->Dpy(isector);
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::Npx(Int_t detElemId) const
+{
+// Maximum number of Pads in x
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  return fCurrentSegmentation->Npx();
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::Npy(Int_t detElemId) const
+{
+// Maximum number of Pads in y
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  return fCurrentSegmentation->Npy();
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::SetPad(Int_t detElemId, Int_t ix, Int_t iy)
+{
+// Set pad position.
+// Sets virtual pad coordinates, needed for evaluating pad response 
+// outside the tracking program.
+// From AliMUONGeometrySegmentationV01.
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  fCurrentSegmentation->SetPad(ix, iy);
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::SetHit(Int_t detElemId, 
+                                        Float_t xghit, Float_t yghit, Float_t zghit)
+{
+// Set hit position
+// Sets virtual hit position, needed for evaluating pad response 
+// outside the tracking program 
+// From AliMUONGeometrySegmentationV01.
+
+  if (!Notify(detElemId)) return;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); 
+
+  fCurrentSegmentation->SetHit(xl, yl, zl);
+}
+    
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::FirstPad(Int_t detElemId,
+                                        Float_t xghit, Float_t yghit, Float_t zghit, 
+                                        Float_t dx, Float_t dy) 
+{                                       
+// Iterate over pads - initialiser
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); 
+
+  fCurrentSegmentation->FirstPad(xl, yl, zl, dx, dy);
+}
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::NextPad(Int_t detElemId)
+{
+// Iterate over pads - stepper
+// ---
+
+  if (!Notify(detElemId)) return;
+  
+  fCurrentSegmentation->NextPad();
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::MorePads(Int_t detElemId)
+{
+// Iterate over pads - condition
+// ---
+
+  if (!Notify(detElemId)) return 0;
+  
+  return fCurrentSegmentation->MorePads();
+}
+
+//______________________________________________________________________________
+Float_t AliMUONGeometrySegmentation::Distance2AndOffset(Int_t detElemId,
+                                           Int_t ix, Int_t iy, 
+                                          Float_t xg, Float_t yg,  Float_t zg,
+                                          Int_t* dummy)
+{                                         
+// Returns the square of the distance between 1 pad
+// labelled by its channel numbers and a coordinate
+// ---
+
+  if (!Notify(detElemId)) return 0.;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
+
+  return fCurrentSegmentation->Distance2AndOffset(ix, iy, xl, yl, dummy);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::GetNParallelAndOffset(Int_t detElemId,
+                                            Int_t ix, Int_t iy,
+                                           Int_t* nparallel, Int_t* offset)
+{                                         
+// Number of pads read in parallel and offset to add to x 
+// (specific to LYON, but mandatory for display)
+// CHECK
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  fCurrentSegmentation->GetNParallelAndOffset(ix, iy, nparallel, offset);  
+}
+
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::Neighbours(Int_t detElemId,
+                                           Int_t ix, Int_t iy, 
+                                           Int_t* nlist, 
+                                          Int_t xlist[10], Int_t ylist[10])
+{                                        
+// Get next neighbours 
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  fCurrentSegmentation->Neighbours(ix, iy, nlist, xlist, ylist);
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometrySegmentation::Ix()
+{
+// Current pad cursor during disintegration
+// x, y-coordinate
+// ---
+
+  return fCurrentSegmentation->Ix();
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometrySegmentation::Iy()
+{
+// Current pad cursor during disintegration
+// x, y-coordinate
+// ---
+
+  return fCurrentSegmentation->Iy();
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometrySegmentation::DetElemId()
+{
+// Current pad cursor during disintegration
+// x, y-coordinate
+// ---
+
+  return fCurrentDetElemId;
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometrySegmentation::ISector()
+{
+// Current sector
+// ---
+
+  return fCurrentSegmentation->ISector();
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId, Int_t ix, Int_t iy)
+{
+// Calculate sector from pad coordinates
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  return fCurrentSegmentation->Sector(ix, iy);
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId,
+                                        Float_t xg, Float_t yg, Float_t zg)
+{
+// Calculate sector from pad coordinates
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
+
+  return fCurrentSegmentation->Sector(xl, yl);
+}
+
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::IntegrationLimits(Int_t detElemId,
+                                        Float_t& x1, Float_t& x2,
+                                        Float_t& y1, Float_t& y2)
+{                                                
+// Current integration limits 
+// ---
+  if (!Notify(detElemId)) return;
+
+  return fCurrentSegmentation->IntegrationLimits(x1, x2, y1, y2);
+}
+
+//______________________________________________________________________________
+Int_t AliMUONGeometrySegmentation::SigGenCond(Int_t detElemId,
+                                        Float_t xg, Float_t yg, Float_t zg)
+{
+// Signal Generation Condition during Stepping
+//  0: don't generate signal
+//  1: generate signal 
+//  Comments: 
+//
+//  Crossing of pad boundary and mid plane between neighbouring wires is checked.
+//  To correctly simulate the dependence of the spatial resolution on the angle 
+//  of incidence signal must be generated for constant steps on 
+//  the projection of the trajectory along the anode wire.
+//
+//  Signal will be generated if particle crosses pad boundary or
+//  boundary between two wires. 
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
+
+  return fCurrentSegmentation->SigGenCond(xl, yl, zl);
+ }
+
+
+//______________________________________________________________________________
+void  AliMUONGeometrySegmentation::SigGenInit(Int_t detElemId,
+                                       Float_t xg, Float_t yg, Float_t zg)
+{
+// Initialise signal generation at coord (x,y,z)
+// Initialises pad and wire position during stepping.
+// From AliMUONGeometrySegmentationV01
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  Float_t xl, yl, zl;
+  fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
+
+  fCurrentSegmentation->SigGenInit(xl, yl, zl);
+}                  
+    
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::GiveTestPoints(Int_t /*detElemId*/,
+                                       Int_t& /*n*/, 
+                                      Float_t* /*xg*/, Float_t* /*yg*/) const
+{                                            
+// Test points for auto calibration
+// Returns test point on the pad plane.
+// Used during determination of the segmoid correction of the COG-method
+// From AliMUONGeometrySegmentationV01
+// ---
+
+  // Requires change of interface
+  // to convert points from local to global we need z coordinate
+  AliError("Not implemented.");
+}
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::Draw(Int_t detElemId, const char* opt) const
+{
+// Draw the segmentation zones.
+// (Called from AliMUON::BuildGeometry)
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  fCurrentSegmentation->Draw(opt);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometrySegmentation::SetCorrFunc(Int_t detElemId, 
+                                              Int_t isec, TF1* func)
+{
+// Set the correction function.
+// From AliMUONGeometrySegmentationV01
+// ---
+
+  if (!Notify(detElemId)) return;
+
+  fCurrentSegmentation->SetCorrFunc(isec, func);
+}
+
+//______________________________________________________________________________
+TF1* AliMUONGeometrySegmentation::CorrFunc(Int_t detElemId, Int_t isec) const
+{
+// Get the correction Function.
+// From AliMUONGeometrySegmentationV01
+// ---
+
+  if (!Notify(detElemId)) return 0;
+
+  return  fCurrentSegmentation->CorrFunc(isec);
+} 
+
diff --git a/MUON/AliMUONGeometrySegmentation.h b/MUON/AliMUONGeometrySegmentation.h
new file mode 100644 (file)
index 0000000..ff8bad1
--- /dev/null
@@ -0,0 +1,181 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//
+// Class AliMUONGeometrySegmentation
+// ----------------------------------
+// New class for the geometry segmentation 
+// composed of the segmentations of detection elements.
+// Applies transformations defined in geometry.
+//
+// Author:Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_GEOMETRY_SEGMENTATION_H
+#define ALI_MUON_GEOMETRY_SEGMENTATION_H
+
+#include <TObject.h>
+
+class TObjArray;
+class TF1;
+
+class AliSegmentation;
+
+class AliMUONGeometryModule;
+class AliMUONGeometryStore;
+class AliMUONGeometryDetElement;
+
+class AliMUONGeometrySegmentation : public TObject
+{
+  public:
+    AliMUONGeometrySegmentation(AliMUONGeometryModule* geometry);
+    AliMUONGeometrySegmentation();
+    virtual ~AliMUONGeometrySegmentation();
+
+    // methods
+    void Add(Int_t detElemId, AliSegmentation* segmentation);  
+    
+    //    
+    // redefined methods from AliSegmentation interface
+    // 
+
+    // Set Chamber Segmentation Parameters
+    //
+    virtual void SetPadSize(Float_t p1, Float_t p2);
+                       // Pad size Dx*Dy 
+    virtual void SetDAnod(Float_t D);
+                       // Anode Pitch
+
+    // Transform from pad (wire) to real coordinates and vice versa
+    //
+    virtual Float_t GetAnod(Int_t detElemId, Float_t xlhit) const;
+                       // Anode wire coordinate closest to xhit
+    virtual void  GetPadI(Int_t detElemId,
+                          Float_t xg, Float_t yg, Float_t  zg, 
+                          Int_t& ix, Int_t& iy);
+                       // Transform from pad to real coordinates
+    virtual void  GetPadC(Int_t detElemId,
+                          Int_t ix, Int_t iy,
+                          Float_t& x, Float_t& y, Float_t& z);
+                       // Transform from real to pad coordinates
+
+    // Initialisation
+    //
+    virtual void Init(Int_t chamber);
+    // Get member data
+    //
+    virtual Float_t Dpx(Int_t detElemId) const;
+    virtual Float_t Dpy(Int_t detElemId) const ;
+                      // Pad size in x, y 
+    virtual Float_t Dpx(Int_t detElemId, Int_t isector) const;
+    virtual Float_t Dpy(Int_t detElemId, Int_t isector) const;
+                      // Pad size in x, y by Sector 
+    virtual Int_t   Npx(Int_t detElemId) const;
+    virtual Int_t   Npy(Int_t detElemId) const;
+                      // Maximum number of Pads in y
+
+    virtual void  SetPad(Int_t detElemId, Int_t ix, Int_t iy);
+                      // Set pad position
+    virtual void  SetHit(Int_t detElemId, Float_t xghit, Float_t yghit, Float_t zghit);
+                      // Set hit position
+    
+    // Iterate over pads
+    //    
+    virtual void  FirstPad(Int_t detElemId, 
+                           Float_t xghit, Float_t yghit, Float_t zghit, 
+                           Float_t dx, Float_t dy);
+    virtual void  NextPad(Int_t detElemId);
+    virtual Int_t MorePads(Int_t detElemId);
+
+    virtual Float_t Distance2AndOffset(Int_t detElemId,
+                           Int_t ix, Int_t iy, 
+                           Float_t xg, Float_t yg, Float_t zg, 
+                          Int_t* dummy);
+                      // Distance between 1 pad and a position
+    virtual void GetNParallelAndOffset(Int_t detElemId,
+                           Int_t ix, Int_t iy,
+                          Int_t* nparallel, Int_t* offset);
+                      // Number of pads read in parallel and offset to add to x 
+                      // (specific to LYON, but mandatory for display)
+    virtual void Neighbours(Int_t detElemId,
+                            Int_t ix, Int_t iy,
+                            Int_t* nlist, Int_t xlist[10], Int_t ylist[10]);
+                      // Get next neighbours 
+
+    // Current values
+    //
+    virtual Int_t  Ix();
+    virtual Int_t  Iy();
+    virtual Int_t  DetElemId();
+                     // Current pad cursor during disintegration
+                     // x, y-coordinate
+    virtual Int_t  ISector();
+                    // current sector
+
+    virtual Int_t  Sector(Int_t detElemId,
+                          Int_t ix, Int_t iy);
+    virtual Int_t  Sector(Int_t detElemId,
+                          Float_t xg, Float_t yg, Float_t zg);
+                    // calculate sector from pad coordinates
+
+    virtual void  IntegrationLimits(Int_t detElemId,
+                          Float_t& x1, Float_t& x2,
+                          Float_t& y1, Float_t& y2);
+                   // Current integration limits 
+
+    // Signal Generation
+    //
+    virtual Int_t SigGenCond(Int_t detElemId,
+                          Float_t xg, Float_t yg, Float_t zg);
+                    // Signal Generation Condition during Stepping
+    virtual void  SigGenInit(Int_t detElemId,
+                          Float_t xg, Float_t yg, Float_t zg);
+                    // Initialise signal generation at coord (x,y,z)
+                   
+    
+    virtual void GiveTestPoints(Int_t detElemId,
+                          Int_t& n, Float_t* xg, Float_t* yg) const;
+                   // Test points for auto calibration
+    virtual void Draw(Int_t detElemId,
+                          const char *opt = "") const;
+                   // Draw the segmentation zones
+
+    // Function for systematic corrections
+    //
+    virtual void SetCorrFunc(Int_t detElemId,
+                          Int_t isec,  TF1* func);
+                   // Set the correction function
+    virtual TF1* CorrFunc(Int_t detElemId, Int_t isec) const;
+                   // Get the correction Function
+  protected:
+    AliMUONGeometrySegmentation(const AliMUONGeometrySegmentation& rhs);
+  
+    // operators
+    AliMUONGeometrySegmentation& operator=(const AliMUONGeometrySegmentation & rhs);
+
+  private:
+    // methods
+    Bool_t Notify(Int_t detElemId) const;
+  
+    // data members
+    mutable  Int_t            fCurrentDetElemId;  
+    mutable  AliMUONGeometryDetElement* fCurrentDetElement;  
+    mutable  AliSegmentation* fCurrentSegmentation;
+    AliMUONGeometryModule*    fGeometryModule;
+    AliMUONGeometryStore*     fDESegmentations;
+   ClassDef(AliMUONGeometrySegmentation,1) // Station1 segmentation
+};
+
+#endif //ALI_MUON_GEOMETRY_SEGMENTATION_H
+
+
+
+
+
+
+
+
diff --git a/MUON/AliMUONGeometryStore.cxx b/MUON/AliMUONGeometryStore.cxx
new file mode 100644 (file)
index 0000000..1edd248
--- /dev/null
@@ -0,0 +1,150 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONGeometryStore
+// -------------------------------------
+// The class contains the array of the detection elements,
+// which are sorted using the AliMUONVGeometryDEIndexing class.
+// The class provides fast access to detection element via DetElemId.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <Riostream.h>
+#include <TGeoMatrix.h>
+
+#include "AliLog.h"
+
+#include "AliMUONGeometryStore.h"
+#include "AliMUONVGeometryDEIndexing.h"
+
+ClassImp(AliMUONGeometryStore)
+
+const Int_t AliMUONGeometryStore::fgkInitSize = 100;
+
+//______________________________________________________________________________
+AliMUONGeometryStore::AliMUONGeometryStore(
+                                   AliMUONVGeometryDEIndexing* indexing,
+                                  Bool_t isOwner)
+ : TObject(),
+   fObjects(fgkInitSize),
+   fDEIndexing(indexing)
+{ 
+// Standard constructor
+  
+  fObjects.SetOwner(isOwner);
+  for (Int_t i=0; i<fgkInitSize; i++) fObjects[i] = 0;
+}
+
+//______________________________________________________________________________
+AliMUONGeometryStore::AliMUONGeometryStore()
+ : TObject(),
+   fObjects(),
+   fDEIndexing(0)
+{
+// Default constructor
+}
+
+//______________________________________________________________________________
+AliMUONGeometryStore::AliMUONGeometryStore(
+                                   const AliMUONGeometryStore& rhs)
+  : TObject(rhs)
+{
+  AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONGeometryStore::~AliMUONGeometryStore() {
+//
+  fObjects.Delete();
+}
+
+//______________________________________________________________________________
+AliMUONGeometryStore& 
+AliMUONGeometryStore::operator = (const AliMUONGeometryStore& rhs) 
+{
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void AliMUONGeometryStore::Add(Int_t objectId, TObject* object)
+{
+// Add detection element in the array
+// if detection element with the same Id is not yet present. 
+// ---
+  //cout << ".. adding " << objectId 
+  //     << " index: " << fDEIndexing->GetDetElementIndex(objectId) << endl;
+
+  // Expand array if the init size has been reached
+  Int_t index = fDEIndexing->GetDetElementIndex(objectId);
+  while ( index >= fObjects.GetSize() ) {
+    Int_t size = fObjects.GetSize();
+    fObjects.Expand(size + fgkInitSize);
+    for (Int_t i=size; i<fObjects.GetSize(); i++) fObjects[i] = 0;
+  }  
+
+  // Add to the map  
+  if ( !Get(objectId, false) )
+    fObjects.AddAt(object, index);
+  else 
+    AliWarning(Form("The detection element %d is already present", objectId));  
+}                    
+
+//______________________________________________________________________________
+TObject* 
+AliMUONGeometryStore::Get(Int_t objectId, Bool_t warn) const
+{
+// Returns transformation for the specified detector element Id
+// ---
+
+  Int_t index = fDEIndexing->GetDetElementIndex(objectId);
+  
+  if ( index >= 0 && index < fObjects.GetEntriesFast() )
+    return (TObject*) fObjects.At(index);
+  else {
+    if (warn) AliWarning(Form("Index %d out of limits", index));
+    return 0;  
+  }  
+}  
+
+//______________________________________________________________________________
+Int_t  AliMUONGeometryStore::GetNofEntries() const
+{
+// Add check if the array is already filled
+
+  return fObjects.GetEntriesFast();
+}  
+
+//______________________________________________________________________________
+TObject* 
+AliMUONGeometryStore::GetEntry(Int_t index) const
+{
+//
+// Add check if the array is already filled
+  
+  return (TObject*) fObjects.At(index);
+}  
diff --git a/MUON/AliMUONGeometryStore.h b/MUON/AliMUONGeometryStore.h
new file mode 100644 (file)
index 0000000..32d8cad
--- /dev/null
@@ -0,0 +1,57 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONGeometryStore
+// --------------------------
+// The class contains the array of the detection elements,
+// which are sorted using the AliMUONVGeometryDEIndexing class.
+// The class provides fast access to detection element via detElemId.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_GEOMETRY_STORE_H
+#define ALI_MUON_GEOMETRY_STORE_H
+
+#include <TObject.h>
+#include <TObjArray.h>
+
+class AliMUONVGeometryDEIndexing;
+
+class AliMUONGeometryStore : public TObject
+{
+  public:
+    AliMUONGeometryStore(AliMUONVGeometryDEIndexing* indexing,
+                         Bool_t isOwner = true);
+    AliMUONGeometryStore();
+    virtual ~AliMUONGeometryStore();
+
+    // methods
+    void Add(Int_t objectId, TObject* object);  
+
+    // get methods
+    TObject* Get(Int_t objectId, Bool_t warn = true) const;
+
+    // methods for looping
+    Int_t     GetNofEntries() const;
+    TObject*  GetEntry(Int_t index) const;
+
+  protected:
+    AliMUONGeometryStore(const AliMUONGeometryStore& rhs);
+
+    // operators  
+    AliMUONGeometryStore& operator = (const AliMUONGeometryStore& rhs);
+  
+  private:
+    // static data members
+    static const Int_t fgkInitSize; // Initial size of array of objects
+
+    // data members
+    TObjArray                   fObjects;// The array of detection elements
+    AliMUONVGeometryDEIndexing* fDEIndexing; // The DE indexing definitions
+
+  ClassDef(AliMUONGeometryStore,1) // MUON geometry store
+};
+
+#endif //ALI_MUON_GEOMETRY_STORE_H
index 28222fd..a1863d7 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
 // $Id$
 //
 // Class AliMUONSlatGeometryBuilder
 #include <TGeoMatrix.h>
 #include <Riostream.h>
 
+#include "AliRun.h"
+#include "AliLog.h"
+
 #include "AliMUONSlatGeometryBuilder.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
 #include "AliMUONConstants.h"
-#include "AliRun.h"
-#include "AliLog.h"
 
 ClassImp(AliMUONSlatGeometryBuilder)
 
@@ -36,9 +52,12 @@ ClassImp(AliMUONSlatGeometryBuilder)
 //______________________________________________________________________________
 AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder(AliMUON* muon)
  : AliMUONVGeometryBuilder("slat.dat",
-                           &muon->Chamber(4), &muon->Chamber(5), 
-                           &muon->Chamber(6), &muon->Chamber(7), 
-                          &muon->Chamber(8), &muon->Chamber(9)),
+                           muon->Chamber(4).GetGeometry(), 
+                          muon->Chamber(5).GetGeometry(), 
+                           muon->Chamber(6).GetGeometry(), 
+                          muon->Chamber(7).GetGeometry(), 
+                          muon->Chamber(8).GetGeometry(), 
+                          muon->Chamber(9).GetGeometry()),
    fMUON(muon)
 {
 // Standard constructor
@@ -216,19 +235,19 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
   if (fStations[2])
     {
       //********************************************************************
-       //                            Station 3                             **
-       //********************************************************************
-       // indices 1 and 2 for first and second chambers in the station
-       // iChamber (first chamber) kept for other quanties than Z,
-       // assumed to be the same in both chambers
+      //                            Station 3                             **
+      //********************************************************************
+      // indices 1 and 2 for first and second chambers in the station
+      // iChamber (first chamber) kept for other quanties than Z,
+      // assumed to be the same in both chambers
 
-       iChamber = GetChamber(4);
+      iChamber = &fMUON->Chamber(4);
       iChamber1 = iChamber;
-      iChamber2 = GetChamber(5);
+      iChamber2 = &fMUON->Chamber(5);
      
       //iChamber1->GetGeometry()->SetDebug(kTRUE);
       //iChamber2->GetGeometry()->SetDebug(kTRUE);
-
       if (gAlice->GetModule("DIPO")) {
        // if DIPO is preset, the whole station will be placed in DDIP volume
        iChamber1->GetGeometry()->SetMotherVolume("DDIP");
@@ -607,9 +626,9 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     //      // assumed to be the same in both chambers
     //      corrected geometry (JP. Cussonneau, Ch. Finck)
  
-    iChamber = GetChamber(6);
+    iChamber = &fMUON->Chamber(6);
     iChamber1 = iChamber;
-    iChamber2 = GetChamber(7);
+    iChamber2 = &fMUON->Chamber(7);
 
     const Int_t   kNslats4          = 7;  // number of slats per quadrant
     const Int_t   kNPCB4[kNslats4]  = {5, 6, 5, 5, 4, 3, 2}; // n PCB per slat
@@ -868,9 +887,9 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     //      // assumed to be the same in both chambers
     //      corrected geometry (JP. Cussonneau, Ch. Finck)
 
-    iChamber = GetChamber(8);
+    iChamber = &fMUON->Chamber(8);
     iChamber1 = iChamber;
-    iChamber2 = GetChamber(9);
+    iChamber2 = &fMUON->Chamber(9);
  
     const Int_t   kNslats5         = 7;  // number of slats per quadrant
     const Int_t   kNPCB5[kNslats5] = {5, 6, 6, 6, 5, 4, 3}; // n PCB per slat
@@ -1124,32 +1143,32 @@ void AliMUONSlatGeometryBuilder::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = GetChamber(4);
+  AliMUONChamber* iChamber1 = &fMUON->Chamber(4);
   Double_t zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = GetChamber(5);
+  AliMUONChamber* iChamber2 = &fMUON->Chamber(5);
   Double_t zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
 
- iChamber1 = GetChamber(6);
+ iChamber1 = &fMUON->Chamber(6);
   zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  iChamber2 = GetChamber(7);
+  iChamber2 = &fMUON->Chamber(7);
   zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
 
- iChamber1 = GetChamber(8);
+ iChamber1 = &fMUON->Chamber(8);
   zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  iChamber2 = GetChamber(9);
+  iChamber2 = &fMUON->Chamber(9);
   zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -1162,12 +1181,12 @@ void AliMUONSlatGeometryBuilder::SetSensitiveVolumes()
 // Defines the sensitive volumes for slat stations chambers.
 // ---
 
-  GetChamber(4)->GetGeometry()->SetSensitiveVolume("S05G");
-  GetChamber(5)->GetGeometry()->SetSensitiveVolume("S06G");
-  GetChamber(6)->GetGeometry()->SetSensitiveVolume("S07G");
-  GetChamber(7)->GetGeometry()->SetSensitiveVolume("S08G");
-  GetChamber(8)->GetGeometry()->SetSensitiveVolume("S09G");
-  GetChamber(9)->GetGeometry()->SetSensitiveVolume("S10G");
+  GetGeometry(4)->SetSensitiveVolume("S05G");
+  GetGeometry(5)->SetSensitiveVolume("S06G");
+  GetGeometry(6)->SetSensitiveVolume("S07G");
+  GetGeometry(7)->SetSensitiveVolume("S08G");
+  GetGeometry(8)->SetSensitiveVolume("S09G");
+  GetGeometry(9)->SetSensitiveVolume("S10G");
 }
 
 //______________________________________________________________________________
diff --git a/MUON/AliMUONSt12QuadrantSegmentation.cxx b/MUON/AliMUONSt12QuadrantSegmentation.cxx
new file mode 100644 (file)
index 0000000..98a3a9c
--- /dev/null
@@ -0,0 +1,610 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+/* $Id$ */
+
+// Class AliMUONSt12QuadrantSegmentation
+// -------------------------------------
+// Segmentation for MUON quadrants of stations 1 and 2 using 
+// the mapping package
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <TError.h>
+#include <TF1.h>
+#include <TObjArray.h>
+#include <TVector2.h>
+
+#include "AliMpPad.h"
+#include "AliMpArea.h"
+#include "AliMpReader.h"
+#include "AliMpSector.h"
+#include "AliMpVPadIterator.h"
+#include "AliMpSectorSegmentation.h"
+
+#include "AliMUONSt12QuadrantSegmentation.h"
+#include "AliRun.h"
+#include "AliMUON.h"
+#include "AliMUONChamber.h"
+#include "AliLog.h"
+
+ClassImp(AliMUONSt12QuadrantSegmentation)
+
+const Float_t  AliMUONSt12QuadrantSegmentation::fgkWireD = 0.20; 
+const Float_t  AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1; 
+
+//______________________________________________________________________________
+AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
+                                       AliMpStationType stationType,
+                                      AliMpPlaneType planeType) 
+: AliSegmentation(),
+  fSector(0),
+  fSectorSegmentation(0),
+  fSectorIterator(0),
+  fWireD(fgkWireD),
+  fChamber(0),
+  fId(0),
+  fRmin(0.),
+  fRmax(0.),
+  fZ(0.),
+  fIx(0),
+  fIy(0),
+  fX(0.),
+  fY(0.),
+  fZone(0),
+  fXhit(0.),
+  fYhit(0.),
+  fIxt(0),
+  fIyt(0),
+  fIwt(0),
+  fXt(0.),
+  fYt(0.),
+  fCorrA(0)
+{
+// Normal constructor
+  
+  AliMpReader r(stationType, planeType);
+  fSector = r.BuildSector();
+  fSectorSegmentation = new AliMpSectorSegmentation(fSector);
+
+  fCorrA = new TObjArray(3);
+  fCorrA->AddAt(0,0);
+  fCorrA->AddAt(0,1);
+  fCorrA->AddAt(0,2);
+}
+
+//______________________________________________________________________________
+AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() 
+: AliSegmentation(),
+  fSector(0),
+  fSectorSegmentation(0),
+  fSectorIterator(0),
+  fWireD(fgkWireD),
+  fChamber(0),
+  fId(0),
+  fRmin(0.),
+  fRmax(0.),
+  fZ(0.),
+  fIx(0),
+  fIy(0),
+  fX(0.),
+  fY(0.),
+  fZone(0),
+  fXhit(0.),
+  fYhit(0.),
+  fIxt(0),
+  fIyt(0),
+  fIwt(0),
+  fXt(0.),
+  fYt(0.),
+  fCorrA(0) {
+// Default Constructor
+}
+
+//______________________________________________________________________________
+AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs) 
+  : AliSegmentation(rhs)
+{
+// Copy constructor
+  AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONSt12QuadrantSegmentation::~AliMUONSt12QuadrantSegmentation() {
+// Destructor
+
+  delete fSector;
+  delete fSectorSegmentation;  
+  delete fSectorIterator;  
+} 
+
+//
+// operators
+//
+
+//______________________________________________________________________________
+AliMUONSt12QuadrantSegmentation& 
+AliMUONSt12QuadrantSegmentation::operator=(const AliMUONSt12QuadrantSegmentation& rhs)
+{
+// Copy operator 
+
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
+//
+// private methods
+//
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::UpdateCurrentPadValues(const AliMpPad& pad)
+{
+// Updates current pad values.
+// ---
+
+  fIx = pad.GetIndices().GetFirst();
+  fIy = pad.GetIndices().GetSecond();
+  fX = pad.Position().X() * fgkLengthUnit;
+  fY = pad.Position().Y() * fgkLengthUnit;
+  fZone = fSectorSegmentation->Zone(pad);
+}  
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::SetPadSize(Float_t /*p1*/, Float_t /*p2*/)
+{
+// Set pad size Dx*Dy 
+// ---
+
+  AliFatal("Not uniform pad size.");
+}
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::SetDAnod(Float_t d)
+{
+// Set anod pitch
+// ---
+
+  fWireD = d;
+}
+
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
+{
+// Anod wire coordinate closest to xhit
+// Returns for a hit position xhit the position of the nearest anode wire    
+// From AliMUONSegmentationV01.
+// ---
+
+  Float_t wire= (xhit>0) ? Int_t(xhit/fWireD) + 0.5
+                         : Int_t(xhit/fWireD) - 0.5;
+  return fWireD*wire;
+
+}
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y, Float_t /*z*/, 
+                                      Int_t& ix, Int_t& iy)
+{                                      
+//  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
+// ---
+
+  GetPadI(x, y, ix, iy);
+}
+                      
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y,
+                                      Int_t& ix, Int_t& iy)
+{                                      
+// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
+// If there is no pad, ix = 0, iy = 0 are returned.
+// ---
+
+  AliMpPad pad = fSectorSegmentation
+               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+
+  ix = pad.GetIndices().GetFirst();
+  iy = pad.GetIndices().GetSecond();
+}
+                      
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy, 
+                                      Float_t& x, Float_t& y, Float_t& z)
+{                                      
+// Transform from pad to real coordinates
+// ---
+
+  z = fZ;
+  GetPadC(ix, iy, x , y);
+}
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy, 
+                                      Float_t& x, Float_t& y)
+{                                      
+// Transform from pad to real coordinates
+// If there is no pad, x = 0., y = 0. are returned.
+// ---
+
+  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy));
+
+  x = pad.Position().X() * fgkLengthUnit;
+  y = pad.Position().Y() * fgkLengthUnit;
+}
+
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::Init(Int_t chamber)
+{
+// Initialize segmentation
+// ---
+
+  // find Npx, Npy and save this info
+  
+  // reference to chamber
+ AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
+ fChamber = &(pMUON->Chamber(chamber));
+ fRmin=fChamber->RInner();
+ fRmax=fChamber->ROuter();  
+ fZ = 0;
+ fId=chamber;
+}
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::Dpx() const
+{
+// Get pad size in x
+// ---
+
+  AliFatal( "Not uniform pad size.");
+  return 0.;
+}
+
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::Dpy() const
+{
+// Get pad size in y
+// ---
+
+  AliFatal("Not uniform pad size.");
+  return 0.;
+}
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::Dpx(Int_t isector) const
+{
+// Pad size in x by sector
+// ---
+
+  return fSectorSegmentation->PadDimensions(isector).X()*2.*fgkLengthUnit;
+} 
+
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::Dpy(Int_t isector) const
+{
+// Pad size in x, y by Sector 
+// ---
+
+  return fSectorSegmentation->PadDimensions(isector).Y()*2.*fgkLengthUnit;
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::Npx() const
+{
+// Maximum number of Pads in x
+// ---
+
+  //Fatal("Npx", "Not yet implemented.");
+  return 142; //hard coded for the time being
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::Npy() const
+{
+// Maximum number of Pads in y
+// ---
+
+  //Fatal("Npy", "Not yet implemented.");
+  return 213; //hard coded for the time being
+}
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::SetPad(Int_t ix, Int_t iy)
+{
+// Set pad position.
+// Sets virtual pad coordinates, needed for evaluating pad response 
+// outside the tracking program.
+// From AliMUONSegmentationV01.
+// ---
+
+  GetPadC(ix, iy, fX, fY);
+  fZone = Sector(ix, iy);
+}
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
+{
+// Set hit position
+// Sets virtual hit position, needed for evaluating pad response 
+// outside the tracking program 
+// From AliMUONSegmentationV01.
+
+  fXhit = xhit;
+  fYhit = yhit;
+}
+    
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, 
+                                       Float_t dx, Float_t dy) 
+{                                       
+// Iterate over pads - initialiser
+// ---
+
+  // Sets the current pad to that located in the hit position
+  SetHit(GetAnod(xhit), yhit, 0.); 
+  
+  // Enable iterating in one dimension
+  if (dx == 0.)  dx = 0.01;
+  if (dy == 0.)  dy = 0.01;
+  
+  fSectorIterator 
+    = fSectorSegmentation
+        ->CreateIterator(AliMpArea(TVector2(fXhit/fgkLengthUnit, fYhit/fgkLengthUnit), 
+                                  TVector2(dx/fgkLengthUnit, dy/fgkLengthUnit)));
+
+  fSectorIterator->First();            
+
+  if (! fSectorIterator->IsDone())
+    UpdateCurrentPadValues(fSectorIterator->CurrentItem());
+}
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::NextPad()
+{
+// Iterate over pads - stepper
+// ---
+
+  fSectorIterator->Next();                             
+
+  if (! fSectorIterator->IsDone())
+    UpdateCurrentPadValues(fSectorIterator->CurrentItem());
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::MorePads()
+{
+// Iterate over pads - condition
+// ---
+
+  if (fSectorIterator->IsDone())
+    return 0;
+  else
+    return 1;  
+}
+
+//______________________________________________________________________________
+Float_t AliMUONSt12QuadrantSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, 
+                                                  Float_t x, Float_t y, Int_t* /*dummy*/)
+{                                         
+// Returns the square of the distance between 1 pad
+// labelled by its channel numbers and a coordinate
+// ---
+
+  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(iX, iY));
+  
+  if (!pad.IsValid())
+    AliFatal("Cannot locate pad.");
+
+  return (pad.Position()*fgkLengthUnit - TVector2(x, y)).Mod2();
+}
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/,
+                                                  Int_t* /*Nparallel*/, Int_t* /*Offset*/)
+{                                         
+// Number of pads read in parallel and offset to add to x 
+// (specific to LYON, but mandatory for display)
+// ---
+
+  AliFatal( "Not yet implemented.");
+}
+
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::Neighbours(Int_t iX, Int_t iY, 
+                                        Int_t* Nlist, 
+                                       Int_t Xlist[10], Int_t Ylist[10])
+{                                        
+// Get next neighbours 
+// ---
+
+  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(iX,iY));
+  Int_t &i = *Nlist;
+  i=0;
+  AliMpVPadIterator* iter
+    = fSectorSegmentation
+      ->CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
+
+  for( iter->First(); !iter->IsDone() && i<10; iter->Next()) {
+    Xlist[i] = iter->CurrentItem().GetIndices().GetFirst();
+    Ylist[i] = iter->CurrentItem().GetIndices().GetSecond();
+    i++;
+  }
+  
+  delete iter;
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONSt12QuadrantSegmentation::Ix()
+{
+// Current pad cursor during disintegration
+// x, y-coordinate
+// ---
+
+  return fSectorIterator->CurrentItem().GetIndices().GetFirst();
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONSt12QuadrantSegmentation::Iy()
+{
+// Current pad cursor during disintegration
+// x, y-coordinate
+// ---
+
+  return fSectorIterator->CurrentItem().GetIndices().GetSecond();
+}
+
+//______________________________________________________________________________
+Int_t  AliMUONSt12QuadrantSegmentation::ISector()
+{
+// Current sector
+// ---
+
+  return fZone;
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::Sector(Int_t ix, Int_t iy)
+{
+// Calculate sector from pad coordinates
+// ---
+
+  return fSectorSegmentation
+           ->Zone(fSectorSegmentation->PadByIndices(AliMpIntPair(ix, iy)));
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::Sector(Float_t x, Float_t y)
+{
+// Calculate sector from pad coordinates
+// ---
+
+  return fSectorSegmentation
+           ->Zone(fSectorSegmentation
+                   ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit)));
+}
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::IntegrationLimits(Float_t& x1, Float_t& x2,
+                                                Float_t& y1, Float_t& y2)
+{                                                
+// Current integration limits 
+// ---
+  x1 = fXhit - fX - Dpx(fZone)/2.;
+  x2 = x1 + Dpx(fZone);
+
+  y1 = fYhit - fY - Dpy(fZone)/2.;
+  y2 = y1 + Dpy(fZone);    
+}
+
+//______________________________________________________________________________
+Int_t AliMUONSt12QuadrantSegmentation::SigGenCond(Float_t x, Float_t y, Float_t /*z*/)
+{
+// Signal Generation Condition during Stepping
+//  0: don't generate signal
+//  1: generate signal 
+//  Comments: 
+//
+//  Crossing of pad boundary and mid plane between neighbouring wires is checked.
+//  To correctly simulate the dependence of the spatial resolution on the angle 
+//  of incidence signal must be generated for constant steps on 
+//  the projection of the trajectory along the anode wire.
+//
+//  Signal will be generated if particle crosses pad boundary or
+//  boundary between two wires. 
+//
+// From AliMUONSegmentationV01
+// ---
+
+  Int_t ixt, iyt;
+  GetPadI(x, y, ixt, iyt);
+  Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
+  
+  if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
+    return 1;
+  } 
+  else {
+    return 0;
+  }
+}
+
+
+//______________________________________________________________________________
+void  AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t /*z*/)
+{
+// Initialise signal generation at coord (x,y,z)
+// Initialises pad and wire position during stepping.
+// From AliMUONSegmentationV01
+// ---
+
+  fXt = x;
+  fYt = y;
+  GetPadI(x, y, fIxt, fIyt);
+  fIwt = (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
+}                  
+    
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::GiveTestPoints(Int_t& n, Float_t* x, Float_t* y) const
+{                                            
+// Test points for auto calibration
+// Returns test point on the pad plane.
+// Used during determination of the segmoid correction of the COG-method
+// From AliMUONSegmentationV01
+// ---
+
+  n=1;
+  x[0] = (fRmax+fRmin)/2/TMath::Sqrt(2.);
+  y[0] = x[0];
+}
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::Draw(const char * /*opt*/)
+{
+// Draw the segmentation zones.
+// (Called from AliMUON::BuildGeometry)
+// ---
+
+  AliWarning("Not yet implemented.");
+}
+
+//______________________________________________________________________________
+void AliMUONSt12QuadrantSegmentation::SetCorrFunc(Int_t isec, TF1* func)
+{
+// Set the correction function.
+// From AliMUONSegmentationV01
+// ---
+
+  fCorrA->AddAt(func, isec);
+}
+
+//______________________________________________________________________________
+TF1* AliMUONSt12QuadrantSegmentation::CorrFunc(Int_t isec) const
+{
+// Get the correction Function.
+// From AliMUONSegmentationV01
+// ---
+
+  return (TF1*) fCorrA->At(isec);
+} 
+
diff --git a/MUON/AliMUONSt12QuadrantSegmentation.h b/MUON/AliMUONSt12QuadrantSegmentation.h
new file mode 100644 (file)
index 0000000..6575c9e
--- /dev/null
@@ -0,0 +1,209 @@
+#ifndef ALI_MUON_ST12_QUADRANT_SEGMENTATION_H
+#define ALI_MUON_ST12_QUADRANT_SEGMENTATION_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+// Revision of includes 07/05/2004
+
+// Class AliMUONSt12QuadrantSegmentation
+// -------------------------------------
+// Segmentation for MUON quadrants of stations 1 and 2 using 
+// the mapping package
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include "AliMpStationType.h"
+#include "AliMpPlaneType.h"
+
+#include "AliSegmentation.h"
+
+class TObjArray;
+
+class AliMpSector;
+class AliMpSectorSegmentation;
+class AliMpVPadIterator;
+class AliMpPad;
+
+class AliMUONChamber;
+
+class AliMUONSt12QuadrantSegmentation : public AliSegmentation 
+{
+  public:
+    AliMUONSt12QuadrantSegmentation(AliMpStationType stationType,
+                                   AliMpPlaneType planeType);
+    AliMUONSt12QuadrantSegmentation();
+    
+    virtual ~AliMUONSt12QuadrantSegmentation();
+    
+    //    
+    // methods derived from base class    
+    // 
+
+    // Set Chamber Segmentation Parameters
+    //
+    virtual void SetPadSize(Float_t p1, Float_t p2);
+                       // Pad size Dx*Dy 
+    virtual void SetDAnod(Float_t D);
+                       // Anode Pitch
+
+    // Transform from pad (wire) to real coordinates and vice versa
+    //
+    virtual Float_t GetAnod(Float_t xhit) const;
+                       // Anode wire coordinate closest to xhit
+    virtual void  GetPadI(Float_t x, Float_t y, Float_t  z, Int_t& ix, Int_t& iy);
+    virtual void  GetPadI(Float_t x, Float_t y , Int_t &ix, Int_t &iy) ;
+                       // Transform from pad to real coordinates
+    virtual void  GetPadC(Int_t ix, Int_t iy, Float_t& x, Float_t& y, Float_t& z);
+    virtual void  GetPadC(Int_t ix, Int_t iy, Float_t& x, Float_t& y);
+                       // Transform from real to pad coordinates
+                      
+
+    // Initialisation
+    //
+    virtual void Init(Int_t chamber);
+    // Get member data
+    //
+    virtual Float_t Dpx() const;
+    virtual Float_t Dpy() const;
+                      // Pad size in x, y 
+    virtual Float_t Dpx(Int_t isector) const;
+    virtual Float_t Dpy(Int_t isector) const;
+                      // Pad size in x, y by Sector 
+    virtual Int_t   Npx() const;
+    virtual Int_t   Npy() const;
+                      // Maximum number of Pads in y
+
+    virtual void  SetPad(Int_t ix, Int_t iy);
+                      // Set pad position
+    virtual void  SetHit(Float_t xhit, Float_t yhit, Float_t zhit);
+                      // Set hit position
+    
+    // Iterate over pads
+    //
+    virtual void  FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, 
+                           Float_t dx, Float_t dy);
+    virtual void  NextPad();
+    virtual Int_t MorePads();
+
+    virtual Float_t Distance2AndOffset(Int_t iX, Int_t iY, 
+                                       Float_t X, Float_t Y, Int_t* dummy) ;
+                      // Distance between 1 pad and a position
+    virtual void GetNParallelAndOffset(Int_t iX, Int_t iY,
+                                      Int_t* Nparallel, Int_t* Offset);
+                      // Number of pads read in parallel and offset to add to x 
+                      // (specific to LYON, but mandatory for display)
+    virtual void Neighbours(Int_t iX, Int_t iY, 
+                            Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]);
+                      // Get next neighbours 
+
+    // Current values
+    //
+    virtual Int_t  Ix();
+    virtual Int_t  Iy();
+                     // Current pad cursor during disintegration
+                     // x, y-coordinate
+    virtual Int_t  ISector();
+                    // current sector
+
+    virtual Int_t  Sector(Int_t ix, Int_t iy);
+    virtual Int_t  Sector(Float_t x, Float_t y);
+                    // calculate sector from pad coordinates
+
+    virtual void  IntegrationLimits(Float_t& x1, Float_t& x2,
+                                    Float_t& y1, Float_t& y2);
+                   // Current integration limits 
+
+    // Signal Generation
+    //
+    virtual Int_t SigGenCond(Float_t x, Float_t y, Float_t z);
+                    // Signal Generation Condition during Stepping
+    virtual void  SigGenInit(Float_t x, Float_t y, Float_t z);
+                    // Initialise signal generation at coord (x,y,z)
+                   
+    
+    virtual void GiveTestPoints(Int_t& n, Float_t* x, Float_t* y) const;
+                   // Test points for auto calibration
+    virtual void Draw(const char *opt = "");
+                   // Draw the segmentation zones
+
+    // Function for systematic corrections
+    //
+    virtual void SetCorrFunc(Int_t isec,  TF1* func);
+                   // Set the correction function
+    virtual TF1* CorrFunc(Int_t isec)  const;
+                   // Get the correction Function
+  protected:
+    AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs);
+  
+    // operators
+    AliMUONSt12QuadrantSegmentation& operator=(const AliMUONSt12QuadrantSegmentation & rhs);
+
+  private:
+    // methods
+    void UpdateCurrentPadValues(const AliMpPad& pad);
+  
+    // constants
+    static const Float_t  fgkWireD;     // default wire pitch
+    static const Float_t  fgkLengthUnit;// conversion between length units
+                                        // from mapping (mm) to AliRoot (cm)
+  
+    // data members
+
+    // From mapping
+    //
+    AliMpSector*             fSector;            //  sector (from mapping)
+    AliMpSectorSegmentation* fSectorSegmentation;//  sector segmentation (from mapping)
+    AliMpVPadIterator*       fSectorIterator;    // ! iterator over pads
+
+    // Wire pitch
+    //
+    Float_t         fWireD;  // wire pitch
+                             // (smaller distance between anode wires)
+    
+    // Reference to mother chamber
+    //
+    AliMUONChamber* fChamber; // ! Reference to mother chamber
+    Int_t           fId;      // Identifier
+    Float_t         fRmin;    // inner radius
+    Float_t         fRmax;    // outer radius
+    Float_t         fZ;       // z-position of chamber
+
+    // Current pad during integration (cursor for disintegration)
+    //
+    Int_t   fIx;     // ! pad coord.  x 
+    Int_t   fIy;     // ! pad coord.  y 
+    Float_t fX;      // ! real coord. x
+    Float_t fY;      // ! real ccord. y
+    Int_t   fZone;   // ! Current zone (sector in AliSegmentation naming)
+    
+    // Current pad and wire during tracking (cursor at hit centre)
+    //
+    Float_t fXhit;  // ! x-position of hit
+    Float_t fYhit;  // ! y-position of hit
+
+    // Reference point to define signal generation condition
+    //
+    Int_t   fIxt;   // ! pad coord. x
+    Int_t   fIyt;   // ! pad coord. y
+    Int_t   fIwt;   // ! wire number
+    Float_t fXt;    // ! x
+    Float_t fYt;    // ! y
+
+    TObjArray* fCorrA; // ! Array of correction functions
+
+  ClassDef(AliMUONSt12QuadrantSegmentation,1) // Station1 segmentation
+};
+
+#endif //ALI_MUON_ST12_QUADRANT_SEGMENTATION_H
+
+
+
+
+
+
+
+
index e282d87..832e4d4 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
 // $Id$
 //
 // Class AliMUONSt1GeometryBuilder
 #include <TVirtualMC.h>
 #include <TGeoMatrix.h>
 
+#include "AliLog.h"
+
 #include "AliMUONSt1GeometryBuilder.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliLog.h"
 
 ClassImp(AliMUONSt1GeometryBuilder)
 
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder(AliMUON* muon)
  : AliMUONVGeometryBuilder("st1.dat",
-                           &muon->Chamber(0), &muon->Chamber(1)),
+                           muon->Chamber(0).GetGeometry(), 
+                          muon->Chamber(1).GetGeometry()),
    fMUON(muon)
 {
 // Standard constructor
@@ -100,8 +117,8 @@ void AliMUONSt1GeometryBuilder::CreateGeometry()
      Int_t irot2;
      fMUON->AliMatrix(irot2,  90.,  90., 90., 180., 0., 0.);
 
-     AliMUONChamber* iChamber1 = GetChamber(0);
-     AliMUONChamber* iChamber2 = GetChamber(1);
+     AliMUONChamber* iChamber1 = &fMUON->Chamber(0);
+     AliMUONChamber* iChamber2 = &fMUON->Chamber(1);
      AliMUONChamber* iChamber = iChamber1;
 
      // DGas decreased from standard one (0.5)
@@ -284,12 +301,12 @@ void AliMUONSt1GeometryBuilder::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = GetChamber(0);
+  AliMUONChamber* iChamber1 = &fMUON->Chamber(0);
   Double_t zpos1= - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = GetChamber(1);
+  AliMUONChamber* iChamber2 = &fMUON->Chamber(1);
   Double_t zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -301,6 +318,6 @@ void AliMUONSt1GeometryBuilder::SetSensitiveVolumes()
 // Defines the sensitive volumes for station1 chambers.
 // ---
 
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("S01G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("S02G");
+  GetGeometry(0)->SetSensitiveVolume("S01G");
+  GetGeometry(1)->SetSensitiveVolume("S02G");
 }
index 69d3a77..11429cd 100644 (file)
 #include "AliMpMotifMap.h"
 #include "AliMpMotifPosition.h"
 
+#include "AliRun.h"
+#include "AliMagF.h"
+#include "AliLog.h"
+
 #include "AliMUONSt1GeometryBuilderV2.h"
 #include "AliMUONSt1SpecialMotif.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliRun.h"
-#include "AliMagF.h"
-#include "AliLog.h"
 
 ClassImp(AliMUONSt1GeometryBuilderV2)
 
@@ -113,7 +114,8 @@ const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantFLayerName="SQF";
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
   : AliMUONVGeometryBuilder("st1V2.dat",
-                            &muon->Chamber(0), &muon->Chamber(1)),
+                            muon->Chamber(0).GetGeometry(), 
+                           muon->Chamber(1).GetGeometry()),
     fMUON(muon)
 {
    // set path to mapping data files
@@ -2530,12 +2532,12 @@ void AliMUONSt1GeometryBuilderV2::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = GetChamber(0);
+  AliMUONChamber* iChamber1 = &fMUON->Chamber(0);
   Double_t zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = GetChamber(1);
+  AliMUONChamber* iChamber2 = &fMUON->Chamber(1);
   Double_t zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -2547,28 +2549,28 @@ void AliMUONSt1GeometryBuilderV2::SetSensitiveVolumes()
 // Defines the sensitive volumes for station2 chambers.
 // ---
 
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SA1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SB1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SC1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SD1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SE1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SF1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SG1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SH1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SI1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SJ1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SK1G");
+  GetGeometry(0)->SetSensitiveVolume("SA1G");
+  GetGeometry(0)->SetSensitiveVolume("SB1G");
+  GetGeometry(0)->SetSensitiveVolume("SC1G");
+  GetGeometry(0)->SetSensitiveVolume("SD1G");
+  GetGeometry(0)->SetSensitiveVolume("SE1G");
+  GetGeometry(0)->SetSensitiveVolume("SF1G");
+  GetGeometry(0)->SetSensitiveVolume("SG1G");
+  GetGeometry(0)->SetSensitiveVolume("SH1G");
+  GetGeometry(0)->SetSensitiveVolume("SI1G");
+  GetGeometry(0)->SetSensitiveVolume("SJ1G");
+  GetGeometry(0)->SetSensitiveVolume("SK1G");
     
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SA2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SB2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SC2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SD2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SE2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SF2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SG2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SH2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SI2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SJ2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SK2G");
+  GetGeometry(1)->SetSensitiveVolume("SA2G");
+  GetGeometry(1)->SetSensitiveVolume("SB2G");
+  GetGeometry(1)->SetSensitiveVolume("SC2G");
+  GetGeometry(1)->SetSensitiveVolume("SD2G");
+  GetGeometry(1)->SetSensitiveVolume("SE2G");
+  GetGeometry(1)->SetSensitiveVolume("SF2G");
+  GetGeometry(1)->SetSensitiveVolume("SG2G");
+  GetGeometry(1)->SetSensitiveVolume("SH2G");
+  GetGeometry(1)->SetSensitiveVolume("SI2G");
+  GetGeometry(1)->SetSensitiveVolume("SJ2G");
+  GetGeometry(1)->SetSensitiveVolume("SK2G");
 }
 
index aa3237b..e9cc6a0 100644 (file)
 #include <TVirtualMC.h>
 #include <TGeoMatrix.h>
 
+#include "AliLog.h"
+
 #include "AliMUONSt2GeometryBuilder.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliLog.h"
 
 ClassImp(AliMUONSt2GeometryBuilder)
 
 //______________________________________________________________________________
 AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(AliMUON* muon)
  : AliMUONVGeometryBuilder("st2.dat",
-                           &muon->Chamber(2), &muon->Chamber(3)),
+                           muon->Chamber(2).GetGeometry(), 
+                          muon->Chamber(3).GetGeometry()),
    fMUON(muon)
 {
 // Standard constructor
@@ -114,9 +116,9 @@ void AliMUONSt2GeometryBuilder::CreateGeometry()
      Int_t irot2;
      fMUON->AliMatrix(irot2,  90.,  90., 90., 180., 0., 0.);
 
-     AliMUONChamber* iChamber = GetChamber(2);
+     AliMUONChamber* iChamber = &fMUON->Chamber(2);
      AliMUONChamber* iChamber1 = iChamber;
-     AliMUONChamber* iChamber2 = GetChamber(3);
+     AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
      
      // Half of the total thickness of frame crosses (including DAlu)
      // for each chamber in stations 1 and 2:
@@ -455,12 +457,12 @@ void AliMUONSt2GeometryBuilder::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = GetChamber(2);
+  AliMUONChamber* iChamber1 = &fMUON->Chamber(2);
   Double_t zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = GetChamber(3);
+  AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
   Double_t zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -472,6 +474,6 @@ void AliMUONSt2GeometryBuilder::SetSensitiveVolumes()
 // Defines the sensitive volumes for station2 chambers.
 // ---
 
-  GetChamber(2)->GetGeometry()->SetSensitiveVolume("S03G");
-  GetChamber(3)->GetGeometry()->SetSensitiveVolume("S04G");
+  GetGeometry(2)->SetSensitiveVolume("S03G");
+  GetGeometry(3)->SetSensitiveVolume("S04G");
 }
diff --git a/MUON/AliMUONTest.cxx b/MUON/AliMUONTest.cxx
new file mode 100644 (file)
index 0000000..821c78d
--- /dev/null
@@ -0,0 +1,255 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONTest
+// -----------------
+// Class with functions for testing
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <TStopwatch.h>
+#include <Riostream.h>
+
+#include "AliRun.h"
+#include "AliSegmentation.h"
+#include "AliLog.h"
+
+#include "AliMUONTest.h"
+#include "AliMUON.h"
+#include "AliMUONConstants.h"
+#include "AliMUONGeometryModule.h"
+#include "AliMUONGeometryStore.h"
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONSt12QuadrantSegmentation.h"
+
+ClassImp(AliMUONTest)
+
+//__________________________________________________________________
+AliMUONTest::AliMUONTest(const TString& configMacro)
+  : TObject()
+{
+// Standard Constructor
+//
+  // Initialize AliRoot
+  gAlice->Init(configMacro.Data());
+}
+
+//__________________________________________________________________
+AliMUONTest::AliMUONTest()
+  : TObject()
+{
+// Default Constructor
+//
+}
+
+//____________________________________________________________________
+AliMUONTest::AliMUONTest(const AliMUONTest& rhs)
+ : TObject(rhs)
+{
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
+}
+
+//____________________________________________________________________
+AliMUONTest::~AliMUONTest()
+{
+// Destructor
+}
+
+//________________________________________________________________________
+AliMUONTest& AliMUONTest::operator = (const AliMUONTest& rhs)
+{
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  AliFatal("Not implemented.");
+    
+  return *this;  
+}
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void  AliMUONTest::DetElemTransforms()
+{
+// 
+  AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
+  if (!muon) {
+    AliFatal("MUON detector not defined.");
+    return;
+  }  
+  
+  // Loop over chambers
+  for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
+
+    AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry();
+    AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
+    
+    // Loop over detection elements
+    for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
+       
+      //Int_t detElemId = geometry->GetDetElemId(j);       
+      Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();       
+      cout << "Detection element Id: " << detElemId << endl;
+       
+      Double_t x, y, z;
+      geometry->Local2Global(detElemId, 0., 0., 0., x, y, z);
+      cout << "  Global DE position:            " 
+          <<  x << ",  " << y << ",  " << z << endl; 
+
+      Double_t x2, y2, z2;
+      geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2);
+      cout << "  ALIC center in the local frame: " 
+          <<  x2 << ",  " << y2 << ",  " << z2 << endl; 
+            
+      Double_t x3, y3, z3;
+      geometry->Global2Local(detElemId, x, y, z, x3, y3, z3);
+      cout << "  Back in the local frame: " 
+           <<  x3 << ",  " << y3 << ",  " << z3 << endl;        
+      cout << endl;         
+    }
+  }
+}       
+
+//______________________________________________________________________________
+void AliMUONTest::PrintPadPositions1()
+{
+// Build new segmentations (based on the  detection element local 
+// segmentations), iterate over all segmentations and print global 
+// pad positions
+
+  AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
+  if (!muon) {
+    AliFatal("MUON detector not defined.");
+    return;
+  }  
+
+  // Loop over chambers
+  for (Int_t i=0; i<1; i++) {
+
+    // Create chamber segmentations
+    AliMUONGeometrySegmentation* seg[2];
+    seg[0] = new AliMUONGeometrySegmentation(muon->Chamber(i).GetGeometry());
+    seg[1] = new AliMUONGeometrySegmentation(muon->Chamber(i).GetGeometry());
+    
+    // Quadrant segmentations:
+    AliMUONSt12QuadrantSegmentation* bendSt1
+      = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane);
+    AliMUONSt12QuadrantSegmentation* nonbendSt1
+      = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane);
+
+    // The same configuration for both chambers of Station 1
+    Int_t id0 = (i+1)*100;
+
+    // Configure  St1 chamber segmentations
+    seg[0]->Add(id0,      bendSt1);
+    seg[0]->Add(id0 +  1, nonbendSt1);
+    seg[0]->Add(id0 + 50, nonbendSt1);
+    seg[0]->Add(id0 + 51, bendSt1);
+
+    seg[1]->Add(id0,      nonbendSt1);
+    seg[1]->Add(id0 +  1, bendSt1);
+    seg[1]->Add(id0 + 50, bendSt1);
+    seg[1]->Add(id0 + 51, nonbendSt1);
+
+    // Iterate over the whole plane and return pad indices and 
+    // global/local positions
+    cout << "Go to loop over pads" << endl;
+    for (Int_t cath=0; cath<2; cath++) {
+      
+      cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
+      cout << "===================================" << endl;  
+      TStopwatch timer;
+      timer.Start();  
+
+      Int_t counter = 0;
+      for ( seg[cath]->FirstPad(100,  70., 70., 0., 80., 80.);
+            seg[cath]->MorePads(100); 
+            seg[cath]->NextPad(100) )
+      {
+        cout << setw(6) << "counter " << counter++ << "   ";
+  
+        Int_t ix = seg[cath]->Ix();
+        Int_t iy = seg[cath]->Iy();
+        Int_t deId = seg[cath]->DetElemId();
+        cout << "Pad indices:  ( " << deId << "; " << ix << ", " << iy << " )  " ;
+
+        Float_t x, y, z;
+        seg[cath]->GetPadC(deId, ix, iy, x, y, z);
+        cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
+      }
+      timer.Stop();
+      timer.Print();
+    }  
+  }  
+}    
+
+//________________________________________________________________________
+void AliMUONTest::PrintPadPositions2()
+{
+// Iterate over all chamber segmentations and prints
+// global pad positions
+
+  AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
+  if (!muon) {
+    AliFatal("MUON detector not defined.");
+    return;
+  }  
+
+  // Loop over chambers
+  for (Int_t i=0; i<1; i++) {
+
+    // Create chamber segmentations
+    AliSegmentation* seg[2];
+    seg[0] = muon->Chamber(i).SegmentationModel(0);
+    seg[1] = muon->Chamber(i).SegmentationModel(1);
+
+    // Iterate over the whole plane and return pad indices and 
+    // global/local positions
+    cout << "Go to loop over pads" << endl;
+    for (Int_t cath=0; cath<2; cath++) {
+      
+      cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
+      cout << "===================================" << endl;  
+      TStopwatch timer;
+      timer.Start();  
+
+      Int_t counter = 0;
+      for ( seg[cath]->FirstPad(70., 70., 0., 80., 80.);
+            seg[cath]->MorePads(); 
+            seg[cath]->NextPad() )
+      {
+        cout << setw(6) << "counter " << counter++ << "   ";
+  
+        Int_t ix = seg[cath]->Ix();
+        Int_t iy = seg[cath]->Iy();
+        cout << "Pad indices:  ( " << ix << ", " << iy << " )  " ;
+
+        Float_t x, y, z;
+        seg[cath]->GetPadC(ix, iy, x, y, z);
+        cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
+      }
+      timer.Stop();
+      timer.Print();
+    }  
+  }  
+}
diff --git a/MUON/AliMUONTest.h b/MUON/AliMUONTest.h
new file mode 100644 (file)
index 0000000..7607360
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONTest
+// -----------------
+// Class with functions for testing
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_TEST_H
+#define ALI_MUON_TEST_H
+
+#include <TObject.h>
+
+#include "AliDetector.h"
+#include "AliMUONData.h"
+#include "AliMUONChamber.h"
+
+class TVector;
+class TFile;
+class TTree;
+
+
+class AliMUONTest : public  TObject 
+{
+  public:
+    AliMUONTest(const TString& configMacro);
+    AliMUONTest();
+    virtual ~AliMUONTest();
+   
+    // tests
+    void DetElemTransforms();
+    void PrintPadPositions1();
+    void PrintPadPositions2();
+
+  protected:
+    AliMUONTest(const AliMUONTest& rhs);
+    AliMUONTest& operator = (const AliMUONTest& rhs);
+
+    ClassDef(AliMUONTest,0)  // MUON class for tests
+};
+
+#endif //ALI_MUON_TEST_H
+
index 74e7857..9421e8f 100644 (file)
 #include <TVirtualMC.h>
 #include <TGeoMatrix.h>
 
+#include "AliLog.h"
+
 #include "AliMUONTriggerGeometryBuilder.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliLog.h"
 
 ClassImp(AliMUONTriggerGeometryBuilder)
 
 //______________________________________________________________________________
 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder(AliMUON* muon)
  : AliMUONVGeometryBuilder("trigger.dat",
-                           &muon->Chamber(10), &muon->Chamber(11),
-                           &muon->Chamber(12),&muon->Chamber(13)),
+                           muon->Chamber(10).GetGeometry(), 
+                          muon->Chamber(11).GetGeometry(),
+                           muon->Chamber(12).GetGeometry(),
+                          muon->Chamber(13).GetGeometry()),
    fMUON(muon)
 {
 // Standard constructor
@@ -126,7 +129,7 @@ void AliMUONTriggerGeometryBuilder::CreateGeometry()
     const Float_t kZp=+3.6;     
 
     AliMUONChamber *iChamber, *iChamber1;
-    iChamber1 = GetChamber(10);
+    iChamber1 = &fMUON->Chamber(10);
     Float_t zpos1=-iChamber1->Z(); 
     
 // ratio of zpos1m/zpos1p and inverse for first plane
@@ -142,7 +145,7 @@ void AliMUONTriggerGeometryBuilder::CreateGeometry()
            icount = Int_t(iplane*TMath::Power(2,0))+
                Int_t(istation*TMath::Power(2,1));
            
-           iChamber = GetChamber(10+icount);
+           iChamber = &fMUON->Chamber(10+icount);
            Float_t zpos = - iChamber->Z();          
            
 // Flange between beam shielding and RPC 
@@ -330,22 +333,22 @@ void AliMUONTriggerGeometryBuilder::SetTransformations()
     Double_t zpos1, zpos2;    
     AliMUONChamber *iChamber1, *iChamber2;
 
-    iChamber1 = GetChamber(10);
+    iChamber1 = &fMUON->Chamber(10);
     zpos1= - iChamber1->Z(); 
     iChamber1->GetGeometry()
        ->SetTranslation(TGeoTranslation(0., 0., zpos1));
     
-    iChamber2 = GetChamber(11);
+    iChamber2 = &fMUON->Chamber(11);
     zpos2 = - iChamber2->Z(); 
     iChamber2->GetGeometry()
        ->SetTranslation(TGeoTranslation(0., 0., zpos2));
 
-    iChamber1 = GetChamber(12);
+    iChamber1 = &fMUON->Chamber(12);
     zpos1 = - iChamber1->Z(); 
     iChamber1->GetGeometry()
        ->SetTranslation(TGeoTranslation(0., 0., zpos1));
     
-    iChamber2 = GetChamber(13);
+    iChamber2 = &fMUON->Chamber(13);
     zpos2 = - iChamber2->Z(); 
     iChamber2->GetGeometry()
        ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -357,9 +360,9 @@ void AliMUONTriggerGeometryBuilder::SetSensitiveVolumes()
 // Defines the sensitive volumes for trigger station chambers.
 // ---
 
-  GetChamber(10)->GetGeometry()->SetSensitiveVolume("SG1A");
-  GetChamber(11)->GetGeometry()->SetSensitiveVolume("SG2A");
-  GetChamber(12)->GetGeometry()->SetSensitiveVolume("SG3A");
-  GetChamber(13)->GetGeometry()->SetSensitiveVolume("SG4A");
+  GetGeometry(10)->SetSensitiveVolume("SG1A");
+  GetGeometry(11)->SetSensitiveVolume("SG2A");
+  GetGeometry(12)->SetSensitiveVolume("SG3A");
+  GetGeometry(13)->SetSensitiveVolume("SG4A");
 }
 
index b67db8e..0b8f3de 100644 (file)
@@ -17,7 +17,7 @@
 //
 // Class AliMUONVGeometryBuilder
 // -----------------------------
-// Abstract base class for geometry construction per chamber(s).
+// Abstract base class for geometry construction per geometry module(s).
 // Author: Ivana Hrivnacova, IPN Orsay
 // 23/01/2004
 
 #include <TVirtualMC.h>
 
 #include "AliMUONVGeometryBuilder.h"
-#include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
-#include "AliMUONGeometryTransformStore.h"
+#include "AliMUONGeometryModule.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryStore.h"
 #include "AliMUONGeometrySVMap.h"
 #include "AliMUONGeometryEnvelopeStore.h"
 #include "AliMUONGeometryEnvelope.h"
 #include "AliMUONGeometryConstituent.h"
-#include "AliMUONConstants.h"
+#include "AliMUONVGeometryDEIndexing.h"
 #include "AliLog.h"
 
 ClassImp(AliMUONVGeometryBuilder)
@@ -46,25 +46,25 @@ const TString AliMUONVGeometryBuilder::fgkOutFileNameSuffix = ".out";
 
 //______________________________________________________________________________
 AliMUONVGeometryBuilder::AliMUONVGeometryBuilder(const TString& fileName,
-                                AliMUONChamber* ch1, AliMUONChamber* ch2,
-                                AliMUONChamber* ch3, AliMUONChamber* ch4,
-                                AliMUONChamber* ch5, AliMUONChamber* ch6)
+                            AliMUONGeometryModule* mg1, AliMUONGeometryModule* mg2,
+                            AliMUONGeometryModule* mg3, AliMUONGeometryModule* mg4,
+                            AliMUONGeometryModule* mg5, AliMUONGeometryModule* mg6)
  : TObject(),
    fTransformFileName(fgkTransformFileNamePrefix+fileName),
    fSVMapFileName(fgkSVMapFileNamePrefix+fileName),
-   fChambers(0)
+   fModuleGeometries(0)
  {
 // Standard constructor
 
-  // Create the chambers array
-  fChambers = new TObjArray();
+  // Create the module geometries array
+  fModuleGeometries = new TObjArray();
   
-  if (ch1) fChambers->Add(ch1);
-  if (ch2) fChambers->Add(ch2);
-  if (ch3) fChambers->Add(ch3);
-  if (ch4) fChambers->Add(ch4);
-  if (ch5) fChambers->Add(ch5);
-  if (ch6) fChambers->Add(ch6);
+  if (mg1) fModuleGeometries->Add(mg1);
+  if (mg2) fModuleGeometries->Add(mg2);
+  if (mg3) fModuleGeometries->Add(mg3);
+  if (mg4) fModuleGeometries->Add(mg4);
+  if (mg5) fModuleGeometries->Add(mg5);
+  if (mg6) fModuleGeometries->Add(mg6);
 }
 
 
@@ -73,7 +73,7 @@ AliMUONVGeometryBuilder::AliMUONVGeometryBuilder()
  : TObject(),
    fTransformFileName(),
    fSVMapFileName(),
-   fChambers(0)
+   fModuleGeometries(0)
 {
 // Default constructor
 }
@@ -91,9 +91,9 @@ AliMUONVGeometryBuilder::AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder&
 //______________________________________________________________________________
 AliMUONVGeometryBuilder::~AliMUONVGeometryBuilder() {
 //
-  if (fChambers) {
-    fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
-    delete fChambers;
+  if (fModuleGeometries) {
+    fModuleGeometries->Clear(); // Sets pointers to 0 since it is not the owner
+    delete fModuleGeometries;
   }
 }
 
@@ -147,8 +147,9 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0,
     TString volName(path0(npos1, npos2-npos1));  
     
     // Check if it is sensitive volume
-    Int_t chamberId = AliMUONConstants::GetChamberId(detElemId);
-    AliMUONChamberGeometry* geometry = GetChamber(chamberId)->GetGeometry();
+    Int_t moduleId = AliMUONVGeometryDEIndexing::Instance()
+                     ->GetModuleId(detElemId);
+    AliMUONGeometryModule* geometry = GetGeometry(moduleId);
     if (geometry->IsSensitiveVolume(volName)) {
       //cout << ".. adding to the map  " 
       //     <<  path0 << "  "  << detElemId << endl;
@@ -182,21 +183,24 @@ void AliMUONVGeometryBuilder::MapSV(const TString& /*path0*/,
   AliWarning("Not yet available");
 }     
 
+
 //______________________________________________________________________________
-void AliMUONVGeometryBuilder::FillData(Int_t chamberId,
+void AliMUONVGeometryBuilder::FillData(Int_t moduleId, Int_t nofDetElements,
                   Double_t x, Double_t y, Double_t z,
                  Double_t a1, Double_t a2, Double_t a3,
                  Double_t a4, Double_t a5, Double_t a6) const 
 {
-// Fill the transformation of the chamber.
+// Fill the transformation of the module.
 // ---
 
-  chamberId--;
-      // Chambers numbers in the file are starting from 1
-
-  GetChamber(chamberId)->GetGeometry()
+  moduleId--;
+      // Modules numbers in the file are starting from 1
+      
+  GetGeometry(moduleId)
+    ->GetDEIndexing()->SetNofDetElements(nofDetElements);    
+  GetGeometry(moduleId)
     ->SetTranslation(TGeoTranslation(x, y, z));
-  GetChamber(chamberId)->GetGeometry()
+  GetGeometry(moduleId)
     ->SetRotation(TGeoRotation("rot", a1, a2, a3, a4, a5, a6));
 }                 
   
@@ -210,12 +214,9 @@ void AliMUONVGeometryBuilder::FillData(
 // Fill the transformation of the detection element.
 // ---
 
-  // Chamber Id
-  Int_t chamberId = AliMUONConstants::GetChamberId(detElemId);
-
-  // Get chamber transformations
-  AliMUONGeometryTransformStore* transforms 
-    = GetTransforms(chamberId);     
+  // Module Id
+  Int_t moduleId 
+    = AliMUONVGeometryDEIndexing::GetModuleId(detElemId);
 
   // Compose path
   TString path = ComposePath(volName, copyNo);
@@ -224,8 +225,12 @@ void AliMUONVGeometryBuilder::FillData(
   TGeoCombiTrans transform(path, x, y, z, 
                            new TGeoRotation(path, a1, a2, a3, a4, a5, a6));
     
-  // Add detection element transformation 
-  transforms->Add(detElemId, path, transform); 
+  // Get detection element store
+  AliMUONGeometryStore* detElements = GetDetElements(moduleId);     
+
+  // Add detection element
+  detElements->Add(detElemId,
+     new AliMUONGeometryDetElement(detElemId, path, transform)); 
 }                 
   
 //______________________________________________________________________________
@@ -235,11 +240,12 @@ void AliMUONVGeometryBuilder::FillData(
 // Fill the mapping of the sensitive volume path to the detection element.
 // ---
 
-  // Chamber Id
-  Int_t chamberId = AliMUONConstants::GetChamberId(detElemId);
+  // Module Id
+  Int_t moduleId 
+    = AliMUONVGeometryDEIndexing::GetModuleId(detElemId);
 
-  // Get chamber transformations
-  AliMUONGeometrySVMap* svMap = GetSVMap(chamberId);     
+  // Get module sensitive volumes map
+  AliMUONGeometrySVMap* svMap = GetSVMap(moduleId);     
 
   // Map the sensitive volume to detection element
   svMap->Add(sensVolumePath, detElemId); 
@@ -248,18 +254,19 @@ void AliMUONVGeometryBuilder::FillData(
 //______________________________________________________________________________
 TString  AliMUONVGeometryBuilder::ReadData1(ifstream& in) const
 {
-// Reads and fills chambers transformations from a file
+// Reads and fills modules transformations from a file
 // Returns true, if reading finished correctly.
 // ---
 
   TString key("CH");
   while ( key == TString("CH") ) {
-    Int_t id;
+    Int_t id, n;
     Double_t  x, y, z;
     Double_t  a1, a2, a3, a4, a5, a6;
     TString dummy;
   
     in >> id;
+    in >> n;
     in >> dummy;
     in >> x;
     in >> y;
@@ -279,7 +286,7 @@ TString  AliMUONVGeometryBuilder::ReadData1(ifstream& in) const
     //  << endl;   
         
     // Fill data
-    FillData(id, x, y, z, a1, a2, a3, a4, a5, a6);
+    FillData(id, n, x, y, z, a1, a2, a3, a4, a5, a6);
     
     // Go to next line
     in >> key;
@@ -386,7 +393,14 @@ void AliMUONVGeometryBuilder::WriteTransform(ofstream& out,
   out << "   rot: ";
   Double_t a1, a2, a3, a4, a5, a6;
   TGeoRotation* rotation = transform->GetRotation();
-  rotation->GetAngles(a1, a2, a3, a4, a5, a6);
+  if (rotation) { 
+    rotation->GetAngles(a1, a2, a3, a4, a5, a6);
+  }
+  else {
+    TGeoRotation rotation2; 
+    rotation2.GetAngles(a1, a2, a3, a4, a5, a6);
+  }  
+      
   out << setw(8) << setprecision(4) << a1 << "  " 
       << setw(8) << setprecision(4) << a2 << "  " 
       << setw(8) << setprecision(4) << a3 << "  " 
@@ -398,19 +412,18 @@ void AliMUONVGeometryBuilder::WriteTransform(ofstream& out,
 //______________________________________________________________________________
 void AliMUONVGeometryBuilder::WriteData1(ofstream& out) const
 {
-// Writes chamber transformations
+// Writes modules transformations
 // ---
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber 
-      = (AliMUONChamber*)fChambers->At(i);
-    AliMUONChamberGeometry* chamberGeometry
-       = chamber->GetGeometry();
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
     const TGeoCombiTrans* transform 
-      = chamberGeometry->GetTransformation();    
+      = geometry->GetTransformation();    
 
     out << "CH " 
-        << setw(4) << chamber->GetId() + 1 << "  ";
+        << setw(4) << geometry->GetModuleId() + 1 << "  "
+        << setw(4) << geometry->GetDetElementStore()->GetNofEntries() << "  ";
     
     WriteTransform(out, transform);
   }
@@ -424,13 +437,11 @@ void AliMUONVGeometryBuilder::WriteData2(ofstream& out) const
 // ---
 
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber 
-      = (AliMUONChamber*)fChambers->At(i);
-    AliMUONChamberGeometry* chamberGeometry
-       = chamber->GetGeometry();
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
     const TObjArray* envelopes 
-      = chamberGeometry->GetEnvelopeStore()->GetEnvelopes();    
+      = geometry->GetEnvelopeStore()->GetEnvelopes();    
 
     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
       AliMUONGeometryEnvelope* envelope
@@ -459,13 +470,11 @@ void AliMUONVGeometryBuilder::WriteData3(ofstream& out) const
 // from the sensitive volume map
 // ---
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber 
-      = (AliMUONChamber*)fChambers->At(i);
-    AliMUONChamberGeometry* chamberGeometry
-       = chamber->GetGeometry();
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
     AliMUONGeometrySVMap* svMap
-      = chamberGeometry->GetSVMap();
+      = geometry->GetSVMap();
 
     svMap->WriteMap(out);
     out << endl;  
@@ -477,14 +486,18 @@ void AliMUONVGeometryBuilder::WriteData3(ofstream& out) const
 //
 
 //______________________________________________________________________________
-AliMUONChamber*  AliMUONVGeometryBuilder::GetChamber(Int_t chamberId) const
+AliMUONGeometryModule*  
+AliMUONVGeometryBuilder::GetGeometry(Int_t moduleId) const
 {
-// Returns the chamber specified by chamberId
+// Returns the module geometry specified by moduleId
 // ---
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber = (AliMUONChamber*)fChambers->At(i);
-    if ( chamber->GetId() == chamberId) return chamber;
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
+
+    if ( geometry->GetModuleId() == moduleId) return geometry;
   }   
   
   return 0;
@@ -492,53 +505,54 @@ AliMUONChamber*  AliMUONVGeometryBuilder::GetChamber(Int_t chamberId) const
 
 //______________________________________________________________________________
 AliMUONGeometryEnvelopeStore*  
-AliMUONVGeometryBuilder::GetEnvelopes(Int_t chamberId) const
+AliMUONVGeometryBuilder::GetEnvelopes(Int_t moduleId) const
 {
-// Returns the envelope store of the chamber specified by chamberId
+// Returns the envelope store of the module geometry specified by moduleId
 // ---
 
-  AliMUONChamber* chamber = GetChamber(chamberId);
+  AliMUONGeometryModule* geometry = GetGeometry(moduleId);
   
-  if (!chamber) {
-    AliFatal(Form("Chamber %d is not defined", chamberId)); 
+  if (!geometry) {
+    AliFatal(Form("Module geometry %d is not defined", moduleId)); 
     return 0;
   }
   
-  return chamber->GetGeometry()->GetEnvelopeStore();
+  return geometry->GetEnvelopeStore();
 }  
 
 //______________________________________________________________________________
-AliMUONGeometryTransformStore*  
-AliMUONVGeometryBuilder::GetTransforms(Int_t chamberId) const
+AliMUONGeometryStore*  
+AliMUONVGeometryBuilder::GetDetElements(Int_t moduleId) const
 {
-// Returns the transformation store of the chamber specified by chamberId
+// Returns the detection elemnts store of the module geometry specified 
+// by moduleId
 // ---
 
-  AliMUONChamber* chamber = GetChamber(chamberId);
+  AliMUONGeometryModule* geometry = GetGeometry(moduleId);
   
-  if (!chamber) {
-    AliFatal(Form("Chamber %d is not defined", chamberId)); 
+  if (!geometry) {
+    AliFatal(Form("Module geometry %d is not defined", moduleId)); 
     return 0;
   }
   
-  return chamber->GetGeometry()->GetTransformStore();
+  return geometry->GetDetElementStore();
 }  
 
 //______________________________________________________________________________
 AliMUONGeometrySVMap*  
-AliMUONVGeometryBuilder::GetSVMap(Int_t chamberId) const
+AliMUONVGeometryBuilder::GetSVMap(Int_t moduleId) const
 {
-// Returns the transformation store of the chamber specified by chamberId
+// Returns the transformation store of the module geometry specified by moduleId
 // ---
 
-  AliMUONChamber* chamber = GetChamber(chamberId);
+  AliMUONGeometryModule* geometry = GetGeometry(moduleId);
   
-  if (!chamber) {
-    AliFatal(Form("Chamber %d is not defined", chamberId)); 
+  if (!geometry) {
+    AliFatal(Form("Geometry %d is not defined", moduleId)); 
     return 0;
   }
   
-  return chamber->GetGeometry()->GetSVMap();
+  return geometry->GetSVMap();
 }  
 
 //
@@ -546,20 +560,22 @@ AliMUONVGeometryBuilder::GetSVMap(Int_t chamberId) const
 //
 
 //______________________________________________________________________________
-void  AliMUONVGeometryBuilder:: FillTransformations() const
+void  AliMUONVGeometryBuilder::FillTransformations() const
 {
 // Fills transformations store from defined geometry.
 // ---
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber 
-      = (AliMUONChamber*)fChambers->At(i);
-    AliMUONChamberGeometry* chamberGeometry
-       = chamber->GetGeometry();
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
     const TObjArray* envelopes 
-      = chamberGeometry->GetEnvelopeStore()->GetEnvelopes();    
-    AliMUONGeometryTransformStore* transforms 
-      = chamberGeometry->GetTransformStore();     
+      = geometry->GetEnvelopeStore()->GetEnvelopes();    
+    
+    AliMUONGeometryStore* detElements = geometry->GetDetElementStore(); 
+      
+    // Set nof detection elements to the indexing
+    geometry->GetDEIndexing()
+      ->SetNofDetElements(geometry->GetEnvelopeStore()->GetNofDetElements()); 
 
     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
       AliMUONGeometryEnvelope* envelope
@@ -575,7 +591,8 @@ void  AliMUONVGeometryBuilder:: FillTransformations() const
       const TGeoCombiTrans* transform = envelope->GetTransformation(); 
 
       // Add detection element transformation 
-      transforms->Add(detElemId, path, *transform); 
+      detElements->Add(detElemId,
+        new AliMUONGeometryDetElement(detElemId, path, *transform)); 
     }  
   }
 }
@@ -586,18 +603,16 @@ void  AliMUONVGeometryBuilder::RebuildSVMaps() const
 // Clear the SV maps in memory and fill them from defined geometry.
 // ---
 
-  for (Int_t i=0; i<fChambers->GetEntriesFast(); i++) {
-    AliMUONChamber* chamber 
-      = (AliMUONChamber*)fChambers->At(i);
-    AliMUONChamberGeometry* chamberGeometry
-       = chamber->GetGeometry();
+  for (Int_t i=0; i<fModuleGeometries->GetEntriesFast(); i++) {
+    AliMUONGeometryModule* geometry 
+      = (AliMUONGeometryModule*)fModuleGeometries->At(i);
     
     // Clear the map   
-    chamberGeometry->GetSVMap()->Clear();
+    geometry->GetSVMap()->Clear();
      
     // Fill the map from geometry
     const TObjArray* envelopes 
-      = chamberGeometry->GetEnvelopeStore()->GetEnvelopes();    
+      = geometry->GetEnvelopeStore()->GetEnvelopes();    
 
     for (Int_t j=0; j<envelopes->GetEntriesFast(); j++) {
       AliMUONGeometryEnvelope* envelope
@@ -607,9 +622,9 @@ void  AliMUONVGeometryBuilder::RebuildSVMaps() const
       if(envelope->GetUniqueID() == 0) continue;
        
       TString path0("/ALIC.1");
-      if (chamberGeometry->GetMotherVolume() != "ALIC") {
+      if (geometry->GetMotherVolume() != "ALIC") {
         path0 += "/";
-       path0 += ComposePath(chamberGeometry->GetMotherVolume(), 1);
+       path0 += ComposePath(geometry->GetMotherVolume(), 1);
       }  
        
       if (!envelope->IsVirtual()) {
@@ -639,6 +654,10 @@ Bool_t  AliMUONVGeometryBuilder::ReadTransformations() const
 // Returns true, if reading finished correctly.
 // ---
 
+  // No reading
+  // if builder is not associated with any geometry module
+  if (fModuleGeometries->GetEntriesFast() == 0) return false;
+
   // File path
   TString filePath = gSystem->Getenv("ALICE_ROOT");
   filePath += "/MUON/data/";
@@ -675,6 +694,10 @@ Bool_t  AliMUONVGeometryBuilder::ReadSVMap() const
 // Returns true, if reading finished correctly.
 // ---
 
+  // No reading
+  // if builder is not associated with any geometry module
+  if (fModuleGeometries->GetEntriesFast() == 0) return false;
+
   // File path
   TString filePath = gSystem->Getenv("ALICE_ROOT");
   filePath += "/MUON/data/";
@@ -709,6 +732,10 @@ Bool_t  AliMUONVGeometryBuilder::WriteTransformations() const
 // Returns true, if writing finished correctly.
 // ---
 
+  // No writing
+  // if builder is not associated with any geometry module
+  if (fModuleGeometries->GetEntriesFast() == 0) return false;
+
   // File path
   TString filePath = gSystem->Getenv("ALICE_ROOT");
   filePath += "/MUON/data/";
@@ -738,6 +765,10 @@ Bool_t  AliMUONVGeometryBuilder::WriteSVMap(Bool_t rebuild) const
 // Returns true, if writing finished correctly.
 // ---
 
+  // No writing
+  // if builder is not associated with any geometry module
+  if (fModuleGeometries->GetEntriesFast() == 0) return false;
+
   // File path
   TString filePath = gSystem->Getenv("ALICE_ROOT");
   filePath += "/MUON/data/";
index f1d582c..9b26948 100644 (file)
 #include <fstream>
 
 #include <TObject.h>
+#include <TObjArray.h>
 
 class TGeoTranslation;
 class TGeoRotation;
 class TGeoCombiTrans;
-class TObjArray;
 
-class AliMUONChamber;
-class AliMUONChamberGeometry;
+class AliMUONGeometryModule;
 class AliMUONGeometryEnvelopeStore;
-class AliMUONGeometryTransformStore;
+class AliMUONGeometryStore;
 class AliMUONGeometrySVMap;
 
 class AliMUONVGeometryBuilder : public TObject
 {
   public:
     AliMUONVGeometryBuilder(const TString& fileName,
-                            AliMUONChamber* ch1,
-                            AliMUONChamber* ch2 = 0,
-                            AliMUONChamber* ch3 = 0,
-                            AliMUONChamber* ch4 = 0,
-                            AliMUONChamber* ch5 = 0,
-                            AliMUONChamber* ch6 = 0);
+                            AliMUONGeometryModule* mg1,
+                            AliMUONGeometryModule* mg2 = 0,
+                            AliMUONGeometryModule* mg3 = 0,
+                            AliMUONGeometryModule* mg4 = 0,
+                            AliMUONGeometryModule* mg5 = 0,
+                            AliMUONGeometryModule* mg6 = 0);
     AliMUONVGeometryBuilder();
     virtual ~AliMUONVGeometryBuilder();
   
@@ -74,6 +73,14 @@ class AliMUONVGeometryBuilder : public TObject
                  // The sensitive volumes Ids for each chamber
                  // should be defined and set to its geometry class. 
 
+    // access to module geometries
+    Int_t  NofGeometries() const;
+    AliMUONGeometryModule* Geometry(Int_t i) const;
+                  // In difference from protected GetGeometry()
+                 // this function access geometry via index and not
+                 // via moduleId
+
+
   protected:
     AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
 
@@ -81,10 +88,10 @@ class AliMUONVGeometryBuilder : public TObject
     AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
 
     // methods
-    AliMUONChamber*                GetChamber(Int_t chamberId) const;
-    AliMUONGeometryEnvelopeStore*  GetEnvelopes(Int_t chamberId) const;
-    AliMUONGeometryTransformStore* GetTransforms(Int_t chamberId) const;
-    AliMUONGeometrySVMap*          GetSVMap(Int_t chamberId) const;
+    AliMUONGeometryModule*         GetGeometry(Int_t moduleId) const;
+    AliMUONGeometryEnvelopeStore*  GetEnvelopes(Int_t moduleId) const;
+    AliMUONGeometryStore*          GetDetElements(Int_t moduleId) const;
+    AliMUONGeometrySVMap*          GetSVMap(Int_t moduleId) const;
     
   private:
     //methods
@@ -92,7 +99,7 @@ class AliMUONVGeometryBuilder : public TObject
     void     MapSV(const TString&path, const TString& volName, 
                   Int_t detElemId) const;
 
-    void FillData(Int_t chamberId, 
+    void FillData(Int_t moduleId, Int_t nofDetElements, 
                   Double_t x, Double_t y, Double_t z,
                  Double_t a1, Double_t a2, Double_t a3, 
                  Double_t a4, Double_t a5, Double_t a6) const; 
@@ -122,10 +129,18 @@ class AliMUONVGeometryBuilder : public TObject
     // data members
     TString     fTransformFileName; // the name file with transformations 
     TString     fSVMapFileName;     // the name file with sensitive volume map 
-    TObjArray*  fChambers; // the chambers which geometry will be built
-                           // by this builder
+    TObjArray*  fModuleGeometries;  // the modules geometries that will be built
+                                    // by this builder
     
-  ClassDef(AliMUONVGeometryBuilder,2) // MUON chamber geometry base class
+  ClassDef(AliMUONVGeometryBuilder,3) // MUON chamber geometry base class
 };
 
+// inline functions
+
+inline Int_t  AliMUONVGeometryBuilder::NofGeometries() const
+{ return fModuleGeometries->GetEntriesFast(); }
+
+inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
+{ return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
+
 #endif //ALI_MUON_V_GEOMETRY_BUILDER_H
diff --git a/MUON/AliMUONVGeometryDEIndexing.cxx b/MUON/AliMUONVGeometryDEIndexing.cxx
new file mode 100644 (file)
index 0000000..8f3fdba
--- /dev/null
@@ -0,0 +1,50 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONVGeometryDEIndexing
+// --------------------------------
+// The abstract singleton base class for definition of
+// the conversion between the detection element Ids and 
+// the indexing in a simple array.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include "AliMUONVGeometryDEIndexing.h"
+
+ClassImp(AliMUONVGeometryDEIndexing)
+
+//______________________________________________________________________________
+AliMUONVGeometryDEIndexing::AliMUONVGeometryDEIndexing()
+ : TObject()
+{ 
+// Standard/default constructor
+}
+
+//______________________________________________________________________________
+AliMUONVGeometryDEIndexing::~AliMUONVGeometryDEIndexing() {
+//
+}
+
+//______________________________________________________________________________
+Int_t AliMUONVGeometryDEIndexing::GetModuleId(Int_t detElemId)
+{
+// Get module Id from detection element Id
+// ---
+
+  return detElemId/100 - 1;
+}  
+
diff --git a/MUON/AliMUONVGeometryDEIndexing.h b/MUON/AliMUONVGeometryDEIndexing.h
new file mode 100644 (file)
index 0000000..3490f27
--- /dev/null
@@ -0,0 +1,40 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+//
+// Class AliMUONVGeometryDEIndexing
+// --------------------------------
+// The abstract singleton base class for definition of
+// the conversion between the detection element Ids and 
+// the indexing in a simple array.
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_V_GEOMETRY_DE_INDEXING_H
+#define ALI_MUON_V_GEOMETRY_DE_INDEXING_H
+
+#include <TObject.h>
+
+class AliMUONVGeometryDEIndexing;
+
+class AliMUONVGeometryDEIndexing : public TObject
+{
+  public:
+    AliMUONVGeometryDEIndexing();
+    virtual ~AliMUONVGeometryDEIndexing();
+
+    // static method
+    static  Int_t GetModuleId(Int_t detElemId);
+            
+    // methods
+    virtual Int_t GetDetElementIndex(Int_t detElemId) const = 0;
+    virtual Int_t GetDetElementId(Int_t detElemIndex) const = 0;
+
+    virtual Int_t GetNofDetElements() const = 0;
+    virtual void  SetNofDetElements(Int_t  nofDetElements) = 0;  
+
+  ClassDef(AliMUONVGeometryDEIndexing, 1) // MUON transformations store
+};
+
+#endif //ALI_MUON_DE_INDEXING_H
index d45f60d..a5ae1b0 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "AliConst.h" 
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONConstants.h"
 #include "AliMUONFactory.h"
 #include "AliMUONHit.h"
index d1da326..723eb5d 100644 (file)
@@ -34,7 +34,9 @@
 #include "AliMUONHit.h"
 #include "AliMUONTriggerCircuit.h"
 #include "AliMUONGeometryBuilder.h"    
+#include "AliMUONGeometryModule.h"     
 #include "AliMUONGeometrySVMap.h"      
+#include "AliMUONGeometryDetElement.h" 
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliMC.h"
@@ -161,8 +163,6 @@ void AliMUONv1::CreateMaterials()
   fGeometryBuilder->CreateMaterials();
 }
 
-#include "AliMUONChamberGeometry.h"    
-#include "AliMUONGeometryTransformStore.h"     
 //___________________________________________
 void AliMUONv1::Init()
 {
@@ -199,14 +199,15 @@ void AliMUONv1::Init()
        cout << "Chamber: " << i+1 << endl;
        cout << "===================" << endl; 
      
-       Chamber(i).GetGeometry()
-          ->GetTransformStore()->Print("");
+       // To do - move PrintLocalTransforms to geometryModule
+       //Chamber(i).GetGeometry()
+       //         ->GetDetElementStore()->PrintLocalTransforms();
  
        Chamber(i).GetGeometry()
           ->GetSVMap()->Print("");
      }
      cout << endl;
-   }  
+   } 
 }
 
 //__________________________________________________________________
@@ -374,13 +375,14 @@ void AliMUONv1::StepManager()
     }
     
     // Detection elements ids
-    AliMUONGeometryTransformStore* transforms
-      =  Chamber(iChamber-1).GetGeometry()->GetTransformStore();
-    const TGeoCombiTrans* kTransform
-      = transforms->FindBySensitiveVolume(CurrentVolumePath());
-      
+    AliMUONGeometryModule* geometry
+      = Chamber(iChamber-1).GetGeometry();
+
+    AliMUONGeometryDetElement* detElement
+      = geometry->FindBySensitiveVolume(CurrentVolumePath());
+
     Int_t detElemId = 0;
-    if (kTransform) detElemId = kTransform->GetUniqueID(); 
+    if (detElement) detElemId = detElement->GetUniqueID(); 
  
     if (!detElemId) {
       cerr << "Chamber id: "
index 032d815..d4f73c3 100644 (file)
@@ -39,7 +39,7 @@
 #include "AliMUONFactory.h"
 #include "AliMUONHit.h"
 #include "AliMUONTriggerCircuit.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliMC.h"
diff --git a/MUON/MUONLinkDefGeometry.h b/MUON/MUONLinkDefGeometry.h
new file mode 100644 (file)
index 0000000..996b35c
--- /dev/null
@@ -0,0 +1,21 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#pragma link C++ class  AliMUONStringIntMap+;
+#pragma link C++ class  AliMUONGeometryConstituent+;
+#pragma link C++ class  AliMUONGeometryEnvelope+;
+#pragma link C++ class  AliMUONGeometryEnvelopeStore+;
+#pragma link C++ class  AliMUONGeometryDetElement+;
+#pragma link C++ class  AliMUONGeometrySVMap+;
+#pragma link C++ class  AliMUONGeometryModule+;
+#pragma link C++ class  AliMUONVGeometryDEIndexing+;
+#pragma link C++ class  AliMUONVGeometryBuilder+;
+#pragma link C++ class  AliMUONGeometryBuilder+;
+#pragma link C++ class  AliMUONGeometryStore+;
+#pragma link C++ class  AliMUONGeometrySegmentation+;
+
+#endif
+
diff --git a/MUON/MUONTest.C b/MUON/MUONTest.C
new file mode 100644 (file)
index 0000000..e1ac69f
--- /dev/null
@@ -0,0 +1,41 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+// $Id$
+//
+// Macro for testing detection elements transformations
+// and segmentations
+// To be run from aliroot:
+// .L MUONTest.C
+// MUONTest(testNumber); > testN.out
+//     testNumber = 1  ...    
+//     testNumber = 2  ...   
+//     testNumber = 3  ...   
+//
+//  Author: I. Hrivnacova, IPN Orsay
+
+void MUONTest(Int_t testNumber)
+{
+  gAlice->Init("./Config_MUON_test.C");
+  cout << "Init done " << endl;
+
+  AliMUONTest test("./Config_MUON_test.C");
+  switch (testNumber) {
+    case 1: test.DetElemTransforms();       break;
+    case 2: test.PrintPadPositions1(); break; 
+    case 3: test.PrintPadPositions2(); break;
+    default: ;
+  }    
+}  
index 7c6dad4..a34b1e5 100644 (file)
@@ -7,16 +7,8 @@
 #pragma link C++ class AliMUONv1+; 
 #pragma link C++ class AliMUONv3+; 
 
-#pragma link C++ class AliMUONGeometryBuilder+; 
-#pragma link C++ class AliMUONVGeometryBuilder+; 
-#pragma link C++ class AliMUONGeometryConstituent+; 
-#pragma link C++ class AliMUONGeometryEnvelope+;
-#pragma link C++ class AliMUONGeometryEnvelopeStore+;
-#pragma link C++ class AliMUONGeometryTransformStore+;
-#pragma link C++ class AliMUONGeometrySVMap+;
-#pragma link C++ class AliMUONStringIntMap+;
-
-#pragma link C++ class AliMUONChamberGeometry+; 
+#pragma link C++ class AliMUONGeometryDEIndexing+;
+#pragma link C++ class AliMUONCommonGeometryBuilder+;
 #pragma link C++ class AliMUONSt1GeometryBuilder+; 
 #pragma link C++ class AliMUONSt1GeometryBuilderV2+; 
 #pragma link C++ class AliMUONSt2GeometryBuilder+; 
@@ -35,6 +27,7 @@
 #pragma link C++ class AliMUONSegmentationSlat+; 
 #pragma link C++ class AliMUONSegmentationSlatN+; 
 #pragma link C++ class AliMUONSt1Segmentation+; 
+#pragma link C++ class AliMUONSt12QuadrantSegmentation+; 
 
 #pragma link C++ class AliMUONResponse+; 
 #pragma link C++ class AliMUONResponseV0+; 
@@ -56,6 +49,8 @@
 #pragma link C++ class AliMUONDigitizerv2+; 
 #pragma link C++ class AliMUONSDigitizerv1+; 
 #pragma link C++ class AliMUONMerger+; 
+
+#pragma link C++ class AliMUONTest+; 
 #endif
 
 
index 3d170f7..a363c22 100644 (file)
@@ -1,5 +1,5 @@
-CH    1     pos:     0.0000      0.0000    533.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH    2     pos:     0.0000      0.0000    546.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    1     1     pos:     0.0000      0.0000    533.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    2     1     pos:     0.0000      0.0000    546.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
 DE  100    S01M    1   pos:     0.0000      0.0000      0.0000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
index ad9b50b..ea1f0f9 100644 (file)
@@ -1,5 +1,5 @@
-CH    1     pos:     0.0000      0.0000    533.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH    2     pos:     0.0000      0.0000    546.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    1     4     pos:     0.0000      0.0000    533.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    2     4     pos:     0.0000      0.0000    546.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
 DE  100    SQM1    1   pos:    -2.6000     -2.6000      3.2500   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 DE  151    SQM1    2   pos:     2.6000     -2.6000     -3.2500   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
index 22661a6..d021cd4 100644 (file)
@@ -1,5 +1,5 @@
-CH    3     pos:     0.0000      0.0000    678.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH    4     pos:     0.0000      0.0000    693.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    3     1     pos:     0.0000      0.0000    678.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH    4     1     pos:     0.0000      0.0000    693.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
 DE  300    S03M    1   pos:     0.0000      0.0000      0.0000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
index 8131644..7ac3e64 100644 (file)
@@ -1,7 +1,7 @@
-CH   11     pos:     0.0000      0.0000   1603.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH   12     pos:     0.0000      0.0000   1620.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH   13     pos:     0.0000      0.0000   1703.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-CH   14     pos:     0.0000      0.0000   1720.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH   11    18     pos:     0.0000      0.0000   1603.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH   12    18     pos:     0.0000      0.0000   1620.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH   13    18     pos:     0.0000      0.0000   1703.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+CH   14    18     pos:     0.0000      0.0000   1720.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 
 DE 1104    S0R5    1   pos:   155.0000      0.0000     -3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 DE 1154    S0L5    1   pos:  -155.0000      0.0000      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
index e04998a..5bfbefb 100644 (file)
@@ -1,3 +1,5 @@
+# $Id$
+
 SRCS:=  AliMUON.cxx \
         AliMUONConstants.cxx \
         AliMUONTriggerConstants.cxx \
diff --git a/MUON/libMUONgeometry.pkg b/MUON/libMUONgeometry.pkg
new file mode 100644 (file)
index 0000000..072c3f2
--- /dev/null
@@ -0,0 +1,23 @@
+# $Id$
+#
+# The framework classes for geometry construction
+# (not dependent on MUON) 
+#
+
+SRCS  =  AliMUONGeometryConstituent.cxx \
+        AliMUONGeometryEnvelope.cxx \
+        AliMUONGeometryEnvelopeStore.cxx \
+        AliMUONGeometryDetElement.cxx \
+        AliMUONGeometrySVMap.cxx \
+        AliMUONGeometryModule.cxx \
+        AliMUONVGeometryDEIndexing.cxx \
+        AliMUONVGeometryBuilder.cxx \
+        AliMUONGeometryBuilder.cxx \
+        AliMUONGeometryStore.cxx \
+        AliMUONGeometrySegmentation.cxx 
+
+HDRS =  $(SRCS:.cxx=.h) 
+
+EINCLUDE:= RAW MUON/mapping
+
+DHDR:= MUONLinkDefGeometry.h
index 931d325..b58f605 100644 (file)
@@ -1,3 +1,4 @@
+# $Id$
 #
 # mapping 
 #
index bcdd3b1..92fa4df 100644 (file)
@@ -1,3 +1,5 @@
+# $Id$
+
 FSRCS= extrap.F
 
 SRCS:= AliMUONClusterReconstructor.cxx \
@@ -38,4 +40,4 @@ HDRS:= $(SRCS:.cxx=.h)
 DHDR:= MUONrecLinkDef.h
 
 
-EINCLUDE := RAW MUON/mapping
\ No newline at end of file
+EINCLUDE := RAW MUON/mapping
index 5a4553a..24d13b4 100644 (file)
@@ -1,12 +1,8 @@
+# $Id$
+
 SRCS:= AliMUONv0.cxx AliMUONv1.cxx AliMUONv3.cxx \
-       AliMUONGeometryBuilder.cxx \
-       AliMUONVGeometryBuilder.cxx \
-       AliMUONGeometryConstituent.cxx \
-       AliMUONGeometryEnvelope.cxx \
-       AliMUONGeometryEnvelopeStore.cxx \
-       AliMUONGeometryTransformStore.cxx \
-       AliMUONGeometrySVMap.cxx \
-       AliMUONChamberGeometry.cxx \
+       AliMUONGeometryDEIndexing.cxx \
+       AliMUONCommonGeometryBuilder.cxx \
        AliMUONSt1GeometryBuilder.cxx \
        AliMUONSt1GeometryBuilderV2.cxx \
        AliMUONSt2GeometryBuilder.cxx \
@@ -24,6 +20,7 @@ SRCS:= AliMUONv0.cxx AliMUONv1.cxx AliMUONv3.cxx \
        AliMUONSegmentationSlat.cxx \
        AliMUONSegmentationSlatN.cxx \
        AliMUONSt1Segmentation.cxx \
+       AliMUONSt12QuadrantSegmentation.cxx \
        AliMUONResponse.cxx \
        AliMUONResponseV0.cxx \
        AliMUONSt1Response.cxx \
@@ -42,7 +39,8 @@ SRCS:= AliMUONv0.cxx AliMUONv1.cxx AliMUONv3.cxx \
        AliMUONDigitizerv1.cxx \
        AliMUONDigitizerv2.cxx \
        AliMUONSDigitizerv1.cxx \
-       AliMUONMerger.cxx 
+       AliMUONMerger.cxx \
+       AliMUONTest.cxx
 
 HDRS:= $(SRCS:.cxx=.h)