ATLAS Offline Software
Loading...
Searching...
No Matches
Tool_DetailsArranger.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9
11
12 return ( i.cachedElement()->bdtPi0Score() > j.cachedElement()->bdtPi0Score() );
13}
14
15
17 asg::AsgTool(name)
18{}
19
21
23
24 m_init=true;
25
27
28 ATH_CHECK( m_Tool_InformationStore->getInfo_Double("TauConstituents_Types_DeltaRCore", m_CoreCone) );
29 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_BinEdges_Eta", m_EtaBinEdges) );
30 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_Neutral_EtaBinned_EtCut", m_EtaBinnedEtCuts) );
31 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Ratio", m_varTypeName_Ratio) );
32 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Mean", m_varTypeName_Mean) );
33 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_StdDev", m_varTypeName_StdDev) );
34 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_HLV", m_varTypeName_HLV) );
35 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Angle", m_varTypeName_Angle) );
36 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_DeltaR", m_varTypeName_DeltaR) );
37 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_JetMoment", m_varTypeName_JetMoment) );
38 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Combined", m_varTypeName_Combined) );
39 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Basic", m_varTypeName_Basic) );
40 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_PID", m_varTypeName_PID) );
41 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Shots", m_varTypeName_Shots) );
42
43 return StatusCode::SUCCESS;
44}
45
46
47StatusCode PanTau::Tool_DetailsArranger::execute(PanTau::PanTauSeed* inSeed, xAOD::ParticleContainer& pi0Container, xAOD::PFOContainer& neutralPFOContainer) const {
48
51 bool noValidInputTau = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed::t_NoValidInputTau);
52 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
53
54 //set the PFO link vector and pantau 4-vector to default values for every tau first (xAOD technicality)
55 //if the tau is valid, overwrite with non-default values
56 xAOD::TauJet* tauJet = inSeed->getTauJet();
57
58 if (isBadSeed) {
59 ATH_MSG_DEBUG("This seed is not useable for detail arranging (other than validity flag)");
62 return StatusCode::SUCCESS;
63 }
64
65 ATH_CHECK(arrangePFOLinks(inSeed, tauJet, pi0Container, neutralPFOContainer));
66
67 //Basic variables
73
74 //Final 4-vector
75 tauJet->setP4(xAOD::TauJetParameters::PanTauCellBased, inSeed->getFinalMomentum().Pt(), inSeed->getFinalMomentum().Eta(), inSeed->getFinalMomentum().Phi(), inSeed->getFinalMomentum().M());
76
77 //BDT variables
78 addPanTauDetailToTauJet(inSeed, "Basic_NNeutralConsts",
80 addPanTauDetailToTauJet(inSeed, "Charged_JetMoment_EtDRxTotalEt",
82 addPanTauDetailToTauJet(inSeed, "Charged_StdDev_Et_WrtEtAllConsts",
84 addPanTauDetailToTauJet(inSeed, "Neutral_HLV_SumM",
86 addPanTauDetailToTauJet(inSeed, "Neutral_PID_BDTValues_BDTSort_1",
88 addPanTauDetailToTauJet(inSeed, "Neutral_PID_BDTValues_BDTSort_2",
90 addPanTauDetailToTauJet(inSeed, "Neutral_Ratio_1stBDTEtOverEtAllConsts",
92 addPanTauDetailToTauJet(inSeed, "Neutral_Ratio_EtOverEtAllConsts",
94 addPanTauDetailToTauJet(inSeed, "Neutral_Shots_NPhotonsInSeed",
96 addPanTauDetailToTauJet(inSeed, "Combined_DeltaR1stNeutralTo1stCharged",
98 addPanTauDetailToTauJet(inSeed, "Charged_HLV_SumM",
100
101 return StatusCode::SUCCESS;
102}
103
104
106 const std::string& featName,
108 PanTauDetailsType detailType) const {
109
110 bool isValid;
111 const PanTau::TauFeature* features = inSeed->getFeatures();
112 std::string fullFeatName = "CellBased_" + featName;
113
114 double theValue = features->value(fullFeatName, isValid);
115 if (!isValid) {
116 bool noAnyConstituents = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed::t_NoConstituentsAtAll);
118 bool noValidInputTau = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed::t_NoValidInputTau);
119 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
120
121 if (!isBadSeed) {
122 ATH_MSG_DEBUG("WARNING --- Problems getting value for feature " << fullFeatName << " from map! This should not happen for this seed!");
123 ATH_MSG_DEBUG("WARNING --- Did the ModeDiscriminator set features used in BDTs that were not found to their default values?");
124 ATH_MSG_DEBUG("NOTE --- This can also happen for seeds with (for example) 0 neutrals when trying to get Neutral_SumM - check seed");
125 }
126 theValue = -1111.;
127 }
128
129 xAOD::TauJet* tauJet = inSeed->getTauJet();
130 int valueToAddInt = -1;
131 float valueToAddFloat = -1.1;
132
133 switch(detailType) {
135 valueToAddInt = static_cast<int>(theValue);
136 tauJet->setPanTauDetail(detailEnum, valueToAddInt);
137 break;
139 valueToAddFloat = static_cast<float>(theValue);
140 tauJet->setPanTauDetail(detailEnum, valueToAddFloat);
141 break;
142 default:
143 ATH_MSG_WARNING("Unknown PanTauDetailType! Please use enum PanTauDetailsType from PanTauAlgs/Tool_DetailsArranger.h.");
144 ATH_MSG_WARNING("!NOT! adding detail named " << featName);
145 break;
146 }
147
148 }
149
150
152
153 //get the PFO links
154 std::vector< ElementLink< xAOD::PFOContainer > > chrgPFOLinks = tauJet->protoChargedPFOLinks();
155 std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->protoNeutralPFOLinks();
156 std::vector< ElementLink< xAOD::PFOContainer > > pi0PFOLinks = CollectConstituentsAsPFOLinks( inSeed, tauJet->protoNeutralPFOLinks(), PanTau::TauConstituent::t_Pi0Neut );
157 std::vector< ElementLink< xAOD::PFOContainer > > preSelected_neutralPFOLinks = CollectConstituentsAsPFOLinks( inSeed, tauJet->protoNeutralPFOLinks(), PanTau::TauConstituent::t_Neutral );
158
159 //clear the default links, just to be safe
160 tauJet->clearChargedPFOLinks();
161 tauJet->clearNeutralPFOLinks();
162 tauJet->clearPi0PFOLinks();
163
164 std::vector< ElementLink< xAOD::PFOContainer > > preLinkPi0PFOLinks = tauJet->pi0PFOLinks();
165
166 // sort PFO links according to pi0 BDT score:
167 std::sort (pi0PFOLinks.begin(), pi0PFOLinks.end(), sortBDTscore);
168 std::sort (preSelected_neutralPFOLinks.begin(), preSelected_neutralPFOLinks.end(), sortBDTscore);
169 std::sort (neutralPFOLinks.begin(), neutralPFOLinks.end(), sortBDTscore);
170
171 // set the masses of all neutrals *and pi0 neutrals* to 0:
172 SetNeutralConstituentVectorMasses(neutralPFOLinks, neutralPFOContainer, 0.);
173
174 // arrange charged & neutral PFOs: they are not changed -> copy from cellbased
175 tauJet->setChargedPFOLinks(chrgPFOLinks);
176 tauJet->setNeutralPFOLinks(neutralPFOLinks);
177
178 tauJet->setDetail(xAOD::TauJetParameters::nCharged, static_cast<int>(chrgPFOLinks.size()));
179
180 //arrange pi0 pfos: depends on decay mode classification
181 int decayModeProto = inSeed->getDecayModeBySubAlg();
182 int decayModeFinal = inSeed->getDecayModeByPanTau();
183
184 if(decayModeFinal == xAOD::TauJetParameters::Mode_Other) {
185 tauJet->setPi0PFOLinks(pi0PFOLinks);
186 SetHLVTau(inSeed, tauJet, m_varTypeName_Basic);
187
188 return StatusCode::SUCCESS;
189 }
190
191 //if pantau sets the same decay mode as the substructure algorithm, just copy the links
192 if(decayModeProto == decayModeFinal) {
193
194 if( decayModeFinal == xAOD::TauJetParameters::Mode_3pXn && pi0PFOLinks.size() > 1 ){
195
196 // assign all neutrals but only one pi0 neutral to Pantau:
197 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
198
199 // set all masses correctly:
200 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
201
202 } else {
203
204 // assign the same constituents to Pantau:
205 preLinkPi0PFOLinks=pi0PFOLinks;
206
207 // set all masses correctly:
208 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
209 }
210
211 } else {
212
213 if( decayModeFinal == xAOD::TauJetParameters::Mode_1p1n && decayModeProto == xAOD::TauJetParameters::Mode_1p0n ){
214
215 // add the highest BDT-score neutral from the sub-alg:
216 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
217 else ATH_MSG_WARNING("No neutral PFO Links although there should be!!");
218
219 // set the mass:
220 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
221
222 } else if( decayModeFinal == xAOD::TauJetParameters::Mode_1p0n && decayModeProto == xAOD::TauJetParameters::Mode_1p1n ){
223
224 // do nothing (leave the pi0 neutrals list empty)
225
226 } else if( decayModeFinal == xAOD::TauJetParameters::Mode_1pXn && decayModeProto == xAOD::TauJetParameters::Mode_1p1n ){
227
228
229 if( pi0PFOLinks.size() == 1 && HasMultPi0sInOneCluster(pi0PFOLinks.at(0).cachedElement(), decayModeProto) ){
230
231 // assign twice the pi0 mass to the one pi0 PFO:
232 SetNeutralConstituentVectorMasses(pi0PFOLinks, neutralPFOContainer, 2*MASS_PI0);
233
234 // assign the same constituents to Pantau:
235 preLinkPi0PFOLinks=pi0PFOLinks;
236
237 } else {
238
239 // copy all (really only one) pi0s from the sub-alg and add
240 // the highest BDT-score neutral:
241 preLinkPi0PFOLinks=pi0PFOLinks;
242 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
243 else ATH_MSG_WARNING("No neutral PFO Links although there should be!!");
244
245 // set the mass:
246 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
247 }
248
249 } else if( decayModeFinal == xAOD::TauJetParameters::Mode_1p1n && decayModeProto == xAOD::TauJetParameters::Mode_1pXn ){
250
251 // copy all (two) pi0s from the sub-alg:
252 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
253 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(1) );
254
255 // set both pi0neutrals to mass 0 (photon mass):
256 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, 0.);
257
258 } else if( decayModeFinal == xAOD::TauJetParameters::Mode_3pXn && decayModeProto == xAOD::TauJetParameters::Mode_3p0n ){
259
260 // add the highest BDT-score neutral from the sub-alg:
261 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
262 else ATH_MSG_WARNING("No neutral PFO Links although there should be!!");
263
264 // set the mass:
265 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
266
267 } else if( decayModeFinal == xAOD::TauJetParameters::Mode_3p0n && decayModeProto == xAOD::TauJetParameters::Mode_3pXn ){
268
269 // do nothing (leave the pi0 neutrals list empty)
270 }
271 }
272
273 tauJet->setPi0PFOLinks(preLinkPi0PFOLinks);
274
275 SetHLVTau(inSeed, tauJet, m_varTypeName_Basic);
276
277 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->chargedPFOLinks();
278 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->pi0PFOLinks();
279 std::vector< ElementLink< xAOD::PFOContainer > > finalNeutralPFOLinks = tauJet->neutralPFOLinks();
280
281 // vector of 4-vectors of actual pi0s and a vector with pointers to PFOs:
282 std::vector< TLorentzVector > vec_pi04vec;
283 std::vector< std::vector< ElementLink<xAOD::PFOContainer> > > vec_pi0pfos;
284 createPi0Vectors(tauJet, vec_pi04vec, vec_pi0pfos);
285
286 for(unsigned int itlv=0; itlv!=vec_pi04vec.size(); ++itlv) {
288 pi0Container.push_back(p);
289 p->setPxPyPzE(vec_pi04vec.at(itlv).Px(), vec_pi04vec.at(itlv).Py(), vec_pi04vec.at(itlv).Pz(), vec_pi04vec.at(itlv).E());
290 std::vector< ElementLink< xAOD::PFOContainer > > pfo_link_vector;
291 for( uint ipfo = 0; ipfo != vec_pi0pfos.at(itlv).size(); ++ipfo) {
292 pfo_link_vector.push_back(vec_pi0pfos.at(itlv).at(ipfo));
293 }
294
295 static const SG::Accessor<std::vector< ElementLink< xAOD::PFOContainer > > > accPi0PFOLinks("pi0PFOLinks");
296 accPi0PFOLinks(*p) = pfo_link_vector;
297
299 linkToPi0.toContainedElement(pi0Container, dynamic_cast<xAOD::IParticle*> (p));
300
301 tauJet->addPi0Link(linkToPi0);
302 }
303
304 return StatusCode::SUCCESS;
305}
306
307
308// Calculate final 4-vector:
309void PanTau::Tool_DetailsArranger::SetHLVTau( PanTau::PanTauSeed* inSeed, xAOD::TauJet* tauJet, const std::string& varTypeName_Basic) {
310
311 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->chargedPFOLinks();
312 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->pi0PFOLinks();
313
314 unsigned int NCharged = finalChrgPFOLinks.size();
315 unsigned int NPi0Neut = finalPi0PFOLinks.size();
316
317 TLorentzVector tlv_PanTau_Final;
318 for(unsigned int iPFO=0; iPFO<NCharged; iPFO++) {
319 const xAOD::PFO* pfo = finalChrgPFOLinks.at(iPFO).cachedElement();
320 tlv_PanTau_Final += pfo->p4();
321 }
322 for(unsigned int iPFO=0; iPFO<NPi0Neut; iPFO++) {
323 const xAOD::PFO* pfo = finalPi0PFOLinks.at(iPFO).cachedElement();
324 tlv_PanTau_Final += pfo->p4();
325 }
326
327 inSeed->setFinalMomentum(tlv_PanTau_Final);
328
329 PanTau::TauFeature* featureMap = inSeed->getFeatures();
330 featureMap->addFeature("CellBased_" + varTypeName_Basic + "_FinalMomentumCore_pt", tlv_PanTau_Final.Pt() );
331 featureMap->addFeature("CellBased_" + varTypeName_Basic + "_FinalMomentumCore_eta", tlv_PanTau_Final.Eta() );
332 featureMap->addFeature("CellBased_" + varTypeName_Basic + "_FinalMomentumCore_phi", tlv_PanTau_Final.Phi() );
333 featureMap->addFeature("CellBased_" + varTypeName_Basic + "_FinalMomentumCore_m", tlv_PanTau_Final.M() );
334}
335
336
337bool PanTau::Tool_DetailsArranger::HasMultPi0sInOneCluster(const xAOD::PFO* pfo, int decayModeProto) const {
338
339 // this is only relevant for reco 1p1n modes, hence restrict the output to these modes
340
341 int nPi0sPerCluster = 1;
342
343 // cell-based sets this to 1pXn however below this function is
344 // called with the decayModeProto as evaluated by Pantau!
345 if (decayModeProto != xAOD::TauJetParameters::Mode_1p1n ) return (nPi0sPerCluster > 1);
346
347 if( !pfo->attribute(xAOD::PFODetails::nPi0Proto, nPi0sPerCluster) ) {
348 ATH_MSG_WARNING("Could not retrieve nPi0Proto. Will set it to 1.");
349 nPi0sPerCluster = 1;
350 }
351
352 return (nPi0sPerCluster > 1);
353}
354
355
357
358 TLorentzVector momentum;
359 PanTau::SetP4EEtaPhiM( momentum, neutral_pfo->e(), neutral_pfo->eta(), neutral_pfo->phi(), mass);
360 neutral_pfo->setP4(momentum.Pt(), neutral_pfo->eta(), neutral_pfo->phi(), mass);
361}
362
363
364void PanTau::Tool_DetailsArranger::SetNeutralConstituentVectorMasses(const std::vector< ElementLink<xAOD::PFOContainer> >& neutralPFOLinks, xAOD::PFOContainer& neutralPFOContainer, double mass) {
365
366 for (const auto& link : neutralPFOLinks) {
367 size_t index = link.index();
368 xAOD::PFO* curNeutralPFO = neutralPFOContainer.at(index);
369 SetNeutralConstituentMass(curNeutralPFO, mass);
370 }
371
372 }
373
374
375std::vector< ElementLink< xAOD::PFOContainer > > PanTau::Tool_DetailsArranger::CollectConstituentsAsPFOLinks( PanTau::PanTauSeed* inSeed,
376 const std::vector< ElementLink< xAOD::PFOContainer > >& cellbased_neutralPFOLinks,
378 // collect element links from tau constituents in the Pantau
379 // seed of type "type". cellbased_neutralPFOLinks is only used
380 // to obtain the ElementLinks.
381
382 std::vector< ElementLink< xAOD::PFOContainer > > new_links;
383
384 unsigned int nConstsOfType=0;
385 bool foundIt=false;
386 std::vector<PanTau::TauConstituent*> tauConstituents=inSeed->getConstituentsOfType(type,foundIt);
387
389 ATH_MSG_WARNING("CollectConstituentsAsPFOLinks: Function was called with type = " << type << " , however it was only designed for types t_Pi0Neut and t_Neutral! Returning...");
390 return new_links;
391 }
392
393 for(unsigned int iConst=0; iConst<tauConstituents.size(); iConst++) {
394 bool isOfType = tauConstituents[iConst]->isOfType(type);
395 if(!isOfType) continue;
396
397 // if the requested type is t_Neutral then exclude any t_Pi0Neut
398 // from the list (note: tau constituents that are t_Pi0Neut are
399 // also t_Neutral at the same time):
400 if(type==PanTau::TauConstituent::t_Neutral && tauConstituents[iConst]->isOfType(PanTau::TauConstituent::t_Pi0Neut) ) continue;
401 ++nConstsOfType;
402
403 for(unsigned int iPFO=0; iPFO<cellbased_neutralPFOLinks.size(); iPFO++) {
404 const xAOD::PFO* pfo = cellbased_neutralPFOLinks.at(iPFO).cachedElement();
405
406 if( tauConstituents[iConst]->getPFO() != pfo ) continue;
407
408 new_links.push_back( cellbased_neutralPFOLinks.at(iPFO) );
409 }
410 }
411
412 if( nConstsOfType != new_links.size() ){
413 ATH_MSG_WARNING("CollectConstituentsAsPFOLinks: Couldn't find PFOLinks " << new_links.size() << " for all tau constituents (" << tauConstituents.size() << ")!");
414 }
415
416 return new_links;
417}
418
419
420//______________________________________________________________________________
421void PanTau::Tool_DetailsArranger::createPi0Vectors(xAOD::TauJet* tauJet, std::vector<TLorentzVector>& vPi0s, std::vector< std::vector< ElementLink< xAOD::PFOContainer > > > &vec_pi0pfos)
422{
423 // reset the pi0s
424 vPi0s.clear();
425 vec_pi0pfos.clear();
426
427 // Since the PFO links as they come out of reconstruction, only correspond to
428 // calorimeter clusters, whereas we want the consts_pi0 vectors to correspond
429 // to real pi0s, we need to be careful to collect the PFOs correctly to pi0s
430 // for the cases where number of pi0s does not match to the decay mode:
431 size_t iNumPi0PFO = tauJet->nPi0PFOs();
432
433 int iDecayMode = -1;
435
436 if (iDecayMode == xAOD::TauJetParameters::Mode_1p1n && iNumPi0PFO > 1) {
437
438 // float fMassPi0 = ParticleConstants::piZeroMassInMeV;
439 float fMassPi0Squared = MASS_PI0*MASS_PI0;
440
441 // combine both photons (with 0 mass that is already set) to one pi0 vector:
442 const xAOD::PFO* xPfo1 = tauJet->pi0PFO(0);
443 const xAOD::PFO* xPfo2 = tauJet->pi0PFO(1);
444 vPi0s.push_back(xPfo1->p4() + xPfo2->p4());
445
446 // re-set the mass to one pi0:
447 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
448 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
449 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
450 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
451 vPi0s[0].E());
452
453 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
454 pfovec.push_back(tauJet->pi0PFOLinks()[0]);
455 pfovec.push_back(tauJet->pi0PFOLinks()[1]);
456 vec_pi0pfos.push_back( pfovec );
457
458 } else if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && iNumPi0PFO == 1){
459
460 // make a single pi0 from a PFO that contains two pi0s:
461 const xAOD::PFO* xPfo = tauJet->pi0PFO(0);
462 // add the 2-pi0 vector preliminarily to the pi0vector:
463 vPi0s.push_back(xPfo->p4());
464
465 // re-set the mass back to one pi0:
466 double dNewMomentum = std::sqrt( (vPi0s[0].E()/2.)*(vPi0s[0].E()/2.) - MASS_PI0*MASS_PI0 );
467 vPi0s[0].SetVectM(vPi0s[0].Vect().Unit() * dNewMomentum, MASS_PI0 );
468
469 // create another pi0 from the same vector:
470 vPi0s.push_back(vPi0s[0]);
471
472 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
473 pfovec.push_back(tauJet->pi0PFOLinks()[0]);
474 vec_pi0pfos.push_back( pfovec );
475 vec_pi0pfos.push_back( pfovec );//fix rare crash?
476
477 } else {
478 // if it's not any of the special cases above then just collect the PFOs:
479 for (size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++){
480 vPi0s.push_back(tauJet->pi0PFO(iPFO)->p4());
481 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
482 pfovec.push_back(tauJet->pi0PFOLinks()[iPFO]);
483 vec_pi0pfos.push_back( pfovec );
484 }
485 }
486
487}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
unsigned int uint
bool sortBDTscore(const ElementLink< xAOD::PFOContainer > &i, const ElementLink< xAOD::PFOContainer > &j)
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
int getDecayModeByPanTau() const
Definition PanTauSeed.h:225
std::vector< PanTau::TauConstituent * > getConstituentsOfType(int tauConstituent_Type, bool &foundit)
void setFinalMomentum(TLorentzVector finalMom)
Definition PanTauSeed.h:229
bool isOfTechnicalQuality(int pantauSeed_TechnicalQuality) const
const xAOD::TauJet * getTauJet() const
Definition PanTauSeed.h:215
int getDecayModeBySubAlg() const
Definition PanTauSeed.h:224
TLorentzVector getFinalMomentum() const
Definition PanTauSeed.h:223
const PanTau::TauFeature * getFeatures() const
Definition PanTauSeed.h:217
Type
Type enumeration to specify type of this tau constituent.
Class containing features of a tau seed.
Definition TauFeature.h:19
bool addFeature(const std::string &name, const double value)
adds a new feature
double value(const std::string &name, bool &isValid) const
returns the value of the feature given by its name
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
StatusCode arrangePFOLinks(PanTau::PanTauSeed *inSeed, xAOD::TauJet *tauJet, xAOD::ParticleContainer &pi0Container, xAOD::PFOContainer &neutralPFOContainer) const
Gaudi::Property< std::string > m_Tool_InformationStoreName
static void SetHLVTau(PanTau::PanTauSeed *inSeed, xAOD::TauJet *tauJet, const std::string &varTypeName_Basic)
std::vector< double > m_EtaBinnedEtCuts
static void SetNeutralConstituentMass(xAOD::PFO *neutral_pfo, double mass)
static void createPi0Vectors(xAOD::TauJet *tauJet, std::vector< TLorentzVector > &vPi0s, std::vector< std::vector< ElementLink< xAOD::PFOContainer > > > &vec_pi0pfos)
ToolHandle< PanTau::ITool_InformationStore > m_Tool_InformationStore
std::vector< double > m_EtaBinEdges
Tool_DetailsArranger(const std::string &name)
bool HasMultPi0sInOneCluster(const xAOD::PFO *pfo, int decayModeProto) const
void addPanTauDetailToTauJet(PanTauSeed *inSeed, const std::string &featName, xAOD::TauJetParameters::PanTauDetails detailEnum, PanTauDetailsType detailType) const
static const constexpr float MASS_PI0
virtual StatusCode execute(PanTau::PanTauSeed *inSeed, xAOD::ParticleContainer &pi0Container, xAOD::PFOContainer &neutralPFOContainer) const
std::vector< ElementLink< xAOD::PFOContainer > > CollectConstituentsAsPFOLinks(PanTau::PanTauSeed *inSeed, const std::vector< ElementLink< xAOD::PFOContainer > > &cellbased_neutralPFOLinks, PanTau::TauConstituent::Type type) const
static void SetNeutralConstituentVectorMasses(const std::vector< ElementLink< xAOD::PFOContainer > > &neutralPFOLinks, xAOD::PFOContainer &neutralPFOContainer, double mass)
Helper class to provide type-safe access to aux data.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
Class providing the definition of the 4-vector interface.
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition PFO_v1.cxx:95
void setP4(const FourMom_t &vec)
set the 4-vec
Definition PFO_v1.cxx:107
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition PFO_v1.cxx:60
virtual double e() const
The total energy of the particle.
Definition PFO_v1.cxx:81
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition PFO_v1.cxx:67
void setPi0PFOLinks(const PFOLinks_t &pi0PFOs)
void setPanTauDetail(TauJetParameters::PanTauDetails panTauDetail, int value)
const PFO * pi0PFO(size_t i) const
Get the pointer to a given pi0 PFO associated with this tau.
void clearPi0PFOLinks()
Remove all pi0 PFOs from the tau.
const PFOLinks_t & pi0PFOLinks() const
const PFOLinks_t & protoChargedPFOLinks() const
cellbased pfos
size_t nPi0PFOs() const
Get the number of pi0 PFO particles associated with this tau.
void clearChargedPFOLinks()
Remove all charged PFOs from the tau.
void addPi0Link(const ElementLink< IParticleContainer > &tr)
add a pi0 link to the tau
void setDetail(TauJetParameters::Detail detail, int value)
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
void clearNeutralPFOLinks()
Remove all neutral PFOs from the tau.
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
void setNeutralPFOLinks(const PFOLinks_t &neutralPFOs)
const PFOLinks_t & neutralPFOLinks() const
const PFOLinks_t & chargedPFOLinks() const
default pfos
void setChargedPFOLinks(const PFOLinks_t &chargedPFOs)
const PFOLinks_t & protoNeutralPFOLinks() const
static void SetP4EEtaPhiM(TLorentzVector &hlv, double e, double eta, double phi, double m)
Definition PanTauSeed.h:233
Definition index.py:1
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
PanTauDetails
Enum for tau details (scalar) calculated by pantau.
Definition TauDefs.h:355
@ PanTau_BDTVar_Neutral_PID_BDTValues_BDTSort_2
Definition TauDefs.h:371
@ PanTau_BDTVar_Charged_JetMoment_EtDRxTotalEt
Definition TauDefs.h:367
@ PanTau_BDTVar_Neutral_Ratio_1stBDTEtOverEtAllConsts
Definition TauDefs.h:372
@ PanTau_BDTVar_Neutral_PID_BDTValues_BDTSort_1
Definition TauDefs.h:370
@ PanTau_BDTVar_Combined_DeltaR1stNeutralTo1stCharged
Definition TauDefs.h:375
@ PanTau_BDTVar_Neutral_Ratio_EtOverEtAllConsts
Definition TauDefs.h:373
@ PanTau_BDTVar_Charged_StdDev_Et_WrtEtAllConsts
Definition TauDefs.h:368
@ PanTau_BDTVar_Neutral_Shots_NPhotonsInSeed
Definition TauDefs.h:374
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
Particle_v1 Particle
Define the latest version of the particle class.
ParticleContainer_v1 ParticleContainer
Define the latest version of the particle class.
TauJet_v3 TauJet
Definition of the current "tau version".