CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~AlphaTVarProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::CaloJetCollection
inputJetTagToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 15 of file AlphaTVarProducer.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file AlphaTVarProducer.cc.

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

26  :
27  inputJetTag_ (iConfig.getParameter<edm::InputTag>("inputJetTag")){
28 
29  produces<std::vector<double> >();
30 
31  //set Token(-s)
32  inputJetTagToken_ = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("inputJetTag"));
33 
34  LogDebug("") << "Inputs: "
35  << inputJetTag_.encode() << " ";
36 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::InputTag inputJetTag_
std::string encode() const
Definition: InputTag.cc:164
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
AlphaTVarProducer::~AlphaTVarProducer ( )

Definition at line 38 of file AlphaTVarProducer.cc.

39 {
40 }

Member Function Documentation

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

Definition at line 106 of file AlphaTVarProducer.cc.

References mathSSE::sqrt().

Referenced by CalcAlphaT(), and produce().

106  {
107  return 0.5 * ( HT - DHT ) / sqrt( HT*HT - MHT*MHT );
108 }
T sqrt(T t)
Definition: SSEVec.h:48
Definition: HT.h:20
double AlphaTVarProducer::CalcAlphaT ( const std::vector< TLorentzVector > &  jets)
private

Definition at line 75 of file AlphaTVarProducer.cc.

References alphaT(), CalcHT(), CalcMHT(), deltaHt(), reco::tau::disc::Eta(), and i.

Referenced by produce().

75  {
76  std::vector<double> ETs;
77  TVector3 MHT{CalcMHT(jets),0.0,0.0};
78  float HT = CalcHT(jets);
79  //float HT = 0;
80  for(unsigned int i = 0; i < jets.size(); i++){
81  if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) ETs.push_back(jets[i].Et());
82  //HT += jets[i].Et();
83  }
84  if(ETs.size() < 2.) return 0.0;
85  if(ETs.size() > 16.) return 0.0;
86  float DHT = deltaHt(ETs);
87 
88  float AlphaT = alphaT(HT,DHT,MHT.Mag());
89 
90  return AlphaT;
91 
92 }
int i
Definition: DBlmapReader.cc:9
static double CalcMHT(const std::vector< TLorentzVector > &)
static double alphaT(const double, const double, const double)
vector< PseudoJet > jets
static double deltaHt(const std::vector< double > &)
static double CalcHT(const std::vector< TLorentzVector > &)
Definition: HT.h:20
double AlphaTVarProducer::CalcHT ( const std::vector< TLorentzVector > &  jets)
staticprivate

Definition at line 111 of file AlphaTVarProducer.cc.

References reco::tau::disc::Eta(), and i.

Referenced by CalcAlphaT(), and produce().

111  {
112 
113  double HT = 0;
114  for(unsigned int i = 0; i < jets.size(); i++){
115  if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) HT += jets[i].Et();
116  }
117 
118  return HT;
119 
120 }
int i
Definition: DBlmapReader.cc:9
vector< PseudoJet > jets
Definition: HT.h:20
double AlphaTVarProducer::CalcMHT ( const std::vector< TLorentzVector > &  jets)
staticprivate

Definition at line 122 of file AlphaTVarProducer.cc.

References reco::tau::disc::Eta(), and i.

Referenced by CalcAlphaT().

122  {
123  TVector3 MHT;
124  for(unsigned int i = 0; i < jets.size(); i++){
125  if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) MHT -= jets[i].Vect();
126  }
127  MHT.SetZ(0.0);
128  return MHT.Mag();
129 }
int i
Definition: DBlmapReader.cc:9
vector< PseudoJet > jets
double AlphaTVarProducer::deltaHt ( const std::vector< double > &  ETs)
staticprivate

Definition at line 94 of file AlphaTVarProducer.cc.

References diffTreeTool::diff, i, j, and min().

Referenced by CalcAlphaT().

94  {
95  if(ETs.size() > 16.) return 9999999;
96  std::vector<double> diff( 1<<(ETs.size()-1) , 0. );
97  for(unsigned i=0; i < diff.size(); i++)
98  for(unsigned j=0; j < ETs.size(); j++)
99  diff[i] += ETs[j] * ( 1 - 2 * (int(i>>j)&1) ) ;
100  std::vector<double>::const_iterator it;
101  double min=9999999;
102  for(it = diff.begin(); it !=diff.end(); it++) if(*it<min) min = *it;
103  return min;
104 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58
void AlphaTVarProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 44 of file AlphaTVarProducer.cc.

References alphaT(), CalcAlphaT(), CalcHT(), edm::Event::getByToken(), inputJetTagToken_, j, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, and query::result.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

45 {
46  using namespace std;
47  using namespace edm;
48  using namespace reco;
49 
50 
51  // get hold of collection of objects
53  iEvent.getByToken(inputJetTagToken_, calojet_handle);
54 
55  std::auto_ptr<std::vector<double> > result(new std::vector<double>);
56  // check the the input collections are available
57  if (calojet_handle.isValid()){
58  std::vector<TLorentzVector> myJets;
59  reco::CaloJetCollection::const_iterator jetIt;
60  for(jetIt = calojet_handle->begin(); jetIt != calojet_handle->end(); jetIt++){
61  TLorentzVector j; j.SetPtEtaPhiE(jetIt->pt(),jetIt->eta(), jetIt->phi(), jetIt->energy());
62  myJets.push_back(j);
63  }
64 
65  double alphaT = CalcAlphaT(myJets);
66  double HT = CalcHT(myJets);
67 
68  result->push_back(alphaT);
69  result->push_back(HT);
70  }
71  iEvent.put(result);
72 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
static double alphaT(const double, const double, const double)
double CalcAlphaT(const std::vector< TLorentzVector > &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
static double CalcHT(const std::vector< TLorentzVector > &)
Definition: HT.h:20

Member Data Documentation

edm::InputTag AlphaTVarProducer::inputJetTag_
private

Definition at line 29 of file AlphaTVarProducer.h.

Referenced by AlphaTVarProducer().

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

Definition at line 32 of file AlphaTVarProducer.h.

Referenced by AlphaTVarProducer(), and produce().