Main Page
Namespaces
Classes
Package Documentation
src
SimDataFormats
TrackerDigiSimLink
src
StripCompactDigiSimLinks.cc
Go to the documentation of this file.
1
#include "
SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinks.h
"
2
3
#include <algorithm>
4
5
StripCompactDigiSimLinks::Links
StripCompactDigiSimLinks::getLinks
(
const
StripCompactDigiSimLinks::key_type
&
key
)
const
{
6
std::vector<TrackRecord>::const_iterator
last
=
trackRecords_
.end();
7
std::vector<TrackRecord>::const_iterator
match
=
std::lower_bound
(
trackRecords_
.begin(),
last
,
key
);
8
if
((match != last) && (*match ==
key
)) {
9
// std::vector<TrackRecord>::const_iterator next = match+1;
10
unsigned
int
end
= (match + 1 == last ?
hitRecords_
.size() : (match + 1)->
start
);
11
return
Links
(
hitRecords_
.begin() + match->start,
hitRecords_
.begin() +
end
);
12
}
else
{
13
return
Links
(
hitRecords_
.end(),
hitRecords_
.end());
14
}
15
}
16
17
StripCompactDigiSimLinks::StripCompactDigiSimLinks
(
const
StripCompactDigiSimLinks::Filler
&
filler
) {
18
trackRecords_
.reserve(filler.
keySize
());
19
hitRecords_
.reserve(filler.
dataSize
());
20
for
(
auto
const
&pair : filler.
storage
()) {
21
trackRecords_
.push_back(
TrackRecord
(pair.first,
hitRecords_
.size()));
22
hitRecords_
.insert(
hitRecords_
.end(), pair.second.begin(), pair.second.end());
23
}
24
}
25
26
StripCompactDigiSimLinks::Filler::~Filler
() {}
27
28
void
StripCompactDigiSimLinks::Filler::insert
(
const
StripCompactDigiSimLinks::key_type
&
key
,
29
const
StripCompactDigiSimLinks::HitRecord
&
record
) {
30
Filler::Map::iterator it = storage_.find(key);
31
if
(it == storage_.end()) {
32
storage_.insert(std::make_pair(key, std::vector<HitRecord>(1, record)));
33
num_keys_++;
34
num_values_++;
35
}
else
{
36
it->second.push_back(record);
37
num_values_++;
38
}
39
}
40
41
std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> >
StripCompactDigiSimLinks::makeReverseMap
()
const
{
42
std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> > ret;
43
typedef
std::vector<TrackRecord>::const_iterator trk_it;
44
typedef
std::vector<HitRecord>::const_iterator hit_it;
45
hit_it hstart =
hitRecords_
.begin(), ith = hstart;
46
for
(trk_it itt =
trackRecords_
.begin(), endt =
trackRecords_
.end(); itt != endt; ++itt) {
47
hit_it edh = (itt + 1 != endt ? hstart + (itt + 1)->
start
:
hitRecords_
.end());
48
for
(; ith < edh; ++ith) {
49
ret[ith->detId].push_back(
RevLink
(*itt, *ith));
50
}
51
}
52
return
ret;
53
}
StripCompactDigiSimLinks::Filler
Definition:
StripCompactDigiSimLinks.h:36
start
Definition:
start.py:1
StripCompactDigiSimLinks.h
record
JetCorrectorParameters::Record record
Definition:
classes.h:7
StripCompactDigiSimLinks::Links
boost::sub_range< const std::vector< HitRecord > > Links
Definition:
StripCompactDigiSimLinks.h:24
StripCompactDigiSimLinks::getLinks
Links getLinks(const key_type &key) const
Definition:
StripCompactDigiSimLinks.cc:5
StripCompactDigiSimLinks::key_type
std::pair< EncodedEventId, unsigned int > key_type
Definition:
StripCompactDigiSimLinks.h:16
StripCompactDigiSimLinks::TrackRecord
Definition:
StripCompactDigiSimLinks.h:59
StripCompactDigiSimLinks::Filler::insert
void insert(const key_type &key, const HitRecord &record)
Definition:
StripCompactDigiSimLinks.cc:28
StripCompactDigiSimLinks::HitRecord
Definition:
StripCompactDigiSimLinks.h:17
crabWrapper.key
key
Definition:
crabWrapper.py:19
StripCompactDigiSimLinks::RevLink
Definition:
StripCompactDigiSimLinks.h:70
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition:
pfDeepBoostedJetPreprocessParams_cfi.py:15
StripCompactDigiSimLinks::Filler::storage
const Map & storage() const
Definition:
StripCompactDigiSimLinks.h:46
StripCompactDigiSimLinks::Filler::keySize
unsigned int keySize() const
Definition:
StripCompactDigiSimLinks.h:48
end
#define end
Definition:
vmac.h:39
objects.autophobj.filler
filler
Definition:
autophobj.py:25
StripCompactDigiSimLinks::trackRecords_
std::vector< TrackRecord > trackRecords_
Definition:
StripCompactDigiSimLinks.h:88
plotBeamSpotDB.last
last
Definition:
plotBeamSpotDB.py:382
StripCompactDigiSimLinks::makeReverseMap
std::map< uint32_t, std::vector< RevLink > > makeReverseMap() const
Make the map in the reverse direction. SLOW! call it only once.
Definition:
StripCompactDigiSimLinks.cc:41
StripCompactDigiSimLinks::StripCompactDigiSimLinks
StripCompactDigiSimLinks()
Empty constructor, for ROOT persistence.
Definition:
StripCompactDigiSimLinks.h:13
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
StripCompactDigiSimLinks::hitRecords_
std::vector< HitRecord > hitRecords_
Definition:
StripCompactDigiSimLinks.h:90
StripCompactDigiSimLinks::Filler::~Filler
~Filler()
Definition:
StripCompactDigiSimLinks.cc:26
StripCompactDigiSimLinks::Filler::dataSize
unsigned int dataSize() const
Definition:
StripCompactDigiSimLinks.h:49
Generated for CMSSW Reference Manual by
1.8.11