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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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::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 57 of file EcalDigiToRaw.cc.

Member Typedef Documentation

typedef unsigned int EcalDigiToRaw::Word32

Definition at line 64 of file EcalDigiToRaw.cc.

typedef long long EcalDigiToRaw::Word64

Definition at line 63 of file EcalDigiToRaw.cc.

Constructor & Destructor Documentation

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

Definition at line 91 of file EcalDigiToRaw.cc.

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

91  :
92  listDCCId_{iConfig.getUntrackedParameter< std::vector<int32_t> >("listDCCId")},
93  config_{
94  &listDCCId_,
95  iConfig.getUntrackedParameter<bool>("debug"),
96  iConfig.getUntrackedParameter<bool>("DoBarrel"),
97  iConfig.getUntrackedParameter<bool>("DoEndCap"),
98  iConfig.getUntrackedParameter<bool>("WriteTCCBlock"),
99  iConfig.getUntrackedParameter<bool>("WriteSRFlags"),
100  iConfig.getUntrackedParameter<bool>("WriteTowerBlock") }
101 {
102  auto label= iConfig.getParameter<string>("Label");
103  auto instanceNameEB = iConfig.getParameter<string>("InstanceEB");
104  auto instanceNameEE = iConfig.getParameter<string>("InstanceEE");
105 
106  edm::InputTag EBlabel = edm::InputTag(label,instanceNameEB);
107  edm::InputTag EElabel = edm::InputTag(label,instanceNameEE);
108 
109  EBDigiToken_ = consumes<EBDigiCollection>(EBlabel);
110  EEDigiToken_ = consumes<EEDigiCollection>(EElabel);
111 
112  labelTT_ = consumes<EcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("labelTT"));
113 
114  labelEBSR_ = consumes<EBSrFlagCollection>(iConfig.getParameter<edm::InputTag>("labelEBSRFlags"));
115  labelEESR_ = consumes<EESrFlagCollection>(iConfig.getParameter<edm::InputTag>("labelEESRFlags"));
116 
117  putToken_ = produces<FEDRawDataCollection>();
118 }
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 127 of file EcalDigiToRaw.cc.

References begin, edm::EventBase::bunchCrossing(), BlockFormatter::Params::bx_, BlockFormatter::CleanUp(), config_, counter, BlockFormatter::Params::counter_, gather_cfg::cout, EcalElectronicsId::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, EEDigiToken_, edm::Event::emplace(), end, edm::DataFrameContainer::end(), TowerBlockFormatter::EndEvent(), edm::EventID::event(), FEDRawDataCollection::FEDData(), RemoveAddSevLevel::flag, edm::EventSetup::get(), edm::Event::getByToken(), TowerBlockFormatter::GetFEDorder(), triggerObjects_cff::id, EcalSrFlag::id(), edm::EventBase::id(), labelEBSR_, labelEESR_, labelTT_, BlockFormatter::Params::lv1_, FEDNumbering::MINECALFEDID, eostools::move(), BlockFormatter::Params::orbit_number_, edm::EventBase::orbitNumber(), BlockFormatter::print(), edm::ESHandle< T >::product(), putToken_, matplotRender::rawdata, edm::EventID::run(), BlockFormatter::Params::runnumber_, EcalTrigTowerDetId::subDet(), and EcalSrFlag::value().

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

128 {
129 
130  if (config_.debug_) cout << "Enter in EcalDigiToRaw::produce ... " << endl;
131 
133  iSetup.get< EcalMappingRcd >().get(ecalmapping);
134  const EcalElectronicsMapping* TheMapping = ecalmapping.product();
135 
136  FEDRawDataCollection productRawData;
137 
138  BlockFormatter::Params params;
139  int counter = iEvent.id().event();
140  params.counter_ = counter;
141  params.orbit_number_ = iEvent.orbitNumber();
142  params.bx_ = iEvent.bunchCrossing();
143  params.lv1_ = counter % (0x1<<24);
144  params.runnumber_ = iEvent.id().run();
145 
146  BlockFormatter Headerblockformatter(config_,params);
147  TCCBlockFormatter TCCblockformatter(config_,params);
148  TowerBlockFormatter Towerblockformatter(config_,params);
149  SRBlockFormatter SRblockformatter(config_,params);
150 
151 
152  Headerblockformatter.DigiToRaw(&productRawData);
153 
154 
155 // --------- Now the Trigger Block part
156 
158 
159  Handle<EBSrFlagCollection> ebSrFlags;
160  Handle<EESrFlagCollection> eeSrFlags;
161 
162 
163  if (config_.doTCC_) {
164 
165  if (config_.debug_) cout << "Creation of the TCC block " << endl;
166  // iEvent.getByType(ecalTrigPrim);
167  iEvent.getByToken(labelTT_, ecalTrigPrim);
168 
169  // loop on TP's and add one by one to the block
170  for (EcalTrigPrimDigiCollection::const_iterator it = ecalTrigPrim -> begin();
171  it != ecalTrigPrim -> end(); it++) {
172 
173  const EcalTriggerPrimitiveDigi& trigprim = *it;
174  const EcalTrigTowerDetId& detid = it -> id();
175 
176  if ( (detid.subDet() == EcalBarrel) && (! config_.doBarrel_) ) continue;
177  if ( (detid.subDet() == EcalEndcap) && (! config_.doEndCap_) ) continue;
178 
179  int iDCC = TheMapping -> DCCid(detid);
180  int FEDid = FEDNumbering::MINECALFEDID + iDCC;
181 
182  FEDRawData& rawdata = productRawData.FEDData(FEDid);
183 
184  // adding the primitive to the block
185  TCCblockformatter.DigiToRaw(trigprim, rawdata, TheMapping);
186 
187  } // end loop on ecalTrigPrim
188 
189  } // endif doTCC
190 
191 
192  if (config_.doSR_) {
193  if (config_.debug_) cout << " Process the SR flags " << endl;
194 
195  if (config_.doBarrel_) {
196 
197  // iEvent.getByType(ebSrFlags);
198  iEvent.getByToken(labelEBSR_, ebSrFlags);
199 
200  for (EBSrFlagCollection::const_iterator it = ebSrFlags -> begin();
201  it != ebSrFlags -> end(); it++) {
202  const EcalSrFlag& srflag = *it;
203  int flag = srflag.value();
204 
205  EcalTrigTowerDetId id = srflag.id();
206  int Dccid = TheMapping -> DCCid(id);
207  int DCC_Channel = TheMapping -> iTT(id);
208  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
209  // if (Dccid == 10) cout << "Dcc " << Dccid << " DCC_Channel " << DCC_Channel << " flag " << flag << endl;
210  if (config_.debug_) cout << "will process SRblockformatter_ for FEDid " << dec << FEDid << endl;
211  FEDRawData& rawdata = productRawData.FEDData(FEDid);
212  if (config_.debug_) Headerblockformatter.print(rawdata);
213  SRblockformatter.DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
214 
215  }
216  } // end DoBarrel
217 
218 
219  if (config_.doEndCap_) {
220  // iEvent.getByType(eeSrFlags);
221  iEvent.getByToken(labelEESR_, eeSrFlags);
222 
223  for (EESrFlagCollection::const_iterator it = eeSrFlags -> begin();
224  it != eeSrFlags -> end(); it++) {
225  const EcalSrFlag& srflag = *it;
226  int flag = srflag.value();
227  EcalScDetId id = srflag.id();
228  pair<int, int> ind = TheMapping -> getDCCandSC(id);
229  int Dccid = ind.first;
230  int DCC_Channel = ind.second;
231 
232  int FEDid = FEDNumbering::MINECALFEDID + Dccid;
233  FEDRawData& rawdata = productRawData.FEDData(FEDid);
234  SRblockformatter.DigiToRaw(Dccid,DCC_Channel,flag, rawdata);
235  }
236  } // end doEndCap
237 
238  } // endif doSR
239 
240 
241 // --------- Now the Tower Block part
242 
243  Handle<EBDigiCollection> ebDigis;
244  Handle<EEDigiCollection> eeDigis;
245 
246  if (config_.doTower_) {
247 
248  if (config_.doBarrel_) {
249  if (config_.debug_) cout << "Creation of the TowerBlock ... Barrel case " << endl;
250  iEvent.getByToken(EBDigiToken_,ebDigis);
251  for (EBDigiCollection::const_iterator it=ebDigis -> begin();
252  it != ebDigis->end(); it++) {
253  const EBDataFrame& dataframe = *it;
254  const EBDetId& ebdetid = it -> id();
255  int DCCid = TheMapping -> DCCid(ebdetid);
256  int FEDid = FEDNumbering::MINECALFEDID + DCCid ;
257  FEDRawData& rawdata = productRawData.FEDData(FEDid);
258  Towerblockformatter.DigiToRaw(dataframe, rawdata, TheMapping);
259  }
260 
261  }
262 
263  if (config_.doEndCap_) {
264  if (config_.debug_) cout << "Creation of the TowerBlock ... EndCap case " << endl;
265  iEvent.getByToken(EEDigiToken_,eeDigis);
266  for (EEDigiCollection::const_iterator it=eeDigis -> begin();
267  it != eeDigis->end(); it++) {
268  const EEDataFrame& dataframe = *it;
269  const EEDetId& eedetid = it -> id();
270  EcalElectronicsId elid = TheMapping -> getElectronicsId(eedetid);
271  int DCCid = elid.dccId() ;
272  int FEDid = FEDNumbering::MINECALFEDID + DCCid;
273  FEDRawData& rawdata = productRawData.FEDData(FEDid);
274  Towerblockformatter.DigiToRaw(dataframe, rawdata, TheMapping);
275  }
276  }
277 
278  } // endif config_.doTower_
279 
280 
281 
282 // -------- Clean up things ...
283 
284  map<int, map<int,int> >& FEDorder = Towerblockformatter.GetFEDorder();
285 
286  Headerblockformatter.CleanUp(&productRawData, &FEDorder);
287 
288 
289 /*
290  cout << "For FED 633 " << endl;
291  FEDRawData& rawdata = productRawData -> FEDData(633);
292  Headerblockformatter_ -> print(rawdata);
293 */
294 
295  // Headerblockformatter_ -> PrintSizes(productRawData.get());
296 
297 
298 
299  Towerblockformatter.EndEvent(&productRawData);
300 
301  iEvent.emplace(putToken_, std::move(productRawData));
302 
303 
304  return;
305 
306 }
edm::EDGetTokenT< EESrFlagCollection > labelEESR_
int value() const
Definition: EcalSrFlag.h:44
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
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
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
virtual const DetId & id() const =0
#define end
Definition: vmac.h:39
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
edm::EDPutTokenT< FEDRawDataCollection > putToken_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > labelTT_
edm::EDGetTokenT< EEDigiCollection > EEDigiToken_
const_iterator end() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
#define begin
Definition: vmac.h:32
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

Member Data Documentation

const int EcalDigiToRaw::BXMAX = 2808
static

Definition at line 66 of file EcalDigiToRaw.cc.

const BlockFormatter::Config EcalDigiToRaw::config_
private

Definition at line 84 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 77 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 78 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 75 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 76 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 74 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().

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

Definition at line 81 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw().

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

Definition at line 79 of file EcalDigiToRaw.cc.

Referenced by EcalDigiToRaw(), and produce().