19 namespace l1tVertexFinder {
21 InputData::InputData() {}
42 std::set<DetId> lStubDetIds;
45 lStubDetIds.insert(p_ttstub->getDetId());
49 std::map<DetId, DetId> stubGeoDetIdMap;
50 for (
auto gd = tGeom.
dets().begin(); gd != tGeom.
dets().end(); gd++) {
51 DetId detid = (*gd)->geographicalId();
58 if (lStubDetIds.count(stackDetid) > 0) {
59 assert(stubGeoDetIdMap.count(stackDetid) == 0);
60 stubGeoDetIdMap[stackDetid] = detid;
63 assert(lStubDetIds.size() == stubGeoDetIdMap.size());
69 iEvent.
getByToken(tpValueMapToken, tpValueMapHandle);
72 for (
unsigned int i = 0;
i < tpHandle->size();
i++) {
73 if (tpValueMap[tpHandle->refAt(
i)].use()) {
74 tpPtrToRefMap_[tpHandle->ptrAt(
i)] = tpHandle->refAt(
i);
81 for (
const auto& [edmPtr, edmRef] : tpPtrToRefMap_) {
82 TP tp = tpValueMap[edmRef];
86 genPt_PU_ += tp->pt();
88 if (settings.
debug() > 0) {
89 edm::LogInfo(
"InputData") <<
"InputData::genPt in the event " << genPt_;
96 for (
unsigned int i = 0;
i < vertices_.size(); ++
i) {
97 if (tp->vz() == vertices_[
i].vz()) {
98 vertices_[
i].insert(tp);
106 vertices_.push_back(vertex);
111 for (
const Vertex& vertex : vertices_) {
113 recoVertices_.push_back(vertex);
116 if (settings.
debug() > 0)
117 edm::LogInfo(
"InputData") <<
"InputData::" << vertices_.size() <<
" pileup vertices in the event, "
118 << recoVertices_.size() <<
" reconstructable";
120 vertex_.computeParameters();
121 if (settings.
debug() > 2)
122 edm::LogInfo(
"InputData") <<
"InputData::Vertex " << vertex_.z0() <<
" containing " << vertex_.numTracks()
123 <<
" total pT " << vertex_.pT();
125 for (
unsigned int i = 0;
i < vertices_.size(); ++
i) {
126 vertices_[
i].computeParameters();
129 for (
unsigned int i = 0;
i < recoVertices_.size(); ++
i) {
130 recoVertices_[
i].computeParameters();
134 std::sort(recoVertices_.begin(), recoVertices_.end(),
SortVertexByPt());
141 iEvent.
getByToken(genParticlesToken, GenParticleHandle);
143 if (!HepMCEvt.isValid() && !GenParticleHandle.
isValid()) {
144 throw cms::Exception(
"Neither the edm::HepMCProduct nor the generator particles are available.");
146 if (HepMCEvt.isValid()) {
148 for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end();
150 bool hasParentVertex =
false;
153 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
156 if ((*iparent)->production_vertex()) {
157 hasParentVertex =
true;
165 HepMC::FourVector pos = (*ivertex)->position();
166 const double mm = 0.1;
167 hepMCVertex_ =
Vertex(pos.z() * mm);
171 if (GenParticleHandle.
isValid()) {
172 for (
const auto& genpart : *GenParticleHandle) {
173 if ((genpart.status() != 1) || (genpart.numberOfMothers() == 0))
175 genVertex_ =
Vertex(genpart.vz());
179 if ((hepMCVertex_.vz() == 0.0) && (genVertex_.vz() == 0.0)) {
180 throw cms::Exception(
"Neither the HepMC vertex nor the generator particle vertex were found.");
185 InputData::~InputData() {}
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
data_type const * const_iterator
bool useForAlgEff() const
bool isLower(const DetId &id) const
bool getData(T &iHolder) const
void insert(TP &tp)
Assign TP to this vertex.
unsigned int debug() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
bool physicsCollision() const
uint32_t stack(const DetId &id) const
bool useForVertexReco() const
unsigned int vx_minTracks() const
static constexpr auto TID