ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Analysis::TagNtupleDumper Class Reference

#include <TagNtupleDumper.h>

Inheritance diagram for Analysis::TagNtupleDumper:
Collaboration diagram for Analysis::TagNtupleDumper:

Public Member Functions

 TagNtupleDumper (const std::string &name, const std::string &n, const IInterface *)
 
virtual ~TagNtupleDumper ()
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual void assignProbability (xAOD::BTagging *BTag, const std::map< std::string, double > &inputs, const std::string &jetauthor) const override
 

Private Attributes

ServiceHandle< ITHistSvc > m_hist_svc
 
std::string m_stream
 
std::map< std::pair< std::string, std::string >, float * > m_features ATLAS_THREAD_SAFE
 
std::map< std::string, TTree * > m_trees ATLAS_THREAD_SAFE
 
std::mutex m_mutex ATLAS_THREAD_SAFE
 

Detailed Description

Definition at line 37 of file TagNtupleDumper.h.

Constructor & Destructor Documentation

◆ TagNtupleDumper()

Analysis::TagNtupleDumper::TagNtupleDumper ( const std::string &  name,
const std::string &  n,
const IInterface *  p 
)

Definition at line 29 of file TagNtupleDumper.cxx.

29  :
30  base_class(name, n,p),
31  m_hist_svc("THistSvc", name)
32  {
33  // setup stream
34  declareProperty("Stream", m_stream = "FTAG");
35  }

◆ ~TagNtupleDumper()

Analysis::TagNtupleDumper::~TagNtupleDumper ( )
virtual

Definition at line 37 of file TagNtupleDumper.cxx.

37  {
38  for (auto& pair: m_features) {
39  delete pair.second;
40  }
41  // no idea how the hist service handles trees, do I have to delete them?
42  // for (auto& tree: m_trees) {
43  // delete tree.second;
44  // }
45  }

Member Function Documentation

◆ assignProbability()

void Analysis::TagNtupleDumper::assignProbability ( xAOD::BTagging BTag,
const std::map< std::string, double > &  inputs,
const std::string &  jetauthor 
) const
overridevirtual

Definition at line 56 of file TagNtupleDumper.cxx.

59  {
60  std::lock_guard<std::mutex> lock (m_mutex);
61 
62  TTree* & tree = m_trees[jetauthor];
63  if (tree == nullptr) {
64  tree = new TTree(jetauthor.c_str(), "who cares");
65  if (m_hist_svc->regTree("/" + m_stream + "/" + jetauthor,
66  tree).isFailure()) {
67  ATH_MSG_ERROR("Cannot register tree " + m_stream + "/" + jetauthor);
68  return;
69  }
70  }
71  for (const auto& in: inputs) {
72  const auto idx = std::make_pair(in.first, jetauthor);
73  // add this branch if it doesn't exist
74  float* & feature = m_features[idx];
75  if (feature == nullptr) {
76  feature = new float;
77  m_trees.at(jetauthor)->Branch(in.first.c_str(), feature);
78  ATH_MSG_INFO("Added Branch " + jetauthor + ": " + in.first );
79  }
80  *feature = in.second;
81  }
82  // fill tree
83  m_trees.at(jetauthor)->Fill();
84  } //end assign_probability

◆ finalize()

StatusCode Analysis::TagNtupleDumper::finalize ( )
overridevirtual

Definition at line 52 of file TagNtupleDumper.cxx.

52  { // all taken care of in destructor
53  return StatusCode::SUCCESS;
54  }

◆ initialize()

StatusCode Analysis::TagNtupleDumper::initialize ( )
overridevirtual

Definition at line 47 of file TagNtupleDumper.cxx.

47  {
48  CHECK( m_hist_svc.retrieve() );
49  return StatusCode::SUCCESS;
50  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/3]

std::map< std::pair<std::string, std::string>, float* > m_features Analysis::TagNtupleDumper::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 57 of file TagNtupleDumper.h.

◆ ATLAS_THREAD_SAFE [2/3]

std::map<std::string, TTree*> m_trees Analysis::TagNtupleDumper::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 58 of file TagNtupleDumper.h.

◆ ATLAS_THREAD_SAFE [3/3]

std::mutex m_mutex Analysis::TagNtupleDumper::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 60 of file TagNtupleDumper.h.

◆ m_hist_svc

ServiceHandle<ITHistSvc> Analysis::TagNtupleDumper::m_hist_svc
private

Definition at line 54 of file TagNtupleDumper.h.

◆ m_stream

std::string Analysis::TagNtupleDumper::m_stream
private

Definition at line 55 of file TagNtupleDumper.h.


The documentation for this class was generated from the following files:
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Analysis::TagNtupleDumper::m_hist_svc
ServiceHandle< ITHistSvc > m_hist_svc
Definition: TagNtupleDumper.h:54
tree
TChain * tree
Definition: tile_monitor.h:30
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Analysis::TagNtupleDumper::m_stream
std::string m_stream
Definition: TagNtupleDumper.h:55
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
readCCLHist.float
float
Definition: readCCLHist.py:83