CMS 3D CMS Logo

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 ()
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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)
 
- 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 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

Definition at line 25 of file EcalDCCUnpackingModule.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 42 of file EcalDCCUnpackingModule.cc.

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

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

Destructor.

Definition at line 79 of file EcalDCCUnpackingModule.cc.

References formatter_.

79  {
80 
81  delete formatter_;
82 
83 }
EcalTBDaqFormatter * formatter_

Member Function Documentation

void EcalDCCTBUnpackingModule::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 85 of file EcalDCCUnpackingModule.cc.

85  {
86 
87 }
void EcalDCCTBUnpackingModule::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 89 of file EcalDCCUnpackingModule.cc.

89  {
90 
91 }
void EcalDCCTBUnpackingModule::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Produce digis out of raw data.

Definition at line 93 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, FEDRawDataCollection::FEDData(), fedRawDataCollectionTag_, formatter_, edm::Event::getByLabel(), triggerObjects_cff::id, EcalSupervisorTBDataFormatter::interpretRawData(), TableDataFormatter::interpretRawData(), MatacqTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), LogDebug, MATACQ_FED_ID, matacqFormatter_, FEDNumbering::MAXFEDID, eostools::move(), edm::Event::put(), matplotRender::rawdata, FEDRawData::size(), TABLE_FED_ID, tableFormatter_, TBCAMAC_FED_ID, ECALTBParserBlockException::what(), ECALTBParserException::what(), and cms::Exception::what().

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

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

Member Data Documentation

CamacTBDataFormatter* EcalDCCTBUnpackingModule::camacTBformatter_
private

Definition at line 46 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

EcalSupervisorTBDataFormatter* EcalDCCTBUnpackingModule::ecalSupervisorFormatter_
private

Definition at line 45 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

edm::InputTag EcalDCCTBUnpackingModule::fedRawDataCollectionTag_
private

Definition at line 49 of file EcalDCCUnpackingModule.h.

Referenced by produce().

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

Definition at line 48 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

TableDataFormatter* EcalDCCTBUnpackingModule::tableFormatter_
private

Definition at line 47 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().