Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "DataFormats/Common/interface/Handle.h"
00022
00023 #include "DQMServices/Core/interface/DQMStore.h"
00024 #include "DQMServices/Core/interface/MonitorElement.h"
00025
00026 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00027 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00028
00029 #include "DataFormats/Common/interface/DetSetVector.h"
00030 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00031
00032 #include <FWCore/Framework/interface/EventSetup.h>
00033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00034
00035 #include "DQM/SiStripMonitorPedestals/interface/SiStripMonitorRawData.h"
00036
00037
00038 #include <cstdlib>
00039 #include <cmath>
00040 #include <numeric>
00041 #include <algorithm>
00042
00043 SiStripMonitorRawData::SiStripMonitorRawData(edm::ParameterSet const& iConfig):
00044 BadFedNumber(0),
00045 dqmStore_(edm::Service<DQMStore>().operator->()),
00046 conf_(iConfig),
00047 m_cacheID_(0)
00048
00049
00050 {
00051 edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData "
00052 << " Constructing....... ";
00053 }
00054
00055
00056 SiStripMonitorRawData::~SiStripMonitorRawData()
00057 {
00058 edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData "
00059 << " Destructing....... ";
00060 }
00061
00062
00063
00064 void SiStripMonitorRawData::beginJob() {
00065 }
00066
00067
00068
00069 void SiStripMonitorRawData::beginRun(edm::Run const& run, edm::EventSetup const& eSetup){
00070 unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
00071
00072 if (BadFedNumber) BadFedNumber->Reset();
00073 if (m_cacheID_ != cacheID) {
00074 m_cacheID_ = cacheID;
00075 eSetup.get<SiStripDetCablingRcd>().get( detcabling );
00076 SelectedDetIds.clear();
00077 detcabling->addActiveDetectorsRawIds(SelectedDetIds);
00078
00079 edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::beginRun: "
00080 << " Creating MEs for new Cabling ";
00081 dqmStore_->setCurrentFolder("Track/GlobalParameter");
00082 if (!BadFedNumber) {
00083 BadFedNumber = dqmStore_->book1D("FaultyFedNumberAndChannel","Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
00084 BadFedNumber->setAxisTitle("Fed Id and Channel numbers",1);
00085 }
00086 }
00087 }
00088
00089
00090
00091 void SiStripMonitorRawData::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup)
00092 {
00093
00094 edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::analyze: Run "<<
00095 iEvent.id().run() << " Event " << iEvent.id().event();
00096
00097
00098 iSetup.get<SiStripDetCablingRcd>().get( detcabling );
00099
00100
00101 std::string digiProducer = conf_.getParameter<std::string>("DigiProducer");
00102
00103 edm::Handle< edm::DetSetVector<SiStripRawDigi> > digi_collection;
00104 std::string digiType = "VirginRaw";
00105
00106 iEvent.getByLabel(digiProducer, digiType, digi_collection);
00107
00108 for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(),
00109 iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
00110 std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( (*idetid) );
00111 if (digis == digi_collection->end() ||
00112 digis->data.size() == 0 ||
00113 digis->data.size() > 768 ) {
00114 std::vector<FedChannelConnection> fed_conns = detcabling->getConnections((*idetid));
00115 for (unsigned int k = 0; k < fed_conns.size() ; k++) {
00116 float fed_id = fed_conns[k].fedId() + 0.01*fed_conns[k].fedCh();
00117 BadFedNumber->Fill(fed_id);
00118 }
00119 continue;
00120 }
00121 }
00122 }
00123
00124
00125
00126 void SiStripMonitorRawData::endRun(edm::Run const& run, edm::EventSetup const& eSetup) {
00127 bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00128 std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00129 if (outputMEsInRootFile) {
00130 dqmStore_->showDirStructure();
00131 dqmStore_->save(outputFileName);
00132 }
00133 }
00134
00135
00136
00137 void SiStripMonitorRawData::endJob(void){
00138 edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::EndJob: "
00139 << " Finishing!! ";
00140 }
00141 DEFINE_FWK_MODULE(SiStripMonitorRawData);
00142