L1Trigger
TrackFindingTracklet
src
CandidateMatchMemory.cc
Go to the documentation of this file.
1
#include "
L1Trigger/TrackFindingTracklet/interface/CandidateMatchMemory.h
"
2
#include "
L1Trigger/TrackFindingTracklet/interface/Settings.h
"
3
#include "
L1Trigger/TrackFindingTracklet/interface/Tracklet.h
"
4
#include "
L1Trigger/TrackFindingTracklet/interface/Stub.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
#include "
FWCore/Utilities/interface/Exception.h
"
7
8
#include <iomanip>
9
#include <filesystem>
10
11
using namespace
std
;
12
using namespace
trklet
;
13
14
CandidateMatchMemory::CandidateMatchMemory(
string
name
,
Settings
const
& settings) :
MemoryBase
(
name
, settings) {}
15
16
void
CandidateMatchMemory::addMatch
(std::pair<Tracklet*, int> tracklet,
const
Stub
* stub) {
17
std::pair<std::pair<Tracklet*, int>,
const
Stub
*>
tmp
(tracklet, stub);
18
19
//Check for consistency
20
for
(
auto
&
match
:
matches_
) {
21
if
(tracklet.first->TCID() <
match
.first.first->TCID()) {
22
throw
cms::Exception
(
"LogicError"
) << __FILE__ <<
" "
<< __LINE__ <<
" In "
<<
getName
() <<
" adding tracklet "
23
<< tracklet.first <<
" with lower TCID : "
<< tracklet.first->TCID()
24
<<
" than earlier TCID "
<<
match
.first.first->TCID();
25
}
26
}
27
matches_
.push_back(
tmp
);
28
}
29
30
void
CandidateMatchMemory::writeCM
(
bool
first
,
unsigned
int
iSector) {
31
iSector_
= iSector;
32
const
string
dirM =
settings_
.
memPath
() +
"Matches/"
;
33
34
std::ostringstream oss;
35
oss << dirM <<
"CandidateMatches_"
<<
getName
() <<
"_"
<< std::setfill(
'0'
) << std::setw(2) << (
iSector_
+ 1)
36
<<
".dat"
;
37
auto
const
&
fname
= oss.str();
38
39
openfile
(
out_
,
first
, dirM,
fname
, __FILE__, __LINE__);
40
41
out_
<<
"BX = "
<< (bitset<3>)
bx_
<<
" Event : "
<<
event_
<< endl;
42
43
for
(
unsigned
int
j
= 0;
j
<
matches_
.size();
j
++) {
44
string
stubid =
matches_
[
j
].second->stubindex().str();
// stub ID
45
int
projindex =
matches_
[
j
].first.second;
// Allproj index
46
FPGAWord
tmp
;
47
if
(projindex >= (1 << 7)) {
48
projindex = (1 << 7) - 1;
49
}
50
tmp
.set(projindex, 7,
true
, __LINE__, __FILE__);
51
out_
<<
"0x"
;
52
out_
<< std::setfill(
'0'
) << std::setw(2);
53
out_
<< hex <<
j
<<
dec
;
54
out_
<<
" "
<<
tmp
.str() <<
"|"
<< stubid <<
" "
<<
trklet::hexFormat
(
tmp
.str() + stubid) << endl;
55
}
56
out_
.close();
57
58
bx_
++;
59
event_
++;
60
if
(
bx_
> 7)
61
bx_
= 0;
62
}
CandidateMatchMemory.h
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:127
Settings.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition:
MemoryBase.h:44
Exception
Definition:
hltDiff.cc:245
MessageLogger.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
trklet::Settings
Definition:
Settings.h:52
trklet::CandidateMatchMemory::writeCM
void writeCM(bool first, unsigned int iSector)
Definition:
CandidateMatchMemory.cc:30
std
Definition:
JetResolutionObject.h:76
Stub.h
trklet::CandidateMatchMemory::addMatch
void addMatch(std::pair< Tracklet *, int > tracklet, const Stub *stub)
Definition:
CandidateMatchMemory.cc:16
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::MemoryBase::settings_
Settings const & settings_
Definition:
MemoryBase.h:50
trklet::MemoryBase::out_
std::ofstream out_
Definition:
MemoryBase.h:46
trklet::FPGAWord
Definition:
FPGAWord.h:9
trklet::MemoryBase::getName
std::string const & getName() const
Definition:
MemoryBase.h:19
Exception.h
trklet::CandidateMatchMemory::matches_
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
Definition:
CandidateMatchMemory.h:34
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
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
trklet::MemoryBase::event_
int event_
Definition:
MemoryBase.h:48
trklet
Definition:
AllInnerStubsMemory.h:10
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