CMS 3D CMS Logo

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

HLTTauRefCombiner Class Reference

#include <HLTTauRefCombiner.h>

Inheritance diagram for HLTTauRefCombiner:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Types

typedef math::XYZTLorentzVectorD LorentzVector
typedef std::vector
< LorentzVector
LorentzVectorCollection

Private Member Functions

bool match (const LorentzVector &, const LorentzVectorCollection &)

Private Attributes

std::vector< edm::InputTaginputColl_
double matchDeltaR_
std::string outName_

Detailed Description

Definition at line 21 of file HLTTauRefCombiner.h.


Member Typedef Documentation

Definition at line 30 of file HLTTauRefCombiner.h.

Definition at line 31 of file HLTTauRefCombiner.h.


Constructor & Destructor Documentation

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

Definition at line 9 of file HLTTauRefCombiner.cc.

References edm::ParameterSet::getParameter().

{
  inputColl_   = iConfig.getParameter< std::vector<InputTag> >("InputCollections");
  matchDeltaR_ = iConfig.getParameter<double>("MatchDeltaR");
  outName_     = iConfig.getParameter<string>("OutputCollection");

  produces<LorentzVectorCollection> ( outName_);
}
HLTTauRefCombiner::~HLTTauRefCombiner ( )

Definition at line 18 of file HLTTauRefCombiner.cc.

{ }

Member Function Documentation

bool HLTTauRefCombiner::match ( const LorentzVector lv,
const LorentzVectorCollection lvcol 
) [private]

Definition at line 84 of file HLTTauRefCombiner.cc.

References delta.

{
 bool matched=false;

 if(lvcol.size()>0)
  for(LorentzVectorCollection::const_iterator it = lvcol.begin();it!=lvcol.end();++it)
   {
          double delta = ROOT::Math::VectorUtil::DeltaR(lv,*it);
          if(delta<matchDeltaR_)
            {
              matched=true;
             
            }
   }



 return matched;
}
void HLTTauRefCombiner::produce ( edm::Event iEvent,
const edm::EventSetup iES 
) [virtual]

Implements edm::EDProducer.

Definition at line 20 of file HLTTauRefCombiner.cc.

References edm::Event::getByLabel(), i, j, edm::match(), edm::Event::put(), findQualityFiles::size, and tmp.

{
    auto_ptr<LorentzVectorCollection> out_product(new LorentzVectorCollection);

    //Create The Handles..
    std::vector< Handle<LorentzVectorCollection> > handles;

    bool allCollectionsExist = true;
    //Map the Handles to the collections if all collections exist
    for(size_t i = 0;i<inputColl_.size();++i)
      {
        edm::Handle<LorentzVectorCollection> tmp;
        if(iEvent.getByLabel(inputColl_[i],tmp))
          {
            handles.push_back(tmp);
          }
        else
          {
            allCollectionsExist = false;
          }

      }

    //The reference output object collection will be the first one..
    if(allCollectionsExist)
      {
        //loop on the first collection
        for(size_t i = 0; i < (handles[0])->size();++i)
          {
            bool MatchedObj = true;

            //get reference Vector
            const LorentzVector lvRef = (*(handles[0]))[i];
            
            //Loop on all other collections and match
                for(size_t j = 1; j < handles.size();++j)
                  {
                    if(!match(lvRef,*(handles[j])))
                      MatchedObj = false;

                  }
                
                //If the Object is Matched Everywhere store
                if(MatchedObj)
                  {
                    out_product->push_back(lvRef);
                  }


          }

        //Put product to file
        iEvent.put(out_product,outName_);

      }
    
    


}

Member Data Documentation

Definition at line 33 of file HLTTauRefCombiner.h.

Definition at line 34 of file HLTTauRefCombiner.h.

std::string HLTTauRefCombiner::outName_ [private]

Definition at line 35 of file HLTTauRefCombiner.h.