Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:43

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author N. Amapane, R. Bellan - INFN Torino
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");     // 500ns
0020   corrType = pSet.getParameter<int>("TOFCorrection");  // 1
0021 }
0022 
0023 DTDigiSyncTOFCorr::~DTDigiSyncTOFCorr() {}
0024 
0025 // Delays to be added to digi times during digitization, in ns.
0026 double DTDigiSyncTOFCorr::digitizerOffset(const DTWireId *id, const DTLayer *layer) const {
0027   double offset = theOffset;
0028   const double cSpeed = 29.9792458;  // cm/ns
0029 
0030   if (corrType == 1) {
0031     // Subtraction of assumed TOF, per CHAMBER
0032     double flightL = layer->chamber()->surface().position().mag();
0033     offset -= flightL / cSpeed;
0034   } else if (corrType == 2) {
0035     // Subtraction of assumed TOF, per WIRE
0036 
0037     // Position of the wire in the Layer's reference frame
0038     float localXPos = layer->specificTopology().wirePosition(id->wire());
0039     LocalPoint localPos(localXPos, 0, 0);
0040 
0041     // Distance of the wire to the CMS's I.P.
0042     double flightL = layer->surface().toGlobal(localPos).mag();
0043 
0044     offset -= flightL / cSpeed;
0045 
0046   } else if (corrType == 3) {
0047     // Subtraction of assumed TOF, per SUPERLAYER
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 // Offset to obtain "raw" TDCs for the L1 emulator from digis.
0057 double DTDigiSyncTOFCorr::emulatorOffset(const DTWireId *id) const { return theOffset; }