Chip Class Reference

#include <Chip.hh>

Inheritance diagram for Chip:

Inheritance graph
[legend]
Collaboration diagram for Chip:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const BoardgetBoard () const
const i32 & getId () const
const ui32 & getSerialNumber () const
void setSerialNumber (ui32 value)
const ChipSoftId getChipSoftId () const
ChannelMap_t getChannels (void) 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 ui32 getColumn (void) const
const ui32 getRow (void) const
ChannelgetChannelById (const i32 channelId)
i32 getMaxChannelId (void) const
i32 getMinChannelId (void) const
const float getXLength () const
const float getYLength () const
virtual const ui32 getXGap () const =0
virtual const ui32 getYGap () const =0
void setGain (const ui32 value)
ui32 getGain () const
bool getBypassed () const
void setBypassed (bool value)
const ui16 getType () const
void setConfigured (bool value)
bool isConfigured (void) const
ui32 getNbColumns () const
ui32 getNbRows () const
const float getXRelative () const
const float getYRelative () const

Protected Member Functions

 Chip (const Board &_board, const i32 aCol, const i32 aRow, const ui32 nbColumns, const ui32 nbRows, const i32 aId, const ui32 aSerialNumber)
 Chip (const Chip &x)
Chipoperator= (const Chip &x)
std::ostream & operator<< (std::ostream &out) const
virtual ~Chip ()

Protected Attributes

bool configured
const Boardboard
i32 id
ui32 serialNum
ui16 type
ui32 column
ui32 row
std::map< i32, Channel * > channels
ui32 nbColumns
ui32 nbRows
ChipSoftId chipSoftId
ui32 gain
bool bypassed

Friends

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

Detailed Description

Definition at line 31 of file Chip.hh.


Constructor & Destructor Documentation

Chip::Chip ( const Board _board,
const i32  aCol,
const i32  aRow,
const ui32  nbColumns,
const ui32  nbRows,
const i32  aId,
const ui32  aSerialNumber 
) [protected]

Definition at line 14 of file Chip.cpp.

00015 :board(_board), id(aId), serialNum(aSerialNumber),  row(aRow), column(aCol), nbRows(aNbRows), nbColumns(aNbColumns), bypassed(false), configured(false)
00016 {
00017     gain = 0;
00018     type = 0;
00019     const Dif* dif = _board.getDif();
00020            unsigned int difId = 0;
00021            if ( dif != NULL) difId = dif->getId();
00022            const Chamber& cham = _board.getChamber();
00023 
00024                 chipSoftId.SetValue(cham.getId(), difId,_board.getId(), id);
00025     FILE_LOG(logDEBUG1) << "Chip id["<< id << "], serial number["<< serialNum <<"]" << endl;
00026 
00027 
00028 }

Chip::Chip ( const Chip x  )  [protected]

Definition at line 50 of file Chip.cpp.

00050                         : board(x.board) {
00051   *this = x;
00052 }

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

Definition at line 70 of file Chip.cpp.

00070             {
00071   for (map<i32, Channel *>::const_iterator it = channels.begin(); it != channels.end(); ++it)
00072   {
00073       FILE_LOG(logDEBUG1) << "Chip destructeur delete it->second"<< endl;
00074       delete (it->second);
00075   }
00076 }


Member Function Documentation

Chip & Chip::operator= ( const Chip x  )  [protected]

Definition at line 55 of file Chip.cpp.

00055                                      {
00056   id = x.id;
00057   column = x.column, row = x.row;
00058   nbColumns = x.nbColumns, nbRows = x.nbRows;
00059   channels = x.channels;
00060         const Dif* dif = board.getDif();
00061         unsigned int difId = 0;
00062         if ( dif != NULL) difId = dif->getId();
00063         const Chamber& cham = board.getChamber();
00064 
00065         chipSoftId.SetValue(cham.getId(), difId,board.getId(), id);
00066   gain  = x.gain;
00067 }

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

Definition at line 39 of file Chip.cpp.

00039                                                    {
00040   out << "      " << "Chip id " << id << ", Chip serialNum " << serialNum << ", position [x/y] @[" << getX() << ", " << getY() << "], "
00041       << "[col/row]=>["<< column << "/" << row << "], "
00042       << "[Xlength/Ylength]=>["<< getXLength() << "/" << getYLength() << "], "
00043       << channels.size() << " channels" 
00044       << "bypassed[" << this->bypassed << "]" << endl;
00045   
00046   return(out);
00047 };

const Board& Chip::getBoard (  )  const [inline]

Definition at line 44 of file Chip.hh.

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

00044 { return board; };

const i32& Chip::getId ( void   )  const [inline]

Definition at line 45 of file Chip.hh.

Referenced by Board::addChip(), Channel::Channel(), MicrorocOldLabviewReader::getAcqData(), MicrorocMergeReader::getAcqData(), MicrorocOldLabviewReader::getAnalogData(), MTChannel::MTChannel(), MTChip::operator=(), MicrorocSCReader::parseSC(), and Channel::~Channel().

00045 { return id; };

const ui32& Chip::getSerialNumber (  )  const [inline]

Definition at line 46 of file Chip.hh.

Referenced by TestMicrorocParser::getNextEvent(), MTChannel::MTChannel(), and MTChip::operator=().

00046 { return serialNum; };

void Chip::setSerialNumber ( ui32  value  )  [inline]

Definition at line 47 of file Chip.hh.

Referenced by TestMicrorocParser::getNextEvent().

00047 { serialNum = value; };

const ChipSoftId Chip::getChipSoftId (  )  const [inline]

Definition at line 49 of file Chip.hh.

Referenced by MicrorocSCReader::parseSC(), and MicrorocSCReader::parseSCFromDb().

00049 { return chipSoftId; };

ChannelMap_t Chip::getChannels ( void   )  const [inline]

Definition at line 50 of file Chip.hh.

Referenced by BeamProfile::DrawChannel2D(), and MTChip::operator=().

00050 { return channels; };

const float Chip::getX (  )  const

Definition at line 90 of file Chip.cpp.

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

00091 {
00092 
00093   float result = 0.;
00094   if ( board.getChamber().getZrotation() == 90 )
00095   {
00096     result = getYRelative() + board.getYRelative();
00097   }
00098   else if ( board.getChamber().getZrotation() == -90 )
00099   {
00100     result = - (getYRelative() + board.getYRelative());
00101   }
00102   else
00103   {
00104     result = getXRelative() + board.getXRelative();
00105   }
00106 
00107   if ( board.getChamber().getYrotation() )
00108   {
00109     result = - result;
00110   }
00111 
00112   return result + board.getChamber().getX() ;
00113 
00114 }

const float Chip::getY (  )  const

Definition at line 126 of file Chip.cpp.

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

00127 {
00128 
00129   float result = 0.;
00130   if ( board.getChamber().getZrotation() == 90 )
00131   {
00132     result = -(getXRelative() + board.getXRelative());
00133  }
00134   else if ( board.getChamber().getZrotation() == -90 )
00135   {
00136     result = (getXRelative() + board.getXRelative());
00137  }
00138   else {
00139     result =  getYRelative() + board.getYRelative(); 
00140   }
00141   if ( board.getChamber().getXrotation() )
00142   {
00143     result = - result;
00144   }
00145   return result + board.getChamber().getY();
00146 
00147 }

const float Chip::getLeftBottomX (  )  const

Definition at line 160 of file Chip.cpp.

00161 {
00162   if ( board.getChamber().getZrotation() == 90 || board.getChamber().getZrotation() == -90) return ( getX() - getYLength() / 2.);
00163    return ( getX() - getXLength() / 2.);
00164 }

const float Chip::getLeftBottomY (  )  const

Definition at line 167 of file Chip.cpp.

00168 {
00169   if ( board.getChamber().getZrotation() == 90 || board.getChamber().getZrotation() == -90) return ( getY() - getXLength() / 2.);
00170    return ( getY() - getYLength() / 2.);
00171 }

const float Chip::getRightUpperX (  )  const

Definition at line 174 of file Chip.cpp.

00175 {
00176   if ( board.getChamber().getZrotation() == 90 || board.getChamber().getZrotation() == -90) return ( getX() + getYLength() / 2.);
00177    return ( getX() + getXLength() / 2.);
00178 }

const float Chip::getRightUpperY (  )  const

Definition at line 181 of file Chip.cpp.

00182 {
00183   if ( board.getChamber().getZrotation() == 90|| board.getChamber().getZrotation() == -90 ) return ( getY() + getXLength() / 2.);
00184    return ( getY() + getYLength() / 2.);
00185 }

const ui32 Chip::getColumn ( void   )  const [inline]

Definition at line 61 of file Chip.hh.

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

00061 { return column;}  ;

const ui32 Chip::getRow ( void   )  const [inline]

Definition at line 62 of file Chip.hh.

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

00062 { return row;};

Channel & Chip::getChannelById ( const i32  channelId  ) 

Definition at line 79 of file Chip.cpp.

Referenced by Board::getChannelById(), main(), MicrorocSCReader::parseSC(), MicrorocSCReader::parseSCFromDb(), and DiracChip::read().

00080 {
00081   std::map<i32, Channel *>::const_iterator it = channels.find(channelId);
00082   if (it == channels.end())
00083     throw MicroException("Chip.getChannelById : no Channel found for this id and this chamber ");
00084 
00085   //FILE_LOG(logDEBUG) << "----Channel Id " << channelId << " found" << endl;
00086   return(*(it->second));
00087 };

i32 Chip::getMaxChannelId ( void   )  const

Definition at line 224 of file Chip.cpp.

Referenced by BeamProfile::FillHitPerChannel().

00225 {
00226         i32     result = 0;
00227   for (std::map<i32, Channel *>::const_iterator it = channels.begin(); it != channels.end(); ++it)
00228   {
00229     Channel* channel = it->second;
00230                 if (channel)
00231                 {
00232                                                 if ( channel->getHardId() > result) { result = channel->getHardId(); }
00233                 }
00234         }
00235                 return result;
00236 }

i32 Chip::getMinChannelId ( void   )  const

Definition at line 209 of file Chip.cpp.

Referenced by BeamProfile::FillHitPerChannel().

00210 {
00211         i32     result = 0xffff;
00212   for (std::map<i32, Channel *>::const_iterator it = channels.begin(); it != channels.end(); ++it)
00213   {
00214     Channel* channel = it->second;
00215                 if (channel)
00216                 {
00217                                                 if ( channel->getHardId() < result) { result = channel->getHardId(); }
00218                 }
00219         }
00220                 return result;
00221 }

const float Chip::getXLength (  )  const

Definition at line 190 of file Chip.cpp.

Referenced by BeamProfile::DrawChannel2D(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), Channel::getXRelative(), and operator<<().

00191 {
00192   if (channels.size()) {
00193     const Channel&  ch = *(channels.begin()->second);
00194     return (nbRows * ch.getXLength())  + ( nbRows-1)  * getXGap() ;
00195   }
00196   return(0);
00197 }

const float Chip::getYLength (  )  const

Definition at line 199 of file Chip.cpp.

Referenced by BeamProfile::DrawChannel2D(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), Channel::getYRelative(), and operator<<().

00200 {
00201   if (channels.size()) {
00202     const Channel&  ch = *(channels.begin()->second);
00203     return (nbColumns *  ch.getYLength()) + (nbColumns-1) * getYGap() ;
00204   }
00205   return(0);
00206 }

virtual const ui32 Chip::getXGap (  )  const [pure virtual]

Implemented in DiracChip, GassiplexChip, GassiplexStripChip, Hardroc1Chip, Hardroc2Chip, Hardroc2IPNLChip, and MicrorocChip.

Referenced by getXLength().

virtual const ui32 Chip::getYGap (  )  const [pure virtual]

Implemented in DiracChip, GassiplexChip, GassiplexStripChip, Hardroc1Chip, Hardroc2Chip, Hardroc2IPNLChip, and MicrorocChip.

Referenced by getYLength().

void Chip::setGain ( const ui32  value  )  [inline]

Definition at line 76 of file Chip.hh.

00076 { gain = value;};

ui32 Chip::getGain (  )  const [inline]

Definition at line 77 of file Chip.hh.

Referenced by MTChip::operator=().

00077 { return  gain;};

bool Chip::getBypassed (  )  const [inline]

Definition at line 79 of file Chip.hh.

Referenced by MicrorocOldLabviewReader::getAcqData(), MicrorocMergeReader::getAcqData(), MicrorocOldLabviewReader::getAnalogData(), and MTChip::operator=().

00079 { return bypassed; };

void Chip::setBypassed ( bool  value  )  [inline]

Definition at line 80 of file Chip.hh.

Referenced by MicrorocSCReader::parseSC(), and MicrorocSCReader::parseSCFromDb().

00080 { bypassed = value;};

const ui16 Chip::getType (  )  const [inline]

Definition at line 82 of file Chip.hh.

00082 { return type;};

void Chip::setConfigured ( bool  value  )  [inline]

Definition at line 83 of file Chip.hh.

Referenced by DiracLabview::getNextEvent(), MicrorocSCReader::parseSC(), and MicrorocSCReader::parseSCFromDb().

00083 { configured = value; } ;

bool Chip::isConfigured ( void   )  const [inline]

Definition at line 84 of file Chip.hh.

Referenced by MTChip::operator=().

00084 { return  configured;};

ui32 Chip::getNbColumns ( void   )  const [inline]

Definition at line 86 of file Chip.hh.

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

00086 { return nbColumns; };

ui32 Chip::getNbRows ( void   )  const [inline]

Definition at line 87 of file Chip.hh.

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

00087 { return nbRows; };

const float Chip::getXRelative (  )  const

Definition at line 117 of file Chip.cpp.

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

00118 {
00119   float result = - ( board.getXLength() / 2. ) + ( row * this->getXLength() )  + ( this->getXLength() / 2. );
00120 
00121   return result;
00122 }

const float Chip::getYRelative (  )  const

Definition at line 150 of file Chip.cpp.

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

00151 {
00152   float result = 0.;
00153   result = - ( board.getYLength() / 2. ) + ( column * this->getYLength() )  + ( this->getYLength() / 2. );
00154 
00155   return result;
00156 
00157 }


Friends And Related Function Documentation

friend class Board [friend]

Definition at line 35 of file Chip.hh.

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

Definition at line 34 of file Chip.cpp.

00034                                                         {
00035   return(x.operator <<(out));
00036 };

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

Definition at line 30 of file Chip.cpp.

00030                                                         {
00031   return(x->operator <<(out));
00032 };


Member Data Documentation

bool Chip::configured [protected]

Definition at line 95 of file Chip.hh.

Referenced by isConfigured(), and setConfigured().

const Board& Chip::board [protected]

Definition at line 96 of file Chip.hh.

Referenced by getBoard(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), getX(), getXRelative(), getY(), getYRelative(), and operator=().

i32 Chip::id [protected]

the board containing this chip

Definition at line 97 of file Chip.hh.

Referenced by Chip(), getId(), GassiplexStripChip::init(), GassiplexChip::init(), and operator=().

ui32 Chip::serialNum [protected]

unique chip Id for every Dif

Definition at line 98 of file Chip.hh.

Referenced by Chip(), getSerialNumber(), operator<<(), and setSerialNumber().

ui16 Chip::type [protected]

unique chip serial number

Definition at line 99 of file Chip.hh.

Referenced by Chip(), GassiplexChip::GassiplexChip(), GassiplexStripChip::GassiplexStripChip(), and getType().

ui32 Chip::column [protected]

Definition at line 100 of file Chip.hh.

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

ui32 Chip::row [protected]

Definition at line 100 of file Chip.hh.

Referenced by getRow(), getXRelative(), operator<<(), and operator=().

std::map<i32, Channel *> Chip::channels [protected]

chip position inside the board

Definition at line 101 of file Chip.hh.

Referenced by getChannelById(), getChannels(), getMaxChannelId(), getMinChannelId(), getXLength(), getYLength(), MicrorocChip::init(), Hardroc2IPNLChip::init(), Hardroc2Chip::init(), Hardroc1Chip::init(), GassiplexStripChip::init(), GassiplexChip::init(), DiracChip::init(), operator<<(), operator=(), and ~Chip().

ui32 Chip::nbColumns [protected]

sorted channel list

Definition at line 102 of file Chip.hh.

Referenced by getNbColumns(), getYLength(), and operator=().

ui32 Chip::nbRows [protected]

Definition at line 102 of file Chip.hh.

Referenced by getNbRows(), getXLength(), and operator=().

ChipSoftId Chip::chipSoftId [protected]

number of channels row and column

Definition at line 103 of file Chip.hh.

Referenced by Chip(), getChipSoftId(), and operator=().

ui32 Chip::gain [protected]

Definition at line 105 of file Chip.hh.

Referenced by Chip(), getGain(), operator=(), DiracChip::read(), and setGain().

bool Chip::bypassed [protected]

Definition at line 106 of file Chip.hh.

Referenced by getBypassed(), MicrorocChip::MicrorocChip(), operator<<(), and setBypassed().


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