CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ticl::TracksterP4FromTrackAndPCA Class Referencefinal
Inheritance diagram for ticl::TracksterP4FromTrackAndPCA:
ticl::TracksterMomentumPluginBase

Public Member Functions

void setP4 (const std::vector< const Trackster *> &tracksters, std::vector< TICLCandidate > &ticl_cands, edm::Event &event) const override
 
 TracksterP4FromTrackAndPCA (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
- Public Member Functions inherited from ticl::TracksterMomentumPluginBase
 TracksterMomentumPluginBase (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
virtual ~TracksterMomentumPluginBase ()
 

Private Member Functions

std::tuple< TracksterMomentumPluginBase::LorentzVector, float > calcP4 (const ticl::Trackster &trackster) const
 

Private Attributes

bool energy_from_regression_
 
edm::EDGetTokenT< reco::TrackCollectiontracks_token_
 

Additional Inherited Members

- Public Types inherited from ticl::TracksterMomentumPluginBase
typedef reco::Candidate::LorentzVector LorentzVector
 

Detailed Description

Definition at line 11 of file TracksterP4FromTrackAndPCA.cc.

Constructor & Destructor Documentation

◆ TracksterP4FromTrackAndPCA()

ticl::TracksterP4FromTrackAndPCA::TracksterP4FromTrackAndPCA ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 24 of file TracksterP4FromTrackAndPCA.cc.

26  energy_from_regression_(ps.getParameter<bool>("energyFromRegression")),
27  tracks_token_(ic.consumes<reco::TrackCollection>(ps.getParameter<edm::InputTag>("tracks"))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< reco::TrackCollection > tracks_token_
TracksterMomentumPluginBase(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ calcP4()

std::tuple<TracksterMomentumPluginBase::LorentzVector, float> ticl::TracksterP4FromTrackAndPCA::calcP4 ( const ticl::Trackster trackster) const
private

◆ setP4()

void ticl::TracksterP4FromTrackAndPCA::setP4 ( const std::vector< const Trackster *> &  tracksters,
std::vector< TICLCandidate > &  ticl_cands,
edm::Event event 
) const
overridevirtual

Implements ticl::TracksterMomentumPluginBase.

Definition at line 29 of file TracksterP4FromTrackAndPCA.cc.

References cms::cuda::assert(), hcalRecHitTable_cff::energy, energy_from_regression_, mps_fire::i, edm::HandleBase::id(), SiStripPI::min, ticl::mpion2, edm::Handle< T >::product(), findQualityFiles::size, mathSSE::sqrt(), JetHT_cfg::trackCollection, and tracks_token_.

Referenced by Jet.Jet::setCorrP4().

31  {
33  event.getByToken(tracks_token_, tracks_h);
34  edm::ProductID trkId = tracks_h.id();
35  const reco::TrackCollection& trackCollection = *tracks_h.product();
36 
37  auto size = std::min(tracksters.size(), ticl_cands.size());
38  for (size_t i = 0; i < size; ++i) {
39  const auto* trackster = tracksters[i];
40  // If there's a track, use it.
41  if (trackster->seedIndex() != -1) {
42  assert(trackster->seedID() == trkId);
43  auto const& tkRef = trackCollection[trackster->seedIndex()];
44  auto const& three_mom = tkRef.momentum();
45  constexpr double mpion2 = 0.13957 * 0.13957;
46  double energy = std::sqrt(tkRef.momentum().mag2() + mpion2);
47  math::XYZTLorentzVector trk_p4(three_mom.x(), three_mom.y(), three_mom.z(), energy);
48  auto& ticl_cand = ticl_cands[i];
49  ticl_cand.setP4(trk_p4);
50  ticl_cand.setRawEnergy(energy);
51  } else {
52  auto direction = trackster->eigenvectors(0).Unit();
53  auto energy = energy_from_regression_ ? trackster->regressed_energy() : trackster->raw_energy();
54  direction *= energy;
55  math::XYZTLorentzVector cartesian(direction.X(), direction.Y(), direction.Z(), energy);
56  auto& ticl_cand = ticl_cands[i];
57  ticl_cand.setP4(cartesian);
58  ticl_cand.setRawEnergy(energy);
59  }
60  }
61  }
size
Write out results.
ProductID id() const
Definition: HandleBase.cc:29
T const * product() const
Definition: Handle.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
assert(be >=bs)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::EDGetTokenT< reco::TrackCollection > tracks_token_
T sqrt(T t)
Definition: SSEVec.h:19
trackCollection
Definition: JetHT_cfg.py:51
constexpr float mpion2
Definition: commons.h:12

Member Data Documentation

◆ energy_from_regression_

bool ticl::TracksterP4FromTrackAndPCA::energy_from_regression_
private

Definition at line 20 of file TracksterP4FromTrackAndPCA.cc.

Referenced by setP4().

◆ tracks_token_

edm::EDGetTokenT<reco::TrackCollection> ticl::TracksterP4FromTrackAndPCA::tracks_token_
private

Definition at line 21 of file TracksterP4FromTrackAndPCA.cc.

Referenced by setP4().