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

Go to the documentation of this file.
00001 /* @version $Revision: 1871 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-08-29 09:45:12 +0200 (Wed, 29 Aug 2012) $ */
00002 #include "root/MTBoard.hh"
00003 //#include "root/MTDif.hh"
00004 #include "root/MTChip.hh"
00005 
00006 #include "root/MTChip.hh"
00007 #include "root/MTHardroc1Chip.hh"
00008 #include "root/MTMicrorocChip.hh"
00009 #include "root/MTDiracChip.hh"
00010 #include "root/MTHardroc2Chip.hh"
00011 
00012 #include "geometry/Hardroc1Chip.hh"
00013 #include "geometry/MicrorocChip.hh"
00014 #include "geometry/DiracChip.hh"
00015 #include "geometry/Hardroc2Chip.hh"
00016 #include "mTypes.h"
00017 
00018 #include "tools/MicroException.hh"
00019 
00020 #include "geometry/Board.hh"
00021 
00022 #include <iostream> 
00023 
00024 using namespace std;
00025 
00026 ClassImp(MTBoard)
00027 //______________________________________________________________________________
00028  MTBoard::MTBoard()
00029 {
00030   id = 0;
00031 }
00032 //______________________________________________________________________________
00033  MTBoard::MTBoard(const Board& aBoard)
00034  {
00035      (*this) = aBoard; // appelle operator=
00036  }
00037 //______________________________________________________________________________
00038 MTBoard::~MTBoard()
00039 {
00040     for( map<UInt_t,MTChip*>::const_iterator iiChip=this->chips.begin(); iiChip!=this->chips.end(); ++iiChip)
00041     {
00042                         MTChip *foo =(*iiChip).second ; 
00043         delete foo;
00044     }
00045 //      }
00046 }
00047 //______________________________________________________________________________
00048 MTBoard& MTBoard::operator=(const Board& aBoard)
00049 {
00050         try
00051         {
00052                 id  = aBoard.getId();
00053 
00054                 MTChip* mtChip = NULL;
00055                 const ChipMap_t& boardChips = aBoard.getChips();
00056                         
00057                 for (ChipMap_t::const_iterator chipIt = boardChips.begin(); chipIt != boardChips.end(); ++chipIt)
00058                 {
00059                         Chip& chip = *(chipIt->second);
00060                         try {
00061                                          DiracChip &diracChip = dynamic_cast<DiracChip &> (chip);
00062                                          mtChip = new MTDiracChip(diracChip);
00063                         }
00064                         catch (...) {}
00065                         try {
00066                                          Hardroc1Chip &hr1Chip = dynamic_cast<Hardroc1Chip &> (chip);
00067                                          mtChip = new MTHardroc1Chip(hr1Chip);
00068                         }
00069                         catch (...) {}
00070                         try {
00071                                          Hardroc2Chip &hr2Chip = dynamic_cast<Hardroc2Chip &> (chip);
00072                                          mtChip = new MTHardroc2Chip(hr2Chip);
00073                         }
00074                         catch (...) {}
00075                         try {
00076                                          MicrorocChip &microChip = dynamic_cast<MicrorocChip &> (chip);
00077                                          mtChip = new MTMicrorocChip(microChip);
00078                         }
00079                         catch (...) {}
00080                                 
00081                         
00082                         if ( mtChip != NULL)
00083                         {
00084                                 //mtChip->SetBoard(*this);
00085                                 chips[chip.getId()] = mtChip;
00086                         //      if ( id == 14 )
00087                 //              {
00088         //                              cout << "Board id[" << id << "] adr[" << this << "] add chip id[" << chip.getId() << "]  chip adr[" << mtChip << "]" << endl;
00089         //                      }
00090                         }
00091                 }
00092         }
00093         catch (MicroException e)
00094         {
00095                 throw MicroException(e.getMessage());
00096         }
00097         return *this;
00098 }
00099 
00100 //______________________________________________________________________________
00101 void  MTBoard::Info() const
00102 {
00103   cout << "**** Board informations ****"    << endl << endl ;
00104   cout << "    Id: " << dec <<  id << "    " << endl ;
00105 }
00106 

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