CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

StripCompactDigiSimLinks Class Reference

#include <StripCompactDigiSimLinks.h>

List of all members.

Classes

class  Filler
struct  HitRecord
struct  RevLink
struct  TrackRecord

Public Types

typedef std::pair
< EncodedEventId, unsigned int > 
key_type
typedef boost::sub_range
< const std::vector< HitRecord > > 
Links
typedef Links value_type

Public Member Functions

Links getLinks (const key_type &key) const
std::map< uint32_t,
std::vector< RevLink > > 
makeReverseMap () const
 Make the map in the reverse direction. SLOW! call it only once.
Links operator[] (const key_type &key) const
 StripCompactDigiSimLinks ()
 Empty constructor, for ROOT persistence.
 StripCompactDigiSimLinks (const Filler &filler)
 This is the real constructor you will use.
void swap (StripCompactDigiSimLinks &other)
 ~StripCompactDigiSimLinks ()

Private Attributes

std::vector< HitRecordhitRecords_
std::vector< TrackRecordtrackRecords_

Detailed Description

Definition at line 10 of file StripCompactDigiSimLinks.h.


Member Typedef Documentation

typedef std::pair<EncodedEventId,unsigned int> StripCompactDigiSimLinks::key_type

Definition at line 16 of file StripCompactDigiSimLinks.h.

typedef boost::sub_range<const std::vector<HitRecord> > StripCompactDigiSimLinks::Links

Definition at line 25 of file StripCompactDigiSimLinks.h.

Definition at line 26 of file StripCompactDigiSimLinks.h.


Constructor & Destructor Documentation

StripCompactDigiSimLinks::StripCompactDigiSimLinks ( ) [inline]

Empty constructor, for ROOT persistence.

Definition at line 13 of file StripCompactDigiSimLinks.h.

{}
StripCompactDigiSimLinks::~StripCompactDigiSimLinks ( ) [inline]

Definition at line 14 of file StripCompactDigiSimLinks.h.

{}
StripCompactDigiSimLinks::StripCompactDigiSimLinks ( const Filler filler)

This is the real constructor you will use.

Definition at line 21 of file StripCompactDigiSimLinks.cc.

References StripCompactDigiSimLinks::Filler::dataSize(), hitRecords_, StripCompactDigiSimLinks::Filler::keySize(), StripCompactDigiSimLinks::Filler::storage(), and trackRecords_.

{
    trackRecords_.reserve(filler.keySize());
    hitRecords_.reserve(filler.dataSize());
    BOOST_FOREACH( const Filler::Map::value_type &pair, filler.storage() ) {
        trackRecords_.push_back(TrackRecord(pair.first, hitRecords_.size()));
        hitRecords_.insert(hitRecords_.end(), pair.second.begin(), pair.second.end());
    }
}

Member Function Documentation

StripCompactDigiSimLinks::Links StripCompactDigiSimLinks::getLinks ( const key_type key) const

Definition at line 8 of file StripCompactDigiSimLinks.cc.

References end, hitRecords_, combine::key, prof2calltree::last, match(), dqm_diff::start, and trackRecords_.

Referenced by operator[]().

{
    std::vector<TrackRecord>::const_iterator last  = trackRecords_.end();
    std::vector<TrackRecord>::const_iterator match = std::lower_bound(trackRecords_.begin(), last, key);
    if ((match != last) && (*match == key)) {
        // std::vector<TrackRecord>::const_iterator next = match+1;
        unsigned int end = (match+1 == last ? hitRecords_.size() : (match+1)->start);
        return Links(hitRecords_.begin()+match->start, hitRecords_.begin()+end);
    } else {
        return Links(hitRecords_.end(), hitRecords_.end());
    }
}
std::map< uint32_t, std::vector< StripCompactDigiSimLinks::RevLink > > StripCompactDigiSimLinks::makeReverseMap ( ) const

Make the map in the reverse direction. SLOW! call it only once.

Definition at line 49 of file StripCompactDigiSimLinks.cc.

References hitRecords_, run_regression::ret, dqm_diff::start, and trackRecords_.

{
    std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> > ret;
    typedef std::vector<TrackRecord>::const_iterator trk_it;
    typedef std::vector<HitRecord>::const_iterator   hit_it;
    hit_it hstart = hitRecords_.begin(), ith = hstart;
    for (trk_it itt = trackRecords_.begin(), endt = trackRecords_.end(); itt != endt; ++itt) {
        hit_it edh = (itt+1 != endt ? hstart + (itt+1)->start : hitRecords_.end());
        for (; ith < edh; ++ith) {
            ret[ith->detId].push_back(RevLink(*itt, *ith));
        }
    }
    return ret;
}
Links StripCompactDigiSimLinks::operator[] ( const key_type key) const [inline]

Definition at line 35 of file StripCompactDigiSimLinks.h.

References getLinks().

{ return getLinks(key); }
void StripCompactDigiSimLinks::swap ( StripCompactDigiSimLinks other) [inline]

Definition at line 28 of file StripCompactDigiSimLinks.h.

References hitRecords_, and trackRecords_.

Referenced by swap().


Member Data Documentation

These MUST be sorted at the same time by key and by start The rule is enforced by allowing to create this only through a Filler

Definition at line 85 of file StripCompactDigiSimLinks.h.

Referenced by getLinks(), makeReverseMap(), StripCompactDigiSimLinks(), and swap().