Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Qipeng Hu
athena
Commits
d8ed1310
Commit
d8ed1310
authored
Oct 22, 2021
by
Sergi Rodriguez Bosca
Committed by
Vakhtang Tsulaia
Oct 22, 2021
Browse files
Adding the Pileup parameters from root files
parent
9c40f09e
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jFEXDriver.h
View file @
d8ed1310
...
...
@@ -62,6 +62,11 @@ class jFEXDriver : public AthAlgorithm
ToolHandle
<
IjFEXSysSim
>
m_jFEXSysSimTool
{
this
,
"jFEXSysSimTool"
,
"LVL1::jFEXSysSim"
,
"Tool that creates the jFEX System Simulation"
};
std
::
unordered_map
<
Identifier
,
std
::
pair
<
int
,
int
>
>
m_cell_to_tower_map
;
std
::
string
m_PileupWeigthFile
;
// This string is used to convert the m_PileupweigthFile file in a readable file for jFEX
std
::
string
m_PileupHelperFile
;
};
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jFEXFPGA.h
View file @
d8ed1310
...
...
@@ -141,6 +141,7 @@ namespace LVL1 {
ToolHandle
<
IjFEXPileupAndNoise
>
m_jFEXPileupAndNoiseTool
{
this
,
"jFEXPileupAndNoiseTool"
,
"LVL1::jFEXPileupAndNoise"
,
"Tool that applies Pileup and Noise"
};
int
getTTowerET_SG
(
unsigned
int
TTID
);
std
::
string
m_jfex_string
[
6
]
=
{
"1C"
,
"2C"
,
"3C"
,
"3A"
,
"2A"
,
"1A"
};
};
}
// end of namespace
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jFEXNtupleWriter.h
View file @
d8ed1310
...
...
@@ -87,16 +87,23 @@ private:
std
::
vector
<
int
>
m_pileup_rho_HAD2
;
std
::
vector
<
int
>
m_pileup_rho_HAD3
;
std
::
vector
<
int
>
m_pileup_rho_FCAL
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_ID
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_HAD_jet
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_EM_jet
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_Total_jet
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_HAD_met
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_EM_met
;
std
::
vector
<
std
::
vector
<
int
>>
m_pileup_map_Et_values_Total_met
;
//std::string m_jet_container_name = "AntiKt10TruthJets";
TTree
*
m_myTree
;
StatusCode
loadsmallRJetAlgoVariables
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
);
StatusCode
loadlargeRJetAlgoVariables
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
);
StatusCode
loadtauAlgoVariables
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
);
StatusCode
loadPileupVariables
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
);
StatusCode
loadPileupEt
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
);
};
}
#endif
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jFEXOutputCollection.h
View file @
d8ed1310
...
...
@@ -33,17 +33,20 @@ namespace LVL1 {
void
addValue_tau
(
std
::
string
,
int
);
void
fill_tau
();
void
addValue_pileup
(
std
::
string
,
int
);
void
addValue_pileup
(
std
::
string
,
std
::
vector
<
int
>
);
void
fill_pileup
();
int
SRsize
()
const
;
int
LRsize
()
const
;
int
tausize
()
const
;
int
pileupsize
()
const
;
int
pileuEtSize
()
const
;
void
setdooutput
(
bool
);
bool
getdooutput
()
const
;
std
::
unordered_map
<
std
::
string
,
int
>*
get_smallRJet
(
int
)
const
;
std
::
unordered_map
<
std
::
string
,
int
>*
get_largeRJet
(
int
)
const
;
std
::
unordered_map
<
std
::
string
,
int
>*
get_tau
(
int
)
const
;
std
::
unordered_map
<
std
::
string
,
int
>*
get_pileup
(
int
)
const
;
int
get_pileup
(
int
,
std
::
string
)
const
;
std
::
vector
<
int
>
get_pileup_map
(
int
,
std
::
string
)
const
;
private:
bool
m_dooutput
;
std
::
unordered_map
<
std
::
string
,
int
>
m_values_tem_smallRJet
;
...
...
@@ -53,7 +56,9 @@ namespace LVL1 {
std
::
unordered_map
<
std
::
string
,
int
>
m_values_tem_tau
;
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
int
>*>
m_allvalues_tau
;
std
::
unordered_map
<
std
::
string
,
int
>
m_values_tem_pileup
;
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
int
>*>
m_allvalues_pileup
;
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
int
>
>
m_values_tem_pileup_maps
;
std
::
vector
<
std
::
unique_ptr
<
std
::
unordered_map
<
std
::
string
,
int
>>
>
m_allvalues_pileup
;
std
::
vector
<
std
::
unique_ptr
<
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
int
>
>>
>
m_allvalues_pileup_map
;
};
}
CLASS_DEF
(
LVL1
::
jFEXOutputCollection
,
1317184196
,
1
)
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jFEXPileupAndNoise.h
View file @
d8ed1310
...
...
@@ -48,15 +48,18 @@ namespace LVL1 {
virtual
~
jFEXPileupAndNoise
();
virtual
std
::
vector
<
int
>
CalculatePileup
()
override
;
virtual
void
ApplyPileupJets
()
override
;
virtual
void
ApplyPileupMet
()
override
;
virtual
std
::
vector
<
float
>
CalculatePileup
()
override
;
virtual
void
ApplyPileup2Jets
(
bool
b
)
override
;
virtual
void
ApplyPileup2Met
(
bool
b
)
override
;
virtual
void
ApplyNoise2Jets
(
bool
b
)
override
;
virtual
void
ApplyNoise2Met
(
bool
b
)
override
;
protected:
private:
SG
::
ReadHandleKey
<
LVL1
::
jTowerContainer
>
m_jFEXPileupAndNoise_jTowerContainerKey
{
this
,
"MyjTowers"
,
"jTowerContainer"
,
"Input container for jTowers"
};
SG
::
ReadHandle
<
jTowerContainer
>
m_jTowerContainer
;
int
m_FPGA_central
[
FEXAlgoSpaceDefs
::
jFEX_algoSpace_height
][
FEXAlgoSpaceDefs
::
jFEX_thin_algoSpace_width
]
=
{{
0
}};
int
m_FPGA_forward
[
FEXAlgoSpaceDefs
::
jFEX_algoSpace_height
][
FEXAlgoSpaceDefs
::
jFEX_wide_algoSpace_width
]
=
{{
0
}};
...
...
@@ -69,11 +72,11 @@ protected:
//rho variables for the pileup
in
t
m_rho_EM
=
0
;
//for eta < 3.2
in
t
m_rho_HAD1
=
0
;
//for eta < 1.5
in
t
m_rho_HAD2
=
0
;
//for 1.5 < eta < 1.6
in
t
m_rho_HAD3
=
0
;
//for 1.6 < eta < 3.2
in
t
m_rho_FCAL
=
0
;
//for eta > 3.1
floa
t
m_rho_EM
=
0
;
//for eta < 3.2
floa
t
m_rho_HAD1
=
0
;
//for eta < 1.5
floa
t
m_rho_HAD2
=
0
;
//for 1.5 < eta < 1.6
floa
t
m_rho_HAD3
=
0
;
//for 1.6 < eta < 3.2
floa
t
m_rho_FCAL
=
0
;
//for eta > 3.1
//TT counters
int
m_count_rho_EM
=
0
;
...
...
@@ -84,25 +87,32 @@ protected:
//boolean flags
bool
m_is_FWD
=
false
;
// 0 for central, 1 for forward
bool
m_apply_jets
=
false
;
bool
m_apply_met
=
false
;
bool
m_apply_noise
=
true
;
// internal only, always set to true
bool
m_apply_pileup2jets
=
false
;
bool
m_apply_pileup2met
=
false
;
bool
m_apply_noise2jets
=
false
;
bool
m_apply_noise2met
=
false
;
void
reset_conters
();
void
SubtractPileup
();
void
ApplyNoiseCuts
(
std
::
unordered_map
<
int
,
std
::
vector
<
int
>
>
&
map_Etvalues
,
int
Jet_NoiseCut
,
int
Met_NoiseCut
);
void
ApplyNoiseCuts
(
std
::
unordered_map
<
int
,
std
::
vector
<
int
>
>
&
map_Etvalues
,
int
layer
);
// SG information
int
getTTowerEta
(
unsigned
int
TTID
);
int
getTTowerET
(
unsigned
int
TTID
);
int
getET_EM
(
unsigned
int
TTID
);
int
getET_HAD
(
unsigned
int
TTID
);
int
getTTowerEta
(
unsigned
int
TTID
);
int
getTTowerET
(
unsigned
int
TTID
);
int
getET_EM
(
unsigned
int
TTID
);
int
getET_HAD
(
unsigned
int
TTID
);
float
getTTArea_EM
(
unsigned
int
TTID
);
float
getTTArea_HAD
(
unsigned
int
TTID
);
//Noise values applied
// It should be 0 GeV and 1 GeV in firmware LSB scale (bitwise is using MeV right now, CHANGE IF NEEDED!)
int
m_et_low
=
0
;
int
m_et_high
=
1000.
;
int
m_noisecut_EM_Jet
=
100
;
int
m_noisecut_EM_Met
=
100
;
int
m_noisecut_HAD_Jet
=
100
;
int
m_noisecut_HAD_Met
=
100
;
std
::
unordered_map
<
int
,
std
::
vector
<
int
>
>
m_map_Etvalues_EM
;
std
::
unordered_map
<
int
,
std
::
vector
<
int
>
>
m_map_Etvalues_HAD
;
};
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jSuperCellTowerMapper.h
View file @
d8ed1310
...
...
@@ -34,8 +34,9 @@ class jSuperCellTowerMapper: public AthAlgTool, virtual public IjSuperCellTowerM
/** standard Athena-Algorithm method */
virtual
StatusCode
initialize
()
override
;
virtual
StatusCode
AssignSuperCellsToTowers
(
/*jTowerContainer**/
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
)
override
;
virtual
StatusCode
AssignTriggerTowerMapper
(
/*jTowerContainer**/
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
)
override
;
virtual
StatusCode
AssignSuperCellsToTowers
(
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
)
override
;
virtual
StatusCode
AssignTriggerTowerMapper
(
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
)
override
;
virtual
StatusCode
AssignPileupAndNoiseValues
(
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
,
TH1F
*
jTowerArea_hist
,
TH1I
*
Firmware2BitwiseID
,
TH1I
*
BinLayer
,
TH1F
*
EtaCoords
,
TH1F
*
PhiCoords
)
override
;
virtual
void
reset
()
override
;
...
...
@@ -48,6 +49,7 @@ class jSuperCellTowerMapper: public AthAlgTool, virtual public IjSuperCellTowerM
virtual
void
ConnectSuperCellToTower
(
/*jTowerContainer**/
std
::
unique_ptr
<
jTowerContainer
>
&
my_jTowerContainerRaw
,
int
iETower
,
Identifier
ID
,
int
iCell
,
float
et
,
int
layer
,
bool
doenergysplit
)
override
;
virtual
int
FindTowerIDForSuperCell
(
int
towereta
,
int
towerphi
)
override
;
virtual
void
PrintCellSpec
(
const
CaloSampling
::
CaloSample
sample
,
int
layer
,
const
int
region
,
const
int
eta_index
,
const
int
phi_index
,
const
int
pos_neg
,
int
iETower
,
int
iCell
,
int
prov
,
Identifier
ID
,
bool
doenergysplit
,
float
eta_min
,
float
eta_max
,
float
eta0
,
float
phi_min
,
float
phi_max
,
float
phi0
,
bool
cellValid
=
true
)
override
;
};
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/jTower.h
View file @
d8ed1310
...
...
@@ -61,6 +61,20 @@ namespace LVL1 {
/** Add to ET of a specified cell */
void
recordMD_ET
(
float
et
,
int
cell
);
/** Add to eta/phi values of a specified tower */
void
setCentreEta
(
float
ieta
);
void
setCentrePhi
(
float
iphi
);
/** Add to Area values of a specified tower */
void
setTTowerArea
(
float
area
,
int
layer
);
float
getTTowerArea
(
int
layer
)
const
;
/** Add to pilup lower and upper thresholds */
void
setMinEtforPileup
(
int
etval
){
m_minEt_pileup_thr
=
etval
;};
int
getMinEtforPileup
()
const
{
return
m_minEt_pileup_thr
;};
void
setMaxEtforPileup
(
int
etval
){
m_maxEt_pileup_thr
=
etval
;};
int
getMaxEtforPileup
()
const
{
return
m_maxEt_pileup_thr
;};
/** Get coordinates of tower */
int
iEta
()
const
;
int
iPhi
()
const
;
...
...
@@ -122,6 +136,12 @@ namespace LVL1 {
/** Set supercell position ID **/
void
setSCID
(
Identifier
ID
,
int
cell
,
float
et
,
int
layer
,
bool
doenergysplit
);
/** Noise values for each layer and object **/
void
setNoiseForMet
(
int
noiseVal
,
int
layer
);
int
getNoiseForMet
(
int
layer
)
const
;
void
setNoiseForJet
(
int
noiseVal
,
int
layer
);
int
getNoiseForJet
(
int
layer
)
const
;
std
::
vector
<
Identifier
>
getEMSCIDs
()
const
{
return
m_EM_scID
;
}
std
::
vector
<
Identifier
>
getHADSCIDs
()
const
{
return
m_HAD_scID
;
}
...
...
@@ -131,9 +151,6 @@ namespace LVL1 {
std
::
vector
<
Identifier
>
getLayerSCIDs
(
unsigned
int
layer
)
const
;
/** Apply supercell noise cut **/
bool
noiseCut
(
int
et
,
int
layer
)
const
;
void
setPosNeg
(
int
posneg
);
inline
int
getPosNeg
()
const
{
return
m_posneg
;}
...
...
@@ -152,12 +169,12 @@ namespace LVL1 {
std
::
vector
<
Identifier
>
m_HAD_scID
;
std
::
vector
<
int
>
m_et
;
std
::
vector
<
float
>
m_et_float
;
std
::
vector
<
float
>
m_TTowerArea
{
1.0
,
1.0
};
int
m_fcal_layer
=
-
1
;
int
m_noisecutPS
=
100
;
int
m_noisecutL1
=
100
;
int
m_noisecutL2
=
100
;
int
m_noisecutL3
=
100
;
int
m_noisecutHad
=
100
;
int
m_NoiseForMet
[
2
]
=
{
0
};
int
m_NoiseForJet
[
2
]
=
{
0
};
int
m_minEt_pileup_thr
=
-
999
;
int
m_maxEt_pileup_thr
=
-
999
;
};
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/share/jFEXDriverJobOptions.py
View file @
d8ed1310
...
...
@@ -62,8 +62,10 @@ StreamAOD.ItemList+=["xAOD::jFexMETRoIContainer#*"]
StreamAOD
.
ItemList
+=
[
"xAOD::jFexMETRoIAuxContainer#*"
]
#Physics Objects
StreamAOD
.
ItemList
+=
[
"xAOD::JetContainer#*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::JetAuxContainer#*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::JetContainer#Anti*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::JetAuxContainer#Anti*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::JetRoIContainer#*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::JetRoIAuxContainer#*"
]
StreamAOD
.
ItemList
+=
[
"xAOD::ElectronContainer#Electrons"
]
StreamAOD
.
ItemList
+=
[
"xAOD::ElectronAuxContainer#ElectronsAux."
]
StreamAOD
.
ItemList
+=
[
"xAOD::TauJetContainer#TauJets"
]
...
...
@@ -80,6 +82,6 @@ StreamAOD.ItemList+=["xAOD::TauJetAuxContainer#TauJetsAux.-VertexedClusters."]
log
.
info
(
"=========================================================="
)
log
.
info
(
"Scheduling jFEXDriver"
)
athAlgSeq
+=
CfgMgr
.
LVL1__jFEXDriver
(
'MyjFEXDriver'
)
#
athAlgSeq += CfgMgr.LVL1__jFEXNtupleWriter('MyjFEXNtupleWriter')
athAlgSeq
+=
CfgMgr
.
LVL1__jFEXNtupleWriter
(
'MyjFEXNtupleWriter'
)
log
.
info
(
"=========================================================="
)
#######################################################
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/jFEXDriver.cxx
View file @
d8ed1310
...
...
@@ -27,7 +27,9 @@
#include
"TROOT.h"
#include
"TH1.h"
#include
"TH1F.h"
#include
"TH1I.h"
#include
"TPad.h"
#include
"TFile.h"
#include
"TCanvas.h"
#include
"StoreGate/WriteHandle.h"
...
...
@@ -46,7 +48,7 @@
#include
<cassert>
#include
"SGTools/TestStore.h"
#include
"PathResolver/PathResolver.h"
#include
<ctime>
#define DEBUG_VHB 1
...
...
@@ -54,11 +56,10 @@
namespace
LVL1
{
jFEXDriver
::
jFEXDriver
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
AthAlgorithm
(
name
,
pSvcLocator
)
//AthReentrantAlgorithm(name, pSvcLocator)
{
}
jFEXDriver
::
jFEXDriver
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
AthAlgorithm
(
name
,
pSvcLocator
){
declareProperty
(
"PileupWeigthFile"
,
m_PileupWeigthFile
=
"Run3L1CaloSimulation/Noise/jTowerCorrection.20210308.r12406.root"
);
declareProperty
(
"PileupHelperFile"
,
m_PileupHelperFile
=
"Run3L1CaloSimulation/Calibrations/jFEX_MatchedMapping.2021Oct14.r12406.root"
);
}
jFEXDriver
::~
jFEXDriver
()
...
...
@@ -73,17 +74,12 @@ StatusCode jFEXDriver::initialize()
m_numberOfEvents
=
1
;
ATH_CHECK
(
m_jTowerBuilderTool
.
retrieve
()
);
ATH_CHECK
(
m_jSuperCellTowerMapperTool
.
retrieve
()
);
ATH_CHECK
(
m_jFEXSysSimTool
.
retrieve
()
);
ATH_CHECK
(
m_jTowerContainerSGKey
.
initialize
()
);
ATH_CHECK
(
m_jFexSRJetEDMKey
.
initialize
()
);
ATH_CHECK
(
m_jFexLRJetEDMKey
.
initialize
()
);
ATH_CHECK
(
m_jFexTauEDMKey
.
initialize
()
);
ATH_CHECK
(
m_jFEXOutputCollectionSGKey
.
initialize
()
);
return
StatusCode
::
SUCCESS
;
...
...
@@ -98,70 +94,95 @@ StatusCode jFEXDriver::finalize()
}
StatusCode
jFEXDriver
::
execute
(
/*const EventContext& ctx*/
)
//const
{
ATH_MSG_DEBUG
(
"Executing "
<<
name
()
<<
", processing event number "
<<
m_numberOfEvents
);
// OLD DIMA STUFF---------------------- Maybe useful in the future again
//if (std::fabsf((*cell)->eta()) > 2.55) continue;
//if (!((*cell)->provenance() & 0x40)) continue; // BCID cut
//// if (!((*cell)->provenance() & 0x200)) continue;
//// 8192 & 0x40 = 0
//// 8256 & 0x40 = 64
//// 8704 & 0x40 = 0
//// 8768 & 0x40 = 64
// STEP 0 - Make a fresh local jTowerContainer
std
::
unique_ptr
<
jTowerContainer
>
local_jTowerContainerRaw
=
std
::
make_unique
<
jTowerContainer
>
();
// STEP 1 TO BE REPLACED IN THE NEAR FUTURE - KEPT HERE FOR REFERENCE
// STEP 1 - Do some monitoring (code to exported in the future to another algorithm accessing only StoreGate and not appearing in this algorithm)
jFEXOutputCollection
*
my_jFEXOutputCollection
=
new
jFEXOutputCollection
();
my_jFEXOutputCollection
->
setdooutput
(
true
);
// STEP 2 - Make some jTowers and fill the local container
m_jTowerBuilderTool
->
init
(
local_jTowerContainerRaw
);
local_jTowerContainerRaw
->
clearContainerMap
();
local_jTowerContainerRaw
->
fillContainerMap
();
// STEP 3 - Do the supercell-tower mapping - put this information into the jTowerContainer
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->
AssignSuperCellsToTowers
(
local_jTowerContainerRaw
));
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->
AssignTriggerTowerMapper
(
local_jTowerContainerRaw
));
// STEP 4 - Write the completed jTowerContainer into StoreGate (move the local copy in memory)
SG
::
WriteHandle
<
LVL1
::
jTowerContainer
>
jTowerContainerSG
(
m_jTowerContainerSGKey
/*, ctx*/
);
ATH_CHECK
(
jTowerContainerSG
.
record
(
std
::
move
(
/*my_jTowerContainerRaw*/
local_jTowerContainerRaw
)));
// STEP 5 - Set up the jFEXSysSim
m_jFEXSysSimTool
->
init
();
// STEP 6 - Run THE jFEXSysSim
ATH_CHECK
(
m_jFEXSysSimTool
->
execute
(
my_jFEXOutputCollection
));
//STEP 6.5- test the EDMs
ATH_CHECK
(
testSRJetEDM
());
ATH_CHECK
(
testLRJetEDM
());
ATH_CHECK
(
testTauEDM
());
// STEP 7 - Close and clean the event
m_jFEXSysSimTool
->
cleanup
();
m_jSuperCellTowerMapperTool
->
reset
();
m_jTowerBuilderTool
->
reset
();
// STEP 8 - Write the completed jFEXOutputCollection into StoreGate (move the local copy in memory)
std
::
unique_ptr
<
jFEXOutputCollection
>
local_jFEXOutputCollection
=
std
::
unique_ptr
<
jFEXOutputCollection
>
(
my_jFEXOutputCollection
);
SG
::
WriteHandle
<
LVL1
::
jFEXOutputCollection
>
jFEXOutputCollectionSG
(
m_jFEXOutputCollectionSGKey
);
ATH_CHECK
(
jFEXOutputCollectionSG
.
record
(
std
::
move
(
local_jFEXOutputCollection
)));
ATH_MSG_DEBUG
(
"Executed "
<<
name
()
<<
", closing event number "
<<
m_numberOfEvents
);
m_numberOfEvents
++
;
StatusCode
jFEXDriver
::
execute
()
{
ATH_MSG_DEBUG
(
"Executing "
<<
name
()
<<
", processing event number "
<<
m_numberOfEvents
);
// OLD DIMA STUFF---------------------- Maybe useful in the future again
//if (std::fabsf((*cell)->eta()) > 2.55) continue;
//if (!((*cell)->provenance() & 0x40)) continue; // BCID cut
//// if (!((*cell)->provenance() & 0x200)) continue;
//// 8192 & 0x40 = 0
//// 8256 & 0x40 = 64
//// 8704 & 0x40 = 0
//// 8768 & 0x40 = 64
// STEP 0 - Make a fresh local jTowerContainer
std
::
unique_ptr
<
jTowerContainer
>
local_jTowerContainerRaw
=
std
::
make_unique
<
jTowerContainer
>
();
std
::
unique_ptr
<
TFile
>
jTowerFile
(
TFile
::
Open
(
PathResolver
::
find_calib_file
(
m_PileupWeigthFile
).
c_str
()));
std
::
unique_ptr
<
TFile
>
jTowerMapFile
(
TFile
::
Open
(
PathResolver
::
find_calib_file
(
m_PileupHelperFile
).
c_str
()));
if
(
!
jTowerFile
||
jTowerFile
->
IsZombie
())
{
ATH_MSG_ERROR
(
"Failed to open cell timing file "
<<
m_PileupWeigthFile
);
return
StatusCode
::
FAILURE
;
}
if
(
!
jTowerMapFile
||
jTowerMapFile
->
IsZombie
())
{
ATH_MSG_ERROR
(
"Failed to open cell timing file "
<<
m_PileupHelperFile
);
return
StatusCode
::
FAILURE
;
}
TH1F
*
jTowerArea_hist
=
(
TH1F
*
)
jTowerFile
->
Get
(
"jTowerArea_final_hist"
);
TH1I
*
Firmware2BitwiseID
=
(
TH1I
*
)
jTowerMapFile
->
Get
(
"Firmware2BitwiseID"
);
TH1I
*
BinLayer
=
(
TH1I
*
)
jTowerMapFile
->
Get
(
"BinLayer"
);
TH1F
*
EtaCoords
=
(
TH1F
*
)
jTowerMapFile
->
Get
(
"EtaCoords"
);
TH1F
*
PhiCoords
=
(
TH1F
*
)
jTowerMapFile
->
Get
(
"PhiCoords"
);
//detach the Histograms from the TFiles
jTowerArea_hist
->
SetDirectory
(
0
);
Firmware2BitwiseID
->
SetDirectory
(
0
);
BinLayer
->
SetDirectory
(
0
);
EtaCoords
->
SetDirectory
(
0
);
PhiCoords
->
SetDirectory
(
0
);
jTowerFile
->
Close
();
jTowerMapFile
->
Close
();
// STEP 1 TO BE REPLACED IN THE NEAR FUTURE - KEPT HERE FOR REFERENCE
// STEP 1 - Do some monitoring (code to exported in the future to another algorithm accessing only StoreGate and not appearing in this algorithm)
jFEXOutputCollection
*
my_jFEXOutputCollection
=
new
jFEXOutputCollection
();
my_jFEXOutputCollection
->
setdooutput
(
true
);
// STEP 2 - Make some jTowers and fill the local container
m_jTowerBuilderTool
->
init
(
local_jTowerContainerRaw
);
local_jTowerContainerRaw
->
clearContainerMap
();
local_jTowerContainerRaw
->
fillContainerMap
();
// STEP 3 - Do the supercell-tower mapping - put this information into the jTowerContainer
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->
AssignSuperCellsToTowers
(
local_jTowerContainerRaw
));
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->
AssignTriggerTowerMapper
(
local_jTowerContainerRaw
));
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->
AssignPileupAndNoiseValues
(
local_jTowerContainerRaw
,
jTowerArea_hist
,
Firmware2BitwiseID
,
BinLayer
,
EtaCoords
,
PhiCoords
));
// STEP 4 - Write the completed jTowerContainer into StoreGate (move the local copy in memory)
SG
::
WriteHandle
<
LVL1
::
jTowerContainer
>
jTowerContainerSG
(
m_jTowerContainerSGKey
/*, ctx*/
);
ATH_CHECK
(
jTowerContainerSG
.
record
(
std
::
move
(
/*my_jTowerContainerRaw*/
local_jTowerContainerRaw
)));
// STEP 5 - Set up the jFEXSysSim
m_jFEXSysSimTool
->
init
();
// STEP 6 - Run THE jFEXSysSim
ATH_CHECK
(
m_jFEXSysSimTool
->
execute
(
my_jFEXOutputCollection
));
//STEP 6.5- test the EDMs
ATH_CHECK
(
testSRJetEDM
());
ATH_CHECK
(
testLRJetEDM
());
ATH_CHECK
(
testTauEDM
());
// STEP 7 - Close and clean the event
m_jFEXSysSimTool
->
cleanup
();
m_jSuperCellTowerMapperTool
->
reset
();
m_jTowerBuilderTool
->
reset
();
// STEP 8 - Write the completed jFEXOutputCollection into StoreGate (move the local copy in memory)
std
::
unique_ptr
<
jFEXOutputCollection
>
local_jFEXOutputCollection
=
std
::
unique_ptr
<
jFEXOutputCollection
>
(
my_jFEXOutputCollection
);
SG
::
WriteHandle
<
LVL1
::
jFEXOutputCollection
>
jFEXOutputCollectionSG
(
m_jFEXOutputCollectionSGKey
);
ATH_CHECK
(
jFEXOutputCollectionSG
.
record
(
std
::
move
(
local_jFEXOutputCollection
)));
ATH_MSG_DEBUG
(
"Executed "
<<
name
()
<<
", closing event number "
<<
m_numberOfEvents
);
m_numberOfEvents
++
;
return
StatusCode
::
SUCCESS
;
return
StatusCode
::
SUCCESS
;
}
StatusCode
jFEXDriver
::
testSRJetEDM
(){
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/jFEXFPGA.cxx
View file @
d8ed1310
This diff is collapsed.
Click to expand it.
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/jFEXForwardJetsAlgo.cxx
View file @
d8ed1310
...
...
@@ -113,7 +113,7 @@ unsigned int LVL1::jFEXForwardJetsAlgo::getTTowerET(int nphi, int neta ) {
}
std
::
unordered_map
<
int
,
jFEXForwardJetsInfo
>
LVL1
::
jFEXForwardJetsAlgo
::
FcalJetsTowerIDLists
()
{
std
::
unordered_map
<
int
,
jFEXForwardJetsInfo
>
FCALJetTowerIDLists
;
std
::
vector
<
int
>
lower_centre_neta
;
...
...
@@ -228,6 +228,7 @@ std::unordered_map<int, jFEXForwardJetsInfo> LVL1::jFEXForwardJetsAlgo::FcalJets
}
//end of centre_neta loop
}
//end of centre_nphi loop
}
//end of myCounter loop
return
FCALJetTowerIDLists
;
}
...
...
@@ -318,7 +319,7 @@ std::unordered_map<int, jFEXForwardJetsInfo> LVL1::jFEXForwardJetsAlgo::isSeedLo
std
::
unordered_map
<
int
,
jFEXForwardJetsInfo
>
LVL1
::
jFEXForwardJetsAlgo
::
calculateJetETs
()
{
// setting the lower/upper eta range for the FCAL 2 and 3 since they are not added in the seed information yet
int
lowerFCAL_eta
=
FEXAlgoSpaceDefs
::
jFEX_algoSpace_C_lowerFCAL_eta
;
int
upperFCAL_eta
=
FEXAlgoSpaceDefs
::
jFEX_algoSpace_C_upperFCAL_eta
;
...
...
Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/jFEXNtupleWriter.cxx
View file @
d8ed1310
...
...
@@ -114,6 +114,13 @@ StatusCode LVL1::jFEXNtupleWriter::initialize () {
m_myTree
->
Branch
(
"pileup_rho_HAD3"
,
&
m_pileup_rho_HAD3
);
m_myTree
->
Branch
(
"pileup_rho_FCAL"
,
&
m_pileup_rho_FCAL
);
m_myTree
->
Branch
(
"pileup_map_ID"
,
&
m_pileup_map_ID
);
m_myTree
->
Branch
(
"pileup_map_Et_values_HAD_jet"
,
&
m_pileup_map_Et_values_HAD_jet
);
m_myTree
->
Branch
(
"pileup_map_Et_values_EM_jet"
,
&
m_pileup_map_Et_values_EM_jet
);
m_myTree
->
Branch
(
"pileup_map_Et_values_Total_jet"
,
&
m_pileup_map_Et_values_Total_jet
);
m_myTree
->
Branch
(
"pileup_map_Et_values_HAD_met"
,
&
m_pileup_map_Et_values_HAD_met
);
m_myTree
->
Branch
(
"pileup_map_Et_values_EM_met"
,
&
m_pileup_map_Et_values_EM_met
);
m_myTree
->
Branch
(
"pileup_map_Et_values_Total_met"
,
&
m_pileup_map_Et_values_Total_met
);
return
StatusCode
::
SUCCESS
;
}
...
...
@@ -133,6 +140,7 @@ StatusCode LVL1::jFEXNtupleWriter::execute () {
CHECK
(
loadlargeRJetAlgoVariables
(
jFEXOutputCollectionobj
));
CHECK
(
loadtauAlgoVariables
(
jFEXOutputCollectionobj
));
CHECK
(
loadPileupVariables
(
jFEXOutputCollectionobj
));
CHECK
(
loadPileupEt
(
jFEXOutputCollectionobj
));
m_myTree
->
Fill
();
return
StatusCode
::
SUCCESS
;
...
...
@@ -266,15 +274,42 @@ StatusCode LVL1::jFEXNtupleWriter::loadPileupVariables(SG::ReadHandle<LVL1::jFEX
for
(
int
i
=
0
;
i
<
jFEXOutputCollectionobj
->
pileupsize
();
i
++
)
{
m_pileup_FPGAid
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_FPGAid"
]);
m_pileup_jFEXid
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_jFEXid"
]);
m_pileup_rho_EM
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_rho_EM"
]);
m_pileup_rho_HAD1
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_rho_HAD1"
]);
m_pileup_rho_HAD2
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_rho_HAD2"
]);
m_pileup_rho_HAD3
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_rho_HAD3"
]);
m_pileup_rho_FCAL
.
push_back
((
*
(
jFEXOutputCollectionobj
->
get_pileup
(
i
)))[
"pileup_rho_FCAL"
]);
m_pileup_FPGAid
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_FPGAid"
));
m_pileup_jFEXid
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_jFEXid"
));
m_pileup_rho_EM
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_rho_EM"
));
m_pileup_rho_HAD1
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_rho_HAD1"
));
m_pileup_rho_HAD2
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_rho_HAD2"
));
m_pileup_rho_HAD3
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_rho_HAD3"
));
m_pileup_rho_FCAL
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup
(
i
,
"pileup_rho_FCAL"
));
}
return
StatusCode
::
SUCCESS
;
}
StatusCode
LVL1
::
jFEXNtupleWriter
::
loadPileupEt
(
SG
::
ReadHandle
<
LVL1
::
jFEXOutputCollection
>
jFEXOutputCollectionobj
)
{
m_pileup_map_ID
.
clear
();
m_pileup_map_Et_values_HAD_jet
.
clear
();
m_pileup_map_Et_values_EM_jet
.
clear
();
m_pileup_map_Et_values_Total_jet
.
clear
();
m_pileup_map_Et_values_HAD_met
.
clear
();
m_pileup_map_Et_values_EM_met
.
clear
();
m_pileup_map_Et_values_Total_met
.
clear
();
for
(
int
i
=
0
;
i
<
jFEXOutputCollectionobj
->
pileuEtSize
();
i
++
)
{
m_pileup_map_ID
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_ID"
));
m_pileup_map_Et_values_HAD_jet
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_HAD_jet"
));
m_pileup_map_Et_values_EM_jet
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_EM_jet"
));
m_pileup_map_Et_values_Total_jet
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_Total_jet"
));
m_pileup_map_Et_values_HAD_met
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_HAD_met"
));
m_pileup_map_Et_values_EM_met
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_EM_met"
));
m_pileup_map_Et_values_Total_met
.
push_back
(
jFEXOutputCollectionobj
->
get_pileup_map
(
i
,
"pileup_map_Et_values_Total_met"
));
}