26 const std::string&
name,
27 const IInterface* parent)
31 declareInterface<IL1CPHitsTools>(
this);
49 return StatusCode::SUCCESS;
56 return StatusCode::SUCCESS;
66 for (; pos != pose; ++pos) {
77 std::vector<const DataVector<CPMRoI>*> cpmRoiColls(1, cpmRoiVec);
88 std::map<unsigned int, CPMHits*> cpmHitsMap;
90 int timeslices = cpmRoiColls.size();
92 for (
int slice = 0; slice < timeslices; ++slice) {
95 for (it=cpmRoiVec->
begin(); it!=cpmRoiVec->
end(); ++it){
97 unsigned int crate = roi->
crate();
98 unsigned int module = roi->
cpm();
99 unsigned int key = testKey.
cpmKey(crate, module);
103 if (timeslices > 1)
ATH_MSG_DEBUG(
"Slice " << slice <<
", ");
105 <<
coord.eta() <<
", " <<
coord.phi() <<
") " <<
", RoIWord = "
106 << std::hex << roi->
roiWord() << std::dec );
107 ATH_MSG_DEBUG(
"Crate = " << crate <<
", Module = " << module
108 <<
", CPM key = " << key );
112 std::map<unsigned int, CPMHits*>::iterator test=cpmHitsMap.find(key);
114 if ( test==cpmHitsMap.end()){
116 << crate <<
", Module = " << module );
118 cpmHits =
new CPMHits(crate, module);
119 if (timeslices > 1) {
121 cpmHits->
addHits(hitVec, hitVec);
127 std::map<unsigned int,CPMHits*>::value_type(key,cpmHits));
132 cpmHits = test->second;
138 unsigned int hits0 = hitvec0[slice];
139 unsigned int hits1 = hitvec1[slice];
142 hitvec0[slice] = hits0;
143 hitvec1[slice] = hits1;
144 cpmHits->
addHits(hitvec0, hitvec1);
173 for (; pos != pose; ++pos) {
175 int crate = hits->crate();
176 int cpm = hits->module();
177 int peak = hits->peak();
203 for (; pos != pose; ++pos) {
205 int dataId = hits->dataID();
206 if (dataId > 14)
continue;
207 int crate = hits->crate();
208 int peak = hits->peak();
209 if (peak > peakm) peakm = peak;
215 }
else if (crate == 1) {
218 }
else if (crate == 2) {
221 }
else if (crate == 3) {
254 for (; pos != pose; ++pos) {
256 if (hits->crate() != 3)
continue;
257 int dataId = hits->dataID();
262 int peak = hits->peak();
263 if (peak > peakm) peakm = peak;
277 int size1 = vec1.size();
278 int size2 = vec2.size();
279 if (size1 < size2) vec1.resize(size2);
280 HitsVector::iterator pos1 = vec1.begin();
281 HitsVector::iterator pose1 = vec1.end();
282 HitsVector::const_iterator pos2 = vec2.begin();
283 HitsVector::const_iterator pose2 = vec2.end();
284 for (; pos1 != pose1 && pos2 != pose2; ++pos1, ++pos2) {
285 *pos1 =
addHits(*pos1, *pos2, 24, 24);
293 int multBits,
int vecBits)
const
295 ATH_MSG_DEBUG(
"addHits: Original hitMult = " << std::hex << hitMult
296 <<
". Add hitWord = " << hitVec << std::dec);
301 int nbitsOut = multBits/nthresh;
302 int nbitsIn = vecBits/nthresh;
306 int max = (1<<nbitsOut) - 1;
307 unsigned int multMask =
max;
308 unsigned int hitMask = (1<<nbitsIn) - 1;
309 unsigned int shift = 0;
311 unsigned int hits = 0;
313 for (
int i = 0; i < nthresh; i++) {
314 int mult = (hitMult&multMask) + (hitVec&hitMask);
315 mult = ( (mult<=
max) ? mult :
max);
316 hits += (mult<<shift);
318 hitMult >>= nbitsOut;
324 << std::hex << hits << std::dec );
334 int size = cmmHitsVec2->
size();
341 cmmHitsVec2->
clear();
349 int crate,
int dataId,
int peak)
const
351 if (std::accumulate(hits0.begin(), hits0.end(), 0) ||
352 std::accumulate(hits1.begin(), hits1.end(), 0)) {
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
void swapElement(size_type index, value_type newElem, reference oldElem)
Swap one element out of the container.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.
Summary of CP (EM/tau) hits received by the merger modules.
The CPMHits object contains the hit data produced by a given Cluster Processor Module,...
const std::vector< unsigned int > & HitsVec0() const
Multi-slice accessors.
void addHits(const std::vector< unsigned int > &hits0, const std::vector< unsigned int > &hits1)
Add hits to existing object.
const std::vector< unsigned int > & HitsVec1() const
void setPeak(int peak)
In multi-slice readout, need to specify which is peak slice.
uint32_t roiWord() const
Return packed RoI word.
int crate() const
Return crate number (0-1)
int cpm() const
Return CPM number (1-14)
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
The ClusterProcessorModuleKey object provides the key for each trigger tower depending on its eta-phi...
unsigned int cpmKey(unsigned int crate, unsigned int module)
calculates key from crate and module index
CoordinateRange class declaration.
static const unsigned int numOfCPThresholds
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...