|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
   12 #include "AthLinks/ElementLink.h" 
   36   cell_t (
int the_cell = 0,
 
   51 const float NWEIGHT_SCALE = 1000;
 
   54 const int INDEX_BITS = 18;
 
   57 const unsigned int INDEX_MASK = (1<<INDEX_BITS) - 1;
 
   60 const int ISEQ_BITS = 32 - INDEX_BITS;
 
   63 const unsigned int ISEQ_MAX = (1 << ISEQ_BITS) - 1;
 
   88                                  "CaloCellLinkContainerCnv_p2")
 
   89       << 
"Inconsistent sequence array lengths: " 
   96   std::vector<unsigned>::const_iterator cIterI = pers->
m_linkI.begin();
 
   97   std::vector<unsigned>::const_iterator cIterIe = pers->
m_linkI.end();
 
   98   std::vector<float>::const_iterator cIterW = pers->
m_linkW.begin();
 
   99   std::vector<float>::const_iterator cIterWe = pers->
m_linkW.end();
 
  101   for (
unsigned int iCluster=0; iCluster<pers->
m_nClusters; iCluster++) {
 
  103     std::vector<float>::const_iterator cIterWb = cIterW;
 
  107     trans->
at(iCluster)=lnk; 
 
  113     unsigned int ncells = 0;
 
  114     for(
unsigned iCell=0; iCell<pers->
m_vISizes[iCluster]; iCell++) {
 
  115       if (cIterI >= cIterIe) {
 
  117                                      "CaloCellLinkContainerCnv_p2")
 
  118           << 
"Cell index array overrun";
 
  122       ncells += (*(cIterI+iCell)) >> INDEX_BITS;
 
  124     if (ncells > 1000) ncells = 1000; 
 
  127     for(
unsigned iCell=0; iCell<pers->
m_vISizes[iCluster]; iCell++) {
 
  128       unsigned int compositeI = *cIterI++;
 
  129       unsigned int realI = compositeI & INDEX_MASK;
 
  130       unsigned int lSEQ = compositeI>>INDEX_BITS;
 
  133           if (cIterW >= cIterWe) {
 
  135                                          "CaloCellLinkContainerCnv_p2")
 
  136               << 
"Cell weight array overrun";
 
  140           float compositeW = *cIterW++;
 
  141           nw = 
static_cast<unsigned int> (compositeW*(1./NWEIGHT_SCALE));
 
  142           weight = compositeW - (nw*NWEIGHT_SCALE);
 
  153                                    "CaloCellLinkContainerCnv_p2")
 
  154         << 
"Weight/index arrays out of sync";
 
  158     if (cIterW - cIterWb != 
static_cast<int> (pers->
m_vWSizes[iCluster])) {
 
  160                                    "CaloCellLinkContainerCnv_p2")
 
  161         << 
"Wrong number of weight sequences";
 
  168                                    "CaloCellLinkContainerCnv_p2")
 
  169         << 
"Missing cell container name";
 
  175                                    "CaloCellLinkContainerCnv_p2")
 
  176         << 
"Discarding cluster cells";
 
  196   unsigned int nclus = trans->
size();
 
  205   pers->
m_linkI.reserve (5*nclus);
 
  206   pers->
m_linkW.reserve (5*nclus);
 
  215   std::vector<cell_t> 
cells;
 
  216   for (
unsigned int iCluster = 0; iCluster < nclus; ++iCluster) {
 
  226     for (;it_cell!=it_cell_e;it_cell++) {  
 
  228         it_cell.getInternalIterator();
 
  231       float weight = citer->second;
 
  233       if (fabs (
weight) > NWEIGHT_SCALE) {
 
  235                                      "CaloCellLinkContainerCnv_p2")
 
  236           << 
"Crazy cluster cell weight " << 
weight 
  241       size_t index = citer->first.index();
 
  246           thinningCache->
thinning (citer->first.key());
 
  266         pers->
m_contName = *citer->first.source()->keyToString (
key);
 
  269       else if (first_key != 
key) {
 
  271                                      "CaloCellLinkContainerCnv_p2")
 
  272           << 
"Multiple container names seen; " 
  273           << 
"cannot be persistified correctly: " 
  275           << 
" != " << *citer->first.source()->keyToString (
key)
 
  280       if ((
index & ~INDEX_MASK) != 0) {
 
  282                                      "CaloCellLinkContainerCnv_p2")
 
  283           << 
"Bad cell index " << 
index 
  284           << 
" had high bits masked off.";
 
  293     unsigned int& nlseq = pers->
m_vISizes[iCluster];
 
  294     unsigned int& nwseq = pers->
m_vWSizes[iCluster];
 
  297     int last_cell = -9999;
 
  298     float last_weight = -9999;
 
  299     unsigned int nl_in_seq = 0;
 
  300     unsigned int nw_in_seq = 0;
 
  303     cells.push_back (cell_t (-99999, -99999));
 
  305     size_t ncells = 
cells.size();
 
  306     for (
size_t i = 0; 
i < ncells; ++
i) {
 
  309       if (last_cell >= 0 && 
static_cast<int>(last_cell + nl_in_seq) == 
cell.cell &&
 
  310           nl_in_seq < ISEQ_MAX)
 
  316           pers->
m_linkI.push_back (last_cell | (nl_in_seq << INDEX_BITS));
 
  319         last_cell = 
cell.cell;
 
  333       float w1 = (nw_in_seq+1)*NWEIGHT_SCALE + last_weight;
 
  334       float w2 = (nw_in_seq+1)*NWEIGHT_SCALE + 
cell.weight;
 
  336       if (
equal (nextafterf (w1, w2), w2) && nw_in_seq < 255)
 
  342           pers->
m_linkW.push_back (nw_in_seq*NWEIGHT_SCALE + last_weight);
 
  345         last_weight = 
cell.weight;
 
  
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
std::vector< unsigned > m_vISizes
bool operator==(const DataVector< T > &a, const DataVector< T > &b)
Vector equality comparison.
Hold thinning decisions for one container.
void insertElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
Container class for CaloCellLink.
virtual object_iter begin() const
Hold thinning decisions for one container.
virtual object_iter end() const
bool equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
std::vector< unsigned > m_linkI
virtual void persToTransWithKey(const CaloCellLinkContainer_p2 *pers, CaloCellLinkContainer *trans, const std::string &key, MsgStream &log) const override
Convert from persistent to transient object.
std::vector< float > m_linkW
Simple store for CaloCell links. This object is fully navigable.
std::vector< unsigned > m_vWSizes
Workaround x86 precision issues for FP inequality comparisons.
virtual void transToPersWithKey(const CaloCellLinkContainer *trans, CaloCellLinkContainer_p2 *pers, const std::string &key, MsgStream &log) const override
Convert from transient to persistent object.
Helpers to retrieve the current thinning cache from the event context.
Navigable< CaloCellContainer, double >::object_iter cell_iterator
Forward internal iterator type to clients.
static const std::size_t RemovedIdx
Flag used to show that an index has been thinned away.
const SG::ThinningCache * getThinningCache(const EventContext &ctx)
Retrieve the current thinning cache from the event context.
void clear()
Erase all the elements in the collection.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
void resize(size_type sz)
Resizes the collection to the specified number of elements.
Helpers for checking error return status codes and reporting errors.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Navigable template generalization to handle navigation.
size_t index(size_t ndxOrig) const
Return the index corresponding to ndxOrig after thinning.
const ThinningDecisionBase * thinning(const std::string &key) const
Return thinning for key.
virtual unsigned int size() const
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
const T * at(size_type n) const
Access an element, as an rvalue.
Cache thinning decisions for converters.
size_type size() const noexcept
Returns the number of elements in the collection.