Exemple #1
0
Measurement* getMeasurement(bhep::hit& hit)
{
  EVector hit_pos(2,0);
  EVector meas_pos(3,0);
  
  meas_pos[0] = hit.x()[0];
  meas_pos[1] = hit.x()[1];
  meas_pos[2] = hit.x()[2];
  
  hit_pos[0] = meas_pos[0];
  hit_pos[1] = meas_pos[1];

  //covariance and meastype hardwired for now.
  EMatrix cov(2,2,0);
  cov[0][0] = 1.; cov[1][1] = 1.;
  string meastype = "xy";

  Measurement* me = new Measurement();
  me->set_name(meastype);
  me->set_hv(HyperVector(hit_pos,cov));
  me->set_name("volume", "Detector");
  me->set_position( meas_pos );

  //Add the hit energy deposit as a key to the Measurement.
  const dict::Key Edep = "E_dep";
  const dict::Key EdepVal = hit.data("E_dep");
  me->set_name(Edep, EdepVal);

  return me;
}
Exemple #2
0
//--------------------------------------------------------------------
  RP::Trajectory* KFSvcManager::CreateTrajectory(std::vector<const Hit* > hits, 
                                                std::vector<double> hitErrors) 
//--------------------------------------------------------------------
  {
    
    log4cpp::Category& klog = log4cpp::Category::getRoot();

    klog << log4cpp::Priority::DEBUG << " In CreateTrajectory --> " ;
  
    klog << log4cpp::Priority::DEBUG << "Cov Matrix --> " ;
    EVector m(3,0);
    fCov = EMatrix(3,3,0);
    
    for (size_t i=0; i<3; ++i)
    {
      fCov[i][i] = hitErrors[i];
    }

    klog << log4cpp::Priority::DEBUG << "Cov Matrix --> " << fCov;

    // destroy measurements in fMeas container
    //stc_tools::destroy(fMeas);

    RP::measurement_vector fMeas;

    auto size = hits.size();

    klog << log4cpp::Priority::DEBUG << " size of hits --> " << size;
    klog << log4cpp::Priority::DEBUG << " fill measurement vector --> " << size;

    for(auto hit : hits)
    {
      m[0]=hit->XYZ().X();
      m[1]=hit->XYZ().Y();
      m[2]=hit->XYZ().Z();
 
      klog << log4cpp::Priority::DEBUG << "+++hit x = " << m[0] 
      << " y = " << m[1] << " z = " << m[2];
      klog << log4cpp::Priority::DEBUG << "Create a measurement " ;

      Measurement* meas = new Measurement(); 
      string type=RP::xyz;
   
      meas->set_name(type);                         // the measurement type
      meas->set_hv(HyperVector(m,fCov,type));  // the HyperVector 
      meas->set_deposited_energy(hit->Edep()); // the deposited energy
      meas->set_name(RP::setup_volume,"mother");          // the volume
        
      // the  position of the measurement
      klog << log4cpp::Priority::DEBUG << "Create measurement plane " ;

      meas->set_position_hv(HyperVector(m,EMatrix(3,3,0),RP::xyz));

      //    Add the measurement to the vector
      fMeas.push_back(meas);
    }
    
    // add the measurements to the trajectory
    klog << log4cpp::Priority::INFO << " Measurement vector created "  ;
    
    Trajectory* trj = new Trajectory();
    trj->add_constituents(fMeas);  

    klog << log4cpp::Priority::INFO << " Trajectory --> " << *trj ;

    return trj;
  }