CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h

Go to the documentation of this file.
00001 #ifndef SiStripDigitizerAlgorithm_h
00002 #define SiStripDigitizerAlgorithm_h
00003 
00010 #include <memory>
00011 #include <string>
00012 
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 
00015 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00016 #include "DataFormats/DetId/interface/DetId.h"
00017 #include "DataFormats/Common/interface/DetSet.h"
00018 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00019 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00020 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00021 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
00022 #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h"
00023 #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h"
00024 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
00025 #include "SiTrivialDigitalConverter.h"
00026 #include "SiGaussianTailNoiseAdder.h"
00027 #include "SiHitDigitizer.h"
00028 #include "SiPileUpSignals.h"
00029 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00030 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00031 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00032 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00033 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
00034 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h"
00035 
00036 class TrackerTopology;
00037 
00038 namespace edm {
00039   class EventSetup;
00040 }
00041 
00042 class SiStripLorentzAngle;
00043 class StripDigiSimLink;
00044 
00045 namespace CLHEP {
00046   class HepRandomEngine;
00047 }
00048 
00049 class SiStripDigitizerAlgorithm {
00050  public:
00051   typedef SiDigitalConverter::DigitalVecType DigitalVecType;
00052   typedef SiDigitalConverter::DigitalRawVecType DigitalRawVecType;
00053   typedef SiPileUpSignals::SignalMapType SignalMapType;
00054   typedef std::map< int, float, std::less<int> > hit_map_type;
00055   typedef float Amplitude;
00056   
00057   // Constructor
00058   SiStripDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&);
00059 
00060   // Destructor
00061   ~SiStripDigitizerAlgorithm();
00062 
00063   void initializeDetUnit(StripGeomDetUnit* det, const edm::EventSetup& iSetup);
00064 
00065   void initializeEvent(const edm::EventSetup& iSetup);
00066 
00067   //run the algorithm to digitize a single det
00068   void accumulateSimHits(const std::vector<PSimHit>::const_iterator inputBegin,
00069                          const std::vector<PSimHit>::const_iterator inputEnd,
00070                          size_t inputBeginGlobalIndex,
00071                          const StripGeomDetUnit *stripdet,
00072                          const GlobalVector& bfield,
00073                          const TrackerTopology *tTopo);
00074 
00075   void digitize(
00076                 edm::DetSet<SiStripDigi>& outDigis,
00077                 edm::DetSet<SiStripRawDigi>& outRawDigis,
00078                 edm::DetSet<StripDigiSimLink>& outLink,
00079                 const StripGeomDetUnit* stripdet,
00080                 edm::ESHandle<SiStripGain>&,
00081                 edm::ESHandle<SiStripThreshold>&, 
00082                 edm::ESHandle<SiStripNoises>&,
00083                 edm::ESHandle<SiStripPedestals>&);
00084 
00085   // ParticleDataTable
00086   void setParticleDataTable(const ParticleDataTable * pardt) {
00087         theSiHitDigitizer->setParticleDataTable(pardt); 
00088         pdt= pardt; 
00089   }
00090   
00091  private:
00092   const std::string lorentzAngleName;
00093   const double theThreshold;
00094   const double cmnRMStib;
00095   const double cmnRMStob;
00096   const double cmnRMStid;
00097   const double cmnRMStec;
00098   const double APVSaturationProb;          
00099   const bool makeDigiSimLinks_; //< Whether or not to create the association to sim truth collection. Set in configuration.
00100   const bool peakMode;
00101   const bool noise;
00102   const bool RealPedestals;              
00103   const bool SingleStripNoise;          
00104   const bool CommonModeNoise;           
00105   const bool BaselineShift;             
00106   const bool APVSaturationFromHIP;
00107   
00108   const int theFedAlgo;
00109   const bool zeroSuppression;
00110   const double theElectronPerADC;
00111   const double theTOFCutForPeak;
00112   const double theTOFCutForDeconvolution;
00113   const double tofCut;
00114   const double cosmicShift;
00115   const double inefficiency;
00116   const double pedOffset;
00117 
00118   const ParticleDataTable * pdt;
00119   const ParticleData * particle;
00120   
00121   const std::unique_ptr<SiHitDigitizer> theSiHitDigitizer;
00122   const std::unique_ptr<SiPileUpSignals> theSiPileUpSignals;
00123   const std::unique_ptr<const SiGaussianTailNoiseAdder> theSiNoiseAdder;
00124   const std::unique_ptr<SiTrivialDigitalConverter> theSiDigitalConverter;
00125   const std::unique_ptr<SiStripFedZeroSuppression> theSiZeroSuppress;
00126 
00127   const std::unique_ptr<CLHEP::RandFlat> theFlatDistribution;
00128 
00129   // bad channels for each detector ID
00130   std::map<unsigned int, std::vector<bool> > allBadChannels;
00131   // first and last channel wit signal for each detector ID
00132   std::map<unsigned int, size_t> firstChannelsWithSignal;
00133   std::map<unsigned int, size_t> lastChannelsWithSignal;
00134 
00135   // ESHandles
00136   edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle;
00137 
00140   struct AssociationInfo
00141   {
00142     unsigned int trackID;
00143     EncodedEventId eventID;
00144     float contributionToADC;
00145     size_t simHitGlobalIndex; 
00146   };
00147 
00148   typedef std::map<int, std::vector<AssociationInfo> >  AssociationInfoForChannel;
00149   typedef std::map<uint32_t, AssociationInfoForChannel>  AssociationInfoForDetId;
00151   AssociationInfoForDetId associationInfoForDetId_;
00152 
00153 };
00154 
00155 #endif