Event Class Reference

#include <Event.hh>

Collaboration diagram for Event:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Event (Run &aRun)
 Event (Run &, i64 aTimestamp, i32 aId)
 ~Event ()
std::ostream & operator<< (std::ostream &out) const
const RungetRun (void) const
i32 getId (void) const
void setId (i32 aId)
const i64 getTimeStamp (void) const
const i32 getDifSynchro (void) const
void setTimeStamp (i64 aTimestamp)
void setDifSyncrho (i32 aDifSynchro)
ui64 getChannelHitSize (ui32 chamberId) const
ui64 getChannelHitSize () const
std::map< ui16, std::multiset<
ChannelHit *, sorter > * > & 
getChannelHits ()
const ChannelHitgetChannelHitByOrder (ui64 order, const Chamber &aChamber)
const ChannelHitgetChannelHitByOrder (ui64 order, const Chamber &aChamber, i16 aThreshold)
void insertHit (Chamber &, ChannelHit *)
const std::multiset< ChannelHit *,
sorter > & 
getChannelHitVector (const Chamber &aChamber) const
void print (void) const
void setSlowControlParam (const SlowControlEntry *params)
const float getPressure () const
const float getTemperature () const
const SlowControlEntrygetSlowControlEntry ()
const float getBoardDriftVolt (const ui32 chamberId, const ui32 difId, const ui32 boardId) const
const float getBoardMeshVolt (const ui32 chamberId, const ui32 difId, const ui32 boardId) const
const BoardSlowControlgetBoardSlowControl (const ui32 chamberId, const ui32 difId, const ui32 boardId) const
void setGlobalTriggerCounter (ui32 value)
void setDifTriggerCounter (ui32 value)
ui32 getGlobalTriggerCounter (void) const
ui32 getDifTriggerCounter (void) const
bool getCrcIsCorrect (void) const
void setCrcIsCorrect (bool value)
ui16 getValidFlag (void) const
std::string getValidFlagString (void) const
void setValidFlag (ui16 value, bool valid=true)
bool isValid (void)
void setTemperature (ui16 difId, float asu1, float asu2, float dif)
float getTemperatureAsu1 (ui16 difId) const
float getTemperatureAsu2 (ui16 difId) const
float getTemperatureDif (ui16 difId) const
std::map< unsigned int, float > getTemperatureAsu1 (void) const
std::map< unsigned int, float > getTemperatureAsu2 (void) const
std::map< unsigned int, float > getTemperatureDif (void) const

Private Member Functions

void initChannelHitVector (void)

Private Attributes

i32 id
const Runrun
i64 timestamp
i32 difSynchro
std::map< ui16, std::multiset<
ChannelHit *, sorter > * > 
channelHits
const SlowControlEntryslowControlEntry
ui32 globalTriggerCounter
ui32 difTriggerCounter
bool crcIsCorrect
ui16 valid
std::map< unsigned int, float > temperatureAsu1
std::map< unsigned int, float > temperatureAsu2
std::map< unsigned int, float > temperatureDif

Friends

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

Detailed Description

CLASS EVENT //

Definition at line 39 of file Event.hh.


Constructor & Destructor Documentation

Event::Event ( Run aRun  ) 

Definition at line 79 of file Event.cpp.

00079                      :run(aRun), slowControlEntry(NULL)
00080 {
00081   //FILE_LOG(logDEBUG) << "-Event contructor"<< endl;
00082 //  initChannelHitVector();
00083 timestamp = 0;
00084 difSynchro = 0;
00085 id = 0;
00086 slowControlEntry = NULL;
00087 crcIsCorrect = true;
00088 valid = VALID;
00089 }

Event::Event ( Run ,
i64  aTimestamp,
i32  aId 
)

Definition at line 91 of file Event.cpp.

00091                                                :run(aRun), timestamp(aTimestamp), id(aId), slowControlEntry(NULL)
00092  {
00093   timestamp = 0;
00094   difSynchro = 0;
00095   id = 0;
00096   slowControlEntry = NULL;
00097   crcIsCorrect = true;
00098   valid = VALID;
00099      //FILE_LOG(logDEBUG) << "-Event contructor with id: "<< aId << endl;
00100  }

Event::~Event (  ) 

Definition at line 102 of file Event.cpp.

00103 {
00104   //FILE_LOG(logDEBUG) << "-Event destructor"<< endl;
00105 
00106    map<ui16, multiset<ChannelHit*,sorter>* >::iterator iter;
00107 
00108   for (iter=channelHits.begin(); iter!=channelHits.end(); iter++)
00109   {
00110       multiset<ChannelHit*,sorter>* list = (*iter).second;
00111       for (multiset<ChannelHit*,sorter>::iterator iterList = list->begin(); iterList!=list->end(); iterList++ )
00112       {
00113           delete (*iterList);
00114       }
00115       delete list;
00116   }
00117 
00118 }


Member Function Documentation

std::ostream& Event::operator<< ( std::ostream &  out  )  const

const Run& Event::getRun ( void   )  const [inline]

Definition at line 49 of file Event.hh.

Referenced by MTEvent::operator=().

00049 { return run; }

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

Definition at line 50 of file Event.hh.

Referenced by MTEvent::operator=().

00050 { return id; }

void Event::setId ( i32  aId  )  [inline]

Definition at line 51 of file Event.hh.

00051 { id = aId; }

const i64 Event::getTimeStamp ( void   )  const [inline]

Definition at line 52 of file Event.hh.

Referenced by MTEvent::operator=().

00052 { return timestamp; }

const i32 Event::getDifSynchro ( void   )  const [inline]

Definition at line 53 of file Event.hh.

Referenced by MTEvent::operator=().

00053 { return difSynchro; }

void Event::setTimeStamp ( i64  aTimestamp  )  [inline]

Definition at line 54 of file Event.hh.

00054 { timestamp = aTimestamp; }

void Event::setDifSyncrho ( i32  aDifSynchro  )  [inline]

Definition at line 55 of file Event.hh.

00055 { difSynchro = aDifSynchro; }

ui64 Event::getChannelHitSize ( ui32  chamberId  )  const [inline]

Definition at line 57 of file Event.hh.

00057 { return channelHits.find(chamberId)->second->size(); }

ui64 Event::getChannelHitSize (  )  const

Definition at line 323 of file Event.cpp.

00324 { 
00325     ui64 size = 0;
00326     for ( std::map<ui16, std::multiset<ChannelHit*,sorter>* >::const_iterator it=channelHits.begin(); it != channelHits.end() ; it++)
00327     {
00328             size +=it->second->size();
00329     }
00330     return size;
00331 }

std::map<ui16, std::multiset<ChannelHit*,sorter>* >& Event::getChannelHits (  )  [inline]

Definition at line 59 of file Event.hh.

00059 { return channelHits; } ;

const ChannelHit & Event::getChannelHitByOrder ( ui64  order,
const Chamber aChamber 
)

Definition at line 190 of file Event.cpp.

Referenced by getChannelHitByOrder().

00191  {
00192         multiset<ChannelHit*,sorter>* chamberChannelHit = this->channelHits.find(aChamber.getId())->second;//channelHits[aChamber.getId()];
00193         ui64 items=0;
00194                 // Find first chamberChannelHit for select chamber
00195         for (multiset<ChannelHit*,sorter>::const_iterator iter=chamberChannelHit->begin(); iter!=chamberChannelHit->end(); iter++)
00196         {
00197                 if ( (*iter)->getChannel().getChamber().getId() == aChamber.getId() )
00198                 {
00199                     if ( order == items)
00200                     {
00201                         return *(*iter);
00202                     }
00203 
00204                     items++;
00205                 }
00206 
00207         }
00208   throw MicroException("No Channel respond or this event, this order and this chamber ");
00209 
00210  }

const ChannelHit & Event::getChannelHitByOrder ( ui64  order,
const Chamber aChamber,
i16  aThreshold 
)

Definition at line 177 of file Event.cpp.

00178  {
00179      if ( getChannelHitByOrder(order+1,aChamber).getAnalogValue() <= aThreshold )
00180      {
00181          return getChannelHitByOrder(order,aChamber);
00182      }
00183      else
00184      {
00185          throw MicroException("No Channel respond for this event, this order, this threshold and this chamber ");
00186      }
00187  }

void Event::insertHit ( Chamber ,
ChannelHit  
)

Definition at line 153 of file Event.cpp.

00154     {
00155          ui16 chamberId  = aChamber.getId();
00156 
00157          multiset<ChannelHit*,sorter>* hits = NULL;
00158 
00159          map<ui16, multiset<ChannelHit*,sorter> *>::iterator iter = channelHits.find(chamberId);
00160 
00161          if( iter == channelHits.end() ) {
00162              hits = new  multiset<ChannelHit*, sorter>();
00163              channelHits.insert(pair<i32, multiset<ChannelHit*,sorter>* > (chamberId,hits));
00164          }
00165 
00166          else
00167          {
00168             hits = iter->second;
00169          }
00170 
00171          hits->insert(aChannelHit);
00172 
00173 
00174     }

const multiset< ChannelHit *, sorter > & Event::getChannelHitVector ( const Chamber aChamber  )  const

Definition at line 141 of file Event.cpp.

Referenced by MTEvent::operator=().

00142     {
00143 
00144          map<ui16, multiset<ChannelHit*,sorter>* >::const_iterator iter = channelHits.find(aChamber.getId());
00145          if( iter != channelHits.end() ) {
00146              return (*iter->second);
00147          }
00148 
00149          throw ( MicroException("No channelHit vector for this chamber"));
00150     //    return channelHits.find(aChamber.getId())->second;
00151     }

void Event::print ( void   )  const

Definition at line 247 of file Event.cpp.

00248 {
00249   FILE_LOG(logINFO) << "-Event id["<< id << "]" << endl;
00250   FILE_LOG(logINFO) << "-Event timestamp[" << timestamp << "]"  << endl ;
00251 }

void Event::setSlowControlParam ( const SlowControlEntry params  ) 

Definition at line 237 of file Event.cpp.

00238 {
00239   slowControlEntry = params;
00240   FILE_LOG(logDEBUG1) << "Event temperature["<< slowControlEntry->getTemperature() << "]" << endl;
00241   FILE_LOG(logDEBUG1) << "Event overPressure["<< slowControlEntry->getOverPressure() << "]" << endl;
00242   FILE_LOG(logDEBUG1) << "Event Pressure["<< slowControlEntry->getPressure() << "]" << endl;
00243 }

const float Event::getPressure (  )  const

Definition at line 254 of file Event.cpp.

Referenced by MTEvent::operator=().

00255 {
00256     if ( slowControlEntry != NULL)
00257     {
00258         return slowControlEntry->getPressure();
00259     }
00260     else
00261     {
00262         return 0;
00263     }
00264 
00265 }

const float Event::getTemperature (  )  const

Definition at line 267 of file Event.cpp.

Referenced by MTEvent::operator=().

00268 {
00269     if ( slowControlEntry != NULL)
00270     {
00271         return slowControlEntry->getTemperature();
00272     }
00273     else
00274     {
00275         return 0;
00276     }
00277 
00278 }

const SlowControlEntry* Event::getSlowControlEntry (  )  [inline]

Definition at line 73 of file Event.hh.

00073 { return slowControlEntry;};

const float Event::getBoardDriftVolt ( const ui32  chamberId,
const ui32  difId,
const ui32  boardId 
) const

Definition at line 294 of file Event.cpp.

00295 {
00296     if ( slowControlEntry != NULL)
00297     {
00298        try
00299        {
00300            return slowControlEntry->getBoard(chamberId,difId,boardId).getDrift().voltage;
00301        }
00302        catch ( MicroException e) {}
00303     }
00304     throw MicroException("Event::getBoardSlowControl: board not found");
00305 
00306 }

const float Event::getBoardMeshVolt ( const ui32  chamberId,
const ui32  difId,
const ui32  boardId 
) const

Definition at line 308 of file Event.cpp.

00309 {
00310     if ( slowControlEntry != NULL)
00311     {
00312        try
00313        {
00314            return slowControlEntry->getBoard(chamberId,difId,boardId).getMesh().voltage;
00315        }
00316        catch ( MicroException e) {}
00317     }
00318     //throw ( MicroException("No mesh voltage for this chamber"));
00319     return -1;
00320 
00321 }

const BoardSlowControl & Event::getBoardSlowControl ( const ui32  chamberId,
const ui32  difId,
const ui32  boardId 
) const

Definition at line 280 of file Event.cpp.

Referenced by MTEvent::operator=().

00281 {
00282     if ( slowControlEntry != NULL)
00283     {
00284        try
00285        {
00286            return slowControlEntry->getBoard(chamberId,difId,boardId);
00287        }
00288        catch ( MicroException e) {}
00289     }
00290 
00291     throw MicroException("Event::getBoardSlowControl: board not found");
00292 }

void Event::setGlobalTriggerCounter ( ui32  value  )  [inline]

Definition at line 79 of file Event.hh.

00079 { globalTriggerCounter = value; };

void Event::setDifTriggerCounter ( ui32  value  )  [inline]

Definition at line 80 of file Event.hh.

00080 { difTriggerCounter = value; };

ui32 Event::getGlobalTriggerCounter ( void   )  const [inline]

Definition at line 81 of file Event.hh.

Referenced by MTEvent::operator=().

00081 { return globalTriggerCounter; };

ui32 Event::getDifTriggerCounter ( void   )  const [inline]

Definition at line 82 of file Event.hh.

Referenced by MTEvent::operator=().

00082 { return difTriggerCounter; };

bool Event::getCrcIsCorrect ( void   )  const [inline]

Definition at line 83 of file Event.hh.

Referenced by MTEvent::operator=().

00083 { return crcIsCorrect;} ;

void Event::setCrcIsCorrect ( bool  value  )  [inline]

Definition at line 84 of file Event.hh.

00084 { crcIsCorrect = value; }; 

ui16 Event::getValidFlag ( void   )  const [inline]

Definition at line 85 of file Event.hh.

Referenced by MTEvent::operator=().

00085 { return valid;} ;

string Event::getValidFlagString ( void   )  const

Definition at line 505 of file Event.cpp.

00506 {
00507 string result;
00508   if ( (valid & VALID )               == VALID )               { result = result + " " + "VALID" ;}
00509   if ( (valid & UNKNOW_NOT_VALID )    == UNKNOW_NOT_VALID )    { result = result + " " + "UNKNOW_NOT_VALID" ;}
00510   if ( (valid & BAD_CHIP_ID )         == BAD_CHIP_ID )         { result = result + " " + "BAD_CHIP_ID" ;}
00511   if ( (valid & BAD_BOARD_ID )        == BAD_BOARD_ID )        { result = result + " " + "BAD_BOARD_ID" ;}
00512   if ( (valid & BAD_DIF_ID )          == BAD_DIF_ID )          { result = result + " " + "BAD_DIF_ID" ;}
00513   if ( (valid & CRC_ERROR )           == CRC_ERROR )           { result = result + " " + "CRC_ERROR" ;}
00514   if ( (valid & ONLY_FFFF)            == ONLY_FFFF )           { result = result + " " + "ONLY_FFFF" ;}
00515   if ( (valid & ONLY_AAAA)            == ONLY_AAAA )           { result = result + " " + "ONLY_AAAA" ;}
00516   if ( (valid & ONLY_5555)            == ONLY_5555 )           { result = result + " " + "ONLY_5555" ;}
00517   if ( (valid & GLOBAL_HEADER_ERROR)  == GLOBAL_HEADER_ERROR ) { result = result + " " + "GLOBAL_HEADER_ERROR" ;}
00518   if ( (valid & FRAME_HEADER_ERROR)   == FRAME_HEADER_ERROR )  { result = result + " " + "FRAME_HEADER_ERROR" ;}
00519   if ( (valid & TRAILER_C3_FOUND)     == TRAILER_C3_FOUND )    { result = result + " " + "TRAILER_C3_FOUND" ;}
00520   if ( (valid & END_OF_FILE_ERROR)    == END_OF_FILE_ERROR )   { result = result + " " + "END_OF_FILE_ERROR" ;}
00521 
00522 
00523   return result;
00524 }

void Event::setValidFlag ( ui16  value,
bool  valid = true 
)

Definition at line 499 of file Event.cpp.

00500 {
00501     valid = valid | value; 
00502     if ( ! isValid ) { valid = valid & 0xFFFE ; }
00503 }

bool Event::isValid ( void   ) 

Definition at line 492 of file Event.cpp.

00493 {
00494   if (( valid & VALID ) == VALID) return true;
00495   return false;
00496 }

void Event::setTemperature ( ui16  difId,
float  asu1,
float  asu2,
float  dif 
)

Definition at line 334 of file Event.cpp.

00335 {
00336   // Search or create difs container
00337     if ( temperatureAsu1.find(difId) != temperatureAsu1.end())
00338     { // dif already exit/ replace value
00339        temperatureAsu1[difId] = asu1;
00340     }
00341     else
00342     { // does not exit create it
00343       temperatureAsu1.insert(make_pair(difId,asu1));
00344     }
00345   // Search or create difs container
00346     if ( temperatureAsu2.find(difId) != temperatureAsu2.end())
00347     { // dif already exit/ replace value
00348        temperatureAsu2[difId] = asu2;
00349     }
00350     else
00351     { // does not exit create it
00352       temperatureAsu2.insert(make_pair(difId,asu2));
00353     }
00354   // Search or create difs container
00355     if ( temperatureDif.find(difId) != temperatureDif.end())
00356     { // dif already exit/ replace value
00357        temperatureDif[difId] = dif;
00358     }
00359     else
00360     { // does not exit create it
00361       temperatureDif.insert(make_pair(difId,dif));
00362     }
00363 
00364 }

float Event::getTemperatureAsu1 ( ui16  difId  )  const

Referenced by MTEvent::operator=().

float Event::getTemperatureAsu2 ( ui16  difId  )  const

Referenced by MTEvent::operator=().

float Event::getTemperatureDif ( ui16  difId  )  const

Referenced by MTEvent::operator=().

std::map<unsigned int,float> Event::getTemperatureAsu1 ( void   )  const [inline]

Definition at line 97 of file Event.hh.

00097 { return temperatureAsu1; } ;

std::map<unsigned int,float> Event::getTemperatureAsu2 ( void   )  const [inline]

Definition at line 98 of file Event.hh.

00098 { return temperatureAsu2; } ;

std::map<unsigned int,float> Event::getTemperatureDif ( void   )  const [inline]

Definition at line 99 of file Event.hh.

00099 { return temperatureDif; } ;

void Event::initChannelHitVector ( void   )  [private]

Definition at line 127 of file Event.cpp.

00128     {
00129       ChamberMap_t chambers = this->run.getDetector().getChambers();
00130 
00131       for (ChamberMap_t::iterator iter = chambers.begin() ; iter != chambers.end() ; iter++)
00132       {
00133         i32 chamberId  = (*iter).first;
00134         multiset<ChannelHit*, sorter> *list = new multiset<ChannelHit*, sorter>();
00135              FILE_LOG(logINFO) << "INIT map size BEFORE INSERT:[" << channelHits.size() << "]" << endl;
00136         channelHits[chamberId] = list;  // a ChannilHits* vector per Chamber
00137              FILE_LOG(logINFO) << "INIT map size AFTER INSERT:[" << channelHits.size() << "]" << endl;
00138       }
00139     }


Friends And Related Function Documentation

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

Definition at line 74 of file Event.cpp.

00074                                                            {
00075     return(x.operator <<(out));
00076   }


Member Data Documentation

i32 Event::id [private]

Definition at line 109 of file Event.hh.

Referenced by getId().

const Run& Event::run [private]

Definition at line 110 of file Event.hh.

Referenced by getRun(), and initChannelHitVector().

i64 Event::timestamp [private]

Definition at line 111 of file Event.hh.

Referenced by Event(), getTimeStamp(), print(), and setTimeStamp().

i32 Event::difSynchro [private]

Definition at line 112 of file Event.hh.

Referenced by Event(), getDifSynchro(), and setDifSyncrho().

std::map<ui16, std::multiset<ChannelHit*,sorter>* > Event::channelHits [private]

Definition at line 113 of file Event.hh.

Referenced by getChannelHitByOrder(), getChannelHits(), getChannelHitSize(), getChannelHitVector(), initChannelHitVector(), insertHit(), and ~Event().

const SlowControlEntry* Event::slowControlEntry [private]

Definition at line 114 of file Event.hh.

Referenced by Event(), getBoardDriftVolt(), getBoardMeshVolt(), getBoardSlowControl(), getPressure(), getSlowControlEntry(), getTemperature(), and setSlowControlParam().

ui32 Event::globalTriggerCounter [private]

Definition at line 115 of file Event.hh.

Referenced by getGlobalTriggerCounter(), and setGlobalTriggerCounter().

ui32 Event::difTriggerCounter [private]

Definition at line 116 of file Event.hh.

Referenced by getDifTriggerCounter(), and setDifTriggerCounter().

bool Event::crcIsCorrect [private]

Definition at line 117 of file Event.hh.

Referenced by Event(), getCrcIsCorrect(), and setCrcIsCorrect().

ui16 Event::valid [private]

Definition at line 118 of file Event.hh.

Referenced by Event(), getValidFlag(), getValidFlagString(), isValid(), and setValidFlag().

std::map<unsigned int,float> Event::temperatureAsu1 [private]

Definition at line 120 of file Event.hh.

Referenced by getTemperatureAsu1(), and setTemperature().

std::map<unsigned int,float> Event::temperatureAsu2 [private]

Definition at line 121 of file Event.hh.

Referenced by getTemperatureAsu2(), and setTemperature().

std::map<unsigned int,float> Event::temperatureDif [private]

Definition at line 122 of file Event.hh.

Referenced by getTemperatureDif(), and setTemperature().


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