93 |
|
nTrkMin_ = iConfig.getUntrackedParameter<int>("nTrkMin"); |
94 |
|
nTrkMax_ = iConfig.getUntrackedParameter<int>("nTrkMax"); |
95 |
|
zsigncut_ = iConfig.getUntrackedParameter<double>("zsigncut"); |
96 |
+ |
ptcut_ = iConfig.getUntrackedParameter<double>("ptcut"); |
97 |
|
analyze_ = iConfig.getUntrackedParameter<bool>("analyze",false); |
98 |
|
bsSrc = iConfig.getParameter< edm::InputTag >("beamSpot"); |
99 |
|
reqCluster_ = iConfig.getUntrackedParameter<bool>("reqCluster",false); |
146 |
|
// |
147 |
|
// member functions |
148 |
|
// |
149 |
< |
std::vector<PVEffAnalyzer::simPrimaryVertex> PVEffAnalyzer::getSimPVs(const Handle<HepMCProduct> evtMC, std::string suffix="") |
149 |
> |
std::vector<PVEffAnalyzer::simPrimaryVertex> PVEffAnalyzer::getSimPVs(const Handle<HepMCProduct> & evtMC, std::string suffix, double & ptcut_) |
150 |
|
{ |
151 |
|
std::vector<PVEffAnalyzer::simPrimaryVertex> simpv; |
152 |
|
const HepMC::GenEvent* evt=evtMC->GetEvent(); |
233 |
|
vp->ptot.setPz(vp->ptot.pz()+m.pz()); |
234 |
|
vp->ptot.setE(vp->ptot.e()+m.e()); |
235 |
|
vp->ptsq+=(m.perp())*(m.perp()); |
236 |
< |
if ( (m.perp()>0.8) && (fabs(m.pseudoRapidity())<2.5) && isCharged( *daughter ) ){ |
236 |
> |
if ( (m.perp()>ptcut_) && (fabs(m.pseudoRapidity())<2.5) && isCharged( *daughter ) ){ |
237 |
|
vp->nGenTrk++; |
238 |
|
} |
239 |
|
} |
244 |
|
return simpv; |
245 |
|
} |
246 |
|
|
246 |
– |
std::vector<PVEffAnalyzer::simPrimaryVertex> PVEffAnalyzer::getSimPVs(const Handle<HepMCProduct> evtMC, |
247 |
– |
const Handle<SimVertexContainer> simVtxs, |
248 |
– |
const Handle<SimTrackContainer> simTrks) |
249 |
– |
{ |
250 |
– |
// simvertices don't have enough information to decide, |
251 |
– |
// genVertices don't have the simulated coordinates ( with VtxSmeared they might) |
252 |
– |
// go through simtracks to get the link between simulated and generated vertices |
253 |
– |
std::vector<PVEffAnalyzer::simPrimaryVertex> simpv; |
254 |
– |
int idx=0; |
255 |
– |
for(SimTrackContainer::const_iterator t=simTrks->begin(); |
256 |
– |
t!=simTrks->end(); ++t){ |
257 |
– |
if ( !(t->noVertex()) && !(t->type()==-99) ){ |
258 |
– |
double ptsq=0; |
259 |
– |
bool primary=false; // something coming directly from the primary vertex |
260 |
– |
bool resonance=false; // resonance |
261 |
– |
bool track=false; // undecayed, charged particle |
262 |
– |
HepMC::GenParticle* gp=evtMC->GetEvent()->barcode_to_particle( (*t).genpartIndex() ); |
263 |
– |
if (gp) { |
264 |
– |
HepMC::GenVertex * gv=gp->production_vertex(); |
265 |
– |
if (gv) { |
266 |
– |
for ( HepMC::GenVertex::particle_iterator |
267 |
– |
daughter = gv->particles_begin(HepMC::descendants); |
268 |
– |
daughter != gv->particles_end(HepMC::descendants); |
269 |
– |
++daughter ) { |
270 |
– |
if (isFinalstateParticle(*daughter)){ |
271 |
– |
ptsq+=(*daughter)->momentum().perp()*(*daughter)->momentum().perp(); |
272 |
– |
} |
273 |
– |
} |
274 |
– |
//primary = ( gv->position().t()==0 ); |
275 |
– |
primary = true; |
276 |
– |
h_gen->Fill1d("genPart_cT", gv->position().t()); // mm |
277 |
– |
h_gen->Fill1d("genPart_T", gv->position().t()/299.792458); // ns |
278 |
– |
|
279 |
– |
//resonance= ( gp->mother() && isResonance(gp->mother())); // in CLHEP/HepMC days |
280 |
– |
// no more mother pointer in the improved HepMC GenParticle |
281 |
– |
resonance= ( isResonance(*(gp->production_vertex()->particles_in_const_begin()))); |
282 |
– |
if (gp->status()==1){ |
283 |
– |
//track=((pdt->particle(gp->pdg_id()))->charge() != 0); |
284 |
– |
track=not isCharged(gp); |
285 |
– |
} |
286 |
– |
} |
287 |
– |
} |
288 |
– |
|
289 |
– |
const HepMC::FourVector & v=(*simVtxs)[t->vertIndex()].position(); |
290 |
– |
//const HepLorentzVector & v=(*simVtxs)[t->vertIndex()].position(); |
291 |
– |
if(primary or resonance){ |
292 |
– |
{ |
293 |
– |
// check all primaries found so far to avoid multiple entries |
294 |
– |
bool newVertex=true; |
295 |
– |
for(std::vector<PVEffAnalyzer::simPrimaryVertex>::iterator v0=simpv.begin(); |
296 |
– |
v0!=simpv.end(); v0++){ |
297 |
– |
if( (fabs(v0->x-v.x())<0.001) && (fabs(v0->y-v.y())<0.001) && (fabs(v0->z-v.z())<0.001) ){ |
298 |
– |
if (track) { |
299 |
– |
v0->simTrackIndex.push_back(idx); |
300 |
– |
if (ptsq>(*v0).ptsq){(*v0).ptsq=ptsq;} |
301 |
– |
} |
302 |
– |
newVertex=false; |
303 |
– |
} |
304 |
– |
} |
305 |
– |
if(newVertex && !resonance){ |
306 |
– |
PVEffAnalyzer::simPrimaryVertex anotherVertex(v.x(),v.y(),v.z()); |
307 |
– |
if (track) anotherVertex.simTrackIndex.push_back(idx); |
308 |
– |
anotherVertex.ptsq=ptsq; |
309 |
– |
simpv.push_back(anotherVertex); |
310 |
– |
} |
311 |
– |
}// |
312 |
– |
} |
313 |
– |
|
314 |
– |
}// simtrack has vertex and valid type |
315 |
– |
idx++; |
316 |
– |
}//simTrack loop |
317 |
– |
return simpv; |
318 |
– |
} |
319 |
– |
|
247 |
|
// ------------ method called to for each event ------------ |
248 |
|
void |
249 |
|
PVEffAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) |
362 |
|
TString suffix = "_mct"; |
363 |
|
// make a list of primary vertices: |
364 |
|
std::vector<simPrimaryVertex> simpv; |
365 |
< |
simpv=getSimPVs(evtMC,""); |
439 |
< |
// simpv=getSimPVs(evtMC, simVtxs, simTrks); |
365 |
> |
simpv=getSimPVs(evtMC,"",ptcut_); |
366 |
|
h_gen->Fill1d("nsimPV", simpv.size()); |
367 |
|
|
368 |
|
int isimpv = 0; |
396 |
|
bool withValidCluster_tag = false; |
397 |
|
bool withValidCluster_probe = false; |
398 |
|
|
399 |
+ |
|
400 |
|
for (vector< vector<reco::TransientTrack> >::const_iterator iclus = clusters1.begin(); iclus != clusters1.end(); iclus++) { |
401 |
|
if((*iclus).size()>1) withValidCluster_probe = true; |
402 |
|
} |
416 |
|
std::cout<<"splitTrackColl1->size() = " << int(splitTrackColl1->size()) << std::endl; |
417 |
|
std::cout<<"splitTrackColl2->size() = " << int(splitTrackColl2->size()) << std::endl; |
418 |
|
} |
419 |
< |
h_summary->Fill1d("denom_ntrack", int(splitTrackColl1->size())); |
419 |
> |
// the same cut as in the sim->nGenTrk |
420 |
> |
int nGoodTracks = 0; |
421 |
> |
for(reco::TrackCollection::const_iterator track = splitTrackColl1->begin(); |
422 |
> |
track!= splitTrackColl1->end(); ++track) { |
423 |
> |
if(track->pt() > ptcut_ && abs(track->eta()) < 2.5 ) |
424 |
> |
nGoodTracks++; |
425 |
> |
} |
426 |
> |
|
427 |
> |
h_summary->Fill1d("denom_ntrack", nGoodTracks); |
428 |
|
if ( isGoodProbeVertex( *splitVertexColl1->begin(), *vertexColl->begin(), zsigncut_) ) |
429 |
< |
h_summary->Fill1d("numer_ntrack", int(splitTrackColl1->size()) ); |
429 |
> |
h_summary->Fill1d("numer_ntrack", nGoodTracks); |
430 |
|
} |
431 |
|
} |
432 |
|
|
621 |
|
eff->SetBinError(i, error); |
622 |
|
} |
623 |
|
} |
624 |
+ |
|