Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
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
#include <boost/foreach.hpp>
5
6
7
StripCompactDigiSimLinks::Links
8
StripCompactDigiSimLinks::getLinks
(
const
StripCompactDigiSimLinks::key_type
&
key
)
const
9
{
10
std::vector<TrackRecord>::const_iterator
last
=
trackRecords_
.end();
11
std::vector<TrackRecord>::const_iterator
match
= std::lower_bound(
trackRecords_
.begin(),
last
,
key
);
12
if
((match != last) && (*match ==
key
)) {
13
// std::vector<TrackRecord>::const_iterator next = match+1;
14
unsigned
int
end
= (match+1 == last ?
hitRecords_
.size() : (match+1)->
start
);
15
return
Links
(
hitRecords_
.begin()+match->start,
hitRecords_
.begin()+
end
);
16
}
else
{
17
return
Links
(
hitRecords_
.end(),
hitRecords_
.end());
18
}
19
}
20
21
StripCompactDigiSimLinks::StripCompactDigiSimLinks
(
const
StripCompactDigiSimLinks::Filler
&filler)
22
{
23
trackRecords_
.reserve(filler.
keySize
());
24
hitRecords_
.reserve(filler.
dataSize
());
25
BOOST_FOREACH(
const
Filler::Map::value_type
&pair, filler.
storage
() ) {
26
trackRecords_
.push_back(
TrackRecord
(pair.first,
hitRecords_
.size()));
27
hitRecords_
.insert(
hitRecords_
.end(), pair.second.begin(), pair.second.end());
28
}
29
}
30
31
StripCompactDigiSimLinks::Filler::~Filler
() {
32
}
33
34
void
35
StripCompactDigiSimLinks::Filler::insert
(
const
StripCompactDigiSimLinks::key_type
&
key
,
const
StripCompactDigiSimLinks::HitRecord
&
record
)
36
{
37
Filler::Map::iterator it = storage_.find(key);
38
if
(it == storage_.end()) {
39
storage_.insert(std::make_pair(key, std::vector<HitRecord>(1,record)));
40
num_keys_++;
41
num_values_++;
42
}
else
{
43
it->second.push_back(record);
44
num_values_++;
45
}
46
}
47
48
std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> >
49
StripCompactDigiSimLinks::makeReverseMap
()
const
50
{
51
std::map<uint32_t, std::vector<StripCompactDigiSimLinks::RevLink> >
ret
;
52
typedef
std::vector<TrackRecord>::const_iterator trk_it;
53
typedef
std::vector<HitRecord>::const_iterator hit_it;
54
hit_it hstart =
hitRecords_
.begin(), ith = hstart;
55
for
(trk_it itt =
trackRecords_
.begin(), endt =
trackRecords_
.end(); itt != endt; ++itt) {
56
hit_it edh = (itt+1 != endt ? hstart + (itt+1)->
start
:
hitRecords_
.end());
57
for
(; ith < edh; ++ith) {
58
ret[ith->detId].push_back(
RevLink
(*itt, *ith));
59
}
60
}
61
return
ret
;
62
}
63
StripCompactDigiSimLinks::Filler
Definition:
StripCompactDigiSimLinks.h:37
dqm_diff.start
tuple start
Check for commandline option errors.
Definition:
dqm_diff.py:58
StripCompactDigiSimLinks.h
record
JetCorrectorParameters::Record record
Definition:
classes.h:7
run_regression.ret
int ret
Definition:
run_regression.py:388
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:8
StripCompactDigiSimLinks::TrackRecord
Definition:
StripCompactDigiSimLinks.h:59
StripCompactDigiSimLinks::Filler::insert
void insert(const key_type &key, const HitRecord &record)
Definition:
StripCompactDigiSimLinks.cc:35
StripCompactDigiSimLinks::HitRecord
Definition:
StripCompactDigiSimLinks.h:17
StripCompactDigiSimLinks::RevLink
Definition:
StripCompactDigiSimLinks.h:70
StripCompactDigiSimLinks::Filler::storage
const Map & storage() const
Definition:
StripCompactDigiSimLinks.h:47
StripCompactDigiSimLinks::Filler::keySize
unsigned int keySize() const
Definition:
StripCompactDigiSimLinks.h:49
end
#define end
Definition:
vmac.h:37
StripCompactDigiSimLinks::trackRecords_
std::vector< TrackRecord > trackRecords_
Definition:
StripCompactDigiSimLinks.h:85
cond::ecalcond::value_type
Container::value_type value_type
Definition:
EcalChannelStatusPyWrapper.cc:33
relval_steps.key
list key
Definition:
relval_steps.py:1371
prof2calltree.last
tuple last
Definition:
prof2calltree.py:122
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:49
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::key_type
std::pair< EncodedEventId, unsigned int > key_type
Definition:
StripCompactDigiSimLinks.h:16
StripCompactDigiSimLinks::hitRecords_
std::vector< HitRecord > hitRecords_
Definition:
StripCompactDigiSimLinks.h:87
StripCompactDigiSimLinks::Filler::~Filler
~Filler()
Definition:
StripCompactDigiSimLinks.cc:31
StripCompactDigiSimLinks::Filler::dataSize
unsigned int dataSize() const
Definition:
StripCompactDigiSimLinks.h:50
Generated for CMSSW Reference Manual by
1.8.5