Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precise RPCTime in muons #18681

Merged
merged 2 commits into from May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions DataFormats/RPCRecHit/src/RPCRecHit.cc
Expand Up @@ -10,20 +10,20 @@

RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx) : RecHit2DLocalPos(rpcId),
theRPCId(rpcId), theBx(bx),theFirstStrip(99),theClusterSize(99), theLocalPosition(), theLocalError(),
theTime(0), theTimeError(0)
theTime(0), theTimeError(-1)
{
}

RPCRecHit::RPCRecHit() : RecHit2DLocalPos(),
theRPCId(), theBx(99),theFirstStrip(99),theClusterSize(99), theLocalPosition(), theLocalError(),
theTime(0), theTimeError(0)
theTime(0), theTimeError(-1)
{
}


RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos) : RecHit2DLocalPos(rpcId),
theRPCId(rpcId), theBx(bx), theFirstStrip(99),theClusterSize(99), theLocalPosition(pos),
theTime(0), theTimeError(0)
theTime(0), theTimeError(-1)
{
float stripResolution = 3.0 ; //cm this sould be taken from trimmed cluster size times strip size
// taken out from geometry service i.e. topology
Expand All @@ -39,7 +39,7 @@ RPCRecHit::RPCRecHit(const RPCDetId& rpcId,
const LocalPoint& pos,
const LocalError& err) : RecHit2DLocalPos(rpcId),
theRPCId(rpcId), theBx(bx),theFirstStrip(99), theClusterSize(99), theLocalPosition(pos), theLocalError(err),
theTime(0), theTimeError(0)
theTime(0), theTimeError(-1)
{
}

Expand All @@ -52,7 +52,7 @@ RPCRecHit::RPCRecHit(const RPCDetId& rpcId,
const LocalPoint& pos,
const LocalError& err) : RecHit2DLocalPos(rpcId),
theRPCId(rpcId), theBx(bx),theFirstStrip(firstStrip), theClusterSize(clustSize), theLocalPosition(pos), theLocalError(err),
theTime(0), theTimeError(0)
theTime(0), theTimeError(-1)
{
}

Expand Down
2 changes: 1 addition & 1 deletion RecoLocalMuon/RPCRecHit/src/RPCRecHitBaseAlgo.cc
Expand Up @@ -40,7 +40,7 @@ edm::OwnVector<RPCRecHit> RPCRecHitBaseAlgo::reconstruct(const RPCRoll& roll,
const int firstClustStrip = cl.firstStrip();
const int clusterSize = cl.clusterSize();
RPCRecHit* recHit = new RPCRecHit(rpcId,cl.bx(),firstClustStrip,clusterSize,point,tmpErr);
if ( timeErr >= 0 ) recHit->setTimeAndError(time, timeErr);
recHit->setTimeAndError(time, timeErr);

result.push_back(recHit);
}
Expand Down
22 changes: 11 additions & 11 deletions RecoMuon/MuonIdentification/src/MuonTimingFiller.cc
Expand Up @@ -179,31 +179,31 @@ MuonTimingFiller::fillTimeFromMeasurements( const TimeMeasurementSequence& tmSeq
void
MuonTimingFiller::fillRPCTime( const reco::Muon& muon, reco::MuonTime &rpcTime, edm::Event& iEvent ) {

int nrpc=0;
double trpc=0,trpc2=0,trpcerr=0;
double trpc=0,trpc2=0;

reco::TrackRef staTrack = muon.standAloneMuon();
if (staTrack.isNull()) return;

std::vector<const RPCRecHit*> rpcHits = theMatcher_->matchRPC(*staTrack,iEvent);
for (std::vector<const RPCRecHit*>::const_iterator hitRPC = rpcHits.begin(); hitRPC != rpcHits.end(); hitRPC++) {
nrpc++;
trpc+=(*hitRPC)->BunchX();
trpc2+=(*hitRPC)->BunchX()*(*hitRPC)->BunchX();
const std::vector<const RPCRecHit*> rpcHits = theMatcher_->matchRPC(*staTrack,iEvent);
const int nrpc = rpcHits.size();
for ( const auto& hitRPC : rpcHits ) {
const double time = hitRPC->timeError() < 0 ? hitRPC->BunchX()*25. : hitRPC->time();
trpc += time;
trpc2 += time*time;
}

if (nrpc==0) return;

trpc2=trpc2/(double)nrpc*25.*25.;
trpc=trpc/(double)nrpc*25.;
trpcerr=sqrt(trpc2-trpc*trpc);
trpc2 = trpc2/nrpc;
trpc = trpc/nrpc;
const double trpcerr = sqrt(std::max(0., trpc2-trpc*trpc));

rpcTime.timeAtIpInOut=trpc;
rpcTime.timeAtIpInOutErr=trpcerr;
rpcTime.nDof=nrpc;

// currently unused
rpcTime.timeAtIpOutIn=0.;
rpcTime.timeAtIpOutIn=0.;
rpcTime.timeAtIpOutInErr=0.;
}

Expand Down