#include <PedestalTask.h>
Public Types | |
enum | Constants { nGain = 3, nPNGain = 2 } |
enum | MESets { kOccupancy, kPedestal = kOccupancy + nGain, kPNOccupancy = kPedestal + nGain, kPNPedestal = kPNOccupancy + nPNGain, nMESets = kPNPedestal + nPNGain } |
Public Member Functions | |
void | analyze (const void *, Collections) |
void | bookMEs () |
bool | filterRunType (const std::vector< short > &) |
PedestalTask (const edm::ParameterSet &, const edm::ParameterSet &) | |
void | runOnDigis (const EcalDigiCollection &) |
void | runOnPnDigis (const EcalPnDiodeDigiCollection &) |
~PedestalTask () | |
Static Public Member Functions | |
static void | setMEData (std::vector< MEData > &) |
Protected Attributes | |
bool | enable_ [BinService::nDCC] |
std::vector< int > | MGPAGains_ |
std::vector< int > | MGPAGainsPN_ |
Definition at line 10 of file PedestalTask.h.
Reimplemented from ecaldqm::DQWorker.
Definition at line 29 of file PedestalTask.h.
{ kOccupancy, // h2f kPedestal = kOccupancy + nGain, // profile2d kPNOccupancy = kPedestal + nGain, kPNPedestal = kPNOccupancy + nPNGain, // profile2d nMESets = kPNPedestal + nPNGain };
data refman pasoursint CMSSW_6_1_1 src DQM EcalBarrelMonitorTasks src PedestalTask cc ecaldqm::PedestalTask::PedestalTask | ( | const edm::ParameterSet & | _params, |
const edm::ParameterSet & | _paths | ||
) |
Definition at line 14 of file PedestalTask.cc.
References Exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEBDigi, ecaldqm::kEEDigi, ecaldqm::kPnDiodeDigi, and evf::evtn::offset().
{ using namespace std; collectionMask_ = (0x1 << kEBDigi) | (0x1 << kEEDigi) | (0x1 << kPnDiodeDigi); edm::ParameterSet const& commonParams(_params.getUntrackedParameterSet("Common")); MGPAGains_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGains"); MGPAGainsPN_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"); 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_[kPedestal + 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_[kPNPedestal + offset]->name(replacements); } }
ecaldqm::PedestalTask::~PedestalTask | ( | ) |
Definition at line 73 of file PedestalTask.cc.
{ }
void ecaldqm::PedestalTask::analyze | ( | const void * | _p, |
Collections | _collection | ||
) | [inline, virtual] |
Reimplemented from ecaldqm::DQWorkerTask.
Definition at line 46 of file PedestalTask.h.
References ecaldqm::kEBDigi, ecaldqm::kEEDigi, ecaldqm::kPnDiodeDigi, runOnDigis(), and runOnPnDigis().
{ switch(_collection){ case kEBDigi: case kEEDigi: runOnDigis(*static_cast<const EcalDigiCollection*>(_p)); break; case kPnDiodeDigi: runOnPnDigis(*static_cast<const EcalPnDiodeDigiCollection*>(_p)); break; default: break; } }
void ecaldqm::PedestalTask::bookMEs | ( | ) | [virtual] |
Reimplemented from ecaldqm::DQWorker.
Definition at line 78 of file PedestalTask.cc.
References kOccupancy, kPedestal, kPNOccupancy, kPNPedestal, 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_[kPedestal + 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_[kPNPedestal + offset]->book(); } }
bool ecaldqm::PedestalTask::filterRunType | ( | const std::vector< short > & | _runType | ) | [virtual] |
Reimplemented from ecaldqm::DQWorkerTask.
Definition at line 106 of file PedestalTask.cc.
References enable_, EcalDCCHeaderBlock::PEDESTAL_GAP, and EcalDCCHeaderBlock::PEDESTAL_STD.
{ bool enable(false); for(int iFED(0); iFED < 54; iFED++){ if(_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD || _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP){ enable = true; enable_[iFED] = true; } } return enable; }
void ecaldqm::PedestalTask::runOnDigis | ( | const EcalDigiCollection & | _digis | ) |
Definition at line 122 of file PedestalTask.cc.
References EcalMGPASample::adc(), edm::DataFrameContainer::begin(), ecaldqm::dccId(), enable_, edm::DataFrameContainer::end(), spr::find(), EcalMGPASample::gainId(), kOccupancy, kPedestal, timingPdfMaker::mean, 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); int gain(0); switch(dataFrame.sample(0).gainId()){ case 1: offset = 2; gain = 12; break; case 2: offset = 1; gain = 6; break; case 3: offset = 0; gain = 1; break; default: continue; } if(std::find(MGPAGains_.begin(), MGPAGains_.end(), gain) == MGPAGains_.end()) continue; MEs_[kOccupancy + offset]->fill(id); float mean(0.); for(int iSample(0); iSample < 10; iSample++) mean += dataFrame.sample(iSample).adc(); mean /= 10.; MEs_[kPedestal + offset]->fill(id, mean); } }
void ecaldqm::PedestalTask::runOnPnDigis | ( | const EcalPnDiodeDigiCollection & | _digis | ) |
Definition at line 157 of file PedestalTask.cc.
References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), spr::find(), kPNOccupancy, kPNPedestal, timingPdfMaker::mean, 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 mean(0.); for(int iSample(0); iSample < 50; iSample++) mean += digiItr->sample(iSample).adc(); mean /= 50.; MEs_[kPNPedestal + offset]->fill(id, mean); } }
void ecaldqm::PedestalTask::setMEData | ( | std::vector< MEData > & | _data | ) | [static] |
Reimplemented from ecaldqm::DQWorker.
Definition at line 189 of file PedestalTask.cc.
References MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, EcalDQMBinningService::kEcalMEM2P, kOccupancy, kPedestal, kPNOccupancy, kPNPedestal, EcalDQMBinningService::kSM, EcalDQMBinningService::kSMMEM, EcalDQMBinningService::kSuperCrystal, nGain, and nPNGain.
{ for(unsigned iGain(0); iGain < nGain; iGain++){ _data[kOccupancy + iGain] = MEData("Occupancy", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F); _data[kPedestal + iGain] = MEData("Pedestal", 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[kPNPedestal + iPNGain] = MEData("PNPedestal", BinService::kSMMEM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE); } }
bool ecaldqm::PedestalTask::enable_[BinService::nDCC] [protected] |
Definition at line 43 of file PedestalTask.h.
Referenced by filterRunType(), runOnDigis(), and runOnPnDigis().
std::vector<int> ecaldqm::PedestalTask::MGPAGains_ [protected] |
Definition at line 40 of file PedestalTask.h.
Referenced by bookMEs(), and runOnDigis().
std::vector<int> ecaldqm::PedestalTask::MGPAGainsPN_ [protected] |
Definition at line 41 of file PedestalTask.h.
Referenced by bookMEs(), and runOnPnDigis().