Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:05:02

0001 #ifndef SiPixelDigitizer_h
0002 #define SiPixelDigitizer_h
0003 
0004 /** \class SiPixelDigitizer
0005  *
0006  * SiPixelDigitizer produces digis from SimHits
0007  * The real algorithm is in SiPixelDigitizerAlgorithm
0008  *
0009  * \author Michele Pioppi-INFN Perugia
0010  *
0011  * \version   Sep 26 2005  
0012 
0013  *
0014  ************************************************************/
0015 
0016 #include <map>
0017 #include <memory>
0018 #include <string>
0019 #include <vector>
0020 
0021 #include "DataFormats/Common/interface/Handle.h"
0022 #include "DataFormats/Provenance/interface/EventID.h"
0023 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0024 #include "FWCore/Framework/interface/ProducesCollector.h"
0025 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0026 #include "FWCore/Utilities/interface/ESGetToken.h"
0027 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0028 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0029 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0030 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h"
0031 
0032 class MagneticField;
0033 class PileUpEventPrincipal;
0034 class PixelGeomDetUnit;
0035 class PSimHit;
0036 class SiPixelDigitizerAlgorithm;
0037 class TrackerGeometry;
0038 
0039 namespace CLHEP {
0040   class HepRandomEngine;
0041 }
0042 
0043 namespace cms {
0044   class SiPixelDigitizer : public DigiAccumulatorMixMod {
0045   public:
0046     explicit SiPixelDigitizer(const edm::ParameterSet& conf, edm::ProducesCollector, edm::ConsumesCollector& iC);
0047 
0048     ~SiPixelDigitizer() override;
0049 
0050     void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override;
0051     void accumulate(edm::Event const& e, edm::EventSetup const& c) override;
0052     void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override;
0053     void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override;
0054 
0055     virtual void beginJob() {}
0056 
0057     void StorePileupInformation(std::vector<int>& numInteractionList,
0058                                 std::vector<int>& bunchCrossingList,
0059                                 std::vector<float>& TrueInteractionList,
0060                                 std::vector<edm::EventID>& eventInfoList,
0061                                 int bunchSpacing) override {
0062       PileupInfo_ = std::make_unique<PileupMixingContent>(
0063           numInteractionList, bunchCrossingList, TrueInteractionList, eventInfoList, bunchSpacing);
0064     }
0065 
0066     PileupMixingContent* getEventPileupInfo() override { return PileupInfo_.get(); }
0067 
0068   private:
0069     void accumulatePixelHits(edm::Handle<std::vector<PSimHit> >,
0070                              size_t globalSimHitIndex,
0071                              const unsigned int tofBin,
0072                              edm::EventSetup const& c);
0073 
0074     bool firstInitializeEvent_;
0075     bool firstFinalizeEvent_;
0076     bool applyLateReweighting_;
0077     const bool store_SimHitEntryExitPoints_;
0078     bool makeDigiSimLinks_;
0079     std::unique_ptr<SiPixelDigitizerAlgorithm> _pixeldigialgo;
0080     /** @brief Offset to add to the index of each sim hit to account for which crossing it's in.
0081 *
0082 * I need to know what each sim hit index will be when the hits from all crossing frames are merged into
0083 * one collection (assuming the MixingModule is configured to create the crossing frame for all sim hits).
0084 * To do this I'll record how many hits were in each crossing, and then add that on to the index for a given
0085 * hit in a given crossing. This assumes that the crossings are processed in the same order here as they are
0086 * put into the crossing frame, which I'm pretty sure is true.<br/>
0087 * The key is the name of the sim hit collection. */
0088     std::map<std::string, size_t> crossingSimHitIndexOffset_;
0089 
0090     typedef std::vector<std::string> vstring;
0091     const std::string hitsProducer;
0092     const vstring trackerContainers;
0093     const TrackerGeometry* pDD = nullptr;
0094     const MagneticField* pSetup = nullptr;
0095     std::map<unsigned int, PixelGeomDetUnit const*> detectorUnits;
0096     CLHEP::HepRandomEngine* randomEngine_ = nullptr;
0097 
0098     std::unique_ptr<PileupMixingContent> PileupInfo_;
0099 
0100     const bool pilotBlades;         // Default = false
0101     const int NumberOfEndcapDisks;  // Default = 2
0102 
0103     const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0104     const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> pDDToken_;
0105     const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> pSetupToken_;
0106 
0107     // infrastructure to reject dead pixels as defined in db (added by F.Blekman)
0108   };
0109 }  // namespace cms
0110 
0111 #endif