82 constexpr
static float xmin_ = -30;
83 constexpr
static float xmax_ = +30;
103 : zMax_((
float)iConfig.getParameter<double>(
"ZMAX")),
104 chi2Max_((
float)iConfig.getParameter<double>(
"CHI2MAX")),
105 pTMinTra_((
float)iConfig.getParameter<double>(
"PTMINTRA")),
106 pTMax_((
float)iConfig.getParameter<double>(
"PTMAX")),
107 highPtTracks_(iConfig.getParameter<
int>(
"HighPtTracks")),
108 nVtx_(iConfig.getParameter<
int>(
"nVtx")),
109 nStubsmin_(iConfig.getParameter<
int>(
"nStubsmin")),
110 nStubsPSmin_(iConfig.getParameter<
int>(
"nStubsPSmin")),
111 nBinning_(iConfig.getParameter<
int>(
"nBinning")),
112 monteCarloVertex_(iConfig.getParameter<
bool>(
"MonteCarloVertex")),
113 doPtComp_(iConfig.getParameter<
bool>(
"doPtComp")),
114 doTightChi2_(iConfig.getParameter<
bool>(
"doTightChi2")),
115 trkPtTightChi2_((
float)iConfig.getParameter<double>(
"trk_ptTightChi2")),
116 trkChi2dofTightChi2_((
float)iConfig.getParameter<double>(
"trk_chi2dofTightChi2")),
117 weight_(iConfig.getParameter<
int>(
"WEIGHT")),
122 iConfig.getParameter<
edm::
InputTag>(
"L1TrackInputTag"))),
124 produces<TkPrimaryVertexCollection>();
140 auto result = std::make_unique<TkPrimaryVertexCollection>();
158 const double mm = 0.1;
159 float zvtx_gen = -999;
165 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
167 bool hasParentVertex =
false;
170 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
173 if ((*iparent)->production_vertex()) {
174 hasParentVertex =
true;
182 HepMC::FourVector
pos = (*ivertex)->position();
183 zvtx_gen =
pos.z() * mm;
187 }
else if (GenParticleHandle.
isValid()) {
188 for (
const auto& genpart : *GenParticleHandle) {
189 int status = genpart.status();
192 if (genpart.numberOfMothers() == 0)
194 float part_zvertex = genpart.vz();
195 zvtx_gen = part_zvertex;
200 <<
"\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) " 201 <<
"\nbut the input file contains neither edm::HepMCProduct> nor vector<reco::GenParticle>. Exit" 207 result->push_back(genvtx);
215 if (!L1TTTrackHandle.
isValid()) {
217 <<
"\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl;
221 for (
const auto&
track : *L1TTTrackHandle) {
222 float z =
track.POCA().z();
224 float pt =
track.momentum().perp();
251 theStubs =
track.getStubRefs();
253 int tmp_trk_nstub = (
int)theStubs.size();
254 if (tmp_trk_nstub < 0) {
256 <<
" ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl;
261 for (
const auto& stub : theStubs) {
264 DetId detId(stub->getDetId());
280 int trk_nstub = (
int)
track.getStubRefs().size();
281 float chi2dof =
chi2 / (2 * trk_nstub - 4);
284 float trk_consistency =
track.stubPtConsistency();
285 if (trk_nstub == 4) {
298 htmp_weight.Fill(
z, wt);
307 int nb = htmp.GetNbinsX();
308 std::vector<int>
found;
310 for (
int ivtx = 0; ivtx <
nVtx_; ivtx++) {
314 for (
int i = 2;
i <= nb - 1;
i++) {
315 float a0 = htmp_weight.GetBinContent(
i - 1);
316 float a1 = htmp_weight.GetBinContent(
i);
317 float a2 = htmp_weight.GetBinContent(
i + 1);
318 float sigma =
a0 + a1 +
a2;
322 float z0 = htmp_weight.GetBinCenter(
i - 1);
323 float z1 = htmp_weight.GetBinCenter(
i);
324 float z2 = htmp_weight.GetBinCenter(
i + 1);
325 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;
328 found.push_back(imax);
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
~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 &)
float trkChi2dofTightChi2_
void addDefault(ParameterSetDescription const &psetDescription)
Abs< T >::type abs(const T &t)
bool getData(T &iHolder) const
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
const edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
const HepMC::GenEvent * GetEvent() const
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.
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