CMS 3D CMS Logo

Public Member Functions | Private Attributes

ESRecHitsMerger Class Reference

#include <ESRecHitsMerger.h>

Inheritance diagram for ESRecHitsMerger:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginJob (void)
void endJob (void)
 ESRecHitsMerger (const edm::ParameterSet &pset)
void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~ESRecHitsMerger ()

Private Attributes

bool debug_
edm::InputTag EgammaSourceES_
edm::InputTag EtaSourceES_
std::string InputRecHitES_
edm::InputTag JetsSourceES_
edm::InputTag MuonsSourceES_
std::string OutputLabelES_
edm::InputTag Pi0SourceES_
edm::InputTag RestSourceES_
edm::InputTag TausSourceES_

Detailed Description

Definition at line 17 of file ESRecHitsMerger.h.


Constructor & Destructor Documentation

ESRecHitsMerger::ESRecHitsMerger ( const edm::ParameterSet pset)

Definition at line 17 of file ESRecHitsMerger.cc.

References edm::ParameterSet::getUntrackedParameter().

                                                            {

 debug_ = pset.getUntrackedParameter<bool>("debug");
 
 EgammaSourceES_ = pset.getUntrackedParameter<edm::InputTag>("EgammaSource_ES",edm::InputTag("dummyEgamma"));
 MuonsSourceES_  = pset.getUntrackedParameter<edm::InputTag>("MuonsSource_ES",edm::InputTag("dummyMuons"));
 TausSourceES_  = pset.getUntrackedParameter<edm::InputTag>("TausSource_ES",edm::InputTag("dummyTaus"));
 JetsSourceES_   = pset.getUntrackedParameter<edm::InputTag>("JetsSource_ES",edm::InputTag("dummyJets"));
 RestSourceES_   = pset.getUntrackedParameter<edm::InputTag>("RestSource_ES",edm::InputTag("dummyRest"));
 Pi0SourceES_   = pset.getUntrackedParameter<edm::InputTag>("Pi0Source_ES",edm::InputTag("dummyPi0"));
 EtaSourceES_   = pset.getUntrackedParameter<edm::InputTag>("EtaSource_ES",edm::InputTag("dummyEta"));
  

 OutputLabelES_ = pset.getUntrackedParameter<std::string>("OutputLabel_ES");
 
 InputRecHitES_ = pset.getUntrackedParameter<std::string>("EcalRecHitCollectionES");
 
 produces<EcalRecHitCollection>(OutputLabelES_);
 
}
ESRecHitsMerger::~ESRecHitsMerger ( ) [virtual]

Definition at line 40 of file ESRecHitsMerger.cc.

                                  {
}

Member Function Documentation

void ESRecHitsMerger::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 44 of file ESRecHitsMerger.cc.

                              {
}
void ESRecHitsMerger::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 47 of file ESRecHitsMerger.cc.

                            {
}
void ESRecHitsMerger::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 50 of file ESRecHitsMerger.cc.

References begin, gather_cfg::cout, edm::EventID::event(), edm::Event::getManyByType(), i, edm::EventBase::id(), edm::Event::put(), edm::EventID::run(), and findQualityFiles::size.

                                                                      {

 if (debug_) std::cout << " ESRecHitMerger : Run " << e.id().run() << " Event " << e.id().event() << std::endl;


 std::vector< edm::Handle<ESRecHitCollection> > EcalRecHits_done;
 e.getManyByType(EcalRecHits_done);
 
 std::auto_ptr<EcalRecHitCollection> ESMergedRecHits(new EcalRecHitCollection);
 
 
 unsigned int nColl = EcalRecHits_done.size();
 
 int nES = 0;


 for (unsigned int i=0; i < nColl; i++) {

   std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
   std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();


   if (debug_){
     std::cout<<"ESrechit to be merged from "<<module_label.c_str()<<" "<<instance.c_str()<<std::endl;
   }
   
   if ( module_label != EgammaSourceES_.label() && 
        module_label != MuonsSourceES_.label() &&
        module_label != JetsSourceES_.label() &&
        module_label != TausSourceES_.label() &&
        module_label != RestSourceES_.label() &&
        module_label != Pi0SourceES_.label() &&
        module_label != EtaSourceES_.label()) continue;
   
   if (instance == InputRecHitES_) {
     nES += EcalRecHits_done[i] -> size();
   }
   
 }
 
 
 ESMergedRecHits -> reserve(nES);
 
 if (debug_) std::cout << " Number of ES Rechits to merge  = " << nES << std::endl;
 
 for (unsigned int i=0; i < nColl; i++) {
   std::string instance = EcalRecHits_done[i].provenance()->productInstanceName(); 

   std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
   if ( module_label != EgammaSourceES_.label() && 
        module_label != MuonsSourceES_.label() &&
        module_label != JetsSourceES_.label() &&
        module_label != TausSourceES_.label() &&
        module_label != RestSourceES_.label() &&
        module_label != Pi0SourceES_.label() && 
        module_label != EtaSourceES_.label() ) continue;

   if (instance == InputRecHitES_) {
     for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
       ESMergedRecHits -> push_back(*it);
     }
   }
   
 }
 
 
 // std::cout << " avant le put " << std::endl;
 e.put(ESMergedRecHits,OutputLabelES_);
 // std::cout << " apres le put " << std::endl;

}

Member Data Documentation

bool ESRecHitsMerger::debug_ [private]

Definition at line 39 of file ESRecHitsMerger.h.

Definition at line 27 of file ESRecHitsMerger.h.

Definition at line 33 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::InputRecHitES_ [private]

Definition at line 36 of file ESRecHitsMerger.h.

Definition at line 30 of file ESRecHitsMerger.h.

Definition at line 28 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::OutputLabelES_ [private]

Definition at line 34 of file ESRecHitsMerger.h.

Definition at line 32 of file ESRecHitsMerger.h.

Definition at line 31 of file ESRecHitsMerger.h.

Definition at line 29 of file ESRecHitsMerger.h.