58 virtual bool HasAdditionalBHadron(
const std::vector<int>&,
const std::vector<int>&,
const std::vector<reco::GenParticle>&,std::vector<const reco::Candidate*>&);
60 virtual std::vector<const reco::Candidate*>
GetTops(
const std::vector<reco::GenParticle> &,std::vector<const reco::Candidate*>& AllTopMothers);
145 std::vector<const reco::Candidate*> AllTopMothers;
146 std::vector<const reco::Candidate*> Tops =
GetTops(*genParticles,AllTopMothers);
148 bool pass =
HasAdditionalBHadron(*genBHadIndex,*genBHadFlavour,*genBHadPlusMothers,AllTopMothers);
150 iEvent.
put(std::make_unique<bool>(pass));
158 for(
unsigned int i=0;
i<genBHadIndex.size();
i++){
160 const reco::GenParticle* bhadron = genBHadIndex[
i]>=0&&genBHadIndex[
i]<
int(genBHadPlusMothers.size()) ? &(genBHadPlusMothers[genBHadIndex[
i]]) :
nullptr;
161 int motherflav = genBHadFlavour[
i];
162 bool from_tth=(
abs(motherflav)==6||
abs(motherflav)==25);
166 if(bhadron!=
nullptr&&!from_tth){
172 if(bhadron!=
nullptr&&!from_tth){
180 if(i==genBHadIndex.size()-1){
194 for(
unsigned int k=0;
k<AllTopMothers.size();
k++){
195 if(particle==AllTopMothers[
k]){
199 bool isFromHardProcess=
false;
203 if(isFromHardProcess){
207 return isFromHardProcess;
214 bool foundTop =
false;
215 bool foundTopBar =
false;
216 std::vector<const reco::GenParticle*> Tops;
222 for(reco::GenParticleCollection::const_iterator i_particle = genParticles.begin(); i_particle != genParticles.end(); ++i_particle){
224 if(!foundTop && thisParticle->
pdgId()==6){
225 firstTop = thisParticle;
231 else if(!foundTopBar && thisParticle->
pdgId()==-6){
232 firstTopBar = thisParticle;
238 if(foundTopBar&&foundTop){
245 return AllTopMothers;
254 AllTopMothers.push_back(particle->
mother(
i));
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genBHadPlusMothersToken_
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
virtual void FindAllTopMothers(const reco::Candidate *particle, std::vector< const reco::Candidate * > &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ttHFGenFilter(const edm::ParameterSet &)
size_t numberOfMothers() const override
number of mothers
virtual bool analyzeMothersRecursive(const reco::Candidate *, std::vector< const reco::Candidate * > &AllTopMothers)
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
void beginStream(edm::StreamID) override
void endStream() override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< std::vector< int > > genBHadFlavourToken_
~ttHFGenFilter() override
virtual int status() const =0
status word
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
const edm::EDGetTokenT< std::vector< std::vector< int > > > genBHadPlusMothersIndicesToken_
virtual int pdgId() const =0
PDG identifier.
const edm::EDGetTokenT< std::vector< int > > genBHadFromTopWeakDecayToken_
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
Abs< T >::type abs(const T &t)
genBHadPlusMothersIndices
const edm::EDGetTokenT< std::vector< int > > genBHadIndexToken_
virtual bool HasAdditionalBHadron(const std::vector< int > &, const std::vector< int > &, const std::vector< reco::GenParticle > &, std::vector< const reco::Candidate * > &)
bool filter(edm::Event &, const edm::EventSetup &) override
virtual std::vector< const reco::Candidate * > GetTops(const std::vector< reco::GenParticle > &, std::vector< const reco::Candidate * > &AllTopMothers)
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
bool OnlyHardProcessBHadrons_