Go to the documentation of this file.00001 #include "../interface/PresampleTask.h"
00002
00003 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
00004 #include "DataFormats/EcalDigi/interface/EcalDataFrame.h"
00005
00006 namespace ecaldqm {
00007
00008 PresampleTask::PresampleTask(const edm::ParameterSet &_params, const edm::ParameterSet& _paths) :
00009 DQWorkerTask(_params, _paths, "PresampleTask")
00010 {
00011 collectionMask_ =
00012 (0x1 << kEBDigi) |
00013 (0x1 << kEEDigi);
00014 }
00015
00016 PresampleTask::~PresampleTask()
00017 {
00018 }
00019
00020 bool
00021 PresampleTask::filterRunType(const std::vector<short>& _runType)
00022 {
00023 for(int iFED(0); iFED < 54; iFED++){
00024 if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
00025 _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
00026 _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00027 _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00028 _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00029 _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
00030 }
00031
00032 return false;
00033 }
00034
00035 void
00036 PresampleTask::runOnDigis(const EcalDigiCollection &_digis)
00037 {
00038 for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
00039 DetId id(digiItr->id());
00040
00041
00042 EcalDataFrame dataFrame(*digiItr);
00043
00044 float mean(0.);
00045 bool gainSwitch(false);
00046
00047 for(int iSample(0); iSample < 3; iSample++){
00048 if(dataFrame.sample(iSample).gainId() != 1){
00049 gainSwitch = true;
00050 break;
00051 }
00052
00053 mean += dataFrame.sample(iSample).adc();
00054 }
00055 if(gainSwitch) continue;
00056
00057 mean /= 3.;
00058
00059 MEs_[kPedestal]->fill(id, mean);
00060 }
00061 }
00062
00063
00064 void
00065 PresampleTask::setMEData(std::vector<MEData>& _data)
00066 {
00067 BinService::AxisSpecs axis;
00068 axis.low = 160.;
00069 axis.high = 240.;
00070 _data[kPedestal] = MEData("Pedestal", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, 0, &axis);
00071 }
00072
00073 DEFINE_ECALDQM_WORKER(PresampleTask);
00074 }
00075