L1Trigger
TrackFindingTracklet
src
VMProjectionsMemory.cc
Go to the documentation of this file.
1
#include "
L1Trigger/TrackFindingTracklet/interface/VMProjectionsMemory.h
"
2
#include "
L1Trigger/TrackFindingTracklet/interface/Tracklet.h
"
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
#include <iomanip>
5
#include <filesystem>
6
7
using namespace
std
;
8
using namespace
trklet
;
9
10
VMProjectionsMemory::VMProjectionsMemory(
string
name
,
Settings
const
& settings,
unsigned
int
iSector)
11
:
MemoryBase
(
name
, settings, iSector) {
12
initLayerDisk
(7,
layer_
,
disk_
);
13
}
14
15
void
VMProjectionsMemory::addTracklet
(
Tracklet
* tracklet,
unsigned
int
allprojindex) {
16
std::pair<Tracklet*, unsigned int>
tmp
(tracklet, allprojindex);
17
//Check that order of TCID is correct
18
if
(!
tracklets_
.empty()) {
19
assert
(
tracklets_
[
tracklets_
.size() - 1].first->TCID() <= tracklet->
TCID
());
20
}
21
tracklets_
.push_back(
tmp
);
22
}
23
24
void
VMProjectionsMemory::writeVMPROJ
(
bool
first
) {
25
const
string
dirVM =
settings_
.
memPath
() +
"VMProjections/"
;
26
27
std::ostringstream oss;
28
oss << dirVM +
"VMProjections_"
<<
getName
();
29
//get rid of duplicates
30
auto
const
&
tmp
= oss.str();
31
int
len =
tmp
.size();
32
if
(
tmp
[len - 2] ==
'n'
&&
tmp
[len - 1] >
'1'
&&
tmp
[len - 1] <=
'9'
)
33
return
;
34
oss <<
"_"
<< std::setfill(
'0'
) << std::setw(2) << (
iSector_
+ 1) <<
".dat"
;
35
auto
const
&
fname
= oss.str();
36
37
if
(
first
) {
38
bx_
= 0;
39
event_
= 1;
40
41
if
(not std::filesystem::exists(dirVM)) {
42
int
fail = system((
string
(
"mkdir -p "
) + dirVM).c_str());
43
if
(fail)
44
throw
cms::Exception
(
"BadDir"
) << __FILE__ <<
" "
<< __LINE__ <<
" could not create directory "
<< dirVM;
45
}
46
out_
.open(
fname
);
47
if
(
out_
.fail())
48
throw
cms::Exception
(
"BadFile"
) << __FILE__ <<
" "
<< __LINE__ <<
" could not create file "
<<
fname
;
49
50
}
else
51
out_
.open(
fname
, std::ofstream::app);
52
53
out_
<<
"BX = "
<< (bitset<3>)
bx_
<<
" Event : "
<<
event_
<< endl;
54
55
for
(
unsigned
int
j
= 0;
j
<
tracklets_
.size();
j
++) {
56
string
vmproj = (
layer_
> 0) ?
tracklets_
[
j
].
first
->vmstrlayer(
layer_
,
tracklets_
[
j
].second)
57
:
tracklets_
[
j
].first->vmstrdisk(
disk_
,
tracklets_
[
j
].
second
);
58
out_
<<
"0x"
;
59
out_
<< std::setfill(
'0'
) << std::setw(2);
60
out_
<< hex <<
j
<<
dec
;
61
out_
<<
" "
<< vmproj <<
" "
<<
trklet::hexFormat
(vmproj) << endl;
62
}
63
out_
.close();
64
65
bx_
++;
66
event_
++;
67
if
(
bx_
> 7)
68
bx_
= 0;
69
}
trklet::VMProjectionsMemory::tracklets_
std::vector< std::pair< Tracklet *, unsigned int > > tracklets_
Definition:
VMProjectionsMemory.h:37
trklet::MemoryBase::settings_
Settings const & settings_
Definition:
MemoryBase.h:50
MessageLogger.h
trklet::VMProjectionsMemory::disk_
int disk_
Definition:
VMProjectionsMemory.h:36
trklet::Settings
Definition:
Settings.h:31
trklet::Settings::memPath
std::string const & memPath() const
Definition:
Settings.h:169
cms::cuda::assert
assert(be >=bs)
trklet::MemoryBase::event_
int event_
Definition:
MemoryBase.h:48
edm::second
U second(std::pair< T, U > const &p)
Definition:
ParameterSet.cc:222
trklet::MemoryBase::out_
std::ofstream out_
Definition:
MemoryBase.h:46
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::Tracklet
Definition:
Tracklet.h:28
trklet::MemoryBase::getName
std::string const & getName() const
Definition:
MemoryBase.h:19
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:112
trklet::MemoryBase
Definition:
MemoryBase.h:13
trklet::Tracklet::TCID
int TCID() const
Definition:
Tracklet.h:500
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
trklet::VMProjectionsMemory::writeVMPROJ
void writeVMPROJ(bool first)
Definition:
VMProjectionsMemory.cc:24
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
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
trklet::VMProjectionsMemory::addTracklet
void addTracklet(Tracklet *tracklet, unsigned int allprojindex)
Definition:
VMProjectionsMemory.cc:15
trklet::VMProjectionsMemory::layer_
int layer_
Definition:
VMProjectionsMemory.h:35
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:143
VMProjectionsMemory.h
Tracklet.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition:
MemoryBase.h:44
Generated for CMSSW Reference Manual by
1.8.16