]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpTriggerSegmentation.cxx
Adding new libraries
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerSegmentation.cxx
index b2eb4ae8380714b1040b1139bf8d94483ca4000f..fbb5adfcc16bd36cff9e60c9609adb2566dc9fd6 100644 (file)
@@ -25,7 +25,6 @@
 #include "AliMpMotifType.h"
 #include "AliMpPCB.h"
 #include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpTrigger.h"
 
 /// 
@@ -44,24 +43,27 @@ ClassImp(AliMpTriggerSegmentation)
 //_____________________________________________________________________________
 AliMpTriggerSegmentation::AliMpTriggerSegmentation() 
 : AliMpVSegmentation(),
-fkSlat(0),
-fNofStrips(0)
+  fkSlat(0),
+  fIsOwner(false),
+  fNofStrips(0)
 {
-  //
-  // Default ctor. Not to be used really.
-  //
+  ///
+  /// Default ctor. Not to be used really.
+  ///
   AliDebug(1,Form("this=%p Empty ctor",this));
 }
 
 //_____________________________________________________________________________
-AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat) 
+AliMpTriggerSegmentation::AliMpTriggerSegmentation(
+                               const AliMpTrigger* slat, Bool_t own) 
 : AliMpVSegmentation(), 
   fkSlat(slat),
+  fIsOwner(own),
   fNofStrips(0)
 {
-  //
-  // Normal ctor.
-  //
+  ///
+  /// Normal ctor.
+  ///
   AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
   
   // Compute the number of strips.
@@ -82,55 +84,59 @@ AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
   }
 }
 
-//______________________________________________________________________________
-AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right) 
-    : AliMpVSegmentation(right),
-      fkSlat(right.fkSlat),
-      fNofStrips(right.fNofStrips)
-{  
-/// Protected copy constructor (not implemented)
-
-  AliFatal("Copy constructor not provided.");
-}
-
 //_____________________________________________________________________________
 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
 {
-  //
-  // Dtor (empty).
-  //
+  ///
+  /// Dtor (empty).
+  ///
+
+  if ( fIsOwner ) delete fkSlat;
+
   AliDebug(1,Form("this=%p",this));                    
 }
 
-//______________________________________________________________________________
-AliMpTriggerSegmentation& 
-AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
+//_____________________________________________________________________________
+AliMpVPadIterator*
+AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
 {
-/// Protected assignement operator (not implemented)
-
-  // check assignement to self
-  if (this == &right) return *this;
-
-  AliFatal("Assignement operator not provided.");
-    
-  return *this;  
-}    
+  ///
+  /// Returns an iterator to loop over the pad contained within given area.
+  /// Not implemented for trigger.
+  AliError("Not implemented for trigger");
+  return 0;
+}
 
 //_____________________________________________________________________________
 AliMpVPadIterator*
-AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
+AliMpTriggerSegmentation::CreateIterator() const
 {
-  //
-  // Returns an iterator to loop over the pad contained within given area.
-  // Not implemented for trigger.
+  ///
+  /// Returns an iterator to loop over all the pads
+  /// Not implemented for trigger.
+  AliError("Not implemented for trigger");
   
   return 0;
 }
 
+//_____________________________________________________________________________
+Int_t 
+AliMpTriggerSegmentation::GetNeighbours(const AliMpPad& /*pad*/, 
+                                        TObjArray& /*neighbours*/,
+                                        Bool_t /*includeSelf*/,
+                                        Bool_t /*includeVoid*/) const
+{
+  /// not implemented.
+  AliError("Not implemented for trigger");
+  return 0;
+}
+
 //_____________________________________________________________________________
 TVector2
 AliMpTriggerSegmentation::Dimensions() const
 {
+/// Return dimensions
+
   return Slat()->Dimensions();
 }
 
@@ -138,6 +144,8 @@ AliMpTriggerSegmentation::Dimensions() const
 void 
 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
 {
+/// Fill the array ecn with all manuIds
+
   Slat()->GetAllLocalBoardNumbers(ecn);
 }
 
@@ -145,7 +153,7 @@ AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
 const char*
 AliMpTriggerSegmentation::GetName() const
 {
-  // Name of that segmentation = TriggerSegmentation + slatName
+  /// Name of that segmentation = TriggerSegmentation + slatName
   TString name("TriggerSegmentation");
   if ( fkSlat) 
   {
@@ -159,10 +167,10 @@ AliMpTriggerSegmentation::GetName() const
 Bool_t
 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
 {
-  //
-  // Test if this slat has a pad located at the position referenced
-  // by the integer indices.
-  //
+  ///
+  /// Test if this slat has a pad located at the position referenced
+  /// by the integer indices.
+  ///
   
   return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
 }
@@ -171,9 +179,9 @@ AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
 Int_t 
 AliMpTriggerSegmentation::MaxPadIndexX() const
 {
-  //
-  // Returns the value of the largest pad index in x-direction.
-  //
+  ///
+  /// Returns the value of the largest pad index in x-direction.
+  ///
   
   return fkSlat->GetNofPadsX()-1;
 }
@@ -182,9 +190,9 @@ AliMpTriggerSegmentation::MaxPadIndexX() const
 Int_t 
 AliMpTriggerSegmentation::MaxPadIndexY() const
 {
-  //
-  // Returns the value of the largest pad index in y-direction.
-  //
+  ///
+  /// Returns the value of the largest pad index in y-direction.
+  ///
   
   return fkSlat->GetMaxNofPadsY()-1;
 }
@@ -194,22 +202,21 @@ AliMpPad
 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location, 
                                         Bool_t warning) const
 {
-  //
-  // Returns the pad specified by its location, where location is the 
-  // pair (ManuID,ManuChannel).
-  // If warning=kTRUE and the pad does not exist, a warning message is 
-  // printed.
-  //
-  // AliMpPad::Invalid() is returned if there's no pad at the given location.
-  //
+  ///
+  /// Returns the pad specified by its location, where location is the 
+  /// pair (ManuID,ManuChannel).
+  /// If warning=kTRUE and the pad does not exist, a warning message is 
+  /// printed.
+  ///
+  /// AliMpPad::Invalid() is returned if there's no pad at the given location.
+  ///
   AliMpPad pad;
   AliMpIntPair invloc;
   
   for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
   {
-    const AliMpSlat* slat = fkSlat->GetLayer(i);
-    AliMpSlatSegmentation seg(slat);
-    AliMpPad pi = seg.PadByLocation(location,kFALSE);
+    AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
+    AliMpPad pi = seg->PadByLocation(location,kFALSE);
     if ( pi.IsValid() ) 
     {
       if ( !pad.IsValid() )
@@ -236,23 +243,22 @@ AliMpPad
 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices, 
                                     Bool_t warning) const
 {
-  //
-  // Returns the pad specified by its integer indices.
-  // If warning=kTRUE and the pad does not exist, a warning message is 
-  // printed.
-  //
-  // AliMpPad::Invalid() is returned if there's no pad at the given location.
-  //
-  //  
+  ///
+  /// Returns the pad specified by its integer indices.
+  /// If warning=kTRUE and the pad does not exist, a warning message is 
+  /// printed.
+  ///
+  /// AliMpPad::Invalid() is returned if there's no pad at the given location.
+  ///
+  ///  
  
   AliMpPad pad;
   AliMpIntPair invloc;
   
   for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
   {
-    const AliMpSlat* slat = fkSlat->GetLayer(i);
-    AliMpSlatSegmentation seg(slat);
-    AliMpPad pi = seg.PadByIndices(indices,kFALSE);
+    AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
+    AliMpPad pi = seg->PadByIndices(indices,kFALSE);
     if ( pi.IsValid() ) 
     {      
       if ( !pad.IsValid() )
@@ -280,21 +286,20 @@ AliMpPad
 AliMpTriggerSegmentation::PadByPosition(const TVector2& position, 
                                      Bool_t warning) const
 {
-  //
-  // Returns the pad specified by its (floating point) position.
-  // If warning=kTRUE and the pad does not exist, a warning message is 
-  // printed.
-  //
-  // AliMpPad::Invalid() is returned if there's no pad at the given location.
-  //
+  ///
+  /// Returns the pad specified by its (floating point) position.
+  /// If warning=kTRUE and the pad does not exist, a warning message is 
+  /// printed.
+  ///
+  /// AliMpPad::Invalid() is returned if there's no pad at the given location.
+  ///
   AliMpPad pad;
   AliMpIntPair invloc;
   
   for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
   {
-    const AliMpSlat* slat = fkSlat->GetLayer(i);
-    AliMpSlatSegmentation seg(slat);
-    AliMpPad pi = seg.PadByPosition(position,kFALSE);
+    AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
+    AliMpPad pi = seg->PadByPosition(position,kFALSE);
     if ( pi.IsValid() ) 
     {
       if ( !pad.IsValid() )
@@ -318,9 +323,11 @@ AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
 }
 
 //_____________________________________________________________________________
-AliMpPlaneType
+AliMp::PlaneType
 AliMpTriggerSegmentation::PlaneType() const
 {
+  /// Return plane type
+
   return Slat()->PlaneType();
 }
 
@@ -328,9 +335,9 @@ AliMpTriggerSegmentation::PlaneType() const
 const AliMpTrigger* 
 AliMpTriggerSegmentation::Slat() const
 {
-  //
-  // Returns the pointer to the referenced slat.
-  //
+  ///
+  /// Returns the pointer to the referenced slat.
+  ///
   
   return fkSlat;
 }