CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalDCCTBUnpackingModule Class Reference

#include <EcalDCCUnpackingModule.h>

Inheritance diagram for EcalDCCTBUnpackingModule:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginJob ()
 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_.

                                                                             {

  formatter_ = new EcalTBDaqFormatter();
  ecalSupervisorFormatter_ = new EcalSupervisorTBDataFormatter();
  camacTBformatter_ = new CamacTBDataFormatter();
  tableFormatter_ = new TableDataFormatter();
  matacqFormatter_ = new MatacqTBDataFormatter();

  // digis
  produces<EBDigiCollection>("ebDigis");
  produces<EcalMatacqDigiCollection>();
  produces<EcalPnDiodeDigiCollection>();
  produces<EcalRawDataCollection>();
  produces<EcalTrigPrimDigiCollection>("EBTT");

  //TB specifics data
  produces<EcalTBHodoscopeRawInfo>();
  produces<EcalTBTDCRawInfo>();
  produces<EcalTBEventHeader>();

  // crystals' integrity
  produces<EBDetIdCollection>("EcalIntegrityDCCSizeErrors");
  produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
  produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
  produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
  produces<EBDetIdCollection>("EcalIntegrityGainErrors");
  produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");

  // mem channels' integrity
  produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
  produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSize");
  produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
  produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
}
EcalDCCTBUnpackingModule::~EcalDCCTBUnpackingModule ( ) [virtual]

Destructor.

Definition at line 80 of file EcalDCCUnpackingModule.cc.

References formatter_.

                                                   {

  delete formatter_;

}

Member Function Documentation

void EcalDCCTBUnpackingModule::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 86 of file EcalDCCUnpackingModule.cc.

                                       {

}
void EcalDCCTBUnpackingModule::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 90 of file EcalDCCUnpackingModule.cc.

                                     {

}
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, AlCaHLTBitMon_QueryRunRegistry::data, ECAL_SUPERVISOR_FED_ID, ecalSupervisorFormatter_, END_DCC_FED_ID, END_DCC_FED_ID_GLOBAL, formatter_, edm::Event::getByType(), MatacqTBDataFormatter::interpretRawData(), TableDataFormatter::interpretRawData(), EcalSupervisorTBDataFormatter::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, cms::Exception::what(), ECALTBParserException::what(), and ECALTBParserBlockException::what().

                                                                          {

  edm::Handle<FEDRawDataCollection> rawdata;
  e.getByType(rawdata);
  

  // create the collection of Ecal Digis
  std::auto_ptr<EBDigiCollection> productEb(new EBDigiCollection);

  // create the collection of Matacq Digi
  std::auto_ptr<EcalMatacqDigiCollection> productMatacq(new EcalMatacqDigiCollection());

  // create the collection of Ecal PN's
  std::auto_ptr<EcalPnDiodeDigiCollection> productPN(new EcalPnDiodeDigiCollection);
  
  //create the collection of Ecal DCC Header
  std::auto_ptr<EcalRawDataCollection> productDCCHeader(new EcalRawDataCollection);

  // create the collection with trigger primitives, bits and flags
  std::auto_ptr<EcalTrigPrimDigiCollection> productTriggerPrimitives(new EcalTrigPrimDigiCollection);

  // create the collection of Ecal Integrity DCC Size
  std::auto_ptr<EBDetIdCollection> productDCCSize(new EBDetIdCollection);

  // create the collection of Ecal Integrity TT Id
  std::auto_ptr<EcalElectronicsIdCollection> productTTId(new EcalElectronicsIdCollection);

  // create the collection of Ecal Integrity TT Block Size
  std::auto_ptr<EcalElectronicsIdCollection> productBlockSize(new EcalElectronicsIdCollection);

  // create the collection of Ecal Integrity Ch Id
  std::auto_ptr<EBDetIdCollection> productChId(new EBDetIdCollection);

  // create the collection of Ecal Integrity Gain
  std::auto_ptr<EBDetIdCollection> productGain(new EBDetIdCollection);

  // create the collection of Ecal Integrity Gain Switch
  std::auto_ptr<EBDetIdCollection> productGainSwitch(new EBDetIdCollection);

  // create the collection of Ecal Integrity Mem towerBlock_id errors
  std::auto_ptr<EcalElectronicsIdCollection> productMemTtId(new EcalElectronicsIdCollection);
  
  // create the collection of Ecal Integrity Mem gain errors
  std::auto_ptr< EcalElectronicsIdCollection> productMemBlockSize(new EcalElectronicsIdCollection);

  // create the collection of Ecal Integrity Mem gain errors
  std::auto_ptr< EcalElectronicsIdCollection> productMemGain(new EcalElectronicsIdCollection);
  
  // create the collection of Ecal Integrity Mem ch_id errors
  std::auto_ptr<EcalElectronicsIdCollection> productMemChIdErrors(new EcalElectronicsIdCollection);
  
  // create the collection of TB specifics data
  std::auto_ptr<EcalTBHodoscopeRawInfo> productHodo(new EcalTBHodoscopeRawInfo());         
  std::auto_ptr<EcalTBTDCRawInfo> productTdc(new EcalTBTDCRawInfo());                      
  std::auto_ptr<EcalTBEventHeader> productHeader(new EcalTBEventHeader());                      


  try {

  for (int id= 0; id<=FEDNumbering::MAXFEDID; ++id){ 

    //    edm::LogInfo("EcalDCCTBUnpackingModule") << "EcalDCCTBUnpackingModule::Got FED ID "<< id <<" ";
    const FEDRawData& data = rawdata->FEDData(id);
    //    edm::LogInfo("EcalDCCTBUnpackingModule") << " Fed data size " << data.size() ;
   
    //std::cout <<"1 Fed id: "<<dec<<id<< " Fed data size: " <<data.size() << std::endl;
//    const unsigned char * pData = data.data();
//    int length = data.size();
//    if(length >0 ){
//      if(length >= 40){length = 40;}
//    std::cout<<"##############################################################"<<std::endl;
//    for( int i=0; i<length; i++ ) {
//      std::cout << std::hex << std::setw(8) << int(pData[i]) << " ";
//      if( (i+1)%8 == 0 ) std::cout << std::endl;
//     }
//    std::cout<<"##############################################################"<<std::endl;
//    } 
    if (data.size()>16){

      if ( (id >= BEG_DCC_FED_ID && id <= END_DCC_FED_ID) ||
           (id >= BEG_DCC_FED_ID_GLOBAL && id <= END_DCC_FED_ID_GLOBAL)
         )
        {       // do the DCC data unpacking and fill the collections
          
          (*productHeader).setSmInBeam(id);
          formatter_->interpretRawData(data,  *productEb, *productPN, 
                                       *productDCCHeader, 
                                       *productDCCSize, 
                                       *productTTId, *productBlockSize, 
                                       *productChId, *productGain, *productGainSwitch, 
                                       *productMemTtId,  *productMemBlockSize,
                                       *productMemGain,  *productMemChIdErrors,
                                       *productTriggerPrimitives);
          int runType = (*productDCCHeader)[0].getRunType();
          if ( runType == EcalDCCHeaderBlock::COSMIC || runType == EcalDCCHeaderBlock::BEAMH4 ) 
            (*productHeader).setTriggerMask(0x1);
          else if ( runType == 4 || runType == 5 || runType == 6 ) //laser runs
            (*productHeader).setTriggerMask(0x2000);
          else if ( runType == 9 || runType == 10 || runType == 11 ) //pedestal runs
            (*productHeader).setTriggerMask(0x800);
          LogDebug("EcalDCCTBUnpackingModule") << "Event type is " << (*productHeader).eventType() << " dbEventType " << (*productHeader).dbEventType();
        } 
      else if ( id == ECAL_SUPERVISOR_FED_ID )
        ecalSupervisorFormatter_->interpretRawData(data, *productHeader);
      else if ( id == TBCAMAC_FED_ID )
        camacTBformatter_->interpretRawData(data, *productHeader,*productHodo, *productTdc );
      else if ( id == TABLE_FED_ID )
        tableFormatter_->interpretRawData(data, *productHeader);
      else if ( id == MATACQ_FED_ID )     
        matacqFormatter_->interpretRawData(data, *productMatacq);
    }// endif 
  }//endfor
  

  // commit to the event  
  e.put(productPN);
  e.put(productEb,"ebDigis");
  e.put(productMatacq);
  e.put(productDCCHeader);
  e.put(productTriggerPrimitives,"EBTT");

  e.put(productDCCSize,"EcalIntegrityDCCSizeErrors");
  e.put(productTTId,"EcalIntegrityTTIdErrors");
  e.put(productBlockSize,"EcalIntegrityBlockSizeErrors");
  e.put(productChId,"EcalIntegrityChIdErrors");
  e.put(productGain,"EcalIntegrityGainErrors");
  e.put(productGainSwitch,"EcalIntegrityGainSwitchErrors");

  e.put(productMemTtId,"EcalIntegrityMemTtIdErrors");
  e.put(productMemBlockSize,"EcalIntegrityMemBlockSize");
  e.put(productMemChIdErrors,"EcalIntegrityMemChIdErrors");
  e.put(productMemGain,"EcalIntegrityMemGainErrors");

  e.put(productHodo);
  e.put(productTdc);
  e.put(productHeader);

  } catch (ECALTBParserException &e) {
    std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
  } catch (ECALTBParserBlockException &e) {
    std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
  } catch (cms::Exception &e) {
    std::cout << "[EcalDCCTBUnpackingModule] " << e.what() << std::endl;
  } catch (...) {
    std::cout << "[EcalDCCTBUnpackingModule] Unknown exception ..." << std::endl;
  }

}

Member Data Documentation

Definition at line 47 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

Definition at line 46 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

Definition at line 49 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().

Definition at line 48 of file EcalDCCUnpackingModule.h.

Referenced by EcalDCCTBUnpackingModule(), and produce().