18 using namespace asg::msgUserCode;
19 gErrorIgnoreLevel = kError;
22 std::cerr <<
"usage: " << argv[0] <<
": <DAOD> <jet collection> <associated collection>"
25 <<
" -1: usage error\n"
26 <<
" 1: broken association\n"
27 <<
" 2: some associated objects are not tracks\n"
28 <<
" 0: association works, is all tracks" << std::endl;
31 std::string
file = argv[1];
32 std::string jets_name = argv[2];
33 std::string linked_particles_name = argv[3];
36 const std::string
APP_NAME =
"TestAssociatedIparticles";
45 std::unique_ptr<TFile> ifile(TFile::Open(
file.c_str(),
"READ"));
46 if ( ! ifile.get() || ifile->IsZombie()) {
47 std::cerr <<
"Couldn't open file: " <<
file << std::endl;
54 unsigned long long nbad = 0;
55 unsigned long long ngood = 0;
56 unsigned long long nIParticle = 0;
57 unsigned long long nTrack = 0;
58 unsigned long long entries =
event.getEntries();
59 for (
unsigned long long entry = 0; entry <
entries; ++entry) {
61 if (event.getEntry(entry) < 0) {
62 std::cerr <<
"Couldn't load entry " << entry <<
" from file"
67 ANA_CHECK( event.retrieve(jets, jets_name) );
69 std::vector<const xAOD::IParticle*> particles;
70 if (!
jet->getAssociatedObjects(linked_particles_name, particles)){
74 nIParticle += particles.size();
75 for (
const auto* part: particles) {
83 std::cout <<
"Summary: found " << ngood <<
" out of " << nbad + ngood <<
" jets with valid links to associated particles " << std::endl;
84 std::cout <<
"Found " << nIParticle <<
" associated xAOD::IParticles, "
85 << nTrack <<
" of which were tracks" << std::endl;
86 if (nbad > 0)
return 1;
87 if (nIParticle > nTrack)
return 2;
int main(int, char **)
Main class for all the CppUnit test classes.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
Jet_v1 Jet
Definition of the current "jet version".
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
JetContainer_v1 JetContainer
Definition of the current "jet container version".