88 constexpr
static float xmin_ = -30;
89 constexpr
static float xmax_ = +30;
109 : hepmcToken_(consumes<edm::
HepMCProduct>(iConfig.getParameter<edm::
InputTag>(
"HepMCInputTag"))),
113 iConfig.getParameter<edm::
InputTag>(
"L1TrackInputTag"))),
135 produces<TkPrimaryVertexCollection>();
151 auto result = std::make_unique<TkPrimaryVertexCollection>();
169 const double mm = 0.1;
170 float zvtx_gen = -999;
176 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
178 bool hasParentVertex =
false;
181 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
184 if ((*iparent)->production_vertex()) {
185 hasParentVertex =
true;
193 HepMC::FourVector pos = (*ivertex)->position();
194 zvtx_gen = pos.z() * mm;
198 }
else if (GenParticleHandle.
isValid()) {
199 for (
const auto& genpart : *GenParticleHandle) {
200 int status = genpart.status();
203 if (genpart.numberOfMothers() == 0)
205 float part_zvertex = genpart.vz();
206 zvtx_gen = part_zvertex;
211 <<
"\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) "
212 <<
"\nbut the input file contains neither edm::HepMCProduct> nor vector<reco::GenParticle>. Exit"
218 result->push_back(genvtx);
226 if (!L1TTTrackHandle.isValid()) {
228 <<
"\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl;
232 for (
const auto&
track : *L1TTTrackHandle) {
233 float z =
track.POCA().z();
235 float pt =
track.momentum().perp();
262 theStubs =
track.getStubRefs();
264 int tmp_trk_nstub = (int)theStubs.size();
265 if (tmp_trk_nstub < 0) {
267 <<
" ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl;
272 for (
const auto& stub : theStubs) {
275 DetId detId(stub->getDetId());
291 int trk_nstub = (int)
track.getStubRefs().size();
292 float chi2dof = chi2 / (2 * trk_nstub - 4);
295 float trk_consistency =
track.stubPtConsistency();
296 if (trk_nstub == 4) {
297 if (
std::abs(eta) < 2.2 && trk_consistency > 10)
299 else if (
std::abs(eta) > 2.2 && chi2dof > 5.0)
309 htmp_weight.Fill(z, wt);
318 int nb = htmp.GetNbinsX();
319 std::vector<int>
found;
321 for (
int ivtx = 0; ivtx <
nVtx_; ivtx++) {
325 for (
int i = 2;
i <= nb - 1;
i++) {
326 float a0 = htmp_weight.GetBinContent(
i - 1);
327 float a1 = htmp_weight.GetBinContent(
i);
328 float a2 = htmp_weight.GetBinContent(
i + 1);
329 float sigma = a0 + a1 +
a2;
333 float z0 = htmp_weight.GetBinCenter(
i - 1);
334 float z1 = htmp_weight.GetBinCenter(
i);
335 float z2 = htmp_weight.GetBinCenter(
i + 1);
336 zvtx_sliding = (a0 * z0 + a1 * z1 + a2 * z2) / sigma;
339 found.push_back(imax);
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~L1TkFastVertexProducer() override
#define DEFINE_FWK_MODULE(type)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static constexpr float xmin_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
L1TkFastVertexProducer(const edm::ParameterSet &)
bool getData(T &iHolder) const
float trkChi2dofTightChi2_
void addDefault(ParameterSetDescription const &psetDescription)
Abs< T >::type abs(const T &t)
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
const edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
static constexpr float xmax_
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genparticleToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static constexpr float a0
Class to store the L1 Track Trigger tracks.
T getParameter(std::string const &) const
const edm::EDGetTokenT< edm::HepMCProduct > hepmcToken_
static constexpr auto TID
Power< A, B >::type pow(const A &a, const B &b)
std::vector< L1TTTrackType > L1TTTrackCollectionType