Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-29 01:21:18

0001 #ifndef ClusterTask_H
0002 #define ClusterTask_H
0003 
0004 #include "DQWorkerTask.h"
0005 
0006 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0007 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0008 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0009 #include "DataFormats/Common/interface/View.h"
0010 
0011 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0012 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
0013 
0014 #include "FWCore/Utilities/interface/InputTag.h"
0015 #include "FWCore/Utilities/interface/EDGetToken.h"
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0018 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0019 #include <bitset>
0020 
0021 namespace ecaldqm {
0022   class ClusterTask : public DQWorkerTask {
0023   public:
0024     ClusterTask();
0025     ~ClusterTask() override {}
0026 
0027     bool filterRunType(short const*) override;
0028 
0029     void addDependencies(DependencySet&) override;
0030 
0031     void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
0032     void endEvent(edm::Event const&, edm::EventSetup const&) override;
0033 
0034     bool analyze(void const*, Collections) override;
0035 
0036     void runOnRecHits(EcalRecHitCollection const&, Collections);
0037     void runOnBasicClusters(edm::View<reco::CaloCluster> const&, Collections);
0038     void runOnSuperClusters(reco::SuperClusterCollection const&, Collections);
0039 
0040     void setTokens(edm::ConsumesCollector&) override;
0041 
0042     enum TriggerTypes { kEcalTrigger, kHcalTrigger, kCSCTrigger, kDTTrigger, kRPCTrigger, nTriggerTypes };
0043 
0044   private:
0045     void setParams(edm::ParameterSet const&) override;
0046 
0047     EcalRecHitCollection const* ebHits_;
0048     EcalRecHitCollection const* eeHits_;
0049     //    int ievt_;
0050     //    int massCalcPrescale_;
0051     bool doExtra_;
0052     float energyThreshold_;
0053     float swissCrossMaxThreshold_;
0054     std::vector<std::string> egTriggerAlgos_;
0055     std::bitset<nTriggerTypes> triggered_;
0056     unsigned trigTypeToME_[nTriggerTypes];
0057 
0058     edm::InputTag L1GlobalTriggerReadoutRecordTag_;
0059     edm::InputTag L1MuGMTReadoutCollectionTag_;
0060     edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1GlobalTriggerReadoutRecordToken_;
0061     edm::EDGetTokenT<L1MuGMTReadoutCollection> L1MuGMTReadoutCollectionToken_;
0062     edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> menuRcd;
0063   };
0064 
0065   inline bool ClusterTask::analyze(void const* _p, Collections _collection) {
0066     switch (_collection) {
0067       case kEBRecHit:
0068       case kEERecHit:
0069         if (_p)
0070           runOnRecHits(*static_cast<EcalRecHitCollection const*>(_p), _collection);
0071         return true;
0072         break;
0073       case kEBBasicCluster:
0074       case kEEBasicCluster:
0075         if (_p)
0076           runOnBasicClusters(*static_cast<edm::View<reco::CaloCluster> const*>(_p), _collection);
0077         return true;
0078         break;
0079       case kEBSuperCluster:
0080       case kEESuperCluster:
0081         if (_p)
0082           runOnSuperClusters(*static_cast<reco::SuperClusterCollection const*>(_p), _collection);
0083         return true;
0084         break;
0085       default:
0086         break;
0087     }
0088 
0089     return false;
0090   }
0091 
0092 }  // namespace ecaldqm
0093 
0094 #endif