Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "GeneratorInterface/GenFilters/interface/HerwigMaxPtPartonFilter.h"
00039 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00040
00041 #include <math.h>
00042
00043 using namespace edm;
00044 using namespace std;
00045
00046 HerwigMaxPtPartonFilter::HerwigMaxPtPartonFilter(const edm::ParameterSet& iConfig) :
00047 label_(iConfig.getUntrackedParameter("moduleLabel",std::string("generator"))),
00048 minptcut(iConfig.getUntrackedParameter("MinPt", 0.)),
00049 maxptcut(iConfig.getUntrackedParameter("MaxPt", 10000.)),
00050 processID(iConfig.getUntrackedParameter("ProcessID", 0)){
00051
00052
00053
00054 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);
00055
00056 }
00057
00058
00059 HerwigMaxPtPartonFilter::~HerwigMaxPtPartonFilter(){
00060
00061
00062
00063
00064 if(hFSPartons_JS_PtWgting) delete hFSPartons_JS_PtWgting;
00065
00066 }
00067
00068
00069
00070
00071
00072
00073
00074 bool HerwigMaxPtPartonFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup){
00075
00076
00077 hFSPartons_JS_PtWgting->Reset();
00078
00079 bool accepted = false;
00080 bool isFSQuark = false;
00081 double maxPartonPt=0.0;
00082
00083
00084
00085 int pos1stCluster=0;
00086
00087
00088 long counter = 0;
00089
00090 Handle<HepMCProduct> evt;
00091 iEvent.getByLabel(label_, evt);
00092
00093 const HepMC::GenEvent * myGenEvent = evt->GetEvent();
00094
00095
00096 if(processID == 0 || processID == myGenEvent->signal_process_id()) {
00097
00098
00099 for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();p != myGenEvent->particles_end(); ++p ) {
00100 if(abs((*p)->pdg_id())==91){
00101 break;
00102 }
00103 pos1stCluster++;
00104 }
00105
00106
00107 for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();p != myGenEvent->particles_end(); ++p ) {
00108
00109 if((*p)->momentum().perp()>1.0){
00110
00111 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){
00112 if( counter<pos1stCluster && ((*p)->status()==158 || (*p)->status()==159) ){
00113 isFSQuark=true;
00114 }
00115 }
00116 }
00117
00118 if(isFSQuark){
00119 hFSPartons_JS_PtWgting->Fill( (*p)->momentum().eta(), (*p)->momentum().phi(), (*p)->momentum().perp());
00120 }
00121
00122 counter++;
00123 isFSQuark=false;
00124 }
00125
00126 maxPartonPt=hFSPartons_JS_PtWgting->GetMaximum();
00127
00128
00129 if(maxPartonPt>=minptcut && maxPartonPt<maxptcut){
00130 accepted=true;
00131
00132 }
00133 }
00134
00135 else{ accepted = true; }
00136
00137 if (accepted){return true; }
00138 else {return false;}
00139 }