ANtpTruthInfoBeamAna Class Reference

#include <ANtpTruthInfoBeamAna.h>

Inheritance diagram for ANtpTruthInfoBeamAna:
NueAnaBase

List of all members.

Public Member Functions

 ANtpTruthInfoBeamAna (ANtpTruthInfoBeamNue &antib)
virtual ~ANtpTruthInfoBeamAna ()
void Analyze (int evtn, NtpStRecord *srobj)
void Analyze (int evtn, RecRecordImp< RecCandHeader > *srobj)
void Analyze (int evtn, NtpSRRecord *srobj, NtpMCRecord *mcobj, NtpTHRecord *thobj)
Int_t GetNueClass (Int_t inu, Int_t inunoosc, Int_t iaction)
Float_t GetNueWeight (Int_t inu, Int_t inunoosc)
Float_t GetOscProb ()
Float_t TrueLepDCosNeu (NtpMCTruth *ntpTruth)
Float_t TrueLepDCosZ (NtpMCTruth *ntpTruth)
Float_t Get3Momenta (NtpMCTruth *ntpTruth, Float_t &p4_0, Float_t &p4_1, Float_t &p4_2)

Private Attributes

ANtpTruthInfoBeamNuefANtpTruthInfoBeam
ANtpInfoObjectFillerBeamfInfoFiller

Detailed Description

Definition at line 15 of file ANtpTruthInfoBeamAna.h.


Constructor & Destructor Documentation

ANtpTruthInfoBeamAna::ANtpTruthInfoBeamAna ( ANtpTruthInfoBeamNue antib  ) 

Definition at line 19 of file ANtpTruthInfoBeamAna.cxx.

00019                                                                      :
00020    fANtpTruthInfoBeam(antib)
00021 {}

ANtpTruthInfoBeamAna::~ANtpTruthInfoBeamAna (  )  [virtual]

Definition at line 23 of file ANtpTruthInfoBeamAna.cxx.

00024 {}


Member Function Documentation

void ANtpTruthInfoBeamAna::Analyze ( int  evtn,
NtpSRRecord srobj,
NtpMCRecord mcobj,
NtpTHRecord thobj 
)

Definition at line 100 of file ANtpTruthInfoBeamAna.cxx.

References ANtpTruthInfoBeamNue::DirCosNeu, ANtpTruthInfoBeamNue::DirCosZ_pan, fANtpTruthInfoBeam, ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation(), ANtpInfoObjectFiller::FillMCTruthInformation(), fInfoFiller, ANtpTruthInfoBeamNue::fNueClass, ANtpTruthInfoBeamNue::fNueWeight, ANtpTruthInfoBeamNue::fOscProb, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), ANtpRecoNtpManipulator::GetMCManipulator(), ANtpMCManipulator::GetNtpMCStdHep(), ANtpMCManipulator::GetNtpMCTruth(), ANtpMCManipulator::GetNtpTHEvent(), GetNueClass(), GetNueWeight(), GetOscProb(), ANtpRecoNtpManipulator::GetStdHepArray(), RecHeader::GetVldContext(), ANtpTruthInfo::interactionType, Detector::kFar, NtpTHEvent::neumc, NtpTHEvent::neustdhep, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuFlavor, TrueLepDCosNeu(), and TrueLepDCosZ().

00101 {
00102 
00103   if(srobj==0){
00104     return;
00105   }
00106   if(mcobj==0){
00107     return;
00108   }
00109   if(thobj==0){
00110     return;
00111   }
00112 
00113     fInfoFiller = new ANtpInfoObjectFillerBeam();
00114     // This is mostly copied from AnalysisNtuples/Module/CondensedNtpModule.cxx
00115     NtpMCTruth *mctruth = 0;
00116     NtpMCStdHep *mcstdhep = 0;
00117     NtpTHEvent *thevent = 0;
00118     //NtpTHStrip *thstrip = 0;
00119     //NtpTHTrack *thtrack = 0;
00120     //NtpTHShower *thshower = 0;
00121 
00122     // Only fill if there is MC or Truth information
00123     if (mcobj && thobj){
00124 
00125         //instansiate a NtpHelper object to help you get the info you want
00126         ANtpRecoNtpManipulator ntpManipulator(srobj,mcobj,thobj);
00127         
00128         thevent = ntpManipulator.GetMCManipulator()->GetNtpTHEvent(evtn);
00129         if(thevent){
00130          mctruth = ntpManipulator.GetMCManipulator()->GetNtpMCTruth(thevent->neumc);
00131          mcstdhep = ntpManipulator.GetMCManipulator()->GetNtpMCStdHep(thevent->neustdhep);
00132         }
00133         
00134         // no strip info yet
00135         //if(ntpStrip) ntpTHStrip = ntpManipulator.GetNtpTHStrip(ntpStrip->index);
00136         //if(ntpTHStrip){
00137         //    ntpMCTruth = ntpManipulator.GetNtpMCTruth(ntpTHStrip->neumc);   
00138         //}
00139 
00140         if(mctruth){
00141           // fill the ANtpTruthInfo part
00142           fInfoFiller->FillMCTruthInformation(mctruth, &fANtpTruthInfoBeam);
00143           // fill the ANtpTruthInfoBeam part
00144           fInfoFiller->FillBeamMCTruthInformation(mctruth, ntpManipulator.GetStdHepArray(),&fANtpTruthInfoBeam);
00145 
00146           Int_t inu = fANtpTruthInfoBeam.nuFlavor;
00147           Int_t inunoosc = fANtpTruthInfoBeam.nonOscNuFlavor;
00148           Int_t iaction = fANtpTruthInfoBeam.interactionType;          
00149 
00150           fANtpTruthInfoBeam.fNueClass = GetNueClass(inu, inunoosc, iaction);
00151           fANtpTruthInfoBeam.fNueWeight = GetNueWeight(inu, inunoosc);
00152           if(srobj->GetHeader().GetVldContext().GetDetector() == Detector::kFar)
00153             GetOscProb();
00154           else
00155             fANtpTruthInfoBeam.fOscProb = 1.0;
00156           
00157           fANtpTruthInfoBeam.DirCosNeu = TrueLepDCosNeu(mctruth);
00158           fANtpTruthInfoBeam.DirCosZ_pan = TrueLepDCosZ(mctruth);
00159         }                               
00160     }   
00161 
00162     if(fInfoFiller){
00163       delete fInfoFiller;
00164       fInfoFiller=0;
00165     }
00166 }

void ANtpTruthInfoBeamAna::Analyze ( int  evtn,
RecRecordImp< RecCandHeader > *  srobj 
) [virtual]

Implements NueAnaBase.

Definition at line 26 of file ANtpTruthInfoBeamAna.cxx.

References Analyze().

00027 {
00028   if(srobj==0){
00029     return;
00030   }
00031   NtpStRecord *st = dynamic_cast<NtpStRecord *>(srobj);
00032   Analyze(event,st);
00033 }

void ANtpTruthInfoBeamAna::Analyze ( int  evtn,
NtpStRecord srobj 
)

Definition at line 35 of file ANtpTruthInfoBeamAna.cxx.

References NtpTHEvent::completeall, ANtpTruthInfoBeamNue::DirCosNeu, ANtpTruthInfoBeamNue::DirCosZ_pan, ANtpTruthInfoBeam::eventCompleteness, fANtpTruthInfoBeam, ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation(), ANtpInfoObjectFiller::FillMCTruthInformation(), fInfoFiller, ANtpTruthInfoBeamNue::fNueClass, ANtpTruthInfoBeamNue::fNueWeight, ANtpTruthInfoBeamNue::fOscProb, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), ANtpRecoNtpManipulator::GetMCManipulator(), ANtpMCManipulator::GetNtpMCStdHep(), ANtpMCManipulator::GetNtpMCTruth(), ANtpMCManipulator::GetNtpTHEvent(), GetNueClass(), GetNueWeight(), GetOscProb(), ANtpRecoNtpManipulator::GetStdHepArray(), ANtpRecoNtpManipulator::GetStripArray(), RecHeader::GetVldContext(), ANtpTruthInfoBeamNue::iflags, NtpMCTruth::iflags, ANtpTruthInfo::interactionType, ANtpTruthInfoBeamNue::istruckq, NtpMCTruth::istruckq, NtpMCTruth::itg, ANtpTruthInfoBeamNue::itg, Detector::kFar, NtpTHEvent::neumc, NtpTHEvent::neustdhep, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuFlavor, ANtpInfoObjectFiller::SetStripArray(), ANtpTruthInfoBeamNue::sigmadiff, NtpMCTruth::sigmadiff, TrueLepDCosNeu(), and TrueLepDCosZ().

Referenced by Analyze(), VtxRecordAna::FillTrue(), and NueRecordAna::FillTrue().

00036 {
00037   if(srobj==0){
00038     return;
00039   }
00040 
00041     // This is mostly copied from AnalysisNtuples/Module/CondensedNtpModule.cxx
00042     NtpMCTruth *mctruth = 0;
00043     NtpMCStdHep *mcstdhep = 0;
00044     NtpTHEvent *thevent = 0;
00045     //NtpTHStrip *thstrip = 0;
00046     //NtpTHTrack *thtrack = 0;
00047     //NtpTHShower *thshower = 0;
00048 
00049     //instansiate a NtpHelper object to help you get the info you want
00050     ANtpRecoNtpManipulator ntpManipulator(srobj);
00051     fInfoFiller = new ANtpInfoObjectFillerBeam();
00052     fInfoFiller->SetStripArray(ntpManipulator.GetStripArray());
00053   
00054     thevent = ntpManipulator.GetMCManipulator()->GetNtpTHEvent(evtn);
00055     if(thevent){
00056       mctruth = ntpManipulator.GetMCManipulator()->GetNtpMCTruth(thevent->neumc);
00057       mcstdhep = ntpManipulator.GetMCManipulator()->GetNtpMCStdHep(thevent->neustdhep);
00058     }
00059                                   
00060     // no strip info yet
00061     //if(ntpStrip) ntpTHStrip = ntpManipulator.GetNtpTHStrip(ntpStrip->index);
00062     //if(ntpTHStrip){
00063     //    ntpMCTruth = ntpManipulator.GetNtpMCTruth(ntpTHStrip->neumc);   
00064     //}
00065     
00066     if(mctruth){
00067       // fill the ANtpTruthInfo part
00068       fInfoFiller->FillMCTruthInformation(mctruth, &fANtpTruthInfoBeam);
00069       // fill the ANtpTruthInfoBeam part
00070       fInfoFiller->FillBeamMCTruthInformation(mctruth, ntpManipulator.GetStdHepArray(),&fANtpTruthInfoBeam);
00071 
00072       Int_t inu = fANtpTruthInfoBeam.nuFlavor;
00073       Int_t inunoosc = fANtpTruthInfoBeam.nonOscNuFlavor;
00074       Int_t iaction = fANtpTruthInfoBeam.interactionType;          
00075 
00076       fANtpTruthInfoBeam.fNueClass = GetNueClass(inu, inunoosc, iaction);
00077       fANtpTruthInfoBeam.fNueWeight = GetNueWeight(inu, inunoosc);
00078       if(srobj->GetHeader().GetVldContext().GetDetector() == Detector::kFar)
00079         GetOscProb();
00080       else
00081         fANtpTruthInfoBeam.fOscProb = 1.0;
00082 
00083       fANtpTruthInfoBeam.DirCosNeu = TrueLepDCosNeu(mctruth);
00084       fANtpTruthInfoBeam.DirCosZ_pan = TrueLepDCosZ(mctruth);
00085 
00086       fANtpTruthInfoBeam.istruckq = mctruth->istruckq;
00087       fANtpTruthInfoBeam.iflags = mctruth->iflags;
00088       fANtpTruthInfoBeam.sigmadiff = mctruth->sigmadiff;
00089       fANtpTruthInfoBeam.itg = mctruth->itg;
00090 
00091       fANtpTruthInfoBeam.eventCompleteness = thevent->completeall;
00092     }
00093 
00094     if(fInfoFiller){
00095       delete fInfoFiller;
00096       fInfoFiller=0;
00097     }                                   
00098 }

Float_t ANtpTruthInfoBeamAna::Get3Momenta ( NtpMCTruth ntpTruth,
Float_t &  p4_0,
Float_t &  p4_1,
Float_t &  p4_2 
)

Definition at line 294 of file ANtpTruthInfoBeamAna.cxx.

References NtpMCTruth::p4el1, NtpMCTruth::p4mu1, and NtpMCTruth::p4tau.

Referenced by TrueLepDCosNeu(), and TrueLepDCosZ().

00296 { 
00297   p4_0 = 0;
00298   p4_1 = 0;
00299   p4_2 = 0;
00300                                                                                 
00301   if(TMath::Abs(ntpTruth->p4mu1[3]) > 0){
00302     p4_0 = ntpTruth->p4mu1[0];
00303     p4_1 = ntpTruth->p4mu1[1];
00304     p4_2 = ntpTruth->p4mu1[2];
00305   }
00306   else if(TMath::Abs(ntpTruth->p4el1[3])>0){
00307     p4_0 = ntpTruth->p4el1[0];
00308     p4_1 = ntpTruth->p4el1[1];
00309     p4_2 = ntpTruth->p4el1[2];
00310   }
00311   else if(TMath::Abs(ntpTruth->p4tau[3])>0){
00312     p4_0 = ntpTruth->p4tau[0];
00313     p4_1 = ntpTruth->p4tau[1];
00314     p4_2 = ntpTruth->p4tau[2];
00315   }
00316   
00317   return (p4_0*p4_0 + p4_1*p4_1 + p4_2*p4_2);
00318 
00319 }

Int_t ANtpTruthInfoBeamAna::GetNueClass ( Int_t  inu,
Int_t  inunoosc,
Int_t  iaction 
)

Definition at line 168 of file ANtpTruthInfoBeamAna.cxx.

References NueConvention::DetermineClassType(), ANtpDefaultValue::IsDefault(), ANtpDefaultValue::kInt, Msg::kWarning, and MSG.

Referenced by Analyze().

00169 {
00170   Int_t cType=ANtpDefVal::kInt;
00171   cType = ClassType::DetermineClassType(inu, inunoosc, iaction);
00172 
00173   if(ANtpDefVal::IsDefault(cType)){
00174        MSG("ANtpTruthInfoBeamAna",Msg::kWarning)<< " GetNueClass called " 
00175                        << "eith invalid paramters - no class assigned" 
00176                        << endl;            
00177   }
00178 
00179   return cType;
00180 }

Float_t ANtpTruthInfoBeamAna::GetNueWeight ( Int_t  inu,
Int_t  inunoosc 
)

Definition at line 183 of file ANtpTruthInfoBeamAna.cxx.

References ReleaseType::IsCarrot(), ReleaseType::IsDaikon(), ANtpDefaultValue::IsDefault(), ANtpDefaultValue::kFloat, and NueAnaBase::release.

Referenced by Analyze().

00184 {
00185                                                                           
00186   Float_t weight = ANtpDefVal::kFloat;
00187 
00188   if(ReleaseType::IsDaikon(release)) weight = 1.0;
00189 
00190   if(ReleaseType::IsCarrot(release)){
00191     if(abs(inu) == 12 || abs(inu) == 14 || abs(inu) == 16){
00192        if(abs(inunoosc) == 12 || abs(inunoosc) == 14 || abs(inunoosc) == 16){
00193           weight = 1.0;
00194           if(abs(inu) ==12 && abs(inunoosc) == 12)    weight = 0.5;
00195        }
00196     }
00197   }
00198 
00199   if(ANtpDefVal::IsDefault(weight)){
00200     // MSG("ANtpTruthInfoBeamAna",Msg::kWarning)<< " GetNueWeight called " 
00201     //                                           << "with invalid paramters "
00202     //                                   <<inu<<" "<<inunoosc
00203     //                                   <<" - 0 weight assigned" 
00204     //                                   << endl;            
00205         return 0.0;
00206   }
00207                           
00208   return weight;  
00209 }

Float_t ANtpTruthInfoBeamAna::GetOscProb (  ) 

Definition at line 211 of file ANtpTruthInfoBeamAna.cxx.

References ANtpTruthInfoBeamNue::Baseline, ANtpTruthInfoBeamNue::Delta, ANtpTruthInfoBeamNue::DeltamSquared12, ANtpTruthInfoBeamNue::DeltamSquared23, ANtpTruthInfoBeamNue::Density, fANtpTruthInfoBeam, ANtpTruthInfoBeamNue::fOscProb, ANtpTruthInfoBeamNue::fOscProbMatterInverted, ANtpTruthInfoBeamNue::fOscProbMatterNormal, OscPar::kDelta, OscPar::kDeltaM12, OscPar::kDeltaM23, OscPar::kDensity, OscPar::kL, OscPar::kNuAntiNu, OscPar::kTh12, OscPar::kTh13, OscPar::kTh23, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, OscCalc::Oscillate(), Oscillate(), OscCalc::SetOscParam(), ANtpTruthInfoBeamNue::Theta12, ANtpTruthInfoBeamNue::Theta13, ANtpTruthInfoBeamNue::Theta23, and ANtpTruthInfoBeamNue::Ue3Squared.

Referenced by Analyze().

00212 {
00213     fANtpTruthInfoBeam.Baseline = 735;
00214     fANtpTruthInfoBeam.DeltamSquared23 = 0.0024;
00215     double th23 = fANtpTruthInfoBeam.Theta23 = TMath::Pi()/4.0;
00216     fANtpTruthInfoBeam.Ue3Squared = 0.025;
00217     
00218 // CC Results for MDC 
00219 //    dm2 = 0.002175;  // +- 0.15e-3
00220     double th13 = TMath::ASin(TMath::Sqrt(fANtpTruthInfoBeam.Ue3Squared)); 
00221 
00222    fANtpTruthInfoBeam.fOscProb = NueConvention::Oscillate(&fANtpTruthInfoBeam);
00223   
00224    Double_t dm2_12 = 8.7e-5;
00225    double th12 = 0.816;
00226    Double_t dm2_23 = fANtpTruthInfoBeam.DeltamSquared23;
00227 
00228    static OscCalc fOscCalc;   
00229                                                                              
00230    Double_t par[9] = {0};
00231    par[OscPar::kL] = fANtpTruthInfoBeam.Baseline;
00232    par[OscPar::kTh23] = fANtpTruthInfoBeam.Theta23 = th23;
00233    par[OscPar::kTh12] = fANtpTruthInfoBeam.Theta12 = th12;
00234    par[OscPar::kTh13] = fANtpTruthInfoBeam.Theta13 = th13;
00235    par[OscPar::kDeltaM23] = dm2_23;
00236    par[OscPar::kDeltaM12] = fANtpTruthInfoBeam.DeltamSquared12 = dm2_12;
00237    par[OscPar::kDensity] = fANtpTruthInfoBeam.Density = 2.65; 
00238    par[OscPar::kDelta] = fANtpTruthInfoBeam.Delta = 0.0;
00239    par[OscPar::kNuAntiNu] = 1;
00240                                                                                 
00241 //  std::cout<<"About to call "<<dm2<<"  "<<ss13<<"  "<<delta<<std::endl;
00242    fOscCalc.SetOscParam(par);
00243  
00244    int nuFlavor = fANtpTruthInfoBeam.nuFlavor;
00245    int nonOscNuFlavor = fANtpTruthInfoBeam.nonOscNuFlavor;
00246 
00247    if(nonOscNuFlavor > 0) fOscCalc.SetOscParam(OscPar::kNuAntiNu, 1);
00248    if(nonOscNuFlavor < 0) fOscCalc.SetOscParam(OscPar::kNuAntiNu, -1);
00249 
00250    double Energy =  fANtpTruthInfoBeam.nuEnergy;
00251 
00252                                                                                 
00253    fANtpTruthInfoBeam.fOscProbMatterNormal = fOscCalc.Oscillate(nuFlavor, nonOscNuFlavor, Energy);
00254     
00255    fOscCalc.SetOscParam(OscPar::kDeltaM23, -dm2_23);
00256    fANtpTruthInfoBeam.fOscProbMatterInverted = fOscCalc.Oscillate(nuFlavor, nonOscNuFlavor, Energy);
00257 
00258 
00259   return 1; 
00260 }

Float_t ANtpTruthInfoBeamAna::TrueLepDCosNeu ( NtpMCTruth ntpTruth  ) 

Definition at line 263 of file ANtpTruthInfoBeamAna.cxx.

References Get3Momenta(), and NtpMCTruth::p4neu.

Referenced by Analyze().

00264 { //ds_mu/ds_nu
00265   TVector3 *nuvec = new TVector3(ntpTruth->p4neu[0],
00266                                  ntpTruth->p4neu[1],
00267                                  ntpTruth->p4neu[2]);
00268 
00269   Float_t p4_0 = 0;
00270   Float_t p4_1 = 0;
00271   Float_t p4_2 = 0;
00272 
00273   Get3Momenta(ntpTruth, p4_0, p4_1, p4_2);
00274 
00275   TVector3 *muvec = new TVector3(p4_0, p4_1, p4_2);
00276   Float_t MuAng = nuvec->Angle(*muvec); //angle in rads
00277   delete nuvec;
00278   delete muvec;
00279   return TMath::Cos(MuAng);
00280 }

Float_t ANtpTruthInfoBeamAna::TrueLepDCosZ ( NtpMCTruth ntpTruth  ) 

Definition at line 282 of file ANtpTruthInfoBeamAna.cxx.

References Get3Momenta().

Referenced by Analyze().

00282                                                               { //dz/ds
00283 
00284   Float_t p4_0 = 0;
00285   Float_t p4_1 = 0;
00286   Float_t p4_2 = 0;
00287 
00288   Float_t mom = Get3Momenta(ntpTruth, p4_0, p4_1, p4_2);
00289 
00290   if(mom==0) return 0;
00291   return p4_2/mom;
00292 }


Member Data Documentation

Definition at line 40 of file ANtpTruthInfoBeamAna.h.

Referenced by Analyze(), and GetOscProb().

Definition at line 41 of file ANtpTruthInfoBeamAna.h.

Referenced by Analyze().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1