CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TauJetCorrectorExample Class Reference

#include <MyTauAndHLTAnalyzer/TauJetCorrectorExample/src/TauJetCorrectorExample.cc>

Inheritance diagram for TauJetCorrectorExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

 TauJetCorrectorExample (const edm::ParameterSet &)
 ~TauJetCorrectorExample ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()

Private Attributes

std::string jetname
int nEvt
int njets
JetCorrectortaucorrector
std::string tauCorrectorname
std::string tauname

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 61 of file TauJetCorrectorExample.cc.


Constructor & Destructor Documentation

TauJetCorrectorExample::TauJetCorrectorExample ( const edm::ParameterSet iConfig) [explicit]

Definition at line 99 of file TauJetCorrectorExample.cc.

                                                                            :
  jetname(iConfig.getUntrackedParameter<std::string>("JetHandle","iterativeCone5CaloJets")),
  tauname(iConfig.getUntrackedParameter<std::string>("TauHandle","coneIsolation")),
  tauCorrectorname(iConfig.getUntrackedParameter<std::string>("tauCorrHandle", "TauJetCorrectorIcone5")),
  nEvt(0), njets(0), taucorrector(0)
{
  //now do what ever initialization is needed

}
TauJetCorrectorExample::~TauJetCorrectorExample ( )

Definition at line 110 of file TauJetCorrectorExample.cc.

{
 
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void TauJetCorrectorExample::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 125 of file TauJetCorrectorExample.cc.

References JetCorrector::correction(), gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), nEvt, njets, pileupReCalc_HLTpaths::scale, metsig::tau, taucorrector, tauCorrectorname, and tauname.

{
  taucorrector = const_cast<JetCorrector*>(JetCorrector::getJetCorrector(tauCorrectorname, iSetup));

  using namespace edm;
  
#ifdef THIS_IS_AN_EVENT_EXAMPLE
  Handle<ExampleData> pIn;
  iEvent.getByLabel("example",pIn);
#endif
   
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
  ESHandle<SetupData> pSetup;
  iSetup.get<SetupRecord>().get(pSetup);
#endif
  using namespace edm;

  // this analyzer produces a small root file with basic candidates and some MC information
  // some additional print statements
  ++nEvt;
  if((nEvt%10==0 && nEvt<=100)||(nEvt%100==0 && nEvt>100))
    std::cout << "reading event " << nEvt << std::endl;

  // get taus
  Handle<reco::IsolatedTauTagInfoCollection> tauTagInfoHandle;
  iEvent.getByLabel(tauname,tauTagInfoHandle);
  reco::IsolatedTauTagInfoCollection::const_iterator tau=tauTagInfoHandle->begin();
  
  //get tau jet corrector
  //const JetCorrector* taucorrector = JetCorrector::getJetCorrector(tauCorrectorname, iSetup);

  //  std::cout << "setting everything to 0 just before tau loop" << std::endl;
  njets=0;

    std::cout << "starting tau loop" << std::endl;
    for(tau=tauTagInfoHandle->begin();tau!=tauTagInfoHandle->end() && njets<10;++tau) {

        //Should check tau discriminator, but not done here

                double pt = tau->jet().get()->et();
        
                //correction returns correction factor which must then be applied to original ET
                double scale = taucorrector->correction(tau->jet().get()->p4());
                double ptcorr = tau->jet().get()->et() * scale;
       
                std::cout << "Tau jet: Original Et = " << pt << " Corrected Et = " << ptcorr << std::endl;

                ++njets;
        }


}
void TauJetCorrectorExample::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file TauJetCorrectorExample.cc.

{
        
//      taucorrector = const_cast<JetCorrector*>(JetCorrector::getJetCorrector(tauCorrectorname, iSetup));
        
}
void TauJetCorrectorExample::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 192 of file TauJetCorrectorExample.cc.

                               { 
}

Member Data Documentation

std::string TauJetCorrectorExample::jetname [private]

Definition at line 73 of file TauJetCorrectorExample.cc.

Definition at line 77 of file TauJetCorrectorExample.cc.

Referenced by analyze().

Definition at line 78 of file TauJetCorrectorExample.cc.

Referenced by analyze().

Definition at line 80 of file TauJetCorrectorExample.cc.

Referenced by analyze().

Definition at line 75 of file TauJetCorrectorExample.cc.

Referenced by analyze().

std::string TauJetCorrectorExample::tauname [private]

Definition at line 74 of file TauJetCorrectorExample.cc.

Referenced by analyze().