Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-29 01:21:19

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