NuExtraction Class Reference

#include <NuExtraction.h>

List of all members.

Public Member Functions

 NuExtraction ()
 ~NuExtraction ()
void ExtractAdditionalDSTVariables (NuEvent &nu) const
void ExtractAuxiliaryInfo (const NtpStRecord &ntp, const NtpSREvent &evt, const NtpFitSARecord *pntpSA, NuEvent &nu) const
void ExtractBasicInfo (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractBeamInfoDB (NuEvent &nu) const
void ExtractCoilCurrent (NuEvent &nu) const
void ExtractCoilInfo (NuEvent &nu) const
void ExtractDataQuality (NuEvent &nu) const
void ExtractEvtInfo (const NtpSREvent &evt, NuEvent &nu) const
void ExtractGeneralInfo (const NtpStRecord &ntp, NuEvent &nu) const
void ExtractLITags (const NtpStRecord &ntp, NuEvent &nu) const
void ExtractMajorityCurvature (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractTimeToNearestSpill (NuEvent &nu) const
void ExtractTimingFiducial (NuEvent &nu) const
void ExtractVertexTimeFit (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractTrkShwInfo (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractMinMaxEvtTimes (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractSAFitInfo (const NtpFitSARecord *pntpSA, NuEvent &nu) const
void ExtractShwInfo (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractTrkInfo (const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
void ExtractNCInfo (const NtpStRecord *ptnp, Int_t eventNb, NuEvent &nu) const
void NuMCEventFromNuEvent (const NuEvent &nu, NuMCEvent &numc) const
void NuEventFromNuMCEvent (const NuMCEvent &mc, NuEvent &nu) const

Protected Member Functions

void ExtractNthTrkInfo (int trkIdx, const NtpStRecord &ntp, const NtpSREvent &evt, NuEvent &nu) const
 Helper for ExtractTrkInfo.


Detailed Description

Definition at line 22 of file NuExtraction.h.


Constructor & Destructor Documentation

NuExtraction::NuExtraction (  ) 

Definition at line 70 of file NuExtraction.cxx.

References Msg::kDebug, and MSG.

00071 {
00072   MSG("NuExtraction",Msg::kDebug)
00073     <<"Running NuExtraction Constructor..."<<endl;
00074 
00075 
00076   MSG("NuExtraction",Msg::kDebug)
00077     <<"Finished NuExtraction Constructor"<<endl;
00078 }

NuExtraction::~NuExtraction (  ) 

Definition at line 82 of file NuExtraction.cxx.

References Msg::kDebug, and MSG.

00083 {
00084   MSG("NuExtraction",Msg::kDebug)
00085     <<"Running NuExtraction Destructor..."<<endl;
00086 
00087 
00088   MSG("NuExtraction",Msg::kDebug)
00089     <<"Finished NuExtraction Destructor"<<endl;
00090 }


Member Function Documentation

void NuExtraction::ExtractAdditionalDSTVariables ( NuEvent nu  )  const

Definition at line 1032 of file NuExtraction.cxx.

Referenced by ExtractAuxiliaryInfo().

01033 {
01034 
01036 /*
01037   //get an instance of the code library
01038   const NuLibrary& lib=NuLibrary::Instance();
01039 
01040   //set fiducial volume variables useful for DST interactive use
01041   if (nu.detector==Detector::kNear) {
01042     nu.fvnmb=lib.cuts.IsInFidVolNDNuMuBar
01043       (nu.xTrkVtx,nu.yTrkVtx,nu.zTrkVtx);
01044     nu.fvpitt=lib.cuts.IsInFidVolPitt
01045       (nu.xTrkVtx,nu.yTrkVtx,nu.zTrkVtx,nu.uTrkVtx,nu.vTrkVtx);
01046     nu.fvcc=lib.cuts.IsInFidVolNDCC0250Std
01047       (nu.xTrkVtx,nu.yTrkVtx,nu.zTrkVtx);
01048   }
01049   else if (nu.detector==Detector::kFar) {
01050     nu.fvcc=lib.cuts.IsInFidVolFDCC0250Std
01051       (nu.planeTrkVtx,nu.rTrkVtx);
01052     //just set these other two to the std CC one
01053     //there are no specialised FD fid vols yet
01054     nu.fvnmb=nu.fvcc;
01055     nu.fvpitt=nu.fvcc;
01056   }
01057   else {
01058     cout<<"Ahhhh, det="<<nu.detector<<endl;
01059   }
01060 */
01061 
01062 }

void NuExtraction::ExtractAuxiliaryInfo ( const NtpStRecord ntp,
const NtpSREvent evt,
const NtpFitSARecord pntpSA,
NuEvent nu 
) const

Definition at line 112 of file NuExtraction.cxx.

References ExtractAdditionalDSTVariables(), ExtractBeamInfoDB(), ExtractDataQuality(), ExtractLITags(), ExtractMinMaxEvtTimes(), ExtractSAFitInfo(), ExtractTimeToNearestSpill(), ExtractTimingFiducial(), and ExtractVertexTimeFit().

Referenced by NuAnalysis::DoExtractions().

00116 {
00117   //extract a bunch of supplementary information needed for analysis
00118 
00119   //get the SA fitter information if it is available
00120   this->ExtractSAFitInfo(pntpSA,nu);
00121   //get the timing info
00122   this->ExtractMinMaxEvtTimes(ntp,evt,nu);
00123   this->ExtractTimeToNearestSpill(nu);
00124   this->ExtractTimingFiducial(nu);
00125   this->ExtractVertexTimeFit(ntp, evt, nu);
00126   //get the data quality
00127   this->ExtractDataQuality(nu);
00128   this->ExtractLITags(ntp,nu);
00129   this->ExtractBeamInfoDB(nu);//done per snarl but do here as safer
00130   this->ExtractAdditionalDSTVariables(nu);
00131 }

void NuExtraction::ExtractBasicInfo ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 94 of file NuExtraction.cxx.

References ExtractEvtInfo(), ExtractGeneralInfo(), ExtractShwInfo(), and ExtractTrkInfo().

Referenced by NuAnalysis::ChargeSeparationOneSnarl(), and NuAnalysis::MakeFullDST().

00097 {
00099 
00100   //get the run, snarl, etc info
00101   this->ExtractGeneralInfo(ntp,nu);
00102   //get info from the evt
00103   this->ExtractEvtInfo(evt,nu);
00104   //extract trk info (needed to get best track info)
00105   this->ExtractTrkInfo(ntp,evt,nu);
00106   //extract shw info
00107   this->ExtractShwInfo(ntp,evt,nu);
00108 }

void NuExtraction::ExtractBeamInfoDB ( NuEvent nu  )  const

Definition at line 369 of file NuExtraction.cxx.

References BeamType::AsString(), BeamMonSpill::BeamType(), NuEvent::beamTypeDB, NuEvent::detector, MuELoss::e, BeamMonSpill::fBpmInt, BeamMonSpill::fHornCur, BeamMonSpill::fTortgt, BDSpillAccessor::Get(), VldTimeStamp::GetSeconds(), VldContext::GetTimeStamp(), NuReco::GetVldContext(), NuEvent::goodBeam, NuEvent::hornCur, NuEvent::hornIsReverse, NuLibrary::Instance(), BeamMonSpill::IsRHCRunning(), SimFlag::kData, Msg::kInfo, BeamType::kL010z185i, BeamType::kL010z185i_rev, Msg::kWarning, BDSpillAccessor::LoadSpill(), MAXMSG, NuEvent::nBatch, NuEvent::potDB, NuLibrary::reco, NuEvent::runPeriod, BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), BMSpillAna::SetTimeDiff(), NuEvent::simFlag, BeamMonSpill::SpillTime(), BMSpillAna::UseDatabaseCuts(), NuEvent::useDBForBeamInfo, NuUtilities::vtsRunIEnd, NuUtilities::vtsRunIIEnd, NuUtilities::vtsRunIIIEnd, NuUtilities::vtsRunIVEnd, NuUtilities::vtsRunIXEnd, NuUtilities::vtsRunVEnd, NuUtilities::vtsRunVIEnd, NuUtilities::vtsRunVIIEnd, and NuUtilities::vtsRunVIIIEnd.

Referenced by NuDemoModule::Ana(), ExtractAuxiliaryInfo(), and NuAnalysis::MakeFullDST().

00370 {
00371   //note that all beam data is per snarl (not event)
00372   //there is an inefficiency in calling this function for every
00373   //event in a ND snarl (but probably not a big deal)
00374 
00375   //check if data
00376   if (nu.simFlag!=SimFlag::kData) {
00377     MAXMSG("NuExtraction",Msg::kInfo,1)
00378       <<"Not extracting BeamInfoDB for simFlag="<<nu.simFlag
00379       <<endl;
00380     return;
00381   }
00382 
00383   //check whether to use the database
00384   if (!nu.useDBForBeamInfo) {
00385     MAXMSG("NuExtraction",Msg::kWarning,1)
00386       <<"Not extracting BeamInfoDB (flag set to not query database)"
00387       <<endl;
00388     //leave values as current (for re-reconstruction case)
00389     return;
00390   }
00391 
00392   MAXMSG("NuExtraction",Msg::kInfo,1)
00393     <<"Extracting BeamInfoDB for simFlag="<<nu.simFlag
00394     <<", detector="<<nu.detector<<endl;
00395 
00396   //get an instance of the code library
00397   const NuLibrary& lib=NuLibrary::Instance();
00398 
00399   //get the event time stamp
00400   VldContext vc=lib.reco.GetVldContext(nu);
00401   VldTimeStamp vts=vc.GetTimeStamp();
00402 
00403   //get a spill accessor
00404   BDSpillAccessor &sa = BDSpillAccessor::Get();
00405   const BeamMonSpill *bs = sa.LoadSpill(vts);
00406 
00407   //now determine if good beam
00408   Bool_t goodBeam=false;
00409   BMSpillAna bmana;
00410   bmana.UseDatabaseCuts();
00411   bmana.SetSpill(*bs);
00412 
00413   //set the time difference to determine if spill is in time
00414   VldTimeStamp delta_vts=vts-bs->SpillTime();
00415   bmana.SetTimeDiff(delta_vts.GetSeconds());
00416 
00417   //determine whether to select
00418   if(bmana.SelectSpill()) goodBeam=true;
00419   else goodBeam=false;
00420 
00421   //store the variable
00422   nu.goodBeam=goodBeam;
00423 
00424   //store the beam variables (these are junk if the spill is not in time)
00425   nu.hornCur=bs->fHornCur;
00426   nu.beamTypeDB=bs->BeamType();
00427   nu.potDB=bs->fTortgt;
00428 
00429   const float* batchStructure = bs->fBpmInt;
00430   Int_t batchCounter = 0;
00431   for (Int_t iBatch = 0; iBatch < 6; ++iBatch){
00432     if (batchStructure[iBatch] > 1e-5){++batchCounter;}
00433   }
00434   nu.nBatch = batchCounter;
00435 
00436   if     (vts.GetSeconds() < NuUtilities::vtsRunIEnd.GetSeconds()) nu.runPeriod = 1;
00437   else if(vts.GetSeconds() < NuUtilities::vtsRunIIEnd.GetSeconds()) nu.runPeriod = 2;
00438   else if(vts.GetSeconds() < NuUtilities::vtsRunIIIEnd.GetSeconds()) nu.runPeriod = 3;
00439   else if(vts.GetSeconds() < NuUtilities::vtsRunIVEnd.GetSeconds()) nu.runPeriod = 4;
00440   else if(vts.GetSeconds() < NuUtilities::vtsRunVEnd.GetSeconds()) nu.runPeriod = 5;
00441   else if(vts.GetSeconds() < NuUtilities::vtsRunVIEnd.GetSeconds()) nu.runPeriod = 6;
00442   else if(vts.GetSeconds() < NuUtilities::vtsRunVIIEnd.GetSeconds()) nu.runPeriod = 7;
00443   else if(vts.GetSeconds() < NuUtilities::vtsRunVIIIEnd.GetSeconds()) nu.runPeriod = 8;
00444   else if(vts.GetSeconds() < NuUtilities::vtsRunIXEnd.GetSeconds()) nu.runPeriod = 9;
00445   else nu.runPeriod = 10;
00446 
00447   // Check for RHC
00448   if (BeamMonSpill::IsRHCRunning(vts)){
00449     MAXMSG("NuExtraction",Msg::kInfo, 10)
00450       << "Found RHC date: " << vts.AsString() << endl;
00451     nu.hornIsReverse =  true;
00452     nu.hornCur *= -1;
00453     if (nu.beamTypeDB == BeamType::kL010z185i_rev){
00454       MAXMSG("NuAnalysis", Msg::kInfo, 10) << "RHC beam already set to kL010z185i_rev."
00455                                            << " Doing nothing."
00456                                            << endl;
00457     }
00458     else if (nu.beamTypeDB == BeamType::kL010z185i){
00459       MAXMSG("NuAnalysis", Msg::kWarning, 10000) << "RHC beam set to kL010z185i. "
00460                                                  << "Setting maually to kL010z185i_rev. "
00461                                                  << "But this shouldn't happen! "
00462                                                  << "Please look into what's gone wrong."
00463                                                  << endl;
00464       nu.beamTypeDB = BeamType::kL010z185i_rev;
00465     }
00466     else {MAXMSG("NuAnalysis",Msg::kWarning,1000)
00467       << "No non le010z185i RHC beam types -- keeping " 
00468       << BeamType::AsString(static_cast<BeamType::BeamType_t>(nu.beamTypeDB)) << endl;}
00469   }
00470   else {
00471     MAXMSG("NuExtraction",Msg::kInfo, 10)
00472       << "Found FHC date: " << vts.AsString() << endl;
00473     nu.hornIsReverse = false;
00474   }
00475 
00476   MAXMSG("NuExtraction",Msg::kInfo,10)
00477     <<"Extracting BeamInfoDB found"
00478     <<  " goodBeam=" << nu.goodBeam
00479     << ", hornCur=" << nu.hornCur
00480     << ", beamTypeDB=" << nu.beamTypeDB
00481     << ", potDB=" << nu.potDB
00482     << ", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
00483     << ", runPeriod=" << nu.runPeriod
00484     << endl;
00485 
00486   //other possibilities
00487   //Float_t hbw=bs->fProfWidX*1000.;//make it in mm
00488   //Float_t vbw=bs->fProfWidY*1000.;//make it in mm
00489   //Float_t hpos1=bs->fTargProfX*1000.;//make it in mm
00490   //Float_t vpos1=bs->fTargProfY*1000.;//make it in mm
00491   //BeamType::BeamType_t beamType=bs->BeamType();
00492   //Bool_t horn_on = bs->GetStatusBits().horn_on;
00493   //Bool_t target_in = bs->GetStatusBits().target_in;
00494 }

void NuExtraction::ExtractCoilCurrent ( NuEvent nu  )  const

Definition at line 278 of file NuExtraction.cxx.

References NuEvent::coilCurrent, NuEvent::detector, CoilTools::GetCoilState(), BfldDbiCoilState::GetCurrent(), Dcs_Mag_Near::GetCurrent(), CoilTools::GetMagNear(), NuReco::GetVldContext(), CoilTools::Instance(), NuLibrary::Instance(), SimFlag::kData, Detector::kFar, Msg::kInfo, Detector::kNear, Msg::kWarning, MAXMSG, NuLibrary::reco, NuEvent::simFlag, and NuEvent::useDBForDataQuality.

Referenced by ExtractCoilInfo().

00279 {
00280   //return if not data
00281   if (nu.simFlag!=SimFlag::kData) {
00282     MAXMSG("NuExtraction",Msg::kInfo,1)
00283       <<"Not extracting CoilCurrent for simFlag="<<nu.simFlag<<endl;
00284     return;
00285   }
00286 
00287   //check whether to use the database
00288   if (!nu.useDBForDataQuality) {//use data quality flag
00289     MAXMSG("NuExtraction",Msg::kWarning,1)
00290       <<"Not extracting CoilCurrent (flag set to not query database)"
00291       <<endl;
00292     //leave values as they are (for re-reconstruction case)
00293     return;
00294   }
00295 
00296   //get an instance of the code library
00297   const NuLibrary& lib=NuLibrary::Instance();
00298 
00299   //get vc
00300   VldContext vc=lib.reco.GetVldContext(nu);
00301 
00302   //get the current, depending on detector
00303   if (nu.detector==Detector::kNear) {
00304     const Dcs_Mag_Near* magnear=CoilTools::Instance().GetMagNear(vc);
00305     if (magnear) nu.coilCurrent=magnear->GetCurrent();
00306     else {
00307       MAXMSG("NuExtraction",Msg::kWarning,10)
00308         <<"No rows in Dcs_Mag_Near DB table for VldContext="<<vc
00309         <<" setting coilCurrent=0"<<endl;
00310       nu.coilCurrent=0;//set to default value
00311     }
00312   }
00313   else if (nu.detector==Detector::kFar) {
00314     const BfldDbiCoilState* coilstate1=
00315       CoilTools::Instance().GetCoilState(vc,1);
00316     const BfldDbiCoilState* coilstate2=
00317       CoilTools::Instance().GetCoilState(vc,2);
00318     //ahh, two values, one slot ... take average
00319     if (coilstate1 && coilstate2) {
00320       nu.coilCurrent=0.5*(coilstate1->GetCurrent()+
00321                           coilstate2->GetCurrent());
00322     }
00323     else {
00324       MAXMSG("NuExtraction",Msg::kInfo,10)
00325         <<"Insufficient rows in BfldDbiCoilState DB table, VldContext="
00326         <<vc<<" setting coilCurrent=0"<<endl;
00327       nu.coilCurrent=0;//set to default value
00328     }
00329   }
00330   else cout<<"Ahhh, det="<<nu.detector<<endl;
00331 
00332   //The old slow way:
00333   //DbiResultPtr<Dcs_Mag_Near> ptr(vc);
00334   //if(ptr.GetNumRows()){
00335   //const Dcs_Mag_Near* row=ptr.GetRow(0);
00336   //nu.coilCurrent=row->GetCurrent();
00337   //}
00338   //else {
00339   //MAXMSG("NuExtraction",Msg::kInfo,10)
00340   //  <<"No rows in Dcs_Mag_Near DB table for VldContext="<<vc
00341   //  <<" setting coilCurrent=0"<<endl;
00342   //nu.coilCurrent=0;//set to default value
00343   //}
00344 
00345   MAXMSG("NuExtraction",Msg::kInfo,10)
00346     <<"Extracted CoilCurrent="<<nu.coilCurrent<<endl;
00347 }

void NuExtraction::ExtractCoilInfo ( NuEvent nu  )  const

Definition at line 224 of file NuExtraction.cxx.

References NuEvent::coilIsOk, NuEvent::coilIsReverse, ExtractCoilCurrent(), NuUtilities::GetDigit(), NuReco::GetVldContext(), NuLibrary::Instance(), CoilTools::IsOK(), CoilTools::IsReverse(), SimFlag::kData, Msg::kInfo, Msg::kWarning, MAXMSG, NuLibrary::reco, NuEvent::run, NuEvent::simFlag, and NuEvent::useDBForDataQuality.

Referenced by NuAnalysis::ChargeSeparationOneSnarl(), and NuAnalysis::MakeFullDST().

00225 {
00226   //return if not data
00227   if (nu.simFlag!=SimFlag::kData) {
00228     MAXMSG("NuExtraction",Msg::kInfo,1)
00229       <<"Not extracting Coil info for simFlag="<<nu.simFlag<<endl;
00230     //set these to be the most likely values
00231     nu.coilIsOk=true;
00232     int fieldNo = NuUtilities::GetDigit(nu.run, 5);
00233     if (fieldNo == 1 || fieldNo == 3) {
00234       MAXMSG("NuExtraction",Msg::kInfo,1)
00235       << "Found field id #" << fieldNo << ", setting coil current to forward."
00236       <<endl;
00237       nu.coilIsReverse=false;
00238     }
00239     else if (fieldNo == 2 || fieldNo == 4) {
00240       MAXMSG("NuExtraction",Msg::kInfo,1)
00241       << "Found field id #" << fieldNo << ", setting coil current to reverse."
00242       <<endl;
00243       nu.coilIsReverse=true;
00244     }
00245     else {
00246       MAXMSG("NuExtraction",Msg::kWarning,1)
00247       << "Don't recognize field id #" << fieldNo << ", only 1, 2, 3, 4 are allowed values.  Assuming field is forward."
00248       <<endl;
00249       nu.coilIsReverse=false;
00250     }
00251     return;
00252   }
00253 
00254   //check whether to use the database
00255   if (!nu.useDBForDataQuality) {//use data quality flag
00256     MAXMSG("NuExtraction",Msg::kWarning,1)
00257       <<"Not extracting CoilCurrent (flag set to not query database)"
00258       <<endl;
00259     //leave values as current (for re-reconstruction case)
00260     return;
00261   }
00262 
00263   //get an instance of the code library
00264   const NuLibrary& lib=NuLibrary::Instance();
00265   VldContext vc=lib.reco.GetVldContext(nu);
00266 
00267   //extract the information about the coil using CoilTools
00268   //this is much faster than using the database
00269   nu.coilIsOk=CoilTools::IsOK(vc);
00270   nu.coilIsReverse=CoilTools::IsReverse(vc);
00271 
00272   //get the coil current here too
00273   this->ExtractCoilCurrent(nu);
00274 }

void NuExtraction::ExtractDataQuality ( NuEvent nu  )  const

Definition at line 632 of file NuExtraction.cxx.

References NuEvent::deltaNanoSecToSpillGPS, NuEvent::deltaSecToSpillGPS, VldContext::GetDetector(), VldTimeStamp::GetNanoSec(), SpillServerMonFinder::GetNearestSpill(), VldTimeStamp::GetSec(), SpillServerMon::GetSpillTime(), SpillServerMon::GetSpillTimeError(), SpillServerMon::GetSpillType(), VldContext::GetTimeStamp(), NuReco::GetVldContext(), NuEvent::gpsError, NuEvent::gpsSpillType, SpillServerMonFinder::Instance(), NuLibrary::Instance(), DataUtil::IsGoodData(), DataUtil::IsGoodDataCOIL(), DataUtil::IsGoodDataGPS(), DataUtil::IsGoodDataHV(), NuEvent::isGoodDataQuality, NuEvent::isGoodDataQualityCOIL, NuEvent::isGoodDataQualityGPS, NuEvent::isGoodDataQualityHV, NuEvent::isGoodDataQualityRUN, DataUtil::IsGoodDataRUN(), SimFlag::kData, Detector::kFar, Msg::kInfo, Detector::kNear, Msg::kWarning, MAXMSG, NuEvent::numActiveCrates, NuEvent::numGoodSnarls, NuEvent::numTimeFrames, NuLibrary::reco, NuEvent::simFlag, NuEvent::snarlRateMax, NuEvent::snarlRateMedian, and NuEvent::useDBForDataQuality.

Referenced by NuDemoModule::Ana(), ExtractAuxiliaryInfo(), NuAnalysis::LIRejectionTest(), and NuAnalysis::MakeFullDST().

00633 {
00634   //return if not data
00635   if (nu.simFlag!=SimFlag::kData) {
00636     MAXMSG("NuExtraction",Msg::kInfo,1)
00637       <<"Not extracting Data Quality info for simFlag="<<nu.simFlag<<endl;
00638     //set these to be the most likely values
00639     nu.isGoodDataQuality = 1;
00640     nu.isGoodDataQualityRUN = 1;
00641     nu.isGoodDataQualityCOIL = 1;
00642     nu.isGoodDataQualityHV = 1;
00643     nu.isGoodDataQualityGPS = 1;
00644     return;
00645   }
00646 
00647   //check whether to use the database
00648   if (!nu.useDBForDataQuality) {
00649     MAXMSG("NuExtraction",Msg::kWarning,1)
00650       <<"Not extracting DataQuality"
00651       <<" (flag set to not query database)"
00652       <<", isGoodDataQuality="<<nu.isGoodDataQuality
00653       <<endl;
00654     //nu.isGoodDataQuality=leave as current value
00655     return;
00656   }
00657 
00658   // get validity context from ntuple record
00659   //const RecCandHeader* ntpHeader = &(ntp.GetHeader());
00660   //VldContext cx = ntpHeader->GetVldContext();
00661   //get an instance of the code library
00662   const NuLibrary& lib=NuLibrary::Instance();
00663   VldContext cx = lib.reco.GetVldContext(nu);
00664 
00665   // check data quality
00666   // ==================
00667   // run DataUtil methods
00668 
00669   nu.isGoodDataQuality = DataUtil::IsGoodData(cx);
00670   nu.isGoodDataQualityRUN = DataUtil::IsGoodDataRUN(cx);
00671   nu.isGoodDataQualityCOIL = DataUtil::IsGoodDataCOIL(cx);
00672   nu.isGoodDataQualityHV = DataUtil::IsGoodDataHV(cx);
00673   nu.isGoodDataQualityGPS = DataUtil::IsGoodDataGPS(cx);
00674 
00675   // extract run quality variables
00676   // =============================
00677 
00678   // far detector - search DbuFarRunQuality table
00679   if( cx.GetDetector() == Detector::kFar ) {
00680     // perform database query
00681     DbiResultPtr<DbuFarRunQuality> farquery("DBUFARRUNQUALITY",cx,0);
00682 
00683     if( farquery.GetNumRows()>0 ){
00684       const DbuFarRunQuality* rowptr = farquery.GetRow(0);
00685       nu.numActiveCrates = rowptr->GetCrateMask();
00686       nu.numTimeFrames = rowptr->GetTimeFrames();
00687       nu.numGoodSnarls = rowptr->GetGoodSnarls();
00688       nu.snarlRateMedian = rowptr->GetMedianSnarlRate();
00689       nu.snarlRateMax = rowptr->GetMaxSnarlRate();
00690     }
00691   }
00692 
00693   // near detector
00694   if( cx.GetDetector() == Detector::kNear ) {
00695     //perform database query
00696     DbiResultPtr<DbuNearRunQuality> nearquery("DBUNEARRUNQUALITY",cx,0);
00697 
00698     if( nearquery.GetNumRows()>0 ){
00699       const DbuNearRunQuality* rowptr = nearquery.GetRow(0);
00700       nu.numActiveCrates = 8 - rowptr->GetColdCrates();
00701       nu.numTimeFrames = rowptr->GetSubrunLength();
00702       nu.numGoodSnarls = rowptr->GetTriggersSpill();
00703       nu.snarlRateMedian = rowptr->GetSnarlRateMedian();
00704       nu.snarlRateMax = rowptr->GetSnarlRateMax();
00705     }
00706   }
00707 
00708 
00709   // extract gps data
00710   // ================
00711   // use SpillServerMonFinder to access nearest spill monitoring block,
00712   // only necessary for far detector
00713   if( cx.GetDetector() == Detector::kFar ) {
00714 
00715     SpillServerMonFinder& spillFinder = SpillServerMonFinder::Instance();
00716     const SpillServerMon& nearestSpill = spillFinder.GetNearestSpill(cx);
00717     VldTimeStamp dt = nearestSpill.GetSpillTime()-cx.GetTimeStamp();
00718 
00719     nu.deltaSecToSpillGPS = dt.GetSec();
00720     nu.deltaNanoSecToSpillGPS = dt.GetNanoSec();
00721     nu.gpsError = nearestSpill.GetSpillTimeError();
00722     nu.gpsSpillType = nearestSpill.GetSpillType();
00723   }
00724 
00725   // coil currents
00726   // =============
00727   // set this information in ExtractCoilInfo() method
00728 }

void NuExtraction::ExtractEvtInfo ( const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 768 of file NuExtraction.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRPlane::end, NtpSREvent::end, NtpSRPlane::endu, NtpSRPlane::endv, NuEvent::evt, NuEvent::evtphsigcor, NuEvent::evtphsigmap, NtpSREvent::index, NtpSRPlane::n, NtpSREvent::ndigit, NuEvent::ndigitEvt, NtpSREvent::nshower, NuEvent::nshw, NtpSREvent::nstrip, NuEvent::nstripEvt, NtpSREvent::ntrack, NuEvent::ntrk, NtpSRPlane::nu, NtpSRPlane::nv, NtpSREvent::ph, NtpSRVertex::plane, NtpSREvent::plane, NuEvent::planeEvtBeg, NuEvent::planeEvtBegu, NuEvent::planeEvtBegv, NuEvent::planeEvtEnd, NuEvent::planeEvtEndu, NuEvent::planeEvtEndv, NuEvent::planeEvtN, NuEvent::planeEvtNu, NuEvent::planeEvtNv, NuEvent::planeEvtVtx, NtpSREvent::primshw, NuEvent::primshw, NtpSREvent::primtrk, NuEvent::primtrk, NtpSRPulseHeight::raw, NuEvent::rawPhEvt, NtpSRPulseHeight::sigcor, NtpSRStripPulseHeight::sigmap, NtpSREvent::slc, NuEvent::slc, NtpSRVertex::t, NuEvent::tEvtVtx, NtpSRVertex::u, NuEvent::uEvtEnd, NuEvent::uEvtVtx, NtpSRVertex::v, NuEvent::vEvtEnd, NuEvent::vEvtVtx, NtpSREvent::vtx, NtpSRVertex::x, NuEvent::xEvtEnd, NuEvent::xEvtVtx, NtpSRVertex::y, NuEvent::yEvtEnd, NuEvent::yEvtVtx, NtpSRVertex::z, NuEvent::zEvtEnd, and NuEvent::zEvtVtx.

Referenced by NuDemoModule::Ana(), NuAnalysis::EnergySpect(), NuAnalysis::EnergySpectMC(), ExtractBasicInfo(), NuAnalysis::LIRejectionTest(), and NuAnalysis::N_1().

00770 {
00772 
00773   nu.evt=evt.index;
00774   nu.slc=evt.slc;
00775   nu.ndigitEvt=evt.ndigit;
00776   nu.nstripEvt=evt.nstrip;
00777   nu.nshw=evt.nshower;
00778   nu.ntrk=evt.ntrack;
00779   nu.primshw=evt.primshw;
00780   nu.primtrk=evt.primtrk;
00781   nu.rawPhEvt=evt.ph.raw;
00782   nu.evtphsigcor=evt.ph.sigcor;
00783   nu.evtphsigmap=evt.ph.sigmap;
00784   nu.planeEvtN=evt.plane.n;
00785   nu.planeEvtNu=evt.plane.nu;
00786   nu.planeEvtNv=evt.plane.nv;
00787 
00788   nu.xEvtVtx=evt.vtx.x;
00789   nu.yEvtVtx=evt.vtx.y;
00790   nu.zEvtVtx=evt.vtx.z;
00791   nu.uEvtVtx=evt.vtx.u;
00792   nu.vEvtVtx=evt.vtx.v;
00793   nu.tEvtVtx=evt.vtx.t;
00794   nu.planeEvtVtx=evt.vtx.plane;
00795   nu.planeEvtBeg=evt.plane.beg;
00796   nu.planeEvtBegu=evt.plane.begu;
00797   nu.planeEvtBegv=evt.plane.begv;
00798 
00799   nu.xEvtEnd=evt.end.x;
00800   nu.yEvtEnd=evt.end.y;
00801   nu.zEvtEnd=evt.end.z;
00802   nu.uEvtEnd=evt.end.u;
00803   nu.vEvtEnd=evt.end.v;
00804   nu.planeEvtEnd=evt.plane.end;
00805   nu.planeEvtEndu=evt.plane.endu;
00806   nu.planeEvtEndv=evt.plane.endv;
00807 
00808 }

void NuExtraction::ExtractGeneralInfo ( const NtpStRecord ntp,
NuEvent nu 
) const

Definition at line 135 of file NuExtraction.cxx.

References NtpSRPlane::beg, NuEvent::detector, NtpSRPlane::end, NuEvent::errorCode, NtpStRecord::evthdr, VldContext::GetDetector(), RecDataHeader::GetErrorCode(), RecRecordImp< T >::GetHeader(), VldTimeStamp::GetNanoSec(), RecPhysicsHeader::GetRemoteSpillType(), RecDataHeader::GetRun(), RecDataHeader::GetRunType(), VldTimeStamp::GetSec(), VldTimeStamp::GetSeconds(), VldContext::GetSimFlag(), RecPhysicsHeader::GetSnarl(), RecDataHeader::GetSubRun(), RecPhysicsHeader::GetTimeFrame(), VldContext::GetTimeStamp(), RecPhysicsHeader::GetTrigSrc(), RecHeader::GetVldContext(), SimFlag::kMC, Detector::kNear, Msg::kWarning, MAXMSG, NtpStRecord::mc, NtpSREventSummary::ph, NtpSREventSummary::plane, NuEvent::planeEvtHdrBeg, NuEvent::planeEvtHdrEnd, NuEvent::remoteSpillType, NuEvent::run, NuEvent::runType, NtpSRPulseHeight::sigcor, NuEvent::simFlag, NuEvent::snarl, NuEvent::snarlPulseHeight, NuEvent::subRun, NuEvent::timeFrame, NuEvent::timeNanoSec, NuEvent::timeSec, NuEvent::timeSeconds, NuEvent::trigSrc, NtpSREventSummary::trigtime, and NuEvent::trigtime.

Referenced by NuDemoModule::Ana(), NuAnalysis::ChargeSeparationOneSnarl(), NuAnalysis::ChargeSignCut(), NuAnalysis::Efficiencies(), NuAnalysis::EnergySpect(), NuAnalysis::EnergySpectMC(), ExtractBasicInfo(), NuAnalysis::LIRejectionTest(), NuAnalysis::MakeFullDST(), NuAnalysis::N_1(), and NuAnalysis::NuMuBarAppearance().

00137 {
00138   const RecCandHeader& rec=ntp.GetHeader();
00139 
00140   nu.run=rec.GetRun();
00141   nu.subRun=rec.GetSubRun();
00142   nu.runType=rec.GetRunType();
00143   nu.errorCode=rec.GetErrorCode();
00144   nu.snarl=rec.GetSnarl();
00145   nu.trigSrc=rec.GetTrigSrc();
00146   nu.timeFrame=rec.GetTimeFrame();
00147   nu.remoteSpillType=rec.GetRemoteSpillType();
00148 
00149   nu.detector=rec.GetVldContext().GetDetector();
00150   nu.simFlag=rec.GetVldContext().GetSimFlag();
00151   nu.timeSec=rec.GetVldContext().GetTimeStamp().GetSec();
00152   nu.timeNanoSec=rec.GetVldContext().GetTimeStamp().GetNanoSec();
00153   nu.timeSeconds=rec.GetVldContext().GetTimeStamp().GetSeconds();
00154 
00155   const NtpSREventSummary& evthdr=ntp.evthdr;
00156   nu.trigtime=evthdr.trigtime;
00157   nu.planeEvtHdrBeg=evthdr.plane.beg;
00158   nu.planeEvtHdrEnd=evthdr.plane.end;
00159   nu.snarlPulseHeight=evthdr.ph.sigcor;
00160 
00161   //a hack to correct the trigger bit of the cosmic MC in the ND
00162   if (nu.simFlag==SimFlag::kMC && nu.detector==Detector::kNear) {
00163     //the cosmic MC doesn't have any entries
00164     TClonesArray& mcTca=*ntp.mc;
00165     if (mcTca.GetEntries()==0){
00166       MAXMSG("MeuAnalysis",Msg::kWarning,5)
00167         <<"Performing hack to correct the fTrigSrc of"
00168         <<" ND cosmic MC, was="
00169         <<nu.trigSrc<<", setting to 4"<<endl;
00170       nu.trigSrc=4;//a plane trigger
00171     }
00172   }
00173 }

void NuExtraction::ExtractLITags ( const NtpStRecord ntp,
NuEvent nu 
) const

Definition at line 351 of file NuExtraction.cxx.

References NtpStRecord::evthdr, NuReco::FDRCBoundary(), NuLibrary::Instance(), LISieve::IsLI(), NuEvent::isLI, NuEvent::litag, NtpSREventSummary::litime, NuEvent::litime, and NuLibrary::reco.

Referenced by NuDemoModule::Ana(), and ExtractAuxiliaryInfo().

00352 {
00354 
00355   //get an event header
00356   const NtpSREventSummary& evthdr=ntp.evthdr;
00357 
00358   //get an instance of the code library
00359   const NuLibrary& lib=NuLibrary::Instance();
00360 
00361   //extract all the possible LI variables
00362   nu.litime=evthdr.litime;
00363   nu.isLI=LISieve::IsLI(ntp);
00364   nu.litag=lib.reco.FDRCBoundary(nu);
00365 }

void NuExtraction::ExtractMajorityCurvature ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 980 of file NuExtraction.cxx.

References NuEvent::calcMajCurv, MajorityCurvature::CurvatureImproved(), NuReco::GetTrackWithIndexX(), NuLibrary::Instance(), MajCInfo::jitter, MajCInfo::jPID, Msg::kInfo, Msg::kWarning, MajCInfo::majC, NuLibrary::majC, MAXMSG, NuEvent::ntrk, NuLibrary::reco, NuReco::SetBestTrkMajorityCurvature(), MajCInfo::smoothMajC, and NuEvent::trkExists.

Referenced by NuAnalysis::ExtractPIDsAndWeights().

00983 {
00984   //check if a track exists
00985   if (nu.ntrk<=0) {
00986     MAXMSG("NuReco",Msg::kInfo,3)
00987       <<"ExtractMajorityCurvature: no tracks so nothing to do"
00988       <<", ntrk="<<nu.ntrk<<endl;
00989     nu.trkExists=false;
00990     return;
00991   }
00992 
00993   //check if flag is set to not calc maj curv
00994   if (!nu.calcMajCurv) {
00995     MAXMSG("NuReco",Msg::kWarning,1)
00996       <<"ExtractMajorityCurvature: flag set to calcMajCurv="
00997       <<nu.calcMajCurv<<endl;
00998     return;
00999   }
01000 
01001   //get an instance of the code library
01002   const NuLibrary& lib = NuLibrary::Instance();
01003 
01004   for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
01005     //get pointer to trk
01006     const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp, evt, trkIdx-1);
01007 
01008     //check if track exists
01009     if(ptrk){
01010       //get a reference
01011       const NtpSRTrack& trk = *ptrk;
01012 
01013       const MajCInfo majCInfo = lib.majC.CurvatureImproved(&trk);
01014       get_jitter(nu, trkIdx) = majCInfo.jitter;
01015       get_jPID(nu, trkIdx) = majCInfo.jPID;
01016       get_majC(nu, trkIdx) = majCInfo.majC;
01017       //get_majCRatio(nu, trkIdx) = majCInfo.majCRatio;
01018       //get_rms(nu, trkIdx) = majCInfo.rms;
01019       //get_simpleMajC(nu, trkIdx) = majCInfo.simpleMajC;
01020       get_smoothMajC(nu, trkIdx) = majCInfo.smoothMajC;
01021       //get_sqJitter(nu, trkIdx) = majCInfo.sqJitter;
01022       //get_totWidth(nu, trkIdx) = majCInfo.totWidth;
01023     }
01024   } // end for trkIdx
01025 
01026   //copy across the MajCurv variables for the best track
01027   lib.reco.SetBestTrkMajorityCurvature(nu);
01028 }

void NuExtraction::ExtractMinMaxEvtTimes ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 1066 of file NuExtraction.cxx.

References NtpSRTimeStatus::crate_t0_ns, NuEvent::crateT0, NuEvent::detector, NtpSRStrip::index, Msg::kDebug, Detector::kFar, Msg::kInfo, SimFlag::kMC, Detector::kNear, Msg::kWarning, MAXMSG, Munits::ns, NtpSREvent::nstrip, NtpSRTimeStatus::rollover_53mhz, NuEvent::rollover_53mhz, NtpSRTimeStatus::rollover_last_53mhz, NuEvent::rollover_last_53mhz, NtpSRTimeStatus::sgate_10mhz, NuEvent::sgate_10mhz, NtpSRTimeStatus::sgate_53mhz, NuEvent::sgate_53mhz, NuEvent::simFlag, NtpSREvent::stp, NtpStRecord::stp, NtpSRStrip::strip, NtpSRStrip::time0, NtpSRStrip::time1, NuEvent::timeNanoSec, and NtpStRecord::timestatus.

Referenced by NuDemoModule::Ana(), ExtractAuxiliaryInfo(), and NuAnalysis::LIRejectionTest().

01069 {
01070   //get a multiset to hold all the strip times
01071   multiset<Double_t> times;
01072   const TClonesArray& stpTca=(*ntp.stp);
01073 
01074   Double_t timemax=-1.e10;
01075   Double_t timemin=1.e10;
01076 
01077   MsgFormat ffmt("%9.9f");
01078 
01079   //Extract the crate t0:
01080 
01081   NtpSRTimeStatus timeStatus = ntp.timestatus;
01082   nu.crateT0 = timeStatus.crate_t0_ns * Munits::ns;
01083   nu.sgate_10mhz = timeStatus.sgate_10mhz;
01084   nu.sgate_53mhz = timeStatus.sgate_53mhz;
01085   nu.rollover_53mhz = timeStatus.rollover_53mhz;
01086   nu.rollover_last_53mhz = timeStatus.rollover_last_53mhz;
01087 
01088 /*
01089   Double_t snarlTime=(nu.timeNanoSec*(Munits::ns));
01090   if (snarlTime>0.999999981 && snarlTime<0.999999983) {
01091     const Int_t numStps=stpTca.GetEntriesFast();
01092     Int_t counter=0;
01093     //loop over strips in snarl
01094     for (Int_t i=0;i<numStps;++i) {
01095       const NtpSRStrip* pstp=
01096         dynamic_cast<NtpSRStrip*>(stpTca[i]);
01097       const NtpSRStrip& stp=(*pstp);
01098 
01099       if (stp.time1>0.000029999) {
01100         MAXMSG("NuExtraction",Msg::kInfo,10000)
01101           <<"run="<<nu.run<<", subrun="<<nu.subRun
01102           <<", snarl="<<nu.snarl<<", i="<<i
01103           <<", count="<<counter<<", evt="<<nu.evt
01104           <<", ind="<<stp.index<<", s,pl="<<stp.strip<<","<<stp.plane
01105           <<endl
01106           <<"  t1="<<ffmt(stp.time1)
01107           <<", snlTime="<<ffmt(snarlTime)
01108           <<", raw="<<stp.ph1.raw
01109           <<", sigC="<<stp.ph1.sigcor
01110           <<endl;
01111       }
01112       counter++;
01113     }
01114   }
01115 */
01116 
01117   MAXMSG("NuExtraction",Msg::kDebug,200)
01118     <<"evt.nstrip="<<evt.nstrip<<endl;
01119   for (Int_t i=0;i<evt.nstrip;i++) {
01120     //check for bug where strip index is -1
01121     if (evt.stp[i]<0) {
01122       MAXMSG("MeuCuts",Msg::kInfo,50)
01123         <<"Skipping strip with evt.stp[i]="<<evt.stp[i]<<endl;
01124       continue;
01125     }
01126 
01127     const NtpSRStrip& stp=
01128       *(dynamic_cast<NtpSRStrip*>(stpTca[evt.stp[i]]));
01129 
01130     Double_t snarlTime=(nu.timeNanoSec*(Munits::ns));
01131     Double_t striptime=-999;
01132 
01133     //get the min/max time
01134     //code from MadTVAnalysis
01135     if (nu.detector==Detector::kNear) {
01136       if (nu.simFlag==SimFlag::kMC &&
01137           snarlTime>0.999999981 && snarlTime<0.999999983) {
01138         MAXMSG("NuExtraction",Msg::kWarning,1)
01139           <<"Deal with odd times: setting fNanoSec to zero, snarlTime="
01140           <<ffmt(snarlTime)<<endl;
01141         snarlTime=0;
01142       }
01143 
01144       //get the time relative to the snarl time
01145       striptime=stp.time1-snarlTime;
01146 
01147       //check if min/max
01148       if(striptime<=timemin && striptime!=-999) timemin=striptime;
01149       if(striptime>=timemax) timemax=striptime;
01150     }
01151     else if (nu.detector==Detector::kFar) {
01152       //get the times relative to the snarl time
01153       Double_t striptime1=stp.time1-snarlTime;
01154       Double_t striptime0=stp.time0-snarlTime;
01155       striptime=-999;
01156       if(striptime1>0 && striptime0<0) striptime=striptime1;
01157       if(striptime0>0 && striptime1<0) striptime=striptime0;
01158       if(striptime0>0 && striptime1>0) striptime=(striptime0+
01159                                                   striptime1)/2.;
01160 
01161       //check if min/max
01162       if(striptime<=timemin && striptime!=-999) timemin=striptime;
01163       if(striptime>=timemax) timemax=striptime;
01164     }
01165     else cout<<"Ahhh, detector not known"<<endl;
01166 
01167     Double_t time=stp.time0;
01168     if (time<0 || time>1) time=stp.time1;
01169 
01170     if (time>0 && time<=1) {
01171       times.insert(time);
01172     }
01173     //else just don't put the time in the map - clearly rubbish
01174     if (nu.detector==Detector::kNear) {
01175       MAXMSG("NuExtraction",Msg::kDebug,1000)
01176         <<"i="<<stp.index<<", s="<<stp.strip<<", t1="<<ffmt(stp.time1)
01177         <<", tmn="<<ffmt(timemin)<<", tmx="<<ffmt(timemax)
01178         <<", snlTime="<<ffmt(snarlTime)<<endl;
01179     }
01180     else {
01181       MAXMSG("NuExtraction",Msg::kDebug,1000)
01182         <<"i="<<stp.index<<", s="<<stp.strip
01183         <<", t0="<<ffmt(stp.time0)<<", t1="<<ffmt(stp.time1)
01184         <<", tmn="<<ffmt(timemin)<<", tmx="<<ffmt(timemax)
01185         <<", snlTime="<<ffmt(snarlTime)
01186         //<<", pl="<<stp.plane
01187         //<<", sigC="<<stp.ph1.sigcor<<", tpos="<<stp.tpos<<endl;
01188         <<endl;
01189     }
01190   }
01191 
01192   //get the median time from the map
01193   multiset<Double_t>::const_iterator it=times.begin();
01194   advance(it,times.size()/2);
01195   Double_t medianTime=*it;
01196   MAXMSG("NuExtraction",Msg::kDebug,100)
01197     <<"Median time="<<medianTime<<endl;
01198 
01199   //set the NuEvent variables
01200   nu.medianTime=medianTime;
01201   nu.timeEvtMin=timemin;
01202   nu.timeEvtMax=timemax;
01203 
01204 
01206   //sanity check and debug printout
01207   if ((timemin+nu.crateT0)<0 || (nu.run==36608 && nu.snarl==42717 && false)) {
01208     //Bad time, run=36608, snarl=42717, evt=0
01209     Double_t timemax=-1.e-10;
01210     Double_t timemin=1.e10;
01211 
01212     MAXMSG("NuExtraction",Msg::kError,1000)
01213       <<"Bad time, run="<<nu.run<<", snarl="<<nu.snarl
01214       <<", evt="<<nu.evt<<endl;
01215     for (Int_t i=0;i<evt.nstrip;i++) {
01216       //check for bug where strip index is -1
01217       if (evt.stp[i]<0) {
01218         MAXMSG("MeuCuts",Msg::kInfo,50)
01219           <<"Skipping strip with evt.stp[i]="<<evt.stp[i]<<endl;
01220         continue;
01221       }
01222 
01223       const NtpSRStrip& stp=
01224         *(dynamic_cast<NtpSRStrip*>(stpTca[evt.stp[i]]));
01225 
01226       Double_t snarlTime=(nu.timeNanoSec*(Munits::ns));
01227       Double_t striptime=-999;
01228 
01229       //get the min/max time
01230       //code from MadTVAnalysis
01231       if (nu.detector==Detector::kNear) {
01232         //get the time relative to the snarl time
01233         striptime=stp.time1-snarlTime;
01234 
01235         //check if min/max
01236         if(striptime<=timemin) timemin=striptime;
01237         if(striptime>=timemax) timemax=striptime;
01238       }
01239       else if (nu.detector==Detector::kFar) {
01240         //get the times relative to the snarl time
01241         Double_t striptime1=stp.time1-snarlTime;
01242         Double_t striptime0=stp.time0-snarlTime;
01243         striptime=-999;
01244         if(striptime1>0 && striptime0<0) striptime=striptime1;
01245         if(striptime0>0 && striptime1<0) striptime=striptime0;
01246         if(striptime0>0 && striptime1>0) striptime=(striptime0+
01247                                                     striptime1)/2.;
01248 
01249         //check if min/max
01250         if(striptime<=timemin) timemin=striptime;
01251         if(striptime>=timemax) timemax=striptime;
01252       }
01253       else cout<<"Ahhh, detector not known"<<endl;
01254 
01255       MAXMSG("NuExtraction",Msg::kInfo,1000)
01256         <<"strip="<<stp.strip
01257         <<", t0="<<ffmt(stp.time0)<<", t1="<<ffmt(stp.time1)
01258         <<", stp.index="<<stp.index
01259         <<endl
01260         <<"  tmn="<<ffmt(timemin)<<", tmx="<<ffmt(timemax)
01261         <<", stime="<<ffmt(striptime)
01262         <<", snlTime="<<ffmt(snarlTime)<<endl
01263         <<"  plane="<<stp.plane
01264         <<", ph0.raw="<<stp.ph0.raw
01265         <<", ph1.raw="<<stp.ph1.raw
01266         <<endl;
01267     }
01268   }
01269 }

void NuExtraction::ExtractNCInfo ( const NtpStRecord ptnp,
Int_t  eventNb,
NuEvent nu 
) const

Definition at line 1272 of file NuExtraction.cxx.

References ANtpEventInfoNC::closeTimeDeltaZ, NuEvent::closeTimeDeltaZ, det, ANtpTrackInfoNC::dtdz, NuEvent::dtdz, ANtpEventInfoNC::edgeActivityPH, NuEvent::edgeActivityPH, ANtpEventInfoNC::edgeActivityStrips, NuEvent::edgeActivityStrips, ANtpTrackInfo::endMetersToCloseEdge, NuEvent::endMetersToCloseEdge, ANtpInfoObjectFillerNC::FillInformation(), ANtpRecoNtpManipulator::GetClusterArray(), VldContext::GetDetector(), ANtpRecoNtpManipulator::GetStripArray(), RecRecordImp< T >::GetVldContext(), ANtpInfoObjectFillerNC::InitializekNN(), Msg::kDebug, ANtpEventInfoNC::maxConsecutivePlanes, NuEvent::maxConsecutivePlanes, ANtpEventInfoNC::minTimeSeparation, NuEvent::minTimeSeparation, MSG, ANtpEventInfoNC::oppEdgePH, NuEvent::oppEdgePH, ANtpEventInfoNC::oppEdgeStrips, NuEvent::oppEdgeStrips, ANtpTruthInfoBeam::Reset(), ANtpShowerInfoNC::Reset(), ANtpTrackInfoNC::Reset(), ANtpEventInfoNC::Reset(), ANtpInfoObjectFillerNC::SetClusterArray(), ANtpInfoObjectFillerNC::SetDetector(), ANtpRecoNtpManipulator::SetPrimaryShowerCriteria(), ANtpRecoNtpManipulator::SetPrimaryTrackCriteria(), ANtpRecoNtpManipulator::SetRecord(), ANtpInfoObjectFiller::SetStripArray(), ANtpEventInfoNC::slicePHFraction, NuEvent::slicePHFraction, ANtpTrackInfo::traceEndZ, NuEvent::traceEndZ, ANtpShowerInfoNC::transverseRMSU, NuEvent::transverseRMSU, ANtpShowerInfoNC::transverseRMSV, NuEvent::transverseRMSV, ANtpTrackInfo::vtxMetersToCloseEdge, ANtpEventInfo::vtxMetersToCloseEdge, NuEvent::vtxMetersToCloseEdgeEvt, NuEvent::vtxMetersToCloseEdgeTrk, ANtpTrackInfo::vtxMetersToCoil, ANtpEventInfo::vtxMetersToCoil, NuEvent::vtxMetersToCoilEvt, and NuEvent::vtxMetersToCoilTrk.

Referenced by NuAnalysis::MakeFullDST().

01275 {
01276   // Protection against reset of gDirectory
01277   // The call to InitializekNN() uses another file.
01278   TDirectory *tmpd = gDirectory;
01279   MSG("NuExtraction",Msg::kDebug) << "Start ExtractNCInfo, gDirectory is : ";
01280   //gDirectory->pwd();
01281 
01282   // See AnalysisNtuple/Module/CondensedNtpModuleNC::Ana()
01283   // create the ntpManipulator object
01284   static ANtpInfoObjectFillerNC   *InfoFiller   = new ANtpInfoObjectFillerNC();
01285   static ANtpRecoNtpManipulator *ntpManipulator = new ANtpRecoNtpManipulator();
01286   NtpStRecord            *tryRec = const_cast<NtpStRecord*>(pntp);
01287   ntpManipulator->SetRecord(tryRec);
01288   static ANtpEventInfoNC   *EventInfo  = new ANtpEventInfoNC();
01289   static ANtpTrackInfoNC   *TrackInfo  = new ANtpTrackInfoNC();
01290   static ANtpShowerInfoNC  *ShowerInfo = new ANtpShowerInfoNC();
01291   static ANtpTruthInfoBeam *TruthInfo  = new ANtpTruthInfoBeam();
01292 
01293   // Extract Header Info
01294   //====================
01295   // Detector - 1 near, 2 far - needed for filling the HeaderInfo
01296   Detector::Detector_t det = tryRec->GetVldContext()->GetDetector();
01297   InfoFiller->SetDetector(det);
01298   InfoFiller->SetStripArray(ntpManipulator->GetStripArray());
01299   InfoFiller->SetClusterArray(ntpManipulator->GetClusterArray());
01300 
01301   // Extract Event/Track/Shower/Truth Info
01302   //======================================
01303   //set up which flags you want to use to determine the primary shower or track
01304   //a value of 0 for a flag means it will not be used
01305   ntpManipulator->SetPrimaryTrackCriteria(0,1,0); // nplanes, length, total pulse height
01306   ntpManipulator->SetPrimaryShowerCriteria(0,1);  // nplanes, total pulse height
01307 
01308 
01309   // Initialize kNN, only once per snarl
01310   //====================================
01311   InfoFiller->InitializekNN(ntpManipulator);
01312 
01313   // Reset the Info Objects
01314   //=======================
01315   EventInfo->Reset();
01316   TrackInfo->Reset();
01317   ShowerInfo->Reset();
01318   TruthInfo->Reset();
01319 
01320   // Fill event, track, shower and truth and calculate variables needed
01321   //===================================================================
01322   InfoFiller->FillInformation(eventNb, ntpManipulator, EventInfo, TrackInfo, ShowerInfo, TruthInfo);
01323 
01324   // Fill the NuEvent variables
01325   //===========================
01326   // event
01327   nu.closeTimeDeltaZ = EventInfo->closeTimeDeltaZ;
01328   nu.edgeActivityStrips = EventInfo->edgeActivityStrips;
01329   nu.edgeActivityPH = EventInfo->edgeActivityPH;
01330   nu.oppEdgeStrips = EventInfo->oppEdgeStrips;
01331   nu.oppEdgePH = EventInfo->oppEdgePH;
01332   nu.vtxMetersToCoilEvt = EventInfo->vtxMetersToCoil;
01333   nu.vtxMetersToCloseEdgeEvt = EventInfo->vtxMetersToCloseEdge;
01334   nu.minTimeSeparation = EventInfo->minTimeSeparation;
01335 
01336   nu.slicePHFraction = EventInfo->slicePHFraction;
01337   nu.maxConsecutivePlanes = EventInfo->maxConsecutivePlanes;
01338 
01339   // shower
01340   nu.transverseRMSU = ShowerInfo->transverseRMSU;
01341   nu.transverseRMSV = ShowerInfo->transverseRMSV;
01342 
01343   // track
01344   nu.dtdz = TrackInfo->dtdz;
01345   nu.endMetersToCloseEdge = TrackInfo->endMetersToCloseEdge;
01346   nu.vtxMetersToCloseEdgeTrk = TrackInfo->vtxMetersToCloseEdge;
01347   nu.vtxMetersToCoilTrk = TrackInfo->vtxMetersToCoil;
01348   nu.traceEndZ = TrackInfo->traceEndZ;
01349 
01350   MSG("NuExtraction",Msg::kDebug) << "End ExtractNCInfo, gDirectory is : ";
01351   gDirectory = tmpd;
01352   //gDirectory->pwd();
01353 }

void NuExtraction::ExtractNthTrkInfo ( int  trkIdx,
const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const [protected]

Helper for ExtractTrkInfo.

Definition at line 864 of file NuExtraction.cxx.

References NtpSRPlane::beg, NtpSRPlane::begu, NtpSRPlane::begv, NuReco::CalculateHorizontalVerticalStripNumber(), NuReco::CalculateParallelStripInset(), NuReco::CalculatePerpendicularStripFlag(), NtpSRTrackTime::cdtds, NtpSRTrackTime::chi2, NtpSRFitTrack::chi2, NtpSRTrack::contained, NtpSRVertex::dcosy, NtpSRVertex::dcosz, NtpSRFiducial::dr, NtpSRTrack::ds, NtpSRFiducial::dz, NtpSRTrack::end, NtpSRPlane::end, NtpSRPlane::endu, NtpSRPlane::endv, NtpSRMomentum::eqp, NtpSRTrack::fidall, NtpSRTrack::fidend, NtpSRTrack::fidvtx, NtpSRTrack::fit, NtpSRTrackTime::forwardNDOF, NtpSRTrackTime::forwardRMS, NuReco::GetCosBetweenPr_Theta(), NuReco::GetEdgeRegion(), NuReco::GetPhi(), NuReco::GetRegion(), NuReco::GetShowerEnergyNearTrack(), NuReco::GetTrackCharge(), NuReco::GetTrackEnergyFromCurvCor(), NuReco::GetTrackEnergyFromRangeCor(), NuReco::GetTrackFirstStrip(), NuReco::GetTrackFirstStripIsU(), NuReco::GetTrackFirstUStrip(), NuReco::GetTrackFirstVStrip(), NuReco::GetTrackLastStrip(), NuReco::GetTrackLastStripIsU(), NuReco::GetTrackLastUStrip(), NuReco::GetTrackLastVStrip(), NuReco::GetTrackWithIndexX(), NuReco::GetTrkQPFraction(), NuReco::GetTrueTrackId(), NuEvent::hornIsReverse, NtpSRTrack::index, NuLibrary::Instance(), NtpSRTrack::momentum, NtpSRPlane::n, NtpSRTrackTime::ndigit, NtpSRTrack::ndigit, NtpSRFitTrack::ndof, NtpSRTrack::nstrip, NtpSRTrackPlane::ntrklike, NtpSRPlane::nu, NtpSRPlane::nv, NtpSRFitTrack::pass, NtpSRTrack::ph, NtpSRVertex::plane, NtpSRTrack::plane, NtpSRMomentum::qp, NtpSRMomentum::qp_rangebiased, NtpSRMomentum::range, NuLibrary::reco, NtpSRPulseHeight::sigcor, NtpSRStripPulseHeight::sigmap, NtpSRVertex::t, NtpSRTrackTime::t0, NtpSRTrack::time, NtpSRFiducial::trace, NtpSRVertex::u, NtpSRVertex::v, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by ExtractTrkInfo().

00868 {
00869   //get an instance of the code library
00870   const NuLibrary& lib = NuLibrary::Instance();
00871 
00872   //get pointer to trk
00873   const NtpSRTrack* ptrk = lib.reco.GetTrackWithIndexX(ntp, evt, trkIdx-1);
00874 
00875   //set this to default to no track exists
00876   get_trkExists(nu, trkIdx) = false;
00877 
00878   //check if track exists
00879   if(ptrk){
00880     //get a reference
00881     const NtpSRTrack& trk = *ptrk;
00882 
00883     get_trkExists(nu, trkIdx) = true;
00884     get_trkIndex(nu, trkIdx) = trk.index;
00885     get_ndigitTrk(nu, trkIdx) = trk.ndigit;
00886     get_nstripTrk(nu, trkIdx) = trk.nstrip;
00887     get_trkEnCorRange(nu, trkIdx) =
00888       lib.reco.GetTrackEnergyFromRangeCor(trk.momentum.range, nu);
00889     get_trkEnCorCurv(nu, trkIdx) =
00890       lib.reco.GetTrackEnergyFromCurvCor(trk.momentum.qp, nu);
00891     get_trkShwEnNear(nu, trkIdx) =
00892       lib.reco.GetShowerEnergyNearTrack(ntp, trk,
00893                                         &get_trkShwEnNearDW(nu, trkIdx));
00894     get_trkMomentumRange(nu, trkIdx) = trk.momentum.range;
00895     get_containedTrk(nu, trkIdx) = trk.contained;
00896     get_trkfitpass(nu, trkIdx) = trk.fit.pass;
00897     get_trkvtxdcosz(nu, trkIdx) = trk.vtx.dcosz;
00898     get_trkvtxdcosy(nu, trkIdx) = trk.vtx.dcosy;
00899     get_trknplane(nu, trkIdx) = trk.plane.n;
00900     get_charge(nu, trkIdx) = lib.reco.GetTrackCharge(trk, nu.hornIsReverse);
00901     get_qp(nu, trkIdx) = trk.momentum.qp;
00902     get_qp_rangebiased(nu, trkIdx) = trk.momentum.qp_rangebiased;
00903     get_sigqp(nu, trkIdx) = trk.momentum.eqp;
00904     if(get_sigqp(nu, trkIdx) != 0.0)
00905       get_qp_sigqp(nu, trkIdx) = get_qp(nu, trkIdx) / get_sigqp(nu, trkIdx);
00906     get_chi2(nu, trkIdx) = trk.fit.chi2;
00907     get_ndof(nu, trkIdx) = trk.fit.ndof;
00908     get_qpFraction(nu, trkIdx) = lib.reco.GetTrkQPFraction(trk);
00909     get_trkVtxUVDiffPl(nu, trkIdx) = trk.plane.begu-trk.plane.begv;
00910     get_trkLength(nu, trkIdx) = abs(trk.plane.end-trk.plane.beg+1);
00911     get_planeTrkNu(nu, trkIdx) = trk.plane.nu;
00912     get_planeTrkNv(nu, trkIdx) = trk.plane.nv;
00913     get_ntrklike(nu, trkIdx) = trk.plane.ntrklike;
00914     get_trkphsigcor(nu, trkIdx) = trk.ph.sigcor;
00915     get_trkphsigmap(nu, trkIdx) = trk.ph.sigmap;
00916     get_trkIdMC(nu, trkIdx) = lib.reco.GetTrueTrackId(ntp,trk);
00917     get_trkds(nu, trkIdx) = trk.ds;
00918 
00919     //majority curvature is extracted in its own function
00920 
00921     get_xTrkVtx(nu, trkIdx) = trk.vtx.x;
00922     get_yTrkVtx(nu, trkIdx) = trk.vtx.y;
00923     get_zTrkVtx(nu, trkIdx) = trk.vtx.z;
00924     get_uTrkVtx(nu, trkIdx) = trk.vtx.u;
00925     get_vTrkVtx(nu, trkIdx) = trk.vtx.v;
00926     get_tTrkVtx(nu, trkIdx) = trk.vtx.t;
00927     get_planeTrkVtx(nu, trkIdx) = trk.vtx.plane;
00928     get_planeTrkBeg(nu, trkIdx) = trk.plane.beg;
00929     get_planeTrkBegu(nu, trkIdx) = trk.plane.begu;
00930     get_planeTrkBegv(nu, trkIdx) = trk.plane.begv;
00931     get_inverseBetaTrk(nu, trkIdx) = trk.time.cdtds;
00932     get_t0Trk(nu, trkIdx) = trk.time.t0;
00933     get_chi2TimeTrk(nu, trkIdx) = trk.time.chi2;
00934     get_ndigitTimeTrk(nu, trkIdx) = trk.time.ndigit;
00935     get_forwardRMSTrk(nu, trkIdx) = trk.time.forwardRMS;
00936     get_forwardNDOFTrk(nu, trkIdx) = trk.time.forwardNDOF;
00937     get_stripTrkBeg(nu, trkIdx) = lib.reco.GetTrackFirstStrip(ntp, trk);
00938     get_stripTrkBegu(nu, trkIdx) = lib.reco.GetTrackFirstUStrip(ntp, trk);
00939     get_stripTrkBegv(nu, trkIdx) = lib.reco.GetTrackFirstVStrip(ntp, trk);
00940     get_stripTrkEnd(nu, trkIdx) = lib.reco.GetTrackLastStrip(ntp,trk);
00941     get_stripTrkEndu(nu, trkIdx) = lib.reco.GetTrackLastUStrip(ntp,trk);
00942     get_stripTrkEndv(nu, trkIdx) = lib.reco.GetTrackLastVStrip(ntp,trk);
00943     get_stripTrkBegIsu(nu, trkIdx) = lib.reco.GetTrackFirstStripIsU(ntp, trk);
00944     get_stripTrkEndIsu(nu, trkIdx) = lib.reco.GetTrackLastStripIsU(ntp, trk);
00945     get_regionTrkVtx(nu, trkIdx) = lib.reco.GetRegion(ntp, trk.vtx);
00946     get_edgeRegionTrkVtx(nu, trkIdx) = lib.reco.GetEdgeRegion(ntp,trk.vtx);
00947     get_edgeRegionTrkEnd(nu, trkIdx) = lib.reco.GetEdgeRegion(ntp,trk.end);
00948     get_phiTrkVtx(nu, trkIdx) = lib.reco.GetPhi(trk.vtx);
00949     get_phiTrkEnd(nu, trkIdx) = lib.reco.GetPhi(trk.end);
00950 
00951     lib.reco.CalculateParallelStripInset(nu, trkIdx);
00952     lib.reco.CalculatePerpendicularStripFlag(nu, trkIdx);
00953     lib.reco.CalculateHorizontalVerticalStripNumber(nu, trkIdx);
00954 
00955     get_xTrkEnd(nu, trkIdx) = trk.end.x;
00956     get_yTrkEnd(nu, trkIdx) = trk.end.y;
00957     get_zTrkEnd(nu, trkIdx) = trk.end.z;
00958     get_uTrkEnd(nu, trkIdx) = trk.end.u;
00959     get_vTrkEnd(nu, trkIdx) = trk.end.v;
00960     get_planeTrkEnd(nu, trkIdx) = trk.plane.end;
00961     get_planeTrkEndu(nu, trkIdx) = trk.plane.endu;
00962     get_planeTrkEndv(nu, trkIdx) = trk.plane.endv;
00963 
00964     get_drTrkFidall(nu, trkIdx) = trk.fidall.dr;
00965     get_dzTrkFidall(nu, trkIdx) = trk.fidall.dz;
00966     get_drTrkFidvtx(nu, trkIdx) = trk.fidvtx.dr;
00967     get_dzTrkFidvtx(nu, trkIdx) = trk.fidvtx.dz;
00968     get_drTrkFidend(nu, trkIdx) = trk.fidend.dr;
00969     get_dzTrkFidend(nu, trkIdx) = trk.fidend.dz;
00970     get_traceTrkFidall(nu, trkIdx) = trk.fidall.trace;
00971     get_traceTrkFidvtx(nu, trkIdx) = trk.fidvtx.trace;
00972     get_traceTrkFidend(nu, trkIdx) = trk.fidend.trace;
00973 
00974     get_cosPrTrkVtx(nu, trkIdx) = lib.reco.GetCosBetweenPr_Theta(trk);
00975   }
00976 }

void NuExtraction::ExtractSAFitInfo ( const NtpFitSARecord pntpSA,
NuEvent nu 
) const

Definition at line 177 of file NuExtraction.cxx.

References NtpFitSARecord::fitsa, NuReco::GetTrackCharge(), NuReco::GetVldContext(), NuLibrary::Instance(), Msg::kDebug, MAXMSG, NuLibrary::reco, NuReco::SetBestTrkSAFit(), and NuReco::uvz2xyz().

Referenced by ExtractAuxiliaryInfo().

00179 {
00180   if (!pntpSA) {
00181     MAXMSG("MeuAnalysis",Msg::kDebug,5)
00182       <<"ExtractSAFitInfo: no NtpFitSARecord"<<endl;
00183     return;
00184   }
00185 
00186   //get a reference
00187   const NtpFitSARecord& ntpSA=*pntpSA;
00188   const TClonesArray& fitsaTca=(*ntpSA.fitsa);
00189 
00190   //get an instance of the code library
00191   const NuLibrary& lib=NuLibrary::Instance();
00192 
00193   for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
00194 
00195     if(get_trkIndex(nu, trkIdx) >= 0){
00196       const NtpFitSA& fitsa =
00197         *(NtpFitSA*)(fitsaTca[get_trkIndex(nu, trkIdx)]);
00198 
00199       get_trkfitpassSA(nu, trkIdx) = fitsa.fit.pass;
00200       get_trkvtxdcoszSA(nu, trkIdx) = fitsa.fit.dcosz;
00201       get_chargeSA(nu, trkIdx) = lib.reco.GetTrackCharge
00202         (fitsa.fit.qp, nu.hornIsReverse);
00203       get_qpSA(nu, trkIdx) = fitsa.fit.qp;
00204       get_sigqpSA(nu, trkIdx) = fitsa.fit.eqp;
00205       get_chi2SA(nu, trkIdx) = fitsa.fit.chi2;
00206       get_ndofSA(nu, trkIdx) = fitsa.fit.ndf;
00207       get_probSA(nu, trkIdx) = TMath::Prob(fitsa.fit.chi2, fitsa.fit.ndf);
00208       TVector3 xyz = lib.reco.uvz2xyz(fitsa.fit.u, fitsa.fit.v,fitsa.fit.z,
00209                                       lib.reco.GetVldContext(nu));
00210       get_xTrkVtxSA(nu, trkIdx) = xyz.X();
00211       get_yTrkVtxSA(nu, trkIdx) = xyz.Y();
00212       get_zTrkVtxSA(nu, trkIdx) = fitsa.fit.z;
00213       get_uTrkVtxSA(nu, trkIdx) = fitsa.fit.u;
00214       get_vTrkVtxSA(nu, trkIdx) = fitsa.fit.v;
00215     }
00216   } // end for trkIdx
00217 
00218   //copy across the variables for the best track
00219   lib.reco.SetBestTrkSAFit(nu);
00220 }

void NuExtraction::ExtractShwInfo ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 812 of file NuExtraction.cxx.

References NtpSRPlane::beg, NtpSRPlane::end, NuReco::GetShowerEnergyCor(), NuReco::GetShowerWithIndexX(), NuReco::GetShwMaxPlane(), NuLibrary::Instance(), CandShowerHandle::kCC, CandShowerHandle::kNC, CandShowerHandle::kWtCC, CandShowerHandle::kWtNC, NtpSRShowerPulseHeight::linCCgev, NtpSRShowerPulseHeight::linNCgev, NtpSRStripPulseHeight::mip, NtpSRPlane::n, NtpSRShower::ndigit, NtpSRShower::nstrip, NtpSRShower::ph, NtpSRShower::plane, NuLibrary::reco, NtpSRShower::shwph, NtpSRShower::vtx, NtpSRShowerPulseHeight::wtCCgev, NtpSRShowerPulseHeight::wtNCgev, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by NuAnalysis::EnergySpect(), NuAnalysis::EnergySpectMC(), ExtractBasicInfo(), ExtractTrkShwInfo(), NuAnalysis::LIRejectionTest(), and NuAnalysis::N_1().

00815 {
00816   //get an instance of the code library
00817   const NuLibrary& lib = NuLibrary::Instance();
00818 
00819   for(int shwIdx = 1; shwIdx <= 5; ++shwIdx){
00820     //get pointer to shower
00821     const NtpSRShower* pshw = lib.reco.GetShowerWithIndexX(ntp, evt, shwIdx-1);
00822 
00823     get_shwExists(nu, shwIdx) = false;
00824 
00825     //check if shower exists
00826     if(pshw){
00827       //get a reference
00828       const NtpSRShower& shw = *pshw;
00829       //fill the variable(s)
00830       get_shwExists(nu, shwIdx) = true;
00831       get_ndigitShw(nu, shwIdx) = shw.ndigit;
00832       get_nstripShw(nu, shwIdx) = shw.nstrip;
00833       get_nplaneShw(nu, shwIdx) = shw.plane.n;
00834       get_shwEnCor(nu, shwIdx) = lib.reco.GetShowerEnergyCor
00835         (shw.shwph.linCCgev, CandShowerHandle::kCC, nu);
00836       get_shwEnNoCor(nu, shwIdx) = shw.shwph.linCCgev;//has to go first
00837       get_shwEnLinCCCor(nu, shwIdx) = lib.reco.GetShowerEnergyCor
00838         (shw.shwph.linCCgev, CandShowerHandle::kCC, nu);
00839       get_shwEnLinCCNoCor(nu, shwIdx) = shw.shwph.linCCgev;
00840       get_shwEnLinNCCor(nu, shwIdx) = lib.reco.GetShowerEnergyCor
00841         (shw.shwph.linNCgev, CandShowerHandle::kNC, nu);
00842       get_shwEnLinNCNoCor(nu, shwIdx) = shw.shwph.linNCgev;
00843       get_shwEnWtCCCor(nu, shwIdx) = lib.reco.GetShowerEnergyCor
00844         (shw.shwph.wtCCgev, CandShowerHandle::kWtCC, nu);
00845       get_shwEnWtCCNoCor(nu, shwIdx) = shw.shwph.wtCCgev;
00846       get_shwEnWtNCCor(nu, shwIdx) = lib.reco.GetShowerEnergyCor
00847         (shw.shwph.wtNCgev, CandShowerHandle::kWtNC, nu);
00848       get_shwEnWtNCNoCor(nu, shwIdx) = shw.shwph.wtNCgev;
00849 
00850       //Note: shw.ph.gev=shw.shwph.wtCCgev
00851       get_shwEnMip(nu, shwIdx) = shw.ph.mip;
00852       get_planeShwBeg(nu, shwIdx) = shw.plane.beg;
00853       get_planeShwEnd(nu, shwIdx) = shw.plane.end;
00854       get_planeShwMax(nu, shwIdx) = lib.reco.GetShwMaxPlane(ntp, shw);
00855       get_xShwVtx(nu, shwIdx) = shw.vtx.x;
00856       get_yShwVtx(nu, shwIdx) = shw.vtx.y;
00857       get_zShwVtx(nu, shwIdx) = shw.vtx.z;
00858     }
00859   } // end for shwIdx
00860 }

void NuExtraction::ExtractTimeToNearestSpill ( NuEvent nu  )  const

Definition at line 498 of file NuExtraction.cxx.

References NuEvent::detector, VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), SpillTimeFinder::GetTimeOfNearestSpill(), SpillTimeFinder::GetTimeToNearestSpill(), NuReco::GetVldContext(), NuLibrary::Instance(), SpillTimeFinder::Instance(), SimFlag::kData, Msg::kInfo, Msg::kWarning, MAXMSG, NuEvent::nearestSpillNanosec, NuEvent::nearestSpillSec, NuLibrary::reco, NuEvent::simFlag, NuEvent::timeToNearestSpill, and NuEvent::useDBForSpillTiming.

Referenced by NuDemoModule::Ana(), ExtractAuxiliaryInfo(), and NuAnalysis::LIRejectionTest().

00499 {
00500   //check if data
00501   if (nu.simFlag!=SimFlag::kData) {
00502     MAXMSG("NuExtraction",Msg::kInfo,1)
00503       <<"Not extracting TimeToNearestSpill for simFlag="<<nu.simFlag
00504       <<endl;
00505     //set a default value
00506     nu.timeToNearestSpill=-999999;
00507     return;
00508   }
00509   
00510 //   //check if the far detector
00511 //   if (nu.detector!=Detector::kFar) {
00512 //     MAXMSG("NuExtraction",Msg::kInfo,1)
00513 //       <<"Not extracting TimeToNearestSpill for detector="<<nu.detector
00514 //       <<endl;
00515 //     //set a default value
00516 //     nu.timeToNearestSpill=-999999;
00517 //     return;
00518 //   }
00519   
00520   //check whether to use the database
00521   if (!nu.useDBForSpillTiming) {
00522     MAXMSG("NuExtraction",Msg::kWarning,1)
00523       <<"Not extracting TimeToNearestSpill"
00524       <<" (flag set to not query database)"
00525       <<", nu.timeToNearestSpill="<<nu.timeToNearestSpill
00526       <<endl;
00527     //leave as current value (for re-reconstruction case)
00528     return;
00529   }
00530 
00531   MAXMSG("NuExtraction",Msg::kInfo,1)
00532     <<"Extracting TimeToNearestSpill for simFlag="<<nu.simFlag
00533     <<", detector="<<nu.detector<<endl;
00534   SpillTimeFinder& spillFinder=SpillTimeFinder::Instance();
00535 
00536   //get an instance of the code library
00537   const NuLibrary& lib=NuLibrary::Instance();
00538 
00539   VldContext vc=lib.reco.GetVldContext(nu);
00540   nu.timeToNearestSpill=spillFinder.GetTimeToNearestSpill(vc);
00541 
00542   VldTimeStamp nearestspill = spillFinder.GetTimeOfNearestSpill(vc);
00543   nu.nearestSpillSec = nearestspill.GetSec();
00544   nu.nearestSpillNanosec = nearestspill.GetNanoSec();
00545 }

void NuExtraction::ExtractTimingFiducial ( NuEvent nu  )  const

Definition at line 549 of file NuExtraction.cxx.

References NuEvent::detector, Form(), Detector::kNear, Msg::kWarning, MSG, NuEvent::run, NuEvent::timeSec, and NuEvent::timingFiducial.

Referenced by ExtractAuxiliaryInfo().

00550 {
00551   //  return;
00552   if (Detector::kNear == nu.detector){
00553     return;
00554   }
00555 
00556   //Find out the run number
00557   Int_t runNumber = nu.run;
00558   //Find the time of the event
00559   Int_t snarlTimeInSeconds = nu.timeSec;
00560 
00561   //Open the relavent text file
00562   string filename =
00563     Form("/minos/data/users/evansj/ToFU/RawData/crate2fid%d.txt",
00564          runNumber);
00565   ifstream fidFile(filename.c_str());
00566   if (!fidFile){
00567     MSG("NuExtraction",Msg::kWarning)
00568       << "No timing fiducial file found for run " << runNumber
00569       << endl;
00570     nu.timingFiducial = -999999;
00571     return;
00572   }
00573 
00574   //Find the timing fiducial immediately before the event
00575   Int_t runCheck, timingFiducial, timeOfData;
00576   Int_t previousTimingFiducial = -999;
00577   Int_t firstLine = true;
00578   while (!fidFile.eof()){
00579     fidFile >> runCheck >> timingFiducial >> timeOfData;
00580 
00581     if (firstLine){
00582       if (timeOfData > snarlTimeInSeconds){
00583         MSG("NuExtraction",Msg::kWarning)
00584           << "First entry is timing fiducial file for run "
00585           << runNumber
00586           << " is later than the snarl"
00587           << endl;
00588         assert(0);
00589       }
00590       firstLine = false;
00591     }
00592     if (snarlTimeInSeconds < timeOfData){
00593       break;
00594     }
00595     previousTimingFiducial = timingFiducial;
00596   }
00597 
00598   if (-999 == previousTimingFiducial){
00599     MSG("NuExtraction",Msg::kWarning)
00600       << "No timing fiducial has been found!!!!"
00601       << endl;
00602     assert(0);
00603   }
00604 
00605   nu.timingFiducial = previousTimingFiducial;
00606 }

void NuExtraction::ExtractTrkInfo ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 732 of file NuExtraction.cxx.

References ExtractNthTrkInfo(), NtpSREvent::index, Msg::kDebug, MAXMSG, NtpSREvent::nshower, and NtpSREvent::ntrack.

Referenced by NuAnalysis::EnergySpect(), NuAnalysis::EnergySpectMC(), ExtractBasicInfo(), ExtractTrkShwInfo(), NuAnalysis::LIRejectionTest(), and NuAnalysis::N_1().

00735 {
00736   Msg::LogLevel_t logLevel=Msg::kDebug;
00737 
00738   MAXMSG("NuExtraction",logLevel,200)
00739     <<"evt="<<evt.index<<", trks="<<evt.ntrack
00740     <<", shws="<<evt.nshower<<endl;
00741 
00742   for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
00743     ExtractNthTrkInfo(trkIdx, ntp, evt, nu);
00744   }
00745 }

void NuExtraction::ExtractTrkShwInfo ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 749 of file NuExtraction.cxx.

References ExtractShwInfo(), ExtractTrkInfo(), NtpSREvent::index, Msg::kDebug, MAXMSG, NtpSREvent::nshower, and NtpSREvent::ntrack.

Referenced by NuDemoModule::Ana().

00752 {
00753   Msg::LogLevel_t logLevel=Msg::kDebug;
00754 
00755   MAXMSG("NuExtraction",logLevel,200)
00756     <<"evt="<<evt.index<<", trks="<<evt.ntrack
00757     <<", shws="<<evt.nshower<<endl;
00758 
00759   //extract the trk info
00760   this->ExtractTrkInfo(ntp,evt,nu);
00761 
00762   //extract the shower info (does 1-3)
00763   this->ExtractShwInfo(ntp,evt,nu);
00764 }

void NuExtraction::ExtractVertexTimeFit ( const NtpStRecord ntp,
const NtpSREvent evt,
NuEvent nu 
) const

Definition at line 609 of file NuExtraction.cxx.

References NtpSREvent::index, passfail(), NtpTimingFit::RunBeamFit(), NuEvent::vtxFitChi2DoF, NuEvent::vtxFitPassFail, NuEvent::vtxFitTime, and NuEvent::vtxFitTimeError.

Referenced by ExtractAuxiliaryInfo().

00612 {
00613   Double_t vtxtime = -999.9;
00614   Double_t vtxtime_error = -999.9;
00615   Double_t chi2_dof = -999.9;
00616 
00617   NtpStRecord* evilConstCast = const_cast<NtpStRecord*> (&ntp);
00618 
00619   Bool_t passfail = NtpTimingFit::RunBeamFit(evilConstCast,
00620                                              (Int_t) evt.index,
00621                                              vtxtime,
00622                                              vtxtime_error,
00623                                              chi2_dof);
00624 
00625   nu.vtxFitPassFail = passfail;
00626   nu.vtxFitTime = vtxtime;
00627   nu.vtxFitTimeError = vtxtime_error;
00628   nu.vtxFitChi2DoF = chi2_dof;
00629 }

void NuExtraction::NuEventFromNuMCEvent ( const NuMCEvent mc,
NuEvent nu 
) const

Definition at line 1535 of file NuExtraction.cxx.

References NuMCEvent::aMC, NuEvent::aMC, NuMCEvent::anaVersion, NuEvent::anaVersion, NuMCEvent::anaWeightCC2010, NuEvent::anaWeightCC2010, NuMCEvent::apply1SigmaWeight, NuEvent::apply1SigmaWeight, NuMCEvent::applyBeamWeight, NuEvent::applyBeamWeight, NuMCEvent::applyDetectorWeight, NuEvent::applyDetectorWeight, NuMCEvent::applyGeneratorWeight, NuEvent::applyGeneratorWeight, NuMCEvent::beamType, NuEvent::beamType, NuMCEvent::beamWeight, NuEvent::beamWeight, NuMCEvent::detector, NuEvent::detector, NuMCEvent::detectorWeight, NuEvent::detectorWeight, NuMCEvent::detectorWeightNM, NuEvent::detectorWeightNM, NuMCEvent::detectorWeightNMB, NuEvent::detectorWeightNMB, NuMCEvent::energyMC, NuEvent::energyMC, NuMCEvent::entry, NuEvent::entry, NuMCEvent::fluxErr, NuEvent::fluxErr, NuMCEvent::generatorWeight, NuEvent::generatorWeight, NuMCEvent::hadronicFinalStateMC, NuEvent::hadronicFinalStateMC, NuMCEvent::hornIsReverse, NuEvent::hornIsReverse, NuMCEvent::iaction, NuEvent::iaction, NuMCEvent::initialStateMC, NuEvent::initialStateMC, NuMCEvent::intensity, NuEvent::intensity, NuMCEvent::inu, NuEvent::inu, NuMCEvent::InukeFormTN, NuEvent::InukeFormTN, NuMCEvent::InukeFormTP, NuEvent::InukeFormTP, NuMCEvent::InukeNknockN, NuEvent::InukeNknockN, NuMCEvent::InukeNknockP, NuEvent::InukeNknockP, NuMCEvent::InukeNNPiN, NuEvent::InukeNNPiN, NuMCEvent::InukeNNPiP, NuEvent::InukeNNPiP, NuMCEvent::InukeNucrad, NuEvent::InukeNucrad, NuMCEvent::InukeNwts, NuEvent::InukeNwts, NuMCEvent::InukeNXsecN, NuEvent::InukeNXsecN, NuMCEvent::InukeNXsecP, NuEvent::InukeNXsecP, NuMCEvent::InukePi2PiN, NuEvent::InukePi2PiN, NuMCEvent::InukePi2PiP, NuEvent::InukePi2PiP, NuMCEvent::InukePiAbsorbN, NuEvent::InukePiAbsorbN, NuMCEvent::InukePiAbsorbP, NuEvent::InukePiAbsorbP, NuMCEvent::InukePiCExchgN, NuEvent::InukePiCExchgN, NuMCEvent::InukePiCExchgP, NuEvent::InukePiCExchgP, NuMCEvent::InukePiEScatN, NuEvent::InukePiEScatN, NuMCEvent::InukePiEScatP, NuEvent::InukePiEScatP, NuMCEvent::InukePiInEScatN, NuEvent::InukePiInEScatN, NuMCEvent::InukePiInEScatP, NuEvent::InukePiInEScatP, NuMCEvent::InukePiXsecN, NuEvent::InukePiXsecN, NuMCEvent::InukePiXsecP, NuEvent::InukePiXsecP, NuMCEvent::InukeWrad, NuEvent::InukeWrad, NuMCEvent::inunoosc, NuEvent::inunoosc, NuMCEvent::iresonance, NuEvent::iresonance, NuMCEvent::isInFidVolCCMC, NuEvent::isInFidVolCCMC, NuMCEvent::itg, NuEvent::itg, NuMCEvent::maxMomPreInukeFSneutMC, NuEvent::maxMomPreInukeFSneutMC, NuMCEvent::maxMomPreInukeFSprotMC, NuEvent::maxMomPreInukeFSprotMC, NuMCEvent::mc, NuEvent::mc, NuMCEvent::mu1EnMC, NuEvent::mu1EnMC, NuMCEvent::mu1PxMC, NuEvent::mu1PxMC, NuMCEvent::mu1PyMC, NuEvent::mu1PyMC, NuMCEvent::mu1PzMC, NuEvent::mu1PzMC, NuMCEvent::Ndecay, NuEvent::Ndecay, NuMCEvent::NdxdzFar, NuEvent::NdxdzFar, NuMCEvent::NdxdzNea, NuEvent::NdxdzNea, NuMCEvent::NdydzFar, NuEvent::NdydzFar, NuMCEvent::NdydzNea, NuEvent::NdydzNea, NuMCEvent::Necm, NuEvent::Necm, NuMCEvent::NenergyF, NuEvent::NenergyF, NuMCEvent::NenergyN, NuEvent::NenergyN, NuMCEvent::neuEnMC, NuEvent::neuEnMC, NuMCEvent::neuPxMC, NuEvent::neuPxMC, NuMCEvent::neuPyMC, NuEvent::neuPyMC, NuMCEvent::neuPzMC, NuEvent::neuPzMC, NuMCEvent::Nimpwt, NuEvent::Nimpwt, NuMCEvent::Npz, NuEvent::Npz, NuMCEvent::nucleusMC, NuEvent::nucleusMC, NuMCEvent::numPreInukeFSneutMC, NuEvent::numPreInukeFSneutMC, NuMCEvent::numPreInukeFSprotMC, NuEvent::numPreInukeFSprotMC, NuMCEvent::NWtFar, NuEvent::NWtFar, NuMCEvent::NWtNear, NuEvent::NWtNear, NuMCEvent::pdPx, NuEvent::pdPx, NuMCEvent::pdPy, NuEvent::pdPy, NuMCEvent::pdPz, NuEvent::pdPz, NuMCEvent::planeTrkVtxMC, NuEvent::planeTrkVtxMC, NuMCEvent::ppdxdz, NuEvent::ppdxdz, NuMCEvent::ppdydz, NuEvent::ppdydz, NuMCEvent::ppenergy, NuEvent::ppenergy, NuMCEvent::ppmedium, NuEvent::ppmedium, NuMCEvent::pppz, NuEvent::pppz, NuMCEvent::ppvx, NuEvent::ppvx, NuMCEvent::ppvy, NuEvent::ppvy, NuMCEvent::ppvz, NuEvent::ppvz, NuMCEvent::ptype, NuEvent::ptype, NuMCEvent::q2MC, NuEvent::q2MC, NuMCEvent::releaseType, NuEvent::releaseType, NuMCEvent::reweightVersion, NuEvent::reweightVersion, NuMCEvent::rTrkVtxMC, NuEvent::rTrkVtxMC, NuMCEvent::run, NuEvent::run, NuMCEvent::runPeriod, NuEvent::runPeriod, NuMCEvent::rw, NuEvent::rw, NuMCEvent::rwActual, NuEvent::rwActual, NuMCEvent::shwEn2MC, NuEvent::shwEn2MC, NuMCEvent::shwEnMC, NuEvent::shwEnMC, NuMCEvent::shwEnWeight, NuEvent::shwEnWeight, NuMCEvent::sigma, NuEvent::sigma, NuMCEvent::simFlag, NuEvent::simFlag, NuMCEvent::snarl, NuEvent::snarl, NuMCEvent::subRun, NuEvent::subRun, NuMCEvent::tgen, NuEvent::tgen, NuMCEvent::tgtEnMC, NuEvent::tgtEnMC, NuMCEvent::tgtPxMC, NuEvent::tgtPxMC, NuMCEvent::tgtPyMC, NuEvent::tgtPyMC, NuMCEvent::tgtPzMC, NuEvent::tgtPzMC, NuMCEvent::timeNanoSec, NuEvent::timeNanoSec, NuMCEvent::timeSec, NuEvent::timeSec, NuMCEvent::timeSeconds, NuEvent::timeSeconds, NuMCEvent::tptype, NuEvent::tptype, NuMCEvent::tpx, NuEvent::tpx, NuMCEvent::tpy, NuEvent::tpy, NuMCEvent::tpz, NuEvent::tpz, NuMCEvent::trigtime, NuEvent::trigtime, NuMCEvent::trkContainmentMC, NuEvent::trkContainmentMC, NuMCEvent::trkEn2MC, NuEvent::trkEn2MC, NuMCEvent::trkEndEnMC, NuEvent::trkEndEnMC, NuMCEvent::trkEnMC, NuEvent::trkEnMC, NuMCEvent::trkEnWeight, NuEvent::trkEnWeight, NuMCEvent::trkStartEnMC, NuEvent::trkStartEnMC, NuMCEvent::tvx, NuEvent::tvx, NuMCEvent::tvy, NuEvent::tvy, NuMCEvent::tvz, NuEvent::tvz, NuMCEvent::vtxuMC, NuEvent::vtxuMC, NuMCEvent::vtxvMC, NuEvent::vtxvMC, NuMCEvent::vtxxMC, NuEvent::vtxxMC, NuMCEvent::vtxyMC, NuEvent::vtxyMC, NuMCEvent::vtxzMC, NuEvent::vtxzMC, NuMCEvent::Vx, NuEvent::Vx, NuMCEvent::Vy, NuEvent::Vy, NuMCEvent::Vz, NuEvent::Vz, NuMCEvent::w2MC, NuEvent::w2MC, NuMCEvent::xMC, NuEvent::xMC, NuMCEvent::y2MC, NuEvent::y2MC, NuMCEvent::yMC, NuEvent::yMC, NuMCEvent::zMC, and NuEvent::zMC.

Referenced by NuZBeamReweight::ExtractZBeamReweight().

01537 {
01538   //copy the info across
01539 
01541   //book keeping  quantities
01543   nu.entry=mc.entry;
01544 
01546   //snarl/run based quantities
01548   nu.run=mc.run;
01549   nu.subRun=mc.subRun;
01550   nu.snarl=mc.snarl;
01551 
01552   nu.runPeriod=mc.runPeriod;
01553   nu.intensity=mc.intensity;
01554   nu.hornIsReverse=mc.hornIsReverse;
01555   nu.beamType=mc.beamType;
01556 
01557   nu.detector=mc.detector;
01558   nu.simFlag=mc.simFlag;
01559   nu.timeSec=mc.timeSec;
01560   nu.timeNanoSec=mc.timeNanoSec;
01561   nu.timeSeconds=mc.timeSeconds;
01562   nu.trigtime=mc.trigtime;
01563 
01564   nu.releaseType=mc.releaseType;
01565   nu.anaVersion=mc.anaVersion;
01566 
01568   //truth variables
01570   nu.energyMC=mc.energyMC;
01571 
01572   nu.neuEnMC=mc.neuEnMC;
01573   nu.neuPxMC=mc.neuPxMC;
01574   nu.neuPyMC=mc.neuPyMC;
01575   nu.neuPzMC=mc.neuPzMC;
01576 
01577   nu.mu1EnMC=mc.mu1EnMC;
01578   nu.mu1PxMC=mc.mu1PxMC;
01579   nu.mu1PyMC=mc.mu1PyMC;
01580   nu.mu1PzMC=mc.mu1PzMC;
01581 
01582   nu.tgtEnMC=mc.tgtEnMC;
01583   nu.tgtPxMC=mc.tgtPxMC;
01584   nu.tgtPyMC=mc.tgtPyMC;
01585   nu.tgtPzMC=mc.tgtPzMC;
01586 
01587   nu.zMC=mc.zMC;
01588   nu.aMC=mc.aMC;
01589   nu.nucleusMC=mc.nucleusMC;
01590   nu.initialStateMC=mc.initialStateMC;
01591   nu.hadronicFinalStateMC=mc.hadronicFinalStateMC;
01592   nu.numPreInukeFSprotMC=mc.numPreInukeFSprotMC;
01593   nu.numPreInukeFSneutMC=mc.numPreInukeFSneutMC;
01594   nu.maxMomPreInukeFSprotMC=mc.maxMomPreInukeFSprotMC;
01595   nu.maxMomPreInukeFSneutMC=mc.maxMomPreInukeFSneutMC;
01596 
01597   nu.yMC=mc.yMC;
01598   nu.y2MC=mc.y2MC;
01599   nu.xMC=mc.xMC;
01600   nu.q2MC=mc.q2MC;
01601   nu.w2MC=mc.w2MC;
01602 
01603   nu.trkEnMC=mc.trkEnMC;
01604   nu.trkEn2MC=mc.trkEn2MC;
01605   nu.shwEnMC=mc.shwEnMC;
01606   nu.shwEn2MC=mc.shwEn2MC;
01607 
01608   nu.trkEndEnMC=mc.trkEndEnMC;
01609   nu.trkStartEnMC=mc.trkStartEnMC;
01610   nu.trkContainmentMC=mc.trkContainmentMC;
01611 
01612   nu.sigma=mc.sigma;
01613   nu.iaction=mc.iaction;
01614   nu.iresonance=mc.iresonance;
01615   nu.inu=mc.inu;
01616   nu.inunoosc=mc.inunoosc;
01617   nu.itg=mc.itg;
01618 
01619   nu.vtxxMC=mc.vtxxMC;
01620   nu.vtxyMC=mc.vtxyMC;
01621   nu.vtxzMC=mc.vtxzMC;
01622   nu.vtxuMC=mc.vtxuMC;
01623   nu.vtxvMC=mc.vtxvMC;
01624   nu.planeTrkVtxMC=mc.planeTrkVtxMC;
01625   nu.rTrkVtxMC=mc.rTrkVtxMC;
01626 
01627   nu.mc=mc.mc;//copy across the index of the true event
01628 
01629   nu.Npz=mc.Npz;
01630   nu.NdxdzNea=mc.NdxdzNea;
01631   nu.NdydzNea=mc.NdydzNea;
01632   nu.NenergyN=mc.NenergyN;
01633   nu.NWtNear=mc.NWtNear;
01634   nu.NdxdzFar=mc.NdxdzFar;
01635   nu.NdydzFar=mc.NdydzFar;
01636   nu.NenergyF=mc.NenergyF;
01637   nu.NWtFar=mc.NWtFar;
01638   nu.Ndecay=mc.Ndecay;
01639   nu.Vx=mc.Vx;
01640   nu.Vy=mc.Vy;
01641   nu.Vz=mc.Vz;
01642   nu.pdPx=mc.pdPx;
01643   nu.pdPy=mc.pdPy;
01644   nu.pdPz=mc.pdPz;
01645   nu.ppdxdz=mc.ppdxdz;
01646   nu.ppdydz=mc.ppdydz;
01647   nu.pppz=mc.pppz;
01648   nu.ppenergy=mc.ppenergy;
01649   nu.ppmedium=mc.ppmedium;
01650   nu.ppvx=mc.ppvx;
01651   nu.ppvy=mc.ppvy;
01652   nu.ppvz=mc.ppvz;
01653   nu.ptype=mc.ptype;
01654   nu.Necm=mc.Necm;
01655   nu.Nimpwt=mc.Nimpwt;
01656   nu.tvx=mc.tvx;
01657   nu.tvy=mc.tvy;
01658   nu.tvz=mc.tvz;
01659   nu.tpx=mc.tpx;
01660   nu.tpy=mc.tpy;
01661   nu.tpz=mc.tpz;
01662   nu.tptype=mc.tptype;
01663   nu.tgen=mc.tgen;
01664 
01665   //copy the weights
01666   nu.reweightVersion = mc.reweightVersion;
01667   nu.applyBeamWeight = mc.applyBeamWeight;
01668   nu.apply1SigmaWeight = mc.apply1SigmaWeight;
01669   nu.applyDetectorWeight = mc.applyDetectorWeight;
01670   nu.applyGeneratorWeight = mc.applyGeneratorWeight;
01671   
01672   nu.rw=mc.rw;
01673   nu.fluxErr=mc.fluxErr;
01674   nu.rwActual=mc.rwActual;
01675   nu.generatorWeight=mc.generatorWeight;
01676   nu.detectorWeight=mc.detectorWeight;
01677   nu.anaWeightCC2010=mc.anaWeightCC2010;
01678 
01679   nu.trkEnWeight=mc.trkEnWeight;
01680   nu.shwEnWeight=mc.shwEnWeight;
01681   nu.beamWeight=mc.beamWeight;
01682   nu.detectorWeightNMB=mc.detectorWeightNMB;
01683   nu.detectorWeightNM=mc.detectorWeightNM;
01684 
01685   nu.InukeNwts  =  (Int_t)mc.InukeNwts ;
01686   nu.InukePiCExchgP  =  mc.InukePiCExchgP ;   //0
01687   nu.InukePiCExchgN  =  mc.InukePiCExchgN ;   //1
01688   nu.InukePiEScatP  =  mc.InukePiEScatP ;     //2
01689   nu.InukePiEScatN  =  mc.InukePiEScatN ;     //3
01690   nu.InukePiInEScatP  =  mc.InukePiInEScatP ;  //4
01691   nu.InukePiInEScatN  =  mc.InukePiInEScatN ;  //5
01692   nu.InukePiAbsorbP  =  mc.InukePiAbsorbP ;   //6
01693   nu.InukePiAbsorbN  =  mc.InukePiAbsorbN ;   //7
01694   nu.InukePi2PiP  =  mc.InukePi2PiP ;         //8
01695   nu.InukePi2PiN  =  mc.InukePi2PiN ;         //9
01696   nu.InukeNknockP  =  mc.InukeNknockP ;       //10
01697   nu.InukeNknockN  =  mc.InukeNknockN ;       //11
01698   nu.InukeNNPiP  =  mc.InukeNNPiP ;           //12
01699   nu.InukeNNPiN  =  mc.InukeNNPiN ;           //13
01700   nu.InukeFormTP  =  mc.InukeFormTP ;      //14
01701   nu.InukeFormTN  =  mc.InukeFormTN ;      //15
01702   nu.InukePiXsecP  =  mc.InukePiXsecP ;     //16
01703   nu.InukePiXsecN  =  mc.InukePiXsecN ;     //17
01704   nu.InukeNXsecP  =  mc.InukeNXsecP ;      //18
01705   nu.InukeNXsecN  =  mc.InukeNXsecN ;      //19
01706   nu.InukeNucrad  =  mc.InukeNucrad ;
01707   nu.InukeWrad  =  mc.InukeWrad ;
01708 
01709   nu.isInFidVolCCMC = mc.isInFidVolCCMC;
01710 }

void NuExtraction::NuMCEventFromNuEvent ( const NuEvent nu,
NuMCEvent numc 
) const

Definition at line 1356 of file NuExtraction.cxx.

References NuEvent::aMC, NuMCEvent::aMC, NuEvent::anaVersion, NuMCEvent::anaVersion, NuEvent::anaWeightCC2010, NuMCEvent::anaWeightCC2010, NuEvent::apply1SigmaWeight, NuMCEvent::apply1SigmaWeight, NuEvent::applyBeamWeight, NuMCEvent::applyBeamWeight, NuEvent::applyDetectorWeight, NuMCEvent::applyDetectorWeight, NuEvent::applyGeneratorWeight, NuMCEvent::applyGeneratorWeight, NuEvent::beamType, NuMCEvent::beamType, NuEvent::beamWeight, NuMCEvent::beamWeight, NuEvent::detector, NuMCEvent::detector, NuEvent::detectorWeight, NuMCEvent::detectorWeight, NuEvent::detectorWeightNM, NuMCEvent::detectorWeightNM, NuEvent::detectorWeightNMB, NuMCEvent::detectorWeightNMB, NuEvent::energyMC, NuMCEvent::energyMC, NuEvent::entry, NuMCEvent::entry, NuEvent::fluxErr, NuMCEvent::fluxErr, NuEvent::generatorWeight, NuMCEvent::generatorWeight, NuEvent::hadronicFinalStateMC, NuMCEvent::hadronicFinalStateMC, NuEvent::hornIsReverse, NuMCEvent::hornIsReverse, NuEvent::iaction, NuMCEvent::iaction, NuEvent::initialStateMC, NuMCEvent::initialStateMC, NuEvent::intensity, NuMCEvent::intensity, NuEvent::inu, NuMCEvent::inu, NuEvent::InukeFormTN, NuMCEvent::InukeFormTN, NuEvent::InukeFormTP, NuMCEvent::InukeFormTP, NuEvent::InukeNknockN, NuMCEvent::InukeNknockN, NuEvent::InukeNknockP, NuMCEvent::InukeNknockP, NuEvent::InukeNNPiN, NuMCEvent::InukeNNPiN, NuEvent::InukeNNPiP, NuMCEvent::InukeNNPiP, NuEvent::InukeNucrad, NuMCEvent::InukeNucrad, NuEvent::InukeNwts, NuMCEvent::InukeNwts, NuEvent::InukeNXsecN, NuMCEvent::InukeNXsecN, NuEvent::InukeNXsecP, NuMCEvent::InukeNXsecP, NuEvent::InukePi2PiN, NuMCEvent::InukePi2PiN, NuEvent::InukePi2PiP, NuMCEvent::InukePi2PiP, NuEvent::InukePiAbsorbN, NuMCEvent::InukePiAbsorbN, NuEvent::InukePiAbsorbP, NuMCEvent::InukePiAbsorbP, NuEvent::InukePiCExchgN, NuMCEvent::InukePiCExchgN, NuEvent::InukePiCExchgP, NuMCEvent::InukePiCExchgP, NuEvent::InukePiEScatN, NuMCEvent::InukePiEScatN, NuEvent::InukePiEScatP, NuMCEvent::InukePiEScatP, NuEvent::InukePiInEScatN, NuMCEvent::InukePiInEScatN, NuEvent::InukePiInEScatP, NuMCEvent::InukePiInEScatP, NuEvent::InukePiXsecN, NuMCEvent::InukePiXsecN, NuEvent::InukePiXsecP, NuMCEvent::InukePiXsecP, NuEvent::InukeWrad, NuMCEvent::InukeWrad, NuEvent::inunoosc, NuMCEvent::inunoosc, NuEvent::iresonance, NuMCEvent::iresonance, NuEvent::isInFidVolCCMC, NuMCEvent::isInFidVolCCMC, NuEvent::itg, NuMCEvent::itg, NuEvent::maxMomPreInukeFSneutMC, NuMCEvent::maxMomPreInukeFSneutMC, NuEvent::maxMomPreInukeFSprotMC, NuMCEvent::maxMomPreInukeFSprotMC, NuEvent::mc, NuMCEvent::mc, NuEvent::mu1EnMC, NuMCEvent::mu1EnMC, NuEvent::mu1PxMC, NuMCEvent::mu1PxMC, NuEvent::mu1PyMC, NuMCEvent::mu1PyMC, NuEvent::mu1PzMC, NuMCEvent::mu1PzMC, NuEvent::Ndecay, NuMCEvent::Ndecay, NuEvent::NdxdzFar, NuMCEvent::NdxdzFar, NuEvent::NdxdzNea, NuMCEvent::NdxdzNea, NuEvent::NdydzFar, NuMCEvent::NdydzFar, NuEvent::NdydzNea, NuMCEvent::NdydzNea, NuEvent::Necm, NuMCEvent::Necm, NuEvent::NenergyF, NuMCEvent::NenergyF, NuEvent::NenergyN, NuMCEvent::NenergyN, NuEvent::neuEnMC, NuMCEvent::neuEnMC, NuEvent::neuPxMC, NuMCEvent::neuPxMC, NuEvent::neuPyMC, NuMCEvent::neuPyMC, NuEvent::neuPzMC, NuMCEvent::neuPzMC, NuEvent::Nimpwt, NuMCEvent::Nimpwt, NuEvent::Npz, NuMCEvent::Npz, NuEvent::nucleusMC, NuMCEvent::nucleusMC, NuEvent::numPreInukeFSneutMC, NuMCEvent::numPreInukeFSneutMC, NuEvent::numPreInukeFSprotMC, NuMCEvent::numPreInukeFSprotMC, NuEvent::NWtFar, NuMCEvent::NWtFar, NuEvent::NWtNear, NuMCEvent::NWtNear, NuEvent::pdPx, NuMCEvent::pdPx, NuEvent::pdPy, NuMCEvent::pdPy, NuEvent::pdPz, NuMCEvent::pdPz, NuEvent::planeTrkVtxMC, NuMCEvent::planeTrkVtxMC, NuEvent::ppdxdz, NuMCEvent::ppdxdz, NuEvent::ppdydz, NuMCEvent::ppdydz, NuEvent::ppenergy, NuMCEvent::ppenergy, NuEvent::ppmedium, NuMCEvent::ppmedium, NuEvent::pppz, NuMCEvent::pppz, NuEvent::ppvx, NuMCEvent::ppvx, NuEvent::ppvy, NuMCEvent::ppvy, NuEvent::ppvz, NuMCEvent::ppvz, NuEvent::ptype, NuMCEvent::ptype, NuEvent::q2MC, NuMCEvent::q2MC, NuEvent::releaseType, NuMCEvent::releaseType, NuEvent::reweightVersion, NuMCEvent::reweightVersion, NuEvent::rTrkVtxMC, NuMCEvent::rTrkVtxMC, NuEvent::run, NuMCEvent::run, NuEvent::runPeriod, NuMCEvent::runPeriod, NuEvent::rw, NuMCEvent::rw, NuEvent::rwActual, NuMCEvent::rwActual, NuEvent::shwEn2MC, NuMCEvent::shwEn2MC, NuEvent::shwEnMC, NuMCEvent::shwEnMC, NuEvent::shwEnWeight, NuMCEvent::shwEnWeight, NuEvent::sigma, NuMCEvent::sigma, NuEvent::simFlag, NuMCEvent::simFlag, NuEvent::snarl, NuMCEvent::snarl, NuEvent::subRun, NuMCEvent::subRun, NuEvent::tgen, NuMCEvent::tgen, NuEvent::tgtEnMC, NuMCEvent::tgtEnMC, NuEvent::tgtPxMC, NuMCEvent::tgtPxMC, NuEvent::tgtPyMC, NuMCEvent::tgtPyMC, NuEvent::tgtPzMC, NuMCEvent::tgtPzMC, NuEvent::timeNanoSec, NuMCEvent::timeNanoSec, NuEvent::timeSec, NuMCEvent::timeSec, NuEvent::timeSeconds, NuMCEvent::timeSeconds, NuEvent::tptype, NuMCEvent::tptype, NuEvent::tpx, NuMCEvent::tpx, NuEvent::tpy, NuMCEvent::tpy, NuEvent::tpz, NuMCEvent::tpz, NuEvent::trigtime, NuMCEvent::trigtime, NuEvent::trkContainmentMC, NuMCEvent::trkContainmentMC, NuEvent::trkEn2MC, NuMCEvent::trkEn2MC, NuEvent::trkEndEnMC, NuMCEvent::trkEndEnMC, NuEvent::trkEnMC, NuMCEvent::trkEnMC, NuEvent::trkEnWeight, NuMCEvent::trkEnWeight, NuEvent::trkStartEnMC, NuMCEvent::trkStartEnMC, NuEvent::tvx, NuMCEvent::tvx, NuEvent::tvy, NuMCEvent::tvy, NuEvent::tvz, NuMCEvent::tvz, NuEvent::vtxuMC, NuMCEvent::vtxuMC, NuEvent::vtxvMC, NuMCEvent::vtxvMC, NuEvent::vtxxMC, NuMCEvent::vtxxMC, NuEvent::vtxyMC, NuMCEvent::vtxyMC, NuEvent::vtxzMC, NuMCEvent::vtxzMC, NuEvent::Vx, NuMCEvent::Vx, NuEvent::Vy, NuMCEvent::Vy, NuEvent::Vz, NuMCEvent::Vz, NuEvent::w2MC, NuMCEvent::w2MC, NuEvent::xMC, NuMCEvent::xMC, NuEvent::y2MC, NuMCEvent::y2MC, NuEvent::yMC, NuMCEvent::yMC, NuEvent::zMC, and NuMCEvent::zMC.

Referenced by NuPlots::FillTrueFidEnergySpect(), and NuAnalysis::LoopOverTruthInfo().

01358 {
01359   //copy the info across
01360 
01362   //book keeping  quantities
01364   numc.entry=nu.entry;
01365 
01367   //snarl/run based quantities
01369   numc.run=nu.run;
01370   numc.subRun=nu.subRun;
01371   numc.snarl=nu.snarl;
01372 
01373   numc.runPeriod=nu.runPeriod;
01374   numc.intensity=nu.intensity;
01375   numc.hornIsReverse=nu.hornIsReverse;
01376   numc.beamType=nu.beamType;
01377 
01378   numc.detector=nu.detector;
01379   numc.simFlag=nu.simFlag;
01380   numc.timeSec=nu.timeSec;
01381   numc.timeNanoSec=nu.timeNanoSec;
01382   numc.timeSeconds=nu.timeSeconds;
01383   numc.trigtime=nu.trigtime;
01384 
01385   numc.releaseType=nu.releaseType;
01386   numc.anaVersion=nu.anaVersion;
01387 
01389   //truth variables
01391   numc.energyMC=nu.energyMC;
01392 
01393   numc.neuEnMC=nu.neuEnMC;
01394   numc.neuPxMC=nu.neuPxMC;
01395   numc.neuPyMC=nu.neuPyMC;
01396   numc.neuPzMC=nu.neuPzMC;
01397 
01398   numc.mu1EnMC=nu.mu1EnMC;
01399   numc.mu1PxMC=nu.mu1PxMC;
01400   numc.mu1PyMC=nu.mu1PyMC;
01401   numc.mu1PzMC=nu.mu1PzMC;
01402 
01403   numc.tgtEnMC=nu.tgtEnMC;
01404   numc.tgtPxMC=nu.tgtPxMC;
01405   numc.tgtPyMC=nu.tgtPyMC;
01406   numc.tgtPzMC=nu.tgtPzMC;
01407 
01408   numc.zMC=nu.zMC;
01409   numc.aMC=nu.aMC;
01410   numc.nucleusMC=nu.nucleusMC;
01411   numc.initialStateMC=nu.initialStateMC;
01412   numc.hadronicFinalStateMC=nu.hadronicFinalStateMC;
01413   numc.numPreInukeFSprotMC=nu.numPreInukeFSprotMC;
01414   numc.numPreInukeFSneutMC=nu.numPreInukeFSneutMC;
01415   numc.maxMomPreInukeFSprotMC=nu.maxMomPreInukeFSprotMC;
01416   numc.maxMomPreInukeFSneutMC=nu.maxMomPreInukeFSneutMC;
01417 
01418   numc.yMC=nu.yMC;
01419   numc.y2MC=nu.y2MC;
01420   numc.xMC=nu.xMC;
01421   numc.q2MC=nu.q2MC;
01422   numc.w2MC=nu.w2MC;
01423 
01424   numc.trkEnMC=nu.trkEnMC;
01425   numc.trkEn2MC=nu.trkEn2MC;
01426   numc.shwEnMC=nu.shwEnMC;
01427   numc.shwEn2MC=nu.shwEn2MC;
01428 
01429   numc.trkEndEnMC=nu.trkEndEnMC;
01430   numc.trkStartEnMC=nu.trkStartEnMC;
01431   numc.trkContainmentMC=nu.trkContainmentMC;
01432 
01433   numc.sigma=nu.sigma;
01434   numc.iaction=nu.iaction;
01435   numc.iresonance=nu.iresonance;
01436   numc.inu=nu.inu;
01437   numc.inunoosc=nu.inunoosc;
01438   numc.itg=nu.itg;
01439 
01440   numc.vtxxMC=nu.vtxxMC;
01441   numc.vtxyMC=nu.vtxyMC;
01442   numc.vtxzMC=nu.vtxzMC;
01443   numc.vtxuMC=nu.vtxuMC;
01444   numc.vtxvMC=nu.vtxvMC;
01445   numc.planeTrkVtxMC=nu.planeTrkVtxMC;
01446   numc.rTrkVtxMC=nu.rTrkVtxMC;
01447 
01448   numc.mc=nu.mc;//copy across the index of the true event
01449 
01450   numc.Npz=nu.Npz;
01451   numc.NdxdzNea=nu.NdxdzNea;
01452   numc.NdydzNea=nu.NdydzNea;
01453   numc.NenergyN=nu.NenergyN;
01454   numc.NWtNear=nu.NWtNear;
01455   numc.NdxdzFar=nu.NdxdzFar;
01456   numc.NdydzFar=nu.NdydzFar;
01457   numc.NenergyF=nu.NenergyF;
01458   numc.NWtFar=nu.NWtFar;
01459   numc.Ndecay=nu.Ndecay;
01460   numc.Vx=nu.Vx;
01461   numc.Vy=nu.Vy;
01462   numc.Vz=nu.Vz;
01463   numc.pdPx=nu.pdPx;
01464   numc.pdPy=nu.pdPy;
01465   numc.pdPz=nu.pdPz;
01466   numc.ppdxdz=nu.ppdxdz;
01467   numc.ppdydz=nu.ppdydz;
01468   numc.pppz=nu.pppz;
01469   numc.ppenergy=nu.ppenergy;
01470   numc.ppmedium=nu.ppmedium;
01471   numc.ppvx=nu.ppvx;
01472   numc.ppvy=nu.ppvy;
01473   numc.ppvz=nu.ppvz;
01474   numc.ptype=nu.ptype;
01475   numc.Necm=nu.Necm;
01476   numc.Nimpwt=nu.Nimpwt;
01477   numc.tvx=nu.tvx;
01478   numc.tvy=nu.tvy;
01479   numc.tvz=nu.tvz;
01480   numc.tpx=nu.tpx;
01481   numc.tpy=nu.tpy;
01482   numc.tpz=nu.tpz;
01483   numc.tptype=nu.tptype;
01484   numc.tgen=nu.tgen;
01485 
01486   //copy the weights
01487   numc.reweightVersion = nu.reweightVersion;
01488   numc.applyBeamWeight = nu.applyBeamWeight;
01489   numc.apply1SigmaWeight = nu.apply1SigmaWeight;
01490   numc.applyDetectorWeight = nu.applyDetectorWeight;
01491   numc.applyGeneratorWeight = nu.applyGeneratorWeight;
01492   
01493   numc.rw=nu.rw;
01494   numc.fluxErr=nu.fluxErr;
01495   numc.rwActual=nu.rwActual;
01496   numc.generatorWeight=nu.generatorWeight;
01497   numc.detectorWeight=nu.detectorWeight;
01498   numc.anaWeightCC2010=nu.anaWeightCC2010;
01499 
01500   numc.trkEnWeight=nu.trkEnWeight;
01501   numc.shwEnWeight=nu.shwEnWeight;
01502   numc.beamWeight=nu.beamWeight;
01503   numc.detectorWeightNMB=nu.detectorWeightNMB;
01504   numc.detectorWeightNM=nu.detectorWeightNM;
01505 
01506   numc.InukeNwts  =  nu.InukeNwts ;
01507   numc.InukePiCExchgP  =  nu.InukePiCExchgP ;   //0
01508   numc.InukePiCExchgN  =  nu.InukePiCExchgN ;   //1
01509   numc.InukePiEScatP  =  nu.InukePiEScatP ;     //2
01510   numc.InukePiEScatN  =  nu.InukePiEScatN ;     //3
01511   numc.InukePiInEScatP  =  nu.InukePiInEScatP ;  //4
01512   numc.InukePiInEScatN  =  nu.InukePiInEScatN ;  //5
01513   numc.InukePiAbsorbP  =  nu.InukePiAbsorbP ;   //6
01514   numc.InukePiAbsorbN  =  nu.InukePiAbsorbN ;   //7
01515   numc.InukePi2PiP  =  nu.InukePi2PiP ;         //8
01516   numc.InukePi2PiN  =  nu.InukePi2PiN ;         //9
01517   numc.InukeNknockP  =  nu.InukeNknockP ;       //10
01518   numc.InukeNknockN  =  nu.InukeNknockN ;       //11
01519   numc.InukeNNPiP  =  nu.InukeNNPiP ;           //12
01520   numc.InukeNNPiN  =  nu.InukeNNPiN ;           //13
01521   numc.InukeFormTP  =  nu.InukeFormTP ;      //14
01522   numc.InukeFormTN  =  nu.InukeFormTN ;      //15
01523   numc.InukePiXsecP  =  nu.InukePiXsecP ;     //16
01524   numc.InukePiXsecN  =  nu.InukePiXsecN ;     //17
01525   numc.InukeNXsecP  =  nu.InukeNXsecP ;      //18
01526   numc.InukeNXsecN  =  nu.InukeNXsecN ;      //19
01527   numc.InukeNucrad  =  nu.InukeNucrad ;
01528   numc.InukeWrad  =  nu.InukeWrad ;
01529 
01530   numc.isInFidVolCCMC = nu.isInFidVolCCMC;
01531 }


The documentation for this class was generated from the following files:
Generated on Thu May 23 22:02:23 2013 for loon by  doxygen 1.4.7