ATLAS Offline Software
Loading...
Searching...
No Matches
TauJet_v3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// System include(s):
6#include <cstdint>
7#include <bitset>
8
9// EDM include(s):
11
12// Local include(s):
15#include "TauJetAccessors_v3.h"
17
18
19namespace xAOD {
20
24
25
26 //primitive setters and getters for default 4-vector
31
32 //primitive setters and getters for JetSeed 4-vector
33 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptJetSeed)
34 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaJetSeed)
35 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiJetSeed)
36 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mJetSeed)
37
38 //primitive setters and getters for DetectorAxis 4-vector
39 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptDetectorAxis)
40 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaDetectorAxis)
41 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiDetectorAxis)
42 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mDetectorAxis)
43
44 //primitive setters and getters for IntermediateAxis 4-vector
45 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptIntermediateAxis)
46 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaIntermediateAxis)
47 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiIntermediateAxis)
48 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mIntermediateAxis)
49
50 //primitive setters and getters for TauEnergyScale 4-vector
51 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptTauEnergyScale)
52 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaTauEnergyScale)
53 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiTauEnergyScale)
54 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mTauEnergyScale)
55
56 //primitive setters and getters for ptTauEtaCalib 4-vector - deprecated in R22
57 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptTauEtaCalib)
58 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaTauEtaCalib)
59 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiTauEtaCalib)
60 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mTauEtaCalib)
61
62 //primitive setters and getters for PanTauCellBasedProto 4-vector - deprecated in R22
63 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptPanTauCellBasedProto)
64 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaPanTauCellBasedProto)
65 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiPanTauCellBasedProto)
66 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mPanTauCellBasedProto)
67
68 //primitive setters and getters for PanTauCellBased 4-vector
69 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptPanTauCellBased)
70 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaPanTauCellBased)
71 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiPanTauCellBased)
72 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mPanTauCellBased)
73
74 //primitive setters and getters for TrigCaloOnly 4-vector
75 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptTrigCaloOnly)
76 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaTrigCaloOnly)
77 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiTrigCaloOnly)
78 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mTrigCaloOnly)
79
80 //primitive setters and getters for FinalCalib 4-vector
81 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, ptFinalCalib)
82 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, etaFinalCalib)
83 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, phiFinalCalib)
84 AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( TauJet_v3, float, double, mFinalCalib)
85
86
87 double TauJet_v3::e() const {
88 return genvecP4().E();
89 }
90
91
92 double TauJet_v3::rapidity() const {
93 return genvecP4().Rapidity();
94 }
95
97 FourMom_t p4{};
98 p4.SetPtEtaPhiM( pt(), eta(), phi(),m());
99 return p4;
100 }
101
105
108
109 switch(calib) {
111 p4.SetPtEtaPhiM( ptJetSeed(), etaJetSeed(), phiJetSeed(), mJetSeed());
112 break;
115 break;
118 break;
121 break;
124 break;
127 break;
130 break;
133 break;
135 p4.SetPtEtaPhiM( ptFinalCalib(), etaFinalCalib(), phiFinalCalib(), mFinalCalib());
136 break;
137 default:
138 p4.SetPtEtaPhiM( pt(), eta(), phi(), m());
139 }
140
141 return p4;
142 }
143
145
146 switch(calib) {
165 default:
166 return GenVecFourMom_t( pt(), eta(), phi(), m());
167 }
168 }
169
170
171 void TauJet_v3::setP4(double pt, double eta, double phi, double m) {
172 static const Accessor< float > acc1( "pt" );
173 static const Accessor< float > acc2( "eta" );
174 static const Accessor< float > acc3( "phi" );
175 static const Accessor< float > acc4( "m" );
176 acc1( *this )=pt;
177 acc2( *this )=eta;
178 acc3( *this )=phi;
179 acc4( *this )=m;
180 }
181
182 bool TauJet_v3::setP4(const TauJetParameters::TauCalibType calib, double pt, double eta, double phi, double m) {
183 TauJetCalibTypeMapper_v1 typeMapper;
184 std::string calibString = "";
185 bool result = typeMapper.getValue(calib, calibString);
186 if (result) {
187 Accessor< float > accTauPtCalib( "pt"+calibString );
188 Accessor< float > accTauEtaCalib( "eta"+calibString );
189 Accessor< float > accTauPhiCalib( "phi"+calibString );
190 Accessor< float > accTauMCalib( "m"+calibString );
191 accTauPtCalib( *this )=pt;
192 accTauEtaCalib( *this )=eta;
193 accTauPhiCalib( *this )=phi;
194 accTauMCalib( *this )=m;
195 return true;
196 }
197 else {
198 return false;
199 }
200
201 }
202
203
204 Type::ObjectType TauJet_v3::type() const {
205 return Type::Tau;
206 }
207
208 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TauJet_v3, unsigned int, ROIWord , setROIWord )
210
211 //-------------------------------------------------------------------------
212 // Has discriminant
213 //-------------------------------------------------------------------------
215 {
216 // Get the discriminant accessor:
218 return acc != nullptr;
219 }
220
221
222 //-------------------------------------------------------------------------
223 // Get discriminant
224 //-------------------------------------------------------------------------
226 // Get the discriminant accessor:
228 if( ! acc ) return -1111.0;
229
230 // Retrieve the discriminant value:
231 return ( *acc )( *this );
232 }
233
234 //-------------------------------------------------------------------------
235 // Set discriminant
236 //-------------------------------------------------------------------------
238 ( *( xAODTau::discriminantAccessorV3( discriminant ) ) )( *this ) = value;
239 return;
240 }
241
242 //-------------------------------------------------------------------------
243 // Accept
244 //-------------------------------------------------------------------------
246 {
247 static const Accessor< uint32_t > acc( "isTauFlags" );
248 std::bitset<32> isTauFlags( acc( *this ) );
249 return isTauFlags[flag];
250 }
251
253 {
254 static const Accessor< uint32_t > acc( "isTauFlags" );
255 std::bitset<32> isTauFlags( acc( *this ) );
256 isTauFlags[flag] = value;
257 acc( *this ) = isTauFlags.to_ulong();
258 }
259
260
261 //-------------------------------------------------------------------------
262 // Get int detail via enum
263 //-------------------------------------------------------------------------
265 // Get the detail accessor:
267 if( ! acc ) return false;
268 if( ! acc->isAvailable( *this ) ) return false;
269
270 // Retrieve the detail value:
271 value = ( *acc )( *this );
272 return true;
273 }
274
275 //-------------------------------------------------------------------------
276 // Get float detail via enum
277 //-------------------------------------------------------------------------
279 // Get the detail accessor:
281 if( ! acc ) return false;
282 if( ! acc->isAvailable( *this ) ) return false;
283
284 // Retrieve the detail value:
285 value = ( *acc )( *this );
286 return true;
287 }
288
289 //-------------------------------------------------------------------------
290 // Get IParticle detail via enum
291 //-------------------------------------------------------------------------
293 // Get the detail accessor:
294 value=nullptr;
296 if( ! acc ) return false;
297 if( ! acc->isAvailable( *this ) ) return false;
298
299 // Retrieve the detail value:
300 ElementLink< IParticleContainer > link = ( *acc )( *this );
301 if( ! link.isValid() ) return false;
302 value = *link;
303 return true;
304 }
305
306 //-------------------------------------------------------------------------
307 // Set int detail via enum
308 //-------------------------------------------------------------------------
310 ( *( xAODTau::detailsAccessorV3<int>( detail ) ) )( *this ) = value;
311 }
312
313 //-------------------------------------------------------------------------
314 // Set float detail via enum
315 //-------------------------------------------------------------------------
317 ( *( xAODTau::detailsAccessorV3<float>( detail ) ) )( *this ) = value;
318 }
319
320 //-------------------------------------------------------------------------
321 // Set IParticle detail via enum
322 //-------------------------------------------------------------------------
324 if(value==nullptr){
325 ElementLink < IParticleContainer > lParticleLink;
326 ( *( xAODTau::detailsAccessorV3<ElementLink < IParticleContainer > >( detail ) ) )( *this ) = lParticleLink;
327 }
328 else{
329 if(!cont) cont=static_cast<const IParticleContainer*> (value->container());
330 ElementLink < IParticleContainer > lParticleLink(value, *cont);
331 ( *( xAODTau::detailsAccessorV3<ElementLink < IParticleContainer > >( detail ) ) )( *this ) = lParticleLink;
332 }
333 }
334
335
336 //-------------------------------------------------------------------------
337 // Get int panTauDetail via enum
338 //-------------------------------------------------------------------------
340 // Get the panTauDetail accessor:
342 if( ! acc ) return false;
343 if( ! acc->isAvailable( *this ) ) return false;
344
345 // Retrieve the panTauDetail value:
346 value = ( *acc )( *this );
347 return true;
348 }
349
350 //-------------------------------------------------------------------------
351 // Get float panTauDetail via enum
352 //-------------------------------------------------------------------------
354 // Get the panTauDetail accessor:
356 if( ! acc ) return false;
357 if( ! acc->isAvailable( *this ) ) return false;
358
359 // Retrieve the panTauDetail value:
360 value = ( *acc )( *this );
361 return true;
362 }
363
364 //-------------------------------------------------------------------------
365 // Set int panTauDetail via enum
366 //-------------------------------------------------------------------------
370
371 //-------------------------------------------------------------------------
372 // Set float panTauDetail via enum
373 //-------------------------------------------------------------------------
377
378
379
380
381 // implementing the functions by hand in order to maintain tauTrackLinks as
382 // persistent name for EL<TauTracks>, but to actually set/retrieve all links using
383 // function with name 'all'TauTrackLinks/set'All'TauTrackLinks
384 // // setters and getters for the track links
385 // AUXSTORE_OBJECT_SETTER_AND_GETTER( TauJet_v3,
386 // TauJet_v3::TauTrackLinks_t,
387 // tauTrackLinks,
388 // setTauTrackLinks )
389
391
393 return tauTrackAcc(*this);
394 }
395
397 tauTrackAcc(*this) = links;
398 return;
399 }
400
401 const TauJet_v3::TauTrackLinks_t TauJet_v3::tauTrackLinks(TauJetParameters::TauTrackFlag flag/*=TauJetParameters::TauTrackFlag::classifiedCharged*/) const{
402 TauTrack::TrackFlagType mask=1<<flag;
403 return tauTrackLinksWithMask(mask);
404 }
405
408 for(const ElementLink< xAOD::TauTrackContainer >& link : tauTrackAcc(*this) ){
409 // protection against tau track thinning
410 if(!link.isValid()) continue;
411 if( (*link)->flagWithMask(mask))
412 links.push_back(link);
413 }
414 return links;
415 }
416
417
421
422 const TauTrack* TauJet_v3::track( size_t i, TauJetParameters::TauTrackFlag flag/*=TauJetParameters::TauTrackFlag::classifiedCharged*/ ,int* container_index) const {
423 TauTrack::TrackFlagType mask=1<<flag;
424 return trackWithMask(i, mask, container_index);
425 }
426
427 const TauTrack* TauJet_v3::trackWithMask( size_t i, unsigned int mask, int* container_index ) const {
428 uint tracks_pass_mask=0;
429
430 for(const ElementLink< xAOD::TauTrackContainer >& link : tauTrackAcc(*this) ){
431 // protection against tau track thinning
432 if(!link.isValid()) continue;
433 const TauTrack* trk = *link;
434 if(trk->flagWithMask(mask)){
435 if(tracks_pass_mask==i) {
436 if(container_index) *container_index=link.index();
437 return trk;
438 }
439 else tracks_pass_mask++;
440 }
441 }
442 return nullptr;
443
444 }
445
446
447#ifndef XAOD_STANDALONE
448 TauTrack* TauJet_v3::trackNonConst( size_t i, TauJetParameters::TauTrackFlag flag/*=TauJetParameters::TauTrackFlag::classifiedCharged*/ ) {
449 int container_index=-1;
450 const TauTrack* c_trk=track(i,flag, &container_index);
451 if(c_trk==nullptr || container_index<0) return nullptr;
452 ElementLink< xAOD::TauTrackContainer > link = tauTrackAcc(*this).at(0);//we don't care about this specific link, just the container
453 xAOD::TauTrackContainer* tauTrackContainer = link.getDataNonConstPtr();
454 TauTrack* trk=tauTrackContainer->at(container_index);
455 if(trk!=c_trk) std::cout << "Did not properly retrieve non-const tauTrack" << std::endl;
456 return trk;
457 }
458#endif
459
461 std::vector<const TauTrack*> TauJet_v3::tracks(TauJetParameters::TauTrackFlag flag/*=TauJetParameters::TauTrackFlag::classifiedCharged*/ ) const{
462 TauTrack::TrackFlagType mask=1<<flag;
463 return tracksWithMask( mask );
464 }
465
467 std::vector<const TauTrack*> TauJet_v3::tracksWithMask( unsigned int mask ) const {
468 std::vector<const TauTrack*> trks;
469 for(const ElementLink< xAOD::TauTrackContainer >& link : tauTrackAcc(*this) ){
470 // protection against tau track thinning
471 if(!link.isValid()) continue;
472 const TauTrack* trk = *link;
473 if(trk->flagWithMask(mask)){
474 trks.push_back(trk);
475 }
476 }
477 return trks;
478 }
479
480
482 std::vector<const TauTrack*> TauJet_v3::allTracks() const{
484 return tracksWithMask( mask );
485 }
486
487 //number of tracks with a given classification
488 size_t TauJet_v3::nTracks(TauJetParameters::TauTrackFlag flag/*=TauJetParameters::TauTrackFlag::classifiedCharged*/) const{
489 TauTrack::TrackFlagType mask=1<<flag;
490 return nTracksWithMask(mask);
491 }
492
493
497
501
502
503 //number of tracks with a given classification
504 size_t TauJet_v3::nTracksWithMask(unsigned int flags) const{
505 size_t n(0);
506 for(const ElementLink< xAOD::TauTrackContainer >& link : tauTrackAcc(*this) ){
507 // protection against tau track thinning
508 if(!link.isValid()) continue;
509 const TauTrack* trk = *link;
510 if(trk->flagWithMask(flags)) n++;
511 }
512 return n;
513 }
514
515 //all tracks regardless of classification or lack thereof
516 size_t TauJet_v3::nAllTracks() const{
517 // return the number of tracks with valid element link
519 return nTracksWithMask( mask );
520 }
521
524 tauTrackAcc( *this ).push_back(tr);
525 }
526
528 tauTrackAcc( *this ).clear();
529 }
530
531 // setters and getters for the cluster links
534 clusterLinks,
535 setClusterLinks )
536
537 static const SG::Accessor< TauJet_v3::IParticleLinks_t > clusterAcc( "clusterLinks" );
538
539
540 const IParticle* TauJet_v3::cluster( size_t i) const {
541 return *(clusterAcc(*this).at(i));
542 }
543
544
545 std::vector<const IParticle*> TauJet_v3::clusters() const {
546 std::vector<const IParticle*> particleList;
547
548 for (const auto& link : clusterAcc(*this)) {
549 if (!link) {
550 continue;
551 }
552 const IParticle* particle = *link;
553 particleList.push_back(particle);
554 }
555
556 return particleList;
557 }
558
559
560
561 TauJet_v3::FourMom_t TauJet_v3::calibratedCluster( size_t i, xAOD::CaloCluster::State state/*=xAOD::CaloCluster::State::CALIBRATED*/) const{
562 const xAOD::IParticle* part = this->cluster(i);
563 if(!part) return FourMom_t();
564 const xAOD::CaloCluster* clus=dynamic_cast<const xAOD::CaloCluster*> (part);
565 if(!clus) return FourMom_t();
566 return clus->p4(state);
567 }
568
569 //number of clusters
570 size_t TauJet_v3::nClusters() const{
571 return clusterAcc( *this ).size();
572 }
573
576 clusterAcc( *this ).push_back(tr);
577 }
578
581 clusterAcc( *this ).clear();
582 }
583
585
586 std::vector<xAOD::CaloVertexedTopoCluster> TauJet_v3::vertexedClusters() const {
587 return vertexedClustersAcc(*this);
588 }
589
590 // setters and getters for the pi0 links
593 pi0Links,
594 setPi0Links )
595
596 static const SG::Accessor< TauJet_v3::IParticleLinks_t > pi0Acc( "pi0Links" );
597
598
599 const IParticle* TauJet_v3::pi0( size_t i) const {
600 return *(pi0Acc(*this).at(i));
601 }
602
603 //number of pi0s
604 size_t TauJet_v3::nPi0s() const{
605 return pi0Acc( *this ).size();
606 }
607
610 pi0Acc( *this ).push_back(tr);
611 }
612
615 pi0Acc( *this ).clear();
616 }
617
618
619
620 //setter and getter for trackfilterprongs
621 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TauJet_v3, int, trackFilterProngs , setTrackFilterProngs )
622 //setter and getter for trackfilterquality
623 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TauJet_v3, int, trackFilterQuality , setTrackFilterQuality )
624 //setter and getter for pi0ConeDR
625 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TauJet_v3, float, pi0ConeDR , setPi0ConeDR )
626
627
630 jetLink,
631 setJetLink )
632
633 static const SG::Accessor< TauJet_v3::JetLink_t > jetAcc( "jetLink" );
634
635 const Jet* TauJet_v3::jet() const {
636 if (!jetAcc( *this ).isValid()) {
637 return nullptr;
638 }
639 return ( *jetAcc( *this ) );
640 }
641
642
644 if( jetAcc( *this ).isValid() )
645 jetAcc( *this ).reset();
646 jetAcc( *this ).toContainedElement( *cont, jet );
647 }
648
649
650
654 vertexLink,
655 setVertexLink )
656
657 static const SG::Accessor< TauJet_v3::VertexLink_t > vertexAcc( "vertexLink" );
658
659 const Vertex* TauJet_v3::vertex() const {
660 if ( !vertexAcc(*this).isValid() ) {
661 return nullptr;
662 }
663 return ( *vertexAcc( *this ) );
664 }
665
666
668 if( vertexAcc( *this ).isValid() )
669 vertexAcc( *this ).reset();
670 vertexAcc( *this ).toContainedElement( *cont, vertex );
671 }
672
673
674
678 secondaryVertexLink,
679 setSecondaryVertexLink )
680
681 static const SG::Accessor< TauJet_v3::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" );
682
683 const Vertex* TauJet_v3::secondaryVertex() const {
684 if (secondaryVertexAcc.isAvailable(*this) == false) {
685 return nullptr;
686 }
687 const VertexLink_t& link = secondaryVertexAcc(*this);
688 if (link.isValid() == false) {
689 return nullptr;
690 }
691 return *link;
692 }
693
694
696 if( secondaryVertexAcc( *this ).isValid() )
697 secondaryVertexAcc( *this ).reset();
698 secondaryVertexAcc( *this ).toContainedElement( *cont, vertex );
699 }
700
701
702
703
705 // setters and getters for the hadronic PFO links
708 hadronicPFOLinks,
709 setHadronicPFOLinks )
710
711
712
713 static const SG::Accessor< TauJet_v3::PFOLinks_t > hadronicPFOAcc( "hadronicPFOLinks" );
714
715 const PFO* TauJet_v3::hadronicPFO( size_t i ) const {
716 return ( *hadronicPFOAcc( *this )[ i ] );
717 }
718
720 return hadronicPFOAcc( *this ).size();
721 }
722
724
725 hadronicPFOAcc( *this ).push_back( pfo );
726 return;
727 }
728
730 hadronicPFOAcc( *this ).clear();
731 return;
732 }
733
734 // setters and getters for the shot PFO links
737 shotPFOLinks,
738 setShotPFOLinks )
739
740
741
742 static const SG::Accessor< TauJet_v3::PFOLinks_t > shotPFOAcc( "shotPFOLinks" );
743
744 const PFO* TauJet_v3::shotPFO( size_t i ) const {
745 return ( *shotPFOAcc( *this )[ i ] );
746 }
747
748 size_t TauJet_v3::nShotPFOs() const {
749 return shotPFOAcc( *this ).size();
750 }
751
753
754 shotPFOAcc( *this ).push_back( pfo );
755 return;
756 }
757
759 shotPFOAcc( *this ).clear();
760 return;
761 }
762
763
764 // setters and getters for the charged PFO links
767 chargedPFOLinks,
768 setChargedPFOLinks )
769
770
771
772 static const SG::Accessor< TauJet_v3::PFOLinks_t > chargedPFOAcc( "chargedPFOLinks" );
773
774 const PFO* TauJet_v3::chargedPFO( size_t i ) const {
775 return ( *chargedPFOAcc( *this )[ i ] );
776 }
777
778 size_t TauJet_v3::nChargedPFOs() const {
779 return chargedPFOAcc( *this ).size();
780 }
781
783
784 chargedPFOAcc( *this ).push_back( pfo );
785 return;
786 }
787
789 chargedPFOAcc( *this ).clear();
790 return;
791 }
792
793
794
795 // setters and getters for the neutral PFO links
798 neutralPFOLinks,
799 setNeutralPFOLinks )
800
801
802
803 static const SG::Accessor< TauJet_v3::PFOLinks_t > neutralPFOAcc( "neutralPFOLinks" );
804
805 const PFO* TauJet_v3::neutralPFO( size_t i ) const {
806 return ( *neutralPFOAcc( *this )[ i ] );
807 }
808
809 size_t TauJet_v3::nNeutralPFOs() const {
810 return neutralPFOAcc( *this ).size();
811 }
812
814
815 neutralPFOAcc( *this ).push_back( pfo );
816 return;
817 }
818
820 neutralPFOAcc( *this ).clear();
821 return;
822 }
823
824
825
826 // setters and getters for the pi0 PFO links
829 pi0PFOLinks,
830 setPi0PFOLinks )
831
832
833
834 static const SG::Accessor< TauJet_v3::PFOLinks_t > pi0PFOAcc( "pi0PFOLinks" );
835
836 const PFO* TauJet_v3::pi0PFO( size_t i ) const {
837 return ( *pi0PFOAcc( *this )[ i ] );
838 }
839
840 size_t TauJet_v3::nPi0PFOs() const {
841 return pi0PFOAcc( *this ).size();
842 }
843
845
846 pi0PFOAcc( *this ).push_back( pfo );
847 return;
848 }
849
851 pi0PFOAcc( *this ).clear();
852 return;
853 }
854
855
856
857
858
860 // setters and getters for the cellbased_charged PFO links
863 protoChargedPFOLinks,
864 setProtoChargedPFOLinks )
865
866
867
868 static const SG::Accessor< TauJet_v3::PFOLinks_t > protoChargedPFOAcc( "protoChargedPFOLinks" );
869
870 const PFO* TauJet_v3::protoChargedPFO( size_t i ) const {
871 return ( *protoChargedPFOAcc( *this )[ i ] );
872 }
873
875 return protoChargedPFOAcc( *this ).size();
876 }
877
879
880 protoChargedPFOAcc( *this ).push_back( pfo );
881 return;
882 }
883
885 protoChargedPFOAcc( *this ).clear();
886 return;
887 }
888
889
890 // setters and getters for the cellbased_neutral PFO links
893 protoNeutralPFOLinks,
894 setProtoNeutralPFOLinks )
895
896
897
898 static const SG::Accessor< TauJet_v3::PFOLinks_t > protoNeutralPFOAcc( "protoNeutralPFOLinks" );
899
900 const PFO* TauJet_v3::protoNeutralPFO( size_t i ) const {
901 return ( *protoNeutralPFOAcc( *this )[ i ] );
902 }
903
905 return protoNeutralPFOAcc( *this ).size();
906 }
907
909
910 protoNeutralPFOAcc( *this ).push_back( pfo );
911 return;
912 }
913
915 protoNeutralPFOAcc( *this ).clear();
916 return;
917 }
918
919
920
921 // setters and getters for the cellbased_pi0 PFO links
924 protoPi0PFOLinks,
925 setProtoPi0PFOLinks )
926
927
928
929 static const SG::Accessor< TauJet_v3::PFOLinks_t > protoPi0PFOAcc( "protoPi0PFOLinks" );
930
931 const PFO* TauJet_v3::protoPi0PFO( size_t i ) const {
932 return ( *protoPi0PFOAcc( *this )[ i ] );
933 }
934
936 return protoPi0PFOAcc( *this ).size();
937 }
938
940
941 protoPi0PFOAcc( *this ).push_back( pfo );
942 return;
943 }
944
946 protoPi0PFOAcc( *this ).clear();
947 return;
948 }
949
950
951
952
953 void TauJet_v3::dump() const {
954 /* keep these two lines to create the template methods. Otherwise they are optimzed away
955 * later: move these two lines into a dummy method, which nobody is calling
956 */
957 std::cout << this->detail<float>(xAOD::TauJetParameters::ipSigLeadTrk) << std::endl;
958 std::cout << this->detail<int>(xAOD::TauJetParameters::numTopoClusters) << std::endl;
959 }
960
961} // namespace xAOD
962
Scalar eta() const
pseudorapidity method
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
Macro creating a getter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
Evaluate cluster kinematics with a different vertex / signal state.
unsigned int uint
const T * at(size_type n) const
Access an element, as an rvalue.
Helper class to provide type-safe access to aux data.
State
enum of possible signal states.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Class providing the definition of the 4-vector interface.
IParticle()=default
TLorentzVector FourMom_t
Definition of the 4-momentum type.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
void reset()
Function making sure that the object is ready for persistification.
Definition Jet_v1.cxx:231
Class describing a tau jet.
Definition TauJet_v3.h:41
void clearHadronicPFOLinks()
Remove all hadronic PFOs from the tau.
virtual double phi() const
The azimuthal angle ( ) of the particle.
size_t nPi0s() const
double etaTauEtaCalib() const
size_t nNeutralPFOs() const
Get the number of neutral PFO particles associated with this tau.
double phiPanTauCellBasedProto() const
double etaFinalCalib() const
double phiJetSeed() const
size_t nProtoPi0PFOs() const
Get the number of cellbased_pi0 PFO particles associated with this tau.
double ptTauEnergyScale() const
const PFO * hadronicPFO(size_t i) const
Get the pointer to a given hadronic PFO associated with this tau.
double mJetSeed() const
void setPanTauDetail(TauJetParameters::PanTauDetails panTauDetail, int value)
double ptPanTauCellBased() const
std::vector< xAOD::CaloVertexedTopoCluster > vertexedClusters() const
const PFO * pi0PFO(size_t i) const
Get the pointer to a given pi0 PFO associated with this tau.
double etaTauEnergyScale() const
double ptPanTauCellBasedProto() const
void clearPi0PFOLinks()
Remove all pi0 PFOs from the tau.
void clearTauTrackLinks()
Remove all tracks from the tau.
bool hasDiscriminant(TauJetParameters::TauID discID) const
Check if class contains requested discriminant.
const PFO * protoChargedPFO(size_t i) const
Get the pointer to a given cellbased_charged PFO associated with this tau.
const IParticle * pi0(size_t i) const
Get the pointer to a given pi0 associated with this tau.
double mTauEnergyScale() const
double ptDetectorAxis() const
TauTrackLinks_t & allTauTrackLinksNonConst()
In order to sort track links.
void addProtoPi0PFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_pi0 PFO to the tau
size_t nShotPFOs() const
Get the number of shot PFO particles associated with this tau.
const PFO * protoPi0PFO(size_t i) const
Get the pointer to a given cellbased_pi0 PFO associated with this tau.
double mFinalCalib() const
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition TauJet_v3.cxx:96
virtual double pt() const
The transverse momentum ( ) of the particle.
double phiFinalCalib() const
void clearPi0Links()
Remove all pi0s from the tau.
virtual double e() const
The total energy of the particle.
Definition TauJet_v3.cxx:87
double phiDetectorAxis() const
size_t nProtoChargedPFOs() const
Get the number of cellbased_charged PFO particles associated with this tau.
double etaDetectorAxis() const
std::vector< const TauTrack * > tracksWithMask(unsigned int mask) const
Get the v<const pointer> to a given tauTrack collection associated with this tau.
void dump() const
void addNeutralPFOLink(const ElementLink< PFOContainer > &pfo)
add a neutral PFO to the tau
const PFO * shotPFO(size_t i) const
Get the pointer to a given shot PFO associated with this tau.
double ptTauEtaCalib() const
void setAllTauTrackLinks(const TauTrackLinks_t &tauTracks)
double ptIntermediateAxis() const
virtual double rapidity() const
The true rapidity (y) of the particle.
Definition TauJet_v3.cxx:92
ElementLink< xAOD::JetContainer > JetLink_t
Definition TauJet_v3.h:197
std::vector< ElementLink< xAOD::PFOContainer > > PFOLinks_t
Definition TauJet_v3.h:325
size_t nPi0PFOs() const
Get the number of pi0 PFO particles associated with this tau.
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : internal taus type.
void addProtoChargedPFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_charged PFO to the tau
void clearClusterLinks()
Remove all clusters from the tau.
void setJet(const xAOD::JetContainer *cont, const xAOD::Jet *jet)
const TauTrackLinks_t tauTrackLinksWithMask(unsigned int) const
void clearChargedPFOLinks()
Remove all charged PFOs from the tau.
size_t nClusters() const
const PFO * chargedPFO(size_t i) const
Get the pointer to a given charged PFO associated with this tau.
const TauTrack * trackWithMask(size_t i, unsigned int mask, int *container_index=0) const
bool detail(TauJetParameters::Detail detail, int &value) const
Get and set values of common details variables via enum.
ElementLink< xAOD::VertexContainer > VertexLink_t
Definition TauJet_v3.h:209
std::vector< ElementLink< xAOD::IParticleContainer > > IParticleLinks_t
Definition TauJet_v3.h:273
size_t nHadronicPFOs() const
Get the number of hadronic PFO particles associated with this tau.
double phiTrigCaloOnly() const
TauJet_v3()
Default constructor.
Definition TauJet_v3.cxx:21
size_t nChargedPFOs() const
Get the number of charged PFO particles associated with this tau.
void clearShotPFOLinks()
Remove all shot PFOs from the tau.
const TauTrack * track(size_t i, TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged, int *container_index=0) const
Get the pointer to a given tauTrack associated with this tau /*container index needed by trackNonCons...
double etaTrigCaloOnly() const
double phiTauEtaCalib() const
std::vector< ElementLink< xAOD::TauTrackContainer > > TauTrackLinks_t
Definition TauJet_v3.h:232
void addPi0Link(const ElementLink< IParticleContainer > &tr)
add a pi0 link to the tau
void setDiscriminant(TauJetParameters::TauID discID, double disc)
Set value of discriminant.
void addChargedPFOLink(const ElementLink< PFOContainer > &pfo)
add a charged PFO to the tau
void setDetail(TauJetParameters::Detail detail, int value)
void clearProtoChargedPFOLinks()
Remove all cellbased_charged PFOs from the tau.
FourMom_t calibratedCluster(size_t i, xAOD::CaloCluster::State state=xAOD::CaloCluster::State::CALIBRATED) const
Get TLV to a given cluster in calibrated state.
double etaPanTauCellBasedProto() const
void setVertex(const xAOD::VertexContainer *cont, const xAOD::Vertex *vertex)
const Vertex * vertex() const
TauTrack * trackNonConst(size_t i, TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged)
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
const IParticle * cluster(size_t i) const
Get the pointer to a given cluster associated with this tau.
std::vector< const IParticle * > clusters() const
double mDetectorAxis() const
void addPi0PFOLink(const ElementLink< PFOContainer > &pfo)
add a pi0 PFO to the tau
void clearProtoPi0PFOLinks()
Remove all cellbased_pi0 PFOs from the tau.
double ptJetSeed() const
double ptTrigCaloOnly() const
double ptFinalCalib() const
void clearNeutralPFOLinks()
Remove all neutral PFOs from the tau.
void setIsTau(TauJetParameters::IsTauFlag flag, bool value)
Set Flag for tau acceptance based on predefined arbitrary criteria.
size_t nTracksIsolation() const
double discriminant(TauJetParameters::TauID discID) const
Get value of discriminant.
virtual double m() const
The invariant mass of the particle.
size_t nTracksWithMask(unsigned int classification) const
void setSecondaryVertex(const xAOD::VertexContainer *cont, const xAOD::Vertex *vertex)
size_t nAllTracks() const
double mIntermediateAxis() const
double mPanTauCellBased() const
size_t nTracksCharged() const
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
double etaJetSeed() const
bool isTau(TauJetParameters::IsTauFlag flag) const
Get Flag for tau acceptance based on predefined arbitrary criteria.
void clearProtoNeutralPFOLinks()
Remove all cellbased_neutral PFOs from the tau.
const Jet * jet() const
double phiTauEnergyScale() const
void addShotPFOLink(const ElementLink< PFOContainer > &pfo)
add a shot PFO to the tau
double etaPanTauCellBased() const
const TauTrackLinks_t tauTrackLinks(TauJetParameters::TauTrackFlag=TauJetParameters::TauTrackFlag::classifiedCharged) const
const PFO * protoNeutralPFO(size_t i) const
Get the pointer to a given cellbased_neutral PFO associated with this tau.
void addHadronicPFOLink(const ElementLink< PFOContainer > &pfo)
add a hadronic PFO to the tau
size_t nProtoNeutralPFOs() const
Get the number of cellbased_neutral PFO particles associated with this tau.
std::vector< const TauTrack * > allTracks() const
Get the v<const pointer> to all tracks associated with this tau, regardless of classification.
const TauTrackLinks_t & allTauTrackLinks() const
double etaIntermediateAxis() const
void addClusterLink(const ElementLink< IParticleContainer > &tr)
add a cluster link to the tau
const Vertex * secondaryVertex() const
void addProtoNeutralPFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_neutral PFO to the tau
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for taus.
Definition TauJet_v3.h:69
double mTauEtaCalib() const
void addTauTrackLink(const ElementLink< TauTrackContainer > &tr)
add a TauTrack to the tau
const PFO * neutralPFO(size_t i) const
Get the pointer to a given neutral PFO associated with this tau.
virtual double eta() const
The pseudorapidity ( ) of the particle.
double phiIntermediateAxis() const
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
double phiPanTauCellBased() const
double mPanTauCellBasedProto() const
std::vector< const TauTrack * > tracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Get the v<const pointer> to a given tauTrack collection associated with this tau.
double mTrigCaloOnly() const
uint16_t TrackFlagType
Definition TauTrack_v1.h:61
bool flagWithMask(unsigned int) const
TauTrackFlag
Enum for tau track flags.
Definition TauDefs.h:400
TauCalibType
Enum for tau calib type.
Definition TauDefs.h:335
Detail
Enum for tau parameters - used mainly for backward compatibility with the analysis code.
Definition TauDefs.h:156
@ numTopoClusters
get number of topocluster constituents of jet associated to tau candidate
Definition TauDefs.h:173
PanTauDetails
Enum for tau details (scalar) calculated by pantau.
Definition TauDefs.h:355
TauID
Enum for discriminants.
Definition TauDefs.h:46
IsTauFlag
Enum for IsTau flags.
Definition TauDefs.h:116
const SG::Accessor< float > * discriminantAccessorV3(xAOD::TauJetParameters::TauID discriminant)
Helper function for managing accessors to id input and output variables defined as enums in TauDefs....
const SG::Accessor< float > * detailsAccessorV3< float >(xAOD::TauJetParameters::Detail detail)
const SG::Accessor< float > * panTauDetailsAccessorV3< float >(xAOD::TauJetParameters::PanTauDetails detail)
const SG::Accessor< T > * detailsAccessorV3(xAOD::TauJetParameters::Detail detail)
const SG::Accessor< int > * panTauDetailsAccessorV3< int >(xAOD::TauJetParameters::PanTauDetails detail)
const SG::Accessor< int > * detailsAccessorV3< int >(xAOD::TauJetParameters::Detail detail)
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Jet_v1 Jet
Definition of the current "jet version".
setRcore setEtHad setFside pt
static const SG::Accessor< std::vector< xAOD::CaloVertexedTopoCluster > > vertexedClustersAcc("VertexedClusters")
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
static const SG::Accessor< TauJet_v3::TauTrackLinks_t > tauTrackAcc("tauTrackLinks")
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TauTrack_v1 TauTrack
Definition of the current version.
Definition TauTrack.h:16
TauTrackContainer_v1 TauTrackContainer
Definition of the current TauTrack container version.
setBGCode setTAP setLVL2ErrorBits bool
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
bool getValue(TauJetParameters::TauCalibType type, std::string &stringName)