]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Detection elements segmentations now derived from the
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Jan 2005 11:09:31 +0000 (11:09 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Jan 2005 11:09:31 +0000 (11:09 +0000)
  AliMUONVGeometryDESegmentation base class
- Bool_t return type in segmentation GetPadI/C(...) makes possible to detect
  not existing pads
- Uncommented function AliMUONVGeometryBuilder::MapSV for generating
  sensitive volume maps
  (required new version of VMC in Root (v1-0 or more for geant3) )
(Ivana)

MUON/AliMUONGeometrySVMap.cxx
MUON/AliMUONGeometrySegmentation.cxx
MUON/AliMUONSt12QuadrantSegmentation.cxx
MUON/AliMUONSt12QuadrantSegmentation.h
MUON/AliMUONSt345SlatSegmentation.cxx
MUON/AliMUONSt345SlatSegmentation.h
MUON/AliMUONVGeometryBuilder.cxx
MUON/libMUONgeometry.pkg

index 6761d538e5f2fd149356aaf4e82a8668095fec4f..43f063c8e336e28a4e45fec4fdfb2c782074dd07 100644 (file)
@@ -134,13 +134,9 @@ void  AliMUONStringIntMap::Clear()
 // Deletes the elements
 // ---
 
-  cout << "######### clearing map " << endl;
-
   fNofItems = 0;
   fFirstArray.Delete();
   fSecondArray.Reset();
-
-  cout << "######### clearing map done " << endl;
 }  
     
 //______________________________________________________________________________
index 83a4bd796d66fe5052b551d5ea37a2b1ace93404..a3210879a2b71fd8c53b77abfe3d82c179fd8411 100644 (file)
 //
 // Author:Ivana Hrivnacova, IPN Orsay
 
-#include "AliSegmentation.h"
 #include "AliLog.h"
 
 #include "AliMUONGeometrySegmentation.h"
+#include "AliMUONVGeometryDESegmentation.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryDetElement.h"
 #include "AliMUONGeometryStore.h"
@@ -119,8 +119,8 @@ Bool_t AliMUONGeometrySegmentation::Notify(Int_t detElemId) const
       return false;
     }     
 
-    AliSegmentation* segmentation 
-      = (AliSegmentation*) fDESegmentations->Get(detElemId);
+    AliMUONVGeometryDESegmentation* segmentation 
+      = (AliMUONVGeometryDESegmentation*) fDESegmentations->Get(detElemId);
     if (!segmentation) {
       AliError(Form("Segmentation for detection element %d not defined",
                      detElemId));
@@ -141,7 +141,7 @@ Bool_t AliMUONGeometrySegmentation::Notify(Int_t detElemId) const
 
 //______________________________________________________________________________
 void AliMUONGeometrySegmentation::Add(Int_t detElemId, 
-                                      AliSegmentation* segmentation)
+                                      AliMUONVGeometryDESegmentation* segmentation)
 {
 // Add detection element segmentation
 // ---
@@ -156,8 +156,8 @@ void AliMUONGeometrySegmentation::SetPadSize(Float_t p1, Float_t p2)
 // ---
 
   for (Int_t i=0; i<fDESegmentations->GetNofEntries(); i++) {
-     AliSegmentation* segmentation
-       = (AliSegmentation*)fDESegmentations->GetEntry(i);
+     AliMUONVGeometryDESegmentation* segmentation
+       = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetEntry(i);
      segmentation->SetPadSize(p1, p2);
   }   
 }
@@ -169,8 +169,8 @@ void AliMUONGeometrySegmentation::SetDAnod(Float_t d)
 // ---
 
   for (Int_t i=0; i<fDESegmentations->GetNofEntries(); i++) {
-     AliSegmentation* segmentation
-       = (AliSegmentation*)fDESegmentations->GetEntry(i);
+     AliMUONVGeometryDESegmentation* segmentation
+       = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetEntry(i);
      segmentation->SetDAnod(d);
   }   
 }
@@ -190,35 +190,41 @@ Float_t AliMUONGeometrySegmentation::GetAnod(Int_t detElemId, Float_t xhit) cons
 }
 
 //______________________________________________________________________________
-void  AliMUONGeometrySegmentation::GetPadI(Int_t detElemId,
+Bool_t  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;
+  if (!Notify(detElemId)) return false;
+  
+  if (!fCurrentSegmentation->HasPad(xg, yg, zg)) return false;
 
   Float_t xl, yl, zl;
   fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); 
 
   fCurrentSegmentation->GetPadI(xl, yl, zl, ix, iy);
+  return true;
 }
                       
 //______________________________________________________________________________
-void  AliMUONGeometrySegmentation::GetPadC(Int_t detElemId,
+Bool_t  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;
+  if (!Notify(detElemId)) return false;
+
+  if (!fCurrentSegmentation->HasPad(ix, iy)) return false;
 
   Float_t xl, yl, zl;
   fCurrentSegmentation->GetPadC(ix, iy, xl , yl, zl);
 
   fGeometryModule->Local2Global(detElemId, xl, yl, zl, xg, yg, zg); 
+  return true;
 }
 
 
index 98a3a9c58e3c5ca22fb9161f08d163397bb923d0..3979b9ea1dfda1979d2ac7e9ed266921d88f8175 100644 (file)
@@ -49,7 +49,7 @@ const Float_t  AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1;
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
                                        AliMpStationType stationType,
                                       AliMpPlaneType planeType) 
-: AliSegmentation(),
+: AliMUONVGeometryDESegmentation(),
   fSector(0),
   fSectorSegmentation(0),
   fSectorIterator(0),
@@ -87,7 +87,7 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
 
 //______________________________________________________________________________
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() 
-: AliSegmentation(),
+: AliMUONVGeometryDESegmentation(),
   fSector(0),
   fSectorSegmentation(0),
   fSectorIterator(0),
@@ -115,7 +115,7 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation()
 
 //______________________________________________________________________________
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs) 
-  : AliSegmentation(rhs)
+  : AliMUONVGeometryDESegmentation(rhs)
 {
 // Copy constructor
   AliFatal("Copy constructor is not implemented.");
@@ -187,6 +187,29 @@ void AliMUONSt12QuadrantSegmentation::SetDAnod(Float_t d)
   fWireD = d;
 }
 
+//______________________________________________________________________________
+Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*z*/)
+{ 
+// Returns true if a pad exists in the given position
+
+  AliMpPad pad = fSectorSegmentation
+               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+
+  return pad.IsValid();
+}  
+
+
+//______________________________________________________________________________
+Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Int_t ix, Int_t iy)
+{
+// Returns true if a pad with given indices exists
+
+  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), false);
+
+  return pad.IsValid();
+}  
+
+
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
 {
@@ -220,7 +243,7 @@ void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y,
 // ---
 
   AliMpPad pad = fSectorSegmentation
-               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true);
 
   ix = pad.GetIndices().GetFirst();
   iy = pad.GetIndices().GetSecond();
@@ -245,7 +268,7 @@ void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy,
 // If there is no pad, x = 0., y = 0. are returned.
 // ---
 
-  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy));
+  AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true);
 
   x = pad.Position().X() * fgkLengthUnit;
   y = pad.Position().Y() * fgkLengthUnit;
@@ -311,20 +334,38 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpy(Int_t isector) const
 Int_t AliMUONSt12QuadrantSegmentation::Npx() const
 {
 // Maximum number of Pads in x
+// hard coded for the time being
 // ---
 
   //Fatal("Npx", "Not yet implemented.");
-  return 142; //hard coded for the time being
+  switch (fSector->GetDirection()) {
+    case kX:
+      return 142;
+    case kY:
+      return 108;
+    default:
+      AliError("Unknown sector direction");
+      return 0;  
+  }      
 }
 
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::Npy() const
 {
 // Maximum number of Pads in y
+// hard coded for the time being
 // ---
 
   //Fatal("Npy", "Not yet implemented.");
-  return 213; //hard coded for the time being
+  switch (fSector->GetDirection()) {
+    case kX:
+      return 160;
+    case kY:
+      return 213;
+    default:
+      AliError("Unknown sector direction");
+      return 0;  
+  }    
 }
 
 //______________________________________________________________________________
index 6575c9ebafd672c0fbcbd91d94e2422afbf2232a..fe8b2e6d9aadaa015b9359ecf6d67044610f3ad2 100644 (file)
@@ -17,7 +17,7 @@
 #include "AliMpStationType.h"
 #include "AliMpPlaneType.h"
 
-#include "AliSegmentation.h"
+#include "AliMUONVGeometryDESegmentation.h"
 
 class TObjArray;
 
@@ -28,11 +28,11 @@ class AliMpPad;
 
 class AliMUONChamber;
 
-class AliMUONSt12QuadrantSegmentation : public AliSegmentation 
+class AliMUONSt12QuadrantSegmentation : public AliMUONVGeometryDESegmentation 
 {
   public:
     AliMUONSt12QuadrantSegmentation(AliMpStationType stationType,
-                                   AliMpPlaneType planeType);
+                                    AliMpPlaneType planeType);
     AliMUONSt12QuadrantSegmentation();
     
     virtual ~AliMUONSt12QuadrantSegmentation();
@@ -48,6 +48,13 @@ class AliMUONSt12QuadrantSegmentation : public AliSegmentation
     virtual void SetDAnod(Float_t D);
                        // Anode Pitch
 
+    // Check if pad exists
+    //
+    virtual Bool_t  HasPad(Float_t x, Float_t y, Float_t z); 
+                       // Returns true if a pad exists in the given position
+    virtual Bool_t  HasPad(Int_t ix, Int_t iy);
+                       // Returns true if a pad with given indices exists
+
     // Transform from pad (wire) to real coordinates and vice versa
     //
     virtual Float_t GetAnod(Float_t xhit) const;
index 6f39ad8acee6bc046c1c3eb197238001b6a28117..6a45aeee983094e0cb7e2b97702757e152a94464 100644 (file)
@@ -35,7 +35,7 @@ ClassImp(AliMUONSt345SlatSegmentation)
 
 
 AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation() 
-  : AliSegmentation(),
+  : AliMUONVGeometryDESegmentation(),
     fId(0),
     fDpx(0),
     fDpy(0),
@@ -61,7 +61,7 @@ AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation()
   (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;       
 }
 //----------------------------------------------------------------------
-AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs) : AliSegmentation(rhs)
+AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs) : AliMUONVGeometryDESegmentation(rhs)
 {
   AliFatal("Not implemented.");
 }
index 68afee9e009e5f6c38f2ac6e06028d50495d9499..16c37aaa5b40eead2500cb60aa80dc6c7d4c1c5b 100644 (file)
 //  and the differents PCB densities. 
 //*********************************************************
 
-#include  "AliSegmentation.h"
+#include  "AliMUONVGeometryDESegmentation.h"
 
 class TArrayF;
 class TArrayI;
 
-class AliMUONSt345SlatSegmentation : public AliSegmentation 
+class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation 
 {
  public:
     AliMUONSt345SlatSegmentation();
@@ -34,6 +34,9 @@ class AliMUONSt345SlatSegmentation : public AliSegmentation
     virtual void     FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy);  // Initialisation for pad iteration
     virtual void     FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy);
 
+    virtual Bool_t   HasPad(Float_t /*x*/, Float_t /*y*/, Float_t /*z*/) { return true; }
+    virtual Bool_t   HasPad(Int_t /*ix*/, Int_t /*iy*/) { return true; }
+
     virtual Float_t  GetAnod(Float_t xhit) const;  // Anod wire coordinate closest to xhit
     virtual void     GetPadI(Float_t x ,Float_t y ,Int_t   &ix,Int_t &iy);  // Transform from pad to real coordinates
     virtual void     GetPadI(Float_t x, Float_t y , Float_t z, Int_t &ix, Int_t &iy);
index 0b8f3de117ce497806c5d76e8d893dcc19ffc0e4..72d0a4818df0f347a770c79044842db12358ffd3 100644 (file)
@@ -129,7 +129,6 @@ AliMUONVGeometryBuilder::operator = (const AliMUONVGeometryBuilder& rhs)
   return path;
 }  
 
-/*
 //______________________________________________________________________________
 void AliMUONVGeometryBuilder::MapSV(const TString& path0, 
                                     const TString& volName, Int_t detElemId) const
@@ -147,8 +146,7 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0,
     TString volName(path0(npos1, npos2-npos1));  
     
     // Check if it is sensitive volume
-    Int_t moduleId = AliMUONVGeometryDEIndexing::Instance()
-                     ->GetModuleId(detElemId);
+    Int_t moduleId = AliMUONVGeometryDEIndexing::GetModuleId(detElemId);
     AliMUONGeometryModule* geometry = GetGeometry(moduleId);
     if (geometry->IsSensitiveVolume(volName)) {
       //cout << ".. adding to the map  " 
@@ -169,20 +167,6 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0,
     MapSV(path, newName, detElemId);
   }
 }     
-*/
-
-//______________________________________________________________________________
-void AliMUONVGeometryBuilder::MapSV(const TString& /*path0*/, 
-                                    const TString& /*volName*/, 
-                                   Int_t /*detElemId*/) const
-{
-// Update the path with all daughters volumes recursively
-// and map it to the detection element Id if it is a sensitive volume
-// ---
-
-  AliWarning("Not yet available");
-}     
-
 
 //______________________________________________________________________________
 void AliMUONVGeometryBuilder::FillData(Int_t moduleId, Int_t nofDetElements,
index 072c3f26791180c73576ed6a9694df4a4c1a595b..22ecea4758f8183901dd0ab84aaf36e8427a73a7 100644 (file)
@@ -14,6 +14,7 @@ SRCS  =  AliMUONGeometryConstituent.cxx \
         AliMUONVGeometryBuilder.cxx \
         AliMUONGeometryBuilder.cxx \
         AliMUONGeometryStore.cxx \
+        AliMUONVGeometryDESegmentation.cxx \
         AliMUONGeometrySegmentation.cxx 
 
 HDRS =  $(SRCS:.cxx=.h)