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

MCFluxInfoAna.cxx

Go to the documentation of this file.
00001 #include "MessageService/MsgService.h"
00002 #include "MCNtuple/NtpMCTruth.h"
00003 #include "StandardNtuple/NtpStRecord.h"
00004 #include "MCReweight/MuParentHelper.h"
00005 #include "MCReweight/NuParent.h"
00006 #include "NueAna/NueAnaTools/SntpHelpers.h"
00007 #include "NueAna/MCFluxInfoAna.h"
00008 
00009 CVSID("$Id: MCFluxInfoAna.cxx,v 1.5 2007/03/01 16:38:49 rhatcher Exp $");
00010 
00011 MCFluxInfoAna::MCFluxInfoAna(NtpMCFluxInfo &fluxinfo):
00012   fMCFluxInfo(fluxinfo),
00013   fluxfileneedsdebuggering(true),
00014   mupar(0)
00015 {}
00016 
00017 MCFluxInfoAna::~MCFluxInfoAna()
00018 {
00019   MSG("MCFluxInfoAna",Msg::kDebug)<<"Destructing MCFluxInfoAna"<<endl;
00020   
00021   MSG("MCFluxInfoAna",Msg::kDebug)<<"Leaving ~MCFluxInfoAna"<<endl;
00022 }
00023 
00024 void MCFluxInfoAna::Analyze(int evtn, RecRecordImp<RecCandHeader> *srobj)
00025 {
00026   //only NtpStRecords have the flux info
00027   NtpStRecord *st = dynamic_cast<NtpStRecord *>(srobj);
00028   if(!st){
00029     MSG("MCFluxInfoAna",Msg::kError)<<"Trying to get flux info from a non NtpStRecord"<<endl
00030                         <<"That's not a good idea"<<endl;
00031     return;
00032   }
00033   int thn = SntpHelpers::GetEvent2MCIndex(evtn,st);
00034   if(thn<0){
00035     return;
00036   }
00037   NtpMCTruth *mcrec = SntpHelpers::GetMCTruth(thn,st);
00038   MSG("MCFluxInfoAna",Msg::kDebug)<<"in MCFluxInfoAna::Analyze mcrec: "<<mcrec<<endl;
00039   if(mcrec==0){
00040       MSG("MCFluxInfoAna",Msg::kError)<<"No mcrec! cannot fill flux info: "<<mcrec<<endl;
00041       return;
00042   }
00043   Analyze(mcrec);
00044 }
00045 
00046 void MCFluxInfoAna::Analyze(NtpMCTruth *mcrec)
00047 {
00048 
00049   if(mcrec==0){
00050     return;
00051   }
00052 
00053   MSG("MCFluxInfoAna",Msg::kDebug)<<"in analyze(NtpMCTruth *)"<<endl;
00054   MSG("MCFluxInfoAna",Msg::kDebug)<<"flux info before copying: "
00055                                   <<" tpx: "<<mcrec->flux.tpx<<" "
00056                                   <<" tpy: "<<mcrec->flux.tpy<<" "
00057                                   <<" tpz: "<<mcrec->flux.tpz<<endl;
00058   
00059   fMCFluxInfo=mcrec->flux;
00060   MSG("MCFluxInfoAna",Msg::kDebug)<<"copying flux info: "
00061                                   <<" tpx: "<<fMCFluxInfo.tpx<<" "
00062                                   <<" tpy: "<<fMCFluxInfo.tpy<<" "
00063                                   <<" tpz: "<<fMCFluxInfo.tpz<<endl;
00064 
00065   if(fluxfileneedsdebuggering){
00066     ResetMuParentInfo();
00067   }
00068 
00069 }
00070 
00071 void  MCFluxInfoAna::ResetMuParentInfo()
00072 {
00073   if(!mupar){
00074     MSG("MCFluxInfoAna",Msg::kError)<<"If you want to reset the muparent info, you must provide a mu parent helper"<<endl;
00075     return;
00076   }
00077   NuParent par;
00078   if(fMCFluxInfo.tptype==-13 || fMCFluxInfo.tptype==13) {
00079     mupar->GetMuParent(fMCFluxInfo.fluxrun,fMCFluxInfo.fluxevtno,
00080                       fMCFluxInfo.tpx,fMCFluxInfo.tpy,fMCFluxInfo.tpz,par);
00081   
00082 
00083     fMCFluxInfo.tvx = par.GetX();
00084     fMCFluxInfo.tvy = par.GetY();
00085     fMCFluxInfo.tvz = par.GetZ();
00086     fMCFluxInfo.tpx = par.GetPx();
00087     fMCFluxInfo.tpy = par.GetPy();
00088     fMCFluxInfo.tpz = par.GetPz();
00089     fMCFluxInfo.tptype = par.GetPID();
00090     
00091     fMCFluxInfo.tgen = par.GetGen();
00092   }
00093 }

Generated on Mon Feb 15 11:06:57 2010 for loon by  doxygen 1.3.9.1