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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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 ( )
virtual

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  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 85 of file EcalDCCUnpackingModule.cc.

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

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 
)
virtual

Produce digis out of raw data.

Implements edm::EDProducer.

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, fedRawDataCollectionTag_, formatter_, edm::Event::getByLabel(), EcalSupervisorTBDataFormatter::interpretRawData(), TableDataFormatter::interpretRawData(), MatacqTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), LogDebug, MATACQ_FED_ID, matacqFormatter_, FEDNumbering::MAXFEDID, edm::Event::put(), lumiPlot::rawdata, fileinputsource_cfi::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().

93  {
94 
97 
98 
99  // create the collection of Ecal Digis
100  std::auto_ptr<EBDigiCollection> productEb(new EBDigiCollection);
101 
102  // create the collection of Matacq Digi
103  std::auto_ptr<EcalMatacqDigiCollection> productMatacq(new EcalMatacqDigiCollection());
104 
105  // create the collection of Ecal PN's
106  std::auto_ptr<EcalPnDiodeDigiCollection> productPN(new EcalPnDiodeDigiCollection);
107 
108  //create the collection of Ecal DCC Header
109  std::auto_ptr<EcalRawDataCollection> productDCCHeader(new EcalRawDataCollection);
110 
111  // create the collection with trigger primitives, bits and flags
112  std::auto_ptr<EcalTrigPrimDigiCollection> productTriggerPrimitives(new EcalTrigPrimDigiCollection);
113 
114  // create the collection of Ecal Integrity DCC Size
115  std::auto_ptr<EBDetIdCollection> productDCCSize(new EBDetIdCollection);
116 
117  // create the collection of Ecal Integrity TT Id
118  std::auto_ptr<EcalElectronicsIdCollection> productTTId(new EcalElectronicsIdCollection);
119 
120  // create the collection of Ecal Integrity TT Block Size
121  std::auto_ptr<EcalElectronicsIdCollection> productBlockSize(new EcalElectronicsIdCollection);
122 
123  // create the collection of Ecal Integrity Ch Id
124  std::auto_ptr<EBDetIdCollection> productChId(new EBDetIdCollection);
125 
126  // create the collection of Ecal Integrity Gain
127  std::auto_ptr<EBDetIdCollection> productGain(new EBDetIdCollection);
128 
129  // create the collection of Ecal Integrity Gain Switch
130  std::auto_ptr<EBDetIdCollection> productGainSwitch(new EBDetIdCollection);
131 
132  // create the collection of Ecal Integrity Mem towerBlock_id errors
133  std::auto_ptr<EcalElectronicsIdCollection> productMemTtId(new EcalElectronicsIdCollection);
134 
135  // create the collection of Ecal Integrity Mem gain errors
136  std::auto_ptr< EcalElectronicsIdCollection> productMemBlockSize(new EcalElectronicsIdCollection);
137 
138  // create the collection of Ecal Integrity Mem gain errors
139  std::auto_ptr< EcalElectronicsIdCollection> productMemGain(new EcalElectronicsIdCollection);
140 
141  // create the collection of Ecal Integrity Mem ch_id errors
142  std::auto_ptr<EcalElectronicsIdCollection> productMemChIdErrors(new EcalElectronicsIdCollection);
143 
144  // create the collection of TB specifics data
145  std::auto_ptr<EcalTBHodoscopeRawInfo> productHodo(new EcalTBHodoscopeRawInfo());
146  std::auto_ptr<EcalTBTDCRawInfo> productTdc(new EcalTBTDCRawInfo());
147  std::auto_ptr<EcalTBEventHeader> productHeader(new 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(productPN);
209  e.put(productEb,"ebDigis");
210  e.put(productMatacq);
211  e.put(productDCCHeader);
212  e.put(productTriggerPrimitives,"EBTT");
213 
214  e.put(productDCCSize,"EcalIntegrityDCCSizeErrors");
215  e.put(productTTId,"EcalIntegrityTTIdErrors");
216  e.put(productBlockSize,"EcalIntegrityBlockSizeErrors");
217  e.put(productChId,"EcalIntegrityChIdErrors");
218  e.put(productGain,"EcalIntegrityGainErrors");
219  e.put(productGainSwitch,"EcalIntegrityGainSwitchErrors");
220 
221  e.put(productMemTtId,"EcalIntegrityMemTtIdErrors");
222  e.put(productMemBlockSize,"EcalIntegrityMemBlockSize");
223  e.put(productMemChIdErrors,"EcalIntegrityMemChIdErrors");
224  e.put(productMemGain,"EcalIntegrityMemGainErrors");
225 
226  e.put(productHodo);
227  e.put(productTdc);
228  e.put(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)
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)
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
void interpretRawData(const FEDRawData &data, EcalMatacqDigiCollection &matacqDigiCollection)
TableDataFormatter * tableFormatter_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
EcalSupervisorTBDataFormatter * ecalSupervisorFormatter_
EcalTBDaqFormatter * formatter_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
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 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().