47main(
int argc,
char* argv[])
50 using namespace asg::testEgChargeCorr;
52 MSG::Level mylevel=MSG::INFO;
58 Error(
APP_NAME,
"No file name received!");
60 " Usage: %s [xAOD file name] [Correction File name]",
65 double SF_chargeID = 0;
68 double n_chargeID = 0;
69 double n_chargeMisID = 0;
75 const TString fileName = argv[1];
76 const TString corrFileName = argv[2];
78 Info(
APP_NAME,
"Opening file: %s", fileName.Data());
79 std::unique_ptr<TFile> ifile(TFile::Open(fileName,
"READ"));
87 "Number of events in the file: %i",
88 static_cast<int>(event.getEntries()));
90 std::cout <<
"==" << std::endl;
93 Long64_t
entries =
event.getEntries();
95 const Long64_t e = atoll(argv[2]);
103 ANA_CHECK(myEgCorrections.setProperty(
"OutputLevel", mylevel));
105 std::string inputFile =
107 ANA_CHECK(myEgCorrections.setProperty(
"CorrectionFileName", inputFile));
108 ANA_CHECK(myEgCorrections.setProperty(
"ForceDataType", 1));
110 ANA_CHECK(myEgCorrections.setProperty(
"DefaultRandomRunNumber",
111 (
unsigned int)311481));
112 ANA_CHECK(myEgCorrections.setProperty(
"UseRandomRunNumber",
false));
118 m_LHToolTight->setProperty(
"primaryVertexContainer",
"PrimaryVertices"));
120 ->setProperty(
"ConfigFile",
121 "ElectronPhotonSelectorTools/offline/mc15_20160512/"
122 "ElectronLikelihoodLooseOfflineConfig2016_CutBL_Smooth.conf")
132 std::cout <<
"==" << std::endl;
138 for (; entry <
entries; ++entry) {
141 event.getEntry(entry);
144 std::cout <<
"=================NEXT EVENT=========================="
149 ANA_CHECK(event.retrieve(event_info,
"EventInfo"));
152 ANA_CHECK(event.retrieve(electrons,
"Electrons"));
155 std::pair<xAOD::ElectronContainer*, xAOD::ShallowAuxContainer*>
167 for (; el_it != el_it_last; ++el_it, ++i) {
170 if (el->pt() < 20000)
173 bool LHacc{ m_LHToolTight->
accept(el) };
174 std::cout <<
"acc: " << LHacc << std::endl;
175 if (!m_LHToolTight->
accept(el))
177 double clusAbsEta = std::abs(el->caloCluster()->etaBE(2));
178 if ( clusAbsEta > 1.37 && (clusAbsEta < 1.52 || clusAbsEta > 2.47) )
187 Error(
APP_NAME,
"Problem in getEfficiencyScaleFactor");
193 Error(
APP_NAME,
"Problem in applyEfficiencyScaleFactor");
197 Info(
APP_NAME,
"===>>> Resulting SF (from get function) %f, (from apply function) %f",
200 SF_chargeID = SF_chargeID + SF;
202 for (
const auto& sys : recSysts) {
203 double systematic = 0;
211 "%f Result %f Systematic value %f ",
220 int truthcharge =
false;
222 if (el->charge() * truthcharge < 0) {
230 Info(
APP_NAME,
"===>>> done processing event #%lld ", entry);
231 Info(
APP_NAME,
"===>>> processed #%d electrons", SF_nevents);
232 Info(
APP_NAME,
"===>>> compared to #%f (from Charge MisId SF)", SF_chargeID);
233 Info(
APP_NAME,
"===>>> compared to #%f and #%f ", n_chargeID, n_chargeMisID);
@ Ok
The correction was done successfully.
Class to wrap a set of SystematicVariations.
DataModel_detail::iterator< DataVector > iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Helper class to provide constant type-safe access to aux data.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
CP::CorrectionCode getEleTruthCharge(const xAOD::Electron &ele, int &truthcharge)
Get the charge of the original electron.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
Electron_v1 Electron
Definition of the current "egamma version".