CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
EcalDigiToRaw Class Reference

#include <EventFilter/EcalDigiToRaw/src/EcalDigiToRaw.cc>

Inheritance diagram for EcalDigiToRaw:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef unsigned int Word32
 
typedef long long Word64
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 EcalDigiToRaw (const edm::ParameterSet &pset)
 
void produce (edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Attributes

static const int BXMAX = 2808
 

Private Attributes

const BlockFormatter::Config config_
 
edm::EDGetTokenT< EBDigiCollectionEBDigiToken_
 
edm::EDGetTokenT< EEDigiCollectionEEDigiToken_
 
edm::EDGetTokenT< EBSrFlagCollectionlabelEBSR_
 
edm::EDGetTokenT< EESrFlagCollectionlabelEESR_
 
edm::EDGetTokenT< EcalTrigPrimDigiCollectionlabelTT_
 
const std::vector< int32_t > listDCCId_
 
edm::EDPutTokenT< FEDRawDataCollectionputToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 54 of file EcalDigiToRaw.cc.

Member Typedef Documentation

typedef unsigned int EcalDigiToRaw::Word32

Definition at line 61 of file EcalDigiToRaw.cc.

typedef long long EcalDigiToRaw::Word64

Definition at line 60 of file EcalDigiToRaw.cc.

Constructor & Destructor Documentation

EcalDigiToRaw::EcalDigiToRaw ( const edm::ParameterSet pset)

Definition at line 83 of file EcalDigiToRaw.cc.

References config_, EBDigiToken_, EEDigiToken_, edm::ParameterSet::getUntrackedParameter(), HLT_2018_cff::InputTag, label, labelEBSR_, labelEESR_, labelTT_, listDCCId_, and putToken_.

84  : listDCCId_{iConfig.getUntrackedParameter<std::vector<int32_t> >("listDCCId")},
86  iConfig.getUntrackedParameter<bool>("debug"),
87  iConfig.getUntrackedParameter<bool>("DoBarrel"),
88  iConfig.getUntrackedParameter<bool>("DoEndCap"),
89  iConfig.getUntrackedParameter<bool>("WriteTCCBlock"),
90  iConfig.getUntrackedParameter<bool>("WriteSRFlags"),
91  iConfig.getUntrackedParameter<bool>("WriteTowerBlock")} {
92  auto label = iConfig.getParameter<string>("Label");
93  auto instanceNameEB = iConfig.getParameter<string>("InstanceEB");
94  auto instanceNameEE = iConfig.getParameter<string>("InstanceEE");
95 
96  edm::InputTag EBlabel = edm::InputTag(label, instanceNameEB);
97  edm::InputTag EElabel = edm::InputTag(label, instanceNameEE);
98 
99  EBDigiToken_ = consumes<EBDigiCollection>(EBlabel);
100  EEDigiToken_ = consumes<EEDigiCollection>(EElabel);
101 
102  labelTT_ = consumes<EcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("labelTT"));
103 
104  labelEBSR_ = consumes<EBSrFlagCollection>(iConfig.getParameter<edm::InputTag>("labelEBSRFlags"));
105  labelEESR_ = consumes<EESrFlagCollection>(iConfig.getParameter<edm::InputTag>("labelEESRFlags"));
106 
107  putToken_ = produces<FEDRawDataCollection>();
108 }
edm::EDGetTokenT< EESrFlagCollection > labelEESR_
edm::EDGetTokenT< EBDigiCollection > EBDigiToken_
char const * label
const std::vector< int32_t > listDCCId_
edm::EDPutTokenT< FEDRawDataCollection > putToken_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > labelTT_
edm::EDGetTokenT< EEDigiCollection > EEDigiToken_
edm::EDGetTokenT< EBSrFlagCollection > labelEBSR_
const BlockFormatter::Config config_

Member Function Documentation

void EcalDigiToRaw::produce ( edm::StreamID  ,
edm::Event e,
const edm::EventSetup c 
) const
override

Definition at line 115 of file EcalDigiToRaw.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::DataFrameContainer::begin(), edm::EventBase::bunchCrossing(), BlockFormatter::Params::bx_, BlockFormatter::CleanUp(), config_, counter, BlockFormatter::Params::counter_, gather_cfg::cout, EcalElectronicsId::dccId(), EcalElectronicsMapping::DCCid(), BlockFormatter::Config::debug_, TauDecayModes::dec, DEFINE_FWK_MODULE, SRBlockFormatter::DigiToRaw(), TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), BlockFormatter::DigiToRaw(), BlockFormatter::Config::doBarrel_, BlockFormatter::Config::doEndCap_, BlockFormatter::Config::doSR_, BlockFormatter::Config::doTCC_, BlockFormatter::Config::doTower_, EBDigiToken_, EcalBarrel, EcalEndcap, SimL1EmulatorDM_cff::eeDigis, EEDigiToken_, edm::Event::emplace(), edm::SortedCollection< T, SORT >::end(), edm::DataFrameContainer::end(), TowerBlockFormatter::EndEvent(), edm::EventID::event(), FEDRawDataCollection::FEDData(), RemoveAddSevLevel::flag, edm::EventSetup::get(), edm::Event::getByToken(), EcalElectronicsMapping::getDCCandSC(), EcalElectronicsMapping::getElectronicsId(), TowerBlockFormatter::GetFEDorder(), EcalSrFlag::id(), edm::EventBase::id(), EcalElectronicsMapping::iTT(), labelEBSR_, labelEESR_, labelTT_, BlockFormatter::Params::lv1_, FEDNumbering::MINECALFEDID, eostools::move(), BlockFormatter::Params::orbit_number_, edm::EventBase::orbitNumber(), CalibrationSummaryClient_cfi::params, BlockFormatter::print(), edm::ESHandle< T >::product(), putToken_, edm::EventID::run(), BlockFormatter::Params::runnumber_, EcalTrigTowerDetId::subDet(), and EcalSrFlag::value().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

115  {
116  if (config_.debug_)
117  cout << "Enter in EcalDigiToRaw::produce ... " << endl;
118 
120  iSetup.get<EcalMappingRcd>().get(ecalmapping);
121  const EcalElectronicsMapping* TheMapping = ecalmapping.product();
122 
123  FEDRawDataCollection productRawData;
124 
126  int counter = iEvent.id().event();
127  params.counter_ = counter;
128  params.orbit_number_ = iEvent.orbitNumber();
129  params.bx_ = iEvent.bunchCrossing();
130  params.lv1_ = counter % (0x1 << 24);
131  params.runnumber_ = iEvent.id().run();
132 
133  BlockFormatter Headerblockformatter(config_, params);
134  TCCBlockFormatter TCCblockformatter(config_, params);
135  TowerBlockFormatter Towerblockformatter(config_, params);
136  SRBlockFormatter SRblockformatter(config_, params);
137 
138  Headerblockformatter.DigiToRaw(&productRawData);
139 
140  // --------- Now the Trigger Block part
141 
143 
144  Handle<EBSrFlagCollection> ebSrFlags;
145  Handle<EESrFlagCollection> eeSrFlags;
146 
147  if (config_.doTCC_) {
148  if (config_.debug_)
149  cout << "Creation of the TCC block " << endl;
150  // iEvent.getByType(ecalTrigPrim);
151  iEvent.getByToken(labelTT_, ecalTrigPrim);
152 
153  // loop on TP's and add one by one to the block
154  for (EcalTrigPrimDigiCollection::const_iterator it = ecalTrigPrim->begin(); it != ecalTrigPrim->end(); it++) {
155  const EcalTriggerPrimitiveDigi& trigprim = *it;
156  const EcalTrigTowerDetId& detid = it->id();
157 
158  if ((detid.subDet() == EcalBarrel) && (!config_.doBarrel_))
159  continue;
160  if ((detid.subDet() == EcalEndcap) && (!config_.doEndCap_))
161  continue;
162 
163  int iDCC = TheMapping->DCCid(detid);
164  int FEDid = FEDNumbering::MINECALFEDID + iDCC;
165 
166  FEDRawData& rawdata = productRawData.FEDData(FEDid);
167 
168  // adding the primitive to the block
169  TCCblockformatter.DigiToRaw(trigprim, rawdata, TheMapping);
170 
171  } // end loop on ecalTrigPrim
172 
173  } // endif doTCC
174 
175  if (config_.doSR_) {
176  if (config_.debug_)
177  cout << " Process the SR flags " << endl;
178 
179  if (config_.doBarrel_) {
180  // iEvent.getByType(ebSrFlags);
181  iEvent.getByToken(labelEBSR_, ebSrFlags);
182 
183  for (EBSrFlagCollection::const_iterator it = ebSrFlags->begin(); it != ebSrFlags->end(); it++) {
184  const EcalSrFlag& srflag = *it;
185  int flag = srflag.value();
186 
187  EcalTrigTowerDetId id = srflag.id();
188  int Dccid = TheMapping->DCCid(id);
189  int DCC_Channel = TheMapping->iTT(id);
190  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
191  // if (Dccid == 10) cout << "Dcc " << Dccid << " DCC_Channel " << DCC_Channel << " flag " << flag << endl;
192  if (config_.debug_)
193  cout << "will process SRblockformatter_ for FEDid " << dec << FEDid << endl;
194  FEDRawData& rawdata = productRawData.FEDData(FEDid);
195  if (config_.debug_)
196  Headerblockformatter.print(rawdata);
197  SRblockformatter.DigiToRaw(Dccid, DCC_Channel, flag, rawdata);
198  }
199  } // end DoBarrel
200 
201  if (config_.doEndCap_) {
202  // iEvent.getByType(eeSrFlags);
203  iEvent.getByToken(labelEESR_, eeSrFlags);
204 
205  for (EESrFlagCollection::const_iterator it = eeSrFlags->begin(); it != eeSrFlags->end(); it++) {
206  const EcalSrFlag& srflag = *it;
207  int flag = srflag.value();
208  EcalScDetId id = srflag.id();
209  pair<int, int> ind = TheMapping->getDCCandSC(id);
210  int Dccid = ind.first;
211  int DCC_Channel = ind.second;
212 
213  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
214  FEDRawData& rawdata = productRawData.FEDData(FEDid);
215  SRblockformatter.DigiToRaw(Dccid, DCC_Channel, flag, rawdata);
216  }
217  } // end doEndCap
218 
219  } // endif doSR
220 
221  // --------- Now the Tower Block part
222 
223  Handle<EBDigiCollection> ebDigis;
225 
226  if (config_.doTower_) {
227  if (config_.doBarrel_) {
228  if (config_.debug_)
229  cout << "Creation of the TowerBlock ... Barrel case " << endl;
230  iEvent.getByToken(EBDigiToken_, ebDigis);
231  for (EBDigiCollection::const_iterator it = ebDigis->begin(); it != ebDigis->end(); it++) {
232  const EBDataFrame& dataframe = *it;
233  const EBDetId& ebdetid = it->id();
234  int DCCid = TheMapping->DCCid(ebdetid);
235  int FEDid = FEDNumbering::MINECALFEDID + DCCid;
236  FEDRawData& rawdata = productRawData.FEDData(FEDid);
237  Towerblockformatter.DigiToRaw(dataframe, rawdata, TheMapping);
238  }
239  }
240 
241  if (config_.doEndCap_) {
242  if (config_.debug_)
243  cout << "Creation of the TowerBlock ... EndCap case " << endl;
244  iEvent.getByToken(EEDigiToken_, eeDigis);
245  for (EEDigiCollection::const_iterator it = eeDigis->begin(); it != eeDigis->end(); it++) {
246  const EEDataFrame& dataframe = *it;
247  const EEDetId& eedetid = it->id();
248  EcalElectronicsId elid = TheMapping->getElectronicsId(eedetid);
249  int DCCid = elid.dccId();
250  int FEDid = FEDNumbering::MINECALFEDID + DCCid;
251  FEDRawData& rawdata = productRawData.FEDData(FEDid);
252  Towerblockformatter.DigiToRaw(dataframe, rawdata, TheMapping);
253  }
254  }
255 
256  } // endif config_.doTower_
257 
258  // -------- Clean up things ...
259 
260  map<int, map<int, int> >& FEDorder = Towerblockformatter.GetFEDorder();
261 
262  Headerblockformatter.CleanUp(&productRawData, &FEDorder);
263 
264  /*
265  cout << "For FED 633 " << endl;
266  FEDRawData& rawdata = productRawData -> FEDData(633);
267  Headerblockformatter_ -> print(rawdata);
268 */
269 
270  // Headerblockformatter_ -> PrintSizes(productRawData.get());
271 
272  Towerblockformatter.EndEvent(&productRawData);
273 
274  iEvent.emplace(putToken_, std::move(productRawData));
275 
276  return;
277 }
edm::EDGetTokenT< EESrFlagCollection > labelEESR_
int value() const
Definition: EcalSrFlag.h:44
edm::EDGetTokenT< EBDigiCollection > EBDigiToken_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
std::pair< int, int > getDCCandSC(EcalScDetId id) const
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
virtual const DetId & id() const =0
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
const_iterator end() const
edm::EDPutTokenT< FEDRawDataCollection > putToken_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > labelTT_
edm::EDGetTokenT< EEDigiCollection > EEDigiToken_
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const_iterator end() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static std::atomic< unsigned int > counter
edm::EDGetTokenT< EBSrFlagCollection > labelEBSR_
const BlockFormatter::Config config_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const

Member Data Documentation

const int EcalDigiToRaw::BXMAX = 2808
static

Definition at line 63 of file EcalDigiToRaw.cc.

const BlockFormatter::Config EcalDigiToRaw::config_
private

Definition at line 77 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

edm::EDGetTokenT<EBDigiCollection> EcalDigiToRaw::EBDigiToken_
private

Definition at line 71 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

edm::EDGetTokenT<EEDigiCollection> EcalDigiToRaw::EEDigiToken_
private

Definition at line 72 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

edm::EDGetTokenT<EBSrFlagCollection> EcalDigiToRaw::labelEBSR_
private

Definition at line 69 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

edm::EDGetTokenT<EESrFlagCollection> EcalDigiToRaw::labelEESR_
private

Definition at line 70 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

edm::EDGetTokenT<EcalTrigPrimDigiCollection> EcalDigiToRaw::labelTT_
private

Definition at line 68 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

const std::vector<int32_t> EcalDigiToRaw::listDCCId_
private

Definition at line 75 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw().

edm::EDPutTokenT<FEDRawDataCollection> EcalDigiToRaw::putToken_
private

Definition at line 73 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().