Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-22 23:31:01

0001 #include "DQM/GEM/interface/GEMPadDigiClusterSource.h"
0002 
0003 using namespace std;
0004 using namespace edm;
0005 
0006 GEMPadDigiClusterSource::GEMPadDigiClusterSource(const edm::ParameterSet& cfg) : GEMDQMBase(cfg) {
0007   tagPadDigiCluster_ =
0008       consumes<GEMPadDigiClusterCollection>(cfg.getParameter<edm::InputTag>("padDigiClusterInputLabel"));
0009   lumiScalers_ = consumes<LumiScalersCollection>(
0010       cfg.getUntrackedParameter<edm::InputTag>("lumiCollection", edm::InputTag("scalersRawToDigi")));
0011   nBXMin_ = cfg.getParameter<int>("bxMin");
0012   nBXMax_ = cfg.getParameter<int>("bxMax");
0013   nCLSMax_ = cfg.getParameter<int>("clsMax");
0014   nClusterSizeBinNum_ = cfg.getParameter<int>("ClusterSizeBinNum");
0015 }
0016 
0017 void GEMPadDigiClusterSource::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0018   edm::ParameterSetDescription desc;
0019   desc.add<edm::InputTag>("padDigiClusterInputLabel", edm::InputTag("muonCSCDigis", "MuonGEMPadDigiCluster"));
0020   desc.addUntracked<std::string>("runType", "online");
0021   desc.addUntracked<std::string>("logCategory", "GEMPadDigiClusterSource");
0022   desc.add<int>("bxMin", -15);
0023   desc.add<int>("bxMax", 15);
0024   desc.add<int>("clsMax", 9);
0025   desc.add<int>("ClusterSizeBinNum", 9);
0026   descriptions.add("GEMPadDigiClusterSource", desc);
0027 }
0028 
0029 void GEMPadDigiClusterSource::bookHistograms(DQMStore::IBooker& ibooker,
0030                                              edm::Run const&,
0031                                              edm::EventSetup const& iSetup) {
0032   initGeometry(iSetup);
0033   if (GEMGeometry_ == nullptr)
0034     return;
0035   loadChambers();
0036 
0037   strFolderMain_ = "GEM/PadDigiCluster";
0038 
0039   fRadiusMin_ = 120.0;
0040   fRadiusMax_ = 250.0;
0041 
0042   mapPadBXDiffPerCh_ = MEMap3Inf(this,
0043                                  "delta_pad_bx",
0044                                  "Difference of Trigger Primitive Pad Number and BX ",
0045                                  81,
0046                                  -40 - 0.5,
0047                                  40 + 0.5,
0048                                  21,
0049                                  -10 - 0.5,
0050                                  10 + 0.5,
0051                                  "Lay1 - Lay2 cluster central pad",
0052                                  "Lay1 - Lay2 cluster BX");
0053   mapPadDiffPerCh_ = MEMap3Inf(this,
0054                                "delta_pad",
0055                                "Difference of Trigger Primitive Pad Number ",
0056                                81,
0057                                -40 - 0.5,
0058                                40 + 0.5,
0059                                "Lay1 - Lay2 cluster central pad");
0060   mapBXDiffPerCh_ = MEMap3Inf(
0061       this, "delta_bx", "Difference of Trigger Primitive BX ", 21, -10 - 0.5, 10 + 0.5, "Lay1 - Lay2 cluster BX");
0062 
0063   mapBXCLSPerCh_ = MEMap4Inf(this, "bx", " Trigger Primitive Cluster BX ", 14, -0.5, 13.5, "Bunch crossing");
0064   mapPadDigiOccPerCh_ =
0065       MEMap4Inf(this, "occ", "Trigger Primitive Occupancy ", 1, -0.5, 1.5, 1, 0.5, 1.5, "Pad number", "i#eta");
0066   mapPadBxPerCh_ = MEMap4Inf(this,
0067                              "pad",
0068                              "Trigger Primitive Pad Number and BX ",
0069                              1536,
0070                              0.5,
0071                              1536.5,
0072                              15,
0073                              -0.5,
0074                              15 - 0.5,
0075                              "Pad number",
0076                              "Cluster BX");
0077   mapPadCLSPerCh_ =
0078       MEMap4Inf(this, "cls", "Trigger Primitive Cluster Size ", 9, 0.5, 9 + 0.5, 1, 0.5, 1.5, "Cluster Size", "i#eta");
0079 
0080   ibooker.cd();
0081   ibooker.setCurrentFolder(strFolderMain_);
0082   GenerateMEPerChamber(ibooker);
0083 }
0084 
0085 int GEMPadDigiClusterSource::ProcessWithMEMap2(BookingHelper& bh, ME2IdsKey key) { return 0; }
0086 
0087 int GEMPadDigiClusterSource::ProcessWithMEMap2WithEta(BookingHelper& bh, ME3IdsKey key) { return 0; }
0088 
0089 int GEMPadDigiClusterSource::ProcessWithMEMap3(BookingHelper& bh, ME3IdsKey key) { return 0; }
0090 int GEMPadDigiClusterSource::ProcessWithMEMap2WithChamber(BookingHelper& bh, ME3IdsKey key) {
0091   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/pad_bx_difference");
0092   mapPadBXDiffPerCh_.bookND(bh, key);
0093   bh.getBooker()->setCurrentFolder(strFolderMain_);
0094 
0095   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/pad_difference");
0096   mapPadDiffPerCh_.bookND(bh, key);
0097   bh.getBooker()->setCurrentFolder(strFolderMain_);
0098 
0099   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/bx_difference");
0100   mapBXDiffPerCh_.bookND(bh, key);
0101   bh.getBooker()->setCurrentFolder(strFolderMain_);
0102 
0103   return 0;
0104 }
0105 
0106 int GEMPadDigiClusterSource::ProcessWithMEMap4WithChamber(BookingHelper& bh, ME4IdsKey key) {
0107   ME3IdsKey key3 = key4Tokey3(key);
0108   MEStationInfo& stationInfo = mapStationInfo_[key3];
0109 
0110   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/occupancy_" + getNameDirLayer(key3));
0111 
0112   int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
0113   int nNumCh = stationInfo.nNumDigi_;
0114 
0115   mapPadDigiOccPerCh_.SetBinConfX(nNumCh * nNumVFATPerEta / 2, -0.5);
0116   mapPadDigiOccPerCh_.SetBinConfY(stationInfo.nNumEtaPartitions_);
0117   mapPadDigiOccPerCh_.bookND(bh, key);
0118   mapPadDigiOccPerCh_.SetLabelForIEta(key, 2);
0119 
0120   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/pads in time_" + getNameDirLayer(key3));
0121   mapPadBxPerCh_.SetBinConfX(nNumCh * nNumVFATPerEta * stationInfo.nNumEtaPartitions_ / 2, -0.5);
0122   mapPadBxPerCh_.bookND(bh, key);
0123 
0124   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/cluster size_" + getNameDirLayer(key3));
0125 
0126   mapPadCLSPerCh_.SetBinConfY(stationInfo.nNumEtaPartitions_);
0127   mapPadCLSPerCh_.bookND(bh, key);
0128   mapPadCLSPerCh_.SetLabelForIEta(key, 2);
0129 
0130   bh.getBooker()->setCurrentFolder(strFolderMain_ + "/bx_cluster_" + getNameDirLayer(key3));
0131   mapBXCLSPerCh_.bookND(bh, key);
0132   bh.getBooker()->setCurrentFolder(strFolderMain_);
0133   return 0;
0134 }
0135 
0136 void GEMPadDigiClusterSource::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) {
0137   edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
0138   event.getByToken(this->tagPadDigiCluster_, gemPadDigiClusters);
0139   edm::Handle<LumiScalersCollection> lumiScalers;
0140   event.getByToken(lumiScalers_, lumiScalers);
0141 
0142   int med_pad1, med_pad2;
0143 
0144   for (auto it = gemPadDigiClusters->begin(); it != gemPadDigiClusters->end(); it++) {
0145     auto range = gemPadDigiClusters->get((*it).first);
0146 
0147     for (auto cluster = range.first; cluster != range.second; cluster++) {
0148       if (cluster->isValid()) {
0149         ME4IdsKey key4Ch{
0150             ((*it).first).region(), ((*it).first).station(), ((*it).first).layer(), ((*it).first).chamber()};
0151         ME3IdsKey key3Ch{((*it).first).region(), ((*it).first).station(), ((*it).first).chamber()};
0152 
0153         //Plot the bx of each cluster.
0154         mapBXCLSPerCh_.Fill(key4Ch, cluster->bx());
0155 
0156         //Plot the size of clusters for each chamber and layer
0157         Int_t nCLS = cluster->pads().size();
0158         Int_t nCLSCutOff = std::min(nCLS, nCLSMax_);
0159         mapPadCLSPerCh_.Fill(key4Ch, nCLSCutOff, ((*it).first).roll());
0160 
0161         //Plot of pad and bx diff of two layers per chamer.
0162         med_pad1 = floor((cluster->pads().front() + cluster->pads().front() + cluster->pads().size() - 1) / 2);
0163         for (auto it2 = gemPadDigiClusters->begin(); it2 != gemPadDigiClusters->end(); it2++) {
0164           auto range2 = gemPadDigiClusters->get((*it2).first);
0165 
0166           for (auto cluster2 = range2.first; cluster2 != range2.second; cluster2++) {
0167             if (cluster2->isValid()) {
0168               med_pad2 = floor((cluster2->pads().front() + cluster2->pads().front() + cluster2->pads().size() - 1) / 2);
0169 
0170               if (((*it).first).chamber() == ((*it2).first).chamber() &&
0171                   ((*it).first).station() == ((*it2).first).station() &&
0172                   ((*it).first).region() == ((*it2).first).region() && ((*it).first).layer() == 1 &&
0173                   ((*it2).first).layer() == 2) {
0174                 if (abs(med_pad1 - med_pad2) <= 40 && abs(((*it).first).roll() - ((*it2).first).roll()) <= 1) {
0175                   mapPadBXDiffPerCh_.Fill(key3Ch, med_pad1 - med_pad2, cluster->bx() - cluster2->bx());
0176                   mapPadDiffPerCh_.Fill(key3Ch, med_pad1 - med_pad2);
0177                   mapBXDiffPerCh_.Fill(key3Ch, cluster->bx() - cluster2->bx());
0178                 }
0179               }
0180             }
0181           }
0182         }
0183 
0184         for (auto pad = cluster->pads().front(); pad < (cluster->pads().front() + cluster->pads().size()); pad++) {
0185           //Plot of pad and bx for each chamber and layer
0186           mapPadDigiOccPerCh_.Fill(key4Ch, pad, ((*it).first).roll());
0187           mapPadBxPerCh_.Fill(key4Ch, pad + (192 * (8 - ((*it).first).roll())), cluster->bx());
0188         }
0189       }
0190     }
0191   }
0192 }
0193 
0194 DEFINE_FWK_MODULE(GEMPadDigiClusterSource);