CMS 3D CMS Logo

Public Member Functions | Private Attributes

sistrip::SpyDigiConverterModule Class Reference

Inheritance diagram for sistrip::SpyDigiConverterModule:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 SpyDigiConverterModule (const edm::ParameterSet &)
 ~SpyDigiConverterModule ()

Private Attributes

const bool discardDigisWithAPVAddressError_
const uint32_t expectedHeaderBit_
sistrip::SpyUtilities::FrameQuality frameQuality_
const edm::InputTag productLabel_
const bool storeAPVAddress_
 True = store APVE address for each channel.
const bool storeModuleDigis_
const bool storePayloadDigis_
const bool storeReorderedDigis_
SpyUtilities utility_

Detailed Description

Definition at line 36 of file SiStripSpyDigiConverterModule.cc.


Constructor & Destructor Documentation

sistrip::SpyDigiConverterModule::SpyDigiConverterModule ( const edm::ParameterSet pset)

Definition at line 61 of file SiStripSpyDigiConverterModule.cc.

References frameQuality_, edm::ParameterSet::getParameter(), edm::isDebugEnabled(), LogTrace, sistrip::SpyUtilities::FrameQuality::maxDigiRange, sistrip::SpyUtilities::FrameQuality::maxTickHeight, sistrip::SpyUtilities::FrameQuality::maxZeroLight, sistrip::SpyUtilities::FrameQuality::minDigiRange, sistrip::SpyUtilities::FrameQuality::minTickHeight, sistrip::SpyUtilities::FrameQuality::minZeroLight, storeAPVAddress_, storeModuleDigis_, storePayloadDigis_, and storeReorderedDigis_.

                                                                              :
    productLabel_(pset.getParameter<edm::InputTag>("InputProductLabel")),
    storeAPVAddress_(pset.getParameter<bool>("StoreAPVAddress")),
    storePayloadDigis_(pset.getParameter<bool>("StorePayloadDigis")),
    storeReorderedDigis_(pset.getParameter<bool>("StoreReorderedDigis")),
    storeModuleDigis_(pset.getParameter<bool>("StoreModuleDigis")),
    discardDigisWithAPVAddressError_(pset.getParameter<bool>("DiscardDigisWithWrongAPVAddress")),
    expectedHeaderBit_(pset.getParameter<uint32_t>("ExpectedPositionOfFirstHeaderBit"))
  {
    if ( edm::isDebugEnabled() ) {
      LogTrace("SiStripSpyDigiConverter")
        << "[sistrip::SpyDigiConverterModule::" << __func__ << "]"
        << " Constructing object...";
    }
    
    if (storePayloadDigis_)   produces< edm::DetSetVector<SiStripRawDigi> >("Payload");
    if (storeReorderedDigis_) produces< edm::DetSetVector<SiStripRawDigi> >("Reordered");
    if (storeModuleDigis_)    produces< edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
        
    if (storeAPVAddress_) {
      produces< std::vector<uint32_t> >("APVAddress");
      //produces<uint8_t>("APVAddress");
    }


    frameQuality_.minDigiRange = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinDigiRange"));
    frameQuality_.maxDigiRange = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxDigiRange"));
    frameQuality_.minZeroLight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinZeroLight"));
    frameQuality_.maxZeroLight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxZeroLight"));
    frameQuality_.minTickHeight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinTickHeight"));
    frameQuality_.maxTickHeight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxTickHeight"));

    
  } // end of constructor.
sistrip::SpyDigiConverterModule::~SpyDigiConverterModule ( )

Definition at line 97 of file SiStripSpyDigiConverterModule.cc.

References edm::isDebugEnabled(), and LogTrace.

                                                  {
    if ( edm::isDebugEnabled() ) {
      LogTrace("SiStripSpyDigiConverter")
        << "[sistrip::SpyDigiConverterModule::" << __func__ << "]"
        << " Destructing object...";
    }
  } // end of destructor.

Member Function Documentation

void sistrip::SpyDigiConverterModule::produce ( edm::Event event,
const edm::EventSetup setup 
) [override, virtual]

Retrieves cabling map from EventSetup and spy channel scope mode digis from Event, creates DetSetVectors of SiStripRawDigis, at verious levels of processing, using the SiStripSpyDigiConverter class and attaches the containers to the Event.

Implements edm::EDProducer.

Definition at line 111 of file SiStripSpyDigiConverterModule.cc.

References discardDigisWithAPVAddressError_, expectedHeaderBit_, sistrip::SpyDigiConverter::extractPayloadDigis(), frameQuality_, sistrip::SpyUtilities::getCabling(), sistrip::SpyUtilities::getMajorityHeader(), sistrip::SpyDigiConverter::mergeModuleChannels(), edm::Handle< T >::product(), productLabel_, sistrip::SpyDigiConverter::reorderDigis(), storeAPVAddress_, storeModuleDigis_, storePayloadDigis_, storeReorderedDigis_, and utility_.

                                                                                    {

    static bool lFirstEvent = true;

    const SiStripFedCabling* lCabling = utility_.getCabling( setup );

    if ( !(storePayloadDigis_ || storeReorderedDigis_ || storeModuleDigis_ || storeAPVAddress_) ) return;
    
    //retrieve the scope mode digis
    edm::Handle<sistrip::SpyDigiConverter::DSVRawDigis> scopeDigisHandle;
    event.getByLabel(productLabel_, scopeDigisHandle);
    
    //32-bit to accomodate known CMSSW container
    std::auto_ptr< std::vector<uint32_t> > pAPVAddresses(new std::vector<uint32_t>);
        
    std::auto_ptr<sistrip::SpyDigiConverter::DSVRawDigis> payloadDigis, reorderedDigis, moduleDigis;
    
    //get the majority value for expected position of first header bit
    //from first event, compare to expected one, else output warning.
    if (lFirstEvent){
      uint16_t lFirstHeaderBit;
      sistrip::SpyUtilities::getMajorityHeader(scopeDigisHandle.product(),lFirstHeaderBit);

      if (lFirstHeaderBit != static_cast<uint16_t>(expectedHeaderBit_)) {
        edm::LogWarning("") << " -- Majority position for firstHeaderBit in first event ("
                            << lFirstHeaderBit
                            << ") is not where expected: "
                            << static_cast<uint16_t>(expectedHeaderBit_)
                            << std::endl;
      }

    }



    //extract frame digis and APV addresses
    payloadDigis = sistrip::SpyDigiConverter::extractPayloadDigis(scopeDigisHandle.product(), 
                                                                  pAPVAddresses.get(),
                                                                  discardDigisWithAPVAddressError_,
                                                                  frameQuality_, 
                                                                  static_cast<uint16_t>(expectedHeaderBit_));
        
    // Reorder
    if (storeReorderedDigis_ || storeModuleDigis_) {
      reorderedDigis = sistrip::SpyDigiConverter::reorderDigis(payloadDigis.get());
    }
    
    // Merge into modules
    if (storeModuleDigis_) {
      moduleDigis = sistrip::SpyDigiConverter::mergeModuleChannels(reorderedDigis.get(), *lCabling);
    }
    
    //add to event
    if (storePayloadDigis_) event.put(payloadDigis,"Payload");
    if (storeReorderedDigis_) event.put(reorderedDigis,"Reordered");
    if (storeModuleDigis_) event.put(moduleDigis,"VirginRaw");
    if (storeAPVAddress_) {
      event.put(pAPVAddresses, "APVAddress");
    }
        

    lFirstEvent = false;

  } // end of SpyDigiConverter::produce method.

Member Data Documentation

Definition at line 48 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

Definition at line 49 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

Definition at line 47 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

Definition at line 44 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

True = store APVE address for each channel.

Definition at line 45 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

Definition at line 46 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

Definition at line 46 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

Definition at line 46 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

Definition at line 52 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().