Main Page
Namespaces
Classes
Package Documentation
SimTracker
TrackHistory
interface
Utils.h
Go to the documentation of this file.
1
#ifndef Utils_h
2
#define Utils_h
3
4
#include <map>
5
#include <utility>
6
#include <vector>
7
9
template
<
typename
Reference,
typename
Association>
10
std::pair<typename Association::data_type::first_type, double>
match
(
Reference
key
,
11
Association
association
,
12
bool
bestMatchByMaxValue
) {
13
typename
Association::data_type::first_type
value
;
14
15
typename
Association::const_iterator
pos
= association.find(key);
16
17
if
(pos == association.end())
18
return
std::pair<typename Association::data_type::first_type, double>(value, 0);
19
20
const
std::vector<typename Association::data_type> &
matches
= pos->val;
21
22
double
q
= bestMatchByMaxValue ? -1e30 : 1e30;
23
24
for
(std::size_t
i
= 0;
i
< matches.size(); ++
i
)
25
if
(bestMatchByMaxValue ? (matches[
i
].
second
> q) : (matches[
i
].second <
q
)) {
26
value = matches[
i
].first;
27
q = matches[
i
].second;
28
}
29
30
return
std::pair<typename Association::data_type::first_type, double>(
value
,
q
);
31
}
32
35
class
G4toCMSLegacyProcTypeMap
{
36
public
:
37
typedef
std::map<unsigned int, unsigned int>
MapType
;
38
39
G4toCMSLegacyProcTypeMap
();
40
41
const
unsigned
int
processId
(
unsigned
int
g4ProcessId)
const
;
42
43
private
:
44
MapType
m_map
;
45
};
46
47
#endif
mps_fire.i
i
Definition:
mps_fire.py:338
G4toCMSLegacyProcTypeMap
Definition:
Utils.h:35
patRefSel_triggerMatching_cfi.matches
matches
Definition:
patRefSel_triggerMatching_cfi.py:17
crabWrapper.key
key
Definition:
crabWrapper.py:19
edm::second
U second(std::pair< T, U > const &p)
Definition:
ParameterSet.cc:215
G4toCMSLegacyProcTypeMap::G4toCMSLegacyProcTypeMap
G4toCMSLegacyProcTypeMap()
Definition:
Utils.cc:5
G4toCMSLegacyProcTypeMap::MapType
std::map< unsigned int, unsigned int > MapType
Definition:
Utils.h:37
G4toCMSLegacyProcTypeMap::processId
const unsigned int processId(unsigned int g4ProcessId) const
Definition:
Utils.cc:59
TrajectoryFactories_cff.Reference
Reference
Definition:
TrajectoryFactories_cff.py:123
pos
Definition:
PixelAliasList.h:18
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
GenTrackMatcher_cfi.bestMatchByMaxValue
bestMatchByMaxValue
Definition:
GenTrackMatcher_cfi.py:12
G4toCMSLegacyProcTypeMap::m_map
MapType m_map
Definition:
Utils.h:44
TrackValidation_cff.association
association
Definition:
TrackValidation_cff.py:282
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
lumiQueryAPI.q
q
Definition:
lumiQueryAPI.py:1843
Generated for CMSSW Reference Manual by
1.8.11