CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HerwigMaxPtPartonFilter Class Reference

#include <IOMC/HerwigMaxPtPartonFilter/src/HerwigMaxPtPartonFilter.cc>

Inheritance diagram for HerwigMaxPtPartonFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 HerwigMaxPtPartonFilter (const edm::ParameterSet &)
 
 ~HerwigMaxPtPartonFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

TH2D * hFSPartons_JS_PtWgting
 
double maxptcut
 
double minptcut
 
int processID
 
edm::EDGetTokenT
< edm::HepMCProduct
token_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 46 of file HerwigMaxPtPartonFilter.h.

Constructor & Destructor Documentation

HerwigMaxPtPartonFilter::HerwigMaxPtPartonFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 46 of file HerwigMaxPtPartonFilter.cc.

References hFSPartons_JS_PtWgting, and M_PI.

46  :
47  token_(consumes<edm::HepMCProduct>(iConfig.getUntrackedParameter("moduleLabel",edm::InputTag("generator","unsmeared")))),
48  minptcut(iConfig.getUntrackedParameter("MinPt", 0.)),
49  maxptcut(iConfig.getUntrackedParameter("MaxPt", 10000.)),
50  processID(iConfig.getUntrackedParameter("ProcessID", 0)){
51  //now do what ever initialization is needed
52 
53 
54  hFSPartons_JS_PtWgting = new TH2D("hFSPartons_JS_PtWgting","#phi-#eta Space of FS Partons (p_{T} wgt'ing)",20,-5.205,5.205,32,-M_PI,M_PI);
55 
56 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > token_
#define M_PI
HerwigMaxPtPartonFilter::~HerwigMaxPtPartonFilter ( )

Definition at line 59 of file HerwigMaxPtPartonFilter.cc.

References hFSPartons_JS_PtWgting.

59  {
60 
61  // do anything here that needs to be done at desctruction time
62  // (e.g. close files, deallocate resources etc.)
63 
65 
66 }

Member Function Documentation

bool HerwigMaxPtPartonFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 74 of file HerwigMaxPtPartonFilter.cc.

References funct::abs(), counter, edm::Event::getByToken(), hFSPartons_JS_PtWgting, maxptcut, minptcut, AlCaHLTBitMon_ParallelJobs::p, processID, and token_.

74  {
75 
76  //Histogram, reset each event
77  hFSPartons_JS_PtWgting->Reset();
78 
79  bool accepted = false; //The Accept/Reject Variable
80  bool isFSQuark = false; //Keeps track of whether a particle is a Final State Quark
81  double maxPartonPt=0.0; //Self Explanatory
82 
83  //int ChosenPartonId=0, ChosenPartonSt=0;
84 
85  int pos1stCluster=0; //keeps track of the position of the first herwig cluster in the event
86 
87  //This is when Hadronization within the event occurs.
88  long counter = 0; //keeps track of the particle index in the event
89 
91  iEvent.getByToken(token_, evt);
92 
93  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
94 
95 
96  if(processID == 0 || processID == myGenEvent->signal_process_id()) { //processId if statement
97 
98  //Find the Position of the 1st Herwig Cluster
99  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();p != myGenEvent->particles_end(); ++p ) {
100  if(abs((*p)->pdg_id())==91){
101  break;
102  }
103  pos1stCluster++; //Starts at Zero, like the Collection
104  }
105 
106  //Loop through the all particles in the event
107  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();p != myGenEvent->particles_end(); ++p ) {
108  //"Garbage" Cut, 1 GeV/c Pt Cut on All Particles Considered
109  if((*p)->momentum().perp()>1.0){
110  //Final State Quark criterion
111  if(abs((*p)->pdg_id())==1 || abs((*p)->pdg_id())==2 || abs((*p)->pdg_id())==3 || abs((*p)->pdg_id())==4 || abs((*p)->pdg_id())==5){
112  if( counter<pos1stCluster && ((*p)->status()==158 || (*p)->status()==159) ){
113  isFSQuark=true;
114  }
115  }//end if FS Quark criterion
116  }//End "Garbage" Cut
117 
118  if(isFSQuark){
119  hFSPartons_JS_PtWgting->Fill( (*p)->momentum().eta(), (*p)->momentum().phi(), (*p)->momentum().perp()); //weighted by Particle Pt
120  }
121 
122  counter++;
123  isFSQuark=false;
124  } //end all particles loop
125 
126  maxPartonPt=hFSPartons_JS_PtWgting->GetMaximum();
127 
128  //The Actual Filtering Process
129  if(maxPartonPt>=minptcut && maxPartonPt<maxptcut){
130  accepted=true; //Accept the Event
131 
132  }//End Filtering
133  }//end processId if statement
134 
135  else{ accepted = true; }
136 
137  if (accepted){return true; }
138  else {return false;}
139 }
edm::EDGetTokenT< edm::HepMCProduct > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::atomic< unsigned int > counter

Member Data Documentation

TH2D* HerwigMaxPtPartonFilter::hFSPartons_JS_PtWgting
private
double HerwigMaxPtPartonFilter::maxptcut
private

Definition at line 62 of file HerwigMaxPtPartonFilter.h.

Referenced by filter().

double HerwigMaxPtPartonFilter::minptcut
private

Definition at line 61 of file HerwigMaxPtPartonFilter.h.

Referenced by filter().

int HerwigMaxPtPartonFilter::processID
private

Definition at line 63 of file HerwigMaxPtPartonFilter.h.

Referenced by filter().

edm::EDGetTokenT<edm::HepMCProduct> HerwigMaxPtPartonFilter::token_
private

Definition at line 59 of file HerwigMaxPtPartonFilter.h.

Referenced by filter().