CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/EcalBarrelMonitorTasks/src/TimingTask.cc

Go to the documentation of this file.
00001 #include "../interface/TimingTask.h"
00002 
00003 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
00004 
00005 namespace ecaldqm {
00006 
00007   TimingTask::TimingTask(const edm::ParameterSet &_params, const edm::ParameterSet& _paths) :
00008     DQWorkerTask(_params, _paths, "TimingTask"),
00009     energyThresholdEB_(0.),
00010     energyThresholdEE_(0.)
00011   {
00012     collectionMask_ = 
00013       (0x1 << kEBRecHit) |
00014       (0x1 << kEERecHit);
00015 
00016     edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
00017 
00018     energyThresholdEB_ = taskParams.getUntrackedParameter<double>("energyThresholdEB");
00019     energyThresholdEE_ = taskParams.getUntrackedParameter<double>("energyThresholdEE");
00020   }
00021 
00022   TimingTask::~TimingTask()
00023   {
00024   }
00025 
00026   bool
00027   TimingTask::filterRunType(const std::vector<short>& _runType)
00028   {
00029     for(int iFED(0); iFED < 54; iFED++){
00030       if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
00031            _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
00032            _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00033            _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00034            _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00035            _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
00036     }
00037 
00038     return false;
00039   }
00040 
00041   void 
00042   TimingTask::runOnRecHits(const EcalRecHitCollection &_hits, Collections _collection)
00043   {
00044     uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime)));
00045     float threshold(_collection == kEBRecHit ? energyThresholdEB_ : energyThresholdEE_);
00046 
00047     for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){
00048 
00049       if(hitItr->checkFlagMask(mask)) continue;
00050 
00051       DetId id(hitItr->id());
00052 
00053       float time(hitItr->time());
00054       float energy(hitItr->energy());
00055 
00056       MEs_[kTimeAmp]->fill(id, energy, time);
00057       MEs_[kTimeAmpAll]->fill(id, energy, time);
00058 
00059       if(energy > threshold){
00060         MEs_[kTimeAll]->fill(id, time);
00061         MEs_[kTimeMap]->fill(id, time);
00062         MEs_[kTimeAllMap]->fill(id, time);
00063       }
00064     }
00065   }
00066 
00067   /*static*/
00068   void
00069   TimingTask::setMEData(std::vector<MEData>& _data)
00070   {
00071     BinService::AxisSpecs axis, axisE, axisT;
00072 
00073     axis.low = -20.;
00074     axis.high = 20.;
00075     _data[kTimeMap] = MEData("TimeMap", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, 0, &axis);
00076 
00077     axis.nbins = 100;
00078     axis.low = -25.;
00079     axis.high = 25.;
00080     _data[kTimeAll] = MEData("TimeAll", BinService::kEcal2P, BinService::kUser, MonitorElement::DQM_KIND_TH1F, &axis);
00081 
00082     axis.low = -7.;
00083     axis.high = 7.;
00084     _data[kTimeAllMap] = MEData("TimeAllMap", BinService::kEcal3P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, 0, &axis);
00085 
00086 
00087     axisE.nbins = 25;
00088     axisE.low = -0.5;
00089     axisE.high = 2.;
00090     axisE.edges = new double[axisE.nbins + 1];
00091     for(int i = 0; i <= axisE.nbins; i++)
00092       axisE.edges[i] = pow((float)10., axisE.low + (axisE.high - axisE.low) / axisE.nbins * i);
00093 
00094     axisT.nbins = 200;
00095     axisT.low = -50.;
00096     axisT.high = 50.;
00097     axisT.edges = new double[axisT.nbins + 1];
00098     for(int i = 0; i <= axisT.nbins; i++)
00099       axisT.edges[i] = axisT.low + (axisT.high - axisT.low) / axisT.nbins * i;
00100 
00101     _data[kTimeAmp] = MEData("TimeAmp", BinService::kSM, BinService::kUser, MonitorElement::DQM_KIND_TH2F, &axisE, &axisT);
00102     _data[kTimeAmpAll] = MEData("TimeAmpAll", BinService::kEcal2P, BinService::kUser, MonitorElement::DQM_KIND_TH2F, &axisE, &axisT);
00103   }
00104 
00105   DEFINE_ECALDQM_WORKER(TimingTask);
00106 }
00107 
00108