Board Class Reference

#include <Board.hh>

Inheritance diagram for Board:

Inheritance graph
[legend]
Collaboration diagram for Board:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const ChambergetChamber () const
const i32 getId () const
const ui32 getColumn () const
const ui32 getRow () const
const float getX () const
const float getY () const
const float getLeftBottomX () const
const float getLeftBottomY () const
const float getRightUpperX () const
const float getRightUpperY () const
const float getXLength () const
const float getYLength () const
virtual const float getXGap () const =0
virtual const float getYGap () const =0
void addChip (Chip *chip)
ChipMap_t getChips (void) const
i32 getMaxChipId (void) const
i32 getMinChipId (void) const
void setDif (Dif *aDif)
const DifgetDif () const
ChannelgetChannelById (const i32 channelId, const i32 chipId=-1)
ChipgetChipById (const i32 chipId)
ChipgetChipByRowCol (const i16 row, const i16 col)
ui32 getNbColumns () const
ui32 getNbRows () const
const float getXRelative () const
const float getYRelative () const

Protected Member Functions

 Board (const Chamber &_chamber, const ui32 aCol, const ui32 aRow, const ui32 nbColumns, const ui32 nbRows, const i32 aId)
 Board (const Board &source)
Boardoperator= (const Board &source)
virtual ~Board ()
std::ostream & operator<< (std::ostream &out) const

Protected Attributes

const Chamberchamber
i32 id
ui32 column
ui32 row
std::map< i32, Chip * > chips
ui32 nbColumns
ui32 nbRows
Difdif

Friends

class Chamber
std::ostream & operator<< (std::ostream &out, const Board &x)

Detailed Description

Definition at line 24 of file Board.hh.


Constructor & Destructor Documentation

Board::Board ( const Chamber _chamber,
const ui32  aCol,
const ui32  aRow,
const ui32  nbColumns,
const ui32  nbRows,
const i32  aId 
) [protected]

Definition at line 21 of file Board.cpp.

00022 : chamber(_chamber), dif(NULL),  row(aRow), column(aCol), nbColumns(aNbColumns), nbRows(aNbRows),  id(aId)
00023 {
00024   FILE_LOG(logDEBUG1) << "Board constructor row " << row << ", column:" << column << endl;
00025 }

Board::Board ( const Board source  )  [protected]

Definition at line 37 of file Board.cpp.

00037                            : chamber(x.chamber) {
00038   *this = x;
00039 }

Board::~Board (  )  [protected, virtual]

Definition at line 28 of file Board.cpp.

00028               {
00029   FILE_LOG(logDEBUG1) << "Board destructor" << endl;
00030   for (std::map<i32, Chip *>::const_iterator it = chips.begin(); it != chips.end(); ++it)
00031   {
00032     delete (it->second);
00033   }
00034 }


Member Function Documentation

Board & Board::operator= ( const Board source  )  [protected]

Definition at line 42 of file Board.cpp.

00042                                       {
00043 //  (Chamber)chamber = x.chamber;
00044   id = x.id;
00045   column = x.column, row= x.row;
00046   nbColumns = x.nbColumns, nbRows = x.nbRows;
00047   chips = x.chips;
00048 }

std::ostream & Board::operator<< ( std::ostream &  out  )  const [protected]

Definition at line 51 of file Board.cpp.

00051                                                     {
00052   out << "    " << "Board id " << id << ", [x/y/z] @[" << getX() << ", " << getY() << ", " << chamber.getZ() << "], "
00053       << "[col/row]=>["<< column << "/" << row << "], "
00054       << "[Xlength/Ylength]=>["<< getXLength() << "/" << getYLength() << "], "
00055       << chips.size() << " chips" << endl;
00056   if (chips.size()) {
00057     for (std::map<i32, Chip *>::const_iterator it = chips.begin(); it != chips.end(); ++it) {
00058       out << *(it->second);
00059     }
00060   }
00061   return(out);
00062 } // operator <<

const Chamber& Board::getChamber (  )  const [inline]

Definition at line 37 of file Board.hh.

Referenced by Chip::Chip(), GassiplexStripChannel::GassiplexStripChannel(), Channel::getChamber(), Channel::getColInChamber(), Chip::getLeftBottomX(), Channel::getLeftBottomX(), getLeftBottomX(), Chip::getLeftBottomY(), Channel::getLeftBottomY(), getLeftBottomY(), Chip::getRightUpperX(), Channel::getRightUpperX(), getRightUpperX(), Chip::getRightUpperY(), Channel::getRightUpperY(), getRightUpperY(), Channel::getRowInChamber(), Chip::getX(), getX(), Chip::getY(), getY(), and Chip::operator=().

00037 { return(chamber); };

const i32 Board::getId ( void   )  const [inline]

Definition at line 38 of file Board.hh.

Referenced by Dif::addBoard(), Chamber::addBoard(), Channel::Channel(), Chip::Chip(), MicrorocOldLabviewReader::getScData(), MicrorocMergeReader::getScData(), MTChannel::MTChannel(), MTEvent::operator=(), MTChip::operator=(), MTBoard::operator=(), and Chip::operator=().

00038 { return(id); };

const ui32 Board::getColumn (  )  const [inline]

Definition at line 39 of file Board.hh.

Referenced by Channel::getColInChamberRelative(), MTChannel::MTChannel(), and MTChip::operator=().

00039 { return(column); };

const ui32 Board::getRow (  )  const [inline]

Definition at line 40 of file Board.hh.

Referenced by Channel::getRowInChamberRelative(), MTChannel::MTChannel(), and MTChip::operator=().

00040 { return(row); };

const float Board::getX (  )  const

Definition at line 105 of file Board.cpp.

Referenced by BeamProfile::DrawChip2D(), getLeftBottomX(), getRightUpperX(), and operator<<().

00106 {
00107 
00108   float result = 0.;
00109 
00110   if ( getChamber().getZrotation() == 90 )
00111   { result = getYRelative(); }
00112   else if ( getChamber().getZrotation() == -90 )
00113   { result = -getYRelative(); }
00114 
00115   else  { result = getXRelative(); }
00116 
00117  if ( getChamber().getYrotation())
00118   {
00119     result = - result;
00120   }
00121 
00122   return result + chamber.getX();//true);
00123 }

const float Board::getY (  )  const

Definition at line 133 of file Board.cpp.

Referenced by BeamProfile::DrawChip2D(), getLeftBottomY(), getRightUpperY(), and operator<<().

00134 {
00135 
00136   float result = 0.;
00137   if ( getChamber().getZrotation() == 90 )
00138   { result = -getXRelative(); }
00139 
00140  else if ( getChamber().getZrotation() == -90 )
00141   { result = getXRelative(); }
00142 
00143 
00144   else {  result = getYRelative(); }  
00145 
00146   if ( getChamber().getXrotation())
00147   {
00148     result = - result;
00149   }
00150    return result + chamber.getY();//true);
00151 }

const float Board::getLeftBottomX (  )  const

Definition at line 195 of file Board.cpp.

00196 {
00197   if ( getChamber().getZrotation() == 90 || getChamber().getZrotation() == -90 ) return ( getX() - getYLength() / 2.);
00198    return ( getX() - getXLength() / 2.);
00199 }

const float Board::getLeftBottomY (  )  const

Definition at line 201 of file Board.cpp.

00202 {
00203   if ( getChamber().getZrotation() == 90  || getChamber().getZrotation() == -90) return ( getY() - getXLength() / 2.);
00204    return ( getY() - getYLength() / 2.);
00205 }

const float Board::getRightUpperX (  )  const

Definition at line 207 of file Board.cpp.

00208 {
00209   if ( getChamber().getZrotation() == 90  || getChamber().getZrotation() == -90) return ( getX() + getYLength() / 2.);
00210    return ( getX() + getXLength() / 2.);
00211 }

const float Board::getRightUpperY (  )  const

Definition at line 213 of file Board.cpp.

00214 {
00215   if ( getChamber().getZrotation() == 90  || getChamber().getZrotation() == -90) return ( getY() + getXLength() / 2.);
00216    return ( getY() + getYLength() / 2.);
00217 }

const float Board::getXLength (  )  const

Definition at line 164 of file Board.cpp.

Referenced by BeamProfile::DrawChip2D(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), Chamber::getXLength(), Chip::getXRelative(), and operator<<().

00165 {
00166 
00167   if (chips.size())
00168   {
00169     Chip* ch = chips.begin()->second;
00170     return  (nbRows *  ch->getXLength())  +( (nbRows-1) * getXGap() ) ;
00171   }
00172 
00173   return 0.;
00174 }

const float Board::getYLength (  )  const

Definition at line 183 of file Board.cpp.

Referenced by BeamProfile::DrawChip2D(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), Chamber::getYLength(), Chip::getYRelative(), and operator<<().

00184 {
00185   if (chips.size())
00186   {
00187     Chip *ch = chips.begin()->second;
00188     return  (nbColumns *  ch->getYLength()) +( (nbColumns-1) * getYGap() ) ;
00189 
00190   }
00191   return 0;
00192 }

virtual const float Board::getXGap (  )  const [pure virtual]

Implemented in DiracBoard, GassiplexBoardBeta21, GassiplexBoardBeta24, GassiplexBoardStrip, Hardroc1Board, Hardroc2Board, and MicrorocBoard.

Referenced by getXLength().

virtual const float Board::getYGap (  )  const [pure virtual]

Implemented in DiracBoard, GassiplexBoardBeta21, GassiplexBoardBeta24, GassiplexBoardStrip, Hardroc1Board, Hardroc2Board, and MicrorocBoard.

Referenced by getYLength().

void Board::addChip ( Chip chip  ) 

Definition at line 65 of file Board.cpp.

Referenced by MicrorocTestChamber::init(), MicrorocChamber6::init(), MicrorocChamber1::init(), MetreCarreChamber::init(), Hardroc2IPNLChamber6::init(), Hardroc2Chamber6::init(), Hardroc2Chamber2::init(), Hardroc2Chamber1::init(), Hardroc1Chamber::init(), and DiracChamber1::init().

00065                               {
00066   chips.insert(make_pair(chip->getId(), chip));
00067 } // Board.addChip

ChipMap_t Board::getChips ( void   )  const [inline]

Definition at line 56 of file Board.hh.

Referenced by BeamProfile::DrawChip2D(), BeamProfile::FillHitPerChannel(), TestMicrorocParser::getNextEvent(), and MTBoard::operator=().

00056 { return chips; };

i32 Board::getMaxChipId ( void   )  const

Definition at line 235 of file Board.cpp.

Referenced by BeamProfile::FillHitPerChipDist().

00236 {
00237         i32     result = 0;
00238   for (std::map<i32, Chip *>::const_iterator it = chips.begin(); it != chips.end(); ++it)
00239   {
00240     Chip* chip = it->second;
00241                 if (chip)
00242                 {
00243                                                 if ( chip->getId() > result) { result = chip->getId(); }
00244                 }
00245         }
00246                 return result;
00247 }

i32 Board::getMinChipId ( void   )  const

Definition at line 220 of file Board.cpp.

Referenced by BeamProfile::FillHitPerChipDist().

00221 {
00222         i32     result = 0xffff;
00223   for (std::map<i32, Chip *>::const_iterator it = chips.begin(); it != chips.end(); ++it)
00224   {
00225     Chip* chip = it->second;
00226                 if (chip)
00227                 {
00228                                                 if ( chip->getId() < result) { result = chip->getId(); }
00229                 }
00230         }
00231                 return result;
00232 }

void Board::setDif ( Dif aDif  ) 

Definition at line 177 of file Board.cpp.

Referenced by Dif::addBoard().

00178 {
00179     dif = aDif;
00180 }

const Dif* Board::getDif (  )  const [inline]

Definition at line 61 of file Board.hh.

Referenced by Channel::Channel(), Chip::Chip(), MTChannel::MTChannel(), MTEvent::operator=(), and Chip::operator=().

00061 { return dif; } ;

Channel & Board::getChannelById ( const i32  channelId,
const i32  chipId = -1 
)

Definition at line 91 of file Board.cpp.

00092 {
00093   // for gassiplex boards the ChipId is the same as the channelId (every chip contains one and only one channel)
00094   try {
00095     Chip& chip = getChipById((chipId >= 0) ? chipId : channelId);
00096     Channel& ch = chip.getChannelById(channelId);
00097     return(ch);
00098   }
00099   catch (MicroException& e) {
00100   }
00101   throw MicroException("Board.getChannelById : no Channel found with this id" );
00102 };

Chip & Board::getChipById ( const i32  chipId  ) 

Definition at line 70 of file Board.cpp.

Referenced by getChannelById().

00070                                           {
00071   std::map<i32, Chip *>::const_iterator itChip = chips.find(chipId);
00072   if (itChip == chips.end()) {
00073     throw MicroException("Board.getChipById : no Chip found for this id in this Board ");
00074   }
00075   return(*itChip->second);
00076 }

Chip & Board::getChipByRowCol ( const i16  row,
const i16  col 
)

Definition at line 79 of file Board.cpp.

Referenced by Dif::getChipByRowCol().

00080 {
00081     for (std::map<i32, Chip *>::const_iterator it = chips.begin(); it != chips.end(); ++it) {
00082       Chip &chip = *(it->second);
00083       if ( chip.getRow() == row && chip.getColumn() == col )
00084       {
00085         return(chip);
00086       }
00087   }
00088   throw MicroException("Board.getChannelByRowCol : no Channel found with this col and row" );
00089 }

ui32 Board::getNbColumns (  )  const [inline]

Definition at line 69 of file Board.hh.

Referenced by Channel::getColInChamber(), Channel::getColInChamberRelative(), Channel::getRowInChamber(), MTChannel::MTChannel(), and MTChip::operator=().

00069 { return nbColumns; }; 

ui32 Board::getNbRows (  )  const [inline]

Definition at line 70 of file Board.hh.

Referenced by Channel::getColInChamber(), Channel::getRowInChamber(), Channel::getRowInChamberRelative(), MTChannel::MTChannel(), and MTChip::operator=().

00070 { return nbRows; }; 

const float Board::getXRelative (  )  const

Definition at line 126 of file Board.cpp.

Referenced by Chip::getX(), Channel::getX(), getX(), Chip::getY(), Channel::getY(), and getY().

00127 {
00128   float result = - ( chamber.getXLength() / 2. ) + ( row * this->getXLength() )  + ( this->getXLength() / 2. ) + ( row ) * chamber.getXGap();
00129 
00130   return result;
00131 }

const float Board::getYRelative (  )  const

Definition at line 155 of file Board.cpp.

Referenced by Chip::getX(), Channel::getX(), getX(), Chip::getY(), Channel::getY(), and getY().

00156 {
00157   float result = 0.;
00158   result = - ( chamber.getYLength() / 2. ) + ( column * this->getYLength() )  + ( this->getYLength() / 2. )  + ( column  * chamber.getYGap());
00159 
00160   return result;
00161 
00162 }


Friends And Related Function Documentation

friend class Chamber [friend]

Definition at line 26 of file Board.hh.

std::ostream& operator<< ( std::ostream &  out,
const Board x 
) [friend]

Definition at line 16 of file Board.cpp.

00016                                                          {
00017   return(x.operator <<(out));
00018 } // operator <<


Member Data Documentation

const Chamber& Board::chamber [protected]

Definition at line 77 of file Board.hh.

Referenced by getChamber(), getX(), getXRelative(), getY(), getYRelative(), GassiplexBoardStrip::init(), and operator<<().

i32 Board::id [protected]

the chamber to which the board belongs

Definition at line 78 of file Board.hh.

Referenced by MicrorocTestChamber::init(), MicrorocChamber6::init(), MicrorocChamber1::init(), MetreCarreChamber::init(), Hardroc2IPNLChamber6::init(), Hardroc2Chamber6::init(), Hardroc2Chamber2::init(), Hardroc2Chamber1::init(), Hardroc1Chamber::init(), DiracChamber1::init(), and operator=().

ui32 Board::column [protected]

the board id

Definition at line 79 of file Board.hh.

Referenced by Board(), getColumn(), getYRelative(), operator<<(), and operator=().

ui32 Board::row [protected]

Definition at line 79 of file Board.hh.

Referenced by Board(), getRow(), getXRelative(), GassiplexBoardStrip::init(), GassiplexBoardBeta24::init(), GassiplexBoardBeta21::init(), operator<<(), and operator=().

std::map<i32, Chip *> Board::chips [protected]

the board position

Definition at line 80 of file Board.hh.

Referenced by addChip(), getChipById(), getChipByRowCol(), getChips(), getMaxChipId(), getMinChipId(), getXLength(), getYLength(), GassiplexBoardStrip::init(), GassiplexBoardBeta24::init(), GassiplexBoardBeta21::init(), DiracBoard::init(), operator<<(), operator=(), and ~Board().

ui32 Board::nbColumns [protected]

the chip collection which composes the board

Definition at line 81 of file Board.hh.

Referenced by getNbColumns(), getYLength(), DiracBoard::init(), and operator=().

ui32 Board::nbRows [protected]

Definition at line 81 of file Board.hh.

Referenced by getNbRows(), getXLength(), DiracBoard::init(), and operator=().

Dif* Board::dif [protected]

number of chips row and column

Definition at line 82 of file Board.hh.

Referenced by getDif(), and setDif().


The documentation for this class was generated from the following files:
Generated on Mon Jan 7 13:17:59 2013 for MicromegasFramework by  doxygen 1.4.7