CMS 3D CMS Logo

HcalRawToDigiFake.cc
Go to the documentation of this file.
12 #include <iostream>
13 #include <unordered_set>
14 #include <string>
15 
16 //helper
17 namespace raw_impl {
18  template <class T>
19  void get(edm::EDGetTokenT<T> tok, edm::Event& e, const std::string& productName = "") {
20  edm::Handle<T> h_coll;
21  e.getByToken(tok, h_coll);
22  auto o_coll = std::make_unique<T>();
23  if (h_coll.isValid()) {
24  //copy constructor
25  o_coll = std::make_unique<T>(*(h_coll.product()));
26  }
27  if (!productName.empty())
28  e.put(std::move(o_coll), productName);
29  else
30  e.put(std::move(o_coll));
31  }
32 } // namespace raw_impl
33 
35 public:
36  explicit HcalRawToDigiFake(const edm::ParameterSet& ps);
37  ~HcalRawToDigiFake() override;
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39  void produce(edm::StreamID id, edm::Event& e, const edm::EventSetup& c) const override;
40 
41 private:
42  //members
54  const bool unpackCalib_, unpackZDC_, unpackTTP_;
55 };
56 
58  : tok_QIE10DigiCollection_(consumes<QIE10DigiCollection>(conf.getParameter<edm::InputTag>("QIE10"))),
59  tok_QIE11DigiCollection_(consumes<QIE11DigiCollection>(conf.getParameter<edm::InputTag>("QIE11"))),
60  tok_HBHEDigiCollection_(consumes<HBHEDigiCollection>(conf.getParameter<edm::InputTag>("HBHE"))),
61  tok_HFDigiCollection_(consumes<HFDigiCollection>(conf.getParameter<edm::InputTag>("HF"))),
62  tok_HODigiCollection_(consumes<HODigiCollection>(conf.getParameter<edm::InputTag>("HO"))),
63  tok_TPDigiCollection_(consumes<HcalTrigPrimDigiCollection>(conf.getParameter<edm::InputTag>("TRIG"))),
64  tok_HOTPDigiCollection_(consumes<HOTrigPrimDigiCollection>(conf.getParameter<edm::InputTag>("HOTP"))),
65  tok_CalibDigiCollection_(consumes<HcalCalibDigiCollection>(conf.getParameter<edm::InputTag>("CALIB"))),
66  tok_ZDCDigiCollection_(consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("ZDC"))),
67  tok_ZDCQIE10DigiCollection_(consumes<QIE10DigiCollection>(conf.getParameter<edm::InputTag>("ZDCQIE10"))),
68  tok_TTPDigiCollection_(consumes<HcalTTPDigiCollection>(conf.getParameter<edm::InputTag>("TTP"))),
69  unpackCalib_(conf.getParameter<bool>("UnpackCalib")),
70  unpackZDC_(conf.getParameter<bool>("UnpackZDC")),
71  unpackTTP_(conf.getParameter<bool>("UnpackTTP")) {
72  // products produced...
73  produces<QIE10DigiCollection>();
74  produces<QIE11DigiCollection>();
75  produces<HBHEDigiCollection>();
76  produces<HFDigiCollection>();
77  produces<HODigiCollection>();
78  produces<HcalTrigPrimDigiCollection>();
79  produces<HOTrigPrimDigiCollection>();
80  if (unpackCalib_)
81  produces<HcalCalibDigiCollection>();
82  if (unpackZDC_)
83  produces<ZDCDigiCollection>();
84  if (unpackTTP_)
85  produces<HcalTTPDigiCollection>();
86  produces<QIE10DigiCollection>("ZDC");
87 }
88 
89 // Virtual destructor needed.
91 
94  desc.add<bool>("UnpackZDC", true);
95  desc.add<bool>("UnpackCalib", true);
96  desc.add<bool>("UnpackTTP", true);
97  //empty tag = not usually produced by simulation
98  desc.add<edm::InputTag>("QIE10", edm::InputTag("simHcalDigis", "HFQIE10DigiCollection"));
99  desc.add<edm::InputTag>("QIE11", edm::InputTag("simHcalDigis", "HBHEQIE11DigiCollection"));
100  desc.add<edm::InputTag>("HBHE", edm::InputTag("simHcalDigis"));
101  desc.add<edm::InputTag>("HF", edm::InputTag("simHcalDigis"));
102  desc.add<edm::InputTag>("HO", edm::InputTag("simHcalDigis"));
103  desc.add<edm::InputTag>("TRIG", edm::InputTag("simHcalTriggerPrimitiveDigis"));
104  desc.add<edm::InputTag>("HOTP", edm::InputTag(""));
105  desc.add<edm::InputTag>("CALIB", edm::InputTag(""));
106  desc.add<edm::InputTag>("ZDC", edm::InputTag("simHcalUnsuppressedDigis"));
107  desc.add<edm::InputTag>("ZDCQIE10", edm::InputTag(""));
108  desc.add<edm::InputTag>("TTP", edm::InputTag(""));
109  //not used, just for compatibility
110  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
111  desc.add<int>("firstSample", 0);
112  desc.add<int>("lastSample", 0);
113  descriptions.add("HcalRawToDigiFake", desc);
114 }
115 
116 // Functions that gets called by framework every event
118  //handle each collection
126  if (unpackCalib_)
128  if (unpackZDC_)
131  if (unpackTTP_)
133 }
134 
edm::EDGetTokenT< HcalTTPDigiCollection > tok_TTPDigiCollection_
void get(edm::EDGetTokenT< T > tok, edm::Event &e, const std::string &productName="")
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_TPDigiCollection_
edm::EDGetTokenT< QIE10DigiCollection > tok_QIE10DigiCollection_
edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
edm::EDGetTokenT< QIE10DigiCollection > tok_ZDCQIE10DigiCollection_
edm::EDGetTokenT< QIE11DigiCollection > tok_QIE11DigiCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< HOTrigPrimDigiCollection > tok_HOTPDigiCollection_
~HcalRawToDigiFake() override
HcalRawToDigiFake(const edm::ParameterSet &ps)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< HcalCalibDigiCollection > tok_CalibDigiCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< HODigiCollection > tok_HODigiCollection_
T const * product() const
Definition: Handle.h:69
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< HBHEDigiCollection > tok_HBHEDigiCollection_
void produce(edm::StreamID id, edm::Event &e, const edm::EventSetup &c) const override
HLT enums.
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< ZDCDigiCollection > tok_ZDCDigiCollection_