Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-19 23:19:57

0001 #include "DQM/EcalMonitorTasks/interface/ClusterTask.h"
0002 
0003 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
0004 #include "DQM/EcalCommon/interface/MESetMulti.h"
0005 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0006 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0007 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
0008 #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
0009 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0010 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0011 #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/ConsumesCollector.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 namespace ecaldqm {
0018   ClusterTask::ClusterTask()
0019       : DQWorkerTask(),
0020         ebHits_(nullptr),
0021         eeHits_(nullptr),
0022         //    ievt_(0),
0023         //    massCalcPrescale_(_workerParams.getUntrackedParameter<int>("massCalcPrescale")),
0024         doExtra_(true),
0025         energyThreshold_(0.),
0026         swissCrossMaxThreshold_(3.),
0027         egTriggerAlgos_(),
0028         trigTypeToME_{0, 1, 2, 3, 4},
0029         L1GlobalTriggerReadoutRecordTag_(),
0030         L1MuGMTReadoutCollectionTag_(),
0031         L1GlobalTriggerReadoutRecordToken_(),
0032         L1MuGMTReadoutCollectionToken_() {}
0033 
0034   void ClusterTask::setParams(edm::ParameterSet const& _params) {
0035     doExtra_ = _params.getUntrackedParameter<bool>("doExtra");
0036 
0037     if (!doExtra_) {
0038       MEs_.erase(std::string("SCSizeVsEnergy"));
0039       MEs_.erase(std::string("SCSeedOccupancyHighE"));
0040       MEs_.erase(std::string("SCSeedOccupancyTrig"));
0041       MEs_.erase(std::string("SCSeedTimeTrigEx"));
0042       MEs_.erase(std::string("SCSeedTimeMapTrigEx"));
0043       MEs_.erase(std::string("SCOccupancyProjEta"));
0044       MEs_.erase(std::string("SCOccupancyProjPhi"));
0045       MEs_.erase(std::string("SCSwissCross"));
0046       MEs_.erase(std::string("Triggers"));
0047       MEs_.erase(std::string("ExclusiveTriggers"));
0048 
0049       return;
0050     }
0051 
0052     energyThreshold_ = _params.getUntrackedParameter<double>("energyThreshold");
0053     swissCrossMaxThreshold_ = _params.getUntrackedParameter<double>("swissCrossMaxThreshold");
0054     egTriggerAlgos_ = _params.getUntrackedParameter<std::vector<std::string> >("egTriggerAlgos");
0055     L1GlobalTriggerReadoutRecordTag_ = _params.getUntrackedParameter<edm::InputTag>("L1GlobalTriggerReadoutRecordTag");
0056     L1MuGMTReadoutCollectionTag_ = _params.getUntrackedParameter<edm::InputTag>("L1MuGMTReadoutCollectionTag");
0057 
0058     MESet::PathReplacements repl;
0059 
0060     std::string triggerTypeNames[nTriggerTypes] = {"ECAL", "HCAL", "CSC", "DT", "RPC"};
0061 
0062     MESetMulti& occupancy(static_cast<MESetMulti&>(MEs_.at("SCSeedOccupancyTrig")));
0063     for (unsigned iT(0); iT != nTriggerTypes; ++iT) {
0064       repl["trig"] = triggerTypeNames[iT];
0065       trigTypeToME_[iT] = occupancy.getIndex(repl);
0066     }
0067   }
0068 
0069   void ClusterTask::addDependencies(DependencySet& _dependencies) {
0070     _dependencies.push_back(Dependency(kEBSuperCluster, kEBRecHit));
0071     _dependencies.push_back(Dependency(kEESuperCluster, kEERecHit));
0072   }
0073 
0074   void ClusterTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const&, bool&) {
0075     if (!doExtra_)
0076       return;
0077 
0078     triggered_.reset();
0079 
0080     // TODO IS THIS THE MOST UP-TO-DATE ACCESSOR TO L1 INFO?
0081 
0082     edm::Handle<L1GlobalTriggerReadoutRecord> l1GTHndl;
0083     _evt.getByToken(L1GlobalTriggerReadoutRecordToken_, l1GTHndl);
0084 
0085     if (!l1GTHndl.isValid()) {
0086       edm::LogError("L1GlobalTriggerReadoutRecord")
0087           << "Failed to retrieve L1GlobalTriggerReadoutRecord from the Event!";
0088       return;  // Exit the function early if the handle is invalid
0089     }
0090 
0091     DecisionWord const& dWord(l1GTHndl->decisionWord());
0092 
0093     //Ecal
0094 
0095     L1GtTriggerMenu const* menu(&_es.getData(menuRcd));
0096 
0097     if (!dWord.empty()) {  //protect against no L1GT in run
0098       for (unsigned iT(0); iT != egTriggerAlgos_.size(); ++iT) {
0099         if (menu->gtAlgorithmResult(egTriggerAlgos_[iT], dWord)) {
0100           triggered_.set(kEcalTrigger);
0101           break;
0102         }
0103       }
0104     }
0105 
0106     //Hcal
0107     bool hcal_top = false;
0108     bool hcal_bot = false;
0109     const L1GtPsbWord psb = l1GTHndl->gtPsbWord(0xbb0d, 0);
0110     std::vector<int> valid_phi;
0111     if ((psb.aData(4) & 0x3f) >= 1) {
0112       valid_phi.push_back((psb.aData(4) >> 10) & 0x1f);
0113     }
0114     if ((psb.bData(4) & 0x3f) >= 1) {
0115       valid_phi.push_back((psb.bData(4) >> 10) & 0x1f);
0116     }
0117     if ((psb.aData(5) & 0x3f) >= 1) {
0118       valid_phi.push_back((psb.aData(5) >> 10) & 0x1f);
0119     }
0120     if ((psb.bData(5) & 0x3f) >= 1) {
0121       valid_phi.push_back((psb.bData(5) >> 10) & 0x1f);
0122     }
0123     std::vector<int>::const_iterator iphi;
0124     for (iphi = valid_phi.begin(); iphi != valid_phi.end(); iphi++) {
0125       if (*iphi < 9)
0126         hcal_top = true;
0127       if (*iphi > 8)
0128         hcal_bot = true;
0129     }
0130     if (hcal_top && hcal_bot)
0131       triggered_.set(kHcalTrigger);
0132 
0133     //Muons
0134     edm::Handle<L1MuGMTReadoutCollection> l1MuHndl;
0135     if (!_evt.getByToken(L1MuGMTReadoutCollectionToken_, l1MuHndl))
0136       return;
0137     std::vector<L1MuGMTReadoutRecord> const& records(l1MuHndl->getRecords());
0138 
0139     for (unsigned iR(0); iR != records.size(); ++iR) {
0140       if (records[iR].getBxInEvent() != 0)
0141         continue;
0142 
0143       unsigned iC(0);
0144 
0145       //DT triggers
0146       std::vector<L1MuRegionalCand> dtBXCands(records[iR].getDTBXCands());
0147       for (iC = 0; iC != dtBXCands.size(); ++iC)
0148         if (!dtBXCands[iC].empty())
0149           break;
0150       if (iC != dtBXCands.size())
0151         triggered_.set(kDTTrigger);
0152 
0153       //RPC triggers
0154       std::vector<L1MuRegionalCand> brlRPCCands(records[iR].getBrlRPCCands());
0155       for (iC = 0; iC != brlRPCCands.size(); ++iC)
0156         if (!brlRPCCands[iC].empty())
0157           break;
0158       if (iC != brlRPCCands.size())
0159         triggered_.set(kRPCTrigger);
0160 
0161       //CSC Triggers
0162       std::vector<L1MuRegionalCand> cscCands(records[iR].getCSCCands());
0163       for (iC = 0; iC != cscCands.size(); ++iC)
0164         if (!cscCands[iC].empty())
0165           break;
0166       if (iC != cscCands.size())
0167         triggered_.set(kCSCTrigger);
0168     }
0169 
0170     if (triggered_.none())
0171       return;
0172 
0173     MESet& meTriggers(MEs_.at("Triggers"));
0174     MESet& meExclusiveTriggers(MEs_.at("ExclusiveTriggers"));
0175 
0176     for (unsigned iT(0); iT != nTriggerTypes; ++iT) {
0177       if (!triggered_[iT])
0178         continue;
0179       meTriggers.fill(getEcalDQMSetupObjects(), iT + 0.5);
0180       if (triggered_.count() == 1)
0181         meExclusiveTriggers.fill(getEcalDQMSetupObjects(), iT + 0.5);
0182     }
0183   }
0184 
0185   void ClusterTask::endEvent(edm::Event const&, edm::EventSetup const&) {
0186     //    ++ievt_;
0187 
0188     ebHits_ = nullptr;
0189     eeHits_ = nullptr;
0190   }
0191 
0192   bool ClusterTask::filterRunType(short const* _runType) {
0193     for (unsigned iFED(0); iFED != nDCC; iFED++) {
0194       if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
0195           _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
0196           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
0197           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
0198         return true;
0199     }
0200 
0201     return false;
0202   }
0203 
0204   void ClusterTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) {
0205     switch (_collection) {
0206       case kEBRecHit:
0207         ebHits_ = &_hits;
0208         break;
0209       case kEERecHit:
0210         eeHits_ = &_hits;
0211         break;
0212       default:
0213         break;
0214     }
0215   }
0216 
0217   void ClusterTask::runOnBasicClusters(edm::View<reco::CaloCluster> const& _bcs, Collections _collection) {
0218     MESet& meBCE(MEs_.at("BCE"));
0219     MESet& meBCEMap(MEs_.at("BCEMap"));
0220     MESet& meBCEMapProjEta(MEs_.at("BCEMapProjEta"));
0221     MESet& meBCEMapProjPhi(MEs_.at("BCEMapProjPhi"));
0222     MESet& meBCEtMapProjEta(MEs_.at("BCEtMapProjEta"));
0223     MESet& meBCEtMapProjPhi(MEs_.at("BCEtMapProjPhi"));
0224     MESet& meBCOccupancy(MEs_.at("BCOccupancy"));
0225     MESet& meBCOccupancyProjEta(MEs_.at("BCOccupancyProjEta"));
0226     MESet& meBCOccupancyProjPhi(MEs_.at("BCOccupancyProjPhi"));
0227     MESet& meBCSize(MEs_.at("BCSize"));
0228     MESet& meTrendBCSize(MEs_.at("TrendBCSize"));
0229     MESet& meBCSizeMap(MEs_.at("BCSizeMap"));
0230     MESet& meBCSizeMapProjEta(MEs_.at("BCSizeMapProjEta"));
0231     MESet& meBCSizeMapProjPhi(MEs_.at("BCSizeMapProjPhi"));
0232     MESet& meBCNum(MEs_.at("BCNum"));
0233     MESet& meTrendNBC(MEs_.at("TrendNBC"));
0234 
0235     int nBC[] = {0, 0};
0236     bool isBarrel(_collection == kEBBasicCluster);
0237 
0238     //    vector<reco::BasicCluster const*> lowMassCands;
0239 
0240     for (edm::View<reco::CaloCluster>::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr) {
0241       if (bcItr->caloID().detectors() != 0) {
0242         if (isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL))
0243           continue;
0244         if (!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP))
0245           continue;
0246       }
0247 
0248       math::XYZPoint const& position(bcItr->position());
0249 
0250       DetId id(bcItr->seed());
0251       if (id.null()) {
0252         GlobalPoint gp(position.x(), position.y(), position.z());
0253         CaloSubdetectorGeometry const* subgeom(
0254             GetGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap));
0255 
0256         id = subgeom->getClosestCell(gp);
0257       }
0258 
0259       if (id.null() || (id.subdetId() == EcalBarrel && !isBarrel) || (id.subdetId() == EcalEndcap && isBarrel))
0260         continue;
0261 
0262       float energy(bcItr->energy());
0263       float posEta(position.eta());
0264       float posPhi(phi(position.phi()));
0265       float et(energy / std::cosh(posEta));
0266       int subdet(isBarrel ? EcalBarrel : EcalEndcap);
0267       if (subdet == EcalEndcap && position.z() < 0.)
0268         subdet = -EcalEndcap;
0269 
0270       meBCE.fill(getEcalDQMSetupObjects(), id, energy);
0271 
0272       meBCEMap.fill(getEcalDQMSetupObjects(), id, energy);
0273       meBCEMapProjEta.fill(getEcalDQMSetupObjects(), posEta, energy);
0274       meBCEMapProjPhi.fill(getEcalDQMSetupObjects(), subdet, posPhi, energy);
0275       meBCEtMapProjEta.fill(getEcalDQMSetupObjects(), posEta, et);
0276       meBCEtMapProjPhi.fill(getEcalDQMSetupObjects(), subdet, posPhi, et);
0277 
0278       meBCOccupancy.fill(getEcalDQMSetupObjects(), id);
0279       meBCOccupancyProjEta.fill(getEcalDQMSetupObjects(), posEta);
0280       meBCOccupancyProjPhi.fill(getEcalDQMSetupObjects(), subdet, posPhi);
0281 
0282       float size(bcItr->size());
0283 
0284       meBCSize.fill(getEcalDQMSetupObjects(), id, size);
0285       meTrendBCSize.fill(getEcalDQMSetupObjects(), id, double(timestamp_.iLumi), size);
0286 
0287       meBCSizeMap.fill(getEcalDQMSetupObjects(), id, size);
0288       meBCSizeMapProjEta.fill(getEcalDQMSetupObjects(), posEta, size);
0289       meBCSizeMapProjPhi.fill(getEcalDQMSetupObjects(), subdet, posPhi, size);
0290 
0291       int zside(position.z() > 0 ? 1 : 0);
0292       nBC[zside]++;
0293 
0294       //       if(ievt_ % massCalcPrescale_ != 0) continue;
0295 
0296       //       if(energy > 10.) continue;
0297 
0298       //       EcalRecHitCollection::const_iterator hitItr(isBarrel ? ebHits_->find(id) : eeHits_->find(id));
0299       //       if(hitItr == (isBarrel ? ebHits_->end() : eeHits_->end())) continue;
0300 
0301       //       // cuts here must be parametrized
0302       //       if(hitItr->energy() < 0.5) continue;
0303 
0304       //       if(hitItr->energy() / energy > 0.95) continue;
0305 
0306       //       lowMassCands.push_back(&(*bcItr));
0307     }
0308 
0309     if (isBarrel) {
0310       meBCNum.fill(getEcalDQMSetupObjects(), EcalBarrel, nBC[0] + nBC[1]);
0311       meTrendNBC.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), nBC[0] + nBC[1]);
0312     } else {
0313       meBCNum.fill(getEcalDQMSetupObjects(), -EcalEndcap, nBC[0]);
0314       meBCNum.fill(getEcalDQMSetupObjects(), EcalEndcap, nBC[1]);
0315       meTrendNBC.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), nBC[0] + nBC[1]);
0316     }
0317 
0318     //     if(ievt_ % massCalcPrescale_ != 0) return;
0319 
0320     //     double const pi(3.14159265);
0321 
0322     //     for(vector<reco::BasicCluster const*>::iterator bcItr1(lowMassCands.begin()); bcItr1 != lowMassCands.end(); ++bcItr1){
0323     //       reco::BasicCluster const& bc1(**bcItr1);
0324     //       float energy1(bc1.energy());
0325     //       float px1(energy1 * sin(bc1.position().theta()) * cos(bc1.phi()));
0326     //       float py1(energy1 * sin(bc1.position().theta()) * sin(bc1.phi()));
0327     //       float pz1(energy1 * cos(bc1.position().theta()));
0328 
0329     //       for(vector<reco::BasicCluster const*>::iterator bcItr2(lowMassCands.begin()); bcItr2 != lowMassCands.end(); ++bcItr2){
0330     //  if(*bcItr1 == *bcItr2) continue;
0331     //  reco::BasicCluster const& bc2(**bcItr2);
0332     //  float energy2(bc2.energy());
0333     //  float px2(energy2 * sin(bc2.position().theta()) * cos(bc2.phi()));
0334     //  float py2(energy2 * sin(bc2.position().theta()) * sin(bc2.phi()));
0335     //  float pz2(energy2 * cos(bc2.position().theta()));
0336 
0337     //  float ptpair(sqrt((px1 + px2) * (px1 + px2) + (py1 + py2) * (py1 + py2)));
0338     //  if(ptpair < 2.5) continue;
0339 
0340     //  float epair(energy1 + energy2);
0341     //  float pzpair(abs(pz1 + pz2));
0342 
0343     //         float m2(epair * epair - pzpair * pzpair - ptpair * ptpair);
0344     //         if(m2 < 0.) continue;
0345 
0346     //  float eta(0.5 * log((epair + pzpair)/(epair - pzpair)));
0347     //  float phi(atan2(px1 + px2, py1 + py2));
0348 
0349     //  float iso(0.);
0350     //  for(reco::BasicClusterCollection::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr){
0351     //    float dEta(bcItr->eta() - eta);
0352     //    float dPhi(bcItr->phi() - phi);
0353     //           if(dPhi > 2. * pi) dPhi -= 2. * pi;
0354     //           else if(dPhi < -2. * pi) dPhi += 2. * pi;
0355     //    if(sqrt(dEta * dEta + dPhi * dPhi) < 0.2) iso += bcItr->energy() * sin(bcItr->position().theta());
0356     //  }
0357     //  if(iso > 0.5) continue;
0358 
0359     //  float mass(sqrt(m2));
0360     //  MEs_[kPi0]->fill(mass);
0361     //  MEs_[kJPsi]->fill(mass);
0362     //       }
0363     //     }
0364   }
0365 
0366   void ClusterTask::runOnSuperClusters(reco::SuperClusterCollection const& _scs, Collections _collection) {
0367     bool isBarrel(_collection == kEBSuperCluster);
0368     EcalSubdetector subdet(isBarrel ? EcalBarrel : EcalEndcap);
0369 
0370     MESet& meSCE(MEs_.at("SCE"));
0371     MESet& meSCELow(MEs_.at("SCELow"));
0372     MESet& meSCRawE(MEs_.at("SCRawE"));
0373     MESet& meSCRawELow(MEs_.at("SCRawELow"));
0374     MESet& meSCRawEHigh(MEs_.at("SCRawEHigh"));
0375     MESet& meSCNBCs(MEs_.at("SCNBCs"));
0376     MESet& meSCNcrystals(MEs_.at("SCNcrystals"));
0377     MESet& meTrendSCSize(MEs_.at("TrendSCSize"));
0378     MESet& meSCSeedEnergy(MEs_.at("SCSeedEnergy"));
0379     MESet& meSCClusterVsSeed(MEs_.at("SCClusterVsSeed"));
0380     MESet& meSCSeedOccupancy(MEs_.at("SCSeedOccupancy"));
0381     MESet& meSingleCrystalCluster(MEs_.at("SingleCrystalCluster"));
0382     MESet& meSCR9(MEs_.at("SCR9"));
0383     MESet& meSCR9Raw(MEs_.at("SCR9Raw"));
0384     MESet& meSCR9Full(MEs_.at("SCR9Full"));
0385     MESet& meSCR9FullRaw(MEs_.at("SCR9FullRaw"));
0386 
0387     MESet* meSCSizeVsEnergy(doExtra_ ? &MEs_.at("SCSizeVsEnergy") : nullptr);
0388     MESet* meSCSeedOccupancyHighE(doExtra_ ? &MEs_.at("SCSeedOccupancyHighE") : nullptr);
0389     MESet* meSCSeedOccupancyTrig(doExtra_ ? &MEs_.at("SCSeedOccupancyTrig") : nullptr);
0390     MESet* meSCSeedTimeTrigEx(doExtra_ ? &MEs_.at("SCSeedTimeTrigEx") : nullptr);
0391     MESet* meSCSeedTimeMapTrigEx(doExtra_ ? &MEs_.at("SCSeedTimeMapTrigEx") : nullptr);
0392     MESet* meSCOccupancyProjEta(doExtra_ ? &MEs_.at("SCOccupancyProjEta") : nullptr);
0393     MESet* meSCOccupancyProjPhi(doExtra_ ? &MEs_.at("SCOccupancyProjPhi") : nullptr);
0394     MESet* meSCSwissCross(doExtra_ ? &MEs_.at("SCSwissCross") : nullptr);
0395 
0396     EcalRecHitCollection const* hits(isBarrel ? ebHits_ : eeHits_);
0397 
0398     //     reco::SuperCluster const* leading(0);
0399     //     reco::SuperCluster const* subLeading(0);
0400 
0401     int nSC(0);
0402 
0403     for (reco::SuperClusterCollection::const_iterator scItr(_scs.begin()); scItr != _scs.end(); ++scItr) {
0404       DetId seedId(scItr->seed()->seed());
0405       if (seedId.null()) {
0406         math::XYZPoint const& position(scItr->position());
0407 
0408         GlobalPoint gp(position.x(), position.y(), position.z());
0409 
0410         CaloSubdetectorGeometry const* subgeom(
0411             GetGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap));
0412 
0413         seedId = subgeom->getClosestCell(gp);
0414       }
0415 
0416       if (seedId.null() || (seedId.subdetId() != subdet))
0417         continue;
0418 
0419       EcalRecHitCollection::const_iterator seedItr(hits->find(seedId));
0420       if (seedItr == hits->end())
0421         continue;
0422 
0423       ++nSC;
0424 
0425       float energy(scItr->energy());
0426       float rawEnergy(scItr->rawEnergy());
0427       float size(scItr->size());
0428 
0429       meSCE.fill(getEcalDQMSetupObjects(), seedId, energy);
0430       meSCELow.fill(getEcalDQMSetupObjects(), seedId, energy);
0431 
0432       meSCRawE.fill(getEcalDQMSetupObjects(), seedId, rawEnergy);
0433       meSCRawELow.fill(getEcalDQMSetupObjects(), seedId, rawEnergy);
0434       meSCRawEHigh.fill(getEcalDQMSetupObjects(), seedId, rawEnergy);
0435 
0436       meSCNBCs.fill(getEcalDQMSetupObjects(), seedId, scItr->clustersSize());
0437       meSCNcrystals.fill(getEcalDQMSetupObjects(), seedId, size);
0438 
0439       if (doExtra_) [[clang::suppress]]
0440         meSCSizeVsEnergy->fill(getEcalDQMSetupObjects(), subdet, energy, size);
0441 
0442       meTrendSCSize.fill(getEcalDQMSetupObjects(), seedId, double(timestamp_.iLumi), size);
0443 
0444       meSCSeedEnergy.fill(getEcalDQMSetupObjects(), seedId, seedItr->energy());
0445       meSCClusterVsSeed.fill(getEcalDQMSetupObjects(), seedId, seedItr->energy(), energy);
0446 
0447       meSCSeedOccupancy.fill(getEcalDQMSetupObjects(), seedId);
0448       if (doExtra_ && energy > energyThreshold_) [[clang::suppress]]
0449         meSCSeedOccupancyHighE->fill(getEcalDQMSetupObjects(), seedId);
0450 
0451       if (scItr->size() == 1)
0452         meSingleCrystalCluster.fill(getEcalDQMSetupObjects(), seedId);
0453 
0454       float e3x3(EcalClusterTools::e3x3(*scItr->seed(), hits, GetTopology()));
0455       float e3x3Full(noZS::EcalClusterTools::e3x3(*scItr->seed(), hits, GetTopology()));
0456 
0457       meSCR9.fill(getEcalDQMSetupObjects(), seedId, e3x3 / energy);
0458       meSCR9Raw.fill(getEcalDQMSetupObjects(), seedId, e3x3 / rawEnergy);
0459       meSCR9Full.fill(getEcalDQMSetupObjects(), seedId, e3x3Full / energy);
0460       meSCR9FullRaw.fill(getEcalDQMSetupObjects(), seedId, e3x3Full / rawEnergy);
0461 
0462       if (doExtra_) {
0463         for (unsigned iT(0); iT != nTriggerTypes; ++iT) {
0464           if (!triggered_[iT])
0465             continue;
0466 
0467           [[clang::suppress]] static_cast<MESetMulti*>(meSCSeedOccupancyTrig)->use(trigTypeToME_[iT]);
0468           meSCSeedOccupancyTrig->fill(getEcalDQMSetupObjects(), seedId);
0469 
0470           // exclusive
0471           if (triggered_.count() == 1) {
0472             static_cast<MESetMulti*>(meSCSeedTimeTrigEx)->use(trigTypeToME_[iT]);
0473             static_cast<MESetMulti*>(meSCSeedTimeMapTrigEx)->use(trigTypeToME_[iT]);
0474             meSCSeedTimeTrigEx->fill(getEcalDQMSetupObjects(), subdet, seedItr->time());
0475             meSCSeedTimeMapTrigEx->fill(getEcalDQMSetupObjects(), seedId, seedItr->time());
0476           }
0477         }
0478 
0479         meSCOccupancyProjEta->fill(getEcalDQMSetupObjects(), subdet, scItr->eta());
0480         meSCOccupancyProjPhi->fill(getEcalDQMSetupObjects(), subdet, phi(scItr->phi()));
0481 
0482         if (isBarrel) {
0483           float e1(EcalClusterTools::eMax(*scItr, ebHits_));
0484           if (e1 > swissCrossMaxThreshold_) {
0485             float e4(EcalClusterTools::eTop(*scItr, ebHits_, GetTopology()) +
0486                      EcalClusterTools::eRight(*scItr, ebHits_, GetTopology()) +
0487                      EcalClusterTools::eBottom(*scItr, ebHits_, GetTopology()) +
0488                      EcalClusterTools::eLeft(*scItr, ebHits_, GetTopology()));
0489 
0490             meSCSwissCross->fill(getEcalDQMSetupObjects(), 1. - e4 / e1);
0491           }
0492         }
0493       }
0494 
0495       //       if(ievt_ % massCalcPrescale_ != 0) continue;
0496 
0497       //       float et(energy * sin(scItr->position().theta()));
0498       //       if(!leading || et > leading->energy() * sin(leading->position().theta())){
0499       //  subLeading = leading;
0500       //  leading = &(*scItr);
0501       //       }
0502       //       else if(!subLeading || et > subLeading->energy() * sin(subLeading->position().theta())){
0503       //  subLeading = &(*scItr);
0504       //       }
0505     }
0506 
0507     MEs_.at("SCNum").fill(getEcalDQMSetupObjects(), subdet, nSC);
0508     MEs_.at("TrendNSC").fill(getEcalDQMSetupObjects(), subdet, double(timestamp_.iLumi), nSC);
0509 
0510     //     if(ievt_ % massCalcPrescale_ != 0) return;
0511 
0512     //     // implement isolation & cuts
0513     //     if(!leading || !subLeading) return;
0514     //     float e(leading->energy() + subLeading->energy());
0515     //     float px(leading->energy() * sin(leading->position().theta()) * cos(leading->phi()) + subLeading->energy() * sin(subLeading->position().theta()) * cos(subLeading->phi()));
0516     //     float py(leading->energy() * sin(leading->position().theta()) * sin(leading->phi()) + subLeading->energy() * sin(subLeading->position().theta()) * sin(subLeading->phi()));
0517     //     float pz(leading->energy() * cos(leading->position().theta()) + subLeading->energy() * cos(subLeading->position().theta()));
0518     //     float m2(e * e - px * px - py * py - pz * pz);
0519     //     if(m2 < 0.) return;
0520     //     float mass(sqrt(m2));
0521     //     MEs_[kZ]->fill(mass);
0522     //     MEs_[kHighMass]->fill(mass);
0523   }
0524 
0525   void ClusterTask::setTokens(edm::ConsumesCollector& _collector) {
0526     L1GlobalTriggerReadoutRecordToken_ =
0527         _collector.consumes<L1GlobalTriggerReadoutRecord>(L1GlobalTriggerReadoutRecordTag_);
0528     L1MuGMTReadoutCollectionToken_ = _collector.consumes<L1MuGMTReadoutCollection>(L1MuGMTReadoutCollectionTag_);
0529     menuRcd = _collector.esConsumes();
0530   }
0531 
0532   DEFINE_ECALDQM_WORKER(ClusterTask);
0533 }  // namespace ecaldqm