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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

double CalcAlphaT (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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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(), inputJetTag_, and LogDebug.

26  :
27  inputJetTag_ (iConfig.getParameter<edm::InputTag>("inputJetTag")){
28 
29  produces<std::vector<double> >();
30 
31  LogDebug("") << "Inputs: "
32  << inputJetTag_.encode() << " ";
33 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::InputTag inputJetTag_
std::string encode() const
Definition: InputTag.cc:164
AlphaTVarProducer::~AlphaTVarProducer ( )

Definition at line 35 of file AlphaTVarProducer.cc.

36 {
37 }

Member Function Documentation

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

Definition at line 103 of file AlphaTVarProducer.cc.

References mathSSE::sqrt().

Referenced by CalcAlphaT(), and produce().

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

Definition at line 72 of file AlphaTVarProducer.cc.

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

Referenced by produce().

72  {
73  std::vector<double> ETs;
74  TVector3 MHT = CalcMHT(jets);
75  float HT = CalcHT(jets);
76  //float HT = 0;
77  for(unsigned int i = 0; i < jets.size(); i++){
78  if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) ETs.push_back(jets[i].Et());
79  //HT += jets[i].Et();
80  }
81  if(ETs.size() < 2.) return 0.0;
82  if(ETs.size() > 16.) return 0.0;
83  float DHT = deltaHt(ETs);
84 
85  float AlphaT = alphaT(HT,DHT,MHT.Mag());
86 
87  return AlphaT;
88 
89 }
Definition: AlphaT.h:9
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 108 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT(), and produce().

108  {
109 
110  double HT = 0;
111  for(unsigned int i = 0; i < jets.size(); i++){
112  if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) HT += jets[i].Et();
113  }
114 
115  return HT;
116 
117 }
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 119 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT().

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

Definition at line 91 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT().

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

Implements edm::EDProducer.

Definition at line 41 of file AlphaTVarProducer.cc.

References alphaT(), CalcAlphaT(), CalcHT(), edm::Event::getByLabel(), inputJetTag_, j, edm::Event::put(), L1Trigger_dataformats::reco, and query::result.

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

42 {
43  using namespace std;
44  using namespace edm;
45  using namespace reco;
46 
47 
48  // get hold of collection of objects
50  iEvent.getByLabel(inputJetTag_,calojet_handle);
51 
52  std::auto_ptr<std::vector<double> > result(new std::vector<double>);
53  // check the the input collections are available
54  if (calojet_handle.isValid()){
55  std::vector<TLorentzVector> myJets;
56  reco::CaloJetCollection::const_iterator jetIt;
57  for(jetIt = calojet_handle->begin(); jetIt != calojet_handle->end(); jetIt++){
58  TLorentzVector j; j.SetPtEtaPhiE(jetIt->pt(),jetIt->eta(), jetIt->phi(), jetIt->energy());
59  myJets.push_back(j);
60  }
61 
62  double alphaT = CalcAlphaT(myJets);
63  double HT = CalcHT(myJets);
64 
65  result->push_back(alphaT);
66  result->push_back(HT);
67  }
68  iEvent.put(result);
69 }
double CalcAlphaT(std::vector< TLorentzVector >)
static double alphaT(const double, const double, const double)
edm::InputTag inputJetTag_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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(), and produce().