CMS 3D CMS Logo

EcalDCCTBUnpackingModule Class Reference

#include <EventFilter/EcalTBRawToDigi/interface/EcalDCCUnpackingModule.h>

Inheritance diagram for EcalDCCTBUnpackingModule:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginJob (const edm::EventSetup &c)
 EcalDCCTBUnpackingModule (const edm::ParameterSet &pset)
 Constructor.
void endJob (void)
void produce (edm::Event &e, const edm::EventSetup &c)
 Produce digis out of raw data.
virtual ~EcalDCCTBUnpackingModule ()
 Destructor.

Private Attributes

CamacTBDataFormattercamacTBformatter_
EcalSupervisorTBDataFormatterecalSupervisorFormatter_
EcalTBDaqFormatterformatter_
MatacqTBDataFormattermatacqFormatter_
TableDataFormattertableFormatter_


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_.

00044                                                                              {
00045 
00046   formatter_ = new EcalTBDaqFormatter();
00047   ecalSupervisorFormatter_ = new EcalSupervisorTBDataFormatter();
00048   camacTBformatter_ = new CamacTBDataFormatter();
00049   tableFormatter_ = new TableDataFormatter();
00050   matacqFormatter_ = new MatacqTBDataFormatter();
00051 
00052   // digis
00053   produces<EBDigiCollection>("ebDigis");
00054   produces<EcalMatacqDigiCollection>();
00055   produces<EcalPnDiodeDigiCollection>();
00056   produces<EcalRawDataCollection>();
00057   produces<EcalTrigPrimDigiCollection>("EBTT");
00058 
00059   //TB specifics data
00060   produces<EcalTBHodoscopeRawInfo>();
00061   produces<EcalTBTDCRawInfo>();
00062   produces<EcalTBEventHeader>();
00063 
00064   // crystals' integrity
00065   produces<EBDetIdCollection>("EcalIntegrityDCCSizeErrors");
00066   produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
00067   produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
00068   produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
00069   produces<EBDetIdCollection>("EcalIntegrityGainErrors");
00070   produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");
00071   produces<EBDetIdCollection>("EcalIntegrityGainSwitchStayErrors");
00072   produces<EBDetIdCollection>("EcalIntegrityGainSwitchStayErrors");
00073 
00074   // mem channels' integrity
00075   produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
00076   produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSize");
00077   produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
00078   produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
00079 }

EcalDCCTBUnpackingModule::~EcalDCCTBUnpackingModule (  )  [virtual]

Destructor.

Definition at line 82 of file EcalDCCUnpackingModule.cc.

References formatter_.

00082                                                    {
00083 
00084   delete formatter_;
00085 
00086 }


Member Function Documentation

void EcalDCCTBUnpackingModule::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 88 of file EcalDCCUnpackingModule.cc.

00088                                                              {
00089 
00090 }

void EcalDCCTBUnpackingModule::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 92 of file EcalDCCUnpackingModule.cc.

00092                                      {
00093 
00094 }

void EcalDCCTBUnpackingModule::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Produce digis out of raw data.

Implements edm::EDProducer.

Definition at line 96 of file EcalDCCUnpackingModule.cc.

References EcalDCCHeaderBlock::BEAMH4, BEG_DCC_FED_ID, BEG_DCC_FED_ID_GLOBAL, camacTBformatter_, EcalDCCHeaderBlock::COSMIC, GenMuonPlsPt100GeV_cfg::cout, data, ECAL_SUPERVISOR_FED_ID, ecalSupervisorFormatter_, END_DCC_FED_ID, END_DCC_FED_ID_GLOBAL, lat::endl(), formatter_, edm::Event::getByType(), id, MatacqTBDataFormatter::interpretRawData(), TableDataFormatter::interpretRawData(), EcalSupervisorTBDataFormatter::interpretRawData(), CamacTBDataFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), FEDNumbering::lastFEDId(), LogDebug, MATACQ_FED_ID, matacqFormatter_, edm::Event::put(), FEDRawData::size(), TABLE_FED_ID, tableFormatter_, TBCAMAC_FED_ID, cms::Exception::what(), ECALTBParserException::what(), and ECALTBParserBlockException::what().

00096                                                                           {
00097 
00098   edm::Handle<FEDRawDataCollection> rawdata;
00099   e.getByType(rawdata);
00100   
00101 
00102   // create the collection of Ecal Digis
00103   std::auto_ptr<EBDigiCollection> productEb(new EBDigiCollection);
00104 
00105   // create the collection of Matacq Digi
00106   std::auto_ptr<EcalMatacqDigiCollection> productMatacq(new EcalMatacqDigiCollection());
00107 
00108   // create the collection of Ecal PN's
00109   std::auto_ptr<EcalPnDiodeDigiCollection> productPN(new EcalPnDiodeDigiCollection);
00110   
00111   //create the collection of Ecal DCC Header
00112   std::auto_ptr<EcalRawDataCollection> productDCCHeader(new EcalRawDataCollection);
00113 
00114   // create the collection with trigger primitives, bits and flags
00115   std::auto_ptr<EcalTrigPrimDigiCollection> productTriggerPrimitives(new EcalTrigPrimDigiCollection);
00116 
00117   // create the collection of Ecal Integrity DCC Size
00118   std::auto_ptr<EBDetIdCollection> productDCCSize(new EBDetIdCollection);
00119 
00120   // create the collection of Ecal Integrity TT Id
00121   std::auto_ptr<EcalElectronicsIdCollection> productTTId(new EcalElectronicsIdCollection);
00122 
00123   // create the collection of Ecal Integrity TT Block Size
00124   std::auto_ptr<EcalElectronicsIdCollection> productBlockSize(new EcalElectronicsIdCollection);
00125 
00126   // create the collection of Ecal Integrity Ch Id
00127   std::auto_ptr<EBDetIdCollection> productChId(new EBDetIdCollection);
00128 
00129   // create the collection of Ecal Integrity Gain
00130   std::auto_ptr<EBDetIdCollection> productGain(new EBDetIdCollection);
00131 
00132   // create the collection of Ecal Integrity Gain Switch
00133   std::auto_ptr<EBDetIdCollection> productGainSwitch(new EBDetIdCollection);
00134 
00135   // create the collection of Ecal Integrity Gain Switch Stay
00136   std::auto_ptr<EBDetIdCollection> productGainSwitchStay(new EBDetIdCollection);
00137 
00138   // create the collection of Ecal Integrity Mem towerBlock_id errors
00139   std::auto_ptr<EcalElectronicsIdCollection> productMemTtId(new EcalElectronicsIdCollection);
00140   
00141   // create the collection of Ecal Integrity Mem gain errors
00142   std::auto_ptr< EcalElectronicsIdCollection> productMemBlockSize(new EcalElectronicsIdCollection);
00143 
00144   // create the collection of Ecal Integrity Mem gain errors
00145   std::auto_ptr< EcalElectronicsIdCollection> productMemGain(new EcalElectronicsIdCollection);
00146   
00147   // create the collection of Ecal Integrity Mem ch_id errors
00148   std::auto_ptr<EcalElectronicsIdCollection> productMemChIdErrors(new EcalElectronicsIdCollection);
00149   
00150   // create the collection of TB specifics data
00151   std::auto_ptr<EcalTBHodoscopeRawInfo> productHodo(new EcalTBHodoscopeRawInfo());         
00152   std::auto_ptr<EcalTBTDCRawInfo> productTdc(new EcalTBTDCRawInfo());                      
00153   std::auto_ptr<EcalTBEventHeader> productHeader(new EcalTBEventHeader());                      
00154 
00155 
00156   try {
00157 
00158   for (int id= 0; id<=FEDNumbering::lastFEDId(); ++id){ 
00159 
00160     //    edm::LogInfo("EcalDCCTBUnpackingModule") << "EcalDCCTBUnpackingModule::Got FED ID "<< id <<" ";
00161     const FEDRawData& data = rawdata->FEDData(id);
00162     //    edm::LogInfo("EcalDCCTBUnpackingModule") << " Fed data size " << data.size() ;
00163    
00164     //std::cout <<"1 Fed id: "<<dec<<id<< " Fed data size: " <<data.size() << std::endl;
00165 //    const unsigned char * pData = data.data();
00166 //    int length = data.size();
00167 //    if(length >0 ){
00168 //      if(length >= 40){length = 40;}
00169 //    std::cout<<"##############################################################"<<std::endl;
00170 //    for( int i=0; i<length; i++ ) {
00171 //      std::cout << std::hex << std::setw(8) << int(pData[i]) << " ";
00172 //      if( (i+1)%8 == 0 ) std::cout << std::endl;
00173 //     }
00174 //    std::cout<<"##############################################################"<<std::endl;
00175 //    } 
00176     if (data.size()>16){
00177 
00178       if ( (id >= BEG_DCC_FED_ID && id <= END_DCC_FED_ID) ||
00179            (id >= BEG_DCC_FED_ID_GLOBAL && id <= END_DCC_FED_ID_GLOBAL)
00180          )
00181         {       // do the DCC data unpacking and fill the collections
00182           
00183           (*productHeader).setSmInBeam(id);
00184           formatter_->interpretRawData(data,  *productEb, *productPN, 
00185                                        *productDCCHeader, 
00186                                        *productDCCSize, 
00187                                        *productTTId, *productBlockSize, 
00188                                        *productChId, *productGain, *productGainSwitch, *productGainSwitchStay, 
00189                                        *productMemTtId,  *productMemBlockSize,
00190                                        *productMemGain,  *productMemChIdErrors,
00191                                        *productTriggerPrimitives);
00192           int runType = (*productDCCHeader)[0].getRunType();
00193           if ( runType == EcalDCCHeaderBlock::COSMIC || runType == EcalDCCHeaderBlock::BEAMH4 ) 
00194             (*productHeader).setTriggerMask(0x1);
00195           else if ( runType == 4 || runType == 5 || runType == 6 ) //laser runs
00196             (*productHeader).setTriggerMask(0x2000);
00197           else if ( runType == 9 || runType == 10 || runType == 11 ) //pedestal runs
00198             (*productHeader).setTriggerMask(0x800);
00199           LogDebug("EcalDCCTBUnpackingModule") << "Event type is " << (*productHeader).eventType() << " dbEventType " << (*productHeader).dbEventType();
00200         } 
00201       else if ( id == ECAL_SUPERVISOR_FED_ID )
00202         ecalSupervisorFormatter_->interpretRawData(data, *productHeader);
00203       else if ( id == TBCAMAC_FED_ID )
00204         camacTBformatter_->interpretRawData(data, *productHeader,*productHodo, *productTdc );
00205       else if ( id == TABLE_FED_ID )
00206         tableFormatter_->interpretRawData(data, *productHeader);
00207       else if ( id == MATACQ_FED_ID )     
00208         matacqFormatter_->interpretRawData(data, *productMatacq);
00209     }// endif 
00210   }//endfor
00211   
00212 
00213   // commit to the event  
00214   e.put(productPN);
00215   e.put(productEb,"ebDigis");
00216   e.put(productMatacq);
00217   e.put(productDCCHeader);
00218   e.put(productTriggerPrimitives,"EBTT");
00219 
00220   e.put(productDCCSize,"EcalIntegrityDCCSizeErrors");
00221   e.put(productTTId,"EcalIntegrityTTIdErrors");
00222   e.put(productBlockSize,"EcalIntegrityBlockSizeErrors");
00223   e.put(productChId,"EcalIntegrityChIdErrors");
00224   e.put(productGain,"EcalIntegrityGainErrors");
00225   e.put(productGainSwitch,"EcalIntegrityGainSwitchErrors");
00226   e.put(productGainSwitchStay,"EcalIntegrityGainSwitchStayErrors");
00227 
00228   e.put(productMemTtId,"EcalIntegrityMemTtIdErrors");
00229   e.put(productMemBlockSize,"EcalIntegrityMemBlockSize");
00230   e.put(productMemChIdErrors,"EcalIntegrityMemChIdErrors");
00231   e.put(productMemGain,"EcalIntegrityMemGainErrors");
00232 
00233   e.put(productHodo);
00234   e.put(productTdc);
00235   e.put(productHeader);
00236 
00237   } catch (ECALTBParserException &e) {
00238     std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
00239   } catch (ECALTBParserBlockException &e) {
00240     std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
00241   } catch (cms::Exception &e) {
00242     std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
00243   } catch (...) {
00244     std::cout << "[EcalDCCTBUnpackingModule] Unknown exception ..." << std::endl;
00245   }
00246 
00247 }


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]

Definition at line 45 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), produce(), and ~EcalDCCTBUnpackingModule().

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:28 2009 for CMSSW by  doxygen 1.5.4