Skip to content
Snippets Groups Projects
Commit c96ccfbe authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

PhotonEfficiencyCorrection tidy code and add ATLAS_CHECK_THREAD_SAFETY

parent 4cd48938
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!42230PhotonEfficiencyCorrection tidy code and add ATLAS_CHECK_THREAD_SAFETY
PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection
...@@ -44,7 +44,7 @@ class AsgPhotonEfficiencyCorrectionTool ...@@ -44,7 +44,7 @@ class AsgPhotonEfficiencyCorrectionTool
public: public:
/// Standard constructor /// Standard constructor
AsgPhotonEfficiencyCorrectionTool ( const std::string myname ); AsgPhotonEfficiencyCorrectionTool ( const std::string& myname );
/// Standard destructor /// Standard destructor
virtual ~AsgPhotonEfficiencyCorrectionTool(); virtual ~AsgPhotonEfficiencyCorrectionTool();
...@@ -108,7 +108,7 @@ private: ...@@ -108,7 +108,7 @@ private:
std::string m_sysSubstring; std::string m_sysSubstring;
// Get the correction filename from the map // Get the correction filename from the map
std::string getFileName(std::string isoWP, std::string trigWP, bool isConv); std::string getFileName(const std::string& isoWP, const std::string& trigWP, bool isConv);
// Set prefix of the corresponding calibration filenames: // Set prefix of the corresponding calibration filenames:
std::string m_file_prefix_ID="offline.Tight"; std::string m_file_prefix_ID="offline.Tight";
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//IAsgPhotonEfficiencyCorrection.h to be used in the tool.
#ifndef __IASGPHOTONEFFICIENCYCORRECTION__
#define __IASGPHOTONEFFICIENCYCORRECTION__
#include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h"
#pragma message "In the process of moving the Interface part under PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces"
#endif
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#include "PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h" #include "PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h"
// STL includes // STL includes
#include <string>
#include <cfloat> #include <cfloat>
#include <climits>
#include <iostream> #include <iostream>
#include <limits.h> #include <string>
// Include the return object // Include the return object
#include "PATCore/PATCoreEnums.h" #include "PATCore/PATCoreEnums.h"
...@@ -45,11 +45,11 @@ typedef Root::TPhotonEfficiencyCorrectionTool::Result Result; ...@@ -45,11 +45,11 @@ typedef Root::TPhotonEfficiencyCorrectionTool::Result Result;
// ============================================================================= // =============================================================================
// Standard constructor // Standard constructor
// ============================================================================= // =============================================================================
AsgPhotonEfficiencyCorrectionTool::AsgPhotonEfficiencyCorrectionTool( std::string myname ) : AsgPhotonEfficiencyCorrectionTool::AsgPhotonEfficiencyCorrectionTool( const std::string& myname ) :
AsgTool(myname), AsgTool(myname),
m_rootTool_unc(0), m_rootTool_unc(nullptr),
m_rootTool_con(0), m_rootTool_con(nullptr),
m_appliedSystematics(0), m_appliedSystematics(nullptr),
m_sysSubstring("") m_sysSubstring("")
{ {
...@@ -106,11 +106,11 @@ StatusCode AsgPhotonEfficiencyCorrectionTool::initialize() ...@@ -106,11 +106,11 @@ StatusCode AsgPhotonEfficiencyCorrectionTool::initialize()
std::vector < std::string > corrFileNameList; std::vector < std::string > corrFileNameList;
// First check if the tool is initialized using the input files or map // First check if the tool is initialized using the input files or map
if(m_mapFile.size()){ // using map file if(!m_mapFile.empty()){ // using map file
corrFileNameList.push_back(getFileName(m_isoWP,m_trigger,true)); // converted photons input corrFileNameList.push_back(getFileName(m_isoWP,m_trigger,true)); // converted photons input
corrFileNameList.push_back(getFileName(m_isoWP,m_trigger,false)); // unconverted photons input corrFileNameList.push_back(getFileName(m_isoWP,m_trigger,false)); // unconverted photons input
} }
else if(m_corrFileNameConv.size() && m_corrFileNameUnconv.size()){ // initialize the tool using input files (old scheme) else if(!m_corrFileNameConv.empty() && !m_corrFileNameUnconv.empty()){ // initialize the tool using input files (old scheme)
corrFileNameList.push_back(m_corrFileNameConv); corrFileNameList.push_back(m_corrFileNameConv);
corrFileNameList.push_back(m_corrFileNameUnconv); corrFileNameList.push_back(m_corrFileNameUnconv);
} }
...@@ -140,7 +140,7 @@ StatusCode AsgPhotonEfficiencyCorrectionTool::initialize() ...@@ -140,7 +140,7 @@ StatusCode AsgPhotonEfficiencyCorrectionTool::initialize()
if( corrFileNameList[0].find(m_file_prefix_ID) != std::string::npos) m_sysSubstring="ID_"; if( corrFileNameList[0].find(m_file_prefix_ID) != std::string::npos) m_sysSubstring="ID_";
if( corrFileNameList[0].find(m_file_prefix_ISO) != std::string::npos) m_sysSubstring="ISO_"; if( corrFileNameList[0].find(m_file_prefix_ISO) != std::string::npos) m_sysSubstring="ISO_";
if( corrFileNameList[0].find(m_file_prefix_Trig) != std::string::npos) m_sysSubstring="TRIGGER_"; if( corrFileNameList[0].find(m_file_prefix_Trig) != std::string::npos) m_sysSubstring="TRIGGER_";
if(m_sysSubstring == "") {ATH_MSG_ERROR ( "Invalid input file" ); return StatusCode::FAILURE;} if(m_sysSubstring.empty()) {ATH_MSG_ERROR ( "Invalid input file" ); return StatusCode::FAILURE;}
// Configure the underlying Root tool // Configure the underlying Root tool
m_rootTool_con->addFileName( corrFileNameList[0] ); m_rootTool_con->addFileName( corrFileNameList[0] );
...@@ -418,7 +418,7 @@ applySystematicVariation ( const CP::SystematicSet& systConfig ) ...@@ -418,7 +418,7 @@ applySystematicVariation ( const CP::SystematicSet& systConfig )
// Map Key Feature // Map Key Feature
//=============================================================================== //===============================================================================
// Gets the correction filename from map // Gets the correction filename from map
std::string AsgPhotonEfficiencyCorrectionTool::getFileName(std::string isoWP, std::string trigWP, bool isConv) { std::string AsgPhotonEfficiencyCorrectionTool::getFileName(const std::string& isoWP, const std::string& trigWP, bool isConv) {
// First locate the map file: // First locate the map file:
std::string mapFileName = PathResolverFindCalibFile( m_mapFile ); std::string mapFileName = PathResolverFindCalibFile( m_mapFile );
......
...@@ -41,7 +41,7 @@ StatusCode testAthenaPhotonAlg::execute() { ...@@ -41,7 +41,7 @@ StatusCode testAthenaPhotonAlg::execute() {
//---------------------------- //----------------------------
// Event information // Event information
//--------------------------- //---------------------------
const xAOD::EventInfo* eventInfo = 0; //NOTE: Everything that comes from the storegate direct from the input files is const! const xAOD::EventInfo* eventInfo = nullptr; //NOTE: Everything that comes from the storegate direct from the input files is const!
// ask the event store to retrieve the xAOD EventInfo container // ask the event store to retrieve the xAOD EventInfo container
//ATH_CHECK( evtStore()->retrieve( eventInfo, "EventInfo") ); // the second argument ("EventInfo") is the key name //ATH_CHECK( evtStore()->retrieve( eventInfo, "EventInfo") ); // the second argument ("EventInfo") is the key name
...@@ -59,7 +59,7 @@ StatusCode testAthenaPhotonAlg::execute() { ...@@ -59,7 +59,7 @@ StatusCode testAthenaPhotonAlg::execute() {
//--------- //---------
// photons // photons
//--------- //---------
const xAOD::PhotonContainer* photons = 0; const xAOD::PhotonContainer* photons = nullptr;
ATH_CHECK( evtStore()->retrieve( photons, "Photons") ); ATH_CHECK( evtStore()->retrieve( photons, "Photons") );
ATH_MSG_DEBUG("Found "<<photons->size() <<" photons in event, itterate...."); ATH_MSG_DEBUG("Found "<<photons->size() <<" photons in event, itterate....");
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
//michael.pitt@cern.ch //michael.pitt@cern.ch
// System include(s): // System include(s):
#include <stdio.h> #include <boost/filesystem.hpp>
#include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <boost/filesystem.hpp>
// ROOT ide(s): // ROOT ide(s):
#include "TFile.h" #include "TFile.h"
...@@ -67,7 +67,7 @@ int main (int argc, const char * argv[]) { ...@@ -67,7 +67,7 @@ int main (int argc, const char * argv[]) {
// read first run number from the directory name: // read first run number from the directory name:
int run_number = atoi(dirName.Tokenize("_")->First()->GetName()); int run_number = atoi(dirName.Tokenize("_")->First()->GetName());
if(getenv("ROOTCOREDIR")==NULL){ if(getenv("ROOTCOREDIR")==nullptr){
cout << "Please setup RootCore before running the PrintPhotonSF [file]"<<endl; cout << "Please setup RootCore before running the PrintPhotonSF [file]"<<endl;
return 0.; return 0.;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment