Commit eeb4a7a6 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'Reading_rootFiles_v08' into 'master'

Adding the Pileup parameters from root files

See merge request atlas/athena!47473
parents 9fbd3ed4 d8ed1310
...@@ -62,6 +62,11 @@ class jFEXDriver : public AthAlgorithm ...@@ -62,6 +62,11 @@ class jFEXDriver : public AthAlgorithm
ToolHandle<IjFEXSysSim> m_jFEXSysSimTool {this, "jFEXSysSimTool", "LVL1::jFEXSysSim", "Tool that creates the jFEX System Simulation"}; 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::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;
}; };
......
...@@ -141,6 +141,7 @@ namespace LVL1 { ...@@ -141,6 +141,7 @@ namespace LVL1 {
ToolHandle<IjFEXPileupAndNoise> m_jFEXPileupAndNoiseTool {this, "jFEXPileupAndNoiseTool", "LVL1::jFEXPileupAndNoise", "Tool that applies Pileup and Noise"}; ToolHandle<IjFEXPileupAndNoise> m_jFEXPileupAndNoiseTool {this, "jFEXPileupAndNoiseTool", "LVL1::jFEXPileupAndNoise", "Tool that applies Pileup and Noise"};
int getTTowerET_SG(unsigned int TTID); int getTTowerET_SG(unsigned int TTID);
std::string m_jfex_string[6] = {"1C","2C","3C","3A","2A","1A"};
}; };
} // end of namespace } // end of namespace
......
...@@ -87,16 +87,23 @@ private: ...@@ -87,16 +87,23 @@ private:
std::vector<int> m_pileup_rho_HAD2; std::vector<int> m_pileup_rho_HAD2;
std::vector<int> m_pileup_rho_HAD3; std::vector<int> m_pileup_rho_HAD3;
std::vector<int> m_pileup_rho_FCAL; 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; TTree *m_myTree;
StatusCode loadsmallRJetAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>); StatusCode loadsmallRJetAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>);
StatusCode loadlargeRJetAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>); StatusCode loadlargeRJetAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>);
StatusCode loadtauAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>); StatusCode loadtauAlgoVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>);
StatusCode loadPileupVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>); StatusCode loadPileupVariables(SG::ReadHandle<LVL1::jFEXOutputCollection>);
StatusCode loadPileupEt(SG::ReadHandle<LVL1::jFEXOutputCollection>);
}; };
} }
#endif #endif
...@@ -33,17 +33,20 @@ namespace LVL1 { ...@@ -33,17 +33,20 @@ namespace LVL1 {
void addValue_tau(std::string, int); void addValue_tau(std::string, int);
void fill_tau(); void fill_tau();
void addValue_pileup(std::string, int); void addValue_pileup(std::string, int);
void addValue_pileup(std::string, std::vector<int> );
void fill_pileup(); void fill_pileup();
int SRsize() const; int SRsize() const;
int LRsize() const; int LRsize() const;
int tausize() const; int tausize() const;
int pileupsize() const; int pileupsize() const;
int pileuEtSize() const;
void setdooutput(bool); void setdooutput(bool);
bool getdooutput() const; bool getdooutput() const;
std::unordered_map<std::string, int>* get_smallRJet(int) 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_largeRJet(int) const;
std::unordered_map<std::string, int>* get_tau(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: private:
bool m_dooutput; bool m_dooutput;
std::unordered_map<std::string, int> m_values_tem_smallRJet; std::unordered_map<std::string, int> m_values_tem_smallRJet;
...@@ -53,7 +56,9 @@ namespace LVL1 { ...@@ -53,7 +56,9 @@ namespace LVL1 {
std::unordered_map<std::string, int> m_values_tem_tau; std::unordered_map<std::string, int> m_values_tem_tau;
std::vector<std::unordered_map<std::string, int>*> m_allvalues_tau; std::vector<std::unordered_map<std::string, int>*> m_allvalues_tau;
std::unordered_map<std::string, int> m_values_tem_pileup; 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 ) CLASS_DEF(LVL1::jFEXOutputCollection, 1317184196 , 1 )
......
...@@ -48,15 +48,18 @@ namespace LVL1 { ...@@ -48,15 +48,18 @@ namespace LVL1 {
virtual ~jFEXPileupAndNoise(); virtual ~jFEXPileupAndNoise();
virtual std::vector<int> CalculatePileup() override; virtual std::vector<float> CalculatePileup() override;
virtual void ApplyPileupJets() override; virtual void ApplyPileup2Jets(bool b) override;
virtual void ApplyPileupMet() override; virtual void ApplyPileup2Met(bool b) override;
virtual void ApplyNoise2Jets(bool b) override;
virtual void ApplyNoise2Met(bool b) override;
protected: protected:
private: private:
SG::ReadHandleKey<LVL1::jTowerContainer> m_jFEXPileupAndNoise_jTowerContainerKey {this, "MyjTowers", "jTowerContainer", "Input container for jTowers"}; 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_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}}; int m_FPGA_forward[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]={{0}};
...@@ -69,11 +72,11 @@ protected: ...@@ -69,11 +72,11 @@ protected:
//rho variables for the pileup //rho variables for the pileup
int m_rho_EM = 0; //for eta < 3.2 float m_rho_EM = 0; //for eta < 3.2
int m_rho_HAD1 = 0; //for eta < 1.5 float m_rho_HAD1 = 0; //for eta < 1.5
int m_rho_HAD2 = 0; //for 1.5 < eta < 1.6 float m_rho_HAD2 = 0; //for 1.5 < eta < 1.6
int m_rho_HAD3 = 0; //for 1.6 < eta < 3.2 float m_rho_HAD3 = 0; //for 1.6 < eta < 3.2
int m_rho_FCAL = 0; //for eta > 3.1 float m_rho_FCAL = 0; //for eta > 3.1
//TT counters //TT counters
int m_count_rho_EM = 0; int m_count_rho_EM = 0;
...@@ -84,25 +87,32 @@ protected: ...@@ -84,25 +87,32 @@ protected:
//boolean flags //boolean flags
bool m_is_FWD = false; // 0 for central, 1 for forward bool m_is_FWD = false; // 0 for central, 1 for forward
bool m_apply_jets = false; bool m_apply_pileup2jets = false;
bool m_apply_met = false; bool m_apply_pileup2met = false;
bool m_apply_noise = true ; // internal only, always set to true bool m_apply_noise2jets = false;
bool m_apply_noise2met = false;
void reset_conters(); void reset_conters();
void SubtractPileup(); 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 // SG information
int getTTowerEta(unsigned int TTID ); int getTTowerEta (unsigned int TTID );
int getTTowerET (unsigned int TTID ); int getTTowerET (unsigned int TTID );
int getET_EM (unsigned int TTID ); int getET_EM (unsigned int TTID );
int getET_HAD (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;
}; };
......
...@@ -34,8 +34,9 @@ class jSuperCellTowerMapper: public AthAlgTool, virtual public IjSuperCellTowerM ...@@ -34,8 +34,9 @@ class jSuperCellTowerMapper: public AthAlgTool, virtual public IjSuperCellTowerM
/** standard Athena-Algorithm method */ /** standard Athena-Algorithm method */
virtual StatusCode initialize() override; virtual StatusCode initialize() override;
virtual StatusCode AssignSuperCellsToTowers(/*jTowerContainer**/std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw) override; virtual StatusCode AssignSuperCellsToTowers(std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw) override;
virtual StatusCode AssignTriggerTowerMapper(/*jTowerContainer**/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; virtual void reset() override;
...@@ -48,6 +49,7 @@ class jSuperCellTowerMapper: public AthAlgTool, virtual public IjSuperCellTowerM ...@@ -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 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 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; 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;
}; };
......
...@@ -61,6 +61,20 @@ namespace LVL1 { ...@@ -61,6 +61,20 @@ namespace LVL1 {
/** Add to ET of a specified cell */ /** Add to ET of a specified cell */
void recordMD_ET(float et, int 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 */ /** Get coordinates of tower */
int iEta() const; int iEta() const;
int iPhi() const; int iPhi() const;
...@@ -122,6 +136,12 @@ namespace LVL1 { ...@@ -122,6 +136,12 @@ namespace LVL1 {
/** Set supercell position ID **/ /** Set supercell position ID **/
void setSCID(Identifier ID, int cell, float et, int layer, bool doenergysplit); 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> getEMSCIDs() const { return m_EM_scID; }
std::vector<Identifier> getHADSCIDs() const { return m_HAD_scID; } std::vector<Identifier> getHADSCIDs() const { return m_HAD_scID; }
...@@ -131,9 +151,6 @@ namespace LVL1 { ...@@ -131,9 +151,6 @@ namespace LVL1 {
std::vector<Identifier> getLayerSCIDs(unsigned int layer) const; std::vector<Identifier> getLayerSCIDs(unsigned int layer) const;
/** Apply supercell noise cut **/
bool noiseCut(int et, int layer) const;
void setPosNeg(int posneg); void setPosNeg(int posneg);
inline int getPosNeg() const {return m_posneg;} inline int getPosNeg() const {return m_posneg;}
...@@ -152,12 +169,12 @@ namespace LVL1 { ...@@ -152,12 +169,12 @@ namespace LVL1 {
std::vector<Identifier> m_HAD_scID; std::vector<Identifier> m_HAD_scID;
std::vector<int> m_et; std::vector<int> m_et;
std::vector<float> m_et_float; std::vector<float> m_et_float;
std::vector<float> m_TTowerArea{ 1.0, 1.0};
int m_fcal_layer = -1; int m_fcal_layer = -1;
int m_noisecutPS = 100; int m_NoiseForMet[2] = {0};
int m_noisecutL1 = 100; int m_NoiseForJet[2] = {0};
int m_noisecutL2 = 100; int m_minEt_pileup_thr = -999;
int m_noisecutL3 = 100; int m_maxEt_pileup_thr = -999;
int m_noisecutHad = 100;
}; };
......
...@@ -62,8 +62,10 @@ StreamAOD.ItemList+=["xAOD::jFexMETRoIContainer#*"] ...@@ -62,8 +62,10 @@ StreamAOD.ItemList+=["xAOD::jFexMETRoIContainer#*"]
StreamAOD.ItemList+=["xAOD::jFexMETRoIAuxContainer#*"] StreamAOD.ItemList+=["xAOD::jFexMETRoIAuxContainer#*"]
#Physics Objects #Physics Objects
StreamAOD.ItemList+=["xAOD::JetContainer#*"] StreamAOD.ItemList+=["xAOD::JetContainer#Anti*"]
StreamAOD.ItemList+=["xAOD::JetAuxContainer#*"] StreamAOD.ItemList+=["xAOD::JetAuxContainer#Anti*"]
StreamAOD.ItemList+=["xAOD::JetRoIContainer#*"]
StreamAOD.ItemList+=["xAOD::JetRoIAuxContainer#*"]
StreamAOD.ItemList+=["xAOD::ElectronContainer#Electrons"] StreamAOD.ItemList+=["xAOD::ElectronContainer#Electrons"]
StreamAOD.ItemList+=["xAOD::ElectronAuxContainer#ElectronsAux."] StreamAOD.ItemList+=["xAOD::ElectronAuxContainer#ElectronsAux."]
StreamAOD.ItemList+=["xAOD::TauJetContainer#TauJets"] StreamAOD.ItemList+=["xAOD::TauJetContainer#TauJets"]
...@@ -80,6 +82,6 @@ StreamAOD.ItemList+=["xAOD::TauJetAuxContainer#TauJetsAux.-VertexedClusters."] ...@@ -80,6 +82,6 @@ StreamAOD.ItemList+=["xAOD::TauJetAuxContainer#TauJetsAux.-VertexedClusters."]
log.info("==========================================================") log.info("==========================================================")
log.info("Scheduling jFEXDriver") log.info("Scheduling jFEXDriver")
athAlgSeq += CfgMgr.LVL1__jFEXDriver('MyjFEXDriver') athAlgSeq += CfgMgr.LVL1__jFEXDriver('MyjFEXDriver')
# athAlgSeq += CfgMgr.LVL1__jFEXNtupleWriter('MyjFEXNtupleWriter') athAlgSeq += CfgMgr.LVL1__jFEXNtupleWriter('MyjFEXNtupleWriter')
log.info("==========================================================") log.info("==========================================================")
####################################################### #######################################################
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
#include "TROOT.h" #include "TROOT.h"
#include "TH1.h" #include "TH1.h"
#include "TH1F.h" #include "TH1F.h"
#include "TH1I.h"
#include "TPad.h" #include "TPad.h"
#include "TFile.h"
#include "TCanvas.h" #include "TCanvas.h"
#include "StoreGate/WriteHandle.h" #include "StoreGate/WriteHandle.h"
...@@ -46,7 +48,7 @@ ...@@ -46,7 +48,7 @@
#include <cassert> #include <cassert>
#include "SGTools/TestStore.h" #include "SGTools/TestStore.h"
#include "PathResolver/PathResolver.h"
#include <ctime> #include <ctime>
#define DEBUG_VHB 1 #define DEBUG_VHB 1
...@@ -54,11 +56,10 @@ ...@@ -54,11 +56,10 @@
namespace LVL1 { namespace LVL1 {
jFEXDriver::jFEXDriver(const std::string& name, ISvcLocator* pSvcLocator) jFEXDriver::jFEXDriver(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator){
: AthAlgorithm(name, pSvcLocator)//AthReentrantAlgorithm(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() jFEXDriver::~jFEXDriver()
...@@ -73,17 +74,12 @@ StatusCode jFEXDriver::initialize() ...@@ -73,17 +74,12 @@ StatusCode jFEXDriver::initialize()
m_numberOfEvents = 1; m_numberOfEvents = 1;
ATH_CHECK( m_jTowerBuilderTool.retrieve() ); ATH_CHECK( m_jTowerBuilderTool.retrieve() );
ATH_CHECK( m_jSuperCellTowerMapperTool.retrieve() ); ATH_CHECK( m_jSuperCellTowerMapperTool.retrieve() );
ATH_CHECK( m_jFEXSysSimTool.retrieve() ); ATH_CHECK( m_jFEXSysSimTool.retrieve() );
ATH_CHECK( m_jTowerContainerSGKey.initialize() ); ATH_CHECK( m_jTowerContainerSGKey.initialize() );
ATH_CHECK( m_jFexSRJetEDMKey.initialize() ); ATH_CHECK( m_jFexSRJetEDMKey.initialize() );
ATH_CHECK( m_jFexLRJetEDMKey.initialize() ); ATH_CHECK( m_jFexLRJetEDMKey.initialize() );
ATH_CHECK( m_jFexTauEDMKey.initialize() ); ATH_CHECK( m_jFexTauEDMKey.initialize() );
ATH_CHECK( m_jFEXOutputCollectionSGKey.initialize() ); ATH_CHECK( m_jFEXOutputCollectionSGKey.initialize() );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
...@@ -98,70 +94,95 @@ StatusCode jFEXDriver::finalize() ...@@ -98,70 +94,95 @@ StatusCode jFEXDriver::finalize()
} }
StatusCode jFEXDriver::execute(/*const EventContext& ctx*/) //const StatusCode jFEXDriver::execute() {
{
ATH_MSG_DEBUG("Executing " << name() << ", processing event number " << m_numberOfEvents );
ATH_MSG_DEBUG("Executing " << name() << ", processing event number " << m_numberOfEvents );
// OLD DIMA STUFF---------------------- Maybe useful in the future again
// OLD DIMA STUFF---------------------- Maybe useful in the future again //if (std::fabsf((*cell)->eta()) > 2.55) continue;
//if (std::fabsf((*cell)->eta()) > 2.55) continue; //if (!((*cell)->provenance() & 0x40)) continue; // BCID cut
//if (!((*cell)->provenance() & 0x40)) continue; // BCID cut //// if (!((*cell)->provenance() & 0x200)) continue;
//// if (!((*cell)->provenance() & 0x200)) continue; //// 8192 & 0x40 = 0
//// 8192 & 0x40 = 0 //// 8256 & 0x40 = 64
//// 8256 & 0x40 = 64 //// 8704 & 0x40 = 0
//// 8704 & 0x40 = 0 //// 8768 & 0x40 = 64
//// 8768 & 0x40 = 64
// STEP 0 - Make a fresh local jTowerContainer
// STEP 0 - Make a fresh local jTowerContainer std::unique_ptr<jTowerContainer> local_jTowerContainerRaw = std::make_unique<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()));
// STEP 1 TO BE REPLACED IN THE NEAR FUTURE - KEPT HERE FOR REFERENCE if (!jTowerFile || jTowerFile->IsZombie()) {
// STEP 1 - Do some monitoring (code to exported in the future to another algorithm accessing only StoreGate and not appearing in this algorithm) ATH_MSG_ERROR("Failed to open cell timing file " << m_PileupWeigthFile);
jFEXOutputCollection* my_jFEXOutputCollection = new jFEXOutputCollection(); return StatusCode::FAILURE;
my_jFEXOutputCollection->setdooutput(true); }
if (!jTowerMapFile || jTowerMapFile->IsZombie()) {
// STEP 2 - Make some jTowers and fill the local container ATH_MSG_ERROR("Failed to open cell timing file " << m_PileupHelperFile);
m_jTowerBuilderTool->init(local_jTowerContainerRaw); return StatusCode::FAILURE;
local_jTowerContainerRaw->clearContainerMap(); }
local_jTowerContainerRaw->fillContainerMap();
TH1F* jTowerArea_hist = (TH1F*) jTowerFile->Get("jTowerArea_final_hist");
// STEP 3 - Do the supercell-tower mapping - put this information into the jTowerContainer TH1I* Firmware2BitwiseID = (TH1I*) jTowerMapFile->Get("Firmware2BitwiseID");
ATH_CHECK(m_jSuperCellTowerMapperTool->AssignSuperCellsToTowers(local_jTowerContainerRaw)); TH1I* BinLayer = (TH1I*) jTowerMapFile->Get("BinLayer");
TH1F* EtaCoords = (TH1F*) jTowerMapFile->Get("EtaCoords");
ATH_CHECK(m_jSuperCellTowerMapperTool->AssignTriggerTowerMapper(local_jTowerContainerRaw)); TH1F* PhiCoords = (TH1F*) jTowerMapFile->Get("PhiCoords");
//detach the Histograms from the TFiles
jTowerArea_hist->SetDirectory(0);
// STEP 4 - Write the completed jTowerContainer into StoreGate (move the local copy in memory) Firmware2BitwiseID->SetDirectory(0);
SG::WriteHandle<LVL1::jTowerContainer> jTowerContainerSG(m_jTowerContainerSGKey/*, ctx*/); BinLayer->SetDirectory(0);
ATH_CHECK(jTowerContainerSG.record(std::move(/*my_jTowerContainerRaw*/local_jTowerContainerRaw))); EtaCoords->SetDirectory(0);
PhiCoords->SetDirectory(0);
// STEP 5 - Set up the jFEXSysSim
m_jFEXSysSimTool->init(); jTowerFile->Close();
jTowerMapFile->Close();
// STEP 6 - Run THE jFEXSysSim
ATH_CHECK(m_jFEXSysSimTool->execute(my_jFEXOutputCollection));
// STEP 1 TO BE REPLACED IN THE NEAR FUTURE - KEPT HERE FOR REFERENCE
//STEP 6.5- test the EDMs // STEP 1 - Do some monitoring (code to exported in the future to another algorithm accessing only StoreGate and not appearing in this algorithm)
ATH_CHECK(testSRJetEDM()); jFEXOutputCollection* my_jFEXOutputCollection = new jFEXOutputCollection();
ATH_CHECK(testLRJetEDM()); my_jFEXOutputCollection->setdooutput(true);
ATH_CHECK(testTauEDM());
// STEP 2 - Make some jTowers and fill the local container
// STEP 7 - Close and clean the event m_jTowerBuilderTool->init(local_jTowerContainerRaw);
m_jFEXSysSimTool->cleanup(); local_jTowerContainerRaw->clearContainerMap();
m_jSuperCellTowerMapperTool->reset(); local_jTowerContainerRaw->fillContainerMap();
m_jTowerBuilderTool->reset();
// STEP 3 - Do the supercell-tower mapping - put this information into the jTowerContainer
// STEP 8 - Write the completed jFEXOutputCollection into StoreGate (move the local copy in memory) ATH_CHECK(m_jSuperCellTowerMapperTool->AssignSuperCellsToTowers(local_jTowerContainerRaw));
std::unique_ptr<jFEXOutputCollection> local_jFEXOutputCollection = std::unique_ptr<jFEXOutputCollection>(my_jFEXOutputCollection); ATH_CHECK(m_jSuperCellTowerMapperTool->AssignTriggerTowerMapper(local_jTowerContainerRaw));
SG::WriteHandle<LVL1::jFEXOutputCollection> jFEXOutputCollectionSG(m_jFEXOutputCollectionSGKey); ATH_CHECK(m_jSuperCellTowerMapperTool->AssignPileupAndNoiseValues(local_jTowerContainerRaw,jTowerArea_hist,Firmware2BitwiseID,BinLayer,EtaCoords,PhiCoords));
ATH_CHECK(jFEXOutputCollectionSG.record(std::move(local_jFEXOutputCollection)));
// STEP 4 - Write the completed jTowerContainer into StoreGate (move the local copy in memory)
ATH_MSG_DEBUG("Executed " << name() << ", closing event number " << m_numberOfEvents ); SG::WriteHandle<LVL1::jTowerContainer> jTowerContainerSG(m_jTowerContainerSGKey/*, ctx*/);
ATH_CHECK(jTowerContainerSG.record(std::move(/*my_jTowerContainerRaw*/local_jTowerContainerRaw)));
m_numberOfEvents++;
// 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());