]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpGraphContext.cxx
Fix in AliMpSectorSegmentation::PadByPosition;
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpGraphContext.cxx
index fc5772c23624a23b67661c7ab37a73d63df35541..bbd96ba5ca40293a4b7dc54cac8e60344bfc02d6 100755 (executable)
@@ -1,58 +1,79 @@
+/**************************************************************************
+ * 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$
+// $MpId: AliMpGraphContext.cxx,v 1.11 2006/05/24 13:58:32 ivana Exp $
 // Category: graphics
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMpGraphContext
 // -----------------------
 // Class describing a the correspondance between a given area
 // in pad, and a zone of real (cm) position
-//
+// Included in AliRoot: 2003/05/02
 // Author: David GUEZ, IPN Orsay
-
-#include <TError.h>
+//-----------------------------------------------------------------------------
 
 #include "AliMpGraphContext.h"
 
+/// \cond CLASSIMP
 ClassImp(AliMpGraphContext)
+/// \endcond
 
-AliMpGraphContext *AliMpGraphContext::fgInstance = 0;
-GraphContextVector AliMpGraphContext::fgStack;
-#ifdef WITH_ROOT
+AliMpGraphContext* AliMpGraphContext::fgInstance = 0;
+TObjArray          AliMpGraphContext::fgStack;
 Int_t              AliMpGraphContext::fgStackSize = 0;
-#endif
 
 //_____________________________________________________________________________
 AliMpGraphContext::AliMpGraphContext():
   TObject(),
+  fColor(20),
   fPadPosition(TVector2(0.5,0.5)),
   fPadDimensions(TVector2(0.49,0.49)),
   fRealPosition(TVector2(0.,0.)),
   fRealDimensions(TVector2(1,1))
 {
-// private constructor
-
-  fColor = 20;
-  // default constructor (private)
+/// Default constructor (private)
 }
 
 //_____________________________________________________________________________
 AliMpGraphContext::AliMpGraphContext(const AliMpGraphContext& right) 
-  : TObject(right) 
+  : TObject(right),
+    fColor(right.fColor),
+    fPadPosition(right.fPadPosition),
+    fPadDimensions(right.fPadDimensions),
+    fRealPosition(right.fRealPosition),
+    fRealDimensions(right.fRealDimensions)     
 {
-// protected copy constructor
-
-  Fatal("AliMpGraphContext", "Copy constructor not provided.");
+/// Copy constructor
 }
 
 //_____________________________________________________________________________
 AliMpGraphContext& 
 AliMpGraphContext::operator=(const AliMpGraphContext& right)
 {
-// protected assignement operator
+/// Protected assignment operator
 
-  // check assignement to self
+  // check assignment to self
   if (this == &right) return *this;
 
-  Fatal("operator =", "Assignement operator not provided.");
+  fColor = right.fColor;
+  fPadPosition = right.fPadPosition;
+  fPadDimensions = right.fPadDimensions;
+  fRealPosition = right.fRealPosition;
+  fRealDimensions = right.fRealDimensions;
     
   return *this;  
 }    
@@ -60,7 +81,8 @@ AliMpGraphContext::operator=(const AliMpGraphContext& right)
 //_____________________________________________________________________________
 AliMpGraphContext *AliMpGraphContext::Instance()
 {
-  // return or create a unique instance of this class
+  /// Return or create a unique instance of this class
+  
   if (fgInstance) return fgInstance;
   fgInstance = new AliMpGraphContext;
   return fgInstance;
@@ -69,7 +91,8 @@ AliMpGraphContext *AliMpGraphContext::Instance()
 //_____________________________________________________________________________
 TVector2 AliMpGraphContext::RealToPad(const TVector2 &position) const
 {
-  // transform a real position into its equivalent position in the pad
+  /// Transform a real position into its equivalent position in the pad
+  
   Double_t x=position.X();
   Double_t y=position.Y();
   x-= (fRealPosition.X()-fRealDimensions.X());
@@ -91,8 +114,9 @@ void AliMpGraphContext::RealToPad(const TVector2 &position,
                              TVector2 &padPosition,
                              TVector2 &padDimensions) const
 {
-  // transform the real area (position,dimensions) to
-  // its equivalent pad area
+  /// Transform the real area (position,dimensions) to
+  /// its equivalent pad area
+
   padPosition = RealToPad(position);
   padDimensions = 
     TVector2(dimensions.X()*fPadDimensions.X()/fRealDimensions.X(),
@@ -104,41 +128,27 @@ void AliMpGraphContext::RealToPad(const TVector2 &position,
 void AliMpGraphContext::SetPadPosForReal(const TVector2 &position,
                                     const TVector2 &dimensions)
 {
-  // Set the pad area from the actual one
-  // corresponding to the given real area.
+  /// Set the pad area from the actual one
+  /// corresponding to the given real area.
+
   RealToPad(position,dimensions,fPadPosition,fPadDimensions);
 }
 
 //_____________________________________________________________________________
 void AliMpGraphContext::Push() const
 {
-  // Store the current configuration
-  AliMpGraphContext *save = new AliMpGraphContext(*this);
+  /// Store the current configuration
 
-#ifdef WITH_STL
-  fgStack.push_back(save);
-#endif
+  AliMpGraphContext *save = new AliMpGraphContext(*this);
 
-#ifdef WITH_ROOT
   fgStack.AddAt(save, fgStackSize++);
-#endif
 }
 
 //_____________________________________________________________________________
 void AliMpGraphContext::Pop()
 {
-// Pops object from the stack.
-#ifdef WITH_STL
-  // restore the last saved configuration
-  if (!fgStack.empty()){
-    AliMpGraphContext *obj = fgStack.back();
-    *this = *obj;
-    fgStack.pop_back();
-    delete obj;
-  }
-#endif
+/// Pop an object from the stack.
 
-#ifdef WITH_ROOT
   // restore the last saved configuration
   if ( fgStackSize ){
     AliMpGraphContext *obj 
@@ -147,5 +157,4 @@ void AliMpGraphContext::Pop()
     fgStack.RemoveAt(fgStackSize);
     delete obj;
   }
-#endif
 }