#include <CaloRecHitsProducer.h>
Public Member Functions | |
virtual void | beginRun (edm::Run &run, const edm::EventSetup &es) |
CaloRecHitsProducer (edm::ParameterSet const &p) | |
virtual void | endJob () |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
virtual | ~CaloRecHitsProducer () |
Private Attributes | |
bool | doDigis_ |
bool | doMiscalib_ |
EcalBarrelRecHitsMaker * | EcalBarrelRecHitsMaker_ |
EcalEndcapRecHitsMaker * | EcalEndcapRecHitsMaker_ |
EcalPreshowerRecHitsMaker * | EcalPreshowerRecHitsMaker_ |
HcalRecHitsMaker * | HcalRecHitsMaker_ |
const RandomEngine * | random |
std::vector< unsigned int > | theInputRecHitCollectionTypes |
std::vector< std::string > | theOutputRecHitCollections |
Definition at line 23 of file CaloRecHitsProducer.h.
CaloRecHitsProducer::CaloRecHitsProducer | ( | edm::ParameterSet const & | p | ) | [explicit] |
Definition at line 21 of file CaloRecHitsProducer.cc.
References gather_cfg::cout, doDigis_, doMiscalib_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, Exception, edm::ParameterSet::getParameter(), HcalRecHitsMaker_, collect_tpl::input, edm::Service< T >::isAvailable(), random, theInputRecHitCollectionTypes, and theOutputRecHitCollections.
: EcalPreshowerRecHitsMaker_(NULL),EcalBarrelRecHitsMaker_(NULL), EcalEndcapRecHitsMaker_(NULL), HcalRecHitsMaker_(NULL) { // Initialize the random number generator service edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable() ) { throw cms::Exception("Configuration") << "CaloRecHitsProducer requires the RandomGeneratorService\n" "which is not present in the configuration file.\n" "You must add the service in the configuration file\n" "or remove the module that requires it"; } random = new RandomEngine(&(*rng)); theInputRecHitCollectionTypes = p.getParameter<std::vector<unsigned> >("InputRecHitCollectionTypes"); theOutputRecHitCollections = p.getParameter<std::vector<std::string> >("OutputRecHitCollections"); doDigis_ = p.getParameter<bool>("doDigis"); doMiscalib_ = p.getParameter<bool>("doMiscalib"); edm::ParameterSet RecHitsParameters = p.getParameter<edm::ParameterSet>("RecHitsFactory"); for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) { switch ( theInputRecHitCollectionTypes[input] ) { case 1: { //Preshower if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<ESRecHitCollection>(theOutputRecHitCollections[input]); else produces<ESRecHitCollection>(); if (doDigis_) std::cout << " The digitization of the preshower is not implemented " << std::endl; EcalPreshowerRecHitsMaker_ = new EcalPreshowerRecHitsMaker(RecHitsParameters,random); } break; case 2: { //Ecal Barrel if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<EBRecHitCollection>(theOutputRecHitCollections[input]); else produces<EBRecHitCollection>(); if (doDigis_) produces<EBDigiCollection>(); EcalBarrelRecHitsMaker_ = new EcalBarrelRecHitsMaker(RecHitsParameters,random); } break; case 3: { //EcalEndcap if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<EERecHitCollection>(theOutputRecHitCollections[input]); else produces<EERecHitCollection>(); if (doDigis_) produces<EEDigiCollection>(); EcalEndcapRecHitsMaker_ = new EcalEndcapRecHitsMaker(RecHitsParameters,random); } break; case 4: { //HBHE if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<HBHERecHitCollection>(theOutputRecHitCollections[input]); else produces<HBHERecHitCollection>(); if (doDigis_) produces<HBHEDigiCollection>(); HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,4,random); } break; case 5: { //HO if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<HORecHitCollection>(theOutputRecHitCollections[input]); else produces<HORecHitCollection>(); if (doDigis_) produces<HODigiCollection>(); HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,5,random); } break; case 6: { //HF if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) produces<HFRecHitCollection>(theOutputRecHitCollections[input]); else produces<HFRecHitCollection>(); if(doDigis_) produces<HFDigiCollection>(); HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,6,random); } break; default: // Should not happen break; } } }
CaloRecHitsProducer::~CaloRecHitsProducer | ( | ) | [virtual] |
Definition at line 135 of file CaloRecHitsProducer.cc.
References random.
void CaloRecHitsProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | es | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 143 of file CaloRecHitsProducer.cc.
References doDigis_, doMiscalib_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, HcalRecHitsMaker_, EcalEndcapRecHitsMaker::init(), EcalPreshowerRecHitsMaker::init(), HcalRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), collect_tpl::input, and theInputRecHitCollectionTypes.
{ for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) { switch ( theInputRecHitCollectionTypes[input] ) { case 1: { // preshower EcalPreshowerRecHitsMaker_->init(es); } break; case 2: { // ecal barrel EcalBarrelRecHitsMaker_->init(es,doDigis_,doMiscalib_); } break; case 3: { // ecal endcap EcalEndcapRecHitsMaker_->init(es,doDigis_,doMiscalib_); } break; case 4: case 5: case 6: { HcalRecHitsMaker_->init(es,doDigis_,doMiscalib_); } break; default: break; } } }
void CaloRecHitsProducer::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 178 of file CaloRecHitsProducer.cc.
References EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, and HcalRecHitsMaker_.
{ //std::cout << " (Fast)RecHitsProducer terminating " << std::endl; if (EcalBarrelRecHitsMaker_) delete EcalBarrelRecHitsMaker_; if (EcalEndcapRecHitsMaker_) delete EcalEndcapRecHitsMaker_; if (EcalPreshowerRecHitsMaker_) delete EcalPreshowerRecHitsMaker_; if (HcalRecHitsMaker_) delete HcalRecHitsMaker_; }
void CaloRecHitsProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 187 of file CaloRecHitsProducer.cc.
References doDigis_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, HcalRecHitsMaker_, collect_tpl::input, EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), EcalPreshowerRecHitsMaker::loadEcalPreshowerRecHits(), HcalRecHitsMaker::loadHcalRecHits(), edm::Event::put(), theInputRecHitCollectionTypes, and theOutputRecHitCollections.
{ // create empty outputs for HCAL // see RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.cc for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) { switch ( theInputRecHitCollectionTypes[input] ) { case 1: { // preshower std::auto_ptr<ESRecHitCollection> reces(new ESRecHitCollection); // ECAL pre-shower EcalPreshowerRecHitsMaker_->loadEcalPreshowerRecHits(iEvent,*reces); if ( theOutputRecHitCollections.size()&& theOutputRecHitCollections[input].size()) iEvent.put(reces,theOutputRecHitCollections[input]); else iEvent.put(reces); break; } case 2: { // ecal barrel std::auto_ptr<EBRecHitCollection> receb(new EBRecHitCollection); // ECAL Barrel std::auto_ptr<EBDigiCollection> digieb(new EBDigiCollection(1)); EcalBarrelRecHitsMaker_->loadEcalBarrelRecHits(iEvent,*receb,*digieb); // std::cout << " ECALBarrel " << receb->size() << std::endl; if ( theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size()) iEvent.put(receb,theOutputRecHitCollections[input]); else iEvent.put(receb); if(doDigis_) iEvent.put(digieb); } break; case 3: { // ecal endcap std::auto_ptr<EERecHitCollection> recee(new EERecHitCollection); // ECAL Endcap std::auto_ptr<EEDigiCollection> digiee(new EEDigiCollection(1)); EcalEndcapRecHitsMaker_->loadEcalEndcapRecHits(iEvent,*recee,*digiee); // std::cout << " ECALEndcap " << recee->size() << std::endl; if ( theOutputRecHitCollections.size()&& theOutputRecHitCollections[input].size()) iEvent.put(recee,theOutputRecHitCollections[input]); else iEvent.put(recee); if(doDigis_) iEvent.put(digiee); } break; case 4: { // hbhe std::auto_ptr<HBHERecHitCollection> rec1(new HBHERecHitCollection); // Barrel+Endcap std::auto_ptr<HBHEDigiCollection> digihbhe(new HBHEDigiCollection); HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec1,*digihbhe); if ( theOutputRecHitCollections.size()&& theOutputRecHitCollections[input].size()) iEvent.put(rec1,theOutputRecHitCollections[input]); else iEvent.put(rec1); if(doDigis_) iEvent.put(digihbhe); } break; case 5: { //ho std::auto_ptr<HORecHitCollection> rec2(new HORecHitCollection); // Outer std::auto_ptr<HODigiCollection> digiho(new HODigiCollection); HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec2,*digiho); if(theOutputRecHitCollections.size()&& theOutputRecHitCollections[input].size()) iEvent.put(rec2,theOutputRecHitCollections[input]); else iEvent.put(rec2); if(doDigis_) iEvent.put(digiho); } break; case 6: { //hf std::auto_ptr<HFRecHitCollection> rec3(new HFRecHitCollection); // Forward std::auto_ptr<HFDigiCollection> digihf(new HFDigiCollection); HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec3,*digihf); if(theOutputRecHitCollections.size()&& theOutputRecHitCollections[input].size()) iEvent.put(rec3,theOutputRecHitCollections[input]); else iEvent.put(rec3); if(doDigis_) iEvent.put(digihf); } break; default: break; } } }
bool CaloRecHitsProducer::doDigis_ [private] |
Definition at line 35 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), and produce().
bool CaloRecHitsProducer::doMiscalib_ [private] |
Definition at line 36 of file CaloRecHitsProducer.h.
Referenced by beginRun(), and CaloRecHitsProducer().
Definition at line 39 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().
Definition at line 40 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().
Definition at line 38 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().
Definition at line 41 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().
const RandomEngine* CaloRecHitsProducer::random [private] |
Definition at line 47 of file CaloRecHitsProducer.h.
Referenced by CaloRecHitsProducer(), and ~CaloRecHitsProducer().
std::vector<unsigned int> CaloRecHitsProducer::theInputRecHitCollectionTypes [private] |
Definition at line 44 of file CaloRecHitsProducer.h.
Referenced by beginRun(), CaloRecHitsProducer(), and produce().
std::vector<std::string> CaloRecHitsProducer::theOutputRecHitCollections [private] |
Definition at line 43 of file CaloRecHitsProducer.h.
Referenced by CaloRecHitsProducer(), and produce().