CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

edm::DataMixingSiStripRawWorker Class Reference

#include <DataMixingSiStripRawWorker.h>

List of all members.

Public Member Functions

void addSiStripPileups (const int bcr, edm::EventPrincipal *, unsigned int EventId)
void addSiStripSignals (const edm::Event &e)
 DataMixingSiStripRawWorker (const edm::ParameterSet &ps)
 DataMixingSiStripRawWorker ()
void putSiStrip (edm::Event &e)
virtual ~DataMixingSiStripRawWorker ()

Private Types

typedef std::vector< SiStripDigiOneDetectorMap
typedef std::map< uint32_t,
OneDetectorMap
SiGlobalIndex

Private Attributes

const edm::DetSetVector
< SiStripDigi > * 
digicollection_
std::string label_
const edm::DetSetVector
< SiStripRawDigi > * 
rawdigicollection_
Selectorsel_
SiGlobalIndex SiHitStorage_
edm::InputTag Sistripdigi_collectionSig_
std::string SiStripDigiCollectionDM_
edm::InputTag SistripLabelSig_
edm::InputTag SiStripPileInputTag_
std::string SiStripRawDigiSource_
edm::InputTag SiStripRawInputTag_

Detailed Description

Definition at line 37 of file DataMixingSiStripRawWorker.h.


Member Typedef Documentation

Definition at line 66 of file DataMixingSiStripRawWorker.h.

typedef std::map<uint32_t, OneDetectorMap> edm::DataMixingSiStripRawWorker::SiGlobalIndex [private]

Definition at line 67 of file DataMixingSiStripRawWorker.h.


Constructor & Destructor Documentation

DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( )

Definition at line 26 of file DataMixingSiStripRawWorker.cc.

{ sel_=0;}
DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( const edm::ParameterSet ps) [explicit]

standard constructor

Definition at line 29 of file DataMixingSiStripRawWorker.cc.

References edm::ParameterSet::getParameter(), label_, sel_, SiHitStorage_, Sistripdigi_collectionSig_, SiStripDigiCollectionDM_, SistripLabelSig_, SiStripPileInputTag_, SiStripRawDigiSource_, and SiStripRawInputTag_.

                                                                                  : 
                                                            label_(ps.getParameter<std::string>("Label"))

  {                                                         

    // get the subdetector names
    //    this->getSubdetectorNames();  //something like this may be useful to check what we are supposed to do...

    // create input selector
    if (label_.size()>0){
      sel_=new Selector( ModuleLabelSelector(label_));
    }
    else {
      sel_=new Selector( MatchAllSelector());
    }

    // declare the products to produce

    Sistripdigi_collectionSig_   = ps.getParameter<edm::InputTag>("SistripdigiCollectionSig");
    SistripLabelSig_   = ps.getParameter<edm::InputTag>("SistripLabelSig");

    SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
    SiStripRawInputTag_ = ps.getParameter<edm::InputTag>("SiStripRawInputTag");

    SiStripDigiCollectionDM_  = ps.getParameter<std::string>("SiStripDigiCollectionDM");

    SiStripRawDigiSource_ = ps.getParameter<std::string>("SiStripRawDigiSource");

    // clear local storage for this event                                                                     
    SiHitStorage_.clear();

  }
DataMixingSiStripRawWorker::~DataMixingSiStripRawWorker ( ) [virtual]

Default destructor

Definition at line 64 of file DataMixingSiStripRawWorker.cc.

References sel_.

                                                          { 
    delete sel_;
    sel_=0;
  }  

Member Function Documentation

void DataMixingSiStripRawWorker::addSiStripPileups ( const int  bcr,
edm::EventPrincipal ep,
unsigned int  EventId 
)

Definition at line 92 of file DataMixingSiStripRawWorker.cc.

References gather_cfg::cout, digicollection_, edm::EventPrincipal::id(), LogDebug, rawdigicollection_, SiStripPileInputTag_, SiStripRawDigiSource_, and SiStripRawInputTag_.

Referenced by edm::DataMixingModule::addPileups().

                                                                                                            {
    
    LogDebug("DataMixingSiStripRawWorker") << "\n===============> adding pileups from event  "
                                           << ep->id() << " for bunchcrossing " << bcr;

    boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi> > const>    pSSD;
    boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripRawDigi> > const> pSSRD;
    
    if (SiStripRawDigiSource_=="SIGNAL") {
      pSSD = getProductByTag<edm::DetSetVector<SiStripDigi> >(*ep, SiStripPileInputTag_);
      digicollection_ = const_cast< edm::DetSetVector<SiStripDigi> * >(pSSD->product());
    } else if (SiStripRawDigiSource_=="PILEUP") {
      pSSRD = getProductByTag<edm::DetSetVector<SiStripRawDigi> >(*ep, SiStripRawInputTag_ );
      rawdigicollection_ = const_cast< edm::DetSetVector<SiStripRawDigi> * >(pSSRD->product());
    } else {
      std::cout << "you shouldn't be here" << std::endl;
    }

  } // end of addSiStripPileups
void DataMixingSiStripRawWorker::addSiStripSignals ( const edm::Event e)
void DataMixingSiStripRawWorker::putSiStrip ( edm::Event e)

Definition at line 113 of file DataMixingSiStripRawWorker.cc.

References edm::DetSetVector< T >::begin(), begin, digicollection_, end, edm::DetSetVector< T >::end(), edm::DetSetVector< T >::insert(), LogDebug, edm::DetSet< T >::push_back(), edm::Event::put(), rawdigicollection_, SiHitStorage_, and SiStripDigiCollectionDM_.

Referenced by edm::DataMixingModule::put().

                                                         {


    //------------------
    //  (1) Fill a map from the Digi collection
    //

    // fill in maps of SiStripDigis
    OneDetectorMap LocalMap;
    
    //loop on all detsets (detectorIDs) inside the input collection
    edm::DetSetVector<SiStripDigi>::const_iterator DSViter=digicollection_->begin();
    for (; DSViter!=digicollection_->end();DSViter++){
      
#ifdef DEBUG
      LogDebug("DataMixingSiStripRawWorker")  << "Processing DetID " << DSViter->id;
#endif
      
      LocalMap.clear();
      LocalMap.reserve((DSViter->data).size());
      LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end());    
      
      SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) );
    }


    //------------------
    //  (2) Loop over the input RawDigi collection and add the Digis from the map
    //

    // collection of RawDigis to put back in the event
    std::vector< edm::DetSet<SiStripRawDigi> > vSiStripRawDigi;

    //loop on all detsets (detectorIDs) inside the SiStripRawDigis collection
    edm::DetSetVector<SiStripRawDigi>::const_iterator rawDSViter=rawdigicollection_->begin();
    for (; rawDSViter!=rawdigicollection_->end();rawDSViter++){

      // Make empty collection with this detID
      edm::DetSet<SiStripRawDigi> SSRD(rawDSViter->id); 

      // find local map (if it exists) for this detector ID
      SiGlobalIndex::const_iterator itest;
      itest = SiHitStorage_.find(rawDSViter->id);

      // if detID already has digis in existing map, add them to rawdigis
      if(itest!=SiHitStorage_.end()) {  

#ifdef DEBUG
        LogDebug("DataMixingSiStripRawWorker")  << "Pileups: Processing DetID " << rawDSViter->id;
#endif

        // get the map from storage
        LocalMap = itest->second;
        OneDetectorMap::const_iterator iLocal  = LocalMap.begin();

        // loop on all strips in rawdigi detset
        int currentstrip=0;
        edm::DetSet<SiStripRawDigi>::const_iterator iRawDigi = rawDSViter->begin();
        while( iRawDigi != rawDSViter->end() ) {

          int ADCSum = iRawDigi->adc();

          // if current strip exists in map, add ADC values
          if(iLocal->strip() == currentstrip) {
            ADCSum += iLocal->adc();
            iLocal++;
          }

          // put ADC sum in DetSet and go to next strip
          SSRD.push_back( SiStripRawDigi(ADCSum) );
          iRawDigi++;
          currentstrip++;

        }

        // copy combined digi+rawdigi into rawdigi DetSetVector
        vSiStripRawDigi.push_back(SSRD);

      // otherwise, just copy the rawdigis from the background event to the output
      } else {
        vSiStripRawDigi.push_back(*rawDSViter);
      }

    }


    //------------------
    //  (3) Put the new RawDigi collection back into the event
    //

    // make new raw digi collection
    std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > MySiStripRawDigis(new edm::DetSetVector<SiStripRawDigi>(vSiStripRawDigi) );

    // put collection
    e.put( MySiStripRawDigis, SiStripDigiCollectionDM_ );

    // clear local storage for this event
    SiHitStorage_.clear();
  }

Member Data Documentation

Definition at line 72 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), addSiStripSignals(), and putSiStrip().

Definition at line 76 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker().

Definition at line 73 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), addSiStripSignals(), and putSiStrip().

Definition at line 69 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

Definition at line 57 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

Definition at line 61 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

Definition at line 58 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

Definition at line 59 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().