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  {
21  edm::Handle<T> h_coll;
22  e.getByToken(tok, h_coll);
23  auto o_coll = std::make_unique<T>();
24  if(h_coll.isValid()){
25  //copy constructor
26  o_coll = std::make_unique<T>(*(h_coll.product()));
27  }
28  if(productName.size()) e.put(std::move(o_coll),productName);
29  else e.put(std::move(o_coll));
30  }
31 }
32 
34 {
35 public:
36  explicit HcalRawToDigiFake(const edm::ParameterSet& ps);
37  virtual ~HcalRawToDigiFake();
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39  virtual void produce(edm::StreamID id, edm::Event& e, const edm::EventSetup& c) const override;
40 private:
41  //members
53  const bool unpackCalib_, unpackZDC_, unpackTTP_;
54 };
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 {
73  // products produced...
74  produces<QIE10DigiCollection>();
75  produces<QIE11DigiCollection>();
76  produces<HBHEDigiCollection>();
77  produces<HFDigiCollection>();
78  produces<HODigiCollection>();
79  produces<HcalTrigPrimDigiCollection>();
80  produces<HOTrigPrimDigiCollection>();
81  if (unpackCalib_)
82  produces<HcalCalibDigiCollection>();
83  if (unpackZDC_)
84  produces<ZDCDigiCollection>();
85  if (unpackTTP_)
86  produces<HcalTTPDigiCollection>();
87  produces<QIE10DigiCollection>("ZDC");
88 }
89 
90 // Virtual destructor needed.
92 
95  desc.add<bool>("UnpackZDC",true);
96  desc.add<bool>("UnpackCalib",true);
97  desc.add<bool>("UnpackTTP",true);
98  //empty tag = not usually produced by simulation
99  desc.add<edm::InputTag>("QIE10", edm::InputTag("simHcalDigis", "HFQIE10DigiCollection"));
100  desc.add<edm::InputTag>("QIE11", edm::InputTag("simHcalDigis", "HBHEQIE11DigiCollection"));
101  desc.add<edm::InputTag>("HBHE", edm::InputTag("simHcalDigis"));
102  desc.add<edm::InputTag>("HF", edm::InputTag("simHcalDigis"));
103  desc.add<edm::InputTag>("HO", edm::InputTag("simHcalDigis"));
104  desc.add<edm::InputTag>("TRIG", edm::InputTag("simHcalTriggerPrimitiveDigis"));
105  desc.add<edm::InputTag>("HOTP", edm::InputTag(""));
106  desc.add<edm::InputTag>("CALIB", edm::InputTag(""));
107  desc.add<edm::InputTag>("ZDC", edm::InputTag("simHcalUnsuppressedDigis"));
108  desc.add<edm::InputTag>("ZDCQIE10", edm::InputTag(""));
109  desc.add<edm::InputTag>("TTP", edm::InputTag(""));
110  //not used, just for compatibility
111  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
112  desc.add<int>("firstSample",0);
113  desc.add<int>("lastSample",0);
114  descriptions.add("HcalRawToDigiFake",desc);
115 }
116 
117 
118 // Functions that gets called by framework every event
120 {
121  //handle each collection
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_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
edm::EDGetTokenT< QIE10DigiCollection > tok_ZDCQIE10DigiCollection_
edm::EDGetTokenT< QIE11DigiCollection > tok_QIE11DigiCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual ~HcalRawToDigiFake()
edm::EDGetTokenT< HOTrigPrimDigiCollection > tok_HOTPDigiCollection_
HcalRawToDigiFake(const edm::ParameterSet &ps)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< HcalCalibDigiCollection > tok_CalibDigiCollection_
edm::EDGetTokenT< HODigiCollection > tok_HODigiCollection_
T const * product() const
Definition: Handle.h:81
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< HBHEDigiCollection > tok_HBHEDigiCollection_
virtual void produce(edm::StreamID id, edm::Event &e, const edm::EventSetup &c) const override
HLT enums.
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< ZDCDigiCollection > tok_ZDCDigiCollection_