CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimGeneral/MixingModule/plugins/MixingWorker.cc

Go to the documentation of this file.
00001 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00002 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00003 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00004 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00005 #include "SimDataFormats/CrossingFrame/interface/PCrossingFrame.h"
00006 #include "MixingWorker.h"
00007 
00008 #include "boost/shared_ptr.hpp"
00009 
00010 namespace edm {
00011   template <>
00012   void MixingWorker<HepMCProduct>::addPileups(const EventPrincipal& ep,unsigned int eventNr) {
00013     // HepMCProduct does not come as a vector....
00014     boost::shared_ptr<Wrapper<HepMCProduct> const> shPtr = getProductByTag<HepMCProduct>(ep, tag_);
00015     if (shPtr) {
00016       LogDebug("MixingModule") <<"HepMC pileup objects  added, eventNr "<<eventNr << " Tag " << tag_ << std::endl;
00017       crFrame_->setPileupPtr(shPtr);
00018       crFrame_->addPileups(*shPtr->product());
00019     }
00020   }
00021 
00022   template <>
00023   void MixingWorker<HepMCProduct>::addSignals(const Event &e) { 
00024     //HepMC - here the interface is different!!!
00025     Handle<HepMCProduct>  result_t;
00026     bool got = e.getByLabel(tag_,result_t);
00027     if (got) {
00028       LogDebug("MixingModule") <<" adding HepMCProduct from signal event  with "<<tag_;
00029       crFrame_->addSignals(result_t.product(),e.id());  
00030     } else {
00031       LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for HepMCProduct with "<<tag_;
00032     }
00033   }
00034   
00035   template <>
00036   bool MixingWorker<HepMCProduct>::checkSignal(const Event &e) {   
00037           bool got;
00038           InputTag t;
00039           
00040           Handle<HepMCProduct> result_t;
00041           got = e.getByLabel(tag_,result_t);
00042           t = InputTag(tag_.label(),tag_.instance());
00043           
00044           if (got) {
00045                LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with "
00046                                        << " with InputTag= "<< t.encode();
00047           }
00048                                        
00049           return got;
00050   }
00051       
00052 }//namespace edm