#include <TestPulseTask.h>
Public Types | |
enum | Constants { nGain = 3, nPNGain = 2 } |
enum | MESets { kOccupancy, kShape = kOccupancy + nGain, kAmplitude = kShape + nGain, kPNOccupancy = kAmplitude + nGain, kPNAmplitude = kPNOccupancy + nPNGain, nMESets = kPNAmplitude + nPNGain } |
Public Member Functions | |
void | analyze (const void *, Collections) |
void | beginRun (const edm::Run &, const edm::EventSetup &) |
void | bookMEs () |
void | endEvent (const edm::Event &, const edm::EventSetup &) |
bool | filterRunType (const std::vector< short > &) |
void | runOnDigis (const EcalDigiCollection &) |
void | runOnPnDigis (const EcalPnDiodeDigiCollection &) |
void | runOnUncalibRecHits (const EcalUncalibratedRecHitCollection &) |
TestPulseTask (const edm::ParameterSet &, const edm::ParameterSet &) | |
~TestPulseTask () | |
Static Public Member Functions | |
static void | setMEData (std::vector< MEData > &) |
Protected Attributes | |
bool | enable_ [54] |
int | gain_ [54] |
std::vector< int > | MGPAGains_ |
std::vector< int > | MGPAGainsPN_ |
Definition at line 11 of file TestPulseTask.h.
Definition at line 29 of file TestPulseTask.h.
Reimplemented from ecaldqm::DQWorker.
Definition at line 34 of file TestPulseTask.h.
{ kOccupancy, kShape = kOccupancy + nGain, kAmplitude = kShape + nGain, // profile2d kPNOccupancy = kAmplitude + nGain, // profile2d kPNAmplitude = kPNOccupancy + nPNGain, // profile2d nMESets = kPNAmplitude + nPNGain };
data refman pasoursint CMSSW_5_3_10_patch2 src DQM EcalBarrelMonitorTasks src TestPulseTask cc ecaldqm::TestPulseTask::TestPulseTask | ( | const edm::ParameterSet & | _params, |
const edm::ParameterSet & | _paths | ||
) |
Definition at line 14 of file TestPulseTask.cc.
References Exception, sistrip::extrainfo::gain_, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, ecaldqm::kPnDiodeDigi, and evf::evtn::offset().
{ using namespace std; collectionMask_ = (0x1 << kEBDigi) | (0x1 << kEEDigi) | (0x1 << kPnDiodeDigi) | (0x1 << kEBUncalibRecHit) | (0x1 << kEEUncalibRecHit); edm::ParameterSet const& commonParams(_params.getUntrackedParameterSet("Common")); MGPAGains_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGains"); MGPAGainsPN_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"); for(int idcc(0); idcc < 54; idcc++){ enable_[idcc] = false; gain_[idcc] = 12; } for(std::vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr) if(*gainItr != 1 && *gainItr != 6 && *gainItr != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain" << std::endl; for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr) if(*gainItr != 1 && *gainItr != 16) throw cms::Exception("InvalidConfiguration") << "PN diode gain" << std::endl; map<string, string> replacements; stringstream ss; for(vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr){ ss.str(""); ss << *gainItr; replacements["gain"] = ss.str(); unsigned offset(0); switch(*gainItr){ case 1: offset = 0; break; case 6: offset = 1; break; case 12: offset = 2; break; default: break; } MEs_[kOccupancy + offset]->name(replacements); MEs_[kShape + offset]->name(replacements); MEs_[kAmplitude + offset]->name(replacements); } for(vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){ ss.str(""); ss << *gainItr; replacements["pngain"] = ss.str(); unsigned offset(0); switch(*gainItr){ case 1: offset = 0; break; case 16: offset = 1; break; default: break; } MEs_[kPNOccupancy + offset]->name(replacements); MEs_[kPNAmplitude + offset]->name(replacements); } }
ecaldqm::TestPulseTask::~TestPulseTask | ( | ) |
Definition at line 81 of file TestPulseTask.cc.
{ }
void ecaldqm::TestPulseTask::analyze | ( | const void * | _p, |
Collections | _collection | ||
) | [inline, virtual] |
Reimplemented from ecaldqm::DQWorkerTask.
Definition at line 52 of file TestPulseTask.h.
References ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, ecaldqm::kPnDiodeDigi, runOnDigis(), runOnPnDigis(), and runOnUncalibRecHits().
{ switch(_collection){ case kEBDigi: case kEEDigi: runOnDigis(*static_cast<const EcalDigiCollection*>(_p)); break; case kPnDiodeDigi: runOnPnDigis(*static_cast<const EcalPnDiodeDigiCollection*>(_p)); break; case kEBUncalibRecHit: case kEEUncalibRecHit: runOnUncalibRecHits(*static_cast<const EcalUncalibratedRecHitCollection*>(_p)); break; default: break; } }
void ecaldqm::TestPulseTask::beginRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [virtual] |
Reimplemented from ecaldqm::DQWorker.
Definition at line 115 of file TestPulseTask.cc.
void ecaldqm::TestPulseTask::bookMEs | ( | ) | [virtual] |
Reimplemented from ecaldqm::DQWorker.
Definition at line 86 of file TestPulseTask.cc.
References kAmplitude, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, ecaldqm::DQWorker::MEs_, MGPAGains_, MGPAGainsPN_, and evf::evtn::offset().
{ for(std::vector<int>::iterator gainItr(MGPAGains_.begin()); gainItr != MGPAGains_.end(); ++gainItr){ unsigned offset(0); switch(*gainItr){ case 1: offset = 0; break; case 6: offset = 1; break; case 12: offset = 2; break; default: break; } MEs_[kOccupancy + offset]->book(); MEs_[kShape + offset]->book(); MEs_[kAmplitude + offset]->book(); } for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){ unsigned offset(0); switch(*gainItr){ case 1: offset = 0; break; case 16: offset = 1; break; default: break; } MEs_[kPNOccupancy + offset]->book(); MEs_[kPNAmplitude + offset]->book(); } }
void ecaldqm::TestPulseTask::endEvent | ( | const edm::Event & | , |
const edm::EventSetup & | |||
) | [virtual] |
Reimplemented from ecaldqm::DQWorkerTask.
Definition at line 124 of file TestPulseTask.cc.
bool ecaldqm::TestPulseTask::filterRunType | ( | const std::vector< short > & | _runType | ) | [virtual] |
Reimplemented from ecaldqm::DQWorkerTask.
Definition at line 133 of file TestPulseTask.cc.
References enable_, EcalDCCHeaderBlock::TESTPULSE_GAP, and EcalDCCHeaderBlock::TESTPULSE_MGPA.
{ bool enable(false); for(int iFED(0); iFED < 54; iFED++){ if(_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA || _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP){ enable = true; enable_[iFED] = true; } } return enable; }
void ecaldqm::TestPulseTask::runOnDigis | ( | const EcalDigiCollection & | _digis | ) |
Definition at line 149 of file TestPulseTask.cc.
References EcalMGPASample::adc(), edm::DataFrameContainer::begin(), ecaldqm::dccId(), enable_, edm::DataFrameContainer::end(), lumiContext::fill, spr::find(), gain_, EcalMGPASample::gainId(), errorMatrix2Lands_multiChannel::id, kOccupancy, kShape, ecaldqm::DQWorker::MEs_, MGPAGains_, evf::evtn::offset(), and EcalDataFrame::sample().
Referenced by analyze().
{ for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ DetId id(digiItr->id()); int iDCC(dccId(id) - 1); if(!enable_[iDCC]) continue; // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor EcalDataFrame dataFrame(*digiItr); unsigned offset(0); switch(dataFrame.sample(0).gainId()){ case 1: offset = 2; gain_[iDCC] = 12; break; case 2: offset = 1; gain_[iDCC] = 6; break; case 3: offset = 0; gain_[iDCC] = 1; break; default: continue; } if(std::find(MGPAGains_.begin(), MGPAGains_.end(), gain_[iDCC]) == MGPAGains_.end()) continue; MEs_[kOccupancy + offset]->fill(id); for(int iSample(0); iSample < 10; iSample++) MEs_[kShape + offset]->fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); } }
void ecaldqm::TestPulseTask::runOnPnDigis | ( | const EcalPnDiodeDigiCollection & | _digis | ) |
Definition at line 179 of file TestPulseTask.cc.
References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), spr::find(), errorMatrix2Lands_multiChannel::id, kPNAmplitude, kPNOccupancy, max(), ecaldqm::DQWorker::MEs_, MGPAGainsPN_, and evf::evtn::offset().
Referenced by analyze().
{ for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ EcalPnDiodeDetId id(digiItr->id()); int iDCC(dccId(id) - 1); if(!enable_[iDCC]) continue; unsigned offset(0); int gain(0); switch(digiItr->sample(0).gainId()){ case 0: offset = 0; gain = 1; break; case 1: offset = 1; gain = 16; break; default: continue; } if(std::find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), gain) == MGPAGainsPN_.end()) continue; MEs_[kPNOccupancy + offset]->fill(id); float pedestal(0.); for(int iSample(0); iSample < 4; iSample++) pedestal += digiItr->sample(iSample).adc(); pedestal /= 4.; float max(0.); for(int iSample(0); iSample < 50; iSample++) if(digiItr->sample(iSample).adc() > max) max = digiItr->sample(iSample).adc(); float amplitude(max - pedestal); MEs_[kPNAmplitude + offset]->fill(id, amplitude); } }
void ecaldqm::TestPulseTask::runOnUncalibRecHits | ( | const EcalUncalibratedRecHitCollection & | _uhits | ) |
Definition at line 216 of file TestPulseTask.cc.
References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), gain_, errorMatrix2Lands_multiChannel::id, kAmplitude, ecaldqm::DQWorker::MEs_, and evf::evtn::offset().
Referenced by analyze().
{ for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){ DetId id(uhitItr->id()); int iDCC(dccId(id) - 1); if(!enable_[iDCC]) continue; unsigned offset(0); switch(gain_[iDCC]){ case 1: offset = 0; break; case 6: offset = 1; break; case 12: offset = 2; break; default: continue; } MEs_[kAmplitude + offset]->fill(id, uhitItr->amplitude()); } }
void ecaldqm::TestPulseTask::setMEData | ( | std::vector< MEData > & | _data | ) | [static] |
Reimplemented from ecaldqm::DQWorker.
Definition at line 239 of file TestPulseTask.cc.
References MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::AxisSpecs::high, kAmplitude, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, EcalDQMBinningService::kEcalMEM2P, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, EcalDQMBinningService::kSM, EcalDQMBinningService::kSMMEM, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::AxisSpecs::low, EcalDQMBinningService::AxisSpecs::nbins, nGain, and nPNGain.
{ BinService::AxisSpecs axis; axis.nbins = 10; axis.low = 0.; axis.high = 10.; for(unsigned iGain(0); iGain < nGain; iGain++){ _data[kOccupancy + iGain] = MEData("Occupancy", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F); _data[kShape + iGain] = MEData("Shape", BinService::kSM, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, &axis); _data[kAmplitude + iGain] = MEData("Amplitude", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D); } for(unsigned iPNGain(0); iPNGain < nPNGain; iPNGain++){ _data[kPNOccupancy + iPNGain] = MEData("PNOccupancy", BinService::kEcalMEM2P, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F); _data[kPNAmplitude + iPNGain] = MEData("PNPedestal", BinService::kSMMEM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE); } }
bool ecaldqm::TestPulseTask::enable_[54] [protected] |
Definition at line 46 of file TestPulseTask.h.
Referenced by beginRun(), endEvent(), filterRunType(), runOnDigis(), runOnPnDigis(), and runOnUncalibRecHits().
int ecaldqm::TestPulseTask::gain_[54] [protected] |
Definition at line 47 of file TestPulseTask.h.
Referenced by beginRun(), endEvent(), runOnDigis(), and runOnUncalibRecHits().
std::vector<int> ecaldqm::TestPulseTask::MGPAGains_ [protected] |
Definition at line 48 of file TestPulseTask.h.
Referenced by bookMEs(), and runOnDigis().
std::vector<int> ecaldqm::TestPulseTask::MGPAGainsPN_ [protected] |
Definition at line 49 of file TestPulseTask.h.
Referenced by bookMEs(), and runOnPnDigis().