CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonTimingFiller Class Reference

#include <RecoMuon/MuonIdentification/src/MuonTimingFiller.cc>

Public Member Functions

void fillTiming (const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTime &rpcTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 MuonTimingFiller (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
 ~MuonTimingFiller ()
 

Private Member Functions

void addEcalTime (const reco::Muon &muon, TimeMeasurementSequence &cmbSeq)
 
void combineTMSequences (const reco::Muon &muon, const TimeMeasurementSequence &dtSeq, const TimeMeasurementSequence &cscSeq, TimeMeasurementSequence &cmbSeq)
 
void fillRPCTime (const reco::Muon &muon, reco::MuonTime &muTime, edm::Event &iEvent)
 
void fillTimeFromMeasurements (const TimeMeasurementSequence &tmSeq, reco::MuonTimeExtra &muTime)
 
void rawFit (double &a, double &da, double &b, double &db, const std::vector< double > &hitsx, const std::vector< double > &hitsy)
 

Private Attributes

double ecalEcut_
 
double errorEB_
 
double errorEE_
 
std::unique_ptr< CSCTimingExtractortheCSCTimingExtractor_
 
std::unique_ptr< DTTimingExtractortheDTTimingExtractor_
 
std::unique_ptr< MuonSegmentMatchertheMatcher_
 
bool useCSC_
 
bool useDT_
 
bool useECAL_
 

Detailed Description

Description: Class filling the DT, CSC and Combined MuonTimeExtra objects

Implementation: <Notes on="" implementation>="">

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file MuonTimingFiller.h.

Constructor & Destructor Documentation

MuonTimingFiller::MuonTimingFiller ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 44 of file MuonTimingFiller.cc.

References ecalEcut_, errorEB_, errorEE_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), theCSCTimingExtractor_, theDTTimingExtractor_, theMatcher_, useCSC_, useDT_, and useECAL_.

45 {
46  // Load parameters for the DTTimingExtractor
47  edm::ParameterSet dtTimingParameters = iConfig.getParameter<edm::ParameterSet>("DTTimingParameters");
48 
49  // Load parameters for the CSCTimingExtractor
50  edm::ParameterSet cscTimingParameters = iConfig.getParameter<edm::ParameterSet>("CSCTimingParameters");
51 
52  // Fallback mechanism for old configs (there the segment matcher was built inside the timing extractors)
53  edm::ParameterSet matchParameters;
54  if (iConfig.existsAs<edm::ParameterSet>("MatchParameters"))
55  matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
56  else
57  matchParameters = dtTimingParameters.getParameter<edm::ParameterSet>("MatchParameters");
58 
59  theMatcher_ = std::make_unique<MuonSegmentMatcher>(matchParameters, iC);
60  theDTTimingExtractor_ = std::make_unique<DTTimingExtractor>(dtTimingParameters,theMatcher_.get());
61  theCSCTimingExtractor_ = std::make_unique<CSCTimingExtractor>(cscTimingParameters,theMatcher_.get());
62 
63  errorEB_ = iConfig.getParameter<double>("ErrorEB");
64  errorEE_ = iConfig.getParameter<double>("ErrorEE");
65  ecalEcut_ = iConfig.getParameter<double>("EcalEnergyCut");
66 
67  useDT_ = iConfig.getParameter<bool>("UseDT");
68  useCSC_ = iConfig.getParameter<bool>("UseCSC");
69  useECAL_ = iConfig.getParameter<bool>("UseECAL");
70 
71 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
std::unique_ptr< DTTimingExtractor > theDTTimingExtractor_
std::unique_ptr< MuonSegmentMatcher > theMatcher_
std::unique_ptr< CSCTimingExtractor > theCSCTimingExtractor_
MuonTimingFiller::~MuonTimingFiller ( )

Definition at line 74 of file MuonTimingFiller.cc.

75 {
76 }

Member Function Documentation

void MuonTimingFiller::addEcalTime ( const reco::Muon muon,
TimeMeasurementSequence cmbSeq 
)
private

Definition at line 262 of file MuonTimingFiller.cc.

References reco::Muon::calEnergy(), TimeMeasurementSequence::dstnc, reco::MuonEnergy::ecal_id, reco::MuonEnergy::ecal_position, reco::MuonEnergy::ecal_time, EcalBarrel, ecalEcut_, reco::MuonEnergy::emMax, errorEB_, errorEE_, reco::Muon::isEnergyValid(), TimeMeasurementSequence::local_t0, DetId::subdetId(), TimeMeasurementSequence::totalWeightInvbeta, TimeMeasurementSequence::totalWeightTimeVtx, TimeMeasurementSequence::weightInvbeta, and TimeMeasurementSequence::weightTimeVtx.

Referenced by fillTiming().

263  {
264 
265  reco::MuonEnergy muonE;
266  if (muon.isEnergyValid())
267  muonE = muon.calEnergy();
268 
269  // Cut on the crystal energy and restrict to the ECAL barrel for now
270 // if (muonE.emMax<ecalEcut_ || fabs(muon.eta())>1.5) return;
271  if (muonE.emMax<ecalEcut_) return;
272 
273  // A simple parametrization of the error on the ECAL time measurement
274  double emErr;
275  if (muonE.ecal_id.subdetId()==EcalBarrel) emErr= errorEB_/muonE.emMax; else
276  emErr=errorEE_/muonE.emMax;
277  double hitWeight = 1/(emErr*emErr);
278  double hitDist=muonE.ecal_position.r();
279 
280  cmbSeq.local_t0.push_back(muonE.ecal_time);
281  cmbSeq.weightTimeVtx.push_back(hitWeight);
282  cmbSeq.weightInvbeta.push_back(hitDist*hitDist*hitWeight/(30.*30.));
283 
284  cmbSeq.dstnc.push_back(hitDist);
285 
286  cmbSeq.totalWeightTimeVtx+=hitWeight;
287  cmbSeq.totalWeightInvbeta+=hitDist*hitDist*hitWeight/(30.*30.);
288 
289 }
std::vector< double > local_t0
float ecal_time
Calorimeter timing.
Definition: MuonEnergy.h:37
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
std::vector< double > weightInvbeta
bool isEnergyValid() const
Definition: Muon.h:109
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:111
float emMax
maximal energy of ECAL crystal in the 5x5 shape
Definition: MuonEnergy.h:22
std::vector< double > weightTimeVtx
DetId ecal_id
DetId of the central ECAL crystal.
Definition: MuonEnergy.h:47
std::vector< double > dstnc
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:43
void MuonTimingFiller::combineTMSequences ( const reco::Muon muon,
const TimeMeasurementSequence dtSeq,
const TimeMeasurementSequence cscSeq,
TimeMeasurementSequence cmbSeq 
)
private

Definition at line 234 of file MuonTimingFiller.cc.

References TimeMeasurementSequence::dstnc, mps_fire::i, TimeMeasurementSequence::local_t0, TimeMeasurementSequence::totalWeightInvbeta, TimeMeasurementSequence::totalWeightTimeVtx, useCSC_, useDT_, TimeMeasurementSequence::weightInvbeta, and TimeMeasurementSequence::weightTimeVtx.

Referenced by fillTiming().

237  {
238 
239  if (useDT_) for (unsigned int i=0;i<dtSeq.dstnc.size();i++) {
240  cmbSeq.dstnc.push_back(dtSeq.dstnc.at(i));
241  cmbSeq.local_t0.push_back(dtSeq.local_t0.at(i));
242  cmbSeq.weightTimeVtx.push_back(dtSeq.weightTimeVtx.at(i));
243  cmbSeq.weightInvbeta.push_back(dtSeq.weightInvbeta.at(i));
244 
245  cmbSeq.totalWeightTimeVtx+=dtSeq.weightTimeVtx.at(i);
246  cmbSeq.totalWeightInvbeta+=dtSeq.weightInvbeta.at(i);
247  }
248 
249  if (useCSC_) for (unsigned int i=0;i<cscSeq.dstnc.size();i++) {
250  cmbSeq.dstnc.push_back(cscSeq.dstnc.at(i));
251  cmbSeq.local_t0.push_back(cscSeq.local_t0.at(i));
252  cmbSeq.weightTimeVtx.push_back(cscSeq.weightTimeVtx.at(i));
253  cmbSeq.weightInvbeta.push_back(cscSeq.weightInvbeta.at(i));
254 
255  cmbSeq.totalWeightTimeVtx+=cscSeq.weightTimeVtx.at(i);
256  cmbSeq.totalWeightInvbeta+=cscSeq.weightInvbeta.at(i);
257  }
258 }
std::vector< double > local_t0
std::vector< double > weightInvbeta
std::vector< double > weightTimeVtx
std::vector< double > dstnc
void MuonTimingFiller::fillRPCTime ( const reco::Muon muon,
reco::MuonTime muTime,
edm::Event iEvent 
)
private

Definition at line 202 of file MuonTimingFiller.cc.

References edm::Ref< C, T, F >::isNull(), SiStripPI::max, reco::MuonTime::nDof, mathSSE::sqrt(), reco::Muon::standAloneMuon(), theMatcher_, ntuplemaker::time, reco::MuonTime::timeAtIpInOut, reco::MuonTime::timeAtIpInOutErr, reco::MuonTime::timeAtIpOutIn, and reco::MuonTime::timeAtIpOutInErr.

Referenced by fillTiming().

202  {
203 
204  double trpc=0,trpc2=0;
205 
206  reco::TrackRef staTrack = muon.standAloneMuon();
207  if (staTrack.isNull()) return;
208 
209  const std::vector<const RPCRecHit*> rpcHits = theMatcher_->matchRPC(*staTrack,iEvent);
210  const int nrpc = rpcHits.size();
211  for ( const auto& hitRPC : rpcHits ) {
212  const double time = hitRPC->timeError() < 0 ? hitRPC->BunchX()*25. : hitRPC->time();
213  trpc += time;
214  trpc2 += time*time;
215  }
216 
217  if (nrpc==0) return;
218 
219  trpc2 = trpc2/nrpc;
220  trpc = trpc/nrpc;
221  const double trpcerr = sqrt(std::max(0., trpc2-trpc*trpc));
222 
223  rpcTime.timeAtIpInOut=trpc;
224  rpcTime.timeAtIpInOutErr=trpcerr;
225  rpcTime.nDof=nrpc;
226 
227  // currently unused
228  rpcTime.timeAtIpOutIn=0.;
229  rpcTime.timeAtIpOutInErr=0.;
230 }
T sqrt(T t)
Definition: SSEVec.h:18
std::unique_ptr< MuonSegmentMatcher > theMatcher_
bool isNull() const
Checks for null.
Definition: Ref.h:250
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:52
void MuonTimingFiller::fillTimeFromMeasurements ( const TimeMeasurementSequence tmSeq,
reco::MuonTimeExtra muTime 
)
private

Definition at line 154 of file MuonTimingFiller.cc.

References diffTreeTool::diff, TimeMeasurementSequence::dstnc, mps_fire::i, TimeMeasurementSequence::local_t0, rawFit(), reco::MuonTimeExtra::setFreeInverseBeta(), reco::MuonTimeExtra::setFreeInverseBetaErr(), reco::MuonTimeExtra::setInverseBeta(), reco::MuonTimeExtra::setInverseBetaErr(), reco::MuonTimeExtra::setNDof(), reco::MuonTimeExtra::setTimeAtIpInOut(), reco::MuonTimeExtra::setTimeAtIpInOutErr(), reco::MuonTimeExtra::setTimeAtIpOutIn(), reco::MuonTimeExtra::setTimeAtIpOutInErr(), mathSSE::sqrt(), TimeMeasurementSequence::totalWeightInvbeta, TimeMeasurementSequence::totalWeightTimeVtx, TimeMeasurementSequence::weightInvbeta, TimeMeasurementSequence::weightTimeVtx, x, and y.

Referenced by fillTiming().

154  {
155  std::vector <double> x,y;
156  double invbeta(0), invbetaerr(0);
157  double vertexTime(0), vertexTimeErr(0), vertexTimeR(0), vertexTimeRErr(0);
158  double freeBeta(0), freeBetaErr(0), freeTime(0), freeTimeErr(0);
159 
160  if (tmSeq.dstnc.size()<=1) return;
161 
162  for (unsigned int i=0;i<tmSeq.dstnc.size();i++) {
163  invbeta+=(1.+tmSeq.local_t0.at(i)/tmSeq.dstnc.at(i)*30.)*tmSeq.weightInvbeta.at(i)/tmSeq.totalWeightInvbeta;
164  x.push_back(tmSeq.dstnc.at(i)/30.);
165  y.push_back(tmSeq.local_t0.at(i)+tmSeq.dstnc.at(i)/30.);
166  vertexTime+=tmSeq.local_t0.at(i)*tmSeq.weightTimeVtx.at(i)/tmSeq.totalWeightTimeVtx;
167  vertexTimeR+=(tmSeq.local_t0.at(i)+2*tmSeq.dstnc.at(i)/30.)*tmSeq.weightTimeVtx.at(i)/tmSeq.totalWeightTimeVtx;
168  }
169 
170  double diff;
171  for (unsigned int i=0;i<tmSeq.dstnc.size();i++) {
172  diff=(1.+tmSeq.local_t0.at(i)/tmSeq.dstnc.at(i)*30.)-invbeta;
173  invbetaerr+=diff*diff*tmSeq.weightInvbeta.at(i);
174  diff=tmSeq.local_t0.at(i)-vertexTime;
175  vertexTimeErr+=diff*diff*tmSeq.weightTimeVtx.at(i);
176  diff=tmSeq.local_t0.at(i)+2*tmSeq.dstnc.at(i)/30.-vertexTimeR;
177  vertexTimeRErr+=diff*diff*tmSeq.weightTimeVtx.at(i);
178  }
179 
180  double cf = 1./(tmSeq.dstnc.size()-1);
181  invbetaerr=sqrt(invbetaerr/tmSeq.totalWeightInvbeta*cf);
182  vertexTimeErr=sqrt(vertexTimeErr/tmSeq.totalWeightTimeVtx*cf);
183  vertexTimeRErr=sqrt(vertexTimeRErr/tmSeq.totalWeightTimeVtx*cf);
184 
185  muTime.setInverseBeta(invbeta);
186  muTime.setInverseBetaErr(invbetaerr);
187  muTime.setTimeAtIpInOut(vertexTime);
188  muTime.setTimeAtIpInOutErr(vertexTimeErr);
189  muTime.setTimeAtIpOutIn(vertexTimeR);
190  muTime.setTimeAtIpOutInErr(vertexTimeRErr);
191 
192  rawFit(freeBeta, freeBetaErr, freeTime, freeTimeErr, x, y);
193 
194  muTime.setFreeInverseBeta(freeBeta);
195  muTime.setFreeInverseBetaErr(freeBetaErr);
196 
197  muTime.setNDof(tmSeq.dstnc.size());
198 }
void setTimeAtIpOutInErr(const float timeErr)
Definition: MuonTimeExtra.h:51
std::vector< double > local_t0
void setTimeAtIpOutIn(const float timeIp)
Definition: MuonTimeExtra.h:50
T sqrt(T t)
Definition: SSEVec.h:18
void rawFit(double &a, double &da, double &b, double &db, const std::vector< double > &hitsx, const std::vector< double > &hitsy)
std::vector< double > weightInvbeta
void setNDof(const int nDof)
Definition: MuonTimeExtra.h:23
void setInverseBetaErr(const float iBetaErr)
Definition: MuonTimeExtra.h:30
std::vector< double > weightTimeVtx
void setFreeInverseBetaErr(const float iBetaErr)
Definition: MuonTimeExtra.h:39
std::vector< double > dstnc
void setFreeInverseBeta(const float iBeta)
Definition: MuonTimeExtra.h:38
void setTimeAtIpInOut(const float timeIp)
Definition: MuonTimeExtra.h:45
void setTimeAtIpInOutErr(const float timeErr)
Definition: MuonTimeExtra.h:46
void setInverseBeta(const float iBeta)
Definition: MuonTimeExtra.h:29
void MuonTimingFiller::fillTiming ( const reco::Muon muon,
reco::MuonTimeExtra dtTime,
reco::MuonTimeExtra cscTime,
reco::MuonTime rpcTime,
reco::MuonTimeExtra combinedTime,
edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 84 of file MuonTimingFiller.cc.

References addEcalTime(), reco::MuonSegmentMatch::BelongsToTrackByDR, reco::MuonSegmentMatch::BestInStationByDR, relativeConstraints::chamber, reco::Muon::combinedMuon(), combineTMSequences(), cscSegments_cfi::cscSegments, reco::MuonTimeExtra::direction(), fillRPCTime(), fillTimeFromMeasurements(), reco::MuonTimeExtra::freeInverseBeta(), reco::MuonTimeExtra::freeInverseBetaErr(), iEvent, reco::Muon::innerTrack(), reco::MuonTimeExtra::inverseBeta(), reco::MuonTimeExtra::inverseBetaErr(), edm::Ref< C, T, F >::isNull(), reco::Muon::isTrackerMuon(), LogTrace, reco::Muon::matches(), reco::MuonTimeExtra::nDof(), reco::Muon::standAloneMuon(), theCSCTimingExtractor_, theDTTimingExtractor_, reco::MuonTimeExtra::timeAtIpInOut(), reco::MuonTimeExtra::timeAtIpInOutErr(), reco::MuonTimeExtra::timeAtIpOutIn(), reco::MuonTimeExtra::timeAtIpOutInErr(), and useECAL_.

Referenced by MuonTimingProducer::produce(), and MuonIdProducer::produce().

91 {
92  TimeMeasurementSequence dtTmSeq,cscTmSeq;
93 
94  if ( !(muon.combinedMuon().isNull()) ) {
95  theDTTimingExtractor_->fillTiming(dtTmSeq, muon.combinedMuon(), iEvent, iSetup);
96  theCSCTimingExtractor_->fillTiming(cscTmSeq, muon.combinedMuon(), iEvent, iSetup);
97  } else {
98  if ( !(muon.standAloneMuon().isNull()) ) {
99  theDTTimingExtractor_->fillTiming(dtTmSeq, muon.standAloneMuon(), iEvent, iSetup);
100  theCSCTimingExtractor_->fillTiming(cscTmSeq, muon.standAloneMuon(), iEvent, iSetup);
101  } else {
102  if ( muon.isTrackerMuon() ) {
103  std::vector<const DTRecSegment4D*> dtSegments;
104  std::vector<const CSCSegment*> cscSegments;
105  for( auto& chamber: muon.matches() ){
106  for ( auto& segment : chamber.segmentMatches ){
107  // Use only the segments that passed arbitration to avoid mixing
108  // segments from in-time and out-of-time muons that may bias the result
109  // SegmentAndTrackArbitration
110  if(segment.isMask(reco::MuonSegmentMatch::BestInStationByDR) &&
112  if ( !(segment.dtSegmentRef.isNull()))
113  dtSegments.push_back(segment.dtSegmentRef.get());
114  if ( !(segment.cscSegmentRef.isNull()))
115  cscSegments.push_back(segment.cscSegmentRef.get());
116  }
117  }
118  }
119  theDTTimingExtractor_->fillTiming(dtTmSeq, dtSegments, muon.innerTrack(), iEvent, iSetup);
120  theCSCTimingExtractor_->fillTiming(cscTmSeq, cscSegments, muon.innerTrack(), iEvent, iSetup);
121  }
122  }
123  }
124 
125  // Fill DT-specific timing information block
126  fillTimeFromMeasurements(dtTmSeq, dtTime);
127 
128  // Fill CSC-specific timing information block
129  fillTimeFromMeasurements(cscTmSeq, cscTime);
130 
131  // Fill RPC-specific timing information block
132  fillRPCTime(muon, rpcTime, iEvent);
133 
134  // Combine the TimeMeasurementSequences from DT/CSC subdetectors
135  TimeMeasurementSequence combinedTmSeq;
136  combineTMSequences(muon,dtTmSeq,cscTmSeq,combinedTmSeq);
137  // add ECAL info
138  if (useECAL_) addEcalTime(muon,combinedTmSeq);
139 
140  // Fill the master timing block
141  fillTimeFromMeasurements(combinedTmSeq, combinedTime);
142 
143  LogTrace("MuonTime") << "Global 1/beta: " << combinedTime.inverseBeta() << " +/- " << combinedTime.inverseBetaErr()<<std::endl;
144  LogTrace("MuonTime") << " Free 1/beta: " << combinedTime.freeInverseBeta() << " +/- " << combinedTime.freeInverseBetaErr()<<std::endl;
145  LogTrace("MuonTime") << " Vertex time (in-out): " << combinedTime.timeAtIpInOut() << " +/- " << combinedTime.timeAtIpInOutErr()
146  << " # of points: " << combinedTime.nDof() <<std::endl;
147  LogTrace("MuonTime") << " Vertex time (out-in): " << combinedTime.timeAtIpOutIn() << " +/- " << combinedTime.timeAtIpOutInErr()<<std::endl;
148  LogTrace("MuonTime") << " direction: " << combinedTime.direction() << std::endl;
149 
150 }
void addEcalTime(const reco::Muon &muon, TimeMeasurementSequence &cmbSeq)
float inverseBetaErr() const
Definition: MuonTimeExtra.h:28
void combineTMSequences(const reco::Muon &muon, const TimeMeasurementSequence &dtSeq, const TimeMeasurementSequence &cscSeq, TimeMeasurementSequence &cmbSeq)
std::unique_ptr< DTTimingExtractor > theDTTimingExtractor_
float inverseBeta() const
Definition: MuonTimeExtra.h:27
virtual TrackRef innerTrack() const
Definition: Muon.h:48
void fillRPCTime(const reco::Muon &muon, reco::MuonTime &muTime, edm::Event &iEvent)
Direction direction() const
direction estimation based on time dispersion
Definition: MuonTimeExtra.h:54
float timeAtIpOutInErr() const
Definition: MuonTimeExtra.h:49
int nDof() const
number of measurements used in timing calculation
Definition: MuonTimeExtra.h:22
static const unsigned int BestInStationByDR
bool isTrackerMuon() const override
Definition: Muon.h:277
int iEvent
Definition: GenABIO.cc:230
float timeAtIpInOutErr() const
Definition: MuonTimeExtra.h:44
float freeInverseBetaErr() const
Definition: MuonTimeExtra.h:37
bool isNull() const
Checks for null.
Definition: Ref.h:250
#define LogTrace(id)
void fillTimeFromMeasurements(const TimeMeasurementSequence &tmSeq, reco::MuonTimeExtra &muTime)
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:52
std::unique_ptr< CSCTimingExtractor > theCSCTimingExtractor_
float timeAtIpInOut() const
Definition: MuonTimeExtra.h:43
TrackRef combinedMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:55
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:144
static const unsigned int BelongsToTrackByDR
float freeInverseBeta() const
Definition: MuonTimeExtra.h:36
float timeAtIpOutIn() const
b) particle is moving from outside in
Definition: MuonTimeExtra.h:48
void MuonTimingFiller::rawFit ( double &  a,
double &  da,
double &  b,
double &  db,
const std::vector< double > &  hitsx,
const std::vector< double > &  hitsy 
)
private

Definition at line 294 of file MuonTimingFiller.cc.

References edmIntegrityCheck::d, mps_fire::i, alignCSCRings::s, mathSSE::sqrt(), fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, x, and y.

Referenced by fillTimeFromMeasurements().

295  {
296 
297  double s=0,sx=0,sy=0,x,y;
298  double sxx=0,sxy=0;
299 
300  freeBeta = 0;
301  freeBetaErr = 0;
302  freeTime = 0;
303  freeTimeErr = 0;
304 
305  if (hitsx.empty()) return;
306  if (hitsx.size()==1) {
307  freeTime=hitsy[0];
308  } else {
309  for (unsigned int i = 0; i != hitsx.size(); i++) {
310  x=hitsx[i];
311  y=hitsy[i];
312  sy += y;
313  sxy+= x*y;
314  s += 1.;
315  sx += x;
316  sxx += x*x;
317  }
318 
319  double d = s*sxx - sx*sx;
320  freeTime = (sxx*sy- sx*sxy)/ d;
321  freeBeta = (s*sxy - sx*sy) / d;
322  freeBetaErr = sqrt(sxx/d);
323  freeTimeErr = sqrt(s/d);
324  }
325 }
T sqrt(T t)
Definition: SSEVec.h:18

Member Data Documentation

double MuonTimingFiller::ecalEcut_
private

Definition at line 63 of file MuonTimingFiller.h.

Referenced by addEcalTime(), and MuonTimingFiller().

double MuonTimingFiller::errorEB_
private

Definition at line 63 of file MuonTimingFiller.h.

Referenced by addEcalTime(), and MuonTimingFiller().

double MuonTimingFiller::errorEE_
private

Definition at line 63 of file MuonTimingFiller.h.

Referenced by addEcalTime(), and MuonTimingFiller().

std::unique_ptr<CSCTimingExtractor> MuonTimingFiller::theCSCTimingExtractor_
private

Definition at line 62 of file MuonTimingFiller.h.

Referenced by fillTiming(), and MuonTimingFiller().

std::unique_ptr<DTTimingExtractor> MuonTimingFiller::theDTTimingExtractor_
private

Definition at line 61 of file MuonTimingFiller.h.

Referenced by fillTiming(), and MuonTimingFiller().

std::unique_ptr<MuonSegmentMatcher> MuonTimingFiller::theMatcher_
private

Definition at line 60 of file MuonTimingFiller.h.

Referenced by fillRPCTime(), and MuonTimingFiller().

bool MuonTimingFiller::useCSC_
private

Definition at line 64 of file MuonTimingFiller.h.

Referenced by combineTMSequences(), and MuonTimingFiller().

bool MuonTimingFiller::useDT_
private

Definition at line 64 of file MuonTimingFiller.h.

Referenced by combineTMSequences(), and MuonTimingFiller().

bool MuonTimingFiller::useECAL_
private

Definition at line 64 of file MuonTimingFiller.h.

Referenced by fillTiming(), and MuonTimingFiller().