CMS 3D CMS Logo

CSA07EventWeightProducer Class Reference

Author:
Filip Moortgat & Paolo Bartalini
More...

Inheritance diagram for CSA07EventWeightProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CSA07EventWeightProducer (const edm::ParameterSet &)
 constructor

Private Member Functions

int FindIndex (int njet, double pT)
vector< double > GetTTbarCrossSection ()
vector< double > GetTTbarNevents ()
vector< double > GetWCrossSection ()
vector< double > GetWNevents ()
vector< double > GetZCrossSection ()
vector< double > GetZNevents ()
void produce (edm::Event &evt, const edm::EventSetup &es)

Private Attributes

double overallLumi
edm::InputTag src_
vector< double > TTbarCrossSection
vector< double > TTbarNevents
double ttKfactor
bool verbose
vector< double > WCrossSection
vector< double > WNevents
vector< double > ZCrossSection
vector< double > ZNevents


Detailed Description

Author:
Filip Moortgat & Paolo Bartalini

Definition at line 17 of file CSA07EventWeightProducer.cc.


Constructor & Destructor Documentation

CSA07EventWeightProducer::CSA07EventWeightProducer ( const edm::ParameterSet p  ) 

constructor

Definition at line 60 of file CSA07EventWeightProducer.cc.

References GetTTbarCrossSection(), GetTTbarNevents(), GetWCrossSection(), GetWNevents(), GetZCrossSection(), GetZNevents(), TTbarCrossSection, TTbarNevents, WCrossSection, WNevents, ZCrossSection, and ZNevents.

00060                                                                            :
00061   src_( p.getParameter<InputTag>( "src" ) ), verbose ( p.getUntrackedParameter<bool> ("talkToMe", false)),
00062   overallLumi (p.getParameter<double> ("overallLumi")) ,
00063   ttKfactor (p.getParameter<double> ("ttKfactor")) {
00064   produces<double>("weight");
00065   produces<int>("AlpgenProcessID");
00066 
00067   // Read Alpgen Xsections and generated yields
00068   WCrossSection = GetWCrossSection();
00069   ZCrossSection = GetZCrossSection();
00070   TTbarCrossSection = GetTTbarCrossSection();
00071   WNevents = GetWNevents();
00072   ZNevents = GetZNevents();
00073   TTbarNevents = GetTTbarNevents();
00074 
00075 }


Member Function Documentation

int CSA07EventWeightProducer::FindIndex ( int  njet,
double  pT 
) [private]

Definition at line 419 of file CSA07EventWeightProducer.cc.

Referenced by produce().

00419                                                            {
00420   int ipT=-10;
00421   if(njet == 0)       ipT = 6;
00422   else {
00423     if(pT<100.)       ipT = 1;
00424     else if(pT<300.)  ipT = 2;
00425     else if(pT<800.)  ipT = 3;
00426     else if(pT<1600.) ipT = 4;
00427     else if(pT<3200.) ipT = 5;
00428     else if(pT<5000.) ipT = 6;
00429   }
00430   return (njet-1)*6 + ipT;
00431 }

vector< double > CSA07EventWeightProducer::GetTTbarCrossSection (  )  [private]

Definition at line 602 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00602                                                               {
00603   vector<double> vec;
00604   vec.push_back(334.5);
00605   vec.push_back(95.4);
00606   vec.push_back(18.2);
00607   vec.push_back(3.2);
00608   vec.push_back(0.8);
00609   return vec;
00610 }

vector< double > CSA07EventWeightProducer::GetTTbarNevents (  )  [private]

Definition at line 612 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00612                                                          {
00613   vector<double> vec;
00614   vec.push_back(1456646);
00615   vec.push_back(361835);
00616   vec.push_back(81215);
00617   vec.push_back(14036);
00618   vec.push_back(5352);
00619   return vec;
00620 }

vector< double > CSA07EventWeightProducer::GetWCrossSection (  )  [private]

Definition at line 434 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00434                                                           {
00435   vector<double> vec;
00436   // W0jet
00437   vec.push_back(1.51E+04);
00438   // W1jet
00439   vec.push_back(3.08E+03);
00440   vec.push_back(8.55E+01);
00441   vec.push_back(9.72E-01);
00442   vec.push_back(5.29E-03);
00443   vec.push_back(4.46E-05);
00444   vec.push_back(1.91E-08);
00445   // W2jet
00446   vec.push_back(8.46E+02);
00447   vec.push_back(7.50E+01);
00448   vec.push_back(1.35E+00);
00449   vec.push_back(1.05E-02);
00450   vec.push_back(1.01E-04);
00451   vec.push_back(5.59E-08);
00452   // W3jet
00453   vec.push_back(1.96E+02);
00454   vec.push_back(3.58E+01);
00455   vec.push_back(1.02E+00);
00456   vec.push_back(1.00E-02);
00457   vec.push_back(1.16E-04);
00458   vec.push_back(6.63E-08);
00459   // W4jet
00460   vec.push_back(4.12E+01);
00461   vec.push_back(1.26E+01);
00462   vec.push_back(5.21E-01);
00463   vec.push_back(6.27E-03);
00464   vec.push_back(7.47E-05);
00465   vec.push_back(4.13E-08);
00466   // W5jet
00467   vec.push_back(2.81E+01);
00468   vec.push_back(1.32E+01);
00469   vec.push_back(1.01E+00);
00470   vec.push_back(1.97E-02);
00471   vec.push_back(2.48E-04);
00472   vec.push_back(1.10E-07);
00473   return vec;
00474 }

vector< double > CSA07EventWeightProducer::GetWNevents (  )  [private]

Definition at line 518 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00518                                                      {
00519   vector<double> vec;
00520   // W0jet
00521   vec.push_back(8796412);
00522   // W1jet
00523   vec.push_back(9088026);
00524   vec.push_back(247023);
00525   vec.push_back(2.9E+03);
00526   vec.push_back(1.6E+01);
00527   vec.push_back(1.3E-01);
00528   vec.push_back(5.7E-05);
00529   // W2jet
00530   vec.push_back(2380315);
00531   vec.push_back(287472);
00532   vec.push_back(4.0E+03);
00533   vec.push_back(3.2E+01);
00534   vec.push_back(3.0E-01);
00535   vec.push_back(1.7E-04);
00536   // W3jet
00537   vec.push_back(352855);
00538   vec.push_back(117608);
00539   vec.push_back(3.1E+03);
00540   vec.push_back(3.0E+01);
00541   vec.push_back(3.5E-01);
00542   vec.push_back(2.0E-04);
00543   // W4jet
00544   vec.push_back(125849);
00545   vec.push_back(39719);
00546   vec.push_back(1.6E+03);
00547   vec.push_back(1.9E+01);
00548   vec.push_back(2.2E-01);
00549   vec.push_back(1.2E-04);
00550   // W5jet
00551   vec.push_back(62238);
00552   vec.push_back(43865);
00553   vec.push_back(3.0E+03);
00554   vec.push_back(5.9E+01);
00555   vec.push_back(7.4E-01);
00556   vec.push_back(3.3E-04);  
00557   return vec;
00558 }

vector< double > CSA07EventWeightProducer::GetZCrossSection (  )  [private]

Definition at line 476 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00476                                                           {
00477   vector<double> vec;
00478   // Z0jet
00479   vec.push_back(1.5E+03);
00480   // Z1jet
00481   vec.push_back(3.1E+02);
00482   vec.push_back(1.0E+01);
00483   vec.push_back(1.2E-01);
00484   vec.push_back(7.1E-04);
00485   vec.push_back(5.6E-06);
00486   vec.push_back(3.0E-09);
00487   // Z2jet
00488   vec.push_back(9.0E+01);
00489   vec.push_back(9.4E+00);
00490   vec.push_back(1.8E-01);
00491   vec.push_back(1.3E-03);
00492   vec.push_back(1.3E-05);
00493   vec.push_back(7.2E-09);
00494   // Z3jet
00495   vec.push_back(2.3E+01);
00496   vec.push_back(4.3E+00);
00497   vec.push_back(1.3E-01);
00498   vec.push_back(1.3E-03);
00499   vec.push_back(1.4E-05);
00500   vec.push_back(8.4E-09);
00501   // Z4jet
00502   vec.push_back(4.6E+00);
00503   vec.push_back(1.4E+00);
00504   vec.push_back(6.7E-02);
00505   vec.push_back(8.2E-04);
00506   vec.push_back(9.3E-06);
00507   vec.push_back(4.4E-09);
00508   // Z5jet
00509   vec.push_back(2.9E+00);
00510   vec.push_back(1.7E+00);
00511   vec.push_back(1.5E-01);
00512   vec.push_back(2.5E-03);
00513   vec.push_back(3.0E-05);
00514   vec.push_back(1.3E-08);
00515   return vec;
00516 }

vector< double > CSA07EventWeightProducer::GetZNevents (  )  [private]

Definition at line 560 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer().

00560                                                      {
00561   vector<double> vec;
00562   // Z0jet
00563   vec.push_back(3251851);
00564   // Z1jet
00565   vec.push_back(944726);
00566   vec.push_back(36135);
00567   vec.push_back(3.6E+02);
00568   vec.push_back(2.1E+00);
00569   vec.push_back(1.7E-02);
00570   vec.push_back(9.0E-06);
00571   // Z2jet
00572   vec.push_back(289278);
00573   vec.push_back(35285);
00574   vec.push_back(5.5E+02);
00575   vec.push_back(4.0E+00);
00576   vec.push_back(4.0E-02);
00577   vec.push_back(2.2E-05);
00578   // Z3jet
00579   vec.push_back(73182);
00580   vec.push_back(24316);
00581   vec.push_back(4.0E+02);
00582   vec.push_back(3.8E+00);
00583   vec.push_back(4.1E-02);
00584   vec.push_back(2.5E-05);
00585   // Z4jet
00586   vec.push_back(33083);
00587   vec.push_back(6616);
00588   vec.push_back(2.0E+02);
00589   vec.push_back(2.5E+00);
00590   vec.push_back(2.8E-02);
00591   vec.push_back(1.3E-05);
00592   // Z5jet
00593   vec.push_back(12136);
00594   vec.push_back(5966);
00595   vec.push_back(4.5E+02);
00596   vec.push_back(7.4E+00);
00597   vec.push_back(9.1E-02);
00598   vec.push_back(3.9E-05);
00599   return vec;
00600 }

void CSA07EventWeightProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 78 of file CSA07EventWeightProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), FindIndex(), genEventScale_cfi::genEventScale, genParticles_cfi::genParticles, edm::Event::getByLabel(), i, reco::Candidate::mother(), njet, NULL, overallLumi, p, reco::Particle::pdgId(), reco::Particle::pt(), edm::Event::put(), st, reco::Particle::status(), TTbarCrossSection, TTbarNevents, ttKfactor, WCrossSection, weight, WNevents, ZCrossSection, and ZNevents.

00078                                                                          {
00079 
00080   /*
00081     Handle<HepMCProduct> mc;
00082     evt.getByLabel( src_, mc );
00083     const GenEvent * genEvt = mc->GetEvent();
00084     if( genEvt == 0 ) 
00085     throw edm::Exception( edm::errors::InvalidReference) << "HepMC has null pointer to GenEvent" << endl;
00086     Handle<GenInfoProduct> gi;
00087     evt.getRun().getByLabel( src_, gi);
00088   
00089     double processID = genEvt->signal_process_id();
00090     double pthat = genEvt->event_scale(); 
00091     double cross_section = gi->external_cross_section(); // is the one written in the cfg file -- units is pb-1!!
00092     double filter_eff = gi->filter_efficiency();
00093 
00094   */
00095 
00096   Handle<int> genProcessID;
00097   evt.getByLabel( "genEventProcID", genProcessID );
00098   double processID = *genProcessID;
00099  
00100   Handle<double> genEventScale;
00101   evt.getByLabel( "genEventScale", genEventScale );
00102   double pthat = *genEventScale;
00103  
00104  
00105   double filter_eff = -99.;
00106   double cross_section = -99.;
00107  
00108  
00109   if (processID != 4) {
00110    
00111     Handle<double> genFilterEff;
00112     evt.getByLabel( "genEventRunInfo", "FilterEfficiency", genFilterEff);
00113     filter_eff = *genFilterEff;
00114    
00115     Handle<double> genCrossSect;
00116     evt.getByLabel( "genEventRunInfo", "PreCalculatedCrossSection", genCrossSect); 
00117     cross_section = *genCrossSect;
00118     // for the cross section calculated at the end of every run: "genEventRunInfo:AutoCrossSection"
00119    
00120   } 
00121  
00122   // initialize ALPGEN procees id to -1, i.e. no ALPGEN event
00123   // the code will return 
00124   // 1000 + jet multiplicity for W+jets
00125   // 2000 + jet multiplicity for Z+jets
00126   // 3000 + jet multiplicity for ttbar
00127   auto_ptr<int> ALPGENid( new int(-1) );
00128 
00129   // initialize weight to write out 
00130   auto_ptr<double> weight( new double(1) );
00131 
00132   // for calculating below we assume 1 pb-1 and we rescale later
00133  
00134   // the event weight is defined as the effective cross section of a certain process divided by the produced number of events of a this process
00135  
00136   if  (processID != 4){  // the Pythia events (for ALPGEN see below)
00137     // min bias (diffractive part)
00138     if ( (filter_eff == 1.) && ( processID == 92 || processID == 93 || processID == 94 || processID == 95 )) {
00139       (*weight) = 25E+9 / 6.25E+06 ; // number = cross section of these processes (25mb), in pb-1, div by 0.31X20M = 6.25M events
00140     }
00141    
00142     // qcd (including min bias HS)
00143     if ((filter_eff == 1. || filter_eff == 0.964) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53)) {
00144   
00145       if (pthat > 0 && pthat < 15) { (*weight) = 53.0E+9 / (13.75E+06 * 53.0 / 55.0 + 0.75E+06); } //number = cross section in 1 pb-1 div by #events (MB HS+ QCD bin)
00146  
00147       if (pthat > 15 && pthat < 20) { (*weight) =  1.46E+9 / (13.75E+06 * 1.46 / 55.0 + 1.3E+06); } //number = cross section in 1 pb-1 div by #events (MB HS + QCD bin)
00148 
00149       if (pthat > 20 && pthat < 30) { (*weight) =  0.63E+9 / (13.75E+06 * 0.63 / 55.0 + 2.5E+06); } //number = cross section in 1 pb-1 div by #events (MB HS + QCD bin)
00150 
00151       if (pthat > 30 && pthat < 50) { (*weight) =  0.163E+9 / (13.75E+06 * 0.163 / 55.0 + 2.5E+06); } //number = cross section in 1 pb-1 div by #events (MB HS + QCD bin)
00152      
00153       if (pthat > 50 && pthat < 80) { (*weight) =  21.6E+06 / (13.75E+06 * 0.0216 / 55.0 + 2.5E+06); } //number = cross section in 1 pb-1 div by #events (MB HS + QCD bin)
00154      
00155       if (pthat > 80 && pthat < 120) { (*weight) =  3.08E+06 / (13.75E+06 * 0.00308 / 55.0 + 1.18E+06); } //number = cross section in 1 pb-1 div by #events (MB HS + QCD bin)
00156      
00157       if (pthat > 120 && pthat < 170) { (*weight) =  0.494E+06 / (0.96E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00158      
00159       if (pthat > 170 && pthat < 230) { (*weight) =  0.101E+06 / (0.86E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00160      
00161       if (pthat > 230 && pthat < 300) { (*weight) =  24.5E+03 / (0.77E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00162      
00163       if (pthat > 300 && pthat < 380) { (*weight) =  6.24E+03 / (0.77E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00164      
00165       if (pthat > 380 && pthat < 470) { (*weight) =  1.78E+03 / (0.77E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00166      
00167       if (pthat > 470 && pthat < 600) { (*weight) =  0.683E+03 / (0.77E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00168      
00169       if (pthat > 600 && pthat < 800) { (*weight) =  0.204E+03 / (0.6E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00170      
00171       if (pthat > 800 && pthat < 1000) { (*weight) =  35.1E+00 / (0.96E+06); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00172      
00173       if (pthat > 1000 && pthat < 1400) { (*weight) =  10.9E+00 / (1.27E+04); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00174      
00175       if (pthat > 1400 && pthat < 1800) { (*weight) =  1.6E+00 / (1.3E+04); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00176      
00177       if (pthat > 1800 && pthat < 2200) { (*weight) =  0.145E+00 / (3.0E+03); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00178      
00179       if (pthat > 2200 && pthat < 2600) { (*weight) =  23.8E-03 / (4.5E+03); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00180      
00181       if (pthat > 2600 && pthat < 3000) { (*weight) =  4.29E-03 / (6.0E+03); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00182      
00183       if (pthat > 3000 && pthat < 3500) { (*weight) =  0.844E-03 / (6.0E+03); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00184      
00185       if (pthat > 3500) { (*weight) =  0.108E-03 / (1.5E+03); } //number = cross section in 1 pb-1 div by #events (QCD bin). MB negligible
00186     
00187     }
00188   
00189     // muon enriched
00190     if ( (filter_eff == 0.0008) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53 || processID == 95)) {
00191   
00192       (*weight) = cross_section * filter_eff / 20.E+06;  // number  = effective cross section for 1 pb-1 div by 20M 
00193   
00194     } 
00195  
00196     // electron enriched (weights calculated neglecting duplication from bbbar -> e, see below)
00197     if ( (filter_eff == 0.0097) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53 || processID == 95)) {
00198   
00199       (*weight) = cross_section * filter_eff / 8.7E+06 ;  // number  = effective cross section in 1 pb-1 div by 10M 
00200   
00201     } 
00202    
00203     // electron enriched from bbbar 5 < pt_hat < 50
00204     if ( (filter_eff == 0.00019) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53 || processID == 95)) {
00205   
00206       (*weight) = cross_section * filter_eff / 3.E+06 ;  // number  = effective cross section in 1 pb-1 div by 3M 
00207   
00208     } 
00209   
00210     // electron enriched from bbbar 50 < pt_hat < 170
00211     if ( (filter_eff == 0.0068) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53 || processID == 95)) {
00212   
00213       (*weight) = cross_section * filter_eff / 3.E+06 ;  // number  = effective cross section in 1 pb-1 div by 3M 
00214   
00215     } 
00216   
00217     // electron enriched from bbbar 170 < pt_hat
00218     if ( (filter_eff == 0.0195) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53 || processID == 95)) {
00219   
00220       (*weight) = cross_section * filter_eff / 2.6E+06 ;  // number  = effective cross section in 1 pb-1 div by 3M 
00221   
00222     } 
00223  
00224   
00225     // photon + jets
00226     if ( processID == 14 || processID == 18 || processID == 29 || processID == 114 || processID == 115) {
00227   
00228       if (pthat > 0 && pthat < 15) { (*weight) =  cross_section / 0.3E+06;}
00229 
00230       if (pthat > 15 && pthat < 20) { (*weight) =  cross_section / (0.52E+06); } 
00231 
00232       if (pthat > 20 && pthat < 30) { (*weight) =  cross_section / (0.6E+06); } 
00233   
00234       if (pthat > 30 && pthat < 50) { (*weight) =  cross_section / (0.51E+06); } 
00235 
00236       if (pthat > 50 && pthat < 80) { (*weight) =  cross_section / (0.52E+06); } 
00237 
00238       if (pthat > 80 && pthat < 120) { (*weight) =  cross_section / (0.53E+06); } 
00239 
00240       if (pthat > 120 && pthat < 170) { (*weight) =  cross_section / (0.56E+06); } 
00241 
00242       if (pthat > 170 && pthat < 300) { (*weight) =  cross_section / (2.0E+05); } 
00243 
00244       if (pthat > 300 && pthat < 500) { (*weight) =  cross_section / (3.0E+04); } 
00245 
00246       if (pthat > 500 && pthat < 7000) { (*weight) =  cross_section / (3.0E+04); } 
00247 
00248     }
00249   
00250     // Drell-Yan (Pythia branching ratio Z->leptons = 0.107)
00251     if ((filter_eff == 1.000) && (processID == 1 || processID == 15 || processID == 19 || processID == 30 || processID == 35 || processID == 141)) {
00252   
00253       (*weight) = cross_section * filter_eff * 0.107 / 3.E+06 ;  // number  = effective cross section in 1 pb-1 div by 3M 
00254   
00255     } 
00256 
00257     // CharmOnia (Pythia branching ratio J/Psi->2muons = 0.06)
00258     if ((processID > 420 && processID < 440)) {
00259   
00260       (*weight) = cross_section * filter_eff * 0.06 / 1.E+06 ;  // number  = effective cross section in 1 pb-1 div by 1M 
00261   
00262     } 
00263 
00264     // BottomOnia (Pythia branching ratio Y->2muons = 0.025)
00265     if ((processID > 460 && processID < 480)) {
00266   
00267       (*weight) = cross_section * filter_eff * 0.025 / 1.E+06 ;  // number  = effective cross section in 1 pb-1 div by 1M 
00268   
00269     } 
00270    
00271     // B -> J/Psi (branching ratio J/Psi->2muons = 0.06)
00272     // average "weighted" branching ratio pp -> b_hadron -> J/Psi X = 0.1 (guess, to be x-checked)
00273     if ((filter_eff == 0.00013)) {
00274   
00275       (*weight) = cross_section * filter_eff * 0.06 * 0.1 / 0.5E+06 ;  // number  = effective cross section in 1 pb-1 div by 0.5M 
00276   
00277     } 
00278 
00279     // top secret 
00280     if (processID == 102 || processID == 123 || processID == 124) {
00281       (*weight) = cross_section * filter_eff / 45200 ;   
00282     }
00283 
00284     if (processID == 141) {
00285       (*weight) = cross_section * filter_eff / 12300 ;   
00286     }
00287     
00288 
00289 
00290   }  // ALPGEN
00291   else if(processID == 4) { // this is the number for external ALPGEN events
00292 
00293     Handle<CandidateCollection> genParticles;
00294     evt.getByLabel( "genParticleCandidates", genParticles );    
00295     int id_process = -1; // 0 -> W+jets; 1-> Z+jets; 2->ttbar +jets
00296     double pT = 0.;
00297     const Candidate * mother = NULL;
00298     // first loop: which process?
00299     for( size_t i = 0; i < genParticles->size(); ++ i ) {
00300       const Candidate & p = (*genParticles)[ i ];
00301       int id = p.pdgId();
00302       int st = p.status();  
00303       const Candidate * mom = p.mother();
00304       // W+jets
00305       if(st == 3 && (id == 24 || id == -24) ) {
00306         mother = mom;
00307         id_process = 0;
00308         pT = p.pt();
00309         i = genParticles->size()-1; // get out of the loop
00310       }
00311       // Z+jets
00312       if(st == 3 && (id == 23 || id == -23) ) {
00313         mother = mom;
00314         id_process = 1;
00315         pT = p.pt();
00316         i = genParticles->size()-1; // get out of the loop       
00317       }
00318       // tt+jets
00319       if(st == 3 && (id == 6 || id == -6) ) {
00320         mother = mom;
00321         id_process = 2;
00322         i = genParticles->size()-1; // get out of the loop       
00323       }
00324     }
00325     // second loop: Find out  jet multiplicity and get the weight
00326     int njet = 0;
00327     for( size_t i = 0; i < genParticles->size(); ++ i ) {
00328       const Candidate & p = (*genParticles)[ i ];
00329       const Candidate * mom = p.mother();
00330       if (mom == mother) njet++;
00331     }
00332     
00333 
00334     if(id_process == 2) {
00335       njet += -2; // take out the two tops from the counting
00336       (*weight) = TTbarCrossSection[njet]*ttKfactor/TTbarNevents[njet];
00337     } else if(id_process == 0) {
00338       njet += -1;// take out the vector boson
00339       int indSample = FindIndex(njet,pT);
00340       // factor 3 for 3 lepton flavours?
00341       (*weight) = 3 * WCrossSection[indSample]/WNevents[indSample];
00342     } else if(id_process == 1) {
00343       njet += -1;// take out the vector boson
00344       int indSample = FindIndex(njet,pT);
00345       // factor 3 for 3 lepton flavours?
00346       (*weight) = 3 * ZCrossSection[indSample]/ZNevents[indSample];
00347     } // should wemake it crash if the process is not found?
00348 
00349     (*ALPGENid) = (id_process+1)*1000+njet;
00350 
00351     if (verbose) {
00352       if(id_process == 0) { cout << " -- Process: W + " << njet << " jets (with boson Pt = " << pT << ")" << endl;}
00353       if(id_process == 1) { cout << " -- Process: Z + " << njet << " jets (with boson Pt = " << pT << ")" << endl;} 
00354       if(id_process == 2) { cout << " -- Process: tt + " << njet << " jets" << endl;}
00355     }
00356     
00358     //  The code below will be used for unscrewed production //
00360 
00361     /*    
00362     // Get the AlpgenInfoProduct
00363     Handle<AlpgenInfoProduct> alpHandle;
00364     evt.getByLabel( src_, alpHandle);
00365     AlpgenInfoProduct alpInfo = *alpHandle;
00366     //    const AlpgenInfoProduct * alpInfo = alp->GetEvent();
00367     int nParton = alpInfo.nTot()-2; // initial partons taken out
00368     int idP1 = alpInfo.lundOut(0);               // lund ID of the first FS parton
00369     int idPlast   = alpInfo.lundOut(nParton-1);  // lund ID of the last  FS parton
00370     int idPntlast = alpInfo.lundOut(nParton-2);  // lund ID of the second last  FS parton
00371     if(abs(idP1) == 6) { // this is a ttbar events
00372     int njet = nParton-6; // take out the partons of the two t -> W(lnu) b decay chain
00373     (*weight) = TTbarCrossSection[njet]/TTbarNevents[njet];
00374     } else if((abs(idPlast) == 11 && abs(idPntlast) == 12) || // W -> e      nu_e
00375     (abs(idPlast) == 12 && abs(idPntlast) == 11) || // W -> nu_e   e
00376     (abs(idPlast) == 13 && abs(idPntlast) == 14) || // W -> mu     nu_mu
00377     (abs(idPlast) == 14 && abs(idPntlast) == 13) || // W -> nu_mu  mu
00378     (abs(idPlast) == 15 && abs(idPntlast) == 16) || // W -> tau    nu_tau
00379     (abs(idPlast) == 16 && abs(idPntlast) == 15)){  // W -> nu_tau tau
00380     // look for jet multiplicity
00381     int njet = nParton-2; // take out the W decay products
00382     // calculate pT(W)
00383     double pT = sqrt(pow(alpInfo.pxOut(idPlast)+alpInfo.pxOut(idPntlast),2.)+
00384     pow(alpInfo.pyOut(idPlast)+alpInfo.pyOut(idPntlast),2.));
00385     int indSample = FindIndex(njet,pT);
00386     (*weight) = WCrossSection[indSample]/WNevents[indSample];
00387     } else if((abs(idPlast) == 11 && abs(idPntlast) == 11) || // Z -> e      e
00388     (abs(idPlast) == 12 && abs(idPntlast) == 12) || // Z -> nu_e   nu_e
00389     (abs(idPlast) == 13 && abs(idPntlast) == 13) || // Z -> mu     mu
00390     (abs(idPlast) == 14 && abs(idPntlast) == 14) || // Z -> nu_mu  mu_mu
00391     (abs(idPlast) == 15 && abs(idPntlast) == 15) || // Z -> tau    tau
00392     (abs(idPlast) == 16 && abs(idPntlast) == 16)){  // Z -> nu_tau nu_tau
00393     // look for jet multiplicity
00394     int njet = nParton-2; // take out the Z decay products
00395     double pT = sqrt(pow(alpInfo.pxOut(idPlast)+alpInfo.pxOut(idPntlast),2.)+
00396     pow(alpInfo.pyOut(idPlast)+alpInfo.pyOut(idPntlast),2.));
00397     int indSample = FindIndex(njet,pT);
00398     (*weight) = ZCrossSection[indSample]/ZNevents[indSample];
00399     }
00400     */
00401 
00403     //  End of the code for unscrewed production //
00405 
00406   } 
00407   
00408   // renormalize to lumi from cfg
00409   (*weight) = (*weight) * overallLumi ;
00410   
00411   if (verbose) {
00412     cout << " -- Event weight : " << (*weight) << endl; 
00413   }
00414 
00415   evt.put( weight, "weight");
00416   evt.put( ALPGENid, "AlpgenProcessID" );
00417 }


Member Data Documentation

double CSA07EventWeightProducer::overallLumi [private]

Definition at line 26 of file CSA07EventWeightProducer.cc.

Referenced by produce().

edm::InputTag CSA07EventWeightProducer::src_ [private]

Definition at line 24 of file CSA07EventWeightProducer.cc.

vector<double> CSA07EventWeightProducer::TTbarCrossSection [private]

Definition at line 35 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().

vector<double> CSA07EventWeightProducer::TTbarNevents [private]

Definition at line 36 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().

double CSA07EventWeightProducer::ttKfactor [private]

Definition at line 27 of file CSA07EventWeightProducer.cc.

Referenced by produce().

bool CSA07EventWeightProducer::verbose [private]

Definition at line 25 of file CSA07EventWeightProducer.cc.

vector<double> CSA07EventWeightProducer::WCrossSection [private]

Definition at line 31 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().

vector<double> CSA07EventWeightProducer::WNevents [private]

Definition at line 33 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().

vector<double> CSA07EventWeightProducer::ZCrossSection [private]

Definition at line 32 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().

vector<double> CSA07EventWeightProducer::ZNevents [private]

Definition at line 34 of file CSA07EventWeightProducer.cc.

Referenced by CSA07EventWeightProducer(), and produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:17:00 2009 for CMSSW by  doxygen 1.5.4