ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
ActsTrk::DetectorAlignStore::TrackingAlignStore Class Reference

Store holding the transfomations used by the Acts algorithms. More...

#include <DetectorAlignStore.h>

Collaboration diagram for ActsTrk::DetectorAlignStore::TrackingAlignStore:

Public Types

using TicketCounterArr = std::array< std::atomic< unsigned >, s_techs >
 
using ReturnedTicketArr = std::array< std::vector< bool >, s_techs >
 
using ReturnedHintArr = std::array< int, s_techs >
 

Public Member Functions

 TrackingAlignStore (const DetectorType detType)
 
const Amg::Transform3DgetTransform (unsigned int ticketNo) const
 Returns the transformation associated with the ticket number. More...
 
const Amg::Transform3DsetTransform (unsigned int ticketNo, Amg::Transform3D &&trf) const
 Caches for the given ticket number the transformation in the store and returns the const reference to it. More...
 

Static Public Member Functions

static unsigned int drawTicket (const DetectorType detType)
 Returns a unique ID to the client under which the client can store its transformation inside the container. More...
 
static unsigned int distributedTickets (const DetectorType detType)
 Returns the number of all distributed tickets. More...
 
static void giveBackTicket (const DetectorType detType, unsigned int ticketNo)
 

Static Public Attributes

static constexpr unsigned s_techs {static_cast<unsigned>(DetectorType::UnDefined)}
 

Private Attributes

std::vector< CxxUtils::CachedUniquePtr< Amg::Transform3D > > m_transforms {}
 

Static Private Attributes

static TicketCounterArr s_clientCounter ATLAS_THREAD_SAFE
 
static ReturnedTicketArr s_returnedTickets ATLAS_THREAD_SAFE
 
static ReturnedHintArr s_returnedHints ATLAS_THREAD_SAFE
 

Detailed Description

Store holding the transfomations used by the Acts algorithms.

Definition at line 33 of file DetectorAlignStore.h.

Member Typedef Documentation

◆ ReturnedHintArr

Definition at line 56 of file DetectorAlignStore.h.

◆ ReturnedTicketArr

Definition at line 55 of file DetectorAlignStore.h.

◆ TicketCounterArr

Definition at line 54 of file DetectorAlignStore.h.

Constructor & Destructor Documentation

◆ TrackingAlignStore()

ActsTrk::DetectorAlignStore::TrackingAlignStore::TrackingAlignStore ( const DetectorType  detType)

Definition at line 21 of file DetectorAlignStore.cxx.

21  {
23  }

Member Function Documentation

◆ distributedTickets()

unsigned int ActsTrk::DetectorAlignStore::TrackingAlignStore::distributedTickets ( const DetectorType  detType)
static

Returns the number of all distributed tickets.

Definition at line 57 of file DetectorAlignStore.cxx.

57  {
58  return s_clientCounter[static_cast<unsigned int>(type)];
59  }

◆ drawTicket()

unsigned int ActsTrk::DetectorAlignStore::TrackingAlignStore::drawTicket ( const DetectorType  detType)
static

Returns a unique ID to the client under which the client can store its transformation inside the container.

Definition at line 24 of file DetectorAlignStore.cxx.

24  {
25  std::lock_guard guard{s_ticketMutex};
26  const unsigned int idx = static_cast<unsigned>(type);
27  std::vector<bool>& returnedPool = s_returnedTickets[idx];
28  int& returnedHint = s_returnedHints[idx];
29  if (returnedPool.size() && returnedHint >= 0) {
30  for (size_t i = returnedHint; i < returnedPool.size(); i++) {
31  if (returnedPool[i]) {
32  returnedPool[i] = false;
33 
34  returnedHint = i+1;
35  if (static_cast<size_t>(returnedHint) >= returnedPool.size()) {
36  returnedHint = 0;
37  }
38  return i;
39  }
40  }
41 
42  for (size_t i = 0; i < static_cast<size_t>(returnedHint); i++) {
43  if (returnedPool[i]) {
44  returnedPool[i] = false;
45  returnedHint = i+1;
46  return i;
47  }
48  }
49 
50  returnedHint = -1;
51  }
52  else {
53  returnedHint = -1;
54  }
55  return s_clientCounter[idx]++;
56  }

◆ getTransform()

const Amg::Transform3D* ActsTrk::DetectorAlignStore::TrackingAlignStore::getTransform ( unsigned int  ticketNo) const
inline

Returns the transformation associated with the ticket number.

Definition at line 44 of file DetectorAlignStore.h.

44  {
45  return m_transforms[ticketNo].get();
46  }

◆ giveBackTicket()

void ActsTrk::DetectorAlignStore::TrackingAlignStore::giveBackTicket ( const DetectorType  detType,
unsigned int  ticketNo 
)
static

The ticket which was handed out at the very latest is returned. Remove all returned tickets from before

Remove all trailing ticket numbers

Definition at line 60 of file DetectorAlignStore.cxx.

60  {
61  std::lock_guard guard{s_ticketMutex};
62  const unsigned int idx = static_cast<unsigned int>(type);
63  std::vector<bool>& returnedPool = s_returnedTickets[idx];
64  int& returnedHint = s_returnedHints[idx];
66  if (ticketNo == distributedTickets(type) -1) {
67 
68  if (ticketNo > 0 && ticketNo-1 < returnedPool.size()) {
69  for (; ticketNo > 0 && returnedPool[ticketNo-1]; --ticketNo)
70  ;
71  returnedPool.resize (ticketNo);
72  }
74  s_clientCounter[idx] = ticketNo;
75  if (returnedHint >= static_cast<int>(ticketNo)) {
76  returnedHint = 0;
77  }
78  } else {
79  if (returnedPool.size() <= ticketNo) {
80  returnedPool.resize (ticketNo+1);
81  }
82  returnedPool[ticketNo] = true;
83  if (returnedHint < 0 || static_cast<int>(ticketNo) < returnedHint) {
84  returnedHint = ticketNo;
85  }
86  }
87  }

◆ setTransform()

const Amg::Transform3D& ActsTrk::DetectorAlignStore::TrackingAlignStore::setTransform ( unsigned int  ticketNo,
Amg::Transform3D &&  trf 
) const
inline

Caches for the given ticket number the transformation in the store and returns the const reference to it.

Definition at line 49 of file DetectorAlignStore.h.

49  {
50  return (*m_transforms.at(ticketNo).set(std::make_unique<Amg::Transform3D>(std::move(trf))));
51  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/3]

TicketCounterArr s_clientCounter ActsTrk::DetectorAlignStore::TrackingAlignStore::ATLAS_THREAD_SAFE
staticprivate

Definition at line 58 of file DetectorAlignStore.h.

◆ ATLAS_THREAD_SAFE [2/3]

ReturnedTicketArr s_returnedTickets ActsTrk::DetectorAlignStore::TrackingAlignStore::ATLAS_THREAD_SAFE
staticprivate

Definition at line 59 of file DetectorAlignStore.h.

◆ ATLAS_THREAD_SAFE [3/3]

ReturnedHintArr s_returnedHints ActsTrk::DetectorAlignStore::TrackingAlignStore::ATLAS_THREAD_SAFE
staticprivate

Definition at line 60 of file DetectorAlignStore.h.

◆ m_transforms

std::vector<CxxUtils::CachedUniquePtr<Amg::Transform3D> > ActsTrk::DetectorAlignStore::TrackingAlignStore::m_transforms {}
private

Definition at line 61 of file DetectorAlignStore.h.

◆ s_techs

constexpr unsigned ActsTrk::DetectorAlignStore::TrackingAlignStore::s_techs {static_cast<unsigned>(DetectorType::UnDefined)}
staticconstexpr

Definition at line 53 of file DetectorAlignStore.h.


The documentation for this class was generated from the following files:
lumiFormat.i
int i
Definition: lumiFormat.py:92
ActsTrk::DetectorAlignStore::TrackingAlignStore::m_transforms
std::vector< CxxUtils::CachedUniquePtr< Amg::Transform3D > > m_transforms
Definition: DetectorAlignStore.h:61
ActsTrk::DetectorAlignStore::TrackingAlignStore::distributedTickets
static unsigned int distributedTickets(const DetectorType detType)
Returns the number of all distributed tickets.
Definition: DetectorAlignStore.cxx:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20