L1Trigger
TrackFindingTracklet
src
VMStubsMEMemory.cc
Go to the documentation of this file.
1
#include "
L1Trigger/TrackFindingTracklet/interface/VMStubsMEMemory.h
"
2
#include "
L1Trigger/TrackFindingTracklet/interface/Settings.h
"
3
#include <iomanip>
4
#include <filesystem>
5
6
using namespace
std
;
7
using namespace
trklet
;
8
9
VMStubsMEMemory::VMStubsMEMemory(
string
name
,
Settings
const
& settings,
unsigned
int
iSector)
10
:
MemoryBase
(
name
, settings, iSector) {
11
unsigned
int
layerdisk =
initLayerDisk
(6);
12
if
(layerdisk <
N_LAYER
) {
13
binnedstubs_
.resize(
settings_
.
NLONGVMBINS
());
14
}
else
{
15
//For disks we have NLONGVMBITS on each disk
16
binnedstubs_
.resize(2 *
settings_
.
NLONGVMBINS
());
17
}
18
}
19
20
void
VMStubsMEMemory::writeStubs
(
bool
first
) {
21
const
string
dirVM =
settings_
.
memPath
() +
"VMStubsME/"
;
22
23
std::ostringstream oss;
24
oss << dirVM <<
"VMStubs_"
<<
getName
();
25
//get rid of duplicates
26
auto
const
&
tmp
= oss.str();
27
int
len =
tmp
.size();
28
if
(
tmp
[len - 2] ==
'n'
&&
tmp
[len - 1] >
'1'
&&
tmp
[len - 1] <=
'9'
)
29
return
;
30
oss <<
"_"
<< std::setfill(
'0'
) << std::setw(2) << (
iSector_
+ 1) <<
".dat"
;
31
auto
const
&
fname
= oss.str();
32
33
if
(
first
) {
34
bx_
= 0;
35
event_
= 1;
36
37
if
(not std::filesystem::exists(dirVM)) {
38
int
fail = system((
string
(
"mkdir -p "
) + dirVM).c_str());
39
if
(fail)
40
throw
cms::Exception
(
"BadDir"
) << __FILE__ <<
" "
<< __LINE__ <<
" could not create directory "
<< dirVM;
41
}
42
out_
.open(
fname
);
43
if
(
out_
.fail())
44
throw
cms::Exception
(
"BadFile"
) << __FILE__ <<
" "
<< __LINE__ <<
" could not create file "
<<
fname
;
45
46
}
else
47
out_
.open(
fname
, std::ofstream::app);
48
49
out_
<<
"BX = "
<< (bitset<3>)
bx_
<<
" Event : "
<<
event_
<< endl;
50
51
for
(
unsigned
int
i
= 0;
i
<
binnedstubs_
.size();
i
++) {
52
for
(
unsigned
int
j
= 0;
j
<
binnedstubs_
[
i
].size();
j
++) {
53
string
stub =
binnedstubs_
[
i
][
j
].stubindex().str();
54
stub +=
"|"
+
binnedstubs_
[
i
][
j
].bend().str();
55
56
FPGAWord
finepos =
binnedstubs_
[
i
][
j
].finerz();
57
stub +=
"|"
+ finepos.
str
();
58
out_
<< hex <<
i
<<
" "
<<
j
<<
dec
<<
" "
<< stub <<
" "
<<
trklet::hexFormat
(stub) << endl;
59
}
60
}
61
out_
.close();
62
63
bx_
++;
64
event_
++;
65
if
(
bx_
> 7)
66
bx_
= 0;
67
}
Settings.h
trklet::MemoryBase::settings_
Settings const & settings_
Definition:
MemoryBase.h:50
mps_fire.i
i
Definition:
mps_fire.py:428
trklet::FPGAWord::str
std::string str() const
Definition:
FPGAWord.cc:54
trklet::Settings
Definition:
Settings.h:31
trklet::Settings::memPath
std::string const & memPath() const
Definition:
Settings.h:169
trklet::MemoryBase::event_
int event_
Definition:
MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition:
MemoryBase.h:46
trklet::VMStubsMEMemory::binnedstubs_
std::vector< std::vector< VMStubME > > binnedstubs_
Definition:
VMStubsMEMemory.h:56
trklet::MemoryBase::initLayerDisk
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition:
MemoryBase.cc:18
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
trklet::MemoryBase::bx_
int bx_
Definition:
MemoryBase.h:47
trklet::MemoryBase::getName
std::string const & getName() const
Definition:
MemoryBase.h:19
trklet::N_LAYER
constexpr int N_LAYER
Definition:
Settings.h:19
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:112
trklet::FPGAWord
Definition:
FPGAWord.h:9
VMStubsMEMemory.h
trklet::MemoryBase
Definition:
MemoryBase.h:13
trklet::Settings::NLONGVMBINS
unsigned int NLONGVMBINS() const
Definition:
Settings.h:295
trklet
Definition:
AllProjectionsMemory.h:9
alignmentValidation.fname
string fname
main script
Definition:
alignmentValidation.py:959
std
Definition:
JetResolutionObject.h:76
Exception
Definition:
hltDiff.cc:245
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition:
Util.h:15
cms::Exception
Definition:
Exception.h:70
trklet::VMStubsMEMemory::writeStubs
void writeStubs(bool first)
Definition:
VMStubsMEMemory.cc:20
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:143
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition:
MemoryBase.h:44
Generated for CMSSW Reference Manual by
1.8.16