CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc

Go to the documentation of this file.
00001 // File: DataMixingHcalDigiWorkerProd.cc
00002 // Description:  see DataMixingHcalDigiWorkerProd.h
00003 // Author:  Mike Hildreth, University of Notre Dame
00004 //
00005 //--------------------------------------------
00006 
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "FWCore/Utilities/interface/EDMException.h"
00009 #include "FWCore/Framework/interface/Selector.h"
00010 #include "DataMixingHcalDigiWorkerProd.h"
00011 
00012 
00013 using namespace std;
00014 namespace edm {
00015   // Constructor 
00016   DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet& ps) : 
00017     HBHEPileInputTag_(ps.getParameter<edm::InputTag>("HBHEPileInputTag")),
00018     HOPileInputTag_(ps.getParameter<edm::InputTag>("HOPileInputTag")),
00019     HFPileInputTag_(ps.getParameter<edm::InputTag>("HFPileInputTag")),
00020     ZDCPileInputTag_(ps.getParameter<edm::InputTag>("ZDCPileInputTag")),
00021     theHBHESignalGenerator(HBHEPileInputTag_),
00022     theHOSignalGenerator(HOPileInputTag_),
00023     theHFSignalGenerator(HFPileInputTag_),
00024     theZDCSignalGenerator(ZDCPileInputTag_),
00025     label_(ps.getParameter<std::string>("Label"))
00026   {                                                         
00027 
00028     // get the subdetector names
00029     //    this->getSubdetectorNames();  //something like this may be useful to check what we are supposed to do...
00030 
00031     // create input selector
00032     //    if (label_.size()>0){
00033     //  sel_=new Selector( ModuleLabelSelector(label_));
00034     // }
00035     //else {
00036     //  sel_=new Selector( MatchAllSelector());
00037     //}
00038 
00039     // declare the products to produce
00040 
00041     // Hcal 
00042     // Signal inputs now handled by HcalDigitizer - gets pSimHits directly
00043 
00044     HBHEDigiCollectionDM_ = ps.getParameter<std::string>("HBHEDigiCollectionDM");
00045     HODigiCollectionDM_   = ps.getParameter<std::string>("HODigiCollectionDM");
00046     HFDigiCollectionDM_   = ps.getParameter<std::string>("HFDigiCollectionDM");
00047     ZDCDigiCollectionDM_  = ps.getParameter<std::string>("ZDCDigiCollectionDM");
00048 
00049     // initialize HcalDigitizer here...
00050 
00051     myHcalDigitizer_ = new HcalDigitizer( ps );
00052 
00053     myHcalDigitizer_->setHBHENoiseSignalGenerator( & theHBHESignalGenerator );
00054     myHcalDigitizer_->setHFNoiseSignalGenerator( & theHFSignalGenerator );
00055     myHcalDigitizer_->setHONoiseSignalGenerator( & theHOSignalGenerator );
00056     myHcalDigitizer_->setZDCNoiseSignalGenerator( & theZDCSignalGenerator );
00057 
00058   }
00059                
00060   // Virtual destructor needed.
00061   DataMixingHcalDigiWorkerProd::~DataMixingHcalDigiWorkerProd() { 
00062     delete myHcalDigitizer_;
00063     //delete sel_;
00064     //sel_=0;
00065   }  
00066 
00067   void DataMixingHcalDigiWorkerProd::addHcalSignals(const edm::Event &e,const edm::EventSetup& ES) { 
00068     
00069     // nothing to do
00070 
00071   } // end of addHcalSignals
00072 
00073   void DataMixingHcalDigiWorkerProd::addHcalPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr,const edm::EventSetup& ES) {
00074   
00075     LogDebug("DataMixingHcalDigiWorkerProd") <<"\n===============> adding pileups from event  "<<ep->id()<<" for bunchcrossing "<<bcr;
00076 
00077     theHBHESignalGenerator.initializeEvent(ep, &ES);
00078     theHOSignalGenerator.initializeEvent(ep, &ES);
00079     theHFSignalGenerator.initializeEvent(ep, &ES);
00080     theZDCSignalGenerator.initializeEvent(ep, &ES);
00081 
00082     theHBHESignalGenerator.fill();
00083     theHOSignalGenerator.fill();
00084     theHFSignalGenerator.fill();
00085   }
00086 
00087   void DataMixingHcalDigiWorkerProd::putHcal(edm::Event &e,const edm::EventSetup& ES) {
00088 
00089     // Digitize
00090 
00091     myHcalDigitizer_->produce( e, ES );
00092   }
00093 
00094 } //edm
00095