本文整理汇总了C++中Track::At方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::At方法的具体用法?C++ Track::At怎么用?C++ Track::At使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::At方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkLayerOrientation
void Tracks::checkLayerOrientation() {
Float_t n[nLayers-1], x[nLayers-1], y[nLayers-1];
Float_t dx, dy;
Track * thisTrack = nullptr;
Cluster * lastCluster = nullptr;
Cluster * thisCluster = nullptr;
Int_t first = 0;
for (Int_t i=0; i<GetEntriesFast(); i++) {
thisTrack = At(i);
if (!At(first)) first = 1;
if (!At(first)) continue;
lastCluster = thisTrack->At(first);
for (Int_t j=first+1; j<thisTrack->GetEntriesFast(); j++) {
thisCluster = thisTrack->At(j);
dx = thisCluster->getX() - lastCluster->getX();
dy = thisCluster->getY() - lastCluster->getY();
x[j] += dx;
y[j] += dy;
n[j]++;
lastCluster = thisCluster;
}
}
cout << "The average track movement between layers is: ";
for (Int_t i=0; i<nLayers-1; i++) {
if (n[i]) {
cout << Form("Layer %d: (%.1f, %.1f), ", i, x[i]/n[i], y[i]/n[i]);
}
}
cout << ".\n";
}
示例2: isLastEventIDCloseToFirst
Bool_t Tracks::isLastEventIDCloseToFirst(Int_t trackIdx) {
Track * track = At(trackIdx);
Cluster * comparisonCluster = nullptr;
Int_t lastEventID = track->Last()->getEventID();
Int_t firstEventID = track->getEventID(0);
Int_t comparisonEventID;
Float_t deltaXY, deltaPHI, phi1, phi2;
Int_t comparisonIdx;
if (!track) return false;
if (!track->At(0)) return false;
if (track->isFirstAndLastEventIDEqual()) return true;
else {
// check first against last ID
comparisonIdx = getTrackIdxFromFirstLayerEID(lastEventID);
if (comparisonIdx < 0) return true;
comparisonCluster = At(comparisonIdx)->At(0);
if (!comparisonCluster) return false;
deltaXY = diffmmXY(track->At(0), comparisonCluster);
phi1 = track->getSlopeAngleAtLayer(1);
phi2 = At(comparisonIdx)->getSlopeAngleAtLayer(1);
deltaPHI = fabs(phi1 - phi2);
if (deltaXY < 0.5 && deltaPHI < 0.5) {
cout << "OK! deltaXY = " << deltaXY << "and angles (" << phi1 << ", " << phi2 << "(\n";
cout << "A = " << *track << endl;
cout << "B = " << *At(comparisonIdx) << endl;
return true;
}
// check last against first ID
comparisonIdx = getTrackIdxFromLastLayerEID(firstEventID);
if (comparisonIdx < 0) return true;
comparisonCluster = At(comparisonIdx)->Last();
if (!comparisonCluster) return false;
deltaXY = diffmmXY(track->Last(), comparisonCluster);
phi1 = track->getSlopeAngleAtLayer(track->GetEntriesFast()-1);
phi2 = At(comparisonIdx)->getSlopeAngleAtLayer(At(comparisonIdx)->GetEntriesFast()-1);
deltaPHI = fabs(phi1 - phi2);
if (deltaXY < 0.5 && deltaPHI < 0.5) {
return true;
}
}
return false;
}
示例3: At
vector<Int_t> * Tracks::getTracksFromCluster(Cluster * cluster) {
Track * thisTrack = nullptr;
vector<Int_t> * tracksWithCluster = new vector<Int_t>;
Int_t idx;
for (Int_t i=0; i<GetEntriesFast(); i++) {
thisTrack = At(i);
if (!thisTrack) continue;
if (thisTrack->isClusterInTrack(cluster)) {
idx = thisTrack->getClusterIdx(cluster);
thisTrack->At(idx)->markUsed();
tracksWithCluster->push_back(i);
}
}
return tracksWithCluster;
}
示例4: matchWithEventIDs
void Tracks::matchWithEventIDs(Hits * eventIDs) {
// Use the Monte Carlo truth list eventIDs (x, y, layer, actual event)
// and find the closes match for each item in list
// then set truth eventID to the Tracks->Track->Cluster object
Float_t minDist = 1e5; // px
Float_t thisDist = 0;
Track * thisTrack = nullptr;
Cluster * thisCluster = nullptr;
Hit * thisHit = nullptr;
Int_t layer = -1;
Int_t minIdx = 0;
Bool_t doLoop = true;
Int_t nHits = eventIDs->GetEntriesFast();
Float_t cX, cY;
Int_t nClusters = 0;
for (Int_t t=0; t<GetEntriesFast(); t++) {
thisTrack = At(t);
if (!thisTrack) continue;
nClusters += thisTrack->GetEntriesFast();
for (Int_t c=0; c<thisTrack->GetEntriesFast(); c++) {
thisCluster = thisTrack->At(c);
layer = thisCluster->getLayer();
cX = thisCluster->getX();
cY = thisCluster->getY();
// Optimization:
// If thisCluster+1 is also eventIDs+1, don't loop to see if we can find it
// But instead just use minIdx++ ;-)
minDist = diffXY(thisCluster, eventIDs->At(minIdx+1));
if (minDist < 10) {
minIdx++;
doLoop = false;
}
else {
doLoop = true;
minDist = 1e5;
minIdx = -1;
}
if (doLoop) {
for (Int_t h=0; h<eventIDs->GetEntriesFast(); h++) {
thisHit = eventIDs->At(h);
if (!thisHit) continue;
if (thisHit->getLayer() != layer) continue;
if (fabs(cX - thisHit->getX()) < 10) {
if (fabs(cY - thisHit->getY()) < 10) {
thisDist = diffXY(thisCluster, thisHit);
if (thisDist < minDist) {
minDist = thisDist;
minIdx = h;
}
}
}
}
}
if (minIdx >= 0 && minDist < 14) {
thisCluster->setEventID(eventIDs->getEventID(minIdx));
eventIDs->removeHitAt(minIdx);
}
}
}
Int_t cWithoutEventID = 0;
for (Int_t t=0; t<GetEntriesFast(); t++) {
for (Int_t c=0; c<At(t)->GetEntriesFast(); c++) {
if (At(t)->getEventID(c) < 0) {
cWithoutEventID++;
}
}
}
cout << "Number of clusters without eventID: " << cWithoutEventID << "( " << (float) cWithoutEventID / nClusters * 100 << "%)\n";
}