CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimMuon/DTDigitizer/src/DTDigitizer.h

Go to the documentation of this file.
00001 #ifndef SimMuon_DTDigitizer_h
00002 #define SimMuon_DTDigitizer_h
00003 
00014 #include "FWCore/Framework/interface/EDProducer.h"
00015 
00016 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
00017 #include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h"
00018 #include "DataFormats/MuonDetId/interface/DTWireId.h"
00019 
00020 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00021 
00022 #include <vector>
00023 
00024 namespace CLHEP {
00025   class RandGaussQ;
00026   class RandFlat;
00027 }
00028 
00029 class DTLayer;
00030 class PSimHit;
00031 class DTWireType;
00032 class DTBaseDigiSync;
00033 class DTTopology;
00034 class DTDigiSyncBase;
00035 
00036 
00037 namespace edm {class ParameterSet; class Event; class EventSetup;}
00038 
00039 class DTDigitizer : public edm::EDProducer {
00040   
00041  public:
00042 
00043   explicit DTDigitizer(const edm::ParameterSet&);
00044   ~DTDigitizer();
00045   virtual void produce(edm::Event&, const edm::EventSetup&);
00046   
00047  private:
00048   typedef std::pair<const PSimHit*,float> hitAndT; // hit & corresponding time
00049   typedef std::vector<hitAndT> TDContainer; // hits & times for one wire
00050 
00051   typedef std::map<DTWireId, std::vector<const PSimHit*> > DTWireIdMap; 
00052   typedef DTWireIdMap::iterator DTWireIdMapIter;  
00053   typedef DTWireIdMap::const_iterator DTWireIdMapConstIter;  
00054 
00055   // Sort hits container by time.
00056   struct hitLessT {
00057     bool operator()(const  hitAndT & h1, const hitAndT & h2) {
00058       if (h1.second < h2.second) return true;
00059       return false;
00060     }
00061   };
00062 
00063   // Calculate the drift time for one hit. 
00064   // if status flag == false, hit has to be discarded.
00065   std::pair<float,bool> computeTime(const DTLayer* layer,const DTWireId &wireId, 
00066                                     const PSimHit *hit, 
00067                                     const LocalVector &BLoc); //FIXME?? 
00068   
00069   // Calculate the drift time using the GARFIELD cell parametrization,
00070   // taking care of all conversions from CMSSW local coordinates
00071   // to the conventions used for the parametrization.
00072   std::pair<float,bool> driftTimeFromParametrization(float x, float alpha, float By,
00073                                                      float Bz) const;
00074   
00075   // Calculate the drift time for the cases where it is not possible
00076   // to use the GARFIELD cell parametrization.
00077   std::pair<float,bool> driftTimeFromTimeMap() const;
00078   
00079   // Add all delays other than drift times (signal propagation along the wire, 
00080   // TOF etc.; subtract calibration time.
00081   float externalDelays(const DTLayer* layer,
00082                        const DTWireId &wireId, 
00083                        const PSimHit *hit) const;
00084 
00085   // Store digis for one wire, taking into account the dead time.
00086   //FiXME put alias for the map.
00087   void storeDigis(DTWireId &wireId, 
00088                   TDContainer &hits,
00089                   DTDigiCollection &output, DTDigiSimLinkCollection &outputLinks);
00090   
00091   // Debug output
00092   void dumpHit(const PSimHit * hit, float xEntry, float xExit, const DTTopology &topo);
00093   
00094   // Double half-gaussian smearing.
00095   float asymGausSmear(double mean, double sigmaLeft, double sigmaRight) const;
00096   
00097   // Allow debugging and testing.
00098   friend class DTDigitizerAnalysis;
00099 
00100   //Its Atributes:
00101   double vPropWire;
00102   float deadTime;
00103   float smearing;
00104   bool debug;
00105   bool interpolate;
00106   bool onlyMuHits;
00107 
00108   std::string syncName;
00109   DTDigiSyncBase *theSync;
00110 
00111   std::string geometryType;
00112 
00113   // Ideal model. Used for debug
00114   bool IdealModel;
00115   float theConstVDrift;  
00116 
00117   // the random generator
00118   CLHEP::RandGaussQ* theGaussianDistribution;
00119   CLHEP::RandFlat* theFlatDistribution;
00120 
00121   // to configure the creation of Digi-Sim links
00122   bool MultipleLinks;
00123   float LinksTimeWindow;
00124   
00125   //Name of Collection use for create the XF 
00126   std::string collection_for_XF;
00127 
00128 };
00129 #endif