]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpMotifReader.cxx
- Added class for Global Crate object
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifReader.cxx
index ae4d00e88c3470d4810122886dbf0aa48b1da5f9..d3954a1ccd48c585651adad2abdbc60330c6c78a 100644 (file)
  **************************************************************************/
 
 // $Id$
-// $MpId: AliMpMotifReader.cxx,v 1.8 2006/03/17 11:38:06 ivana Exp $
+// $MpId: AliMpMotifReader.cxx,v 1.10 2006/05/24 13:58:41 ivana Exp $
 // Category: sector
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMpMotifReader
 // -------------------
 // Class that takes care of reading the sector data.
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMpFiles.h"
 #include "AliMpMotifReader.h"
@@ -31,7 +33,6 @@
 #include "AliMpMotifType.h"
 #include "AliMpConnection.h"
 #include "AliMpIntPair.h"
-#include "AliMpDirection.h"
 
 #include "AliLog.h"
 
   #include <sstream>
 #endif
 
+/// \cond CLASSIMP
 ClassImp(AliMpMotifReader)
+/// \endcond
 
 //_____________________________________________________________________________
-AliMpMotifReader::AliMpMotifReader(AliMpStationType station, 
-                                   AliMpPlaneType plane) 
+AliMpMotifReader::AliMpMotifReader(AliMp::StationType station, 
+                                   AliMp::PlaneType plane) 
   : TObject(),
     fStationType(station),
     fPlaneType(plane)
@@ -59,49 +62,18 @@ AliMpMotifReader::AliMpMotifReader(AliMpStationType station,
 //_____________________________________________________________________________
 AliMpMotifReader::AliMpMotifReader() 
   : TObject(),
-    fStationType(kStation1),
-    fPlaneType(kBendingPlane)
+    fStationType(AliMp::kStation1),
+    fPlaneType(AliMp::kBendingPlane)
 {
 /// Default constructor
 }
 
-//_____________________________________________________________________________
-AliMpMotifReader::AliMpMotifReader(const AliMpMotifReader& right) 
-  : TObject(right) 
-{
-/// Protected copy constructor (not provided)
-
-  Fatal("AliMpMotifReader", "Copy constructor not provided.");
-}
-
 //_____________________________________________________________________________
 AliMpMotifReader::~AliMpMotifReader() 
 {
 /// Destructor  
 }
 
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpMotifReader& AliMpMotifReader::operator=(const AliMpMotifReader& right)
-{
-/// Protected assignment operator (not provided)
-
-  // check assignment to self
-  if (this == &right) return *this;
-
-  Fatal("operator =", "Assignment operator not provided.");
-    
-  return *this;  
-}    
-
-//
-// private methods
-//
-
-
 //
 // public methods
 //
@@ -119,7 +91,7 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
   TString padPosFileName(AliMpFiles::PadPosFilePath(fStationType, 
                                                     fPlaneType, motifTypeId));
   ifstream padPos(padPosFileName);
-  AliDebugStream(1) << "Opening file " << padPosFileName << endl;
+  AliDebugStream(2) << "Opening file " << padPosFileName << endl;
 
   PadMapType positions;
 
@@ -155,11 +127,11 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
 
   TString bergToGCFileName
     = AliMpFiles::BergToGCFilePath(fStationType);
-  AliDebugStream(1) << "Opening file " << bergToGCFileName << endl;
+  AliDebugStream(2) << "Opening file " << bergToGCFileName << endl;
 
   ifstream bergToGCFile(bergToGCFileName);
   const Int_t knbergpins = 
-    (fStationType == kStation1 || fStationType == kStation2 ) ? 80 : 100;
+    (fStationType == AliMp::kStation1 || fStationType == AliMp::kStation2 ) ? 80 : 100;
   // Station1 & 2 Bergstak connectors have 80 pins, while for stations
   // 3, 4 and 5 they have 100 pins.
   Int_t gassiChannel[100];
@@ -180,7 +152,7 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
   TString motifTypeFileName(AliMpFiles::MotifFilePath(fStationType, 
                                                       fPlaneType, motifTypeId));
   ifstream motif(motifTypeFileName);
-  AliDebugStream(1) << "Opening file " << motifTypeFileName << endl;
+  AliDebugStream(2) << "Opening file " << motifTypeFileName << endl;
 
   Int_t nofPadsX=0;
   Int_t nofPadsY=0;
@@ -280,6 +252,23 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
   return motifType;
 }
 
+//_____________________________________________________________________________
+TString 
+AliMpMotifReader::MotifSpecialName(const TString& motifID, Double_t scale)
+{
+  /// Build the name taking into the scale, if not 1.0
+  TString id;
+  
+  if ( scale != 1.0 )
+  {
+    id = Form("%s-%e",motifID.Data(),scale);
+  }
+  else
+  {
+    id = motifID;
+  }
+  return id;
+}
 
 //_____________________________________________________________________________
 AliMpMotifSpecial*  
@@ -300,7 +289,9 @@ AliMpMotifReader::BuildMotifSpecial(const TString& motifID,
      return 0;
   }
 
-  AliMpMotifSpecial* res = new AliMpMotifSpecial(motifID,motifType);
+  TString id = MotifSpecialName(motifID,scale);
+  
+  AliMpMotifSpecial* res = new AliMpMotifSpecial(id,motifType);
   Int_t i,j;
   Double_t x,y;
   in >> i;
@@ -309,6 +300,7 @@ AliMpMotifReader::BuildMotifSpecial(const TString& motifID,
     res->SetPadDimensions(AliMpIntPair(i,j),TVector2(x*scale/2.,y*scale/2.));
     in >> i;
   }
+  res->CalculateDimensions();
   
   in.close();
   return res;