本文整理汇总了C++中Trajectory::add_node方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::add_node方法的具体用法?C++ Trajectory::add_node怎么用?C++ Trajectory::add_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trajectory
的用法示例。
在下文中一共展示了Trajectory::add_node方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSingleTrajectory
//*************************************************************
bool fitter::CreateSingleTrajectory(Trajectory& traj) {
//*************************************************************
_m.message("+++ CreateSingleTrajectory function ++++",bhep::VERBOSE);
//--------- add measurements to trajectory --------//
///create the trajectory
std::vector<cluster*>::iterator it1;
for (it1 = _meas.begin();it1 != _meas.end();it1++){
RecObject* ro = new RecObject();
ro = dynamic_cast<RecObject*>(*it1);
Node temp;
temp.set_measurement(*ro);
traj.add_node(temp);
// measurement( *(*it1) );
}
_m.message("Trajectory created:",traj,bhep::VVERBOSE);
return true;
}
示例2: rec_had_edep
//*************************************************************
void fitter::rec_had_edep(int j){
//*************************************************************
double hadEdep = 0;
EVector hadCentroid = EVector(3,0);
std::vector<cluster*> hadHits;
// create a new trajectory based on the hadron hits alone.
Trajectory* hadTraj = new Trajectory();
double minZ=999999.9, maxZ=-99999.9;
_nonMuonEdep.push_back(0.0);
_nonMuonHits.push_back(0);
_showerDir.push_back(EVector(3,0));
_showerVertZ.push_back(0.0);
_showerNplanes.push_back(0);
_showerXtent.push_back(0.0);
if((int)_trajs.size() != 0 && j != (int)_trajs.size()) {
//sort the trajectories
sort( _trajs.begin(), _trajs.end(), sortTrajByLength());
//loop over trajectories
EVector hadCentroid = EVector(3,0);
for(int i=0; i<(int)_trajs.size(); i++){
hadHits = _hadmeas;
// cout<<i<<" _muonindex[i] ="<< _muonindex[i]<<endl;
// if(i == _muonindex[i]) continue;
if(i == j) continue;
Trajectory& traj = *_trajs[i];
std::vector<Node*> hits = traj.nodes();
//Add total non-muon hits
_nonMuonHits[j] += hits.size();
for ( int iHit=0; iHit < (int)hits.size(); iHit++){
EVector hpos = EVector(3,0);
hpos[0] = hits[iHit]->measurement().position()[0];
hpos[1] = hits[iHit]->measurement().position()[1];
hpos[2] = hits[iHit]->measurement().position()[2] ;
if(hpos[2] < minZ) minZ = hpos[2];
if(hpos[2] > maxZ) maxZ = hpos[2];
hadEdep += get_classifier().correctEdep((hits[iHit]->measurement().hv("energy").vector()[0])*MeV,hpos[0],hpos[1],hpos[2]);
//sum of position to calculate centroid
hadCentroid[0] += hpos[0];
hadCentroid[1] += hpos[1];
hadCentroid[2] += hpos[2];
}
_m.message("i=",i," hits =",hits.size()," _nonMuonHits=",_nonMuonHits[j]," hadEdep = ",hadEdep," hadHits=",hadHits.size(),bhep::VERBOSE);
}
}
else
hadHits = _meas;
// total edep for non-muon hits
_nonMuonEdep[j] += hadEdep ;
_nonMuonHits[j] += hadHits.size();
_m.message(" hadHits=",hadHits.size(),bhep::VERBOSE);
if(hadHits.size() !=0){
for(int ih=0;ih<(int)hadHits.size();ih++){
RecObject* ro = dynamic_cast<RecObject*>(hadHits[ih]);
hadTraj->add_node(Node(*ro));
EVector hadPos = EVector(3,0);
hadPos[0] = hadHits[ih]->position()[0];
hadPos[1] = hadHits[ih]->position()[1];
hadPos[2] = hadHits[ih]->position()[2];
if(hadPos[2] < minZ) minZ = hadPos[2];
if(hadPos[2] > maxZ) maxZ = hadPos[2];
//edep
_nonMuonEdep[j] += get_classifier().correctEdep((hadHits[ih]->get_eng())*MeV,hadPos[0],hadPos[1],hadPos[2]) ;
//sum of position to calculate centroid
hadCentroid[0] += hadPos[0];
hadCentroid[1] += hadPos[1];
hadCentroid[2] += hadPos[2];
}
}
// else hadCentroid = EVector(3,0);
//calculate the centroid
if (_nonMuonHits[j]) hadCentroid /= _nonMuonHits[j];
else hadCentroid = EVector(3,0);
_m.message(" hadEdep= ",hadEdep," nonMuonEdep= ",_nonMuonEdep[j]," nonMuonHits= ",_nonMuonHits[j],bhep::VERBOSE);
//direction w.r.t reconstructed vertex
double dxdz=0, dydz=0, dz = 0, norm = 0;
EVector vertex = EVector(3,0);
// reconstructed vertex
if(_trajs.size() != 0
&& _trajs[0]->quality("fitcheck") > 0 && _trajs[0]->quality("fitted"))
//.........这里部分代码省略.........