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
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 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
HcalDataFrameContainer
Definition: HcalDigiCollections.h:35
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HcalRawToDigiFake::tok_QIE10DigiCollection_
edm::EDGetTokenT< QIE10DigiCollection > tok_QIE10DigiCollection_
Definition: HcalRawToDigiFake.cc:43
HcalRawToDigiFake::tok_TTPDigiCollection_
edm::EDGetTokenT< HcalTTPDigiCollection > tok_TTPDigiCollection_
Definition: HcalRawToDigiFake.cc:53
ESHandle.h
HcalRawToDigiFake::tok_ZDCDigiCollection_
edm::EDGetTokenT< ZDCDigiCollection > tok_ZDCDigiCollection_
Definition: HcalRawToDigiFake.cc:51
HcalRawToDigiFake
Definition: HcalRawToDigiFake.cc:34
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
edm::Handle
Definition: AssociativeIterator.h:50
HcalRawToDigiFake::tok_HFDigiCollection_
edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
Definition: HcalRawToDigiFake.cc:46
HcalRawToDigiFake::tok_TPDigiCollection_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_TPDigiCollection_
Definition: HcalRawToDigiFake.cc:48
HcalRawToDigiFake::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HcalRawToDigiFake.cc:92
MakerMacros.h
HcalRawToDigiFake::tok_QIE11DigiCollection_
edm::EDGetTokenT< QIE11DigiCollection > tok_QIE11DigiCollection_
Definition: HcalRawToDigiFake.cc:44
raw_impl::get
void get(edm::EDGetTokenT< T > tok, edm::Event &e, const std::string &productName="")
Definition: HcalRawToDigiFake.cc:19
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HcalRawToDigiFake::unpackTTP_
const bool unpackTTP_
Definition: HcalRawToDigiFake.cc:54
HcalRawToDigiFake::tok_ZDCQIE10DigiCollection_
edm::EDGetTokenT< QIE10DigiCollection > tok_ZDCQIE10DigiCollection_
Definition: HcalRawToDigiFake.cc:52
HcalRawToDigiFake::produce
void produce(edm::StreamID id, edm::Event &e, const edm::EventSetup &c) const override
Definition: HcalRawToDigiFake.cc:117
HcalDigiCollections.h
HcalRawToDigiFake::unpackZDC_
const bool unpackZDC_
Definition: HcalRawToDigiFake.cc:54
ParameterSetDescription.h
HcalRawToDigiFake::~HcalRawToDigiFake
~HcalRawToDigiFake() override
Definition: HcalRawToDigiFake.cc:90
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalRawToDigiFake::HcalRawToDigiFake
HcalRawToDigiFake(const edm::ParameterSet &ps)
Definition: HcalRawToDigiFake.cc:57
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
HcalRawToDigiFake::tok_HOTPDigiCollection_
edm::EDGetTokenT< HOTrigPrimDigiCollection > tok_HOTPDigiCollection_
Definition: HcalRawToDigiFake.cc:49
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HcalRawToDigiFake::tok_HODigiCollection_
edm::EDGetTokenT< HODigiCollection > tok_HODigiCollection_
Definition: HcalRawToDigiFake.cc:47
eostools.move
def move(src, dest)
Definition: eostools.py:511
HcalRawToDigiFake::tok_CalibDigiCollection_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_CalibDigiCollection_
Definition: HcalRawToDigiFake.cc:50
EventSetup.h
ParameterSet.h
HcalRawToDigiFake::unpackCalib_
const bool unpackCalib_
Definition: HcalRawToDigiFake.cc:54
EDProducer.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
HcalRawToDigiFake::tok_HBHEDigiCollection_
edm::EDGetTokenT< HBHEDigiCollection > tok_HBHEDigiCollection_
Definition: HcalRawToDigiFake.cc:45
raw_impl
Definition: HcalRawToDigiFake.cc:17
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37