00001 /* 00002 * See header file for a description of this class. 00003 * 00004 * $Date: 2007/11/09 11:51:51 $ 00005 * $Revision: 1.3 $ 00006 * \author G. Cerminara - INFN Torino 00007 */ 00008 00009 #include "DTTTrigSyncT0Only.h" 00010 00011 00012 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00013 #include "FWCore/Framework/interface/EventSetup.h" 00014 #include "FWCore/Framework/interface/ESHandle.h" 00015 #include "DataFormats/MuonDetId/interface/DTWireId.h" 00016 #include "CondFormats/DTObjects/interface/DTT0.h" 00017 #include "CondFormats/DataRecord/interface/DTT0Rcd.h" 00018 00019 #include <iostream> 00020 00021 using namespace std; 00022 using namespace edm; 00023 00024 00025 DTTTrigSyncT0Only::DTTTrigSyncT0Only(const ParameterSet& config){ 00026 debug = config.getUntrackedParameter<bool>("debug"); 00027 } 00028 00029 00030 00031 DTTTrigSyncT0Only::~DTTTrigSyncT0Only(){} 00032 00033 00034 00035 void DTTTrigSyncT0Only::setES(const EventSetup& setup) { 00036 ESHandle<DTT0> t0; 00037 setup.get<DTT0Rcd>().get(t0); 00038 tZeroMap = &*t0; 00039 00040 if(debug) { 00041 cout << "[DTTTrigSyncT0Only] T0 version: " << t0->version() << endl; 00042 } 00043 } 00044 00045 00046 00047 00048 double DTTTrigSyncT0Only::offset(const DTLayer* layer, 00049 const DTWireId& wireId, 00050 const GlobalPoint& globPos, 00051 double& tTrig, 00052 double& wirePropCorr, 00053 double& tofCorr) { 00054 tTrig = offset(wireId); 00055 wirePropCorr = 0; 00056 tofCorr = 0; 00057 00058 if(debug) { 00059 cout << "[DTTTrigSyncT0Only] Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl 00060 << " various contributions are: " << endl 00061 //<< " tZero (ns): " << t0 << endl 00062 << " Propagation along wire delay (ns): " << wirePropCorr << endl 00063 << " TOF correction (ns): " << tofCorr << endl 00064 << endl; 00065 } 00066 //The global offset is the sum of various contributions 00067 return tTrig + wirePropCorr - tofCorr; 00068 } 00069 00070 double DTTTrigSyncT0Only::offset(const DTWireId& wireId) { 00071 float t0 = 0; 00072 float t0rms = 0; 00073 tZeroMap->cellT0(wireId, 00074 t0, 00075 t0rms, 00076 DTTimeUnits::ns); 00077 00078 return t0; 00079 } 00080 00081 00082 // Set the verbosity level 00083 bool DTTTrigSyncT0Only::debug; 00084 00085 00086 00087