CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/EcalBarrelMonitorTasks/src/IntegrityTask.cc

Go to the documentation of this file.
00001 #include "../interface/IntegrityTask.h"
00002 
00003 #include "FWCore/Utilities/interface/Exception.h"
00004 
00005 namespace ecaldqm {
00006 
00007   IntegrityTask::IntegrityTask(const edm::ParameterSet &_params, const edm::ParameterSet& _paths) :
00008     DQWorkerTask(_params, _paths, "IntegrityTask"),
00009     hltTaskMode_(0),
00010     hltTaskFolder_("")
00011   {
00012     collectionMask_ = 
00013       (0x1 << kLumiSection) |
00014       (0x1 << kGainErrors) |
00015       (0x1 << kChIdErrors) |
00016       (0x1 << kGainSwitchErrors) |
00017       (0x1 << kTowerIdErrors) |
00018       (0x1 << kBlockSizeErrors);
00019 
00020     edm::ParameterSet const& commonParams(_params.getUntrackedParameterSet("Common"));
00021 
00022     hltTaskMode_ = commonParams.getUntrackedParameter<int>("hltTaskMode");
00023     hltTaskFolder_ = commonParams.getUntrackedParameter<std::string>("hltTaskFolder");
00024 
00025     if(hltTaskMode_ != 0 && hltTaskFolder_.size() == 0)
00026         throw cms::Exception("InvalidConfiguration") << "HLTTask mode needs a folder name";
00027 
00028     if(hltTaskMode_ != 0){
00029       std::string path;
00030       std::map<std::string, std::string> replacements;
00031       replacements["hlttask"] = hltTaskFolder_;
00032 
00033       MEs_[kFEDNonFatal]->name(replacements);
00034     }
00035   }
00036 
00037   IntegrityTask::~IntegrityTask()
00038   {
00039   }
00040 
00041   void
00042   IntegrityTask::bookMEs()
00043   {
00044     if(hltTaskMode_ != 1){
00045       for(unsigned iME(kByLumi); iME < kFEDNonFatal; iME++)
00046         MEs_[iME]->book();
00047     }
00048     if(hltTaskMode_ != 0)
00049       MEs_[kFEDNonFatal]->book();
00050   }
00051 
00052   void
00053   IntegrityTask::beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
00054   {
00055     if(MEs_[kByLumi]->isActive()) MEs_[kByLumi]->reset();
00056   }
00057 
00058   void
00059   IntegrityTask::runOnErrors(const DetIdCollection &_ids, Collections _collection)
00060   {
00061     MESets set(nMESets);
00062     switch(_collection){
00063     case kGainErrors:
00064       set = kGain;
00065       break;
00066     case kChIdErrors:
00067       set = kChId;
00068       break;
00069     case kGainSwitchErrors:
00070       set = kGainSwitch;
00071       break;
00072     default:
00073       return;
00074     }
00075 
00076     for(DetIdCollection::const_iterator idItr(_ids.begin()); idItr != _ids.end(); ++idItr){
00077       if(MEs_[set]->isActive()) MEs_[set]->fill(*idItr);
00078       if(MEs_[kFEDNonFatal]->isActive()) MEs_[kFEDNonFatal]->fill(*idItr);
00079       if(MEs_[kByLumi]->isActive()) MEs_[kByLumi]->fill(*idItr);
00080       if(MEs_[kTotal]->isActive()) MEs_[kTotal]->fill(*idItr);
00081     }
00082   }
00083   
00084   void
00085   IntegrityTask::runOnErrors(const EcalElectronicsIdCollection &_ids, Collections _collection)
00086   {
00087     MESets set(nMESets);
00088 
00089     switch(_collection){
00090     case kTowerIdErrors:
00091       set = kTowerId;
00092       break;
00093     case kBlockSizeErrors:
00094       set = kBlockSize;
00095       break;
00096     default:
00097       return;
00098     }
00099 
00100     // 25 is not correct
00101 
00102     for(EcalElectronicsIdCollection::const_iterator idItr(_ids.begin()); idItr != _ids.end(); ++idItr){
00103       if(MEs_[set]->isActive()) MEs_[set]->fill(*idItr, 25.);
00104       if(MEs_[kFEDNonFatal]->isActive()) MEs_[kFEDNonFatal]->fill(*idItr, 25.);
00105       if(MEs_[kByLumi]->isActive()) MEs_[kByLumi]->fill(*idItr, 25.);
00106       if(MEs_[kTotal]->isActive()) MEs_[kTotal]->fill(*idItr, 25.);
00107     }
00108   }
00109 
00110   /*static*/
00111   void
00112   IntegrityTask::setMEData(std::vector<MEData>& _data)
00113   {
00114     _data[kByLumi] = MEData("ByLumi", BinService::kEcal2P, BinService::kDCC, MonitorElement::DQM_KIND_TH1F);
00115     _data[kTotal] = MEData("Total", BinService::kEcal2P, BinService::kDCC, MonitorElement::DQM_KIND_TH1F);
00116     _data[kGain] = MEData("Gain", BinService::kChannel, BinService::kCrystal, MonitorElement::DQM_KIND_TH1F);
00117     _data[kChId] = MEData("ChId", BinService::kChannel, BinService::kCrystal, MonitorElement::DQM_KIND_TH1F);
00118     _data[kGainSwitch] = MEData("GainSwitch", BinService::kChannel, BinService::kCrystal, MonitorElement::DQM_KIND_TH1F);
00119     _data[kBlockSize] = MEData("BlockSize", BinService::kChannel, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH1F);
00120     _data[kTowerId] = MEData("TowerId", BinService::kChannel, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH1F);
00121     _data[kFEDNonFatal] = MEData("FEDNonFatal", BinService::kEcal2P, BinService::kDCC, MonitorElement::DQM_KIND_TH1F);
00122   }
00123 
00124   DEFINE_ECALDQM_WORKER(IntegrityTask);
00125 }
00126 
00127