31 const bool result = ARG; \
33 ::Error(APP_NAME, "Failed to execute: \"%s\"", \
53int main(
int argc,
char* argv[] )
61 Error(
APP_NAME,
"No file name received!" );
68 StatusCode::enableFailure();
71 const TString fileName = argv[ 1 ];
72 Info(
APP_NAME,
"Opening file: %s", fileName.Data());
73 std::unique_ptr<TFile> ifile(TFile::Open(fileName,
"READ"));
78 CHECK( event.readFrom(ifile.get()) );
79 Info(
APP_NAME,
"Number of events in the file: %i",
80 static_cast<int>(event.getEntries()));
87 Long64_t
entries =
event.getEntries();
89 const Long64_t e = atoll(argv[2]);
98 std::string esModel =
"es2017_R21_v1";
99 CHECK( energyRescaler->setProperty(
"ESModel", esModel) );
101 ToolHandle<CP::IEgammaCalibrationAndSmearingTool> energyRescalerTool(energyRescaler->name());
105 CHECK( fsrTool.setProperty<
double>(
"far_fsr_drcut", 0.12) );
106 fsrTool.
msg().setLevel(MSG::DEBUG);
107 CHECK( fsrTool.setProperty(
"egCalibToolName", energyRescaler->name()) );
114 for(Long64_t entry = 0; entry <
entries; ++entry) {
119 event.getEntry(entry);
134 CHECK( event.retrieve( muons,
"Muons" ) );
138 CHECK( event.retrieve( els,
"Electrons" ) );
140 std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > electrons_shallowCopy =
144 CHECK( store->
record( electrons_shallowCopy.first,
"ElectronsCorr" ) );
145 CHECK( store->
record( electrons_shallowCopy.second,
"ElectronsCorrAux." ) );
151 Error(
APP_NAME,
"Unable to setOriginalObjectLink for electron containers ");
157 CHECK( event.retrieve( phs,
"Photons" ) );
159 std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > photons_shallowCopy =
163 CHECK( store->
record( photons_shallowCopy.first,
"PhotonsCorr" ) );
164 CHECK( store->
record( photons_shallowCopy.second,
"PhotonsCorrAux." ) );
168 Error(
APP_NAME,
"Unable to setOriginalObjectLink for photon containers ");
174 double tmp_energy = -999.;
175 double fsr_energy = 0.;
176 TLorentzVector fsr_tlv;
179 for(
auto muon : *muons ) {
183 Info(
APP_NAME,
" FSR candidate found !!!!!!!! ");
184 Info(
APP_NAME,
" container = %s deltaR = %f Et = %f f1 = %f"
185 " eta = %f phi = %f phIso = %f fsrtype = %i",
188 candidate.
eta, candidate.
phi,
194 if (photon) fsr_energy = photon->e();
196 else if (candidate.
container ==
"electron" ) {
198 if (electron) fsr_energy = electron->e();
200 Info(
APP_NAME,
" FSR candidate particle is unknown " );
202 if ( fsr_energy > tmp_energy ) {
203 tmp_energy = fsr_energy;
204 fsr_tlv.SetPtEtaPhiE(candidate.
Et, candidate.
eta, candidate.
phi, fsr_energy);
@ Ok
The correction was done successfully.
Simple interface for searching the FSR candidate.
const xAOD::IParticle * particle
void record(const T *p, const std::string &key)
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
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.
A relatively simple transient store for objects created in analysis.
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".
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.
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
Photon_v1 Photon
Definition of the current "egamma version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".