CMS 3D CMS Logo

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

cms::SiPixelDigitizer Class Reference

#include <SiPixelDigitizer.h>

Inheritance diagram for cms::SiPixelDigitizer:
DigiAccumulatorMixMod

List of all members.

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c) override
virtual void beginJob ()
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 SiPixelDigitizer (const edm::ParameterSet &conf, edm::EDProducer &mixMod)
virtual ~SiPixelDigitizer ()

Private Types

typedef std::vector< std::string > vstring

Private Member Functions

void accumulatePixelHits (edm::Handle< std::vector< PSimHit > >)

Private Attributes

std::unique_ptr
< SiPixelDigitizerAlgorithm
_pixeldigialgo
std::map< unsigned int,
PixelGeomDetUnit * > 
detectorUnits
bool first
const std::string geometryType
const std::string hitsProducer
edm::ESHandle< TrackerGeometrypDD
edm::ESHandle< MagneticFieldpSetup
CLHEP::HepRandomEngine * rndEngine
const vstring trackerContainers

Detailed Description

Definition at line 44 of file SiPixelDigitizer.h.


Member Typedef Documentation

typedef std::vector<std::string> cms::SiPixelDigitizer::vstring [private]

Definition at line 61 of file SiPixelDigitizer.h.


Constructor & Destructor Documentation

afs cern ch work a aaltunda public www CMSSW_6_2_7 src SimTracker SiPixelDigitizer plugins SiPixelDigitizer cc SiPixelDigitizer::SiPixelDigitizer ( const edm::ParameterSet conf,
edm::EDProducer mixMod 
) [explicit]

Definition at line 90 of file SiPixelDigitizer.cc.

References Exception, edm::Service< T >::isAvailable(), and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer";
    
    const std::string alias ("simSiPixelDigis"); 
    
    mixMod.produces<edm::DetSetVector<PixelDigi> >().setBranchAlias(alias);
    mixMod.produces<edm::DetSetVector<PixelDigiSimLink> >().setBranchAlias(alias + "siPixelDigiSimLink");
    edm::Service<edm::RandomNumberGenerator> rng;
    if ( ! rng.isAvailable()) {
      throw cms::Exception("Configuration")
        << "SiPixelDigitizer requires the RandomNumberGeneratorService\n"
        "which is not present in the configuration file.  You must add the service\n"
        "in the configuration file or remove the modules that require it.";
    }
  
    rndEngine       = &(rng->getEngine());
    _pixeldigialgo.reset(new SiPixelDigitizerAlgorithm(iConfig,(*rndEngine)));

  }
  
SiPixelDigitizer::~SiPixelDigitizer ( ) [virtual]

Definition at line 116 of file SiPixelDigitizer.cc.


Member Function Documentation

void SiPixelDigitizer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
) [override, virtual]
void SiPixelDigitizer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
) [override, virtual]
void SiPixelDigitizer::accumulatePixelHits ( edm::Handle< std::vector< PSimHit > >  hSimHits) [private]

Definition at line 126 of file SiPixelDigitizer.cc.

References _pixeldigialgo, detectorUnits, LogDebug, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GloballyPositioned< T >::position(), pSetup, trackerHits::simHits, DetId::subdetId(), and GeomDet::surface().

Referenced by accumulate().

                           {
       std::set<unsigned int> detIds;
       std::vector<PSimHit> const& simHits = *hSimHits.product();
       for(std::vector<PSimHit>::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it) {
         unsigned int detId = (*it).detUnitId();
         if(detIds.insert(detId).second) {
           // The insert succeeded, so this detector element has not yet been processed.
           unsigned int isub = DetId(detId).subdetId();
           if((isub == PixelSubdetector::PixelBarrel) || (isub == PixelSubdetector::PixelEndcap)) {
             PixelGeomDetUnit* pixdet = detectorUnits[detId];
             //access to magnetic field in global coordinates
             GlobalVector bfield = pSetup->inTesla(pixdet->surface().position());
             LogDebug ("PixelDigitizer ") << "B-field(T) at " << pixdet->surface().position() << "(cm): " 
                                          << pSetup->inTesla(pixdet->surface().position());
             _pixeldigialgo->accumulateSimHits(it, itEnd, pixdet, bfield);
           }
         }
       }
    }
  }
  
virtual void cms::SiPixelDigitizer::beginJob ( void  ) [inline, virtual]

Definition at line 56 of file SiPixelDigitizer.h.

{}
void SiPixelDigitizer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
) [override, virtual]

Implements DigiAccumulatorMixMod.

Definition at line 200 of file SiPixelDigitizer.cc.

                                                                                                                        {
      DetId idet=DetId((*iu)->geographicalId().rawId());
      unsigned int isub=idet.subdetId();
      
      if((isub == PixelSubdetector::PixelBarrel) || (isub == PixelSubdetector::PixelEndcap)) {  
        
        //
        
        edm::DetSet<PixelDigi> collector((*iu)->geographicalId().rawId());
        edm::DetSet<PixelDigiSimLink> linkcollector((*iu)->geographicalId().rawId());
        
        
        _pixeldigialgo->digitize(dynamic_cast<PixelGeomDetUnit*>((*iu)),
                                 collector.data,
                                 linkcollector.data,
                                 tTopo);
        if(collector.data.size() > 0) {
          theDigiVector.push_back(std::move(collector));
        }
        if(linkcollector.data.size() > 0) {
          theDigiLinkVector.push_back(std::move(linkcollector));
        }
      }
    }
    
    // Step C: create collection with the cache vector of DetSet 
    std::auto_ptr<edm::DetSetVector<PixelDigi> > 
      output(new edm::DetSetVector<PixelDigi>(theDigiVector) );
    std::auto_ptr<edm::DetSetVector<PixelDigiSimLink> > 
      outputlink(new edm::DetSetVector<PixelDigiSimLink>(theDigiLinkVector) );

    // Step D: write output to file 
    iEvent.put(output);
    iEvent.put(outputlink);
  }

void SiPixelDigitizer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
) [override, virtual]

Implements DigiAccumulatorMixMod.

Definition at line 149 of file SiPixelDigitizer.cc.

References _pixeldigialgo, and first.

             {
      _pixeldigialgo->init(iSetup);
      first = false;
    }
    _pixeldigialgo->initializeEvent();
    iSetup.get<TrackerDigiGeometryRecord>().get(geometryType, pDD);
    iSetup.get<IdealMagneticFieldRecord>().get(pSetup);

    // FIX THIS! We only need to clear and (re)fill this map when the geometry type IOV changes.  Use ESWatcher to determine this.
    if(true) { // Replace with ESWatcher 
      detectorUnits.clear();
      for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); ++iu) {
        unsigned int detId = (*iu)->geographicalId().rawId();
        DetId idet=DetId(detId);
        unsigned int isub=idet.subdetId();
        if((isub == PixelSubdetector::PixelBarrel) || (isub == PixelSubdetector::PixelEndcap)) {  
          PixelGeomDetUnit* pixdet = dynamic_cast<PixelGeomDetUnit*>((*iu));
          assert(pixdet != 0);
          detectorUnits.insert(std::make_pair(detId, pixdet));
        }
      }
    }
  }


Member Data Documentation

Definition at line 60 of file SiPixelDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

std::map<unsigned int, PixelGeomDetUnit*> cms::SiPixelDigitizer::detectorUnits [private]

Definition at line 67 of file SiPixelDigitizer.h.

Referenced by accumulatePixelHits().

Definition at line 59 of file SiPixelDigitizer.h.

Referenced by initializeEvent().

const std::string cms::SiPixelDigitizer::geometryType [private]

Definition at line 64 of file SiPixelDigitizer.h.

const std::string cms::SiPixelDigitizer::hitsProducer [private]

Definition at line 62 of file SiPixelDigitizer.h.

Referenced by accumulate().

Definition at line 65 of file SiPixelDigitizer.h.

Definition at line 66 of file SiPixelDigitizer.h.

Referenced by accumulatePixelHits().

CLHEP::HepRandomEngine* cms::SiPixelDigitizer::rndEngine [private]

Definition at line 68 of file SiPixelDigitizer.h.

Definition at line 63 of file SiPixelDigitizer.h.