274 {
275
276 const InDetDD::SiDetectorElement* element =
m_pixelRDOTool->checkCollection(collection, ctx);
277 if (element == nullptr){
278 return nullptr;
279 }
280
281 std::vector<UnpackedPixelRDO> collectionID =
282 m_pixelRDOTool->getUnpackedPixelRDOs(collection, pixelID, element, ctx);
283
284
285
286 if(collectionID.empty()) return nullptr;
287 if(collectionID.size() > 1)
std::sort(collectionID.begin(),collectionID.end(),pixel_less);
288
289
290
291 std::vector<network> connections(collectionID.size());
292
293
294
295 int collectionSize = collectionID.size();
296
297
298
300
301
302
303 for(int currentPixel = 0; currentPixel!=collectionSize-1; ++currentPixel) {
304 int NB = 0;
305 int row = collectionID.at(currentPixel).ROW;
306 int col = collectionID.at(currentPixel).COL;
307
308 auto & currentConnection = connections.at(currentPixel);
309 for(int otherPixel = currentPixel+1; otherPixel!=collectionSize; ++otherPixel) {
310 auto & otherConnection = connections.at(otherPixel);
311 int deltaCol = std::abs(collectionID.at(otherPixel).COL - col);
312 int deltaRow = std::abs(collectionID.at(otherPixel).ROW - row);
313
314 if( deltaCol > 1) {
315 break;
316 }
317
319 continue;
320 }
321
322
323
324
325
326
327
328
329
330
331
332 if( (deltaCol+deltaRow) == 1 or (
m_addCorners and deltaCol == 1 and deltaRow == 1) ) {
333 int NC1 = currentConnection.NC;
334 int NC2 = otherConnection.NC;
335 int maxPossible = currentConnection.CON.size() - 1;
336 if ((NC1>maxPossible) or (NC2>maxPossible)){
337 std::string
m=
"attempt to access connection array of dimension 8 at idx "+std::to_string(currentConnection.NC);
339 break;
340 } else {
341 currentConnection.CON.at(currentConnection.NC++) = otherPixel;
342 otherConnection.CON.at(otherConnection.NC++) = currentPixel ;
343 }
344 if(++NB==maxElements) {
345 break;
346 }
347 }
348 }
349 }
350
351
352
353
354 int Ncluster = 0;
355 for(int currentPixel=0; currentPixel!=collectionSize; ++currentPixel) {
356 if(collectionID.at(currentPixel).NCL < 0) {
357 collectionID.at(currentPixel).NCL = Ncluster;
359 ++Ncluster;
360 }
361 }
362
363
364
365 if(--collectionSize > 1) {
366 for(
int i(1);
i<collectionSize; ++
i ) {
367 UnpackedPixelRDO U = collectionID.at(i+1);
368
369 int j(i);
370 while(collectionID.at(j).NCL > U.NCL) {
371 collectionID.at(j+1)=collectionID.at(j);
372 --j;
373 }
374 collectionID.at(j+1)=U;
375 }
376 }
377
378
379
380 const Identifier elementID = collection.identify();
381 const IdentifierHash idHash = collection.identifyHash();
382 PixelClusterCollection *clusterCollection = new PixelClusterCollection(idHash);
383 if(dataItemsPool){
385 }
386 clusterCollection->setIdentifier(elementID);
387 clusterCollection->reserve(Ncluster);
388
389 std::vector<Identifier> DVid = {collectionID.at(0).ID };
390 std::vector<int> Totg = {collectionID.at(0).TOT};
391 std::vector<int> Lvl1 = {collectionID.at(0).LVL1};
392
393 int clusterNumber = 0;
394 int NCL0 = 0;
395
396 DVid.reserve(collectionID.back().NCL);
397 Totg.reserve(collectionID.back().NCL);
398 Lvl1.reserve(collectionID.back().NCL);
399
400 ++collectionSize;
401
402
403 const PixelChargeCalibCondData *calibData = nullptr;
405 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey, ctx);
406 calibData = *calibDataHandle;
407 }
408
409 const PixelCalib::PixelOfflineCalibData *offlineCalibData = nullptr;
411 SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibDataHandle(
m_clusterErrorKey, ctx);
412 offlineCalibData = *offlineCalibDataHandle;
413 }
414
415 for(
int i=1;
i<=collectionSize; ++
i) {
416 if(i!=collectionSize and collectionID.at(i).NCL==NCL0) {
417 DVid.push_back(collectionID.at(i).ID );
418 Totg.push_back(collectionID.at(i).TOT);
419 Lvl1.push_back(collectionID.at(i).LVL1);
420
421 } else {
422
423
426 if (dataItemsPool) {
427
428
430 (*cluster) =
431 makeCluster(DVid, Totg, Lvl1, element, pixelID, ++clusterNumber,
432 false, 0.0, 0.0, calibData, offlineCalibData,ctx);
433 } else {
434
436 (*cluster) =
437 makeCluster(DVid, Totg, Lvl1, element, pixelID, ++clusterNumber,
438 false, 0.0, 0.0, calibData, offlineCalibData,ctx);
439 }
440
441 cluster->setHashAndIndex(clusterCollection->identifyHash(),
442 clusterCollection->size());
443 clusterCollection->push_back(cluster);
444
445
446 if (i!=collectionSize) {
447 NCL0 = collectionID.at(i).NCL ;
448 DVid.clear(); DVid = {collectionID.at(i).ID };
449 Totg.clear(); Totg = {collectionID.at(i).TOT};
450 Lvl1.clear(); Lvl1 = {collectionID.at(i).LVL1};
451 }
452 }
453 }
454
455 return clusterCollection;
456 }
#define ATH_MSG_WARNING(x)
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
row
Appending html table to final .html summary file.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.