customGetter.h 2.3 KB
Newer Older
1
/*
2
  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
4
5
6
7
8
9
10
11
*/

// The customGetter file is a catch-all for various getter functinos
// that need to be hard coded for whatever reason. Some of these are
// accessing methods like `pt` which have no name in the EDM, others
// can't be stored in the edm directly for various reasons.


// EDM includes
12
13
#include "xAODJet/JetFwd.h"
#include "xAODTracking/TrackParticleFwd.h"
14
#include "AthContainers/AuxElement.h"
15
16
17

#include <functional>
#include <string>
18
#include <set>
19
20
21
22
23

#ifndef CUSTOM_GETTER_H
#define CUSTOM_GETTER_H

namespace FlavorTagDiscriminants {
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

  /// Factory function to produce TrackParticle -> vector<double> functions
  ///
  /// DL2 configures the its inputs when the algorithm is initalized,
  /// meaning that the list of track and jet properties that are used
  /// as inputs won't be known at compile time. Instead we build an
  /// array of "getter" functions, each of which returns one input for
  /// the tagger. The function here returns those getter functions.
  ///
  /// Many of the getter functions are trivial: they will, for example,
  /// read one double of auxdata off of the BTagging object. The
  /// sequence input getters tend to be more complicated. Since we'd
  /// like to avoid reimplementing the logic in these functions in
  /// multiple places, they are exposed here.
  ///
  /// This function will return a getter based on a string key. See the
  /// implementation for the definitions.
  ///
  /// NOTE: This function is for experts only, don't expect support.
  ///
44
45

  using SequenceFromTracks = std::function<std::vector<double>(
46
    const xAOD::Jet&,
47
48
49
50
51
52
53
    const std::vector<const xAOD::TrackParticle*>&)>;

  std::pair<SequenceFromTracks, std::set<std::string>>
  customSequenceGetterWithDeps(
    const std::string& name,   // name of the getter
    const std::string& prefix  // prefix for track accessor
    );
54
55

  // internal functions
56
  namespace internal {
57
    std::function<std::pair<std::string, double>(const SG::AuxElement&)>
58
59
    customGetterAndName(const std::string&);

60
    std::pair<std::function<std::pair<std::string, std::vector<double>>(
61
      const xAOD::Jet&,
62
63
64
      const std::vector<const xAOD::TrackParticle*>&)>,
      std::set<std::string>>
    customNamedSeqGetterWithDeps(const std::string&, const std::string&);
65
66
67
68
  }
}

#endif