Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:54

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/Common/interface/TriggerNames.h"
0005 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0006 #include "DQMOffline/Trigger/interface/HeavyIonUCCDQM.h"
0007 
0008 HeavyIonUCCDQM::HeavyIonUCCDQM(const edm::ParameterSet& ps) {
0009   triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("triggerResults"));
0010   theCaloMet = consumes<reco::CaloMETCollection>(ps.getParameter<edm::InputTag>("caloMet"));
0011   theSiPixelCluster = consumes<edmNew::DetSetVector<SiPixelCluster> >(ps.getParameter<edm::InputTag>("pixelCluster"));
0012   triggerPath_ = ps.getParameter<std::string>("triggerPath");
0013 
0014   nClusters = ps.getParameter<int>("nClusters");
0015   minClusters = ps.getParameter<int>("minClusters");
0016   maxClusters = ps.getParameter<int>("maxClusters");
0017   nEt = ps.getParameter<int>("nEt");
0018   minEt = ps.getParameter<double>("minEt");
0019   maxEt = ps.getParameter<double>("maxEt");
0020 }
0021 
0022 HeavyIonUCCDQM::~HeavyIonUCCDQM() = default;
0023 
0024 void HeavyIonUCCDQM::bookHistograms(DQMStore::IBooker& ibooker_, edm::Run const&, edm::EventSetup const&) {
0025   ibooker_.cd();
0026   ;
0027   ibooker_.setCurrentFolder("HLT/HI/" + triggerPath_);
0028 
0029   h_SumEt = ibooker_.book1D("h_SumEt", "SumEt", nEt, minEt, maxEt);
0030   h_SiPixelClusters = ibooker_.book1D("h_SiPixelClusters", "h_SiPixelClusters", nClusters, minClusters, maxClusters);
0031   h_SumEt_SiPixelClusters = ibooker_.book2D(
0032       "h_SumEt_SiPixelClusters", "h_SumEt_SiPixelClusters", nEt, minEt, maxEt, nClusters, minClusters, maxClusters);
0033 
0034   ibooker_.cd();
0035 }
0036 
0037 void HeavyIonUCCDQM::analyze(edm::Event const& e, edm::EventSetup const& eSetup) {
0038   edm::Handle<edm::TriggerResults> hltresults;
0039   e.getByToken(triggerResults_, hltresults);
0040   if (!hltresults.isValid()) {
0041     edm::LogError("HeavyIonUCCDQM") << "invalid collection: TriggerResults"
0042                                     << "\n";
0043     return;
0044   }
0045 
0046   bool hasFired = false;
0047   const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
0048   unsigned int numTriggers = trigNames.size();
0049   for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
0050     if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
0051         hltresults->accept(hltIndex)) {
0052       hasFired = true;
0053     }
0054   }
0055 
0056   if (!hasFired)
0057     return;
0058 
0059   edm::Handle<edmNew::DetSetVector<SiPixelCluster> > cluster;
0060   e.getByToken(theSiPixelCluster, cluster);
0061   if (cluster.isValid()) {
0062     h_SiPixelClusters->Fill(cluster->dataSize());
0063   }
0064 
0065   edm::Handle<reco::CaloMETCollection> calometColl;
0066   e.getByToken(theCaloMet, calometColl);
0067   if (calometColl.isValid()) {
0068     h_SumEt->Fill((*calometColl).front().sumEt());
0069   }
0070 
0071   if (cluster.isValid() && calometColl.isValid()) {
0072     h_SumEt_SiPixelClusters->Fill((*calometColl).front().sumEt(), cluster->dataSize());
0073   }
0074 }
0075 
0076 DEFINE_FWK_MODULE(HeavyIonUCCDQM);