CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/HLTrigger/HLTcore/plugins/TriggerSummaryProducerRAW.cc

Go to the documentation of this file.
00001 
00012 #include "HLTrigger/HLTcore/interface/TriggerSummaryProducerRAW.h"
00013 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
00014 
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 
00017 #include<string>
00018 
00019 //
00020 // constructors and destructor
00021 //
00022 TriggerSummaryProducerRAW::TriggerSummaryProducerRAW(const edm::ParameterSet& ps) : 
00023   pn_(ps.getParameter<std::string>("processName")),
00024   selector_(edm::ProcessNameSelector(pn_)),
00025   tns_(), fobs_()
00026 {
00027   if (pn_=="@") {
00028     // use tns
00029     if (edm::Service<edm::service::TriggerNamesService>().isAvailable()) {
00030       // get tns pointer
00031       tns_ = edm::Service<edm::service::TriggerNamesService>().operator->();
00032       if (tns_!=0) {
00033         pn_=tns_->getProcessName();
00034       } else {
00035         edm::LogError("TriggerSummaryProducerRaw") << "HLT Error: TriggerNamesService pointer = 0!";
00036         pn_="*";
00037       }
00038     } else {
00039       edm::LogError("TriggerSummaryProducerRaw") << "HLT Error: TriggerNamesService not available!";
00040       pn_="*";
00041     }
00042     selector_=edm::ProcessNameSelector(pn_);
00043   }
00044 
00045   LogDebug("TriggerSummaryProducerRaw") << "Using process name: '" << pn_ <<"'";
00046   produces<trigger::TriggerEventWithRefs>();
00047 
00048 }
00049 
00050 TriggerSummaryProducerRAW::~TriggerSummaryProducerRAW()
00051 {
00052 }
00053 
00054 //
00055 // member functions
00056 //
00057 
00058 // ------------ method called to produce the data  ------------
00059 void
00060 TriggerSummaryProducerRAW::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00061 {
00062    using namespace std;
00063    using namespace edm;
00064    using namespace reco;
00065    using namespace trigger;
00066 
00067    // reset from previous event
00068    fobs_.clear();
00069 
00070    // get all filter objects created in requested process
00071    iEvent.getMany(selector_,fobs_);
00072    const unsigned int nfob(fobs_.size());
00073    LogDebug("TriggerSummaryProducerRaw") << "Number of filter objects found: " << nfob;
00074 
00075    // construct single RAW product
00076    auto_ptr<TriggerEventWithRefs> product(new TriggerEventWithRefs(pn_,nfob));
00077    for (unsigned int ifob=0; ifob!=nfob; ++ifob) {
00078      const string& label    (fobs_[ifob].provenance()->moduleLabel());
00079      const string& instance (fobs_[ifob].provenance()->productInstanceName());
00080      const string& process  (fobs_[ifob].provenance()->processName());
00081      const InputTag tag(label,instance,process);
00082      LogTrace("TriggerSummaryProducerRaw")
00083        << ifob << " " << tag << endl
00084        << " Sizes: "
00085        << " 1/" << fobs_[ifob]->photonSize()
00086        << " 2/" << fobs_[ifob]->electronSize()
00087        << " 3/" << fobs_[ifob]->muonSize()
00088        << " 4/" << fobs_[ifob]->jetSize()
00089        << " 5/" << fobs_[ifob]->compositeSize()
00090        << " 6/" << fobs_[ifob]->basemetSize()
00091        << " 7/" << fobs_[ifob]->calometSize()
00092        << " 8/" << fobs_[ifob]->pixtrackSize()
00093        << " 9/" << fobs_[ifob]->l1emSize()
00094        << " A/" << fobs_[ifob]->l1muonSize()
00095        << " B/" << fobs_[ifob]->l1jetSize()
00096        << " C/" << fobs_[ifob]->l1etmissSize()
00097        << " D/" << fobs_[ifob]->l1hfringsSize()
00098        << " E/" << fobs_[ifob]->pfjetSize()
00099        << " F/" << fobs_[ifob]->pftauSize()
00100        << endl;
00101      product->addFilterObject(tag,*fobs_[ifob]);
00102    }
00103 
00104    // place product in Event
00105    OrphanHandle<TriggerEventWithRefs> ref = iEvent.put(product);
00106    LogTrace("TriggerSummaryProducerRaw") << "Number of filter objects packed: " << ref->size();
00107 
00108    return;
00109 }