15using Athena::Units::GeV;
31 ATH_MSG_WARNING(
"Number of btaggers and CDI files do not match. Will not retrieve b-tagging information.");
32 return StatusCode::SUCCESS;
39 btagSelTool.
setTypeAndName(
"BTaggingSelectionTool/btagSelTool_"+taggerName);
49 return StatusCode::SUCCESS;
62 for (
const auto& key :
m_keys) {
66 if (FormatTool->AddToEvent(
dataTypeName(), key.key() +
"_xAOD", &
data).isFailure()) {
76 return StatusCode::SUCCESS;
107 DataVect trackContKey; trackContKey.reserve(jetCont->
size());
108 DataVect trackLinkCount; trackLinkCount.reserve(jetCont->
size());
117 for (
const auto jet : *jetCont) {
119 ATH_MSG_DEBUG(
" Jet #" << counter++ <<
" : eta = " <<
jet->eta() <<
", phi = " <<
jet->phi() <<
", pt = " <<
jet->pt() );
122 size_t numConstit =
jet->numConstituents();
123 std::vector<std::string> tempCellID;
124 size_t trackcounter = 0;
133 for (
size_t i = 0; i < numConstit; i++) {
135 dynamic_cast<const xAOD::PFO *
>(
jet->rawConstituent(i));
145 size_t numConstit =
jet->numConstituents();
146 for (
size_t i = 0; i < numConstit; i++) {
153 if (thisTrack !=
nullptr) {
165 for (
size_t j = 0; j < numConstit; ++j) {
170 if (std::find(tempCellID.begin(), tempCellID.end(), std::to_string( cc->caloDDE()->identify().get_compact())) != tempCellID.end()) {
173 cellID.emplace_back(
DataType(cc->caloDDE()->identify().get_compact()));
174 tempCellID.emplace_back( std::to_string(cc->caloDDE()->identify().get_compact()));
180 std::vector<const xAOD::TrackParticle*> ghosttracks;
182 if (ghosttracks.empty()) {
185 for (
size_t i = 0; i < ghosttracks.size(); i++) {
193 ATH_MSG_VERBOSE(
" Associated track: d0 = " << ghosttracks[i]->d0() <<
", pt = " << ghosttracks[i]->pt());
195 trackcounter = ghosttracks.size();
198 for (
size_t j = 0; j < numConstit; ++j) {
204 trackKey.emplace_back(
DataType(track->index()));
207 ATH_MSG_VERBOSE(
" Associated track: d0 = " << track->d0() <<
", pt = " << track->pt());
213 trackLinkCount.emplace_back(
DataType(trackcounter));
214 numCells.emplace_back(
DataType(tempCellID.size()));
220 idVec.emplace_back(
DataType( ++
id ));
230 if (jetkey!=
"AntiKt4EMPFlowJets" || (
m_nTaggers==0)){
232 bTagName.emplace_back(
DataType(
"None"));
233 bTagValue.emplace_back(
DataType(0.));
240 ATH_MSG_DEBUG(
"Failed to get btagging weight for tagger " << taggerName);
243 bTagName.emplace_back(
DataType(taggerName));
244 bTagValue.emplace_back(
DataType(btagValue));
258 std::vector<float> jvfread;
263 jvf.emplace_back(
DataType( jvfread[0] ));
271 jvt.emplace_back(
DataType(jvtread));
274 float emfracread = 0;
277 emfrac.emplace_back(
DataType( 0. ));
279 emfrac.emplace_back(
DataType( emfracread ));
291 DataMap[
"bTagName multiple=\""+str_nTaggers+
"\""] = bTagName;
292 DataMap[
"bTagValue multiple=\""+str_nTaggers+
"\""] = bTagValue;
302 if ((trackKey.size()) != 0){
303 double NTracksPerVertex = trackKey.size()*1./jetCont->
size();
304 std::string tag =
"trackIndex multiple=\"" +
DataType(NTracksPerVertex).toString()+
"\"";
306 tag =
"trackKey multiple=\"" +
DataType(NTracksPerVertex).toString()+
"\"";
310 if ((clusterID.size())!=0){
311 std::string tag =
"clusterIndex multiple=\"" +
DataType(clusterID.size()).toString()+
"\"";
312 double NCellsPerJet = cellID.size()*1./jetCont->
size();
313 tag =
"cells multiple=\"" +
DataType(NCellsPerJet).toString()+
"\"";
317 DataMap[
"trackLinkCount"] = trackLinkCount;
318 DataMap[
"numCells"] = numCells;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double charge(const T &p)
char data[hepevt_bytes_allocation_ATLAS]
Defines enum to access jet attribute and associated particles/objects.
Wrapper to avoid constant divisions when using units.
Return value from object correction CP tools.
@ Ok
The correction was done successfully.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
Gaudi::Property< std::vector< std::string > > m_bTaggerNames
SG::ReadHandleKeyArray< xAOD::JetContainer > m_keys
Gaudi::Property< std::vector< std::string > > m_CDIPaths
std::unordered_map< std::string, asg::AnaToolHandle< IBTaggingSelectionTool > > m_btagSelTools
virtual StatusCode initialize()
const DataMap getData(const xAOD::JetContainer *, const std::string &jetkey)
Puts the variables into a DataMap.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each jet collections retrieve basic parameters.
xAODJetRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Gaudi::Property< std::string > m_tracksName
size_t index() const
Return the index of this element within its container.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
signal_t signalType() const
const xAOD::IParticle * chargedObject(std::size_t i) const
Class providing the definition of the 4-vector interface.
bool isCharged() const
is a charged PFO
const TrackParticle * track(unsigned int index) const
Retrieve a const pointer to a Rec::TrackParticle.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ TrackParticle
The object is a charged track particle.
@ ParticleFlow
The object is a particle-flow object.
@ FlowElement
The object is a track-calo-cluster.
@ CaloCluster
The object is a calorimeter cluster.
PFO_v1 PFO
Definition of the current "pfo version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Extra patterns decribing particle interation process.