CMS 3D CMS Logo

EcalDigisFromPortableProducer.cc
Go to the documentation of this file.
1 #include <utility>
2 
14 
16 public:
18  ~EcalDigisFromPortableProducer() override = default;
20 
21 private:
22  void produce(edm::Event&, edm::EventSetup const&) override;
23 
24  template <typename ProductType, typename... ARGS>
26  return (produceDummyIntegrityCollections_) ? produces<ProductType>(std::forward<ARGS>(args)...)
28  }
29 
30 private:
31  // input digi collections on host in SoA format
35 
36  // output digi collections in legacy format
39 
40  // whether to produce dummy integrity collections
42 
43  // dummy producer collections
46 
47  // dummy ECAL raw data collection
49 
50  // dummy integrity for xtal data
54 
55  // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
59 
60  // dummy integrity errors
64 
66 
67  // dummy TCC collections
70 
71  // dummy mem integrity collections
76 };
77 
80 
81  desc.add<edm::InputTag>("digisInLabelEB", edm::InputTag{"ecalRawToDigiPortable", "ebDigis"});
82  desc.add<edm::InputTag>("digisInLabelEE", edm::InputTag{"ecalRawToDigiPortable", "eeDigis"});
83  desc.add<std::string>("digisOutLabelEB", "ebDigis");
84  desc.add<std::string>("digisOutLabelEE", "eeDigis");
85  desc.add<bool>("produceDummyIntegrityCollections", false);
86 
87  confDesc.add("ecalDigisFromPortableProducer", desc);
88 }
89 
91  : // input digi collections on host in SoA format
92  digisInEBToken_{consumes(ps.getParameter<edm::InputTag>("digisInLabelEB"))},
93  digisInEEToken_{consumes(ps.getParameter<edm::InputTag>("digisInLabelEE"))},
94 
95  // output digi collections in legacy format
96  digisOutEBToken_{produces<EBDigiCollection>(ps.getParameter<std::string>("digisOutLabelEB"))},
97  digisOutEEToken_{produces<EEDigiCollection>(ps.getParameter<std::string>("digisOutLabelEE"))},
98 
99  // whether to produce dummy integrity collections
100  produceDummyIntegrityCollections_{ps.getParameter<bool>("produceDummyIntegrityCollections")},
101 
102  // dummy collections
103  ebSrFlagToken_{dummyProduces<EBSrFlagCollection>()},
104  eeSrFlagToken_{dummyProduces<EESrFlagCollection>()},
105 
106  // dummy ECAL raw data collection
107  ecalRawDataToken_{dummyProduces<EcalRawDataCollection>()},
108 
109  // dummy integrity for xtal data
110  ebIntegrityGainErrorsToken_{dummyProduces<EBDetIdCollection>("EcalIntegrityGainErrors")},
111  ebIntegrityGainSwitchErrorsToken_{dummyProduces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors")},
112  ebIntegrityChIdErrorsToken_{dummyProduces<EBDetIdCollection>("EcalIntegrityChIdErrors")},
113 
114  // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
115  eeIntegrityGainErrorsToken_{dummyProduces<EEDetIdCollection>("EcalIntegrityGainErrors")},
116  eeIntegrityGainSwitchErrorsToken_{dummyProduces<EEDetIdCollection>("EcalIntegrityGainSwitchErrors")},
117  eeIntegrityChIdErrorsToken_{dummyProduces<EEDetIdCollection>("EcalIntegrityChIdErrors")},
118 
119  // dummy integrity errors
120  integrityTTIdErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors")},
121  integrityZSXtalIdErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityZSXtalIdErrors")},
122  integrityBlockSizeErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors")},
123 
124  //
125  pnDiodeDigisToken_{dummyProduces<EcalPnDiodeDigiCollection>()},
126 
127  // dummy TCC collections
128  ecalTriggerPrimitivesToken_{dummyProduces<EcalTrigPrimDigiCollection>("EcalTriggerPrimitives")},
129  ecalPseudoStripInputsToken_{dummyProduces<EcalPSInputDigiCollection>("EcalPseudoStripInputs")},
130 
131  // dummy mem integrity collections
132  ecalIntegrityMemTtIdErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors")},
133  ecalIntegrityMemBlockSizeErrorsToken_{
134  dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSizeErrors")},
135  ecalIntegrityMemChIdErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors")},
136  ecalIntegrityMemGainErrorsToken_{dummyProduces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors")} {}
137 
139  // output collections
140  auto digisEB = std::make_unique<EBDigiCollection>();
141  auto digisEE = std::make_unique<EEDigiCollection>();
142 
143  auto const& digisEBSoAHostColl = event.get(digisInEBToken_);
144  auto const& digisEESoAHostColl = event.get(digisInEEToken_);
145  auto& digisEBSoAView = digisEBSoAHostColl.view();
146  auto& digisEESoAView = digisEESoAHostColl.view();
147 
148  auto const digisEBSize = digisEBSoAView.size();
149  auto const digisEESize = digisEESoAView.size();
150  auto const digisEBDataSize = digisEBSize * ecalPh1::sampleSize;
151  auto const digisEEDataSize = digisEESize * ecalPh1::sampleSize;
152 
153  // Intermediate containers because the DigiCollection containers are accessible only as const
154  EBDigiCollection::IdContainer digisIdsEB(digisEBSoAView.id(), digisEBSoAView.id() + digisEBSize);
155  EEDigiCollection::IdContainer digisIdsEE(digisEESoAView.id(), digisEESoAView.id() + digisEESize);
156  EBDigiCollection::DataContainer digisDataEB(digisEBSoAView.data()->data(),
157  digisEBSoAView.data()->data() + digisEBDataSize);
158  EEDigiCollection::DataContainer digisDataEE(digisEESoAView.data()->data(),
159  digisEESoAView.data()->data() + digisEEDataSize);
160 
161  digisEB->swap(digisIdsEB, digisDataEB);
162  digisEE->swap(digisIdsEE, digisDataEE);
163 
164  digisEB->sort();
165  digisEE->sort();
166 
167  event.put(digisOutEBToken_, std::move(digisEB));
168  event.put(digisOutEEToken_, std::move(digisEE));
169 
171  // dummy collections
172  event.emplace(ebSrFlagToken_);
173  event.emplace(eeSrFlagToken_);
174  // dummy ECAL raw data collection
175  event.emplace(ecalRawDataToken_);
176  // dummy integrity for xtal data
177  event.emplace(ebIntegrityGainErrorsToken_);
178  event.emplace(ebIntegrityGainSwitchErrorsToken_);
179  event.emplace(ebIntegrityChIdErrorsToken_);
180  // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
181  event.emplace(eeIntegrityGainErrorsToken_);
182  event.emplace(eeIntegrityGainSwitchErrorsToken_);
183  event.emplace(eeIntegrityChIdErrorsToken_);
184  // dummy integrity errors
185  event.emplace(integrityTTIdErrorsToken_);
186  event.emplace(integrityZSXtalIdErrorsToken_);
187  event.emplace(integrityBlockSizeErrorsToken_);
188  //
189  event.emplace(pnDiodeDigisToken_);
190  // dummy TCC collections
191  event.emplace(ecalTriggerPrimitivesToken_);
192  event.emplace(ecalPseudoStripInputsToken_);
193  // dummy mem integrity collections
194  event.emplace(ecalIntegrityMemTtIdErrorsToken_);
196  event.emplace(ecalIntegrityMemChIdErrorsToken_);
197  event.emplace(ecalIntegrityMemGainErrorsToken_);
198  }
199 }
200 
edm::EDGetTokenT< InputProduct > digisInEBToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< EcalElectronicsIdCollection > integrityBlockSizeErrorsToken_
EcalDigisFromPortableProducer(edm::ParameterSet const &ps)
PortableHostCollection< EcalDigiSoA > EcalDigiHostCollection
edm::EDPutTokenT< EcalTrigPrimDigiCollection > ecalTriggerPrimitivesToken_
edm::EDPutTokenT< EcalPSInputDigiCollection > ecalPseudoStripInputsToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityChIdErrorsToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityGainErrorsToken_
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityGainErrorsToken_
edm::EDPutTokenT< EcalElectronicsIdCollection > ecalIntegrityMemTtIdErrorsToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< InputProduct > digisInEEToken_
edm::EDPutTokenT< EcalElectronicsIdCollection > ecalIntegrityMemGainErrorsToken_
std::vector< data_type > DataContainer
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~EcalDigisFromPortableProducer() override=default
edm::EDPutTokenT< EcalElectronicsIdCollection > ecalIntegrityMemBlockSizeErrorsToken_
edm::EDPutTokenT< EcalElectronicsIdCollection > integrityZSXtalIdErrorsToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDPutTokenT< EBDigiCollection > digisOutEBToken_
static constexpr unsigned int sampleSize
Definition: EcalConstants.h:53
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityGainSwitchErrorsToken_
void produce(edm::Event &, edm::EventSetup const &) override
std::vector< id_type > IdContainer
edm::EDPutTokenT< EcalElectronicsIdCollection > ecalIntegrityMemChIdErrorsToken_
edm::EDPutTokenT< EESrFlagCollection > eeSrFlagToken_
edm::EDPutTokenT< EcalPnDiodeDigiCollection > pnDiodeDigisToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
edm::EDPutTokenT< ProductType > dummyProduces(ARGS &&... args)
edm::EDPutTokenT< EBSrFlagCollection > ebSrFlagToken_
edm::EDPutTokenT< EcalRawDataCollection > ecalRawDataToken_
def move(src, dest)
Definition: eostools.py:511
edm::EDPutTokenT< EcalElectronicsIdCollection > integrityTTIdErrorsToken_
Definition: event.py:1
edm::EDPutTokenT< EEDigiCollection > digisOutEEToken_