CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TkEmParticleProducer Class Reference
Inheritance diagram for L1TkEmParticleProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< L1TTTrackType
L1TTTrackCollectionType
 
typedef TTTrack
< Ref_Phase2TrackerDigi_
L1TTTrackType
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

float CorrectedEta (float eta, float zv) const
 
 L1TkEmParticleProducer (const edm::ParameterSet &)
 
 ~L1TkEmParticleProducer () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector
< edm::ProductResolverIndex >
const & 
indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

const float chi2Max_
 
const float deltaZMax_
 
const float dR2Max_
 
const float dR2Min_
 
const edm::EDGetTokenT
< EGammaBxCollection
egToken_
 
const float etMin_
 
const float isoCut_
 
const std::string label_
 
const bool primaryVtxConstrain_
 
const float pTMinTra_
 
const bool relativeIsolation_
 
const edm::EDGetTokenT
< L1TTTrackCollectionType
trackToken_
 
const edm::EDGetTokenT
< TkPrimaryVertexCollection
vertexToken_
 
const float zMax_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 43 of file L1TkEmParticleProducer.cc.

Member Typedef Documentation

Definition at line 46 of file L1TkEmParticleProducer.cc.

Definition at line 45 of file L1TkEmParticleProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file L1TkEmParticleProducer.cc.

References label_.

83  : egToken_(consumes<EGammaBxCollection>(iConfig.getParameter<edm::InputTag>("L1EGammaInputTag"))),
84  trackToken_(consumes<L1TTTrackCollectionType>(iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))),
85  vertexToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))),
86  label_(iConfig.getParameter<std::string>("label")),
87  etMin_((float)iConfig.getParameter<double>("ETmin")),
88  zMax_((float)iConfig.getParameter<double>("ZMAX")),
89  chi2Max_((float)iConfig.getParameter<double>("CHI2MAX")),
90  pTMinTra_((float)iConfig.getParameter<double>("PTMINTRA")),
91  dR2Min_((float)iConfig.getParameter<double>("DRmin") * (float)iConfig.getParameter<double>("DRmin")),
92  dR2Max_((float)iConfig.getParameter<double>("DRmax") * (float)iConfig.getParameter<double>("DRmax")),
93  primaryVtxConstrain_(iConfig.getParameter<bool>("PrimaryVtxConstrain")),
94  deltaZMax_((float)iConfig.getParameter<double>("DeltaZMax")),
95  isoCut_((float)iConfig.getParameter<double>("IsoCut")),
96  relativeIsolation_(iConfig.getParameter<bool>("RelativeIsolation")) {
97  produces<TkEmCollection>(label_);
98 }
const edm::EDGetTokenT< EGammaBxCollection > egToken_
const edm::EDGetTokenT< TkPrimaryVertexCollection > vertexToken_
const edm::EDGetTokenT< L1TTTrackCollectionType > trackToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TkEmParticleProducer::~L1TkEmParticleProducer ( )
override

Definition at line 100 of file L1TkEmParticleProducer.cc.

100 {}

Member Function Documentation

float L1TkEmParticleProducer::CorrectedEta ( float  eta,
float  zv 
) const

Definition at line 231 of file L1TkEmParticleProducer.cc.

References funct::abs(), CommonMethods::delta(), PVValHelper::eta, EtaECal, funct::exp(), log, M_PI, REcal, funct::tan(), ZEcal, and gpuVertexFinder::zv.

Referenced by produce().

231  {
232  // Correct the eta of the L1EG object once we know the zvertex
233 
234  if (zv == 0.)
235  return eta;
236 
237  if (eta == 0) {
238  float thetaprime = atan(-REcal / zv);
239  if (thetaprime < 0)
240  thetaprime = thetaprime + M_PI;
241  float etaprime = -log(tan(0.5 * thetaprime));
242  return etaprime;
243  }
244 
245  bool IsBarrel = (std::abs(eta) < EtaECal);
246 
247  float tanhalftheta = exp(-eta);
248  float tantheta = 2. * tanhalftheta / (1. - tanhalftheta * tanhalftheta);
249 
250  float delta;
251  if (IsBarrel)
252  delta = REcal / tantheta;
253  else
254  delta = eta > 0 ? ZEcal : -ZEcal;
255 
256  float etaprime;
257  if (delta == zv) {
258  etaprime = 0.;
259  } else {
260  float tanthetaprime = delta * tantheta / (delta - zv);
261  float thetaprime = atan(tanthetaprime);
262  if (thetaprime < 0)
263  thetaprime = thetaprime + M_PI;
264  etaprime = -log(tan(0.5 * thetaprime));
265  }
266 
267  return etaprime;
268 }
static constexpr float EtaECal
static std::vector< std::string > checklist log
float *__restrict__ zv
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
static constexpr float REcal
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
static constexpr float ZEcal
void L1TkEmParticleProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 271 of file L1TkEmParticleProducer.cc.

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

271  {
272  //The following says we do not know what parameters are allowed so do no validation
273  // Please change this to state exactly what you do use, even if it is no parameters
275  desc.add<string>("label", "EG");
276  desc.add<edm::InputTag>("L1EGammaInputTag", edm::InputTag("simCaloStage2Digis"));
277  desc.add<edm::InputTag>("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"));
278  desc.add<edm::InputTag>("L1VertexInputTag", edm::InputTag("L1TkPrimaryVertex"));
279  desc.add<double>("ETmin", -1.);
280  desc.add<bool>("RelativeIsolation", true);
281  desc.add<double>("IsoCut", 0.23);
282  desc.add<double>("ZMAX", 25.);
283  desc.add<double>("CHI2MAX", 100.);
284  desc.add<double>("PTMINTRA", 2.);
285  desc.add<double>("DRmin", 0.07);
286  desc.add<double>("DRmax", 0.30);
287  desc.add<bool>("PrimaryVtxConstrain", false);
288  desc.add<double>("DeltaZMax", 0.6);
289  descriptions.add("l1TkEmParticleProducer", desc);
290 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L1TkEmParticleProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 103 of file L1TkEmParticleProducer.cc.

References funct::abs(), HLT_FULL_cff::chi2, chi2Max_, CorrectedEta(), reco::deltaR2(), deltaZMax_, dR2Min_, egToken_, PVValHelper::eta, etMin_, edm::Event::getByToken(), isoCut_, label_, eostools::move(), phi, colinearityKinematic::Phi, primaryVtxConstrain_, pTMinTra_, edm::Event::put(), relativeIsolation_, mps_fire::result, HLT_FULL_cff::track, trackToken_, vertexToken_, z, and zMax_.

103  {
104  using namespace edm;
105 
106  auto result = std::make_unique<TkEmCollection>();
107 
108  // the L1Tracks
109  edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle;
110  iEvent.getByToken(trackToken_, L1TTTrackHandle);
111  if (!L1TTTrackHandle.isValid()) {
112  LogError("L1TkEmParticleProducer") << "\nWarning: L1TTTrackCollectionType not found in the event. Exit."
113  << std::endl;
114  return;
115  }
116 
117  // the primary vertex (used only if primaryVtxConstrain_ = true)
118  float zvtxL1tk = -999;
119  bool primaryVtxConstrain = primaryVtxConstrain_;
121  iEvent.getByToken(vertexToken_, L1VertexHandle);
122  if (!L1VertexHandle.isValid()) {
123  LogWarning("L1TkEmParticleProducer")
124  << "Warning: TkPrimaryVertexCollection not found in the event. Won't use any PrimaryVertex constraint."
125  << std::endl;
126  primaryVtxConstrain = false;
127  } else {
128  std::vector<TkPrimaryVertex>::const_iterator vtxIter = L1VertexHandle->begin();
129  // by convention, the first vertex in the collection is the one that should
130  // be used by default
131  zvtxL1tk = vtxIter->zvertex();
132  }
133 
134  // Now loop over the L1EGamma objects
135 
136  edm::Handle<EGammaBxCollection> eGammaHandle;
137  iEvent.getByToken(egToken_, eGammaHandle);
138  if (!eGammaHandle.isValid()) {
139  LogError("L1TkEmParticleProducer") << "\nWarning: L1EmCollection not found in the event. Exit." << std::endl;
140  return;
141  }
142  EGammaBxCollection eGammaCollection = (*eGammaHandle.product());
144 
145  int ieg = 0;
146  for (egIter = eGammaCollection.begin(0); egIter != eGammaCollection.end(0); ++egIter) // considering BX = only
147  {
148  edm::Ref<EGammaBxCollection> EGammaRef(eGammaHandle, ieg);
149  ieg++;
150 
151  float et = egIter->et();
152  if (et < etMin_)
153  continue;
154 
155  float eta = egIter->eta();
156  // The eta of the L1EG object is seen from (0,0,0).
157  // if primaryVtxConstrain_ = true, and for the PV constrained iso, use the zvtxL1tk to correct the eta(L1EG)
158  // that is used in the calculation of DeltaR.
159  float etaPV = CorrectedEta(eta, zvtxL1tk);
160 
161  float phi = egIter->phi();
162 
163  // calculate the isolation of the L1EG object with
164  // respect to L1Tracks.
165 
166  float sumPt = 0;
167  float sumPtPV = 0;
168 
169  for (const auto& track : *L1TTTrackHandle) {
170  float Pt = track.momentum().perp();
171  float Eta = track.momentum().eta();
172  float Phi = track.momentum().phi();
173  float z = track.POCA().z();
174  if (fabs(z) > zMax_)
175  continue;
176  if (Pt < pTMinTra_)
177  continue;
178  float chi2 = track.chi2();
179  if (chi2 > chi2Max_)
180  continue;
181 
182  float dr2 = reco::deltaR2(Eta, Phi, eta, phi);
183  if (dr2 < dR2Max_ && dr2 >= dR2Min_) {
184  sumPt += Pt;
185  }
186 
187  if (zvtxL1tk > -999 && std::abs(z - zvtxL1tk) >= deltaZMax_)
188  continue; // Now, PV constrained trackSum:
189 
190  dr2 = reco::deltaR2(Eta, Phi, etaPV, phi); // recompute using the corrected eta
191  if (dr2 < dR2Max_ && dr2 >= dR2Min_) {
192  sumPtPV += Pt;
193  }
194  } // end loop over tracks
195 
196  float trkisol = -999;
197  float trkisolPV = -999;
198  if (relativeIsolation_) {
199  if (et > 0) {
200  trkisol = sumPt / et;
201  trkisolPV = sumPtPV / et;
202  } // relative isolation
203  } else { // absolute isolation
204  trkisol = sumPt;
205  trkisolPV = sumPtPV;
206  }
207 
208  float isolation = primaryVtxConstrain ? trkisolPV : trkisol;
209 
210  const math::XYZTLorentzVector P4 = egIter->p4();
211  TkEm trkEm(P4, EGammaRef, trkisol, trkisolPV);
212 
213  if (isoCut_ <= 0) {
214  // write the L1TkEm particle to the collection,
215  // irrespective of its relative isolation
216  result->push_back(trkEm);
217  } else {
218  // the object is written to the collection only
219  // if it passes the isolation cut
220  if (isolation <= isoCut_)
221  result->push_back(trkEm);
222  }
223 
224  } // end loop over EGamma objects
225 
226  iEvent.put(std::move(result), label_);
227 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::Ref< EGammaBxCollection > EGammaRef
Definition: TkEGTau.h:35
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< EGammaBxCollection > egToken_
Log< level::Error, false > LogError
const edm::EDGetTokenT< TkPrimaryVertexCollection > vertexToken_
tuple result
Definition: mps_fire.py:311
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const edm::EDGetTokenT< L1TTTrackCollectionType > trackToken_
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
Definition: TkEm.h:19
def move
Definition: eostools.py:511
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
float CorrectedEta(float eta, float zv) const
Log< level::Warning, false > LogWarning

Member Data Documentation

const float L1TkEmParticleProducer::chi2Max_
private

Definition at line 68 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::deltaZMax_
private

Definition at line 73 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::dR2Max_
private

Definition at line 71 of file L1TkEmParticleProducer.cc.

const float L1TkEmParticleProducer::dR2Min_
private

Definition at line 70 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<EGammaBxCollection> L1TkEmParticleProducer::egToken_
private

Definition at line 60 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::etMin_
private

Definition at line 66 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::isoCut_
private

Definition at line 75 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const std::string L1TkEmParticleProducer::label_
private
const bool L1TkEmParticleProducer::primaryVtxConstrain_
private

Definition at line 72 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::pTMinTra_
private

Definition at line 69 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const bool L1TkEmParticleProducer::relativeIsolation_
private

Definition at line 76 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<L1TTTrackCollectionType> L1TkEmParticleProducer::trackToken_
private

Definition at line 61 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<TkPrimaryVertexCollection> L1TkEmParticleProducer::vertexToken_
private

Definition at line 62 of file L1TkEmParticleProducer.cc.

Referenced by produce().

const float L1TkEmParticleProducer::zMax_
private

Definition at line 67 of file L1TkEmParticleProducer.cc.

Referenced by produce().