47 using namespace asg::TestxAODPhotonAlg;
55 Error(
APP_NAME,
"No file name received!" );
66 std::unique_ptr< TFile >
ifile( TFile::Open(
fileName,
"READ" ) );
73 Info(
APP_NAME,
"Number of events in the file: %i",
78 Long64_t
entries =
event.getEntries();
80 const Long64_t
e = atoll(
argv[ 2 ] );
91 photonSF_ID.
msg().setLevel( mylevel );
92 photonSF_Iso.
msg().setLevel( mylevel );
93 photonSF_Trig.
msg().setLevel( mylevel );
97 ANA_CHECK(photonSF_ID.setProperty(
"ForceDataType",1));
100 ANA_CHECK(photonSF_Iso.setProperty(
"IsoKey",
"Loose"));
101 ANA_CHECK(photonSF_Iso.setProperty(
"ForceDataType",1));
104 ANA_CHECK(photonSF_Trig.setProperty(
"IsoKey",
"Loose"));
105 ANA_CHECK(photonSF_Trig.setProperty(
"TriggerKey",
"DI_PH_2015_2016_g25_loose_2017_2018_g50_loose_L1EM20VH"));
106 ANA_CHECK(photonSF_Trig.setProperty(
"ForceDataType",1));
109 ANA_CHECK(photonSF_ID.setProperty(
"UseRandomRunNumber",
false));
110 ANA_CHECK(photonSF_ID.setProperty(
"DefaultRandomRunNumber",428648));
111 ANA_CHECK(photonSF_Iso.setProperty(
"UseRandomRunNumber",
false));
112 ANA_CHECK(photonSF_Iso.setProperty(
"DefaultRandomRunNumber",428648));
113 ANA_CHECK(photonSF_Trig.setProperty(
"UseRandomRunNumber",
false));
114 ANA_CHECK(photonSF_Trig.setProperty(
"DefaultRandomRunNumber",349534));
117 std::cout <<
"Failed to initialize the tool, check for errors"<<std::endl;
121 std::cout <<
"Failed to initialize the tool, check for errors"<<std::endl;
125 std::cout <<
"Failed to initialize the tool, check for errors"<<std::endl;
130 std::vector<CP::SystematicSet> sysList;
134 std::cout <<
"List of recommended systematics from the registry:"<<std::endl;
135 for (
auto sysListItr = recommendedSystematics.
begin(); sysListItr != recommendedSystematics.
end(); ++sysListItr){
136 std::cout <<(*sysListItr).name()<<std::endl;
143 std::cout <<
"restructure all recommended systematic variations for the SF tool"<<std::endl;
144 std::vector<CP::SystematicSet> syst_PhotonID, syst_PhotonIso, syst_PhotonTrig;
147 syst_PhotonID.emplace_back();
148 syst_PhotonID.back().insert(SystematicsVariation);
152 syst_PhotonIso.emplace_back();
153 syst_PhotonIso.back().insert(SystematicsVariation);
157 syst_PhotonTrig.emplace_back();
158 syst_PhotonTrig.back().insert(SystematicsVariation);
161 for (
const auto& sSystematicSet: syst_PhotonID){
162 Info(
APP_NAME,
"PhotonEfficiencyCorrectionTool ID instance has next systematic variation %s ",sSystematicSet.name().c_str());
164 for (
const auto& sSystematicSet: syst_PhotonIso){
165 Info(
APP_NAME,
"PhotonEfficiencyCorrectionTool Iso instance has next systematic variation %s ",sSystematicSet.name().c_str());
167 for (
const auto& sSystematicSet: syst_PhotonTrig){
168 Info(
APP_NAME,
"PhotonEfficiencyCorrectionTool Iso instance has next systematic variation %s ",sSystematicSet.name().c_str());
171 double efficiencyScaleFactor=0, efficiencyScaleFactorError=0;
173 std::cout <<
"loop on " <<
entries <<
" entries"<<std::endl;
177 event.getEntry(
entry );
194 for( ; ph_itr != ph_end; ++ph_itr, ++
i ) {
198 if(ph->
pt()<10000.0)
continue;
204 if( std::abs(cluster->
etaBE(2))>2.37)
continue;
206 Info (
APP_NAME,
"xAOD/raw pt = %f, eta = %f ", ph->
pt(), ph->
eta() );
217 Info(
APP_NAME,
"===>>> Result ID: ScaleFactor %f, TotalUncertainty %f ",efficiencyScaleFactor,efficiencyScaleFactorError);
223 Info(
APP_NAME,
"===>>> Result Iso: ScaleFactor %f, TotalUncertainty %f ",efficiencyScaleFactor,efficiencyScaleFactorError);
229 Info(
APP_NAME,
"===>>> Result Trigger: ScaleFactor %f, TotalUncertainty %f ",efficiencyScaleFactor,efficiencyScaleFactorError);
233 Info(
"applyEfficiencyScaleFactor()",
"===>>> new decoration: \"SF\"=%f", sfAcc(*ph));
235 Info(
"applyEfficiencyScaleFactor()",
"===>>> new decoration: \"SF\"=%f", sfAcc(*ph));
237 Info(
"applyEfficiencyScaleFactor()",
"===>>> new decoration: \"SF\"=%f", sfAcc(*ph));
240 for (
const auto& sSystematicSet: syst_PhotonID){
245 for (
const auto& sSystematicSet: syst_PhotonIso){
250 for (
const auto& sSystematicSet: syst_PhotonTrig){