Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ANtpInfoObjectFiller Class Reference

#include <ANtpInfoObjectFiller.h>

Inheritance diagram for ANtpInfoObjectFiller:

ANtpInfoObjectFillerBeam List of all members.

Public Member Functions

 ANtpInfoObjectFiller ()
virtual ~ANtpInfoObjectFiller ()
void FillHeaderInformation (Int_t run, Int_t subRun, Int_t snarl, NtpSREventSummary summary, NtpSRCosmicRay cr, DetectorType::Detector_t det, SimFlag::SimFlag_t dataType, ANtpHeaderInfo *headerInfo)
void FillEventInformation (NtpSREvent *ntpEvent, ANtpEventInfo *eventInfo)
void FillTrackInformation (NtpSRTrack *ntpTrack, ANtpTrackInfo *trackInfo)
void FillShowerInformation (NtpSRShower *ntpShower, ANtpShowerInfo *showerInfo)
void FillMCTruthInformation (NtpMCTruth *ntpMCTruth, ANtpTruthInfo *truthInfo)

Protected Attributes

VldContext fVldc

Private Member Functions

double Sqr (double x)
int Sqr (int x)
float Sqr (float x)
void GetTrackTrace (NtpSRTrack *ntpTrack, ANtpTrackInfo *trackInfo, Int_t direction)

Constructor & Destructor Documentation

ANtpInfoObjectFiller::ANtpInfoObjectFiller  ) 
 

Definition at line 42 of file ANtpInfoObjectFiller.cxx.

References MSG.

00043 {
00044     
00045   MSG("ANtpInfoObjectFiller", Msg::kDebug) << "ANtpInfoObjectFiller::Constructor" << endl;
00046   
00047 }

ANtpInfoObjectFiller::~ANtpInfoObjectFiller  )  [virtual]
 

Definition at line 50 of file ANtpInfoObjectFiller.cxx.

References MSG.

00051 {
00052   
00053   MSG("ANtpInfoObjectFiller", Msg::kDebug) << "ANtpInfoObjectFiller::Destructor" << endl;
00054   
00055 }


Member Function Documentation

void ANtpInfoObjectFiller::FillEventInformation NtpSREvent ntpEvent,
ANtpEventInfo eventInfo
 

Definition at line 232 of file ANtpInfoObjectFiller.cxx.

References NtpSRPlane::beg, ANtpEventInfo::begPlane, NtpSRPlane::end, ANtpEventInfo::endPlane, ANtpEventInfo::energyGeV, ANtpEventInfo::event, NtpSRStripPulseHeight::gev, NtpSREvent::index, NtpSRPlane::n, NtpSREvent::nshower, NtpSREvent::nstrip, NtpSREvent::ntrack, ANtpEventInfo::passStrips, NtpSREvent::ph, NtpSREvent::plane, ANtpEventInfo::planes, ANtpEventInfo::pulseHeight, ANtpEventInfo::Reset(), ANtpEventInfo::showers, NtpSRPulseHeight::sigcor, ANtpEventInfo::totalStrips, ANtpEventInfo::tracks, NtpSREvent::vtx, ANtpEventInfo::vtxX, ANtpEventInfo::vtxY, ANtpEventInfo::vtxZ, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by CondensedNtpModule::Ana(), ANtpEventInfoAna::Analyze(), MadAnalysis::CreateANtpPAN(), and ANtpAnalysisInfoAna::FillNueAnalysisInformation().

00234 {
00235 
00236   eventInfo->Reset();
00237   eventInfo->event = (int)ntpEvent->index;
00238   eventInfo->pulseHeight = ntpEvent->ph.sigcor;
00239   eventInfo->energyGeV = ntpEvent->ph.gev;
00240   eventInfo->begPlane = ntpEvent->plane.beg;
00241   eventInfo->endPlane = ntpEvent->plane.end;
00242   eventInfo->planes = ntpEvent->plane.n;
00243   
00244   //add up the pulse height in each plane to find the maximum in the event
00245   eventInfo->totalStrips = ntpEvent->nstrip;
00246   
00247   //write your own criterea for whether a strip is good or not
00248   eventInfo->passStrips = ntpEvent->nstrip;
00249   
00250   eventInfo->showers = ntpEvent->nshower;
00251   eventInfo->tracks = ntpEvent->ntrack;
00252   eventInfo->vtxX = ntpEvent->vtx.x;
00253   eventInfo->vtxY = ntpEvent->vtx.y;
00254   eventInfo->vtxZ = ntpEvent->vtx.z;
00255   
00256   return;
00257 }

void ANtpInfoObjectFiller::FillHeaderInformation Int_t  run,
Int_t  subRun,
Int_t  snarl,
NtpSREventSummary  summary,
NtpSRCosmicRay  cr,
DetectorType::Detector_t  det,
SimFlag::SimFlag_t  dataType,
ANtpHeaderInfo headerInfo
 

Definition at line 59 of file ANtpInfoObjectFiller.cxx.

References ANtpHeaderInfo::coilStatus, NtpSREventSummary::date, NtpSRDate::day, ANtpHeaderInfo::day, ANtpHeaderInfo::detector, ANtpHeaderInfo::events, fVldc, DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), BfieldCoilCurrent::GetSm1Status(), BfieldCoilCurrent::GetSm2Status(), NtpSRDate::hour, ANtpHeaderInfo::hour, NtpSRCosmicRay::juliandate, ANtpHeaderInfo::julianDate, ANtpHeaderInfo::localSiderealTime, NtpSRCosmicRay::locsiderialtime, NtpSRDate::minute, ANtpHeaderInfo::minute, NtpSRDate::month, ANtpHeaderInfo::month, NtpSREventSummary::nevent, ANtpHeaderInfo::Reset(), ANtpHeaderInfo::run, NtpSRDate::sec, ANtpHeaderInfo::second, ANtpHeaderInfo::snarl, ANtpHeaderInfo::subRun, NtpSRDate::utc, ANtpHeaderInfo::utc, NtpSRDate::year, and ANtpHeaderInfo::year.

Referenced by CondensedNtpModule::Ana().

00065 {
00066 
00067   headerInfo->Reset();
00068   
00069   headerInfo->detector = (int)det;
00070   headerInfo->run = run;
00071   headerInfo->subRun = subRun;
00072   headerInfo->snarl = snarl;
00073   headerInfo->events = summary.nevent;
00074   headerInfo->year = (int)summary.date.year;
00075   headerInfo->month = (int)summary.date.month;
00076   headerInfo->day = (int)summary.date.day;
00077   headerInfo->hour = (int)summary.date.hour;
00078   headerInfo->minute = (int)summary.date.minute;
00079   headerInfo->second = summary.date.sec;
00080   headerInfo->utc = summary.date.utc;
00081   headerInfo->julianDate = cr.juliandate;
00082   headerInfo->localSiderealTime = cr.locsiderialtime;   
00083   
00084   //figure out the coil status
00085   headerInfo->coilStatus = 0;
00086   
00087   if(dataType == SimFlag::kMC) headerInfo->coilStatus = 1;
00088   
00089   //get the appropriate context
00090   VldTimeStamp timeStamp(summary.date.year, summary.date.month, summary.date.day,
00091                          summary.date.hour, summary.date.minute, 
00092                          TMath::Nint(summary.date.sec));
00093   fVldc = VldContext(det, dataType, timeStamp);
00094   
00095   DbiResultPtr<BfieldCoilCurrent> coilTable(fVldc);
00096   
00097   //get the status of the coils
00098   for(UInt_t i = 0; i < coilTable.GetNumRows(); ++i){
00099     
00100     if(det == DetectorType::kFar){
00101 
00102       const BfieldCoilCurrent *coilCurrent = coilTable.GetRow(i);
00103       //if both coils have the same status code, set them to Sm1Status, otherwise call the coil in 
00104       //off/unknown state
00105       if(coilCurrent->GetSm1Status() == coilCurrent->GetSm2Status())
00106         headerInfo->coilStatus = coilCurrent->GetSm1Status();
00107       else headerInfo->coilStatus = 0;
00108     }
00109   }
00110   
00111   return;
00112 }

void ANtpInfoObjectFiller::FillMCTruthInformation NtpMCTruth ntpMCTruth,
ANtpTruthInfo truthInfo
 

Definition at line 261 of file ANtpInfoObjectFiller.cxx.

References ANtpTruthInfo::hadronicY, NtpMCTruth::iaction, ANtpTruthInfo::interactionType, NtpMCTruth::inu, ANtpTruthInfo::leptonDCosX, ANtpTruthInfo::leptonDCosY, ANtpTruthInfo::leptonDCosZ, ANtpTruthInfo::leptonMomentum, ANtpTruthInfo::nuDCosX, ANtpTruthInfo::nuDCosY, ANtpTruthInfo::nuDCosZ, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, ANtpTruthInfo::nuVtxX, ANtpTruthInfo::nuVtxY, ANtpTruthInfo::nuVtxZ, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4neu, NtpMCTruth::p4shw, NtpMCTruth::p4tau, NtpMCTruth::p4tgt, ANtpTruthInfo::Reset(), ANtpTruthInfo::showerDCosX, ANtpTruthInfo::showerDCosY, ANtpTruthInfo::showerDCosZ, ANtpTruthInfo::showerEnergy, ANtpTruthInfo::targetEnergy, ANtpTruthInfo::targetPX, ANtpTruthInfo::targetPY, ANtpTruthInfo::targetPZ, NtpMCTruth::vtxx, NtpMCTruth::vtxy, NtpMCTruth::vtxz, and NtpMCTruth::y.

Referenced by CondensedNtpModule::Ana(), ANtpTruthInfoBeamAna::Analyze(), MadAnalysis::CreateANtpPAN(), and CondensedNtpModule::FillUnRecoedMCInformation().

00263 {
00264   Float_t muMass = 0.105658357; //mu mass in GeV/c
00265   Float_t eMass = 0.000510999; //e mass in GeV/c
00266   Float_t tauMass = 1.777;      //tau mass in GeV/c
00267 
00268   truthInfo->Reset();
00269   truthInfo->nuEnergy = ntpMCTruth->p4neu[3];
00270   truthInfo->nuVtxX = ntpMCTruth->vtxx;
00271   truthInfo->nuVtxY = ntpMCTruth->vtxy;
00272   truthInfo->nuVtxZ = ntpMCTruth->vtxz;
00273   if(TMath::Abs(truthInfo->nuEnergy) > 0.){
00274     truthInfo->nuDCosX = ntpMCTruth->p4neu[0]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);
00275     truthInfo->nuDCosY = ntpMCTruth->p4neu[1]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);
00276     truthInfo->nuDCosZ = ntpMCTruth->p4neu[2]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);             
00277   }
00278   else{
00279     truthInfo->nuDCosX = -10000.;
00280     truthInfo->nuDCosY = -10000.;
00281     truthInfo->nuDCosZ = -10000.;
00282   }
00283   truthInfo->nuFlavor = ntpMCTruth->inu;
00284   truthInfo->interactionType = ntpMCTruth->iaction;
00285   
00286   truthInfo->targetEnergy = ntpMCTruth->p4tgt[3];
00287   truthInfo->targetPX = ntpMCTruth->p4tgt[0];
00288   truthInfo->targetPY = ntpMCTruth->p4tgt[1];
00289   truthInfo->targetPZ = ntpMCTruth->p4tgt[2];
00290   
00291   truthInfo->hadronicY = ntpMCTruth->y;
00292   
00293   truthInfo->showerEnergy = 0.;
00294   float showerMomentumSqr = 0.;
00295   if(ntpMCTruth->p4shw[3]>0.){
00296     truthInfo->showerEnergy = ntpMCTruth->p4shw[3];
00297     showerMomentumSqr = ntpMCTruth->p4shw[0]*ntpMCTruth->p4shw[0];
00298     showerMomentumSqr += ntpMCTruth->p4shw[1]*ntpMCTruth->p4shw[1];
00299     showerMomentumSqr += ntpMCTruth->p4shw[2]*ntpMCTruth->p4shw[2];
00300     truthInfo->showerDCosX = ntpMCTruth->p4shw[0]/TMath::Sqrt(showerMomentumSqr);
00301     truthInfo->showerDCosY = ntpMCTruth->p4shw[1]/TMath::Sqrt(showerMomentumSqr);
00302     truthInfo->showerDCosZ = ntpMCTruth->p4shw[2]/TMath::Sqrt(showerMomentumSqr);
00303   }
00304   else{
00305     truthInfo->showerDCosX = ANtpDefVal::kFloat;
00306     truthInfo->showerDCosY = ANtpDefVal::kFloat;
00307     truthInfo->showerDCosZ = ANtpDefVal::kFloat;
00308   }
00309   
00310   truthInfo->leptonMomentum = 0.;
00311   if(TMath::Abs(ntpMCTruth->p4mu1[3])>0.){
00312     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4mu1[3]*ntpMCTruth->p4mu1[3] - muMass*muMass);
00313     truthInfo->leptonDCosX = ntpMCTruth->p4mu1[0]/truthInfo->leptonMomentum;
00314     truthInfo->leptonDCosY = ntpMCTruth->p4mu1[1]/truthInfo->leptonMomentum;
00315     truthInfo->leptonDCosZ = ntpMCTruth->p4mu1[2]/truthInfo->leptonMomentum;            
00316     if(ntpMCTruth->p4mu1[3]<0.) truthInfo->leptonMomentum *= -1.;
00317   }
00318   else if(TMath::Abs(ntpMCTruth->p4el1[3])>0.){
00319     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4el1[3]*ntpMCTruth->p4el1[3] - eMass*eMass);
00320     truthInfo->leptonDCosX = ntpMCTruth->p4el1[0]/truthInfo->leptonMomentum;
00321     truthInfo->leptonDCosY = ntpMCTruth->p4el1[1]/truthInfo->leptonMomentum;
00322     truthInfo->leptonDCosZ = ntpMCTruth->p4el1[2]/truthInfo->leptonMomentum;            
00323     if(ntpMCTruth->p4el1[3]<0.) truthInfo->leptonMomentum *= -1.;
00324   }
00325   else if(TMath::Abs(ntpMCTruth->p4tau[3])>0.){
00326     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4tau[3]*ntpMCTruth->p4tau[3] - tauMass*tauMass);
00327     truthInfo->leptonDCosX = ntpMCTruth->p4tau[0]/truthInfo->leptonMomentum;
00328     truthInfo->leptonDCosY = ntpMCTruth->p4tau[1]/truthInfo->leptonMomentum;
00329     truthInfo->leptonDCosZ = ntpMCTruth->p4tau[2]/truthInfo->leptonMomentum;            
00330     if(ntpMCTruth->p4tau[3]<0.) truthInfo->leptonMomentum *= -1.;
00331   }
00332   else{
00333     truthInfo->leptonDCosX = ANtpDefVal::kFloat;
00334     truthInfo->leptonDCosY = ANtpDefVal::kFloat;
00335     truthInfo->leptonDCosZ = ANtpDefVal::kFloat;                
00336   }
00337     
00338   
00339   return;
00340 }

void ANtpInfoObjectFiller::FillShowerInformation NtpSRShower ntpShower,
ANtpShowerInfo showerInfo
 

Definition at line 211 of file ANtpInfoObjectFiller.cxx.

References NtpSRPlane::beg, ANtpShowerInfo::begPlane, NtpSRVertex::dcosx, ANtpShowerInfo::dcosX, NtpSRVertex::dcosy, ANtpShowerInfo::dcosY, NtpSRVertex::dcosz, ANtpShowerInfo::dcosZ, NtpSRPlane::end, ANtpShowerInfo::endPlane, NtpSRPlane::n, NtpSRShower::nstrip, NtpSRShower::ph, NtpSRShower::plane, ANtpShowerInfo::planes, ANtpShowerInfo::pulseHeight, ANtpShowerInfo::Reset(), NtpSRStripPulseHeight::sigmap, ANtpShowerInfo::totalStrips, NtpSRShower::vtx, ANtpShowerInfo::vtxX, ANtpShowerInfo::vtxY, ANtpShowerInfo::vtxZ, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by CondensedNtpModule::Ana(), ANtpShowerInfoAna::Analyze(), MadAnalysis::CreateANtpPAN(), and ANtpAnalysisInfoAna::FillNueAnalysisInformation().

00213 {
00214   showerInfo->Reset();
00215   showerInfo->planes = ntpShower->plane.n;
00216   showerInfo->totalStrips = ntpShower->nstrip;
00217   showerInfo->begPlane = ntpShower->plane.beg;
00218   showerInfo->endPlane = ntpShower->plane.end;
00219   showerInfo->vtxX = ntpShower->vtx.x;
00220   showerInfo->vtxY = ntpShower->vtx.y;
00221   showerInfo->vtxZ = ntpShower->vtx.z;
00222   showerInfo->dcosX = ntpShower->vtx.dcosx;
00223   showerInfo->dcosY = ntpShower->vtx.dcosy;
00224   showerInfo->dcosZ = ntpShower->vtx.dcosz;
00225   showerInfo->pulseHeight = ntpShower->ph.sigmap;
00226   
00227   return;
00228 }

void ANtpInfoObjectFiller::FillTrackInformation NtpSRTrack ntpTrack,
ANtpTrackInfo trackInfo
 

Definition at line 171 of file ANtpInfoObjectFiller.cxx.

References NtpSRPlane::beg, ANtpTrackInfo::begPlane, NtpSRFitTrack::chi2, NtpSRVertex::dcosx, ANtpTrackInfo::dcosXEnd, ANtpTrackInfo::dcosXVtx, NtpSRVertex::dcosy, ANtpTrackInfo::dcosYEnd, ANtpTrackInfo::dcosYVtx, NtpSRVertex::dcosz, ANtpTrackInfo::dcosZEnd, ANtpTrackInfo::dcosZVtx, NtpSRTrack::ds, NtpSRTrack::end, NtpSRPlane::end, ANtpTrackInfo::endPlane, ANtpTrackInfo::endX, ANtpTrackInfo::endY, ANtpTrackInfo::endZ, NtpSRMomentum::eqp, NtpSRTrack::fit, ANtpTrackInfo::fitMomentum, GetTrackTrace(), ANtpTrackInfo::length, NtpSRTrack::momentum, NtpSRPlane::n, NtpSRFitTrack::ndof, NtpSRTrack::nstrip, NtpSRFitTrack::pass, ANtpTrackInfo::passedFit, NtpSRTrack::ph, NtpSRTrack::plane, ANtpTrackInfo::planes, ANtpTrackInfo::pulseHeight, NtpSRMomentum::qp, NtpSRMomentum::range, ANtpTrackInfo::rangeMomentum, ANtpTrackInfo::reducedChi2, ANtpTrackInfo::Reset(), NtpSRPulseHeight::sigcor, ANtpTrackInfo::sigmaQoverP, ANtpTrackInfo::totalStrips, NtpSRTrack::vtx, ANtpTrackInfo::vtxX, ANtpTrackInfo::vtxY, ANtpTrackInfo::vtxZ, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by CondensedNtpModule::Ana(), ANtpTrackInfoAna::Analyze(), MadAnalysis::CreateANtpPAN(), and ANtpAnalysisInfoAna::FillNueAnalysisInformation().

00173 {
00174   
00175   trackInfo->Reset();
00176   trackInfo->planes = ntpTrack->plane.n;
00177   trackInfo->totalStrips = ntpTrack->nstrip;
00178   trackInfo->pulseHeight = ntpTrack->ph.sigcor;
00179   if(TMath::Abs(ntpTrack->momentum.qp)>0.) trackInfo->fitMomentum = (1./ntpTrack->momentum.qp);
00180   trackInfo->sigmaQoverP = ntpTrack->momentum.eqp;
00181   trackInfo->rangeMomentum = ntpTrack->momentum.range;                            
00182   trackInfo->begPlane = ntpTrack->plane.beg;
00183   trackInfo->endPlane = ntpTrack->plane.end;
00184   trackInfo->length = ntpTrack->ds;
00185   trackInfo->vtxX = ntpTrack->vtx.x; 
00186   trackInfo->vtxY = ntpTrack->vtx.y; 
00187   trackInfo->vtxZ = ntpTrack->vtx.z; 
00188   trackInfo->dcosXVtx = ntpTrack->vtx.dcosx;
00189   trackInfo->dcosYVtx = ntpTrack->vtx.dcosy;
00190   trackInfo->dcosZVtx = ntpTrack->vtx.dcosz;
00191   trackInfo->endX = ntpTrack->end.x; 
00192   trackInfo->endY = ntpTrack->end.y; 
00193   trackInfo->endZ = ntpTrack->end.z; 
00194   trackInfo->dcosXEnd = ntpTrack->end.dcosx;
00195   trackInfo->dcosYEnd = ntpTrack->end.dcosy;
00196   trackInfo->dcosZEnd = ntpTrack->end.dcosz;
00197   trackInfo->passedFit = 0;
00198   if(ntpTrack->fit.pass) trackInfo->passedFit = 1;
00199   trackInfo->reducedChi2 = ntpTrack->fit.chi2;
00200   if(ntpTrack->fit.ndof>0.) 
00201     trackInfo->reducedChi2 /= 1.*ntpTrack->fit.ndof;
00202   
00203   GetTrackTrace(ntpTrack, trackInfo, -1);
00204   GetTrackTrace(ntpTrack, trackInfo, 1);
00205     
00206   return;
00207 }

void ANtpInfoObjectFiller::GetTrackTrace NtpSRTrack ntpTrack,
ANtpTrackInfo trackInfo,
Int_t  direction
[private]
 

Definition at line 361 of file ANtpInfoObjectFiller.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRTrack::end, kInverseSqrt2, Sqr(), ANtpTrackInfo::traceEnd, ANtpTrackInfo::traceEndZ, ANtpTrackInfo::traceVtx, ANtpTrackInfo::traceVtxZ, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillTrackInformation().

00364 {
00365   
00366   //get the trace for the track - this is very far detector centric for now,
00367   //adapted from C. Howcroft's code
00368   
00369   //direction tells you whether to trace back from vertex (-1) or forward from end (1)
00370   
00371   //side is as labeled below
00372   //               0
00373   //     -------
00374   //    7 /               \ 1
00375   //   /          y|   \
00376   // 6 |           |    | 2
00377   //   |           ---- |
00378   // 5 \                 x / 3
00379   //      \       /
00380   //    --------
00381   //              4
00382   
00383   double dcos[3] = {direction*ntpTrack->vtx.dcosx,
00384                     direction*ntpTrack->vtx.dcosy,
00385                     direction*ntpTrack->vtx.dcosz}; 
00386   double dcosUV[3] = {direction*ntpTrack->vtx.dcosu,
00387                       direction*ntpTrack->vtx.dcosv,
00388                       direction*ntpTrack->vtx.dcosz}; 
00389   double endPointXY[3] = {ntpTrack->vtx.x, ntpTrack->vtx.y, ntpTrack->vtx.z};
00390   double endPointUV[3] = {ntpTrack->vtx.u, ntpTrack->vtx.v, ntpTrack->vtx.z};
00391   
00392   if(direction > 0){
00393     endPointXY[0] = ntpTrack->end.x;
00394     endPointXY[1] = ntpTrack->end.y;
00395     endPointXY[2] = ntpTrack->end.z;
00396     endPointUV[0] = ntpTrack->end.u;
00397     endPointUV[1] = ntpTrack->end.v;
00398     endPointUV[2] = ntpTrack->end.z;
00399     dcos[0] = ntpTrack->end.dcosx;
00400     dcos[1] = ntpTrack->end.dcosy;
00401     dcos[2] = ntpTrack->end.dcosz;
00402     dcosUV[0] = ntpTrack->end.dcosu;
00403     dcosUV[1] = ntpTrack->end.dcosv;
00404     dcosUV[2] = ntpTrack->end.dcosz;
00405   }
00406   
00407   int side = -1;
00408   double xzproj[2]={-999., -999.};   
00409   double entry[3] = {0.};
00410   double minpath = 99e99;
00411   double tmppath = 0.;
00412   double maxDetectorY = 4.;
00413   double sidelength = kFarSideLength;
00414   
00415   if(TMath::IsNaN(endPointUV[0]) || TMath::IsNaN(endPointUV[1]) 
00416      || TMath::IsNaN(dcosUV[0]) || TMath::IsNaN(dcosUV[1]) 
00417      || TMath::IsNaN(dcos[2])) return;
00418   
00419   if(TMath::Abs(dcos[1])>1.e-6){ 
00420     // Y - SIDES
00421     //SIDE 0 
00422     xzproj[0] = endPointXY[0] + (dcos[0]/dcos[1])*(maxDetectorY - endPointXY[1]);
00423     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[1])*(maxDetectorY - endPointXY[1]);
00424     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00425       tmppath = Sqr(endPointXY[0] - xzproj[0]) + Sqr(endPointXY[1] - maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00426       if(TMath::Finite(tmppath)){
00427         tmppath = TMath::Sqrt(tmppath);
00428         if(tmppath < minpath){
00429           minpath  = tmppath;
00430           entry[0] = xzproj[0];
00431           entry[2] = xzproj[1];
00432           entry[1] = maxDetectorY;
00433           side     = 0;
00434         }                       
00435       }      
00436     }//end side 0
00437     //SIDE 4 
00438     xzproj[0] = endPointXY[0] + (dcos[0]/dcos[1])*(-maxDetectorY - endPointXY[1]);
00439     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[1])*(-maxDetectorY - endPointXY[1]);
00440     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00441       tmppath = Sqr(endPointXY[0] - xzproj[0]) + Sqr(endPointXY[1] + maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00442       if(TMath::Finite(tmppath)){
00443         tmppath = TMath::Sqrt(tmppath);
00444         if(tmppath<minpath){
00445           minpath  = tmppath;
00446           entry[0] = xzproj[0];
00447           entry[2] = xzproj[1];
00448           entry[1] = -maxDetectorY;
00449           side     = 4;
00450         }                       
00451       }      
00452     }//end side 4
00453   }//end Y sides
00454   if(TMath::Abs(dcos[0])>1e-6){  // X - SIDES
00455     //SIDE 2 
00456     xzproj[0] = endPointXY[1] + (dcos[1]/dcos[0])*(maxDetectorY - endPointXY[0]);
00457     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[0])*(maxDetectorY - endPointXY[0]);
00458     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00459       tmppath = (endPointXY[1] - xzproj[0])*(endPointXY[1] - xzproj[0]) + (endPointXY[0] - maxDetectorY)*(endPointXY[0] - maxDetectorY) + (endPointXY[2] - xzproj[1])*(endPointXY[2] - xzproj[1]);
00460       if(TMath::Finite(tmppath)){
00461         tmppath = TMath::Sqrt(tmppath);
00462         if(tmppath<minpath){
00463           minpath  = tmppath;
00464           entry[1] = xzproj[0];
00465           entry[2] = xzproj[1];
00466           entry[0] = maxDetectorY;
00467           side     = 2;
00468         }               
00469       }       
00470     }//end side 2      
00471     //SIDE 6 
00472     xzproj[0] = endPointXY[1] + (dcos[1]/dcos[0])*(-maxDetectorY - endPointXY[0]);
00473     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[0])*(-maxDetectorY - endPointXY[0]);
00474     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00475       tmppath = Sqr(endPointXY[1] - xzproj[0]) + Sqr(endPointXY[0] + maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00476       if(TMath::Finite(tmppath)){
00477         tmppath = TMath::Sqrt(tmppath);
00478         if(tmppath<minpath){
00479           minpath  = tmppath;
00480           entry[1] = xzproj[0];
00481           entry[2] = xzproj[1];
00482           entry[0] = -maxDetectorY;
00483           side     = 6;
00484         }
00485       }                       
00486     }//end if side 6      
00487   }//end x sides
00488   if(TMath::Abs(dcosUV[0])>1.e-6){  // U - SIDES
00489     //SIDE 1 
00490     xzproj[0] = endPointUV[1] + (dcosUV[1]/dcosUV[0])*(maxDetectorY - endPointUV[0]);
00491     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[0])*(maxDetectorY - endPointUV[0]);
00492     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00493       tmppath = Sqr(ntpTrack->vtx.v - xzproj[0]) + Sqr(ntpTrack->vtx.u - maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00494       if(TMath::Finite(tmppath)){
00495         tmppath = TMath::Sqrt(tmppath);
00496         if(tmppath<minpath){
00497           minpath  = tmppath;
00498           entry[0] = kInverseSqrt2*(maxDetectorY - xzproj[0]) ;
00499           entry[2] = xzproj[1];
00500           entry[1] = kInverseSqrt2*(maxDetectorY + xzproj[0]) ;
00501           side     = 1;
00502         }                       
00503       }      
00504     }//end if side1 
00505     //SIDE 5 
00506     xzproj[0] = endPointUV[1] + (dcosUV[1]/dcosUV[0])*(-maxDetectorY - endPointUV[0]);
00507     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[0])*(-maxDetectorY - endPointUV[0]);
00508     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00509       tmppath = Sqr(ntpTrack->vtx.v - xzproj[0]) + Sqr(ntpTrack->vtx.u + maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00510       if(TMath::Finite(tmppath)){
00511         tmppath = TMath::Sqrt(tmppath);
00512         if(tmppath<minpath){
00513           minpath  = tmppath;
00514           entry[0] = kInverseSqrt2*(-maxDetectorY - xzproj[0]) ;
00515           entry[2] = xzproj[1];
00516           entry[1] = kInverseSqrt2*(-maxDetectorY + xzproj[0]) ;
00517           side     = 5;
00518         }                             
00519       }
00520     }//end if side 5 
00521   }//end u sides
00522   if(TMath::Abs(dcosUV[1])>1.e-6){  // V - SIDES
00523     //SIDE 7
00524     xzproj[0] = endPointUV[0] + (dcosUV[0]/dcosUV[1])*(maxDetectorY - endPointUV[1]);
00525     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[1])*(maxDetectorY - endPointUV[1]);
00526     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00527       tmppath =  Sqr(ntpTrack->vtx.u - xzproj[0]) + Sqr(ntpTrack->vtx.v - maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00528       if(TMath::Finite(tmppath)){
00529         tmppath = TMath::Sqrt ( tmppath);
00530         if(tmppath<minpath){
00531           minpath  = tmppath;
00532           entry[0] = kInverseSqrt2*(xzproj[0]-maxDetectorY) ;
00533           entry[2] = xzproj[1];
00534           entry[1] = kInverseSqrt2*(xzproj[0]+maxDetectorY) ;
00535           side     = 7;
00536         }                       
00537       }      
00538     }//end if side7
00539     //SIDE 3
00540     xzproj[0] = endPointUV[0] + (dcosUV[0]/dcosUV[1])*(-maxDetectorY - endPointUV[1]);
00541     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[1])*(-maxDetectorY - endPointUV[1]);
00542     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00543       tmppath = Sqr(ntpTrack->vtx.u - xzproj[0]) + Sqr(ntpTrack->vtx.v + maxDetectorY) + Sqr(endPointXY[2] - xzproj[1]);
00544       if(TMath::Finite(tmppath)){
00545         tmppath = TMath::Sqrt(tmppath);
00546         if(tmppath<minpath){
00547           minpath  = tmppath;
00548           entry[0] = kInverseSqrt2*(xzproj[0]+maxDetectorY) ;
00549           entry[2] = xzproj[1];
00550           entry[1] = kInverseSqrt2*(xzproj[0]-maxDetectorY) ;
00551           side     = 3;
00552         }                         
00553       }    
00554     }//end if side 3    
00555   }//end v sides
00556   
00557   if(direction < 0){
00558     trackInfo->traceVtx = TMath::Sqrt(Sqr(endPointXY[0]-entry[0]) + Sqr(endPointXY[1]-entry[1])
00559                                       + Sqr(endPointXY[2]-entry[2]));
00560     trackInfo->traceVtxZ = entry[2] - endPointXY[2];
00561     
00562   } 
00563   else if(direction > 0){
00564     trackInfo->traceEnd = TMath::Sqrt(Sqr(ntpTrack->end.x-entry[0]) + Sqr(ntpTrack->end.y-entry[1])
00565                                       + Sqr(ntpTrack->end.z-entry[2]));
00566     trackInfo->traceEndZ = entry[2] - ntpTrack->end.z;
00567     
00568   } 
00569   
00570   return;
00571 }

float ANtpInfoObjectFiller::Sqr float  x  )  [private]
 

Definition at line 355 of file ANtpInfoObjectFiller.cxx.

00356 {
00357   return x*x;
00358 }

int ANtpInfoObjectFiller::Sqr int  x  )  [private]
 

Definition at line 349 of file ANtpInfoObjectFiller.cxx.

00350 {
00351   return x*x;
00352 }

double ANtpInfoObjectFiller::Sqr double  x  )  [private]
 

Definition at line 343 of file ANtpInfoObjectFiller.cxx.

Referenced by GetTrackTrace().

00344 {
00345   return x*x;
00346 }


Member Data Documentation

VldContext ANtpInfoObjectFiller::fVldc [protected]
 

Definition at line 54 of file ANtpInfoObjectFiller.h.

Referenced by FillHeaderInformation().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:55:35 2007 for loon by  doxygen 1.3.9.1