CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalDCCTBUnpackingModule Class Reference

#include <EcalDCCUnpackingModule.h>

Inheritance diagram for EcalDCCTBUnpackingModule:
edm::stream::EDProducer<>

Public Member Functions

 EcalDCCTBUnpackingModule (const edm::ParameterSet &pset)
 Constructor. More...
 
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::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

CamacTBDataFormattercamacTBformatter_
 
EcalSupervisorTBDataFormatterecalSupervisorFormatter_
 
edm::InputTag fedRawDataCollectionTag_
 
EcalTBDaqFormatterformatter_
 
MatacqTBDataFormattermatacqFormatter_
 
TableDataFormattertableFormatter_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 24 of file EcalDCCUnpackingModule.h.

Constructor & Destructor Documentation

◆ EcalDCCTBUnpackingModule()

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_
CamacTBDataFormatter * camacTBformatter_

◆ ~EcalDCCTBUnpackingModule()

EcalDCCTBUnpackingModule::~EcalDCCTBUnpackingModule ( )
override

Destructor.

Definition at line 75 of file EcalDCCUnpackingModule.cc.

References formatter_.

75 { delete formatter_; }
EcalTBDaqFormatter * formatter_

Member Function Documentation

◆ produce()

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

Produce digis out of raw data.

Definition at line 77 of file EcalDCCUnpackingModule.cc.

References EcalDCCHeaderBlock::BEAMH4, BEG_DCC_FED_ID, BEG_DCC_FED_ID_GLOBAL, camacTBformatter_, EcalDCCHeaderBlock::COSMIC, gather_cfg::cout, data, MillePedeFileConverter_cfg::e, ECAL_SUPERVISOR_FED_ID, ecalSupervisorFormatter_, END_DCC_FED_ID, END_DCC_FED_ID_GLOBAL, FEDRawDataCollection::FEDData(), fedRawDataCollectionTag_, formatter_, l1ctLayer2EG_cff::id, TableDataFormatter::interpretRawData(), EcalSupervisorTBDataFormatter::interpretRawData(), MatacqTBDataFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), LogDebug, MATACQ_FED_ID, matacqFormatter_, FEDNumbering::MAXFEDID, eostools::move(), EcalCondDBWriter_cfi::runType, TABLE_FED_ID, tableFormatter_, TBCAMAC_FED_ID, and testProducerWithPsetDescEmpty_cfi::x1.

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

◆ camacTBformatter_

CamacTBDataFormatter* EcalDCCTBUnpackingModule::camacTBformatter_
private

Definition at line 38 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

◆ ecalSupervisorFormatter_

EcalSupervisorTBDataFormatter* EcalDCCTBUnpackingModule::ecalSupervisorFormatter_
private

Definition at line 37 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

◆ fedRawDataCollectionTag_

edm::InputTag EcalDCCTBUnpackingModule::fedRawDataCollectionTag_
private

Definition at line 41 of file EcalDCCUnpackingModule.h.

Referenced by produce().

◆ formatter_

EcalTBDaqFormatter* EcalDCCTBUnpackingModule::formatter_
private

◆ matacqFormatter_

MatacqTBDataFormatter* EcalDCCTBUnpackingModule::matacqFormatter_
private

Definition at line 40 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

◆ tableFormatter_

TableDataFormatter* EcalDCCTBUnpackingModule::tableFormatter_
private

Definition at line 39 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().