CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
AlphaTVarProducer Class Reference

#include <AlphaTVarProducer.h>

Inheritance diagram for AlphaTVarProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlphaTVarProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~AlphaTVarProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

double CalcAlphaT (const std::vector< TLorentzVector > &)
 

Static Private Member Functions

static double alphaT (const double, const double, const double)
 
static double CalcHT (const std::vector< TLorentzVector > &)
 
static double CalcMHT (const std::vector< TLorentzVector > &)
 
static double deltaHt (const std::vector< double > &)
 

Private Attributes

edm::InputTag inputJetTag_
 
edm::EDGetTokenT< reco::CaloJetCollectioninputJetTagToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file AlphaTVarProducer.h.

Constructor & Destructor Documentation

◆ AlphaTVarProducer()

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

Definition at line 26 of file AlphaTVarProducer.cc.

27  : inputJetTag_(iConfig.getParameter<edm::InputTag>("inputJetTag")) {
28  produces<std::vector<double>>();
29 
30  // set Token(-s)
31  inputJetTagToken_ = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("inputJetTag"));
32 
33  LogDebug("") << "Inputs: " << inputJetTag_.encode() << " ";
34 }

References edm::InputTag::encode(), edm::ParameterSet::getParameter(), inputJetTag_, inputJetTagToken_, and LogDebug.

◆ ~AlphaTVarProducer()

AlphaTVarProducer::~AlphaTVarProducer ( )
override

Definition at line 36 of file AlphaTVarProducer.cc.

36 {}

Member Function Documentation

◆ alphaT()

double AlphaTVarProducer::alphaT ( const double  HT,
const double  DHT,
const double  MHT 
)
staticprivate

Definition at line 104 of file AlphaTVarProducer.cc.

104  {
105  return 0.5 * (HT - DHT) / sqrt(HT * HT - MHT * MHT);
106 }

References nanoDQM_cfi::MHT, and mathSSE::sqrt().

Referenced by CalcAlphaT(), and produce().

◆ CalcAlphaT()

double AlphaTVarProducer::CalcAlphaT ( const std::vector< TLorentzVector > &  jets)
private

Definition at line 68 of file AlphaTVarProducer.cc.

68  {
69  std::vector<double> ETs;
70  TVector3 MHT{CalcMHT(jets), 0.0, 0.0};
71  float HT = CalcHT(jets);
72  // float HT = 0;
73  for (unsigned int i = 0; i < jets.size(); i++) {
74  if (jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5)
75  ETs.push_back(jets[i].Et());
76  // HT += jets[i].Et();
77  }
78  if (ETs.size() < 2.)
79  return 0.0;
80  if (ETs.size() > 16.)
81  return 0.0;
82  float DHT = deltaHt(ETs);
83 
84  float AlphaT = alphaT(HT, DHT, MHT.Mag());
85 
86  return AlphaT;
87 }

References alphaT(), CalcHT(), CalcMHT(), deltaHt(), mps_fire::i, singleTopDQM_cfi::jets, and nanoDQM_cfi::MHT.

Referenced by produce().

◆ CalcHT()

double AlphaTVarProducer::CalcHT ( const std::vector< TLorentzVector > &  jets)
staticprivate

Definition at line 108 of file AlphaTVarProducer.cc.

108  {
109  double HT = 0;
110  for (unsigned int i = 0; i < jets.size(); i++) {
111  if (jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5)
112  HT += jets[i].Et();
113  }
114 
115  return HT;
116 }

References tmtt::Utility::HT, mps_fire::i, and singleTopDQM_cfi::jets.

Referenced by CalcAlphaT(), and produce().

◆ CalcMHT()

double AlphaTVarProducer::CalcMHT ( const std::vector< TLorentzVector > &  jets)
staticprivate

Definition at line 118 of file AlphaTVarProducer.cc.

118  {
119  TVector3 MHT;
120  for (unsigned int i = 0; i < jets.size(); i++) {
121  if (jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5)
122  MHT -= jets[i].Vect();
123  }
124  MHT.SetZ(0.0);
125  return MHT.Mag();
126 }

References mps_fire::i, singleTopDQM_cfi::jets, and nanoDQM_cfi::MHT.

Referenced by CalcAlphaT().

◆ deltaHt()

double AlphaTVarProducer::deltaHt ( const std::vector< double > &  ETs)
staticprivate

Definition at line 89 of file AlphaTVarProducer.cc.

89  {
90  if (ETs.size() > 16.)
91  return 9999999;
92  std::vector<double> diff(1 << (ETs.size() - 1), 0.);
93  for (unsigned i = 0; i < diff.size(); i++)
94  for (unsigned j = 0; j < ETs.size(); j++)
95  diff[i] += ETs[j] * (1 - 2 * (int(i >> j) & 1));
96  std::vector<double>::const_iterator it;
97  double min = 9999999;
98  for (it = diff.begin(); it != diff.end(); it++)
99  if (*it < min)
100  min = *it;
101  return min;
102 }

References change_name::diff, mps_fire::i, dqmiolumiharvest::j, and min().

Referenced by CalcAlphaT().

◆ produce()

void AlphaTVarProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 39 of file AlphaTVarProducer.cc.

39  {
40  using namespace std;
41  using namespace edm;
42  using namespace reco;
43 
44  // get hold of collection of objects
46  iEvent.getByToken(inputJetTagToken_, calojet_handle);
47 
48  std::unique_ptr<std::vector<double>> result(new std::vector<double>);
49  // check the the input collections are available
50  if (calojet_handle.isValid()) {
51  std::vector<TLorentzVector> myJets;
52  reco::CaloJetCollection::const_iterator jetIt;
53  for (jetIt = calojet_handle->begin(); jetIt != calojet_handle->end(); jetIt++) {
54  TLorentzVector j;
55  j.SetPtEtaPhiE(jetIt->pt(), jetIt->eta(), jetIt->phi(), jetIt->energy());
56  myJets.push_back(j);
57  }
58 
59  double alphaT = CalcAlphaT(myJets);
60  double HT = CalcHT(myJets);
61 
62  result->push_back(alphaT);
63  result->push_back(HT);
64  }
65  iEvent.put(std::move(result));
66 }

References alphaT(), CalcAlphaT(), CalcHT(), iEvent, inputJetTagToken_, edm::HandleBase::isValid(), dqmiolumiharvest::j, eostools::move(), and mps_fire::result.

Member Data Documentation

◆ inputJetTag_

edm::InputTag AlphaTVarProducer::inputJetTag_
private

Definition at line 29 of file AlphaTVarProducer.h.

Referenced by AlphaTVarProducer().

◆ inputJetTagToken_

edm::EDGetTokenT<reco::CaloJetCollection> AlphaTVarProducer::inputJetTagToken_
private

Definition at line 32 of file AlphaTVarProducer.h.

Referenced by AlphaTVarProducer(), and produce().

change_name.diff
diff
Definition: change_name.py:13
mps_fire.i
i
Definition: mps_fire.py:428
AlphaTVarProducer::alphaT
static double alphaT(const double, const double, const double)
Definition: AlphaTVarProducer.cc:104
AlphaTVarProducer::inputJetTag_
edm::InputTag inputJetTag_
Definition: AlphaTVarProducer.h:29
min
T min(T a, T b)
Definition: MathUtil.h:58
AlphaTVarProducer::CalcMHT
static double CalcMHT(const std::vector< TLorentzVector > &)
Definition: AlphaTVarProducer.cc:118
edm
HLT enums.
Definition: AlignableModifier.h:19
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< reco::CaloJetCollection >
tmtt::Utility::HT
Definition: Utility.h:28
HT
Definition: HT.h:21
AlphaTVarProducer::CalcAlphaT
double CalcAlphaT(const std::vector< TLorentzVector > &)
Definition: AlphaTVarProducer.cc:68
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
nanoDQM_cfi.MHT
MHT
Definition: nanoDQM_cfi.py:785
AlphaTVarProducer::inputJetTagToken_
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
Definition: AlphaTVarProducer.h:32
iEvent
int iEvent
Definition: GenABIO.cc:224
AlphaTVarProducer::CalcHT
static double CalcHT(const std::vector< TLorentzVector > &)
Definition: AlphaTVarProducer.cc:108
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
AlphaTVarProducer::deltaHt
static double deltaHt(const std::vector< double > &)
Definition: AlphaTVarProducer.cc:89
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
mps_fire.result
result
Definition: mps_fire.py:311
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15