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

#include <BSignalFilter.h>

Inheritance diagram for BSignalFilter:
Collaboration diagram for BSignalFilter:

Public Member Functions

 BSignalFilter (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode filterFinalize ()
virtual StatusCode filterEvent (const EventContext &ctx)
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
Event loop algorithm methods: not to be overloaded
StatusCode initialize ()
StatusCode execute (const EventContext &ctx)
 Execute method.
StatusCode finalize ()
Gen-specific event loop methods: to be overloaded!
virtual StatusCode filterInitialize ()
Counters
int nPassed () const
int nFailed () const
int nNeeded () const
bool keepAll () const
Event collection accessors (const and non-const)
HepMC::GenEvent *event ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current signal event (first in the McEventCollection).
McEventCollection *events ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current event's McEventCollection.
const HepMC::GenEventevent_const (const EventContext &ctx) const
 Access the current signal event (const).
const McEventCollectionevents_const (const EventContext &ctx) const
 Access the current event's McEventCollection (const).

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
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.

Protected Attributes

Counters and requirements
int m_nPass
int m_nFail
int m_nNeeded
bool m_keepAll

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void FindAllChildren (const HepMC::ConstGenParticlePtr &mother, std::string treeIDStr, bool fromFinalB, bool &foundSignal, bool &passedAllCuts, TLorentzVector &p1, TLorentzVector &p2, bool fromSelectedB, TLorentzVector &total_4mom) const
bool FinalStatePassedCuts (const HepMC::ConstGenParticlePtr &child) const
bool test_cuts (const double myPT, const double testPT, const double myEta, const double testEta) const
bool LVL1_Mu_Trigger (const HepMC::ConstGenParticlePtr &child) const
bool LVL2_eMu_Trigger (const HepMC::ConstGenParticlePtr &child) const
void PrintChild (const HepMC::ConstGenParticlePtr &child, const std::string &treeIDStr, const bool fromFinalB) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_cuts_f_e_on
bool m_cuts_f_mu_on
bool m_cuts_f_had_on
bool m_cuts_f_gam_on
bool m_cuts_f_K0_on
bool m_localLVL1MuonCutOn
bool m_localLVL2MuonCutOn
bool m_localLVL2ElectronCutOn
bool m_InvMass_switch
bool m_TotalInvMass_switch
double m_cuts_f_e_pT
double m_cuts_f_mu_pT
double m_cuts_f_had_pT
double m_cuts_f_gam_pT
double m_cuts_f_K0_pT
double m_cuts_f_e_eta
double m_cuts_f_mu_eta
double m_cuts_f_had_eta
double m_cuts_f_gam_eta
double m_cuts_f_K0_eta
double m_localLVL1MuonCutPT
double m_localLVL1MuonCutEta
double m_localLVL2MuonCutPT
double m_localLVL2MuonCutEta
double m_localLVL2ElectronCutPT
double m_localLVL2ElectronCutEta
double m_LVL1Counter
double m_LVL2Counter
double m_rejectedTrigger
double m_rejectedAll
int m_B_pdgid
int m_InvMass_PartId1
int m_InvMass_PartId2
double m_InvMass_PartFakeMass1
double m_InvMass_PartFakeMass2
double m_InvMassMin
double m_InvMassMax
double m_TotalInvMassMin
double m_TotalInvMassMax
int m_EventCnt
std::shared_ptr< GenDatam_gendata {nullptr}
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

Properties

SG::ReadHandleKey< McEventCollectionm_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
 Const handle to the MC event collection.
std::string m_mcEventKey {}
 StoreGate key for the MC event collection (defaults to GEN_EVENT).
BooleanProperty m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
 Flag to determine if a new MC event collection should be made if it doesn't exist.

Detailed Description

Definition at line 25 of file BSignalFilter.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

◆ BSignalFilter()

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

Definition at line 34 of file BSignalFilter.cxx.

34 :
35 GenFilter(name, pSvcLocator)
36{
37 // ** Declare the algorithm's properties **
38 declareProperty("LVL1MuonCutOn" , m_localLVL1MuonCutOn = false );
39 declareProperty("LVL2MuonCutOn" , m_localLVL2MuonCutOn = false );
40 declareProperty("LVL2ElectronCutOn" , m_localLVL2ElectronCutOn = false);
41 declareProperty("LVL1MuonCutPT" , m_localLVL1MuonCutPT = 0.0 );
42 declareProperty("LVL1MuonCutEta" , m_localLVL1MuonCutEta = 102.5 );
43 declareProperty("LVL2MuonCutPT" , m_localLVL2MuonCutPT = 0.0 );
44 declareProperty("LVL2MuonCutEta" , m_localLVL2MuonCutEta = 102.5 );
45 declareProperty("LVL2ElectronCutPT" , m_localLVL2ElectronCutPT = 0.0 );
46 declareProperty("LVL2ElectronCutEta" , m_localLVL2ElectronCutEta = 102.5);
47 declareProperty("Cuts_Final_e_switch" , m_cuts_f_e_on = false );
48 declareProperty("Cuts_Final_e_pT" , m_cuts_f_e_pT = 0. );
49 declareProperty("Cuts_Final_e_eta" , m_cuts_f_e_eta = 2.5 );
50 declareProperty("Cuts_Final_mu_switch" , m_cuts_f_mu_on = false );
51 declareProperty("Cuts_Final_mu_pT" , m_cuts_f_mu_pT = 0. );
52 declareProperty("Cuts_Final_mu_eta" , m_cuts_f_mu_eta = 102.5 );
53 declareProperty("Cuts_Final_hadrons_switch", m_cuts_f_had_on = false );
54 declareProperty("Cuts_Final_hadrons_pT" , m_cuts_f_had_pT = 0. );
55 declareProperty("Cuts_Final_hadrons_eta" , m_cuts_f_had_eta = 102.5 );
56 declareProperty("Cuts_Final_gamma_switch" , m_cuts_f_gam_on = false );
57 declareProperty("Cuts_Final_gamma_pT" , m_cuts_f_gam_pT = 0. );
58 declareProperty("Cuts_Final_gamma_eta" , m_cuts_f_gam_eta = 102.5 );
59 declareProperty("Cuts_Final_K0_switch" , m_cuts_f_K0_on = false );
60 declareProperty("Cuts_Final_K0_pT" , m_cuts_f_K0_pT = 0. );
61 declareProperty("Cuts_Final_K0_eta" , m_cuts_f_K0_eta = 102.5 );
62 //
63 // ** Declare the signal B-meson/hadron PDGid
64 declareProperty("B_PDGCode" ,m_B_pdgid = 0);
65 //
66 // ** Declare properties for mass filter **
67 declareProperty("InvMass_switch" , m_InvMass_switch = false );
68 declareProperty("InvMass_PartId1" , m_InvMass_PartId1 = 13 );
69 declareProperty("InvMass_PartId2" , m_InvMass_PartId2 = -m_InvMass_PartId1 );
70 declareProperty("InvMass_PartFakeMass1", m_InvMass_PartFakeMass1 = -1. );
71 declareProperty("InvMass_PartFakeMass2", m_InvMass_PartFakeMass2 = -1. );
72 declareProperty("InvMassMin" , m_InvMassMin = 0.0 );
73 declareProperty("InvMassMax" , m_InvMassMax = 14000000.0 );
74 declareProperty("TotalInvMass_switch" , m_TotalInvMass_switch = false );
75 declareProperty("TotalInvMassMin" , m_TotalInvMassMin = 0.0 );
76 declareProperty("TotalInvMassMax" , m_TotalInvMassMax = 14000000.0 );
77
78 // ** Initialise event counter **
79 m_EventCnt = 0;
80 m_LVL1Counter = 0;
81 m_LVL2Counter = 0;
82 m_rejectedTrigger = 0;
83 m_rejectedAll = 0;
84
85}
Base class for event generator filtering modules.
Definition GenFilter.h:30

Member Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE() [1/2]

McEventCollection *events GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inherited

Access the current event's McEventCollection.

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

◆ ATLAS_NOT_CONST_THREAD_SAFE() [2/2]

HepMC::GenEvent *event GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inlineinherited

Access the current signal event (first in the McEventCollection).

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

Definition at line 72 of file GenBase.h.

72 {
73 if (events()->empty())
74 ATH_MSG_ERROR("McEventCollection is empty during first event access");
75 return *(events()->begin());
76 }
#define ATH_MSG_ERROR(x)
static const Attributes_t empty

◆ 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.

◆ event_const()

const HepMC::GenEvent * GenBase::event_const ( const EventContext & ctx) const
inlineinherited

Access the current signal event (const).

Definition at line 79 of file GenBase.h.

79 {
80 const McEventCollection* coll = events_const(ctx);
81 if (coll->empty())
82 ATH_MSG_ERROR("Const McEventCollection is empty during first event access");
83 return *(coll->begin());
84 }
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool empty() const noexcept
Returns true if the collection is empty.
const McEventCollection * events_const(const EventContext &ctx) const
Access the current event's McEventCollection (const).
Definition GenBase.h:93

◆ events_const()

const McEventCollection * GenBase::events_const ( const EventContext & ctx) const
inlineinherited

Access the current event's McEventCollection (const).

Definition at line 93 of file GenBase.h.

93 {
94 SG::ReadHandle<McEventCollection> ret = SG::makeHandle(m_mcevents_const, ctx);
95 if (!ret.isValid())
96 ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
97 return ret.cptr();
98 }
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition GenBase.h:117
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ 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 GenFilter::execute ( const EventContext & ctx)
virtualinherited

Execute method.

Todo
Probably the filter should only look at the first event... right?

Reimplemented from GenBase.

Definition at line 27 of file GenFilter.cxx.

27 {
28 if (events_const(ctx)->empty()) {
29 ATH_MSG_ERROR("No events found in McEventCollection");
30 return StatusCode::FAILURE;
31 } else if (events_const(ctx)->size() > 1) {
33 ATH_MSG_WARNING("More than one event in current McEventCollection -- which is valid?");
34 }
36 if (filterPassed(ctx) || m_keepAll ) {
37 ATH_MSG_DEBUG("Event passed filter");
38 m_nPass += 1;
39 } else {
40 ATH_MSG_DEBUG("Event failed filter");
41 m_nFail += 1;
42 }
43 // Bail out once we have enough events
44 if (m_nPass >= m_nNeeded && m_nNeeded > 0)
45 sc = StatusCode::FAILURE;
46 return sc;
47}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
size_t size() const
Number of registered mappings.
virtual bool filterPassed(const EventContext &ctx) const
bool m_keepAll
Definition GenFilter.h:66
int m_nPass
Definition GenFilter.h:63
int m_nNeeded
Definition GenFilter.h:65
virtual StatusCode filterEvent(const EventContext &ctx)=0
int m_nFail
Definition GenFilter.h:64
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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.

◆ filterEvent()

StatusCode BSignalFilter::filterEvent ( const EventContext & ctx)
virtual

Implements GenFilter.

Definition at line 88 of file BSignalFilter.cxx.

89{
90 ATH_MSG_INFO("");
91 ATH_MSG_INFO(" ---------------------------------- ");
92 ATH_MSG_INFO(" >>> BSignalFilter::FilterEvent <<< ");
93 ATH_MSG_INFO(" ---------------------------------- ");
94 ATH_MSG_INFO("");
95 m_gendata = std::make_shared<GenData>();
96
97 // ** Return ERROR and exit if the user has not selected the PDGid of the B-meson/hadron signal **
98 if ( m_cuts_f_e_on || m_cuts_f_mu_on || m_cuts_f_had_on || m_cuts_f_gam_on || m_cuts_f_K0_on )
99 if (m_B_pdgid==0)
100 {
101 ATH_MSG_ERROR("");
102 ATH_MSG_ERROR(" ==>> 'B_PDGCode = 0'! Please define the PDGid of the B-meson/hadron signal!");
103 ATH_MSG_ERROR("");
104 return StatusCode::FAILURE;
105 }
106
107 // ** Begin iterating over McEventCollection **
109 for( itr = events()->begin(); itr != events()->end(); ++itr )
110 {
111 m_EventCnt++;
112 bool acceptEvent = true;
113 const HepMC::GenEvent* genEvt = (*itr);
114
115 // ** Check HepMC for particles activating LVL1 trigger, if that is what user wishes **
116 //
117 bool LVL1Passed = false;
118 HepMC::ConstGenParticlePtr LVL1Muon = nullptr;
119 //
120 if ( m_localLVL1MuonCutOn ) {
121 for(const auto& part: *genEvt){
122 bool LVL1Result = LVL1_Mu_Trigger( part );
123 if ( LVL1Result )
124 {
125 LVL1Passed = true;
126 LVL1Muon = part; // Remember the muon for LVL2 testing
127 break;
128 }
129 }
130 }
131
132 // ** Check HepMC for particles activating LVL2 trigger, if that is what user wishes **
133 //
134 bool LVL2Passed = false;
135 //
136 if ( LVL1Passed && (m_localLVL2MuonCutOn || m_localLVL2ElectronCutOn) )
137 {
138 for(const auto& part: *genEvt)
139 {
140 bool LVL2Result = LVL2_eMu_Trigger( part );
141 if ( LVL2Result )
142 {
143 if ( part != LVL1Muon ) // Check the particle triggering LVL2 isn't
144 LVL2Passed = true; // the muon that triggered LVL1 --> Artificial,
145 // since, effectively, LVL2 trigger is not applied.
146 // This is needed to "trigger" the 2nd muon!
147 }
148 }
149 }
150
151 // ** Flag event as passing LVL1 if it has passed **
152 //cy of both versions of the filter and go
153 if ( m_localLVL1MuonCutOn && LVL1Passed )
154 {
155 ATH_MSG_DEBUG(" LVL1 Trigger activated for event " << m_EventCnt);
157 }
158 // ** Flag event as passing LVL2 if it has passed **
159 //
160 if ( (m_localLVL2MuonCutOn || m_localLVL2ElectronCutOn) && LVL2Passed )
161 {
162 ATH_MSG_DEBUG(" LVL2 Trigger activated for event " << m_EventCnt);
164 }
165
166 // ** If user hasn't requested triggers then set everything to true so nothing is thrown away **
167 //
168 if ( !m_localLVL1MuonCutOn )
169 {
170 LVL1Passed = true;
171 LVL2Passed = true;
172 }
173 if ( !m_localLVL2MuonCutOn && !m_localLVL2ElectronCutOn ) LVL2Passed = true;
174
175 // ** Reject event if an undecayed quark is found **
176 //
177 for(const auto& part: *genEvt)
178 {
179 if ( std::abs(part->pdg_id()) <= 6 && MC::isStable(part) )
180 {
181 acceptEvent = false;
182 ATH_MSG_WARNING(" Undecayed quark "<< part);
183 }
184 }
185
186 // ** Look for signal events **
187 //
188 bool SignalPassedCuts=false;
189 if ( LVL1Passed && LVL2Passed )
190 {
191 // ** Loop on all particles **
192 for(const auto& part: *genEvt)
193 {
194 const int particleID = part->pdg_id();
195 //
196 bool motherIsB = false;
197 bool newBChain = false;
198
199 if( ( MC::isBottomMeson(particleID) || MC::isBottomBaryon(particleID) ) && MC::isPhysical(part) ){
200 // ** Reject whole event if any of B-hadrons in the event is not decayed **
201 if( MC::isStable(part)) { acceptEvent = false; }
202
203 auto firstParent = part->production_vertex()->particles_in().begin();
204 auto lastParent = part->production_vertex()->particles_in().end();
205 for (auto thisParent = firstParent; thisParent != lastParent; ++thisParent ) {
206 if (MC::isBottomMeson(*thisParent) || MC::isBottomBaryon(*thisParent) ) motherIsB = true;
207 }
208 if( motherIsB ){
209 newBChain = false; // Since the chain is not new
210 }else{
211 newBChain = true;
212 }
213 }
214 else{ newBChain = false; } // Since particle is not b
215
216 // ** New B-signal found, output message and find whole decay tree **
217 if( newBChain )
218 {
219 const auto HadronData = m_gendata->particleName(std::abs(particleID));
220 std::string HadronName = "unknown particle";
221 if (HadronData) HadronName = ((particleID < 0) ? std::string("anti - ") : std::string("")) + *HadronData;
222 ATH_MSG_DEBUG("");
223 ATH_MSG_DEBUG(" ------------------------------------------ ");
224 ATH_MSG_DEBUG(" *** BSignalFilter.cxx: B-signal found *** ");
225 ATH_MSG_DEBUG(" ------------------------------------------ ");
226 ATH_MSG_DEBUG("");
227 ATH_MSG_DEBUG(" Event " << m_EventCnt << " --> B-hadron/B-meson (" << HadronName << ") " << part);
228 ATH_MSG_DEBUG("");
229
230 // ** Looping on all children checking if they have passed the selection cuts defined by the user **
231 if ( m_cuts_f_e_on || m_cuts_f_mu_on || m_cuts_f_had_on || m_cuts_f_gam_on || m_cuts_f_K0_on
232 || m_InvMass_switch || m_TotalInvMass_switch )
233 {
234 ATH_MSG_DEBUG(" *** KINEMATIC CUTS ON PARTICLES ACTIVATED *** ");
235 ATH_MSG_DEBUG("");
236 ATH_MSG_DEBUG(" --------------------------------- ");
237 ATH_MSG_DEBUG(" Started looping on all children ");
238 ATH_MSG_DEBUG(" --------------------------------- ");
239 ATH_MSG_DEBUG("");
240 //
241 bool isSignal=false;
242 bool havePassedCuts=true;
243 TLorentzVector CandPart1, CandPart2, total_4mom;
244 //
245 FindAllChildren(part,"",false,isSignal,havePassedCuts,CandPart1,CandPart2,false,total_4mom);
246 //
247 ATH_MSG_DEBUG("");
248 ATH_MSG_DEBUG(" ------------------------------- ");
249 ATH_MSG_DEBUG(" Ended looping on all children ");
250 ATH_MSG_DEBUG(" ------------------------------- ");
251 ATH_MSG_DEBUG("");
252
253 SignalPassedCuts = ( isSignal && havePassedCuts );
254
255 // ** If signal event is found and InvMass_switch = true, check if the selected
256 // couple of particles has an invariant mass within the range set by the user **
257 if ( m_InvMass_switch )
258 {
259 if ( SignalPassedCuts )
260 {
261 bool accept_mass = false;
262 bool accept_total_mass = false;
263 ATH_MSG_DEBUG("");
264 ATH_MSG_DEBUG(" *** INVARIANT MASS CUTS ON PARTICLES ACTIVATED! *** ");
265 ATH_MSG_DEBUG("");
266 ATH_MSG_DEBUG(" -- Mass cuts -->> " << m_InvMassMin << " < mass < " << m_InvMassMax << " MeV");
267 //
268 double invMass = ( CandPart1 + CandPart2 ).M();
269 double invMass_total = total_4mom.M();
270 //
271
272 if ( m_InvMass_switch )
273 {
274 ATH_MSG_DEBUG(" -- Invariant mass of the couple of particles = " << invMass << " MeV");
275 if ( m_InvMassMin < invMass && invMass < m_InvMassMax )
276 {
277 ATH_MSG_DEBUG(" ==>> Event has passed the mass filter!");
278 ATH_MSG_DEBUG("");
279 accept_mass = true;
280 }else
281 {
282 ATH_MSG_DEBUG(" ==>> Event has NOT passed the mass filter!");
283 ATH_MSG_DEBUG("");
284 }
285 SignalPassedCuts = SignalPassedCuts && accept_mass;
286 }
287 if ( m_TotalInvMass_switch )
288 {
289 ATH_MSG_DEBUG(" -- Total invariant mass of the final-state particles = " << invMass_total << " MeV");
290 if ( m_TotalInvMassMin < invMass_total && invMass_total < m_TotalInvMassMax )
291 {
292 ATH_MSG_DEBUG(" ==>> Event has passed the total mass filter!");
293 ATH_MSG_DEBUG("");
294 accept_total_mass = true;
295 } else {
296 ATH_MSG_DEBUG(" ==>> Event has NOT passed the total mass filter!");
297 ATH_MSG_DEBUG("");
298 }
299 SignalPassedCuts = SignalPassedCuts && accept_total_mass;
300 }
301 }else{
302 ATH_MSG_DEBUG("");
303 ATH_MSG_DEBUG(" *** INVARIANT MASS CUTS ON PARTICLES NOT APPLIED (since the event is not a signal that passed cuts)! *** ");
304 ATH_MSG_DEBUG("");
305 }
306 }else{
307 ATH_MSG_DEBUG(" *** INVARIANT MASS CUTS ON PARTICLES NOT ACTIVATED *** ");
308 ATH_MSG_DEBUG("");
309 }
310 }else{
311 SignalPassedCuts = true;
312 //
313 ATH_MSG_DEBUG(" *** KINEMATIC CUTS ON PARTICLES NOT ACTIVATED ==>> ACCEPT ALL EVENTS! *** ");
314 ATH_MSG_DEBUG("");
315 }
316 } // End newBChain
317 if ( SignalPassedCuts ) break; // We have found the signal, we do not need to look for other particles
318 } // End particle iteration
319
320 if ( SignalPassedCuts )
321 {
322 ATH_MSG_DEBUG(" -->> All signal children have passed cuts on particles!");
323 }else{
324 ATH_MSG_DEBUG(" -->> Signal children have NOT passed cuts on particles!");
325 }
326 } // end of LVL1/LVL2 selection
327 else{
328 ATH_MSG_DEBUG("");
329 ATH_MSG_DEBUG(" -->> Event has NOT passed the trigger!");
330 }
331 // ** Reject event if it has not passed triggers **
332 // --> If not requested by user these flags will be set
333 // to true so there will be no erroneous rejection
334 if ( (!LVL1Passed) || (!LVL2Passed) ){
336 acceptEvent = false;
337 }
338
339 // ** Check if all conditions are true **
340 // --> Accept the event if acceptEvent is true and the event is a signal event
341 acceptEvent = acceptEvent && SignalPassedCuts;
342
343 // ** Print whether the event has passed or not **
344 //
345 ATH_MSG_DEBUG("");
346 if( !acceptEvent )
347 {
348 setFilterPassed(false, ctx);
350 ATH_MSG_DEBUG(" ==========================");
351 ATH_MSG_DEBUG(" Event REJECTED by Filter ");
352 ATH_MSG_DEBUG(" ==========================");
353 }else
354 {
355 setFilterPassed(true, ctx);
356 ATH_MSG_DEBUG(" ==========================");
357 ATH_MSG_DEBUG(" Event ACCEPTED by Filter ");
358 ATH_MSG_DEBUG(" ==========================");
359 }
360 ATH_MSG_DEBUG("");
361
362 } // End event iteration
363 // End of execution for each event
364 return StatusCode::SUCCESS;
365}
#define ATH_MSG_INFO(x)
virtual void setFilterPassed(bool state, const EventContext &ctx) const
double m_LVL1Counter
double m_rejectedAll
double m_rejectedTrigger
void FindAllChildren(const HepMC::ConstGenParticlePtr &mother, std::string treeIDStr, bool fromFinalB, bool &foundSignal, bool &passedAllCuts, TLorentzVector &p1, TLorentzVector &p2, bool fromSelectedB, TLorentzVector &total_4mom) const
std::shared_ptr< GenData > m_gendata
bool LVL2_eMu_Trigger(const HepMC::ConstGenParticlePtr &child) const
double m_LVL2Counter
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
std::optional< std::string > particleName(int pdgId) const
Definition GenData.h:62
End of vector before end of string
Definition Arrayrep.cxx:228
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
bool isBottomMeson(const T &p)
bool isBottomBaryon(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
double invMass(const I4Momentum &pA, const I4Momentum &pB)
invariant mass from two I4momentum references
Definition P4Helpers.h:252

◆ filterFinalize()

StatusCode BSignalFilter::filterFinalize ( )
virtual

Reimplemented from GenFilter.

Definition at line 635 of file BSignalFilter.cxx.

636{
637 double total = m_EventCnt;
638 ATH_MSG_ALWAYS(" I===============================================================================================");
639 ATH_MSG_ALWAYS(" I BSignalFilter Summary Report ");
640 ATH_MSG_ALWAYS(" I===============================================================================================");
641 if (m_localLVL1MuonCutOn)
642 {
643 ATH_MSG_ALWAYS(" I LVL1 muon trigger report:");
644 ATH_MSG_ALWAYS(" I Muon pT cut " << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << "I" << '\t'
645 << m_localLVL1MuonCutPT << " MeV ");
646 ATH_MSG_ALWAYS(" I Muon pseudo-rapidity cut" << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << "I" << '\t'
647 << m_localLVL1MuonCutEta);
648 ATH_MSG_ALWAYS(" I No of events containing at least " << '\t' << '\t' << '\t' << '\t' << '\t' << "I");
649 ATH_MSG_ALWAYS(" I one particle satisfying these cuts " << '\t' << '\t' << '\t' << '\t' << '\t' << "I" << '\t'
650 << m_LVL1Counter);
651 if (m_localLVL2MuonCutOn)
652 {
653 ATH_MSG_ALWAYS(" I LVL2 muon trigger report:");
654 ATH_MSG_ALWAYS(" I Muon pT cut " << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << "I" << '\t'
655 << m_localLVL2MuonCutPT << " MeV ");
656 ATH_MSG_ALWAYS(" I Muon pseudo-rapidity cut " << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << "I" << '\t'
657 << m_localLVL2MuonCutEta);
658 }
659 if (m_localLVL2ElectronCutOn)
660 {
661 ATH_MSG_ALWAYS(" I LVL2 electron trigger report:");
662 ATH_MSG_ALWAYS(" I Electron pT cut " << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' << '\t' <<
663 " I" << '\t' << m_localLVL2ElectronCutPT << " MeV ");
664 ATH_MSG_ALWAYS(" I Electron pseudo-rapidity cut " << '\t' << '\t' << '\t' << '\t' << '\t' << "I"
665 << '\t' << m_localLVL2ElectronCutEta);
666 }
667 if (m_localLVL2MuonCutOn || m_localLVL2ElectronCutOn)
668 {
669 ATH_MSG_ALWAYS(" I No of events containing at least one muon satisfying LVL1 cut" << '\t' << "I");
670 ATH_MSG_ALWAYS(" I and at least one separate particle passing these LVL2 cuts " << '\t' << '\t' << "I" << '\t'
671 << m_LVL2Counter);
672 }
673 }
674 ATH_MSG_ALWAYS(" I Total no of input events " << '\t'<< '\t'<< '\t'<< '\t'<< '\t'<< '\t'<< '\t' << "I" << '\t'
675 << total);
676 ATH_MSG_ALWAYS(" I No of events rejected by trigger " << '\t' << '\t'<< '\t'<< '\t'<< '\t'<< '\t'<< '\t' << "I" << '\t'
677 << m_rejectedTrigger);
678 ATH_MSG_ALWAYS(" I No of events rejected in total " << '\t' << '\t'<< '\t'<< '\t'<< '\t'<< '\t'<< '\t' << "I" << '\t'
679 << m_rejectedAll);
680 if (m_localLVL1MuonCutOn && (!m_localLVL2MuonCutOn && !m_localLVL2ElectronCutOn))
681 ATH_MSG_ALWAYS(" I To obtain correct cross section, multiply BX in PythiaB report by " << '\t' << '\t' << "I" << '\t'
682 << m_LVL1Counter / total);
683 if (m_localLVL1MuonCutOn && (m_localLVL2MuonCutOn || m_localLVL2ElectronCutOn))
684 ATH_MSG_ALWAYS(" I To obtain correct cross section, multiply BX in PythiaB report by " << '\t' << '\t' << "I" << '\t'
685 << m_LVL2Counter / total);
686 if (!m_localLVL1MuonCutOn)
687 ATH_MSG_ALWAYS(" I No trigger requests made");
688 //
689 ATH_MSG_ALWAYS(" I=========================================== End of report =====================================");
690
691 return StatusCode::SUCCESS;
692}
#define ATH_MSG_ALWAYS(x)

◆ filterInitialize()

virtual StatusCode GenFilter::filterInitialize ( )
inlinevirtualinherited

Reimplemented in BoostedHadTopAndTopPair, ChargedTracksWeightFilter, DecaysFinalStateFilter, DecayTimeFilter, DecayVolumeFilter, DiBjetFilter, DiLeptonMassFilter, DiPhotonFilter, DirectPhotonFilter, FourLeptonInvMassFilter, FourLeptonMassFilter, HeavyFlavorHadronFilter, HTFilter, JetFilter, LeptonFilter, LeptonPairFilter, M4MuIntervalFilter, MassRangeFilter, MuDstarFilter, MultiBjetFilter, MultiCjetFilter, MultiParticleFilter, ParentChildFilter, ParentChildwStatusFilter, ParentTwoChildrenFilter, ParticleDecayFilter, ParticleFilter, QCDTruthJetFilter, QCDTruthMultiJetFilter, SameParticleHardScatteringFilter, TauFilter, TrimuMassRangeFilter, TruthJetFilter, TTbarPlusHeavyFlavorFilter, TTbarWithJpsimumuFilter, VBFForwardJetsFilter, VBFHbbEtaSortingFilter, VBFMjjIntervalFilter, xAODBSignalFilter, xAODChargedTracksFilter, xAODChargedTracksWeightFilter, xAODDecaysFinalStateFilter, xAODDecayTimeFilter, xAODDiLeptonMassFilter, xAODDiPhotonFilter, xAODDirectPhotonFilter, xAODElectronFilter, xAODForwardProtonFilter, xAODFourLeptonInvMassFilter, xAODFourLeptonMassFilter, xAODHeavyFlavorHadronFilter, xAODHTFilter, xAODJetFilter, xAODLeptonFilter, xAODLeptonPairFilter, xAODM4MuIntervalFilter, xAODMETFilter, xAODMuDstarFilter, xAODMultiBjetFilter, xAODMultiCjetFilter, xAODMultiElecMuTauFilter, xAODMultiElectronFilter, xAODMultiLeptonFilter, xAODMultiMuonFilter, xAODMuonFilter, xAODParentChildFilter, xAODParentTwoChildrenFilter, xAODParticleDecayFilter, xAODParticleFilter, xAODPhotonFilter, xAODSameParticleHardScatteringFilter, xAODSplitPhotonFilter, xAODTauFilter, xAODTTbarWithJpsimumuFilter, xAODTTbarWToLeptonFilter, xAODVBFForwardJetsFilter, xAODVBFMjjIntervalFilter, xAODXtoVVDecayFilterExtended, and XtoVVDecayFilterExtended.

Definition at line 45 of file GenFilter.h.

45{ return StatusCode::SUCCESS; }

◆ 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 }

◆ finalize()

StatusCode GenFilter::finalize ( )
inherited

Definition at line 50 of file GenFilter.cxx.

50 {
51 ATH_MSG_INFO("Events passed = " << m_nPass << " Events failed = " << m_nFail);
53 return StatusCode::SUCCESS;
54}
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode filterFinalize()
Definition GenFilter.h:47

◆ FinalStatePassedCuts()

bool BSignalFilter::FinalStatePassedCuts ( const HepMC::ConstGenParticlePtr & child) const
private

Definition at line 487 of file BSignalFilter.cxx.

488{
489 bool accept = true;
490
491 // ** Look if children has passed the cuts **
492 //
493 int pID = child->pdg_id();
494 double myPT = child->momentum().perp();
495 double myEta = child->momentum().pseudoRapidity();
496
497 ATH_MSG_DEBUG("");
498 ATH_MSG_DEBUG(" ** Found a child with: ");
499 ATH_MSG_DEBUG(" - id = " << pID );
500 ATH_MSG_DEBUG(" - pT = " << myPT << " MeV");
501 ATH_MSG_DEBUG(" - eta = " << myEta );
502 ATH_MSG_DEBUG("");
503
504 if ( m_cuts_f_e_on )
505 {
506 if ( std::abs(pID) == 11 )
507 {
508 ATH_MSG_DEBUG(" ** ( pT , eta ) cuts applied on the electron --> ( " << m_cuts_f_e_pT
509 << " , " << m_cuts_f_e_eta << " )");
510 if ( test_cuts( myPT, m_cuts_f_e_pT, myEta, m_cuts_f_e_eta) )
511 {
512 ATH_MSG_DEBUG(" ==>> Found an electron which passed the pT and eta cuts!");
513 ATH_MSG_DEBUG(" - Electron: pT = " << myPT << " MeV");
514 ATH_MSG_DEBUG(" - Electron: eta = " << myEta);
515 ATH_MSG_DEBUG("");
516 ATH_MSG_DEBUG(" ==>> Accepted the electron!");
517 ATH_MSG_DEBUG("");
518 }else
519 {
520 accept = false;
521 ATH_MSG_DEBUG(" ==>> The electron has NOT passed the pT and eta cuts!");
522 ATH_MSG_DEBUG("");
523 }
524 }
525 }
526 if ( m_cuts_f_mu_on )
527 {
528 if ( std::abs(pID) == 13 )
529 {
530 ATH_MSG_DEBUG(" ** ( pT , eta ) cuts applied on the muon --> ( " << m_cuts_f_mu_pT
531 << " , " << m_cuts_f_mu_eta << " )");
532 if ( test_cuts( myPT, m_cuts_f_mu_pT, myEta, m_cuts_f_mu_eta) )
533 {
534 ATH_MSG_DEBUG(" ==>> Found a muon which passed the pT and eta cuts!");
535 ATH_MSG_DEBUG(" - Muon: pT = " << myPT << " MeV");
536 ATH_MSG_DEBUG(" - Muon: eta = " << myEta);
537 ATH_MSG_DEBUG("");
538 ATH_MSG_DEBUG(" ==>> Accepted the muon!");
539 ATH_MSG_DEBUG("");
540 }else
541 {
542 accept = false;
543 ATH_MSG_DEBUG(" ==>> The muon has NOT passed the pT and eta cuts!");
544 ATH_MSG_DEBUG("");
545 }
546 }
547 }
548 if ( m_cuts_f_had_on )
549 {
550 if ( MC::isHadron(pID) && MC::isCharged(pID))
551 {
552 ATH_MSG_DEBUG(" ** ( pT , eta ) cuts applied on the charged hadron --> ( " << m_cuts_f_had_pT
553 << " , " << m_cuts_f_had_eta << " )");
554 if ( test_cuts( myPT, m_cuts_f_had_pT, myEta, m_cuts_f_had_eta) )
555 {
556 ATH_MSG_DEBUG(" ==>> Found a charged hadron which passed the pT and eta cuts!");
557 ATH_MSG_DEBUG(" - Charged hadron: pT = " << myPT << " MeV");
558 ATH_MSG_DEBUG(" - Charged hadron: eta = " << myEta);
559 ATH_MSG_DEBUG("");
560 ATH_MSG_DEBUG(" ==>> Accepted the charged hadron!");
561 ATH_MSG_DEBUG("");
562 }else
563 {
564 accept = false;
565 ATH_MSG_DEBUG(" ==>> The charged hadron has NOT passed the pT and eta cuts!");
566 ATH_MSG_DEBUG("");
567 }
568 }
569 }
570 if ( m_cuts_f_gam_on )
571 {
572 if ( std::abs(pID) == 22 )
573 {
574 ATH_MSG_DEBUG(" ** ( pT , eta ) cuts applied on the gamma --> ( " << m_cuts_f_gam_pT
575 << " , " << m_cuts_f_gam_eta << " )");
576 if ( test_cuts( myPT, m_cuts_f_gam_pT, myEta, m_cuts_f_gam_eta) )
577 {
578 ATH_MSG_DEBUG(" ==>> Found a gamma which passed the pT and eta cuts!");
579 ATH_MSG_DEBUG(" - Gamma: pT = " << myPT << " MeV");
580 ATH_MSG_DEBUG(" - Gamma: eta = " << myEta);
581 ATH_MSG_DEBUG("");
582 ATH_MSG_DEBUG(" ==>> Accepted the gamma!");
583 ATH_MSG_DEBUG("");
584 }else
585 {
586 accept = false;
587 ATH_MSG_DEBUG(" ==>> The gamma has NOT passed the pT and eta cuts!");
588 ATH_MSG_DEBUG("");
589 }
590 }
591 }
592 if ( m_cuts_f_K0_on )
593 {
594 if ( std::abs(pID) == 311 )
595 {
596 ATH_MSG_DEBUG(" ** ( pT , eta ) cuts applied on the K0 --> ( " << m_cuts_f_K0_pT
597 << " , " << m_cuts_f_K0_eta << " )");
598 if ( test_cuts( myPT, m_cuts_f_K0_pT, myEta, m_cuts_f_K0_eta) )
599 {
600 ATH_MSG_DEBUG(" ==>> Found a K0 which passed the pT and eta cuts!");
601 ATH_MSG_DEBUG(" - K0: pT = " << myPT << " MeV");
602 ATH_MSG_DEBUG(" - K0: eta = " << myEta);
603 ATH_MSG_DEBUG("");
604 ATH_MSG_DEBUG(" ==>> Accepted the K0!");
605 ATH_MSG_DEBUG("");
606 }else
607 {
608 accept = false;
609 ATH_MSG_DEBUG(" ==>> The K0 has NOT passed the pT and eta cuts!");
610 ATH_MSG_DEBUG("");
611 }
612 }
613 }
614
615 return accept;
616
617}
bool test_cuts(const double myPT, const double testPT, const double myEta, const double testEta) const
StatusCode accept(const xAOD::Muon *mu)
bool isCharged(const T &p)
bool isHadron(const T &p)

◆ FindAllChildren()

void BSignalFilter::FindAllChildren ( const HepMC::ConstGenParticlePtr & mother,
std::string treeIDStr,
bool fromFinalB,
bool & foundSignal,
bool & passedAllCuts,
TLorentzVector & p1,
TLorentzVector & p2,
bool fromSelectedB,
TLorentzVector & total_4mom ) const
private

Definition at line 405 of file BSignalFilter.cxx.

408{
409 int pID = mother->pdg_id();
410 //
411 if ( !(mother->end_vertex()) && MC::isStable(mother) ) // i.e. this is a final state
412 {
413 bool hasChildGoodParent = fromFinalB && (fromSelectedB || m_B_pdgid==0);
414 //
415 if( fromFinalB && hasChildGoodParent )
416 {
417 foundSignal=true;
418 bool passedCut = FinalStatePassedCuts(mother); // X = X && ... in case of multiple particles (e.g. KK)
419 if ( m_cuts_f_e_on && std::abs(pID)==11 ) passedAllCuts = passedAllCuts && passedCut;
420 if ( m_cuts_f_mu_on && std::abs(pID)==13 ) passedAllCuts = passedAllCuts && passedCut;
421 if ( m_cuts_f_had_on && MC::isHadron(pID) && MC::isCharged(pID) ) passedAllCuts = passedAllCuts && passedCut;
422 if ( m_cuts_f_gam_on && std::abs(pID)==22 ) passedAllCuts = passedAllCuts && passedCut;
423 if ( m_cuts_f_K0_on && std::abs(pID)==311 ) passedAllCuts = passedAllCuts && passedCut;
424 //
425 if ( (m_InvMass_switch || m_TotalInvMass_switch) && m_InvMass_PartId1==pID )
426 {
427 if (m_InvMass_PartFakeMass1 < 0.) p1.SetPxPyPzE(mother->momentum().x(),mother->momentum().y(),mother->momentum().z(),mother->momentum().e() );
428 else p1.SetXYZM(mother->momentum().x(),mother->momentum().y(),mother->momentum().z(),m_InvMass_PartFakeMass1);
429 total_4mom = total_4mom + p1;
430 } else if ( (m_InvMass_switch || m_TotalInvMass_switch) && m_InvMass_PartId2==pID ) {
431 if (m_InvMass_PartFakeMass2 < 0.) p2.SetPxPyPzE(mother->momentum().x(),mother->momentum().y(),mother->momentum().z(),mother->momentum().e() );
432 else p2.SetXYZM(mother->momentum().x(),mother->momentum().y(),mother->momentum().z(),m_InvMass_PartFakeMass2);
433 total_4mom = total_4mom + p2;
434 } else if (m_TotalInvMass_switch) {
435 TLorentzVector current_4p;
436 current_4p.SetPxPyPzE(mother->momentum().x(),mother->momentum().y(),mother->momentum().z(),mother->momentum().e());
437 total_4mom = total_4mom + current_4p;
438 }
439 }
440 return;
441 }
442 else{
443 if ( !(mother->end_vertex()) ) // i.e. something is wrong in HepMC
444 {
445 if (MC::isDecayed(mother))
446 ATH_MSG_DEBUG(" Inconsistent entry in HepMC (status 2 particle not decayed), chain rejected!");
447 return;
448 }
449 }
450 auto firstChild = mother->end_vertex()->particles_out().begin();
451 auto lastChild = mother->end_vertex()->particles_out().end();
452
453 int childCnt = 0;
454 std::string childIDStr;
455 if( !( treeIDStr=="" ) ) treeIDStr = treeIDStr + ".";
456
457 // ** Find out whether particle is child of final (non-excited) B, used for cuts **
458 if( (!fromFinalB) && (MC::isBottomMeson(pID) || MC::isBottomBaryon(pID)) )
459 {
460 fromFinalB = true;
461 int pID{};
462 for (auto thisChild = firstChild; thisChild != lastChild; ++thisChild)
463 {
464 pID = (*thisChild)->pdg_id();
465 if( MC::isBottomMeson(pID) || MC::isBottomBaryon(pID) ) fromFinalB = false;
466 }
467 }
468
469 // ** Main loop: iterate over all children, call method recursively.
470 //Note: Iterators changed between HEPMC v2 and HEPMC v3; the previous version
471 //was a custom iterator which could be incremented indefinitely, always returning
472 //'end' when necessary. In HEPMC v3, these are standard library iterators
473 for (auto thisChild = firstChild; thisChild != lastChild; ++thisChild)
474 {
475 childCnt++;
476 std::stringstream childCntSS; childCntSS << childCnt;
477 childIDStr = treeIDStr + childCntSS.str();
478 PrintChild( (*thisChild), childIDStr, fromFinalB );
479 FindAllChildren( (*thisChild),childIDStr,fromFinalB,foundSignal,passedAllCuts,p1,p2,(pID==m_B_pdgid) || fromSelectedB,total_4mom);
480 }
481
482 return;
483
484}
void PrintChild(const HepMC::ConstGenParticlePtr &child, const std::string &treeIDStr, const bool fromFinalB) const
bool isDecayed(const T &p)
Identify if the particle decayed.

◆ initialize()

StatusCode GenFilter::initialize ( )
virtualinherited

Reimplemented from GenBase.

Definition at line 18 of file GenFilter.cxx.

18 {
20 m_nPass = 0;
21 m_nFail = 0;
23 return StatusCode::SUCCESS;
24}
virtual StatusCode initialize() override
Definition GenBase.cxx:17
virtual StatusCode filterInitialize()
Definition GenFilter.h:45

◆ 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 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ keepAll()

bool GenFilter::keepAll ( ) const
inlineinherited

Definition at line 55 of file GenFilter.h.

55{return m_keepAll; }

◆ LVL1_Mu_Trigger()

bool BSignalFilter::LVL1_Mu_Trigger ( const HepMC::ConstGenParticlePtr & child) const
private

Definition at line 374 of file BSignalFilter.cxx.

375{
376 bool accept = false;
377 int pID = child->pdg_id();
378 double myPT = child->momentum().perp();
379 double myEta = child->momentum().pseudoRapidity();
380
381 if ( (std::abs(pID) == 13) && m_localLVL1MuonCutOn )
382 accept = test_cuts( myPT, m_localLVL1MuonCutPT, myEta, m_localLVL1MuonCutEta );
383
384 return accept;
385
386}

◆ LVL2_eMu_Trigger()

bool BSignalFilter::LVL2_eMu_Trigger ( const HepMC::ConstGenParticlePtr & child) const
private

Definition at line 389 of file BSignalFilter.cxx.

390{
391 bool accept = false;
392 int pID = child->pdg_id();
393 double myPT = child->momentum().perp();
394 double myEta = child->momentum().pseudoRapidity();
395
396 if ( (std::abs(pID) == 11) && m_localLVL2ElectronCutOn )
397 accept = test_cuts( myPT, m_localLVL2ElectronCutPT, myEta, m_localLVL2ElectronCutEta );
398 if ( (std::abs(pID) == 13) && m_localLVL2MuonCutOn )
399 accept = test_cuts( myPT, m_localLVL2MuonCutPT, myEta, m_localLVL2MuonCutEta );
400
401 return accept;
402}

◆ 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 }

◆ nFailed()

int GenFilter::nFailed ( ) const
inlineinherited

Definition at line 53 of file GenFilter.h.

53{ return m_nFail; }

◆ nNeeded()

int GenFilter::nNeeded ( ) const
inlineinherited

Definition at line 54 of file GenFilter.h.

54{ return m_nNeeded; }

◆ nPassed()

int GenFilter::nPassed ( ) const
inlineinherited

Definition at line 52 of file GenFilter.h.

52{ return m_nPass; }

◆ 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.

◆ PrintChild()

void BSignalFilter::PrintChild ( const HepMC::ConstGenParticlePtr & child,
const std::string & treeIDStr,
const bool fromFinalB ) const
private

Definition at line 620 of file BSignalFilter.cxx.

622{
623 int pID = child->pdg_id();
624 // ** Find name **
625 const auto pData = m_gendata->particleName(std::abs(pID));
626 std::string pName = "unknown particle";
627 if (pData) pName = ((pID < 0) ? std::string("anti - ") : std::string("")) + *pData;
628 ATH_MSG_DEBUG(" " << treeIDStr << " " << "Child (" << pName
629 << ") " << child<<" , from final B = " << fromFinalB);
630
631 return;
632}
STL class.
STL namespace.

◆ 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 }

◆ 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 }

◆ 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}
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.

◆ test_cuts()

bool BSignalFilter::test_cuts ( const double myPT,
const double testPT,
const double myEta,
const double testEta ) const
private

Definition at line 368 of file BSignalFilter.cxx.

369{
370 return ( (myPT >= testPT) && (std::abs(myEta) <= testEta) );
371}

◆ 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_B_pdgid

int BSignalFilter::m_B_pdgid
private

Definition at line 56 of file BSignalFilter.h.

◆ m_cuts_f_e_eta

double BSignalFilter::m_cuts_f_e_eta
private

Definition at line 47 of file BSignalFilter.h.

◆ m_cuts_f_e_on

bool BSignalFilter::m_cuts_f_e_on
private

Definition at line 40 of file BSignalFilter.h.

◆ m_cuts_f_e_pT

double BSignalFilter::m_cuts_f_e_pT
private

Definition at line 45 of file BSignalFilter.h.

◆ m_cuts_f_gam_eta

double BSignalFilter::m_cuts_f_gam_eta
private

Definition at line 48 of file BSignalFilter.h.

◆ m_cuts_f_gam_on

bool BSignalFilter::m_cuts_f_gam_on
private

Definition at line 41 of file BSignalFilter.h.

◆ m_cuts_f_gam_pT

double BSignalFilter::m_cuts_f_gam_pT
private

Definition at line 46 of file BSignalFilter.h.

◆ m_cuts_f_had_eta

double BSignalFilter::m_cuts_f_had_eta
private

Definition at line 47 of file BSignalFilter.h.

◆ m_cuts_f_had_on

bool BSignalFilter::m_cuts_f_had_on
private

Definition at line 40 of file BSignalFilter.h.

◆ m_cuts_f_had_pT

double BSignalFilter::m_cuts_f_had_pT
private

Definition at line 45 of file BSignalFilter.h.

◆ m_cuts_f_K0_eta

double BSignalFilter::m_cuts_f_K0_eta
private

Definition at line 48 of file BSignalFilter.h.

◆ m_cuts_f_K0_on

bool BSignalFilter::m_cuts_f_K0_on
private

Definition at line 41 of file BSignalFilter.h.

◆ m_cuts_f_K0_pT

double BSignalFilter::m_cuts_f_K0_pT
private

Definition at line 46 of file BSignalFilter.h.

◆ m_cuts_f_mu_eta

double BSignalFilter::m_cuts_f_mu_eta
private

Definition at line 47 of file BSignalFilter.h.

◆ m_cuts_f_mu_on

bool BSignalFilter::m_cuts_f_mu_on
private

Definition at line 40 of file BSignalFilter.h.

◆ m_cuts_f_mu_pT

double BSignalFilter::m_cuts_f_mu_pT
private

Definition at line 45 of file BSignalFilter.h.

◆ 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_EventCnt

int BSignalFilter::m_EventCnt
private

Definition at line 62 of file BSignalFilter.h.

◆ 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_gendata

std::shared_ptr<GenData> BSignalFilter::m_gendata {nullptr}
private

Definition at line 85 of file BSignalFilter.h.

85{nullptr};

◆ m_InvMass_PartFakeMass1

double BSignalFilter::m_InvMass_PartFakeMass1
private

Definition at line 58 of file BSignalFilter.h.

◆ m_InvMass_PartFakeMass2

double BSignalFilter::m_InvMass_PartFakeMass2
private

Definition at line 58 of file BSignalFilter.h.

◆ m_InvMass_PartId1

int BSignalFilter::m_InvMass_PartId1
private

Definition at line 57 of file BSignalFilter.h.

◆ m_InvMass_PartId2

int BSignalFilter::m_InvMass_PartId2
private

Definition at line 57 of file BSignalFilter.h.

◆ m_InvMass_switch

bool BSignalFilter::m_InvMass_switch
private

Definition at line 44 of file BSignalFilter.h.

◆ m_InvMassMax

double BSignalFilter::m_InvMassMax
private

Definition at line 59 of file BSignalFilter.h.

◆ m_InvMassMin

double BSignalFilter::m_InvMassMin
private

Definition at line 59 of file BSignalFilter.h.

◆ m_keepAll

bool GenFilter::m_keepAll
protectedinherited

Definition at line 66 of file GenFilter.h.

◆ m_localLVL1MuonCutEta

double BSignalFilter::m_localLVL1MuonCutEta
private

Definition at line 49 of file BSignalFilter.h.

◆ m_localLVL1MuonCutOn

bool BSignalFilter::m_localLVL1MuonCutOn
private

Definition at line 42 of file BSignalFilter.h.

◆ m_localLVL1MuonCutPT

double BSignalFilter::m_localLVL1MuonCutPT
private

Definition at line 49 of file BSignalFilter.h.

◆ m_localLVL2ElectronCutEta

double BSignalFilter::m_localLVL2ElectronCutEta
private

Definition at line 51 of file BSignalFilter.h.

◆ m_localLVL2ElectronCutOn

bool BSignalFilter::m_localLVL2ElectronCutOn
private

Definition at line 43 of file BSignalFilter.h.

◆ m_localLVL2ElectronCutPT

double BSignalFilter::m_localLVL2ElectronCutPT
private

Definition at line 50 of file BSignalFilter.h.

◆ m_localLVL2MuonCutEta

double BSignalFilter::m_localLVL2MuonCutEta
private

Definition at line 50 of file BSignalFilter.h.

◆ m_localLVL2MuonCutOn

bool BSignalFilter::m_localLVL2MuonCutOn
private

Definition at line 42 of file BSignalFilter.h.

◆ m_localLVL2MuonCutPT

double BSignalFilter::m_localLVL2MuonCutPT
private

Definition at line 49 of file BSignalFilter.h.

◆ m_LVL1Counter

double BSignalFilter::m_LVL1Counter
private

Definition at line 52 of file BSignalFilter.h.

◆ m_LVL2Counter

double BSignalFilter::m_LVL2Counter
private

Definition at line 53 of file BSignalFilter.h.

◆ m_mcEventKey

std::string GenBase::m_mcEventKey {}
protectedinherited

StoreGate key for the MC event collection (defaults to GEN_EVENT).

Definition at line 108 of file GenBase.h.

108{};

◆ m_mcevents_const

SG::ReadHandleKey<McEventCollection> GenBase::m_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
privateinherited

Const handle to the MC event collection.

Definition at line 117 of file GenBase.h.

117{ this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" };

◆ m_mkMcEvent

BooleanProperty GenBase::m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
protectedinherited

Flag to determine if a new MC event collection should be made if it doesn't exist.

Definition at line 110 of file GenBase.h.

110{this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"};

◆ m_nFail

int GenFilter::m_nFail
protectedinherited

Definition at line 64 of file GenFilter.h.

◆ m_nNeeded

int GenFilter::m_nNeeded
protectedinherited

Definition at line 65 of file GenFilter.h.

◆ m_nPass

int GenFilter::m_nPass
protectedinherited

Definition at line 63 of file GenFilter.h.

◆ m_rejectedAll

double BSignalFilter::m_rejectedAll
private

Definition at line 55 of file BSignalFilter.h.

◆ m_rejectedTrigger

double BSignalFilter::m_rejectedTrigger
private

Definition at line 54 of file BSignalFilter.h.

◆ m_TotalInvMass_switch

bool BSignalFilter::m_TotalInvMass_switch
private

Definition at line 44 of file BSignalFilter.h.

◆ m_TotalInvMassMax

double BSignalFilter::m_TotalInvMassMax
private

Definition at line 60 of file BSignalFilter.h.

◆ m_TotalInvMassMin

double BSignalFilter::m_TotalInvMassMin
private

Definition at line 60 of file BSignalFilter.h.

◆ 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: