85 constexpr
static float xmin_ = -30;
86 constexpr
static float xmax_ = +30;
110 iConfig.getParameter<
edm::
InputTag>(
"L1TrackInputTag"))),
129 produces<TkPrimaryVertexCollection>();
145 auto result = std::make_unique<TkPrimaryVertexCollection>();
164 const double mm = 0.1;
165 float zvtx_gen = -999;
171 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
173 bool hasParentVertex =
false;
176 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
179 if ((*iparent)->production_vertex()) {
180 hasParentVertex =
true;
188 HepMC::FourVector
pos = (*ivertex)->position();
189 zvtx_gen =
pos.z() * mm;
193 }
else if (GenParticleHandle.
isValid()) {
194 for (
const auto& genpart : *GenParticleHandle) {
195 int status = genpart.status();
198 if (genpart.numberOfMothers() == 0)
200 float part_zvertex = genpart.vz();
201 zvtx_gen = part_zvertex;
206 <<
"\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) "
207 <<
"\nbut the input file contains neither edm::HepMCProduct> nor vector<reco::GenParticle>. Exit"
213 result->push_back(genvtx);
221 if (!L1TTTrackHandle.
isValid()) {
223 <<
"\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl;
227 for (
const auto&
track : *L1TTTrackHandle) {
228 float z =
track.POCA().z();
230 float pt =
track.momentum().perp();
257 theStubs =
track.getStubRefs();
259 int tmp_trk_nstub = (
int)theStubs.size();
260 if (tmp_trk_nstub < 0) {
262 <<
" ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl;
267 for (
const auto& stub : theStubs) {
270 DetId detId(stub->getDetId());
286 int trk_nstub = (
int)
track.getStubRefs().size();
287 float chi2dof =
chi2 / (2 * trk_nstub - 4);
290 float trk_consistency =
track.stubPtConsistency();
291 if (trk_nstub == 4) {
299 if (
pt > 10.0 && chi2dof > 5.0)
304 htmp_weight.Fill(
z, wt);
310 float zvtx_sliding = -999;
311 float sigma_max = -999;
312 int nb = htmp.GetNbinsX();
313 for (
int i = 2;
i <= nb - 1;
i++) {
314 float a0 = htmp.GetBinContent(
i - 1);
315 float a1 = htmp.GetBinContent(
i);
316 float a2 = htmp.GetBinContent(
i + 1);
317 float sigma =
a0 + a1 +
a2;
318 if (sigma > sigma_max) {
320 float z0 = htmp.GetBinCenter(
i - 1);
321 float z1 = htmp.GetBinCenter(
i);
322 float z2 = htmp.GetBinCenter(
i + 1);
323 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;
329 for (
int i = 2;
i <= nb - 1;
i++) {
330 float a0 = htmp_weight.GetBinContent(
i - 1);
331 float a1 = htmp_weight.GetBinContent(
i);
332 float a2 = htmp_weight.GetBinContent(
i + 1);
333 float sigma =
a0 + a1 +
a2;
334 if (sigma > sigma_max) {
336 float z0 = htmp_weight.GetBinCenter(
i - 1);
337 float z1 = htmp_weight.GetBinCenter(
i);
338 float z2 = htmp_weight.GetBinCenter(
i + 1);
339 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;