ATLAS Offline Software
BmumuThinningTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
13 #ifndef DERIVATIONFRAMEWORK_BmumuThinningTool_H
14 #define DERIVATIONFRAMEWORK_BmumuThinningTool_H
15 
18 #include "GaudiKernel/ToolHandle.h"
20 
21 #include <string>
22 
23 class IThinningSvc;
24 
25 namespace SG {
26  class AuxElement;
27 }
28 
29 namespace xAOD {
30  class AuxContainerBase;
31 }
32 
33 namespace DerivationFramework {
145 
146  // useful typedefs
149 
150  public:
152  // Note: may later be migrated to xAODBPhys/BPhysHelper
153  static std::map<pv_type, std::string> PvTypeToVarNameMap;
154 
155  public:
157  BmumuThinningTool(const std::string& t, const std::string& n,
158  const IInterface* p);
166  virtual StatusCode doThinning() const;
167 
168  protected:
179  bool pass(const SG::AuxElement& em, std::string hypo) const;
188  std::string name) const;
189 
190  template<typename TYPE>
192  const std::vector<bool>& trkMask,
193  bool doAnd) const;
194 
195 
206  std::vector<bool>& muMask,
207  xAOD::BPhysHelper& vtx,
208  std::string counterName) const;
227  const xAOD::MuonContainer* cmuCont,
228  std::vector<bool>& muMask,
229  std::vector<bool>& cmuMask,
230  std::string counterName,
231  bool allowFastSync=true) const;
246  const xAOD::MuonContainer* cmuCont,
247  std::vector<bool>& muMask,
248  std::vector<bool>& cmuMask,
249  std::string counterName,
250  bool allowFastSync) const;
262  trkPartCont,
263  std::vector<bool>& trkMask,
264  const xAOD::MuonContainer* muCont,
265  std::vector<bool>& muMask,
266  std::string counterName) const;
278  trkPartCont,
279  std::vector<bool>& trkMask,
280  const xAOD::MuonContainer* muCont,
281  std::vector<bool>& muMask,
282  std::string counterName) const;
285 
297  std::vector<std::string>
299  std::string pattern) const;
310  std::vector<std::string>& vLinkNames,
311  std::vector<pv_type>& vLinkTypes,
312  std::string pattern) const;
325  std::vector<std::string>& vLinkNames,
326  std::vector<std::string> vPrefixes,
327  std::vector<pv_type>& vLinkTypes,
328  std::string pattern) const;
336  std::string dumpVS(const std::vector<std::string>& vs,
337  const std::string header="",
338  size_t nBlanks=0) const;
346  void logWrappedMsg(const std::string& str, const MSG::Level lvl) const;
359  std::string checkMaskConsistency(const std::vector<bool>& mask1,
360  const std::vector<bool>& mask2,
361  const std::string name1,
362  const std::string name2,
363  const std::string header="") const;
364 
365  private:
370  std::string m_trkPartContName;
371  std::vector<std::string> m_vtxContNames;
372  std::vector<std::string> m_vtxPassFlags;
373  std::string m_PVContName;
374  std::vector<std::string> m_refPVContNames;
375  std::string m_muonContName;
376  std::string m_calMuonContName;
377  std::string m_ctBranchBaseName;
378  std::vector<std::string> m_ctBranchPrefixes;
391  bool m_thinPVs;
397  bool m_muonAnd;
399 
406  bool m_doPVs;
410  bool m_doMuons;
416 
425  mutable std::vector<std::vector<std::string> > m_vvOrigPVLinkNames;
426  mutable std::vector<std::vector<pv_type> > m_vvOrigPVLinkTypes;
427  mutable std::vector<std::vector<std::string> > m_vvRefPVLinkNames;
428  mutable std::vector<std::vector<pv_type> > m_vvRefPVLinkTypes;
429 
433  mutable std::vector<std::vector<std::string> > m_vvCtLinkNames;
434  mutable std::vector<std::vector<pv_type> > m_vvCtLinkTypes;
436 
437  };
438 
439 } // namespace DerivationFramework
440 
441 #endif // DERIVATIONFRAMEWORK_BmumuThinningTool_H
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
DerivationFramework::BmumuThinningTool::m_keepPVTracks
bool m_keepPVTracks
Definition: BmumuThinningTool.h:380
DerivationFramework::BmumuThinningTool::m_thinPVs
bool m_thinPVs
Definition: BmumuThinningTool.h:391
DerivationFramework::BmumuThinningTool::m_markCalMuons
bool m_markCalMuons
Definition: BmumuThinningTool.h:383
ReadCellNoiseFromCool.name1
name1
Definition: ReadCellNoiseFromCool.py:233
xAOD::BPhysHelper
Definition: BPhysHelper.h:71
header
Definition: hcg.cxx:526
DerivationFramework::BmumuThinningTool::m_thinMuons
bool m_thinMuons
Definition: BmumuThinningTool.h:394
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
DerivationFramework::BmumuThinningTool::selectAuxElements
void selectAuxElements(const xAOD::AuxContainerBase *auxCont, std::vector< std::string > &vLinkNames, std::vector< pv_type > &vLinkTypes, std::string pattern) const
Determine aux elements to be looked at – for (refitted) PVs.
DerivationFramework::BmumuThinningTool::m_ctBranchPrefixes
std::vector< std::string > m_ctBranchPrefixes
Definition: BmumuThinningTool.h:378
DerivationFramework::BmumuThinningTool::matchMuons
StatusCode matchMuons(const xAOD::MuonContainer *muCont, std::vector< bool > &muMask, xAOD::BPhysHelper &vtx, std::string counterName) const
Mark muons matched to secondary vertices.
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:472
DerivationFramework::BmumuThinningTool::m_vvRefPVLinkNames
std::vector< std::vector< std::string > > m_vvRefPVLinkNames
Definition: BmumuThinningTool.h:427
DerivationFramework::IThinningTool
Definition: IThinningTool.h:24
DerivationFramework::BmumuThinningTool::TrackParticleLink
ElementLink< xAOD::TrackParticleContainer > TrackParticleLink
Definition: BmumuThinningTool.h:148
xAOD::AuxContainerBase
Common base class for the auxiliary containers.
Definition: AuxContainerBase.h:59
IThinningTool.h
DerivationFramework::BmumuThinningTool::m_vvCtLinkTypes
std::vector< std::vector< pv_type > > m_vvCtLinkTypes
Definition: BmumuThinningTool.h:434
DerivationFramework::BmumuThinningTool::dumpVS
std::string dumpVS(const std::vector< std::string > &vs, const std::string header="", size_t nBlanks=0) const
Dump a vector<str> to a string.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
DerivationFramework::BmumuThinningTool::m_muonContName
std::string m_muonContName
Definition: BmumuThinningTool.h:375
DerivationFramework::BmumuThinningTool::m_alignPassToVertexList
bool m_alignPassToVertexList
Definition: BmumuThinningTool.h:379
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::BmumuThinningTool::m_vvOrigPVLinkNames
std::vector< std::vector< std::string > > m_vvOrigPVLinkNames
Definition: BmumuThinningTool.h:425
DerivationFramework::BmumuThinningTool::checkMaskConsistency
std::string checkMaskConsistency(const std::vector< bool > &mask1, const std::vector< bool > &mask2, const std::string name1, const std::string name2, const std::string header="") const
Check two masks for consistency.
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition: ThinningHandle.h:84
DerivationFramework::BmumuThinningTool::BmumuThinningTool
BmumuThinningTool(const std::string &t, const std::string &n, const IInterface *p)
Main constructor.
DerivationFramework::BmumuThinningTool::doThinning
virtual StatusCode doThinning() const
Main thinning method executed for each event.
DerivationFramework::BmumuThinningTool::m_doCloseTracks
bool m_doCloseTracks
Definition: BmumuThinningTool.h:404
DerivationFramework::BmumuThinningTool::m_calMuonContName
std::string m_calMuonContName
Definition: BmumuThinningTool.h:376
DerivationFramework::BmumuThinningTool::m_doPVs
bool m_doPVs
process primary vertices
Definition: BmumuThinningTool.h:406
DerivationFramework::BmumuThinningTool::markOrigMuons
StatusCode markOrigMuons(const xAOD::MuonContainer *muCont, const xAOD::MuonContainer *cmuCont, std::vector< bool > &muMask, std::vector< bool > &cmuMask, std::string counterName, bool allowFastSync=true) const
DerivationFramework::BmumuThinningTool::m_vvRefPVLinkTypes
std::vector< std::vector< pv_type > > m_vvRefPVLinkTypes
Definition: BmumuThinningTool.h:428
DerivationFramework::BmumuThinningTool::m_vvOrigPVLinkTypes
std::vector< std::vector< pv_type > > m_vvOrigPVLinkTypes
Definition: BmumuThinningTool.h:426
DerivationFramework::BmumuThinningTool::m_doCalMuons
bool m_doCalMuons
process refitted muons
Definition: BmumuThinningTool.h:412
DerivationFramework::BmumuThinningTool::getTrackParticle
const xAOD::TrackParticle * getTrackParticle(const xAOD::Vertex *vtx, std::string name) const
Helper to get a TrackParticle link.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
xAOD::BPhysHelper::pv_type
pv_type
: Enum type of the PV
Definition: BPhysHelper.h:475
DerivationFramework::BmumuThinningTool::m_keepSelTrackCalMuons
bool m_keepSelTrackCalMuons
Definition: BmumuThinningTool.h:389
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::BmumuThinningTool::m_thinTracks
bool m_thinTracks
Definition: BmumuThinningTool.h:393
BPhysHypoHelper.h
: B-physcis xAOD helpers.
DerivationFramework::BmumuThinningTool::finalize
StatusCode finalize()
Finalize tool.
DerivationFramework::BmumuThinningTool::PvTypeToVarNameMap
static std::map< pv_type, std::string > PvTypeToVarNameMap
Definition: BmumuThinningTool.h:153
DerivationFramework::BmumuThinningTool::markCalibMuons
StatusCode markCalibMuons(const xAOD::MuonContainer *muCont, const xAOD::MuonContainer *cmuCont, std::vector< bool > &muMask, std::vector< bool > &cmuMask, std::string counterName, bool allowFastSync) const
Mark calibrated muons for accepted (original) muons.
DerivationFramework::BmumuThinningTool::selectAuxElements
void selectAuxElements(const xAOD::AuxContainerBase *auxCont, std::vector< std::string > &vLinkNames, std::vector< std::string > vPrefixes, std::vector< pv_type > &vLinkTypes, std::string pattern) const
Determine aux elements to be looked at – for closest tracks.
DerivationFramework::BmumuThinningTool::m_ctBranchBaseName
std::string m_ctBranchBaseName
Definition: BmumuThinningTool.h:377
DerivationFramework::BmumuThinningTool::m_allowFastMuonMaskSync
bool m_allowFastMuonMaskSync
Definition: BmumuThinningTool.h:390
DerivationFramework::BmumuThinningTool::m_markMuons
bool m_markMuons
Definition: BmumuThinningTool.h:382
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::BmumuThinningTool::m_muonAnd
bool m_muonAnd
Definition: BmumuThinningTool.h:397
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
DerivationFramework::BmumuThinningTool::m_trackAnd
bool m_trackAnd
Definition: BmumuThinningTool.h:396
DerivationFramework::BmumuThinningTool::m_doMuons
bool m_doMuons
process (original) muons
Definition: BmumuThinningTool.h:410
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DerivationFramework::BmumuThinningTool::m_vtxPassFlags
std::vector< std::string > m_vtxPassFlags
Definition: BmumuThinningTool.h:372
DerivationFramework::BmumuThinningTool::pv_type
xAOD::BPhysHelper::pv_type pv_type
Definition: BmumuThinningTool.h:147
DerivationFramework::BmumuThinningTool::m_vtxContNames
std::vector< std::string > m_vtxContNames
Definition: BmumuThinningTool.h:371
DerivationFramework::BmumuThinningTool::m_keepSelCalMuonTracks
bool m_keepSelCalMuonTracks
Definition: BmumuThinningTool.h:387
DerivationFramework::BmumuThinningTool::filterAuxElements
std::vector< std::string > filterAuxElements(const xAOD::AuxContainerBase *auxCont, std::string pattern) const
Obtain all auxillary elements matching a certain pattern.
DerivationFramework::BmumuThinningTool::m_trkPartContName
std::string m_trkPartContName
Definition: BmumuThinningTool.h:370
DerivationFramework::BmumuThinningTool::markMuonsForSelTracks
StatusCode markMuonsForSelTracks(const xAOD::TrackParticleContainer *trkPartCont, std::vector< bool > &trkMask, const xAOD::MuonContainer *muCont, std::vector< bool > &muMask, std::string counterName) const
Mark muons for selected ID tracks.
DerivationFramework::BmumuThinningTool::m_vvCtLinkNames
std::vector< std::vector< std::string > > m_vvCtLinkNames
caching aux element link names (and pv types) for closest tracks
Definition: BmumuThinningTool.h:433
DerivationFramework::BmumuThinningTool::m_thinningSvc
ServiceHandle< IThinningSvc > m_thinningSvc
Definition: BmumuThinningTool.h:369
DerivationFramework::BmumuThinningTool::m_syncMuonsBothWays
bool m_syncMuonsBothWays
Definition: BmumuThinningTool.h:384
DerivationFramework::BmumuThinningTool::markTrksForSelMuons
StatusCode markTrksForSelMuons(const xAOD::TrackParticleContainer *trkPartCont, std::vector< bool > &trkMask, const xAOD::MuonContainer *muCont, std::vector< bool > &muMask, std::string counterName) const
Mark ID tracks of selected (original or calibrated) muons.
DerivationFramework::BmumuThinningTool::pass
bool pass(const SG::AuxElement &em, std::string hypo) const
Helper checking for hypothesis passing.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
DerivationFramework::BmumuThinningTool::m_keepCloseTracks
bool m_keepCloseTracks
Definition: BmumuThinningTool.h:385
DerivationFramework::BmumuThinningTool::m_keepSelTrackMuons
bool m_keepSelTrackMuons
Definition: BmumuThinningTool.h:388
CfAthAlgTool.h
DerivationFramework::BmumuThinningTool::logWrappedMsg
void logWrappedMsg(const std::string &str, const MSG::Level lvl) const
Wrap string at line breaks and print with appropriate message level.
DerivationFramework::BmumuThinningTool::m_thinRefPVs
bool m_thinRefPVs
Definition: BmumuThinningTool.h:392
DerivationFramework::BmumuThinningTool::m_keepSelMuonTracks
bool m_keepSelMuonTracks
Definition: BmumuThinningTool.h:386
str
Definition: BTagTrackIpAccessor.cxx:11
DerivationFramework::BmumuThinningTool::m_matchCalMuons
bool m_matchCalMuons
Definition: BmumuThinningTool.h:381
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
DerivationFramework::BmumuThinningTool::applyThinMask
StatusCode applyThinMask(SG::ThinningHandle< TYPE > &trkCont, const std::vector< bool > &trkMask, bool doAnd) const
DerivationFramework::BmumuThinningTool::~BmumuThinningTool
~BmumuThinningTool()
Default destructor.
DerivationFramework::BmumuThinningTool
Primary vertex, track and muon thinning for Bmumu analysis.
Definition: BmumuThinningTool.h:144
DerivationFramework::BmumuThinningTool::m_doTracks
bool m_doTracks
process ID tracks
Definition: BmumuThinningTool.h:414
DerivationFramework::BmumuThinningTool::m_vertexAnd
bool m_vertexAnd
Definition: BmumuThinningTool.h:395
DerivationFramework::BmumuThinningTool::m_doRefPVs
bool m_doRefPVs
process refitted primary vertices
Definition: BmumuThinningTool.h:408
DerivationFramework::CfAthAlgTool
Definition: CfAthAlgTool.h:35
DerivationFramework::BmumuThinningTool::m_refPVContNames
std::vector< std::string > m_refPVContNames
Definition: BmumuThinningTool.h:374
DerivationFramework::BmumuThinningTool::initialize
StatusCode initialize()
Initialize tool.
ServiceHandle< IThinningSvc >
DerivationFramework::BmumuThinningTool::m_PVContName
std::string m_PVContName
Definition: BmumuThinningTool.h:373