Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-08 22:26:32

0001 #ifndef __L1Trigger_L1THGCalUtilities_HGCalTriggerNtupleBase_h__
0002 #define __L1Trigger_L1THGCalUtilities_HGCalTriggerNtupleBase_h__
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "TTree.h"
0011 
0012 namespace HepPDT {
0013   class ParticleDataTable;
0014 }
0015 class MagneticField;
0016 class HGCalTriggerGeometryBase;
0017 
0018 struct HGCalTriggerNtupleEventSetup {
0019   edm::ESHandle<HepPDT::ParticleDataTable> pdt;
0020   edm::ESHandle<MagneticField> magfield;
0021   edm::ESHandle<HGCalTriggerGeometryBase> geometry;
0022 };
0023 
0024 class HGCalTriggerNtupleBase {
0025 public:
0026   HGCalTriggerNtupleBase(const edm::ParameterSet& conf) : name_(conf.getParameter<std::string>("NtupleName")){};
0027   virtual ~HGCalTriggerNtupleBase(){};
0028   const std::string& name() const { return name_; }
0029   virtual void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) = 0;
0030   virtual void fill(const edm::Event&, const HGCalTriggerNtupleEventSetup&) {
0031     edm::LogWarning("NotImplemented") << "Calling ntuplizer fill(edm::Event, HGCalTriggerNtupleEventSetup), but it is "
0032                                          "not implemented in the concrete class '"
0033                                       << name() << "'. "
0034                                       << "You might want to set 'accessEventSetup_' to true in order to call "
0035                                          "fill(edm::Event, edm::EventSetup) instead.";
0036   }
0037   // Kept for backward compatibility: used in L1Trigger/L1CaloTrigger/test
0038   virtual void fill(const edm::Event&, const edm::EventSetup&) {
0039     edm::LogWarning("NotImplemented")
0040         << "Calling ntuplizer fill(edm::Event, edm::EventSetup), but it is not implemented in the concrete class '"
0041         << name() << "'. "
0042         << "You might want to set 'accessEventSetup_' to false in order to call fill(edm::Event, "
0043            "HGCalTriggerNtupleEventSetup) instead.";
0044   }
0045   bool accessEventSetup() const { return accessEventSetup_; }
0046 
0047 protected:
0048   virtual void clear() = 0;
0049   bool accessEventSetup_ = true;
0050   const std::string name_;
0051 };
0052 
0053 #include "FWCore/PluginManager/interface/PluginFactory.h"
0054 typedef edmplugin::PluginFactory<HGCalTriggerNtupleBase*(const edm::ParameterSet&)> HGCalTriggerNtupleFactory;
0055 
0056 #endif