00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef RawEvent_RawEventHeader_H
00016 #define RawEvent_RawEventHeader_H 1
00017
00018
00019 #include "Event/HeaderObject.h"
00020 #include "Conventions/Trigger.h"
00021 #include "Conventions/DetectorId.h"
00022 #include "Conventions/Site.h"
00023 #include "GaudiKernel/boost_allocator.h"
00024 #include "GaudiKernel/SerializeSTL.h"
00025 #include <ostream>
00026
00027
00028
00029 namespace DayaBay
00030 {
00031
00032
00033 class RawRom;
00034 using GaudiUtils::operator<<;
00035
00036
00037
00038 static const CLID CLID_RawEventHeader = 51901;
00039
00040
00041 namespace RawEventHeaderLocation {
00042 static const std::string& Default = "/Event/Raw/RawEventHeader";
00043 }
00044
00045
00055 class RawEventHeader: public HeaderObject
00056 {
00057 public:
00058
00060 static const std::string& defaultLocation() { return RawEventHeaderLocation::Default; }
00061 virtual const std::string& defLoc() const { return RawEventHeaderLocation::Default; }
00062
00064 RawEventHeader() : m_dataBlockNum(0),
00065 m_dataBlockSize(0),
00066 m_formatVersionMajor(0),
00067 m_formatVersionMinor(0),
00068 m_evtSize(0),
00069 m_detId(0),
00070 m_siteId(0),
00071 m_positionId(0),
00072 m_runNum(0),
00073 m_evtNum(0),
00074 m_dataType(0),
00075 m_dataTypeSpecific(0),
00076 m_dataStatus(0),
00077 m_modules() {}
00078
00080 ~RawEventHeader();
00081
00082
00083 virtual const CLID& clID() const;
00084 static const CLID& classID();
00085
00087 virtual std::ostream& fillStream(std::ostream& s) const;
00088
00090 Trigger::TriggerType_t triggerType() const;
00091
00093 Site::Site_t getSiteId() const;
00094
00096 DetectorId::DetectorId_t detectorId() const;
00097
00100 int dataBlockNum() const;
00101
00104 void setDataBlockNum(int value);
00105
00108 int dataBlockSize() const;
00109
00112 void setDataBlockSize(int value);
00113
00116 int formatVersionMajor() const;
00117
00120 void setFormatVersionMajor(int value);
00121
00124 int formatVersionMinor() const;
00125
00128 void setFormatVersionMinor(int value);
00129
00132 int evtSize() const;
00133
00136 void setEvtSize(int value);
00137
00140 int detId() const;
00141
00144 void setDetId(int value);
00145
00148 int siteId() const;
00149
00152 void setSiteId(int value);
00153
00156 int positionId() const;
00157
00160 void setPositionId(int value);
00161
00164 int runNum() const;
00165
00168 void setRunNum(int value);
00169
00172 int evtNum() const;
00173
00176 void setEvtNum(int value);
00177
00180 int dataType() const;
00181
00184 void setDataType(int value);
00185
00188 int dataTypeSpecific() const;
00189
00192 void setDataTypeSpecific(int value);
00193
00196 int dataStatus() const;
00197
00200 void setDataStatus(int value);
00201
00204 const std::vector<DayaBay::RawRom*>& modules() const;
00205
00208 void setModules(const std::vector<DayaBay::RawRom*>& value);
00209
00210
00211 #ifndef GOD_NOALLOC
00213 static void* operator new ( size_t size )
00214 {
00215 return ( sizeof(RawEventHeader) == size ?
00216 boost::singleton_pool<RawEventHeader, sizeof(RawEventHeader)>::malloc() :
00217 ::operator new(size) );
00218 }
00219
00223 static void* operator new ( size_t size, void* pObj )
00224 {
00225 return ::operator new (size,pObj);
00226 }
00227
00229 static void operator delete ( void* p )
00230 {
00231 boost::singleton_pool<RawEventHeader, sizeof(RawEventHeader)>::is_from(p) ?
00232 boost::singleton_pool<RawEventHeader, sizeof(RawEventHeader)>::free(p) :
00233 ::operator delete(p);
00234 }
00235
00238 static void operator delete ( void* p, void* pObj )
00239 {
00240 ::operator delete (p, pObj);
00241 }
00242 #endif
00243 protected:
00244
00245 private:
00246
00247 int m_dataBlockNum;
00248 int m_dataBlockSize;
00249 int m_formatVersionMajor;
00250 int m_formatVersionMinor;
00251 int m_evtSize;
00252 int m_detId;
00253 int m_siteId;
00254 int m_positionId;
00255 int m_runNum;
00256 int m_evtNum;
00257 int m_dataType;
00258 int m_dataTypeSpecific;
00259 int m_dataStatus;
00260 std::vector<DayaBay::RawRom*> m_modules;
00261
00262 };
00263
00264 inline std::ostream& operator<< (std::ostream& str, const RawEventHeader& obj)
00265 {
00266 return obj.fillStream(str);
00267 }
00268
00269 }
00270
00271
00272
00273
00274
00275
00276 #include "Event/RawRom.h"
00277
00278
00279 inline DayaBay::RawEventHeader::~RawEventHeader()
00280 {
00281
00282 for(unsigned int i=0; i<m_modules.size(); i++) {
00283 delete m_modules[i];
00284 }
00285 m_modules.clear();
00286
00287 }
00288
00289 inline const CLID& DayaBay::RawEventHeader::clID() const
00290 {
00291 return DayaBay::RawEventHeader::classID();
00292 }
00293
00294 inline const CLID& DayaBay::RawEventHeader::classID()
00295 {
00296 return CLID_RawEventHeader;
00297 }
00298
00299 inline std::ostream& DayaBay::RawEventHeader::fillStream(std::ostream& s) const
00300 {
00301 HeaderObject::fillStream(s);
00302 s << "{ " << "dataBlockNum : " << m_dataBlockNum << std::endl
00303 << "dataBlockSize : " << m_dataBlockSize << std::endl
00304 << "formatVersionMajor : " << m_formatVersionMajor << std::endl
00305 << "formatVersionMinor : " << m_formatVersionMinor << std::endl
00306 << "evtSize : " << m_evtSize << std::endl
00307 << "detId : " << m_detId << std::endl
00308 << "siteId : " << m_siteId << std::endl
00309 << "positionId : " << m_positionId << std::endl
00310 << "runNum : " << m_runNum << std::endl
00311 << "evtNum : " << m_evtNum << std::endl
00312 << "dataType : " << m_dataType << std::endl
00313 << "dataTypeSpecific : " << m_dataTypeSpecific << std::endl
00314 << "dataStatus : " << m_dataStatus << std::endl
00315 << "modules : " << m_modules << std::endl << " }";
00316 return s;
00317 }
00318
00319
00320 inline int DayaBay::RawEventHeader::dataBlockNum() const
00321 {
00322 return m_dataBlockNum;
00323 }
00324
00325 inline void DayaBay::RawEventHeader::setDataBlockNum(int value)
00326 {
00327 m_dataBlockNum = value;
00328 }
00329
00330 inline int DayaBay::RawEventHeader::dataBlockSize() const
00331 {
00332 return m_dataBlockSize;
00333 }
00334
00335 inline void DayaBay::RawEventHeader::setDataBlockSize(int value)
00336 {
00337 m_dataBlockSize = value;
00338 }
00339
00340 inline int DayaBay::RawEventHeader::formatVersionMajor() const
00341 {
00342 return m_formatVersionMajor;
00343 }
00344
00345 inline void DayaBay::RawEventHeader::setFormatVersionMajor(int value)
00346 {
00347 m_formatVersionMajor = value;
00348 }
00349
00350 inline int DayaBay::RawEventHeader::formatVersionMinor() const
00351 {
00352 return m_formatVersionMinor;
00353 }
00354
00355 inline void DayaBay::RawEventHeader::setFormatVersionMinor(int value)
00356 {
00357 m_formatVersionMinor = value;
00358 }
00359
00360 inline int DayaBay::RawEventHeader::evtSize() const
00361 {
00362 return m_evtSize;
00363 }
00364
00365 inline void DayaBay::RawEventHeader::setEvtSize(int value)
00366 {
00367 m_evtSize = value;
00368 }
00369
00370 inline int DayaBay::RawEventHeader::detId() const
00371 {
00372 return m_detId;
00373 }
00374
00375 inline void DayaBay::RawEventHeader::setDetId(int value)
00376 {
00377 m_detId = value;
00378 }
00379
00380 inline int DayaBay::RawEventHeader::siteId() const
00381 {
00382 return m_siteId;
00383 }
00384
00385 inline void DayaBay::RawEventHeader::setSiteId(int value)
00386 {
00387 m_siteId = value;
00388 }
00389
00390 inline int DayaBay::RawEventHeader::positionId() const
00391 {
00392 return m_positionId;
00393 }
00394
00395 inline void DayaBay::RawEventHeader::setPositionId(int value)
00396 {
00397 m_positionId = value;
00398 }
00399
00400 inline int DayaBay::RawEventHeader::runNum() const
00401 {
00402 return m_runNum;
00403 }
00404
00405 inline void DayaBay::RawEventHeader::setRunNum(int value)
00406 {
00407 m_runNum = value;
00408 }
00409
00410 inline int DayaBay::RawEventHeader::evtNum() const
00411 {
00412 return m_evtNum;
00413 }
00414
00415 inline void DayaBay::RawEventHeader::setEvtNum(int value)
00416 {
00417 m_evtNum = value;
00418 }
00419
00420 inline int DayaBay::RawEventHeader::dataType() const
00421 {
00422 return m_dataType;
00423 }
00424
00425 inline void DayaBay::RawEventHeader::setDataType(int value)
00426 {
00427 m_dataType = value;
00428 }
00429
00430 inline int DayaBay::RawEventHeader::dataTypeSpecific() const
00431 {
00432 return m_dataTypeSpecific;
00433 }
00434
00435 inline void DayaBay::RawEventHeader::setDataTypeSpecific(int value)
00436 {
00437 m_dataTypeSpecific = value;
00438 }
00439
00440 inline int DayaBay::RawEventHeader::dataStatus() const
00441 {
00442 return m_dataStatus;
00443 }
00444
00445 inline void DayaBay::RawEventHeader::setDataStatus(int value)
00446 {
00447 m_dataStatus = value;
00448 }
00449
00450 inline const std::vector<DayaBay::RawRom*>& DayaBay::RawEventHeader::modules() const
00451 {
00452 return m_modules;
00453 }
00454
00455 inline void DayaBay::RawEventHeader::setModules(const std::vector<DayaBay::RawRom*>& value)
00456 {
00457 m_modules = value;
00458 }
00459
00460 inline DayaBay::Trigger::TriggerType_t DayaBay::RawEventHeader::triggerType() const
00461 {
00462
00463 return (DayaBay::Trigger::TriggerType_t)(m_positionId > 0 ? 1 << (m_positionId + 1) : m_positionId);
00464
00465 }
00466
00467 inline Site::Site_t DayaBay::RawEventHeader::getSiteId() const
00468 {
00469
00470 return (Site::Site_t)(m_siteId == 0 ? m_siteId : 1 << (m_siteId - 1));
00471
00472 }
00473
00474 inline DetectorId::DetectorId_t DayaBay::RawEventHeader::detectorId() const
00475 {
00476
00477 return (DetectorId::DetectorId_t)m_positionId;
00478
00479 }
00480
00481
00482 #endif