CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TPFastJetProducer Class Reference
Inheritance diagram for TPFastJetProducer:
edm::stream::EDProducer<>

Public Member Functions

 TPFastJetProducer (const edm::ParameterSet &)
 
 ~TPFastJetProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const float coneSize_
 
const float tpEtaMax_
 
const int tpNStubLayerMin_
 
const int tpNStubMin_
 
const float tpPtMin_
 
const float tpZMax_
 
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 58 of file TPFastJetProducer.cc.

Constructor & Destructor Documentation

◆ TPFastJetProducer()

TPFastJetProducer::TPFastJetProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 82 of file TPFastJetProducer.cc.

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")),
90  consumes<std::vector<TrackingParticle>>(iConfig.getParameter<edm::InputTag>("TrackingParticleInputTag"))),
92  iConfig.getParameter<edm::InputTag>("MCTruthStubInputTag"))),
93  tTopoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>(edm::ESInputTag("", ""))) {
94  produces<TkJetCollection>("TPFastJets");
95 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Stores association of Truth Particles (TP) to L1 Track-Trigger Stubs.

◆ ~TPFastJetProducer()

TPFastJetProducer::~TPFastJetProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void TPFastJetProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 201 of file TPFastJetProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

201  {
202  // The following says we do not know what parameters are allowed so do no validation
204  desc.add<edm::InputTag>("TrackingParticleInputTag", edm::InputTag("mix", "MergedTrackTruth"));
205  desc.add<edm::InputTag>("MCTruthStubInputTag", edm::InputTag("TTStubAssociatorFromPixelDigis", "StubAccepted"));
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);
213 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void TPFastJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 98 of file TPFastJetProducer.cc.

References coneSize_, callgraph::cs, edm::EventSetup::getData(), mps_fire::i, iEvent, createfilelist::int, isum, nano_mu_digi_cff::layer, TrackerTopology::layer(), eostools::move(), TrackingParticle::pt(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, StripSubdetector::TID, StripSubdetector::TOB, tpEtaMax_, tpNStubLayerMin_, tpNStubMin_, tpPtMin_, tpZMax_, trackingParticleToken_, tTopoToken_, ttStubMCTruthToken_, and TrackingParticle::z0().

98  {
99  std::unique_ptr<TkJetCollection> TPFastJets(new TkJetCollection);
100 
101  // Tracking particles
102  edm::Handle<std::vector<TrackingParticle>> TrackingParticleHandle;
103  iEvent.getByToken(trackingParticleToken_, TrackingParticleHandle);
104  std::vector<TrackingParticle>::const_iterator iterTP;
105 
106  // MC truth association maps
108  iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle);
109 
110  // Tracker Topology
111  const TrackerTopology& tTopo = iSetup.getData(tTopoToken_);
112 
113  fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize_);
114  std::vector<fastjet::PseudoJet> JetInputs;
115 
116  // loop over tps
117  unsigned int this_tp = 0;
118  for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); iterTP++) {
119  edm::Ptr<TrackingParticle> tp_ptr(TrackingParticleHandle, this_tp);
120  this_tp++;
121 
122  std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_>>, TTStub<Ref_Phase2TrackerDigi_>>>
123  theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
124  int nStubTP = (int)theStubRefs.size();
125 
126  // how many layers/disks have stubs?
127  int hasStubInLayer[11] = {0};
128  for (auto& theStubRef : theStubRefs) {
129  DetId detid(theStubRef->getDetId());
130 
131  int layer = -1;
132  if (detid.subdetId() == StripSubdetector::TOB) {
133  layer = static_cast<int>(tTopo.layer(detid)) - 1; //fill in array as entries 0-5
134  } else if (detid.subdetId() == StripSubdetector::TID) {
135  layer = static_cast<int>(tTopo.layer(detid)) + 5; //fill in array as entries 6-10
136  }
137 
138  //treat genuine stubs separately (==2 is genuine, ==1 is not)
139  if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[layer] < 2)
140  hasStubInLayer[layer] = 1;
141  else
142  hasStubInLayer[layer] = 2;
143  }
144 
145  int nStubLayerTP = 0;
146  for (int isum : hasStubInLayer) {
147  if (isum >= 1)
148  nStubLayerTP += 1;
149  }
150 
151  // tp quality cuts to match L1 tracks
152  if (iterTP->pt() < tpPtMin_)
153  continue;
154  if (fabs(iterTP->eta()) > tpEtaMax_)
155  continue;
156  if (nStubTP < tpNStubMin_)
157  continue;
158  if (nStubLayerTP < tpNStubLayerMin_)
159  continue;
160  if (fabs(iterTP->z0()) > tpZMax_)
161  continue;
162  if (iterTP->charge() == 0.) // extra check that all tps are charged
163  continue;
164  if (iterTP->eventId().event() > 0) // only select hard interaction tps
165  continue;
166 
167  fastjet::PseudoJet psuedoJet(iterTP->px(), iterTP->py(), iterTP->pz(), iterTP->energy());
168  JetInputs.push_back(psuedoJet); // input tps for clustering
169  JetInputs.back().set_user_index(this_tp - 1); // save tp index in the collection
170  } // end loop over tps
171 
172  fastjet::ClusterSequence cs(JetInputs, jet_def); // define the output jet collection
173  std::vector<fastjet::PseudoJet> JetOutputs =
174  fastjet::sorted_by_pt(cs.inclusive_jets(0)); // output jet collection, pT-ordered
175 
176  for (unsigned int ijet = 0; ijet < JetOutputs.size(); ++ijet) {
178  JetOutputs[ijet].px(), JetOutputs[ijet].py(), JetOutputs[ijet].pz(), JetOutputs[ijet].modp());
179  float sumpt = 0;
180  float avgZ = 0;
181  std::vector<edm::Ptr<TrackingParticle>> tpPtrs;
182  std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(cs.constituents(JetOutputs[ijet]));
183 
184  for (unsigned int i = 0; i < fjConstituents.size(); ++i) {
185  auto index = fjConstituents[i].user_index();
186  edm::Ptr<TrackingParticle> tpPtr(TrackingParticleHandle, index);
187  tpPtrs.push_back(tpPtr); // tracking particles in the jet
188  sumpt = sumpt + tpPtr->pt();
189  avgZ = avgZ + tpPtr->pt() * tpPtr->z0();
190  }
191  avgZ = avgZ / sumpt;
193  std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>> dummyL1TrackPtrs; // can't create TkJet with tp references
194  TkJet tpJet(jetP4, dummyL1TrackPtrs, avgZ, fjConstituents.size(), 0, 0, 0, false);
195  TPFastJets->push_back(tpJet);
196  } //end loop over Jet Outputs
197 
198  iEvent.put(std::move(TPFastJets), "TPFastJets");
199 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
double isum
unsigned int layer(const DetId &id) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
Definition: DetId.h:17
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
std::vector< TkJet > TkJetCollection
Definition: TkJetFwd.h:20
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
static constexpr auto TID
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ coneSize_

const float TPFastJetProducer::coneSize_
private

Definition at line 74 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tpEtaMax_

const float TPFastJetProducer::tpEtaMax_
private

Definition at line 70 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tpNStubLayerMin_

const int TPFastJetProducer::tpNStubLayerMin_
private

Definition at line 73 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tpNStubMin_

const int TPFastJetProducer::tpNStubMin_
private

Definition at line 72 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tpPtMin_

const float TPFastJetProducer::tpPtMin_
private

Definition at line 69 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tpZMax_

const float TPFastJetProducer::tpZMax_
private

Definition at line 71 of file TPFastJetProducer.cc.

Referenced by produce().

◆ trackingParticleToken_

edm::EDGetTokenT<std::vector<TrackingParticle> > TPFastJetProducer::trackingParticleToken_
private

Definition at line 76 of file TPFastJetProducer.cc.

Referenced by produce().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TPFastJetProducer::tTopoToken_
private

Definition at line 78 of file TPFastJetProducer.cc.

Referenced by produce().

◆ ttStubMCTruthToken_

edm::EDGetTokenT<TTStubAssociationMap<Ref_Phase2TrackerDigi_> > TPFastJetProducer::ttStubMCTruthToken_
private

Definition at line 77 of file TPFastJetProducer.cc.

Referenced by produce().