Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: equip to write decoded tracks to the event #73

Open
wants to merge 2 commits into
base: L1PF_11_1_7_X_newfirmware
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion DataFormats/L1TParticleFlow/interface/PFCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ namespace l1t {

void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); }
void setDxy(float dxy) { dxy_ = dxy; }
void setCaloEta(float caloeta) { caloEta_ = caloeta; }
void setCaloPhi(float calophi) { caloPhi_ = calophi; }


float z0() const { return vz(); }
float dxy() const { return dxy_; }
float caloEta() const { return caloEta_; }
float caloPhi() const { return caloPhi_; }

int16_t hwZ0() const { return hwZ0_; }
int16_t hwDxy() const { return hwDxy_; }
Expand All @@ -70,7 +75,7 @@ namespace l1t {
PFClusterRef clusterRef_;
PFTrackRef trackRef_;
MuonRef muonRef_;
float dxy_, puppiWeight_;
float dxy_, puppiWeight_, caloEta_, caloPhi_;

int16_t hwZ0_, hwDxy_;
uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_;
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/L1TParticleFlow/src/PFCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ l1t::PFCandidate::PFCandidate(
: L1Candidate(p, hwpt, hweta, hwphi, /*hwQuality=*/int(kind)),
dxy_(0),
puppiWeight_(puppiWeight),
caloEta_(0),
caloPhi_(0),
hwZ0_(0),
hwDxy_(0),
hwTkQuality_(0),
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/L1TParticleFlow/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<class name="edm::RefVector<l1t::PFTrackCollection>" />
<class name="std::vector<edm::Ref<l1t::PFTrackCollection> >" />

<class name="l1t::PFCandidate" ClassVersion="5">
<class name="l1t::PFCandidate" ClassVersion="6">
<version ClassVersion="6" checksum="2213464616"/>
<version ClassVersion="5" checksum="3777180193"/>
<version ClassVersion="4" checksum="3798885201"/>
<version ClassVersion="3" checksum="4253860178"/>
Expand Down Expand Up @@ -60,4 +61,3 @@
<class name="edm::RefVector<l1t::HPSPFTauCollection>" />
<class name="std::vector<edm::Ref<l1t::HPSPFTauCollection> >" />
</lcgdict>

Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class L1TCorrelatorLayer1Producer : public edm::stream::EDProducer<> {
std::unique_ptr<l1t::PFCandidateCollection> fetchEmCalo() const;
std::unique_ptr<l1t::PFCandidateCollection> fetchTracks() const;
std::unique_ptr<l1t::PFCandidateCollection> fetchPF() const;
std::unique_ptr<std::vector<l1t::PFTrack>> fetchDecodedTracks() const;
void putPuppi(edm::Event &iEvent) const;

void putEgObjects(edm::Event &iEvent,
Expand Down Expand Up @@ -157,6 +158,9 @@ L1TCorrelatorLayer1Producer::L1TCorrelatorLayer1Producer(const edm::ParameterSet
#if 0 // LATER
produces<l1t::PFCandidateCollection>("TKVtx");
#endif
#if 1 // LATER
produces<std::vector<l1t::PFTrack>>("DecodedTK");
#endif

for (const auto &tag : iConfig.getParameter<std::vector<edm::InputTag>>("emClusters")) {
emCands_.push_back(consumes<l1t::PFClusterCollection>(tag));
Expand Down Expand Up @@ -314,6 +318,10 @@ void L1TCorrelatorLayer1Producer::produce(edm::Event &iEvent, const edm::EventSe
iEvent.put(fetchEmCalo(), "EmCalo");
iEvent.put(fetchHadCalo(), "Calo");
iEvent.put(fetchTracks(), "TK");

#if 1
iEvent.put(fetchDecodedTracks(), "DecodedTK");
#endif

// Then do the vertexing, and save it out

Expand Down Expand Up @@ -740,6 +748,37 @@ std::unique_ptr<l1t::PFCandidateCollection> L1TCorrelatorLayer1Producer::fetchTr
return ret;
}

std::unique_ptr<std::vector<l1t::PFTrack>> L1TCorrelatorLayer1Producer::fetchDecodedTracks() const {
auto ret = std::make_unique<std::vector<l1t::PFTrack>>();
for (const auto r : event_.decoded.track) {
const auto &reg = r.region;
for (const auto &p : r.obj) {
if (p.hwPt == 0 || !reg.isFiducial(p))
continue;
reco::Particle::PolarLorentzVector p4(p.floatPt(), reg.floatGlbEta(p.hwVtxEta()), reg.floatGlbPhi(p.hwVtxPhi()), 0);

reco::Particle::Point vtx(0,0,p.floatZ0());

ret->emplace_back(l1t::PFTrack(p.intCharge(),
reco::Particle::LorentzVector(p4),
vtx,
p.src->track(),
0,
reg.floatGlbEta(p.hwEta),
reg.floatGlbPhi(p.hwPhi),
-1,
-1,
p.hwQuality.to_int(),
false,
p.intPt(),
p.intEta(),
p.intPhi()));
}
}
return ret;
}


std::unique_ptr<l1t::PFCandidateCollection> L1TCorrelatorLayer1Producer::fetchPF() const {
auto ret = std::make_unique<l1t::PFCandidateCollection>();
for (unsigned int ir = 0, nr = event_.pfinputs.size(); ir < nr; ++ir) {
Expand All @@ -760,6 +799,9 @@ std::unique_ptr<l1t::PFCandidateCollection> L1TCorrelatorLayer1Producer::fetchPF
ret->back().setHwZ0(p.hwZ0);
ret->back().setHwDxy(p.hwDxy);
ret->back().setHwTkQuality(p.hwTkQuality);
ret->back().setCaloEta(reg.floatGlbEtaOf(p));
ret->back().setCaloPhi(reg.floatGlbPhiOf(p));

setRefs_(ret->back(), p);
}
for (const auto &p : event_.out[ir].pfneutral) {
Expand All @@ -770,6 +812,8 @@ std::unique_ptr<l1t::PFCandidateCollection> L1TCorrelatorLayer1Producer::fetchPF
p.hwId.isPhoton() ? l1t::PFCandidate::Photon : l1t::PFCandidate::NeutralHadron;
ret->emplace_back(type, 0, p4, 1, p.intPt(), p.intEta(), p.intPhi());
ret->back().setHwEmID(p.hwEmID);
ret->back().setCaloEta(reg.floatGlbEtaOf(p));
ret->back().setCaloPhi(reg.floatGlbPhiOf(p));
setRefs_(ret->back(), p);
}
}
Expand Down