ANtpInfoObjectFillerBeam Class Reference

#include <ANtpInfoObjectFillerBeam.h>

Inheritance diagram for ANtpInfoObjectFillerBeam:

ANtpInfoObjectFiller ANtpInfoObjectFillerNC List of all members.

Public Member Functions

 ANtpInfoObjectFillerBeam ()
 ANtpInfoObjectFillerBeam (Detector::Detector_t detector)
virtual ~ANtpInfoObjectFillerBeam ()
void FillBeamInformation (VldTimeStamp &timeStamp, Detector::Detector_t det, SimFlag::SimFlag_t dataType, ANtpBeamInfo *beamInfo)
void FillBeamInformation (NtpBDLiteRecord *bdRecord, ANtpBeamInfo *beamInfo)

Static Public Member Functions

static void FillBeamMCTruthInformation (NtpMCTruth *ntpMCTruth, TClonesArray *stdArray, ANtpTruthInfoBeam *truthInfo)

Private Attributes

BMSpillAnafSpillAna

Detailed Description

Definition at line 25 of file ANtpInfoObjectFillerBeam.h.


Constructor & Destructor Documentation

ANtpInfoObjectFillerBeam::ANtpInfoObjectFillerBeam (  ) 

Definition at line 42 of file ANtpInfoObjectFillerBeam.cxx.

References Msg::kDebug, and MSG.

00043 {
00044   
00045   fSpillAna = new BMSpillAna();
00046   //use the database to determine the cuts for this data sample
00047   fSpillAna->UseDatabaseCuts();
00048   
00049   MSG("ANtpInfoObjectFillerBeam", Msg::kDebug) << "ANtpInfoObjectFillerBeam::Constructor" << endl;
00050   
00051 }

ANtpInfoObjectFillerBeam::ANtpInfoObjectFillerBeam ( Detector::Detector_t  detector  ) 

Definition at line 54 of file ANtpInfoObjectFillerBeam.cxx.

References fSpillAna, Msg::kDebug, MSG, and BMSpillAna::UseDatabaseCuts().

00054                                                                               :
00055   ANtpInfoObjectFiller(detector)
00056 {
00057 
00058   fSpillAna = new BMSpillAna();
00059   //use the database to determine the cuts for this data sample
00060   fSpillAna->UseDatabaseCuts();
00061     
00062   MSG("ANtpInfoObjectFillerBeam", Msg::kDebug) << "ANtpInfoObjectFillerBeam::Constructor" << endl;
00063    
00064 }

ANtpInfoObjectFillerBeam::~ANtpInfoObjectFillerBeam (  )  [virtual]

Definition at line 67 of file ANtpInfoObjectFillerBeam.cxx.

References fSpillAna, Msg::kDebug, and MSG.

00068 {
00069 
00070   delete fSpillAna;
00071   MSG("ANtpInfoObjectFillerBeam", Msg::kDebug) << "ANtpInfoObjectFillerBeam::Destructor" << endl;
00072   
00073 }


Member Function Documentation

void ANtpInfoObjectFillerBeam::FillBeamInformation ( NtpBDLiteRecord bdRecord,
ANtpBeamInfo beamInfo 
)

Definition at line 168 of file ANtpInfoObjectFillerBeam.cxx.

References BeamMonSpill::BeamType(), ANtpBeamInfo::beamType, BeamMonSpill::BpmAtTarget(), NtpBDLiteRecord::dt_nearest, BeamMonSpill::fHadInt, BeamMonSpill::fHornCur, BeamMonSpill::fMuInt1, BeamMonSpill::fMuInt2, BeamMonSpill::fMuInt3, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, fSpillAna, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, RecRecordImp< T >::GetHeader(), BeamDataLiteHeader::GetTimeDiffStreamSpill(), ANtpBeamInfo::goodSpill, ANtpBeamInfo::hadronIntensity, ANtpBeamInfo::hornCurrent, ANtpBeamInfo::muonIntensity1, ANtpBeamInfo::muonIntensity2, ANtpBeamInfo::muonIntensity3, NtpBDLiteRecord::nearest_nsec, NtpBDLiteRecord::nearest_sec, ANtpBeamInfo::nearestNSToSpill, ANtpBeamInfo::nearestSecToSpill, ANtpBeamInfo::profileWidthX, ANtpBeamInfo::profileWidthY, ANtpBeamInfo::protonIntensity, ANtpBeamInfo::Reset(), BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), ANtpBeamInfo::streamSpillTimeDiff, ANtpBeamInfo::targetBPMX, ANtpBeamInfo::targetBPMY, ANtpBeamInfo::timeToNearestSpill, ANtpBeamInfo::tor101, ANtpBeamInfo::tortgt, ANtpBeamInfo::tr101d, and ANtpBeamInfo::trtgtd.

00170 {
00171 
00172   beamInfo->Reset();
00173 
00174   //got to get the header to get the status bits
00175   if(record){
00176 
00177     double x = 0.;
00178     double y = 0.;
00179     double xrms = 0.;
00180     double yrms = 0.;
00181 
00182     //need a BeamMonSpill object to use the BMSpillAna object
00183     BeamMonSpill spillInfo;
00184 
00185     //set the spill in the BMSpillAna object
00186     fSpillAna->SetSpill(*record, spillInfo);
00187     spillInfo.BpmAtTarget(x,y,xrms,yrms);
00188 
00189     beamInfo->tor101 = spillInfo.fTor101;
00190     beamInfo->tr101d = spillInfo.fTr101d;
00191     beamInfo->tortgt = spillInfo.fTortgt;
00192     beamInfo->trtgtd = spillInfo.fTrtgtd;
00193     beamInfo->hornCurrent = spillInfo.fHornCur;
00194     beamInfo->targetBPMX = x;
00195     beamInfo->targetBPMY = y;
00196     beamInfo->profileWidthX = spillInfo.fProfWidX;
00197     beamInfo->profileWidthY = spillInfo.fProfWidY;
00198     beamInfo->hadronIntensity = spillInfo.fHadInt;
00199     beamInfo->muonIntensity1 = spillInfo.fMuInt1;
00200     beamInfo->muonIntensity2 = spillInfo.fMuInt2;
00201     beamInfo->muonIntensity3 = spillInfo.fMuInt3;
00202     beamInfo->beamType = (Int_t)( spillInfo.BeamType() );
00203     beamInfo->protonIntensity = beamInfo->trtgtd;
00204     
00205     beamInfo->timeToNearestSpill = record->dt_nearest;
00206     beamInfo->streamSpillTimeDiff = record->GetHeader().GetTimeDiffStreamSpill();
00207     beamInfo->nearestSecToSpill = record->nearest_sec;
00208     beamInfo->nearestNSToSpill = record->nearest_nsec;
00209     beamInfo->goodSpill = (int)fSpillAna->SelectSpill();
00210   }
00211   
00212   return;
00213 }

void ANtpInfoObjectFillerBeam::FillBeamInformation ( VldTimeStamp timeStamp,
Detector::Detector_t  det,
SimFlag::SimFlag_t  dataType,
ANtpBeamInfo beamInfo 
)

Definition at line 77 of file ANtpInfoObjectFillerBeam.cxx.

References ANtpBeamInfo::beamType, ANtpBeamInfo::deltaSecToSpillGPS, fSpillAna, BDSpillAccessor::Get(), VldTimeStamp::GetNanoSec(), SpillServerMonFinder::GetNearestSpill(), VldTimeStamp::GetSec(), VldTimeStamp::GetSeconds(), SpillServerMon::GetSpillTime(), SpillServerMon::GetSpillTimeError(), SpillTimeFinder::GetTimeOfNearestSpill(), VldContext::GetTimeStamp(), SpillTimeFinder::GetTimeToNearestSpill(), ANtpBeamInfo::goodSpill, ANtpBeamInfo::gpsError, ANtpBeamInfo::hadronIntensity, ANtpBeamInfo::hornCurrent, SpillServerMonFinder::Instance(), SpillTimeFinder::Instance(), SimFlag::kData, Detector::kFar, SimFlag::kMC, BDSpillAccessor::LoadSpill(), ANtpBeamInfo::muonIntensity1, ANtpBeamInfo::muonIntensity2, ANtpBeamInfo::muonIntensity3, ANtpBeamInfo::nearestNSToSpill, ANtpBeamInfo::nearestSecToSpill, ANtpBeamInfo::profileWidthX, ANtpBeamInfo::profileWidthY, ANtpBeamInfo::protonIntensity, ANtpBeamInfo::Reset(), BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), BMSpillAna::SetTimeDiff(), ANtpBeamInfo::streamSpillTimeDiff, ANtpBeamInfo::targetBPMX, ANtpBeamInfo::targetBPMY, ANtpBeamInfo::timeToNearestSpill, ANtpBeamInfo::tor101, ANtpBeamInfo::tortgt, ANtpBeamInfo::tr101d, and ANtpBeamInfo::trtgtd.

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

00081 {
00082   //get the appropriate context
00083   VldContext vldc(det, dataType, timeStamp);
00084 
00085   beamInfo->Reset();
00086 
00087 //   TStopwatch stopwatch;
00088 //     stopwatch.Start();
00089 //     stopwatch.Stop();
00090 //     MSG("CondensedNtpModuleAtm", Msg::kInfo) << "took " << stopwatch.RealTime()
00091 //                                            << " to make LoadSpill" << endl;
00092 //     stopwatch.Reset();
00093 
00094   if(dataType == SimFlag::kData){
00095     //make the thing to access the beam information from the db
00096     BDSpillAccessor& spillAccess = BDSpillAccessor::Get();
00097 
00098     double x = 0.;
00099     double y = 0.;
00100     double xrms = 0.;
00101     double yrms = 0.;
00102 
00103     //load the spill for the validity context
00104     const BeamMonSpill &spillInfo = *(spillAccess.LoadSpill(timeStamp));
00105     fSpillAna->SetSpill(spillInfo);
00106     spillInfo.BpmAtTarget(x,y,xrms,yrms);
00107 
00108     beamInfo->tor101 = spillInfo.fTor101;
00109     beamInfo->tr101d = spillInfo.fTr101d;
00110     beamInfo->tortgt = spillInfo.fTortgt;
00111     beamInfo->trtgtd = spillInfo.fTrtgtd;
00112     beamInfo->hornCurrent = spillInfo.fHornCur;
00113     beamInfo->targetBPMX = x;
00114     beamInfo->targetBPMY = y;
00115     beamInfo->profileWidthX = spillInfo.fProfWidX;
00116     beamInfo->profileWidthY = spillInfo.fProfWidY;
00117     beamInfo->hadronIntensity = spillInfo.fHadInt;
00118     beamInfo->muonIntensity1 = spillInfo.fMuInt1;
00119     beamInfo->muonIntensity2 = spillInfo.fMuInt2;
00120     beamInfo->muonIntensity3 = spillInfo.fMuInt3;
00121     beamInfo->beamType = (Int_t)( spillInfo.BeamType() );
00122     beamInfo->protonIntensity = beamInfo->tortgt;
00123 
00124     //cout << BeamType::AsString(spillInfo.BeamType()) << " " << beamInfo->beamType << endl;
00125     
00126     SpillTimeFinder &stf = SpillTimeFinder::Instance();
00127     VldTimeStamp tons = stf.GetTimeOfNearestSpill(vldc);
00128     beamInfo->timeToNearestSpill = stf.GetTimeToNearestSpill(vldc);
00129     beamInfo->nearestSecToSpill = tons.GetSec();
00130     beamInfo->nearestNSToSpill = tons.GetNanoSec();
00131     VldTimeStamp ds = spillInfo.SpillTime()-vldc.GetTimeStamp();
00132     fSpillAna->SetTimeDiff(ds.GetSeconds());
00133     beamInfo->streamSpillTimeDiff = ds.GetSeconds();
00134     beamInfo->goodSpill = (int)fSpillAna->SelectSpill();
00135 
00136     //gps error is only relevant for the far detector, so 
00137     //only ping the database for the far detector
00138     if(det == Detector::kFar){
00139       SpillServerMonFinder& spillFinder = SpillServerMonFinder::Instance();
00140       const SpillServerMon& nearestSpill= spillFinder.GetNearestSpill(vldc);
00141       tons = nearestSpill.GetSpillTime()-timeStamp;
00142       beamInfo->deltaSecToSpillGPS = TMath::Abs(tons.GetSec());
00143       beamInfo->gpsError = nearestSpill.GetSpillTimeError();
00144     }
00145   }
00146   else if(dataType == SimFlag::kMC){
00147 //     beamInfo->tor101 = spillInfo->fTor101;
00148 //     beamInfo->tortgt = spillInfo->fTortgt;
00149 //     beamInfo->trtgtd = spillInfo->fTrtgtd;
00150 //     beamInfo->hornCurrent = spillInfo->fHornCur;
00151 //     beamInfo->targetBPMX = spillInfo->fTargBpmX[0];
00152 //     beamInfo->targetBPMY = spillInfo->fTargBpmY[0];
00153 //     beamInfo->profileWidthX = spillInfo->fProfWidX;
00154 //     beamInfo->profileWidthY = spillInfo->fProfWidY;
00155 //     beamInfo->hadronIntensity = spillInfo->fHadInt;
00156 //     beamInfo->muonIntensity1 = spillInfo->fMuInt1;
00157 //     beamInfo->muonIntensity2 = spillInfo->fMuInt2;
00158 //     beamInfo->muonIntensity3 = spillInfo->fMuInt3;
00159 //     beamInfo->targetPosition = (int)spillInfo->GetStatusBits().beam_type;
00160 //     beamInfo->protonIntensity = beamInfo->tor101;
00161   }
00162   
00163   return;
00164 }

void ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation ( NtpMCTruth ntpMCTruth,
TClonesArray *  stdArray,
ANtpTruthInfoBeam truthInfo 
) [static]

Definition at line 217 of file ANtpInfoObjectFillerBeam.cxx.

References NtpMCTruth::a, ANtpTruthInfoBeam::atomicNumber, ANtpTruthInfoBeam::atomicWeight, ANtpTruthInfoBeam::bjorkenX, NtpMCTruth::emfrac, ANtpTruthInfoBeam::emShowerFraction, NtpMCTruth::flux, ANtpTruthInfoBeam::hadronicFinalState, NtpMCStdHep::IdHEP, ANtpTruthInfoBeam::initialState, NtpMCTruth::inu, NtpMCTruth::inunoosc, NtpMCTruth::iresonance, NtpMCStdHep::IstHEP, Msg::kDebug, NtpMCStdHep::mass, MSG, ANtpTruthInfoBeam::nonOscNuDCosX, ANtpTruthInfoBeam::nonOscNuDCosY, ANtpTruthInfoBeam::nonOscNuDCosZ, ANtpTruthInfoBeam::nonOscNuEnergy, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuFlavor, NtpMCStdHep::p4, NtpMCTruth::p4neunoosc, ANtpTruthInfoBeam::parentPID, ANtpTruthInfoBeam::parentPX, ANtpTruthInfoBeam::parentPY, ANtpTruthInfoBeam::parentPZ, ANtpTruthInfoBeam::parentX, ANtpTruthInfoBeam::parentY, ANtpTruthInfoBeam::parentZ, NtpMCFluxInfo::pdpx, NtpMCFluxInfo::pdpy, NtpMCFluxInfo::pdpz, NtpMCFluxInfo::ptype, NtpMCTruth::q2, ANtpTruthInfoBeam::q2, ANtpTruthInfoBeam::resonanceCode, NtpMCTruth::sigma, ANtpTruthInfoBeam::sigma, NtpMCTruth::stdhep, ANtpTruthInfoBeam::targetExitX, ANtpTruthInfoBeam::targetExitY, ANtpTruthInfoBeam::targetExitZ, ANtpTruthInfoBeam::targetParentPX, ANtpTruthInfoBeam::targetParentPY, ANtpTruthInfoBeam::targetParentPZ, ANtpTruthInfoBeam::targetParentType, NtpMCFluxInfo::tptype, NtpMCFluxInfo::tpx, NtpMCFluxInfo::tpy, NtpMCFluxInfo::tpz, ANtpTruthInfoBeam::trueVisibleE, NtpMCFluxInfo::tvx, NtpMCFluxInfo::tvy, NtpMCFluxInfo::tvz, NtpMCFluxInfo::vx, NtpMCFluxInfo::vy, NtpMCFluxInfo::vz, NtpMCTruth::w2, ANtpTruthInfoBeam::w2, NtpMCTruth::x, and NtpMCTruth::z.

Referenced by ANtpTruthInfoBeamAna::Analyze(), MadAnalysis::CreateANtpPAN(), ANtpInfoObjectFillerMRCC::FillEventInformationHelper(), and ANtpInfoObjectFillerNC::FillMCInformation().

00220 {  
00221   //the NtpMCTruth object stdhep array tells you which entries in the stdhep array 
00222   //are the first and last for the event
00223   Int_t lowIndex = (Int_t)ntpMCTruth->stdhep[0];
00224   Int_t highIndex = (Int_t)ntpMCTruth->stdhep[1];
00225 
00226   MSG("ANtpInfoObjectFillerBeam", Msg::kDebug) << "fill beam mc truth " 
00227                                               << lowIndex << " " << highIndex
00228                                               << endl;
00229 
00230   //already fill this variable in the FillMCTruthInformation() method
00231   //but leave it in to quiet the compiler
00232   truthInfo->nuFlavor = ntpMCTruth->inu;
00233   truthInfo->nonOscNuEnergy = ntpMCTruth->p4neunoosc[3];
00234   truthInfo->nonOscNuDCosX = ntpMCTruth->p4neunoosc[0];
00235   truthInfo->nonOscNuDCosY = ntpMCTruth->p4neunoosc[1];
00236   truthInfo->nonOscNuDCosZ = ntpMCTruth->p4neunoosc[2];
00237   truthInfo->nonOscNuFlavor = ntpMCTruth->inunoosc;
00238   truthInfo->resonanceCode = ntpMCTruth->iresonance;
00239   
00240   truthInfo->atomicWeight = ntpMCTruth->a;
00241   truthInfo->atomicNumber = ntpMCTruth->z;
00242   truthInfo->bjorkenX = ntpMCTruth->x;
00243   truthInfo->q2 = ntpMCTruth->q2;
00244   truthInfo->w2 = ntpMCTruth->w2;
00245   truthInfo->sigma = ntpMCTruth->sigma;
00246   truthInfo->emShowerFraction = ntpMCTruth->emfrac;
00247 
00248   truthInfo->targetExitX = ntpMCTruth->flux.tvx;
00249   truthInfo->targetExitY = ntpMCTruth->flux.tvy;
00250   truthInfo->targetExitZ = ntpMCTruth->flux.tvz;
00251   truthInfo->targetParentPX = ntpMCTruth->flux.tpx;
00252   truthInfo->targetParentPY = ntpMCTruth->flux.tpy;
00253   truthInfo->targetParentPZ = ntpMCTruth->flux.tpz;
00254   truthInfo->targetParentType = ntpMCTruth->flux.tptype;
00255   truthInfo->parentX = ntpMCTruth->flux.vx;
00256   truthInfo->parentY = ntpMCTruth->flux.vy;
00257   truthInfo->parentZ = ntpMCTruth->flux.vz;
00258   truthInfo->parentPX = ntpMCTruth->flux.pdpx;
00259   truthInfo->parentPY = ntpMCTruth->flux.pdpy;
00260   truthInfo->parentPZ = ntpMCTruth->flux.pdpz;
00261   truthInfo->parentPID = ntpMCTruth->flux.ptype;
00262 
00263   NtpMCStdHep *ntpMCStdHep = 0;
00264   
00265   //loop over the entries to figure out the targert nucleon
00266   Int_t nucleon = 0;
00267   Int_t nuFlavor = ntpMCTruth->inu;
00268 
00269   //gotta add up Mike K.'s true visible energy - email from mike on 5/26/06
00270   //Brian: You must define "true visible energy" for our regular MC files.  
00271   //It is not y*Enu for you.  You do it taking the *kinetic energy* of all
00272   //baryons and the *total energy* (e.g. include mass) of mesons. Use only
00273   //particles with IstHEP==1. Do add in any photons (e.g., from nucleon
00274   //resonance decays).  Use the code on all events, even those with zero
00275   //shower energy. Let me know if you have questions or problems.
00276   //in practice for everything that has 16 < abs(IdHep) < 1e5 and is not
00277   //2212 (proton) or 2112 (neutron) add total energy (p4[3]).  if is a 
00278   //proton or neutrino add sqrt(p4[3]*p4[3] - mass*mass)
00279   
00280   truthInfo->trueVisibleE = 0.;
00281 
00282   int idHEP = 0;
00283   int istHEP = 0;
00284   bool gotOneAlreadyMate = false;  //used for HadronicFinalState
00285 
00286   for(Int_t i = lowIndex; i < highIndex+1; ++i){
00287     
00288     ntpMCStdHep = dynamic_cast<NtpMCStdHep *>(stdArray->At(i));
00289 
00290     idHEP = ntpMCStdHep->IdHEP;
00291     istHEP = ntpMCStdHep->IstHEP;
00292 
00293     if(TMath::Abs(idHEP) > 16 
00294        && TMath::Abs(idHEP) < 1e5 
00295        && istHEP == 1){
00296       
00297       if(idHEP == 2212 || idHEP == 2112) 
00298         truthInfo->trueVisibleE += ntpMCStdHep->p4[3] - ntpMCStdHep->mass;
00299       else
00300         truthInfo->trueVisibleE += ntpMCStdHep->p4[3];
00301     }
00302     
00303     if(istHEP == 11){
00304       if(idHEP == 2212) nucleon = 1;
00305       else if(idHEP == 2112) nucleon = 0;
00306       else if(TMath::Abs(idHEP) > 1000000000)  nucleon = 2;
00307       else nucleon = 3;
00308     }
00309     
00310     if(nucleon == 1 && nuFlavor > 0) truthInfo->initialState = 1;       //p + v
00311     else if(nucleon == 0 && nuFlavor > 0) truthInfo->initialState = 2;  //n + v
00312     else if(nucleon == 1 && nuFlavor < 0) truthInfo->initialState = 3;  //p + vbar
00313     else if(nucleon == 0 && nuFlavor < 0) truthInfo->initialState = 4;  //n + vbar
00314     else if(nucleon == 2 && nuFlavor > 0) truthInfo->initialState = 5;  //N + v
00315     else if(nucleon == 3 && nuFlavor > 0) truthInfo->initialState = 6;  //A + v
00316     else if(nucleon == 2 && nuFlavor < 0) truthInfo->initialState = 7;  //N + vbar
00317     else if(nucleon == 3 && nuFlavor < 0) truthInfo->initialState = 8;  //A + vbar      
00318 
00319     //figure out the hadronic final state too, but only for non RES processes
00320     if(istHEP == 3 && !gotOneAlreadyMate){
00321       if(ntpMCTruth->iresonance != 1002 || TMath::Abs(idHEP) != 15){
00322         truthInfo->hadronicFinalState = idHEP%1000;
00323         gotOneAlreadyMate = true;
00324       }         
00325     }
00326     
00327   }//end loop over stdhep array for this event
00328   
00329   return;
00330 }


Member Data Documentation

BMSpillAna* ANtpInfoObjectFillerBeam::fSpillAna [private]

Definition at line 44 of file ANtpInfoObjectFillerBeam.h.

Referenced by ANtpInfoObjectFillerBeam(), FillBeamInformation(), and ~ANtpInfoObjectFillerBeam().


The documentation for this class was generated from the following files:
Generated on Wed Sep 10 22:50:47 2014 for loon by  doxygen 1.4.7