CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

TauJetCorrector Class Reference

#include <TauJetCorrector.h>

Inheritance diagram for TauJetCorrector:
JetCorrector

List of all members.

Classes

class  ParametrizationTauJet

Public Member Functions

virtual double correction (const LorentzVector &fJet) const
 get correction using Jet information only
virtual double correction (const reco::Jet &) const
 apply correction using Jet information only
virtual bool eventRequired () const
 if correction needs event information
void setParameters (std::string, int)
 TauJetCorrector (const edm::ParameterSet &fParameters)
virtual ~TauJetCorrector ()

Private Types

typedef std::map< double,
ParametrizationTauJet * > 
ParametersMap

Private Attributes

ParametersMap parametrization
int type

Detailed Description

jet energy corrections from Taujet calibration

Definition at line 13 of file TauJetCorrector.h.


Member Typedef Documentation

typedef std::map<double,ParametrizationTauJet *> TauJetCorrector::ParametersMap [private]

Definition at line 45 of file TauJetCorrector.h.


Constructor & Destructor Documentation

TauJetCorrector::TauJetCorrector ( const edm::ParameterSet fParameters)

Definition at line 99 of file TauJetCorrector.cc.

References edm::ParameterSet::getParameter().

{
  type = fConfig.getParameter<int>("TauTriggerType");
  setParameters (fConfig.getParameter <std::string> ("tagName"),type);
}
TauJetCorrector::~TauJetCorrector ( ) [virtual]

Definition at line 106 of file TauJetCorrector.cc.

{
  for(ParametersMap::iterator ip=parametrization.begin();ip!=parametrization.end();ip++) delete ip->second;
}

Member Function Documentation

double TauJetCorrector::correction ( const LorentzVector fJet) const [virtual]

get correction using Jet information only

Implements JetCorrector.

Definition at line 178 of file TauJetCorrector.cc.

References eta(), and edm::second().

{
  //cout<<" Start Apply Corrections "<<endl;
  if(parametrization.empty()) { return 1.; }
  
    double et=fJet.Et();
    double eta=fabs(fJet.Eta());
    
    //cout<<" Et and eta of jet "<<et<<" "<<eta<<endl;

    double etnew;
    std::map<double,ParametrizationTauJet*>::const_iterator ip=parametrization.upper_bound(eta);
    etnew=(--ip)->second->value(et,eta);

         //cout<<" The new energy found "<<etnew<<" "<<et<<endl;

         float mScale = etnew/et;
                        
     return mScale;
}
double TauJetCorrector::correction ( const reco::Jet fJet) const [virtual]

apply correction using Jet information only

Implements JetCorrector.

Definition at line 199 of file TauJetCorrector.cc.

References reco::LeafCandidate::p4().

                                                            {
        return correction(fJet.p4());
}
virtual bool TauJetCorrector::eventRequired ( ) const [inline, virtual]

if correction needs event information

Implements JetCorrector.

Definition at line 24 of file TauJetCorrector.h.

{return false;}
void TauJetCorrector::setParameters ( std::string  aCalibrationType,
int  itype 
)

Definition at line 111 of file TauJetCorrector.cc.

References JetCalibrationParameterSetTauJet::eta(), JetCalibrationParameterSetTauJet::neta(), JetCalibrationParameterSetTauJet::parameters(), edm::second(), JetCalibrationParameterSetTauJet::type(), and JetCalibrationParameterSetTauJet::valid().

{
     //cout<< " Start to set parameters "<<endl;
     type = itype;
     JetCalibrationParameterSetTauJet pset(aCalibrationType);
     
     if((!pset.valid()) && (aCalibrationType!="no"))
       {
         edm::LogError( "TauJetCorrector:Jet Corrections not found ")<<aCalibrationType<< 
           " not found! Cannot apply any correction ... For JetPlusTrack calibration only radii 0.5 and 0.7 are included for JetParton" << endl;
         return; 
       }
     if (aCalibrationType=="no") return;
      
     map<int,vector<double> > pq;
     map<int,vector<double> > pg;
     map<int,vector<double> > pqcd;
     map<int,double > etaboundx;
     int iq = 0;
     int ig = 0;
     int iqcd = 0;
     int mtype = 0;
    for(int ieta=0; ieta<pset.neta();ieta++)
    {
     if( pset.type(ieta) == 1 ) {pq[iq] = pset.parameters(ieta);    iq++;  mtype=(int)(pset.type(ieta));}
     if( pset.type(ieta) == 2 ) {pg[ig] = pset.parameters(ieta);    ig++;  mtype=(int)(pset.type(ieta));}
     if( pset.type(ieta) == 3 ) {pqcd[iqcd] = pset.parameters(ieta);iqcd++;mtype=(int)(pset.type(ieta));}
     if( pset.type(ieta) == -1 ) {etaboundx[mtype-1] = pset.eta(ieta);}
    }
    
    //cout<<" Number of parameters "<<iq<<" "<<ig<<" "<<iqcd<<endl;
    int mynum = 0;
      for(int ieta=0; ieta<pset.neta();ieta++)
        {
        //cout<<" New parmetrization "<<ieta<<" "<<pset.type(ieta)<<endl;
        
         if ( pset.type(ieta) == -1 ) continue;
         if( ieta < iq+1)
         {
          parametrization[pset.eta(ieta)]=new ParametrizationTauJet(pset.type(ieta),(*pq.find(ieta)).second,
                                                                                  (*etaboundx.find(0)).second);
           //cout<<" ALL "<<ieta<<" "<<((*pq.find(ieta)).second)[0]<<" "<<((*pq.find(ieta)).second)[1]<<" "<<
           //((*pq.find(ieta)).second)[2]<<endl;

         }
         if( ieta > iq && ieta < iq + ig + 2 ) 
         {
          mynum = ieta - iq - 1;
          parametrization[pset.eta(ieta)]=new ParametrizationTauJet(pset.type(ieta),(*pg.find(mynum)).second,
                                                                                  (*etaboundx.find(1)).second);
           //cout<<" One prong "<<((*pg.find(mynum)).second)[0]<<" "<<((*pg.find(mynum)).second)[1]<<" "<<
           //((*pg.find(mynum)).second)[2]<<endl;
           
         }
         if( ieta > iq + ig + 1) 
         {
          mynum = ieta - iq - ig - 2;
          //cout<<" Mynum "<<mynum<<" "<<ieta<<" "<<pset.type(ieta)<<endl;
          parametrization[pset.eta(ieta)]=new ParametrizationTauJet(pset.type(ieta),(*pqcd.find(mynum)).second,
                                                                                  (*etaboundx.find(2)).second);
           //cout<<" Two prongs "<<((*pqcd.find(mynum)).second)[0]<<" "<<((*pqcd.find(mynum)).second)[1]<<" "<<
           //((*pqcd.find(mynum)).second)[2]<<endl;
         }
        }
   //cout<<" Parameters inserted into mAlgorithm "<<endl;                                                                  
}

Member Data Documentation

Definition at line 46 of file TauJetCorrector.h.

int TauJetCorrector::type [private]

Definition at line 47 of file TauJetCorrector.h.