Go to the documentation of this file.00001
00002
00003
00004
00005
00006
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");
00023 corrType = pSet.getParameter<int>("TOFCorrection");
00024 }
00025
00026
00027 DTDigiSyncTOFCorr::~DTDigiSyncTOFCorr(){}
00028
00029
00030
00031 double DTDigiSyncTOFCorr::digitizerOffset(const DTWireId * id, const DTLayer* layer) const {
00032
00033 double offset = theOffset;
00034 const double cSpeed = 29.9792458;
00035
00036 if (corrType==1) {
00037
00038 double flightL = layer->chamber()->surface().position().mag();
00039 offset -= flightL/cSpeed;
00040 } else if (corrType==2) {
00041
00042
00043
00044 float localXPos = layer->specificTopology().wirePosition(id->wire());
00045 LocalPoint localPos(localXPos,0,0);
00046
00047
00048 double flightL = layer->surface().toGlobal(localPos).mag();
00049
00050 offset -= flightL/cSpeed;
00051
00052 } else if (corrType==3) {
00053
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
00065 double DTDigiSyncTOFCorr::emulatorOffset(const DTWireId * id) const {
00066 return theOffset;
00067 }