#include <RecoMuon/MuonIdentification/src/MuonTimingFiller.cc>
Public Member Functions | |
void | fillTiming (const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup) |
MuonTimingFiller (const edm::ParameterSet &) | |
~MuonTimingFiller () | |
Private Member Functions | |
void | addEcalTime (const reco::Muon &muon, TimeMeasurementSequence &cmbSeq) |
void | combineTMSequences (const reco::Muon &muon, TimeMeasurementSequence dtSeq, TimeMeasurementSequence cscSeq, TimeMeasurementSequence &cmbSeq) |
void | fillTimeFromMeasurements (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_ |
CSCTimingExtractor * | theCSCTimingExtractor_ |
DTTimingExtractor * | theDTTimingExtractor_ |
bool | useCSC_ |
bool | useDT_ |
bool | useECAL_ |
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 43 of file MuonTimingFiller.h.
MuonTimingFiller::MuonTimingFiller | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 44 of file MuonTimingFiller.cc.
References ecalEcut_, errorEB_, errorEE_, edm::ParameterSet::getParameter(), theCSCTimingExtractor_, theDTTimingExtractor_, useCSC_, useDT_, and useECAL_.
{ // Load parameters for the DTTimingExtractor edm::ParameterSet dtTimingParameters = iConfig.getParameter<edm::ParameterSet>("DTTimingParameters"); theDTTimingExtractor_ = new DTTimingExtractor(dtTimingParameters); // Load parameters for the CSCTimingExtractor edm::ParameterSet cscTimingParameters = iConfig.getParameter<edm::ParameterSet>("CSCTimingParameters"); theCSCTimingExtractor_ = new CSCTimingExtractor(cscTimingParameters); errorEB_ = iConfig.getParameter<double>("ErrorEB"); errorEE_ = iConfig.getParameter<double>("ErrorEE"); ecalEcut_ = iConfig.getParameter<double>("EcalEnergyCut"); useDT_ = iConfig.getParameter<bool>("UseDT"); useCSC_ = iConfig.getParameter<bool>("UseCSC"); useECAL_ = iConfig.getParameter<bool>("UseECAL"); }
MuonTimingFiller::~MuonTimingFiller | ( | ) |
Definition at line 65 of file MuonTimingFiller.cc.
References theCSCTimingExtractor_, and theDTTimingExtractor_.
{ if (theDTTimingExtractor_) delete theDTTimingExtractor_; if (theCSCTimingExtractor_) delete theCSCTimingExtractor_; }
void MuonTimingFiller::addEcalTime | ( | const reco::Muon & | muon, |
TimeMeasurementSequence & | cmbSeq | ||
) | [private] |
Definition at line 192 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::totalWeightVertex, TimeMeasurementSequence::weightInvbeta, and TimeMeasurementSequence::weightVertex.
Referenced by fillTiming().
{ reco::MuonEnergy muonE; if (muon.isEnergyValid()) muonE = muon.calEnergy(); // Cut on the crystal energy and restrict to the ECAL barrel for now // if (muonE.emMax<ecalEcut_ || fabs(muon.eta())>1.5) return; if (muonE.emMax<ecalEcut_) return; // A simple parametrization of the error on the ECAL time measurement double emErr; if (muonE.ecal_id.subdetId()==EcalBarrel) emErr= errorEB_/muonE.emMax; else emErr=errorEE_/muonE.emMax; double hitWeight = 1/(emErr*emErr); double hitDist=muonE.ecal_position.r(); cmbSeq.local_t0.push_back(muonE.ecal_time); cmbSeq.weightVertex.push_back(hitWeight); cmbSeq.weightInvbeta.push_back(hitDist*hitDist*hitWeight/(30.*30.)); cmbSeq.dstnc.push_back(hitDist); cmbSeq.totalWeightVertex+=hitWeight; cmbSeq.totalWeightInvbeta+=hitDist*hitDist*hitWeight/(30.*30.); }
void MuonTimingFiller::combineTMSequences | ( | const reco::Muon & | muon, |
TimeMeasurementSequence | dtSeq, | ||
TimeMeasurementSequence | cscSeq, | ||
TimeMeasurementSequence & | cmbSeq | ||
) | [private] |
Definition at line 164 of file MuonTimingFiller.cc.
References TimeMeasurementSequence::dstnc, i, TimeMeasurementSequence::local_t0, TimeMeasurementSequence::totalWeightInvbeta, TimeMeasurementSequence::totalWeightVertex, useCSC_, useDT_, TimeMeasurementSequence::weightInvbeta, and TimeMeasurementSequence::weightVertex.
Referenced by fillTiming().
{ if (useDT_) for (unsigned int i=0;i<dtSeq.dstnc.size();i++) { cmbSeq.dstnc.push_back(dtSeq.dstnc.at(i)); cmbSeq.local_t0.push_back(dtSeq.local_t0.at(i)); cmbSeq.weightVertex.push_back(dtSeq.weightVertex.at(i)); cmbSeq.weightInvbeta.push_back(dtSeq.weightInvbeta.at(i)); cmbSeq.totalWeightVertex+=dtSeq.weightVertex.at(i); cmbSeq.totalWeightInvbeta+=dtSeq.weightInvbeta.at(i); } if (useCSC_) for (unsigned int i=0;i<cscSeq.dstnc.size();i++) { cmbSeq.dstnc.push_back(cscSeq.dstnc.at(i)); cmbSeq.local_t0.push_back(cscSeq.local_t0.at(i)); cmbSeq.weightVertex.push_back(cscSeq.weightVertex.at(i)); cmbSeq.weightInvbeta.push_back(cscSeq.weightInvbeta.at(i)); cmbSeq.totalWeightVertex+=cscSeq.weightVertex.at(i); cmbSeq.totalWeightInvbeta+=cscSeq.weightInvbeta.at(i); } }
void MuonTimingFiller::fillTimeFromMeasurements | ( | TimeMeasurementSequence | tmSeq, |
reco::MuonTimeExtra & | muTime | ||
) | [private] |
Definition at line 116 of file MuonTimingFiller.cc.
References diffTreeTool::diff, TimeMeasurementSequence::dstnc, 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::totalWeightVertex, TimeMeasurementSequence::weightInvbeta, TimeMeasurementSequence::weightVertex, x, and detailsBasic3DVector::y.
Referenced by fillTiming().
{ std::vector <double> x,y; double invbeta=0, invbetaerr=0; double vertexTime=0, vertexTimeErr=0, vertexTimeR=0, vertexTimeRErr=0; double freeBeta, freeBetaErr, freeTime, freeTimeErr; if (tmSeq.dstnc.size()<=1) return; for (unsigned int i=0;i<tmSeq.dstnc.size();i++) { invbeta+=(1.+tmSeq.local_t0.at(i)/tmSeq.dstnc.at(i)*30.)*tmSeq.weightInvbeta.at(i)/tmSeq.totalWeightInvbeta; x.push_back(tmSeq.dstnc.at(i)/30.); y.push_back(tmSeq.local_t0.at(i)+tmSeq.dstnc.at(i)/30.); vertexTime+=tmSeq.local_t0.at(i)*tmSeq.weightVertex.at(i)/tmSeq.totalWeightVertex; vertexTimeR+=(tmSeq.local_t0.at(i)+2*tmSeq.dstnc.at(i)/30.)*tmSeq.weightVertex.at(i)/tmSeq.totalWeightVertex; } double diff; for (unsigned int i=0;i<tmSeq.dstnc.size();i++) { diff=(1.+tmSeq.local_t0.at(i)/tmSeq.dstnc.at(i)*30.)-invbeta; invbetaerr+=diff*diff*tmSeq.weightInvbeta.at(i); diff=tmSeq.local_t0.at(i)-vertexTime; vertexTimeErr+=diff*diff*tmSeq.weightVertex.at(i); diff=tmSeq.local_t0.at(i)+2*tmSeq.dstnc.at(i)/30.-vertexTimeR; vertexTimeRErr+=diff*diff*tmSeq.weightVertex.at(i); } double cf = 1./(tmSeq.dstnc.size()-1); invbetaerr=sqrt(invbetaerr/tmSeq.totalWeightInvbeta*cf); vertexTimeErr=sqrt(vertexTimeErr/tmSeq.totalWeightVertex*cf); vertexTimeRErr=sqrt(vertexTimeRErr/tmSeq.totalWeightVertex*cf); muTime.setInverseBeta(invbeta); muTime.setInverseBetaErr(invbetaerr); muTime.setTimeAtIpInOut(vertexTime); muTime.setTimeAtIpInOutErr(vertexTimeErr); muTime.setTimeAtIpOutIn(vertexTimeR); muTime.setTimeAtIpOutInErr(vertexTimeRErr); rawFit(freeBeta, freeBetaErr, freeTime, freeTimeErr, x, y); muTime.setFreeInverseBeta(freeBeta); muTime.setFreeInverseBetaErr(freeBetaErr); muTime.setNDof(tmSeq.dstnc.size()); }
void MuonTimingFiller::fillTiming | ( | const reco::Muon & | muon, |
reco::MuonTimeExtra & | dtTime, | ||
reco::MuonTimeExtra & | cscTime, | ||
reco::MuonTimeExtra & | combinedTime, | ||
edm::Event & | iEvent, | ||
const edm::EventSetup & | iSetup | ||
) |
Definition at line 77 of file MuonTimingFiller.cc.
References addEcalTime(), reco::Muon::combinedMuon(), combineTMSequences(), reco::MuonTimeExtra::direction(), fillTimeFromMeasurements(), DTTimingExtractor::fillTiming(), CSCTimingExtractor::fillTiming(), reco::MuonTimeExtra::freeInverseBeta(), reco::MuonTimeExtra::freeInverseBetaErr(), iEvent, reco::MuonTimeExtra::inverseBeta(), reco::MuonTimeExtra::inverseBetaErr(), LogTrace, reco::MuonTimeExtra::nDof(), reco::Muon::standAloneMuon(), theCSCTimingExtractor_, theDTTimingExtractor_, reco::MuonTimeExtra::timeAtIpInOut(), reco::MuonTimeExtra::timeAtIpInOutErr(), reco::MuonTimeExtra::timeAtIpOutIn(), reco::MuonTimeExtra::timeAtIpOutInErr(), and useECAL_.
Referenced by MuonIdProducer::produce(), and MuonTimingProducer::produce().
{ TimeMeasurementSequence dtTmSeq,cscTmSeq; if ( !(muon.combinedMuon().isNull()) ) { theDTTimingExtractor_->fillTiming(dtTmSeq, muon.combinedMuon(), iEvent, iSetup); theCSCTimingExtractor_->fillTiming(cscTmSeq, muon.combinedMuon(), iEvent, iSetup); } else if ( !(muon.standAloneMuon().isNull()) ) { theDTTimingExtractor_->fillTiming(dtTmSeq, muon.standAloneMuon(), iEvent, iSetup); theCSCTimingExtractor_->fillTiming(cscTmSeq, muon.standAloneMuon(), iEvent, iSetup); } // Fill DT-specific timing information block fillTimeFromMeasurements(dtTmSeq, dtTime); // Fill CSC-specific timing information block fillTimeFromMeasurements(cscTmSeq, cscTime); // Combine the TimeMeasurementSequences from all subdetectors TimeMeasurementSequence combinedTmSeq; combineTMSequences(muon,dtTmSeq,cscTmSeq,combinedTmSeq); // add ECAL info if (useECAL_) addEcalTime(muon,combinedTmSeq); // Fill the master timing block fillTimeFromMeasurements(combinedTmSeq, combinedTime); LogTrace("MuonTime") << "Global 1/beta: " << combinedTime.inverseBeta() << " +/- " << combinedTime.inverseBetaErr()<<std::endl; LogTrace("MuonTime") << " Free 1/beta: " << combinedTime.freeInverseBeta() << " +/- " << combinedTime.freeInverseBetaErr()<<std::endl; LogTrace("MuonTime") << " Vertex time (in-out): " << combinedTime.timeAtIpInOut() << " +/- " << combinedTime.timeAtIpInOutErr() << " # of points: " << combinedTime.nDof() <<std::endl; LogTrace("MuonTime") << " Vertex time (out-in): " << combinedTime.timeAtIpOutIn() << " +/- " << combinedTime.timeAtIpOutInErr()<<std::endl; LogTrace("MuonTime") << " direction: " << combinedTime.direction() << std::endl; }
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 445 of file DTMeantimerPatternReco.cc.
References i, alignCSCRings::s, x, and detailsBasic3DVector::y.
Referenced by fillTimeFromMeasurements().
{ double s=0,sx=0,sy=0,x,y; double sxx=0,sxy=0; a=b=0; if (hits.size()==0) return; if (hits.size()==1) { b=(*(hits.begin())).second; } else { for (unsigned int i = 0; i != hits.size(); i++) { x=hits[i].first; y=hits[i].second; sy += y; sxy+= x*y; s += 1.; sx += x; sxx += x*x; } // protect against a vertical line??? double d = s*sxx - sx*sx; b = (sxx*sy- sx*sxy)/ d; a = (s*sxy - sx*sy) / d; } }
double MuonTimingFiller::ecalEcut_ [private] |
Definition at line 61 of file MuonTimingFiller.h.
Referenced by addEcalTime(), and MuonTimingFiller().
double MuonTimingFiller::errorEB_ [private] |
Definition at line 61 of file MuonTimingFiller.h.
Referenced by addEcalTime(), and MuonTimingFiller().
double MuonTimingFiller::errorEE_ [private] |
Definition at line 61 of file MuonTimingFiller.h.
Referenced by addEcalTime(), and MuonTimingFiller().
Definition at line 60 of file MuonTimingFiller.h.
Referenced by fillTiming(), MuonTimingFiller(), and ~MuonTimingFiller().
Definition at line 59 of file MuonTimingFiller.h.
Referenced by fillTiming(), MuonTimingFiller(), and ~MuonTimingFiller().
bool MuonTimingFiller::useCSC_ [private] |
Definition at line 62 of file MuonTimingFiller.h.
Referenced by combineTMSequences(), and MuonTimingFiller().
bool MuonTimingFiller::useDT_ [private] |
Definition at line 62 of file MuonTimingFiller.h.
Referenced by combineTMSequences(), and MuonTimingFiller().
bool MuonTimingFiller::useECAL_ [private] |
Definition at line 62 of file MuonTimingFiller.h.
Referenced by fillTiming(), and MuonTimingFiller().