CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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 "DataMixingHcalDigiWorkerProd.h"
00010 
00011 
00012 using namespace std;
00013 namespace edm {
00014   // Constructor 
00015   DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet& ps) : 
00016     HBHEPileInputTag_(ps.getParameter<edm::InputTag>("HBHEPileInputTag")),
00017     HOPileInputTag_(ps.getParameter<edm::InputTag>("HOPileInputTag")),
00018     HFPileInputTag_(ps.getParameter<edm::InputTag>("HFPileInputTag")),
00019     ZDCPileInputTag_(ps.getParameter<edm::InputTag>("ZDCPileInputTag")),
00020     theHBHESignalGenerator(HBHEPileInputTag_),
00021     theHOSignalGenerator(HOPileInputTag_),
00022     theHFSignalGenerator(HFPileInputTag_),
00023     theZDCSignalGenerator(ZDCPileInputTag_),
00024     label_(ps.getParameter<std::string>("Label"))
00025   {                                                         
00026 
00027     // get the subdetector names
00028     //    this->getSubdetectorNames();  //something like this may be useful to check what we are supposed to do...
00029 
00030     // declare the products to produce
00031 
00032     // Hcal 
00033     // Signal inputs now handled by HcalDigitizer - gets pSimHits directly
00034 
00035     HBHEDigiCollectionDM_ = ps.getParameter<std::string>("HBHEDigiCollectionDM");
00036     HODigiCollectionDM_   = ps.getParameter<std::string>("HODigiCollectionDM");
00037     HFDigiCollectionDM_   = ps.getParameter<std::string>("HFDigiCollectionDM");
00038     ZDCDigiCollectionDM_  = ps.getParameter<std::string>("ZDCDigiCollectionDM");
00039 
00040     // initialize HcalDigitizer here...
00041 
00042     myHcalDigitizer_ = new HcalDigitizer( ps );
00043 
00044     myHcalDigitizer_->setHBHENoiseSignalGenerator( & theHBHESignalGenerator );
00045     myHcalDigitizer_->setHFNoiseSignalGenerator( & theHFSignalGenerator );
00046     myHcalDigitizer_->setHONoiseSignalGenerator( & theHOSignalGenerator );
00047     myHcalDigitizer_->setZDCNoiseSignalGenerator( & theZDCSignalGenerator );
00048 
00049   }
00050                
00051   // Virtual destructor needed.
00052   DataMixingHcalDigiWorkerProd::~DataMixingHcalDigiWorkerProd() { 
00053     delete myHcalDigitizer_;
00054   }  
00055 
00056   void DataMixingHcalDigiWorkerProd::addHcalSignals(const edm::Event &e,const edm::EventSetup& ES) { 
00057     
00058     // nothing to do
00059 
00060   } // end of addHcalSignals
00061 
00062   void DataMixingHcalDigiWorkerProd::addHcalPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr,const edm::EventSetup& ES) {
00063   
00064     LogDebug("DataMixingHcalDigiWorkerProd") <<"\n===============> adding pileups from event  "<<ep->id()<<" for bunchcrossing "<<bcr;
00065 
00066     theHBHESignalGenerator.initializeEvent(ep, &ES);
00067     theHOSignalGenerator.initializeEvent(ep, &ES);
00068     theHFSignalGenerator.initializeEvent(ep, &ES);
00069     theZDCSignalGenerator.initializeEvent(ep, &ES);
00070 
00071     theHBHESignalGenerator.fill();
00072     theHOSignalGenerator.fill();
00073     theHFSignalGenerator.fill();
00074   }
00075 
00076   void DataMixingHcalDigiWorkerProd::putHcal(edm::Event &e,const edm::EventSetup& ES) {
00077 
00078     // Digitize
00079 
00080     myHcalDigitizer_->initializeEvent( e, ES );
00081     myHcalDigitizer_->finalizeEvent( e, ES );
00082   }
00083 
00084 } //edm
00085