|
ATLAS Offline Software
|
Go to the documentation of this file.
44 TString
fileName =
"/eos/atlas/atlascerngroupdisk/perf-jets/ReferenceFiles/mc16_13TeV.361028.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ8W.deriv.DAOD_FTAG1.e3569_s3126_r9364_r9315_p3260/DAOD_FTAG1.12133096._000074.pool.root.1";
48 bool useConfigFile =
true;
50 Info(
APP_NAME,
"==============================================" );
54 Info(
APP_NAME,
" $> %s -n X | X = number of events you want to run on",
APP_NAME );
55 Info(
APP_NAME,
" $> %s -e X | X = specific number of the event to run on - for debugging",
APP_NAME );
57 Info(
APP_NAME,
" $> %s -wp | working point to test (either 50 or 80 [signal efficiency]) ",
APP_NAME );
58 Info(
APP_NAME,
" $> %s -m | manually setup taggers using cut function and tagger mode properties",
APP_NAME );
59 Info(
APP_NAME,
"==============================================" );
63 Info(
APP_NAME,
"No arguments - using default file" );
75 if(
options.find(
"-f")!=std::string::npos){
76 for(
int ipos=0; ipos<
argc ; ipos++ ) {
77 if(std::string(
argv[ipos]).compare(
"-f")==0){
86 if(
options.find(
"-event")!=std::string::npos ||
options.find(
"-e")!=std::string::npos) {
87 for(
int ipos=0; ipos<
argc ; ipos++ ) {
90 Info(
APP_NAME,
"Argument (-event) : Running only on event # %i", ievent );
96 if(
options.find(
"-n")!=std::string::npos){
97 for(
int ipos=0; ipos<
argc ; ipos++ ) {
106 if(
options.find(
"-v")!=std::string::npos){
108 Info(
APP_NAME,
"Argument (-v) : Setting verbose");
111 if(
options.find(
"-m")!=std::string::npos){
113 Info(
APP_NAME,
"Argument (-m) : Setting manual tagger setup");
117 std::string taggerEfficiency =
"50";
119 if (
options.find(
"-wp") != std::string::npos) {
120 for(
int ipos=0; ipos<
argc ; ipos++ ) {
122 if (std::string(
argv[ipos+1]) ==
"50" || std::string(
argv[ipos+1]) ==
"80") {
123 taggerEfficiency =
argv[ipos+1];
124 if (taggerEfficiency ==
"50") {
125 Info(
APP_NAME,
"Argument (-wp) : Setting is 50pc signal efficiency");
126 }
else if (taggerEfficiency ==
"80") {
127 Info(
APP_NAME,
"Argument (-wp) : Setting is 80pc signal efficiency");
130 Error(
APP_NAME,
"Argument (-wp) : Invalid value (should be 50 or 80), using default 50 value");
141 StatusCode::enableFailure();
147 TChain *
chain =
new TChain (
"CollectionTree",
"CollectionTree");
158 Long64_t
entries =
event.getEntries();
161 std::string ROOTFileName =
"output_HLLHCSmoothedTopTaggers_" + taggerEfficiency +
"SignalEff.root";
164 TFile*
outputFile = TFile::Open( ROOTFileName.c_str(),
"recreate" );
165 int pass, passMass, passSphericity, validJet, validKinRange;
166 float sphericityCut, massCut;
167 TTree*
Tree =
new TTree(
"tree",
"test_tree" );
168 Tree->Branch(
"pass", &pass,
"pass/I" );
169 Tree->Branch(
"passMass", &passMass,
"passMass/I" );
170 Tree->Branch(
"passSphericity", &passSphericity,
"passSphericity/I" );
171 Tree->Branch(
"massCut", &massCut,
"massCut/F" );
172 Tree->Branch(
"sphericityCut", &sphericityCut,
"sphericityCut/F" );
173 Tree->Branch(
"validJetContent", &validJet,
"validJetContent/I" );
174 Tree->Branch(
"validKinRange", &validKinRange,
"validKinRange/I" );
177 float jetPt, jetEta, jetPhi, jetM, jetE, jetSphericity;
178 Tree->Branch(
"jetEta", &jetEta,
"jetEta/F");
179 Tree->Branch(
"jetPt", &jetPt,
"jetPt/F");
180 Tree->Branch(
"jetPhi", &jetPhi,
"jetPhi/F");
181 Tree->Branch(
"jetM", &jetM,
"jetM/F");
182 Tree->Branch(
"jetE", &jetE,
"jetE/F");
183 Tree->Branch(
"jetSphericity", &jetSphericity,
"jetSphericity/F");
190 bool useLocalCalibArea =
true;
196 if (taggerEfficiency ==
"50") {
197 configFile =
"HLLHCSmoothedContainedTopTagger_AntiKt10LCTopoTrimmed_MassSphericityFixedSignalEfficiency50_20220413.dat";
198 decorationName =
"HLLHCSmoothedTop50MassSphericity";
201 else if (taggerEfficiency ==
"80") {
202 configFile =
"HLLHCSmoothedContainedTopTagger_AntiKt10LCTopoTrimmed_MassSphericityFixedSignalEfficiency80_20220413.dat";
203 decorationName =
"HLLHCSmoothedTop80MassSphericity";
228 std::string localConfigPath =
"HLLHCSmoothedTopTaggers/";
230 std::cout<<
"Initializing HLLHC Top Tagger"<<std::endl;
238 if (!useLocalCalibArea) {
248 std::vector<std::string> variableNames = {
"Mass",
"Sphericity"};
249 std::vector<std::string> cutExpressions;
250 if (taggerEfficiency ==
"50") {
252 cutExpressions.push_back(
"(x > 2250.0) ? 163.5 : (x < 575.0) ? 121.5 : (107.08208957157846) * pow(x, 0.0) + (0.025074626862387987) * pow(x, 1.0)");
253 cutExpressions.push_back(
"(x > 2250.0) ? 0.2665 : (x < 575.0) ? 0.2115 : (0.21589532367374106) * pow(x, 0.0) + (-4.630614969502935e-05) * pow(x, 1.0) + (7.982389622058105e-08) * pow(x, 2.0) + (-2.188773324349366e-11) * pow(x, 3.0)");
254 }
else if (taggerEfficiency ==
"80") {
256 cutExpressions.push_back(
"(x > 2250.0) ? 142.5 : (x < 575.0) ? 96.5 : (80.7089552147599) * pow(x, 0.0) + (0.027462686570187158) * pow(x, 1.0)");
257 cutExpressions.push_back(
"(x > 2250.0) ? 0.0965 : (x < 575.0) ? 0.0445 : (-0.015521973683231065) * pow(x, 0.0) + (0.0001160203413917445) * pow(x, 1.0) + (-1.7074246660926898e-08) * pow(x, 2.0) + (-5.494467663191552e-12) * pow(x, 3.0)");
259 Error(
APP_NAME,
"Invalid tagger efficiency working point" );
272 std::string massDecor = decorationName +
"_Cut_m";
273 std::string sphericityDecor = decorationName +
"_Cut_Sphericity";
275 std::string sphericityPassDecor = decorationName +
"_PassSphericity";
276 std::string massPassDecor = decorationName +
"_PassMass";
278 std::string validJetDecor = decorationName +
"_ValidJetContent";
279 std::string validKinRangeDecor = decorationName +
"_ValidKinRange";
285 event.getEntry(
entry );
289 if(
event.
retrieve( evtInfo,
"EventInfo" ) != StatusCode::SUCCESS){
292 if(ievent!=-1 &&
static_cast <int> (evtInfo->
eventNumber())!=ievent) {
298 if(
event.
retrieve( myJets,
"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets" ) != StatusCode::SUCCESS)
303 std::unique_ptr<xAOD::JetContainer> shallowJets(jets_shallowCopy.first);
304 std::unique_ptr<xAOD::ShallowAuxContainer> shallowAux(jets_shallowCopy.second);
307 if(
verbose) std::cout<<
"Testing Top Tagger"<< std::endl;
314 passMass =
jet->auxdecor<
bool>(massPassDecor);
315 passSphericity =
jet->auxdecor<
bool>(sphericityPassDecor);
316 massCut =
jet->auxdecor<
float>(massDecor);
317 sphericityCut =
jet->auxdecor<
float>(sphericityDecor);
321 jetM =
jet->m()*0.001;
322 jetE =
jet->e()*0.001;
323 jetPt =
jet->pt()*0.001;
324 validJet =
jet->auxdata<
bool>(validJetDecor);
325 validKinRange =
jet->auxdata<
bool>(validKinRangeDecor);
327 pass = validJet && passMass && passSphericity && validKinRange;
328 if (!(
jet->getAttribute(
"Sphericity",jetSphericity))) {
329 std::cout <<
"WARNING sphericity is not decorated on this jet!" << std::endl;
333 std::cout<<
"Total tagger result : "<<pass<<std::endl;
334 std::cout<<
"Valid jet content = "<<validJet<<std::endl;
335 std::cout<<
"result massPass = "<<passMass<<std::endl;
336 std::cout<<
"result sphericityPass = "<<passSphericity<<std::endl;
337 std::cout<<
"result massCut = "<<massCut<<std::endl;
338 std::cout<<
"result sphericityCut = "<<sphericityCut<<std::endl;
339 std::cout <<
"Jet pT (GeV) = " << jetPt <<
", eta = " << jetEta <<
" ; mass (GeV) = " << jetM <<
", Sphericity = " << jetSphericity << std::endl;
345 Info(
APP_NAME,
"===>>> done processing event #%i, run #%i %i events processed so far <<<===",
static_cast< int >( evtInfo->
eventNumber() ),
static_cast< int >( evtInfo->
runNumber() ),
static_cast< int >(
entry + 1 ) );
361 std::cout<<std::endl<<std::endl;
362 std::cout<<
"Smart Slimming Checker :"<<std::endl;
364 std::cout<<std::endl<<std::endl;
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
uint64_t eventNumber() const
The current event's event number.
ReadStats & stats()
Access the object belonging to the current thread.
@ kAthenaAccess
Access containers/objects like Athena does.
uint32_t runNumber() const
The current event's run number.
virtual StatusCode tag(const xAOD::Jet &jet) const override
Decorate single jet with tagging info.
POOL::TEvent event(POOL::TEvent::kClassAccess)
int main(int argc, char *argv[])
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Class describing the basic event information.
A relatively simple transient store for objects created in analysis.
StatusCode retrieve(const T *&obj)
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Error
The different types of error that can be flagged in the L1TopoRDO.
Tool for accessing xAOD files outside of Athena.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.