DSTUtil::Target Namespace Reference


Functions

std::string Name (const double &tgta)
int Index (const double &tgta)
bool IsInside (const MIPPVertexSummary *vtx, const MIPPRunSummary *rs)
bool IsInsideLH2 (const MIPPVertexSummary *vtx, const MIPPRunSummary *rs)
bool IsInside (const float *x, const MIPPRunSummary *rs)
double LH2TrgtLen (double &rad)
bool IsInsideLH2 (const float *x, const MIPPRunSummary *rs)


Function Documentation

std::string DSTUtil::Target::Name ( const double &  tgta  ) 

Definition at line 1489 of file DSTUtil.cxx.

References A, name, RITargetAZ::ntgt, and RITargetAZ::tgt.

Referenced by MXMLdbTableEntryBuilder::Build(), MXMLdbTableBuilder::Build(), DCCalib::Init(), and main().

01490 {
01491   for (int i=0 ; i != RITargetAZ::ntgt; ++i) {
01492     if (fabs(tgta - RITargetAZ::tgt[i].A) < 0.005)
01493       return RITargetAZ::tgt[i].name;
01494   }
01495   cout << "DSTUtil::Target::Name: Error: A=" 
01496        << tgta << " not found." << endl;
01497   return "Unknown";
01498 }

int DSTUtil::Target::Index ( const double &  tgta  ) 

Definition at line 1502 of file DSTUtil.cxx.

References A, RITargetAZ::ntgt, and RITargetAZ::tgt.

Referenced by main().

01503 {
01504   for (int i=0 ; i!=RITargetAZ::ntgt; ++i) {
01505     if (fabs(tgta - RITargetAZ::tgt[i].A) < 0.005)
01506       return i;
01507   }
01508   cout << "DSTUtil::Target::Index: Error: A=" 
01509        << tgta << " not found." << endl;
01510   return -1;
01511 }

bool DSTUtil::Target::IsInside ( const MIPPVertexSummary vtx,
const MIPPRunSummary rs 
)

Definition at line 1515 of file DSTUtil.cxx.

References MIPPVertexSummary::x.

01517 {
01518   return DSTUtil::Target::IsInside(vtx->x, rs);
01519 }

bool DSTUtil::Target::IsInsideLH2 ( const MIPPVertexSummary vtx,
const MIPPRunSummary rs 
)

Definition at line 1522 of file DSTUtil.cxx.

References MIPPVertexSummary::x.

Referenced by main().

01524 {
01525   return DSTUtil::Target::IsInsideLH2(vtx->x, rs);
01526 }

bool DSTUtil::Target::IsInside ( const float *  x,
const MIPPRunSummary rs 
)

Definition at line 1530 of file DSTUtil.cxx.

References MIPPRunSummary::tgtPos, and MIPPRunSummary::tgtSize.

01532 {
01533   //Naive (broken) implementation, NEEDS TO IMPROVE, TODO
01534   const float* tp = rs->tgtPos;
01535   const float* ts = rs->tgtSize;
01536   for (int dim = 0; dim !=3; ++dim) {
01537     if (x[dim] < tp[dim]-ts[dim] || x[dim] > tp[dim]+ts[dim]) 
01538       return false;
01539   }
01540   return true;
01541 }

double DSTUtil::Target::LH2TrgtLen ( double &  rad  ) 

Definition at line 1544 of file DSTUtil.cxx.

References par.

Referenced by IsInsideLH2().

01544                                            {
01545   //returns the half length in z for a given radius of the active lh2 shrunken volume.
01546 
01547   double  par[5] = {7.0980 , 0.48297  , -1.8404  ,1.7047 ,  -0.54161};
01548   double hlen = par[0] + par[1]*rad + par[2]*(rad*rad) + 
01549     par[3]*(rad*rad*rad) + par[4]*(rad*rad*rad*rad);
01550   return hlen;
01551 }

bool DSTUtil::Target::IsInsideLH2 ( const float *  x,
const MIPPRunSummary rs 
)

Definition at line 1553 of file DSTUtil.cxx.

References LH2TrgtLen(), MIPPRunSummary::tgta, and MIPPRunSummary::tgtPos.

01555 {
01556   const float* tp = rs->tgtPos;
01557   //const float* ts = rs->tgtSize;
01558   const float  ta = rs->tgta;
01559   bool in = false;
01560   if(ta<2){
01561     //in lh2
01562     double dx = x[0] - tp[0];
01563     double dy = x[1] - tp[1];
01564     double dz = x[2] - tp[2];
01565     double rad = sqrt(dx*dx + dy*dy);
01566     double tzl = LH2TrgtLen(rad);
01567     //This is the shrunken LH2 target radius
01568     if(rad<1.8962 && fabs(dz)<tzl)in = true;
01569 
01570   }else{
01571     cout<<" Target is not LH2 "<<" atomic weight of target = "<<ta<<endl;
01572   }
01573   return in;
01574 }


Generated on Mon Nov 23 08:05:25 2009 for MIPP(E907) by  doxygen 1.4.7