本文整理汇总了C++中Hit::getX方法的典型用法代码示例。如果您正苦于以下问题:C++ Hit::getX方法的具体用法?C++ Hit::getX怎么用?C++ Hit::getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hit
的用法示例。
在下文中一共展示了Hit::getX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matchWithEventIDs
void Clusters::matchWithEventIDs(Hits * eventIDs) {
Float_t minDist = 1e5; // pixels
Float_t thisDist = 0;
Cluster * thisCluster = nullptr;
Hit * thisHit = nullptr;
Int_t layer = -1;
Int_t minIdx = -1;
Bool_t doLoop = true;
Int_t cWithoutEventID = 0;
Float_t cX, cY;
Int_t nClusters = GetEntries();
Int_t nHits = eventIDs->GetEntriesFast();
for (Int_t c=0; c<GetEntriesFast(); c++) {
thisCluster = At(c);
if (!thisCluster) continue;
layer = thisCluster->getLayer();
cX = thisCluster->getX();
cY = thisCluster->getY();
minDist = 1e5;
minIdx = -1;
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 < 10) {
thisCluster->setEventID(eventIDs->getEventID(minIdx));
eventIDs->removeHitAt(minIdx);
}
}
for (Int_t c=0; c<GetEntriesFast(); c++) {
if (!At(c)) continue;
if (getEventID(c) < 0) cWithoutEventID++;
}
// cout << "Number of clusters without eventID: " << cWithoutEventID << " (" << (float) cWithoutEventID / nClusters * 100 << "%)" << endl;
}
示例2: if
void Track::extrapolateToLayer0() {
Int_t nTracks = GetEntriesFast();
Int_t eventID = -1;
if (!At(0)) {
// OK, no information in first layer
// now GetLayer(1) should be 1, and GetLayer(2) should be 2
// If both layer 0 and 2 are skipped, some more extrapolation should be done
// maybe set new x as [1.x - slope.x * (2.z - 1.z)]
Hit *slope = new Hit();
if (!At(1)) {
cout << "No pointer for At(1) as well... Aborting this track extrapolation.\n";
return;
}
else {
eventID = At(1)->getEventID();
if (getLayer(1) == 0) return; // hotfix... Why is layer 0 sometimes placed in idx 1? Must fix this.
}
if (At(2)) {
slope->set(getX(2) - getX(1), getY(2) - getY(1), getLayer(2) - getLayer(1));
if (eventID<0) eventID = At(2)->getEventID();
}
else if (!At(2) && At(3)) {
slope->set(getX(3) - getX(1), getY(3) - getY(1), getLayer(3) - getLayer(1));
if (eventID<0) eventID = At(3)->getEventID();
}
else {
cout << "Too many holes (!At(0), At(1), !At(2), !At(3), .....), aborting this track extrapolation.\n";
return;
}
// must create pointer!
Cluster *newStart = (Cluster*) track_.ConstructedAt(0);
newStart->set(getX(1) - slope->getLayer() * slope->getX(), // new x
getY(1) - slope->getLayer() * slope->getY(), // new y
0); // layer = 0
newStart->setEventID(eventID);
}
}
示例3: 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";
}