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::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::Filler
Definition:
StripCompactDigiSimLinks.h:37
start
Definition:
start.py:1
StripCompactDigiSimLinks::getLinks
Links getLinks(const key_type &key) const
Definition:
StripCompactDigiSimLinks.cc:5
StripCompactDigiSimLinks.h
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:761
StripCompactDigiSimLinks::Links
boost::sub_range< const std::vector< HitRecord > > Links
Definition:
StripCompactDigiSimLinks.h:25
StripCompactDigiSimLinks::key_type
std::pair< EncodedEventId, unsigned int > key_type
Definition:
StripCompactDigiSimLinks.h:17
StripCompactDigiSimLinks::TrackRecord
Definition:
StripCompactDigiSimLinks.h:60
StripCompactDigiSimLinks::Filler::insert
void insert(const key_type &key, const HitRecord &record)
Definition:
StripCompactDigiSimLinks.cc:28
StripCompactDigiSimLinks::HitRecord
Definition:
StripCompactDigiSimLinks.h:18
StripCompactDigiSimLinks::RevLink
Definition:
StripCompactDigiSimLinks.h:71
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition:
pfDeepBoostedJetPreprocessParams_cfi.py:15
submitPVResolutionJobs.key
key
prepare the HTCondor submission files and eventually submit them
Definition:
submitPVResolutionJobs.py:222
StripCompactDigiSimLinks::trackRecords_
std::vector< TrackRecord > trackRecords_
Definition:
StripCompactDigiSimLinks.h:89
mps_fire.end
end
Definition:
mps_fire.py:242
dqmdumpme.last
last
Definition:
dqmdumpme.py:56
AlCaHarvesting_cff.record
record
Definition:
AlCaHarvesting_cff.py:50
ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it
auto & it
Definition:
splitVertices.h:48
StripCompactDigiSimLinks::StripCompactDigiSimLinks
StripCompactDigiSimLinks()
Empty constructor, for ROOT persistence.
Definition:
StripCompactDigiSimLinks.h:14
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
StripCompactDigiSimLinks::hitRecords_
std::vector< HitRecord > hitRecords_
Definition:
StripCompactDigiSimLinks.h:91
StripCompactDigiSimLinks::Filler::~Filler
~Filler()
Definition:
StripCompactDigiSimLinks.cc:26
Generated for CMSSW Reference Manual by
1.8.14