In order that the TransformStore is able to provide enough memory to store the transform centrally, it needs to know how many clients are instantiated for a certain detector type.
Each client which wants to use the TansformStore to outsource its transform caching needs to draw a ticket when it is instantiated. As the life time of certain instances may actually be short, the client is supposed to return its ticket to the counter when destructed. In this way, the cache size matches exactly the memory needs.
Definition at line 113 of file TransformStore.h.
| void ActsTrk::detail::TrfStoreTicketCounter::giveBackTicket |
( |
const DetectorType | detType, |
|
|
unsigned int | ticketNo ) |
|
static |
Return back a ticket for the specified detector type such that its slot can be used by another instance.
- Parameters
-
| detType | The ATLAS sub detector type for which the ticket is returned |
| ticketNo | The number of the drawn ticket to return |
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 190 of file TransformStore.cxx.
191 {
192 std::unique_lock guard{s_ticketMutex};
193 const unsigned idx =
static_cast<unsigned>(
type);
194 std::vector<char>& returnedPool = s_returnedTickets[
idx];
195 int& returnedHint = s_returnedHints[
idx];
197 const unsigned distributed = s_clientCounter[
idx];
198 if (ticketNo == distributed -1) {
199
200 if (ticketNo > 0 && ticketNo-1 < returnedPool.size()) {
201 for (; ticketNo > 0 && returnedPool[ticketNo-1]; --ticketNo){}
202 returnedPool.resize (ticketNo);
203 }
205 s_clientCounter[
idx] = ticketNo;
206 if (returnedHint >= static_cast<int>(ticketNo)) {
207 returnedHint = 0;
208 }
209 } else {
210 if (returnedPool.size() <= ticketNo) {
211 returnedPool.resize (ticketNo+1);
212 }
213 returnedPool[ticketNo] = true;
214 if (returnedHint < 0 || static_cast<int>(ticketNo) < returnedHint) {
215 returnedHint = ticketNo;
216 }
217 }
218 }