Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:51

0001 #include <string>
0002 
0003 #include "DQM/L1TMonitor/interface/L1TdeStage2RegionalShower.h"
0004 
0005 L1TdeStage2RegionalShower::L1TdeStage2RegionalShower(const edm::ParameterSet& ps)
0006     : data_EMTFShower_token_(
0007           consumes<l1t::RegionalMuonShowerBxCollection>(ps.getParameter<edm::InputTag>("dataSource"))),
0008       emul_EMTFShower_token_(
0009           consumes<l1t::RegionalMuonShowerBxCollection>(ps.getParameter<edm::InputTag>("emulSource"))),
0010       monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir")) {}
0011 
0012 L1TdeStage2RegionalShower::~L1TdeStage2RegionalShower() {}
0013 
0014 void L1TdeStage2RegionalShower::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run&, const edm::EventSetup&) {
0015   iBooker.setCurrentFolder(monitorDir_);
0016 
0017   // 2D summary plots
0018   emtfShowerDataSummary_denom_ =
0019       iBooker.book2D("emtf_shower_data_summary_denom", "Data EMTF Shower All", 6, 1, 7, 4, 0, 4);
0020   emtfShowerDataSummary_num_ =
0021       iBooker.book2D("emtf_shower_data_summary_num", "Data EMTF Shower Emul Matched", 6, 1, 7, 4, 0, 4);
0022   emtfShowerEmulSummary_denom_ =
0023       iBooker.book2D("emtf_shower_emul_summary_denom", "Emul EMTF Shower All", 6, 1, 7, 4, 0, 4);
0024   emtfShowerEmulSummary_num_ =
0025       iBooker.book2D("emtf_shower_emul_summary_num", "Emul EMTF Shower Not Matched to Data", 6, 1, 7, 4, 0, 4);
0026 
0027   // x labels
0028   emtfShowerDataSummary_denom_->setAxisTitle("Sector", 1);
0029   emtfShowerDataSummary_num_->setAxisTitle("Sector", 1);
0030   emtfShowerEmulSummary_denom_->setAxisTitle("Sector", 1);
0031   emtfShowerEmulSummary_num_->setAxisTitle("Sector", 1);
0032 
0033   // plotting option
0034   emtfShowerDataSummary_denom_->setOption("colz");
0035   emtfShowerDataSummary_num_->setOption("colz");
0036   emtfShowerEmulSummary_denom_->setOption("colz");
0037   emtfShowerEmulSummary_num_->setOption("colz");
0038 
0039   // y labels
0040   emtfShowerDataSummary_denom_->setBinLabel(1, "ME- Tight", 2);
0041   emtfShowerDataSummary_num_->setBinLabel(1, "ME- Tight", 2);
0042   emtfShowerEmulSummary_denom_->setBinLabel(1, "ME- Tight", 2);
0043   emtfShowerEmulSummary_num_->setBinLabel(1, "ME- Tight", 2);
0044   emtfShowerDataSummary_denom_->setBinLabel(2, "ME- Nom", 2);
0045   emtfShowerDataSummary_num_->setBinLabel(2, "ME- Nom", 2);
0046   emtfShowerEmulSummary_denom_->setBinLabel(2, "ME- Nom", 2);
0047   emtfShowerEmulSummary_num_->setBinLabel(2, "ME- Nom", 2);
0048 
0049   emtfShowerDataSummary_denom_->setBinLabel(3, "ME+ Nom", 2);
0050   emtfShowerDataSummary_num_->setBinLabel(3, "ME+ Nom", 2);
0051   emtfShowerEmulSummary_denom_->setBinLabel(3, "ME+ Nom", 2);
0052   emtfShowerEmulSummary_num_->setBinLabel(3, "ME+ Nom", 2);
0053   emtfShowerDataSummary_denom_->setBinLabel(4, "ME+ Tight", 2);
0054   emtfShowerDataSummary_num_->setBinLabel(4, "ME+ Tight", 2);
0055   emtfShowerEmulSummary_denom_->setBinLabel(4, "ME+ Tight", 2);
0056   emtfShowerEmulSummary_num_->setBinLabel(4, "ME+ Tight", 2);
0057 }
0058 
0059 void L1TdeStage2RegionalShower::analyze(const edm::Event& e, const edm::EventSetup& c) {
0060   edm::Handle<l1t::RegionalMuonShowerBxCollection> dataShowers;
0061   edm::Handle<l1t::RegionalMuonShowerBxCollection> emulShowers;
0062 
0063   e.getByToken(data_EMTFShower_token_, dataShowers);
0064   e.getByToken(emul_EMTFShower_token_, emulShowers);
0065 
0066   for (auto dSh = dataShowers->begin(); dSh != dataShowers->end(); ++dSh) {
0067     if (dSh->isValid() and dSh->isOneNominalInTime()) {
0068       if (dSh->isOneTightInTime())
0069         emtfShowerDataSummary_denom_->Fill(dSh->processor() + 1,
0070                                            (dSh->trackFinderType() == l1t::tftype::emtf_pos) ? 3.5 : 0.5);
0071       emtfShowerDataSummary_denom_->Fill(dSh->processor() + 1,
0072                                          (dSh->trackFinderType() == l1t::tftype::emtf_pos) ? 2.5 : 1.5);
0073       for (auto eSh = emulShowers->begin(); eSh != emulShowers->end(); ++eSh) {
0074         if (eSh->isValid() and eSh->isOneNominalInTime() and dSh->processor() == eSh->processor() and
0075             dSh->trackFinderType() == eSh->trackFinderType() and *dSh == *eSh) {
0076           if (dSh->isOneTightInTime())
0077             emtfShowerDataSummary_num_->Fill(dSh->processor() + 1,
0078                                              (dSh->trackFinderType() == l1t::tftype::emtf_pos) ? 3.5 : 0.5);
0079           emtfShowerDataSummary_num_->Fill(dSh->processor() + 1,
0080                                            (dSh->trackFinderType() == l1t::tftype::emtf_pos) ? 2.5 : 1.5);
0081         }
0082       }
0083     }
0084   }
0085 
0086   for (auto eSh = emulShowers->begin(); eSh != emulShowers->end(); ++eSh) {
0087     bool isMatched = false;
0088     if (eSh->isValid() and eSh->isOneNominalInTime()) {
0089       if (eSh->isOneTightInTime())
0090         emtfShowerEmulSummary_denom_->Fill(eSh->processor() + 1,
0091                                            (eSh->trackFinderType() == l1t::tftype::emtf_pos) ? 3.5 : 0.5);
0092       emtfShowerEmulSummary_denom_->Fill(eSh->processor() + 1,
0093                                          (eSh->trackFinderType() == l1t::tftype::emtf_pos) ? 2.5 : 1.5);
0094       for (auto dSh = dataShowers->begin(); dSh != dataShowers->end(); ++dSh) {
0095         if (dSh->isValid() and dSh->isOneNominalInTime() and eSh->processor() == dSh->processor() and
0096             eSh->trackFinderType() == dSh->trackFinderType() and *dSh == *eSh)
0097           isMatched = true;
0098       }
0099       if (not isMatched) {
0100         if (eSh->isOneTightInTime())
0101           emtfShowerEmulSummary_num_->Fill(eSh->processor() + 1,
0102                                            (eSh->trackFinderType() == l1t::tftype::emtf_pos) ? 3.5 : 0.5);
0103         emtfShowerEmulSummary_num_->Fill(eSh->processor() + 1,
0104                                          (eSh->trackFinderType() == l1t::tftype::emtf_pos) ? 2.5 : 1.5);
0105       }
0106     }
0107   }
0108 }