ATLAS Offline Software
Loading...
Searching...
No Matches
BeamBackgroundFiller Class Reference

Implementation of the Beam Background Identification Method. More...

#include <BeamBackgroundFiller.h>

Inheritance diagram for BeamBackgroundFiller:
Collaboration diagram for BeamBackgroundFiller:

Classes

struct  Cache

Public Member Functions

 BeamBackgroundFiller (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~BeamBackgroundFiller ()=default
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void FillMatchMatrix (const EventContext &ctx, Cache &cache) const
 This function selects the muon segments with the direction parallel to the beam pipe and calorimeter clusters above certain energy threshold.
void SegmentMethod (Cache &cache) const
 This function looks at the segments found by the FillMatchMatrix function.
void OneSidedMethod (Cache &cache) const
 This function is the implementation of the "No-Time Method" and the "One-Sided Method".
void TwoSidedMethod (Cache &cache) const
 This function is the implementation of the "Two-Sided No-Time Method" and the "Two-Sided Method" that looks at the clusters matched with at least one muon segment on side A and one muon segment on side C.
void ClusterShapeMethod (Cache &cache) const
 This function is the implementation of the "Cluster-Shape Method".
double GetSegmentTime (const Muon::MuonSegment &pMuonSegment) const
void FindFakeJets (const EventContext &ctx, Cache &cache) const
 This function checks whether the matched clusters are contained in any jets.
void FillBeamBackgroundData (SG::WriteHandle< BeamBackgroundData > &beamBackgroundDataWriteHandle, Cache &cache) const
 This function stores all the results in BeamBackgroundData.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKeyArray< Trk::SegmentCollectionm_segmentKeys
 ReadHandleKey for Trk::SegmentCollection from CSC.
SG::ReadHandleKey< xAOD::CaloClusterContainerm_caloClusterContainerReadHandleKey
 ReadHandleKey for CaloClusterContainer.
SG::ReadHandleKey< xAOD::JetContainerm_jetContainerReadHandleKey
 ReadHandleKey for JetContainer.
SG::WriteHandleKey< BeamBackgroundDatam_beamBackgroundDataWriteHandleKey
ToolHandle< Muon::IMuonSegmentSelectionToolm_segmentSelector {this, "SegmentSelector",""}
Gaudi::Property< double > m_thetaCutNCB {this, "cutThetaNCB", 5. * Gaudi::Units::deg}
 Inclanation cut between the segment position and its direction.
Gaudi::Property< double > m_cutDphiSegAC {this,"cutPhi", 4.* Gaudi::Units::deg}
Gaudi::Property< double > m_clusEnergyCut {this,"clustEnergy", 10. *Gaudi::Units::GeV}
 Minimum cut on the cluster energy to be considered.
Gaudi::Property< double > m_clusRadiusLow {this, "cutRadiusLow", 881. * Gaudi::Units::mm}
Gaudi::Property< double > m_clusRadiusHigh {this,"cutRadiusHigh", 4250. * Gaudi::Units::mm}
Gaudi::Property< double > m_cutDphiClusSeg {this, "cutDphiClusSeg", 4.* Gaudi::Units::deg}
Gaudi::Property< double > m_cutDradClusSeg {this,"cutDrClusSet", 40. * Gaudi::Units::cm}
Gaudi::Property< double > m_cutMuonTime {this, "cutMuonTime", 25.}
Gaudi::Property< double > m_cutClusTime {this,"cutClusTime", 2.5}
Gaudi::Property< double > m_cutTimeDiffAC {this,"cutTimeDiffAC", 25.}
Gaudi::Property< double > m_cutDrdz {this,"cutDrdz", 0.15}
ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Implementation of the Beam Background Identification Method.

This implementation defines the selection criteria for identifying beam background muons, and looks for them based on several methods. The result are stored in BeamBackgroundData.

Author
David Salek David.nosp@m..Sal.nosp@m.ek@ce.nosp@m.rn.c.nosp@m.h
Revision
693115
Date
2015-09-04 09:22:39 +0200 (Fri, 04 Sep 2015)

Definition at line 38 of file BeamBackgroundFiller.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BeamBackgroundFiller()

BeamBackgroundFiller::BeamBackgroundFiller ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 31 of file BeamBackgroundFiller.cxx.

33 : AthReentrantAlgorithm(name, pSvcLocator) {
34}

◆ ~BeamBackgroundFiller()

virtual BeamBackgroundFiller::~BeamBackgroundFiller ( )
virtualdefault

Member Function Documentation

◆ ClusterShapeMethod()

void BeamBackgroundFiller::ClusterShapeMethod ( Cache & cache) const
private

This function is the implementation of the "Cluster-Shape Method".

The shape of the cluster is described by the variable dr/dz which is the ratio of the standard deviation of the radial position of the contianed cells and the standard deviation of the z-position of the contained cells. Only the clusters matched with muon segments are checked.

Definition at line 575 of file BeamBackgroundFiller.cxx.

575 {
576 cache.m_numClusterShape = 0;
577 cache.m_drdzClus.clear();
578
579 for (unsigned int clusIndex = 0; clusIndex < cache.m_indexClus.size();
580 clusIndex++) {
581
582 const xAOD::CaloCluster* clus = *(cache.m_indexClus[clusIndex]);
583
584 double rClus(0.);
586 rClus = 0;
587 rClus = rClus / cosh(clus->eta());
588 double zClus = rClus * sinh(clus->eta());
589
590 // calculate dr/dz
591 double dr = 0.;
592 double dz = 0.;
593 double drdz = -1.;
594 int nCell = 0;
595
596 if (clus->getCellLinks() != nullptr) {
599
600 for (; firstCell != lastCell; ++firstCell) {
601 const CaloCell* cell = *firstCell;
602
603 if (cell->time() == 0.)
604 continue;
605 if (cell->energy() < 100.)
606 continue;
607 nCell++;
608
609 // double rCell = sqrt(cell->x()*cell->x() + cell->y()*cell->y());
610 // double zCell = cell->z();
611 const CaloDetDescrElement* dde = cell->caloDDE();
612 const double rCell = dde->r();
613 const double zCell = dde->z();
614 dr = dr + (rCell - rClus) * (rCell - rClus);
615 dz = dz + (zCell - zClus) * (zCell - zClus);
616 }
617 }
618
619 if (nCell) {
620 dr = sqrt(dr / nCell);
621 dz = sqrt(dz / nCell);
622 if (dz > 0.)
623 drdz = dr / dz;
624 }
625
626 cache.m_drdzClus.push_back(drdz);
627
628 // check dr/dz
629 if (drdz < 0.)
630 continue;
631 if (drdz < m_cutDrdz) {
632 for (unsigned int segIndex = 0; segIndex < cache.m_indexSeg.size();
633 segIndex++) {
634 if (!(cache.m_matchMatrix[clusIndex][segIndex] & 1))
635 continue;
636 cache.m_matchMatrix[clusIndex][segIndex] =
637 cache.m_matchMatrix[clusIndex][segIndex] |
639 cache.m_resultSeg[segIndex] = cache.m_resultSeg[segIndex] |
640 cache.m_matchMatrix[clusIndex][segIndex];
641 }
642 cache.m_resultClus[clusIndex] =
643 cache.m_resultClus[clusIndex] | BeamBackgroundData::ClusterShape;
644 cache.m_numClusterShape++;
645 }
646 }
647}
Gaudi::Property< double > m_cutDrdz
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
virtual double eta() const
The pseudorapidity ( ) of the particle.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
const_cell_iterator cell_end() const
@ CENTER_MAG
Cluster Centroid ( ).
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version).
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode BeamBackgroundFiller::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 51 of file BeamBackgroundFiller.cxx.

51 {
52
53 Cache cache{};
54 // find muon segments from beam background muon candidates and match them with
55 // calorimeter clusters
56 FillMatchMatrix(ctx, cache);
57 // apply Beam Background Identifiaction Methods
58 SegmentMethod(cache);
59 OneSidedMethod(cache);
60 TwoSidedMethod(cache);
61 ClusterShapeMethod(cache);
62 // identify fake jets
63 FindFakeJets(ctx, cache);
64
65 // fill the results into BeamBackgroundData
66 SG::WriteHandle<BeamBackgroundData> writeHandle(m_beamBackgroundDataWriteHandleKey, ctx);
67 ATH_CHECK(writeHandle.record(std::make_unique<BeamBackgroundData>()));
68 FillBeamBackgroundData(writeHandle, cache);
69
70 return StatusCode::SUCCESS;
71}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::WriteHandleKey< BeamBackgroundData > m_beamBackgroundDataWriteHandleKey
void SegmentMethod(Cache &cache) const
This function looks at the segments found by the FillMatchMatrix function.
void FindFakeJets(const EventContext &ctx, Cache &cache) const
This function checks whether the matched clusters are contained in any jets.
void ClusterShapeMethod(Cache &cache) const
This function is the implementation of the "Cluster-Shape Method".
void FillBeamBackgroundData(SG::WriteHandle< BeamBackgroundData > &beamBackgroundDataWriteHandle, Cache &cache) const
This function stores all the results in BeamBackgroundData.
void FillMatchMatrix(const EventContext &ctx, Cache &cache) const
This function selects the muon segments with the direction parallel to the beam pipe and calorimeter ...
void OneSidedMethod(Cache &cache) const
This function is the implementation of the "No-Time Method" and the "One-Sided Method".
void TwoSidedMethod(Cache &cache) const
This function is the implementation of the "Two-Sided No-Time Method" and the "Two-Sided Method" that...

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ FillBeamBackgroundData()

void BeamBackgroundFiller::FillBeamBackgroundData ( SG::WriteHandle< BeamBackgroundData > & beamBackgroundDataWriteHandle,
Cache & cache ) const
private

This function stores all the results in BeamBackgroundData.

Definition at line 714 of file BeamBackgroundFiller.cxx.

716 {
717
718 writeHandle->SetNumSegment(cache.m_numSegment);
719 writeHandle->SetNumSegmentEarly(cache.m_numSegmentEarly);
720 writeHandle->SetNumSegmentACNoTime(cache.m_numSegmentACNoTime);
721 writeHandle->SetNumSegmentAC(cache.m_numSegmentAC);
722 writeHandle->SetNumMatched(cache.m_numMatched);
723 writeHandle->SetNumNoTimeLoose(cache.m_numNoTimeLoose);
724 writeHandle->SetNumNoTimeMedium(cache.m_numNoTimeMedium);
725 writeHandle->SetNumNoTimeTight(cache.m_numNoTimeTight);
726 writeHandle->SetNumOneSidedLoose(cache.m_numOneSidedLoose);
727 writeHandle->SetNumOneSidedMedium(cache.m_numOneSidedMedium);
728 writeHandle->SetNumOneSidedTight(cache.m_numOneSidedTight);
729 writeHandle->SetNumTwoSidedNoTime(cache.m_numTwoSidedNoTime);
730 writeHandle->SetNumTwoSided(cache.m_numTwoSided);
731 writeHandle->SetNumClusterShape(cache.m_numClusterShape);
732 writeHandle->SetNumJet(cache.m_numJet);
733
734 int decision = 0;
735 for (unsigned int i = 0; i < cache.m_indexSeg.size(); i++) {
736 decision |= cache.m_resultSeg[i];
737 }
738 for (unsigned int i = 0; i < cache.m_indexClus.size(); i++) {
739 decision |= cache.m_resultClus[i];
740 }
741 writeHandle->SetDecision(decision);
742
743 writeHandle->SetDirection(cache.m_direction);
744
745 writeHandle->FillIndexSeg(cache.m_indexSeg);
746 writeHandle->FillResultSeg(&cache.m_resultSeg);
747 writeHandle->FillIndexClus(cache.m_indexClus);
748 writeHandle->FillMatchMatrix(&cache.m_matchMatrix);
749
750 writeHandle->FillResultClus(&cache.m_resultClus);
751 writeHandle->FillIndexJet(cache.m_indexJet);
752 writeHandle->FillDrdzClus(&cache.m_drdzClus);
753
754 writeHandle->FillIndexJet(cache.m_indexJet);
755 writeHandle->FillResultJet(&cache.m_resultJet);
756
757 ATH_MSG_DEBUG("parallel segments "
758 << cache.m_numSegment << " " << cache.m_numSegmentEarly << " "
759 << cache.m_numSegmentACNoTime << " " << cache.m_numSegmentAC);
760
761 ATH_MSG_DEBUG("matched clusters "
762 << cache.m_numMatched << " " << cache.m_numNoTimeLoose << " "
763 << cache.m_numNoTimeMedium << " " << cache.m_numNoTimeTight
764 << " " << cache.m_numOneSidedLoose << " "
765 << cache.m_numOneSidedMedium << " " << cache.m_numOneSidedTight
766 << " " << cache.m_numTwoSidedNoTime << " "
767 << cache.m_numTwoSided << " " << cache.m_numClusterShape);
768}
#define ATH_MSG_DEBUG(x,...)

◆ FillMatchMatrix()

void BeamBackgroundFiller::FillMatchMatrix ( const EventContext & ctx,
Cache & cache ) const
private

This function selects the muon segments with the direction parallel to the beam pipe and calorimeter clusters above certain energy threshold.

Matching matrix is created to store the results of beam background identification for each cluster and segment

Select only the segements from the EI station

match in phi

Definition at line 80 of file BeamBackgroundFiller.cxx.

81 {
82 //
83
84 for (const SG::ReadHandleKey<Trk::SegmentCollection>& key : m_segmentKeys) {
85 // select only the CSC segments with the global direction parallel to the
86 // beam pipe
87 SG::ReadHandle<Trk::SegmentCollection> ncbSegmentHandle(key, ctx);
88 if(!ncbSegmentHandle.isPresent()) {
89 throw std::runtime_error("Could not load the " + key.key() + " segment container");
90 }
91 unsigned int ncbCounter = 0;
92 for (const Trk::Segment *ncbSegment : *ncbSegmentHandle) {
93 ++ncbCounter;
94 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(ncbSegment);
95
96 const Identifier id = m_edmHelperSvc->chamberId(*seg);
97 if (!id.is_valid()|| !m_idHelperSvc->isMuon(id)) {
98 ATH_MSG_WARNING("Found a muon segment in the container which pretends not to be a muon segment..");
99 continue;
100 }
101 Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
103 if (stIndex != Muon::MuonStationIndex::StIndex::EI) {
104 ATH_MSG_VERBOSE("Segment "<<m_idHelperSvc->toStringChamber(id)<<" is not in EI");
105 continue;
106 }
107 const Amg::Vector3D& globalDir = seg->globalDirection();
108 if (std::abs(globalDir.theta()) < m_thetaCutNCB) {
109 continue;
110 }
111 constexpr int highestSegQual = 3;
112 if (!m_segmentSelector->select(*seg,false, highestSegQual)) {
113 continue;
114 }
115 ElementLink<Trk::SegmentCollection> segLink{*ncbSegmentHandle, ncbCounter - 1};
116 cache.m_indexSeg.push_back(segLink);
117 }
118 }
119
120 cache.m_resultSeg.assign(cache.m_indexSeg.size(), 0);
121
122 // find matching clusters
123 SG::ReadHandle<xAOD::CaloClusterContainer> caloClusterContainerReadHandle(m_caloClusterContainerReadHandleKey,ctx);
124 if (!caloClusterContainerReadHandle.isPresent()){
125 throw std::runtime_error("Failed to load the calorimeter cluster container");
126 }
127 ATH_MSG_DEBUG(m_caloClusterContainerReadHandleKey<< " retrieved from StoreGate");
128
129 constexpr std::array<CaloSampling::CaloSample, 24> caloLayers{CaloSampling::CaloSample::PreSamplerB,
130 CaloSampling::CaloSample::EMB1, CaloSampling::CaloSample::EMB2, CaloSampling::CaloSample::EMB3,
131 CaloSampling::CaloSample::PreSamplerE,
132 CaloSampling::CaloSample::EME1, CaloSampling::CaloSample::EME2, CaloSampling::CaloSample::EME3,
133 CaloSampling::CaloSample::FCAL0,
134
135 CaloSampling::CaloSample::HEC0, CaloSampling::CaloSample::HEC1, CaloSampling::CaloSample::HEC2, CaloSampling::CaloSample::HEC3,
136
137 CaloSampling::CaloSample::TileBar0, CaloSampling::CaloSample::TileBar1, CaloSampling::CaloSample::TileBar2,
138 CaloSampling::CaloSample::TileGap1, CaloSampling::CaloSample::TileGap2, CaloSampling::CaloSample::TileGap3,
139 CaloSampling::CaloSample::TileExt0, CaloSampling::CaloSample::TileExt1, CaloSampling::CaloSample::TileExt2, CaloSampling::CaloSample::FCAL1,
140 CaloSampling::CaloSample::FCAL2};
141
142 unsigned int caloClusterCounter = 0;
143 for (const xAOD::CaloCluster* thisCaloCluster : *caloClusterContainerReadHandle) {
144 ++caloClusterCounter;
145 double eClus{0.};
146 for (auto lay : caloLayers){
147 eClus +=thisCaloCluster->eSample(lay);
148 }
149 // ignore low energy clusters
150 if (eClus < m_clusEnergyCut){
151 ATH_MSG_VERBOSE("Cluster with energy "<<eClus<<" is below threshold "<<m_clusEnergyCut);
152 continue;
153 }
154 double rClus{0.};
155 if (!thisCaloCluster->retrieveMoment(xAOD::CaloCluster_v1::CENTER_MAG, rClus)) {
156 ATH_MSG_DEBUG("Failed to retrieve the CENTER_MAG moment");
157 continue;
158 }
159 rClus = rClus / std::cosh(thisCaloCluster->eta());
160
161 // remove clusters at low radius (outside the CSC acceptance)
162 if (rClus < m_clusRadiusLow || rClus > m_clusRadiusHigh) {
163 ATH_MSG_VERBOSE("Radius cut not passed "<<rClus<<" needs to be in "
165 continue;
166 }
167 const double phiClus = thisCaloCluster->phi();
168
169
170 std::vector<int> matchedSegmentsPerCluster(cache.m_indexSeg.size(), 0);
171 bool matched{false};
172
173 for (unsigned int j = 0; j < cache.m_indexSeg.size(); j++) {
174 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[j]));
175
176 const Amg::Vector3D& globalPos = seg->globalPosition();
177 const double phiSeg = globalPos.phi();
178
180 if (P4Helpers::deltaPhi(phiClus, phiSeg) < std::abs(m_cutDphiClusSeg)) {
181 ATH_MSG_VERBOSE("Delta phi "<<P4Helpers::deltaPhi(phiClus, phiSeg)
182 <<" exceeds maximum cut "<<m_cutDphiClusSeg
183 <<"Segment: "<<Amg::toString(globalPos)<<", phi: "<<globalPos.phi()
184 <<" --- Cluster: "<<phiClus);
185 continue;
186 }
187
188 const double rSeg = globalPos.perp();
189 // match in radius
190 if (std::abs(rClus - rSeg) > m_cutDradClusSeg) {
191 ATH_MSG_VERBOSE("Radial difference "<<std::abs(rClus - rSeg)<<" exceeds maximum cut "<<m_cutDradClusSeg
192 <<"Segment: "<<Amg::toString(globalPos)<<", phi: "<<globalPos.perp()
193 <<" --- Cluster: "<<rClus);
194 continue;
195 }
196 matchedSegmentsPerCluster[j] = 1;
197 matched = true;
198 cache.m_resultSeg[j] |= BeamBackgroundData::Matched;
199 }
200
201 if (!matched) {
202 ATH_MSG_VERBOSE("Calo cluster does not match with segment");
203 continue;
204 }
205 ElementLink<xAOD::CaloClusterContainer> clusLink;
206 clusLink.toIndexedElement(*caloClusterContainerReadHandle, caloClusterCounter - 1);
207 cache.m_indexClus.push_back(std::move(clusLink));
208 cache.m_matchMatrix.push_back(std::move(matchedSegmentsPerCluster));
209 ++cache.m_numMatched;
210 }
211
212 cache.m_resultClus.assign(cache.m_indexClus.size(), 1);
213}
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
Gaudi::Property< double > m_thetaCutNCB
Inclanation cut between the segment position and its direction.
Gaudi::Property< double > m_cutDradClusSeg
ToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
SG::ReadHandleKeyArray< Trk::SegmentCollection > m_segmentKeys
ReadHandleKey for Trk::SegmentCollection from CSC.
Gaudi::Property< double > m_clusRadiusLow
Gaudi::Property< double > m_cutDphiClusSeg
Gaudi::Property< double > m_clusEnergyCut
Minimum cut on the cluster energy to be considered.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterContainerReadHandleKey
ReadHandleKey for CaloClusterContainer.
Gaudi::Property< double > m_clusRadiusHigh
virtual const Amg::Vector3D & globalPosition() const override final
global position
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 1 > Vector3D
StIndex
enum to classify the different station layers in the muon spectrometer
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition P4Helpers.h:34
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ FindFakeJets()

void BeamBackgroundFiller::FindFakeJets ( const EventContext & ctx,
Cache & cache ) const
private

This function checks whether the matched clusters are contained in any jets.

If yes, the jet is marked as fake jet and the corresponding result of the Beam Background Identification Method is stored (using the OR condition if more than one cluster is found within one jet)

Definition at line 656 of file BeamBackgroundFiller.cxx.

657 {
658 cache.m_numJet = 0;
659 cache.m_indexJet.clear();
660 cache.m_resultJet.clear();
661
662 // find the jet that contains this cluster
663 SG::ReadHandle<xAOD::JetContainer> jetContainerReadHandle(
665
666 if (!jetContainerReadHandle.isValid()) {
667 ATH_MSG_WARNING("Invalid ReadHandle to JetContainer with name: "
669 } else {
670 ATH_MSG_DEBUG(m_jetContainerReadHandleKey << " retrieved from StoreGate");
671
672 unsigned int jetCounter = 0;
673 for (const auto *thisJet : *jetContainerReadHandle) {
674 bool isFakeJet = false;
675 int resultJet = 0;
676
677 xAOD::JetConstituentVector vec = thisJet->getConstituents();
678 xAOD::JetConstituentVector::iterator constIt = vec.begin();
679 xAOD::JetConstituentVector::iterator constItE = vec.end();
680
681 for (; constIt != constItE; ++constIt) {
682 if (constIt->type() != xAOD::Type::CaloCluster)
683 continue;
684 const xAOD::CaloCluster* jetConst =
685 dynamic_cast<const xAOD::CaloCluster*>(constIt->rawConstituent());
686
687 for (unsigned int clusIndex = 0; clusIndex < cache.m_indexClus.size();
688 clusIndex++) {
689 const xAOD::CaloCluster* clus = *(cache.m_indexClus[clusIndex]);
690
691 if (jetConst == clus) {
692 isFakeJet = true;
693 resultJet = resultJet | cache.m_resultClus[clusIndex];
694 }
695 }
696 }
697
698 if (isFakeJet) {
699 ElementLink<xAOD::JetContainer> jetLink;
700 jetLink.toIndexedElement(*jetContainerReadHandle, jetCounter);
701 cache.m_indexJet.push_back(jetLink);
702 cache.m_resultJet.push_back(resultJet);
703 cache.m_numJet++;
704 }
705 jetCounter++;
706 }
707 }
708}
std::vector< size_t > vec
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerReadHandleKey
ReadHandleKey for JetContainer.
Type::ObjectType type() const
The full 4-momentum of the particle.
const IParticle * rawConstituent() const
Access the real underlying IParticle.
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39

◆ GetSegmentTime()

double BeamBackgroundFiller::GetSegmentTime ( const Muon::MuonSegment & pMuonSegment) const
private

Need to check how to translate the bcid bitmaps into timings

Definition at line 217 of file BeamBackgroundFiller.cxx.

217 {
218 double time{0.};
219 unsigned int nMeas{0};
220 for (const Trk::MeasurementBase* meas : pMuonSegment.containedMeasurements()) {
221 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(meas);
222 if (!rot) {
223 continue;
224 }
225 ++nMeas;
226 const Trk::PrepRawData* prd = rot->prepRawData();
228 const Muon::MMPrepData* mmPrd = static_cast<const Muon::MMPrepData*>(prd);
229 time += mmPrd->time();
230 } else if (prd->type(Trk::PrepRawDataType::sTgcPrepData)) {
231 const Muon::sTgcPrepData* sTgcPrd = static_cast<const Muon::sTgcPrepData*>(prd);
232 time += sTgcPrd->time();
233 } else if (prd->type(Trk::PrepRawDataType::MdtPrepData)) {
234 const Muon::MdtPrepData* mdtPrd = static_cast<const Muon::MdtPrepData*>(prd);
235 constexpr double tdcBinSize = 0.78125; //25/32; exact number: (1000.0/40.079)/32.0
236 time += tdcBinSize * mdtPrd->tdc();
237 } else if (prd->type(Trk::PrepRawDataType::TgcPrepData)) {
239 --nMeas;
240 } else if (prd->type(Trk::PrepRawDataType::CscPrepData)) {
241 const Muon::CscPrepData* cscPrd = static_cast<const Muon::CscPrepData*>(prd);
242 time += cscPrd->time();
243 } else {
244 ATH_MSG_WARNING("You can't have "<<m_idHelperSvc->toString(prd->identify())<<" in a EI segment.");
245 --nMeas;
246 }
247
248 }
249 return time / std::max(nMeas, 1u);
250}
double time() const
Returns the time.
short int time() const
Returns the time (in ns).
Definition MMPrepData.h:222
int tdc() const
Returns the TDC (typically range is 0 to 2500).
short int time() const
Identifier identify() const
return the identifier
virtual bool type(PrepRawDataType type) const
Interface method checking the type.
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
time(flags, cells_name, *args, **kw)

◆ initialize()

StatusCode BeamBackgroundFiller::initialize ( )
overridevirtual

Definition at line 37 of file BeamBackgroundFiller.cxx.

37 {
38 CHECK(m_edmHelperSvc.retrieve());
39 CHECK(m_idHelperSvc.retrieve());
40
41 ATH_CHECK(m_segmentKeys.initialize());
42 ATH_CHECK(m_segmentSelector.retrieve(EnableTool{!m_segmentKeys.empty()}));
45
47 return StatusCode::SUCCESS;
48}
#define CHECK(...)
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ OneSidedMethod()

void BeamBackgroundFiller::OneSidedMethod ( Cache & cache) const
private

This function is the implementation of the "No-Time Method" and the "One-Sided Method".

The "One-Sided Method" compares the time of the calorimeter cluster with the expected time. The expected time is calculated based on the direction of the beam background muon which is reconstructed from the position and time of the muon segment. The "No-Time Method" does not use the time information of the muon segment thus the direction of the beam background muon is not known. Therefore, the cluster time is compared to two expected time values (corresponding to both A->C and C->A directions).

Definition at line 362 of file BeamBackgroundFiller.cxx.

362 {
363 //
364 for (unsigned int clusIndex = 0; clusIndex < cache.m_indexClus.size();
365 clusIndex++) {
366
367 const xAOD::CaloCluster* clus = *(cache.m_indexClus[clusIndex]);
368
369 double rClus(0.);
371 continue;
372 }
373 rClus = rClus / std::cosh(clus->eta());
374 double zClus = rClus * std::sinh(clus->eta());
375 double tClus = clus->time();
376
377 // calculate expected cluster time
378 double expectedClusterTimeAC = -(zClus + std::hypot(rClus, zClus)) * inv_c;
379 double expectedClusterTimeCA = -(-zClus + std::hypot(rClus, zClus)) * inv_c;
380
381 for (unsigned int segIndex = 0; segIndex < cache.m_indexSeg.size(); segIndex++) {
382
383 if (!(cache.m_matchMatrix[clusIndex][segIndex] & BeamBackgroundData::Matched)){
384 continue;
385 }
386 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[segIndex]));
387
388 const Amg::Vector3D& globalPos = seg->globalPosition();
389 double zSeg = globalPos.z();
390
391 double tSeg = GetSegmentTime(*seg);
392
393 // muon segment: in-time (1), early (2), ambiguous (0)
394 int timeStatus = 0;
395 double inTime = -(-std::abs(zSeg) + globalPos.mag()) * inv_c;
396 double early = -(std::abs(zSeg) + globalPos.mag()) * inv_c;
397 if (std::abs(tSeg - inTime) < m_cutMuonTime)
398 timeStatus = 1;
399 if (std::abs(tSeg - early) < m_cutMuonTime)
400 timeStatus = 2;
401
402 // reconstruct beam background direction: A->C (1), C->A (-1)
403 int direction = 0;
404 if ((zSeg > 0 && timeStatus == 2) || (zSeg < 0 && timeStatus == 1))
405 direction = 1;
406 if ((zSeg > 0 && timeStatus == 1) || (zSeg < 0 && timeStatus == 2))
407 direction = -1;
408
409 // check the cluster time without the beam background direction
410 // information
411 if (std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime ||
412 std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime) {
413 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::NoTimeLoose;
414 }
415 if ((std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime) ||
416 (std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime)) {
417 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::NoTimeMedium;
418 }
419 if ((std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2. * m_cutClusTime) ||
420 (std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2. * m_cutClusTime)) {
421 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::NoTimeTight;
422 }
423
424 // check the cluster time with the beam background direction information
425 if (direction == 1) {
426 if (std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime) {
427 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedLoose;
428 }
429 if (std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime) {
430 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedMedium;
431 }
432 if (std::abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2. * m_cutClusTime) {
433 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedTight;
434 }
435 } else if (direction == -1) {
436 if (std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime) {
437 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedLoose;
438 }
439 if (std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime) {
440 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedMedium;
441 }
442 if (std::abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2. * m_cutClusTime) {
443 cache.m_matchMatrix[clusIndex][segIndex] |= BeamBackgroundData::OneSidedTight;
444 }
445 }
446
447 cache.m_resultClus[clusIndex] |= cache.m_matchMatrix[clusIndex][segIndex];
448 cache.m_resultSeg[segIndex] |= cache.m_matchMatrix[clusIndex][segIndex];
449 }
450
451 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::NoTimeLoose)
452 cache.m_numNoTimeLoose++;
453 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::NoTimeMedium)
454 cache.m_numNoTimeMedium++;
455 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::NoTimeTight)
456 cache.m_numNoTimeTight++;
457
458 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::OneSidedLoose)
459 cache.m_numOneSidedLoose++;
460 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::OneSidedMedium)
461 cache.m_numOneSidedMedium++;
462 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::OneSidedTight)
463 cache.m_numOneSidedTight++;
464 }
465}
Gaudi::Property< double > m_cutClusTime
double GetSegmentTime(const Muon::MuonSegment &pMuonSegment) const
Gaudi::Property< double > m_cutMuonTime
flt_t time() const
Access cluster time.
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ SegmentMethod()

void BeamBackgroundFiller::SegmentMethod ( Cache & cache) const
private

This function looks at the segments found by the FillMatchMatrix function.

The following results are set:

  • number of segments with the direciton parallel to the beam pipe (all the segments in the matching matrix)
  • number of such segments with early time
  • number of segment pairs on side A and C
  • number of segment pairs on side A and C with the corresponding time difference

take only the segments on side A (z > 0)

Definition at line 262 of file BeamBackgroundFiller.cxx.

262 {
264 for (unsigned int segIndex = 0; segIndex < cache.m_indexSeg.size(); ++segIndex) {
265
266 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[segIndex]));
267
268 const Amg::Vector3D& globalPos = seg->globalPosition();
269 double zSeg = globalPos.z();
270
272 if (zSeg < 0.) {
273 continue;
274 }
275
276
277 double tSeg = GetSegmentTime(*seg);
278 cache.m_numSegment++;
279 cache.m_resultSeg[segIndex] |= BeamBackgroundData::Segment;
280
281 // muon segment: in-time (1), early (2), ambiguous (0)
282 int timeStatus = 0;
283 double inTime = -(-std::abs(zSeg) + globalPos.mag()) * inv_c;
284 double early = -(std::abs(zSeg) + globalPos.mag()) * inv_c;
285 if (std::abs(tSeg - inTime) < m_cutMuonTime)
286 timeStatus = 1;
287 if (std::abs(tSeg - early) < m_cutMuonTime)
288 timeStatus = 2;
289
290 if (timeStatus == 2) {
291 cache.m_numSegmentEarly++;
292 cache.m_resultSeg[segIndex] |= BeamBackgroundData::SegmentEarly;
293 }
294
295
296
297 unsigned int segIndexA = segIndex;
298
299 double tSegA = tSeg;
300 int timeStatusA = timeStatus;
301
302 double phiSegA = globalPos.phi();
303
304 for (unsigned int segIndexC = 0; segIndexC < cache.m_indexSeg.size(); segIndexC++) {
305
306 const Muon::MuonSegment* segC = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[segIndexC]));
307
308 const Amg::Vector3D& globalPos = segC->globalPosition();
309 double zSegC = globalPos.z();
310
311 // take only the segments on side C (z < 0)
312 if (zSegC > 0.) {
313 continue;
314 }
315 double tSegC = GetSegmentTime(*segC);
316
317
318
319 // muon segment: in-time (1), early (2), ambiguous (0)
320 int timeStatusC = 0;
321 double inTime = -(-std::abs(zSegC) + globalPos.mag()) * inv_c;
322 double early = -(std::abs(zSegC) + globalPos.mag()) * inv_c;
323 if (std::abs(tSegC - inTime) < m_cutMuonTime)
324 timeStatusC = 1;
325 if (std::abs(tSegC - early) < m_cutMuonTime)
326 timeStatusC = 2;
327
328 double phiSegC = globalPos.phi();
329
330 // match in phi
331 if (std::abs(P4Helpers::deltaPhi(phiSegA, phiSegC)) > m_cutDphiSegAC) {
332 continue;
333 }
334 cache.m_numSegmentACNoTime++;
335 cache.m_resultSeg[segIndexA] |= BeamBackgroundData::SegmentACNoTime;
336 cache.m_resultSeg[segIndexC] |= BeamBackgroundData::SegmentACNoTime;
337
338 if (timeStatusA == 0 || timeStatusC == 0)
339 continue;
340
341 // check the time difference
342 if (std::abs(tSegA - tSegC) > m_cutTimeDiffAC) {
343 cache.m_numSegmentAC++;
344 cache.m_resultSeg[segIndexA] |= BeamBackgroundData::SegmentAC;
345 cache.m_resultSeg[segIndexC] |= BeamBackgroundData::SegmentAC;
346 }
347 }
348 }
349}
Gaudi::Property< double > m_cutTimeDiffAC
Gaudi::Property< double > m_cutDphiSegAC

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_ERROR(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ TwoSidedMethod()

void BeamBackgroundFiller::TwoSidedMethod ( Cache & cache) const
private

This function is the implementation of the "Two-Sided No-Time Method" and the "Two-Sided Method" that looks at the clusters matched with at least one muon segment on side A and one muon segment on side C.

In case of the "Two-Sided Method", corresponding time difference of the muon segments is required and the direction of the beam background muon is also stored.

Definition at line 476 of file BeamBackgroundFiller.cxx.

476 {
477
478
479 for (unsigned int clusIndex = 0; clusIndex < cache.m_indexClus.size(); clusIndex++) {
480
481 for (unsigned int segIndexA = 0; segIndexA < cache.m_indexSeg.size(); segIndexA++) {
482
483 if (!(cache.m_matchMatrix[clusIndex][segIndexA] & BeamBackgroundData::Matched))
484 continue;
485
486 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[segIndexA]));
487
488 const Amg::Vector3D& globalPos = seg->globalPosition();
489 double zSegA = globalPos.z();
490 // take only the segments on side A (z > 0)
491 if (zSegA < 0.) {
492 continue;
493 }
494 double tSegA = GetSegmentTime(*seg);
495
496 // muon segment: in-time (1), early (2), ambiguous (0)
497 int timeStatusA = 0;
498 double inTime = -(-std::abs(zSegA) + globalPos.mag()) * inv_c;
499 double early = -(std::abs(zSegA) + globalPos.mag()) * inv_c;
500 if (std::abs(tSegA - inTime) < m_cutMuonTime)
501 timeStatusA = 1;
502 if (std::abs(tSegA - early) < m_cutMuonTime)
503 timeStatusA = 2;
504
505
506 for (unsigned int segIndexC = 0; segIndexC < cache.m_indexSeg.size(); segIndexC++) {
507
508 if (!(cache.m_matchMatrix[clusIndex][segIndexC] & BeamBackgroundData::Matched)){
509 continue;
510 }
511 const Muon::MuonSegment* seg = static_cast<const Muon::MuonSegment*>(*(cache.m_indexSeg[segIndexC]));
512
513 const Amg::Vector3D& globalPos = seg->globalPosition();
514 double zSegC = globalPos.z();
515
516 // take only the segments on side C (z < 0)
517 if (zSegC > 0.) {
518 continue;
519 }
520
521 double tSegC = GetSegmentTime(*seg);
522
523 // muon segment: in-time (1), early (2), ambiguous (0)
524 int timeStatusC = 0;
525 double inTime = -(-std::abs(zSegC) + globalPos.mag()) * inv_c;
526 double early = -(std::abs(zSegC) + globalPos.mag()) * inv_c;
527 if (std::abs(tSegC - inTime) < m_cutMuonTime)
528 timeStatusC = 1;
529 if (std::abs(tSegC - early) < m_cutMuonTime)
530 timeStatusC = 2;
531
532
533
534 cache.m_matchMatrix[clusIndex][segIndexA] |=BeamBackgroundData::TwoSidedNoTime;
535 cache.m_matchMatrix[clusIndex][segIndexC] |=BeamBackgroundData::TwoSidedNoTime;
536 cache.m_resultSeg[segIndexA] |= cache.m_matchMatrix[clusIndex][segIndexA];
537 cache.m_resultSeg[segIndexC] |= cache.m_matchMatrix[clusIndex][segIndexC];
538
539 if (timeStatusA == 0 || timeStatusC == 0)
540 continue;
541
542 // check the time difference
543 if (std::abs(tSegA - tSegC) > m_cutTimeDiffAC) {
544 cache.m_matchMatrix[clusIndex][segIndexA] |= BeamBackgroundData::TwoSided;
545 cache.m_matchMatrix[clusIndex][segIndexC] |= BeamBackgroundData::TwoSided;
546 cache.m_resultSeg[segIndexA] |= cache.m_matchMatrix[clusIndex][segIndexA];
547 cache.m_resultSeg[segIndexC] |= cache.m_matchMatrix[clusIndex][segIndexC];
548
549 // direction of beam background
550 if (timeStatusA == 2)
551 cache.m_direction++; // A->C
552 if (timeStatusC == 2)
553 cache.m_direction--; // C->A
554 }
555 }
556
557 cache.m_resultClus[clusIndex] |= cache.m_matchMatrix[clusIndex][segIndexA];
558 }
559
560 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::TwoSidedNoTime)
561 cache.m_numTwoSidedNoTime++;
562 if (cache.m_resultClus[clusIndex] & BeamBackgroundData::TwoSided)
563 cache.m_numTwoSided++;
564 }
565}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_beamBackgroundDataWriteHandleKey

SG::WriteHandleKey<BeamBackgroundData> BeamBackgroundFiller::m_beamBackgroundDataWriteHandleKey
private
Initial value:
{
this, "BeamBackgroundKey", "BeamBackgroundData",
"WriteHandleKey for BeamBackgroundData"}

Definition at line 127 of file BeamBackgroundFiller.h.

127 {
128 this, "BeamBackgroundKey", "BeamBackgroundData",
129 "WriteHandleKey for BeamBackgroundData"};

◆ m_caloClusterContainerReadHandleKey

SG::ReadHandleKey<xAOD::CaloClusterContainer> BeamBackgroundFiller::m_caloClusterContainerReadHandleKey
private
Initial value:
{
this, "caloClusterContainerKey", "CaloCalTopoClusters",
"ReadHandleKey for CaloClusterContainer"}

ReadHandleKey for CaloClusterContainer.

Definition at line 117 of file BeamBackgroundFiller.h.

117 {
118 this, "caloClusterContainerKey", "CaloCalTopoClusters",
119 "ReadHandleKey for CaloClusterContainer"};

◆ m_clusEnergyCut

Gaudi::Property<double> BeamBackgroundFiller::m_clusEnergyCut {this,"clustEnergy", 10. *Gaudi::Units::GeV}
private

Minimum cut on the cluster energy to be considered.

Definition at line 140 of file BeamBackgroundFiller.h.

140{this,"clustEnergy", 10. *Gaudi::Units::GeV};

◆ m_clusRadiusHigh

Gaudi::Property<double> BeamBackgroundFiller::m_clusRadiusHigh {this,"cutRadiusHigh", 4250. * Gaudi::Units::mm}
private

Definition at line 145 of file BeamBackgroundFiller.h.

145{this,"cutRadiusHigh", 4250. * Gaudi::Units::mm};

◆ m_clusRadiusLow

Gaudi::Property<double> BeamBackgroundFiller::m_clusRadiusLow {this, "cutRadiusLow", 881. * Gaudi::Units::mm}
private

Definition at line 144 of file BeamBackgroundFiller.h.

144{this, "cutRadiusLow", 881. * Gaudi::Units::mm};

◆ m_cutClusTime

Gaudi::Property<double> BeamBackgroundFiller::m_cutClusTime {this,"cutClusTime", 2.5}
private

Definition at line 153 of file BeamBackgroundFiller.h.

153{this,"cutClusTime", 2.5};

◆ m_cutDphiClusSeg

Gaudi::Property<double> BeamBackgroundFiller::m_cutDphiClusSeg {this, "cutDphiClusSeg", 4.* Gaudi::Units::deg}
private

Definition at line 147 of file BeamBackgroundFiller.h.

147{this, "cutDphiClusSeg", 4.* Gaudi::Units::deg};

◆ m_cutDphiSegAC

Gaudi::Property<double> BeamBackgroundFiller::m_cutDphiSegAC {this,"cutPhi", 4.* Gaudi::Units::deg}
private

Definition at line 137 of file BeamBackgroundFiller.h.

137{this,"cutPhi", 4.* Gaudi::Units::deg};

◆ m_cutDradClusSeg

Gaudi::Property<double> BeamBackgroundFiller::m_cutDradClusSeg {this,"cutDrClusSet", 40. * Gaudi::Units::cm}
private

Definition at line 148 of file BeamBackgroundFiller.h.

148{this,"cutDrClusSet", 40. * Gaudi::Units::cm};

◆ m_cutDrdz

Gaudi::Property<double> BeamBackgroundFiller::m_cutDrdz {this,"cutDrdz", 0.15}
private

Definition at line 155 of file BeamBackgroundFiller.h.

155{this,"cutDrdz", 0.15};

◆ m_cutMuonTime

Gaudi::Property<double> BeamBackgroundFiller::m_cutMuonTime {this, "cutMuonTime", 25.}
private

Definition at line 152 of file BeamBackgroundFiller.h.

152{this, "cutMuonTime", 25.};

◆ m_cutTimeDiffAC

Gaudi::Property<double> BeamBackgroundFiller::m_cutTimeDiffAC {this,"cutTimeDiffAC", 25.}
private

Definition at line 154 of file BeamBackgroundFiller.h.

154{this,"cutTimeDiffAC", 25.};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_edmHelperSvc

ServiceHandle<Muon::IMuonEDMHelperSvc> BeamBackgroundFiller::m_edmHelperSvc
private
Initial value:
{
this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"}

Definition at line 156 of file BeamBackgroundFiller.h.

156 {
157 this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
158 "Handle to the service providing the IMuonEDMHelperSvc interface"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> BeamBackgroundFiller::m_idHelperSvc
private
Initial value:
{
this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 159 of file BeamBackgroundFiller.h.

159 {
160 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_jetContainerReadHandleKey

SG::ReadHandleKey<xAOD::JetContainer> BeamBackgroundFiller::m_jetContainerReadHandleKey
private
Initial value:
{
this, "jetContainerKey", "AntiKt4EMTopoJets",
"ReadHandleKey for JetContainer"}

ReadHandleKey for JetContainer.

Definition at line 122 of file BeamBackgroundFiller.h.

122 {
123 this, "jetContainerKey", "AntiKt4EMTopoJets",
124 "ReadHandleKey for JetContainer"};

◆ m_segmentKeys

SG::ReadHandleKeyArray<Trk::SegmentCollection> BeamBackgroundFiller::m_segmentKeys
private
Initial value:
{
this, "SegmentKeys", {"NCB_TrackMuonSegments", } ,
"Muon segment collections from the MS patterns"}

ReadHandleKey for Trk::SegmentCollection from CSC.

Definition at line 111 of file BeamBackgroundFiller.h.

111 {
112 this, "SegmentKeys", {"NCB_TrackMuonSegments", /*"TrackMuonSegments" */} ,
113 "Muon segment collections from the MS patterns"};

◆ m_segmentSelector

ToolHandle<Muon::IMuonSegmentSelectionTool> BeamBackgroundFiller::m_segmentSelector {this, "SegmentSelector",""}
private

Definition at line 131 of file BeamBackgroundFiller.h.

131{this, "SegmentSelector",""};

◆ m_thetaCutNCB

Gaudi::Property<double> BeamBackgroundFiller::m_thetaCutNCB {this, "cutThetaNCB", 5. * Gaudi::Units::deg}
private

Inclanation cut between the segment position and its direction.

Definition at line 135 of file BeamBackgroundFiller.h.

135{this, "cutThetaNCB", 5. * Gaudi::Units::deg};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: