Channel Class Reference

#include <Channel.hh>

Inheritance diagram for Channel:

Inheritance graph
[legend]
Collaboration diagram for Channel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Channel (const Chip &, const std::string description, const i32 aCol, const i32 aRow, const i32 aId)
 Channel (const Channel &source)
Channeloperator= (const Channel &source)
virtual ~Channel ()
std::string getDescription () const
void print () const
const ChipgetChip () const
const ChambergetChamber () const
int getColumn (void) const
void setColumn (int aColumn)
int getRow (void) const
void setRow (int aRow)
ui32 getHardId (void) const
const ChannelSoftIdgetSoftId (void) const
const float getX () const
const float getY () const
float getZ () const
const float getLeftBottomX () const
const float getLeftBottomY () const
const float getRightUpperX () const
const float getRightUpperY () const
const ui16 getColInChamberRelative () const
const ui16 getRowInChamberRelative () const
const ui16 getColInChamber () const
const ui16 getRowInChamber () const
virtual const ui32 getXLength () const =0
virtual const ui32 getYLength () const =0
virtual bool valueIsValid (const int value)
bool getEnable () const
bool getStimulate () const
unsigned int getPedestalOffset () const
void setEnable (bool _value)
void setStimulate (bool _value)
void setPedestalOffset (unsigned int value)
const float getXRelative () const
const float getYRelative () const

Protected Attributes

const Chipchip
std::string description
ui32 hardId
ui32 column
ui32 row
bool enable
bool stimulate
unsigned int pedestal_offset
ChannelSoftId channelSoftId

Friends

std::ostream & operator<< (std::ostream &out, const Channel &x)

Detailed Description

CLASS Channel //

Definition at line 32 of file Channel.hh.


Constructor & Destructor Documentation

Channel::Channel ( const Chip ,
const std::string  description,
const i32  aCol,
const i32  aRow,
const i32  aId 
)

Definition at line 24 of file Channel.cpp.

00025   :chip(_chip), description(aDesc), column(aColumn), row(aRow), hardId(aHardId)
00026 {
00027   enable = true;
00028   stimulate = false;
00029 
00030         const Chip&  chip = this->getChip() ;
00031         const Board& board = chip.getBoard() ;
00032         const Dif* dif = board.getDif();
00033                 unsigned int difId = 0;
00034          if ( dif != NULL) difId = dif->getId();
00035         const Chamber& cham = this->getChamber();
00036         channelSoftId.SetValue(cham.getId(), difId, board.getId(),chip.getId(),getHardId(),getRow(),getColumn());
00037 //  FILE_LOG(logDEBUG) << "------Channel constructor. " << endl;
00038 }

Channel::Channel ( const Channel source  ) 

Definition at line 44 of file Channel.cpp.

00044                                       : chip(source.chip)
00045 {
00046   //FILE_LOG(logDEBUG) << "-- Channel copy constructor" << endl;
00047   *this = source;  // appel de l operateur =
00048 }

Channel::~Channel (  )  [virtual]

Definition at line 67 of file Channel.cpp.

00068 {
00069   FILE_LOG(logDEBUG1) << "------Channel destructeur:" <<  this->getHardId() << " in chip["  << this->getChip().getId() << endl;
00070 }


Member Function Documentation

Channel & Channel::operator= ( const Channel source  ) 

Definition at line 53 of file Channel.cpp.

00054 {
00055   //FILE_LOG(logDEBUG) << "--Channel operator de copie"<< endl;
00056   hardId = source.hardId;
00057   description = source.description;
00058   column = source.column;
00059   row = source.row;
00060   enable = source.enable;
00061   stimulate = source.stimulate;
00062   pedestal_offset  = source.pedestal_offset;
00063   return *this;
00064 }

std::string Channel::getDescription (  )  const [inline]

Definition at line 44 of file Channel.hh.

00044 { return description; };

void Channel::print (  )  const

Definition at line 188 of file Channel.cpp.

Referenced by ChannelHit::print().

00189 {
00190   cout << *this << endl;
00191 }

const Chip& Channel::getChip (  )  const [inline]

Definition at line 47 of file Channel.hh.

Referenced by Channel(), GassiplexStripChannel::GassiplexStripChannel(), MTChannel::MTChannel(), and ~Channel().

00047 { return chip; };

const Chamber & Channel::getChamber (  )  const

Definition at line 73 of file Channel.cpp.

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

00074 {
00075   return(chip.getBoard().getChamber());
00076 };

int Channel::getColumn ( void   )  const [inline]

Definition at line 50 of file Channel.hh.

Referenced by Channel(), getColInChamberRelative(), and MTChannel::MTChannel().

00050 { return column; };

void Channel::setColumn ( int  aColumn  )  [inline]

Definition at line 51 of file Channel.hh.

00051 { column = aColumn; };

int Channel::getRow ( void   )  const [inline]

Definition at line 54 of file Channel.hh.

Referenced by Channel(), getRowInChamberRelative(), and MTChannel::MTChannel().

00054 { return row; };

void Channel::setRow ( int  aRow  )  [inline]

Definition at line 55 of file Channel.hh.

00055 { row = aRow; };

ui32 Channel::getHardId ( void   )  const [inline]

Definition at line 57 of file Channel.hh.

Referenced by Channel(), MTChannel::MTChannel(), and ~Channel().

00057 { return hardId; }

const ChannelSoftId& Channel::getSoftId ( void   )  const [inline]

Definition at line 59 of file Channel.hh.

00059 { return channelSoftId; };

const float Channel::getX (  )  const

X, Y 'world'position

Definition at line 80 of file Channel.cpp.

Referenced by getLeftBottomX(), getRightUpperX(), main(), MTChannel::MTChannel(), CalibMicrorocParser::newHit(), CalibHR2Parser::newHit(), CalibHR1Parser::newHit(), and operator<<().

00082 {
00083   float result = 0.;
00084   if ( getChamber().getZrotation() == 90 )
00085   {
00086     result = getYRelative() +chip.getYRelative()  + chip.getBoard().getYRelative();
00087   }
00088   else if ( getChamber().getZrotation() == -90 )
00089   {
00090     result = -(getYRelative() +chip.getYRelative()  + chip.getBoard().getYRelative());
00091   }
00092   else
00093   {
00094     result = getXRelative() + chip.getXRelative() + chip.getBoard().getXRelative();
00095   }
00096 
00097   if ( getChamber().getYrotation() )
00098   {
00099     result = - result;
00100   }
00101 
00102   return result + getChamber().getX() ;
00103 
00104 
00105 }

const float Channel::getY (  )  const

Definition at line 116 of file Channel.cpp.

Referenced by getLeftBottomY(), getRightUpperY(), main(), MTChannel::MTChannel(), CalibMicrorocParser::newHit(), CalibHR2Parser::newHit(), CalibHR1Parser::newHit(), and operator<<().

00117 {
00118 
00119   float result = 0.;
00120   if ( getChamber().getZrotation() == 90 )
00121   {
00122     result = -(getXRelative() + chip.getXRelative() +  chip.getBoard().getXRelative());
00123  }
00124   else if ( getChamber().getZrotation() == -90 )
00125   {
00126     result = (getXRelative() + chip.getXRelative() +  chip.getBoard().getXRelative());
00127  }
00128   else {
00129     result =  getYRelative() +  chip.getYRelative() + chip.getBoard().getYRelative();
00130   }
00131   if ( getChamber().getXrotation() )
00132   {
00133     result = - result;
00134   }
00135   return result + getChamber().getY();
00136 
00137 
00138 
00139 }

float Channel::getZ (  )  const

Definition at line 153 of file Channel.cpp.

Referenced by main(), MTChannel::MTChannel(), and operator<<().

00154 {
00155   return getChamber().getZ();
00156 }

const float Channel::getLeftBottomX (  )  const

Definition at line 159 of file Channel.cpp.

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

const float Channel::getLeftBottomY (  )  const

Definition at line 166 of file Channel.cpp.

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

const float Channel::getRightUpperX (  )  const

Definition at line 173 of file Channel.cpp.

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

const float Channel::getRightUpperY (  )  const

Definition at line 180 of file Channel.cpp.

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

const ui16 Channel::getColInChamberRelative (  )  const

Definition at line 195 of file Channel.cpp.

Referenced by getColInChamber(), and getRowInChamber().

00196   {
00197     const Board& board = chip.getBoard();
00198     ui16 chipCol =  ( board.getColumn() * board.getNbColumns() ) + chip.getColumn();
00199     return chipCol * chip.getNbColumns() + getColumn();
00200   }

const ui16 Channel::getRowInChamberRelative (  )  const

Definition at line 202 of file Channel.cpp.

Referenced by getColInChamber(), and getRowInChamber().

00203   {
00204     const Board& board = chip.getBoard();
00205     ui16 chipRow =  ( board.getRow() * board.getNbRows() ) + chip.getRow();
00206     return chipRow * chip.getNbRows() + getRow();
00207   }

const ui16 Channel::getColInChamber (  )  const

Definition at line 210 of file Channel.cpp.

Referenced by MTChannel::MTChannel().

00211   {
00212     ui16 result = 0;
00213     const Board& board = chip.getBoard();
00214     const Chamber& chamber = board.getChamber();
00215     if ( chamber.getZrotation() == 90 )
00216     {
00217       ui16 nbTotalRow = chamber.getNbRows() * board.getNbRows() *  chip.getNbRows();
00218       result =  nbTotalRow - (getRowInChamberRelative()+1);     
00219     }
00220     else if ( chamber.getZrotation() == -90 )
00221     {
00222       result =  getRowInChamberRelative();
00223     }
00224     else // no roration
00225     {
00226       result =  getColInChamberRelative();
00227     }
00228 
00229     if (  chamber.getXrotation() == true )
00230     {
00231       ui16 nbTotalCol = chamber.getNbColumns() * board.getNbColumns() *  chip.getNbColumns();
00232       result = nbTotalCol - (result+1);
00233     }
00234 
00235     return result;
00236     
00237   }

const ui16 Channel::getRowInChamber (  )  const

Definition at line 239 of file Channel.cpp.

Referenced by MTChannel::MTChannel().

00240   {
00241     ui16 result = 0;
00242     const Board& board = chip.getBoard();
00243     const Chamber& chamber = board.getChamber();
00244     if ( chamber.getZrotation() == 90 )
00245     {
00246       result =  getColInChamberRelative();
00247     }
00248     else if ( chamber.getZrotation() == -90 )
00249     {
00250       ui16 nbTotalCol = chamber.getNbColumns() * board.getNbColumns() *  chip.getNbColumns();
00251       result =  nbTotalCol - (getColInChamberRelative()+1);
00252     }
00253     else
00254     {
00255       result =  getRowInChamberRelative() ;
00256     }
00257     if (  chamber.getYrotation() == true )
00258     {
00259       ui16 nbTotalRow = chamber.getNbRows() * board.getNbRows() *  chip.getNbRows();
00260       result = nbTotalRow - (result+1);
00261     }
00262     return result;
00263   }

virtual const ui32 Channel::getXLength (  )  const [pure virtual]

Implemented in DiracChannel, GassiplexChannel, GassiplexStripChannel, Hardroc1Channel, Hardroc2Channel, Hardroc2IPNLChannel, and MicrorocChannel.

Referenced by getLeftBottomX(), getLeftBottomY(), getRightUpperX(), and getRightUpperY().

virtual const ui32 Channel::getYLength (  )  const [pure virtual]

Implemented in DiracChannel, GassiplexChannel, GassiplexStripChannel, Hardroc1Channel, Hardroc2Channel, Hardroc2IPNLChannel, and MicrorocChannel.

Referenced by getLeftBottomX(), getLeftBottomY(), getRightUpperX(), and getRightUpperY().

virtual bool Channel::valueIsValid ( const int  value  )  [inline, virtual]

Definition at line 86 of file Channel.hh.

00086 { return(0); };

bool Channel::getEnable (  )  const [inline]

Definition at line 88 of file Channel.hh.

00088 { return enable;};

bool Channel::getStimulate (  )  const [inline]

Definition at line 89 of file Channel.hh.

00089 { return stimulate;};

unsigned int Channel::getPedestalOffset (  )  const [inline]

Definition at line 90 of file Channel.hh.

00090 {return pedestal_offset;};

void Channel::setEnable ( bool  _value  )  [inline]

Definition at line 92 of file Channel.hh.

Referenced by DiracChip::read().

00092 { enable = _value; };

void Channel::setStimulate ( bool  _value  )  [inline]

Definition at line 93 of file Channel.hh.

00093 { stimulate = _value; };

void Channel::setPedestalOffset ( unsigned int  value  )  [inline]

Definition at line 94 of file Channel.hh.

00094 { pedestal_offset = value; };

const float Channel::getXRelative (  )  const

Definition at line 107 of file Channel.cpp.

Referenced by getX(), and getY().

00108 {
00109 
00110   float result = -( chip.getXLength() / 2. ) + ( row * this->getXLength() )  + ( this->getXLength() / 2. );
00111 
00112   return result;
00113 }

const float Channel::getYRelative (  )  const

Definition at line 141 of file Channel.cpp.

Referenced by getX(), and getY().

00142 {
00143   float result = 0.;
00144 
00145 
00146   result = - ( chip.getYLength() / 2. ) + ( column * this->getYLength() )  + ( this->getYLength() / 2. );
00147 
00148 
00149   return result ;
00150 }


Friends And Related Function Documentation

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

Definition at line 16 of file Channel.cpp.

00016                                                            {
00017   out << "        " << x.description << " id " << x.hardId
00018       << ", position [x/y/z] @[" << x.getX() << ", " << x.getY() << ", " << x.getZ() << "], "
00019       << "[col/row]=>["<< x.column << "/" << x.row << "]";
00020   return(out);
00021 } // operator <<


Member Data Documentation

const Chip& Channel::chip [protected]

Definition at line 102 of file Channel.hh.

Referenced by Channel(), getChamber(), getChip(), getColInChamber(), getColInChamberRelative(), getLeftBottomX(), getLeftBottomY(), getRightUpperX(), getRightUpperY(), getRowInChamber(), getRowInChamberRelative(), getX(), getXRelative(), getY(), and getYRelative().

std::string Channel::description [protected]

the chip this channel belongs to

Definition at line 103 of file Channel.hh.

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

ui32 Channel::hardId [protected]

short description

Definition at line 104 of file Channel.hh.

Referenced by getHardId(), operator<<(), and operator=().

ui32 Channel::column [protected]

unique within a chamber

Definition at line 105 of file Channel.hh.

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

ui32 Channel::row [protected]

Definition at line 105 of file Channel.hh.

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

bool Channel::enable [protected]

Z position is done by the corresponding Chamber

Definition at line 108 of file Channel.hh.

Referenced by Channel(), getEnable(), operator=(), and setEnable().

bool Channel::stimulate [protected]

Definition at line 109 of file Channel.hh.

Referenced by Channel(), getStimulate(), operator=(), and setStimulate().

unsigned int Channel::pedestal_offset [protected]

Definition at line 110 of file Channel.hh.

Referenced by getPedestalOffset(), operator=(), and setPedestalOffset().

ChannelSoftId Channel::channelSoftId [protected]

Definition at line 112 of file Channel.hh.

Referenced by Channel(), and getSoftId().


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