File indexing completed on 2024-04-06 12:30:43
0001
0002
0003
0004
0005
0006
0007 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "SimMuon/DTDigitizer/src/DTDigiSyncTOFCorr.h"
0010
0011 #include "Geometry/DTGeometry/interface/DTChamber.h"
0012 #include "Geometry/DTGeometry/interface/DTLayer.h"
0013 #include "Geometry/DTGeometry/interface/DTSuperLayer.h"
0014 #include <iostream>
0015
0016 using namespace std;
0017
0018 DTDigiSyncTOFCorr::DTDigiSyncTOFCorr(const edm::ParameterSet &pSet) {
0019 theOffset = pSet.getParameter<double>("offset");
0020 corrType = pSet.getParameter<int>("TOFCorrection");
0021 }
0022
0023 DTDigiSyncTOFCorr::~DTDigiSyncTOFCorr() {}
0024
0025
0026 double DTDigiSyncTOFCorr::digitizerOffset(const DTWireId *id, const DTLayer *layer) const {
0027 double offset = theOffset;
0028 const double cSpeed = 29.9792458;
0029
0030 if (corrType == 1) {
0031
0032 double flightL = layer->chamber()->surface().position().mag();
0033 offset -= flightL / cSpeed;
0034 } else if (corrType == 2) {
0035
0036
0037
0038 float localXPos = layer->specificTopology().wirePosition(id->wire());
0039 LocalPoint localPos(localXPos, 0, 0);
0040
0041
0042 double flightL = layer->surface().toGlobal(localPos).mag();
0043
0044 offset -= flightL / cSpeed;
0045
0046 } else if (corrType == 3) {
0047
0048 double flightL = layer->superLayer()->surface().position().mag();
0049 offset -= flightL / cSpeed;
0050 } else if (corrType != 0) {
0051 cout << "ERROR: SimMuon:DTDigitizer:DTDigiSyncTOFCorr:TOFCorrection = " << corrType << "is not defined " << endl;
0052 }
0053 return offset;
0054 }
0055
0056
0057 double DTDigiSyncTOFCorr::emulatorOffset(const DTWireId *id) const { return theOffset; }