CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimMuon/DTDigitizer/src/DTDigiSyncTOFCorr.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2010/07/16 14:44:04 $
00005  *  $Revision: 1.8 $
00006  *  \author N. Amapane, R. Bellan - INFN Torino
00007  */
00008 
00009 #include "SimMuon/DTDigitizer/src/DTDigiSyncTOFCorr.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "DataFormats/MuonDetId/interface/DTWireId.h"
00012 
00013 #include "Geometry/DTGeometry/interface/DTLayer.h"
00014 #include "Geometry/DTGeometry/interface/DTChamber.h"
00015 #include "Geometry/DTGeometry/interface/DTSuperLayer.h"
00016 #include <iostream>
00017 
00018 using namespace std;
00019 
00020 DTDigiSyncTOFCorr::DTDigiSyncTOFCorr(const edm::ParameterSet& pSet){
00021   
00022   theOffset = pSet.getParameter<double>("offset"); //500ns
00023   corrType = pSet.getParameter<int>("TOFCorrection"); //1
00024 }
00025 
00026 
00027 DTDigiSyncTOFCorr::~DTDigiSyncTOFCorr(){}
00028 
00029 
00030 // Delays to be added to digi times during digitization, in ns.
00031 double DTDigiSyncTOFCorr::digitizerOffset(const DTWireId * id, const DTLayer* layer) const {
00032 
00033   double offset = theOffset;
00034   const double cSpeed = 29.9792458; // cm/ns
00035 
00036   if (corrType==1) {
00037     // Subtraction of assumed TOF, per CHAMBER
00038     double flightL = layer->chamber()->surface().position().mag();
00039     offset -= flightL/cSpeed;
00040   } else if (corrType==2) {
00041     // Subtraction of assumed TOF, per WIRE 
00042 
00043     // Position of the wire in the Layer's reference frame
00044     float localXPos = layer->specificTopology().wirePosition(id->wire());
00045     LocalPoint localPos(localXPos,0,0); 
00046 
00047     // Distance of the wire to the CMS's I.P.
00048     double flightL = layer->surface().toGlobal(localPos).mag();
00049 
00050     offset -= flightL/cSpeed;
00051 
00052   } else if (corrType==3) {
00053     // Subtraction of assumed TOF, per SUPERLAYER
00054     double flightL = layer->superLayer()->surface().position().mag();
00055     offset -= flightL/cSpeed;
00056   } else if (corrType!=0){
00057     cout << "ERROR: SimMuon:DTDigitizer:DTDigiSyncTOFCorr:TOFCorrection = " << corrType
00058          << "is not defined " << endl; 
00059   }
00060   return offset;
00061 }
00062 
00063 
00064 // Offset to obtain "raw" TDCs for the L1 emulator from digis.
00065 double DTDigiSyncTOFCorr::emulatorOffset(const DTWireId * id) const {
00066   return theOffset;
00067 }