CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::ProductRegistryHelper

Public Member Functions

void beginJob ()
 
 EcalDCCTBUnpackingModule (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob (void)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 Produce digis out of raw data. More...
 
virtual ~EcalDCCTBUnpackingModule ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

CamacTBDataFormattercamacTBformatter_
 
EcalSupervisorTBDataFormatterecalSupervisorFormatter_
 
EcalTBDaqFormatterformatter_
 
MatacqTBDataFormattermatacqFormatter_
 
TableDataFormattertableFormatter_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 26 of file EcalDCCUnpackingModule.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 44 of file EcalDCCUnpackingModule.cc.

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

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

Destructor.

Definition at line 80 of file EcalDCCUnpackingModule.cc.

References formatter_.

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

Member Function Documentation

void EcalDCCTBUnpackingModule::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 86 of file EcalDCCUnpackingModule.cc.

86  {
87 
88 }
void EcalDCCTBUnpackingModule::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 90 of file EcalDCCUnpackingModule.cc.

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

Produce digis out of raw data.

Implements edm::EDProducer.

Definition at line 94 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, formatter_, edm::Event::getByType(), errorMatrix2Lands_multiChannel::id, EcalSupervisorTBDataFormatter::interpretRawData(), TableDataFormatter::interpretRawData(), MatacqTBDataFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), LogDebug, MATACQ_FED_ID, matacqFormatter_, FEDNumbering::MAXFEDID, edm::Event::put(), lumiPlot::rawdata, environment_file_cff::runType, 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().

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

Referenced by EcalDCCTBUnpackingModule(), and produce().

EcalSupervisorTBDataFormatter* EcalDCCTBUnpackingModule::ecalSupervisorFormatter_
private

Definition at line 46 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

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

Definition at line 49 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

TableDataFormatter* EcalDCCTBUnpackingModule::tableFormatter_
private

Definition at line 48 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().