Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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:37
runTheMatrix.ret
tuple ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:596
StripCompactDigiSimLinks.h
StripCompactDigiSimLinks::Links
boost::sub_range< const std::vector< HitRecord > > Links
Definition:
StripCompactDigiSimLinks.h:25
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: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
command_line.start
start
Definition:
command_line.py:165
StripCompactDigiSimLinks::Filler::storage
const Map & storage() const
Definition:
StripCompactDigiSimLinks.h:47
submitPVResolutionJobs.key
tuple key
prepare the HTCondor submission files and eventually submit them
Definition:
submitPVResolutionJobs.py:398
StripCompactDigiSimLinks::Filler::keySize
unsigned int keySize() const
Definition:
StripCompactDigiSimLinks.h:49
StripCompactDigiSimLinks::trackRecords_
std::vector< TrackRecord > trackRecords_
Definition:
StripCompactDigiSimLinks.h:89
GlobalPosition_Frontier_DevDB_cff.record
tuple record
Definition:
GlobalPosition_Frontier_DevDB_cff.py:10
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:14
cuda_std::lower_bound
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition:
cudastdAlgorithm.h:27
dataset.end
string end
Definition:
dataset.py:937
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
dqmdumpme.last
tuple last
Definition:
dqmdumpme.py:56
StripCompactDigiSimLinks::hitRecords_
std::vector< HitRecord > hitRecords_
Definition:
StripCompactDigiSimLinks.h:91
StripCompactDigiSimLinks::Filler::~Filler
~Filler()
Definition:
StripCompactDigiSimLinks.cc:26
StripCompactDigiSimLinks::Filler::dataSize
unsigned int dataSize() const
Definition:
StripCompactDigiSimLinks.h:50
Generated for CMSSW Reference Manual by
1.8.5