#include <SimG4CMS/Forward/interface/TotemNumberMerger.h>
Public Member Functions | |
unsigned long | Merge (unsigned long value1, unsigned long value2, unsigned long value3, unsigned long value4) const |
unsigned long | Merge (unsigned long value1, unsigned long value2, unsigned long value3) const |
unsigned long | Merge (unsigned long value1, unsigned long value2) const |
void | Split (unsigned long source, unsigned long &value1, unsigned long &value2, unsigned long &value3, unsigned long &value4) const |
void | Split (unsigned long source, unsigned long &value1, unsigned long &value2, unsigned long &value3) const |
void | Split (unsigned long source, unsigned long &value1, unsigned long &value2) const |
TotemNumberMerger () | |
~TotemNumberMerger () |
Usage: Used in TotemOrganizations to get unique ID of sensitive detector element
Definition at line 29 of file TotemNumberMerger.h.
TotemNumberMerger::TotemNumberMerger | ( | ) |
Definition at line 23 of file TotemNumberMerger.cc.
References LogDebug.
00023 { 00024 #ifdef SCRIVI 00025 LogDebug("ForwardSim") << "Creating TotemNumberMerger"; 00026 #endif 00027 }
TotemNumberMerger::~TotemNumberMerger | ( | ) |
Definition at line 29 of file TotemNumberMerger.cc.
References LogDebug.
00029 { 00030 #ifdef SCRIVI 00031 LogDebug("ForwardSim") << "Destruction of TotemNumberMerger"; 00032 #endif 00033 }
unsigned long TotemNumberMerger::Merge | ( | unsigned long | value1, | |
unsigned long | value2, | |||
unsigned long | value3, | |||
unsigned long | value4 | |||
) | const |
unsigned long TotemNumberMerger::Merge | ( | unsigned long | value1, | |
unsigned long | value2, | |||
unsigned long | value3 | |||
) | const |
unsigned long TotemNumberMerger::Merge | ( | unsigned long | value1, | |
unsigned long | value2 | |||
) | const |
Definition at line 39 of file TotemNumberMerger.cc.
References c, LogDebug, HLT_VtxMuL3::result, and Split().
Referenced by TotemT1Organization::_FromDataToUnitID(), and Merge().
00040 { 00041 00042 unsigned long c(value1+value2); 00043 unsigned long result(((c*(c+1))>>1)+value1); 00044 00045 #ifdef SCRIVI 00046 LogDebug("ForwardSim") << "Merge(value1=" << value1 00047 << ", value2=" << value2 << ")=" << result; 00048 00049 unsigned long invValue1, invValue2; 00050 Split(result, invValue1, invValue2); 00051 00052 assert(invValue1==value1); 00053 assert(invValue2==value2); 00054 #endif 00055 00056 return result; 00057 }
void TotemNumberMerger::Split | ( | unsigned long | source, | |
unsigned long & | value1, | |||
unsigned long & | value2, | |||
unsigned long & | value3, | |||
unsigned long & | value4 | |||
) | const |
void TotemNumberMerger::Split | ( | unsigned long | source, | |
unsigned long & | value1, | |||
unsigned long & | value2, | |||
unsigned long & | value3 | |||
) | const |
void TotemNumberMerger::Split | ( | unsigned long | source, | |
unsigned long & | value1, | |||
unsigned long & | value2 | |||
) | const |
Definition at line 72 of file TotemNumberMerger.cc.
References c, LogDebug, and funct::sqrt().
Referenced by TotemT1Organization::_FromUnitIDToData(), Merge(), and Split().
00073 { 00074 unsigned long c(static_cast<unsigned long>(floor(sqrt(1.+8.*static_cast<float>(source))*0.5-0.5))); 00075 00076 value1 = source-((c*(c+1))>>1); 00077 value2 = c - value1; 00078 00079 #ifdef SCRIVI 00080 LogDebug("ForwardSim") << "source=" << source << ", c=" << c 00081 << ", value1=" << value1 << ", value2=" << value2; 00082 #endif 00083 }