62 void endJob()
override;
113 iConfig.getParameter<
edm::
InputTag>(
"L1TrackInputTag"))) {
138 produces<TkPrimaryVertexCollection>();
174 const double mm = 0.1;
175 float zvtx_gen = -999;
181 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
183 bool hasParentVertex =
false;
186 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
189 if ((*iparent)->production_vertex()) {
190 hasParentVertex =
true;
198 HepMC::FourVector
pos = (*ivertex)->position();
199 zvtx_gen =
pos.z() * mm;
203 }
else if (GenParticleHandle.
isValid()) {
204 std::vector<reco::GenParticle>::const_iterator genpartIter;
205 for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) {
206 int status = genpartIter->status();
209 if (genpartIter->numberOfMothers() == 0)
211 float part_zvertex = genpartIter->vz();
212 zvtx_gen = part_zvertex;
217 <<
"\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) "
218 <<
"\nbut the input file contains neither edm::HepMCProduct> nor vector<reco::GenParticle>. Exit"
226 result->push_back(genvtx);
234 if (!L1TTTrackHandle.
isValid()) {
236 <<
"\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl;
240 L1TTTrackCollectionType::const_iterator trackIter;
241 for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) {
242 float z = trackIter->POCA().z();
243 float chi2 = trackIter->chi2();
244 float pt = trackIter->momentum().perp();
245 float eta = trackIter->momentum().eta();
271 theStubs = trackIter->getStubRefs();
273 int tmp_trk_nstub = (
int)theStubs.size();
274 if (tmp_trk_nstub < 0) {
276 <<
" ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl;
281 for (
unsigned int istub = 0; istub < (
unsigned int)theStubs.size(); istub++) {
284 DetId detId(theStubs.at(istub)->getDetId());
300 int trk_nstub = (
int)trackIter->getStubRefs().size();
301 float chi2dof =
chi2 / (2 * trk_nstub - 4);
304 float trk_consistency = trackIter->stubPtConsistency();
307 if (trk_nstub == 4) {
315 if (
pt > 10.0 && chi2dof > 5.0)
326 float zvtx_sliding = -999;
327 float sigma_max = -999;
328 int nb =
htmp_->GetNbinsX();
329 for (
int i = 2;
i <= nb - 1;
i++) {
330 float a0 =
htmp_->GetBinContent(
i - 1);
331 float a1 =
htmp_->GetBinContent(
i);
332 float a2 =
htmp_->GetBinContent(
i + 1);
333 float sigma =
a0 + a1 +
a2;
334 if (sigma > sigma_max) {
336 float z0 =
htmp_->GetBinCenter(
i - 1);
337 float z1 =
htmp_->GetBinCenter(
i);
338 float z2 =
htmp_->GetBinCenter(
i + 1);
339 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;
345 for (
int i = 2;
i <= nb - 1;
i++) {
349 float sigma =
a0 + a1 +
a2;
350 if (sigma > sigma_max) {
355 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;