1 |
+ |
#include "TLorentzVector.h" |
2 |
+ |
|
3 |
|
#include "DataFormats/Common/interface/Handle.h" |
4 |
|
#include "DataFormats/Common/interface/TriggerResults.h" |
5 |
|
#include "DataFormats/Common/interface/HLTenums.h" |
40 |
|
|
41 |
|
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h" |
42 |
|
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" |
43 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" |
44 |
|
|
45 |
|
#include "FWCore/ServiceRegistry/interface/Service.h" |
46 |
|
#include "FWCore/Framework/interface/Run.h" |
194 |
|
<< simVC.at(0).position().z() << ")" << std::endl; |
195 |
|
*/ |
196 |
|
|
197 |
+ |
//used in jet method.... |
198 |
+ |
edm::Handle<reco::GenParticleCollection> lGenParticles; |
199 |
+ |
|
200 |
|
if (!processData_) { |
201 |
|
edm::Handle<edm::HepMCProduct> mcProd; |
202 |
|
edm::Handle<GenRunInfoProduct> lRunProd; |
211 |
|
std::cout << "AMM: Collection GenInfoProduct not available! Exception : " << e.what() << ". " << std::endl; |
212 |
|
} |
213 |
|
|
214 |
< |
//HbbGenInfo(mcProd,lRunProd); |
209 |
< |
} |
214 |
> |
HbbGenInfo(mcProd,lRunProd); |
215 |
|
|
216 |
< |
edm::Handle<reco::GenParticleCollection> lGenParticles; |
217 |
< |
try { |
218 |
< |
aEvt.getByLabel(genParticleSrc_,lGenParticles); |
219 |
< |
if (debug_) std::cout << "** ngenParticles = " << lGenParticles->size() << std::endl; |
220 |
< |
} catch(cms::Exception& e) { |
221 |
< |
if (!processData_) std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
217 |
< |
} |
216 |
> |
edm::Handle<LHEEventProduct> lLHEEvt; |
217 |
> |
try { |
218 |
> |
aEvt.getByType(lLHEEvt); |
219 |
> |
} catch(cms::Exception& e) { |
220 |
> |
std::cout << "AMM: Collection of LHEEventProduct not available! Exception : " << e.what() << ". " << std::endl; |
221 |
> |
} |
222 |
|
|
223 |
< |
if (doGen_ && !processData_) HbbParticles(lGenParticles,event_->particles()); |
223 |
> |
HbbLHEInfo(lLHEEvt,event_->lheParticles()); |
224 |
|
|
225 |
< |
unsigned int lNPartons = 0; |
226 |
< |
if (!processData_) lNPartons = jetFlav_.fillPartons(lGenParticles); |
227 |
< |
|
228 |
< |
if (debug_ && !processData_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
225 |
> |
try { |
226 |
> |
aEvt.getByLabel(genParticleSrc_,lGenParticles); |
227 |
> |
if (debug_) std::cout << "** ngenParticles = " << lGenParticles->size() << std::endl; |
228 |
> |
} catch(cms::Exception& e) { |
229 |
> |
std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
230 |
> |
} |
231 |
|
|
232 |
+ |
if (doGen_) HbbParticles(lGenParticles,event_->particles()); |
233 |
+ |
|
234 |
+ |
unsigned int lNPartons = 0; |
235 |
+ |
lNPartons = jetFlav_.fillPartons(lGenParticles); |
236 |
+ |
|
237 |
+ |
if (debug_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
238 |
+ |
} |
239 |
|
|
240 |
|
edm::Handle<std::vector<reco::Vertex> > lRecoVertices; |
241 |
|
try { |
1839 |
|
event_->generatorInfo(lInfo); |
1840 |
|
|
1841 |
|
} |
1842 |
+ |
|
1843 |
+ |
void HbbTreeMaker::HbbLHEInfo(const edm::Handle<LHEEventProduct> & aLHEEvt, |
1844 |
+ |
std::vector<HbbAnalysis::GenParticle> & aVec) { |
1845 |
+ |
|
1846 |
+ |
const lhef::HEPEUP lhepeup = aLHEEvt->hepeup(); |
1847 |
|
|
1848 |
+ |
//4-momentum (px,py,pz,E)+mass |
1849 |
+ |
const std::vector<lhef::HEPEUP::FiveVector> lpup = lhepeup.PUP; |
1850 |
+ |
//pdgid int |
1851 |
+ |
const std::vector<int> lidup = lhepeup.IDUP; |
1852 |
+ |
//status int |
1853 |
+ |
const std::vector<int> listup = lhepeup.ISTUP; |
1854 |
+ |
//mother: pair<int,int> |
1855 |
+ |
const std::vector<std::pair<int,int> > lmothup = lhepeup.MOTHUP; |
1856 |
+ |
|
1857 |
+ |
|
1858 |
+ |
//add genParticle inside vector |
1859 |
+ |
for (unsigned int imc = 0;imc<lpup.size();++imc) |
1860 |
+ |
{//loop on particles |
1861 |
+ |
|
1862 |
+ |
HbbAnalysis::MCVars lMC; |
1863 |
+ |
lMC.index = imc; |
1864 |
+ |
lMC.E = (lpup[imc])[3]; |
1865 |
+ |
|
1866 |
+ |
TLorentzVector lVec((lpup[imc])[0],(lpup[imc])[1],(lpup[imc])[2],(lpup[imc])[3]); |
1867 |
+ |
|
1868 |
+ |
lMC.pT = lVec.Pt(); |
1869 |
+ |
lMC.eta = lVec.Eta(); |
1870 |
+ |
lMC.y = lVec.Rapidity(); |
1871 |
+ |
lMC.phi = lVec.Phi(); |
1872 |
+ |
lMC.pdgId = lidup[imc]; |
1873 |
+ |
lMC.status = listup[imc]; |
1874 |
+ |
|
1875 |
+ |
HbbAnalysis::GenParticle lObj(lMC); |
1876 |
+ |
lObj.setParent(lmothup[imc].first); |
1877 |
+ |
lObj.setParent(lmothup[imc].second); |
1878 |
+ |
aVec.push_back(lObj); |
1879 |
+ |
|
1880 |
+ |
}//loop on particles |
1881 |
+ |
|
1882 |
+ |
if (debug_>1){ |
1883 |
+ |
for (unsigned int imc(0); imc < aVec.size(); ++imc){ |
1884 |
+ |
HbbAnalysis::GenParticle & p = aVec.at(imc); |
1885 |
+ |
p.print(); |
1886 |
+ |
} |
1887 |
+ |
} |
1888 |
+ |
} |
1889 |
+ |
|
1890 |
|
#include "FWCore/Framework/interface/MakerMacros.h" |
1891 |
|
DEFINE_FWK_MODULE(HbbTreeMaker); |
1892 |
|
|