CMS 3D CMS Logo

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::ProductRegistryHelper

List of all members.

Public Member Functions

 AlphaTVarProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~AlphaTVarProducer ()

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_

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.

                                                                   :
  inputJetTag_    (iConfig.getParameter<edm::InputTag>("inputJetTag")){

  produces<std::vector<double> >();

  LogDebug("") << "Inputs: "
               << inputJetTag_.encode() << " ";
}
AlphaTVarProducer::~AlphaTVarProducer ( )

Definition at line 35 of file AlphaTVarProducer.cc.

{
}

Member Function Documentation

double AlphaTVarProducer::alphaT ( const double  HT,
const double  DHT,
const double  MHT 
) [static, private]

Definition at line 103 of file AlphaTVarProducer.cc.

References mathSSE::sqrt().

Referenced by CalcAlphaT(), and produce().

                                                                                    {
        return 0.5 * ( HT - DHT ) / sqrt( HT*HT - MHT*MHT );
}
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().

                                                           {
        std::vector<double> ETs;
        TVector3 MHT = CalcMHT(jets);
        float HT = CalcHT(jets);
        //float HT = 0;
        for(unsigned int i = 0; i < jets.size(); i++){
                if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) ETs.push_back(jets[i].Et());
                //HT += jets[i].Et();
        }
        if(ETs.size() < 2.) return 0.0;
        if(ETs.size() > 16.) return 0.0;
        float DHT = deltaHt(ETs);
        
        float AlphaT = alphaT(HT,DHT,MHT.Mag());
        
        return AlphaT;
        
}
double AlphaTVarProducer::CalcHT ( const std::vector< TLorentzVector >  jets) [static, private]

Definition at line 108 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT(), and produce().

                                                       {

        double HT = 0;
        for(unsigned int i = 0; i < jets.size(); i++){
                if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) HT += jets[i].Et();
        }
        
        return HT;
        
}
double AlphaTVarProducer::CalcMHT ( const std::vector< TLorentzVector >  jets) [static, private]

Definition at line 119 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT().

                                                               {
        TVector3 MHT;
        for(unsigned int i = 0; i < jets.size(); i++){
                if(jets[i].Et() > 50. && fabs(jets[i].Eta()) < 2.5) MHT -= jets[i].Vect();
        }
        MHT.SetZ(0.0);
        return MHT.Mag();
}
double AlphaTVarProducer::deltaHt ( const std::vector< double > &  ETs) [static, private]

Definition at line 91 of file AlphaTVarProducer.cc.

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

Referenced by CalcAlphaT().

                                                              {
  if(ETs.size() > 16.) return 9999999;
        std::vector<double> diff( 1<<(ETs.size()-1) , 0. );
        for(unsigned i=0; i < diff.size(); i++)
                for(unsigned j=0; j < ETs.size(); j++)
                        diff[i] += ETs[j] * ( 1 - 2 * (int(i>>j)&1) ) ;
        std::vector<double>::const_iterator it;
        double min=9999999;
        for(it = diff.begin(); it !=diff.end(); it++) if(*it<min) min = *it;
        return min;
}
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(), dt_dqm_sourceclient_common_cff::reco, and query::result.

{
   using namespace std;
   using namespace edm;
   using namespace reco;


   // get hold of collection of objects
   edm::Handle<reco::CaloJetCollection> calojet_handle; 
   iEvent.getByLabel(inputJetTag_,calojet_handle);

   std::auto_ptr<std::vector<double> > result(new std::vector<double>); 
   // check the the input collections are available
   if (calojet_handle.isValid()){
     std::vector<TLorentzVector> myJets;
     reco::CaloJetCollection::const_iterator jetIt;
     for(jetIt = calojet_handle->begin(); jetIt != calojet_handle->end(); jetIt++){
       TLorentzVector j; j.SetPtEtaPhiE(jetIt->pt(),jetIt->eta(), jetIt->phi(), jetIt->energy());
       myJets.push_back(j);
     }

     double alphaT = CalcAlphaT(myJets);
     double HT     = CalcHT(myJets);

     result->push_back(alphaT);
     result->push_back(HT);
   }
   iEvent.put(result);
}

Member Data Documentation

Definition at line 29 of file AlphaTVarProducer.h.

Referenced by AlphaTVarProducer(), and produce().