46 const bool result = ARG; \
48 ::Error( APP_NAME, "Failed to execute: \"%s\"", \
57int main(
int argc,
char* argv[] ) {
64 Error(
APP_NAME,
"No file name received!" );
73 const TString fileName = argv[1];
74 Info(
APP_NAME,
"Opening file: %s", fileName.Data() );
75 std::unique_ptr<TFile> ifile(TFile::Open( fileName,
"READ"));
77 if ((!ifile.get() ) || ifile->IsZombie()) {
78 Error(
APP_NAME,
"Couldn't open file: %s", argv[1]);
84 CHECK( event.readFrom( ifile.get() ) );
85 Info(
APP_NAME,
"Number of events in the file: %i",
86 static_cast< int >( event.getEntries() ) );
89 Long64_t
entries =
event.getEntries();
91 const Long64_t e = atoll( argv[ 2 ] );
107 std::vector<CP::SystematicSet> sysList;
109 std::cout <<
"SIZE of the systematics set:" << recommendedSystematics.
size() << std::endl;
111 for (
auto sys : recommendedSystematics) { sysList.push_back(
CP::SystematicSet({sys})); }
115 for (Long64_t entry = 0; entry <
entries; ++entry) {
118 event.getEntry(entry);
120 std::cout <<
"=================NEXT EVENT==========================" << std::endl;
123 CHECK( event.retrieve( event_info,
"EventInfo" ) );
127 CHECK( event.retrieve(photons,
"Photons") );
134 if (ph->
pt() <
MIN_PT) {
continue; }
135 std::cout << std::string(80,
'-') << std::endl;
136 std::cout <<
"eta|phi|pt|xAOD e = " << ph->
eta() <<
"|" << ph->
phi() <<
"|" << ph->
pt() <<
"|" << ph->
e() << std::endl;
138 std::cout <<
"ERROR: particle has no calocluster" << std::endl;
143 std::cout <<
"particle is not electron of photon" << std::endl;
147 CHECK(tool->applyCorrection(*ph));
148 std::cout <<
"Calibrated e = " << ph->
e() << std::endl;
151 std::cout <<
"\n=============SYSTEMATICS CHECK NOW";
152 for (
auto sys : sysList) {
154 if (tool->applySystematicVariation(sys) != StatusCode::SUCCESS) {
155 Error(
APP_NAME,
"Cannot configure calibration tool for systematics");
158 CHECK(tool->applyCorrection(*ph));
159 std::cout <<
"\nCalibrated pt with systematic " << sys.name() <<
" = " << ph->
pt();
161 std::cout <<
"\n=============END SYSTEMATICS " << std::endl;
167 CHECK( event.retrieve(electrons,
"Electrons") );
170 std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > electrons_shallowCopy =
xAOD::shallowCopyContainer( *electrons );
174 if (el->pt() <
MIN_PT) {
continue; }
175 std::cout << std::string(80,
'-') << std::endl;
176 std::cout <<
"eta|phi|pt|xAOD e = " << el->eta() <<
"|" << el->phi() <<
"|" << el->pt() <<
"|" << el->e() << std::endl;
177 if (not el->caloCluster()) {
178 std::cout <<
"ERROR: particle has no calocluster" << std::endl;
181 std::cout <<
"raw E = " << el->caloCluster()->energyBE(1) + el->caloCluster()->energyBE(2) + el->caloCluster()->energyBE(3) << std::endl;
183 std::cout <<
"particle is not electron of photon" << std::endl;
187 CHECK (tool->applyCorrection(*el));
188 std::cout <<
"Calibrated e = " << el->e() << std::endl;
191 std::cout <<
"\n=============SYSTEMATICS CHECK NOW";
192 for (
auto sys : sysList) {
194 if (tool->applySystematicVariation(sys) != StatusCode::SUCCESS) {
195 Error(
APP_NAME,
"Cannot configure calibration tool for systematics");
198 CHECK(tool->applyCorrection(*el));
199 std::cout <<
"\nCalibrated pt with systematic " << sys.name() <<
" = " << el->pt();
201 std::cout <<
"\n=============END SYSTEMATICS " << std::endl;
205 "===>>> done processing event #%i, "
206 "run #%i %i events processed so far <<<===",
208 static_cast< int >( event_info->
runNumber() ),
209 static_cast< int >( entry + 1 ) );
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
This module implements the central registry for handling systematic uncertainties with CP tools.
const SystematicSet & recommendedSystematics() const
returns: the recommended set of systematics
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Class to wrap a set of SystematicVariations.
size_t size() const
returns: size of the set
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
virtual double e() const override final
The total energy of the particle.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
static StatusCode setProperty(IAsgTool *tool, const std::string &property, W &&value)
Helper method for calling setProperty on an interface class Usage: asg::setProperty( myTool ,...
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
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.
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".