Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:06:54

0001 #include "DQM/CastorMonitor/interface/CastorLEDMonitor.h"
0002 #include "DQMServices/Core/interface/DQMStore.h"
0003 
0004 //***************************************************//
0005 //********** CastorLEDMonitor ***********************//
0006 //********** Author: Dmytro Volyanskyy   ************//
0007 //********** Date  : 20.11.2008 (first version) ******//
0008 //---------- last revision: 31.05.2011 (Panos Katsas)
0009 //***************************************************//
0010 //---- critical revision 26.06.2014 (Vladimir Popov)
0011 //==================================================================//
0012 
0013 CastorLEDMonitor::CastorLEDMonitor(const edm::ParameterSet &ps) {
0014   fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
0015   if (fVerbosity > 0)
0016     std::cout << "CastorLEDMonitor Constructor: " << this << std::endl;
0017   subsystemname = ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
0018   ievt_ = 0;
0019 }
0020 
0021 CastorLEDMonitor::~CastorLEDMonitor() {}
0022 
0023 void CastorLEDMonitor::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &iRun) {
0024   char s[60];
0025 
0026   ibooker.setCurrentFolder(subsystemname + "/CastorLEDMonitor");
0027 
0028   sprintf(s, "CastorLEDqMap(cumulative)");
0029   h2qMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
0030   h2qMap->setOption("colz");
0031   sprintf(s, "CastorLED_QmeanMap");
0032   h2meanMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
0033   h2meanMap->setAxisTitle("moduleZ", /* axis */ 1);
0034   h2meanMap->setAxisTitle("sectorPhi", /* axis */ 2);
0035   h2meanMap->setOption("colz");
0036 
0037   ievt_ = 0;
0038   return;
0039 }
0040 
0041 void CastorLEDMonitor::processEvent(const CastorDigiCollection &castorDigis, const CastorDbService &cond) {
0042   if (fVerbosity > 0)
0043     std::cout << "CastorLEDMonitor::processEvent (start)" << std::endl;
0044 
0045   /* be implemented
0046    edm::Handle<HcalTBTriggerData> trigger_data;
0047    iEvent.getByToken(tok_tb_, trigger_data);
0048    if(trigger_data.isValid())
0049     if(trigger_data->triggerWord()==6) LEDevent=true;
0050   */
0051 
0052   if (castorDigis.empty()) {
0053     if (fVerbosity > 0)
0054       std::cout << "CastorLEDMonitor::processEvent NO Castor Digis" << std::endl;
0055     return;
0056   }
0057 
0058   for (CastorDigiCollection::const_iterator j = castorDigis.begin(); j != castorDigis.end(); j++) {
0059     const CastorDataFrame digi = (const CastorDataFrame)(*j);
0060     int module = digi.id().module() - 1;
0061     int sector = digi.id().sector() - 1;
0062     double qsum = 0.;
0063     for (int i = 0; i < digi.size(); i++) {
0064       int dig = digi.sample(i).adc() & 0x7f;
0065       float ets = LedMonAdc2fc[dig] + 0.5;
0066       // h2qts->Fill(i,ets);
0067       qsum += ets;
0068     }
0069     // int ind = sector*14 + module;
0070     // h2QvsPMT->Fill(ind,qsum);
0071     h2qMap->Fill(module, sector, qsum);
0072   }  // end for(CastorDigiCollection::const_iterator j=castorDigis...
0073 
0074   ievt_++;
0075   if (ievt_ % 100 == 0) {
0076     for (int mod = 1; mod <= 14; mod++)
0077       for (int sec = 1; sec <= 16; sec++) {
0078         double a = h2qMap->getBinContent(mod, sec);
0079         h2meanMap->setBinContent(mod, sec, a / double(ievt_));
0080       }
0081   }
0082 
0083   if (fVerbosity > 0)
0084     std::cout << "CastorLEDMonitor::processEvent(end)" << std::endl;
0085   return;
0086 }