Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:37

0001 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0002 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0003 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0004 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0005 #include "SimDataFormats/CrossingFrame/interface/PCrossingFrame.h"
0006 #include "MixingWorker.h"
0007 
0008 #include <memory>
0009 
0010 namespace edm {
0011   template <>
0012   void MixingWorker<HepMCProduct>::addPileups(const EventPrincipal& ep,
0013                                               ModuleCallingContext const* mcc,
0014                                               unsigned int eventNr) {
0015     // HepMCProduct does not come as a vector....
0016     for (InputTag const& tag : allTags_) {
0017       std::shared_ptr<Wrapper<HepMCProduct> const> shPtr = getProductByTag<HepMCProduct>(ep, tag, mcc);
0018       if (shPtr) {
0019         LogDebug("MixingModule") << "HepMC pileup objects  added, eventNr " << eventNr << " Tag " << tag << std::endl;
0020         crFrame_->setPileupPtr(shPtr);
0021         crFrame_->addPileups(*shPtr->product());
0022         break;
0023       }
0024     }
0025   }
0026 
0027   template <>
0028   void MixingWorker<HepMCProduct>::addSignals(const Event& e) {
0029     //HepMC - here the interface is different!!!
0030     bool got = false;
0031     Handle<HepMCProduct> result_t;
0032     for (InputTag const& tag : allTags_) {
0033       got = e.getByLabel(tag, result_t);
0034       if (got) {
0035         LogDebug("MixingModule") << "adding HepMCProduct from signal event  with " << tag;
0036         crFrame_->addSignals(result_t.product(), e.id());
0037         break;
0038       }
0039     }
0040     if (!got) {
0041       LogInfo("MixingModule") << "!!!!!!! Did not get any signal data for HepMCProduct with " << allTags_[0];
0042     }
0043   }
0044 
0045   template <>
0046   bool MixingWorker<HepMCProduct>::checkSignal(const Event& e) {
0047     bool got = false;
0048     Handle<HepMCProduct> result_t;
0049     for (InputTag const& tag : allTags_) {
0050       got = e.getByLabel(tag, result_t);
0051       if (got) {
0052         InputTag t = InputTag(tag.label(), tag.instance());
0053         LogInfo("MixingModule") << " Will create a CrossingFrame for HepMCProduct with "
0054                                 << " with InputTag= " << t.encode();
0055         break;
0056       }
0057     }
0058     return got;
0059   }
0060 }  //namespace edm