42 #include <fastjet/JetDefinition.hh> 83 : tpPtMin_((
float)iConfig.getParameter<double>(
"tp_ptMin")),
84 tpEtaMax_((
float)iConfig.getParameter<double>(
"tp_etaMax")),
85 tpZMax_((
float)iConfig.getParameter<double>(
"tp_zMax")),
86 tpNStubMin_((
int)iConfig.getParameter<
int>(
"tp_nStubMin")),
87 tpNStubLayerMin_((
int)iConfig.getParameter<
int>(
"tp_nStubLayerMin")),
88 coneSize_((
float)iConfig.getParameter<double>(
"coneSize")),
89 trackingParticleToken_(
92 iConfig.getParameter<
edm::
InputTag>(
"MCTruthStubInputTag"))),
94 produces<TkJetCollection>(
"TPFastJets");
104 std::vector<TrackingParticle>::const_iterator iterTP;
113 fastjet::JetDefinition jet_def(fastjet::antikt_algorithm,
coneSize_);
114 std::vector<fastjet::PseudoJet> JetInputs;
117 unsigned int this_tp = 0;
118 for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); iterTP++) {
123 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
124 int nStubTP = (
int)theStubRefs.size();
127 int hasStubInLayer[11] = {0};
128 for (
auto& theStubRef : theStubRefs) {
129 DetId detid(theStubRef->getDetId());
133 layer =
static_cast<int>(tTopo.
layer(detid)) - 1;
135 layer =
static_cast<int>(tTopo.
layer(detid)) + 5;
139 if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[
layer] < 2)
140 hasStubInLayer[
layer] = 1;
142 hasStubInLayer[
layer] = 2;
145 int nStubLayerTP = 0;
146 for (
int isum : hasStubInLayer) {
160 if (fabs(iterTP->z0()) >
tpZMax_)
162 if (iterTP->charge() == 0.)
164 if (iterTP->eventId().event() > 0)
167 fastjet::PseudoJet psuedoJet(iterTP->px(), iterTP->py(), iterTP->pz(), iterTP->energy());
168 JetInputs.push_back(psuedoJet);
169 JetInputs.back().set_user_index(this_tp - 1);
172 fastjet::ClusterSequence
cs(JetInputs, jet_def);
173 std::vector<fastjet::PseudoJet> JetOutputs =
174 fastjet::sorted_by_pt(
cs.inclusive_jets(0));
176 for (
unsigned int ijet = 0; ijet < JetOutputs.size(); ++ijet) {
178 JetOutputs[ijet].
px(), JetOutputs[ijet].
py(), JetOutputs[ijet].pz(), JetOutputs[ijet].modp());
181 std::vector<edm::Ptr<TrackingParticle>> tpPtrs;
182 std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(
cs.constituents(JetOutputs[ijet]));
184 for (
unsigned int i = 0;
i < fjConstituents.size(); ++
i) {
185 auto index = fjConstituents[
i].user_index();
187 tpPtrs.push_back(tpPtr);
188 sumpt = sumpt + tpPtr->
pt();
189 avgZ = avgZ + tpPtr->
pt() * tpPtr->
z0();
193 std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>> dummyL1TrackPtrs;
194 TkJet tpJet(jetP4, dummyL1TrackPtrs, avgZ, fjConstituents.size(), 0, 0, 0,
false);
195 TPFastJets->push_back(tpJet);
206 desc.add<
double>(
"tp_ptMin", 2.0);
207 desc.add<
double>(
"tp_etaMax", 2.4);
208 desc.add<
double>(
"tp_zMax", 15.);
209 desc.add<
int>(
"tp_nStubMin", 4);
210 desc.add<
int>(
"tp_nStubLayerMin", 4);
211 desc.add<
double>(
"coneSize", 0.4);
212 descriptions.
add(
"tpFastJets",
desc);
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int layer(const DetId &id) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
#define DEFINE_FWK_MODULE(type)
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const int tpNStubLayerMin_
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
Monte Carlo truth information used for tracking validation.
double pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
std::vector< TkJet > TkJetCollection
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Stores association of Truth Particles (TP) to L1 Track-Trigger Stubs.
static constexpr auto TID
double z0() const
z0 parameter
void produce(edm::Event &, const edm::EventSetup &) override
TPFastJetProducer(const edm::ParameterSet &)