src
L1Trigger
TrackFindingTracklet
src
FullMatchMemory.cc
Go to the documentation of this file.
1
#include "
L1Trigger/TrackFindingTracklet/interface/FullMatchMemory.h
"
2
#include "
L1Trigger/TrackFindingTracklet/interface/Tracklet.h
"
3
#include "
L1Trigger/TrackFindingTracklet/interface/Stub.h
"
4
#include "
L1Trigger/TrackFindingTracklet/interface/L1TStub.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
#include <iomanip>
7
#include <filesystem>
8
9
using namespace
std
;
10
using namespace
trklet
;
11
12
FullMatchMemory::FullMatchMemory(
string
name
,
Settings
const
& settings) :
MemoryBase
(
name
, settings) {
13
size_t
pos
=
find_nth
(
name
, 0,
"_"
, 1);
14
assert
(
pos
!= string::npos);
15
initLayerDisk
(
pos
+ 1,
layer_
,
disk_
);
16
}
17
18
void
FullMatchMemory::addMatch
(
Tracklet
* tracklet,
const
Stub
* stub) {
19
if
(!
settings_
.
doKF
() || !
settings_
.
doMultipleMatches
()) {
//When using KF we allow multiple matches
20
for
(
auto
&
match
:
matches_
) {
21
if
(
match
.first == tracklet) {
//Better match, replace
22
match
.second = stub;
23
return
;
24
}
25
}
26
}
27
std::pair<Tracklet*, const Stub*>
tmp
(tracklet, stub);
28
//Check that we have the right TCID order
29
if
(!
matches_
.empty()) {
30
if
((!
settings_
.
doKF
() &&
matches_
[
matches_
.size() - 1].first->TCID() >= tracklet->
TCID
()) ||
31
(
settings_
.
doKF
() &&
matches_
[
matches_
.size() - 1].first->TCID() > tracklet->
TCID
())) {
32
edm::LogPrint
(
"Tracklet"
) <<
"Wrong TCID ordering in "
<<
getName
() <<
" : "
33
<<
matches_
[
matches_
.size() - 1].first->TCID() <<
" "
<< tracklet->
TCID
() <<
" "
34
<<
matches_
[
matches_
.size() - 1].first->trackletIndex() <<
" "
35
<< tracklet->
trackletIndex
();
36
}
37
}
38
matches_
.push_back(
tmp
);
39
}
40
41
void
FullMatchMemory::writeMC
(
bool
first
,
unsigned
int
iSector) {
42
iSector_
= iSector;
43
const
string
dirM =
settings_
.
memPath
() +
"Matches/"
;
44
45
std::ostringstream oss;
46
oss << dirM <<
"FullMatches_"
<<
getName
() <<
"_"
<< std::setfill(
'0'
) << std::setw(2) << (
iSector_
+ 1) <<
".dat"
;
47
auto
const
&
fname
= oss.str();
48
49
openfile
(
out_
,
first
, dirM,
fname
, __FILE__, __LINE__);
50
51
out_
<<
"BX = "
<< (bitset<3>)
bx_
<<
" Event : "
<<
event_
<< endl;
52
53
for
(
unsigned
int
j
= 0;
j
<
matches_
.size();
j
++) {
54
string
match
= (
layer_
> 0) ?
matches_
[
j
].
first
->fullmatchstr(
layer_
) :
matches_
[
j
].first->fullmatchdiskstr(
disk_
);
55
out_
<<
"0x"
;
56
out_
<< std::setfill(
'0'
) << std::setw(2);
57
out_
<< hex <<
j
<<
dec
;
58
out_
<<
" "
<<
match
<<
" "
<<
trklet::hexFormat
(
match
) << endl;
59
}
60
out_
.close();
61
62
bx_
++;
63
event_
++;
64
if
(
bx_
> 7)
65
bx_
= 0;
66
}
trklet::FullMatchMemory::disk_
int disk_
Definition:
FullMatchMemory.h:42
trklet::MemoryBase::find_nth
static size_t find_nth(const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
Definition:
MemoryBase.cc:103
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:127
trklet::Tracklet
Definition:
Tracklet.h:27
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition:
MemoryBase.h:44
MessageLogger.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
trklet::Settings
Definition:
Settings.h:52
trklet::FullMatchMemory::matches_
std::vector< std::pair< Tracklet *, const Stub * > > matches_
Definition:
FullMatchMemory.h:39
std
Definition:
JetResolutionObject.h:76
Stub.h
trklet::FullMatchMemory::layer_
int layer_
Definition:
FullMatchMemory.h:41
cms::cuda::assert
assert(be >=bs)
trklet::Tracklet::TCID
int TCID() const
Definition:
Tracklet.h:212
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition:
Util.h:19
Tracklet.h
trklet::Settings::memPath
std::string memPath() const
Definition:
Settings.h:192
trklet::Tracklet::trackletIndex
int trackletIndex() const
Definition:
Tracklet.h:206
trklet::MemoryBase::settings_
Settings const & settings_
Definition:
MemoryBase.h:50
trklet::MemoryBase::out_
std::ofstream out_
Definition:
MemoryBase.h:46
trklet::FullMatchMemory::addMatch
void addMatch(Tracklet *tracklet, const Stub *stub)
Definition:
FullMatchMemory.cc:18
FullMatchMemory.h
trklet::Settings::doMultipleMatches
bool doMultipleMatches() const
Definition:
Settings.h:241
trklet::MemoryBase::getName
std::string const & getName() const
Definition:
MemoryBase.h:19
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition:
MessageLogger.h:130
pos
Definition:
PixelCalibBase.h:13
trklet::MemoryBase::bx_
int bx_
Definition:
MemoryBase.h:47
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:142
alignmentValidation.fname
string fname
main script
Definition:
alignmentValidation.py:959
trklet::MemoryBase
Definition:
MemoryBase.h:13
trklet::Stub
Definition:
Stub.h:18
trklet::FullMatchMemory::writeMC
void writeMC(bool first, unsigned int iSector)
Definition:
FullMatchMemory.cc:41
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
L1TStub.h
trklet::Settings::doKF
bool doKF() const
Definition:
Settings.h:240
trklet::MemoryBase::event_
int event_
Definition:
MemoryBase.h:48
trklet
Definition:
AllInnerStubsMemory.h:10
trklet::MemoryBase::initLayerDisk
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition:
MemoryBase.cc:19
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
trklet::openfile
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition:
Util.h:139
Generated for CMSSW Reference Manual by
1.8.14