26 |
|
#include "Geometry/CaloGeometry/interface/CaloGeometry.h" |
27 |
|
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
28 |
|
#include "SimDataFormats/HiGenData/interface/SubEventMap.h" |
29 |
< |
#include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h" |
29 |
> |
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" |
30 |
|
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
31 |
|
#include "FWCore/Framework/interface/ESHandle.h" |
32 |
|
#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" |
83 |
|
fJet->setNPasses (fProtojet.nPasses ()); |
84 |
|
} |
85 |
|
|
86 |
+ |
/* |
87 |
|
void copyConstituents (const JetReco::InputCollection& fConstituents, const reco::GenParticleCollection& fInput, reco::Jet* fJet) { |
88 |
|
// put constituents |
89 |
|
for (unsigned iConstituent = 0; iConstituent < fConstituents.size (); ++iConstituent) { |
90 |
|
fJet->addDaughter (fInput[fConstituents[iConstituent].index ()].sourceCandidatePtr(0)); |
91 |
|
} |
92 |
|
} |
93 |
+ |
*/ |
94 |
|
|
95 |
+ |
void copyConstituents (const JetReco::InputCollection& fConstituents, const edm::View <Candidate>& fInput, reco::Jet* fJet) { |
96 |
+ |
// put constituents |
97 |
+ |
for (unsigned iConstituent = 0; iConstituent < fConstituents.size (); ++iConstituent) { |
98 |
+ |
fJet->addDaughter (fInput.ptrAt (fConstituents[iConstituent].index ())); |
99 |
+ |
} |
100 |
+ |
} |
101 |
+ |
|
102 |
|
} |
103 |
|
|
104 |
|
namespace cms |
106 |
|
// Constructor takes input parameters now: to be replaced with parameter set. |
107 |
|
BaseHiGenJetProducer::BaseHiGenJetProducer(const edm::ParameterSet& conf) |
108 |
|
: mSrc(conf.getParameter<edm::InputTag>( "src")), |
109 |
+ |
mapSrc(conf.getParameter<edm::InputTag>( "srcMap")), |
110 |
|
mJetType (conf.getParameter<string>( "jetType")), |
111 |
|
mVerbose (conf.getUntrackedParameter<bool>("verbose", false)), |
112 |
|
mEtInputCut (conf.getParameter<double>("inputEtMin")), |
137 |
|
{ |
138 |
|
using namespace reco; |
139 |
|
|
140 |
< |
edm::Handle<GenParticleCollection> inputHandle; |
140 |
> |
// edm::Handle<GenParticleCollection> inputHandle; |
141 |
> |
edm::Handle< edm::View<Candidate> > inputHandle; |
142 |
|
e.getByLabel(mSrc,inputHandle); |
143 |
|
|
144 |
+ |
edm::Handle<GenParticleCollection> genparts; |
145 |
+ |
e.getByLabel(mapSrc,genparts); |
146 |
+ |
|
147 |
|
edm::Handle<edm::SubEventMap> subs; |
148 |
< |
e.getByLabel(mSrc,subs); |
148 |
> |
e.getByLabel(mapSrc,subs); |
149 |
|
|
150 |
|
vector <ProtoJet> output; |
151 |
|
vector<JetReco::InputCollection> inputs; |
155 |
|
|
156 |
|
for (unsigned i = 0; i < inputHandle->size(); ++i) { |
157 |
|
|
158 |
< |
const GenParticle & p = (*inputHandle)[i]; |
159 |
< |
if(!selectForJet(p)) continue; |
160 |
< |
int subevent = (*subs)[GenParticleRef(inputHandle,i)]; |
158 |
> |
// const GenParticle & p = (*inputHandle)[i]; |
159 |
> |
// const & p = (*inputHandle)[i]; |
160 |
> |
// if(!selectForJet(p)) continue; |
161 |
> |
// int subevent = (*subs)[GenParticleRef(inputHandle,i)]; |
162 |
> |
// int subevent = (*subs)[((*inputHandle)[i])] |
163 |
> |
// CandidateRef pref(inputHandle.id(),i); |
164 |
> |
// GenParticleRef pref(inputHandle->id(),i,inputHandle->productGetter()); |
165 |
> |
// GenParticleRef pref(genparts,); |
166 |
> |
|
167 |
> |
GenParticleRef pref = inputHandle->refAt(i).castTo<GenParticleRef>(); |
168 |
> |
|
169 |
> |
// int subevent = (*subs)[CandidateRef(inputHandle.id(),i)] |
170 |
> |
int subevent = (*subs)[pref]; |
171 |
|
LogDebug("SubEventJets")<<"inputs size "<<inputs.size()<<" subevent "<<subevent; |
172 |
|
|
173 |
|
if(subevent >= inputs.size()){ |
176 |
|
} |
177 |
|
// cout<<"inputs size "<<inputs.size()<<" subevent "<<subevent<<endl; |
178 |
|
if(nsubparticle[subevent]< nHydro_){ |
179 |
< |
(inputs[subevent]).push_back(JetReco::InputItem(&p,i)); |
179 |
> |
// (inputs[subevent]).push_back(JetReco::InputItem(&p,i)); |
180 |
> |
(inputs[subevent]).push_back(JetReco::InputItem(&((*inputHandle)[i]),i)); |
181 |
|
nsubparticle[subevent]++; |
182 |
|
}else{ |
183 |
|
LogDebug("JetsInHydro")<<"More particles than hydro cut, Sub-Event : "<<subevent; |