Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-03 00:58:50

0001 #ifndef OccupancyTask_H
0002 #define OccupancyTask_H
0003 
0004 #include "DQWorkerTask.h"
0005 
0006 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0007 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0008 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h"
0011 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
0012 #include "DataFormats/Provenance/interface/Timestamp.h"
0013 #include "FWCore/Framework/interface/ConsumesCollector.h"
0014 #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h"
0015 
0016 namespace ecaldqm {
0017   class OccupancyTask : public DQWorkerTask {
0018   public:
0019     OccupancyTask();
0020     ~OccupancyTask() override {}
0021 
0022     bool filterRunType(short const*) override;
0023 
0024     void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
0025     void beginRun(edm::Run const&, edm::EventSetup const&) override;
0026     bool analyze(void const*, Collections) override;
0027 
0028     void runOnRawData(EcalRawDataCollection const&);
0029     template <typename DigiCollection>
0030     void runOnDigis(DigiCollection const&, Collections);
0031     void runOnTPDigis(EcalTrigPrimDigiCollection const&);
0032     void runOnRecHits(EcalRecHitCollection const&, Collections);
0033     void setTokens(edm::ConsumesCollector&) override;
0034     void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0035 
0036   private:
0037     void setParams(edm::ParameterSet const&) override;
0038     edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> lasertoken_;
0039     bool FillLaser = false;
0040     float recHitThreshold_;
0041     float tpThreshold_;
0042     edm::TimeValue_t m_iTime;
0043     edm::InputTag metadataTag;
0044     edm::EDGetTokenT<OnlineLuminosityRecord> metaDataToken_;
0045     double scal_pu;
0046     bool FindPUinLS = false;
0047     int nEv;
0048     bool lumiCheck_;
0049   };
0050 
0051   inline bool OccupancyTask::analyze(void const* _p, Collections _collection) {
0052     switch (_collection) {
0053       case kEcalRawData:
0054         if (_p)
0055           runOnRawData(*static_cast<EcalRawDataCollection const*>(_p));
0056         return true;
0057       case kEBDigi:
0058         if (_p)
0059           runOnDigis(*static_cast<EBDigiCollection const*>(_p), _collection);
0060         return true;
0061         break;
0062       case kEEDigi:
0063         if (_p)
0064           runOnDigis(*static_cast<EEDigiCollection const*>(_p), _collection);
0065         return true;
0066         break;
0067       case kTrigPrimDigi:
0068         if (_p)
0069           runOnTPDigis(*static_cast<EcalTrigPrimDigiCollection const*>(_p));
0070         return true;
0071         break;
0072       case kEBRecHit:
0073       case kEERecHit:
0074         if (_p)
0075           runOnRecHits(*static_cast<EcalRecHitCollection const*>(_p), _collection);
0076         return true;
0077         break;
0078       default:
0079         break;
0080     }
0081 
0082     return false;
0083   }
0084 }  // namespace ecaldqm
0085 
0086 #endif