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

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)
void FillBeamMCTruthInformation (NtpMCTruth *ntpMCTruth, TClonesArray *stdArray, ANtpTruthInfoBeam *truthInfo)

Private Attributes

BMSpillAnafSpillAna

Constructor & Destructor Documentation

ANtpInfoObjectFillerBeam::ANtpInfoObjectFillerBeam  ) 
 

Definition at line 42 of file ANtpInfoObjectFillerBeam.cxx.

References 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, 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 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 167 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::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, BeamType::ToZarko(), and ANtpBeamInfo::trtgtd.

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

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

Definition at line 77 of file ANtpInfoObjectFillerBeam.cxx.

References BeamMonSpill::BeamType(), ANtpBeamInfo::beamType, BeamMonSpill::BpmAtTarget(), ANtpBeamInfo::deltaSecToSpillGPS, BeamMonSpill::fHadInt, BeamMonSpill::fHornCur, BeamMonSpill::fMuInt1, BeamMonSpill::fMuInt2, BeamMonSpill::fMuInt3, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, fSpillAna, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTrtgtd, 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(), 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(), BeamMonSpill::SpillTime(), ANtpBeamInfo::streamSpillTimeDiff, ANtpBeamInfo::targetBPMX, ANtpBeamInfo::targetBPMY, ANtpBeamInfo::timeToNearestSpill, ANtpBeamInfo::tor101, ANtpBeamInfo::tortgt, BeamType::ToZarko(), 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->tortgt = spillInfo.fTortgt;
00110     beamInfo->trtgtd = spillInfo.fTrtgtd;
00111     beamInfo->hornCurrent = spillInfo.fHornCur;
00112     beamInfo->targetBPMX = x;
00113     beamInfo->targetBPMY = y;
00114     beamInfo->profileWidthX = spillInfo.fProfWidX;
00115     beamInfo->profileWidthY = spillInfo.fProfWidY;
00116     beamInfo->hadronIntensity = spillInfo.fHadInt;
00117     beamInfo->muonIntensity1 = spillInfo.fMuInt1;
00118     beamInfo->muonIntensity2 = spillInfo.fMuInt2;
00119     beamInfo->muonIntensity3 = spillInfo.fMuInt3;
00120     beamInfo->beamType = BeamType::ToZarko(spillInfo.BeamType());
00121     beamInfo->protonIntensity = beamInfo->tortgt;
00122 
00123     //cout << BeamType::AsString(spillInfo.BeamType()) << " " << beamInfo->beamType << endl;
00124     
00125     SpillTimeFinder &stf = SpillTimeFinder::Instance();
00126     VldTimeStamp tons = stf.GetTimeOfNearestSpill(vldc);
00127     beamInfo->timeToNearestSpill = stf.GetTimeToNearestSpill(vldc);
00128     beamInfo->nearestSecToSpill = tons.GetSec();
00129     beamInfo->nearestNSToSpill = tons.GetNanoSec();
00130     VldTimeStamp ds = spillInfo.SpillTime()-vldc.GetTimeStamp();
00131     fSpillAna->SetTimeDiff(ds.GetSeconds());
00132     beamInfo->streamSpillTimeDiff = ds.GetSeconds();
00133     beamInfo->goodSpill = (int)fSpillAna->SelectSpill();
00134 
00135     //gps error is only relevant for the far detector, so 
00136     //only ping the database for the far detector
00137     if(det == Detector::kFar){
00138       SpillServerMonFinder& spillFinder = SpillServerMonFinder::Instance();
00139       const SpillServerMon& nearestSpill= spillFinder.GetNearestSpill(vldc);
00140       tons = nearestSpill.GetSpillTime()-timeStamp;
00141       beamInfo->deltaSecToSpillGPS = TMath::Abs(tons.GetSec());
00142       beamInfo->gpsError = nearestSpill.GetSpillTimeError();
00143     }
00144   }
00145   else if(dataType == SimFlag::kMC){
00146 //     beamInfo->tor101 = spillInfo->fTor101;
00147 //     beamInfo->tortgt = spillInfo->fTortgt;
00148 //     beamInfo->trtgtd = spillInfo->fTrtgtd;
00149 //     beamInfo->hornCurrent = spillInfo->fHornCur;
00150 //     beamInfo->targetBPMX = spillInfo->fTargBpmX[0];
00151 //     beamInfo->targetBPMY = spillInfo->fTargBpmY[0];
00152 //     beamInfo->profileWidthX = spillInfo->fProfWidX;
00153 //     beamInfo->profileWidthY = spillInfo->fProfWidY;
00154 //     beamInfo->hadronIntensity = spillInfo->fHadInt;
00155 //     beamInfo->muonIntensity1 = spillInfo->fMuInt1;
00156 //     beamInfo->muonIntensity2 = spillInfo->fMuInt2;
00157 //     beamInfo->muonIntensity3 = spillInfo->fMuInt3;
00158 //     beamInfo->targetPosition = (int)spillInfo->GetStatusBits().beam_type;
00159 //     beamInfo->protonIntensity = beamInfo->tor101;
00160   }
00161   
00162   return;
00163 }

void ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation NtpMCTruth ntpMCTruth,
TClonesArray *  stdArray,
ANtpTruthInfoBeam truthInfo
 

Definition at line 215 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, 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(), and ANtpInfoObjectFillerNC::FillMCInformation().

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


Member Data Documentation

BMSpillAna* ANtpInfoObjectFillerBeam::fSpillAna [private]
 

Definition at line 41 of file ANtpInfoObjectFillerBeam.h.

Referenced by ANtpInfoObjectFillerBeam(), and FillBeamInformation().


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:00:22 2008 for loon by  doxygen 1.3.9.1