CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
EcalDCCTBUnpackingModule Class Reference

#include <EcalDCCUnpackingModule.h>

Inheritance diagram for EcalDCCTBUnpackingModule:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
 EcalDCCTBUnpackingModule (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob (void) override
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 Produce digis out of raw data. More...
 
 ~EcalDCCTBUnpackingModule () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

CamacTBDataFormattercamacTBformatter_
 
EcalSupervisorTBDataFormatterecalSupervisorFormatter_
 
edm::InputTag fedRawDataCollectionTag_
 
EcalTBDaqFormatterformatter_
 
MatacqTBDataFormattermatacqFormatter_
 
TableDataFormattertableFormatter_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file EcalDCCUnpackingModule.h.

Constructor & Destructor Documentation

EcalDCCTBUnpackingModule::EcalDCCTBUnpackingModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 40 of file EcalDCCUnpackingModule.cc.

References camacTBformatter_, ecalSupervisorFormatter_, formatter_, matacqFormatter_, and tableFormatter_.

41  : fedRawDataCollectionTag_(pset.getParameter<edm::InputTag>("fedRawDataCollectionTag")) {
47 
48  // digis
49  produces<EBDigiCollection>("ebDigis");
50  produces<EcalMatacqDigiCollection>();
51  produces<EcalPnDiodeDigiCollection>();
52  produces<EcalRawDataCollection>();
53  produces<EcalTrigPrimDigiCollection>("EBTT");
54 
55  //TB specifics data
56  produces<EcalTBHodoscopeRawInfo>();
57  produces<EcalTBTDCRawInfo>();
58  produces<EcalTBEventHeader>();
59 
60  // crystals' integrity
61  produces<EBDetIdCollection>("EcalIntegrityDCCSizeErrors");
62  produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
63  produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
64  produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
65  produces<EBDetIdCollection>("EcalIntegrityGainErrors");
66  produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");
67 
68  // mem channels' integrity
69  produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
70  produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSize");
71  produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
72  produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
73 }
MatacqTBDataFormatter * matacqFormatter_
TableDataFormatter * tableFormatter_
EcalSupervisorTBDataFormatter * ecalSupervisorFormatter_
EcalTBDaqFormatter * formatter_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CamacTBDataFormatter * camacTBformatter_
EcalDCCTBUnpackingModule::~EcalDCCTBUnpackingModule ( )
override

Destructor.

Definition at line 75 of file EcalDCCUnpackingModule.cc.

References formatter_.

75 { delete formatter_; }
EcalTBDaqFormatter * formatter_

Member Function Documentation

void EcalDCCTBUnpackingModule::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 77 of file EcalDCCUnpackingModule.cc.

77 {}
void EcalDCCTBUnpackingModule::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 79 of file EcalDCCUnpackingModule.cc.

79 {}
void EcalDCCTBUnpackingModule::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Produce digis out of raw data.

Implements edm::EDProducer.

Definition at line 81 of file EcalDCCUnpackingModule.cc.

References EcalDCCHeaderBlock::BEAMH4, BEG_DCC_FED_ID, BEG_DCC_FED_ID_GLOBAL, camacTBformatter_, EcalDCCHeaderBlock::COSMIC, gather_cfg::cout, data, ECAL_SUPERVISOR_FED_ID, ecalSupervisorFormatter_, END_DCC_FED_ID, END_DCC_FED_ID_GLOBAL, fedRawDataCollectionTag_, formatter_, edm::Event::getByLabel(), gpuClustering::id, TableDataFormatter::interpretRawData(), EcalSupervisorTBDataFormatter::interpretRawData(), MatacqTBDataFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), LogDebug, MATACQ_FED_ID, matacqFormatter_, FEDNumbering::MAXFEDID, eostools::move(), edm::Event::put(), runPedHist::runType, FEDRawData::size(), TABLE_FED_ID, tableFormatter_, TBCAMAC_FED_ID, ECALTBParserException::what(), ECALTBParserBlockException::what(), and cms::Exception::what().

81  {
84 
85  // create the collection of Ecal Digis
86  auto productEb = std::make_unique<EBDigiCollection>();
87 
88  // create the collection of Matacq Digi
89  auto productMatacq = std::make_unique<EcalMatacqDigiCollection>();
90 
91  // create the collection of Ecal PN's
92  auto productPN = std::make_unique<EcalPnDiodeDigiCollection>();
93 
94  //create the collection of Ecal DCC Header
95  auto productDCCHeader = std::make_unique<EcalRawDataCollection>();
96 
97  // create the collection with trigger primitives, bits and flags
98  auto productTriggerPrimitives = std::make_unique<EcalTrigPrimDigiCollection>();
99 
100  // create the collection of Ecal Integrity DCC Size
101  auto productDCCSize = std::make_unique<EBDetIdCollection>();
102 
103  // create the collection of Ecal Integrity TT Id
104  auto productTTId = std::make_unique<EcalElectronicsIdCollection>();
105 
106  // create the collection of Ecal Integrity TT Block Size
107  auto productBlockSize = std::make_unique<EcalElectronicsIdCollection>();
108 
109  // create the collection of Ecal Integrity Ch Id
110  auto productChId = std::make_unique<EBDetIdCollection>();
111 
112  // create the collection of Ecal Integrity Gain
113  auto productGain = std::make_unique<EBDetIdCollection>();
114 
115  // create the collection of Ecal Integrity Gain Switch
116  auto productGainSwitch = std::make_unique<EBDetIdCollection>();
117 
118  // create the collection of Ecal Integrity Mem towerBlock_id errors
119  auto productMemTtId = std::make_unique<EcalElectronicsIdCollection>();
120 
121  // create the collection of Ecal Integrity Mem gain errors
122  auto productMemBlockSize = std::make_unique<EcalElectronicsIdCollection>();
123 
124  // create the collection of Ecal Integrity Mem gain errors
125  auto productMemGain = std::make_unique<EcalElectronicsIdCollection>();
126 
127  // create the collection of Ecal Integrity Mem ch_id errors
128  auto productMemChIdErrors = std::make_unique<EcalElectronicsIdCollection>();
129 
130  // create the collection of TB specifics data
131  auto productHodo = std::make_unique<EcalTBHodoscopeRawInfo>();
132  auto productTdc = std::make_unique<EcalTBTDCRawInfo>();
133  auto productHeader = std::make_unique<EcalTBEventHeader>();
134 
135  try {
136  for (int id = 0; id <= FEDNumbering::MAXFEDID; ++id) {
137  // edm::LogInfo("EcalDCCTBUnpackingModule") << "EcalDCCTBUnpackingModule::Got FED ID "<< id <<" ";
138  const FEDRawData& data = rawdata->FEDData(id);
139  // edm::LogInfo("EcalDCCTBUnpackingModule") << " Fed data size " << data.size() ;
140 
141  //std::cout <<"1 Fed id: "<<dec<<id<< " Fed data size: " <<data.size() << std::endl;
142  // const unsigned char * pData = data.data();
143  // int length = data.size();
144  // if(length >0 ){
145  // if(length >= 40){length = 40;}
146  // std::cout<<"##############################################################"<<std::endl;
147  // for( int i=0; i<length; i++ ) {
148  // std::cout << std::hex << std::setw(8) << int(pData[i]) << " ";
149  // if( (i+1)%8 == 0 ) std::cout << std::endl;
150  // }
151  // std::cout<<"##############################################################"<<std::endl;
152  // }
153  if (data.size() > 16) {
154  if ((id >= BEG_DCC_FED_ID && id <= END_DCC_FED_ID) ||
155  (id >= BEG_DCC_FED_ID_GLOBAL &&
156  id <= END_DCC_FED_ID_GLOBAL)) { // do the DCC data unpacking and fill the collections
157 
158  (*productHeader).setSmInBeam(id);
160  *productEb,
161  *productPN,
162  *productDCCHeader,
163  *productDCCSize,
164  *productTTId,
165  *productBlockSize,
166  *productChId,
167  *productGain,
168  *productGainSwitch,
169  *productMemTtId,
170  *productMemBlockSize,
171  *productMemGain,
172  *productMemChIdErrors,
173  *productTriggerPrimitives);
174  int runType = (*productDCCHeader)[0].getRunType();
175  if (runType == EcalDCCHeaderBlock::COSMIC || runType == EcalDCCHeaderBlock::BEAMH4)
176  (*productHeader).setTriggerMask(0x1);
177  else if (runType == 4 || runType == 5 || runType == 6) //laser runs
178  (*productHeader).setTriggerMask(0x2000);
179  else if (runType == 9 || runType == 10 || runType == 11) //pedestal runs
180  (*productHeader).setTriggerMask(0x800);
181  LogDebug("EcalDCCTBUnpackingModule")
182  << "Event type is " << (*productHeader).eventType() << " dbEventType " << (*productHeader).dbEventType();
183  } else if (id == ECAL_SUPERVISOR_FED_ID)
184  ecalSupervisorFormatter_->interpretRawData(data, *productHeader);
185  else if (id == TBCAMAC_FED_ID)
186  camacTBformatter_->interpretRawData(data, *productHeader, *productHodo, *productTdc);
187  else if (id == TABLE_FED_ID)
188  tableFormatter_->interpretRawData(data, *productHeader);
189  else if (id == MATACQ_FED_ID)
190  matacqFormatter_->interpretRawData(data, *productMatacq);
191  } // endif
192  } //endfor
193 
194  // commit to the event
195  e.put(std::move(productPN));
196  e.put(std::move(productEb), "ebDigis");
197  e.put(std::move(productMatacq));
198  e.put(std::move(productDCCHeader));
199  e.put(std::move(productTriggerPrimitives), "EBTT");
200 
201  e.put(std::move(productDCCSize), "EcalIntegrityDCCSizeErrors");
202  e.put(std::move(productTTId), "EcalIntegrityTTIdErrors");
203  e.put(std::move(productBlockSize), "EcalIntegrityBlockSizeErrors");
204  e.put(std::move(productChId), "EcalIntegrityChIdErrors");
205  e.put(std::move(productGain), "EcalIntegrityGainErrors");
206  e.put(std::move(productGainSwitch), "EcalIntegrityGainSwitchErrors");
207 
208  e.put(std::move(productMemTtId), "EcalIntegrityMemTtIdErrors");
209  e.put(std::move(productMemBlockSize), "EcalIntegrityMemBlockSize");
210  e.put(std::move(productMemChIdErrors), "EcalIntegrityMemChIdErrors");
211  e.put(std::move(productMemGain), "EcalIntegrityMemGainErrors");
212 
213  e.put(std::move(productHodo));
214  e.put(std::move(productTdc));
215  e.put(std::move(productHeader));
216 
217  } catch (ECALTBParserException& e) {
218  std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
219  } catch (ECALTBParserBlockException& e) {
220  std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
221  } catch (cms::Exception& e) {
222  std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
223  } catch (...) {
224  std::cout << "[EcalDCCTBUnpackingModule] Unknown exception ..." << std::endl;
225  }
226 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
uint16_t *__restrict__ id
#define TABLE_FED_ID
void interpretRawData(const FEDRawData &data, EBDigiCollection &digicollection, EcalPnDiodeDigiCollection &pndigicollection, EcalRawDataCollection &DCCheaderCollection, EBDetIdCollection &dccsizecollection, EcalElectronicsIdCollection &ttidcollection, EcalElectronicsIdCollection &blocksizecollection, EBDetIdCollection &chidcollection, EBDetIdCollection &gaincollection, EBDetIdCollection &gainswitchcollection, EcalElectronicsIdCollection &memttidcollection, EcalElectronicsIdCollection &memblocksizecollection, EcalElectronicsIdCollection &memgaincollection, EcalElectronicsIdCollection &memchidcollection, EcalTrigPrimDigiCollection &tpcollection)
tuple runType
Definition: runPedHist.py:37
MatacqTBDataFormatter * matacqFormatter_
#define MATACQ_FED_ID
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
#define END_DCC_FED_ID
void interpretRawData(const FEDRawData &data, EcalMatacqDigiCollection &matacqDigiCollection)
TableDataFormatter * tableFormatter_
def move
Definition: eostools.py:511
char const * what() const noexceptoverride
Definition: Exception.cc:103
EcalSupervisorTBDataFormatter * ecalSupervisorFormatter_
EcalTBDaqFormatter * formatter_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader)
#define BEG_DCC_FED_ID_GLOBAL
CamacTBDataFormatter * camacTBformatter_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const char * what() const
tuple cout
Definition: gather_cfg.py:144
#define ECAL_SUPERVISOR_FED_ID
#define TBCAMAC_FED_ID
#define END_DCC_FED_ID_GLOBAL
#define BEG_DCC_FED_ID
#define LogDebug(id)
void interpretRawData(const FEDRawData &data, EcalTBEventHeader &tbEventHeader, EcalTBHodoscopeRawInfo &hodoRaw, EcalTBTDCRawInfo &tdcRawInfo)

Member Data Documentation

CamacTBDataFormatter* EcalDCCTBUnpackingModule::camacTBformatter_
private

Definition at line 44 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

EcalSupervisorTBDataFormatter* EcalDCCTBUnpackingModule::ecalSupervisorFormatter_
private

Definition at line 43 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

edm::InputTag EcalDCCTBUnpackingModule::fedRawDataCollectionTag_
private

Definition at line 47 of file EcalDCCUnpackingModule.h.

Referenced by produce().

EcalTBDaqFormatter* EcalDCCTBUnpackingModule::formatter_
private
MatacqTBDataFormatter* EcalDCCTBUnpackingModule::matacqFormatter_
private

Definition at line 46 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

TableDataFormatter* EcalDCCTBUnpackingModule::tableFormatter_
private

Definition at line 45 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().