/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/root/MTChamber.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1672 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-04-24 22:23:36 +0200 (Tue, 24 Apr 2012) $ */
00002 #include "root/MTChamber.hh"
00003 //#include "root/MTDif.hh"
00004 #include "root/MTBoard.hh"
00005 #include "tools/MicroException.hh"
00006 #include "geometry/Chamber.hh"
00007 #include "geometry/Dif.hh"
00008 #include "geometry/Board.hh"
00009 #include "mTypes.h"
00010 #include <iostream> 
00011 
00012 using namespace std;
00013 
00014 ClassImp(MTChamber)
00015 
00016 
00017 //______________________________________________________________________________
00018  MTChamber::MTChamber()
00019 {
00020   id = 0;
00021   type = "";
00022   xPos  = 0.;
00023   yPos  = 0.;
00024   zPos  = 0.;
00025   xRotation = 0.;
00026   yRotation = 0.;
00027   zRotation = 0;
00028   xLength = 0.;
00029   yLength = 0.;
00030 
00031 }
00032 //______________________________________________________________________________
00033  MTChamber::MTChamber(const Chamber& aChamber)
00034  {
00035      (*this) = aChamber; // appelle operator=
00036  }
00037 //______________________________________________________________________________
00038 MTChamber::~MTChamber()
00039 {
00040 //    for( map<UInt_t,MTDif*>::iterator iiDif=this->difs.begin(); iiDif!=this->difs.end(); ++iiDif)
00041 //    {
00042 //        delete (*iiDif).second;
00043 //    }
00044 
00045     for( map<UInt_t,MTBoard*>::const_iterator iiBoard=this->boards.begin(); iiBoard!=this->boards.end(); ++iiBoard)
00046     {
00047         delete (*iiBoard).second;
00048     }
00049 
00050 }
00051 //______________________________________________________________________________
00052 MTChamber& MTChamber::operator=(const Chamber& aChamber)
00053 
00054 {
00055     try
00056     {
00057         id    = aChamber.getId();
00058         type  = aChamber.getType();
00059         xPos  = aChamber.getX();
00060         yPos  = aChamber.getY();
00061         zPos  = aChamber.getZ(); 
00062         xLength = aChamber.getXLength();
00063         yLength = aChamber.getYLength();
00064         xRotation = aChamber.getXrotation(); 
00065         yRotation = aChamber.getYrotation();
00066         zRotation = aChamber.getZrotation();
00067 
00068 /*
00069         const DifMap_t& chamberDifs = aChamber.getDifs();
00070         for (DifMap_t::const_iterator difIt = chamberDifs.begin(); difIt != chamberDifs.end(); ++difIt)
00071         {
00072             Dif& dif = *(difIt->second);
00073             MTDif *mtDif = new MTDif(dif);
00074             difs[dif.getId()] = mtDif;
00075 
00076                                         const BoardMap_t& chamberBoards = dif.getBoards();
00077                                         for (BoardMap_t::const_iterator boardIt = chamberBoards.begin(); boardIt != chamberBoards.end(); ++boardIt)
00078                                         {
00079                                                         Board& board = *(boardIt->second);
00080                                                         MTBoard *mtBoard = new MTBoard(board);
00081                                                         //mtBoard->SetDif(mtDif);
00082                                                         boards[board.getId()] = mtBoard;
00083                                         }
00084                                 }
00085 */
00086         const BoardMap_t& chamberBoards = aChamber.getBoards();
00087         for (BoardMap_t::const_iterator boardIt = chamberBoards.begin(); boardIt != chamberBoards.end(); ++boardIt)
00088         {
00089                                                         Board& board = *(boardIt->second);
00090                                                         MTBoard *mtBoard = new MTBoard(board);
00091                                                         boards[board.getId()] = mtBoard;
00092        }
00093     }
00094     catch (MicroException e)
00095     {
00096         throw MicroException(e.getMessage());
00097     }
00098     return *this;
00099 
00100 }
00101 
00102 //______________________________________________________________________________
00103 void  MTChamber::Info() const
00104 {
00105 
00106   cout << "**** Chamber informations ****"    << endl << endl ;
00107   cout << "    Id: " << id << "    " << endl ;
00108   cout << "    Type:  "<< type << endl;
00109 }
00110 
00111 
00112 //-------------------------------------------//
00113 const float MTChamber::GetLeftBottomX() const
00114 {
00115   if ( zRotation == 90 || zRotation == -90 ) return ( xPos - yLength / 2.);
00116    return ( xPos - GetXLength() / 2.);
00117 
00118 }
00119 //-------------------------------------------//
00120 const float MTChamber::GetLeftBottomY() const
00121 {
00122   if ( zRotation == 90  || zRotation == -90) return ( yPos - xLength / 2.);
00123    return ( yPos - GetYLength() / 2.);
00124 }
00125 //-------------------------------------------//
00126 const float MTChamber::GetRightUpperX() const
00127 {
00128   if ( zRotation == 90  || zRotation == -90) return ( xPos + yLength / 2.);
00129    return ( xPos + GetXLength() / 2.);
00130 }
00131 //-------------------------------------------//
00132 const float MTChamber::GetRightUpperY() const
00133 {
00134   if ( zRotation == 90  || zRotation == -90) return ( yPos + xLength / 2.);
00135    return ( yPos + GetYLength() / 2.);
00136 }
00137 
00138 

Generated on Mon Jan 7 13:15:22 2013 for MicromegasFramework by  doxygen 1.4.7