Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DQM/EcalMonitorTasks/interface/EnergyTask.h"
0002 
0003 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
0004 
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 
0008 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
0009 
0010 namespace ecaldqm {
0011   EnergyTask::EnergyTask() : DQWorkerTask(), isPhysicsRun_(false) {}
0012 
0013   void EnergyTask::setParams(edm::ParameterSet const& _params) {
0014     isPhysicsRun_ = _params.getUntrackedParameter<bool>("isPhysicsRun");
0015   }
0016 
0017   bool EnergyTask::filterRunType(short const* _runType) {
0018     for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) {
0019       if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
0020           _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
0021           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
0022           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
0023         return true;
0024     }
0025 
0026     return false;
0027   }
0028 
0029   void EnergyTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const& ByLumiResetSwitch, bool&) {
0030     if (ByLumiResetSwitch) {
0031       MEs_.at("HitMapAllByLumi").reset(GetElectronicsMap());
0032     }
0033   }
0034 
0035   void EnergyTask::runOnRecHits(EcalRecHitCollection const& _hits) {
0036     MESet& meHitMap(MEs_.at("HitMap"));
0037     MESet& meHitMapAll(MEs_.at("HitMapAll"));
0038     MESet& meHitMapAllByLumi(MEs_.at("HitMapAllByLumi"));
0039     MESet& meHit(MEs_.at("Hit"));
0040     MESet& meHitAll(MEs_.at("HitAll"));
0041 
0042     uint32_t goodORPoorCalibBits(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kPoorCalib);
0043     uint32_t goodOROOTBits(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime);
0044 
0045     for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) {
0046       if (isPhysicsRun_ && !hitItr->checkFlagMask(goodORPoorCalibBits))
0047         continue;
0048       if (!isPhysicsRun_ && !hitItr->checkFlagMask(goodOROOTBits))
0049         continue;
0050 
0051       float energy(hitItr->energy());
0052 
0053       if (energy < 0.)
0054         continue;
0055 
0056       DetId id(hitItr->id());
0057 
0058       meHitMap.fill(getEcalDQMSetupObjects(), id, energy);
0059       meHitMapAll.fill(getEcalDQMSetupObjects(), id, energy);
0060       meHitMapAllByLumi.fill(getEcalDQMSetupObjects(), id, energy);
0061       meHit.fill(getEcalDQMSetupObjects(), id, energy);
0062       meHitAll.fill(getEcalDQMSetupObjects(), id, energy);
0063 
0064       // look for the seeds
0065       //       float e3x3(energy);
0066       //       bool isSeed = true;
0067 
0068       //       EcalRecHitCollection::const_iterator neighborItr;
0069       //       float neighborE;
0070       //       std::vector<DetId> window(GetTopology()->getWindow(id, 3, 3));
0071       //       for(std::vector<DetId>::iterator idItr(window.begin()); idItr != window.end(); ++idItr){
0072       //    if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue;
0073       //         if(isPhysicsRun_ && neighborItr->checkFlagMask(notGood)) continue;
0074       //         if(!isPhysicsRun_ && neighborItr->checkFlagMask(neitherGoodNorOOT)) continue;
0075       //    neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy();
0076       //    if(neighborE > energy){
0077       //      isSeed = false;
0078       //      break;
0079       //    }
0080       //    e3x3 += neighborE;
0081       //       }
0082 
0083       //       if(!isSeed) continue;
0084 
0085       //       if ( e3x3 >= threshS9_ )
0086       //    MEs_[kMiniCluster]->fill(id, e3x3);
0087     }
0088   }
0089 
0090   DEFINE_ECALDQM_WORKER(EnergyTask);
0091 }  // namespace ecaldqm