CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1TrackerEtMissProducer Class Reference
Inheritance diagram for L1TrackerEtMissProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< L1TTTrackTypeL1TTTrackCollectionType
 
typedef edm::RefVector< L1TTTrackCollectionTypeL1TTTrackRefCollectionType
 
typedef TTTrack< Ref_Phase2TrackerDigi_L1TTTrackType
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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

 L1TrackerEtMissProducer (const edm::ParameterSet &)
 
 ~L1TrackerEtMissProducer () override=default
 
- 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

const bool debug_
 
const int highPtTracks_
 
const std::string L1MetCollectionName
 
const float maxPt_
 
const edm::EDGetTokenT< L1TTTrackRefCollectionTypetrackToken_
 
const edm::EDGetTokenT< L1TTTrackRefCollectionTypevtxAssocTrackToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 27 of file L1TrackerEtMissProducer.cc.

Member Typedef Documentation

◆ L1TTTrackCollectionType

Definition at line 30 of file L1TrackerEtMissProducer.cc.

◆ L1TTTrackRefCollectionType

Definition at line 31 of file L1TrackerEtMissProducer.cc.

◆ L1TTTrackType

Definition at line 29 of file L1TrackerEtMissProducer.cc.

Constructor & Destructor Documentation

◆ L1TrackerEtMissProducer()

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

Definition at line 49 of file L1TrackerEtMissProducer.cc.

References L1MetCollectionName.

50  : trackToken_(consumes<L1TTTrackRefCollectionType>(iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))),
52  consumes<L1TTTrackRefCollectionType>(iConfig.getParameter<edm::InputTag>("L1TrackAssociatedInputTag"))),
53  L1MetCollectionName(iConfig.getParameter<std::string>("L1MetCollectionName")),
54  maxPt_(iConfig.getParameter<double>("maxPt")),
55  highPtTracks_(iConfig.getParameter<int>("highPtTracks")),
56  debug_(iConfig.getParameter<bool>("debug")) {
57  produces<TkEtMissCollection>(L1MetCollectionName);
58 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< L1TTTrackRefCollectionType > trackToken_
const std::string L1MetCollectionName
const edm::EDGetTokenT< L1TTTrackRefCollectionType > vtxAssocTrackToken_

◆ ~L1TrackerEtMissProducer()

L1TrackerEtMissProducer::~L1TrackerEtMissProducer ( )
overridedefault

Member Function Documentation

◆ produce()

void L1TrackerEtMissProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 60 of file L1TrackerEtMissProducer.cc.

References funct::cos(), debug_, EgHLTOffHistBins_cfi::et, spr::find(), highPtTracks_, iEvent, edm::HandleBase::isValid(), L1MetCollectionName, maxPt_, eostools::move(), phi, DiDispStaMuonMonitor_cfi::pt, funct::sin(), mathSSE::sqrt(), HLT_2024v12_cff::track, trackToken_, and vtxAssocTrackToken_.

60  {
61  using namespace edm;
62 
63  std::unique_ptr<TkEtMissCollection> METCollection(new TkEtMissCollection);
64 
66  iEvent.getByToken(trackToken_, L1TTTrackHandle);
67 
68  edm::Handle<L1TTTrackRefCollectionType> L1TTTrackAssociatedHandle;
69  iEvent.getByToken(vtxAssocTrackToken_, L1TTTrackAssociatedHandle);
70 
71  if (!L1TTTrackHandle.isValid()) {
72  LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackCollection not found in the event. Exit\n";
73  return;
74  }
75 
76  if (!L1TTTrackAssociatedHandle.isValid()) {
77  LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n";
78  return;
79  }
80 
81  float sumPx = 0;
82  float sumPy = 0;
83 
84  int numqualitytracks = 0;
85  int numassoctracks = 0;
86 
87  for (const auto& track : *L1TTTrackHandle) {
88  float pt = track->momentum().perp();
89  float phi = track->momentum().phi();
90 
91  if (maxPt_ > 0 && pt > maxPt_) {
92  if (highPtTracks_ == 0)
93  continue; // ignore these very high PT tracks: truncate
94  if (highPtTracks_ == 1)
95  pt = maxPt_; // saturate
96  }
97 
98  numqualitytracks++;
99 
100  if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) !=
101  L1TTTrackAssociatedHandle->end()) {
102  numassoctracks++;
103  sumPx += pt * cos(phi);
104  sumPy += pt * sin(phi);
105  }
106  } // end loop over tracks
107 
108  float et = sqrt(sumPx * sumPx + sumPy * sumPy);
109  double etphi = atan2(sumPy, sumPx);
110 
111  math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et);
112 
113  if (debug_) {
114  edm::LogVerbatim("L1TrackerEtMissProducer") << "====Global Pt===="
115  << "\n"
116  << "Px: " << sumPx << "| Py: " << sumPy << "\n"
117  << "====MET==="
118  << "\n"
119  << "MET: " << et << "| Phi: " << etphi << "\n"
120 
121  << "# Tracks after quality cuts: " << L1TTTrackHandle->size() << "\n"
122  << "# Tacks after additional highPt Cuts: " << numqualitytracks << "\n"
123  << "# Tracks associated to vertex: " << numassoctracks << "\n"
124  << "========================================================"
125  << "\n";
126  }
127 
128  int ibx = 0;
129  METCollection->push_back(TkEtMiss(missingEt, TkEtMiss::kMET, etphi, numassoctracks, ibx));
130 
132 } // end producer
std::vector< TkEtMiss > TkEtMissCollection
Definition: TkEtMissFwd.h:10
Log< level::Info, true > LogVerbatim
const edm::EDGetTokenT< L1TTTrackRefCollectionType > trackToken_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const std::string L1MetCollectionName
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Collection of MET.
const edm::EDGetTokenT< L1TTTrackRefCollectionType > vtxAssocTrackToken_
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ debug_

const bool L1TrackerEtMissProducer::debug_
private

Definition at line 45 of file L1TrackerEtMissProducer.cc.

Referenced by produce().

◆ highPtTracks_

const int L1TrackerEtMissProducer::highPtTracks_
private

Definition at line 44 of file L1TrackerEtMissProducer.cc.

Referenced by produce().

◆ L1MetCollectionName

const std::string L1TrackerEtMissProducer::L1MetCollectionName
private

Definition at line 42 of file L1TrackerEtMissProducer.cc.

Referenced by L1TrackerEtMissProducer(), and produce().

◆ maxPt_

const float L1TrackerEtMissProducer::maxPt_
private

Definition at line 43 of file L1TrackerEtMissProducer.cc.

Referenced by produce().

◆ trackToken_

const edm::EDGetTokenT<L1TTTrackRefCollectionType> L1TrackerEtMissProducer::trackToken_
private

Definition at line 40 of file L1TrackerEtMissProducer.cc.

Referenced by produce().

◆ vtxAssocTrackToken_

const edm::EDGetTokenT<L1TTTrackRefCollectionType> L1TrackerEtMissProducer::vtxAssocTrackToken_
private

Definition at line 41 of file L1TrackerEtMissProducer.cc.

Referenced by produce().