Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-16 06:15:46

0001 /** \class TriggerSummaryProducerRAW
0002  *
0003  * See header file for documentation
0004  *
0005  *
0006  *  \author Martin Grunewald
0007  *
0008  */
0009 
0010 #include "HLTrigger/HLTcore/interface/TriggerSummaryProducerRAW.h"
0011 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0012 
0013 #include "DataFormats/Common/interface/Handle.h"
0014 #include "DataFormats/Common/interface/OrphanHandle.h"
0015 #include "DataFormats/Provenance/interface/Provenance.h"
0016 #include "FWCore/Framework/interface/ProcessMatch.h"
0017 #include "FWCore/Framework/interface/TriggerNamesService.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019 #include "FWCore/ServiceRegistry/interface/Service.h"
0020 #include "FWCore/Utilities/interface/InputTag.h"
0021 
0022 #include <memory>
0023 #include <vector>
0024 
0025 //
0026 // constructors and destructor
0027 //
0028 TriggerSummaryProducerRAW::TriggerSummaryProducerRAW(const edm::ParameterSet& ps)
0029     : pn_(ps.getParameter<std::string>("processName")), putToken_{produces<trigger::TriggerEventWithRefs>()} {
0030   if (pn_ == "@") {
0031     edm::Service<edm::service::TriggerNamesService> tns;
0032     if (tns.isAvailable()) {
0033       pn_ = tns->getProcessName();
0034     } else {
0035       edm::LogError("TriggerSummaryProducerRaw") << "HLT Error: TriggerNamesService not available!";
0036       pn_ = "*";
0037     }
0038   }
0039 
0040   LogDebug("TriggerSummaryProducerRaw") << "Using process name: '" << pn_ << "'";
0041 
0042   // Tell the getter what type of products to get and
0043   // also the process to get them from
0044   getterOfProducts_ = edm::GetterOfProducts<trigger::TriggerFilterObjectWithRefs>(edm::ProcessMatch(pn_), this);
0045   callWhenNewProductsRegistered(getterOfProducts_);
0046 }
0047 
0048 TriggerSummaryProducerRAW::~TriggerSummaryProducerRAW() = default;
0049 
0050 //
0051 // member functions
0052 //
0053 
0054 void TriggerSummaryProducerRAW::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0055   edm::ParameterSetDescription desc;
0056   desc.add<std::string>("processName", "@");
0057   descriptions.add("triggerSummaryProducerRAW", desc);
0058 }
0059 
0060 // ------------ method called to produce the data  ------------
0061 void TriggerSummaryProducerRAW::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const {
0062   using namespace std;
0063   using namespace edm;
0064   using namespace reco;
0065   using namespace trigger;
0066 
0067   std::vector<edm::Handle<trigger::TriggerFilterObjectWithRefs> > fobs;
0068   getterOfProducts_.fillHandles(iEvent, fobs);
0069 
0070   const unsigned int nfob(fobs.size());
0071   LogDebug("TriggerSummaryProducerRaw") << "Number of filter objects found: " << nfob;
0072 
0073   // construct single RAW product
0074   TriggerEventWithRefs product(pn_, nfob);
0075   for (unsigned int ifob = 0; ifob != nfob; ++ifob) {
0076     const string& label(fobs[ifob].provenance()->moduleLabel());
0077     const string& instance(fobs[ifob].provenance()->productInstanceName());
0078     const string& process(fobs[ifob].provenance()->processName());
0079     const InputTag tag(label, instance, process);
0080     LogTrace("TriggerSummaryProducerRaw")
0081         << ifob << " " << tag << "\n"
0082         << " Sizes: "
0083         << " 1/" << fobs[ifob]->photonSize() << " 2/" << fobs[ifob]->electronSize() << " 3/" << fobs[ifob]->muonSize()
0084         << " 4/" << fobs[ifob]->jetSize() << " 5/" << fobs[ifob]->compositeSize() << " 6/" << fobs[ifob]->basemetSize()
0085         << " 7/" << fobs[ifob]->calometSize()
0086 
0087         << " 8/" << fobs[ifob]->pixtrackSize() << " 9/" << fobs[ifob]->l1emSize() << " A/" << fobs[ifob]->l1muonSize()
0088         << " B/" << fobs[ifob]->l1jetSize() << " C/" << fobs[ifob]->l1etmissSize() << " D/"
0089         << fobs[ifob]->l1hfringsSize() << " E/" << fobs[ifob]->pfjetSize() << " F/" << fobs[ifob]->pftauSize() << " G/"
0090         << fobs[ifob]->pfmetSize() << " I/" << fobs[ifob]->l1tmuonSize() << " J/" << fobs[ifob]->l1tegammaSize()
0091         << " K/" << fobs[ifob]->l1tjetSize() << " L/" << fobs[ifob]->l1ttauSize() << " M/" << fobs[ifob]->l1tetsumSize()
0092         << " N/" << fobs[ifob]->l1ttkmuonSize() << " O/" << fobs[ifob]->l1ttkeleSize() << " P/"
0093         << fobs[ifob]->l1ttkemSize() << " Q/" << fobs[ifob]->l1tpfjetSize() << " R/" << fobs[ifob]->l1tpftauSize()
0094         << " S/" << fobs[ifob]->l1thpspftauSize() << " T/" << fobs[ifob]->l1tpftrackSize() << " U/"
0095         << fobs[ifob]->l1tmuonShowerSize();
0096     LogTrace("TriggerSummaryProducerRaw")
0097         << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0098         << "\n fobs[ifob]->l1tmuonIds().size() = " << fobs[ifob]->l1tmuonIds().size()
0099         << "\n fobs[ifob]->l1tmuonRefs().size() = " << fobs[ifob]->l1tmuonRefs().size();
0100     LogTrace("TriggerSummaryProducerRaw")
0101         << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0102         << "\n fobs[ifob]->l1tegammaIds().size() = " << fobs[ifob]->l1tegammaIds().size()
0103         << "\n fobs[ifob]->l1tegammaRefs().size() = " << fobs[ifob]->l1tegammaRefs().size();
0104     LogTrace("TriggerSummaryProducerRaw") << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0105                                           << "\n fobs[ifob]->l1tjetIds().size() = " << fobs[ifob]->l1tjetIds().size()
0106                                           << "\n fobs[ifob]->l1tjetRefs().size() = " << fobs[ifob]->l1tjetRefs().size();
0107     LogTrace("TriggerSummaryProducerRaw") << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0108                                           << "\n fobs[ifob]->l1ttauIds().size() = " << fobs[ifob]->l1ttauIds().size()
0109                                           << "\n fobs[ifob]->l1ttauRefs().size() = " << fobs[ifob]->l1ttauRefs().size();
0110     LogTrace("TriggerSummaryProducerRaw")
0111         << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0112         << "\n fobs[ifob]->l1tetsumIds().size() = " << fobs[ifob]->l1tetsumIds().size()
0113         << "\n fobs[ifob]->l1tetsumRefs().size() = " << fobs[ifob]->l1tetsumRefs().size();
0114     LogTrace("TriggerSummaryProducerRaw")
0115         << "TriggerSummaryProducerRaw::addFilterObjects(   )"
0116         << "\n fobs[ifob]->l1tmuonShowerIds().size() = " << fobs[ifob]->l1tmuonShowerIds().size()
0117         << "\n fobs[ifob]->l1tmuonShowerRefs().size() = " << fobs[ifob]->l1tmuonShowerRefs().size();
0118     product.addFilterObject(tag, *fobs[ifob]);
0119   }
0120 
0121   // place product in Event
0122   OrphanHandle<TriggerEventWithRefs> ref = iEvent.emplace(putToken_, std::move(product));
0123   LogTrace("TriggerSummaryProducerRaw") << "Number of filter objects packed: " << ref->size();
0124 
0125   return;
0126 }