CMS 3D CMS Logo

HGCDigiConverter.cc
Go to the documentation of this file.
1 //STL includes
2 #include <memory>
3 
4 //framework includes
12 
13 //other includes
15 
17  public:
18  explicit HGCDigiConverter(const edm::ParameterSet&);
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20  private:
21  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
25 };
26 
28  tok_ee_(consumes<HGCEEDigiCollection>(iConfig.getParameter<edm::InputTag>("eeDigis"))),
29  tok_fh_(consumes<HGCHEDigiCollection>(iConfig.getParameter<edm::InputTag>("fhDigis"))),
30  tok_bh_(consumes<HGCBHDigiCollection>(iConfig.getParameter<edm::InputTag>("bhDigis")))
31 {
32  produces<HGCalDigiCollection>("EE");
33  produces<HGCalDigiCollection>("HEfront");
34  produces<HGCalDigiCollection>("HEback");
35 }
36 
41 
42  iEvent.getByToken(tok_ee_,h_ee);
43  iEvent.getByToken(tok_fh_,h_fh);
44  iEvent.getByToken(tok_bh_,h_bh);
45 
46  auto out_ee = std::make_unique<HGCalDigiCollection>();
47  if(h_ee.isValid()){
48  for(const auto& df_ee : *h_ee){
49  HGCalDataFrame tmp(df_ee.id());
50  tmp.setData(df_ee.data());
51  out_ee->push_back(tmp);
52  }
53  }
54  iEvent.put(std::move(out_ee),"EE");
55 
56  auto out_fh = std::make_unique<HGCalDigiCollection>();
57  if(h_fh.isValid()){
58  for(const auto& df_fh : *h_fh){
59  HGCalDataFrame tmp(df_fh.id());
60  tmp.setData(df_fh.data());
61  out_fh->emplace_back(tmp);
62  }
63  }
64  iEvent.put(std::move(out_fh),"HEfront");
65 
66  auto out_bh = std::make_unique<HGCalDigiCollection>();
67  if(h_bh.isValid()){
68  for(const auto& df_bh : *h_bh){
69  HGCalDataFrame tmp(df_bh.id());
70  tmp.setData(df_bh.data());
71  out_bh->emplace_back(tmp);
72  }
73  }
74  iEvent.put(std::move(out_bh),"HEback");
75 }
76 
79  desc.add<edm::InputTag>("eeDigis",edm::InputTag("mix:HGCDigisEE"));
80  desc.add<edm::InputTag>("fhDigis",edm::InputTag("mix:HGCDigisHEfront"));
81  desc.add<edm::InputTag>("bhDigis",edm::InputTag("mix:HGCDigisHEback"));
82 
83  descriptions.add("HGCDigiConverter",desc);
84 }
85 
86 //define this as a plug-in
edm::EDGetTokenT< HGCBHDigiCollection > tok_bh_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< HGCHEDigiCollection > tok_fh_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HGCDigiConverter(const edm::ParameterSet &)
HLT enums.
edm::EDGetTokenT< HGCEEDigiCollection > tok_ee_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:511