CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HSCParticleSelector Class Reference

Inheritance diagram for HSCParticleSelector:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

bool Filter_
std::vector< CandidateSelector * > Selectors
edm::InputTag sourceTag_

Detailed Description

Definition at line 16 of file HSCParticleSelector.cc.


Constructor & Destructor Documentation

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

Definition at line 34 of file HSCParticleSelector.cc.

References Filter_, edm::ParameterSet::getParameter(), i, Selectors, and sourceTag_.

{
   // What is being produced
   produces<susybsm::HSCParticleCollection >();

   // Input products
   sourceTag_     = iConfig.getParameter<edm::InputTag> ("source");
   Filter_        = iConfig.getParameter<bool>          ("filter");

   // Load all the selections
   std::vector<edm::ParameterSet> SelectionParameters = iConfig.getParameter<std::vector<edm::ParameterSet> >("SelectionParameters");
   for(unsigned int i=0;i<SelectionParameters.size();i++){
      Selectors.push_back(new CandidateSelector(SelectionParameters[i]) );
   }
} 
HSCParticleSelector::~HSCParticleSelector ( )

Definition at line 51 of file HSCParticleSelector.cc.

                                         {
}

Member Function Documentation

void HSCParticleSelector::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 55 of file HSCParticleSelector.cc.

                                   {
}
void HSCParticleSelector::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 59 of file HSCParticleSelector.cc.

                                {
}
bool HSCParticleSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 63 of file HSCParticleSelector.cc.

References Filter_, edm::Event::getByLabel(), i, convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), query::result, Selectors, popcon_last_value_cfg::Source, and sourceTag_.

{
      // Source Collection
      edm::Handle<susybsm::HSCParticleCollection > SourceHandle;
      if (!iEvent.getByLabel(sourceTag_, SourceHandle)) {
            edm::LogError("") << ">>> HSCParticleCollection does not exist !!!";
            return false;
      }
      susybsm::HSCParticleCollection Source = *SourceHandle.product();


      // Output Collection
      susybsm::HSCParticleCollection* output = new susybsm::HSCParticleCollection;
      std::auto_ptr<susybsm::HSCParticleCollection> result(output);

      // cleanup the collection based on the input selection
      for(susybsm::HSCParticleCollection::iterator hscpcandidate = Source.begin(); hscpcandidate < Source.end(); ++hscpcandidate){
         bool decision = false;
         for(unsigned int i=0;i<Selectors.size();i++){decision |= Selectors[i]->isSelected(*hscpcandidate);}
         if(decision){
            susybsm::HSCParticle* newhscp = new susybsm::HSCParticle(*hscpcandidate);
            output->push_back(*newhscp);
         }
      }

      bool filterResult = !Filter_ || (Filter_ && output->size()>=1);

      iEvent.put(result);

      return filterResult;
}

Member Data Documentation

Definition at line 28 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().

Definition at line 29 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().

Definition at line 26 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().