CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DPFIsolation Class Reference
Inheritance diagram for DPFIsolation:
deep_tau::DeepTauBase edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >

Public Member Functions

 DPFIsolation (const edm::ParameterSet &cfg, const deep_tau::DeepTauCache *cache)
 
- Public Member Functions inherited from deep_tau::DeepTauBase
 DeepTauBase (const edm::ParameterSet &cfg, const OutputCollection &outputs, const DeepTauCache *cache)
 
void produce (edm::Event &event, const edm::EventSetup &es) override
 
 ~DeepTauBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static unsigned GetNumberOfFeatures (unsigned graphVersion)
 
static unsigned getNumberOfParticles (unsigned graphVersion)
 
static const OutputCollectionGetOutputs ()
 
- Static Public Member Functions inherited from deep_tau::DeepTauBase
static void globalEndJob (const DeepTauCache *cache)
 
static std::unique_ptr< DeepTauCacheinitializeGlobalCache (const edm::ParameterSet &cfg)
 

Private Member Functions

tensorflow::Tensor getPredictions (edm::Event &event, edm::Handle< TauCollection > taus) override
 

Private Attributes

unsigned graphVersion
 

Additional Inherited Members

- Public Types inherited from deep_tau::DeepTauBase
enum  BasicDiscriminator {
  ChargedIsoPtSum, NeutralIsoPtSum, NeutralIsoPtSumWeight, FootprintCorrection,
  PhotonPtSumOutsideSignalCone, PUcorrPtSum
}
 
using CandidateCollection = edm::View< reco::Candidate >
 
using Cutter = TauWPThreshold
 
using CutterPtr = std::unique_ptr< Cutter >
 
using ElectronCollection = pat::ElectronCollection
 
using LorentzVectorXYZ = ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > >
 
using MuonCollection = pat::MuonCollection
 
using OutputCollection = std::map< std::string, Output >
 
using TauCollection = edm::View< reco::BaseTau >
 
using TauDiscriminator = reco::TauDiscriminatorContainer
 
using TauRef = edm::Ref< TauCollection >
 
using TauRefProd = edm::RefProd< TauCollection >
 
using WPList = std::vector< CutterPtr >
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Attributes inherited from deep_tau::DeepTauBase
uint8_t andPrediscriminants_
 
std::vector< TauDiscInfo< pat::PATTauDiscriminator > > patPrediscriminants_
 
std::vector< TauDiscInfo< reco::PFTauDiscriminator > > recoPrediscriminants_
 
- Protected Attributes inherited from deep_tau::DeepTauBase
const DeepTauCachecache_
 
const bool is_online_
 
OutputCollection outputs_
 
edm::EDGetTokenT< CandidateCollectionpfcandToken_
 
edm::EDGetTokenT< TauCollectiontausToken_
 
edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 
std::map< std::string, WPListworkingPoints_
 
- Static Protected Attributes inherited from deep_tau::DeepTauBase
static const std::vector< BasicDiscriminatorrequiredBasicDiscriminators_
 
static const std::vector< BasicDiscriminatorrequiredBasicDiscriminatorsdR03_
 
static const std::map< BasicDiscriminator, std::string > stringFromDiscriminator_
 

Detailed Description

Definition at line 22 of file DPFIsolation.cc.

Constructor & Destructor Documentation

◆ DPFIsolation()

DPFIsolation::DPFIsolation ( const edm::ParameterSet cfg,
const deep_tau::DeepTauCache cache 
)
inlineexplicit

Definition at line 63 of file DPFIsolation.cc.

64  : DeepTauBase(cfg, GetOutputs(), cache), graphVersion(cfg.getParameter<unsigned>("version")) {
65  const auto& shape = cache_->getGraph().node(0).attr().at("shape").shape();
66 
67  if (!(graphVersion == 1 || graphVersion == 0))
68  throw cms::Exception("DPFIsolation") << "unknown version of the graph file.";
69 
70  if (!(shape.dim(1).size() == getNumberOfParticles(graphVersion) &&
71  shape.dim(2).size() == GetNumberOfFeatures(graphVersion)))
72  throw cms::Exception("DPFIsolation")
73  << "number of inputs does not match the expected inputs for the given version";
74  }

References deep_tau::DeepTauBase::cache_, Exception, deep_tau::DeepTauCache::getGraph(), GetNumberOfFeatures(), getNumberOfParticles(), and graphVersion.

Member Function Documentation

◆ fillDescriptions()

static void DPFIsolation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 40 of file DPFIsolation.cc.

40  {
42  desc.add<edm::InputTag>("pfcands", edm::InputTag("packedPFCandidates"));
43  desc.add<edm::InputTag>("taus", edm::InputTag("slimmedTaus"));
44  desc.add<edm::InputTag>("vertices", edm::InputTag("offlineSlimmedPrimaryVertices"));
45  desc.add<std::string>("graph_file", "RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb");
46  desc.add<unsigned>("version", 0);
47  desc.add<bool>("mem_mapped", false);
48 
50  descWP.add<std::string>("VVVLoose", "0");
51  descWP.add<std::string>("VVLoose", "0");
52  descWP.add<std::string>("VLoose", "0");
53  descWP.add<std::string>("Loose", "0");
54  descWP.add<std::string>("Medium", "0");
55  descWP.add<std::string>("Tight", "0");
56  descWP.add<std::string>("VTight", "0");
57  descWP.add<std::string>("VVTight", "0");
58  descWP.add<std::string>("VVVTight", "0");
59  desc.add<edm::ParameterSetDescription>("VSallWP", descWP);
60  descriptions.add("DPFTau2016v0", desc);
61  }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ GetNumberOfFeatures()

static unsigned DPFIsolation::GetNumberOfFeatures ( unsigned  graphVersion)
inlinestatic

Definition at line 35 of file DPFIsolation.cc.

35  {
36  static const std::map<unsigned, unsigned> nfeatures{{0, 47}, {1, 51}};
37  return nfeatures.at(graphVersion);
38  }

References graphVersion.

Referenced by DPFIsolation(), and getPredictions().

◆ getNumberOfParticles()

static unsigned DPFIsolation::getNumberOfParticles ( unsigned  graphVersion)
inlinestatic

Definition at line 30 of file DPFIsolation.cc.

30  {
31  static const std::map<unsigned, unsigned> nparticles{{0, 60}, {1, 36}};
32  return nparticles.at(graphVersion);
33  }

References graphVersion.

Referenced by DPFIsolation(), and getPredictions().

◆ GetOutputs()

static const OutputCollection& DPFIsolation::GetOutputs ( )
inlinestatic

Definition at line 24 of file DPFIsolation.cc.

24  {
25  const size_t tau_index = 0;
26  static const OutputCollection outputs_ = {{"VSall", Output({tau_index}, {})}};
27  return outputs_;
28  };

References GetRecoTauVFromDQM_MC_cff::Output, and deep_tau::DeepTauBase::outputs_.

◆ getPredictions()

tensorflow::Tensor DPFIsolation::getPredictions ( edm::Event event,
edm::Handle< TauCollection taus 
)
inlineoverrideprivatevirtual

Implements deep_tau::DeepTauBase.

Definition at line 77 of file DPFIsolation.cc.

77  {
79  event.getByToken(pfcandToken_, pfcands);
80 
82  event.getByToken(vtxToken_, vertices);
83 
84  tensorflow::Tensor tensor(
85  tensorflow::DT_FLOAT,
86  {1, static_cast<int>(getNumberOfParticles(graphVersion)), static_cast<int>(GetNumberOfFeatures(graphVersion))});
87 
88  tensorflow::Tensor predictions(tensorflow::DT_FLOAT, {static_cast<int>(taus->size()), 1});
89 
90  std::vector<tensorflow::Tensor> outputs_;
91 
92  float pfCandPt, pfCandPz, pfCandPtRel, pfCandPzRel, pfCandDr, pfCandDEta, pfCandDPhi, pfCandEta, pfCandDz,
93  pfCandDzErr, pfCandD0, pfCandD0D0, pfCandD0Dz, pfCandD0Dphi, pfCandPuppiWeight, pfCandPixHits, pfCandHits,
94  pfCandLostInnerHits, pfCandPdgID, pfCandCharge, pfCandFromPV, pfCandVtxQuality, pfCandHighPurityTrk,
95  pfCandTauIndMatch, pfCandDzSig, pfCandD0Sig, pfCandD0Err, pfCandPtRelPtRel, pfCandDzDz, pfCandDVx_1,
96  pfCandDVy_1, pfCandDVz_1, pfCandD_1;
97  float pvx = !vertices->empty() ? (*vertices)[0].x() : -1;
98  float pvy = !vertices->empty() ? (*vertices)[0].y() : -1;
99  float pvz = !vertices->empty() ? (*vertices)[0].z() : -1;
100 
101  bool pfCandIsBarrel;
102 
103  // These variables define ranges further used for standardization
104  static constexpr float pfCandPt_max = 500.f;
105  static constexpr float pfCandPz_max = 1000.f;
106  static constexpr float pfCandPtRel_max = 1.f;
107  static constexpr float pfCandPzRel_max = 100.f;
108  static constexpr float pfCandPtRelPtRel_max = 1.f;
109  static constexpr float pfCandD0_max = 5.f;
110  static constexpr float pfCandDz_max = 5.f;
111  static constexpr float pfCandDVx_y_z_1_max = 0.05f;
112  static constexpr float pfCandD_1_max = 0.1f;
113  static constexpr float pfCandD0_z_Err_max = 1.f;
114  static constexpr float pfCandDzSig_max = 3.f;
115  static constexpr float pfCandD0Sig_max = 1.f;
116  static constexpr float pfCandDr_max = 0.5f;
117  static constexpr float pfCandEta_max = 2.75f;
118  static constexpr float pfCandDEta_max = 0.5f;
119  static constexpr float pfCandDPhi_max = 0.5f;
120  static constexpr float pfCandPixHits_max = 7.f;
121  static constexpr float pfCandHits_max = 30.f;
122 
123  for (size_t tau_index = 0; tau_index < taus->size(); tau_index++) {
124  pat::Tau tau = taus->at(tau_index);
125  bool isGoodTau = false;
126  const float lepRecoPt = tau.pt();
127  const float lepRecoPz = std::abs(tau.pz());
128  const float lepRecoEta = tau.eta();
129  const float lepRecoPhi = tau.phi();
130 
131  if (lepRecoPt >= 30 && std::abs(lepRecoEta) < 2.3 && tau.isTauIDAvailable("againstMuonLoose3") &&
132  tau.isTauIDAvailable("againstElectronVLooseMVA6")) {
133  isGoodTau = (tau.tauID("againstElectronVLooseMVA6") && tau.tauID("againstMuonLoose3"));
134  }
135 
136  if (!isGoodTau) {
137  predictions.matrix<float>()(tau_index, 0) = -1;
138  continue;
139  }
140 
141  std::vector<unsigned int> signalCandidateInds;
142 
143  for (const auto& c : tau.signalCands())
144  signalCandidateInds.push_back(getPFCandidateIndex(pfcands, c));
145 
146  // Use of setZero results in warnings in eigen library during compilation.
147  //tensor.flat<float>().setZero();
149  for (unsigned input_idx = 0; input_idx < n_inputs; ++input_idx)
150  tensor.flat<float>()(input_idx) = 0;
151 
152  unsigned int iPF = 0;
153  const unsigned max_iPF = getNumberOfParticles(graphVersion);
154 
155  std::vector<unsigned int> sorted_inds(pfcands->size());
156  std::size_t n = 0;
157  std::generate(std::begin(sorted_inds), std::end(sorted_inds), [&] { return n++; });
158 
159  std::sort(std::begin(sorted_inds), std::end(sorted_inds), [&](int i1, int i2) {
160  return pfcands->at(i1).pt() > pfcands->at(i2).pt();
161  });
162 
163  for (size_t pf_index = 0; pf_index < pfcands->size() && iPF < max_iPF; pf_index++) {
164  pat::PackedCandidate p = pfcands->at(sorted_inds.at(pf_index));
165  float deltaR_tau_p = deltaR(p.p4(), tau.p4());
166 
167  if (p.pt() < 0.5)
168  continue;
169  if (deltaR_tau_p > 0.5)
170  continue;
171  if (p.fromPV() < 1 && p.charge() != 0)
172  continue;
173  pfCandPt = p.pt();
174  pfCandPtRel = p.pt() / lepRecoPt;
175 
176  pfCandDr = deltaR_tau_p;
177  pfCandDEta = std::abs(lepRecoEta - p.eta());
178  pfCandDPhi = std::abs(deltaPhi(lepRecoPhi, p.phi()));
179  pfCandEta = p.eta();
180  pfCandIsBarrel = (std::abs(pfCandEta) < 1.4);
181  pfCandPz = std::abs(std::sinh(pfCandEta) * pfCandPt);
182  pfCandPzRel = pfCandPz / lepRecoPz;
183  pfCandPdgID = std::abs(p.pdgId());
184  pfCandCharge = p.charge();
185  pfCandDVx_1 = p.vx() - pvx;
186  pfCandDVy_1 = p.vy() - pvy;
187  pfCandDVz_1 = p.vz() - pvz;
188 
189  pfCandD_1 = std::sqrt(pfCandDVx_1 * pfCandDVx_1 + pfCandDVy_1 * pfCandDVy_1 + pfCandDVz_1 * pfCandDVz_1);
190 
191  if (pfCandCharge != 0 and p.hasTrackDetails()) {
192  pfCandDz = p.dz();
193  pfCandDzErr = p.dzError();
194  pfCandDzSig = (std::abs(p.dz()) + 0.000001) / (p.dzError() + 0.00001);
195  pfCandD0 = p.dxy();
196  pfCandD0Err = p.dxyError();
197  pfCandD0Sig = (std::abs(p.dxy()) + 0.000001) / (p.dxyError() + 0.00001);
198  pfCandPixHits = p.numberOfPixelHits();
199  pfCandHits = p.numberOfHits();
200  pfCandLostInnerHits = p.lostInnerHits();
201  } else {
202  float disp = 1;
203  int psudorand = p.pt() * 1000000;
204  if (psudorand % 2 == 0)
205  disp = -1;
206  pfCandDz = 5 * disp;
207  pfCandDzErr = 0;
208  pfCandDzSig = 0;
209  pfCandD0 = 5 * disp;
210  pfCandD0Err = 0;
211  pfCandD0Sig = 0;
212  pfCandPixHits = 0;
213  pfCandHits = 0;
214  pfCandLostInnerHits = 2.;
215  pfCandDVx_1 = 1;
216  pfCandDVy_1 = 1;
217  pfCandDVz_1 = 1;
218  pfCandD_1 = 1;
219  }
220 
221  pfCandPuppiWeight = p.puppiWeight();
222  pfCandFromPV = p.fromPV();
223  pfCandVtxQuality = p.pvAssociationQuality();
224  pfCandHighPurityTrk = p.trackHighPurity();
225  float pfCandTauIndMatch_temp = 0;
226 
227  for (auto i : signalCandidateInds) {
228  if (i == sorted_inds.at(pf_index))
229  pfCandTauIndMatch_temp = 1;
230  }
231 
232  pfCandTauIndMatch = pfCandTauIndMatch_temp;
233  pfCandPtRelPtRel = pfCandPtRel * pfCandPtRel;
234  pfCandPt = std::min(pfCandPt, pfCandPt_max);
235  pfCandPt = pfCandPt / pfCandPt_max;
236 
237  pfCandPz = std::min(pfCandPz, pfCandPz_max);
238  pfCandPz = pfCandPz / pfCandPz_max;
239 
240  pfCandPtRel = std::min(pfCandPtRel, pfCandPtRel_max);
241  pfCandPzRel = std::min(pfCandPzRel, pfCandPzRel_max);
242  pfCandPzRel = pfCandPzRel / pfCandPzRel_max;
243  pfCandDr = pfCandDr / pfCandDr_max;
244  pfCandEta = pfCandEta / pfCandEta_max;
245  pfCandDEta = pfCandDEta / pfCandDEta_max;
246  pfCandDPhi = pfCandDPhi / pfCandDPhi_max;
247  pfCandPixHits = pfCandPixHits / pfCandPixHits_max;
248  pfCandHits = pfCandHits / pfCandHits_max;
249 
250  pfCandPtRelPtRel = std::min(pfCandPtRelPtRel, pfCandPtRelPtRel_max);
251 
252  pfCandD0 = std::clamp(pfCandD0, -pfCandD0_max, pfCandD0_max);
253  pfCandD0 = pfCandD0 / pfCandD0_max;
254 
255  pfCandDz = std::clamp(pfCandDz, -pfCandDz_max, pfCandDz_max);
256  pfCandDz = pfCandDz / pfCandDz_max;
257 
258  pfCandD0Err = std::min(pfCandD0Err, pfCandD0_z_Err_max);
259  pfCandDzErr = std::min(pfCandDzErr, pfCandD0_z_Err_max);
260  pfCandDzSig = std::min(pfCandDzSig, pfCandDzSig_max);
261  pfCandDzSig = pfCandDzSig / pfCandDzSig_max;
262 
263  pfCandD0Sig = std::min(pfCandD0Sig, pfCandD0Sig_max);
264  pfCandD0D0 = pfCandD0 * pfCandD0;
265  pfCandDzDz = pfCandDz * pfCandDz;
266  pfCandD0Dz = pfCandD0 * pfCandDz;
267  pfCandD0Dphi = pfCandD0 * pfCandDPhi;
268 
269  pfCandDVx_1 = std::clamp(pfCandDVx_1, -pfCandDVx_y_z_1_max, pfCandDVx_y_z_1_max);
270  pfCandDVx_1 = pfCandDVx_1 / pfCandDVx_y_z_1_max;
271 
272  pfCandDVy_1 = std::clamp(pfCandDVy_1, -pfCandDVx_y_z_1_max, pfCandDVx_y_z_1_max);
273  pfCandDVy_1 = pfCandDVy_1 / pfCandDVx_y_z_1_max;
274 
275  pfCandDVz_1 = std::clamp(pfCandDVz_1, -pfCandDVx_y_z_1_max, pfCandDVx_y_z_1_max);
276  pfCandDVz_1 = pfCandDVz_1 / pfCandDVx_y_z_1_max;
277 
278  pfCandD_1 = std::clamp(pfCandD_1, -pfCandD_1_max, pfCandD_1_max);
279  pfCandD_1 = pfCandD_1 / pfCandD_1_max;
280 
281  if (graphVersion == 0) {
282  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 0) = pfCandPt;
283  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 1) = pfCandPz;
284  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 2) = pfCandPtRel;
285  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 3) = pfCandPzRel;
286  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 4) = pfCandDr;
287  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 5) = pfCandDEta;
288  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 6) = pfCandDPhi;
289  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 7) = pfCandEta;
290  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 8) = pfCandDz;
291  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 9) = pfCandDzSig;
292  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 10) = pfCandD0;
293  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 11) = pfCandD0Sig;
294  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 12) = pfCandDzErr;
295  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 13) = pfCandD0Err;
296  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 14) = pfCandD0D0;
297  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 15) = pfCandCharge == 0;
298  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 16) = pfCandCharge == 1;
299  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 17) = pfCandCharge == -1;
300  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 18) = pfCandPdgID > 22;
301  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 19) = pfCandPdgID == 22;
302  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 20) = pfCandDzDz;
303  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 21) = pfCandD0Dz;
304  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 22) = pfCandD0Dphi;
305  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 23) = pfCandPtRelPtRel;
306  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 24) = pfCandPixHits;
307  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 25) = pfCandHits;
308  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 26) = pfCandLostInnerHits == -1;
309  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 27) = pfCandLostInnerHits == 0;
310  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 28) = pfCandLostInnerHits == 1;
311  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 29) = pfCandLostInnerHits == 2;
312  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 30) = pfCandPuppiWeight;
313  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 31) = (pfCandVtxQuality == 1);
314  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 32) = (pfCandVtxQuality == 5);
315  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 33) = (pfCandVtxQuality == 6);
316  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 34) = (pfCandVtxQuality == 7);
317  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 35) = (pfCandFromPV == 1);
318  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 36) = (pfCandFromPV == 2);
319  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 37) = (pfCandFromPV == 3);
320  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 38) = pfCandIsBarrel;
321  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 39) = pfCandHighPurityTrk;
322  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 40) = pfCandPdgID == 1;
323  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 41) = pfCandPdgID == 2;
324  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 42) = pfCandPdgID == 11;
325  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 43) = pfCandPdgID == 13;
326  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 44) = pfCandPdgID == 130;
327  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 45) = pfCandPdgID == 211;
328  tensor.tensor<float, 3>()(0, 60 - 1 - iPF, 46) = pfCandTauIndMatch;
329  }
330 
331  if (graphVersion == 1) {
332  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 0) = pfCandPt;
333  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 1) = pfCandPz;
334  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 2) = pfCandPtRel;
335  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 3) = pfCandPzRel;
336  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 4) = pfCandDr;
337  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 5) = pfCandDEta;
338  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 6) = pfCandDPhi;
339  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 7) = pfCandEta;
340  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 8) = pfCandDz;
341  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 9) = pfCandDzSig;
342  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 10) = pfCandD0;
343  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 11) = pfCandD0Sig;
344  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 12) = pfCandDzErr;
345  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 13) = pfCandD0Err;
346  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 14) = pfCandD0D0;
347  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 15) = pfCandCharge == 0;
348  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 16) = pfCandCharge == 1;
349  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 17) = pfCandCharge == -1;
350  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 18) = pfCandPdgID > 22;
351  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 19) = pfCandPdgID == 22;
352  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 20) = pfCandDVx_1;
353  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 21) = pfCandDVy_1;
354  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 22) = pfCandDVz_1;
355  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 23) = pfCandD_1;
356  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 24) = pfCandDzDz;
357  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 25) = pfCandD0Dz;
358  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 26) = pfCandD0Dphi;
359  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 27) = pfCandPtRelPtRel;
360  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 28) = pfCandPixHits;
361  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 29) = pfCandHits;
362  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 30) = pfCandLostInnerHits == -1;
363  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 31) = pfCandLostInnerHits == 0;
364  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 32) = pfCandLostInnerHits == 1;
365  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 33) = pfCandLostInnerHits == 2;
366  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 34) = pfCandPuppiWeight;
367  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 35) = (pfCandVtxQuality == 1);
368  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 36) = (pfCandVtxQuality == 5);
369  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 37) = (pfCandVtxQuality == 6);
370  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 38) = (pfCandVtxQuality == 7);
371  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 39) = (pfCandFromPV == 1);
372  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 40) = (pfCandFromPV == 2);
373  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 41) = (pfCandFromPV == 3);
374  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 42) = pfCandIsBarrel;
375  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 43) = pfCandHighPurityTrk;
376  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 44) = pfCandPdgID == 1;
377  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 45) = pfCandPdgID == 2;
378  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 46) = pfCandPdgID == 11;
379  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 47) = pfCandPdgID == 13;
380  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 48) = pfCandPdgID == 130;
381  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 49) = pfCandPdgID == 211;
382  tensor.tensor<float, 3>()(0, 36 - 1 - iPF, 50) = pfCandTauIndMatch;
383  }
384  iPF++;
385  }
386  tensorflow::run(&(cache_->getSession()), {{"input_1", tensor}}, {"output_node0"}, &outputs_);
387  predictions.matrix<float>()(tau_index, 0) = outputs_[0].flat<float>()(0);
388  }
389  return predictions;
390  }

References funct::abs(), c, deep_tau::DeepTauBase::cache_, SiPixelRawToDigiRegional_cfi::deltaPhi, PbPb_ZMuSkimMuonDPG_cff::deltaR, mps_fire::end, dqmMemoryStats::float, generate(), GetNumberOfFeatures(), getNumberOfParticles(), deep_tau::DeepTauCache::getSession(), graphVersion, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, min(), dqmiodumpmetadata::n, deep_tau::DeepTauBase::outputs_, AlCaHLTBitMon_ParallelJobs::p, deep_tau::DeepTauBase::pfcandToken_, tensorflow::run(), jetUpdater_cfi::sort, mathSSE::sqrt(), metsig::tau, Tau3MuMonitor_cff::taus, AlignmentTracksFromVertexSelector_cfi::vertices, and deep_tau::DeepTauBase::vtxToken_.

Member Data Documentation

◆ graphVersion

unsigned DPFIsolation::graphVersion
private
deep_tau::DeepTauBase::cache_
const DeepTauCache * cache_
Definition: DeepTauBase.h:135
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
deep_tau::DeepTauCache::getSession
tensorflow::Session & getSession(const std::string &name="") const
Definition: DeepTauBase.h:57
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
deep_tau::DeepTauBase::pfcandToken_
edm::EDGetTokenT< CandidateCollection > pfcandToken_
Definition: DeepTauBase.h:130
metsig::tau
Definition: SignAlgoResolutions.h:49
min
T min(T a, T b)
Definition: MathUtil.h:58
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
pat::Tau
Analysis-level tau class.
Definition: Tau.h:53
deep_tau::DeepTauBase::OutputCollection
std::map< std::string, Output > OutputCollection
Definition: DeepTauBase.h:91
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
deep_tau::DeepTauBase::vtxToken_
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: DeepTauBase.h:131
edm::Handle< pat::PackedCandidateCollection >
GetRecoTauVFromDQM_MC_cff.Output
Output
Definition: GetRecoTauVFromDQM_MC_cff.py:12
AlignmentTracksFromVertexSelector_cfi.vertices
vertices
Definition: AlignmentTracksFromVertexSelector_cfi.py:5
DPFIsolation::GetOutputs
static const OutputCollection & GetOutputs()
Definition: DPFIsolation.cc:24
generate
void generate(uint32_t const nbins, float const *initValues, std::vector< float > &values)
Definition: generateQIEShapes.cc:48
deep_tau::DeepTauBase::DeepTauBase
DeepTauBase(const edm::ParameterSet &cfg, const OutputCollection &outputs, const DeepTauCache *cache)
Definition: DeepTauBase.cc:86
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
mps_fire.end
end
Definition: mps_fire.py:242
utilities.cache
def cache(function)
Definition: utilities.py:3
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
deep_tau::DeepTauBase::outputs_
OutputCollection outputs_
Definition: DeepTauBase.h:134
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pat::PackedCandidate
Definition: PackedCandidate.h:22
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
DPFIsolation::getNumberOfParticles
static unsigned getNumberOfParticles(unsigned graphVersion)
Definition: DPFIsolation.cc:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Exception
Definition: hltDiff.cc:245
tensorflow::run
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:213
DPFIsolation::GetNumberOfFeatures
static unsigned GetNumberOfFeatures(unsigned graphVersion)
Definition: DPFIsolation.cc:35
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::InputTag
Definition: InputTag.h:15
deep_tau::DeepTauCache::getGraph
const tensorflow::GraphDef & getGraph(const std::string &name="") const
Definition: DeepTauBase.h:58
DPFIsolation::graphVersion
unsigned graphVersion
Definition: DPFIsolation.cc:393