CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/DQM/EcalBarrelMonitorTasks/src/OccupancyTask.cc

Go to the documentation of this file.
00001 #include "../interface/OccupancyTask.h"
00002 
00003 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
00004 
00005 namespace ecaldqm {
00006 
00007   OccupancyTask::OccupancyTask(const edm::ParameterSet &_params, const edm::ParameterSet& _paths) :
00008     DQWorkerTask(_params, _paths, "OccupancyTask"),
00009     recHitThreshold_(0.),
00010     tpThreshold_(0.)
00011   {
00012     collectionMask_ =
00013       (0x1 << kEBDigi) |
00014       (0x1 << kEEDigi) |
00015       (0x1 << kTrigPrimDigi) |
00016       (0x1 << kEBRecHit) |
00017       (0x1 << kEERecHit);
00018 
00019     edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
00020 
00021     recHitThreshold_ = taskParams.getUntrackedParameter<double>("recHitThreshold");
00022     tpThreshold_ = taskParams.getUntrackedParameter<double>("tpThreshold", 1.0);
00023   }
00024 
00025   OccupancyTask::~OccupancyTask()
00026   {
00027   }
00028 
00029   bool
00030   OccupancyTask::filterRunType(const std::vector<short>& _runType)
00031   {
00032     for(int iFED(0); iFED < 54; iFED++){
00033       if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
00034          _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
00035          _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00036          _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00037          _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00038          _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true;
00039     }
00040 
00041     return false;
00042   }
00043 
00044   void
00045   OccupancyTask::runOnDigis(const EcalDigiCollection &_digis)
00046   {
00047     for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
00048       DetId id(digiItr->id());
00049       MEs_[kDigi]->fill(id);
00050       MEs_[kDigiProjEta]->fill(id);
00051       MEs_[kDigiProjPhi]->fill(id);
00052       MEs_[kDigiAll]->fill(id);
00053       MEs_[kDigiDCC]->fill(id);
00054     }
00055   }
00056 
00057   void
00058   OccupancyTask::runOnTPDigis(const EcalTrigPrimDigiCollection &_digis)
00059   {
00060     for(EcalTrigPrimDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
00061       EcalTrigTowerDetId const& id(digiItr->id());
00062 
00063       MEs_[kTPDigi]->fill(id);
00064       MEs_[kTPDigiProjEta]->fill(id);
00065       MEs_[kTPDigiProjPhi]->fill(id);
00066 
00067       if(digiItr->compressedEt() > tpThreshold_){
00068         MEs_[kTPDigiThr]->fill(id);
00069         MEs_[kTPDigiThrProjEta]->fill(id);
00070         MEs_[kTPDigiThrProjPhi]->fill(id);
00071         MEs_[kTPDigiThrAll]->fill(id);
00072       }
00073     }
00074   }
00075 
00076   void
00077   OccupancyTask::runOnRecHits(const EcalRecHitCollection &_hits, Collections _collection)
00078   {
00079     uint32_t mask(~(0x1 << EcalRecHit::kGood));
00080 
00081     for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){
00082       DetId id(hitItr->id());
00083 
00084 //       MEs_[kRecHit]->fill(id);
00085 //       MEs_[kRecHitProjEta]->fill(id);
00086 //       MEs_[kRecHitProjPhi]->fill(id);
00087 
00088       if(!hitItr->checkFlagMask(mask) && hitItr->energy() > recHitThreshold_){
00089         MEs_[kRecHitThr]->fill(id);
00090         MEs_[kRecHitThrProjEta]->fill(id);
00091         MEs_[kRecHitThrProjPhi]->fill(id);
00092         MEs_[kRecHitThrAll]->fill(id);
00093       }
00094     }
00095 
00096     if(_collection == kEBRecHit)
00097       MEs_[kRecHit1D]->fill((unsigned)BinService::kEB + 1, float(_hits.size()));
00098     else
00099       MEs_[kRecHit1D]->fill((unsigned)BinService::kEE + 1, float(_hits.size()));
00100   }
00101 
00102   /*static*/
00103   void
00104   OccupancyTask::setMEData(std::vector<MEData>& _data)
00105   {
00106     BinService::AxisSpecs axis;
00107 
00108     _data[kDigi] = MEData("Digi", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F);
00109     _data[kDigiProjEta] = MEData("Digi", BinService::kEcal3P, BinService::kProjEta, MonitorElement::DQM_KIND_TH1F);
00110     _data[kDigiProjPhi] = MEData("Digi", BinService::kEcal3P, BinService::kProjPhi, MonitorElement::DQM_KIND_TH1F);
00111     _data[kDigiAll] = MEData("Digi", BinService::kEcal3P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00112     _data[kDigiDCC] = MEData("DigiDCC", BinService::kEcal2P, BinService::kDCC, MonitorElement::DQM_KIND_TH1F);
00113 
00114     axis.nbins = 100;
00115     axis.low = 0.;
00116     axis.high = 6000.;
00117     _data[kRecHit1D] = MEData("RecHit1D", BinService::kEcal2P, BinService::kUser, MonitorElement::DQM_KIND_TH1F, &axis);
00118     _data[kRecHitThr] = MEData("RecHitThr", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F);
00119     _data[kRecHitThrProjEta] = MEData("RecHitThr", BinService::kEcal3P, BinService::kProjEta, MonitorElement::DQM_KIND_TH1F);
00120     _data[kRecHitThrProjPhi] = MEData("RecHitThr", BinService::kEcal3P, BinService::kProjPhi, MonitorElement::DQM_KIND_TH1F);
00121     _data[kRecHitThrAll] = MEData("RecHitThr", BinService::kEcal3P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00122     _data[kTPDigi] = MEData("TPDigi", BinService::kSM, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00123     _data[kTPDigiProjEta] = MEData("TPDigi", BinService::kEcal3P, BinService::kProjEta, MonitorElement::DQM_KIND_TH1F);
00124     _data[kTPDigiProjPhi] = MEData("TPDigi", BinService::kEcal3P, BinService::kProjPhi, MonitorElement::DQM_KIND_TH1F);
00125     _data[kTPDigiThr] = MEData("TPDigiThr", BinService::kSM, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00126     _data[kTPDigiThrProjEta] = MEData("TPDigiThr", BinService::kEcal3P, BinService::kProjEta, MonitorElement::DQM_KIND_TH1F);
00127     _data[kTPDigiThrProjPhi] = MEData("TPDigiThr", BinService::kEcal3P, BinService::kProjPhi, MonitorElement::DQM_KIND_TH1F);
00128     _data[kTPDigiThrAll] = MEData("TPDigiThr", BinService::kEcal3P, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00129   }
00130 
00131   DEFINE_ECALDQM_WORKER(OccupancyTask);
00132 }
00133