diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt index 3acfa40113c471ca795f864910e677d4d0435b71..ea7181871a6d6ab8607f64336bae34d56bf6198e 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt @@ -18,9 +18,10 @@ atlas_depends_on_subdirs( Event/xAOD/xAODCaloEvent Event/xAOD/xAODJet Event/xAOD/xAODTrigMissingET + Event/FourMomUtils GaudiKernel LArCalorimeter/LArIdentifier - LArCalorimeter/LArCabling + LArCalorimeter/LArTools Trigger/TrigAlgorithms/TrigT2CaloCommon Trigger/TrigEvent/TrigCaloEvent Trigger/TrigEvent/TrigMissingEtEvent @@ -28,8 +29,9 @@ atlas_depends_on_subdirs( Trigger/TrigSteer/TrigInterfaces Trigger/TrigTools/TrigTimeAlgs PRIVATE - Tools/PathResolver - InnerDetector/InDetRecTools/InDetTrackSelectionTool + PhysicsAnalysis/AnalysisCommon/PATCore + PathResolver + InDetTrackSelectionTool Control/CxxUtils DetectorDescription/Identifier Event/EventKernel @@ -40,6 +42,8 @@ atlas_depends_on_subdirs( Trigger/TrigT1/TrigT1Interfaces ) # External dependencies: +find_package( FastJet ) +find_package( FastJetContrib COMPONENTS SoftKiller ConstituentSubtractor ) find_package( ROOT COMPONENTS Core Hist Matrix ) find_package( tdaq-common COMPONENTS eformat ) @@ -47,27 +51,22 @@ find_package( tdaq-common COMPONENTS eformat ) atlas_add_library( TrigEFMissingETLib TrigEFMissingET/*.h src/*.cxx PUBLIC_HEADERS TrigEFMissingET - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${FASTJETCONTRIB_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier AthenaBaseComps xAODCaloEvent xAODJet xAODTrigMissingET GaudiKernel LArIdentifier TrigCaloEvent TrigMissingEtEvent TrigParticle CaloDetDescrLib - LArCablingLib TrigT2CaloCommonLib TrigInterfacesLib TrigTimeAlgsLib - InDetTrackSelectionToolLib - PRIVATE_LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} CxxUtils Identifier + LArToolsLib TrigT2CaloCommonLib TrigInterfacesLib TrigTimeAlgsLib + PRIVATE_LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${FASTJETCONTRIB_LIBRARIES} CxxUtils Identifier EventKernel xAODEventInfo JetEvent TrigMuonEvent TrigSteeringEvent - PathResolver + PathResolver PATCoreLib TrigT1Interfaces ) atlas_add_component( TrigEFMissingET src/components/*.cxx - LINK_LIBRARIES GaudiKernel TrigEFMissingETLib ) + LINK_LIBRARIES GaudiKernel TrigEFMissingETLib ${FASTJET_LIBRARIES} + PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} +) # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( METFexes - SCRIPT test/test_met_fexes.sh - PROPERTIES TIMEOUT 1000 - ) diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingET.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingET.h index 49da319dad666e08372040369023989e21b292a3..a928c805a8c1b32b414926115afa28c096beb49e 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingET.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingET.h @@ -128,6 +128,7 @@ class EFMissingET : public HLT::AllTEAlgo { const xAOD::JetContainer *m_jets; const xAOD::TrackParticleContainer *m_tracks; const xAOD::VertexContainer *m_vertices; + const xAOD::MuonContainer *m_muons; // unsigned m_maskEMB_A_Missing; //!< EMB_A absent in DetMask // unsigned m_maskEMB_C_Missing; //!< EMB_C absent in DetMask @@ -162,7 +163,9 @@ class EFMissingET : public HLT::AllTEAlgo { bool m_doTimers; //!< switch on/off detailed timers bool m_decodeDetMask; //!< switch on/off DetMask decoding bool m_doTopoClusters; //!< switch on/off topo. clusters + bool m_doTrackTopoClusters; //!< switch on/off track and topo. clusters bool m_doJets; //!< switch on/off jets + bool m_doJetVeto; //!< siwtch on/off jetveto bool m_doTracks; //!< switch on/off tracks bool m_doPUC; //!< switch on/off Pile-up fit int m_n_sizePers; //!< number of components in pers. objects diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETBaseTool.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETBaseTool.h index 251212580b4fb237cda58d7ac3ceb36873937374..86624e0ef87199fc745a20ee91c1833e3b1e833b 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETBaseTool.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETBaseTool.h @@ -26,6 +26,7 @@ tools must implement the execute(...) method. #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODTrigMissingET/TrigMissingET.h" #include "xAODJet/JetContainer.h" +#include "xAODMuon/MuonContainer.h" #include <vector> class TrigMissingET; @@ -63,7 +64,8 @@ class EFMissingETBaseTool : public AthAlgTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); /** save time for detector iDet at step iStep in timerTime */ StatusCode getTime(int iDet, int iStep, float *timerTime); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFlags.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFlags.h index 6cc8705b205f9f4049c0d0f96b31d861bf9a1e8a..1a75eed6261ea7ad3a0c99a0ac203ffaeb62a975 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFlags.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFlags.h @@ -47,7 +47,8 @@ class EFMissingETFlags : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); private: diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromCells.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromCells.h index fab79dc1ae0df9521f312c15a95f0f5ccabe527d..9bf90a49449f21db640b5d54e3595325fd11622a 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromCells.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromCells.h @@ -54,7 +54,8 @@ class EFMissingETFromCells : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); // slow calo data access via RegionSelector StatusCode addAllCellsToHelper(TrigEFMissingEtHelper* met); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClusters.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClusters.h index d7eefc6e4efc9117c41edd2b1997d0d2cee64d58..c1a3f03944f91311e2ca580e785b16eed56482c6 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClusters.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClusters.h @@ -45,7 +45,8 @@ class EFMissingETFromClusters : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); private: bool m_saveuncalibrated; diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPS.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPS.h index b5c3cf9b0e87791d498718a0a5a9e65b3e437e1a..9e28da99a00acb8341e3e8a6ba555e1ccaa38353 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPS.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPS.h @@ -48,8 +48,8 @@ class EFMissingETFromClustersPS : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); - + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); private: bool m_saveuncalibrated; bool m_subtractpileup; diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPUC.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPUC.h index 7f1340a0c984277d67fcc7b000086dd25333ea7b..4b96324f2abe75ae086f013b2ae8dbe4deb3a092 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPUC.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersPUC.h @@ -47,7 +47,8 @@ class EFMissingETFromClustersPUC : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); private: bool m_saveuncalibrated; @@ -67,6 +68,10 @@ class EFMissingETFromClustersPUC : public EFMissingETBaseTool double m_varrhoscale; //adjustment factor for weighting rho errors in fit double m_trimfactor; //Fraction of towers used in calculating the trimmed mean + bool m_doLArH11off; //! LAr H11 off or not + bool m_doLArH12off; //! LAr H12 off or not + double m_Jetptcut; //! Jet pt cut for LAr H11/H12 + int m_nphibins; int m_netabins; int m_ntowers; diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersTracksPUC.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersTracksPUC.h new file mode 100644 index 0000000000000000000000000000000000000000..608a91a3fe773dbb9a6b81ad673f0a54c8d150f6 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromClustersTracksPUC.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGEFMISSINGET_EFMissingETFromClustersTracksPUC_H +#define TRIGEFMISSINGET_EFMissingETFromClustersTracksPUC_H + + + +/******************************************************************** + +This code should be edited as necessary and then placed in the TrigEFMissingET/TrigEFMissingET directory + + ********************************************************************/ + +#include "TrigEFMissingET/EFMissingETBaseTool.h" +#include "TrigMissingEtEvent/TrigMissingET.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" +#include "GaudiKernel/ToolHandle.h" + +class EFMissingETFromClustersTracksPUC : public EFMissingETBaseTool +{ + public: + + EFMissingETFromClustersTracksPUC(const std::string& type, + const std::string& name, + const IInterface* parent); + + ~EFMissingETFromClustersTracksPUC(); + + virtual StatusCode initialize(); + virtual StatusCode finalize(); + virtual StatusCode execute(); + + virtual StatusCode execute(xAOD::TrigMissingET *met, + TrigEFMissingEtHelper *metHelper, + const xAOD::CaloClusterContainer *caloCluster, + const xAOD::JetContainer *jets, + const xAOD::TrackParticleContainer *track, + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); + + private: + //internal + unsigned int m_nPhiBins; + unsigned int m_nEtaBins; + unsigned int m_nTowers; + double m_towerEtaWidth; + double m_towerPhiWidth; + + bool m_saveuncalibrated; + xAOD::CaloCluster::State m_clusterstate; + + int m_methelperposition; + // Tower + double m_targetTowerWidth; + double m_maxEta; + + // For jet selection + double m_forward_ptcut; + double m_track_ptcut; + double m_dRCut; + double m_minJetPtJvt; + double m_maxJetPtJvt; + double m_jetRpTCut; + ToolHandle<InDet::IInDetTrackSelectionTool> m_trackselTool; + + //Covariance variables + double m_caloResSqrtTerm; + double m_caloResFloor; + + // Pufit variables + double m_constraintWeight; +}; + +#endif // TRIGEFMISSINGET_EFMissingETFromClustersTracksPUC_H diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromFEBHeader.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromFEBHeader.h index 840ce729d798037c4b506c2695e782cdba4757a7..25f614c5621423c723fc58710c52c3fd0cdfc07b 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromFEBHeader.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromFEBHeader.h @@ -54,7 +54,8 @@ class EFMissingETFromFEBHeader : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); // slow calo data access via RegionSelector StatusCode addFebEnergyToHelper(TrigEFMissingEtHelper* met); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromHelper.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromHelper.h index 1e2f6004c2b48df09d7791b49ef4a481c32a9154..f5ac2f4ffe28c1430dbd7f58355f756bb5fd357e 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromHelper.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromHelper.h @@ -51,7 +51,10 @@ class EFMissingETFromHelper : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); + + StatusCode executeMT(xAOD::TrigMissingET *met, TrigEFMissingEtHelper *metHelper); }; diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromJets.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromJets.h index ba29788d3438a7473588790bb27232c2f59854c5..c1b7a832d84e8dc777c2d29738ced37c7bcf5354 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromJets.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromJets.h @@ -45,7 +45,8 @@ class EFMissingETFromJets : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); private: float m_etacut; diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndClusters.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndClusters.h new file mode 100644 index 0000000000000000000000000000000000000000..bdd618af34409c27910531b52cfae2c5408eb36d --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndClusters.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGEFMISSINGET_EFMissingETFromTrackAndClusters_H +#define TRIGEFMISSINGET_EFMissingETFromTrackAndClusters_H + +/******************************************************************** + +NAME: EFMissingETFromTrackAndClusters.h +PACKAGE: Trigger/TrigAlgorithms/TrigEFMissingET + +AUTHORS: Renjie Wang (renjie.wang@cern.ch) + Use tracks and vertices to remove pile-up clusters by Constituent-level pile-up mitigation techniques + (cluster vertex fraction, Voronoi Subtraction, SofterKiller ) + the track-based soft term is also added to MET + +CREATED: Aug 05, 2018 + + ********************************************************************/ + +#include "TrigEFMissingET/EFMissingETBaseTool.h" +#include "TrigMissingEtEvent/TrigMissingET.h" + + + +#include "xAODTracking/VertexContainer.h" +#include "xAODCaloEvent/CaloCluster.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "xAODCaloEvent/CaloClusterChangeSignalState.h" + +#include "xAODTracking/TrackParticlexAODHelpers.h" + +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "xAODCore/ShallowAuxContainer.h" + +#include "fastjet/ClusterSequenceArea.hh" +#include "fastjet/PseudoJet.hh" +#include "fastjet/Selector.hh" +#include "fastjet/JetDefinition.hh" +#include "fastjet/tools/JetMedianBackgroundEstimator.hh" +#include <fastjet/tools/Subtractor.hh> +#include "fastjet/contrib/SoftKiller.hh" + + +/** + $class EFMissingETFromTrackAndClusters + Updates transient helper object with topo. clusters + **/ + +class EFMissingETFromTrackAndClusters : public EFMissingETBaseTool { +public: + + EFMissingETFromTrackAndClusters(const std::string& type, + const std::string& name, + const IInterface* parent); + + ~EFMissingETFromTrackAndClusters(); + + virtual StatusCode initialize(); + virtual StatusCode finalize(); + virtual StatusCode execute(); + + virtual StatusCode execute(xAOD::TrigMissingET *met, + TrigEFMissingEtHelper *metHelper, + const xAOD::CaloClusterContainer *caloCluster, + const xAOD::JetContainer *jets, + const xAOD::TrackParticleContainer *track, + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); + + + void setCVF(std::vector<xAOD::CaloCluster>, const xAOD::TrackParticleContainer*, std::vector<const xAOD::TrackParticle*>, std::vector<float>&); + float ExtrapolationEstimate(float,float,float); + + StatusCode makeVoronoiClusters(std::vector<fastjet::PseudoJet>& clusters, std::vector< std::pair<fastjet::PseudoJet,std::vector<float> > >&) const; + void spreadPt(std::vector< std::pair< fastjet::PseudoJet,std::vector<float> > >& correctedptvec, float spreadr=0.4, float alpha=2) const; + + int calculateWeight(xAOD::CaloCluster cl) const; + int calculateSplitWeight(xAOD::CaloCluster cl) const; + void RunClusters(std::vector<xAOD::CaloCluster> m_clust) const; + void RunSplitClusters(std::vector<xAOD::CaloCluster> m_clust) const; + + + +private: + + double findMinPt(std::vector<fastjet::PseudoJet> *clustSK) const; + std::vector<fastjet::PseudoJet> makeSKClust(std::vector<fastjet::PseudoJet> clustPJ) const; + + + bool m_saveUncalibrated; + int m_metHelperPosition; + xAOD::CaloCluster_v1::State m_clusterstate; + + bool m_debug = false; + bool m_doLC = true; + bool m_doSpread = true; + int m_nSigma = 0; + + + //mutable int m_initCount; + float m_lambdaCalDivide; + + // Properties. + bool m_isCaloSplit; + float m_gridSpacing; + float m_eCalGrid; + float m_hCalGrid; + float m_rapmin; + float m_rapmax; + float m_rapminApplied; + float m_rapmaxApplied; + mutable double m_minPt; + mutable double m_minPtECal; + mutable double m_minPtHCal; + + + float m_deltaR; +}; + +#endif // TRIGEFMISSINGET_EFMissingETFromTrackAndClusters_H diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndJets.h b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndJets.h index 7277bed763b6f84eae8492681ecf2d9d78b3758a..345e14ee5fcdbf07896060e0165a983481fc0ebc 100755 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndJets.h +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/TrigEFMissingET/EFMissingETFromTrackAndJets.h @@ -53,7 +53,8 @@ class EFMissingETFromTrackAndJets : public EFMissingETBaseTool const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer *jets, const xAOD::TrackParticleContainer *track, - const xAOD::VertexContainer *vertex); + const xAOD::VertexContainer *vertex, + const xAOD::MuonContainer *muon); TH1* getHistogramFromFile(TString hname, TString fname); @@ -67,7 +68,6 @@ class EFMissingETFromTrackAndJets : public EFMissingETBaseTool TH2F* m_jvtLikelihood; ToolHandle<InDet::IInDetTrackSelectionTool> m_trackselTool; - ToolHandle<InDet::IInDetTrackSelectionTool> m_muontrackselTool; }; #endif // TRIGEFMISSINGET_EFMISSINGETFROMTRACKANDJETS_H diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/python/TrigEFMissingETConfig.py b/Trigger/TrigAlgorithms/TrigEFMissingET/python/TrigEFMissingETConfig.py index 4be81ddc97d4d4446e8a14f7c70da40e8197c3d4..4127a7ebe4066d9ce697f9a72e4c60def0eebeb1 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/python/TrigEFMissingETConfig.py +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/python/TrigEFMissingETConfig.py @@ -7,8 +7,10 @@ from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromCells from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromClusters from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromClustersPS from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromClustersPUC +from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromClustersTracksPUC from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromJets from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromTrackAndJets +from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromTrackAndClusters from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFlags from TrigEFMissingET.TrigEFMissingETConf import EFMissingETFromHelper @@ -1172,6 +1174,194 @@ class EFMissingET_Fex_topoClustersPS (EFMissingETBase): self.ComponentCalib1 += [ 1.00 ] # Muons + from TrigEFMissingET.TrigEFMissingETMonitoring import TrigEFMissingETValidationMonitoring_other, TrigEFMissingETOnlineMonitoring_other, TrigEFMissingETCosmicMonitoring_other + validation = TrigEFMissingETValidationMonitoring_other() + online = TrigEFMissingETOnlineMonitoring_other() + cosmic = TrigEFMissingETCosmicMonitoring_other() + + self.AthenaMonTools = [ validation, online, cosmic] + +#### Use topo. clusters for noise suppression ##### +class EFMissingET_Fex_topoClustersTracksPUC (EFMissingETBase): + __slots__ = [] + def __init__ (self, name="EFMissingET_Fex_topoClustersTracksPUC", extraCalib = ""): + super(EFMissingET_Fex_topoClustersTracksPUC, self).__init__(name) + + # name of TrigMissingET object + self.MissingETOutputKey = "TrigEFMissingET_topocltrk_PUC{0}".format(extraCalib) + self.doTopoClusters = True + self.doPUC = True + self.doJets = True + self.doTracks = True + + # tools + clusterTool = EFMissingETFromClustersTracksPUC("TheClusterToolTracksPUC") + flagTool = EFMissingETFlags("TheFlagsTool") + helperTool = EFMissingETFromHelper("TheHelperTool") + + clusterTool.ParentFexName = name + flagTool.ParentFexName = name + helperTool.ParentFexName = name + + #clusterTool.SubtractPileup = True + is2016 = (TriggerFlags.run2Config() == '2016') + clusterTool.SaveUncalibrated = True if "_em" in extraCalib else False + + ''' + clusterTool.use2016Algo = is2016 +# N.B. - defaults for 2016 running: nSigma = 3.2 and varRhoScale = 4.0 +# N.B. - defaults for 2017 running: nSigma = 5.0 and varRhoScale = 1.0 + clusterTool.nSigma = 3.2 if is2016 else 5.0 + clusterTool.varRhoScale = 4.0 if is2016 else 1.0 + clusterTool.aveEclusPU = 10000.0 + clusterTool.towerWidthInput = 0.7 + clusterTool.EtaRange = 5.0 + clusterTool.resE = 15.81 + clusterTool.resEfloor = 50.0 + clusterTool.trimFactor = 0.90 + ''' + # fraction of energy deposited in EM samplings + flagTool.MaxEMfraction = 1.0 + flagTool.MinEMfraction = 0.0 + flagTool.MaxTileGapEratio = 1.0 + # max/min energy ratios from each subdet. + flagTool.MaxSumEratioInEMB = 1.0 + flagTool.MaxSumEratioInEME = 1.0 + flagTool.MaxSumEratioInHEC = 1.0 + flagTool.MaxSumEratioInTileBar = 1.0 + flagTool.MaxSumEratioInTileGap = 1.0 + flagTool.MaxSumEratioInTileExt = 1.0 + flagTool.MaxSumEratioInFCal = 1.0 + flagTool.MinSumEratioInEMB = 0.0 + flagTool.MinSumEratioInEME = 0.0 + flagTool.MinSumEratioInHEC = 0.0 + flagTool.MinSumEratioInTileBar = 0.0 + flagTool.MinSumEratioInTileGap = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + # max/min comp energies + flagTool.MaxCompE = [] + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCompE = [] + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellE = [] + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # FCalEM, FCalHad1, FCalHad2 + # max/min cell times + flagTool.MaxCellTime = [] + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellTime = [] + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + # max cell chi-square + flagTool.WorstCellQuality = [] + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplE, EME1, EME2, EME3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # HEC0, HEC1, HEC2, HEC3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileBar0, TileBar1, TileBar2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileGap0, TileGap1, TileGap2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileExt0, TileExt1, TileExt2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # FCalEM, FCalHad1, FCalHad2 + + ## chain of tools + self.Tools = [] + self.Tools += [ clusterTool ] + self.Tools += [ flagTool ] + self.Tools += [ helperTool ] + + # component flags (-1 means skip) + self.ComponentFlags = [] + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentFlags += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentFlags += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentFlags += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentFlags += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentFlags += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentFlags += [ 0 ] # EM Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Had Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Jet + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # PUC + self.ComponentFlags += [ 0 ] # PUC prior correction + self.ComponentFlags += [ 0 ] # Muons + # calibration: constant term (MeV) + self.ComponentCalib0 = [] + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib0 += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib0 += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib0 += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib0 += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib0 += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib0 += [ 0 ] # EM Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Had Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Jet + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # PUC + self.ComponentCalib0 += [ 0 ] # PUC prior correction + self.ComponentCalib0 += [ 0 ] # Muons + # calibration: multiplicative constant + self.ComponentCalib1 = [] + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib1 += [ 1.00 ] # EM Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Had Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Jet + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # PUC + self.ComponentCalib1 += [ 1.00 ] # PUC prior correction + self.ComponentCalib1 += [ 1.00 ] # Muons + + from TrigEFMissingET.TrigEFMissingETMonitoring import TrigEFMissingETValidationMonitoring_other, TrigEFMissingETOnlineMonitoring_other, TrigEFMissingETCosmicMonitoring_other validation = TrigEFMissingETValidationMonitoring_other() online = TrigEFMissingETOnlineMonitoring_other() @@ -1182,13 +1372,14 @@ class EFMissingET_Fex_topoClustersPS (EFMissingETBase): ##### Use topo. clusters for noise suppression ##### class EFMissingET_Fex_topoClustersPUC (EFMissingETBase): __slots__ = [] - def __init__ (self, name="EFMissingET_Fex_topoClustersPUC"): + def __init__ (self, name="EFMissingET_Fex_topoClustersPUC", doLArH11off = False, doLArH12off = False, jptthr = -1.0): super(EFMissingET_Fex_topoClustersPUC, self).__init__(name) # name of TrigMissingET object - self.MissingETOutputKey = "TrigEFMissingET_topocl_PUC" + self.MissingETOutputKey = "TrigEFMissingET_topocl_PUC" if 'LAr' not in name else "TrigEFMissingET_"+name self.doTopoClusters = True self.doPUC = True + self.doJetVeto = True # tools clusterTool = EFMissingETFromClustersPUC("TheClusterToolPUC") @@ -1200,10 +1391,12 @@ class EFMissingET_Fex_topoClustersPUC (EFMissingETBase): helperTool.ParentFexName = name clusterTool.SubtractPileup = True - - is2016 = (TriggerFlags.run2Config() == '2016') + ## + clusterTool.doLArH11off = doLArH11off + clusterTool.doLArH12off = doLArH12off + clusterTool.Jetptcut = jptthr clusterTool.use2016Algo = is2016 # N.B. - defaults for 2016 running: nSigma = 3.2 and varRhoScale = 4.0 @@ -1378,11 +1571,11 @@ class EFMissingET_Fex_topoClustersPUC (EFMissingETBase): ##### loop over jets ##### class EFMissingET_Fex_Jets (EFMissingETBase): __slots__ = [] - def __init__ (self, name="EFMissingET_Fex_Jets"): + def __init__ (self, name="EFMissingET_Fex_Jets", extraCalib = ""): super(EFMissingET_Fex_Jets, self).__init__(name) # name of TrigMissingET object - self.MissingETOutputKey = "TrigEFMissingET_mht" + self.MissingETOutputKey = "TrigEFMissingET_mht{0}".format(extraCalib) self.doJets = True # tools @@ -1449,9 +1642,6 @@ class EFMissingET_Fex_TrackAndJets (EFMissingETBase): jetTool.TrackSelectionTool.CutLevel = "Loose" jetTool.TrackSelectionTool.maxZ0SinTheta = 1.5 jetTool.TrackSelectionTool.maxD0overSigmaD0 = 3 - jetTool.MuonTrackSelectionTool.CutLevel = "LooseMuon" - jetTool.MuonTrackSelectionTool.maxZ0SinTheta = 1.5 - jetTool.MuonTrackSelectionTool.maxD0overSigmaD0 = 3 ## chain of tools self.Tools = [] @@ -1466,11 +1656,422 @@ class EFMissingET_Fex_TrackAndJets (EFMissingETBase): self.AthenaMonTools = [ validation, online, cosmic] -##### THE DEFAULT FEX ##### -class EFMissingET_Fex (EFMissingET_Fex_2sidednoiseSupp): +##### loop over tracks and jets ##### +class EFMissingET_Fex_FTKTrackAndJets (EFMissingETBase): __slots__ = [] - def __init__ (self, name="EFMissingET_Fex"): - super(EFMissingET_Fex, self).__init__(name) + def __init__ (self, name="EFMissingET_Fex_FTKTrackAndJets"): + super(EFMissingET_Fex_FTKTrackAndJets, self).__init__(name) # name of TrigMissingET object - self.MissingETOutputKey = "TrigEFMissingET" + self.MissingETOutputKey = "TrigEFMissingET_trkmhtFTK" + self.doJets = True + self.doTracks = True + + # tools + febTool = EFMissingETFromFEBHeader("TheFEBTool") + jetTool = EFMissingETFromTrackAndJets("TheTrackAndJetTool") + flagTool = EFMissingETFlags("TheFlagsTool") + helperTool = EFMissingETFromHelper("TheHelperTool") + # + febTool.ParentFexName = name + jetTool.ParentFexName = name + flagTool.ParentFexName = name + helperTool.ParentFexName = name + # + + ## Configuration of jet fex + jetTool.EtaSeparation = 2.2 + jetTool.CentralpTCut = 25 #GeV + jetTool.ForwardpTCut = 0.0 + jetTool.TrackpTCut = 1 #GeV + jetTool.CentralJetJVTCut = 0.9 + jetTool.TrackSelectionTool.CutLevel = "Loose" + jetTool.TrackSelectionTool.maxZ0SinTheta = 1.5 + jetTool.TrackSelectionTool.maxD0overSigmaD0 = 3 + + ## chain of tools + self.Tools = [] + self.Tools += [ jetTool ] + self.Tools += [ flagTool ] + self.Tools += [ helperTool ] + + from TrigEFMissingET.TrigEFMissingETMonitoring import TrigEFMissingETValidationMonitoring_alt, TrigEFMissingETOnlineMonitoring_alt, TrigEFMissingETCosmicMonitoring_alt + validation = TrigEFMissingETValidationMonitoring_alt() + online = TrigEFMissingETOnlineMonitoring_alt() + cosmic = TrigEFMissingETCosmicMonitoring_alt() + + self.AthenaMonTools = [ validation, online, cosmic] + + +##### Use topo. clusters and tracks for constituent-level pile-up mitigation ##### +class EFMissingET_Fex_TrackAndClusters (EFMissingETBase): + __slots__ = [] + def __init__ (self, name="EFMissingET_Fex_TrackAndClusters"): + super(EFMissingET_Fex_TrackAndClusters, self).__init__(name) + + # name of TrigMissingET object + self.MissingETOutputKey = "TrigEFMissingET_trktc" + self.doTrackTopoClusters = True + self.doTracks = True + + # tools + clusterTool =EFMissingETFromTrackAndClusters("TheTrackAndClusters") + flagTool = EFMissingETFlags("TheFlagsTool") + helperTool = EFMissingETFromHelper("TheHelperTool") + # + clusterTool.ParentFexName = name + flagTool.ParentFexName = name + helperTool.ParentFexName = name + + # ClusterTool options + + # fraction of energy deposited in EM samplings + flagTool.MaxEMfraction = 1.0 + flagTool.MinEMfraction = 0.0 + flagTool.MaxTileGapEratio = 1.0 + # max/min energy ratios from each subdet. + flagTool.MaxSumEratioInEMB = 1.0 + flagTool.MaxSumEratioInEME = 1.0 + flagTool.MaxSumEratioInHEC = 1.0 + flagTool.MaxSumEratioInTileBar = 1.0 + flagTool.MaxSumEratioInTileGap = 1.0 + flagTool.MaxSumEratioInTileExt = 1.0 + flagTool.MaxSumEratioInFCal = 1.0 + flagTool.MinSumEratioInEMB = 0.0 + flagTool.MinSumEratioInEME = 0.0 + flagTool.MinSumEratioInHEC = 0.0 + flagTool.MinSumEratioInTileBar = 0.0 + flagTool.MinSumEratioInTileGap = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + # max/min comp energies + flagTool.MaxCompE = [] + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCompE = [] + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # FCalEM, FCalHad1, FCalHad2 + # max/min cell energies + flagTool.MaxCellE = [] + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellE = [] + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # FCalEM, FCalHad1, FCalHad2 + # max/min cell times + flagTool.MaxCellTime = [] + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellTime = [] + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + # max cell chi-square + flagTool.WorstCellQuality = [] + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplE, EME1, EME2, EME3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # HEC0, HEC1, HEC2, HEC3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileBar0, TileBar1, TileBar2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileGap0, TileGap1, TileGap2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileExt0, TileExt1, TileExt2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # FCalEM, FCalHad1, FCalHad2 + + ## chain of tools + self.Tools = [] + self.Tools += [ clusterTool ] + self.Tools += [ flagTool ] + self.Tools += [ helperTool ] + + # component flags (-1 means skip) + self.ComponentFlags = [] + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentFlags += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentFlags += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentFlags += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentFlags += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentFlags += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentFlags += [ 0 ] # EM Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Had Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Jet + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # PUC + self.ComponentFlags += [ 0 ] # PUC prior correction + self.ComponentFlags += [ 0 ] # Muons + # calibration: constant term (MeV) + self.ComponentCalib0 = [] + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib0 += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib0 += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib0 += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib0 += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib0 += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib0 += [ 0 ] # EM Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Had Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Jet + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # PUC + self.ComponentCalib0 += [ 0 ] # PUC prior correction + self.ComponentCalib0 += [ 0 ] # Muons + # calibration: multiplicative constant + self.ComponentCalib1 = [] + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib1 += [ 1.00 ] # EM Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Had Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Jet + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # PUC + self.ComponentCalib1 += [ 1.00 ] # PUC prior correction + self.ComponentCalib1 += [ 1.00 ] # Muons + + + from TrigEFMissingET.TrigEFMissingETMonitoring import TrigEFMissingETValidationMonitoring_other, TrigEFMissingETOnlineMonitoring_other, TrigEFMissingETCosmicMonitoring_other + validation = TrigEFMissingETValidationMonitoring_other() + online = TrigEFMissingETOnlineMonitoring_other() + cosmic = TrigEFMissingETCosmicMonitoring_other() + + self.AthenaMonTools = [ validation, online, cosmic] + + +##### Use topo. clusters and tracks for constituent-level pile-up mitigation ##### +class EFMissingET_Fex_FTKTrackAndClusters (EFMissingETBase): + __slots__ = [] + def __init__ (self, name="EFMissingET_Fex_FTKTrackAndClusters"): + super(EFMissingET_Fex_FTKTrackAndClusters, self).__init__(name) + + # name of TrigMissingET object + self.MissingETOutputKey = "TrigEFMissingET_trktcFTK" + self.doTrackTopoClusters = True + self.doTracks = True + + # tools + clusterTool =EFMissingETFromTrackAndClusters("TheTrackAndClusters") + flagTool = EFMissingETFlags("TheFlagsTool") + helperTool = EFMissingETFromHelper("TheHelperTool") + # + clusterTool.ParentFexName = name + flagTool.ParentFexName = name + helperTool.ParentFexName = name + + # ClusterTool options + + # fraction of energy deposited in EM samplings + flagTool.MaxEMfraction = 1.0 + flagTool.MinEMfraction = 0.0 + flagTool.MaxTileGapEratio = 1.0 + # max/min energy ratios from each subdet. + flagTool.MaxSumEratioInEMB = 1.0 + flagTool.MaxSumEratioInEME = 1.0 + flagTool.MaxSumEratioInHEC = 1.0 + flagTool.MaxSumEratioInTileBar = 1.0 + flagTool.MaxSumEratioInTileGap = 1.0 + flagTool.MaxSumEratioInTileExt = 1.0 + flagTool.MaxSumEratioInFCal = 1.0 + flagTool.MinSumEratioInEMB = 0.0 + flagTool.MinSumEratioInEME = 0.0 + flagTool.MinSumEratioInHEC = 0.0 + flagTool.MinSumEratioInTileBar = 0.0 + flagTool.MinSumEratioInTileGap = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + flagTool.MinSumEratioInTileExt = 0.0 + # max/min comp energies + flagTool.MaxCompE = [] + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCompE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCompE = [] + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCompE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # FCalEM, FCalHad1, FCalHad2 + # max/min cell energies + flagTool.MaxCellE = [] + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV,1e4*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellE += [ 1e4*GeV,1e4*GeV,1e4*GeV ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellE = [] + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV,0.0*GeV ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellE += [ 0.0*GeV,0.0*GeV,0.0*GeV ] # FCalEM, FCalHad1, FCalHad2 + # max/min cell times + flagTool.MaxCellTime = [] + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond,+10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MaxCellTime += [ +10*nanosecond,+10*nanosecond,+10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + flagTool.MinCellTime = [] + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # PreSamplE, EME1, EME2, EME3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond,-10*nanosecond ] # HEC0, HEC1, HEC2, HEC3 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileBar0, TileBar1, TileBar2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileGap0, TileGap1, TileGap2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # TileExt0, TileExt1, TileExt2 + flagTool.MinCellTime += [ -10*nanosecond,-10*nanosecond,-10*nanosecond ] # FCalEM, FCalHad1, FCalHad2 + # max cell chi-square + flagTool.WorstCellQuality = [] + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplB, EMB1, EMB2, EMB3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # PreSamplE, EME1, EME2, EME3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3,4e3 ] # HEC0, HEC1, HEC2, HEC3 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileBar0, TileBar1, TileBar2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileGap0, TileGap1, TileGap2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # TileExt0, TileExt1, TileExt2 + flagTool.WorstCellQuality += [ 4e3,4e3,4e3 ] # FCalEM, FCalHad1, FCalHad2 + + ## chain of tools + self.Tools = [] + self.Tools += [ clusterTool ] + self.Tools += [ flagTool ] + self.Tools += [ helperTool ] + + # component flags (-1 means skip) + self.ComponentFlags = [] + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentFlags += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentFlags += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentFlags += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentFlags += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentFlags += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentFlags += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentFlags += [ 0 ] # EM Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Had Topo + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # Jet + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0,0 ] + self.ComponentFlags += [ 0 ] # PUC + self.ComponentFlags += [ 0 ] # PUC prior correction + self.ComponentFlags += [ 0 ] # Muons + # calibration: constant term (MeV) + self.ComponentCalib0 = [] + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib0 += [ 0,0,0,0 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib0 += [ 0,0,0,0 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib0 += [ 0,0,0 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib0 += [ 0,0,0 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib0 += [ 0,0,0 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib0 += [ 0,0,0 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib0 += [ 0 ] # EM Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Had Topo + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # Jet + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0, 0 ] + self.ComponentCalib0 += [ 0 ] # PUC + self.ComponentCalib0 += [ 0 ] # PUC prior correction + self.ComponentCalib0 += [ 0 ] # Muons + # calibration: multiplicative constant + self.ComponentCalib1 = [] + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplB, EMB1, EMB2, EMB3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # PreSamplE, EME1, EME2, EME3 + self.ComponentCalib1 += [ 1.00,1.00,1.00,1.00 ] # HEC0, HEC1, HEC2, HEC3 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileBar0, TileBar1, TileBar2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileGap0, TileGap1, TileGap2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # TileExt0, TileExt1, TileExt2 + self.ComponentCalib1 += [ 1.00,1.00,1.00 ] # FCalEM, FCalHad1, FCalHad2 + self.ComponentCalib1 += [ 1.00 ] # EM Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Had Topo + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # Jet + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00,1.00 ] + self.ComponentCalib1 += [ 1.00 ] # PUC + self.ComponentCalib1 += [ 1.00 ] # PUC prior correction + self.ComponentCalib1 += [ 1.00 ] # Muons + + + from TrigEFMissingET.TrigEFMissingETMonitoring import TrigEFMissingETValidationMonitoring_other, TrigEFMissingETOnlineMonitoring_other, TrigEFMissingETCosmicMonitoring_other + validation = TrigEFMissingETValidationMonitoring_other() + online = TrigEFMissingETOnlineMonitoring_other() + cosmic = TrigEFMissingETCosmicMonitoring_other() + + self.AthenaMonTools = [ validation, online, cosmic] + + +##### THE DEFAULT FEX ##### +class EFMissingET_Fex (EFMissingET_Fex_2sidednoiseSupp): + __slots__ = [] + def __init__ (self, name="EFMissingET_Fex"): + super(EFMissingET_Fex, self).__init__(name) + + # name of TrigMissingET object + self.MissingETOutputKey = "TrigEFMissingET" + + diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingET.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingET.cxx index e4005c86fd5304b1cb17cc91cdb17c955e339929..8417c4e430a6e59c44efaa147fdcfb6cedbb3afb 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingET.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingET.cxx @@ -27,6 +27,8 @@ #include "CaloEvent/CaloCellContainer.h" #include "xAODTrigMissingET/TrigMissingET.h" #include "xAODTrigMissingET/TrigMissingETContainer.h" +#include "AthContainers/DataVector.h" +#include "AthContainers/ConstDataVector.h" //#include "TrigNavigation/Navigation.h" // Added for "Hack" //#include "TrigNavigation/NavigationCore.icc" // Added for "Hack" @@ -42,460 +44,473 @@ using namespace std; class ISvcLocator; EFMissingET::EFMissingET(const std::string & name, ISvcLocator* pSvcLocator): - HLT::AllTEAlgo(name, pSvcLocator), - m_cachedTE(0), m_useCachedResult(false), m_tools( this ) + HLT::AllTEAlgo(name, pSvcLocator), + m_cachedTE(0), m_useCachedResult(false), m_tools( this ) { - declareProperty("MissingETOutputKey",m_metOutputKey = "TrigEFMissingET", "label for the MET feature in the HLT navigation"); - declareProperty("Tools", m_tools, "list of missEt tools"); - declareProperty("doTimers", m_doTimers = true, "switch on/off internal timers"); - declareProperty("DecodeDetMask", m_decodeDetMask = false, "switch on/off DetMask decoding"); - declareProperty("doTopoClusters", m_doTopoClusters = false, "run with or without topo. clusters"); - declareProperty("doJets", m_doJets = false, "run with or without jets"); - declareProperty("doTracks", m_doTracks = false, "run with or without tracks"); - declareProperty("doPUC", m_doPUC = false, "run with or without pile-up correction fit"); - declareProperty("ComponentFlags", m_flags, "(vector) set to -1 to switch off a component"); - declareProperty("ComponentCalib0", m_calib0, "(vector) additive calibration constants"); - declareProperty("ComponentCalib1", m_calib1, "(vector) multiplicative calib. constants"); - - declareMonitoredVariable("EF_MEx_log", m_mex_log); - declareMonitoredVariable("EF_MEy_log", m_mey_log); - declareMonitoredVariable("EF_MEz_log", m_mez_log); - declareMonitoredVariable("EF_MET_log", m_met_log); - declareMonitoredVariable("EF_ME_log", m_me_log); - declareMonitoredVariable("EF_SumEt_log", m_set_log); - declareMonitoredVariable("EF_SumE_log", m_se_log); - - declareMonitoredVariable("EF_MEx_lin", m_mex_lin); - declareMonitoredVariable("EF_MEy_lin", m_mey_lin); - declareMonitoredVariable("EF_MEz_lin", m_mez_lin); - declareMonitoredVariable("EF_MET_lin", m_met_lin); - declareMonitoredVariable("EF_ME_lin", m_me_lin); - declareMonitoredVariable("EF_SumEt_lin", m_set_lin); - declareMonitoredVariable("EF_SumE_lin", m_se_lin); - declareMonitoredVariable("EF_XS", m_xs); - declareMonitoredVariable("EF_MET_phi", m_phi); - - declareMonitoredVariable("EMRegSelTime", m_tool_time_00); - declareMonitoredVariable("EMLoadColTime", m_tool_time_01); - declareMonitoredVariable("EMLoopTime", m_tool_time_02); - declareMonitoredVariable("HECRegSelTime", m_tool_time_10); - declareMonitoredVariable("HECLoadColTime", m_tool_time_11); - declareMonitoredVariable("HECLoopTime", m_tool_time_12); - declareMonitoredVariable("TileRegSelTime", m_tool_time_20); - declareMonitoredVariable("TileLoadColTime", m_tool_time_21); - declareMonitoredVariable("TileLoopTime", m_tool_time_22); - declareMonitoredVariable("FCalRegSelTime", m_tool_time_30); - declareMonitoredVariable("FCalLoadColTime", m_tool_time_31); - declareMonitoredVariable("FCalLoopTime", m_tool_time_32); + declareProperty("MissingETOutputKey",m_metOutputKey = "TrigEFMissingET", "label for the MET feature in the HLT navigation"); + declareProperty("Tools", m_tools, "list of missEt tools"); + declareProperty("doTimers", m_doTimers = true, "switch on/off internal timers"); + declareProperty("DecodeDetMask", m_decodeDetMask = false, "switch on/off DetMask decoding"); + declareProperty("doTopoClusters", m_doTopoClusters = false, "run with or without topo. clusters"); + declareProperty("doTrackTopoClusters", m_doTrackTopoClusters = false, "run with or without track and topo. clusters"); + declareProperty("doJets", m_doJets = false, "run with or without jets"); + declareProperty("doJetVeto", m_doJetVeto = false, "run with or without Jet Veto"); + declareProperty("doTracks", m_doTracks = false, "run with or without tracks"); + declareProperty("doPUC", m_doPUC = false, "run with or without pile-up correction fit"); + declareProperty("ComponentFlags", m_flags, "(vector) set to -1 to switch off a component"); + declareProperty("ComponentCalib0", m_calib0, "(vector) additive calibration constants"); + declareProperty("ComponentCalib1", m_calib1, "(vector) multiplicative calib. constants"); + + declareMonitoredVariable("EF_MEx_log", m_mex_log); + declareMonitoredVariable("EF_MEy_log", m_mey_log); + declareMonitoredVariable("EF_MEz_log", m_mez_log); + declareMonitoredVariable("EF_MET_log", m_met_log); + declareMonitoredVariable("EF_ME_log", m_me_log); + declareMonitoredVariable("EF_SumEt_log", m_set_log); + declareMonitoredVariable("EF_SumE_log", m_se_log); + + declareMonitoredVariable("EF_MEx_lin", m_mex_lin); + declareMonitoredVariable("EF_MEy_lin", m_mey_lin); + declareMonitoredVariable("EF_MEz_lin", m_mez_lin); + declareMonitoredVariable("EF_MET_lin", m_met_lin); + declareMonitoredVariable("EF_ME_lin", m_me_lin); + declareMonitoredVariable("EF_SumEt_lin", m_set_lin); + declareMonitoredVariable("EF_SumE_lin", m_se_lin); + declareMonitoredVariable("EF_XS", m_xs); + declareMonitoredVariable("EF_MET_phi", m_phi); + + declareMonitoredVariable("EMRegSelTime", m_tool_time_00); + declareMonitoredVariable("EMLoadColTime", m_tool_time_01); + declareMonitoredVariable("EMLoopTime", m_tool_time_02); + declareMonitoredVariable("HECRegSelTime", m_tool_time_10); + declareMonitoredVariable("HECLoadColTime", m_tool_time_11); + declareMonitoredVariable("HECLoopTime", m_tool_time_12); + declareMonitoredVariable("TileRegSelTime", m_tool_time_20); + declareMonitoredVariable("TileLoadColTime", m_tool_time_21); + declareMonitoredVariable("TileLoopTime", m_tool_time_22); + declareMonitoredVariable("FCalRegSelTime", m_tool_time_30); + declareMonitoredVariable("FCalLoadColTime", m_tool_time_31); + declareMonitoredVariable("FCalLoopTime", m_tool_time_32); // declareMonitoredVariable("TotalTime", m_tool_time_TOT); - declareMonitoredVariable("TotalEMTime", m_tool_time_EM); - declareMonitoredVariable("TotalHECTime", m_tool_time_HEC); - declareMonitoredVariable("TotalTileTime", m_tool_time_Tile); - declareMonitoredVariable("TotalFCalTime", m_tool_time_FCal); - declareMonitoredVariable("TotalRegSelTime", m_tool_time_RegSel); - declareMonitoredVariable("TotalLoadColTime", m_tool_time_LoadCol); - declareMonitoredVariable("TotalLoopTime", m_tool_time_Loop); - - // helper object - unsigned char N=42; // number of components - m_met_help = new TrigEFMissingEtHelper(N); - m_flags.reserve(N); - m_calib0.reserve(N); - m_calib1.reserve(N); - m_comp_index.reserve(N); - m_comp_ex_log.reserve(N); - m_comp_ey_log.reserve(N); - m_comp_ez_log.reserve(N); - m_comp_et_log.reserve(N); - m_comp_sum_et_log.reserve(N); - m_comp_sum_e_log.reserve(N); - m_comp_status_flag.reserve(N); - m_comp_et_lin.reserve(N); - m_comp_sum_et_lin.reserve(N); - - for (int i=0; i<N; ++i) { - m_comp_index.push_back(i); - m_comp_ex_log.push_back(0); - m_comp_ey_log.push_back(0); - m_comp_ez_log.push_back(0); - m_comp_et_log.push_back(0); - m_comp_sum_et_log.push_back(0); - m_comp_sum_e_log.push_back(0); - m_comp_status_flag.push_back(0); - m_comp_et_lin.push_back(0); - m_comp_sum_et_lin.push_back(0); - } - - declareMonitoredStdContainer("compN", m_comp_index); - declareMonitoredStdContainer("compEx", m_comp_ex_log); - declareMonitoredStdContainer("compEy", m_comp_ey_log); - declareMonitoredStdContainer("compEz", m_comp_ez_log); - declareMonitoredStdContainer("compEt", m_comp_et_log); - declareMonitoredStdContainer("compSumEt", m_comp_sum_et_log); - declareMonitoredStdContainer("compSumE", m_comp_sum_e_log); - declareMonitoredStdContainer("compEt_lin", m_comp_et_lin); - declareMonitoredStdContainer("compSumEt_lin", m_comp_sum_et_lin); - - declareMonitoredStdContainer("compStatus", m_comp_status_flag); + declareMonitoredVariable("TotalEMTime", m_tool_time_EM); + declareMonitoredVariable("TotalHECTime", m_tool_time_HEC); + declareMonitoredVariable("TotalTileTime", m_tool_time_Tile); + declareMonitoredVariable("TotalFCalTime", m_tool_time_FCal); + declareMonitoredVariable("TotalRegSelTime", m_tool_time_RegSel); + declareMonitoredVariable("TotalLoadColTime", m_tool_time_LoadCol); + declareMonitoredVariable("TotalLoopTime", m_tool_time_Loop); + + // helper object + unsigned char N=42; // number of components + m_met_help = new TrigEFMissingEtHelper(N); + m_flags.reserve(N); + m_calib0.reserve(N); + m_calib1.reserve(N); + m_comp_index.reserve(N); + m_comp_ex_log.reserve(N); + m_comp_ey_log.reserve(N); + m_comp_ez_log.reserve(N); + m_comp_et_log.reserve(N); + m_comp_sum_et_log.reserve(N); + m_comp_sum_e_log.reserve(N); + m_comp_status_flag.reserve(N); + m_comp_et_lin.reserve(N); + m_comp_sum_et_lin.reserve(N); + + for (int i=0; i<N; ++i) { + m_comp_index.push_back(i); + m_comp_ex_log.push_back(0); + m_comp_ey_log.push_back(0); + m_comp_ez_log.push_back(0); + m_comp_et_log.push_back(0); + m_comp_sum_et_log.push_back(0); + m_comp_sum_e_log.push_back(0); + m_comp_status_flag.push_back(0); + m_comp_et_lin.push_back(0); + m_comp_sum_et_lin.push_back(0); + } + + declareMonitoredStdContainer("compN", m_comp_index); + declareMonitoredStdContainer("compEx", m_comp_ex_log); + declareMonitoredStdContainer("compEy", m_comp_ey_log); + declareMonitoredStdContainer("compEz", m_comp_ez_log); + declareMonitoredStdContainer("compEt", m_comp_et_log); + declareMonitoredStdContainer("compSumEt", m_comp_sum_et_log); + declareMonitoredStdContainer("compSumE", m_comp_sum_e_log); + declareMonitoredStdContainer("compEt_lin", m_comp_et_lin); + declareMonitoredStdContainer("compSumEt_lin", m_comp_sum_et_lin); + + declareMonitoredStdContainer("compStatus", m_comp_status_flag); // declareMonitoredCustomVariable("compStatus", m_comp_status_flag); - m_status_flag.reserve(32); // to map a 32-bit word - m_status_flag.assign(32, 0); - declareMonitoredStdContainer("EF_MET_status", m_status_flag); - - m_totTime=0; - m_algTime=0; - - m_StoreGate=nullptr; - m_current_run_id=0; - m_current_lbk_id=0; - m_current_evt_id=0; - m_current_bcg_id=0; - m_LArEMbarrelAside=true; - m_LArEMbarrelCside=true; - m_LArEMendCapAside=true; - m_LArEMendCapCside=true; - m_LArHECendCapAside=true; - m_LArHECendCapCside=true; - m_LArFCalAside=true; - m_LArFCalCside=true; - m_TileBarrelAside=true; - m_TileBarrelCside=true; - m_TileExtBarAside=true; - m_TileExtBarCside=true; - - m_caloCluster=nullptr; - m_jets=nullptr; - m_tracks=nullptr; - m_vertices=nullptr; - - // // see the base tool for all other status bits - // m_maskEMB_A_Missing = 0x00010000; // bit 16 - // m_maskEMB_C_Missing = 0x00020000; // bit 17 - // m_maskEME_A_Missing = 0x00040000; // bit 18 - // m_maskEME_C_Missing = 0x00080000; // bit 19 - // m_maskHEC_A_Missing = 0x00100000; // bit 20 - // m_maskHEC_C_Missing = 0x00200000; // bit 21 - // m_maskFCAL_A_Missing = 0x00400000; // bit 22 - // m_maskFCAL_C_Missing = 0x00800000; // bit 23 - // m_maskTileB_A_Missing = 0x01000000; // bit 24 - // m_maskTileB_C_Missing = 0x02000000; // bit 25 - // m_maskTileE_A_Missing = 0x04000000; // bit 26 - // m_maskTileE_C_Missing = 0x08000000; // bit 27 - - //Initialize some variables to make coverity happy, - //even though not needed in principle - - m_met=nullptr; - m_firsteventinrun=false; - m_n_sizePers=0; + m_status_flag.reserve(32); // to map a 32-bit word + m_status_flag.assign(32, 0); + declareMonitoredStdContainer("EF_MET_status", m_status_flag); + + m_totTime=0; + m_algTime=0; + + m_StoreGate=nullptr; + m_current_run_id=0; + m_current_lbk_id=0; + m_current_evt_id=0; + m_current_bcg_id=0; + m_LArEMbarrelAside=true; + m_LArEMbarrelCside=true; + m_LArEMendCapAside=true; + m_LArEMendCapCside=true; + m_LArHECendCapAside=true; + m_LArHECendCapCside=true; + m_LArFCalAside=true; + m_LArFCalCside=true; + m_TileBarrelAside=true; + m_TileBarrelCside=true; + m_TileExtBarAside=true; + m_TileExtBarCside=true; + + m_caloCluster=nullptr; + m_jets=nullptr; + m_tracks=nullptr; + m_vertices=nullptr; + m_muons=nullptr; + + // // see the base tool for all other status bits + // m_maskEMB_A_Missing = 0x00010000; // bit 16 + // m_maskEMB_C_Missing = 0x00020000; // bit 17 + // m_maskEME_A_Missing = 0x00040000; // bit 18 + // m_maskEME_C_Missing = 0x00080000; // bit 19 + // m_maskHEC_A_Missing = 0x00100000; // bit 20 + // m_maskHEC_C_Missing = 0x00200000; // bit 21 + // m_maskFCAL_A_Missing = 0x00400000; // bit 22 + // m_maskFCAL_C_Missing = 0x00800000; // bit 23 + // m_maskTileB_A_Missing = 0x01000000; // bit 24 + // m_maskTileB_C_Missing = 0x02000000; // bit 25 + // m_maskTileE_A_Missing = 0x04000000; // bit 26 + // m_maskTileE_C_Missing = 0x08000000; // bit 27 + + //Initialize some variables to make coverity happy, + //even though not needed in principle + + m_met=nullptr; + m_firsteventinrun=false; + m_n_sizePers=0; } ////////////////////////////////////////////////////////// HLT::ErrorCode EFMissingET::hltFinalize() { - return HLT::OK; + return HLT::OK; } ////////////////////////////////////////////////////////// HLT::ErrorCode EFMissingET::hltInitialize() { - // Initialize timers - if (doTiming() && m_doTimers) { - m_totTime=addTimer("EFMissingETInternalTotalTime"); - m_algTime=addTimer("EFMissingETtotalAlgToolTime"); - if (m_totTime==0 || m_algTime==0) { - ATH_MSG_WARNING( "not able to initialize timer!" ); + // Initialize timers + if (doTiming() && m_doTimers) { + m_totTime=addTimer("EFMissingETInternalTotalTime"); + m_algTime=addTimer("EFMissingETtotalAlgToolTime"); + if (m_totTime==0 || m_algTime==0) { + ATH_MSG_WARNING( "not able to initialize timer!" ); + } } - } - - ATH_MSG_DEBUG( "Initializing EFMissingET" ); - - if(m_tools.retrieve().isFailure() ) - ATH_MSG_ERROR( "Failed retrieve tools " << m_tools ); - else - ATH_MSG_DEBUG( "Successfully retrieve tools " << m_tools ); - - - int Nc = m_met_help->GetElements(); - int Nf = m_flags.size(); - if(Nf>0){ - ATH_MSG_INFO( "ComponentFlags has size " << Nf ); - if (Nf!=Nc) { - ATH_MSG_ERROR( "ComponentFlags has size different from the number " << Nc << " of components. Aborting" ); - return HLT::ERROR; - } else { - for (unsigned char i=0; i<Nf; ++i) { - if (m_flags[i]<0) - (m_met_help->GetComponent(i))->m_skip = true; - } + + ATH_MSG_DEBUG( "Initializing EFMissingET" ); + + if(m_tools.retrieve().isFailure() ) + ATH_MSG_ERROR( "Failed retrieve tools " << m_tools ); + else + ATH_MSG_DEBUG( "Successfully retrieve tools " << m_tools ); + + + int Nc = m_met_help->GetElements(); + int Nf = m_flags.size(); + if(Nf>0) { + ATH_MSG_INFO( "ComponentFlags has size " << Nf ); + if (Nf!=Nc) { + ATH_MSG_ERROR( "ComponentFlags has size different from the number " << Nc << " of components. Aborting" ); + return HLT::ERROR; + } else { + for (unsigned char i=0; i<Nf; ++i) { + if (m_flags[i]<0) + (m_met_help->GetComponent(i))->m_skip = true; + } + } } - } - - int N0 = m_calib0.size(); - if (N0>0) { - ATH_MSG_INFO( "ComponentCalib0 has size " << N0 ); - if (N0!=Nc) { - ATH_MSG_ERROR( "ComponentCalib0 has size different from the number " << Nc << " of components. Aborting" ); - return HLT::ERROR; - } else { - for (unsigned char i=0; i<N0; ++i) { - (m_met_help->GetComponent(i))->m_calib0 = m_calib0[i]; - } + + int N0 = m_calib0.size(); + if (N0>0) { + ATH_MSG_INFO( "ComponentCalib0 has size " << N0 ); + if (N0!=Nc) { + ATH_MSG_ERROR( "ComponentCalib0 has size different from the number " << Nc << " of components. Aborting" ); + return HLT::ERROR; + } else { + for (unsigned char i=0; i<N0; ++i) { + (m_met_help->GetComponent(i))->m_calib0 = m_calib0[i]; + } + } } - } - - int N1 = m_calib1.size(); - if (N1>0) { - ATH_MSG_INFO( "ComponentCalib1 has size " << N1 ); - if (N1!=Nc) { - ATH_MSG_ERROR( "ComponentCalib1 has size different from the number " << Nc << " of components. Aborting" ); - return HLT::ERROR; - } else { - for (unsigned char i=0; i<N1; ++i) { - (m_met_help->GetComponent(i))->m_calib1 = m_calib1[i]; - } + + int N1 = m_calib1.size(); + if (N1>0) { + ATH_MSG_INFO( "ComponentCalib1 has size " << N1 ); + if (N1!=Nc) { + ATH_MSG_ERROR( "ComponentCalib1 has size different from the number " << Nc << " of components. Aborting" ); + return HLT::ERROR; + } else { + for (unsigned char i=0; i<N1; ++i) { + (m_met_help->GetComponent(i))->m_calib1 = m_calib1[i]; + } + } } - } - return HLT::OK; + return HLT::OK; } ////////////////////////////////////////////////////////// -EFMissingET::~EFMissingET(){ - if (m_met_help) { - delete m_met_help; - m_met_help = nullptr; - } +EFMissingET::~EFMissingET() +{ + if (m_met_help) { + delete m_met_help; + m_met_help = nullptr; + } } ////////////////////////////////////////////////////////// -HLT::ErrorCode EFMissingET::hltStart() { +HLT::ErrorCode EFMissingET::hltStart() +{ - // access StoreGate - m_StoreGate = store(); - if (m_StoreGate==0) { - ATH_MSG_ERROR( "Can not access StoreGate" ); - return HLT::SG_ERROR; - } + ATH_MSG_DEBUG( " EFMissingET::hltStart() called " ); - // Check if configuration is sane - bool foundTopo = false; bool foundFEB = false; bool foundCell = false; bool foundJets = false; + // access StoreGate + m_StoreGate = store(); + if (m_StoreGate==0) { + ATH_MSG_ERROR( "Can not access StoreGate" ); + return HLT::SG_ERROR; + } - ATH_MSG_DEBUG( " loop through helper tools start " ); + // Check if configuration is sane + bool foundTopo = false; + bool foundFEB = false; + bool foundCell = false; + bool foundJets = false; - for (auto& tool : m_tools) { + ATH_MSG_DEBUG( " loop through helper tools start " ); - ATH_MSG_DEBUG( tool->name() ); + for (auto& tool : m_tools) { - if(tool->getFexType() == FexType::TOPO) foundTopo = true; - if(tool->getFexType() == FexType::CELL) foundCell = true; - if(tool->getFexType() == FexType::FEB) foundFEB = true; - if(tool->getFexType() == FexType::JET) foundJets = true; + ATH_MSG_DEBUG( tool->name() ); - } + if(tool->getFexType() == FexType::TOPO) foundTopo = true; + if(tool->getFexType() == FexType::CELL) foundCell = true; + if(tool->getFexType() == FexType::FEB) foundFEB = true; + if(tool->getFexType() == FexType::JET) foundJets = true; - if(foundTopo && (foundFEB || foundCell)) { - ATH_MSG_ERROR( "found topo. clusters AND Cells OR FEB - not a valid configuration .. aborting " ); - return HLT::ERROR; - } + } - if(m_doTopoClusters && !foundTopo) { - ATH_MSG_ERROR( "found topo. clusters config but no ClusterTool .. aborting " ); - return HLT::ERROR; - } + if(foundTopo && (foundFEB || foundCell)) { + ATH_MSG_ERROR( "found topo. clusters AND Cells OR FEB - not a valid configuration .. aborting " ); + return HLT::ERROR; + } - if(m_doJets && !foundJets) { - ATH_MSG_ERROR( "found jet config but no JetTool .. aborting " ); - return HLT::ERROR; - } + if(m_doTopoClusters && !foundTopo) { + ATH_MSG_ERROR( "found topo. clusters config but no ClusterTool .. aborting " ); + return HLT::ERROR; + } + if(m_doJets && !foundJets) { + if (!m_doTopoClusters) { + ATH_MSG_ERROR( "found jet config but no JetTool .. aborting " ); + return HLT::ERROR; + } + } - m_firsteventinrun = true; + m_firsteventinrun = true; - return HLT::OK; + return HLT::OK; } ////////////////////////////////////////////////////////// HLT::ErrorCode EFMissingET::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& tes_in, - unsigned int type_out) { - - if (doTiming() && m_doTimers && m_totTime) { - m_totTime->start(); - } + unsigned int type_out) +{ - // CACHING - if (m_useCachedResult) { // check whether we executed this instance before - ATH_MSG_DEBUG( "Executing this EFMissingET " << name() << " in cached mode" ); + if (doTiming() && m_doTimers && m_totTime) { + m_totTime->start(); + } - // Only count MET as an input TE (for seeding relation of navigation structure) - HLT::TEVec allTEs; - if ( (tes_in.size()>0) && (tes_in[0].size()>0) ) allTEs.push_back( tes_in[0][0] ); + // CACHING + if (m_useCachedResult) { // check whether we executed this instance before + ATH_MSG_DEBUG( "Executing this EFMissingET " << name() << " in cached mode" ); - // Create an output TE seeded by the inputs - HLT::TriggerElement* outputTE = config()->getNavigation()->addNode(allTEs, type_out); - outputTE->setActiveState(true); + // Only count MET as an input TE (for seeding relation of navigation structure) + HLT::TEVec allTEs; + if ( (tes_in.size()>0) && (tes_in[0].size()>0) ) allTEs.push_back( tes_in[0][0] ); - // save (cached) met feature to output TE: - m_config->getNavigation()->copyAllFeatures( m_cachedTE, outputTE ); + // Create an output TE seeded by the inputs + HLT::TriggerElement* outputTE = config()->getNavigation()->addNode(allTEs, type_out); + outputTE->setActiveState(true); - return HLT::OK; - } - - // start monitoring - beforeExecMonitors().ignore(); - - //initialize monitored variables to impossible values - m_mex_log = -9e9; - m_mey_log = -9e9; - m_mez_log = -9e9; - m_met_log = -9e9; - m_me_log = -9e9; - m_set_log = -9e9; - m_se_log = -9e9; - m_mex_lin = -9e9; - m_mey_lin = -9e9; - m_mez_lin = -9e9; - m_met_lin = -9e9; - m_me_lin = -9e9; - m_set_lin = -9e9; - m_se_lin = -9e9; - - m_xs = -9e9; - - m_phi = -9e9; - - m_tool_time_00 = 0; - m_tool_time_01 = 0; - m_tool_time_02 = 0; - m_tool_time_10 = 0; - m_tool_time_11 = 0; - m_tool_time_12 = 0; - m_tool_time_20 = 0; - m_tool_time_21 = 0; - m_tool_time_22 = 0; - m_tool_time_30 = 0; - m_tool_time_31 = 0; - m_tool_time_32 = 0; - // m_tool_time_TOT = 0; - m_tool_time_EM = 0; - m_tool_time_HEC = 0; - m_tool_time_Tile = 0; - m_tool_time_FCal = 0; - m_tool_time_RegSel = 0; - m_tool_time_LoadCol = 0; - m_tool_time_Loop = 0; - - m_jets = nullptr; - m_caloCluster = nullptr; - m_tracks=nullptr; - m_vertices=nullptr; - - ATH_MSG_DEBUG( "Executing EFMissingET::hltExecute()" ); - - if(m_firsteventinrun) { - ATH_MSG_DEBUG( "REGTEST: First event in run" ); - if (m_StoreGate) { - const xAOD::EventInfo* pEvent(0); - StatusCode sc = m_StoreGate->retrieve(pEvent); - if ( sc.isFailure() ) { - ATH_MSG_ERROR( "Cannot find xAOD::EventInfo object" ); - } else { - m_current_run_id = pEvent->runNumber(); - m_current_lbk_id = pEvent->lumiBlock(); - m_current_evt_id = pEvent->eventNumber(); - m_current_bcg_id = pEvent->bcid(); - char buff[512]; - snprintf(buff,512, - "REGTEST: Run number = %11u, luminosity block = %11u, event number = %11u, bunch crossing = %11u", - m_current_run_id, m_current_lbk_id, m_current_evt_id, m_current_bcg_id); - ATH_MSG_DEBUG( buff ); - - m_LArEMbarrelAside=true; - m_LArEMbarrelCside=true; - m_LArEMendCapAside=true; - m_LArEMendCapCside=true; - m_LArHECendCapAside=true; - m_LArHECendCapCside=true; - m_LArFCalAside=true; - m_LArFCalCside=true; - m_TileBarrelAside=true; - m_TileBarrelCside=true; - m_TileExtBarAside=true; - m_TileExtBarCside=true; - - if (m_decodeDetMask) { - uint64_t mask64 = pEvent->detectorMask(); - if(msgLvl(MSG::DEBUG) ){ - char buff[512]; - snprintf(buff,512,"REGTEST: DetMask_1 = 0x%08lu",mask64); - ATH_MSG_DEBUG( buff ); - } - - if (!(mask64==0)) { // 0 means present - - eformat::helper::DetectorMask dm(mask64); - m_LArEMbarrelAside = dm.is_set(eformat::LAR_EM_BARREL_A_SIDE); - m_LArEMbarrelCside = dm.is_set(eformat::LAR_EM_BARREL_C_SIDE); - m_LArEMendCapAside = dm.is_set(eformat::LAR_EM_ENDCAP_A_SIDE); - m_LArEMendCapCside = dm.is_set(eformat::LAR_EM_ENDCAP_C_SIDE); - m_LArHECendCapAside = dm.is_set(eformat::LAR_HAD_ENDCAP_A_SIDE); - m_LArHECendCapCside = dm.is_set(eformat::LAR_HAD_ENDCAP_C_SIDE); - m_LArFCalAside = dm.is_set(eformat::LAR_FCAL_A_SIDE); - m_LArFCalCside = dm.is_set(eformat::LAR_FCAL_C_SIDE); - m_TileBarrelAside = dm.is_set(eformat::TILECAL_BARREL_A_SIDE); - m_TileBarrelCside = dm.is_set(eformat::TILECAL_BARREL_C_SIDE); - m_TileExtBarAside = dm.is_set(eformat::TILECAL_EXT_A_SIDE); - m_TileExtBarCside = dm.is_set(eformat::TILECAL_EXT_C_SIDE); - - if (msgLvl(MSG::WARNING) ) { - if(!m_LArEMbarrelAside) ATH_MSG_WARNING( "LAR_EM_BARREL_A_SIDE is absent!" ); - if(!m_LArEMbarrelCside) ATH_MSG_WARNING( "LAR_EM_BARREL_C_SIDE is absent!" ); - if(!m_LArEMendCapAside) ATH_MSG_WARNING( "LAR_EM_ENDCAP_A_SIDE is absent!" ); - if(!m_LArEMendCapCside) ATH_MSG_WARNING( "LAR_EM_ENDCAP_C_SIDE is absent!" ); - if(!m_LArHECendCapAside) ATH_MSG_WARNING( "LAR_HAD_ENDCAP_A_SIDE is absent!" ); - if(!m_LArHECendCapCside) ATH_MSG_WARNING( "LAR_HAD_ENDCAP_C_SIDE is absent!" ); - if(!m_LArFCalAside) ATH_MSG_WARNING( "LAR_FCAL_A_SIDE is absent!" ); - if(!m_LArFCalCside) ATH_MSG_WARNING( "LAR_FCAL_C_SIDE is absent!" ); - if(!m_TileBarrelAside) ATH_MSG_WARNING( "TILECAL_BARREL_A_SIDE is absent!" ); - if(!m_TileBarrelCside) ATH_MSG_WARNING( "TILECAL_BARREL_C_SIDE is absent!" ); - if(!m_TileExtBarAside) ATH_MSG_WARNING( "TILECAL_EXT_A_SIDE is absent!" ); - if(!m_TileExtBarCside) ATH_MSG_WARNING( "TILECAL_EXT_C_SIDE is absent!" ); - } + // save (cached) met feature to output TE: + m_config->getNavigation()->copyAllFeatures( m_cachedTE, outputTE ); - } // end of setting flags for non-zero mask - } // end of decoding detector mask - } + return HLT::OK; } - m_firsteventinrun=false; - } // done processing for first event in the run - - // do the real job - HLT::ErrorCode status = makeMissingET(tes_in); - if(status != HLT::OK){ - delete m_met; - m_met = nullptr; - ATH_MSG_ERROR( "EFMissingET::makeOutputTE returned Failure" ); - return HLT::ERROR; - } + // start monitoring + beforeExecMonitors().ignore(); + + //initialize monitored variables to impossible values + m_mex_log = -9e9; + m_mey_log = -9e9; + m_mez_log = -9e9; + m_met_log = -9e9; + m_me_log = -9e9; + m_set_log = -9e9; + m_se_log = -9e9; + m_mex_lin = -9e9; + m_mey_lin = -9e9; + m_mez_lin = -9e9; + m_met_lin = -9e9; + m_me_lin = -9e9; + m_set_lin = -9e9; + m_se_lin = -9e9; + + m_xs = -9e9; + + m_phi = -9e9; + + m_tool_time_00 = 0; + m_tool_time_01 = 0; + m_tool_time_02 = 0; + m_tool_time_10 = 0; + m_tool_time_11 = 0; + m_tool_time_12 = 0; + m_tool_time_20 = 0; + m_tool_time_21 = 0; + m_tool_time_22 = 0; + m_tool_time_30 = 0; + m_tool_time_31 = 0; + m_tool_time_32 = 0; + // m_tool_time_TOT = 0; + m_tool_time_EM = 0; + m_tool_time_HEC = 0; + m_tool_time_Tile = 0; + m_tool_time_FCal = 0; + m_tool_time_RegSel = 0; + m_tool_time_LoadCol = 0; + m_tool_time_Loop = 0; + + m_jets = nullptr; + m_caloCluster = nullptr; + m_tracks=nullptr; + m_vertices=nullptr; + m_muons=nullptr; + + ATH_MSG_DEBUG( "Executing EFMissingET::hltExecute()" ); + + if(m_firsteventinrun) { + ATH_MSG_DEBUG( "REGTEST: First event in run" ); + if (m_StoreGate) { + const xAOD::EventInfo* pEvent(0); + StatusCode sc = m_StoreGate->retrieve(pEvent); + if ( sc.isFailure() ) { + ATH_MSG_ERROR( "Cannot find xAOD::EventInfo object" ); + } else { + m_current_run_id = pEvent->runNumber(); + m_current_lbk_id = pEvent->lumiBlock(); + m_current_evt_id = pEvent->eventNumber(); + m_current_bcg_id = pEvent->bcid(); + char buff[512]; + snprintf(buff,512, + "REGTEST: Run number = %11u, luminosity block = %11u, event number = %11u, bunch crossing = %11u", + m_current_run_id, m_current_lbk_id, m_current_evt_id, m_current_bcg_id); + ATH_MSG_DEBUG( buff ); + + m_LArEMbarrelAside=true; + m_LArEMbarrelCside=true; + m_LArEMendCapAside=true; + m_LArEMendCapCside=true; + m_LArHECendCapAside=true; + m_LArHECendCapCside=true; + m_LArFCalAside=true; + m_LArFCalCside=true; + m_TileBarrelAside=true; + m_TileBarrelCside=true; + m_TileExtBarAside=true; + m_TileExtBarCside=true; + + if (m_decodeDetMask) { + uint64_t mask64 = pEvent->detectorMask(); + if(msgLvl(MSG::DEBUG) ) { + char buff[512]; + snprintf(buff,512,"REGTEST: DetMask_1 = 0x%08lu",mask64); + ATH_MSG_DEBUG( buff ); + } + + if (!(mask64==0)) { // 0 means present + + eformat::helper::DetectorMask dm(mask64); + m_LArEMbarrelAside = dm.is_set(eformat::LAR_EM_BARREL_A_SIDE); + m_LArEMbarrelCside = dm.is_set(eformat::LAR_EM_BARREL_C_SIDE); + m_LArEMendCapAside = dm.is_set(eformat::LAR_EM_ENDCAP_A_SIDE); + m_LArEMendCapCside = dm.is_set(eformat::LAR_EM_ENDCAP_C_SIDE); + m_LArHECendCapAside = dm.is_set(eformat::LAR_HAD_ENDCAP_A_SIDE); + m_LArHECendCapCside = dm.is_set(eformat::LAR_HAD_ENDCAP_C_SIDE); + m_LArFCalAside = dm.is_set(eformat::LAR_FCAL_A_SIDE); + m_LArFCalCside = dm.is_set(eformat::LAR_FCAL_C_SIDE); + m_TileBarrelAside = dm.is_set(eformat::TILECAL_BARREL_A_SIDE); + m_TileBarrelCside = dm.is_set(eformat::TILECAL_BARREL_C_SIDE); + m_TileExtBarAside = dm.is_set(eformat::TILECAL_EXT_A_SIDE); + m_TileExtBarCside = dm.is_set(eformat::TILECAL_EXT_C_SIDE); + + if (msgLvl(MSG::WARNING) ) { + if(!m_LArEMbarrelAside) ATH_MSG_WARNING( "LAR_EM_BARREL_A_SIDE is absent!" ); + if(!m_LArEMbarrelCside) ATH_MSG_WARNING( "LAR_EM_BARREL_C_SIDE is absent!" ); + if(!m_LArEMendCapAside) ATH_MSG_WARNING( "LAR_EM_ENDCAP_A_SIDE is absent!" ); + if(!m_LArEMendCapCside) ATH_MSG_WARNING( "LAR_EM_ENDCAP_C_SIDE is absent!" ); + if(!m_LArHECendCapAside) ATH_MSG_WARNING( "LAR_HAD_ENDCAP_A_SIDE is absent!" ); + if(!m_LArHECendCapCside) ATH_MSG_WARNING( "LAR_HAD_ENDCAP_C_SIDE is absent!" ); + if(!m_LArFCalAside) ATH_MSG_WARNING( "LAR_FCAL_A_SIDE is absent!" ); + if(!m_LArFCalCside) ATH_MSG_WARNING( "LAR_FCAL_C_SIDE is absent!" ); + if(!m_TileBarrelAside) ATH_MSG_WARNING( "TILECAL_BARREL_A_SIDE is absent!" ); + if(!m_TileBarrelCside) ATH_MSG_WARNING( "TILECAL_BARREL_C_SIDE is absent!" ); + if(!m_TileExtBarAside) ATH_MSG_WARNING( "TILECAL_EXT_A_SIDE is absent!" ); + if(!m_TileExtBarCside) ATH_MSG_WARNING( "TILECAL_EXT_C_SIDE is absent!" ); + } + + } // end of setting flags for non-zero mask + } // end of decoding detector mask + } + } + m_firsteventinrun=false; + } // done processing for first event in the run + + // do the real job + HLT::ErrorCode status = makeMissingET(tes_in); + + if(status != HLT::OK) { + delete m_met; + m_met = nullptr; + ATH_MSG_ERROR( "EFMissingET::makeOutputTE returned Failure" ); + return HLT::ERROR; + } - // create output trigger element - status = makeOutputTE(tes_in, type_out); + // create output trigger element + status = makeOutputTE(tes_in, type_out); - if (doTiming() && m_doTimers && m_totTime) { - m_totTime->stop(); - } + if (doTiming() && m_doTimers && m_totTime) { + m_totTime->stop(); + } - // stop monitoring - afterExecMonitors().ignore(); + // stop monitoring + afterExecMonitors().ignore(); - return HLT::OK; + return HLT::OK; } /////////////////////////////////////////// @@ -516,367 +531,507 @@ HLT::ErrorCode EFMissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme HLT::ErrorCode EFMissingET::makeMissingET(std::vector<std::vector<HLT::TriggerElement*> >& tes_in) { - if(m_doTopoClusters == false && m_doJets == false && m_doJets == false) - m_n_sizePers = 25; - else if(m_doJets == true) - m_n_sizePers = 6; - else if(m_doPUC == true) - m_n_sizePers = 3; - else - m_n_sizePers = 9; - - - // Setup xAOD EDM - m_met = new xAOD::TrigMissingET(); m_met->makePrivateStore(); - - std::vector <std::string> vs_aux; - for(int i = 0; i < m_n_sizePers; i++) - vs_aux.push_back(""); - - m_met->defineComponents(vs_aux); - - ATH_MSG_DEBUG (" Created pers. object of size " << m_n_sizePers); - - // fetch topo. clusters for later use - if (m_doTopoClusters && tes_in.size() > 0) { // safe-guard - for (const auto& te_in : tes_in.at(0) ) { - HLT::ErrorCode status = getFeature( te_in , m_caloCluster ); - - if(status!=HLT::OK || !m_caloCluster) { - // Changed to prevent abortions of combined chains during cosmic data taking - // This should not be in during collisions - //ATH_MSG_ERROR( "Failed to get ClusterContainer" ); return HLT::NAV_ERROR; - ATH_MSG_ERROR( "Failed to get ClusterContainer" ); return HLT::OK; - } else { - ATH_MSG_DEBUG( "size of cluster container " << m_caloCluster->size() ); - } - - } // end loop over topoclusters - } // fetched all topo. clusters - - // fetch jets for later use - if (m_doJets && tes_in.size() > 0) { // safe-guard - for (const auto& te_in : tes_in.at(0) ) { - HLT::ErrorCode status = getFeature( te_in , m_jets ); - - if(status!=HLT::OK || !m_jets) { - ATH_MSG_ERROR( "Failed to get Jets" ); return HLT::NAV_ERROR; - } else { - if (msgLvl(MSG::DEBUG) ) { - ATH_MSG_DEBUG( "size of jet container " << m_jets->size() ); - for (const auto& ijet : *m_jets) - ATH_MSG_DEBUG( " Jet E, eta, phi: " << ijet->e()<<", "<< ijet->eta()<<", "<< ijet->phi() ); - } - } - - } // end loop over topoclusters - } // fetched all topo. clusters + if(m_doTopoClusters == false && m_doJets == false) + m_n_sizePers = 25; + else if(m_doTopoClusters == true && m_doJets == true && m_doTracks==true) + m_n_sizePers = 3; + else if(m_doJets == true) + m_n_sizePers = 6; + else if(m_doPUC == true) + m_n_sizePers = 3; + else + m_n_sizePers = 9; - //fetch tracks for later use - if (m_doJets && m_doTracks && tes_in.size() > 0) { // safe-guard - for (const auto& te_in : tes_in.at(1) ) { - HLT::ErrorCode status = getFeature( te_in , m_tracks ); + if(m_doTrackTopoClusters) m_n_sizePers = 9; - if(status!=HLT::OK || !m_tracks) { - ATH_MSG_ERROR( "Failed to get tracks" ); return HLT::NAV_ERROR; - } else { - if (msgLvl(MSG::DEBUG) ) { - ATH_MSG_DEBUG( "size of track container " << m_tracks->size() ); - for (const auto& itrack : *m_tracks) - ATH_MSG_DEBUG( " Track pt, eta, phi, z0, vz: " << itrack->pt()<<", "<< itrack->eta()<<", "<< itrack->phi() << ", " - << fabs(itrack->z0()) << ", " << itrack->vz() ); - } - } + // Setup xAOD EDM + m_met = new xAOD::TrigMissingET(); + m_met->makePrivateStore(); - } // end loop over topoclusters - } // fetched all topo. clusters + std::vector <std::string> vs_aux; + for(int i = 0; i < m_n_sizePers; i++) + vs_aux.push_back(""); + m_met->defineComponents(vs_aux); + ATH_MSG_DEBUG (" Created pers. object of size " << m_n_sizePers); + ConstDataVector<xAOD::TrackParticleContainer> v_ttracks (SG::VIEW_ELEMENTS);//Define a track container for Pufit track + // fetch topo. clusters for later use + if (m_doTopoClusters && tes_in.size() > 0) { // safe-guard + for (const auto& te_in : tes_in.at(0) ) { + HLT::ErrorCode status = getFeature( te_in , m_caloCluster ); - //fetch vertex for later use - if (m_doJets && m_doTracks && tes_in.size() > 0) { // safe-guard - for (const auto& te_in : tes_in.at(1) ) { - HLT::ErrorCode status = getFeature( te_in , m_vertices ); - - if(status!=HLT::OK || !m_vertices) { - ATH_MSG_ERROR( "Failed to get vertices" ); return HLT::NAV_ERROR; - } else { - if (msgLvl(MSG::DEBUG) ) { - ATH_MSG_DEBUG( "size of vertex container " << m_vertices->size() ); - for (const xAOD::Vertex* ivtx : *m_vertices) - ATH_MSG_DEBUG( " Vertex x, y, z, ntracks: " << ivtx->x()<<", "<< ivtx->y()<<", "<< ivtx->z() << ", " - << ivtx->nTrackParticles() ); + if(status!=HLT::OK || !m_caloCluster) { + // Changed to prevent abortions of combined chains during cosmic data taking + // This should not be in during collisions + //ATH_MSG_ERROR( "Failed to get ClusterContainer" ); return HLT::NAV_ERROR; + ATH_MSG_ERROR( "Failed to get ClusterContainer" ); + return HLT::OK; + } else { + ATH_MSG_DEBUG( "size of cluster container " << m_caloCluster->size() ); } - } - - } // end loop over topoclusters - } // fetched all topo. clusters + } // end loop over topoclusters + + if (m_doJetVeto && tes_in.size() > 0) { + for (const auto& te_in : tes_in.at(1) ) { + HLT::ErrorCode status = getFeature( te_in , m_jets ); + + if(status!=HLT::OK || !m_jets) { + ATH_MSG_ERROR( "Failed to get Jets" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_INFO( "size of jet container " << m_jets->size() ); + for (const auto& ijet : *m_jets) + ATH_MSG_INFO( " Jet E, eta, phi: " << ijet->e()<<", "<< ijet->eta()<<", "<< ijet->phi() ); + } + } + } + } + + if (m_doJets && m_doTracks && tes_in.size() > 0) { + for (const auto& te_in : tes_in.at(1) ) { + HLT::ErrorCode status = getFeature( te_in , m_jets ); + + if(status!=HLT::OK || !m_jets) { + ATH_MSG_ERROR( "Failed to get Jets" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of jet container " << m_jets->size() ); + for (const auto& ijet : *m_jets) + ATH_MSG_DEBUG( " Jet E, eta, phi: " << ijet->e()<<", "<< ijet->eta()<<", "<< ijet->phi() ); + } + } + } + if(tes_in.size()>3) { + //This section is for 4 tes, like in the case of pufit track + const xAOD::TrackParticleContainer* tempTracks; + for (const auto& te_in : tes_in.at(2) ) { + HLT::ErrorCode status_trk = getFeature( te_in , tempTracks); + + if(status_trk!=HLT::OK || !tempTracks) { + ATH_MSG_ERROR( "Failed to get tracks" ); + return HLT::NAV_ERROR; + } else { + // v_ttracks.push_back(tempTracks); + ATH_MSG_DEBUG( "size of track container " << tempTracks->size() ); + for (const auto& itrack : *tempTracks) { + v_ttracks.push_back(itrack); + ATH_MSG_DEBUG( " Track pt, eta, phi, vertex, z0, vz: " << itrack->pt()<<", "<< itrack->eta()<<", "<< itrack->phi() << ", " + << fabs(itrack->z0()) << ", " << itrack->vz() ); + } + }//correctly retrived the tracks + }//retrieve te2 + m_tracks = v_ttracks.asDataVector(); + std::vector<const xAOD::TrackParticle*> TracksVec(m_tracks->begin(), m_tracks->end()); + ATH_MSG_DEBUG( "num of tracks in datavector: " << TracksVec.size() ); + for (const xAOD::TrackParticle* trk : TracksVec) { + ATH_MSG_DEBUG("tracks " << trk->pt() << "," << trk->eta() << ","<<trk->phi() ); + } + + ATH_MSG_DEBUG( "size of track container" << m_tracks->size()); + for (const auto& te_in : tes_in.at(3) ) { + HLT::ErrorCode status_vtx = getFeature( te_in , m_vertices ); + if(status_vtx!=HLT::OK || !m_vertices) { + ATH_MSG_ERROR( "Failed to get vertices" ); + return HLT::NAV_ERROR; + } + }//retrieve te3 + }//more than 3 tes (0-3) + else { + //this section is for track mht + for (const auto& te_in : tes_in.at(2) ) { + HLT::ErrorCode status_trk = getFeature( te_in , m_tracks ); + + if(status_trk!=HLT::OK || !m_tracks) { + ATH_MSG_ERROR( "Failed to get tracks" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of track container " << m_tracks->size() ); + } + } + //The vertex container is part of the same TE as the tracks + HLT::ErrorCode status_vtx = getFeature( te_in , m_vertices ); + + if(status_vtx!=HLT::OK || !m_vertices) { + ATH_MSG_ERROR( "Failed to get vertices" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of vertex container " << m_vertices->size() ); + } + } + }//retrieve te2, this gets tracks and vertex container for track mht + }//only 3 tes, for track mht + }//do jets and tracks + } else { // fetched all topo. clusters + + + // fetched all topo. clusters + if (m_doTrackTopoClusters && tes_in.size() > 0) { // safe-guard + for (const auto& te_in : tes_in.at(0) ) { + HLT::ErrorCode status = getFeature( te_in , m_caloCluster ); + + if(status!=HLT::OK || !m_caloCluster) { + // Changed to prevent abortions of combined chains during cosmic data taking + // This should not be in during collisions + //ATH_MSG_ERROR( "Failed to get ClusterContainer" ); return HLT::NAV_ERROR; + ATH_MSG_ERROR( "Failed to get ClusterContainer" ); + return HLT::OK; + } else { + ATH_MSG_DEBUG( "size of cluster container " << m_caloCluster->size() ); + } + + } // end loop over topoclusters + } + + // fetch jets for later use + if (m_doJets && tes_in.size() > 0) { // safe-guard + for (const auto& te_in : tes_in.at(0) ) { + HLT::ErrorCode status = getFeature( te_in , m_jets ); + + if(status!=HLT::OK || !m_jets) { + ATH_MSG_ERROR( "Failed to get Jets" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of jet container " << m_jets->size() ); + for (const auto& ijet : *m_jets) + ATH_MSG_DEBUG( " Jet E, eta, phi: " << ijet->e()<<", "<< ijet->eta()<<", "<< ijet->phi() ); + } + } + + } // end loop over jets + } // fetched all jets + + + //fetch tracks for later use + if ((m_doJets||m_doTrackTopoClusters) && m_doTracks && tes_in.size() > 0) { // safe-guard + for (const auto& te_in : tes_in.at(1) ) { + HLT::ErrorCode status = getFeature( te_in , m_tracks ); + + if(status!=HLT::OK || !m_tracks) { + ATH_MSG_ERROR( "Failed to get tracks" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of track container " << m_tracks->size() ); + } + } + + } // end loop over tracks + } // fetched all tracks + + + + //fetch vertex for later use + if ((m_doJets||m_doTrackTopoClusters) && m_doTracks && tes_in.size() > 0) { // safe-guard + for (const auto& te_in : tes_in.at(1) ) { + HLT::ErrorCode status = getFeature( te_in , m_vertices ); + + if(status!=HLT::OK || !m_vertices) { + ATH_MSG_ERROR( "Failed to get vertices" ); + return HLT::NAV_ERROR; + } else { + if (msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG( "size of vertex container " << m_vertices->size() ); + } + } + + } // end loop over vertex + } // fetched all vertex + + + //fetch muons for later use + if ((m_doJets||m_doTrackTopoClusters) && m_doTracks && tes_in.size() > 2) { // safe-guard + for (HLT::TEVec::const_iterator it = tes_in[2].begin(); it != tes_in[2].end(); ++it) { + HLT::ErrorCode status = getFeature( (*it) , m_muons ); + + if(status==HLT::OK && m_muons!=nullptr) { + if (msgLvl() <= MSG::DEBUG) { + ATH_MSG_DEBUG( "size of muon container " << m_muons->size() ); + for (xAOD::MuonContainer::const_iterator it = m_muons->begin(); it != m_muons->end(); ++it ) + ATH_MSG_DEBUG( " Muon pt, eta, phi: " << (*it)->pt()/1000.<<", "<< (*it)->eta()<<", "<< (*it)->phi() ); + } + } + + } // end loop muons + } // fetched all muons + } - if(m_doTopoClusters && !m_caloCluster) { // check if one should process topo. clusters and if pointer is present - ATH_MSG_INFO( " Error: configured to run over topo. clusters but no TriggerElement was passed to the FEX -- check menu configuration!! " ); - return HLT::ERROR; - } - - if(m_doJets && !m_jets) { // check if one should process jets and if pointer is present - ATH_MSG_INFO( " Error: configured to run over jets but no TriggerElement was passed to the FEX -- check menu configuration!! " ); - return HLT::ERROR; - } - - if(m_doTracks && (!m_tracks || !m_vertices)) { // check if one should process jets and if pointer is present - ATH_MSG_INFO( " Error: configured to run over tracks and jets but no TriggerElement was passed to the FEX -- check menu configuration!! " ); - return HLT::ERROR; - } + if(m_doTopoClusters && !m_caloCluster) { // check if one should process topo. clusters and if pointer is present + ATH_MSG_INFO( " Error: configured to run over topo. clusters but no TriggerElement was passed to the FEX -- check menu configuration!! " ); + return HLT::ERROR; + } - if (doTiming() && m_doTimers && m_algTime) { - m_algTime->start(); - } + if(m_doJets && !m_jets) { // check if one should process jets and if pointer is present + ATH_MSG_INFO( " Error: configured to run over jets but no TriggerElement was passed to the FEX -- check menu configuration!! " ); + return HLT::ERROR; + } - /// clear transient-only helper object - m_met_help->Reset(); + if(m_doTracks && (!m_tracks || !m_vertices)) { // check if one should process jets and if pointer is present + ATH_MSG_INFO( " Error: configured to run over tracks and jets but no TriggerElement was passed to the FEX -- check menu configuration!! " ); + return HLT::ERROR; + } - // // encode DetMask info in the status flag - // int flag=m_met_help->GetStatus(); + if(m_doTrackTopoClusters && ( !m_caloCluster || !m_tracks || !m_vertices)) { // check if one should process jets and if pointer is present + ATH_MSG_INFO( " Error: configured to run over tracks and TopoClusters but no TriggerElement was passed to the FEX -- check menu configuration!! " ); + return HLT::ERROR; + } - // if (!m_LArEMbarrelAside) flag |= m_maskEMB_A_Missing; - // if (!m_LArEMbarrelCside) flag |= m_maskEMB_C_Missing; - // if (!m_LArEMendCapAside) flag |= m_maskEME_A_Missing; - // if (!m_LArEMendCapCside) flag |= m_maskEME_C_Missing; - // if (!m_LArHECendCapAside) flag |= m_maskHEC_A_Missing; - // if (!m_LArHECendCapCside) flag |= m_maskHEC_C_Missing; - // if (!m_LArFCalAside) flag |= m_maskFCAL_A_Missing; - // if (!m_LArFCalCside) flag |= m_maskFCAL_C_Missing; - // if (!m_TileBarrelAside) flag |= m_maskTileB_A_Missing; - // if (!m_TileBarrelCside) flag |= m_maskTileB_C_Missing; - // if (!m_TileExtBarAside) flag |= m_maskTileE_A_Missing; - // if (!m_TileExtBarCside) flag |= m_maskTileE_C_Missing; + if (doTiming() && m_doTimers && m_algTime) { + m_algTime->start(); + } - // m_met_help->SetStatus(flag); + /// clear transient-only helper object + m_met_help->Reset(); - //unsigned short m_tmp_maskProcessing = 0x0001; // bit 0 - //unsigned short m_tmp_maskProcessed = 0x4000; // bit 14 + // // encode DetMask info in the status flag + // int flag=m_met_help->GetStatus(); - /// loop over tools - for (auto& tool : m_tools) { + // if (!m_LArEMbarrelAside) flag |= m_maskEMB_A_Missing; + // if (!m_LArEMbarrelCside) flag |= m_maskEMB_C_Missing; + // if (!m_LArEMendCapAside) flag |= m_maskEME_A_Missing; + // if (!m_LArEMendCapCside) flag |= m_maskEME_C_Missing; + // if (!m_LArHECendCapAside) flag |= m_maskHEC_A_Missing; + // if (!m_LArHECendCapCside) flag |= m_maskHEC_C_Missing; + // if (!m_LArFCalAside) flag |= m_maskFCAL_A_Missing; + // if (!m_LArFCalCside) flag |= m_maskFCAL_C_Missing; + // if (!m_TileBarrelAside) flag |= m_maskTileB_A_Missing; + // if (!m_TileBarrelCside) flag |= m_maskTileB_C_Missing; + // if (!m_TileExtBarAside) flag |= m_maskTileE_A_Missing; + // if (!m_TileExtBarCside) flag |= m_maskTileE_C_Missing; - if ( tool->execute(m_met, m_met_help, m_caloCluster,m_jets, m_tracks, m_vertices).isFailure() ) { - ATH_MSG_ERROR( "EFMissingET AlgTool returned Failure" ); - return HLT::ERROR; - } + // m_met_help->SetStatus(flag); + //unsigned short m_tmp_maskProcessing = 0x0001; // bit 0 + //unsigned short m_tmp_maskProcessed = 0x4000; // bit 14 - if (doTiming() && m_doTimers) { - float timer[4][3]={{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; + /// loop over tools + for (auto& tool : m_tools) { - for (int iDet=0; iDet<4; ++iDet){ // loop on detector - for (int iStep=0; iStep<3; ++iStep) { // loop on step - if ( tool->getTime(iDet, iStep, &timer[iDet][iStep]).isFailure() ) { - ATH_MSG_ERROR( "EFMissingET AlgTool timer returned Failure" ); + if ( tool->execute(m_met, m_met_help, m_caloCluster,m_jets, m_tracks, m_vertices, m_muons).isFailure() ) { + ATH_MSG_ERROR( "EFMissingET AlgTool returned Failure" ); return HLT::ERROR; - } - } // loop on step - } // loop on detector - - m_tool_time_00 += timer[0][0]; - m_tool_time_01 += timer[0][1]; - m_tool_time_02 += timer[0][2]; - m_tool_time_10 += timer[1][0]; - m_tool_time_11 += timer[1][1]; - m_tool_time_12 += timer[1][2]; - m_tool_time_20 += timer[2][0]; - m_tool_time_21 += timer[2][1]; - m_tool_time_22 += timer[2][2]; - m_tool_time_30 += timer[3][0]; - m_tool_time_31 += timer[3][1]; - m_tool_time_32 += timer[3][2]; - - m_tool_time_EM += timer[0][0] + timer[0][1] + timer[0][2]; - m_tool_time_HEC += timer[1][0] + timer[1][1] + timer[1][2]; - m_tool_time_Tile += timer[2][0] + timer[2][1] + timer[2][2]; - m_tool_time_FCal += timer[3][0] + timer[3][1] + timer[3][2]; - m_tool_time_RegSel += timer[0][0] + timer[1][0] + timer[2][0] + timer[3][0]; - m_tool_time_LoadCol += timer[0][1] + timer[1][1] + timer[2][1] + timer[3][1]; - m_tool_time_Loop += timer[0][2] + timer[1][2] + timer[2][2] + timer[3][2]; - - } // timers - } // loop on tools - - // m_tool_time_TOT=m_tool_time_RegSel+m_tool_time_LoadCol+m_tool_time_Loop; - - if (doTiming() && m_doTimers && m_algTime) { - m_algTime->stop(); - } - - float ETx = m_met->ex(); - float ETy = m_met->ey(); - float MET = sqrt(ETx*ETx+ETy*ETy); - float SET = m_met->sumEt(); - - if(msgLvl(MSG::DEBUG) ) { - if (m_StoreGate) { - const xAOD::EventInfo* pEvent(0); - StatusCode sc = m_StoreGate->retrieve(pEvent); - if ( sc.isFailure() ) { - ATH_MSG_ERROR( "Cannot find xAOD::EventInfo object" ); - } else { - m_current_run_id = pEvent->runNumber(); - m_current_lbk_id = pEvent->lumiBlock(); - m_current_evt_id = pEvent->eventNumber(); - m_current_bcg_id = pEvent->bcid(); - char buff[512]; - snprintf(buff,512, - "REGTEST: Run number = %11u, luminosity block = %11u, event number = %11u, bunch crossing = %11u", - m_current_run_id, m_current_lbk_id, m_current_evt_id, m_current_bcg_id); - ATH_MSG_DEBUG( buff ); - } + } + + + if (doTiming() && m_doTimers) { + float timer[4][3]= {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; + + for (int iDet=0; iDet<4; ++iDet) { // loop on detector + for (int iStep=0; iStep<3; ++iStep) { // loop on step + if ( tool->getTime(iDet, iStep, &timer[iDet][iStep]).isFailure() ) { + ATH_MSG_ERROR( "EFMissingET AlgTool timer returned Failure" ); + return HLT::ERROR; + } + } // loop on step + } // loop on detector + + m_tool_time_00 += timer[0][0]; + m_tool_time_01 += timer[0][1]; + m_tool_time_02 += timer[0][2]; + m_tool_time_10 += timer[1][0]; + m_tool_time_11 += timer[1][1]; + m_tool_time_12 += timer[1][2]; + m_tool_time_20 += timer[2][0]; + m_tool_time_21 += timer[2][1]; + m_tool_time_22 += timer[2][2]; + m_tool_time_30 += timer[3][0]; + m_tool_time_31 += timer[3][1]; + m_tool_time_32 += timer[3][2]; + + m_tool_time_EM += timer[0][0] + timer[0][1] + timer[0][2]; + m_tool_time_HEC += timer[1][0] + timer[1][1] + timer[1][2]; + m_tool_time_Tile += timer[2][0] + timer[2][1] + timer[2][2]; + m_tool_time_FCal += timer[3][0] + timer[3][1] + timer[3][2]; + m_tool_time_RegSel += timer[0][0] + timer[1][0] + timer[2][0] + timer[3][0]; + m_tool_time_LoadCol += timer[0][1] + timer[1][1] + timer[2][1] + timer[3][1]; + m_tool_time_Loop += timer[0][2] + timer[1][2] + timer[2][2] + timer[3][2]; + + } // timers + } // loop on tools + + // m_tool_time_TOT=m_tool_time_RegSel+m_tool_time_LoadCol+m_tool_time_Loop; + + if (doTiming() && m_doTimers && m_algTime) { + m_algTime->stop(); } - ATH_MSG_DEBUG( "Transient object follows " ); - ATH_MSG_DEBUG( "REGTEST: (EF) Lvl1Id = " << config()->getLvl1Id() ); - ATH_MSG_DEBUG( *m_met_help ); // transient object - } - - // monitored values (in GeV or rad) - m_phi = atan2f(ETy, ETx); - m_mex_lin = ETx * 1e-3; - m_mey_lin = ETy * 1e-3; - m_mez_lin = m_met->ez() * 1e-3; - m_met_lin = MET * 1e-3; - m_me_lin = sqrt(m_mex_lin*m_mex_lin+m_mey_lin*m_mey_lin+m_mez_lin*m_mez_lin); - m_set_lin = SET * 1e-3; // NB: might be negative - m_se_lin = m_met->sumE() * 1e-3; // NB: might be negative - - float epsilon = 1e-6; // 1 keV - if (m_set_lin > epsilon) m_xs = m_met_lin / sqrt(m_set_lin); - - // never compare a float with zero: - epsilon = 1e-6; // 1 keV - if (m_me_lin>epsilon) m_me_log = log10(fabsf(m_me_lin)); // underflow otherwise - - epsilon=1.189; // GeV (see TrigEFMissingETMonitoring.py) - if (fabsf(m_mex_lin)>epsilon) - m_mex_log = copysign(log10f(fabsf(m_mex_lin)), m_mex_lin); - else - m_mex_log = 0; - if (fabsf(m_mey_lin)>epsilon) - m_mey_log = copysign(log10f(fabsf(m_mey_lin)), m_mey_lin); - else - m_mey_log = 0; - if (fabsf(m_mez_lin)>epsilon) - m_mez_log = copysign(log10f(fabsf(m_mez_lin)), m_mez_lin); - else - m_mez_log = 0; - if (fabsf(m_set_lin)>epsilon) - m_set_log = copysign(log10f(fabsf(m_set_lin)), m_set_lin); - else - m_set_log = 0; - if (fabsf(m_se_lin)>epsilon) - m_se_log = copysign(log10f(fabsf(m_se_lin)), m_se_lin); - else - m_se_log = 0; - if (fabsf(m_met_lin)>epsilon) // positive definite - m_met_log = log10f(fabsf(m_met_lin)); - else - m_met_log = -9e9; // underflow - - // monitoring: status flag - for (int i=0; i<32; ++i) { - unsigned mask = (1<<i); - if (m_met->flag() & mask) - m_status_flag[i] = 1; - else - m_status_flag[i] = 0; - } - - for (unsigned char i=0; i<m_met_help->GetElements(); ++i) { - TrigEFMissingEtComponent* metComp=m_met_help->GetComponent(i); - float ex = metComp->m_ex * 1e-3; // GeV - float ey = metComp->m_ey * 1e-3; // GeV - float ez = metComp->m_ez * 1e-3; // GeV - float et = sqrt(ex*ex+ey*ey); - float sumEt = metComp->m_sumEt * 1e-3; // GeV - float sumE = metComp->m_sumE * 1e-3; // GeV - - if (fabsf(ex)>epsilon) - m_comp_ex_log[i] = copysign(log10f(fabsf(ex)), ex); + + float ETx = m_met->ex(); + float ETy = m_met->ey(); + float MET = sqrt(ETx*ETx+ETy*ETy); + float SET = m_met->sumEt(); + + if(msgLvl(MSG::DEBUG) ) { + if (m_StoreGate) { + const xAOD::EventInfo* pEvent(0); + StatusCode sc = m_StoreGate->retrieve(pEvent); + if ( sc.isFailure() ) { + ATH_MSG_ERROR( "Cannot find xAOD::EventInfo object" ); + } else { + m_current_run_id = pEvent->runNumber(); + m_current_lbk_id = pEvent->lumiBlock(); + m_current_evt_id = pEvent->eventNumber(); + m_current_bcg_id = pEvent->bcid(); + char buff[512]; + snprintf(buff,512, + "REGTEST: Run number = %11u, luminosity block = %11u, event number = %11u, bunch crossing = %11u", + m_current_run_id, m_current_lbk_id, m_current_evt_id, m_current_bcg_id); + ATH_MSG_DEBUG( buff ); + } + } + ATH_MSG_DEBUG( "Transient object follows " ); + ATH_MSG_DEBUG( "REGTEST: (EF) Lvl1Id = " << config()->getLvl1Id() ); + ATH_MSG_DEBUG( *m_met_help ); // transient object + } + + // monitored values (in GeV or rad) + m_phi = atan2f(ETy, ETx); + m_mex_lin = ETx * 1e-3; + m_mey_lin = ETy * 1e-3; + m_mez_lin = m_met->ez() * 1e-3; + m_met_lin = MET * 1e-3; + m_me_lin = sqrt(m_mex_lin*m_mex_lin+m_mey_lin*m_mey_lin+m_mez_lin*m_mez_lin); + m_set_lin = SET * 1e-3; // NB: might be negative + m_se_lin = m_met->sumE() * 1e-3; // NB: might be negative + + float epsilon = 1e-6; // 1 keV + if (m_set_lin > epsilon) m_xs = m_met_lin / sqrt(m_set_lin); + + // never compare a float with zero: + epsilon = 1e-6; // 1 keV + if (m_me_lin>epsilon) m_me_log = log10(fabsf(m_me_lin)); // underflow otherwise + + epsilon=1.189; // GeV (see TrigEFMissingETMonitoring.py) + if (fabsf(m_mex_lin)>epsilon) + m_mex_log = copysign(log10f(fabsf(m_mex_lin)), m_mex_lin); else - m_comp_ex_log[i] = 0; - if (fabsf(ey)>epsilon) - m_comp_ey_log[i] = copysign(log10f(fabsf(ey)), ey); + m_mex_log = 0; + if (fabsf(m_mey_lin)>epsilon) + m_mey_log = copysign(log10f(fabsf(m_mey_lin)), m_mey_lin); else - m_comp_ey_log[i] = 0; - if (fabsf(ez)>epsilon) - m_comp_ez_log[i] = copysign(log10f(fabsf(ez)), ez); + m_mey_log = 0; + if (fabsf(m_mez_lin)>epsilon) + m_mez_log = copysign(log10f(fabsf(m_mez_lin)), m_mez_lin); else - m_comp_ez_log[i] = 0; - m_comp_et_lin[i] = et; - if (et>1e-6) // i.e. et > 0 - m_comp_et_log[i] = log10f(et); + m_mez_log = 0; + if (fabsf(m_set_lin)>epsilon) + m_set_log = copysign(log10f(fabsf(m_set_lin)), m_set_lin); else - m_comp_et_log[i] = -9e9; // underflow - m_comp_sum_et_lin[i] = sumEt; - if (fabsf(sumEt)>epsilon) - m_comp_sum_et_log[i] = copysign(log10f(fabsf(sumEt)), sumEt); + m_set_log = 0; + if (fabsf(m_se_lin)>epsilon) + m_se_log = copysign(log10f(fabsf(m_se_lin)), m_se_lin); else - m_comp_sum_et_log[i] = 0; - if (fabsf(sumE)>epsilon) - m_comp_sum_e_log[i] = copysign(log10f(fabsf(sumE)), sumE); + m_se_log = 0; + if (fabsf(m_met_lin)>epsilon) // positive definite + m_met_log = log10f(fabsf(m_met_lin)); else - m_comp_sum_e_log[i] = 0; - } + m_met_log = -9e9; // underflow + + // monitoring: status flag + for (int i=0; i<32; ++i) { + unsigned mask = (1<<i); + if (m_met->flag() & mask) + m_status_flag[i] = 1; + else + m_status_flag[i] = 0; + } - return HLT::OK; + for (unsigned char i=0; i<m_met_help->GetElements(); ++i) { + TrigEFMissingEtComponent* metComp=m_met_help->GetComponent(i); + float ex = metComp->m_ex * 1e-3; // GeV + float ey = metComp->m_ey * 1e-3; // GeV + float ez = metComp->m_ez * 1e-3; // GeV + float et = sqrt(ex*ex+ey*ey); + float sumEt = metComp->m_sumEt * 1e-3; // GeV + float sumE = metComp->m_sumE * 1e-3; // GeV + + if (fabsf(ex)>epsilon) + m_comp_ex_log[i] = copysign(log10f(fabsf(ex)), ex); + else + m_comp_ex_log[i] = 0; + if (fabsf(ey)>epsilon) + m_comp_ey_log[i] = copysign(log10f(fabsf(ey)), ey); + else + m_comp_ey_log[i] = 0; + if (fabsf(ez)>epsilon) + m_comp_ez_log[i] = copysign(log10f(fabsf(ez)), ez); + else + m_comp_ez_log[i] = 0; + m_comp_et_lin[i] = et; + if (et>1e-6) // i.e. et > 0 + m_comp_et_log[i] = log10f(et); + else + m_comp_et_log[i] = -9e9; // underflow + m_comp_sum_et_lin[i] = sumEt; + if (fabsf(sumEt)>epsilon) + m_comp_sum_et_log[i] = copysign(log10f(fabsf(sumEt)), sumEt); + else + m_comp_sum_et_log[i] = 0; + if (fabsf(sumE)>epsilon) + m_comp_sum_e_log[i] = copysign(log10f(fabsf(sumE)), sumE); + else + m_comp_sum_e_log[i] = 0; + } + + return HLT::OK; } ////////////////////////////////////////////////////////// HLT::ErrorCode EFMissingET::makeOutputTE(std::vector<std::vector<HLT::TriggerElement*> >& tes_in, - unsigned int type_out) { + unsigned int type_out) +{ - // Only count MET as an input TE (for seeding relation of navigation structure) - HLT::TEVec allTEs; - if ( (tes_in.size()>0) && (tes_in[0].size()>0) ) allTEs.push_back( tes_in[0][0] ); + // Only count MET as an input TE (for seeding relation of navigation structure) + HLT::TEVec allTEs; + if ( (tes_in.size()>0) && (tes_in[0].size()>0) ) allTEs.push_back( tes_in[0][0] ); - // create output TE: - // Create an output TE seeded by the inputs - HLT::TriggerElement* outputTE = config()->getNavigation()->addNode(allTEs, type_out); - HLT::ErrorCode status = attachFeature(outputTE, m_met, m_metOutputKey); + // create output TE: + // Create an output TE seeded by the inputs + HLT::TriggerElement* outputTE = config()->getNavigation()->addNode(allTEs, type_out); + HLT::ErrorCode status = attachFeature(outputTE, m_met, m_metOutputKey); - if (status != HLT::OK){ - ATH_MSG_ERROR( "Write into outputTE failed" ); - return status; - } + if (status != HLT::OK) { + ATH_MSG_ERROR( "Write into outputTE failed" ); + return status; + } - /* + /* - // Create a new RoiDescriptor with updated eta and phi. - // Note that the steering will propagate l1Id and roiId automatically - // so no need to set them. - TrigRoiDescriptor* newRoiDescriptor=new TrigRoiDescriptor(m_roiDescriptor->l1Id(), - m_roiDescriptor->roiId(), - m_roiDescriptor->eta0(), - m_roiDescriptor->phi0()); + // Create a new RoiDescriptor with updated eta and phi. + // Note that the steering will propagate l1Id and roiId automatically + // so no need to set them. + TrigRoiDescriptor* newRoiDescriptor=new TrigRoiDescriptor(m_roiDescriptor->l1Id(), + m_roiDescriptor->roiId(), + m_roiDescriptor->eta0(), + m_roiDescriptor->phi0()); - if(msgLvl() <= MSG::DEBUG) { - msg() << MSG::DEBUG << "Recorded an RoiDescriptor " << - " phi " << newRoiDescriptor->phi0() << - " eta " << newRoiDescriptor->eta0() << endmsg; - } + if(msgLvl() <= MSG::DEBUG) { + msg() << MSG::DEBUG << "Recorded an RoiDescriptor " << + " phi " << newRoiDescriptor->phi0() << + " eta " << newRoiDescriptor->eta0() << endmsg; + } - status = attachFeature(outputTE, newRoiDescriptor,"TrigEFMissingET"); + status = attachFeature(outputTE, newRoiDescriptor,"TrigEFMissingET"); -*/ + */ - // Some debug output: - ATH_MSG_DEBUG( "We assume success, set TE with label active to signal positive result." ); + // Some debug output: + ATH_MSG_DEBUG( "We assume success, set TE with label active to signal positive result." ); - // CACHING - // if we got here, everything was okay. so, we cache the feature for further execution of this instance in e.g. other MET Sequences: - m_useCachedResult = true; - m_cachedTE = outputTE; + // CACHING + // if we got here, everything was okay. so, we cache the feature for further execution of this instance in e.g. other MET Sequences: + m_useCachedResult = true; + m_cachedTE = outputTE; - return HLT::OK; + return HLT::OK; } diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETBaseTool.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETBaseTool.cxx index 708c9784983874dd14334c7a596c2d6cf090cc94..5a8c41954f229849353dbc9df26d9c48452c2fb4 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETBaseTool.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETBaseTool.cxx @@ -116,7 +116,8 @@ StatusCode EFMissingETBaseTool::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper * /* metHelper */ , const xAOD::CaloClusterContainer * /* caloCluster */ , const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFlags.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFlags.cxx index ba5cc7e773e3ac92ef822e352970d98282c94d29..4f6693baaff6d5d508a6254d24c3afc695754201 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFlags.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFlags.cxx @@ -203,7 +203,8 @@ StatusCode EFMissingETFlags::execute(xAOD::TrigMissingET *met , TrigEFMissingEtHelper *metHelper , const xAOD::CaloClusterContainer * /* caloCluster */ , const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "EFMissingETFlags::execute() called" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCells.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCells.cxx index 1ebb7398bc68607aa6398f9abd4ea171fdb72041..ba05fc9ddca236fc5c130baa97ca70fc72345765 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCells.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCells.cxx @@ -136,7 +136,8 @@ StatusCode EFMissingETFromCells::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper *metHelper , const xAOD::CaloClusterContainer * /* caloCluster */ , const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "this is EFMissingETFromCells::execute()" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClusters.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClusters.cxx index 56e8bf72637095f590a5379d14a24082100f9ba4..bc1862584e6075aac1a541fad5cbaaf98cc7e8b6 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClusters.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClusters.cxx @@ -89,7 +89,8 @@ StatusCode EFMissingETFromClusters::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper *metHelper , const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "called EFMissingETFromClusters::execute()" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPS.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPS.cxx index 2f7a5a24cd1484b73d9b2e00c8daa717603fba4a..61b12365dd004c847e0235f00c9a38bc5a438851 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPS.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPS.cxx @@ -100,7 +100,8 @@ StatusCode EFMissingETFromClustersPS::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper *metHelper , const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "called EFMissingETFromClustersPS::execute()" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPUC.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPUC.cxx index c9f24bcff551ec92ec316261f1d2e7abcd1e05e2..abb3957bb4af5f1d62c5ed193291435518314827 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPUC.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersPUC.cxx @@ -44,6 +44,10 @@ EFMissingETFromClustersPUC::EFMissingETFromClustersPUC(const std::string& type, declareProperty("nSigma", m_nsigma = 5.0 ,"tower ET significance"); declareProperty("varRhoScale", m_varrhoscale = 1.0 ,"adjustment factor for weighting rho errors in fit"); declareProperty("trimFactor", m_trimfactor = 0.90 ,"Fraction of towers used in calculating trimmed mean"); + + declareProperty("doLArH11off", m_doLArH11off = false, "LAr H11 crate is off" ); + declareProperty("doLArH12off", m_doLArH12off = false, "LAr H12 crate is off" ); + declareProperty("Jetptcut", m_Jetptcut = 999., "remove event when Jet pt > m_Jetptcut in the region of LAr H11 or/both H12"); // declare configurables @@ -105,8 +109,9 @@ StatusCode EFMissingETFromClustersPUC::finalize() StatusCode EFMissingETFromClustersPUC::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper *metHelper , - const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * /* jets */, - const xAOD::TrackParticleContainer * /*trackContainer*/, const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * jets, + const xAOD::TrackParticleContainer * /*trackContainer*/, const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "called EFMissingETFromClustersPUC::execute()" ); @@ -114,6 +119,20 @@ StatusCode EFMissingETFromClustersPUC::execute(xAOD::TrigMissingET * /* met */ , if(m_timersvc) m_glob_timer->start(); // total time + + + std::vector<const xAOD::Jet*> JetsVec(jets->begin(), jets->end()); + ATH_MSG_DEBUG( "num of jets: " << JetsVec.size() ); + + bool foundJetVeto(false); + if(m_Jetptcut>0){ + for (const xAOD::Jet* jet : JetsVec) { + if(m_doLArH11off && jet->eta()>-1.5 && jet->eta()<0 && jet->phi() > -2.0 && jet->phi() < -1.5 && jet->pt() > m_Jetptcut*1000. ) foundJetVeto = true; + if(m_doLArH12off && jet->eta()>-1.5 && jet->eta()<0 && jet->phi() > -2.5 && jet->phi() < -2.0 && jet->pt() > m_Jetptcut*1000. ) foundJetVeto = true; + } + } + + /// fetching the topo. cluster component TrigEFMissingEtComponent* metComp = nullptr; metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Cluster component @@ -221,6 +240,8 @@ StatusCode EFMissingETFromClustersPUC::execute(xAOD::TrigMissingET * /* met */ , VarEtTower += term; } VarEtTower *= 1.0/m_ntowers; + // Set a minimum value to avoid FPEs + if (VarEtTower < 1.0e6) VarEtTower = 1.0e6; ptmin_final = EtTowerTrimMean + m_nsigma*sqrt(VarEtTower); // find binning that gives largest sumEt from bins above threshold @@ -261,7 +282,7 @@ StatusCode EFMissingETFromClustersPUC::execute(xAOD::TrigMissingET * /* met */ , } int nummasks = ExInMask.size(); - if(nummasks > 0) { + if(nummasks > 0 && !foundJetVeto) { // Form sumEtobs and covEtobs from all towers double sumEtobs = 0, varsumEtobs = 0; TMatrixD Etobs(2,1), covEtobs(2,2); @@ -386,12 +407,14 @@ StatusCode EFMissingETFromClustersPUC::execute(xAOD::TrigMissingET * /* met */ , // -------------------------------------------------------------------------------------- + // move from "processing" to "processed" state metComp->m_status ^= m_maskProcessing; // switch off bit metComp->m_status |= m_maskProcessed; // switch on bit } // end container loop. + if(m_timersvc) m_glob_timer->stop(); // total time diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersTracksPUC.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersTracksPUC.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8503a1cfb7d0593f314c8cafbbeb7478f43dfd80 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromClustersTracksPUC.cxx @@ -0,0 +1,425 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/******************************************************************** + +NAME: EFMissingETFromClustersTracksPUC.cxx +PACKAGE: Trigger/TrigAlgorithms/TrigEFMissingET + +AUTHORS: Rui Zou, Ben Carlson, Jonathan Burr +CREATED: Feb 01, 2018 + +PURPOSE: Pile-up fit + tracks + +********************************************************************/ + +#include "TrigEFMissingET/EFMissingETFromClustersTracksPUC.h" +#include "TrigTimeAlgs/TrigTimerSvc.h" + +#include <TMatrixD.h> +#include <string> + +using namespace std; +namespace { + // Helper class + struct Tower{ + xAOD::CaloCluster::State m_clusterstate; + float sumEt{0.}; + float px{0.}; + float py{0.}; + float pt() { return sqrt(px*px+py*py); } + float cosPhi() { return pt() > 0 ? px/pt() : 1.; } + float sinPhi() { return pt() > 0 ? py/pt() : 0.; } + Tower& operator=(bool m_saveuncalibrated) { + if(m_saveuncalibrated) m_clusterstate = xAOD::CaloCluster::UNCALIBRATED; + else m_clusterstate = xAOD::CaloCluster::CALIBRATED; + return *this; + } + Tower& operator+=(const xAOD::CaloCluster& clus) { + float sinPhi; + float cosPhi; + sincosf(clus.phi(m_clusterstate), &sinPhi, &cosPhi); + float Et = clus.pt(m_clusterstate); + sumEt += Et; + px += Et * cosPhi; + py += Et * sinPhi; + return *this; + } + }; +} + + +EFMissingETFromClustersTracksPUC::EFMissingETFromClustersTracksPUC(const std::string& type, + const std::string& name, + const IInterface* parent) : + EFMissingETBaseTool(type, name, parent), + m_trackselTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this ) +{ + // declare the algorithm configurables here + // declareProperty("PropertyName", m_property=default_value, "Property Description"); + // (*Do* add a property description...) + declareProperty("SaveUncalibrated", m_saveuncalibrated = false ,"save uncalibrated topo. clusters"); + declareProperty("TargetTowerWidth", m_targetTowerWidth = 0.7, "The target width of the towers"); + declareProperty("MaxEta", m_maxEta = 5., "The maximum eta"); + declareProperty("ForwardpTCut", m_forward_ptcut = 50.0e3 ,"pT Cut for forward jets"); + declareProperty("TrackpTCut", m_track_ptcut = 0.0 ,"pT Cut for online tracks"); + declareProperty("dRCut", m_dRCut = 0.4, "dR Cut for track - jet association"); + declareProperty("MinJetPtJvt", m_minJetPtJvt = 20.e3, "The minimum pT (in MeV) for jets to consider for JVT"); + declareProperty("MaxJetPtJvt", m_maxJetPtJvt = 60.e3, "The maximum pT (in MeV) for jets to consider for JVT (above this jets automatically pass"); + declareProperty("JetRpTCut", m_jetRpTCut = 0.1, "The JVT RpT cut to apply to jets");//0.1, "The JVT RpT cut to apply to jets"); + declareProperty("CaloResSqrtTerm", m_caloResSqrtTerm = 15.81, "The coefficient of the sqrt term in the calorimeter resolution (in MeV)"); + declareProperty("CaloResFloor", m_caloResFloor = 50, "Floor for calorimeter resolution (in MeV)"); + declareProperty("ConstraintWeight", m_constraintWeight = 1., "The relative weighting applied to the constraints"); + + // declare configurables + + m_fextype = FexType::TOPO; + m_methelperposition = 3; + + // Determine number of phi & eta bins, and number of towers + m_nPhiBins = TMath::TwoPi() / m_targetTowerWidth; + m_nEtaBins = 2 * m_maxEta / m_targetTowerWidth; + m_nTowers = m_nPhiBins * m_nEtaBins; + + m_towerEtaWidth = 2 * m_maxEta / m_nEtaBins; + m_towerPhiWidth = TMath::TwoPi() / m_nPhiBins; + + m_clusterstate = xAOD::CaloCluster::UNCALIBRATED; +} + + +EFMissingETFromClustersTracksPUC::~EFMissingETFromClustersTracksPUC() +{ +} + + +StatusCode EFMissingETFromClustersTracksPUC::initialize() +{ + ATH_MSG_DEBUG( "called EFMissingETFromClustersTracksPUC::initialize()" ); + + // Standard initialize step + + // Set up the timer service. + if( service( "TrigTimerSvc", m_timersvc).isFailure() ) + ATH_MSG_WARNING( name() << ": Unable to locate TrigTimer Service" ); + + if (m_timersvc) { + // global time + std::string basename=name()+".TotalTime"; + m_glob_timer = m_timersvc->addItem(basename); + } // if timing service + + if(m_saveuncalibrated) m_clusterstate = xAOD::CaloCluster::UNCALIBRATED; + else m_clusterstate = xAOD::CaloCluster::CALIBRATED; + + return StatusCode::SUCCESS; +} + + +StatusCode EFMissingETFromClustersTracksPUC::execute() +{ + return StatusCode::SUCCESS; +} + +StatusCode EFMissingETFromClustersTracksPUC::finalize() +{ + ATH_MSG_DEBUG( "called EFMissingETFromClustersTracksPUC::finalize()" ); + + return StatusCode::SUCCESS; + +} + +StatusCode EFMissingETFromClustersTracksPUC::execute(xAOD::TrigMissingET * /* met */ , + TrigEFMissingEtHelper *metHelper , + const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * jetContainer, + const xAOD::TrackParticleContainer * trackContainer, const xAOD::VertexContainer * vertexContainer, + const xAOD::MuonContainer * /*muonContainer*/ ) +{ + // The function signature has to be compatible with all of the algorithms used in the package + // This is unfortunate and liable to change in the future (certainly for athenaMT) but until then just be aware that that's how it goes + // The main algorithm works out what types the various trigger elements are that have been given to it and then passes them onto these functions + + ATH_MSG_DEBUG( "called EFMissingETFromClustersTracksPUC::execute()" ); + + if(m_timersvc)m_glob_timer->start(); // total time + + // The met Helper is used to create the various components of the output trigger MET + // Again, this is an old design and could be updated but probably won't be until athenaMT + // You need to write the met into a position in the helper (and a later tool then compiles this into a met value) + /// fetching the topo. cluster component + TrigEFMissingEtComponent* metComp = nullptr; + metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Cluster component + if (metComp==0) { + ATH_MSG_ERROR( "cannot fetch Topo. cluster component!" ); + return StatusCode::FAILURE; + } + if(string(metComp->m_name).substr(0,2)!="TC"){ + ATH_MSG_ERROR( "fetched " << metComp->m_name << " instead of the Clusters component!" ); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG( "fetched metHelper component \"" << metComp->m_name << "\"" ); + + if ( (metComp->m_status & m_maskProcessed)==0 ){ // not yet processed + metComp->Reset(); // reset component... + } + else { // skip if processed + if(m_timersvc) m_glob_timer->stop(); // total time + return StatusCode::SUCCESS; + } + + // The mask statuses are involved in making sure that you don't try and run the same calculation multiple times + // To be honest I *thought* this was handled by the steering so it probably is something we should check... + // set status to Processing + metComp->m_status |= m_maskProcessing; + + std::vector<const xAOD::Jet*> JetsVec(jetContainer->begin(), jetContainer->end()); + ATH_MSG_DEBUG( "num of jets: " << JetsVec.size() ); + + std::vector<const xAOD::TrackParticle*> TracksVec(trackContainer->begin(), trackContainer->end()); + ATH_MSG_DEBUG( "num of tracks: " << TracksVec.size() ); + + std::vector<const xAOD::Vertex*> VertexVec(vertexContainer->begin(), vertexContainer->end()); + ATH_MSG_DEBUG( "num of vertices: " << VertexVec.size() ); + + std::vector<const xAOD::CaloCluster*> clusters(caloCluster->begin(), caloCluster->end()); + + std::vector<const xAOD::Jet*> hardScatterJets(0); + std::vector<const xAOD::Jet*> pileupJets(0); + + const xAOD::Vertex* primaryVertex = nullptr; + for (const xAOD::Vertex* vertex : VertexVec) { + + ATH_MSG_DEBUG( "\tx: " << vertex->x() << "\ty: " << vertex->y() << "\tz: " << vertex->z() + << "\tntracks: " << vertex->nTrackParticles() + << "\ttype: " << vertex->vertexType() + << "\txAOD::VxType::PriVtx: " << xAOD::VxType::PriVtx ); + + // ntracks is not working now in rel21 + // if ( vertex->nTrackParticles() < 2 ) continue; + if ( vertex->vertexType() == xAOD::VxType::PriVtx ) { + primaryVertex = vertex; + break; + } + } + + std::vector<double> ptsum_pvsVec(JetsVec.size(), 0.0); + for (const xAOD::TrackParticle* itrk : TracksVec) { + bool accept = (itrk->pt()> m_track_ptcut && m_trackselTool->accept(*itrk, primaryVertex)); + if (!accept) continue; + int whichjet = 0; + double minkT = -1; + for (uint i=0; i < JetsVec.size(); i++) { + const xAOD::Jet* jet = JetsVec.at(i); + if (primaryVertex) { + if (fabs(jet->eta() ) < 2.4) { + double dphi = fabs(jet->phi()-itrk->phi()); + if (dphi > M_PI) dphi = 2*M_PI - dphi; + double dR = sqrt((jet->rapidity()-itrk->rapidity())*(jet->rapidity()-itrk->rapidity()) + dphi * dphi); + if (dR > m_dRCut) continue; + double kT = dR/jet->pt(); + if (kT < minkT || minkT < 0) { + minkT = kT; + whichjet = i; + } + } + } + if (minkT >= 0) ptsum_pvsVec.at(whichjet) += itrk->pt(); + + } + } + + for (uint i=0; i < JetsVec.size(); i++) { + const xAOD::Jet* jet = JetsVec.at(i); + if (primaryVertex) { + if (fabs(jet->eta() ) < 2.4) { + double RpT = ptsum_pvsVec.at(i)/jet->pt(); + if (jet->pt() > m_minJetPtJvt && (RpT > m_jetRpTCut || jet->pt() > m_maxJetPtJvt)){ + hardScatterJets.push_back(jet); + } else { + pileupJets.push_back(jet); + } + } else if (jet->pt() >= m_forward_ptcut) { + hardScatterJets.push_back(jet); + } else { + pileupJets.push_back(jet); + } + } else { + pileupJets.push_back(jet); + } + } + + if (hardScatterJets.size() == 0) return StatusCode::SUCCESS; + + std::vector<const xAOD::CaloCluster*> pileupClusters(0); + std::vector<const xAOD::CaloCluster*> hardScatterClusters(0); + std::set<unsigned int> hardScatterIndices; // The indices of clusters associated with pileup jets + + // Assume all of our jets have the same radius - the rest of the algorithm basically + // relies on this anyway. + float jetRadiusParameter = hardScatterJets.front()->getSizeParameter(); + + for (const xAOD::Jet* ijet : hardScatterJets) + for (const auto& link : ijet->constituentLinks() ) + hardScatterIndices.insert(link.index() ); + for (unsigned int ii = 0; ii < clusters.size(); ++ii) { + if (fabs(clusters.at(ii)->eta(m_clusterstate) ) > m_maxEta) + continue; + if (hardScatterIndices.count(ii) ){ + hardScatterClusters.push_back(clusters.at(ii) ); + } else { + pileupClusters.push_back(clusters.at(ii) ); + } + } + + // Calculate covariance of pileup deposits, collect into towers and calculate pileup 2-vector + float sigma_xx = 0.; + float sigma_yy = 0.; + float sigma_xy = 0.; + std::vector<Tower> pileupTowers(m_nTowers); + TVector2 ptPileup; + for (const xAOD::CaloCluster* iclus : pileupClusters) { + float sigma2 = m_caloResFloor*m_caloResFloor + m_caloResSqrtTerm*m_caloResSqrtTerm*iclus->pt(m_clusterstate); + float sinPhi; + float cosPhi; + sincosf(iclus->phi(m_clusterstate), &sinPhi, &cosPhi); + sigma_xx += sigma2 * cosPhi*cosPhi; + sigma_yy += sigma2 * sinPhi*sinPhi; + sigma_xy += sigma2 * cosPhi*sinPhi; + unsigned int etaBin = (iclus->eta(m_clusterstate) + m_maxEta)/(2*m_maxEta) * m_nEtaBins; + unsigned int phiBin = fmod(iclus->phi(m_clusterstate)/TMath::TwoPi() + 1, 1) * m_nPhiBins; + pileupTowers.at(etaBin*m_nPhiBins + phiBin) = m_clusterstate; + pileupTowers.at(etaBin*m_nPhiBins + phiBin) += *iclus; + ptPileup += TVector2(cosPhi, sinPhi) * iclus->pt(m_clusterstate); + } + float sigma_det = sigma_yy*sigma_xx - sigma_xy*sigma_xy; + double cosPhiPileup = ptPileup.Px()/ptPileup.Mod(); + double sinPhiPileup = ptPileup.Py()/ptPileup.Mod(); + + float sumEtPileup = 0.; + float sumEt2Pileup = 0.; + unsigned int nNonOverlappingPileupTowers = 0; + // Now calculate the variance of the towers that don't overlap with jets + for (unsigned int ii = 0; ii < pileupTowers.size(); ++ii) { + Tower& tower = pileupTowers.at(ii); + // Calculate the (eta, phi) centre of the tower from its index + unsigned int phiBin = ii % m_nPhiBins; + float phi = (phiBin + 0.5) * m_towerPhiWidth; + unsigned int etaBin = ii/m_nPhiBins; + float eta = -m_maxEta + (etaBin + 0.5) * m_towerEtaWidth; + bool overlaps = false; + for (const xAOD::Jet* ijet : hardScatterJets) { + // Taking absolutes exploits the symmetry of the overlap problem + // We consider the case of overlapping with the right side, the top or the top right corner + float dPhi = fabs(phi - ijet->phi() ); + float dEta = fabs(eta - ijet->eta() ); + if ( (dPhi < m_towerPhiWidth/2. && dEta < (jetRadiusParameter + m_towerEtaWidth/2.) ) + || (dEta < m_towerEtaWidth/2. && dPhi < (jetRadiusParameter + m_towerPhiWidth/2.) ) + || (dEta - m_towerEtaWidth/2.)*(dEta - m_towerEtaWidth/2.) + (dPhi-m_towerPhiWidth/2.)*(dPhi-m_towerPhiWidth/2.) < jetRadiusParameter*jetRadiusParameter) { + overlaps = true; + break; + } + } + // Remove overlapping towers from the variance calculation + if (overlaps) + continue; + sumEtPileup += tower.sumEt; + sumEt2Pileup += tower.sumEt*tower.sumEt; + ++nNonOverlappingPileupTowers; + } + float avgPileupEt = sumEtPileup/nNonOverlappingPileupTowers; + float varPileupEt = sumEt2Pileup/nNonOverlappingPileupTowers - avgPileupEt*avgPileupEt; + + // Construct matrix to calculate corrections + TMatrixD Xij(hardScatterJets.size(), hardScatterJets.size() ); + TMatrixD Cj(hardScatterJets.size(), 1); + for (unsigned int ii = 0; ii < hardScatterJets.size(); ++ii) { + float sinPhi1; + float cosPhi1; + sincosf(hardScatterJets.at(ii)->phi(), &sinPhi1, &cosPhi1); + Cj[ii][0] = -m_constraintWeight * ptPileup.Mod() / sigma_det * ( + sigma_yy * cosPhi1 * cosPhiPileup + + sigma_xx * sinPhi1 * sinPhiPileup + - sigma_xy * (sinPhi1 * cosPhiPileup + cosPhi1 * sinPhiPileup) ) + + avgPileupEt / varPileupEt; + for (unsigned int jj = ii; jj < hardScatterJets.size(); ++jj) { + float sinPhi2; + float cosPhi2; + sincosf(hardScatterJets.at(jj)->phi(), &sinPhi2, &cosPhi2); + Xij[ii][jj] = m_constraintWeight / sigma_det * ( + sigma_yy * cosPhi1 * cosPhi2 + + sigma_xx * sinPhi1 * sinPhi2 + - sigma_xy * (cosPhi1 * sinPhi2 + sinPhi1 * cosPhi2) ); + if (ii == jj) + // Scale the variance of the jet by the ratio of its area to the tower area + Xij[ii][jj] += m_towerPhiWidth*m_towerEtaWidth / (varPileupEt * hardScatterJets.at(ii)->getAttribute<float>(xAOD::JetAttribute::AttributeID::ActiveArea) ); + else + Xij[jj][ii] = Xij[ii][jj]; + } + } + Xij.Invert(); + TMatrixD corrections(Xij * Cj); + + float ex = 0; + float ey = 0; + float ez = 0; + float sumEt = 0; + float sumE = 0; + for (const xAOD::CaloCluster* iclus : hardScatterClusters) { + float pt = iclus->pt(m_clusterstate); + float sinPhi; + float cosPhi; + float eta = iclus->eta(m_clusterstate); + sincosf(iclus->phi(m_clusterstate), &sinPhi, &cosPhi); + ex -= pt * cosPhi; + ey -= pt * sinPhi; + ez += pt * sinhf(eta); + sumEt += pt; + sumE += iclus->p4(m_clusterstate).E(); + } + // Apply corrections + for (unsigned int ii = 0; ii < hardScatterJets.size(); ++ii) { + float sinPhi; + float cosPhi; + sincosf(hardScatterJets.at(ii)->phi(), &sinPhi, &cosPhi); + ex += corrections[ii][0] * cosPhi; + ey += corrections[ii][0] * sinPhi; + sumEt -= corrections[ii][0]; + } + + // At the end make sure that you stored your calculated met values in the component + metComp->m_ex = ex; + metComp->m_ey = ey; + metComp->m_ez = ez; + metComp->m_sumEt = sumEt; + metComp->m_sumE = sumE; + metComp->m_usedChannels += 1; + + // You *can* store bits in other components (either spreading the met over several components or recording extra information that might be useful) + // However you need to be very sure that the helper is adding up the right bits + /**************************************************************************************** + metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition + 1 ); // fetch first auxiliary component to store uncorrected MET + + metComp->m_ex = -MExEta; + metComp->m_ey = -MEyEta; + metComp->m_ez = -MEzEta; + metComp->m_sumEt = sumEtEta; + metComp->m_sumE = sumEEta; + metComp->m_usedChannels += 1; + *****************************************************************************************/ + //} + + // -------------------------------------------------------------------------------------- + + // move from "processing" to "processed" state + metComp->m_status ^= m_maskProcessing; // switch off bit + metComp->m_status |= m_maskProcessed; // switch on bit + + // end container loop. + + if(m_timersvc) m_glob_timer->stop(); // total time + + return StatusCode::SUCCESS; + +} diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromFEBHeader.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromFEBHeader.cxx index a36934e4b625197ef775829eff473e427aaf5398..a966f478c61ba81b10b3cc9b7b3e1824a74e2288 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromFEBHeader.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromFEBHeader.cxx @@ -121,7 +121,8 @@ StatusCode EFMissingETFromFEBHeader::execute(xAOD::TrigMissingET * /* met */ , TrigEFMissingEtHelper * metHelper, const xAOD::CaloClusterContainer * /* caloCluster */, const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "EFMissingETFromFEBHeader::execute() has been called" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromHelper.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromHelper.cxx index 7c8fd7989e8b613a9bac2eaba8aca2ee0c7aabed..c7b01da03dc299dd02105b216df61babacecb83e 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromHelper.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromHelper.cxx @@ -78,14 +78,15 @@ StatusCode EFMissingETFromHelper::execute() StatusCode EFMissingETFromHelper::executeMT(xAOD::TrigMissingET *met, TrigEFMissingEtHelper *metHelper) { - return execute(met, metHelper, nullptr, nullptr, nullptr, nullptr); + return execute(met, metHelper, nullptr, nullptr, nullptr, nullptr, nullptr); } StatusCode EFMissingETFromHelper::execute(xAOD::TrigMissingET *met , TrigEFMissingEtHelper *metHelper , const xAOD::CaloClusterContainer * /* caloCluster */, const xAOD::JetContainer * /* jets */, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "EFMissingETFromHelper::execute() called" ); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromJets.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromJets.cxx index a297d99f1c86d5c1a9faf6e9e1130a243d371f57..e09c9a7166c661350457909224324816a8c6b515 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromJets.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromJets.cxx @@ -92,7 +92,8 @@ StatusCode EFMissingETFromJets::execute(xAOD::TrigMissingET *, const xAOD::CaloClusterContainer * /* caloCluster */, const xAOD::JetContainer *MHTJetContainer, const xAOD::TrackParticleContainer * /*trackContainer*/, - const xAOD::VertexContainer * /*vertexContainer*/ ) + const xAOD::VertexContainer * /*vertexContainer*/, + const xAOD::MuonContainer * /*muonContainer*/ ) { ATH_MSG_DEBUG( "called EFMissingETFromJets::execute()" ); // EFMissingET_Fex_Jets diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndClusters.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndClusters.cxx new file mode 100644 index 0000000000000000000000000000000000000000..91ba2e45b4258d91807738f006699081dd4f5565 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndClusters.cxx @@ -0,0 +1,816 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/******************************************************************** + +NAME: EFMissingETFromTrackAndClusters.h +PACKAGE: Trigger/TrigAlgorithms/TrigEFMissingET + +AUTHORS: Renjie Wang (renjie.wang@cern.ch) + Use tracks and vertices to remove pile-up clusters by Constituent-level pile-up mitigation techniques + (cluster vertex fraction, Voronoi Subtraction, SofterKiller ) + the track-based soft term is also added to MET + +CREATED: Aug 05, 2018 + + + ********************************************************************/ +#include "TrigEFMissingET/EFMissingETFromTrackAndClusters.h" + +#include "TrigTimeAlgs/TrigTimerSvc.h" +#include "CxxUtils/sincosf.h" + +#include "EventKernel/ISignalState.h" +#include "EventKernel/SignalStateHelper.h" +#include "FourMomUtils/xAODP4Helpers.h" + +#include <cmath> +#include <string> +using namespace std; + + +namespace SortHelper { +// +// For Sorting +// +struct pt_sort { + + inline bool operator() (const TLorentzVector& lhs, const TLorentzVector& rhs) { + return (lhs.Pt() > rhs.Pt()); + } + + inline bool operator() (const TLorentzVector* lhs, const TLorentzVector* rhs) { + return (lhs->Pt() > rhs->Pt()); + } + + inline bool operator() (const xAOD::IParticle& lhs, const xAOD::IParticle& rhs) { + return (lhs.pt() > rhs.pt()); + } + + inline bool operator() (const xAOD::IParticle* lhs, const xAOD::IParticle* rhs) { + return (lhs->pt() > rhs->pt()); + } +}; + + +template<typename T> +T sort_container_pt(T* inCont) +{ + T sortedCont(SG::VIEW_ELEMENTS); + for(auto el : *inCont) sortedCont.push_back( el ); + std::sort(sortedCont.begin(), sortedCont.end(), pt_sort()); + return sortedCont; +} + +template<typename T> +const T sort_container_pt(const T* inCont) +{ + ConstDataVector<T> sortedCont(SG::VIEW_ELEMENTS); + + for(auto el : *inCont) sortedCont.push_back( el ); + std::sort(sortedCont.begin(), sortedCont.end(), pt_sort()); + return *sortedCont.asDataVector(); +} + +struct PJcomp { + bool operator() (const std::pair<fastjet::PseudoJet, std::vector<float> >& lhsp, const std::pair<fastjet::PseudoJet, std::vector<float> >& rhsp) { + fastjet::PseudoJet lhs = lhsp.first; + fastjet::PseudoJet rhs = rhsp.first; + return lhs.pt()>rhs.pt(); + //The comparator must be a strict weak ordering. + } +}; + + +} // end SortHelper + + + +EFMissingETFromTrackAndClusters::EFMissingETFromTrackAndClusters(const std::string& type, + const std::string& name, + const IInterface* parent) : + EFMissingETBaseTool(type, name, parent) +{ + declareProperty("SaveUncalibrated", m_saveUncalibrated = false ,"save uncalibrated topo. clusters"); + // standalone module. + + // declare configurables + m_fextype = FexType::TOPO; + m_metHelperPosition = 18; + + // Properties are as follows: + m_lambdaCalDivide = 317; + m_isCaloSplit = false; //If false, SK is run the same on all clusters. If true, SK is run separately for clusters in the ECal and the HCal. + m_gridSpacing = 0.6; // The grid size that should be applied for the SK algorithm. Suggested values between 0.3 and 0.6 + m_eCalGrid = 0.5; //Only necessary if isCaloSplit == true. The SK grid spacing used for the ECal. + m_hCalGrid = 0.5; // Only necessary if isCaloSplit == true. The SK grid spacing used for the HCal. + m_rapmin = 0.0; //The minimum (absolute) rapidity over which to calculate SK + m_rapmax = 2.5; //The maximum (absolute) rapidity over which to calculate SK + m_rapminApplied = 0; //The minimum (absolute) rapidity over which to apply SK + m_rapmaxApplied = 10; //The maximum (absolute) rapidity over which to apply SK + + + m_deltaR = 0.01; + //initialization to make coverity happy: + m_clusterstate = xAOD::CaloCluster_v1::UNCALIBRATED; + +} + + +EFMissingETFromTrackAndClusters::~EFMissingETFromTrackAndClusters() +{ +} + + +StatusCode EFMissingETFromTrackAndClusters::initialize() +{ + + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndClusters::initialize()" ); + + /// timers + if( service( "TrigTimerSvc", m_timersvc).isFailure() ) + ATH_MSG_WARNING( name() << ": Unable to locate TrigTimer Service" ); + + if (m_timersvc) { + // global time + std::string basename=name()+".TotalTime"; + m_glob_timer = m_timersvc->addItem(basename); + } // if timing service + + if(m_saveUncalibrated) m_metHelperPosition = 13; + + + m_clusterstate = (m_saveUncalibrated) ? xAOD::CaloCluster_v1::UNCALIBRATED : xAOD::CaloCluster_v1::CALIBRATED; + + + + return StatusCode::SUCCESS; +} + + +StatusCode EFMissingETFromTrackAndClusters::execute() +{ + return StatusCode::SUCCESS; +} + +StatusCode EFMissingETFromTrackAndClusters::finalize() +{ + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndClusters::finalize()" ); + + return StatusCode::SUCCESS; + +} + +StatusCode EFMissingETFromTrackAndClusters::execute(xAOD::TrigMissingET * /* met */ , + TrigEFMissingEtHelper *metHelper , + const xAOD::CaloClusterContainer *caloCluster, const xAOD::JetContainer * /* jets */, + const xAOD::TrackParticleContainer * trackContainer, + const xAOD::VertexContainer * vertexContainer, + const xAOD::MuonContainer * muonContainer ) +{ + + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndClusters::execute()" ); + + if(m_timersvc) + m_glob_timer->start(); // total time + + /// fetching the topo. cluster component + TrigEFMissingEtComponent* metComp = nullptr; + metComp = metHelper->GetComponent(metHelper->GetElements() - m_metHelperPosition); // fetch Cluster component + if (metComp==0) { + ATH_MSG_ERROR( "cannot fetch Topo. cluster component!" ); + return StatusCode::FAILURE; + } + if(string(metComp->m_name).substr(0,2)!="TC") { + ATH_MSG_ERROR( "fetched " << metComp->m_name << " instead of the Clusters component!" ); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG( "fetched metHelper component \"" << metComp->m_name << "\"" ); + + + if ( (metComp->m_status & m_maskProcessed)==0 ) { // not yet processed + metComp->Reset(); // reset component... + } else { // skip if processed + if(m_timersvc) m_glob_timer->stop(); // total time + return StatusCode::SUCCESS; + } + + // set status to Processing + metComp->m_status |= m_maskProcessing; + + //###################################################################### + + + ATH_MSG_DEBUG( "num of tracks: " << trackContainer->size() ); + ATH_MSG_DEBUG( "num of topoclusters: " << caloCluster->size() ); + ATH_MSG_DEBUG( "num of vertices: " << vertexContainer->size() ); + + std::vector<const xAOD::Muon*> MuonVec; + if(muonContainer!=nullptr) { + for (auto muon : *muonContainer) { + MuonVec.push_back(muon); + } + } + ATH_MSG_DEBUG( "num of muons: " << MuonVec.size() ); + + + // HLT Muons + std::vector<const xAOD::TrackParticle*> vecOfMuonTrk; + for( const xAOD::Muon* muon : MuonVec ) { + const xAOD::Muon::MuonType muontype = muon->muonType(); + // combined or segment tagged muon + if(muontype == xAOD::Muon::MuonType::Combined || muontype == xAOD::Muon::MuonType::SegmentTagged ) { + const xAOD::TrackParticle* idtrk = muon->trackParticle( xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle ); + if(idtrk==0) continue; + if(fabs(muon->pt())<5000) continue; + + + bool find_duplicate(false); + for(std::vector<const xAOD::TrackParticle*>::size_type idx=0; idx<vecOfMuonTrk.size(); idx++) { + float deltaR_ = idtrk->p4().DeltaR(vecOfMuonTrk[idx]->p4()); + if(deltaR_< m_deltaR) { + find_duplicate = true; + break; + } + } //end of loop over stored muon tracks + + ATH_MSG_DEBUG( "Found muon track --> pt = " << idtrk->pt()/1000. + << " eta= " << idtrk->eta() + << " phi= " << idtrk->phi() + << " Found duplicate=" << find_duplicate + ); + if(find_duplicate) continue; + + vecOfMuonTrk.push_back(idtrk); // store for testing future muon tracks for double counting prevention + + } + } + + // vertex + const xAOD::Vertex* primaryVertexFTK = nullptr; + for (auto vertex: *vertexContainer) { + //count the number of vertices with at least 2 tracks + ATH_MSG_DEBUG ( " x: " << vertex->x() << "\ty: " << vertex->y() << "\tz: " << vertex->z() + << "\tntracks: " << vertex->nTrackParticles() + << "\ttype: " << vertex->vertexType() + << "\txAOD::VxType::PriVtx: " << xAOD::VxType::PriVtx + ); + //if( vertex->nTrackParticles() < 2 ) continue; + if( vertex->vertexType() == xAOD::VxType::PriVtx ) { + primaryVertexFTK = vertex; + break; + } + } + + + //having FTK vertex, and find the associated tracks + std::vector<const xAOD::TrackParticle*> TrackVec_FTK_PV; + TrackVec_FTK_PV.clear(); + + std::vector<const xAOD::TrackParticle*> goodTracksnoMuons;; + goodTracksnoMuons.clear(); + + if(primaryVertexFTK!=nullptr) { + + const std::vector< ElementLink< xAOD::TrackParticleContainer> > tpLinks = primaryVertexFTK->trackParticleLinks(); + ATH_MSG_DEBUG ( " tpLinks size: " << tpLinks.size()); + if(tpLinks.size() != 0) { + + for(const auto& tp_elem : tpLinks ) { + if (tp_elem != nullptr && tp_elem.isValid()) { + const xAOD::TrackParticle* itrk = *tp_elem; + + ATH_MSG_DEBUG ( "\titrk pt: " << itrk->pt()/1000. << "\teta: " << itrk->eta() << "\tphi: " << itrk->phi() + //<< "\tvertex: " << itrk->vertex() + << "\tz0: " << itrk->z0() + << "\tvz: " << itrk->vz() + << "\ttheta: " << itrk->theta() + //<< "\tdZ: " << fabs((itrk->z0()+itrk->vz()-primaryVertexFTK->z())*sin(itrk->theta())) + //<< "\tisfromPV: " << (itrk->vertex()==primaryVertexFTK) + ); + + TrackVec_FTK_PV.push_back(itrk); + + + //saving tracks for soft-term + float t_pt = itrk->pt() * 0.001 ; + float t_eta = itrk->eta(); + //float t_phi = itrk->phi(); + //float t_en = itrk->e() * 0.001; + if(t_pt<0.4 || fabs(t_eta)>2.5) continue; + + bool findMuonTrack(false); + for(std::vector<const xAOD::TrackParticle*>::size_type idx=0; idx<vecOfMuonTrk.size(); idx++) { + float deltaR_ = itrk->p4().DeltaR(vecOfMuonTrk[idx]->p4()); + if(deltaR_<m_deltaR) { + findMuonTrack=true; + break; + } + } + if(findMuonTrack) continue; + + goodTracksnoMuons.push_back(itrk); + + } + } + } + + } // having FTK vertex + + + + ///////////////////////////////////////// + // Voronoi Subtraction + //////////////////////////////////////// + + + + + //CaloClusterChangeSignalStateList stateHelperList; + std::vector<fastjet::PseudoJet> clusters; + clusters.reserve(caloCluster->size()); + for(auto clust: *caloCluster) { + //read in clusters as PseudoJets + //if(m_doLC) stateHelperList.add(clust,xAOD::CaloCluster::State(1)); //default is calibrated but we can make it explicit anyway + //else stateHelperList.add(clust,xAOD::CaloCluster::State(0)); + + fastjet::PseudoJet test; + test = fastjet::PseudoJet(clust->p4()); + if(clust->e() >= 0) { //definition of clusters (\label{clust_def}) + clusters.push_back(test); + if(m_debug) std::cout << clust->pt() << std::endl; + } + } + + const char* APP_NAME = "VoronoiWeightTool::process()"; + std::vector< std::pair< fastjet::PseudoJet, std::vector<float> > > ptvec; //vector of pairs of PJs and their corrected pTs + if(makeVoronoiClusters(clusters, ptvec) != StatusCode::SUCCESS) ATH_MSG_ERROR(APP_NAME << ": Error in makeVoronoiClusters"); + std::sort(ptvec.begin(), ptvec.end(), SortHelper::PJcomp()); + + if(m_doSpread && m_nSigma > 0) ATH_MSG_ERROR(APP_NAME << ": Can't combine spreading with nSigma yet"); + int alg; + if(m_doSpread && m_nSigma == 0) alg = 3; + if(!m_doSpread && m_nSigma == 0) alg = 1; + if(!m_doSpread && m_nSigma > 0) alg = 2; + + size_t i=0; + std::vector<const xAOD::CaloCluster*> SortedAlltopoClusters; + for(auto el : *caloCluster) SortedAlltopoClusters.push_back( el); + std::sort(SortedAlltopoClusters.begin(), SortedAlltopoClusters.end(), SortHelper::pt_sort()); + + + // need new colletion need to change the energy of cluster, + //and remove the zero-energy clusters + std::vector<xAOD::CaloCluster> VoronoiWeightedTopoClusters; + VoronoiWeightedTopoClusters.clear(); + + + for(auto clust : SortedAlltopoClusters) { + + xAOD::CaloCluster aclust = (*clust); + + float newE; + //There should be the same number of positive E Clusters in the container as clusters in the ptvec + bool endContainer = clust->e()<0; //consistent with definition of clusters on L.~\ref{clust_def} + bool endVec = i>=ptvec.size(); + if(endVec && endContainer) { + newE = 0; //remove negative energy clusters + } else if(endContainer || endVec) { + ATH_MSG_ERROR(APP_NAME << ": Clusters don't have same number of elements."); + return StatusCode::FAILURE; + } else { + //And the clusters should match + float Containerpt = clust->pt(); + float PJpt = ptvec[i].first.pt(); + if(m_debug) { + std::cout << "Container: " << Containerpt << std::endl; + std::cout << "Ptvec: " << PJpt << std::endl; + } + if (fabs(Containerpt-PJpt) > 0.1) { + if(m_debug) std::cout << fabs(Containerpt-PJpt) << std::endl; + ATH_MSG_ERROR(APP_NAME << ": Clusters don't match."); + return StatusCode::FAILURE; + } + newE = ptvec[i].second[alg]*cosh(clust->eta()); + } + + //float w = newE/clust->e(); + aclust.setE(newE); + if(newE>0) VoronoiWeightedTopoClusters.push_back(aclust); + + i++; + } + + + + ////////////////////////////////////// + //Soft Killer + ////////////////////////////////////// + + if(m_isCaloSplit == false) RunClusters(VoronoiWeightedTopoClusters); + else RunSplitClusters(VoronoiWeightedTopoClusters); + + std::vector<xAOD::CaloCluster> SKWeightedTopoClusters; + + for(xAOD::CaloCluster cl : VoronoiWeightedTopoClusters) { + int w = 1; + if(m_isCaloSplit == false) w = calculateWeight(cl); + else w = calculateSplitWeight(cl); + float clust_e = cl.e(); // Cluster energy + float newclust_e = clust_e * w; + //cout << "newclust_e: " << newclust_e << endl; + cl.setE( newclust_e ); + if(newclust_e>0) SKWeightedTopoClusters.push_back(cl); + } + + + /////////////////////////////////////// + // Cluster Vertex Fraction + /////////////////////////////////////// + std::vector<float> cvfs; + setCVF(SKWeightedTopoClusters,trackContainer,TrackVec_FTK_PV,cvfs); + + + + //###################################################################### + + size_t iclus=0; + std::vector<xAOD::CaloCluster> HStopocls; + for(auto clust: SKWeightedTopoClusters) { //Es are sorted by default order + + float phi = clust.phi(); + float cosPhi, sinPhi; + sincosf(phi, &sinPhi, &cosPhi); + float eta = clust.eta(); + + float Et = clust.pt(); + float Ex = Et*cosPhi; + float Ey = Et*sinPhi; + float Ez = Et*sinhf(eta); + float E = clust.p4().E(); + + bool isPU_topocl(false); + if(cvfs[iclus]>-1 && cvfs[iclus]<=0.1) { + if( Et < 3000 ) { + isPU_topocl = true; + } + } + + if(!isPU_topocl) { + metComp->m_ex -= Ex; + metComp->m_ey -= Ey; + metComp->m_ez -= Ez; + metComp->m_sumEt += Et; + metComp->m_sumE += E; + metComp->m_usedChannels += 1; + metComp->m_sumOfSigns += static_cast<short int>(floor(copysign(1.0,Et)+0.5)); + + HStopocls.push_back(clust); + } + + iclus++; + } + + //adding track-based soft-term + for( const xAOD::TrackParticle* track : goodTracksnoMuons ) { + + float trketa = track->eta(); + float trkphi = track->phi(); + float trkpt = track->pt(); + float trkcharge = track->charge(); + + float deltaphi = ExtrapolationEstimate(trkpt,trketa,trkcharge); + float newtrkphi = -999.0; + if(deltaphi>-998.0) newtrkphi = trkphi-deltaphi; + + if(trkpt<1000) continue; + + float dRmin(999); + for(auto clust: HStopocls) { + float dR = xAOD::P4Helpers::deltaR(clust,trketa, newtrkphi); + if(dR<dRmin) dRmin=dR; + } + + if(dRmin>0.1) { + metComp->m_ex -= track->p4().Px(); + metComp->m_ey -= track->p4().Py(); + metComp->m_ez -= track->p4().Pz(); + metComp->m_sumEt += track->pt(); + metComp->m_sumE += track->e(); + } + } + + + + + // move from "processing" to "processed" state + metComp->m_status ^= m_maskProcessing; // switch off bit + metComp->m_status |= m_maskProcessed; // switch on bit + + if(m_timersvc) + m_glob_timer->stop(); // total time + + return StatusCode::SUCCESS; +} + + +void EFMissingETFromTrackAndClusters::setCVF( + std::vector<xAOD::CaloCluster> clusters, + const xAOD::TrackParticleContainer* tracks, + std::vector<const xAOD::TrackParticle*> TrackVec_FTK_PV, + std::vector<float>& cvfs) +{ + //static SG::AuxElement::Decorator< float > newphi("newphi"); + for(auto clust: clusters) { //cvfs are in default order + //std::cout << "c: " << clust->pt() << ";" << clust->eta() << ";" << clust->phi() << std::endl; + float num = 0; + float den = 0; + + float cleta = clust.eta(); + + for(auto track: *tracks) { + + bool isTrackClusterMatched(true); + //isTrackClusterMatched = xAOD::P4Helpers::isInDeltaR(*clust,*track,0.1,false); + + float trketa = track->eta(); + float trkphi = track->phi(); + float trkpt = track->pt(); + float trkcharge = track->charge(); + + float deta = trketa-cleta; + isTrackClusterMatched &= (fabs(deta)<0.1); + + float deltaphi = ExtrapolationEstimate(trkpt,trketa,trkcharge); + float newtrkphi = -999.0; + if(deltaphi>-998.0) newtrkphi = trkphi-deltaphi; + + float dR = xAOD::P4Helpers::deltaR(clust,trketa,newtrkphi); + isTrackClusterMatched &= (dR<0.1); + + if(isTrackClusterMatched) { + float trkpt = track->pt(); + //std::cout << "t: " << track->pt() << ";" << track->eta() << ";" << track->phi() << std::endl; + + bool isfromPV(false); + for( const xAOD::TrackParticle* itrkPV : TrackVec_FTK_PV ) { + float deltaR_ = track->p4().DeltaR(itrkPV->p4()); + if(deltaR_ < m_deltaR) { + isfromPV=true; + break; + } + } + + if (isfromPV) { + //PV + num+=trkpt; + den+=trkpt; + } else { + //pileup + den+=trkpt; + } + } + } + float cvf; + if(den==0) cvf = -1; + else cvf = num/den; //Rpt + cvfs.push_back(cvf); + //if(cvf==0 and clust->pt()>2000) std::cout << clust->pt() << std::endl; + //std::cout << clust->pt() << ";" << cvf << std::endl; + } +} + + +float EFMissingETFromTrackAndClusters::ExtrapolationEstimate(float pt, float eta, float charge) +{ + const float params[3] = { -14.6027571, -44.7818374, 540.656643}; + float eptsindeltaphi = params[0]*pow(eta,4)+params[1]*pow(eta,2)+params[2]*pow(eta,0); + float sindeltaphi = eptsindeltaphi/(pt*charge); + if (fabs(sindeltaphi)>1.0) return -999.0; //never reaches the detector + float deltaphi = asin(sindeltaphi); + return deltaphi; +} + + + +StatusCode EFMissingETFromTrackAndClusters::makeVoronoiClusters(std::vector<fastjet::PseudoJet>& clusters,std::vector< std::pair< fastjet::PseudoJet,std::vector<float> > >& correctedptvec) const +{ + std::vector<fastjet::PseudoJet> & inputConst = clusters; + fastjet::Selector jselector = fastjet::SelectorAbsRapRange(0.0,2.1); + fastjet::JetAlgorithm algo = fastjet::kt_algorithm; + float jetR = 0.4; + fastjet::JetDefinition jetDef(algo, jetR,fastjet::E_scheme, fastjet::Best); + fastjet::AreaDefinition area_def(fastjet::voronoi_area, fastjet::VoronoiAreaSpec(0.9)); + + fastjet::ClusterSequenceArea clustSeq(inputConst, jetDef, area_def); + fastjet::JetMedianBackgroundEstimator bge(jselector,jetDef,area_def); + + bge.set_particles(inputConst); + std::vector<fastjet::PseudoJet> inclusiveJets = sorted_by_pt(clustSeq.inclusive_jets(0)); + + int nsigma = m_nSigma; + float rho = bge.rho(); + float sigma = bge.sigma(); + for(unsigned int iJet = 0 ; iJet < inclusiveJets.size() ; iJet++) { + fastjet::PseudoJet jet = inclusiveJets[iJet]; + std::vector<fastjet::PseudoJet> constituents = jet.constituents(); + for(auto cons : constituents) { + float pt = cons.pt(); + float area = cons.area(); + float subPt = pt-rho*area; + //std::cout << "Area: " << area << "; Rho: " << bge.rho() << "; pt: " << constituents[iCons].pt() << "; corrected: " << correctedPt << std::endl; + //std::cout << "Pt: " << cons.pt() << "; Eta: " << cons.eta() <<"; Phi: " << cons.phi() << std::endl; + //fastjet::PseudoJet constituentP; + /*if(correctedPt<0.) continue; + constituentP.reset_PtYPhiM(correctedPt, constituents[iCons].rap(), constituents[iCons].phi(), constituents[iCons].m()); + clusters_voronoi.push_back(constituentP);*/ + //correctedptmap[cons] = correctedPt; + float voro0pt = subPt * (subPt > 0); + float voro1pt = subPt * (subPt > sqrt(area)*sigma*(float)nsigma); + std::vector<float> algopts; + algopts.push_back(subPt); + algopts.push_back(voro0pt); + algopts.push_back(voro1pt); + algopts.push_back(0); + std::pair <fastjet::PseudoJet,std::vector<float> > pjcptpair (cons,algopts); + correctedptvec.push_back(pjcptpair); + } // end loop over cons + } // end loop over jets + //std::cout << "Size: " << correctedptmap.size() << std::endl; + + if(m_doSpread) spreadPt(correctedptvec); + + return StatusCode::SUCCESS; +} + + + +void EFMissingETFromTrackAndClusters::spreadPt(std::vector< std::pair< fastjet::PseudoJet,std::vector<float> > >& correctedptvec, float spreadr, float alpha) const +{ + //default alpha = 2 + //Set up neighbors within spreadr: + int clusters = correctedptvec.size(); + std::vector<float> spreadPT(clusters); + std::vector<bool> isPositive(clusters); + for(int iCl = 0; iCl < clusters; iCl++) { + spreadPT[iCl] = correctedptvec[iCl].second[0]; + isPositive[iCl] = spreadPT[iCl]>0; + } + + std::vector<std::vector<std::pair<int,float> > > cluster_drs; //for each cluster, list of nearby positive pT clusters and their distances + for(int iCl = 0; iCl < clusters; iCl++) { + fastjet::PseudoJet icluster = correctedptvec[iCl].first; + //float ieta = icluster.eta(); + //float iphi = icluster.phi(); + std::vector<std::pair<int,float> > this_cluster_drs; + for(int jCl = 0; jCl < clusters; jCl++) { + if(iCl == jCl) continue; + if(!isPositive[jCl]) continue; + fastjet::PseudoJet jcluster = correctedptvec[jCl].first; + //float jeta = jcluster.eta(); + //float jphi = jcluster.phi(); + float dphi = icluster.delta_phi_to(jcluster); + float deta = icluster.eta() - jcluster.eta(); //fastjet::pseudojet::delta_R(const PseudoJet& other) gives rap-phi distance + float dr2 = pow(dphi,2) + pow(deta,2); + if(dr2 > pow(spreadr,2)) continue; + std::pair<int,float> jdrpair (jCl,dr2); + this_cluster_drs.push_back(jdrpair); + } + cluster_drs.push_back(this_cluster_drs); + } + + + for(int i = 0; i < clusters; i++) { + if(!(spreadPT[i]<0)) continue; //only spread from negative pT clusters + //find closest positive PT cluster: + float sumdR2 = 0; + //iterate over nearby positive pT clusters + for(size_t j=0; j<cluster_drs[i].size(); j++) { + //cout << "j: " << j << " realid: " << realid << " Eta: " << points[realid][0]<< " Phi: " << points[realid][1] << " Pt:" << spreadPT[realid] << " Dist: " << dists[j] << endl; // dists[j] = dR^2 + float dr = cluster_drs[i][j].second; + if(dr>0) sumdR2 += 1./(pow(dr,alpha/2)); + } + //if at least one neighbor + if(sumdR2 > 0) { + float spreadPT_orig = spreadPT[i]; + //std::cout << "orig: " << spreadPT_orig << std::endl; + for(size_t j=0; j<cluster_drs[i].size(); j++) { + float dr = cluster_drs[i][j].second; + float realid = cluster_drs[i][j].first; + if(dr>0) { + float weight = (1./pow(dr,alpha/2))/sumdR2; + //std::cout << dr << "; " << weight << std::endl; + //std::cout << "Before spreading: " << weight << ";" << weight*spreadPT_orig << ";" << spreadPT[realid] << std::endl; + if(fabs(weight*spreadPT_orig)>spreadPT[realid]) { + spreadPT[i]+=spreadPT[realid]; + spreadPT[realid]=0; + } else { + spreadPT[realid]+=weight*spreadPT_orig; + spreadPT[i]-=weight*spreadPT_orig; + } + //std::cout << "After spreading: " << weight << ";" << weight*spreadPT_orig << ";" << spreadPT[realid] << std::endl; + } + } + //std::cout << "final: " << spreadPT[i] << std::endl; + } + //cout << i << ";" << cluster(i,key).Float("correctedPT") << ";" << spreadPT[i]<< endl; + } + + /*float totalcorrpt=0, totalspreadpt=0; + for(int i=0; i<clusters; i++){ totalcorrpt+=cluster(i,key).Float("correctedPT"); totalspreadpt+=spreadPT[i];} + cout << totalcorrpt << ";" << totalspreadpt << endl; //should be the same*/ + + for(int iCl = 0; iCl < clusters; iCl++) { + correctedptvec[iCl].second[3] = spreadPT[iCl] * (spreadPT[iCl] > 0); + } +} + + + +//########## +// Softer Killer +// Finds the pT cut for this event based on the SK results +// The clustSK collection contains all clusters that aren't cut, so clusters below +// its min pT are cut +double EFMissingETFromTrackAndClusters::findMinPt(std::vector<fastjet::PseudoJet> *clustSK) const +{ + double minPt = 999999999999; + + for(unsigned int i=0; i < clustSK->size(); i++) { + if( (*clustSK)[i].pt() < minPt) minPt = (*clustSK)[i].pt(); + } + + // There is a small rounding error which I account for this way + return (minPt - 1e-12); +} + +// Reweights clusters (when calo isn't split) +void EFMissingETFromTrackAndClusters::RunClusters(std::vector<xAOD::CaloCluster> clust) const +{ + vector<fastjet::PseudoJet> clustPJ; + + for(xAOD::CaloCluster cl : clust) { + if(cl.e() > 0) clustPJ.push_back( fastjet::PseudoJet( cl.p4() )); + } + + fastjet::Selector selector = fastjet::SelectorAbsRapRange(m_rapmin, m_rapmax); + fastjet::RectangularGrid SKgrid(-m_rapmax, m_rapmax, m_gridSpacing, m_gridSpacing, selector); + fastjet::contrib::SoftKiller softkiller(SKgrid); + std::vector<fastjet::PseudoJet> clustSK = softkiller(selector(clustPJ)); + + m_minPt = findMinPt(&clustSK); +} + +void EFMissingETFromTrackAndClusters::RunSplitClusters(std::vector<xAOD::CaloCluster> clust) const +{ + vector<fastjet::PseudoJet> clustPJ_ECal; + vector<fastjet::PseudoJet> clustPJ_HCal; + + for(xAOD::CaloCluster cl : clust) { + double center_lambda; + cl.retrieveMoment(xAOD::CaloCluster::CENTER_LAMBDA,center_lambda); + if( center_lambda < m_lambdaCalDivide && cl.e() > 0) clustPJ_ECal.push_back( fastjet::PseudoJet( cl.p4() )); + if( center_lambda >= m_lambdaCalDivide && cl.e() > 0) clustPJ_HCal.push_back( fastjet::PseudoJet( cl.p4() )); + } + + fastjet::Selector selector = fastjet::SelectorAbsRapRange(m_rapmin, m_rapmax); + fastjet::RectangularGrid SKgridECal(-m_rapmax, m_rapmax, m_eCalGrid, m_eCalGrid, selector); + fastjet::contrib::SoftKiller softkillerECal(SKgridECal); + std::vector<fastjet::PseudoJet> clustSK_ECal = softkillerECal(selector(clustPJ_ECal)); + m_minPtECal = findMinPt(&clustSK_ECal); + + fastjet::RectangularGrid SKgridHCal(-m_rapmax, m_rapmax, m_hCalGrid, m_hCalGrid, selector); + fastjet::contrib::SoftKiller softkillerHCal(SKgridHCal); + std::vector<fastjet::PseudoJet> clustSK_HCal = softkillerHCal(selector(clustPJ_HCal)); + m_minPtHCal = findMinPt(&clustSK_HCal); +} + + +int EFMissingETFromTrackAndClusters::calculateWeight(xAOD::CaloCluster cl) const +{ + // If the cluster pT is below the SoftKiller pT cut, rescale 4-momentum to 0 + if( abs(cl.eta()) < m_rapminApplied || abs(cl.eta()) > m_rapmaxApplied) return 1; + if( cl.pt() < m_minPt) return 0; + return 1; +} + + +int EFMissingETFromTrackAndClusters::calculateSplitWeight(xAOD::CaloCluster cl) const +{ + if( abs(cl.eta()) < m_rapminApplied || abs(cl.eta()) > m_rapmaxApplied) return 1; + double center_lambda; + + if(!cl.retrieveMoment(xAOD::CaloCluster::CENTER_LAMBDA,center_lambda)) center_lambda = 0; + + //Make a separate pT cut for the ECal and HCal + if( center_lambda < m_lambdaCalDivide && cl.pt() < m_minPtECal) return 0; + if( cl.pt() < m_minPtHCal) return 0; + return 1; +} + + + + + diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndJets.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndJets.cxx index b826140027ef5dbdd828f8a61885c346ae51f4b4..e1c46b1e19ba52c7bed73669aafe5b5bb747e927 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndJets.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromTrackAndJets.cxx @@ -35,8 +35,7 @@ EFMissingETFromTrackAndJets::EFMissingETFromTrackAndJets(const std::string& type const std::string& name, const IInterface* parent) : EFMissingETBaseTool(type, name, parent), - m_trackselTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this ), - m_muontrackselTool("InDet::InDetTrackSelectionTool/MuonTrackSelectionTool", this ) + m_trackselTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this ) { declareProperty("EtaSeparation", m_etacut = 2.2 ,"Cut to split into forward and central jets -- needs to be positive"); declareProperty("CentralpTCut", m_central_ptcut = 0.0 ,"pT Cut for central jets"); @@ -44,7 +43,6 @@ EFMissingETFromTrackAndJets::EFMissingETFromTrackAndJets(const std::string& type declareProperty("TrackpTCut", m_track_ptcut = 0.0 ,"pT Cut for online tracks"); declareProperty("CentralJetJVTCut", m_central_jvtcut = 0.9 ,"Jet JVT Cut for central jets"); declareProperty("TrackSelectionTool", m_trackselTool ); - declareProperty("MuonTrackSelectionTool", m_muontrackselTool ); m_fextype = FexType::JET; m_etacut = fabs(m_etacut); @@ -60,7 +58,7 @@ EFMissingETFromTrackAndJets::~EFMissingETFromTrackAndJets() StatusCode EFMissingETFromTrackAndJets::initialize() { - ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::initialize()" ); + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::initialize()" ); /// timers if( service( "TrigTimerSvc", m_timersvc).isFailure() ) @@ -94,7 +92,7 @@ StatusCode EFMissingETFromTrackAndJets::execute() StatusCode EFMissingETFromTrackAndJets::finalize() { - ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::finalize()" ); + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::finalize()" ); return StatusCode::SUCCESS; @@ -105,278 +103,310 @@ StatusCode EFMissingETFromTrackAndJets::execute(xAOD::TrigMissingET *, const xAOD::CaloClusterContainer * /* caloCluster */, const xAOD::JetContainer *MHTJetContainer, const xAOD::TrackParticleContainer *trackContainer, - const xAOD::VertexContainer *vertexContainer) + const xAOD::VertexContainer *vertexContainer, + const xAOD::MuonContainer *muonContainer) { - ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::execute()" ); // EFMissingET_Fex_Jets + ATH_MSG_DEBUG( "called EFMissingETFromTrackAndJets::execute()" ); // EFMissingET_Fex_Jets - if(m_timersvc) - m_glob_timer->start(); // total time + if(m_timersvc) + m_glob_timer->start(); // total time - ATH_MSG_DEBUG( "started MET jet CPU timer" ); + ATH_MSG_DEBUG( "started MET jet CPU timer" ); - TrigEFMissingEtComponent* metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Jet component + TrigEFMissingEtComponent* metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Jet component - if (metComp==0) { - ATH_MSG_ERROR( "cannot fetch Topo. cluster component!" ); - return StatusCode::FAILURE; - } - if(string(metComp->m_name, 0, 3) != "JET") { - ATH_MSG_ERROR( "fetched " << metComp->m_name << " instead of the Jet component!" ); - return StatusCode::FAILURE; - } + if (metComp==0) { + ATH_MSG_ERROR( "cannot fetch Topo. cluster component!" ); + return StatusCode::FAILURE; + } + if(string(metComp->m_name, 0, 3) != "JET") { + ATH_MSG_ERROR( "fetched " << metComp->m_name << " instead of the Jet component!" ); + return StatusCode::FAILURE; + } - std::vector<const xAOD::Jet*> MHTJetsVec(MHTJetContainer->begin(), MHTJetContainer->end()); - ATH_MSG_DEBUG( "num of jets: " << MHTJetsVec.size() ); + std::vector<const xAOD::Jet*> MHTJetsVec(MHTJetContainer->begin(), MHTJetContainer->end()); + ATH_MSG_DEBUG( "num of jets: " << MHTJetsVec.size() ); - std::vector<const xAOD::TrackParticle*> TrackVec(trackContainer->begin(), trackContainer->end()); - ATH_MSG_DEBUG( "num of tracks: " << TrackVec.size() ); + std::vector<const xAOD::TrackParticle*> TrackVec(trackContainer->begin(), trackContainer->end()); + ATH_MSG_DEBUG( "num of tracks: " << TrackVec.size() ); - std::vector<const xAOD::Vertex*> VertexVec(vertexContainer->begin(), vertexContainer->end()); - ATH_MSG_DEBUG( "num of vertices: " << VertexVec.size() ); + std::vector<const xAOD::Vertex*> VertexVec(vertexContainer->begin(), vertexContainer->end()); + ATH_MSG_DEBUG( "num of vertices: " << VertexVec.size() ); + std::vector<const xAOD::Muon*> MuonVec; + if(muonContainer!=nullptr) { + for (auto muon : *muonContainer) { + MuonVec.push_back(muon); + } + } + ATH_MSG_DEBUG( "num of muons: " << MuonVec.size() ); + + + //################################################################# + std::vector<const xAOD::TrackParticle*> vecOfMuonTrk; + for (const xAOD::Muon* muon : MuonVec) { + const xAOD::Muon::MuonType muontype = muon->muonType(); + // combined or segment tagged muon + if(muontype == xAOD::Muon::MuonType::Combined || muontype == xAOD::Muon::MuonType::SegmentTagged ) { + const xAOD::TrackParticle* idtrk = muon->trackParticle( xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle ); + if(idtrk==0) continue; + if(fabs(muon->pt())<5000) continue; + + ATH_MSG_DEBUG( "Found muon " << "pt = " << muon->pt()/1000. << " eta= " << + muon->eta() << " phi= " << muon->phi() ); + + //check if duplicate muon track + bool find_duplicate(false); + for(std::vector<const xAOD::TrackParticle*>::size_type idx=0; idx<vecOfMuonTrk.size(); idx++) { + float deltaR_ = idtrk->p4().DeltaR(vecOfMuonTrk[idx]->p4()); + if(deltaR_<0.01) { + find_duplicate = true; + break; + } + } + if(find_duplicate) continue; + + vecOfMuonTrk.push_back(idtrk); + } + } - //################################################################# - //bool hasGoodVtx = false; - const xAOD::Vertex* primaryVertex = nullptr; - for (const xAOD::Vertex* vertex : VertexVec) { - ATH_MSG_DEBUG( "\tx: " << vertex->x() << "\ty: " << vertex->y() << "\tz: " << vertex->z() - << "\tntracks: " << vertex->nTrackParticles() - << "\ttype: " << vertex->vertexType() - << "\txAOD::VxType::PriVtx: " << xAOD::VxType::PriVtx ); + //bool hasGoodVtx = false; + const xAOD::Vertex* primaryVertex = nullptr; + for (const xAOD::Vertex* vertex : VertexVec) { - // ntracks is not working now in rel21 - // if ( vertex->nTrackParticles() < 2 ) continue; - if ( vertex->vertexType() == xAOD::VxType::PriVtx ) { - //hasGoodVtx = true; - primaryVertex = vertex; - break; - } + ATH_MSG_DEBUG( "\tx: " << vertex->x() << "\ty: " << vertex->y() << "\tz: " << vertex->z() + << "\tntracks: " << vertex->nTrackParticles() + << "\ttype: " << vertex->vertexType() + << "\txAOD::VxType::PriVtx: " << xAOD::VxType::PriVtx ); - } - - - std::vector<const xAOD::Jet*> goodJets; - goodJets = MHTJetsVec; - std::vector<const xAOD::TrackParticle*> tracksSeparatedWithJets; - - - if(primaryVertex) { - - unsigned int n_putracks = 0; - for (const xAOD::TrackParticle* itrk : TrackVec) { - const xAOD::Vertex* foundVertex { nullptr }; - for (const auto& vx : *vertexContainer) - { - for (const auto& tpLink : vx->trackParticleLinks()) - { - if (*tpLink == itrk) - { - foundVertex = vx; - break; - } - } - if (foundVertex) break; - } - bool isfromPV = ((!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.) || foundVertex==primaryVertex); - if(!isfromPV && itrk->pt()<30e3 && m_trackselTool->accept(*itrk,primaryVertex)) n_putracks++; - } // end for loop over tracks - if (!n_putracks) n_putracks++; - - - - goodJets.clear(); - for (const xAOD::Jet* jet : MHTJetsVec) { - - double ptsum_all = 0; - double ptsum_pv = 0; - double ptsum_pileup = 0; - - for (const xAOD::TrackParticle* itrk : TrackVec) { - - float deltaR_trackj = jet->p4().DeltaR(itrk->p4()); - if(deltaR_trackj>0.4) continue; - - const xAOD::Vertex* foundVertex { nullptr }; - for (const auto& vx : *vertexContainer) - { - for (const auto& tpLink : vx->trackParticleLinks()) - { - if (*tpLink == itrk) - { - foundVertex = vx; - break; - } - } - if (foundVertex) break; - } - - bool accept = (itrk->pt()>500 && m_trackselTool->accept(*itrk, primaryVertex)); - if (accept) ptsum_all += itrk->pt(); - if (accept && ((!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.) || foundVertex==primaryVertex)) ptsum_pv += itrk->pt(); - if (accept && !(!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.)) ptsum_pileup += itrk->pt(); - } - //double JVF = ptsum_all>0 ? ptsum_pv/ptsum_all : -1; - double Rpt = ptsum_pv/jet->pt(); - double corrJVF = ptsum_pv+ptsum_pileup>0 ? ptsum_pv/(ptsum_pv+100*ptsum_pileup/n_putracks) : -1; - double JVT = corrJVF>=0 ? m_jvtLikelihood->Interpolate(corrJVF,std::min(Rpt,1.0)) : -0.1; - - if(jet->pt()<50e3 && jet->pt()>20e3 && fabs(jet->eta())<2.4 && JVT<m_central_jvtcut) continue; - goodJets.push_back(jet); + // ntracks is not working now in rel21 + // if ( vertex->nTrackParticles() < 2 ) continue; + if ( vertex->vertexType() == xAOD::VxType::PriVtx ) { + //hasGoodVtx = true; + primaryVertex = vertex; + break; + } } + std::vector<const xAOD::Jet*> goodJets; + goodJets = MHTJetsVec; + std::vector<const xAOD::TrackParticle*> tracksSeparatedWithJets; - for (const xAOD::TrackParticle* track : TrackVec) { - - const xAOD::Vertex* foundVertex { nullptr }; - for (const auto& vx : *vertexContainer) - { - for (const auto& tpLink : vx->trackParticleLinks()) - { - if (*tpLink == track) - { - foundVertex = vx; - break; - } - } - if (foundVertex) break; - } - //checking the track coming from PV - bool isfromPV = ((!foundVertex && fabs((track->z0()+track->vz()-primaryVertex->z())*sin(track->theta()))<3.) || foundVertex==primaryVertex); - if(!isfromPV) continue; - if(fabs(track->eta())>2.4 || track->pt()/1000. < m_track_ptcut) continue; - if(!m_trackselTool->accept(*track,primaryVertex)) continue; - if(m_muontrackselTool->accept(*track,primaryVertex)) continue; - - ATH_MSG_DEBUG( "\ttrack pt: " << track->pt()/1000. << "\teta: " << track->eta() << "\tphi: " << track->phi() - << "\tvertex: " << foundVertex - << "\tz0: " << track->z0() - << "\tvz: " << track->vz() - << "\ttheta: " << track->theta() - << "\tdZ: " << fabs((track->z0()+track->vz()-primaryVertex->z())*sin(track->theta())) - << "\tisfromPV: " << isfromPV ); - - bool findWithinjets(false); - for (const xAOD::Jet* jet : goodJets) { - if( fabs(jet->eta())<2.4 && jet->pt()/1000. < m_central_ptcut) continue; - float deltaR_trackj = track->p4().DeltaR(jet->p4()); - if(deltaR_trackj<0.4) { - findWithinjets = true; - break; - } - } + if(primaryVertex) { - if(!findWithinjets) { - tracksSeparatedWithJets.push_back(track); - } + unsigned int n_putracks = 0; + for (const xAOD::TrackParticle* itrk : TrackVec) { - } + const xAOD::Vertex* foundVertex { + nullptr + }; + for (const auto& vx : *vertexContainer) { + for (const auto& tpLink : vx->trackParticleLinks()) { + if (*tpLink == itrk) { + foundVertex = vx; + break; + } + } + if (foundVertex) break; + } + bool isfromPV = ((!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.) || foundVertex==primaryVertex); + if(!isfromPV && itrk->pt()<30e3 && m_trackselTool->accept(*itrk,primaryVertex)) n_putracks++; + } // end for loop over tracks + if (!n_putracks) n_putracks++; - } - //################################################################## - //--- fetching the topo. cluster component - float upperlim[4] = {m_etacut,0,5,-m_etacut}; - float lowerlim[4] = {0,-m_etacut,m_etacut,-5}; - for(int i = 0; i < 5; i++) { + goodJets.clear(); + for (const xAOD::Jet* jet : MHTJetsVec) { - metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition + i); // fetch Cluster component + double ptsum_all = 0; + double ptsum_pv = 0; + double ptsum_pileup = 0; - if(i ==0) { - for (const xAOD::TrackParticle* track : tracksSeparatedWithJets) { - metComp->m_ex -= track->p4().Px(); - metComp->m_ey -= track->p4().Py(); - metComp->m_ez -= track->p4().Pz(); - metComp->m_sumEt += track->pt(); - metComp->m_sumE += track->e(); - } - } + for (const xAOD::TrackParticle* itrk : TrackVec) { - for (const xAOD::Jet* aJet : goodJets) { + float deltaR_trackj = jet->p4().DeltaR(itrk->p4()); + if(deltaR_trackj>0.4) continue; - if(i == 0) { + const xAOD::Vertex* foundVertex { + nullptr + }; + for (const auto& vx : *vertexContainer) { + for (const auto& tpLink : vx->trackParticleLinks()) { + if (*tpLink == itrk) { + foundVertex = vx; + break; + } + } + if (foundVertex) break; + } - if( fabs(aJet->eta())<2.4 && aJet->pt()/1000 < m_central_ptcut ) continue; - metComp->m_ex -= aJet->px(); - metComp->m_ey -= aJet->py(); - metComp->m_ez -= aJet->pz(); - metComp->m_sumEt += aJet->pt(); - metComp->m_sumE += aJet->e(); - metComp->m_usedChannels += 1; - metComp->m_sumOfSigns += copysign(1.0, aJet->pt() ); + bool accept = (itrk->pt()>500 && m_trackselTool->accept(*itrk, primaryVertex)); + if (accept) ptsum_all += itrk->pt(); + if (accept && ((!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.) || foundVertex==primaryVertex)) ptsum_pv += itrk->pt(); + if (accept && !((!foundVertex && fabs((itrk->z0()+itrk->vz()-primaryVertex->z())*sin(itrk->theta()))<3.) || foundVertex==primaryVertex)) ptsum_pileup += itrk->pt(); + } + //double JVF = ptsum_all>0 ? ptsum_pv/ptsum_all : -1; + double Rpt = ptsum_pv/jet->pt(); + double corrJVF = ptsum_pv+ptsum_pileup>0 ? ptsum_pv/(ptsum_pv+100*ptsum_pileup/n_putracks) : -1; + double JVT = corrJVF>=0 ? m_jvtLikelihood->Interpolate(corrJVF,std::min(Rpt,1.0)) : -0.1; + + if(jet->pt()<50e3 && jet->pt()>20e3 && fabs(jet->eta())<2.4 && JVT<m_central_jvtcut) continue; + goodJets.push_back(jet); + + } - } else if (i > 0) { - float eta = aJet->eta(); - float ptCut = 0.; - // Set pT cut depending on region - if(i == 1 || i == 2) ptCut = m_central_ptcut; - else ptCut = m_forward_ptcut; - // only sum jets that have a pt above the cut value - if(aJet->pt() < ptCut) continue; + for (const xAOD::TrackParticle* track : TrackVec) { + + + const xAOD::Vertex* foundVertex { + nullptr + }; + for (const auto& vx : *vertexContainer) { + for (const auto& tpLink : vx->trackParticleLinks()) { + if (*tpLink == track) { + foundVertex = vx; + break; + } + } + if (foundVertex) break; + } + + //checking the track coming from PV + bool isfromPV = ((!foundVertex && fabs((track->z0()+track->vz()-primaryVertex->z())*sin(track->theta()))<3.) || foundVertex==primaryVertex); + if(!isfromPV) continue; + if(fabs(track->eta())>2.4 || track->pt()/1000. < m_track_ptcut) continue; + if(!m_trackselTool->accept(*track,primaryVertex)) continue; + + //remove muon tracks + float mindeltaR_trackj(999.); + for (const xAOD::TrackParticle* muontrk: vecOfMuonTrk) { + float deltaR_trackj = track->p4().DeltaR(muontrk->p4()); + if(deltaR_trackj<mindeltaR_trackj) mindeltaR_trackj=deltaR_trackj; + } + if(mindeltaR_trackj<0.1) continue; + + + ATH_MSG_DEBUG( "\ttrack pt: " << track->pt()/1000. << "\teta: " << track->eta() << "\tphi: " << track->phi() + << "\tvertex: " << foundVertex + << "\tz0: " << track->z0() + << "\tvz: " << track->vz() + << "\ttheta: " << track->theta() + << "\tdZ: " << fabs((track->z0()+track->vz()-primaryVertex->z())*sin(track->theta())) + << "\tisfromPV: " << isfromPV ); + + bool findWithinjets(false); + for (const xAOD::Jet* jet : goodJets) { + if( fabs(jet->eta())<2.4 && jet->pt()/1000. < m_central_ptcut) continue; + float deltaR_trackj = track->p4().DeltaR(jet->p4()); + if(deltaR_trackj<0.4) { + findWithinjets = true; + break; + } + } + + if(!findWithinjets) { + tracksSeparatedWithJets.push_back(track); + } - if( eta >= lowerlim[i-1] && eta <= upperlim[i-1]) { - metComp->m_ex -= aJet->px(); - metComp->m_ey -= aJet->py(); - metComp->m_ez -= aJet->pz(); - metComp->m_sumEt += aJet->pt(); - metComp->m_sumE += aJet->e(); - metComp->m_usedChannels += 1; - metComp->m_sumOfSigns += copysign(1.0, aJet->pt() ); } - } + } + //################################################################## + + //--- fetching the topo. cluster component + float upperlim[4] = {m_etacut,0,5,-m_etacut}; + float lowerlim[4] = {0,-m_etacut,m_etacut,-5}; + + for(int i = 0; i < 5; i++) { - } // End loop over all jets + metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition + i); // fetch Cluster component - // move from "processing" to "processed" state - metComp->m_status ^= m_maskProcessing; // switch off bit - metComp->m_status |= m_maskProcessed; // switch on bit + for (const xAOD::TrackParticle* track : tracksSeparatedWithJets) { + metComp->m_ex -= track->p4().Px(); + metComp->m_ey -= track->p4().Py(); + metComp->m_ez -= track->p4().Pz(); + metComp->m_sumEt += track->pt(); + metComp->m_sumE += track->e(); + } + + for (const xAOD::Jet* aJet : goodJets) { + + if( fabs(aJet->eta())<2.4 && aJet->pt()/1000 < m_central_ptcut ) continue; + + if(i == 0) { + metComp->m_ex -= aJet->px(); + metComp->m_ey -= aJet->py(); + metComp->m_ez -= aJet->pz(); + metComp->m_sumEt += aJet->pt(); + metComp->m_sumE += aJet->e(); + metComp->m_usedChannels += 1; + metComp->m_sumOfSigns += copysign(1.0, aJet->pt() ); + } else if (i > 0) { + float eta = aJet->eta(); + if( eta >= lowerlim[i-1] && eta <= upperlim[i-1]) { + metComp->m_ex -= aJet->px(); + metComp->m_ey -= aJet->py(); + metComp->m_ez -= aJet->pz(); + metComp->m_sumEt += aJet->pt(); + metComp->m_sumE += aJet->e(); + metComp->m_usedChannels += 1; + metComp->m_sumOfSigns += copysign(1.0, aJet->pt() ); + } + + } + + } // End loop over all jets + + // move from "processing" to "processed" state + metComp->m_status ^= m_maskProcessing; // switch off bit + metComp->m_status |= m_maskProcessed; // switch on bit - } + } - metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Cluster component + metComp = metHelper->GetComponent(metHelper->GetElements() - m_methelperposition); // fetch Cluster component - ATH_MSG_DEBUG( " calculated MET: " << sqrt((metComp->m_ex)*(metComp->m_ex)+(metComp->m_ey)*(metComp->m_ey)) ); + ATH_MSG_DEBUG( " calculated MET: " << sqrt((metComp->m_ex)*(metComp->m_ex)+(metComp->m_ey)*(metComp->m_ey)) ); - if(m_timersvc) - m_glob_timer->stop(); // total time + if(m_timersvc) + m_glob_timer->stop(); // total time - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } TH1* EFMissingETFromTrackAndJets::getHistogramFromFile(TString hname, TString fname) { - fname = PathResolverFindCalibFile(fname.Data()); - TFile *file = TFile::Open(fname.Data(), "READ"); + fname = PathResolverFindCalibFile(fname.Data()); + TFile *file = TFile::Open(fname.Data(), "READ"); - if (file == nullptr) { - ATH_MSG_DEBUG( "getHistogramFromFile() : Couldn't open file " << fname.Data() << ", returning nullptr." ); - return nullptr; - } + if (file == nullptr) { + ATH_MSG_DEBUG( "getHistogramFromFile() : Couldn't open file " << fname.Data() << ", returning nullptr." ); + return nullptr; + } - TH1 *temp = (TH1*)file->Get(hname.Data()); + TH1 *temp = (TH1*)file->Get(hname.Data()); - if (temp == nullptr) { - ATH_MSG_DEBUG( "getHistogramFromFile() : Couldn't find histogram " << hname.Data() << " in file " << fname.Data() << ", returning nullptr." ); - return nullptr; - } + if (temp == nullptr) { + ATH_MSG_DEBUG( "getHistogramFromFile() : Couldn't find histogram " << hname.Data() << " in file " << fname.Data() << ", returning nullptr." ); + return nullptr; + } - hname = "cloned_" + hname; - TH1 *hist = (TH1*)temp->Clone(hname.Data()); - hist->SetDirectory(0); - SafeDelete(file); + hname = "cloned_" + hname; + TH1 *hist = (TH1*)temp->Clone(hname.Data()); + hist->SetDirectory(0); + SafeDelete(file); - return hist; + return hist; } diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx index 2b2c2a4f3429bdc86aace3ffda34889f1dab8a33..9e636d5423bf1c84500bce954244ff25671d0aa2 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx @@ -7,6 +7,8 @@ #include "TrigEFMissingET/EFMissingETFromFEBHeader.h" #include "TrigEFMissingET/EFMissingETFromJets.h" #include "TrigEFMissingET/EFMissingETFromTrackAndJets.h" +#include "TrigEFMissingET/EFMissingETFromClustersTracksPUC.h" +#include "TrigEFMissingET/EFMissingETFromTrackAndClusters.h" //#include "TrigEFMissingET/EFMissingETFromLvl1Ppr.h" #include "TrigEFMissingET/EFMissingETFlags.h" #include "TrigEFMissingET/EFMissingETFromHelper.h" @@ -22,6 +24,8 @@ DECLARE_COMPONENT( EFMissingETFromClustersPUC ) DECLARE_COMPONENT( EFMissingETFromFEBHeader ) DECLARE_COMPONENT( EFMissingETFromJets ) DECLARE_COMPONENT( EFMissingETFromTrackAndJets ) +DECLARE_COMPONENT( EFMissingETFromClustersTracksPUC ) +DECLARE_COMPONENT( EFMissingETFromTrackAndClusters ) //DECLARE_COMPONENT( EFMissingETFromLvl1Ppr ) DECLARE_COMPONENT( EFMissingETFlags ) DECLARE_COMPONENT( EFMissingETFromHelper ) diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_load.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..afd56dc41bbf236fa5f17990f0fee9bdf77c05f3 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_load.cxx @@ -0,0 +1,3 @@ +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(TrigEFMissingET) diff --git a/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2MissingET.cxx b/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2MissingET.cxx index 2b36cae676b228f34a59f5884f173c3fe27274ae..f762d11d3322dd320f46ac7e923f0ab5124b2b26 100755 --- a/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2MissingET.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2MissingET.cxx @@ -248,7 +248,7 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme if(msgLvl() <= MSG::DEBUG){ char buff[512]; snprintf(buff,512,"REGTEST: DetMask = 0x%08lu",mask64); - ATH_MSG_DEBUG( buff ); + msg() << MSG::DEBUG << buff << endmsg; } if (!(mask64==0)) { // 0 means present @@ -305,7 +305,9 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme m_met_feature->defineComponents(vs_aux); if (m_met_feature==0) { - ATH_MSG_WARNING( "cannot create the TrigMissingET object!" ); + if(msgLvl() <= MSG::WARNING) + msg() << MSG::ERROR //WARNING + << "cannot create the TrigMissingET object!" << endmsg; return HLT::NO_HLT_RESULT; } @@ -392,14 +394,16 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme ATH_MSG_DEBUG( "Running in seeded mode" ); tes_in0_size=tes_in[0].size(); if (tes_in0_size != 1) { - ATH_MSG_WARNING( "Configuration error: expecting exactly 1 L1 result. Aborting chain" ); + msg() << MSG::ERROR + << "Configuration error: expecting exactly 1 L1 result. Aborting chain" << endmsg; return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::BAD_JOB_SETUP); } break; default: - ATH_MSG_WARNING( "Configuration error: tes_in.size() is " << tes_in_size - << " but can only be 1 or 0 in unseeded mode. Aborting chain" ); + msg() << MSG::ERROR + << "Configuration error: tes_in.size() is " << tes_in_size + << " but can only be 1 or 0 in unseeded mode. Aborting chain" << endmsg; return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::BAD_JOB_SETUP); } @@ -411,8 +415,8 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme HLT::ErrorCode status = getFeatures(tes_in[0][0], vectorOfEnergyRoI); if(status == HLT::OK) { if ( vectorOfEnergyRoI.size() < 1 ) { - ATH_MSG_WARNING( "Cannot find L1 result!" ); - return HLT::NAV_ERROR; + msg() << MSG::ERROR << "Cannot find L1 result! Aborting" << endmsg; + return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::MISSING_FEATURE); } else if ( vectorOfEnergyRoI.size() > 1 ) { ATH_MSG_WARNING( "found " << vectorOfEnergyRoI.size() @@ -420,8 +424,9 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme } lvl1_energyRoi = vectorOfEnergyRoI.front(); } else { - ATH_MSG_WARNING( "RecEnergyRoI feature not found. Aborting" ); - return HLT::NAV_ERROR; + msg() << MSG::ERROR + << "RecEnergyRoI feature not found. Aborting" << endmsg; + return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::MISSING_FEATURE); } } else { // unseeded mode: get all RoIs and look for the good one HLT::Navigation* nav = config()->getNavigation(); @@ -433,8 +438,9 @@ HLT::ErrorCode T2MissingET::hltExecute(std::vector<std::vector<HLT::TriggerEleme } } if(!lvl1_energyRoi) { - ATH_MSG_WARNING( "No RecEnergyRoI object found! Aborting" ); - return HLT::NAV_ERROR; + msg() << MSG::ERROR + << "No RecEnergyRoI object found! Aborting" << endmsg; + return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::MISSING_FEATURE); } } diff --git a/Trigger/TrigAlgorithms/TrigMissingETMuon/src/TrigMissingETMuon.cxx b/Trigger/TrigAlgorithms/TrigMissingETMuon/src/TrigMissingETMuon.cxx index 35290b59b58ca30fd94ab96efd8c12f0dbcca197..8d2fd60d94b420c5f0bc941ffe0e0ca363f9109c 100755 --- a/Trigger/TrigAlgorithms/TrigMissingETMuon/src/TrigMissingETMuon.cxx +++ b/Trigger/TrigAlgorithms/TrigMissingETMuon/src/TrigMissingETMuon.cxx @@ -352,7 +352,7 @@ HLT::ErrorCode TrigMissingETMuon::hltExecute(std::vector<std::vector<HLT::Trigge unsigned int muonComp = m_met->getNumberOfComponents() - 1; // Suggested by Diego: Checking the component name of the input if( (m_met->nameOfComponent(muonComp)).substr(0,4)!="Muon") { - msg() << MSG::ERROR << "Could not find MET container with muon information!!! Exit..." <<endmsg; + msg() << MSG::ERROR << "Could not find MET container with muon information!!! Exit..." << endmsg; return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::BAD_JOB_SETUP); } // Fetch Muon Components diff --git a/Trigger/TrigHypothesis/TrigMissingETHypo/TrigMissingETHypo/TrigEFMissingETHypo.h b/Trigger/TrigHypothesis/TrigMissingETHypo/TrigMissingETHypo/TrigEFMissingETHypo.h index accb14726561dadebd59477441ebd430f0b6cf1f..14ca94831b64ab969271ae8dee49ae0b444c8ada 100755 --- a/Trigger/TrigHypothesis/TrigMissingETHypo/TrigMissingETHypo/TrigEFMissingETHypo.h +++ b/Trigger/TrigHypothesis/TrigMissingETHypo/TrigMissingETHypo/TrigEFMissingETHypo.h @@ -62,6 +62,7 @@ class TrigEFMissingETHypo : public HLT::HypoAlgo { */ HLT::ErrorCode hltExecute(const HLT::TriggerElement* outputTE, bool & pass); + private: std::string m_featureLabel; //!< label for the MET feature in the HLT Navigation @@ -110,6 +111,10 @@ class TrigEFMissingETHypo : public HLT::HypoAlgo { bool m_doEMScaleTC; //!< switch on/off the use of EM scale information (in topo. clusters) bool m_doOnlyCalcCentralMET; //!< calculate MET only with central contributions + bool m_doLArH11off; //! LAr H11 off or not + bool m_doLArH12off; //! LAr H12 off or not + bool m_doMETphicut; //! switch on/off MET phi cut for LAr H11/H12 + bool m_monitorMeasuredEnergies; // Heavy Ion Monitoring bool m_doL1L2FEBTest; // L1=L2 vs FEB MET test diff --git a/Trigger/TrigHypothesis/TrigMissingETHypo/python/TrigMissingETHypoConfig.py b/Trigger/TrigHypothesis/TrigMissingETHypo/python/TrigMissingETHypoConfig.py index 3c2473a72af91f8ebcb20e0110073675b9d3bcfd..229085335076d68e238c8943449e01aa0ba440fa 100755 --- a/Trigger/TrigHypothesis/TrigMissingETHypo/python/TrigMissingETHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigMissingETHypo/python/TrigMissingETHypoConfig.py @@ -136,6 +136,15 @@ class EFMetHypoXE (EFMissingETHypoBase): self.SumETCut = 100000000*GeV self.forceAccept=False self.onlineMonitoring(False) + self.doLArH11off=False + self.doLArH12off=False + self.doMETphicut=False + if 'LArH11off' in name: + self.doLArH11off = True + if 'LArH12off' in name: + self.doLArH12off = True + if 'METphi' in name: + self.doMETphicut = True if 'wMu' in name: self.doMuonCorrection = True if 'Mon' in name: @@ -229,13 +238,13 @@ class EFMetHypoTCPSXE (EFMissingETHypoBase): class EFMetHypoJetsXE (EFMissingETHypoBase): __slots__ = [] - def __init__(self, name = "EFMetHypo_mhtxe1000",ef_thr=1000*GeV): + def __init__(self, name = "EFMetHypo_mhtxe1000",ef_thr=1000*GeV, extraCalib = ""): super( EFMetHypoJetsXE, self ).__init__( name ) self.SumETCut=ef_thr self.MissingETCut=ef_thr self.CutType=-2.0 - self.METLabel='TrigEFMissingET_mht' + self.METLabel='TrigEFMissingET_mht{0}'.format(extraCalib) self.doMuonCorrection = False self.SumETCut = 100000000*GeV self.forceAccept=False @@ -275,20 +284,107 @@ class EFMetHypoTrackAndJetsXE (EFMissingETHypoBase): if 'xe30' in name: self.onlineMonitoring(True) +class EFMetHypoFTKTrackAndJetsXE (EFMissingETHypoBase): + __slots__ = [] + def __init__(self, name = "EFMetHypo_trkmhtxe1000",ef_thr=1000*GeV): + super( EFMetHypoFTKTrackAndJetsXE, self ).__init__( name ) + + self.SumETCut=ef_thr + self.MissingETCut=ef_thr + self.CutType=-2.0 + self.METLabel='TrigEFMissingET_trkmhtFTK' + self.doMuonCorrection = False + self.SumETCut = 100000000*GeV + self.forceAccept=False + self.onlineMonitoring(False) + self.doEMScaleTC=False + if 'noFW' in name: + self.doOnlyCalcCentralMET = True + if 'wMu' in name: + self.doMuonCorrection = True + if 'noEF' in name: + self.MissingETCut=-100*GeV + self.SumETCut=-100*GeV + if 'xe30' in name: + self.onlineMonitoring(True) + +class EFMetHypoTrackAndClustersXE (EFMissingETHypoBase): + __slots__ = [] + def __init__(self, name = "EFMetHypo_trktcxe1000",ef_thr=1000*GeV): + super( EFMetHypoTrackAndClustersXE, self ).__init__( name ) + + self.SumETCut=ef_thr + self.MissingETCut=ef_thr + self.CutType=-2.0 + self.METLabel='TrigEFMissingET_trktc' + self.doMuonCorrection = False + self.SumETCut = 100000000*GeV + self.forceAccept=False + self.onlineMonitoring(False) + self.doEMScaleTC=False + if 'noFW' in name: + self.doOnlyCalcCentralMET = True + if 'tclcw' in name: + self.doEMScaleTC = False + if 'wMu' in name: + self.doMuonCorrection = True + if 'noEF' in name: + self.MissingETCut=-100*GeV + self.SumETCut=-100*GeV + if 'xe30' in name: + self.onlineMonitoring(True) + + +class EFMetHypoFTKTrackAndClustersXE (EFMissingETHypoBase): + __slots__ = [] + def __init__(self, name = "EFMetHypo_trktcxe1000",ef_thr=1000*GeV): + super( EFMetHypoFTKTrackAndClustersXE, self ).__init__( name ) + + self.SumETCut=ef_thr + self.MissingETCut=ef_thr + self.CutType=-2.0 + self.METLabel='TrigEFMissingET_trktcFTK' + self.doMuonCorrection = False + self.SumETCut = 100000000*GeV + self.forceAccept=False + self.onlineMonitoring(False) + self.doEMScaleTC=False + if 'noFW' in name: + self.doOnlyCalcCentralMET = True + if 'tclcw' in name: + self.doEMScaleTC = False + if 'wMu' in name: + self.doMuonCorrection = True + if 'noEF' in name: + self.MissingETCut=-100*GeV + self.SumETCut=-100*GeV + if 'xe30' in name: + self.onlineMonitoring(True) + + class EFMetHypoTCPUCXE (EFMissingETHypoBase): __slots__ = [] - def __init__(self, name = "EFMetHypo_tcpucxe1000",ef_thr=1000*GeV): + def __init__(self, name = "EFMetHypo_tcpucxe1000",ef_thr=1000*GeV,labelMET = ""): super( EFMetHypoTCPUCXE, self ).__init__( name ) self.SumETCut=ef_thr self.MissingETCut=ef_thr self.CutType=-2.0 - self.METLabel='TrigEFMissingET_topocl_PUC' + self.METLabel='TrigEFMissingET_topocl_PUC' if 'LAr' not in labelMET else 'TrigEFMissingET_EFMissingET_Fex_topoClustersPUC'+labelMET self.doMuonCorrection = False self.SumETCut = 100000000*GeV self.forceAccept=False self.onlineMonitoring(False) self.doEMScaleTC=True + self.doLArH11off=False + self.doLArH12off=False + self.doMETphicut=False + if 'LArH11off' in name: + self.doLArH11off = True + if 'LArH12off' in name: + self.doLArH12off = True + if 'METphi' in name: + self.doMETphicut = True if 'tchad' in name: self.doEMScaleTC = False if 'tclcw' in name: @@ -303,6 +399,35 @@ class EFMetHypoTCPUCXE (EFMissingETHypoBase): if 'xe30' in name: self.onlineMonitoring(True) +class EFMetHypoTCTrkPUCXE (EFMissingETHypoBase): + __slots__ = [] + def __init__(self, name = "EFMetHypo_tctrkpucxe1000",ef_thr=1000*GeV, extraCalib = ""): + super( EFMetHypoTCTrkPUCXE, self ).__init__( name ) + + self.SumETCut=ef_thr + self.MissingETCut=ef_thr + self.CutType=-2.0 + self.METLabel='TrigEFMissingET_topocltrk_PUC{0}'.format(extraCalib) + self.doMuonCorrection = False + self.SumETCut = 100000000*GeV + self.forceAccept=False + self.onlineMonitoring(False) + self.doEMScaleTC=True + if 'tchad' in name: + self.doEMScaleTC = False + if 'tc' in name and 'lcw' in name: + self.doEMScaleTC = False + if 'tc' in name and 'em' in name: + self.doEMScaleTC = True + if 'wMu' in name: + self.doMuonCorrection = True + if 'noEF' in name: + self.MissingETCut=-100*GeV + self.SumETCut=-100*GeV + if 'xe30' in name: + self.onlineMonitoring(True) + + class L2MetHypoTE (EFMissingETHypoBase): __slots__ = [] def __init__(self, name = "L2MetHypo_te1000",l2_thr=1000*GeV): diff --git a/Trigger/TrigHypothesis/TrigMissingETHypo/src/TrigEFMissingETHypo.cxx b/Trigger/TrigHypothesis/TrigMissingETHypo/src/TrigEFMissingETHypo.cxx index eca647c5b87d5cf18f50082cebed807251c25e2d..cda8f337521e3205ee48e566ad6f9f047ecad809 100755 --- a/Trigger/TrigHypothesis/TrigMissingETHypo/src/TrigEFMissingETHypo.cxx +++ b/Trigger/TrigHypothesis/TrigMissingETHypo/src/TrigEFMissingETHypo.cxx @@ -52,6 +52,12 @@ TrigEFMissingETHypo::TrigEFMissingETHypo(const std::string& name, ISvcLocator* p declareProperty("doL1L2FEBTest", m_doL1L2FEBTest = false, "Use L2=L1 values to Trigger FEB if MET values disagree by more than L1L2FEBTolerance GeV (for FEB only!)" ); declareProperty("L1L2FEBTolerance", m_L1L2FEBTolerance = 100*CLHEP::GeV, "L2=L1 vs FEB tolerance in GeV" ); + declareProperty("doLArH11off", m_doLArH11off = false, "LAr H11 crate is off" ); + declareProperty("doLArH12off", m_doLArH12off = false, "LAr H12 crate is off" ); + declareProperty("doMETphicut", m_doMETphicut = false, "remove event when MET phi in the region of LAr H11 or/both H12"); + + + // xs = MET/[a sqrt(SumET) - b] @@ -206,6 +212,9 @@ HLT::ErrorCode TrigEFMissingETHypo::hltExecute(const HLT::TriggerElement* output HLT::ErrorCode stat = getFeatures(outputTE, vectorMissingET, m_featureLabel); + + + if(stat != HLT::OK) { msg() << MSG::WARNING << " Failed to get vectorMissingETs " << endmsg; if (doTiming() && m_totTime) { @@ -634,6 +643,13 @@ HLT::ErrorCode TrigEFMissingETHypo::hltExecute(const HLT::TriggerElement* output msg() << MSG::WARNING << " WRONG Cut Type. Event will Fail MET Cut " << endmsg; } + + if(m_doMETphicut){ + m_phi = atan2f(Ey, Ex); + if(m_doLArH12off && m_phi > -2.5 && m_phi < -2.0 ) accepted = false; + if(m_doLArH11off && m_phi > -2.0 && m_phi < -1.5 ) accepted = false; + } + if(accepted) { pass = true; m_accepted++; diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/TrigMETMonitoring/HLTMETMonTool.h b/Trigger/TrigMonitoring/TrigMETMonitoring/TrigMETMonitoring/HLTMETMonTool.h index e1dc244cf2fa58219013834cca0e8a9004af7c8d..4ebd305f44b8b7e22647a934c528ec39eefc9619 100755 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/TrigMETMonitoring/HLTMETMonTool.h +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/TrigMETMonitoring/HLTMETMonTool.h @@ -9,6 +9,8 @@ #include "TrigMissingEtEvent/TrigMissingET.h" #include "MissingETEvent/MissingET.h" +#include "xAODTrigger/JetRoI.h" +#include "xAODTrigger/JetRoIContainer.h" #include "xAODTrigger/EnergySumRoI.h" #include "xAODTrigMissingET/TrigMissingET.h" #include "xAODTrigMissingET/TrigMissingETContainer.h" @@ -21,6 +23,8 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/Electron.h" +#include "TLorentzVector.h" + #include <string> #include <vector> @@ -39,19 +43,35 @@ public: private: - /** methods called by book() */ - //void bookExpertL1Histograms(); - //void bookExpertHLTHistograms(); - void bookExpertEfficHistograms(); + StatusCode fillMETHist(); /** methods to make booking easier */ + void addL1BasicHistograms(); + void addL1JetHistograms(); + void addL1ProfileHistograms(std::map<std::string, int> met_signatures_tolook); + void addL1ProfileShifterHistograms(); + void addL1ProfileExpertHistograms(); + void addHLTBasicHistograms(); + void addHLTProfileHistograms(std::map<std::string, int> met_signatures_tolook); + void addHLTStatusHistograms(); void addHLTCompHistograms(); - void addHLTStatusHistogram(); + void addOffMETHistograms(); void addL1vsHLTHistograms(); void addHLTvsOffHistograms(); void addL1vsOffHistograms(); - - StatusCode fillMETHist(); + void addElMuHistograms(); + // methods to make filling easier + void fillL1BasicHistograms(float l1_mex,float l1_mex_log,float l1_mey,float l1_mey_log,float l1_met,float l1_met_log,float l1_sumet,float l1_sumet_log,float l1_phi,float saturated); + void fillL1JetHistograms(float l1_jet_pt,float l1_jet_eta); + void fillL1ProfileHistograms(float off_met,float pT_mumu,bool METMuonFilled,std::map<std::string, int> met_signatures_tolook); + void fillHLTBasicHistograms(float hlt_ex,float hlt_ex_log,float hlt_ey,float hlt_ey_log,float hlt_ez,float hlt_ez_log,float hlt_met,float hlt_met_log,float hlt_sumet,float hlt_sumet_log,float hlt_sume,float hlt_sume_log,float hlt_phi,float hlt_eta,float hlt_significance); + void fillHLTProfileHistograms(float off_met,std::map<std::string, int> met_signatures_tolook); + void fillHLTProfileShifterHistograms(float off_met); + void fillHLTProfileExpertHistograms(float off_met); + void fillOffMETHistograms(float off_met,float off_ex,float off_ey,float off_sumet,float off_phi); + void fillL1vsHLTHistograms(float l1_met,float l1_sumet,float l1_phi,float l1_mex,float l1_mey,float hlt_met,float hlt_sumet,float hlt_phi,float hlt_ex,float hlt_ey,float saturated); + void fillHLTvsOffHistograms(float hlt_met,float hlt_ex,float hlt_ey,float hlt_sumet,float hlt_phi,float off_met,float off_ex,float off_ey,float off_sumet,float off_phi); + void fillL1vsOffHistograms(float l1_met,float l1_mex,float l1_mey,float l1_sumet,float l1_phi,float off_met,float off_ex,float off_ey,float off_sumet,float off_phi,float saturated); void check_triggers(std::vector<std::string> &m_triggers, std::map<std::string,int> &m_signatures); @@ -70,29 +90,37 @@ private: private: - double m_et_min, m_sumet_min, m_phi_min, m_det_min, m_eff_min; - double m_et_max, m_sumet_max, m_phi_max, m_det_max, m_eff_max; - int m_et_bins, m_sumet_bins, m_phi_bins, m_det_bins, m_eff_bins; + double m_et_min, m_ec_min, m_sumet_min, m_sume_min; + double m_phi_min, m_eta_min, m_det_min, m_eff_min, m_xs_min; + double m_et_max, m_ec_max, m_sumet_max, m_sume_max; + double m_phi_max, m_eta_max, m_det_max, m_eff_max, m_xs_max; + int m_et_bins, m_ec_bins, m_sumet_bins, m_sume_bins; + int m_phi_bins, m_eta_bins, m_det_bins, m_eff_bins, m_xs_bins; std::vector<std::string> m_primary_met; - std::vector<std::string> m_monitoring_met; + std::vector<std::string> m_monitoring_met_shifter; + std::vector<std::string> m_monitoring_met_expert; std::vector<std::string> m_monitoring_alg; + std::vector<std::string> m_monitoring_alg_shifter; + std::vector<std::string> m_monitoring_alg_expert; std::vector<std::string> m_prescaled_met; - std::vector<std::string> m_met_triggers_l1, m_met_triggers_hlt; - std::map<std::string, int> m_l1_met_signatures_tolook; - std::map<std::string, int> m_hlt_met_signatures_tolook; + + std::vector<std::string> m_met_triggers_l1_expert, m_met_triggers_hlt_expert; + std::vector<std::string> m_met_triggers_l1_shifter, m_met_triggers_hlt_shifter; + std::map<std::string, int> m_l1_met_signatures_tolook_shifter; + std::map<std::string, int> m_hlt_met_signatures_tolook_shifter; + std::map<std::string, int> m_l1_met_signatures_tolook_expert; + std::map<std::string, int> m_hlt_met_signatures_tolook_expert; bool m_print_met_trig_stats; bool m_make_expert_histograms; - //bool m_doRecMET; std::string m_mon_path; std::string m_shifter_path; std::string m_expert_path; - //bool m_is_do_trigger_effic; - + std::string m_lvl1_jet_roi_key; std::string m_lvl1_roi_key; std::string m_hlt_cell_met_key; std::string m_hlt_mht_met_key; @@ -117,10 +145,7 @@ private: // for the efficiencies std::string m_denominator_trigger; - //TH1F *h_denominator = 0; - - std::string m_numerator_trigger[4]; // = {"HLT_xe80", "HLT_xe100"}; - //TH1F *trig_eff_num[4] = {0}; + std::string m_numerator_trigger[4]; // for MET significance float m_sigOffset; diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitCategory.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitCategory.py index 38bc63e63acdaa40cf2bef55409931f4ace8ddee..5264b20c21f1df28385b0f3842384634256361dd 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitCategory.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitCategory.py @@ -1,22 +1,46 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # l1 trigger to monitor: -# the first one is the denominator for all efficiencies -met_triggers_l1 = [ - "L1_XE50", - #"L1_XS30", - "L1_XE60", - #"L1_XE70", +met_triggers_l1_shifter = [ + "L1_XE50", + "L1_XE55", ] +met_triggers_l1_expert = [ + "L1_XE60", + ] + # hlt triggers to monitor -# -met_triggers_hlt = [ - ## "HLT_mu30", - "HLT_xe100_pufit_L1XE50", - "HLT_xe110_mht_L1XE50", - "HLT_xe110_pufit_L1XE60", - "HLT_xe120_mht_xe80_L1XE60", +met_triggers_hlt_shifter = [ + "HLT_xe110_pufit_xe65_L1XE50", + "HLT_xe110_pufit_xe70_L1XE50", + "HLT_xe110_pufit_xe65_L1XE55", + "HLT_xe110_pufit_xe65_L1XE60", +] + +met_triggers_hlt_expert = [ + "HLT_xe110_pufit_xe75_L1XE50", + "HLT_xe110_pufit_xe70_L1XE55", + "HLT_xe110_pufit_xe70_L1XE60", + "HLT_xe100_trkmht_FTK_L1XE50", + "HLT_xe110_trkmht_FTK_L1XE55", + "HLT_xe110_trkmht_FTK_L1XE60", +] + + +# Trigger chins in early 2018 + #"HLT_xe100_pufit_xe75_L1XE60", + #"HLT_xe120_pufit_L1XE50", + #"HLT_xe120_pufit_L1XE55", + #"HLT_xe120_pufit_L1XE60", + + +# Trigger chins in 2015-2017 + #"HLT_xe110_pufit_L1XE50", + #"HLT_xe110_pufit_L1XE55", + #"HLT_xe110_pufit_L1XE60", + #"HLT_xe120_mht_xe80_L1XE60", + #"HLT_mu30", #"HLT_xs30", #"HLT_xe70_tc_lcw", #"HLT_xe80_tc_lcw_L1XE50", @@ -32,9 +56,18 @@ met_triggers_hlt = [ #"HLT_xe35_xeNOcut_pueta", #"HLT_xe35_xeNOcut_pufit", #"HLT_xe35_xeNOcut_mht", -] -monitoring_met = met_triggers_l1 + met_triggers_hlt -monitoring_met_pp = met_triggers_l1 + met_triggers_hlt -monitoring_met_cosmic = met_triggers_l1 + met_triggers_hlt + +monitoring_met_shifter = met_triggers_l1_shifter + met_triggers_hlt_shifter +monitoring_met_expert = met_triggers_l1_expert + met_triggers_hlt_expert + +monitoring_met_shifter_pp = met_triggers_l1_shifter + met_triggers_hlt_shifter +monitoring_met_expert_pp = met_triggers_l1_expert + met_triggers_hlt_expert + +monitoring_met_shifter_cosmic = met_triggers_l1_shifter + met_triggers_hlt_shifter +monitoring_met_expert_cosmic = met_triggers_l1_expert + met_triggers_hlt_expert + +monitoring_met = monitoring_met_shifter +monitoring_met_pp = monitoring_met_shifter_pp +monitoring_met_cosmic = monitoring_met_shifter_cosmic diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py index 19fe1eccf75ac6664bccef73c2ff280c748b2372..1ab5b1edc6e0a0adb8d88aaed8c358549d91a22b 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py @@ -58,34 +58,44 @@ bitNames_allHLT= [ ] -met_alt_algorithms = [ +met_alt_algorithms_shifter = [ "mht_lcw", - "mht_em", "tc_lcw", "cell", - #"pueta", - "pufit", + "pufit" +] + +met_alt_algorithms_expert = [ + "mht_em", + "pueta", "trkmht_FS", - "trkmht_FTK", + "trkmht_FTK" +] + +# algorithms in Run1 #"feb", #"fex", -] def HLTMETMonitoringTool(): from TrigMETMonitoring.TrigMETMonitoringConf import HLTMETMonTool from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # access to central tool + print "shifter list " + print hltmonList.monitoring_met_shifter HLTMETMon = HLTMETMonTool(name = 'HLTMETMon', histoPathBase = "/Trigger/HLT", MonPathBase = "/HLT/METMon", comp_names = compNames_all, bit_names = bitNames_allHLT, - monitoring_met = hltmonList.monitoring_met, - monitoring_alg = met_alt_algorithms, + monitoring_met_shifter = hltmonList.monitoring_met_shifter, + monitoring_met_expert = hltmonList.monitoring_met_expert, + monitoring_alg = met_alt_algorithms_shifter, + monitoring_alg_shifter = met_alt_algorithms_shifter, + monitoring_alg_expert = met_alt_algorithms_expert, muon_base = "HLT_mu26", muon_pt_thresh = 18, electron_pt_thresh = 20, - primary_met = [], + primary_met = ["pufit"], prescaled_met = [], ); from AthenaCommon.AppMgr import ToolSvc diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/share/HLTMETMon_jobOptions.py b/Trigger/TrigMonitoring/TrigMETMonitoring/share/HLTMETMon_jobOptions.py index a52d7ab90324cc88bbcd97aea5209cf538f10241..f35a7e32144f5501ff0977898e0e7ad90e0238bf 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/share/HLTMETMon_jobOptions.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/share/HLTMETMon_jobOptions.py @@ -10,45 +10,7 @@ import sys ############## # Input files ############## -#InputFiles = ['/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0331._0001.1'] - -#InputFiles = ['/hep300/data/khamano/data16/data16_13TeV.00298967.physics_Main.merge.AOD.f696_m1588/data16_13TeV.00298967.physics_Main.merge.AOD.f696_m1588._lb0157._0006.1'] - -#InputFiles = ['/hep300/data/khamano/data16/data16_13TeV.00298967.physics_EnhancedBias.merge.AOD.r8138_p2645/AOD.08788661._000026.pool.root.1','/hep300/data/khamano/data16/data16_13TeV.00298967.physics_EnhancedBias.merge.AOD.r8138_p2645/AOD.08788661._000309.pool.root.1','/hep300/data/khamano/data16/data16_13TeV.00298967.physics_EnhancedBias.merge.AOD.r8138_p2645/AOD.08788661._000352.pool.root.1','/hep300/data/khamano/data16/data16_13TeV.00298967.physics_EnhancedBias.merge.AOD.r8138_p2645/AOD.08788661._000447.pool.root.1','/hep300/data/khamano/data16/data16_13TeV.00298967.physics_EnhancedBias.merge.AOD.r8138_p2645/AOD.08788661._000476.pool.root.1'] - -InputFiles = ['/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646._lb0127._0004.1','/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646._lb0405._0003.1','/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646._lb0573._0002.1','/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646._lb0947._0002.1','/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646/data16_13TeV.00305543.physics_Main.merge.AOD.f729_m1646._lb0989._0001.1'] - - -# xs trigger -#InputFiles = ['/hep300/data/khamano/data15/data15_13TeV.00276952.physics_EnhancedBias.merge.AOD.r7124_p2424_tid06589898_00/AOD.06589898._000130.pool.root.1','/hep300/data/khamano/data15/data15_13TeV.00280500.physics_EnhancedBias.merge.AOD.r7128_p2424_tid06595858_00/AOD.06595858._000083.pool.root.1'] - -#InputFiles = ['/hep300/data/khamano/data15/data15_13TeV.00276952.physics_EnhancedBias.merge.AOD.r7124_p2424_tid06589898_00/AOD.06589898._000130.pool.root.1'] - -#InputFiles = ['/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0331._0001.1'] - -#InputFiles = ['/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0331._0001.1', '/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0342._0007.1', '/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0350._0004.1', '/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0363._0001.1', '/hep300/data-shared/MET/271595/files/data15_13TeV.00271595.physics_Main.merge.AOD.f611_m1463._lb0373._0004.1'] - -# PeriodA -#InputFiles = ['/hep300/data/khamano/data15/data15_13TeV.00266904.physics_Main.merge.AOD.r6944_p2410_tid06296440_00/AOD.06296440._000566.pool.root.1'] - -# PeriodC -#InputFiles = ['/hep300/data/khamano/data15/data15_13TeV.00270816.physics_Main.merge.AOD.r6943_p2410_tid06297590_00/AOD.06297590._000005.pool.root.1'] - -#InputFiles = ['/hep300/data/khamano/mc15/mc15_13TeV.361100.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplusenu.merge.AOD.e3601_s2576_s2132_r6630_r6264_tid05371496_00/AOD.05371496._000392.pool.root.1'] - -#mc15 - -#Wplusenu -#InputFiles = ['/afs/cern.ch/user/y/ychiu/work/MonitoringMay13/test/mc15data/mc15_13TeV.361100.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplusenu.merge.AOD.e3601_s2576_s2132_r6630_r6264_tid05367769_00/AOD.05367769._000216.pool.root.1']; - -#Wplusmunu -#InputFiles = ['/afs/cern.ch/user/y/ychiu/work/MonitoringMay13/test/mc15data/mc15_13TeV.361101.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplusmunu.merge.AOD.e3601_s2576_s2132_r6630_r6264_tid05371399_00/AOD.05371399._000167.pool.root.1']; - -#minbias -#InputFiles = ['/afs/cern.ch/user/y/ychiu/work/MonitoringMay13/test/mc15data/mc15_13TeV.361203.Pythia8_A2_MSTW2008LO_ND_minbias.merge.AOD.e3639_s2601_s2132_r6630_r6264_tid05405009_00/AOD.05405009._000059.pool.root.1']; - -#ttbar -#InputFiles = ['/afs/cern.ch/user/y/ychiu/work/MonitoringMay13/test/mc15data/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.AOD.e3698_s2608_s2183_r6630_r6264_tid05382619_00/AOD.05382619._000139.pool.root.1']; +InputFiles = ['/hep300/data/khamano/data17/data17_13TeV.00339590.physics_Main.merge.AOD.f889_m1831_r9949_r10241_r10242_p3313/AOD.13015916._000011.pool.root.1','/hep300/data/khamano/data17/data17_13TeV.00339590.physics_Main.merge.AOD.f889_m1831_r9949_r10241_r10242_p3313/AOD.13015916._000182.pool.root.1','/hep300/data/khamano/data17/data17_13TeV.00339590.physics_Main.merge.AOD.f889_m1831_r9949_r10241_r10242_p3313/AOD.13015916._000326.pool.root.1','/hep300/data/khamano/data17/data17_13TeV.00339590.physics_Main.merge.AOD.f889_m1831_r9949_r10241_r10242_p3313/AOD.13015916._000341.pool.root.1','/hep300/data/khamano/data17/data17_13TeV.00339590.physics_Main.merge.AOD.f889_m1831_r9949_r10241_r10242_p3313/AOD.13015916._000368.pool.root.1'] @@ -57,6 +19,7 @@ InputFiles = ['/hep300/data/khamano/data16/data16_13TeV.00305543.physics_Main.me ############################ import AthenaPoolCnvSvc.ReadAthenaPool ServiceMgr.EventSelector.InputCollections=InputFiles + ServiceMgr.PoolSvc.AttemptCatalogPatch = True; ServiceMgr.OutputLevel=ERROR @@ -165,9 +128,9 @@ HLTmetMonMan.FileKey = "MonitorHLTmet" print HLTmetMonMan -########################## -# Events to run over -########################## +############################################# +# Events to run over; "-1" for all events. +############################################# theApp.EvtMax = -1 #theApp.EvtMax = 10 diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/HLTMETMonTool.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/HLTMETMonTool.cxx index 9918e96e4836122f8de3a5edf83f7041a7367b6e..685152aadd593a25cfa3dbb6ad3e2fc7d8cf1e03 100755 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/HLTMETMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/HLTMETMonTool.cxx @@ -1,21 +1,24 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #include "TrigMETMonitoring/HLTMETMonTool.h" #include "GaudiKernel/MsgStream.h" #include "StoreGate/StoreGateSvc.h" +#include "GaudiKernel/PropertyMgr.h" #include "GaudiKernel/ToolHandle.h" #include "TrigConfL1Data/TriggerItem.h" #include "TrigMissingEtEvent/TrigMissingETContainer.h" #include "CLHEP/Units/SystemOfUnits.h" +#include "xAODEventInfo/EventInfo.h" #include <iostream> #include <iomanip> #include <cmath> #include <functional> +#include "TLorentzVector.h" #include "TH1.h" #include "TH2.h" #include "TH1F.h" @@ -36,10 +39,16 @@ HLTMETMonTool::HLTMETMonTool(const std::string & type, const std::string & name, // Triggers to monitor declareProperty("primary_met", m_primary_met); - declareProperty("monitoring_met", m_monitoring_met); + declareProperty("monitoring_met_shifter", m_monitoring_met_shifter); + declareProperty("monitoring_met_expert", m_monitoring_met_expert); declareProperty("monitoring_alg", m_monitoring_alg); + declareProperty("monitoring_alg_shifter", m_monitoring_alg_shifter); + declareProperty("monitoring_alg_expert", m_monitoring_alg_expert); declareProperty("prescaled_met", m_prescaled_met); + // Jet keys + declareProperty("l1_jet_key", m_lvl1_jet_roi_key="LVL1JetRoIs"); + // Met keys declareProperty("l1_key", m_lvl1_roi_key="LVL1EnergySumRoI"); declareProperty("hlt_cell_key", m_hlt_cell_met_key="HLT_xAOD__TrigMissingETContainer_TrigEFMissingET"); @@ -64,31 +73,49 @@ HLTMETMonTool::HLTMETMonTool(const std::string & type, const std::string & name, declareProperty("electron_base", m_electron_base_trigger="HLT_e5_lhloose"); declareProperty("electron_pt_thresh", m_electron_pt_thresh=20.0); + // declareProperty("comp_names", m_compNames); declareProperty("bit_names", m_bitNames); // histograms limits // et - declareProperty("et_min", m_et_min=-13.5, "Minimum Et"); - declareProperty("et_max", m_et_max=601.5, "Maximum Et"); declareProperty("et_bins", m_et_bins=205, "Number of bins Et"); + declareProperty("et_min", m_et_min=-13.5, "Minimum Et"); + declareProperty("et_max", m_et_max=401.5, "Maximum Et"); + // Ex, Ey, Ez + declareProperty("ec_bins", m_ec_bins=199, "Number of bins Ex, Ey, Ez"); + declareProperty("ec_min", m_ec_min=-298.5, "Minimum Ex, Ey, Ez"); + declareProperty("ec_max", m_ec_max=298.5, "Maximum Ex, Ey, Ez"); // sumet - declareProperty("sumet_min", m_sumet_min=-27., "Minimum Sumet"); - declareProperty("sumet_max", m_sumet_max=1803., "Maximum Sumet"); - declareProperty("sumet_bins", m_sumet_bins=305, "Number of bins Sumet"); + declareProperty("sumet_bins", m_sumet_bins=305, "Number of bins SumEt"); + declareProperty("sumet_min", m_sumet_min=-27., "Minimum SumEt"); + declareProperty("sumet_max", m_sumet_max=4203., "Maximum SumEt"); + // sume + declareProperty("sume_bins", m_sume_bins=153, "Number of bins SumE"); + declareProperty("sume_min", m_sume_min=-27., "Minimum SumE"); + declareProperty("sume_max", m_sume_max=24003., "Maximum SumE"); // phi, dphi + declareProperty("phi_bins", m_phi_bins=32, "Number of bins Phi, dPhi"); declareProperty("phi_min", m_phi_min=-3.1416, "Minimum Phi"); declareProperty("phi_max", m_phi_max=3.1416, "Maximum Phi"); - declareProperty("phi_bins", m_phi_bins=32, "Number of bins Phi, dPhi"); + // eta + declareProperty("eta_bins", m_eta_bins=24, "Number of bins Eta"); + declareProperty("eta_min", m_eta_min=-4.8, "Minimum Eta"); + declareProperty("eta_max", m_eta_max=4.8, "Maximum Eta"); // dEt, dEx, dEy + declareProperty("det_bins", m_det_bins=100, "Number of bins dEt, dEx, dEy"); declareProperty("det_min", m_det_min=-100., "Minimum dEt, dEx, dEy"); declareProperty("det_max", m_det_max=100., "Maximum dEt, dEx, dEy"); - declareProperty("det_bins", m_det_bins=100, "Number of bins dEt, dEx, dEy"); // efficiency + declareProperty("eff_bins", m_eff_bins=42, "Number of bins Eff"); declareProperty("eff_min", m_eff_min=-13.5, "Minimum Eff"); declareProperty("eff_max", m_eff_max=406.5, "Maximum Eff"); - declareProperty("eff_bins", m_eff_bins=42, "Number of bins Eff"); - // significance + // xs + declareProperty("xs_bins", m_xs_bins=40, "Number of bins Xs"); + declareProperty("xs_min", m_xs_min=-0.025, "Minimum Xs"); + declareProperty("xs_max", m_xs_max=20.025, "Maximum Xs"); + + // significance parameters declareProperty("sig_offset", m_sigOffset=4.93182 , "Resolution offset"); declareProperty("sig_slope", m_sigSlope=0.442864 , "Resolution slope"); declareProperty("sig_quadr", m_sigQuadr=0.0 , "Resolution quad term"); @@ -104,21 +131,36 @@ HLTMETMonTool::~HLTMETMonTool() { } +class High2LowByPt { +public: + bool operator () (const TLorentzVector &a, const TLorentzVector &b) const { + return (a.Perp()>b.Perp()); + } +}; + //___________________________________________________________________________________________________________ StatusCode HLTMETMonTool::init() { ATH_MSG_DEBUG("in HLTMETMonTool::init()"); ATH_MSG_DEBUG("HLTMETMonTool: L1Key = " << m_lvl1_roi_key); - ATH_MSG_DEBUG("HLTMETMonTool: HLT_METKey = " << m_hlt_cell_met_key); + ATH_MSG_DEBUG("HLTMETMonTool: HLT_METKey = " << m_primary_met[0]); ATH_MSG_DEBUG("HLTMETMonTool: Off_METKey = " << m_off_met_key); - // put all trigger names into one arry - for (std::vector<std::string>::iterator it = m_monitoring_met.begin(); it != m_monitoring_met.end(); ++it) { + // put all trigger names into one array for shifter + for (std::vector<std::string>::iterator it = m_monitoring_met_shifter.begin(); it != m_monitoring_met_shifter.end(); ++it) { if (get_trigger_level(*it) == "L1") - m_met_triggers_l1.push_back(*it); + m_met_triggers_l1_shifter.push_back(*it); else if (get_trigger_level(*it) == "HLT") - m_met_triggers_hlt.push_back(*it); + m_met_triggers_hlt_shifter.push_back(*it); } + //put all trigger names into one array for expert + for (std::vector<std::string>::iterator it = m_monitoring_met_expert.begin(); it != m_monitoring_met_expert.end(); ++it) { + if (get_trigger_level(*it) == "L1") + m_met_triggers_l1_expert.push_back(*it); + else if (get_trigger_level(*it) == "HLT") + m_met_triggers_hlt_expert.push_back(*it); + } + return StatusCode::SUCCESS; @@ -129,13 +171,22 @@ StatusCode HLTMETMonTool::init() { StatusCode HLTMETMonTool::book() { ATH_MSG_DEBUG("in HLTMETMonTool::book()"); - + // check if input met triggers are in trigger configuration and add them to signatures_to look vectors - if (m_met_triggers_l1.size()) - check_triggers(m_met_triggers_l1, m_l1_met_signatures_tolook); - if (m_met_triggers_hlt.size()) - check_triggers(m_met_triggers_hlt, m_hlt_met_signatures_tolook); + if (m_met_triggers_l1_shifter.size()) + check_triggers(m_met_triggers_l1_shifter, m_l1_met_signatures_tolook_shifter); + if (m_met_triggers_hlt_shifter.size()) + check_triggers(m_met_triggers_hlt_shifter, m_hlt_met_signatures_tolook_shifter); + //Do the same for expert + if (m_met_triggers_l1_expert.size()) + check_triggers(m_met_triggers_l1_expert, m_l1_met_signatures_tolook_expert); + if (m_met_triggers_hlt_expert.size()) + check_triggers(m_met_triggers_hlt_expert, m_hlt_met_signatures_tolook_expert);// + // declare iterator etc. + std::map<std::string,int>::const_iterator it; + std::map<std::string, int> met_signatures_tolook; + // Create Shifter and Expert folders m_shifter_path = m_mon_path + "/Shifter"; m_expert_path = m_mon_path + "/Expert"; @@ -143,125 +194,81 @@ StatusCode HLTMETMonTool::book() { addMonGroup(new MonGroup(this, m_shifter_path, run)); addMonGroup(new MonGroup(this, m_expert_path, run)); - //############################ - //-- Book "Shifter" histograms - //############################ - //********************** - // Shifter L1 histograms - //********************** - std::string mongroupName = m_shifter_path + "/L1"; - addMonGroup(new MonGroup(this, mongroupName.c_str(), run)); - setCurrentMonGroup(mongroupName); - - addHistogram(new TH1F("L1_METx", "L1 Missing E_{x};E_{x} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("L1_METy", "L1 Missing E_{y};E_{y} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("L1_MET", "L1 MET (GeV);MET (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("L1_SumEt", "L1 SumEt (GeV);SumEt (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("L1_MET_phi", "L1 MET #phi (rad);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_MET_phi_etweight", "L1 MET #phi (|Missing E_{T}|);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_MET_log", "L1 |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 40, -1.875, 4.125)); - addHistogram(new TH1F("L1_SumEt_log", "L1 Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 40, -1.875, 4.125)); - + std::string monGroupName = ""; //L1 or HLT + std::string monFolderName = ""; //Primary, Efficiecny, mht, trigger name etc. - std::map<std::string,int>::const_iterator it; - /// Efficiencies for the L1 triggers - for (it = m_l1_met_signatures_tolook.begin(); it != m_l1_met_signatures_tolook.end(); it++) { - std::string prof_name = "Eff_" + it->first; - std::string prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; - addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); - } + // Book Shifter L1 histograms ***** + monGroupName = m_shifter_path + "/L1"; + addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); + // Basic L1 histograms + monFolderName = monGroupName + "/Primary"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addL1BasicHistograms(); + + // Efficiencies Shifter L1 histograms + monFolderName = monGroupName + "/Efficiency"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + met_signatures_tolook = m_l1_met_signatures_tolook_shifter; + addL1ProfileHistograms(met_signatures_tolook); - //*********************** - // Shifter HLT histograms - //*********************** - mongroupName = m_shifter_path + "/HLT"; - addMonGroup(new MonGroup(this, mongroupName.c_str(), run)); - setCurrentMonGroup(mongroupName); - - addHistogram(new TH1F("HLT_MEx", "HLT Missing E_{x};E_{x} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MEy", "HLT Missing E_{y};E_{y} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MET", "HLT |Missing E_{T}|;ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("HLT_SumEt", "HLT Sum |E_{T}|;SumE_{T} (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("HLT_MET_phi", "HLT MET #phi (rad);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_phi_etweight", "HLT MET #phi (|Missing E_{T}|);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_log", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_SumEt_log", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_MEz", "HLT Missing E_{z};E_{z} (GeV)", 100, -298.5,298.5)); - addHistogram(new TH1F("HLT_SumE", "HLT Sum |E|;SumE (GeV)", 153, -27., 18003.)); - addHistogram(new TH2F("HLT_MET_etaphi", "HLT MET #eta/#phi;#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH2F("HLT_MET_etaphi_etweight", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - /// Efficiencies for the HLT triggers - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string prof_name = "Eff_" + it->first; - std::string prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; - addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); - } - // Signal like electron and muon efficiency - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string name = it->first; - std::string mu_profname = "Eff_mu_"+name; - std::string mu_prof_title = mu_profname + " Efficiency Missing E_{T};ME_{T} (GeV) (Wmunu-like events)"; - addProfile(new TProfile(mu_profname.c_str(), mu_prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); - std::string el_profname = "Eff_el_"+name; - std::string el_prof_title = el_profname + " Efficiency Missing E_{T};ME_{T} (GeV) (Wenu-like events)"; - addProfile(new TProfile(el_profname.c_str(), el_prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); - } + // Book Shifter HLT histograms ***** + monGroupName = m_shifter_path + "/HLT"; + addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - // muon histograms - addHistogram(new TH1F("HLT_MEx_mu", "HLT Missing E_{x};E_{x} Signal-like #mu (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MEy_mu", "HLT Missing E_{y};E_{y} Signal-like #mu (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MET_mu", "HLT |Missing E_{T}|;ME_{T} Signal-like #mu (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("HLT_SumEt_mu", "HLT Sum |E_{T}|;SumE_{T} Signal-like #mu (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("HLT_MET_phi_mu", "HLT MET #phi (rad);#phi (rad) Signal-like #mu", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_phi_etweight_mu", "HLT MET #phi (|Missing E_{T}|);MET #phi (rad) Signal-like #mu", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_log_mu", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV) Signal-like #mu", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_SumEt_log_mu", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV) Signal-like #mu", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_MEz_mu", "HLT Missing E_{z};E_{z} (GeV) Signal-like #mu", 100, -298.5,298.5)); - addHistogram(new TH1F("HLT_SumE_mu", "HLT Sum |E|;SumE (GeV) Signal-like #mu", 153, -27., 18003.)); - //addHistogram(new TH2F("HLT_MET_etaphi_etweight_mu", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad) Signal-like #mu", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - // electron hsistograms - addHistogram(new TH1F("HLT_MEx_e", "HLT Missing E_{x};E_{x} Signal-like e (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MEy_e", "HLT Missing E_{y};E_{y} Signal-like e (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MET_e", "HLT |Missing E_{T}|;ME_{T} Signal-like e (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("HLT_SumEt_e", "HLT Sum |E_{T}|;SumE_{T} Signal-like e (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("HLT_MET_phi_e", "HLT MET #phi (rad);#phi (rad) Signal-like e", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_phi_etweight_e", "HLT MET #phi (|Missing E_{T}|);MET #phi (rad) Signal-like e", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_log_e", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV) Signal-like e", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_SumEt_log_e", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV) Signal-like e", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_MEz_e", "HLT Missing E_{z};E_{z} (GeV) Signal-like e", 100, -298.5,298.5)); - addHistogram(new TH1F("HLT_SumE_e", "HLT Sum |E|;SumE (GeV) Signal-like e", 153, -27., 18003.)); - //addHistogram(new TH2F("HLT_MET_etaphi_etweight_e", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad) Signal-like e", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - - - /// Alternative algorithms: tc_lcw, tc_em, pueta, pufit, mht, feb, fex - for (std::vector<std::string>::iterator it2 = m_monitoring_alg.begin(); it2 != m_monitoring_alg.end(); it2++) { - - std::string shifter_path_alg = mongroupName + "/" + *it2; - addMonGroup(new MonGroup(this, shifter_path_alg, run)); - setCurrentMonGroup(shifter_path_alg); - - addHistogram(new TH1F("HLT_MEx", "HLT Missing E_{x};E_{x} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MEy", "HLT Missing E_{y};E_{y} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MET", "HLT |Missing E_{T}|;ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("HLT_MET_lin1", "HLT |Missing E_{T}| (0-10 GeV);ME_{T} (GeV)", 110, -0.5, 10.5)); - addHistogram(new TH1F("HLT_SumEt", "HLT Sum |E_{T}|;SumE_{T} (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("HLT_MET_phi", "HLT MET #phi (rad);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_phi_etweight", "HLT MET #phi(|Missing E_{T}|);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MEx_log", "HLT Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MEy_log", "HLT Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MET_log", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_SumEt_log", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_MEz", "HLT Missing E_{z};E_{z} (GeV)", 100, -298.5,298.5)); - addHistogram(new TH1F("HLT_SumE", "HLT Sum |E|;SumE (GeV)", 153, -27., 18003.)); - addHistogram(new TH1F("HLT_MEz_log", "HLT Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)",27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_SumE_log", "HLT Sum |E|;log_{10}(SumE/GeV)",40, -1.875, 6.125)); - addHistogram(new TH2F("HLT_MET_etaphi", "HLT MET #eta/#phi;#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH2F("HLT_MET_etaphi_etweight", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - //addHistogram(new TH1F("HLT_XS", "HLT MET Significance;Significance (XS/GeV^{1/2})", 40, -0.025, 20.025)); - //addHLTStatusHistogram(); + // Basic HLT histograms + monFolderName = monGroupName + "/Primary"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addHLTBasicHistograms(); + + // Efficiencies Shifter HLT histograms + monFolderName = monGroupName + "/Efficiency"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + addHLTProfileHistograms(met_signatures_tolook); + + // mu50 histograms + monFolderName = monGroupName + "/mu50"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addHLTBasicHistograms(); + + // Signal like electron histograms + monFolderName = monGroupName + "/SignalEl"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addHLTBasicHistograms(); + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + addHLTProfileHistograms(met_signatures_tolook); + + // Signal like muon histograms + monFolderName = monGroupName + "/SignalMu"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addHLTBasicHistograms(); + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + addHLTProfileHistograms(met_signatures_tolook); + + // HLT cell status histograms + monFolderName = monGroupName + "/Status"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addHLTStatusHistograms(); + + /// Alternative algorithms: tc_lcw, tc_em, pueta, pufit, mht, etc. + for (std::vector<std::string>::iterator it2 = m_monitoring_alg_shifter.begin(); it2 != m_monitoring_alg_shifter.end(); it2++) { + + monFolderName = monGroupName + "/" + *it2; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + + addHLTBasicHistograms(); } @@ -269,137 +276,110 @@ StatusCode HLTMETMonTool::book() { if (!m_make_expert_histograms) return StatusCode::SUCCESS; - - //########################## - //-- Book Expert histograms - //########################## - //********************** - /// Expert L1 histograms - //********************** - /// No trigger requirement - std::string monGroupName = m_expert_path + "/L1"; + // Book Expert L1 histograms *************** + monGroupName = m_expert_path + "/L1"; addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - addHistogram(new TH1F("L1_METx_log", "L1 Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 55, -4.125, 4.125)); - addHistogram(new TH1F("L1_METy_log", "L1 Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 55, -4.125, 4.125)); - //addHistogram(new TH1F("L1_MET", "L1 MET (GeV);MET (GeV)", m_et_bins, m_et_min, m_et_max)); - //addHistogram(new TH1F("L1_MET_phi", "L1 MET #phi (rad);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); + // Jets Expert L1 histograms + monFolderName = monGroupName + "/Jets"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + addL1JetHistograms(); + // Efficiencies Expert L1 histograms + monFolderName = monGroupName + "/Efficiency"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + met_signatures_tolook = m_l1_met_signatures_tolook_expert; + addL1ProfileHistograms(met_signatures_tolook); - /// With trigger rquirement: L1_XE50 etc. - for (it = m_l1_met_signatures_tolook.begin(); it != m_l1_met_signatures_tolook.end(); it++) { + // With trigger rquirement: L1_XE50 etc. + for (it = m_l1_met_signatures_tolook_shifter.begin(); it != m_l1_met_signatures_tolook_shifter.end(); it++) { - std::string trigger_path = monGroupName + "/" + it->first; + monFolderName = monGroupName + "/" + it->first; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); - //declare a group of histograms - addMonGroup(new MonGroup(this, trigger_path, run)); - setCurrentMonGroup(trigger_path); - - addHistogram(new TH1F("L1_MET", "L1 MET (GeV);MET (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("L1_METx", "L1 Missing E_{x};E_{x} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("L1_METy", "L1 Missing E_{y};E_{y} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("L1_SumEt", "L1 SumEt (GeV);SumEt (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("L1_MET_phi", "L1 MET #phi (rad);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_MET_phi_etweight", "L1 MET #phi (|Missing E_{T}|);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_MET_log", "L1 |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 40, -1.875, 4.125)); - addHistogram(new TH1F("L1_METx_log", "L1 Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 55, -4.125, 4.125)); - addHistogram(new TH1F("L1_METy_log", "L1 Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 55, -4.125, 4.125)); - addHistogram(new TH1F("L1_SumEt_log", "L1 Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 40, -1.875, 4.125)); + addL1BasicHistograms(); } - //*********************** - // Expert HLT histpograms - //*********************** - /// HLT No specific trigger requirement + // Book Expert HLT histpograms *********** monGroupName = m_expert_path + "/HLT"; addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - addHistogram(new TH1F("HLT_MEx_log", "HLT Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MEy_log", "HLT Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MET_lin1", "HLT |Missing E_{T}| (0-10 GeV);ME_{T} (GeV)", 110, -0.5, 10.5)); - //addHistogram(new TH1F("HLT_MET_phi_etweight", "HLT MET #phi(|Missing E_{T}|);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MEz_log", "HLT Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)",27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_SumE_log", "HLT Sum |E|;log_{10}(SumE/GeV)",40, -1.875, 6.125)); - addHistogram(new TH1F("HLT_XS", "HLT MET Significance;Significance (XS/GeV^{1/2})", 40, -0.025, 20.025)); - addHLTStatusHistogram(); + + // Efficiencies Expert HLT histograms + monFolderName = monGroupName + "/Efficiency"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + met_signatures_tolook = m_hlt_met_signatures_tolook_expert; + addHLTProfileHistograms(met_signatures_tolook); + + /// HLT cell component histograms + monFolderName = monGroupName + "/Component"; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); addHLTCompHistograms(); - - /// With trigger requiriment: xe35, xe80, xe100 etc. - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - - std::string expert_path_trigger = monGroupName + "/" + it->first; - addMonGroup(new MonGroup(this, expert_path_trigger, run)); - setCurrentMonGroup(expert_path_trigger); - - addHistogram(new TH1F("HLT_MEx", "HLT Missing E_{x};E_{x} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MEy", "HLT Missing E_{y};E_{y} (GeV)", 199, -298.5, 298.5)); - addHistogram(new TH1F("HLT_MET", "HLT |Missing E_{T}|;ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("HLT_MET_lin1", "HLT |Missing E_{T}| (0-10 GeV);ME_{T} (GeV)", 110, -0.5, 10.5)); - addHistogram(new TH1F("HLT_SumEt", "HLT Sum |E_{T}|;SumE_{T} (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("HLT_MET_phi", "HLT MET #phi (rad);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MET_phi_etweight", "HLT MET #phi(|Missing E_{T}|);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_MEx_log", "HLT Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MEy_log", "HLT Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_MET_log", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_SumEt_log", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 20, -1.875, 4.125)); - addHistogram(new TH1F("HLT_MEz", "HLT Missing E_{z};E_{z} (GeV)", 100, -298.5,298.5)); - addHistogram(new TH1F("HLT_SumE", "HLT Sum |E|;SumE (GeV)", 153, -27., 18003.)); - addHistogram(new TH1F("HLT_MEz_log", "HLT Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)",27, -4.125, 4.125)); - addHistogram(new TH1F("HLT_SumE_log", "HLT Sum |E|;log_{10}(SumE/GeV)",40, -1.875, 6.125)); - addHistogram(new TH2F("HLT_MET_etaphi", "HLT MET #eta/#phi;#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH2F("HLT_MET_etaphi_etweight", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad)", 24, -4.8, 4.8, m_phi_bins, m_phi_min, m_phi_max)); - //addHistogram(new TH1F("HLT_XS", "HLT MET Significance;Significance (XS/GeV^{1/2})", 40, -0.025, 20.025)); - //addHLTStatusHistogram(); + + // Alternative algorithms: tc_lcw, tc_em, pueta, pufit, mht, etc. + for (std::vector<std::string>::iterator it2 = m_monitoring_alg_expert.begin(); it2 != m_monitoring_alg_expert.end(); it2++) { + + monFolderName = monGroupName + "/" + *it2; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + + addHLTBasicHistograms(); } - - /// Offline MET - monGroupName = m_expert_path + "/Offline"; - addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - setCurrentMonGroup(monGroupName); - addHistogram(new TH1F("Offline_MET", "Offline MET;Et", m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH1F("Offline_METx", "Offline METx;Et", 199, -298.5, 298.5)); - addHistogram(new TH1F("Offline_METy", "Offline METy;Et", 199, -298.5, 298.5)); - addHistogram(new TH1F("Offline_SumEt", "Offline SumEt;sumEt", m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH1F("Offline_MET_phi", "Offline MET phi;Phi", m_phi_bins, m_phi_min, m_phi_max)); + + // With trigger requiriment: xe35, xe80, xe100 etc. + for (it = m_hlt_met_signatures_tolook_shifter.begin(); it != m_hlt_met_signatures_tolook_shifter.end(); it++) { - /// L1/HLT correlations and difference: XE35 vs xe35 and XE60 vs xe80 - monGroupName = m_expert_path + "/L1_vs_HLT"; - addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - setCurrentMonGroup(monGroupName); + monFolderName = monGroupName + "/" + it->first; + addMonGroup(new MonGroup(this, monFolderName, run)); + setCurrentMonGroup(monFolderName); + + addHLTBasicHistograms(); + + } + + monGroupName = m_expert_path; + + // Book Offline MET histograms ********* + monFolderName = monGroupName + "/Offline"; + addMonGroup(new MonGroup(this, monFolderName.c_str(), run)); + setCurrentMonGroup(monFolderName); + addOffMETHistograms(); + + + // Book L1 vs HLT histograms *********** + monFolderName = monGroupName + "/L1_vs_HLT"; + addMonGroup(new MonGroup(this, monFolderName.c_str(), run)); + setCurrentMonGroup(monFolderName); addL1vsHLTHistograms(); - /// HLT/Offline correlations and differences - monGroupName = m_expert_path + "/HLT_vs_Offline"; - addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - setCurrentMonGroup(monGroupName); + + + // Book HLT vs Offline histograms ******** + monFolderName = monGroupName + "/HLT_vs_Offline"; + addMonGroup(new MonGroup(this, monFolderName.c_str(), run)); + setCurrentMonGroup(monFolderName); addHLTvsOffHistograms(); - /// L1/Offline correlations and differences - monGroupName = m_expert_path + "/L1_vs_Offline"; - addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - setCurrentMonGroup(monGroupName); + + // Book L1 vs Offline histograms ******** + monFolderName = monGroupName + "/L1_vs_Offline"; + addMonGroup(new MonGroup(this, monFolderName.c_str(), run)); + setCurrentMonGroup(monFolderName); addL1vsOffHistograms(); - /// HLT Muons and Electrons - // muon histograms - monGroupName = m_expert_path + "/ElMu"; - addMonGroup(new MonGroup(this, monGroupName.c_str(), run)); - setCurrentMonGroup(monGroupName); - //int etabins = 14; double etamin = -2.8; double etamax = 2.8; - //addHistogram(new TH1F("HLT_base_muon_pt", "HLT muon p_{T};p_{T} (GeV)", m_et_bins, m_et_min, m_et_max)); - //addHistogram(new TH1F("HLT_base_muon_phi", "HLT muon phi;#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); - //addHistogram(new TH1F("HLT_base_muon_eta", "HLT muon eta;#eta", etabins, etamin, etamax)); - // muon histograms - addHistogram(new TH1F("HLT_electronpt", "HLT Electron Pt (GeV)", 50, 0, 100)); - //addHistogram(new TH1F("HLT_electroneta", "HLT Electron Eta", 25, -5, 5)); - addHistogram(new TH1F("HLT_electronmult", "HLT Electron Multiplicity", 10, 0, 10)); - // electron histograms - addHistogram(new TH1F("HLT_muonpt", "HLT Muon Pt (GeV)", 200, 0, 100)); - //addHistogram(new TH1F("HLT_muoneta", "HLT Muon Eta", 25, -5, -5)); - addHistogram(new TH1F("HLT_muonmult", "HLT Muon Multiplicity", 10, 0, 10)); + // Book HLT Muons and Electrons histograms ******** + monFolderName = monGroupName + "/ElMu"; + addMonGroup(new MonGroup(this, monFolderName.c_str(), run)); + setCurrentMonGroup(monFolderName); + addElMuHistograms(); return StatusCode::SUCCESS; } @@ -427,8 +407,7 @@ StatusCode HLTMETMonTool::fill() { StatusCode HLTMETMonTool::proc() { std::string eff_name; - std::string mongroupName; - //TH1 *h_numerator; + std::string monGroupName; ATH_MSG_DEBUG("in HLTMETMonTool::proc()"); @@ -436,180 +415,18 @@ StatusCode HLTMETMonTool::proc() { print_trigger_stats(); // efficiency histo shifter/L1 - - mongroupName = m_shifter_path + "/L1"; - setCurrentMonGroup(mongroupName); - - - //eff_name = "Effh_" + m_numerator_trigger[0]; - //h_numerator = trig_eff_num[0]; - //h_numerator->Sumw2(); - //h_denominator->Sumw2(); - //if(h_denominator->GetEntries() != 0) { - // ATH_MSG_DEBUG(" performing division "); - //hist(eff_name)->Divide(h_numerator, h_denominator); - //} + monGroupName = m_shifter_path + "/L1"; + setCurrentMonGroup(monGroupName); // efficiency histos shifter/HLT - - mongroupName = m_shifter_path + "/HLT"; - setCurrentMonGroup(mongroupName); - - - //for (int i_eff = 1; i_eff < 4; i_eff++){ - //eff_name = "Effh_" + m_numerator_trigger[i_eff]; - //hist(eff_name)->Divide(trig_eff_num[i_eff], h_denominator); - //ATH_MSG_DEBUG("in HLTMETMonTool::proc() filling efficiency for trigger " << m_numerator_trigger[i_eff]); - //} - + monGroupName = m_shifter_path + "/HLT"; + setCurrentMonGroup(monGroupName); return StatusCode::SUCCESS; } -//___________________________________________________________________________________________________________ -void HLTMETMonTool::addHLTCompHistograms() { - - // HLT MET all components in one 2d histogram - float fMaxEFC = float(m_compNames.size()); - fMaxEFC -= 0.5; - int fBinEFC = int(m_compNames.size()); - TH2F *h2f[10] = {0}; - h2f[0] = new TH2F("compN_compEx", "HLT MissingE_{x} VS component;;sgn(ME_{x}) log_{10}(E_{x}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); - h2f[1] = new TH2F("compN_compEy", "HLT Missing E_{y} VS component;;sgn(ME_{y}) log_{10}(E_{y}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); - h2f[2] = new TH2F("compN_compEz", "HLT Missing E_{z} VS component;;sgn(ME_{z}) log_{10}(E_{z}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); - h2f[3] = new TH2F("compN_compEt", "HLT MissingE_{T} VS component;;sgn(ME_{T}) log_{10}(ME_{T}/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); - h2f[4] = new TH2F("compN_compSumEt", "HLT Sum |E_{T}| VS component;;log_{10}(SumE_{T}/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); - h2f[5] = new TH2F("compN_compSumE", "HLT Sum |E| VS component;;log_{10}(SumE/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); - h2f[6] = new TH2F("compN_compEt_lin", "HLT MissingE_{T} VS component;;ME_{T} (GeV)", fBinEFC, -0.5, fMaxEFC, 102, -13.5, 601.5); - h2f[7] = new TH2F("compN_compSumEt_lin", "HLT Sum |E_{T}| VS component;;SumE_{T} (GeV)", fBinEFC, -0.5, fMaxEFC, 236, -30, 2802); - h2f[8] = new TH2F("compN_HLT_MET_status", "HLT MET Status VS component;;", fBinEFC, -0.5, fMaxEFC,32, -0.5, 31.5); - h2f[9] = new TH2F("compN_HLT_usedChannels", "HLT Used Channels VS component;;log_{10}(N > 0)", fBinEFC, -0.5, fMaxEFC,13,-0.5,6.0); - - for (size_t k = 0; k < 10; k++) { // 10 hists - for (size_t cn = 0; cn < m_compNames.size(); cn++) { // 25 bins - if(cn < m_compNames.size()) h2f[k]->GetXaxis()->SetBinLabel(cn+1, m_compNames[cn].c_str()); - } - // for status v. component, set bin labels for Y axis - if (k == 8) { - for (size_t j = 0; j < m_bitNames.size(); j++) { - if(j < m_bitNames.size()) h2f[k]->GetYaxis()->SetBinLabel(j+1, m_bitNames[j].c_str()); - } - h2f[k]->GetYaxis()->SetLabelFont(42); - h2f[k]->GetYaxis()->SetLabelOffset(0.002); - h2f[k]->GetYaxis()->SetLabelSize(0.03); - } - if (k == 9) { - // 10^x (x = 0.5, 1.0 1.5 ....) - /*std::string binlb_nc[13] = { "none", "[0-3]", "[4-9]", "[10-31]", - "[32-99]", "[100-316]", "[317-999]", "[1-3.16]10^{3}", "[0.32 - 1]10^{4}", - "[1 - 3.2]10^{4}", "[0.32 - 1]10^{5}", "[1 - 3.2]10^{5}", "[0.32 - 1]10^{6}" }; - for(size_t l = 0; l < 13; l++) {*/ - h2f[k]->GetYaxis()->SetBinLabel(1,"none"); - //} - } - addHistogram(h2f[k]); - } - - int phibins = 16; double phimin = m_phi_min; double phimax = m_phi_max; - int etabins = 24; double etamin = -4.8; double etamax = 4.8; - - for (unsigned int j = 0; j < m_compNames.size(); j++) { - std::string name = Form("compN_EtaPhi_%02d", j); - std::string title = m_compNames[j]; - title += ": N(#eta, #phi);#eta;#phi [rad];"; - TH2F* h = new TH2F(name.c_str(), title.c_str(), etabins, etamin, etamax, phibins, phimin, phimax); - addHistogram(h); - - name = Form("compEt_lin_EtaPhi_%02d", j); - title = m_compNames[j]; - title += ": MissingE_{T}(#eta, #phi); #eta; #phi [rad];ME_{T}/GeV"; - h = new TH2F(name.c_str(), title.c_str(), etabins, etamin, etamax, phibins, phimin, phimax); - addHistogram(h); - - name = Form("compSumEt_lin_EtaPhi_%02d", j); - title = m_compNames[j]; - title += ": Sum |E_{T}|(#eta, #phi); #eta; #phi [rad];Sum|E_{T}|/GeV"; - h = new TH2F(name.c_str(), title.c_str(), etabins, etamin, etamax, phibins, phimin, phimax); - addHistogram(h); - - name = Form("compSumE_lin_EtaPhi_%02d", j); - title = m_compNames[j]; - title += ": Sum |E|(#eta, #phi); #eta; #phi [rad];Sum|E|/GeV"; - h = new TH2F(name.c_str(), title.c_str(), etabins, etamin, etamax, phibins, phimin, phimax); - addHistogram(h); - - } - -} - -//___________________________________________________________________________________________________________ -void HLTMETMonTool::addHLTStatusHistogram() { - TH1F *h1i = new TH1F("HLT_MET_status", "HLT MET Status", 32, -0.5, 31.5); - for (size_t j = 0; j < m_bitNames.size(); j++) { - if(j < m_bitNames.size()) h1i->GetXaxis()->SetBinLabel(j+1, m_bitNames[j].c_str()); - } - addHistogram(h1i); -} - -//___________________________________________________________________________________________________________ -void HLTMETMonTool::addL1vsHLTHistograms() { - - // Correlation - addHistogram(new TH2F("L1_HLT_EtCor", "L1 vs HLT Missing E_{T} ; HLTME_{T} (GeV); L1ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH2F("L1_HLT_SumEtCor", "L1 vs HLT Sum |E_{T}| ; HLTSum|E_{T}| (GeV); L1Sum|E_{T}| (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH2F("L1_HLT_PhiCor", "L1 vs HLT #phi ; EF #phi (rad); L1 #phi (rad)", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); - - // Differences - addHistogram(new TH1F("L1_HLT_dEt", "#DeltaE_{T}(L1-HLT) ; #DeltaE_{T} (GeV)", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("L1_HLT_dPhi", "#Delta#phi(L1-HLT) ; #Delta#phi (GeV)", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_HLT_dEx", "#DeltaE_{x}(L1-HLT) ; #DeltaE_{x} (GeV)", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("L1_HLT_dEy", "#DeltaE_{y}(L1-HLT) ; #DeltaE_{y} (GeV)", m_det_bins, m_det_min, m_det_max)); - -} - -//___________________________________________________________________________________________________________ -void HLTMETMonTool::addHLTvsOffHistograms() { - - addHistogram(new TH2F("HLT_Off_EtCor", "EtCor_HLTMET_OffMET; Offline MET ; HLT MET", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH2F("HLT_Off_SumEtCor", "SumEtCor_HLTMET_OffMET; Offline SumEt ; HLT SumEt", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH2F("HLT_Off_PhiCor", "PhiCor_HLTMET_OffMET; Offline #phi ; HLT #phi", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_Off_dEt", "dEt_HLTMET_OffMET; dEt", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("HLT_Off_dPhi", "dPhi_HLTMET_OffMET; dPhi", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("HLT_Off_dEx", "dEx_HLTMET_OffMET; dEx", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("HLT_Off_dEy", "dEy_HLTMET_OffMET; dEy", m_det_bins, m_det_min, m_det_max)); -} - -//___________________________________________________________________________________________________________ -void HLTMETMonTool::addL1vsOffHistograms() { - - addHistogram(new TH2F("L1_Off_EtCor", "EtCor_L1MET_OffMET; Offline MET ; L1 MET", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); - addHistogram(new TH2F("L1_Off_SumEtCor", "SumEtCor_L1MET_OffMET; Offline SumEt ; L1 SumEt", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); - addHistogram(new TH2F("L1_Off_PhiCor", "PhiCor_L1MET_OffMET; Offline #phi ; L1 #phi", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_Off_dEt", "dEt_L1MET_OffMET; dEt", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("L1_Off_dPhi", "dPhi_L1MET_OffMET; dPhi", m_phi_bins, m_phi_min, m_phi_max)); - addHistogram(new TH1F("L1_Off_dEx", "dEx_L1MET_OffMET; dEx", m_det_bins, m_det_min, m_det_max)); - addHistogram(new TH1F("L1_Off_dEy", "dEy_L1MET_OffMET; dEy", m_det_bins, m_det_min, m_det_max)); -} -//___________________________________________________________________________________________________________ -void HLTMETMonTool::trigger_decision() { - std::vector<std::map<std::string,int>> met_signatures_tolook; - met_signatures_tolook.push_back(m_l1_met_signatures_tolook); - met_signatures_tolook.push_back(m_hlt_met_signatures_tolook); - - if (m_print_met_trig_stats) { - std::map<std::string,int>::iterator iter; - for (unsigned int i = 0; i<met_signatures_tolook.size(); i++) { - for (iter = met_signatures_tolook[i].begin(); iter != met_signatures_tolook[i].end(); ++iter) { - std::string name = iter->first; - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - iter->second +=1; - } - } - } - } -} //___________________________________________________________________________________________________________ StatusCode HLTMETMonTool::fillMETHist() { @@ -625,140 +442,195 @@ StatusCode HLTMETMonTool::fillMETHist() { } - // retrieve xAOD L1 ROI - const xAOD::EnergySumRoI *l1_roi_cont = 0; - sc = evtStore()->retrieve(l1_roi_cont, m_lvl1_roi_key); - if(sc.isFailure() || !l1_roi_cont) { + // retrieve EventInfo + const xAOD::EventInfo *eventInfo = nullptr; + sc = evtStore()->retrieve(eventInfo, "EventInfo"); + if(sc.isFailure() || !eventInfo) { + ATH_MSG_WARNING("Could not retrieve EventInfo with key \"EventInfo\" from TDS" ); + } + + // retrieve L1 Jet ROI + const xAOD::JetRoIContainer *v_l1_jet_roi_cont = 0; + sc = evtStore()->retrieve(v_l1_jet_roi_cont, m_lvl1_jet_roi_key); + if(sc.isFailure() || !v_l1_jet_roi_cont) { + ATH_MSG_WARNING("Could not retrieve LVL1_Jet_RoIs with key \"" << m_lvl1_jet_roi_key << "\" from TDS" ); + } + + // retrieve xAOD L1 ROI + const xAOD::EnergySumRoI *v_l1_roi_cont = 0; + sc = evtStore()->retrieve(v_l1_roi_cont, m_lvl1_roi_key); + if(sc.isFailure() || !v_l1_roi_cont) { ATH_MSG_WARNING("Could not retrieve LVL1_RoIs with key \"" << m_lvl1_roi_key << "\" from TDS" ); } // retrieve HLT containers // Get HLT (CELL) container - const xAOD::TrigMissingETContainer *hlt_cell_met_cont = 0; - sc = evtStore()->retrieve(hlt_cell_met_cont, m_hlt_cell_met_key); - if (sc.isFailure() || !hlt_cell_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_cell_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_cell_met_cont, m_hlt_cell_met_key); + if (sc.isFailure() || !v_hlt_cell_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_cell_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met (cell) with " << hlt_cell_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met (cell) with " << v_hlt_cell_met_cont->size() << " elements"); // Get HLT mht container - const xAOD::TrigMissingETContainer *hlt_mht_met_cont = 0; - sc = evtStore()->retrieve(hlt_mht_met_cont, m_hlt_mht_met_key); - if (sc.isFailure() || !hlt_mht_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_mht_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_mht_met_cont, m_hlt_mht_met_key); + if (sc.isFailure() || !v_hlt_mht_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_mht_met_key << " from TDS"); } else { - ATH_MSG_DEBUG("Accessing met(mht) with " << hlt_mht_met_cont->size() << " elements"); - //std::cout << "Found mht = " << m_hlt_mht_met_key << std::endl; + ATH_MSG_DEBUG("Accessing met(mht) with " << v_hlt_mht_met_cont->size() << " elements"); } // Get HLT mhtem container - const xAOD::TrigMissingETContainer *hlt_mhtem_met_cont = 0; - sc = evtStore()->retrieve(hlt_mhtem_met_cont, m_hlt_mhtem_met_key); - if (sc.isFailure() || !hlt_mhtem_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_mhtem_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_mhtem_met_cont, m_hlt_mhtem_met_key); + if (sc.isFailure() || !v_hlt_mhtem_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_mhtem_met_key << " from TDS"); } else { - ATH_MSG_DEBUG("Accessing met(mhtem) with " << hlt_mhtem_met_cont->size() << " elements"); - //std::cout << "Found mhtem = " << m_hlt_mhtem_met_key << std::endl; + ATH_MSG_DEBUG("Accessing met(mhtem) with " << v_hlt_mhtem_met_cont->size() << " elements"); } // Get HLT trkmht container - const xAOD::TrigMissingETContainer *hlt_trkmht_met_cont = 0; - sc = evtStore()->retrieve(hlt_trkmht_met_cont, m_hlt_trkmht_met_key); - if (sc.isFailure() || !hlt_trkmht_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_trkmht_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_trkmht_met_cont, m_hlt_trkmht_met_key); + if (sc.isFailure() || !v_hlt_trkmht_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_trkmht_met_key << " from TDS"); } else { - ATH_MSG_DEBUG("Accessing met(trkmht) with " << hlt_trkmht_met_cont->size() << " elements"); - //std::cout << "Found trkmht = " << m_hlt_trkmht_met_key << std::endl; + ATH_MSG_DEBUG("Accessing met(trkmht) with " << v_hlt_trkmht_met_cont->size() << " elements"); } // Get HLT trkmhtFTK container - const xAOD::TrigMissingETContainer *hlt_trkmhtFTK_met_cont = 0; - sc = evtStore()->retrieve(hlt_trkmhtFTK_met_cont, m_hlt_trkmhtFTK_met_key); - if (sc.isFailure() || !hlt_trkmhtFTK_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_trkmhtFTK_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_trkmhtFTK_met_cont, m_hlt_trkmhtFTK_met_key); + if (sc.isFailure() || !v_hlt_trkmhtFTK_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_trkmhtFTK_met_key << " from TDS"); } else { - ATH_MSG_DEBUG("Accessing met(trkmhtFTK) with " << hlt_trkmhtFTK_met_cont->size() << " elements"); - //std::cout << "Found trkmhtFTK = " << m_hlt_trkmhtFTK_met_key << std::endl; + ATH_MSG_DEBUG("Accessing met(trkmhtFTK) with " << v_hlt_trkmhtFTK_met_cont->size() << " elements"); } // Get HLT topocl container - const xAOD::TrigMissingETContainer *hlt_topocl_met_cont = 0; - sc = evtStore()->retrieve(hlt_topocl_met_cont, m_hlt_topocl_met_key); - if (sc.isFailure() || !hlt_topocl_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_topocl_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_topocl_met_cont, m_hlt_topocl_met_key); + if (sc.isFailure() || !v_hlt_topocl_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_topocl_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met(topcl) with " << hlt_topocl_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met(topcl) with " << v_hlt_topocl_met_cont->size() << " elements"); // Get HLT topocl_PS container - const xAOD::TrigMissingETContainer *hlt_topocl_PS_met_cont = 0; - sc = evtStore()->retrieve(hlt_topocl_PS_met_cont, m_hlt_topocl_PS_met_key); - if (sc.isFailure() || !hlt_topocl_PS_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_topocl_PS_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_topocl_PS_met_cont, m_hlt_topocl_PS_met_key); + if (sc.isFailure() || !v_hlt_topocl_PS_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_topocl_PS_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met(topocl_PS) with " << hlt_topocl_PS_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met(topocl_PS) with " << v_hlt_topocl_PS_met_cont->size() << " elements"); // Get HLT topocl_PUC container - const xAOD::TrigMissingETContainer *hlt_topocl_PUC_met_cont = 0; - sc = evtStore()->retrieve(hlt_topocl_PUC_met_cont, m_hlt_topocl_PUC_met_key); - if (sc.isFailure() || !hlt_topocl_PUC_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_topocl_PUC_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_topocl_PUC_met_cont, m_hlt_topocl_PUC_met_key); + if (sc.isFailure() || !v_hlt_topocl_PUC_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_topocl_PUC_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met(topocl_PUC) with " << hlt_topocl_PUC_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met(topocl_PUC) with " << v_hlt_topocl_PUC_met_cont->size() << " elements"); // Get HLT FEB container - const xAOD::TrigMissingETContainer *hlt_FEB_met_cont = 0; - sc = evtStore()->retrieve(hlt_FEB_met_cont, m_hlt_FEB_met_key); - if (sc.isFailure() || !hlt_FEB_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_FEB_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_FEB_met_cont, m_hlt_FEB_met_key); + if (sc.isFailure() || !v_hlt_FEB_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_FEB_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met(FEB) with " << hlt_FEB_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met(FEB) with " << v_hlt_FEB_met_cont->size() << " elements"); // Get HLT Fex container - const xAOD::TrigMissingETContainer *hlt_Fex_met_cont = 0; - sc = evtStore()->retrieve(hlt_Fex_met_cont, m_hlt_Fex_met_key); - if (sc.isFailure() || !hlt_Fex_met_cont) { + const xAOD::TrigMissingETContainer *v_hlt_Fex_met_cont = 0; + sc = evtStore()->retrieve(v_hlt_Fex_met_cont, m_hlt_Fex_met_key); + if (sc.isFailure() || !v_hlt_Fex_met_cont) { ATH_MSG_WARNING("Could not retrieve TrigMissingETContainer with key " << m_hlt_Fex_met_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing met(Fex) with " << hlt_Fex_met_cont->size() << " elements"); + ATH_MSG_DEBUG("Accessing met(Fex) with " << v_hlt_Fex_met_cont->size() << " elements"); // Get EF muon and EF egamma containers for signal-like selection // retrieve EF muon container - const xAOD::MuonContainer *hlt_muonEFcontainer = 0; - sc = evtStore()->retrieve(hlt_muonEFcontainer, m_muon_key); - if (sc.isFailure() || !hlt_muonEFcontainer) { + const xAOD::MuonContainer *v_hlt_muonEFcontainer = 0; + sc = evtStore()->retrieve(v_hlt_muonEFcontainer, m_muon_key); + if (sc.isFailure() || !v_hlt_muonEFcontainer) { ATH_MSG_WARNING("Could not retrieve muon container with key " << m_muon_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing EF muons container with " << hlt_muonEFcontainer->size() << " elements"); + ATH_MSG_DEBUG("Accessing EF muons container with " << v_hlt_muonEFcontainer->size() << " elements"); // retrieve EF electron container - const xAOD::ElectronContainer *hlt_electronEFcontainer = 0; - sc = evtStore()->retrieve(hlt_electronEFcontainer, m_electron_key); - if (sc.isFailure() || !hlt_electronEFcontainer) { + const xAOD::ElectronContainer *v_hlt_electronEFcontainer = 0; + sc = evtStore()->retrieve(v_hlt_electronEFcontainer, m_electron_key); + if (sc.isFailure() || !v_hlt_electronEFcontainer) { ATH_MSG_WARNING("Could not retrieve electron container with key " << m_electron_key << " from TDS"); } else - ATH_MSG_DEBUG("Accessing EF electrons container with " << hlt_electronEFcontainer->size() << " elements"); + ATH_MSG_DEBUG("Accessing EF electrons container with " << v_hlt_electronEFcontainer->size() << " elements"); // Get Offline MET container - const xAOD::MissingETContainer *off_met_cont = 0; - sc = evtStore()->retrieve(off_met_cont, m_off_met_key); - if (sc.isFailure() || !off_met_cont) { - ATH_MSG_DEBUG("Could not retrieve Reconstructed MET term with Key " << m_off_met_key << " : off_met_cont = 0"); - } - else { + const xAOD::MissingETContainer *v_off_met_cont = 0; + sc = evtStore()->retrieve(v_off_met_cont, m_off_met_key); + if (sc.isFailure() || !v_off_met_cont) { + ATH_MSG_DEBUG("Could not retrieve Reconstructed MET term with Key " << m_off_met_key << " : v_off_met_cont = 0"); + } else { ATH_MSG_DEBUG("Got Reconstructed MET term with key " << m_off_met_key); } + + + // Check if signal-like muon exists + ATH_MSG_DEBUG("Going to iterate through muon container"); + bool METMuonFilled = false; // flag is set to true if event satisfies signal-like requirement + float pT_mumu = 0; + bool muonContEmpty = true; + if (v_hlt_muonEFcontainer && v_hlt_muonEFcontainer->size()>0) { + ATH_MSG_DEBUG("HLT EF Muon container exists and is not empty. Going to loop over container."); + muonContEmpty = false; + std::vector<TLorentzVector> muonCollection; + for (auto muon : *v_hlt_muonEFcontainer) { + // If a muon in this event satifies the requirements, we will fill in MET for this event. + if(muon->muonType() == xAOD::Muon::Combined && (muon->pt()/CLHEP::GeV > m_muon_pt_thresh)) { + METMuonFilled = true; + muonCollection.push_back(muon->p4()); + } + } + std::sort(muonCollection.begin(),muonCollection.end(),High2LowByPt()); + if(muonCollection.size()>=2)pT_mumu = (muonCollection.at(0)+muonCollection.at(1)).Perp()/CLHEP::GeV; + muonCollection.clear(); + } else { + ATH_MSG_DEBUG("HLT EF Muon container DNE or is empty"); + } + + // Check if signal-like electron exists + ATH_MSG_DEBUG("Going to iterate through electron container"); + bool METElectronFilled = false; + bool electronEtaReq = false; + bool electronContEmpty = true; + if (v_hlt_electronEFcontainer && v_hlt_electronEFcontainer->size()>0) { + ATH_MSG_DEBUG("HLT EF electron container exists and is not empty. Going to loop over container."); + //ATH_MSG_INFO("HLT EF electron container exists and is not empty. Going to loop over container."); + electronContEmpty = false; + for (auto eg : *v_hlt_electronEFcontainer) { + + electronEtaReq = ( fabsf(eg->eta()) < 1.37 || fabsf(eg->eta()) > 1.52 ) && fabsf(eg->eta()) < 2.47; + + if (eg->pt()/CLHEP::GeV > m_electron_pt_thresh && electronEtaReq) { + METElectronFilled = true; + } + } + } else { + ATH_MSG_DEBUG("HLT EF electron container DNE or is empty"); + } + ATH_MSG_DEBUG("Filling histograms..."); @@ -766,8 +638,15 @@ StatusCode HLTMETMonTool::fillMETHist() { //#################### //-- Get met values //#################### - const xAOD::TrigMissingET *hlt_met_obj = 0; - const xAOD::MissingET *off_met_obj = 0; + const xAOD::TrigMissingET *v_hlt_met = 0; + const xAOD::MissingET *v_off_met = 0; + + //*********** + /// L1 JET + //*********** + float l1_jet_pt = -9e9; + float l1_jet_eta = -9e9; + //*********** /// L1 MET @@ -784,19 +663,21 @@ StatusCode HLTMETMonTool::fillMETHist() { float l1_mey_log = -9e9; float l1_met_log = -9e9; float l1_sumet_log = -9e9; + float saturated = false; - if (l1_roi_cont) { - if ((l1_roi_cont->energyX())>-9e12 && (l1_roi_cont->energyX())<9e12 && (l1_roi_cont->energyY())>-9e12 && (l1_roi_cont->energyY())<9e12) { - l1_mex = - (l1_roi_cont->energyX())/CLHEP::GeV; - l1_mey = - (l1_roi_cont->energyY())/CLHEP::GeV; + if (v_l1_roi_cont) { + if ((v_l1_roi_cont->energyX())>-9e12 && (v_l1_roi_cont->energyX())<9e12 && (v_l1_roi_cont->energyY())>-9e12 && (v_l1_roi_cont->energyY())<9e12) { + l1_mex = - (v_l1_roi_cont->energyX())/CLHEP::GeV; + l1_mey = - (v_l1_roi_cont->energyY())/CLHEP::GeV; l1_met = sqrt(l1_mex*l1_mex + l1_mey*l1_mey); l1_phi = atan2f(l1_mey,l1_mex); - l1_sumet = (l1_roi_cont->energyT())/CLHEP::GeV; + l1_sumet = (v_l1_roi_cont->energyT())/CLHEP::GeV; l1_mex_log = signed_log(l1_mex, epsilon); l1_mey_log = signed_log(l1_mey, epsilon); l1_met_log = signed_log(l1_met, epsilon); l1_sumet_log = signed_log(l1_sumet, epsilon); + saturated = (fabs(l1_mex)>16383 || fabs(l1_mey)>16383 ); //this is a hacked way to see if Ex/Ey saturated. There may be better. } else { ATH_MSG_WARNING("L1 POI enegy too large"); } @@ -822,30 +703,57 @@ StatusCode HLTMETMonTool::fillMETHist() { float hlt_significance = -9e9; - //###################################################### - //##### Set main trigger Algorithm #################### - //###################################################### - //if (hlt_cell_met_cont && hlt_cell_met_cont->size()) { - //hlt_met_obj = hlt_cell_met_cont->at(0); - //if (hlt_topocl_met_cont && hlt_topocl_met_cont->size()) { - //hlt_met_obj = hlt_topocl_met_cont->at(0); - if (hlt_mht_met_cont && hlt_mht_met_cont->size()) { - hlt_met_obj = hlt_mht_met_cont->at(0); - - hlt_ex = hlt_met_obj->ex()/CLHEP::GeV; - hlt_ey = hlt_met_obj->ey()/CLHEP::GeV; - hlt_ez = hlt_met_obj->ez()/CLHEP::GeV; + // Set primary trigger Algorithm + std::string primary_name = m_primary_met[0]; + std::string primary_algo = get_trigger_algo(primary_name); + ATH_MSG_DEBUG("Primary Selected Alg : " << primary_algo); + if (primary_algo == "cell" && v_hlt_cell_met_cont && v_hlt_cell_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : Cell"); + v_hlt_met = v_hlt_cell_met_cont->at(0); + } else if (primary_algo == "mht" && v_hlt_mht_met_cont && v_hlt_mht_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : MHT"); + v_hlt_met = v_hlt_mht_met_cont->at(0); + } else if (primary_algo == "mhtem" && v_hlt_mhtem_met_cont && v_hlt_mhtem_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : mht_em"); + v_hlt_met = v_hlt_mhtem_met_cont->at(0); + } else if (primary_algo == "trkmht" && v_hlt_trkmht_met_cont && v_hlt_trkmht_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : trkmht"); + v_hlt_met = v_hlt_trkmht_met_cont->at(0); + } else if (primary_algo == "trkmhtFTK" && v_hlt_trkmhtFTK_met_cont && v_hlt_trkmhtFTK_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : trkmhtFTK"); + v_hlt_met = v_hlt_trkmhtFTK_met_cont->at(0); + } else if (primary_algo == "topocl" && v_hlt_topocl_met_cont && v_hlt_topocl_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : TopoCL"); + v_hlt_met = v_hlt_topocl_met_cont->at(0); + } else if (primary_algo == "topocl_PS" && v_hlt_topocl_PS_met_cont && v_hlt_topocl_PS_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : TopoCL_PS"); + v_hlt_met = v_hlt_topocl_PS_met_cont->at(0); + } else if (primary_algo == "topocl_PUC" && v_hlt_topocl_PUC_met_cont && v_hlt_topocl_PUC_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : TopoCL_PUC"); + v_hlt_met = v_hlt_topocl_PUC_met_cont->at(0); + } else if (primary_algo == "FEB" && v_hlt_FEB_met_cont && v_hlt_FEB_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : FEB"); + v_hlt_met = v_hlt_FEB_met_cont->at(0); + } else if (primary_algo == "Fex" && v_hlt_Fex_met_cont && v_hlt_Fex_met_cont->size()>0) { + ATH_MSG_DEBUG("Primary Alg : FEX"); + v_hlt_met = v_hlt_Fex_met_cont->at(0); + } else { + ATH_MSG_DEBUG("Primary Alg : NONE"); + v_hlt_met = 0; + } + if (v_hlt_met) { + hlt_ex = v_hlt_met->ex()/CLHEP::GeV; + hlt_ey = v_hlt_met->ey()/CLHEP::GeV; + hlt_ez = v_hlt_met->ez()/CLHEP::GeV; hlt_met = sqrt(hlt_ex*hlt_ex+hlt_ey*hlt_ey); - //hlt_me = sqrt(hlt_ex*hlt_ex+hlt_ey*hlt_ey+hlt_ez*hlt_ez); - hlt_sumet = hlt_met_obj->sumEt()/CLHEP::GeV; - hlt_sume = hlt_met_obj->sumE()/CLHEP::GeV; + hlt_sumet = v_hlt_met->sumEt()/CLHEP::GeV; + hlt_sume = v_hlt_met->sumE()/CLHEP::GeV; CLHEP::Hep3Vector v(hlt_ex, hlt_ey, hlt_ez); hlt_eta = v.eta(); hlt_phi = v.phi(); float epsilon = 1e-6; // 1 keV - //if (hlt_me > epsilon) hlt_me_log = log10(fabsf(hlt_me)); // underflow otherwise epsilon = 1.189; hlt_ex_log = signed_log(hlt_ex, epsilon); @@ -869,275 +777,218 @@ StatusCode HLTMETMonTool::fillMETHist() { float off_met = -9e9; float off_sumet = -9e9; float off_phi = -9e9; - if (off_met_cont) { - if (off_met_cont->size()) { - off_met_obj = (*off_met_cont)["FinalClus"]; + if (v_off_met_cont) { + if (v_off_met_cont->size()) { + v_off_met = (*v_off_met_cont)["FinalClus"]; - off_ex = ((*off_met_cont)["FinalClus"]->mpx())/CLHEP::GeV; - off_ey = ((*off_met_cont)["FinalClus"]->mpy())/CLHEP::GeV; + off_ex = ((*v_off_met_cont)["FinalClus"]->mpx())/CLHEP::GeV; + off_ey = ((*v_off_met_cont)["FinalClus"]->mpy())/CLHEP::GeV; off_met = sqrt(off_ex*off_ex+off_ey*off_ey); - off_sumet = ((*off_met_cont)["FinalClus"]->sumet())/CLHEP::GeV; + off_sumet = ((*v_off_met_cont)["FinalClus"]->sumet())/CLHEP::GeV; off_phi = atan2(off_ey, off_ex); } } - TH1 *h(0); - TH2 *h2(0); //######################## - //-- Fill Shifter histograms + //-- Fill histograms //######################## + + // declare iterator etc. + std::map<std::string,int>::const_iterator it; + std::map<std::string, int> met_signatures_tolook; + TH1 *h(0); + TH2 *h2(0); + + // Group and Folder names under Shifter and Expert folders + std::string monGroupName = ""; //L1 or HLT + std::string monFolderName = ""; //Primary, Efficiecny, mht, trigger name etc. + ///////////// /// Shifter L1 ///////////// - std::map<std::string,int>::const_iterator it; + monGroupName = m_shifter_path + "/L1"; - std::string mongroupName = m_shifter_path + "/L1"; - setCurrentMonGroup(mongroupName.c_str()); + // L1 Basic + monFolderName = monGroupName + "/Primary"; + setCurrentMonGroup(monFolderName.c_str()); if (l1_met > epsilon_l1met) { - if ((h = hist("L1_METx"))) h->Fill(l1_mex); - if ((h = hist("L1_METy"))) h->Fill(l1_mey); - if ((h = hist("L1_MET"))) h->Fill(l1_met); - if ((h = hist("L1_SumEt"))) h->Fill(l1_sumet); - if ((h = hist("L1_MET_phi")) && l1_met>0) h->Fill(l1_phi); - if ((h = hist("L1_MET_phi_etweight")) && l1_met>0) h->Fill(l1_phi, l1_met); - if ((h = hist("L1_MET_log"))) h->Fill(l1_met_log); - if ((h = hist("L1_SumEt_log"))) h->Fill(l1_sumet_log); + fillL1BasicHistograms(l1_mex,l1_mex_log,l1_mey,l1_mey_log,l1_met,l1_met_log,l1_sumet,l1_sumet_log,l1_phi,saturated); } - - - TProfile *p(0); + // L1 efficiency - for (it = m_l1_met_signatures_tolook.begin(); it != m_l1_met_signatures_tolook.end(); it++) { - std::string name = it->first; - std::string profname = "Eff_"+ name; - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - //trig_eff_num[0]->Fill(off_met); - if ((p = profile(profname))) p->Fill(off_met,1.0,1.0); - } else { - if ((p = profile(profname))) p->Fill(off_met,0.0,1.0); - } - } - - + monFolderName = monGroupName + "/Efficiency"; + setCurrentMonGroup(monFolderName.c_str()); + + met_signatures_tolook = m_l1_met_signatures_tolook_shifter; + fillL1ProfileHistograms(off_met,pT_mumu,METMuonFilled,met_signatures_tolook); + ///////////// // Shifter HLT ///////////// - setCurrentMonGroup(m_shifter_path + "/HLT"); + monGroupName = m_shifter_path + "/HLT"; - if ((h = hist("HLT_MEx"))) h->Fill(hlt_ex); - if ((h = hist("HLT_MEy"))) h->Fill(hlt_ey); - if ((h = hist("HLT_MET"))) h->Fill(hlt_met); - if ((h = hist("HLT_SumEt"))) h->Fill(hlt_sumet); - if ((h = hist("HLT_MET_phi")) && hlt_met>0) h->Fill(hlt_phi); - if ((h = hist("HLT_MET_phi_etweight")) && hlt_met>0) h->Fill(hlt_phi, hlt_met); - if ((h = hist("HLT_MET_log"))) h->Fill(hlt_met_log); - if ((h = hist("HLT_SumEt_log"))) h->Fill(hlt_sumet_log); - if ((h = hist("HLT_MEz"))) h->Fill(hlt_ez); - if ((h = hist("HLT_SumE"))) h->Fill(hlt_sume); - if ((h2 = hist2("HLT_MET_etaphi")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi); - if ((h2 = hist2("HLT_MET_etaphi_etweight")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi, hlt_met); + // HLT Basic + monFolderName = monGroupName + "/Primary"; + setCurrentMonGroup(monFolderName); + if (hlt_met > 0) { // remove MET=0 events + fillHLTBasicHistograms(hlt_ex,hlt_ex_log,hlt_ey,hlt_ey_log,hlt_ez,hlt_ez_log,hlt_met,hlt_met_log,hlt_sumet,hlt_sumet_log,hlt_sume,hlt_sume_log,hlt_phi,hlt_eta,hlt_significance); + } + // HLT efficiency + monFolderName = monGroupName + "/Efficiency"; + setCurrentMonGroup(monFolderName); - // HLT efficiency histos - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string name = it->first; - std::string profname = "Eff_"+name; - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - //trig_eff_num[i_eff]->Fill(off_met); - if ((p = profile(profname))) p->Fill(off_met,1.0,1.0); - } else { - if ((p = profile(profname))) p->Fill(off_met,0.0,1.0); - } + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + fillHLTProfileHistograms(off_met,met_signatures_tolook); + + + // HLT mu50 + monFolderName = monGroupName + "/mu50"; + setCurrentMonGroup(monFolderName); + if (hlt_met > 0 && eventInfo) { // remove MET=0 events + if (eventInfo->actualInteractionsPerCrossing()>47. && eventInfo->actualInteractionsPerCrossing()<53.) { + fillHLTBasicHistograms(hlt_ex,hlt_ex_log,hlt_ey,hlt_ey_log,hlt_ez,hlt_ez_log,hlt_met,hlt_met_log,hlt_sumet,hlt_sumet_log,hlt_sume,hlt_sume_log,hlt_phi,hlt_eta,hlt_significance); + } } - /////////////////////////////////////////// - //## fill in signal-like selection histograms ############### - ATH_MSG_DEBUG("Going to iterate through muon container"); - bool METMuonFilled = false; // flag is set to true if event satisfies signal-like requirement - bool muonContEmpty = true; - if (hlt_muonEFcontainer && hlt_muonEFcontainer->size()>0) { - ATH_MSG_DEBUG("HLT EF Muon container exists and is not empty. Going to loop over container."); - muonContEmpty = false; - for (auto muon : *hlt_muonEFcontainer) { - // If a muon in this event satifies the requirements, we will fill in MET for this event. - if(muon->muonType() == xAOD::Muon::Combined && (muon->pt()/CLHEP::GeV > m_muon_pt_thresh)) { - METMuonFilled = true; - } + // HLT signal-like electron + monFolderName = monGroupName + "/SignalEl"; + setCurrentMonGroup(monFolderName); + + if(METElectronFilled == true) { + if (hlt_met > 0) { // remove MET=0 events + fillHLTBasicHistograms(hlt_ex,hlt_ex_log,hlt_ey,hlt_ey_log,hlt_ez,hlt_ez_log,hlt_met,hlt_met_log,hlt_sumet,hlt_sumet_log,hlt_sume,hlt_sume_log,hlt_phi,hlt_eta,hlt_significance); } - } else { - ATH_MSG_DEBUG("HLT EF Muon container DNE or is empty"); - //return StatusCode::SUCCESS; + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + fillHLTProfileHistograms(off_met,met_signatures_tolook); } - // Fill in MET if we found a muon in this event that satifies the requirements + + // HLT signal-like muon + monFolderName = monGroupName + "/SignalMu"; + setCurrentMonGroup(monFolderName); + if(METMuonFilled == true) { - if((h = hist("HLT_MET_mu") )) h->Fill(hlt_met); - if((h = hist("HLT_MEx_mu") )) h->Fill(hlt_ex); - if((h = hist("HLT_MEy_mu") )) h->Fill(hlt_ey); - if((h = hist("HLT_SumEt_mu") )) h->Fill(hlt_sumet); - if((h = hist("HLT_MET_phi_mu") ) && hlt_met>0) h->Fill(hlt_phi); - if((h = hist("HLT_MET_phi_etweight_mu") ) && hlt_met>0) h->Fill(hlt_phi,hlt_met); - if((h = hist("HLT_MET_log_mu") )) h->Fill(hlt_met_log); - if((h = hist("HLT_SumEt_log_mu") )) h->Fill(hlt_sumet_log); - if((h = hist("HLT_MEz_mu") )) h->Fill(hlt_ez); - if((h = hist("HLT_SumE_mu") )) h->Fill(hlt_sume); - - TProfile *pmu(0); - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string name = it->first; - std::string mu_profname = "Eff_mu_"+name; - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - if ((pmu = profile(mu_profname))) pmu->Fill(off_met, 1.0, 1.0); - } else { - if ((pmu = profile(mu_profname))) pmu->Fill(off_met, 0.0, 1.0); - } + if (hlt_met > 0) { // remove MET=0 events + fillHLTBasicHistograms(hlt_ex,hlt_ex_log,hlt_ey,hlt_ey_log,hlt_ez,hlt_ez_log,hlt_met,hlt_met_log,hlt_sumet,hlt_sumet_log,hlt_sume,hlt_sume_log,hlt_phi,hlt_eta,hlt_significance); } - + met_signatures_tolook = m_hlt_met_signatures_tolook_shifter; + fillHLTProfileHistograms(off_met,met_signatures_tolook); } + // HLT cell status + monFolderName = monGroupName + "/Status"; + setCurrentMonGroup(monFolderName); - ATH_MSG_DEBUG("Going to iterate through electron container"); - bool METElectronFilled = false; - bool electronEtaReq = false; - bool electronContEmpty = true; - if (hlt_electronEFcontainer && hlt_electronEFcontainer->size()>0) { - ATH_MSG_DEBUG("HLT EF electron container exists and is not empty. Going to loop over container."); - //ATH_MSG_INFO("HLT EF electron container exists and is not empty. Going to loop over container."); - electronContEmpty = false; - for (auto eg : *hlt_electronEFcontainer) { - //ATH_MSG_INFO("--------------"); - //ATH_MSG_INFO("electron found in electronEFContainer"); - - //ATH_MSG_INFO("Electron Pt: " << eg->pt()/CLHEP::GeV << " Eta: " << eg->eta() << " Phi: " << eg->phi()); - - //unsigned int isEMbit = 0; - //ATH_MSG_INFO("Electron is loose: " << eg->selectionisEM(isEMbit,"isEMLoose")); - //ATH_MSG_INFO("Electron is medium: " << eg->selectionisEM(isEMbit,"isEMMedium")); - //ATH_MSG_INFO("Electron is tight: " << eg->selectionisEM(isEMbit,"isEMTight")); - - electronEtaReq = ( std::abs(eg->eta()) < 1.37 || std::abs(eg->eta()) > 1.52 ) && std::abs(eg->eta()) < 2.47; - - //if (eg->pt()/CLHEP::GeV > m_electron_pt_thresh && electronEtaReq && eg->trackParticle()) { - if (eg->pt()/CLHEP::GeV > m_electron_pt_thresh && electronEtaReq) { - METElectronFilled = true; + const xAOD::TrigMissingET *missETEF = 0; + if (v_hlt_cell_met_cont && v_hlt_cell_met_cont->size()) { + missETEF = *(v_hlt_cell_met_cont->begin()); + + // Lumi Block histogram + if ((h = hist("HLT_limiBlock")) && eventInfo) h->Fill(eventInfo->lumiBlock()); + + // <mju> histogram + if ((h = hist("HLT_mu")) && eventInfo) h->Fill(eventInfo->actualInteractionsPerCrossing()); + + // status histogram + TH1F *h1i(0); + bool v_fill_stat = false; + if((h1i = (TH1F *) hist("HLT_MET_status"))) v_fill_stat = true; + for (int i=0; i<32; ++i) { + unsigned mask = (1<<i); + if (missETEF->flag() & mask) { + if(v_fill_stat && h1i) h1i->Fill(i,1.); + } else { + if(v_fill_stat && h1i) h1i->Fill(i,0); } } - } else { - ATH_MSG_DEBUG("HLT EF electron container DNE or is empty"); - //return StatusCode::SUCCESS; - } - - if(METElectronFilled == true) { - if((h = hist("HLT_MET_e") )) h->Fill(hlt_met); - if((h = hist("HLT_MEx_e") )) h->Fill(hlt_ex); - if((h = hist("HLT_MEy_e") )) h->Fill(hlt_ey); - if((h = hist("HLT_SumEt_e") )) h->Fill(hlt_sumet); - if((h = hist("HLT_MET_phi_e") ) && hlt_met>0) h->Fill(hlt_phi); - if((h = hist("HLT_MET_phi_etweight_e") ) && hlt_met>0) h->Fill(hlt_phi,hlt_met); - if((h = hist("HLT_MET_log_e") )) h->Fill(hlt_met_log); - if((h = hist("HLT_SumEt_log_e") )) h->Fill(hlt_sumet_log); - if((h = hist("HLT_MEz_e") )) h->Fill(hlt_ez); - if((h = hist("HLT_SumE_e") )) h->Fill(hlt_sume); - - TProfile *pele(0); - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string name = it->first; - std::string el_profname = "Eff_el_"+name; - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - if ((pele = profile(el_profname))) pele->Fill(off_met, 1.0, 1.0); - } else { - if ((pele = profile(el_profname))) pele->Fill(off_met, 0.0, 1.0); + + // component histograms + unsigned int Nc = missETEF->getNumberOfComponents(); + unsigned int compNc = m_compNames.size(); + Nc = Nc > compNc ? compNc : Nc; + + if (Nc > 0) { + for (unsigned int i = 0; i < Nc; ++i) { // loop over components + float ex = missETEF->exComponent(i)/CLHEP::GeV; + float ey = missETEF->eyComponent(i)/CLHEP::GeV; + float et = sqrt(ex*ex+ey*ey); + float v_comp_et_lin = et; + if((h2 = hist2("compN_compEt_lin"))) h2->Fill(i,v_comp_et_lin); + + bool v_fill_stat = false; + if((h2 = hist2("compN_HLT_MET_status"))) v_fill_stat = true; + // loop over status flags + for (int j=0; j<32; ++j) { + unsigned mask = (1<<j); + if (missETEF->statusComponent(i) & mask) { + if(v_fill_stat && h2) h2->Fill(i,j); + } + } } } + } - - // End of signal-like selection histograms ################# - ////////////////////////////////////////// - - ////////////////////////// - // fill HLT histograms with alternative alg - std::string shifter_partial_path = m_shifter_path + "/HLT/"; - for (std::vector<std::string>::iterator it2 = m_monitoring_alg.begin(); it2 != m_monitoring_alg.end(); it2++) { + /// Alternative algorithms: tc_lcw, tc_em, pueta, pufit, mht, etc. + for (std::vector<std::string>::iterator it2 = m_monitoring_alg_shifter.begin(); it2 != m_monitoring_alg_shifter.end(); it2++) { - std::string name = *it2; - setCurrentMonGroup(shifter_partial_path+name); - ATH_MSG_DEBUG("Histogram Folder : " << shifter_partial_path+name); + monFolderName = monGroupName + "/" + *it2; + setCurrentMonGroup(monFolderName); - //std::cout << "name = " << name << std::endl; + std::string name = *it2; std::string algo = get_trigger_algo(name); - //std::cout << "algo = " << algo << std::endl; ATH_MSG_DEBUG("Alternative Selected Alg : " << algo); - if (algo == "cell" && hlt_cell_met_cont && hlt_cell_met_cont->size()>0) { + if (algo == "cell" && v_hlt_cell_met_cont && v_hlt_cell_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : Cell"); - hlt_met_obj = hlt_cell_met_cont->at(0); - } else if (algo == "mht" && hlt_mht_met_cont && hlt_mht_met_cont->size()>0) { + v_hlt_met = v_hlt_cell_met_cont->at(0); + } else if (algo == "mht" && v_hlt_mht_met_cont && v_hlt_mht_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : MHT"); - hlt_met_obj = hlt_mht_met_cont->at(0); - } else if (algo == "mhtem" && hlt_mhtem_met_cont && hlt_mhtem_met_cont->size()>0) { + v_hlt_met = v_hlt_mht_met_cont->at(0); + } else if (algo == "mhtem" && v_hlt_mhtem_met_cont && v_hlt_mhtem_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : mht_em"); - hlt_met_obj = hlt_mhtem_met_cont->at(0); - } else if (algo == "trkmht" && hlt_trkmht_met_cont && hlt_trkmht_met_cont->size()>0) { + v_hlt_met = v_hlt_mhtem_met_cont->at(0); + } else if (algo == "trkmht" && v_hlt_trkmht_met_cont && v_hlt_trkmht_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : trkmht"); - hlt_met_obj = hlt_trkmht_met_cont->at(0); - } else if (algo == "trkmhtFTK" && hlt_trkmhtFTK_met_cont && hlt_trkmhtFTK_met_cont->size()>0) { + v_hlt_met = v_hlt_trkmht_met_cont->at(0); + } else if (algo == "trkmhtFTK" && v_hlt_trkmhtFTK_met_cont && v_hlt_trkmhtFTK_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : trkmhtFTK"); - hlt_met_obj = hlt_trkmhtFTK_met_cont->at(0); - } else if (algo == "topocl" && hlt_topocl_met_cont && hlt_topocl_met_cont->size()>0) { + v_hlt_met = v_hlt_trkmhtFTK_met_cont->at(0); + } else if (algo == "topocl" && v_hlt_topocl_met_cont && v_hlt_topocl_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : TopoCL"); - hlt_met_obj = hlt_topocl_met_cont->at(0); - } else if (algo == "topocl_PS" && hlt_topocl_PS_met_cont && hlt_topocl_PS_met_cont->size()>0) { + v_hlt_met = v_hlt_topocl_met_cont->at(0); + } else if (algo == "topocl_PS" && v_hlt_topocl_PS_met_cont && v_hlt_topocl_PS_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : TopoCL_PS"); - hlt_met_obj = hlt_topocl_PS_met_cont->at(0); - } else if (algo == "topocl_PUC" && hlt_topocl_PUC_met_cont && hlt_topocl_PUC_met_cont->size()>0) { + v_hlt_met = v_hlt_topocl_PS_met_cont->at(0); + } else if (algo == "topocl_PUC" && v_hlt_topocl_PUC_met_cont && v_hlt_topocl_PUC_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : TopoCL_PUC"); - hlt_met_obj = hlt_topocl_PUC_met_cont->at(0); - } else if (algo == "FEB" && hlt_FEB_met_cont && hlt_FEB_met_cont->size()>0) { + v_hlt_met = v_hlt_topocl_PUC_met_cont->at(0); + } else if (algo == "FEB" && v_hlt_FEB_met_cont && v_hlt_FEB_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : FEB"); - hlt_met_obj = hlt_FEB_met_cont->at(0); - } else if (algo == "Fex" && hlt_Fex_met_cont && hlt_Fex_met_cont->size()>0) { + v_hlt_met = v_hlt_FEB_met_cont->at(0); + } else if (algo == "Fex" && v_hlt_Fex_met_cont && v_hlt_Fex_met_cont->size()>0) { ATH_MSG_DEBUG("Alternative Alg : FEX"); - hlt_met_obj = hlt_Fex_met_cont->at(0); + v_hlt_met = v_hlt_Fex_met_cont->at(0); } else { ATH_MSG_DEBUG("Alternative Alg : NONE"); - hlt_met_obj = 0; - } - ATH_MSG_DEBUG("hlt_met_obj = " << hlt_met_obj); - if (hlt_cell_met_cont && hlt_cell_met_cont->size()) { - ATH_MSG_DEBUG("hlt_met_obj cell = " << hlt_cell_met_cont->at(0)); - ATH_MSG_DEBUG("CELL MET Ex = " << hlt_cell_met_cont->at(0)->ex()/CLHEP::GeV); - } - if (hlt_mht_met_cont && hlt_mht_met_cont->size()) { - ATH_MSG_DEBUG("MHT MET Ex = " << hlt_mht_met_cont->at(0)->ex()/CLHEP::GeV); - } - if (hlt_topocl_met_cont && hlt_topocl_met_cont->size()) { - ATH_MSG_DEBUG("CL MET Ex = " << hlt_topocl_met_cont->at(0)->ex()/CLHEP::GeV); - } - if (hlt_topocl_PS_met_cont && hlt_topocl_PS_met_cont->size()) { - ATH_MSG_DEBUG("PS MET Ex = " << hlt_topocl_PS_met_cont->at(0)->ex()/CLHEP::GeV); - } - if (hlt_topocl_PUC_met_cont && hlt_topocl_PUC_met_cont->size()) { - ATH_MSG_DEBUG("PUC MET Ex = " << hlt_topocl_PUC_met_cont->at(0)->ex()/CLHEP::GeV); - } - if (hlt_FEB_met_cont && hlt_FEB_met_cont->size()) { - ATH_MSG_DEBUG("FEB MET Ex = " << hlt_FEB_met_cont->at(0)->ex()/CLHEP::GeV); + v_hlt_met = 0; } - if (hlt_met_obj) { - float tmp_hlt_ex = hlt_met_obj->ex()/CLHEP::GeV; - float tmp_hlt_ey = hlt_met_obj->ey()/CLHEP::GeV; - float tmp_hlt_ez = hlt_met_obj->ez()/CLHEP::GeV; + if (v_hlt_met) { + float tmp_hlt_ex = v_hlt_met->ex()/CLHEP::GeV; + float tmp_hlt_ey = v_hlt_met->ey()/CLHEP::GeV; + float tmp_hlt_ez = v_hlt_met->ez()/CLHEP::GeV; float tmp_hlt_met = sqrt(tmp_hlt_ex*tmp_hlt_ex+tmp_hlt_ey*tmp_hlt_ey); - float tmp_hlt_sumet = hlt_met_obj->sumEt()/CLHEP::GeV; - float tmp_hlt_sume = hlt_met_obj->sumE()/CLHEP::GeV; + float tmp_hlt_sumet = v_hlt_met->sumEt()/CLHEP::GeV; + float tmp_hlt_sume = v_hlt_met->sumE()/CLHEP::GeV; ATH_MSG_DEBUG("Alternative Ex = " << tmp_hlt_ex); ATH_MSG_DEBUG("Alternative Ey = " << tmp_hlt_ey); ATH_MSG_DEBUG("Alternative MET = " << tmp_hlt_met); @@ -1152,10 +1003,9 @@ StatusCode HLTMETMonTool::fillMETHist() { float tmp_hlt_met_log = -9e9; float tmp_hlt_sume_log = -9e9; float tmp_hlt_sumet_log = -9e9; - //float tmp_hlt_me_log = -9e9; + float tmp_hlt_significance = -9e9; float epsilon = 1e-6; // 1 keV - //if (tmp_hlt_me > epsilon) tmp_hlt_me_log = log10(std::abs(tmp_hlt_me)); // underflow otherwise epsilon = 1.189; tmp_hlt_ex_log = signed_log(tmp_hlt_ex, epsilon); @@ -1164,37 +1014,21 @@ StatusCode HLTMETMonTool::fillMETHist() { tmp_hlt_met_log = signed_log(tmp_hlt_met, epsilon); tmp_hlt_sume_log = signed_log(tmp_hlt_sume, epsilon); tmp_hlt_sumet_log = signed_log(tmp_hlt_sumet, epsilon); + + float tmp_resolution = 0.0; + if (tmp_hlt_sumet>0.0) tmp_resolution = m_sigOffset + m_sigSlope*sqrt(tmp_hlt_sumet) + m_sigQuadr*tmp_hlt_sumet; + if (tmp_resolution>0.0) tmp_hlt_significance = tmp_hlt_met/tmp_resolution; - if ((h = hist("HLT_MEx"))) h->Fill(tmp_hlt_ex); - if ((h = hist("HLT_MEy"))) h->Fill(tmp_hlt_ey); - if ((h = hist("HLT_MEz"))) h->Fill(tmp_hlt_ez); - if ((h = hist("HLT_MET"))) h->Fill(tmp_hlt_met); - if ((h = hist("HLT_MET_lin1"))) h->Fill(tmp_hlt_met); - if ((h = hist("HLT_SumEt"))) h->Fill(tmp_hlt_sumet); - if ((h = hist("HLT_MET_phi")) && tmp_hlt_met>0) h->Fill(tmp_hlt_phi); - if ((h = hist("HLT_MET_phi_etweight")) && tmp_hlt_met>0) h->Fill(tmp_hlt_phi, hlt_met); - if ((h = hist("HLT_MEx_log"))) h->Fill(tmp_hlt_ex_log); - if ((h = hist("HLT_MEy_log"))) h->Fill(tmp_hlt_ey_log); - if ((h = hist("HLT_MEz_log"))) h->Fill(tmp_hlt_ez_log); - if ((h = hist("HLT_MET_log"))) h->Fill(tmp_hlt_met_log); - if ((h = hist("HLT_SumEt_log"))) h->Fill(tmp_hlt_sumet_log); - if ((h = hist("HLT_SumE"))) h->Fill(tmp_hlt_sume); - if ((h = hist("HLT_SumE_log"))) h->Fill(tmp_hlt_sume_log); - if ((h2 = hist2("HLT_MET_etaphi")) && tmp_hlt_met>0) h2->Fill(tmp_hlt_eta, tmp_hlt_phi); - if ((h2 = hist2("HLT_MET_etaphi_etweight")) && tmp_hlt_met>0) h2->Fill(tmp_hlt_eta, tmp_hlt_phi, tmp_hlt_met); - //if ((h = hist("HLT_XS"))) h->Fill(hlt_significance); + fillHLTBasicHistograms(tmp_hlt_ex,tmp_hlt_ex_log,tmp_hlt_ey,tmp_hlt_ey_log,tmp_hlt_ez,tmp_hlt_ez_log,tmp_hlt_met,tmp_hlt_met_log,tmp_hlt_sumet,tmp_hlt_sumet_log,tmp_hlt_sume,tmp_hlt_sume_log,tmp_hlt_phi,tmp_hlt_eta,tmp_hlt_significance); } } - // End of alternative alg histograms - ////////////////////////// - if (!m_make_expert_histograms) - return sc; + if (!m_make_expert_histograms) return sc; //######################## @@ -1206,38 +1040,38 @@ StatusCode HLTMETMonTool::fillMETHist() { ///////////// /// Expert L1 ///////////// - setCurrentMonGroup(m_expert_path+"/L1"); - - if (l1_met > epsilon_l1met) { - if ((h = hist("L1_METx_log"))) h->Fill(l1_mex_log); - if ((h = hist("L1_METy_log"))) h->Fill(l1_mey_log); - //if ((h = hist("L1_MET"))) h->Fill(l1_met); - //if ((h = hist("L1_MET_phi"))) h->Fill(l1_phi); + monGroupName = m_expert_path + "/L1"; + + // L1 Jets + monFolderName = monGroupName + "/Jets"; + setCurrentMonGroup(monFolderName); + if (l1_met > 50) { + for (auto l1_jet : *v_l1_jet_roi_cont) { + l1_jet_pt = l1_jet->et8x8()/CLHEP::GeV; + l1_jet_eta = l1_jet->eta(); + fillL1JetHistograms(l1_jet_pt,l1_jet_eta); + } } - ////////////////////////// - /// L1 Triggers - - std::string expert_partial_path = m_expert_path + "/L1/"; - for (it = m_l1_met_signatures_tolook.begin(); it != m_l1_met_signatures_tolook.end(); it++) { + // L1 efficiency + monFolderName = monGroupName + "/Efficiency"; + setCurrentMonGroup(monFolderName); + + met_signatures_tolook = m_l1_met_signatures_tolook_expert; + fillL1ProfileHistograms(off_met,pT_mumu,METMuonFilled,met_signatures_tolook); + + // L1 Triggers + for (it = m_l1_met_signatures_tolook_shifter.begin(); it != m_l1_met_signatures_tolook_shifter.end(); it++) { std::string name = it->first; ATH_MSG_DEBUG("TriggerLoop: name = " << name); - //if (name == m_denominator_trigger) continue; if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { ATH_MSG_DEBUG("Passed L1 Trigger : " << name); - setCurrentMonGroup(expert_partial_path+name); - if ((h = hist("L1_MET"))) h->Fill(l1_met); - if ((h = hist("L1_METx"))) h->Fill(l1_mex); - if ((h = hist("L1_METy"))) h->Fill(l1_mey); - if ((h = hist("L1_SumEt"))) h->Fill(l1_sumet); - if ((h = hist("L1_MET_phi")) && l1_met>0) h->Fill(l1_phi); - if ((h = hist("L1_MET_phi_etweight")) && l1_met>0) h->Fill(l1_phi, l1_met); - if ((h = hist("L1_MET_log"))) h->Fill(l1_met_log); - if ((h = hist("L1_METx_log"))) h->Fill(l1_mex_log); - if ((h = hist("L1_METy_log"))) h->Fill(l1_mey_log); - if ((h = hist("L1_SumEt_log"))) h->Fill(l1_sumet_log); + monFolderName = monGroupName + "/" + it->first; + setCurrentMonGroup(monFolderName); + + fillL1BasicHistograms(l1_mex,l1_mex_log,l1_mey,l1_mey_log,l1_met,l1_met_log,l1_sumet,l1_sumet_log,l1_phi,saturated); } } @@ -1247,235 +1081,265 @@ StatusCode HLTMETMonTool::fillMETHist() { /// Expert HLT ///////////// - ////////////////////////// - // fill HLT histograms without trigger requirement - setCurrentMonGroup(m_expert_path+"/HLT"); - if (hlt_met_obj) { - if ((h = hist("HLT_MEx_log"))) h->Fill(hlt_ex_log); - if ((h = hist("HLT_MEy_log"))) h->Fill(hlt_ey_log); - if ((h = hist("HLT_MET_lin1"))) h->Fill(hlt_met); - //if ((h = hist("HLT_MET_phi_etweight")) && hlt_met>0) h->Fill(hlt_phi, hlt_met); - if ((h = hist("HLT_MEz_log"))) h->Fill(hlt_ez_log); - if ((h = hist("HLT_SumE_log"))) h->Fill(hlt_sume_log); - if ((h = hist("HLT_XS"))) h->Fill(hlt_significance); + monGroupName = m_expert_path + "/HLT"; + + // HLT efficiency expert + monFolderName = monGroupName + "/Efficiency"; + setCurrentMonGroup(monFolderName); + + met_signatures_tolook = m_hlt_met_signatures_tolook_expert; + fillHLTProfileHistograms(off_met,met_signatures_tolook); + + + // HLT trigger requiriment: xe35, xe80, xe100 etc. + for (it = m_hlt_met_signatures_tolook_shifter.begin(); it != m_hlt_met_signatures_tolook_shifter.end(); it++) { + monFolderName = monGroupName + "/" + it->first; + setCurrentMonGroup(monFolderName); + + std::string name = it->first; + ATH_MSG_DEBUG("Trig : " << name); + if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { + fillHLTBasicHistograms(hlt_ex,hlt_ex_log,hlt_ey,hlt_ey_log,hlt_ez,hlt_ez_log,hlt_met,hlt_met_log,hlt_sumet,hlt_sumet_log,hlt_sume,hlt_sume_log,hlt_phi,hlt_eta,hlt_significance); + } } - ///////////////////////////////////////////////////////////////////////////// - // fill in HLT status and component histograms without trigger requirement // - // Available only for cell based MET /////////////////////////////////////// - const xAOD::TrigMissingET *missETEF = 0; - if (hlt_cell_met_cont && hlt_cell_met_cont->size()) { - missETEF = *(hlt_cell_met_cont->begin()); // cell based - - ////////////////////////// - // status histogram - TH1F *h1i(0); - bool fill_stat = false; - if((h1i = (TH1F *) hist("HLT_MET_status"))) fill_stat = true; - for (int i=0; i<32; ++i) { - unsigned mask = (1<<i); - if (missETEF->flag() & mask) { - if(fill_stat && h1i) h1i->Fill(i,1.); - //m_status_flag[i] = 1; - } else { - if(fill_stat && h1i) h1i->Fill(i,0); - //m_status_flag[i] = 0; - } - } + // HLT cell component + monFolderName = monGroupName + "/Component"; + setCurrentMonGroup(monFolderName); - ////////////////////////// - // component histograms - unsigned int Nc = missETEF->getNumberOfComponents(); - unsigned int compNc = m_compNames.size(); - Nc = Nc > compNc ? compNc : Nc; - - if (Nc > 0) { - for (unsigned int i = 0; i < Nc; ++i) { // loop over components - float ex = missETEF->exComponent(i)/CLHEP::GeV; - float ey = missETEF->eyComponent(i)/CLHEP::GeV; - float ez = missETEF->ezComponent(i)/CLHEP::GeV; - float et = sqrt(ex*ex+ey*ey); - float sumE = missETEF->sumEComponent(i)/CLHEP::GeV; - float sumEt = missETEF->sumEtComponent(i)/CLHEP::GeV; - - float comp_ex_log = -9e9; - float comp_ey_log = -9e9; - float comp_ez_log = -9e9; - float comp_et_log = -9e9; - float comp_sum_et_log = -9e9; - float comp_sum_e_log = -9e9; - float comp_sum_et_lin = -9e9; - float comp_sum_e_lin = -9e9; - float comp_et_lin = -9e9; - - if (std::abs(ex)>epsilon) - comp_ex_log = copysign(log10f(std::abs(ex)), ex); - else - comp_ex_log = 0.01; - - if (std::abs(ey)>epsilon) - comp_ey_log = copysign(log10f(std::abs(ey)), ey); - else - comp_ey_log = 0.01; - - if (std::abs(ez)>epsilon) - comp_ez_log = copysign(log10f(std::abs(ez)), ez); - else - comp_ez_log = 0.01; - - comp_et_lin = et; - if (et>1e-6) // i.e. et > 0 - comp_et_log = log10f(et); - else - comp_et_log = -100; // underflow - - comp_sum_et_lin = sumEt; - comp_sum_e_lin = sumE; - - if (std::abs(sumEt)>epsilon) - comp_sum_et_log = copysign(log10f(std::abs(sumEt)), sumEt); - else - comp_sum_et_log = 0.01; - if (std::abs(sumE)>epsilon) - comp_sum_e_log = copysign(log10f(std::abs(sumE)), sumE); - else - comp_sum_e_log = 0.01; - - if((h2 = hist2("compN_compEx"))) h2->Fill(i,comp_ex_log); - if((h2 = hist2("compN_compEy"))) h2->Fill(i,comp_ey_log); - if((h2 = hist2("compN_compEz"))) h2->Fill(i,comp_ez_log); - if((h2 = hist2("compN_compEt"))) h2->Fill(i,comp_et_log); - if((h2 = hist2("compN_compSumEt"))) h2->Fill(i,comp_sum_et_log); - if((h2 = hist2("compN_compSumE"))) h2->Fill(i,comp_sum_e_log); - if((h2 = hist2("compN_compEt_lin"))) h2->Fill(i,comp_et_lin); - if((h2 = hist2("compN_compSumEt_lin"))) h2->Fill(i,comp_sum_et_lin); - - bool fill_stat = false; - if((h2 = hist2("compN_HLT_MET_status"))) fill_stat = true; - // loop over status flags - for (int j=0; j<32; ++j) { - unsigned mask = (1<<j); - if (missETEF->statusComponent(i) & mask) { - if(fill_stat && h2) h2->Fill(i,j); - } - } - - float nchan_used = missETEF->usedChannelsComponent(i); - if(nchan_used > epsilon) nchan_used = log10f(nchan_used); - else nchan_used = -1.; - if((h2 = hist2("compN_HLT_usedChannels"))) h2->Fill(i,nchan_used); - - CLHEP::Hep3Vector v(ex,ey,ez); - double eta = v.eta(); - double phi = v.phi(); - - if((h2 = hist2(Form("compN_EtaPhi_%02d", i)))) h2->Fill(eta, phi); - if((h2 = hist2(Form("compEt_lin_EtaPhi_%02d", i)))) h2->Fill(eta, phi, comp_et_lin); - if((h2 = hist2(Form("compSumEt_lin_EtaPhi_%02d", i)))) h2->Fill(eta, phi, comp_sum_et_lin); - if((h2 = hist2(Form("compSumE_lin_EtaPhi_%02d", i)))) h2->Fill(eta, phi, comp_sum_e_lin); - } + if (v_hlt_cell_met_cont && v_hlt_cell_met_cont->size()) { + missETEF = *(v_hlt_cell_met_cont->begin()); // cell based + + // component histograms + unsigned int Nc = missETEF->getNumberOfComponents(); + unsigned int compNc = m_compNames.size(); + Nc = Nc > compNc ? compNc : Nc; + + if (Nc > 0) { + for (unsigned int i = 0; i < Nc; ++i) { // loop over components + float ex = missETEF->exComponent(i)/CLHEP::GeV; + float ey = missETEF->eyComponent(i)/CLHEP::GeV; + float ez = missETEF->ezComponent(i)/CLHEP::GeV; + float et = sqrt(ex*ex+ey*ey); + float sumE = missETEF->sumEComponent(i)/CLHEP::GeV; + float sumEt = missETEF->sumEtComponent(i)/CLHEP::GeV; + + float v_comp_ex_log = -9e9; + float v_comp_ey_log = -9e9; + float v_comp_ez_log = -9e9; + float v_comp_et_log = -9e9; + float v_comp_sum_et_log = -9e9; + float v_comp_sum_e_log = -9e9; + float v_comp_sum_et_lin = -9e9; + //float m_comp_sum_e_lin = -9e9; + float v_comp_et_lin = -9e9; + + if (fabsf(ex)>epsilon) + v_comp_ex_log = copysign(log10f(fabsf(ex)), ex); + else + v_comp_ex_log = 0.01; + + if (fabsf(ey)>epsilon) + v_comp_ey_log = copysign(log10f(fabsf(ey)), ey); + else + v_comp_ey_log = 0.01; + + if (fabsf(ez)>epsilon) + v_comp_ez_log = copysign(log10f(fabsf(ez)), ez); + else + v_comp_ez_log = 0.01; + + v_comp_et_lin = et; + if (et>1e-6) // i.e. et > 0 + v_comp_et_log = log10f(et); + else + v_comp_et_log = -100; // underflow + + v_comp_sum_et_lin = sumEt; + + if (fabsf(sumEt)>epsilon) + v_comp_sum_et_log = copysign(log10f(fabsf(sumEt)), sumEt); + else + v_comp_sum_et_log = 0.01; + if (fabsf(sumE)>epsilon) + v_comp_sum_e_log = copysign(log10f(fabsf(sumE)), sumE); + else + v_comp_sum_e_log = 0.01; + + if((h2 = hist2("compN_compEx"))) h2->Fill(i,v_comp_ex_log); + if((h2 = hist2("compN_compEy"))) h2->Fill(i,v_comp_ey_log); + if((h2 = hist2("compN_compEz"))) h2->Fill(i,v_comp_ez_log); + if((h2 = hist2("compN_compEt"))) h2->Fill(i,v_comp_et_log); + if((h2 = hist2("compN_compSumEt"))) h2->Fill(i,v_comp_sum_et_log); + if((h2 = hist2("compN_compSumE"))) h2->Fill(i,v_comp_sum_e_log); + if((h2 = hist2("compN_compEt_lin"))) h2->Fill(i,v_comp_et_lin); + if((h2 = hist2("compN_compSumEt_lin"))) h2->Fill(i,v_comp_sum_et_lin); + + bool v_fill_stat = false; + if((h2 = hist2("compN_HLT_MET_status"))) v_fill_stat = true; + // loop over status flags + for (int j=0; j<32; ++j) { + unsigned mask = (1<<j); + if (missETEF->statusComponent(i) & mask) { + if(v_fill_stat && h2) h2->Fill(i,j); + } + } + + float nchan_used = fabsf(missETEF->usedChannelsComponent(i)); + if(nchan_used > epsilon) nchan_used = log10f(nchan_used); + else nchan_used = -1.; + if((h2 = hist2("compN_HLT_usedChannels"))) h2->Fill(i,nchan_used); + + CLHEP::Hep3Vector v(ex,ey,ez); + double eta = v.eta(); + double phi = v.phi(); + + if((h2 = hist2(Form("compEt_lin_EtaPhi_%02d", i)))) h2->Fill(eta, phi, v_comp_et_lin); } + } } - // End of compN histograms - ////////////////////////// - ////////////////////////// - // fill HLT histograms passing monitored triggers - expert_partial_path = m_expert_path + "/HLT/"; - for (it = m_hlt_met_signatures_tolook.begin(); it != m_hlt_met_signatures_tolook.end(); it++) { - std::string name = it->first; - ATH_MSG_DEBUG("Trig : " << name); - if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { - setCurrentMonGroup(expert_partial_path+name); - - if ((h = hist("HLT_MEx"))) h->Fill(hlt_ex); - if ((h = hist("HLT_MEy"))) h->Fill(hlt_ey); - if ((h = hist("HLT_MEz"))) h->Fill(hlt_ez); - if ((h = hist("HLT_MET"))) h->Fill(hlt_met); - if ((h = hist("HLT_MET_lin1"))) h->Fill(hlt_met); - if ((h = hist("HLT_SumEt"))) h->Fill(hlt_sumet); - if ((h = hist("HLT_MET_phi")) && hlt_met>0) h->Fill(hlt_phi); - if ((h = hist("HLT_MET_phi_etweight")) && hlt_met>0) h->Fill(hlt_phi, hlt_met); - if ((h = hist("HLT_MEx_log"))) h->Fill(hlt_ex_log); - if ((h = hist("HLT_MEy_log"))) h->Fill(hlt_ey_log); - if ((h = hist("HLT_MEz_log"))) h->Fill(hlt_ez_log); - if ((h = hist("HLT_MET_log"))) h->Fill(hlt_met_log); - if ((h = hist("HLT_SumEt_log"))) h->Fill(hlt_sumet_log); - if ((h = hist("HLT_SumE"))) h->Fill(hlt_sume); - if ((h = hist("HLT_SumE_log"))) h->Fill(hlt_sume_log); - if ((h2 = hist2("HLT_MET_etaphi")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi); - if ((h2 = hist2("HLT_MET_etaphi_etweight")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi, hlt_met); - //if ((h = hist("HLT_XS"))) h->Fill(hlt_significance); + /// Alternative algorithms: tc_lcw, tc_em, pueta, pufit, mht, etc. + for (std::vector<std::string>::iterator it2 = m_monitoring_alg_expert.begin(); it2 != m_monitoring_alg_expert.end(); it2++) { + + monFolderName = monGroupName + "/" + *it2; + setCurrentMonGroup(monFolderName); + + std::string name = *it2; + std::string algo = get_trigger_algo(name); + ATH_MSG_DEBUG("Alternative Selected Alg : " << algo); + if (algo == "cell" && v_hlt_cell_met_cont && v_hlt_cell_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : Cell"); + v_hlt_met = v_hlt_cell_met_cont->at(0); + } else if (algo == "mht" && v_hlt_mht_met_cont && v_hlt_mht_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : MHT"); + v_hlt_met = v_hlt_mht_met_cont->at(0); + } else if (algo == "mhtem" && v_hlt_mhtem_met_cont && v_hlt_mhtem_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : mht_em"); + v_hlt_met = v_hlt_mhtem_met_cont->at(0); + } else if (algo == "trkmht" && v_hlt_trkmht_met_cont && v_hlt_trkmht_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : trkmht"); + v_hlt_met = v_hlt_trkmht_met_cont->at(0); + } else if (algo == "trkmhtFTK" && v_hlt_trkmhtFTK_met_cont && v_hlt_trkmhtFTK_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : trkmhtFTK"); + v_hlt_met = v_hlt_trkmhtFTK_met_cont->at(0); + } else if (algo == "topocl" && v_hlt_topocl_met_cont && v_hlt_topocl_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : TopoCL"); + v_hlt_met = v_hlt_topocl_met_cont->at(0); + } else if (algo == "topocl_PS" && v_hlt_topocl_PS_met_cont && v_hlt_topocl_PS_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : TopoCL_PS"); + v_hlt_met = v_hlt_topocl_PS_met_cont->at(0); + } else if (algo == "topocl_PUC" && v_hlt_topocl_PUC_met_cont && v_hlt_topocl_PUC_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : TopoCL_PUC"); + v_hlt_met = v_hlt_topocl_PUC_met_cont->at(0); + } else if (algo == "FEB" && v_hlt_FEB_met_cont && v_hlt_FEB_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : FEB"); + v_hlt_met = v_hlt_FEB_met_cont->at(0); + } else if (algo == "Fex" && v_hlt_Fex_met_cont && v_hlt_Fex_met_cont->size()>0) { + ATH_MSG_DEBUG("Alternative Alg : FEX"); + v_hlt_met = v_hlt_Fex_met_cont->at(0); + } else { + ATH_MSG_DEBUG("Alternative Alg : NONE"); + v_hlt_met = 0; } + + if (v_hlt_met) { + float tmp_hlt_ex = v_hlt_met->ex()/CLHEP::GeV; + float tmp_hlt_ey = v_hlt_met->ey()/CLHEP::GeV; + float tmp_hlt_ez = v_hlt_met->ez()/CLHEP::GeV; + float tmp_hlt_met = sqrt(tmp_hlt_ex*tmp_hlt_ex+tmp_hlt_ey*tmp_hlt_ey); + float tmp_hlt_sumet = v_hlt_met->sumEt()/CLHEP::GeV; + float tmp_hlt_sume = v_hlt_met->sumE()/CLHEP::GeV; + ATH_MSG_DEBUG("Alternative Ex = " << tmp_hlt_ex); + ATH_MSG_DEBUG("Alternative Ey = " << tmp_hlt_ey); + ATH_MSG_DEBUG("Alternative MET = " << tmp_hlt_met); + + CLHEP::Hep3Vector v(tmp_hlt_ex, tmp_hlt_ey, tmp_hlt_ez); + float tmp_hlt_eta = v.eta(); + float tmp_hlt_phi = v.phi(); + + float tmp_hlt_ex_log = -9e9; + float tmp_hlt_ey_log = -9e9; + float tmp_hlt_ez_log = -9e9; + float tmp_hlt_met_log = -9e9; + float tmp_hlt_sume_log = -9e9; + float tmp_hlt_sumet_log = -9e9; + float tmp_hlt_significance = -9e9; + + float epsilon = 1e-6; // 1 keV + + epsilon = 1.189; + tmp_hlt_ex_log = signed_log(tmp_hlt_ex, epsilon); + tmp_hlt_ey_log = signed_log(tmp_hlt_ey, epsilon); + tmp_hlt_ez_log = signed_log(tmp_hlt_ez, epsilon); + tmp_hlt_met_log = signed_log(tmp_hlt_met, epsilon); + tmp_hlt_sume_log = signed_log(tmp_hlt_sume, epsilon); + tmp_hlt_sumet_log = signed_log(tmp_hlt_sumet, epsilon); + + float tmp_resolution = 0.0; + if (tmp_hlt_sumet>0.0) tmp_resolution = m_sigOffset + m_sigSlope*sqrt(tmp_hlt_sumet) + m_sigQuadr*tmp_hlt_sumet; + if (tmp_resolution>0.0) tmp_hlt_significance = tmp_hlt_met/tmp_resolution; + + fillHLTBasicHistograms(tmp_hlt_ex,tmp_hlt_ex_log,tmp_hlt_ey,tmp_hlt_ey_log,tmp_hlt_ez,tmp_hlt_ez_log,tmp_hlt_met,tmp_hlt_met_log,tmp_hlt_sumet,tmp_hlt_sumet_log,tmp_hlt_sume,tmp_hlt_sume_log,tmp_hlt_phi,tmp_hlt_eta,tmp_hlt_significance); + + } + } - // End of trigger specific histos - ////////////////////////// + + monGroupName = m_expert_path; ////////////////////////// // Offline MET - setCurrentMonGroup(m_expert_path+"/Offline"); - if (off_met_obj) { - if ((h = hist("Offline_MET"))) h->Fill(off_met); - if ((h = hist("Offline_METx"))) h->Fill(off_ex); - if ((h = hist("Offline_METy"))) h->Fill(off_ey); - if ((h = hist("Offline_SumEt"))) h->Fill(off_sumet); - if ((h = hist("Offline_MET_phi")) && off_met>0) h->Fill(off_phi); + monFolderName = monGroupName + "/Offline"; + setCurrentMonGroup(monFolderName); + + if (v_off_met) { + fillOffMETHistograms(off_met,off_ex,off_ey,off_sumet,off_phi); } - // fill correlation histograms -- L1 vs HLT - //ATH_MSG_INFO("Aqui: " << name); - setCurrentMonGroup(m_expert_path+"/L1_vs_HLT"); - if (l1_roi_cont) { - if ((h2 = hist2("L1_HLT_EtCor"))) h2->Fill(hlt_met, l1_met); - if ((h2 = hist2("L1_HLT_SumEtCor"))) h2->Fill(hlt_sumet, l1_sumet); - if ((h2 = hist2("L1_HLT_PhiCor")) && hlt_met>0) h2->Fill(hlt_phi, l1_phi); - - if ((h = hist("L1_HLT_dEt"))) h->Fill(l1_met - hlt_met); - double dphi = signed_delta_phi(l1_phi, hlt_phi); - if ((h = hist("L1_HLT_dPhi")) && hlt_met>0) h->Fill(dphi); - if ((h = hist("L1_HLT_dEx"))) h->Fill(l1_mex - hlt_ex); - if ((h = hist("L1_HLT_dEy"))) h->Fill(l1_mey - hlt_ey); + + ////////////////////////// + // L1 vs HLT + monFolderName = monGroupName + "/L1_vs_HLT"; + setCurrentMonGroup(monFolderName); + + if (v_l1_roi_cont) { + fillL1vsHLTHistograms(l1_met,l1_mex,l1_mey,l1_sumet,l1_phi,hlt_met,hlt_ex,hlt_ey,hlt_sumet,hlt_phi,saturated); } - // fill correlation histograms -- HLT vs Off - setCurrentMonGroup(m_expert_path+"/HLT_vs_Offline"); - if (off_met_obj) { - if ((h2 = hist2("HLT_Off_EtCor"))) h2->Fill(off_met, hlt_met); - if ((h2 = hist2("HLT_Off_SumEtCor"))) h2->Fill(off_sumet, hlt_sumet); - if ((h2 = hist2("HLT_Off_PhiCor")) && hlt_met>0) h2->Fill(off_phi, hlt_phi); - - if ((h = hist("HLT_Off_dEt"))) h->Fill(hlt_met - off_met); - double dphi = signed_delta_phi(hlt_phi, off_phi); - if ((h = hist("HLT_Off_dPhi")) && hlt_met>0) h->Fill(dphi); - if ((h = hist("HLT_Off_dEx"))) h->Fill(hlt_ex - off_ex); - if ((h = hist("HLT_Off_dEy"))) h->Fill(hlt_ey - off_ey); - } + + ////////////////////////// + // HLT vs Offline + monFolderName = monGroupName + "/HLT_vs_Offline"; + setCurrentMonGroup(monFolderName); + + if (v_off_met) { + fillHLTvsOffHistograms(hlt_met,hlt_ex,hlt_ey,hlt_sumet,hlt_phi,off_met,off_ex,off_ey,off_sumet,off_phi); + } - // fill correlation histograms -- L1 vs Off - setCurrentMonGroup(m_expert_path+"/L1_vs_Offline"); - if (off_met_obj) { - if ((h2 = hist2("L1_Off_EtCor"))) h2->Fill(off_met, l1_met); - if ((h2 = hist2("L1_Off_SumEtCor"))) h2->Fill(off_sumet, l1_sumet); - if ((h2 = hist2("L1_Off_PhiCor")) && l1_met>0) h2->Fill(off_phi, l1_phi); - - if ((h = hist("L1_Off_dEt"))) h->Fill(l1_met - off_met); - double dphi = signed_delta_phi(l1_phi, off_phi); - if ((h = hist("L1_Off_dPhi")) && l1_met>0) h->Fill(dphi); - if ((h = hist("L1_Off_dEx"))) h->Fill(l1_mex - off_ex); - if ((h = hist("L1_Off_dEy"))) h->Fill(l1_mey - off_ey); + + ////////////////////////// + // L1 vs Offline + monFolderName = monGroupName + "/L1_vs_Offline"; + setCurrentMonGroup(monFolderName); + + if (v_off_met) { + fillL1vsOffHistograms(l1_met,l1_mex,l1_mey,l1_sumet,l1_phi,off_met,off_ex,off_ey,off_sumet,off_phi,saturated); } ////////////////////////// // Electron and Muon - setCurrentMonGroup(m_expert_path+"/ElMu"); + monFolderName = monGroupName + "/ElMu"; + setCurrentMonGroup(monFolderName); + int muonMult = 0; if (muonContEmpty == false) { - for (auto muon : *hlt_muonEFcontainer) { + for (auto muon : *v_hlt_muonEFcontainer) { if(muon->muonType() == xAOD::Muon::Combined) { if((h = hist("HLT_muonpt") )) h->Fill(muon->pt()/CLHEP::GeV); muonMult += 1; @@ -1486,11 +1350,9 @@ StatusCode HLTMETMonTool::fillMETHist() { } int electronMult = 0; if (electronContEmpty == false) { - for (auto eg : *hlt_electronEFcontainer) { - //if (eg->trackParticle()) { + for (auto eg : *v_hlt_electronEFcontainer) { if((h = hist("HLT_electronpt") )) h->Fill(eg->pt()/CLHEP::GeV); electronMult += 1; - //} } ATH_MSG_DEBUG("Electron multiciplicity: " << electronMult); if((h = hist("HLT_electronmult") )) h->Fill(electronMult); @@ -1499,6 +1361,425 @@ StatusCode HLTMETMonTool::fillMETHist() { return sc; } +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addL1BasicHistograms() { + + addHistogram(new TH1F("L1_METx", "L1 Missing E_{x};E_{x} (GeV)", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("L1_METx_log", "L1 Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 55, -4.125, 4.125)); + addHistogram(new TH1F("L1_METy", "L1 Missing E_{y};E_{y} (GeV)", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("L1_METy_log", "L1 Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 55, -4.125, 4.125)); + addHistogram(new TH1F("L1_MET", "L1 MET (GeV);MET (GeV)", m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH1F("L1_MET_log", "L1 |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 40, -1.875, 4.125)); + addHistogram(new TH1F("L1_SumEt", "L1 SumEt (GeV);SumEt (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH1F("L1_SumEt_log", "L1 Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 40, -1.875, 4.125)); + addHistogram(new TH1F("L1_MET_phi", "L1 MET #phi (rad);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("L1_MET_phi_etweight", "L1 MET #phi (|Missing E_{T}|);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillL1BasicHistograms(float l1_mex,float l1_mex_log,float l1_mey,float l1_mey_log,float l1_met,float l1_met_log,float l1_sumet,float l1_sumet_log,float l1_phi,float saturated) { + + TH1 *h(0); + if ((h = hist("L1_METx"))) h->Fill(l1_mex); + if ((h = hist("L1_METx_log"))) h->Fill(l1_mex_log); + if ((h = hist("L1_METy"))) h->Fill(l1_mey); + if ((h = hist("L1_METy_log"))) h->Fill(l1_mey_log); + if ((h = hist("L1_MET"))) h->Fill(l1_met); + if ((h = hist("L1_MET_log"))) h->Fill(l1_met_log); + if ((h = hist("L1_SumEt"))) h->Fill(l1_sumet); + if ((h = hist("L1_SumEt_log"))) h->Fill(l1_sumet_log); + if ((h = hist("L1_MET_phi")) && l1_met>0 && !saturated) h->Fill(l1_phi); + if ((h = hist("L1_MET_phi_etweight")) && l1_met>0 && !saturated) h->Fill(l1_phi, l1_met); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addL1JetHistograms() { + + const int nBins = 13; + double edges[nBins + 1] = {-4.9,-3.1,-2.5,-1.9,-1.3,-0.75,-0.25,0.25,0.75,1.3,1.9,2.5,3.1,4.9}; + addHistogram(new TH2F("L1_Jet_eta_pt", "L1 Jet #eta/p_{T};#eta;p_{T} [GeV]", nBins, edges, 80, 10, 90)); +} + + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillL1JetHistograms(float l1_jet_pt,float l1_jet_eta) { + + TH2 *h2(0); + if ((h2 = hist2("L1_Jet_eta_pt")) && l1_jet_pt>0) h2->Fill(l1_jet_eta, l1_jet_pt); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addL1ProfileHistograms(std::map<std::string, int> met_signatures_tolook) { + + std::map<std::string,int>::const_iterator it; + for (it = met_signatures_tolook.begin(); it != met_signatures_tolook.end(); it++) { + std::string prof_name = "Eff_" + it->first; + std::string prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; + addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); + + prof_name = "Eff_mu_" + it->first; + prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; + addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); + + prof_name = "Eff_mumu_" + it->first; + prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; + addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); + } + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillL1ProfileHistograms(float off_met,float pT_mumu,bool METMuonFilled,std::map<std::string, int> met_signatures_tolook) { + + std::map<std::string,int>::const_iterator it; + TProfile *p(0); + TProfile *pmu(0); + for (it = met_signatures_tolook.begin(); it != met_signatures_tolook.end(); it++) { + std::string name = it->first; + std::string profname = "Eff_"+ name; + if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { + if ((p = profile(profname))) p->Fill(off_met,1.0,1.0); + } else { + if ((p = profile(profname))) p->Fill(off_met,0.0,1.0); + } + + if(METMuonFilled == true) { + std::string name = it->first; + std::string mu_profname = "Eff_mu_"+name; + if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { + if ((pmu = profile(mu_profname))) pmu->Fill(off_met, 1.0, 1.0); + } else { + if ((pmu = profile(mu_profname))) pmu->Fill(off_met, 0.0, 1.0); + } + if(pT_mumu>0){ + std::string mumu_name = it->first; + std::string mumu_profname = "Eff_mumu_"+name; + if (getTDT()->isPassed(mumu_name, TrigDefs::eventAccepted)) { + if ((pmu = profile(mumu_profname))) pmu->Fill(pT_mumu, 1.0, 1.0); + } else { + if ((pmu = profile(mumu_profname))) pmu->Fill(pT_mumu, 0.0, 1.0); + } + }//pT_mumu > 0 + }//loop over signatures + } + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addHLTBasicHistograms() { + + addHistogram(new TH1F("HLT_MEx", "HLT Missing E_{x};E_{x} (GeV)", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("HLT_MEx_log", "HLT Missing E_{x};sgn(E_{x}) log_{10}(E_{x}/GeV)", 27, -4.125, 4.125)); + addHistogram(new TH1F("HLT_MEy", "HLT Missing E_{y};E_{y} (GeV)", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("HLT_MEy_log", "HLT Missing E_{y};sgn(E_{y}) log_{10}(E_{y}/GeV)", 27, -4.125, 4.125)); + addHistogram(new TH1F("HLT_MEz", "HLT Missing E_{z};E_{z} (GeV)", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("HLT_MEz_log", "HLT Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)",27, -4.125, 4.125)); + addHistogram(new TH1F("HLT_MET", "HLT |Missing E_{T}|;ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH1F("HLT_MET_log", "HLT |Missing E_{T}|;log_{10}(ME_{T}/GeV)", 20, -1.875, 4.125)); + addHistogram(new TH1F("HLT_MET_lin1", "HLT |Missing E_{T}| (0-10 GeV);ME_{T} (GeV)", 110, -0.5, 10.5)); + addHistogram(new TH1F("HLT_SumEt", "HLT Sum |E_{T}|;SumE_{T} (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH1F("HLT_SumEt_log", "HLT Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", 20, -1.875, 4.125)); + addHistogram(new TH1F("HLT_SumE", "HLT Sum |E|;SumE (GeV)", m_sume_bins, m_sume_min, m_sume_max)); + addHistogram(new TH1F("HLT_SumE_log", "HLT Sum |E|;log_{10}(SumE/GeV)",40, -1.875, 6.125)); + addHistogram(new TH1F("HLT_MET_phi", "HLT MET #phi (rad);#phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("HLT_MET_phi_etweight", "HLT MET #phi (|Missing E_{T}|);MET #phi (rad)", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("HLT_MET_eta", "HLT MET #eta (rad);#eta", m_eta_bins, m_eta_min, m_eta_max)); + addHistogram(new TH1F("HLT_MET_eta_etweight", "HLT MET #eta (|Missing E_{T}|);MET #eta", m_eta_bins, m_eta_min, m_eta_max)); + addHistogram(new TH2F("HLT_MET_etaphi", "HLT MET #eta/#phi;#eta;#phi (rad)", m_eta_bins, m_eta_min, m_eta_max, m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH2F("HLT_MET_etaphi_etweight", "HLT MET #eta/#phi(|Missing E_{T}|);#eta;#phi (rad)", m_eta_bins, m_eta_min, m_eta_max, m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("HLT_XS", "HLT MET Significance;Significance (XS/GeV^{1/2})", m_xs_bins, m_xs_min, m_xs_max)); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillHLTBasicHistograms(float hlt_ex,float hlt_ex_log,float hlt_ey,float hlt_ey_log,float hlt_ez,float hlt_ez_log,float hlt_met,float hlt_met_log,float hlt_sumet,float hlt_sumet_log,float hlt_sume,float hlt_sume_log,float hlt_phi,float hlt_eta,float hlt_significance) { + + TH1 *h(0); + TH2 *h2(0); + if ((h = hist("HLT_MEx"))) h->Fill(hlt_ex); + if ((h = hist("HLT_MEx_log"))) h->Fill(hlt_ex_log); + if ((h = hist("HLT_MEy"))) h->Fill(hlt_ey); + if ((h = hist("HLT_MEy_log"))) h->Fill(hlt_ey_log); + if ((h = hist("HLT_MEz"))) h->Fill(hlt_ez); + if ((h = hist("HLT_MEz_log"))) h->Fill(hlt_ez_log); + if ((h = hist("HLT_MET"))) h->Fill(hlt_met); + if ((h = hist("HLT_MET_log"))) h->Fill(hlt_met_log); + if ((h = hist("HLT_MET_lin1"))) h->Fill(hlt_met); + if ((h = hist("HLT_SumEt"))) h->Fill(hlt_sumet); + if ((h = hist("HLT_SumEt_log"))) h->Fill(hlt_sumet_log); + if ((h = hist("HLT_SumE"))) h->Fill(hlt_sume); + if ((h = hist("HLT_SumE_log"))) h->Fill(hlt_sume_log); + if ((h = hist("HLT_MET_phi")) && hlt_met>0) h->Fill(hlt_phi); + if ((h = hist("HLT_MET_phi_etweight")) && hlt_met>0) h->Fill(hlt_phi, hlt_met); + if ((h = hist("HLT_MET_eta")) && hlt_met>0) h->Fill(hlt_eta); + if ((h = hist("HLT_MET_eta_etweight")) && hlt_met>0) h->Fill(hlt_eta, hlt_met); + if ((h2 = hist2("HLT_MET_etaphi")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi); + if ((h2 = hist2("HLT_MET_etaphi_etweight")) && hlt_met>0) h2->Fill(hlt_eta, hlt_phi, hlt_met); + if ((h = hist("HLT_XS"))) h->Fill(hlt_significance); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addHLTProfileHistograms(std::map<std::string, int> met_signatures_tolook) { + + std::map<std::string,int>::const_iterator it; + for (it = met_signatures_tolook.begin(); it != met_signatures_tolook.end(); it++) { + std::string prof_name = "Eff_" + it->first; + std::string prof_title = prof_name + " Efficiency Missing E_{T};ME_{T} (GeV)"; + addProfile(new TProfile(prof_name.c_str(), prof_title.c_str(), m_eff_bins, m_eff_min, m_eff_max)); + } + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillHLTProfileHistograms(float off_met,std::map<std::string, int> met_signatures_tolook) { + + std::map<std::string,int>::const_iterator it; + TProfile *p(0); + for (it = met_signatures_tolook.begin(); it != met_signatures_tolook.end(); it++) { + std::string name = it->first; + std::string profname = "Eff_"+name; + if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { + if ((p = profile(profname))) p->Fill(off_met,1.0,1.0); + } else { + if ((p = profile(profname))) p->Fill(off_met,0.0,1.0); + } + } + +} + + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addHLTStatusHistograms() { + + // Lumiblock histogram + addHistogram(new TH1F("HLT_limiBlock", "HLT Lumi Block", 1000, 0, 1000)); + + // <mu> histogram + addHistogram(new TH1F("HLT_mu", "HLT mu", 100, 0, 100)); + + // status in 1d + TH1F *h1i = new TH1F("HLT_MET_status", "HLT MET Status", 32, -0.5, 31.5); + for (size_t j = 0; j < m_bitNames.size(); j++) { + if(j < m_bitNames.size()) h1i->GetXaxis()->SetBinLabel(j+1, m_bitNames[j].c_str()); + } + addHistogram(h1i); + + // HLT MET all components in one 2d histogram + float fMaxEFC = float(m_compNames.size()); + fMaxEFC -= 0.5; + int fBinEFC = int(m_compNames.size()); + TH2F *h2f[2] = {0}; + h2f[0] = new TH2F("compN_HLT_MET_status", "HLT MET Status VS component;;", fBinEFC, -0.5, fMaxEFC,32, -0.5, 31.5); + h2f[1] = new TH2F("compN_compEt_lin", "HLT MissingE_{T} VS component;;ME_{T} (GeV)", fBinEFC, -0.5, fMaxEFC, 102, -13.5, 601.5); + for (size_t k = 0; k < 2; k++) { // 2 hists + for (size_t cn = 0; cn < m_compNames.size(); cn++) { // 25 bins + if(cn < m_compNames.size()) h2f[k]->GetXaxis()->SetBinLabel(cn+1, m_compNames[cn].c_str()); + } + addHistogram(h2f[k]); + } + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addHLTCompHistograms() { + + // HLT MET all components in one 2d histogram + float fMaxEFC = float(m_compNames.size()); + fMaxEFC -= 0.5; + int fBinEFC = int(m_compNames.size()); + TH2F *h2f[10] = {0}; + h2f[0] = new TH2F("compN_compEx", "HLT MissingE_{x} VS component;;sgn(ME_{x}) log_{10}(E_{x}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); + h2f[1] = new TH2F("compN_compEy", "HLT Missing E_{y} VS component;;sgn(ME_{y}) log_{10}(E_{y}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); + h2f[2] = new TH2F("compN_compEz", "HLT Missing E_{z} VS component;;sgn(ME_{z}) log_{10}(E_{z}/GeV)", fBinEFC, -0.5, fMaxEFC, 27, -4.125, 4.125); + h2f[3] = new TH2F("compN_compEt", "HLT MissingE_{T} VS component;;sgn(ME_{T}) log_{10}(ME_{T}/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); + h2f[4] = new TH2F("compN_compSumEt", "HLT Sum |E_{T}| VS component;;log_{10}(SumE_{T}/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); + h2f[5] = new TH2F("compN_compSumE", "HLT Sum |E| VS component;;log_{10}(SumE/GeV)", fBinEFC, -0.5, fMaxEFC, 20, -1.875, 4.125); + h2f[6] = new TH2F("compN_compEt_lin", "HLT MissingE_{T} VS component;;ME_{T} (GeV)", fBinEFC, -0.5, fMaxEFC, 102, -13.5, 601.5); + h2f[7] = new TH2F("compN_compSumEt_lin", "HLT Sum |E_{T}| VS component;;SumE_{T} (GeV)", fBinEFC, -0.5, fMaxEFC, 236, -30, 2802); + h2f[8] = new TH2F("compN_HLT_MET_status", "HLT MET Status VS component;;", fBinEFC, -0.5, fMaxEFC,32, -0.5, 31.5); + h2f[9] = new TH2F("compN_HLT_usedChannels", "HLT Used Channels VS component;;log_{10}(N > 0)", fBinEFC, -0.5, fMaxEFC,13,-0.5,6.0); + + for (size_t k = 0; k < 10; k++) { // 10 hists + for (size_t cn = 0; cn < m_compNames.size(); cn++) { // 25 bins + if(cn < m_compNames.size()) h2f[k]->GetXaxis()->SetBinLabel(cn+1, m_compNames[cn].c_str()); + } + // for status v. component, set bin labels for Y axis + if (k == 8) { + for (size_t j = 0; j < m_bitNames.size(); j++) { + if(j < m_bitNames.size()) h2f[k]->GetYaxis()->SetBinLabel(j+1, m_bitNames[j].c_str()); + } + h2f[k]->GetYaxis()->SetLabelFont(42); + h2f[k]->GetYaxis()->SetLabelOffset(0.002); + h2f[k]->GetYaxis()->SetLabelSize(0.03); + } + if (k == 9) { + h2f[k]->GetYaxis()->SetBinLabel(1,"none"); + } + addHistogram(h2f[k]); + } + + int phibins = 16; double phimin = m_phi_min; double phimax = m_phi_max; + int etabins = 24; double etamin = -4.8; double etamax = 4.8; + + for (unsigned int j = 0; j < m_compNames.size(); j++) { + std::string name = Form("compEt_lin_EtaPhi_%02d", j); + std::string title = m_compNames[j]; + title += ": MissingE_{T}(#eta, #phi); #eta; #phi [rad];ME_{T}/GeV"; + TH2F* h = new TH2F(name.c_str(), title.c_str(), etabins, etamin, etamax, phibins, phimin, phimax); + addHistogram(h); + } + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addOffMETHistograms() { + + addHistogram(new TH1F("Offline_MET", "Offline MET;Et", m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH1F("Offline_METx", "Offline METx;Ex", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("Offline_METy", "Offline METy;Ey", m_ec_bins, m_ec_min, m_ec_max)); + addHistogram(new TH1F("Offline_SumEt", "Offline SumEt;sumEt", m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH1F("Offline_MET_phi", "Offline MET phi;Phi", m_phi_bins, m_phi_min, m_phi_max)); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillOffMETHistograms(float off_met,float off_ex,float off_ey,float off_sumet,float off_phi) { + + TH1 *h(0); + if ((h = hist("Offline_MET"))) h->Fill(off_met); + if ((h = hist("Offline_METx"))) h->Fill(off_ex); + if ((h = hist("Offline_METy"))) h->Fill(off_ey); + if ((h = hist("Offline_SumEt"))) h->Fill(off_sumet); + if ((h = hist("Offline_MET_phi")) && off_met>0) h->Fill(off_phi); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addL1vsHLTHistograms() { + + addHistogram(new TH2F("L1_HLT_EtCor", "L1 vs HLT Missing E_{T} ; HLTME_{T} (GeV); L1ME_{T} (GeV)", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH2F("L1_HLT_SumEtCor", "L1 vs HLT Sum |E_{T}| ; HLTSum|E_{T}| (GeV); L1Sum|E_{T}| (GeV)", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH2F("L1_HLT_PhiCor", "L1 vs HLT #phi ; EF #phi (rad); L1 #phi (rad)", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); + + addHistogram(new TH1F("L1_HLT_dEt", "#DeltaE_{T}(L1-HLT) ; #DeltaE_{T} (GeV)", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("L1_HLT_dPhi", "#Delta#phi(L1-HLT) ; #Delta#phi (GeV)", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("L1_HLT_dEx", "#DeltaE_{x}(L1-HLT) ; #DeltaE_{x} (GeV)", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("L1_HLT_dEy", "#DeltaE_{y}(L1-HLT) ; #DeltaE_{y} (GeV)", m_det_bins, m_det_min, m_det_max)); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillL1vsHLTHistograms(float l1_met,float l1_sumet,float l1_phi,float l1_mex,float l1_mey,float hlt_met,float hlt_sumet,float hlt_phi,float hlt_ex,float hlt_ey,float saturated) { + + TH1 *h(0); + TH2 *h2(0); + if ((h2 = hist2("L1_HLT_EtCor"))) h2->Fill(hlt_met, l1_met); + if ((h2 = hist2("L1_HLT_SumEtCor"))) h2->Fill(hlt_sumet, l1_sumet); + if ((h2 = hist2("L1_HLT_PhiCor")) && hlt_met>0 && !saturated) h2->Fill(hlt_phi, l1_phi); + + if ((h = hist("L1_HLT_dEt"))) h->Fill(l1_met - hlt_met); + double dphi = signed_delta_phi(l1_phi, hlt_phi); + if ((h = hist("L1_HLT_dPhi")) && hlt_met>0) h->Fill(dphi); + if ((h = hist("L1_HLT_dEx"))) h->Fill(l1_mex - hlt_ex); + if ((h = hist("L1_HLT_dEy"))) h->Fill(l1_mey - hlt_ey); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addHLTvsOffHistograms() { + + addHistogram(new TH2F("HLT_Off_EtCor", "HLT vs Offline Missing E_{T} ; Offline MET ; HLT MET", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH2F("HLT_Off_SumEtCor", "HLT vs Offline Sum |E_{T}| ; Offline SumEt ; HLT SumEt", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH2F("HLT_Off_PhiCor", "HLT vs Offline #phi ; Offline #phi ; HLT #phi", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("HLT_Off_dEt", "#DeltaE_{T}(HLT-Offline) ; dEt", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("HLT_Off_dPhi", "#Delta#phi(HLT-Offline) ; dPhi", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("HLT_Off_dEx", "#DeltaE_{x}(HLT-Offline) ; dEx", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("HLT_Off_dEy", "#DeltaE_{y}(HLT-Offline) ; dEy", m_det_bins, m_det_min, m_det_max)); + +} +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillHLTvsOffHistograms(float hlt_met,float hlt_ex,float hlt_ey,float hlt_sumet,float hlt_phi,float off_met,float off_ex,float off_ey,float off_sumet,float off_phi) { + + TH1 *h(0); + TH2 *h2(0); + if ((h2 = hist2("HLT_Off_EtCor"))) h2->Fill(off_met, hlt_met); + if ((h2 = hist2("HLT_Off_SumEtCor"))) h2->Fill(off_sumet, hlt_sumet); + if ((h2 = hist2("HLT_Off_PhiCor")) && hlt_met>0) h2->Fill(off_phi, hlt_phi); + if ((h = hist("HLT_Off_dEt"))) h->Fill(hlt_met - off_met); + double dphi = signed_delta_phi(hlt_phi, off_phi); + if ((h = hist("HLT_Off_dPhi")) && hlt_met>0) h->Fill(dphi); + if ((h = hist("HLT_Off_dEx"))) h->Fill(hlt_ex - off_ex); + if ((h = hist("HLT_Off_dEy"))) h->Fill(hlt_ey - off_ey); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addL1vsOffHistograms() { + + addHistogram(new TH2F("L1_Off_EtCor", "L1 vs Offline Missing E_{T} ; Offline MET ; L1 MET", m_et_bins, m_et_min, m_et_max, m_et_bins, m_et_min, m_et_max)); + addHistogram(new TH2F("L1_Off_SumEtCor", "L1 vs Offline Sum |E_{T}| ; Offline SumEt ; L1 SumEt", m_sumet_bins, m_sumet_min, m_sumet_max, m_sumet_bins, m_sumet_min, m_sumet_max)); + addHistogram(new TH2F("L1_Off_PhiCor", "L1 vs Offline #phi ; Offline #phi ; L1 #phi", m_phi_bins, m_phi_min, m_phi_max, m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("L1_Off_dEt", "#DeltaE_{T}(L1-Offline) ; dEt", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("L1_Off_dPhi", "#Delta#phi(L1-Offline) ; dPhi", m_phi_bins, m_phi_min, m_phi_max)); + addHistogram(new TH1F("L1_Off_dEx", "#DeltaE_{x}(L1-Offline) ; dEx", m_det_bins, m_det_min, m_det_max)); + addHistogram(new TH1F("L1_Off_dEy", "#DeltaE_{y}(L1-Offline) ; dEy", m_det_bins, m_det_min, m_det_max)); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::fillL1vsOffHistograms(float l1_met,float l1_mex,float l1_mey,float l1_sumet,float l1_phi,float off_met,float off_ex,float off_ey,float off_sumet,float off_phi,float saturated) { + + TH1 *h(0); + TH2 *h2(0); + if ((h2 = hist2("L1_Off_EtCor"))) h2->Fill(off_met, l1_met); + if ((h2 = hist2("L1_Off_SumEtCor"))) h2->Fill(off_sumet, l1_sumet); + if ((h2 = hist2("L1_Off_PhiCor")) && l1_met>0 && !saturated) h2->Fill(off_phi, l1_phi); + if ((h = hist("L1_Off_dEt"))) h->Fill(l1_met - off_met); + double dphi = signed_delta_phi(l1_phi, off_phi); + if ((h = hist("L1_Off_dPhi")) && l1_met>0) h->Fill(dphi); + if ((h = hist("L1_Off_dEx"))) h->Fill(l1_mex - off_ex); + if ((h = hist("L1_Off_dEy"))) h->Fill(l1_mey - off_ey); + +} + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::addElMuHistograms() { + + // muon histograms + addHistogram(new TH1F("HLT_electronpt", "HLT Electron Pt (GeV)", 50, 0, 100)); + addHistogram(new TH1F("HLT_electronmult", "HLT Electron Multiplicity", 10, 0, 10)); + + // electron histograms + addHistogram(new TH1F("HLT_muonpt", "HLT Muon Pt (GeV)", 200, 0, 100)); + addHistogram(new TH1F("HLT_muonmult", "HLT Muon Multiplicity", 10, 0, 10)); + +} + + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::trigger_decision() { + + std::vector<std::map<std::string,int>> v_met_signatures_tolook_shifter; + v_met_signatures_tolook_shifter.push_back(m_l1_met_signatures_tolook_shifter); + v_met_signatures_tolook_shifter.push_back(m_hlt_met_signatures_tolook_shifter); + + if (m_print_met_trig_stats) { + std::map<std::string,int>::iterator iter; + for (unsigned int i = 0; i<v_met_signatures_tolook_shifter.size(); i++) { + for (iter = v_met_signatures_tolook_shifter[i].begin(); iter != v_met_signatures_tolook_shifter[i].end(); ++iter) { + std::string name = iter->first; + if (getTDT()->isPassed(name, TrigDefs::eventAccepted)) { + iter->second +=1; + } + } + } + } +} + //___________________________________________________________________________________________________________ std::string HLTMETMonTool::get_trigger_level(std::string item) { @@ -1506,6 +1787,8 @@ std::string HLTMETMonTool::get_trigger_level(std::string item) return item.substr(0, n); } + +//___________________________________________________________________________________________________________ std::string HLTMETMonTool::get_trigger_algo(std::string item) { std::string algo = ""; @@ -1535,7 +1818,9 @@ std::string HLTMETMonTool::get_trigger_algo(std::string item) return algo; } -void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map<std::string,int> &signatures) { + +//___________________________________________________________________________________________________________ +void HLTMETMonTool::check_triggers(std::vector<std::string>& v_triggers, std::map<std::string,int> &v_signatures) { const std::vector<std::string> trig_L1_items = getTDT()->getListOfTriggers("L1_.*"); const std::vector<std::string> trig_EF_items = getTDT()->getListOfTriggers("EF_.*"); @@ -1543,9 +1828,9 @@ void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map< std::vector<std::string>::const_iterator iter; - for (unsigned int it = 0; it < triggers.size(); ++it) { // Loop over trigger items + for (unsigned int it = 0; it < v_triggers.size(); ++it) { // Loop over trigger items - std::string item = triggers[it]; + std::string item = v_triggers[it]; std::string trig_level = get_trigger_level(item); //item.substr(0,3); ATH_MSG_DEBUG("signature " << item << " requested"); @@ -1557,7 +1842,7 @@ void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map< std::string L1name = *iter; if (L1name == item) { triggerFound = true; - signatures.insert(std::map<std::string,int>::value_type(item, 0)); + v_signatures.insert(std::map<std::string,int>::value_type(item, 0)); } } if (!triggerFound) { @@ -1569,7 +1854,7 @@ void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map< std::string EFname = *iter; if (EFname == item) { triggerFound = true; - signatures.insert(std::map<std::string,int>::value_type(item, 0)); + v_signatures.insert(std::map<std::string,int>::value_type(item, 0)); } } if (!triggerFound) @@ -1580,7 +1865,7 @@ void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map< std::string HLTname = *iter; if (HLTname == item) { triggerFound = true; - signatures.insert(std::map<std::string,int>::value_type(item, 0)); + v_signatures.insert(std::map<std::string,int>::value_type(item, 0)); } } if (!triggerFound) @@ -1594,15 +1879,15 @@ void HLTMETMonTool::check_triggers(std::vector<std::string>& triggers, std::map< void HLTMETMonTool::print_trigger_stats() { // L1 - ATH_MSG_DEBUG("Level-1 Met Triggers to look: " << m_l1_met_signatures_tolook.size()); + ATH_MSG_DEBUG("Level-1 Met Triggers to look: " << m_l1_met_signatures_tolook_shifter.size()); std::map<std::string,int>::iterator iter; - for (iter = m_l1_met_signatures_tolook.begin(); iter!= m_l1_met_signatures_tolook.end(); ++iter) { + for (iter = m_l1_met_signatures_tolook_shifter.begin(); iter!= m_l1_met_signatures_tolook_shifter.end(); ++iter) { ATH_MSG_DEBUG("Events passing " << iter->first << ": " << iter->second); } // EF - ATH_MSG_DEBUG("HLT Met Triggers to look: " << m_hlt_met_signatures_tolook.size()); - for (iter = m_hlt_met_signatures_tolook.begin(); iter != m_hlt_met_signatures_tolook.end(); ++iter) { + ATH_MSG_DEBUG("HLT Met Triggers to look: " << m_hlt_met_signatures_tolook_shifter.size()); + for (iter = m_hlt_met_signatures_tolook_shifter.begin(); iter != m_hlt_met_signatures_tolook_shifter.end(); ++iter) { ATH_MSG_DEBUG("Events passing " << iter->first << ": " << iter->second); } } @@ -1628,8 +1913,8 @@ double HLTMETMonTool::signed_delta_phi(double phi1, double phi2) { double e_log = -9e9; - if (std::abs(e) > epsilon) - e_log = copysign(log10(std::abs(e)), e); + if (fabsf(e) > epsilon) + e_log = copysign(log10(fabsf(e)), e); else e_log = 0.01; diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDM.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDM.py index af1bd17fd728109a573fc7df55b5cee258129aed..ecad149c6ccf1cdd0fcdb57b456b6eb6290ef6b9 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDM.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDM.py @@ -350,9 +350,17 @@ TriggerHLTList = [ ('xAOD::TrigMissingET#HLT_TrigEFMissingET_mht', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_mhtAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), - ('xAOD::TrigMissingET#HLT_TrigEFMissingET_trkmht', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), - ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_trkmhtAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), - + ('xAOD::TrigMissingET#HLT_TrigEFMissingET_topocltrk_PUC_nojcalib', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), + ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_topocltrk_PUC_nojcalibAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), + + ('xAOD::TrigMissingET#HLT_TrigEFMissingET_trkmht', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_trkmhtAux.', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingET#HLT_TrigEFMissingET_trkmhtFTK', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_trkmhtFTKAux.', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingET#HLT_TrigEFMissingET_trktc', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_trktcAux.', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingET#HLT_TrigEFMissingET_trktcFTK', 'BS ESD AODFULL AODSLIM', 'MET'), + ('xAOD::TrigMissingETAuxContainer#HLT_TrigEFMissingET_trktcFTKAux.', 'BS ESD AODFULL AODSLIM', 'MET'), ('xAOD::TrigMissingET#HLT_TrigL2MissingET_FEB', 'BS ESD AODFULL AODSLIM', 'MET'), diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py index cbe97169148d4352a41d99cb0805ce6cdf573082..27d5d51fba24459154a2260a26fbc68c72e67ee2 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py @@ -298,14 +298,15 @@ METChainParts = { 'threshold' : '', 'multiplicity' : '', 'topo' : AllowedTopos_xe, - 'trigType' : ['xe'], + 'trigType' : ['xe'], 'extra' : ['noL1'], - 'calib' : ['lcw','had','em'], + 'calib' : ['lcw','had','em'], + 'jetCalib' : JetChainParts['jetCalib'], 'L2recoAlg' : ['','l2fsperf','L2FS'], - 'EFrecoAlg' : ['tc','cell','pueta','mht','pufit'], + 'EFrecoAlg' : ['tc','cell','pueta','mht','trkmht','pufit', 'pufittrack', 'trktc'], 'L2muonCorr' : ['','wL2MuFEB','wEFMuFEB'], 'EFmuonCorr' : ['','wEFMu'], - 'addInfo' : ['FStracks'], + 'addInfo' : ['FStracks','FTK','LArH11offMETphi','LArH12offMETphi','LArH11offLArH12offMETphi','LArH11offMETphiJpt1','LArH11offMETphiJpt2','LArH11offMETphiJpt5','LArH11offMETphiJpt10','LArH11offMETphiJpt20','LArH11offMETphiJpt30','LArH12offMETphiJpt1','LArH12offMETphiJpt2','LArH12offMETphiJpt5','LArH12offMETphiJpt10','LArH12offMETphiJpt20','LArH12offMETphiJpt30','LArH11offLArH12offMETphiJpt1','LArH11offLArH12offMETphiJpt2','LArH11offLArH12offMETphiJpt5','LArH11offLArH12offMETphiJpt10','LArH11offLArH12offMETphiJpt20','LArH11offLArH12offMETphiJpt30','LArH11offJpt1','LArH11offJpt2','LArH11offJpt5','LArH11offJpt10','LArH11offJpt20','LArH11offJpt30','LArH12offJpt1','LArH12offJpt2','LArH12offJpt5','LArH12offJpt10','LArH12offJpt20','LArH12offJpt30','LArH11offLArH12offJpt1','LArH11offLArH12offJpt2','LArH11offLArH12offJpt5','LArH11offLArH12offJpt10','LArH11offLArH12offJpt20','LArH11offLArH12offJpt30'], } # ---- MetDictinary of default Values ---- METChainParts_Default = { @@ -315,6 +316,7 @@ METChainParts_Default = { 'threshold' : '', 'extra' : '', 'calib' : 'lcw', + 'jetCalib' : JetChainParts_Default['jetCalib'], 'L2recoAlg' : '', 'EFrecoAlg' : 'cell', 'L2muonCorr' : '', diff --git a/Trigger/TriggerCommon/TriggerMenu/python/met/METSliceFlags.py b/Trigger/TriggerCommon/TriggerMenu/python/met/METSliceFlags.py index f0a0c95920d6053434f0bd149672e74078e5acc7..ef098a8e112344520a7ac33a4d862a9ae871b6f9 100755 --- a/Trigger/TriggerCommon/TriggerMenu/python/met/METSliceFlags.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/met/METSliceFlags.py @@ -2,10 +2,8 @@ """ MET slice specific flags """ - -from AthenaCommon.Logging import logging -from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties -from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper, AllowedList +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper # create container __author__ = 'T. Bold' diff --git a/Trigger/TriggerCommon/TriggerMenu/python/met/MissingETDef.py b/Trigger/TriggerCommon/TriggerMenu/python/met/MissingETDef.py index 300be93e66518ebcab9290a31914593213d8fc17..33939f14a379b29f943bddd94d99890dbdc43e7e 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/met/MissingETDef.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/met/MissingETDef.py @@ -12,31 +12,46 @@ from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) log = logging.getLogger("TriggerMenu.met.MissingETDef") +def trace(frame, event, arg): + if event == "call": + filename = frame.f_code.co_filename + lineno = frame.f_lineno + print "%s @ %s" % (filename, lineno) + return trace + + + from TrigEFMissingET.TrigEFMissingETConfig import (EFMissingET_Fex_2sidednoiseSupp, EFMissingET_Fex_Jets, + EFMissingET_Fex_TrackAndJets, + EFMissingET_Fex_FTKTrackAndJets, + EFMissingET_Fex_TrackAndClusters, + EFMissingET_Fex_FTKTrackAndClusters, EFMissingET_Fex_topoClusters, EFMissingET_Fex_topoClustersPS, - EFMissingET_Fex_topoClustersPUC) + EFMissingET_Fex_topoClustersPUC, + EFMissingET_Fex_topoClustersTracksPUC) -from TrigL2MissingET.TrigL2MissingETConfig import (L2CaloMissingET_Fex_ReadL2L1, - L2MissingET_Fex) +from TrigL2MissingET.TrigL2MissingETConfig import L2MissingET_Fex from TrigMissingETHypo.TrigMissingETHypoConfig import (EFMetHypoJetsXE, + EFMetHypoTrackAndJetsXE, + EFMetHypoFTKTrackAndJetsXE, + EFMetHypoTrackAndClustersXE, + EFMetHypoFTKTrackAndClustersXE, EFMetHypoTCPSXE, EFMetHypoTCPUCXE, + EFMetHypoTCTrkPUCXE, EFMetHypoTCXE, EFMetHypoTE, EFMetHypoXE, - EFMetHypoXS_2sided, - L2MetHypoFEBXE, - L2MetHypoXE) + EFMetHypoXS_2sided) from TrigMissingETMuon.TrigMissingETMuonConfig import (EFTrigMissingETMuon_Fex, EFTrigMissingETMuon_Fex_Jets, EFTrigMissingETMuon_Fex_topocl, EFTrigMissingETMuon_Fex_topoclPS, EFTrigMissingETMuon_Fex_topoclPUC, - L2CaloTrigMissingETMuon_Fex, L2TrigMissingETMuon_Fex) from TrigGenericAlgs.TrigGenericAlgsConf import PESA__DummyUnseededAllTEAlgo @@ -46,6 +61,7 @@ from TriggerMenu.menu import DictFromChainName from TriggerMenu.menu.HltConfig import L2EFChainDef, mergeRemovingOverlap from TriggerMenu.menu.MenuUtils import splitChainDict from TriggerMenu.muon.MuonDef import L2EFChain_mu +from TriggerMenu.menu.SignatureDicts import METChainParts_Default ############################################################################# class L2EFChain_met(L2EFChainDef): @@ -57,6 +73,8 @@ class L2EFChain_met(L2EFChainDef): self.EFsignatureList = [] self.TErenamingDict = [] + # May as well give the methods easy access to all the input information + self.chainDict = chainDict l1_item_name = chainDict['L1item'] self.l2_input_tes = '' ##MET is un-seeded chain_counter = chainDict['chainCounter'] @@ -102,9 +120,9 @@ class L2EFChain_met(L2EFChainDef): threshold = int(self.chainPart['threshold']) calibration = self.chainPart['calib'] + jetCalib = self.chainPart['jetCalib'] L2recoAlg = self.chainPart['L2recoAlg'] - EFrecoAlg = self.chainPart['EFrecoAlg'] - L2muon = self.chainPart['L2muonCorr'] + EFrecoAlg = self.chainPart['EFrecoAlg'] EFmuon = self.chainPart['EFmuonCorr'] addInfo = self.chainPart["addInfo"] @@ -133,22 +151,10 @@ class L2EFChain_met(L2EFChainDef): ##L1 MET theL2Fex = L2MissingET_Fex() theL2MuonFex = L2TrigMissingETMuon_Fex() - - ##FEB MET at L2 -# theL2FEBL1Check = L2CaloMissingET_Fex_ReadL2L1() - -# theL2FEBMuonFex = L2CaloTrigMissingETMuon_Fex() - - mucorr= '_wMu' if L2muon else '' - if L2recoAlg=="L2FS": - theL2MuonHypo = L2MetHypoFEBXE(name='L2MetHypo_xe%d%s_FEB'%(threshold,mucorr),l2_thr=threshold*GeV) - else: - theL2MuonHypo = L2MetHypoXE('L2MetHypo_xe_noL2%s' %mucorr,l2_thr=threshold*GeV) - mucorr= '_wMu' if EFmuon else '' ##MET with topo-cluster - if EFrecoAlg=='tc' or EFrecoAlg=='pueta' or EFrecoAlg=='pufit' or EFrecoAlg=='mht': + if EFrecoAlg=='tc' or EFrecoAlg=='pueta' or EFrecoAlg=='pufit' or EFrecoAlg=='mht' or EFrecoAlg=='trkmht' or EFrecoAlg=='pufittrack' or EFrecoAlg=='trktc': ##Topo-cluster if EFrecoAlg=='tc': @@ -168,23 +174,86 @@ class L2EFChain_met(L2EFChainDef): theEFMETHypo = EFMetHypoTCXE('EFMetHypo_TC_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) if EFrecoAlg=='pufit': + + doLArH11off=False + doLArH12off=False + LArTag='' + if "LArH11off" in addInfo: + doLArH11off = True + LArTag += '_LArH11off' + if "LArH12off" in addInfo: + doLArH12off = True + LArTag += '_LArH12off' + if "METphi" in addInfo: + LArTag += '_METphi' + + jpt_thr = '-1' + if len(addInfo.split('Jpt'))==2: jpt_thr = addInfo.split('Jpt')[1] + + if "Jpt" in addInfo: + LArTag += '_Jpt'+jpt_thr + #MET fex - theEFMETFex = EFMissingET_Fex_topoClustersPUC() + theEFMETFex = EFMissingET_Fex_topoClustersPUC("EFMissingET_Fex_topoClustersPUC%s"%(addInfo),doLArH11off,doLArH12off,float(jpt_thr)) #Muon correction fex theEFMETMuonFex = EFTrigMissingETMuon_Fex_topoclPUC() mucorr= '_wMu' if EFmuon else '' - theEFMETHypo = EFMetHypoTCPUCXE('EFMetHypo_TCPUC_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + + theEFMETHypo = EFMetHypoTCPUCXE('EFMetHypo_TCPUC'+LArTag+'_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV,labelMET=addInfo) + + + if EFrecoAlg=='pufittrack': + calibCorr = ('_{0}'.format(calibration) if calibration != METChainParts_Default['calib'] else '') + ('_{0}'.format(jetCalib) if jetCalib != METChainParts_Default['jetCalib'] else '') + #MET fex + #print "PUFITTRACK XXXXXXXXXX" + #print calibCorr + theEFMETFex = EFMissingET_Fex_topoClustersTracksPUC("EFMissingET_Fex_topoClustersTracksPUC{0}".format(calibCorr), extraCalib=calibCorr) + #print "PUFITTRACK XXXXXXXXXX" + #print theEFMETFex + #Muon correction fex + theEFMETMuonFex = EFTrigMissingETMuon_Fex_topoclPUC() + #print theEFMETMuonFex + mucorr= '_wMu' if EFmuon else '' + #theEFMETHypo = EFMetHypoTCTrkPUCXE('EFMetHypo_TCTrkPUC_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + theEFMETHypo = EFMetHypoTCTrkPUCXE('EFMetHypo_TCTrkPUC_xe%s_tc%s%s%s'%(threshold,jetCalib,calibration,mucorr),ef_thr=float(threshold)*GeV, extraCalib=calibCorr) ##MET based on trigger jets if EFrecoAlg=='mht': + calibCorr = ('_{0}'.format(calibration) if calibration != METChainParts_Default['calib'] else '') + ('_{0}'.format(jetCalib) if jetCalib != METChainParts_Default['jetCalib'] else '') + #MET fex - theEFMETFex = EFMissingET_Fex_Jets() + theEFMETFex = EFMissingET_Fex_Jets("EFMissingET_Fex_Jets{0}".format(calibCorr), extraCalib=calibCorr ) #Muon correction fex - theEFMETMuonFex = EFTrigMissingETMuon_Fex_Jets() + theEFMETMuonFex = EFTrigMissingETMuon_Fex_Jets("EFTrigMissingETMuon_Fex_Jets{0}".format(calibCorr) ) #mucorr= '_wMu' if EFmuon else '' - theEFMETHypo = EFMetHypoJetsXE('EFMetHypo_Jets_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + theEFMETHypo = EFMetHypoJetsXE('EFMetHypo_Jets_xe%s_tc%s%s%s'%(threshold,jetCalib,calibration,mucorr),ef_thr=float(threshold)*GeV, extraCalib=calibCorr) + + + ##MET based on trigger jets + if EFrecoAlg=='trkmht': + #MET fex + if "FTK" in addInfo: theEFMETFex = EFMissingET_Fex_FTKTrackAndJets() + else: theEFMETFex = EFMissingET_Fex_TrackAndJets() + #Muon correction fex + ## this will be added later + theEFMETMuonFex = EFTrigMissingETMuon_Fex_Jets() + #mucorr= '_wMu' if EFmuon else '' + if "FTK" in addInfo: theEFMETHypo = EFMetHypoFTKTrackAndJetsXE('EFMetHypo_FTKTrackAndJets_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + else: theEFMETHypo = EFMetHypoTrackAndJetsXE('EFMetHypo_TrackAndJets_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + - + if EFrecoAlg=='trktc': + #MET fex + if "FTK" in addInfo: theEFMETFex = EFMissingET_Fex_FTKTrackAndClusters() + else: theEFMETFex = EFMissingET_Fex_TrackAndClusters() + #Muon correction fex + ## this will never be used + theEFMETMuonFex = EFTrigMissingETMuon_Fex_topocl() + #mucorr= '_wMu' if EFmuon else '' + if "FTK" in addInfo: theEFMETHypo = EFMetHypoFTKTrackAndClustersXE('EFMetHypo_FTKTrackAndClusters_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + else: theEFMETHypo = EFMetHypoTrackAndClustersXE('EFMetHypo_TrackAndClusters_xe%s_tc%s%s'%(threshold,calibration,mucorr),ef_thr=float(threshold)*GeV) + + ##Topo-cluster with Pile-up suppression if EFrecoAlg=='pueta': #MET fex @@ -210,26 +279,38 @@ class L2EFChain_met(L2EFChainDef): elif self.chainPart['trigType'] == "te": theEFMETHypo = EFMetHypoTE('EFMetHypo_te%d'% threshold,ef_thr=threshold*GeV) else: - theEFMETHypo = EFMetHypoXE('EFMetHypo_xe%s%s'%(threshold,mucorr),ef_thr=float(threshold)*GeV) + LArTag='' + if "LArH11off" in addInfo: LArTag += '_LArH11off' + if "LArH12off" in addInfo: LArTag += '_LArH12off' + if "METphi" in addInfo: LArTag += '_METphi' + theEFMETHypo = EFMetHypoXE('EFMetHypo'+LArTag+'_xe%s%s'%(threshold,mucorr),ef_thr=float(threshold)*GeV) else: log.warning("MET EF algorithm not recognised") #---------------------------------------------------- - # Obtaining the needed jet TEs from the jet code + # Obtaining the needed jet TEs from the jet code and b-jet code #---------------------------------------------------- from TriggerJobOpts.TriggerFlags import TriggerFlags - if "v6" in TriggerFlags.triggerMenuSetup() or "v5" in TriggerFlags.triggerMenuSetup(): - chain = ['j0_lcw', '', [], ["Main"], ['RATE:SingleJet', 'BW:Jet'], -1] - else: - chain = ['j0', '', [], ["Main"], ['RATE:SingleJet', 'BW:Jet'], -1] + + from TriggerMenu.bjet.generateBjetChainDefs import generateChainDefs as generateBjetChainDefs + + chain = ['j0_{0}_{1}'.format(calibration, jetCalib), '', [], ["Main"], ['RATE:SingleJet', 'BW:Jet'], -1] theDictFromChainName = DictFromChainName.DictFromChainName() jetChainDict = theDictFromChainName.getChainDict(chain) jetChainDict['chainCounter'] = 9151 jetChainDef = generateHLTChainDef(jetChainDict) - + #This is a dummy b-jet chain, with a threshold at 20 GeV at the uncalibrated scale. It computes the tracks within each jet RoI. + #Change the calibration by changing 'nojcalib' to the desired calibration scale. + #For pufittrack, we found that the performance was superior using uncalibrated jets. + dummy_bjet_chain = ['j20_{0}_{1}_boffperf_split'.format(calibration, jetCalib), '', [], ["Main"], ['RATE:SingleBJet', 'BW:BJet'], -1] + bjet_chain_dict = theDictFromChainName.getChainDict(dummy_bjet_chain) + bjet_chain_dict["chainCounter"] = 9152 + bjet_chain_dict['topoThreshold'] = None + bjet_chain_def = generateBjetChainDefs(bjet_chain_dict) + #for i in range(3): # m_input[i] = jetChainDef.sequenceList[i]['input'] # m_output[i]= jetChainDef.sequenceList[i]['output'] @@ -271,27 +352,59 @@ class L2EFChain_met(L2EFChainDef): self.L2sequenceList += [[ self.l2_input_tes, [theL2Fex], 'L2_xe_step1']] ##Moun Correction to L1 MET self.L2sequenceList += [[ ['L2_xe_step1', muonSeed], [theL2MuonFex], 'L2_xe_step2']] - - # ##FEB Met - # self.L2sequenceList += [[ 'L2_xe_step2', [theL2FEBL1Check], 'L2_xe_step3']] - - # if L2recoAlg=="l2fsperf": - # #Only execute Muon FEB MET and muon correction - # self.L2sequenceList += [[ ['L2_xe_step3',muonSeed], [theL2FEBMuonFex], 'L2_xe_step4']] - # if L2recoAlg=="L2FS": - # #Hypo on FEB MET - # self.L2sequenceList += [[ ['L2_xe_step3',muonSeed], [theL2FEBMuonFex,theL2MuonHypo], 'L2_xe_step4']] # --- EF --- + + # cell preselection (v7 onwards only) + # First check if we're in a multipart chain (for now assume that we don't apply the preselection for these) + isMulitpartChain = self.chainPart['chainPartName'] != self.chainDict['chainName'] + if EFrecoAlg != 'cell' and 'v6' not in TriggerFlags.triggerMenuSetup() and 'v5' not in TriggerFlags.triggerMenuSetup() and not isMulitpartChain: + # if EFrecoAlg != 'cell' and TriggerFlags.run2Config() != '2016' and not isMulitpartChain: + # a few parameters + cellPresel_minL1Threshold = 50 + cellPresel_threshold = 50 + # work out what the L1 threshold is + import re + match = re.match("L1_XE(\d+)", self.chainDict['L1item']) + if match: + if int(match.group(1) ) >= cellPresel_minL1Threshold: + cellPreselectionFex = EFMissingET_Fex_2sidednoiseSupp() + cellPreselectionMuonFex = EFTrigMissingETMuon_Fex() + cellPreselectionHypo = EFMetHypoXE('EFMetHypo_xe{0}_presel'.format(cellPresel_threshold), ef_thr = float(cellPresel_threshold) * GeV) + + self.EFsequenceList += [[ [''], [cellPreselectionFex], 'EF_xe{0}_step1'.format(cellPresel_threshold) ]] + self.EFsequenceList += [[ ['EF_xe{0}_step1'.format(cellPresel_threshold), muonSeed], [cellPreselectionMuonFex, cellPreselectionHypo], 'EF_xe{0}_step2'.format(cellPresel_threshold) ]] + + self.EFsignatureList += [ [['EF_xe{0}_step1'.format(cellPresel_threshold)]] ] + self.EFsignatureList += [ [['EF_xe{0}_step2'.format(cellPresel_threshold)]] ] + else: + log.info("Pure MET chain doesn't have an L1_XE seed! Will not apply the cell preselection") + + #topocluster if EFrecoAlg=='tc' or EFrecoAlg=='pueta' or EFrecoAlg=='pufit': self.EFsequenceList +=[[ input0,algo0, output0 ]] self.EFsequenceList +=[[ input1,algo1, output1 ]] self.EFsequenceList +=[[ input2,algo2, output2 ]] self.EFsequenceList +=[[ input3,algo3, output3 ]] - self.EFsequenceList +=[[ [output3], [theEFMETFex], 'EF_xe_step1' ]] + self.EFsequenceList +=[[ input4,algo4, output4 ]] + self.EFsequenceList +=[[ [output3,output4], [theEFMETFex], 'EF_xe_step1' ]] self.EFsequenceList +=[[ ['EF_xe_step1',muonSeed], [theEFMETMuonFex, theEFMETHypo], 'EF_xe_step2' ]] - + + + elif EFrecoAlg=='pufittrack': + makelist = lambda x: x if isinstance(x, list) else [x] + self.EFsequenceList += [ [ x['input'], makelist(x['algorithm']), x['output'] ] for x in bjet_chain_def.sequenceList[:-2] ] +# for x in bjet_chain_def.sequenceList[:-2]: +# print x +# print self.EFsequenceList[4][2], "Clusters, output EF_FSTopoClusters" +# print self.EFsequenceList[6][2], "Jets, output EF_8389636500743033767_jetrec_a4tclcwnojcalibFS" +# print self.EFsequenceList[-1][2], "Tracks, output HLT_j20_eta_jsplit_IDTrig" +# print self.EFsequenceList[-5][2], "Vertex, output HLT_superIDTrig_prmVtx" +# Fill the sequence with clusters, jets, tracks, vertices + self.EFsequenceList += [[ [self.EFsequenceList[4][2],self.EFsequenceList[6][2],self.EFsequenceList[-1][2],self.EFsequenceList[-5][2]], [theEFMETFex], 'EF_xe_step1' ]] + self.EFsequenceList += [[ ['EF_xe_step1',muonSeed], [theEFMETMuonFex, theEFMETHypo], 'EF_xe_step2' ]] + #trigger-jet based MET elif EFrecoAlg=='mht': self.EFsequenceList +=[[ input0,algo0, output0 ]] @@ -303,12 +416,61 @@ class L2EFChain_met(L2EFChainDef): self.EFsequenceList +=[[ ['EF_xe_step1',muonSeed], [theEFMETMuonFex, theEFMETHypo], 'EF_xe_step2' ]] if "FStracks" in addInfo: from TrigInDetConf.TrigInDetSequence import TrigInDetSequence - trk_algs = TrigInDetSequence("FullScan", "fullScan", "IDTrig", "FTF").getSequence() - print "XXXXXXXXXXXXXXXXXX" + trk_algs = TrigInDetSequence("FullScan", "fullScan", "IDTrig", sequenceFlavour=["FTF"]).getSequence() print trk_algs[0] dummyAlg = PESA__DummyUnseededAllTEAlgo("EF_DummyFEX_xe") self.EFsequenceList +=[[ [''], [dummyAlg]+trk_algs[0], 'EF_xe_step3' ]] + elif EFrecoAlg=='trkmht': + self.EFsequenceList +=[[ input0,algo0, output0 ]] + self.EFsequenceList +=[[ input1,algo1, output1 ]] + self.EFsequenceList +=[[ input2,algo2, output2 ]] + self.EFsequenceList +=[[ input3,algo3, output3 ]] + self.EFsequenceList +=[[ input4,algo4, output4 ]] + + ##adding FTK tracks in the sequence, + ##if not, adding FullScan tracks + if "FTK" in addInfo: + from TrigInDetConf.TrigInDetFTKSequence import TrigInDetFTKSequence + trk_algs = TrigInDetFTKSequence("FullScan", "fullScan", sequenceFlavour=["FTKVtx"]).getSequence() + dummyAlg = PESA__DummyUnseededAllTEAlgo("EF_DummyFEX_xe") + self.EFsequenceList +=[[ [''], [dummyAlg]+trk_algs[0]+trk_algs[1], 'EF_xe_step0' ]] + + else: + from TrigInDetConf.TrigInDetSequence import TrigInDetSequence + trk_algs = TrigInDetSequence("FullScan", "fullScan", "IDTrig", sequenceFlavour=["FTF"]).getSequence() + dummyAlg = PESA__DummyUnseededAllTEAlgo("EF_DummyFEX_xe") + self.EFsequenceList +=[[ [''], [dummyAlg]+trk_algs[0], 'EF_xe_step0' ]] + + self.EFsequenceList +=[[ [output4,'EF_xe_step0',muonSeed], [theEFMETFex], 'EF_xe_step1' ]] + self.EFsequenceList +=[[ ['EF_xe_step1',muonSeed], [theEFMETMuonFex, theEFMETHypo], 'EF_xe_step2' ]] + + + elif EFrecoAlg=='trktc': + self.EFsequenceList +=[[ input0,algo0, output0 ]] + self.EFsequenceList +=[[ input1,algo1, output1 ]] + self.EFsequenceList +=[[ input2,algo2, output2 ]] + self.EFsequenceList +=[[ input3,algo3, output3 ]] + #self.EFsequenceList +=[[ input4,algo4, output4 ]] + + ##adding FTK tracks in the sequence, + ##if not, adding FullScan tracks + if "FTK" in addInfo: + from TrigInDetConf.TrigInDetFTKSequence import TrigInDetFTKSequence + trk_algs = TrigInDetFTKSequence("FullScan", "fullScan", sequenceFlavour=["FTKVtx"]).getSequence() + dummyAlg = PESA__DummyUnseededAllTEAlgo("EF_DummyFEX_xe") + self.EFsequenceList +=[[ [''], [dummyAlg]+trk_algs[0]+trk_algs[1], 'EF_xe_step0' ]] + + else: + from TrigInDetConf.TrigInDetSequence import TrigInDetSequence + trk_algs = TrigInDetSequence("FullScan", "fullScan", "IDTrig", sequenceFlavour=["FTF"]).getSequence() + dummyAlg = PESA__DummyUnseededAllTEAlgo("EF_DummyFEX_xe") + self.EFsequenceList +=[[ [''], [dummyAlg]+trk_algs[0], 'EF_xe_step0' ]] + + self.EFsequenceList +=[[ [output3,'EF_xe_step0',muonSeed], [theEFMETFex], 'EF_xe_step1' ]] + self.EFsequenceList +=[[ ['EF_xe_step1',muonSeed], [theEFMETMuonFex, theEFMETHypo], 'EF_xe_step2' ]] + + #cell based MET elif EFrecoAlg=='cell': self.EFsequenceList +=[[ [''], [theEFMETFex], 'EF_xe_step1' ]] @@ -319,9 +481,9 @@ class L2EFChain_met(L2EFChainDef): if L2recoAlg=="l2fsperf" or L2recoAlg=="L2FS" : self.L2signatureList += [ [['L2_xe_step1']] ] self.L2signatureList += [ [['L2_xe_step2']] ] -# self.L2signatureList += [ [['L2_xe_step3']] ] -# self.L2signatureList += [ [['L2_xe_step4']] ] + if EFrecoAlg=="trkmht" or EFrecoAlg=="trktc" : + self.EFsignatureList += [ [['EF_xe_step0']] ] self.EFsignatureList += [ [['EF_xe_step1']] ] self.EFsignatureList += [ [['EF_xe_step2']] ] @@ -335,8 +497,11 @@ class L2EFChain_met(L2EFChainDef): if L2recoAlg=="l2fsperf" or L2recoAlg=="L2FS" : self.TErenamingDict['L2_xe_step1']= mergeRemovingOverlap('L2_', self.sig_id_noMult+'_step1') self.TErenamingDict['L2_xe_step2']= mergeRemovingOverlap('L2_', self.sig_id_noMult+'_step2') -# self.TErenamingDict['L2_xe_step3']= mergeRemovingOverlap('L2_', self.sig_id_noMult+'_step3') -# self.TErenamingDict['L2_xe_step4']= mergeRemovingOverlap('L2_', self.sig_id_noMult+'_step4') + + if EFrecoAlg=='trkmht' or EFrecoAlg=='trktc': + self.TErenamingDict['EF_xe_step0']= mergeRemovingOverlap('EF_', self.sig_id_noMult+"_step0") + #if EFrecoAlg=='pufittrack': + # self.TErenamingDict['EF_xe_step0']= mergeRemovingOverlap('EF_', self.sig_id_noMult+"_step0") self.TErenamingDict['EF_xe_step1']= mergeRemovingOverlap('EF_', self.sig_id_noMult+'_step1') if "FStracks" in addInfo: