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
void setValidFlag (ui16 value)
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 78 of file Event.cpp.

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

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

Definition at line 90 of file Event.cpp.

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

Event::~Event (  ) 

Definition at line 101 of file Event.cpp.

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


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 322 of file Event.cpp.

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

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 189 of file Event.cpp.

Referenced by getChannelHitByOrder().

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

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

Definition at line 176 of file Event.cpp.

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

void Event::insertHit ( Chamber ,
ChannelHit  
)

Definition at line 152 of file Event.cpp.

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

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

Definition at line 140 of file Event.cpp.

Referenced by MTEvent::operator=().

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

void Event::print ( void   )  const

Definition at line 246 of file Event.cpp.

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

void Event::setSlowControlParam ( const SlowControlEntry params  ) 

Definition at line 236 of file Event.cpp.

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

const float Event::getPressure (  )  const

Definition at line 253 of file Event.cpp.

Referenced by MTEvent::operator=().

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

const float Event::getTemperature (  )  const

Definition at line 266 of file Event.cpp.

Referenced by MTEvent::operator=().

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

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 293 of file Event.cpp.

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

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

Definition at line 307 of file Event.cpp.

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

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

Definition at line 279 of file Event.cpp.

Referenced by MTEvent::operator=().

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

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;} ;

void Event::setValidFlag ( ui16  value  )  [inline]

Definition at line 86 of file Event.hh.

00086 { valid = valid+value; }; 

bool Event::isValid ( void   ) 

Definition at line 491 of file Event.cpp.

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

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

Definition at line 333 of file Event.cpp.

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

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 95 of file Event.hh.

00095 { return temperatureAsu1; } ;

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

Definition at line 96 of file Event.hh.

00096 { return temperatureAsu2; } ;

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

Definition at line 97 of file Event.hh.

00097 { return temperatureDif; } ;

void Event::initChannelHitVector ( void   )  [private]

Definition at line 126 of file Event.cpp.

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


Friends And Related Function Documentation

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

Definition at line 73 of file Event.cpp.

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


Member Data Documentation

i32 Event::id [private]

Definition at line 107 of file Event.hh.

Referenced by getId().

const Run& Event::run [private]

Definition at line 108 of file Event.hh.

Referenced by getRun(), and initChannelHitVector().

i64 Event::timestamp [private]

Definition at line 109 of file Event.hh.

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

i32 Event::difSynchro [private]

Definition at line 110 of file Event.hh.

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

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

Definition at line 111 of file Event.hh.

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

const SlowControlEntry* Event::slowControlEntry [private]

Definition at line 112 of file Event.hh.

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

ui32 Event::globalTriggerCounter [private]

Definition at line 113 of file Event.hh.

Referenced by getGlobalTriggerCounter(), and setGlobalTriggerCounter().

ui32 Event::difTriggerCounter [private]

Definition at line 114 of file Event.hh.

Referenced by getDifTriggerCounter(), and setDifTriggerCounter().

bool Event::crcIsCorrect [private]

Definition at line 115 of file Event.hh.

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

ui16 Event::valid [private]

Definition at line 116 of file Event.hh.

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

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

Definition at line 118 of file Event.hh.

Referenced by getTemperatureAsu1(), and setTemperature().

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

Definition at line 119 of file Event.hh.

Referenced by getTemperatureAsu2(), and setTemperature().

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

Definition at line 120 of file Event.hh.

Referenced by getTemperatureDif(), and setTemperature().


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 16:58:24 2012 for MicromegasFramework by  doxygen 1.4.7