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
}
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:355
start
Definition:
start.py:1
StripCompactDigiSimLinks::hitRecords_
std::vector< HitRecord > hitRecords_
Definition:
StripCompactDigiSimLinks.h:90
GlobalPosition_Frontier_DevDB_cff.record
record
Definition:
GlobalPosition_Frontier_DevDB_cff.py:10
StripCompactDigiSimLinks::key_type
std::pair< EncodedEventId, unsigned int > key_type
Definition:
StripCompactDigiSimLinks.h:16
end
#define end
Definition:
vmac.h:39
dqmdumpme.last
last
Definition:
dqmdumpme.py:56
StripCompactDigiSimLinks::TrackRecord
Definition:
StripCompactDigiSimLinks.h:59
StripCompactDigiSimLinks::getLinks
Links getLinks(const key_type &key) const
Definition:
StripCompactDigiSimLinks.cc:5
StripCompactDigiSimLinks::Filler::~Filler
~Filler()
Definition:
StripCompactDigiSimLinks.cc:26
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition:
cudastdAlgorithm.h:27
StripCompactDigiSimLinks::RevLink
Definition:
StripCompactDigiSimLinks.h:70
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
StripCompactDigiSimLinks::trackRecords_
std::vector< TrackRecord > trackRecords_
Definition:
StripCompactDigiSimLinks.h:88
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::Filler::insert
void insert(const key_type &key, const HitRecord &record)
Definition:
StripCompactDigiSimLinks.cc:28
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::HitRecord
Definition:
StripCompactDigiSimLinks.h:17
StripCompactDigiSimLinks::StripCompactDigiSimLinks
StripCompactDigiSimLinks()
Empty constructor, for ROOT persistence.
Definition:
StripCompactDigiSimLinks.h:13
StripCompactDigiSimLinks::Links
boost::sub_range< const std::vector< HitRecord > > Links
Definition:
StripCompactDigiSimLinks.h:24
StripCompactDigiSimLinks::Filler
Definition:
StripCompactDigiSimLinks.h:36
crabWrapper.key
key
Definition:
crabWrapper.py:19
StripCompactDigiSimLinks.h
Generated for CMSSW Reference Manual by
1.8.16