CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

SiStripClusterToDigiProducer Class Reference

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

List of all members.

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 SiStripClusterToDigiProducer (const edm::ParameterSet &conf)

Private Types

typedef edmNew::DetSetVector
< SiStripCluster
ClusterCollection
typedef edmNew::DetSet
< SiStripCluster >
::const_iterator 
DetClusIter
typedef edmNew::DetSet
< SiStripCluster
DetClusterCollection
typedef edm::DetSet< SiStripDigiDetDigiCollection
typedef edm::DetSet
< SiStripDigi >
::const_iterator 
DetDigiIter
typedef edm::DetSetVector
< SiStripDigi
DigiCollection

Private Member Functions

uint16_t applyGain (const uint16_t &strip, const uint16_t &adc)
float gain (const uint16_t &strip) const
void initialize (const edm::EventSetup &es)
void process (const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
void setDetId (const uint32_t id)

Private Attributes

const edm::InputTag _inputTag
uint32_t detId
uint32_t gain_cache_id
edm::ESHandle< SiStripGaingainHandle
SiStripApvGain::Range gainRange

Detailed Description

Definition at line 19 of file SiStripClusterToDigiProducer.cc.


Member Typedef Documentation

Definition at line 21 of file SiStripClusterToDigiProducer.cc.

Definition at line 23 of file SiStripClusterToDigiProducer.cc.

Definition at line 22 of file SiStripClusterToDigiProducer.cc.

Definition at line 27 of file SiStripClusterToDigiProducer.cc.

Definition at line 28 of file SiStripClusterToDigiProducer.cc.

Definition at line 26 of file SiStripClusterToDigiProducer.cc.


Constructor & Destructor Documentation

SiStripClusterToDigiProducer::SiStripClusterToDigiProducer ( const edm::ParameterSet conf) [explicit]

Definition at line 53 of file SiStripClusterToDigiProducer.cc.

  : _inputTag( conf.getParameter<edm::InputTag>("ClusterProducer") ){
  
  produces< DigiCollection > ("ZeroSuppressed");
  produces< DigiCollection > ("VirginRaw"     );
  produces< DigiCollection > ("ProcessedRaw"  );
  produces< DigiCollection > ("ScopeMode"     );
  
}

Member Function Documentation

uint16_t SiStripClusterToDigiProducer::applyGain ( const uint16_t &  strip,
const uint16_t &  adc 
) [inline, private]

Definition at line 134 of file SiStripClusterToDigiProducer.cc.

References ecalMGPA::adc(), DeDxDiscriminatorTools::charge(), Exception, and gain().

Referenced by process().

                                                      {

  if(adc > 255) throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
  if(adc > 253) return adc; //saturated, do not scale
  uint16_t charge = static_cast<uint16_t>( adc*gain(strip) + 0.5 ); //NB: here we revert the gain applied at the clusterizer level. for this reason the adc counts are multiplied by gain and not divided
  return ( charge > 1022 ? 255 : 
          ( charge >  253 ? 254 : charge ));
}
float SiStripClusterToDigiProducer::gain ( const uint16_t &  strip) const [inline, private]

Definition at line 41 of file SiStripClusterToDigiProducer.cc.

References gainHandle, and gainRange.

Referenced by applyGain().

{ return gainHandle->getStripGain( strip, gainRange ); }
void SiStripClusterToDigiProducer::initialize ( const edm::EventSetup es) [private]

Definition at line 115 of file SiStripClusterToDigiProducer.cc.

References gain_cache_id, gainHandle, and edm::EventSetup::get().

Referenced by produce().

                                    {
  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();

  if(g_cache_id != gain_cache_id) {
    es.get<SiStripGainRcd>().get( gainHandle );
    gain_cache_id = g_cache_id;
  }
}
void SiStripClusterToDigiProducer::process ( const ClusterCollection input,
std::vector< DetDigiCollection > &  output_base 
) [private]

Definition at line 88 of file SiStripClusterToDigiProducer.cc.

References applyGain(), edmNew::DetSetVector< T >::begin(), edm::DetSet< T >::data, cond::rpcobgas::detid, edmNew::DetSetVector< T >::end(), setDetId(), edm::DetSet< T >::size(), and tablePrinter::width.

Referenced by produce().

                                                                                    {
 
  for(ClusterCollection::const_iterator it = input.begin(); it!=input.end(); ++it) {

    uint32_t detid=it->detId();

    setDetId(detid);
    DetDigiCollection detDigis(detid);

    DetClusIter clus(it->begin()), endclus(it->end());
    for(;clus!=endclus;clus++){
      size_t istrip     = 0;
      size_t width      = clus->amplitudes().size();
      size_t firstStrip = clus->firstStrip();
      uint16_t stripPos=firstStrip;
      for(;istrip<width;++istrip){
        detDigis.data.push_back( SiStripDigi( stripPos, applyGain(stripPos,clus->amplitudes()[istrip]) ) );
        stripPos++;
      }
    }
    
    if (detDigis.size()) 
      output_base.push_back(detDigis); 
  }
}
void SiStripClusterToDigiProducer::produce ( edm::Event event,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 64 of file SiStripClusterToDigiProducer.cc.

References _inputTag, initialize(), LaserDQM_cfg::input, edm::HandleBase::isValid(), and process().

                                                   {
  
  initialize(es);
  
  std::vector<DetDigiCollection> output_base; 
  edm::Handle<ClusterCollection> input ;
  event.getByLabel(_inputTag,input);

  if(input.isValid())
    process(*input, output_base);


  std::auto_ptr< DigiCollection > outputZS(new DigiCollection(output_base) );
  std::auto_ptr< DigiCollection > outputVR(new DigiCollection() );
  std::auto_ptr< DigiCollection > outputPR(new DigiCollection() );
  std::auto_ptr< DigiCollection > outputSM(new DigiCollection() );

  event.put( outputZS, "ZeroSuppressed");
  event.put( outputVR, "VirginRaw"     );
  event.put( outputPR, "ProcessedRaw"  );
  event.put( outputSM, "ScopeMode"     );
}
void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id) [inline, private]

Definition at line 127 of file SiStripClusterToDigiProducer.cc.

References detId, gainHandle, and gainRange.

Referenced by process().

                            {
  gainRange =  gainHandle->getRange(id); 
  detId = id;
}

Member Data Documentation

Definition at line 44 of file SiStripClusterToDigiProducer.cc.

Referenced by produce().

Definition at line 47 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

Definition at line 47 of file SiStripClusterToDigiProducer.cc.

Referenced by initialize().

Definition at line 46 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), initialize(), and setDetId().

Definition at line 45 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().