ANtpInfoObjectFiller Class Reference

#include <ANtpInfoObjectFiller.h>

Inheritance diagram for ANtpInfoObjectFiller:
ANtpInfoObjectFillerBeam ANtpInfoObjectFillerNC

List of all members.

Public Member Functions

 ANtpInfoObjectFiller ()
 ANtpInfoObjectFiller (Detector::Detector_t detector)
 ANtpInfoObjectFiller (TClonesArray *strips)
virtual ~ANtpInfoObjectFiller ()
void FillHeaderInformation (ANtpRecoNtpManipulator *ntpManip, Detector::Detector_t det, SimFlag::SimFlag_t dataType, ANtpHeaderInfo *headerInfo)
void FillEventInformation (ANtpRecoNtpManipulator *ntpManip, NtpSREvent *ntpEvent, ANtpEventInfo *eventInfo)
void FillTrackInformation (NtpSRTrack *ntpTrack, ANtpTrackInfo *trackInfo)
void FillShowerInformation (NtpSRShower *ntpShower, ANtpShowerInfo *showerInfo)
void SetDetector (Detector::Detector_t detector)
void SetStripArray (TClonesArray *strips)
Float_t MetersToBeam (Detector::Detector_t det, Float_t x, Float_t y, Float_t z)
Float_t MetersToCoil (Detector::Detector_t det, Float_t x, Float_t y)
Float_t MetersToCloseEdge (Detector::Detector_t det, Float_t x, Float_t y, Bool_t NDUseFullPlane=0)

Static Public Member Functions

static void FillMCTruthInformation (NtpMCTruth *ntpMCTruth, ANtpTruthInfo *truthInfo)

Protected Member Functions

void FillFiducialInformation (ANtpTrackInfo *trackInfo)
void FillFiducialInformation (ANtpEventInfo *eventInfo)

Protected Attributes

VldContext fVldc
TClonesArray * fStripArray
Detector::Detector_t fDetector

Private Member Functions

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

Private Attributes

Long64_t fRowNum

Detailed Description

Definition at line 34 of file ANtpInfoObjectFiller.h.


Constructor & Destructor Documentation

ANtpInfoObjectFiller::ANtpInfoObjectFiller (  ) 

Definition at line 63 of file ANtpInfoObjectFiller.cxx.

References Msg::kDebug, MSG, and RunQualityFinder::OverrideDB().

00063                                            :
00064   fStripArray(0),
00065   fDetector(Detector::kUnknown),
00066   fRowNum(0)
00067 {
00068   // This ensures we get the latest version of the bad runs list,
00069   // specifically the bad runs in Nov 2007
00070   RunQualityFinder::OverrideDB();    
00071 
00072   MSG("ANtpInfoObjectFiller", Msg::kDebug) 
00073     << "ANtpInfoObjectFiller::Constructor" << endl;
00074   
00075 }

ANtpInfoObjectFiller::ANtpInfoObjectFiller ( Detector::Detector_t  detector  ) 

Definition at line 78 of file ANtpInfoObjectFiller.cxx.

References Msg::kDebug, MSG, and RunQualityFinder::OverrideDB().

00078                                                                       :
00079   fStripArray(0),
00080   fDetector(detector),
00081   fRowNum(0)
00082 {
00083   // This ensures we get the latest version of the bad runs list,
00084   // specifically the bad runs in Nov 2007
00085   RunQualityFinder::OverrideDB();
00086 
00087   MSG("ANtpInfoObjectFiller", Msg::kDebug) 
00088     << "ANtpInfoObjectFiller::Constructor" << endl;
00089   
00090 }

ANtpInfoObjectFiller::ANtpInfoObjectFiller ( TClonesArray *  strips  ) 

Definition at line 93 of file ANtpInfoObjectFiller.cxx.

References Msg::kDebug, MSG, and RunQualityFinder::OverrideDB().

00093                                                                :
00094   fStripArray(strips),
00095   fDetector(Detector::kUnknown),
00096   fRowNum(0)
00097 {
00098   // This ensures we get the latest version of the bad runs list,
00099   // specifically the bad runs in Nov 2007
00100   RunQualityFinder::OverrideDB();
00101   MSG("ANtpInfoObjectFiller", Msg::kDebug) 
00102     << "ANtpInfoObjectFiller::Constructor" << endl;
00103   
00104 }

ANtpInfoObjectFiller::~ANtpInfoObjectFiller (  )  [virtual]

Definition at line 107 of file ANtpInfoObjectFiller.cxx.

References Msg::kDebug, and MSG.

00108 {
00109   
00110   MSG("ANtpInfoObjectFiller", Msg::kDebug) 
00111     << "ANtpInfoObjectFiller::Destructor" << endl;
00112   
00113 }


Member Function Documentation

void ANtpInfoObjectFiller::FillEventInformation ( ANtpRecoNtpManipulator ntpManip,
NtpSREvent ntpEvent,
ANtpEventInfo eventInfo 
)

Definition at line 362 of file ANtpInfoObjectFiller.cxx.

References ReleaseType::AsString(), NtpSRPlane::beg, ANtpEventInfo::begPlane, NtpSRPlane::end, ANtpEventInfo::endPlane, ANtpEventInfo::energyGeV, FillFiducialInformation(), NtpVtxFinder::FindVertex(), fStripArray, ANtpRecoNtpManipulator::GetNtpStRecord(), ANtpRecoNtpManipulator::GetReleaseMCType(), NtpSRStripPulseHeight::gev, ANtpEventInfo::index, NtpSREvent::index, ReleaseType::kCedarCarrot, ReleaseType::kCedarDaikon, ReleaseType::kCedarData, NtpSRPlane::n, NtpSREvent::nshower, NtpSREvent::nstrip, NtpSREvent::ntrack, ANtpEventInfo::passStrips, NtpSREvent::ph, NtpSRStrip::plane, NtpSREvent::plane, ANtpEventInfo::planes, ANtpEventInfo::pulseHeight, ANtpEventInfo::Reset(), NtpVtxFinder::SetTargetEvent(), ANtpEventInfo::showers, NtpSRPulseHeight::sigcor, NtpSREvent::stp, ANtpEventInfo::stripsPerPlane, NtpSRVertex::t, ANtpEventInfo::totalStrips, ANtpEventInfo::tracks, ANtpEventInfo::vertexTime, NtpSREvent::vtx, NtpVtxFinder::VtxT(), NtpVtxFinder::VtxX(), ANtpEventInfo::vtxX, ANtpEventInfo::vtxY, NtpVtxFinder::VtxY(), ANtpEventInfo::vtxZ, NtpVtxFinder::VtxZ(), NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

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

00365 {
00366 
00367   eventInfo->Reset();
00368   eventInfo->index = static_cast <int> (ntpEvent->index);
00369   eventInfo->pulseHeight = ntpEvent->ph.sigcor;
00370   eventInfo->energyGeV = ntpEvent->ph.gev;
00371   eventInfo->begPlane = ntpEvent->plane.beg;
00372   eventInfo->endPlane = ntpEvent->plane.end;
00373   eventInfo->planes = ntpEvent->plane.n;
00374   
00375   //add up the pulse height in each plane to find the maximum in the event
00376   eventInfo->totalStrips = ntpEvent->nstrip;
00377   
00378   //write your own criterea for whether a strip is good or not
00379   eventInfo->passStrips = ntpEvent->nstrip;
00380   
00381   eventInfo->showers = ntpEvent->nshower;
00382   eventInfo->tracks = ntpEvent->ntrack;
00383 
00384   //Correct cedar vertex bug 
00385   TString reco = ntpManip->GetReleaseMCType();
00386   if(reco.Contains((ReleaseType::AsString(ReleaseType::kCedarData)).c_str()) || 
00387      reco.Contains((ReleaseType::AsString(ReleaseType::kCedarCarrot)).c_str()) ||
00388      reco.Contains((ReleaseType::AsString(ReleaseType::kCedarDaikon)).c_str())){
00389     
00390     NtpVtxFinder vtxf;
00391     vtxf.SetTargetEvent(static_cast <int> (ntpEvent->index), 
00392                    ntpManip->GetNtpStRecord());
00393     if (vtxf.FindVertex()<0){ //Take existing vertex if fix cannot be used
00394       eventInfo->vtxX = ntpEvent->vtx.x;
00395       eventInfo->vtxY = ntpEvent->vtx.y;
00396       eventInfo->vtxZ = ntpEvent->vtx.z;
00397       eventInfo->vertexTime = ntpEvent->vtx.t;
00398     } else {
00399       eventInfo->vtxX = vtxf.VtxX();
00400       eventInfo->vtxY = vtxf.VtxY();
00401       eventInfo->vtxZ = vtxf.VtxZ();
00402       eventInfo->vertexTime = vtxf.VtxT();
00403     }//if(vtxf.FindVertex())
00404     
00405   } else {
00406     eventInfo->vtxX = ntpEvent->vtx.x;
00407     eventInfo->vtxY = ntpEvent->vtx.y;
00408     eventInfo->vtxZ = ntpEvent->vtx.z;
00409     eventInfo->vertexTime = ntpEvent->vtx.t;
00410   }//if(reco.Contains(...))
00411 
00412   FillFiducialInformation(eventInfo);
00413 
00414   if(!fStripArray) return;
00415 
00416   //loop over the strips in the shower and record which planes they are on
00417   NtpSRStrip *strip = 0;
00418   for(int i = 0; i < eventInfo->totalStrips; ++i){
00419     if (ntpEvent->stp[i] >= 0) strip = dynamic_cast<NtpSRStrip *>
00420                                   (fStripArray->At(ntpEvent->stp[i]));
00421     else continue;
00422     ++eventInfo->stripsPerPlane[strip->plane];
00423   }
00424   
00425   return;
00426 }

void ANtpInfoObjectFiller::FillFiducialInformation ( ANtpEventInfo eventInfo  )  [protected]

Definition at line 535 of file ANtpInfoObjectFiller.cxx.

References fDetector, MetersToBeam(), MetersToCloseEdge(), MetersToCoil(), ANtpEventInfo::vtxMetersToBeam, ANtpEventInfo::vtxMetersToCloseEdge, ANtpEventInfo::vtxMetersToCoil, ANtpEventInfo::vtxX, ANtpEventInfo::vtxY, and ANtpEventInfo::vtxZ.

00536 {
00537   double x = eventInfo->vtxX; 
00538   double y = eventInfo->vtxY;
00539   double z = eventInfo->vtxZ;
00540   
00541   eventInfo->vtxMetersToBeam = MetersToBeam(fDetector, x, y, z); 
00542   eventInfo->vtxMetersToCoil = MetersToCoil(fDetector, x, y); 
00543   eventInfo->vtxMetersToCloseEdge = MetersToCloseEdge(fDetector, x, y, 0);
00544 
00545   return;
00546 }

void ANtpInfoObjectFiller::FillFiducialInformation ( ANtpTrackInfo trackInfo  )  [protected]

Definition at line 514 of file ANtpInfoObjectFiller.cxx.

References ANtpTrackInfo::endMetersToBeam, ANtpTrackInfo::endMetersToCloseEdge, ANtpTrackInfo::endMetersToCoil, ANtpTrackInfo::endX, ANtpTrackInfo::endY, ANtpTrackInfo::endZ, fDetector, MetersToBeam(), MetersToCloseEdge(), MetersToCoil(), ANtpTrackInfo::vtxMetersToBeam, ANtpTrackInfo::vtxMetersToCloseEdge, ANtpTrackInfo::vtxMetersToCoil, ANtpTrackInfo::vtxX, ANtpTrackInfo::vtxY, and ANtpTrackInfo::vtxZ.

Referenced by FillEventInformation(), and FillTrackInformation().

00515 {
00516   double x = trackInfo->vtxX; 
00517   double y = trackInfo->vtxY;
00518   double z = trackInfo->vtxZ;
00519 
00520   trackInfo->vtxMetersToBeam = MetersToBeam(fDetector, x, y, z); 
00521   trackInfo->vtxMetersToCoil = MetersToCoil(fDetector, x, y); 
00522   trackInfo->vtxMetersToCloseEdge = MetersToCloseEdge(fDetector, x,y, 0);
00523   
00524   x = trackInfo->endX; 
00525   y = trackInfo->endY;
00526   z = trackInfo->endZ;
00527 
00528   trackInfo->endMetersToBeam = MetersToBeam(fDetector, x, y, z);
00529   trackInfo->endMetersToCoil = MetersToCoil(fDetector, x, y);
00530   trackInfo->endMetersToCloseEdge = MetersToCloseEdge(fDetector, x, y, 1);
00531   return;
00532 }

void ANtpInfoObjectFiller::FillHeaderInformation ( ANtpRecoNtpManipulator ntpManip,
Detector::Detector_t  det,
SimFlag::SimFlag_t  dataType,
ANtpHeaderInfo headerInfo 
)

Definition at line 124 of file ANtpInfoObjectFiller.cxx.

References AstUtil::CalendarToJulian(), ANtpHeaderInfo::coilCurrent, ANtpHeaderInfo::coilStatus, NtpSRDataQuality::cratemask, ANtpHeaderInfo::crateMask, ANtpHeaderInfo::dataType, ANtpHeaderInfo::day, ANtpHeaderInfo::detector, ANtpHeaderInfo::events, fRowNum, fStripArray, fVldc, CoilTools::GetCoilState(), BfldDbiCoilState::GetCurrent(), Dcs_Mag_Near::GetCurrent(), ANtpRecoNtpManipulator::GetDataQuality(), ANtpRecoNtpManipulator::GetDmxStatusInfo(), HvStatusFinder::GetHvStatus(), CoilTools::GetMagNear(), ANtpRecoNtpManipulator::GetNtpStRecord(), ANtpRecoNtpManipulator::GetReleaseMCType(), ANtpRecoNtpManipulator::GetRun(), ANtpRecoNtpManipulator::GetSnarl(), ANtpRecoNtpManipulator::GetSnarlEventSummary(), ANtpRecoNtpManipulator::GetSpillType(), ANtpRecoNtpManipulator::GetSubRun(), ANtpRecoNtpManipulator::GetTriggerSource(), HvStatus::Good(), AstUtil::GSTToLST(), Munits::hour, ANtpHeaderInfo::hour, ANtpHeaderInfo::hvStatus, CoilTools::Instance(), HvStatusFinder::Instance(), DataUtil::IsGoodData(), ANtpHeaderInfo::isGoodData, ANtpHeaderInfo::isLI, LISieve::IsLI(), LISieve::IsLIforNC(), ANtpHeaderInfo::isLIold, CoilTools::IsOK(), CoilTools::IsReverse(), ANtpHeaderInfo::julianDate, AstUtil::JulianToGMST(), Detector::kFar, AstUtil::kFarDetLongitude, SimFlag::kMC, Detector::kNear, AstUtil::kNearDetLongitude, Msg::kWarning, ANtpHeaderInfo::localSiderealTime, ANtpHeaderInfo::minute, ANtpHeaderInfo::month, MSG, ANtpHeaderInfo::newSnarl, ANtpHeaderInfo::passedDeMux, NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, ANtpHeaderInfo::Reset(), ANtpHeaderInfo::run, ANtpHeaderInfo::second, NtpSRPulseHeight::sigcor, ANtpHeaderInfo::slices, ANtpHeaderInfo::snarl, ANtpHeaderInfo::snarlPE, ANtpHeaderInfo::snarlPulseHeight, ANtpHeaderInfo::snarlPulseHeight2PE, ANtpHeaderInfo::sntpRow, ANtpHeaderInfo::softVersion, ANtpHeaderInfo::spillType, ANtpHeaderInfo::subRun, ANtpHeaderInfo::triggerPMTTime, ANtpHeaderInfo::triggerSource, ANtpHeaderInfo::triggerTime, ANtpHeaderInfo::utc, and ANtpHeaderInfo::year.

Referenced by CondensedNtpModule::Ana(), CondensedNtpModuleAtm::Ana(), and CondensedNtpModuleNC::Ana().

00128 {
00129   const NtpSREventSummary& summary(ntpManip->GetSnarlEventSummary());
00130 
00131   headerInfo->Reset();
00132   
00133   headerInfo->detector = (int)det;
00134   headerInfo->dataType = (int)dataType;
00135   headerInfo->run = ntpManip->GetRun();
00136   headerInfo->subRun = ntpManip->GetSubRun();
00137   headerInfo->snarl = ntpManip->GetSnarl();
00138   //always call it a new snarl because this method is called once per record
00139   //reset the value in the loop over events in the module
00140   headerInfo->newSnarl = 1; 
00141   headerInfo->triggerSource = ntpManip->GetTriggerSource();
00142   headerInfo->spillType = ntpManip->GetSpillType();
00143   headerInfo->events = summary.nevent;
00144   headerInfo->slices = summary.nslice;
00145   headerInfo->year = (int)summary.date.year;
00146   headerInfo->month = (int)summary.date.month;
00147   headerInfo->day = (int)summary.date.day;
00148   headerInfo->hour = (int)summary.date.hour;
00149   headerInfo->minute = (int)summary.date.minute;
00150   headerInfo->utc = summary.date.utc;
00151 
00152 
00153   headerInfo->second = summary.date.sec;
00154   // It sometimes happens in MRCC files that summary.trigtime and
00155   // summary.date.sec are filled with junk. If this is the case,
00156   // refill the second based on the utc value, which is still
00157   // correct. This means we lose the fractional part, but since
00158   // trigtime is wrong, we couldn't have got it anyway
00159   if(headerInfo->second<0 || headerInfo->second>61 || isnan(headerInfo->second)){
00160     MSG("ANtpInfoObjectFiller", Msg::kWarning) 
00161       << "summary.date.sec out of range (" << summary.date.sec << ") " 
00162       << "Resetting from utc" << endl;
00163     // Code shamelessly stolen from VldTimeStamp::GetTime
00164     time_t atime=summary.date.utc;
00165     struct tm* ptm=gmtime(&atime);
00166     headerInfo->second=ptm->tm_sec;
00167   }
00168 
00169 
00170   double longitude = AstUtil::kFarDetLongitude;
00171   if(det == Detector::kNear) longitude = AstUtil::kNearDetLongitude;
00172   double gmst = 0.;
00173   double hour = 1.*headerInfo->hour + 1.*headerInfo->minute/60. + headerInfo->second/3600.;
00174   AstUtil::CalendarToJulian(headerInfo->year, headerInfo->month, 
00175                             headerInfo->day, hour, headerInfo->julianDate);
00176   AstUtil::JulianToGMST(headerInfo->julianDate, gmst);
00177   AstUtil::GSTToLST(gmst, longitude, headerInfo->localSiderealTime);
00178 
00179   headerInfo->snarlPulseHeight = summary.ph.sigcor;     
00180   headerInfo->triggerPMTTime = summary.litime;
00181   // This still won't protect against the case of trigtime being
00182   // filled with junk that is interpreted as a very tiny positive
00183   // number, but it's the best we can do I think
00184   if(summary.trigtime<0 || summary.trigtime>1){
00185     MSG("ANtpInfoObjectFiller", Msg::kWarning) 
00186       << "summary.trigtime out of range (" << summary.trigtime << ") " 
00187       << "Resetting to zero." << endl;
00188     headerInfo->triggerTime=0;
00189   }
00190   else{
00191     headerInfo->triggerTime = summary.trigtime;
00192   }
00193   headerInfo->passedDeMux = 1;
00194   headerInfo->crateMask = ntpManip->GetDataQuality().cratemask;
00195   //headerInfo->isGoodFDData = (int)DataUtil::IsGoodFDData(ntpManip->GetNtpStRecord());
00196   headerInfo->isGoodData = (int)DataUtil::IsGoodData(ntpManip->GetNtpStRecord());
00197 
00198   //......................................................................
00199   //Now fill new data members
00200   headerInfo->snarlPE = summary.ph.pe;
00201   headerInfo->sntpRow = fRowNum++;
00202   headerInfo->isLIold = LISieve::IsLI( *(ntpManip->GetNtpStRecord()) );
00203   headerInfo->isLI = LISieve::IsLIforNC( *(ntpManip->GetNtpStRecord()) );
00204 
00205   //......................................................................
00206   //Fill Release type member
00207   headerInfo->softVersion = ntpManip->GetReleaseMCType();
00208   
00209   //Passed DeMux flag
00210   if(det == Detector::kFar) {
00211     const NtpSRDmxStatus& dmx( ntpManip->GetDmxStatusInfo());
00212     if (dmx.ismultimuon || dmx.validplanesfail) headerInfo->passedDeMux = 0;
00213   }
00214   
00215   //loop over the strips to figure out the 
00216   double ph2pe = 0.;
00217   double ph = 0.;
00218   NtpSRStrip *strip = 0;
00219   for(int i = 0; i < fStripArray->GetLast()+1; ++i){
00220     strip = dynamic_cast<NtpSRStrip *>(fStripArray->At(i));
00221     ph = strip->ph0.pe+strip->ph1.pe;
00222     if(ph > 2.) ph2pe += strip->ph0.sigcor + strip->ph1.sigcor;
00223   }
00224   headerInfo->snarlPulseHeight2PE = ph2pe;
00225     
00226   //figure out the coil status
00227   headerInfo->coilStatus = 0;
00228 
00229   //coil is always on in the MC
00230   if(dataType == SimFlag::kMC){
00231     headerInfo->coilStatus = 1;
00232     return;
00233   }
00234 
00235   //get the appropriate context
00236   VldTimeStamp timeStamp(headerInfo->year, headerInfo->month, 
00237                          headerInfo->day, headerInfo->hour, 
00238                          headerInfo->minute, 
00239                          TMath::Nint(headerInfo->second));
00240   fVldc = VldContext(det, dataType, timeStamp);
00241 
00242   //check out the HV status of the detector - only works for 
00243   //far detector currently
00244   if(det == Detector::kFar){
00245     HvStatus::HvStatus_t hv = HvStatusFinder::Instance().GetHvStatus(fVldc,60,1);
00246     headerInfo->hvStatus = (int)HvStatus::Good(hv);
00247     //   MSG("ANtpInfoObjectFiller", Msg::kInfo) << HvStatus::Good(hv)
00248     //                                    << " " 
00249     //                                    << headerInfo->hvStatus
00250     //                                    << endl;
00251     const BfldDbiCoilState *farstate = CoilTools::Instance().GetCoilState(fVldc);
00252     if(farstate) headerInfo->coilCurrent =  farstate->GetCurrent();
00253   }
00254   else if(det == Detector::kNear){
00255     const Dcs_Mag_Near *nearstate = CoilTools::Instance().GetMagNear(fVldc);
00256     if(nearstate) headerInfo->coilCurrent = nearstate->GetCurrent();
00257   }
00258 
00259   //CoilTools allows for generic access of the database - no 
00260   //detector dependent stuff needed by user
00261   if( CoilTools::IsReverse(fVldc) ) headerInfo->coilStatus = -1;
00262   else headerInfo->coilStatus = 1;
00263   
00264   if( !CoilTools::IsOK(fVldc) ) headerInfo->coilStatus = 0;
00265 
00266   return;
00267 }

void ANtpInfoObjectFiller::FillMCTruthInformation ( NtpMCTruth ntpMCTruth,
ANtpTruthInfo truthInfo 
) [static]

Definition at line 430 of file ANtpInfoObjectFiller.cxx.

References ANtpTruthInfo::hadronicY, NtpMCTruth::iaction, ANtpTruthInfo::interactionType, NtpMCTruth::inu, ANtpDefaultValue::kFloat, 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(), ANtpInfoObjectFillerMRCC::FillEventInformationHelper(), CondensedNtpModuleAtm::FillMCInformation(), ANtpInfoObjectFillerNC::FillMCInformation(), and CondensedNtpModule::FillUnRecoedMCInformation().

00432 {
00433   const Float_t muMass = 0.105658357; //mu mass in GeV/c
00434   const Float_t eMass = 0.000510999; //e mass in GeV/c
00435   const Float_t tauMass = 1.777;      //tau mass in GeV/c
00436 
00437   truthInfo->Reset();
00438   truthInfo->nuEnergy = ntpMCTruth->p4neu[3];
00439   truthInfo->nuVtxX = ntpMCTruth->vtxx;
00440   truthInfo->nuVtxY = ntpMCTruth->vtxy;
00441   truthInfo->nuVtxZ = ntpMCTruth->vtxz;
00442   if(TMath::Abs(truthInfo->nuEnergy) > 0.){
00443     truthInfo->nuDCosX = ntpMCTruth->p4neu[0]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);
00444     truthInfo->nuDCosY = ntpMCTruth->p4neu[1]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);
00445     truthInfo->nuDCosZ = ntpMCTruth->p4neu[2]/TMath::Sqrt(truthInfo->nuEnergy*truthInfo->nuEnergy);             
00446   }
00447   else{
00448     truthInfo->nuDCosX = -10000.;
00449     truthInfo->nuDCosY = -10000.;
00450     truthInfo->nuDCosZ = -10000.;
00451   }
00452   truthInfo->nuFlavor = ntpMCTruth->inu;
00453   truthInfo->interactionType = ntpMCTruth->iaction;
00454   
00455   truthInfo->targetEnergy = ntpMCTruth->p4tgt[3];
00456   truthInfo->targetPX = ntpMCTruth->p4tgt[0];
00457   truthInfo->targetPY = ntpMCTruth->p4tgt[1];
00458   truthInfo->targetPZ = ntpMCTruth->p4tgt[2];
00459   
00460   truthInfo->hadronicY = ntpMCTruth->y;
00461   
00462   truthInfo->showerEnergy = 0.;
00463   float showerMomentumSqr = 0.;
00464   if(ntpMCTruth->p4shw[3]>0. && TMath::Abs(ntpMCTruth->p4shw[0] + 
00465                                            ntpMCTruth->p4shw[1] + 
00466                                            ntpMCTruth->p4shw[2]) > 0.){
00467     truthInfo->showerEnergy = ntpMCTruth->p4shw[3];
00468     showerMomentumSqr = ntpMCTruth->p4shw[0]*ntpMCTruth->p4shw[0];
00469     showerMomentumSqr += ntpMCTruth->p4shw[1]*ntpMCTruth->p4shw[1];
00470     showerMomentumSqr += ntpMCTruth->p4shw[2]*ntpMCTruth->p4shw[2];
00471     truthInfo->showerDCosX = ntpMCTruth->p4shw[0]/TMath::Sqrt(showerMomentumSqr);
00472     truthInfo->showerDCosY = ntpMCTruth->p4shw[1]/TMath::Sqrt(showerMomentumSqr);
00473     truthInfo->showerDCosZ = ntpMCTruth->p4shw[2]/TMath::Sqrt(showerMomentumSqr);
00474   }
00475   else{
00476     truthInfo->showerDCosX = ANtpDefVal::kFloat;
00477     truthInfo->showerDCosY = ANtpDefVal::kFloat;
00478     truthInfo->showerDCosZ = ANtpDefVal::kFloat;
00479   }
00480   
00481   truthInfo->leptonMomentum = 0.;
00482   if(TMath::Abs(ntpMCTruth->p4mu1[3])>muMass){
00483     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4mu1[3]*ntpMCTruth->p4mu1[3] - muMass*muMass);
00484     truthInfo->leptonDCosX = ntpMCTruth->p4mu1[0]/truthInfo->leptonMomentum;
00485     truthInfo->leptonDCosY = ntpMCTruth->p4mu1[1]/truthInfo->leptonMomentum;
00486     truthInfo->leptonDCosZ = ntpMCTruth->p4mu1[2]/truthInfo->leptonMomentum;            
00487     if(ntpMCTruth->p4mu1[3]<0.) truthInfo->leptonMomentum *= -1.;
00488   }
00489   else if(TMath::Abs(ntpMCTruth->p4el1[3])>eMass){
00490     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4el1[3]*ntpMCTruth->p4el1[3] - eMass*eMass);
00491     truthInfo->leptonDCosX = ntpMCTruth->p4el1[0]/truthInfo->leptonMomentum;
00492     truthInfo->leptonDCosY = ntpMCTruth->p4el1[1]/truthInfo->leptonMomentum;
00493     truthInfo->leptonDCosZ = ntpMCTruth->p4el1[2]/truthInfo->leptonMomentum;            
00494     if(ntpMCTruth->p4el1[3]<0.) truthInfo->leptonMomentum *= -1.;
00495   }
00496   else if(TMath::Abs(ntpMCTruth->p4tau[3])>tauMass){
00497     truthInfo->leptonMomentum = TMath::Sqrt(ntpMCTruth->p4tau[3]*ntpMCTruth->p4tau[3] - tauMass*tauMass);
00498     truthInfo->leptonDCosX = ntpMCTruth->p4tau[0]/truthInfo->leptonMomentum;
00499     truthInfo->leptonDCosY = ntpMCTruth->p4tau[1]/truthInfo->leptonMomentum;
00500     truthInfo->leptonDCosZ = ntpMCTruth->p4tau[2]/truthInfo->leptonMomentum;            
00501     if(ntpMCTruth->p4tau[3]<0.) truthInfo->leptonMomentum *= -1.;
00502   }
00503   else{
00504     truthInfo->leptonDCosX = ANtpDefVal::kFloat;
00505     truthInfo->leptonDCosY = ANtpDefVal::kFloat;
00506     truthInfo->leptonDCosZ = ANtpDefVal::kFloat;                
00507   }
00508     
00509   
00510   return;
00511 }

void ANtpInfoObjectFiller::FillShowerInformation ( NtpSRShower ntpShower,
ANtpShowerInfo showerInfo 
)

Definition at line 330 of file ANtpInfoObjectFiller.cxx.

References NtpSRPlane::beg, ANtpShowerInfo::begPlane, ANtpShowerInfo::dcosX, NtpSRVertex::dcosx, ANtpShowerInfo::dcosY, NtpSRVertex::dcosy, ANtpShowerInfo::dcosZ, NtpSRVertex::dcosz, ANtpShowerInfo::deweightCCGeV, ANtpShowerInfo::deweightNCGeV, NtpSRPlane::end, ANtpShowerInfo::endPlane, fStripArray, NtpSRShowerPulseHeight::linCCgev, ANtpShowerInfo::linearCCGeV, ANtpShowerInfo::linearNCGeV, NtpSRShowerPulseHeight::linNCgev, NtpSRPlane::n, NtpSRShower::nstrip, NtpSRShower::ph, NtpSRShower::plane, NtpSRStrip::plane, ANtpShowerInfo::planes, ANtpShowerInfo::pulseHeight, ANtpShowerInfo::Reset(), NtpSRShower::shwph, NtpSRPulseHeight::sigcor, NtpSRShower::stp, ANtpShowerInfo::stripsPerPlane, ANtpShowerInfo::totalStrips, NtpSRShower::vtx, ANtpShowerInfo::vtxX, ANtpShowerInfo::vtxY, ANtpShowerInfo::vtxZ, NtpSRShowerPulseHeight::wtCCgev, NtpSRShowerPulseHeight::wtNCgev, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

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

00332 {
00333   showerInfo->Reset();
00334   showerInfo->planes = ntpShower->plane.n;
00335   showerInfo->totalStrips = ntpShower->nstrip;
00336   showerInfo->begPlane = ntpShower->plane.beg;
00337   showerInfo->endPlane = ntpShower->plane.end;
00338   showerInfo->vtxX = ntpShower->vtx.x;
00339   showerInfo->vtxY = ntpShower->vtx.y;
00340   showerInfo->vtxZ = ntpShower->vtx.z;
00341   showerInfo->dcosX = ntpShower->vtx.dcosx;
00342   showerInfo->dcosY = ntpShower->vtx.dcosy;
00343   showerInfo->dcosZ = ntpShower->vtx.dcosz;
00344   showerInfo->pulseHeight = ntpShower->ph.sigcor;//used to be sigmap
00345   showerInfo->linearCCGeV = ntpShower->shwph.linCCgev;
00346   showerInfo->linearNCGeV = ntpShower->shwph.linNCgev;
00347   showerInfo->deweightCCGeV = ntpShower->shwph.wtCCgev;
00348   showerInfo->deweightNCGeV = ntpShower->shwph.wtNCgev;
00349 
00350   //loop over the strips in the shower and record which planes they are on
00351   NtpSRStrip *strip = 0;
00352   for(int i = 0; i < showerInfo->totalStrips; ++i){
00353     strip = dynamic_cast<NtpSRStrip *>(fStripArray->At(ntpShower->stp[i]));
00354     ++showerInfo->stripsPerPlane[strip->plane];
00355   }
00356   
00357   return;
00358 }

void ANtpInfoObjectFiller::FillTrackInformation ( NtpSRTrack ntpTrack,
ANtpTrackInfo trackInfo 
)

Definition at line 271 of file ANtpInfoObjectFiller.cxx.

References ANtpTrackInfo::backwardRMS, NtpSRTrackTime::backwardRMS, NtpSRPlane::beg, ANtpTrackInfo::begPlane, ANtpTrackInfo::begPlaneU, ANtpTrackInfo::begPlaneV, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRFitTrack::chi2, NtpSRVertex::dcosx, ANtpTrackInfo::dcosXEnd, ANtpTrackInfo::dcosXVtx, NtpSRVertex::dcosy, ANtpTrackInfo::dcosYEnd, ANtpTrackInfo::dcosYVtx, NtpSRVertex::dcosz, ANtpTrackInfo::dcosZEnd, ANtpTrackInfo::dcosZVtx, NtpSRTrack::ds, NtpSRPlane::end, NtpSRTrack::end, ANtpTrackInfo::endPlane, ANtpTrackInfo::endPlaneU, ANtpTrackInfo::endPlaneV, NtpSRPlane::endu, NtpSRPlane::endv, ANtpTrackInfo::endX, ANtpTrackInfo::endY, ANtpTrackInfo::endZ, NtpSRMomentum::eqp, FillFiducialInformation(), NtpSRTrack::fit, ANtpTrackInfo::fitMomentum, ANtpTrackInfo::forwardRMS, NtpSRTrackTime::forwardRMS, fStripArray, GetTrackTrace(), ANtpTrackInfo::length, NtpSRTrack::momentum, NtpSRPlane::n, NtpSRFitTrack::ndof, NtpSRTrack::nstrip, NtpSRFitTrack::pass, ANtpTrackInfo::passedFit, NtpSRTrack::ph, NtpSRStrip::plane, NtpSRTrack::plane, ANtpTrackInfo::planes, ANtpTrackInfo::pulseHeight, NtpSRMomentum::qp, NtpSRMomentum::range, ANtpTrackInfo::rangeMomentum, ANtpTrackInfo::reducedChi2, ANtpTrackInfo::Reset(), NtpSRPulseHeight::sigcor, ANtpTrackInfo::sigmaQoverP, NtpSRTrack::stp, ANtpTrackInfo::stripsPerPlane, NtpSRTrack::time, 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(), ANtpAnalysisInfoAna::FillNueAnalysisInformation(), and CondensedNtpModuleAtm::FillTrackInformation().

00273 {
00274   
00275   trackInfo->Reset();
00276   trackInfo->planes = ntpTrack->plane.n;
00277   trackInfo->totalStrips = ntpTrack->nstrip;
00278   trackInfo->pulseHeight = ntpTrack->ph.sigcor;
00279   if(TMath::Abs(ntpTrack->momentum.qp) > 0.) 
00280     trackInfo->fitMomentum = (1./ntpTrack->momentum.qp);
00281   trackInfo->sigmaQoverP = ntpTrack->momentum.eqp;
00282   trackInfo->rangeMomentum = ntpTrack->momentum.range;                            
00283   trackInfo->begPlane = ntpTrack->plane.beg;
00284   trackInfo->endPlane = ntpTrack->plane.end;
00285   trackInfo->begPlaneU = ntpTrack->plane.begu;
00286   trackInfo->endPlaneU = ntpTrack->plane.endu;
00287   trackInfo->begPlaneV = ntpTrack->plane.begv;
00288   trackInfo->endPlaneV = ntpTrack->plane.endv;
00289   trackInfo->length = ntpTrack->ds;
00290   trackInfo->vtxX = ntpTrack->vtx.x; 
00291   trackInfo->vtxY = ntpTrack->vtx.y; 
00292   trackInfo->vtxZ = ntpTrack->vtx.z; 
00293   trackInfo->dcosXVtx = ntpTrack->vtx.dcosx;
00294   trackInfo->dcosYVtx = ntpTrack->vtx.dcosy;
00295   trackInfo->dcosZVtx = ntpTrack->vtx.dcosz;
00296   trackInfo->endX = ntpTrack->end.x; 
00297   trackInfo->endY = ntpTrack->end.y; 
00298   trackInfo->endZ = ntpTrack->end.z; 
00299   trackInfo->dcosXEnd = ntpTrack->end.dcosx;
00300   trackInfo->dcosYEnd = ntpTrack->end.dcosy;
00301   trackInfo->dcosZEnd = ntpTrack->end.dcosz;
00302   trackInfo->passedFit = 0;
00303   if(ntpTrack->fit.pass) trackInfo->passedFit = 1;
00304   trackInfo->reducedChi2 = ntpTrack->fit.chi2;
00305   if(ntpTrack->fit.ndof>0.) 
00306     trackInfo->reducedChi2 /= 1.*ntpTrack->fit.ndof;
00307 
00308   trackInfo->forwardRMS = ntpTrack->time.forwardRMS;
00309   trackInfo->backwardRMS = ntpTrack->time.backwardRMS;
00310 
00311     GetTrackTrace(ntpTrack, trackInfo, -1);
00312   GetTrackTrace(ntpTrack, trackInfo, 1);
00313 
00314   FillFiducialInformation(trackInfo);
00315 
00316   //loop over the strips in the track and record which planes they are on
00317   NtpSRStrip *strip = 0;
00318   for(int i = 0; i < trackInfo->totalStrips; ++i){
00319     if (ntpTrack->stp[i] >=0) strip = dynamic_cast<NtpSRStrip *>
00320                                 (fStripArray->At(ntpTrack->stp[i]));
00321     else continue;
00322     ++trackInfo->stripsPerPlane[strip->plane];
00323   }
00324     
00325   return;
00326 }

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

Definition at line 574 of file ANtpInfoObjectFiller.cxx.

References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosx, NtpSRVertex::dcosy, NtpSRVertex::dcosz, MuELoss::e, NtpSRTrack::end, kFarSideLength, 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().

00577 {
00578   
00579   //get the trace for the track - this is very far detector centric for now,
00580   //adapted from C. Howcroft's code
00581   
00582   //direction tells you whether to trace back from vertex (-1) or forward from end (1)
00583   
00584   //side is as labeled below
00585   /*
00586              0
00587           --------
00588        7 /        \ 1
00589         /   y|     \
00590      6 |     |      | 2
00591        |     ----   |
00592       5 \      x   / 3
00593          \        /
00594           --------
00595               4
00596   */  
00597   double dcos[3] = {direction*ntpTrack->vtx.dcosx,
00598                     direction*ntpTrack->vtx.dcosy,
00599                     direction*ntpTrack->vtx.dcosz}; 
00600   double dcosUV[3] = {direction*ntpTrack->vtx.dcosu,
00601                       direction*ntpTrack->vtx.dcosv,
00602                       direction*ntpTrack->vtx.dcosz}; 
00603   double endPointXY[3] = {ntpTrack->vtx.x, ntpTrack->vtx.y, ntpTrack->vtx.z};
00604   double endPointUV[3] = {ntpTrack->vtx.u, ntpTrack->vtx.v, ntpTrack->vtx.z};
00605   
00606   if(direction > 0){
00607     endPointXY[0] = ntpTrack->end.x;
00608     endPointXY[1] = ntpTrack->end.y;
00609     endPointXY[2] = ntpTrack->end.z;
00610     endPointUV[0] = ntpTrack->end.u;
00611     endPointUV[1] = ntpTrack->end.v;
00612     endPointUV[2] = ntpTrack->end.z;
00613     dcos[0] = ntpTrack->end.dcosx;
00614     dcos[1] = ntpTrack->end.dcosy;
00615     dcos[2] = ntpTrack->end.dcosz;
00616     dcosUV[0] = ntpTrack->end.dcosu;
00617     dcosUV[1] = ntpTrack->end.dcosv;
00618     dcosUV[2] = ntpTrack->end.dcosz;
00619   }
00620   
00621   int side = -1;
00622   double xzproj[2]={-999., -999.};   
00623   double entry[3] = {0.};
00624   double minpath = 99e99;
00625   double tmppath = 0.;
00626   double maxDetectorY = 4.;
00627   double sidelength = kFarSideLength;
00628   
00629   if(TMath::IsNaN(endPointUV[0]) || TMath::IsNaN(endPointUV[1]) 
00630      || TMath::IsNaN(dcosUV[0]) || TMath::IsNaN(dcosUV[1]) 
00631      || TMath::IsNaN(dcos[2])) return;
00632   
00633   if(TMath::Abs(dcos[1])>1.e-6){ 
00634     // Y - SIDES
00635     //SIDE 0 
00636     xzproj[0] = endPointXY[0] + (dcos[0]/dcos[1])*(maxDetectorY - endPointXY[1]);
00637     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[1])*(maxDetectorY - endPointXY[1]);
00638     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00639       tmppath = Sqr(endPointXY[0] - xzproj[0]) 
00640               + Sqr(endPointXY[1] - maxDetectorY) 
00641               + Sqr(endPointXY[2] - xzproj[1]);
00642       if(TMath::Finite(tmppath)){
00643         tmppath = TMath::Sqrt(tmppath);
00644         if(tmppath < minpath){
00645           minpath  = tmppath;
00646           entry[0] = xzproj[0];
00647           entry[2] = xzproj[1];
00648           entry[1] = maxDetectorY;
00649           side     = 0;
00650         }                       
00651       }      
00652     }//end side 0
00653     //SIDE 4 
00654     xzproj[0] = endPointXY[0] + (dcos[0]/dcos[1])*(-maxDetectorY - endPointXY[1]);
00655     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[1])*(-maxDetectorY - endPointXY[1]);
00656     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00657       tmppath = Sqr(endPointXY[0] - xzproj[0]) 
00658               + Sqr(endPointXY[1] + maxDetectorY) 
00659               + Sqr(endPointXY[2] - xzproj[1]);
00660       if(TMath::Finite(tmppath)){
00661         tmppath = TMath::Sqrt(tmppath);
00662         if(tmppath<minpath){
00663           minpath  = tmppath;
00664           entry[0] = xzproj[0];
00665           entry[2] = xzproj[1];
00666           entry[1] = -maxDetectorY;
00667           side     = 4;
00668         }                       
00669       }      
00670     }//end side 4
00671   }//end Y sides
00672   if(TMath::Abs(dcos[0])>1e-6){  // X - SIDES
00673     //SIDE 2 
00674     xzproj[0] = endPointXY[1] + (dcos[1]/dcos[0])*(maxDetectorY - endPointXY[0]);
00675     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[0])*(maxDetectorY - endPointXY[0]);
00676     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00677       tmppath = (endPointXY[1] - xzproj[0])    * (endPointXY[1] - xzproj[0]) 
00678               + (endPointXY[0] - maxDetectorY) * (endPointXY[0] - maxDetectorY) 
00679               + (endPointXY[2] - xzproj[1])    * (endPointXY[2] - xzproj[1]);
00680       if(TMath::Finite(tmppath)){
00681         tmppath = TMath::Sqrt(tmppath);
00682         if(tmppath<minpath){
00683           minpath  = tmppath;
00684           entry[1] = xzproj[0];
00685           entry[2] = xzproj[1];
00686           entry[0] = maxDetectorY;
00687           side     = 2;
00688         }               
00689       }       
00690     }//end side 2      
00691     //SIDE 6 
00692     xzproj[0] = endPointXY[1] + (dcos[1]/dcos[0])*(-maxDetectorY - endPointXY[0]);
00693     xzproj[1] = endPointXY[2] + (dcos[2]/dcos[0])*(-maxDetectorY - endPointXY[0]);
00694     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00695       tmppath = Sqr(endPointXY[1] - xzproj[0]) 
00696               + Sqr(endPointXY[0] + maxDetectorY) 
00697               + Sqr(endPointXY[2] - xzproj[1]);
00698       if(TMath::Finite(tmppath)){
00699         tmppath = TMath::Sqrt(tmppath);
00700         if(tmppath<minpath){
00701           minpath  = tmppath;
00702           entry[1] = xzproj[0];
00703           entry[2] = xzproj[1];
00704           entry[0] = -maxDetectorY;
00705           side     = 6;
00706         }
00707       }                       
00708     }//end if side 6      
00709   }//end x sides
00710   if(TMath::Abs(dcosUV[0])>1.e-6){  // U - SIDES
00711     //SIDE 1 
00712     xzproj[0] = endPointUV[1] + (dcosUV[1]/dcosUV[0])*(maxDetectorY - endPointUV[0]);
00713     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[0])*(maxDetectorY - endPointUV[0]);
00714     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00715       tmppath = Sqr(ntpTrack->vtx.v - xzproj[0]) 
00716               + Sqr(ntpTrack->vtx.u - maxDetectorY) 
00717               + Sqr(endPointXY[2] - xzproj[1]);
00718       if(TMath::Finite(tmppath)){
00719         tmppath = TMath::Sqrt(tmppath);
00720         if(tmppath<minpath){
00721           minpath  = tmppath;
00722           entry[0] = kInverseSqrt2*(maxDetectorY - xzproj[0]) ;
00723           entry[2] = xzproj[1];
00724           entry[1] = kInverseSqrt2*(maxDetectorY + xzproj[0]) ;
00725           side     = 1;
00726         }                       
00727       }      
00728     }//end if side1 
00729     //SIDE 5 
00730     xzproj[0] = endPointUV[1] + (dcosUV[1]/dcosUV[0])*(-maxDetectorY - endPointUV[0]);
00731     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[0])*(-maxDetectorY - endPointUV[0]);
00732     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00733       tmppath = Sqr(ntpTrack->vtx.v - xzproj[0]) 
00734               + Sqr(ntpTrack->vtx.u + maxDetectorY) 
00735               + Sqr(endPointXY[2] - xzproj[1]);
00736       if(TMath::Finite(tmppath)){
00737         tmppath = TMath::Sqrt(tmppath);
00738         if(tmppath<minpath){
00739           minpath  = tmppath;
00740           entry[0] = kInverseSqrt2*(-maxDetectorY - xzproj[0]) ;
00741           entry[2] = xzproj[1];
00742           entry[1] = kInverseSqrt2*(-maxDetectorY + xzproj[0]) ;
00743           side     = 5;
00744         }                             
00745       }
00746     }//end if side 5 
00747   }//end u sides
00748   if(TMath::Abs(dcosUV[1])>1.e-6){  // V - SIDES
00749     //SIDE 7
00750     xzproj[0] = endPointUV[0] + (dcosUV[0]/dcosUV[1])*(maxDetectorY - endPointUV[1]);
00751     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[1])*(maxDetectorY - endPointUV[1]);
00752     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00753       tmppath =  Sqr(ntpTrack->vtx.u - xzproj[0]) 
00754               + Sqr(ntpTrack->vtx.v - maxDetectorY) 
00755               + Sqr(endPointXY[2] - xzproj[1]);
00756       if(TMath::Finite(tmppath)){
00757         tmppath = TMath::Sqrt ( tmppath);
00758         if(tmppath<minpath){
00759           minpath  = tmppath;
00760           entry[0] = kInverseSqrt2*(xzproj[0]-maxDetectorY) ;
00761           entry[2] = xzproj[1];
00762           entry[1] = kInverseSqrt2*(xzproj[0]+maxDetectorY) ;
00763           side     = 7;
00764         }                       
00765       }      
00766     }//end if side7
00767     //SIDE 3
00768     xzproj[0] = endPointUV[0] + (dcosUV[0]/dcosUV[1])*(-maxDetectorY - endPointUV[1]);
00769     xzproj[1] = endPointXY[2] + (dcos[2]/dcosUV[1])*(-maxDetectorY - endPointUV[1]);
00770     if(TMath::Abs(xzproj[0]) < sidelength && ((xzproj[1] -  endPointXY[2])*dcos[2]) > 0.0){
00771       tmppath = Sqr(ntpTrack->vtx.u - xzproj[0]) 
00772               + Sqr(ntpTrack->vtx.v + maxDetectorY) 
00773               + Sqr(endPointXY[2] - xzproj[1]);
00774       if(TMath::Finite(tmppath)){
00775         tmppath = TMath::Sqrt(tmppath);
00776         if(tmppath<minpath){
00777           minpath  = tmppath;
00778           entry[0] = kInverseSqrt2*(xzproj[0]+maxDetectorY) ;
00779           entry[2] = xzproj[1];
00780           entry[1] = kInverseSqrt2*(xzproj[0]-maxDetectorY) ;
00781           side     = 3;
00782         }                         
00783       }    
00784     }//end if side 3    
00785   }//end v sides
00786   
00787   if(direction < 0){
00788     trackInfo->traceVtx = TMath::Sqrt(Sqr(endPointXY[0]-entry[0]) + Sqr(endPointXY[1]-entry[1])
00789                                       + Sqr(endPointXY[2]-entry[2]));
00790     trackInfo->traceVtxZ = entry[2] - endPointXY[2];
00791     
00792   } 
00793   else if(direction > 0){
00794     trackInfo->traceEnd = TMath::Sqrt(Sqr(ntpTrack->end.x-entry[0]) + Sqr(ntpTrack->end.y-entry[1])
00795                                       + Sqr(ntpTrack->end.z-entry[2]));
00796     trackInfo->traceEndZ = entry[2] - ntpTrack->end.z;
00797     
00798   } 
00799   
00800   return;
00801 }

Float_t ANtpInfoObjectFiller::MetersToBeam ( Detector::Detector_t  det,
Float_t  x,
Float_t  y,
Float_t  z 
)

Definition at line 804 of file ANtpInfoObjectFiller.cxx.

References Detector::kFar, ANtpDefaultValue::kFloat, Detector::kNear, and Munits::m.

Referenced by ANtpEventInfoAna::Analyze(), and FillFiducialInformation().

00809                      :
00810   // Beam is at x = 1.4485m
00811   // Beam dy/dz = -0.0578 (angle = -3.31deg) to the z-axis 
00812   // Beam passes through y = 0 at back of golden region (plane 90)
00813   //  \-> Beam passes through y = 0.3087 @ z = 0  
00814   // Still looking for hard evidence about this.
00815 {
00816   if (det == Detector::kNear) {
00817     const Float_t dydz(-0.0578); 
00818     const Float_t beamCenterX(1.4885 * Munits::m);
00819     const Float_t beamCenterY0(0.3087 * Munits::m);
00820 
00821     x -= beamCenterX;
00822     y -= beamCenterY0 + dydz * z; 
00823     return TMath::Sqrt(x*x + y*y);
00824   }
00825 
00826   else if (det == Detector::kFar){
00827     //Beam center is faintly meaningless for FD cut
00828     return ANtpDefVal::kFloat;
00829   }
00830 
00831   else return ANtpDefVal::kFloat;
00832 }
//----------------------------------------------------------------------

Float_t ANtpInfoObjectFiller::MetersToCloseEdge ( Detector::Detector_t  det,
Float_t  x,
Float_t  y,
Bool_t  NDUseFullPlane = 0 
)

Definition at line 850 of file ANtpInfoObjectFiller.cxx.

References PlaneOutline::DistanceToOuterEdge(), PlaneOutline::IsInside(), PlaneCoverage::kComplete, Detector::kFar, ANtpDefaultValue::kFloat, Detector::kNear, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, PlaneView::kU, PlaneView::kV, and Munits::m2.

Referenced by ANtpEventInfoAna::Analyze(), and FillFiducialInformation().

00853 {
00854   // Calculate the distance to the nearest (outside) plane edge
00855   // using the PlaneOutline class. 
00856   // Currently takes distance to nearest edges seperatly for U and V
00857   // views, then takes the average of the two distances.
00858   // It would be better to take a single distance to an average plane
00859   // but this is not yet possible.
00860 
00861   if (det == Detector::kNear || det == Detector::kFar ){
00862     
00863     // Pick a plane coverage
00864     PlaneCoverage::PlaneCoverage_t outline(PlaneCoverage::kComplete);
00865     if (det == Detector::kNear){
00866       if (NDUseFullPlane) outline = PlaneCoverage::kNearFull;
00867       else outline = PlaneCoverage::kNearPartial;
00868     }
00869 
00870     PlaneOutline po;  
00871     
00872     // Calculate distance (to nearest outside edge) in U. 
00873     Float_t distU(0.);
00874     Float_t xedge; Float_t yedge; 
00875     po.DistanceToOuterEdge(x, y, PlaneView::kU, outline,
00876                            distU, xedge, yedge);
00877 
00878     // Calculate distance in V.
00879     Float_t distV(0.);
00880     po.DistanceToOuterEdge(x, y, PlaneView::kV, outline,
00881                            distV, xedge, yedge); 
00882 
00883     // Now work out if the point is inside or outside each outline
00884     // Firstly deal with the coil hole. We consider it inside,
00885     // but the PlaneOutline class calls it outside.
00886     
00887     Bool_t insideU(0.); 
00888     if ( outline != PlaneCoverage::kNearPartial ) {
00889       // circle of radius 1/sqrt(2) will enclose the coilHole, 
00890       // but is itself enclosed by the outer edges
00891       insideU = ( (x*x + y*y) < 0.5 * Munits::m2 );
00892       //cout << "X: " << x << ";   Y: " 
00893       //           << y << ";   inside:" << insideU << endl;
00894     }
00895     
00896     Bool_t insideV(insideU);
00897     if ( !insideU ){ 
00898       insideU = po.IsInside(x, y, PlaneView::kU, outline);
00899       insideV = po.IsInside(x, y, PlaneView::kV, outline);
00900     }
00901     distU *= ( insideU ? 1. : -1. );
00902     distV *= ( insideV ? 1. : -1. );
00903 
00904     //    cout << ">U<: " << insideU << "   " << distU << "\n";
00905     //cout << ">V<: " << insideV << "   " << distV;
00906     
00907     return ( distU + distV ) / 2.;
00908   }  // if ( @ near or far detectors )
00909 
00910   else return ANtpDefVal::kFloat;    
00911 }

Float_t ANtpInfoObjectFiller::MetersToCoil ( Detector::Detector_t  det,
Float_t  x,
Float_t  y 
)

Definition at line 834 of file ANtpInfoObjectFiller.cxx.

References Detector::kFar, ANtpDefaultValue::kFloat, and Detector::kNear.

Referenced by ANtpEventInfoAna::Analyze(), and FillFiducialInformation().

00836 {
00837   if (det == Detector::kNear){
00838    // Take coil to be at (0,0) Looks about right...  (?) 
00839     return TMath::Sqrt(x*x + y*y);
00840   }
00841 
00842   else if (det == Detector::kFar){
00843     return TMath::Sqrt(x*x + y*y);    
00844   }
00845 
00846   else return ANtpDefVal::kFloat;
00847 }       

void ANtpInfoObjectFiller::SetDetector ( Detector::Detector_t  detector  ) 

Reimplemented in ANtpInfoObjectFillerNC.

Definition at line 116 of file ANtpInfoObjectFiller.cxx.

References fDetector.

Referenced by CondensedNtpModule::BeginJob().

00117 {
00118   fDetector = detector;
00119   return;
00120 }

void ANtpInfoObjectFiller::SetStripArray ( TClonesArray *  strips  ) 
float ANtpInfoObjectFiller::Sqr ( float  x  )  [private]

Definition at line 568 of file ANtpInfoObjectFiller.cxx.

00569 {
00570   return x*x;
00571 }

int ANtpInfoObjectFiller::Sqr ( int  x  )  [private]

Definition at line 562 of file ANtpInfoObjectFiller.cxx.

00563 {
00564   return x*x;
00565 }

double ANtpInfoObjectFiller::Sqr ( double  x  )  [private]

Definition at line 556 of file ANtpInfoObjectFiller.cxx.

Referenced by GetTrackTrace().

00557 {
00558   return x*x;
00559 }


Member Data Documentation

Long64_t ANtpInfoObjectFiller::fRowNum [private]

Definition at line 93 of file ANtpInfoObjectFiller.h.

Referenced by FillHeaderInformation().

TClonesArray* ANtpInfoObjectFiller::fStripArray [protected]

Definition at line 80 of file ANtpInfoObjectFiller.h.

Referenced by FillHeaderInformation().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1