|
|
Go to the documentation of this file.
86 constexpr
static float xmin_ = -30;
87 constexpr
static float xmax_ = +30;
111 iConfig.getParameter<
edm::
InputTag>(
"L1TrackInputTag"))),
131 produces<TkPrimaryVertexCollection>();
147 auto result = std::make_unique<TkPrimaryVertexCollection>();
166 const double mm = 0.1;
167 float zvtx_gen = -999;
173 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
175 bool hasParentVertex =
false;
178 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
181 if ((*iparent)->production_vertex()) {
182 hasParentVertex =
true;
190 HepMC::FourVector
pos = (*ivertex)->position();
191 zvtx_gen =
pos.z() * mm;
195 }
else if (GenParticleHandle.
isValid()) {
196 for (
const auto& genpart : *GenParticleHandle) {
197 int status = genpart.status();
200 if (genpart.numberOfMothers() == 0)
202 float part_zvertex = genpart.vz();
203 zvtx_gen = part_zvertex;
208 <<
"\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) "
209 <<
"\nbut the input file contains neither edm::HepMCProduct> nor vector<reco::GenParticle>. Exit"
215 result->push_back(genvtx);
223 if (!L1TTTrackHandle.
isValid()) {
225 <<
"\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl;
229 for (
const auto&
track : *L1TTTrackHandle) {
230 float z =
track.POCA().z();
232 float pt =
track.momentum().perp();
259 theStubs =
track.getStubRefs();
261 int tmp_trk_nstub = (
int)theStubs.size();
262 if (tmp_trk_nstub < 0) {
264 <<
" ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl;
269 for (
const auto& stub : theStubs) {
272 DetId detId(stub->getDetId());
288 int trk_nstub = (
int)
track.getStubRefs().size();
289 float chi2dof =
chi2 / (2 * trk_nstub - 4);
292 float trk_consistency =
track.stubPtConsistency();
293 if (trk_nstub == 4) {
301 if (
pt > 10.0 && chi2dof > 5.0)
306 htmp_weight.Fill(
z, wt);
312 float zvtx_sliding = -999;
313 float sigma_max = -999;
315 int nb = htmp.GetNbinsX();
316 for (
int i = 2;
i <= nb - 1;
i++) {
317 float a0 = htmp.GetBinContent(
i - 1);
318 float a1 = htmp.GetBinContent(
i);
319 float a2 = htmp.GetBinContent(
i + 1);
320 float sigma =
a0 + a1 +
a2;
321 if (sigma > sigma_max) {
324 float z0 = htmp.GetBinCenter(
i - 1);
325 float z1 = htmp.GetBinCenter(
i);
326 float z2 = htmp.GetBinCenter(
i + 1);
327 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;
331 std::vector<int>
found;
333 for (
int ivtx = 0; ivtx <
nVtx_; ivtx++) {
337 for (
int i = 2;
i <= nb - 1;
i++) {
338 float a0 = htmp_weight.GetBinContent(
i - 1);
339 float a1 = htmp_weight.GetBinContent(
i);
340 float a2 = htmp_weight.GetBinContent(
i + 1);
341 float sigma =
a0 + a1 +
a2;
345 float z0 = htmp_weight.GetBinCenter(
i - 1);
346 float z1 = htmp_weight.GetBinCenter(
i);
347 float z2 = htmp_weight.GetBinCenter(
i + 1);
348 zvtx_sliding = (
a0 *
z0 + a1 * z1 +
a2 *
z2) / sigma;
351 found.push_back(imax);
T const * product() const
Class to store the L1 Track Trigger tracks.
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
L1TkFastVertexProducer(const edm::ParameterSet &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int tidRing(const DetId &id) const
constexpr static float xmin_
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Class to store the L1 Track Trigger stubs.
const edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genparticleToken_
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
~L1TkFastVertexProducer() override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const HepMC::GenEvent * GetEvent() const
constexpr static float xmax_
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const edm::EDGetTokenT< edm::HepMCProduct > hepmcToken_
static constexpr auto TOB
Power< A, B >::type pow(const A &a, const B &b)
Abs< T >::type abs(const T &t)
std::vector< L1TTTrackType > L1TTTrackCollectionType
void addDefault(ParameterSetDescription const &psetDescription)
static constexpr float a0
static constexpr auto TID
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)