CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

HiGenCleaner< T2 > Class Template Reference

#include <yetkin/HiGenCleaner/src/HiGenCleaner.cc>

Inheritance diagram for HiGenCleaner< T2 >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector< T2 > T2Collection

Public Member Functions

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

Private Member Functions

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

Private Attributes

double deltaR_
bool fillDummy_
InputTag jetSrc_
bool makeNew_
double ptCut_

Detailed Description

template<class T2>
class HiGenCleaner< T2 >

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

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

Definition at line 52 of file HiGenCleaner.cc.


Member Typedef Documentation

template<class T2 >
typedef std::vector<T2> HiGenCleaner< T2 >::T2Collection

Definition at line 54 of file HiGenCleaner.cc.


Constructor & Destructor Documentation

template<class T2 >
HiGenCleaner< T2 >::HiGenCleaner ( const edm::ParameterSet iConfig) [explicit]

Definition at line 84 of file HiGenCleaner.cc.

References HiGenCleaner< T2 >::jetSrc_, and edm::InputTag::label().

                                                             :
  jetSrc_(iConfig.getParameter<InputTag>( "src")),
  deltaR_(iConfig.getParameter<double>("deltaR")),
  ptCut_(iConfig.getParameter<double>("ptCut")),
  makeNew_(iConfig.getUntrackedParameter<bool>("createNewCollection",true)),
  fillDummy_(iConfig.getUntrackedParameter<bool>("fillDummyEntries",true))
{
   std::string alias = jetSrc_.label();
   produces<T2Collection>().setBranchAlias (alias);
}
template<class T2 >
HiGenCleaner< T2 >::~HiGenCleaner ( )

Definition at line 96 of file HiGenCleaner.cc.

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

Member Function Documentation

template<class T2 >
void HiGenCleaner< T2 >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 110 of file HiGenCleaner.cc.

References Geom::deltaR(), deltaR_, edm::Event::getByLabel(), fwrapper::jets, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, and corrVsCorr::selection.

{
   using namespace edm;
   using namespace reco;

   auto_ptr<T2Collection> jets;
   jets = auto_ptr<T2Collection>(new T2Collection);
   
   edm::Handle<edm::View<T2> > genjets;
   iEvent.getByLabel(jetSrc_,genjets);

   int jetsize = genjets->size();

   vector<int> selection;
   for(int ijet = 0; ijet < jetsize; ++ijet){
      selection.push_back(-1);
   }

   vector<int> selectedIndices;
   vector<int> removedIndices;

   for(int ijet = 0; ijet < jetsize; ++ijet){

     const T2* jet1 = &((*genjets)[ijet]);
     
     if(selection[ijet] == -1){
       selection[ijet] = 1;
       for(int ijet2 = 0; ijet2 < jetsize; ++ijet2){

         if(ijet2 == ijet) continue;
         
         const T2* jet2 = &((*genjets)[ijet2]);
            
         if(Geom::deltaR(jet1->momentum(),jet2->momentum()) < deltaR_){
           if(jet1->et() < jet2->et()){
             selection[ijet] = 0;
             removedIndices.push_back(ijet);
             break;
           }else{
             selection[ijet2] = 0;
             removedIndices.push_back(ijet2);
           }
         }
         }
     }
     
     double etjet = ((*genjets)[ijet]).et();
      
      if(selection[ijet] == 1 && etjet > ptCut_){ 
         selectedIndices.push_back(ijet);
         jets->push_back(*jet1);
      }
   }
   iEvent.put(jets);

}

Member Data Documentation

template<class T2 >
double HiGenCleaner< T2 >::deltaR_ [private]

Definition at line 63 of file HiGenCleaner.cc.

template<class T2 >
bool HiGenCleaner< T2 >::fillDummy_ [private]

Definition at line 66 of file HiGenCleaner.cc.

template<class T2 >
InputTag HiGenCleaner< T2 >::jetSrc_ [private]

Definition at line 62 of file HiGenCleaner.cc.

Referenced by HiGenCleaner< T2 >::HiGenCleaner().

template<class T2 >
bool HiGenCleaner< T2 >::makeNew_ [private]

Definition at line 65 of file HiGenCleaner.cc.

template<class T2 >
double HiGenCleaner< T2 >::ptCut_ [private]

Definition at line 64 of file HiGenCleaner.cc.