|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "GaudiKernel/SystemOfUnits.h"
19 #include "TLorentzVector.h"
21 #include "CLHEP/Random/RandomEngine.h"
60 return StatusCode::SUCCESS;
67 return StatusCode::SUCCESS;
72 const EventContext& ctx)
const
76 rngWrapper->
setSeed( rngName, ctx );
82 const EventContext& ctx = Gaudi::Hive::currentContext();
83 CLHEP::HepRandomEngine* rndm = this->
getRandomEngine(
"MultiBjetFilter", ctx);
85 ATH_MSG_WARNING(
"Failed to retrieve random number engine " <<
"MultiBjetFilter");
86 setFilterPassed(
false);
87 return StatusCode::FAILURE;
96 if(
sc.isFailure() || !truthjetTES) {
98 <<
sc.isFailure() <<
" "<< !truthjetTES);
99 return StatusCode::SUCCESS;
103 double lead_jet_pt = 0.0;
106 std::vector<xAOD::JetContainer::const_iterator>
jets,bjets;
107 for(jitr = (*truthjetTES).begin(); jitr !=(*truthjetTES).end(); ++jitr) {
109 if(std::abs((*jitr)->eta()) >
m_jetEtaMax)
continue;
110 if((*jitr)->pt() > lead_jet_pt) lead_jet_pt = (*jitr)->pt();
111 jets.push_back(jitr);
118 int njets =
jets.size();
125 weight = genEvt->weights().front();
128 std::vector<HepMC::ConstGenParticlePtr> bHadrons;
129 for(
const auto& pitr: *genEvt) {
132 if( std::abs( pitr->momentum().pseudoRapidity() ) >
m_bottomEtaMax)
continue;
133 bHadrons.push_back(pitr);
137 for(
uint j = 0; j < bHadrons.size(); j++){
138 HepMC::FourVector
tmp = bHadrons.at(j)->momentum();
143 bjets.push_back(
jets[
i]);
164 double rnd = rndm->flat();
176 for (
unsigned int i=0;
i<mec->
size();++
i) {
177 if ( !(*mec)[
i] )
continue;
178 orig = (*mec)[
i]->weights().
size()>0?(*mec)[
i]->weights()[0]:1.;
179 if ((*mec)[
i]->weights().size()>0) (*mec)[
i]->weights()[0] = orig/
m_inclusiveEff;
187 setFilterPassed(pass);
188 return StatusCode::SUCCESS;
193 int id = std::abs(pID);
def retrieve(aClass, aKey=None)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Const iterator class for DataVector/DataList.
bool isBwithWeakDK(const int pID) const
const McEventCollection * events_const() const
Access the current event's McEventCollection (const)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
double m_SumOfWeights_Evt
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
ServiceHandle< IAthRNGSvc > m_rndmSvc
virtual StatusCode filterFinalize()
virtual ~MultiBjetFilter()
std::string m_TruthJetContainerName
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Base class for event generator filtering modules.
::StatusCode StatusCode
StatusCode definition for legacy code.
Provide simplified clock_gettime() function for MacOSX.
double m_SumOfWeights_Pass
virtual StatusCode filterEvent()
#define CHECK(...)
Evaluate an expression and check for errors.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
virtual StatusCode filterInitialize()
A wrapper class for event-slot-local random engines.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
tuple genpart
Check that the actual generators, tune, and main PDF are consistent with the JO name.
#define ATH_MSG_WARNING(x)
MultiBjetFilter(const std::string &name, ISvcLocator *pSvcLocator)
size_type size() const noexcept
Returns the number of elements in the collection.