NuReco.cxx File Reference

#include <set>
#include <cmath>
#include "TClonesArray.h"
#include "TFile.h"
#include "TH2F.h"
#include "TRandom3.h"
#include "TTree.h"
#include "BeamDataUtil/BDSpillAccessor.h"
#include "Conventions/BeamType.h"
#include "DataUtil/EnergyCorrections.h"
#include "MessageService/MsgService.h"
#include "MessageService/MsgFormat.h"
#include "MCNtuple/NtpMCStdHep.h"
#include "MCNtuple/NtpMCTruth.h"
#include "CandNtupleSR/NtpSREvent.h"
#include "CandNtupleSR/NtpSRShower.h"
#include "CandNtupleSR/NtpSRStrip.h"
#include "CandNtupleSR/NtpSRTrack.h"
#include "StandardNtuple/NtpStRecord.h"
#include "TruthHelperNtuple/NtpTHEvent.h"
#include "TruthHelperNtuple/NtpTHShower.h"
#include "TruthHelperNtuple/NtpTHTrack.h"
#include "DataUtil/PlaneOutline.h"
#include "Conventions/ReleaseType.h"
#include "UgliGeometry/UgliGeomHandle.h"
#include "DataUtil/infid.h"
#include "DataUtil/EnergyResolution.h"
#include "NtupleUtils/LISieve.h"
#include "NtupleUtils/NuCutImps.h"
#include "NtupleUtils/NuCutter.h"
#include "NtupleUtils/NuEvent.h"
#include "NtupleUtils/NuKDTree.h"
#include "NtupleUtils/NukNN.h"
#include "NtupleUtils/NuLibrary.h"
#include "NtupleUtils/NuReco.h"
#include "NtupleUtils/NuIntranuke.h"

Go to the source code of this file.

Functions

 CVSID ("$Id: NuReco.cxx,v 1.226 2015/03/02 12:47:27 lwhite86 Exp $")
template<class T >
SQR (T x)
int IntegerProbShift (int origvalue, const float realshift, const float zerotoone)
void ShiftHoveStrip (NuEvent &nu)
int ShiftHoveStripAnswer (const NuEvent &nu)
 Return what ShiftHoveStrip would shift stripHoveNumTrkVtx in this event to.

Variables

const double kMuonMassSquared = SQR(105.658357*Munits::MeV)
 Measured in GeV^2.

Function Documentation

CVSID ( "$Id: NuReco.  cxx,
v 1.226 2015/03/02 12:47:27 lwhite86 Exp $"   
)
int IntegerProbShift ( int  origvalue,
const float  realshift,
const float  zerotoone 
)

Input: origvalue -- an integer-valued variable to be shifted realshift -- the float-valued shift to make zerotoone -- a pre-determined random number [0, 1] Output: origvalue always with the integer part of realshift added to or subtracted from it and 1 added/subtracted if zerotoone is greater than the fractional part of realshift

Definition at line 437 of file NuReco.cxx.

Referenced by NuSystematic::RockSelectionShift(), ShiftHoveStrip(), and ShiftHoveStripAnswer().

00439 {
00440   float absshift = fabs(realshift);
00441   int shiftdir = (realshift > 0 ? +1 : -1);
00442 
00443   origvalue += shiftdir*int(floor(absshift));
00444   if(zerotoone < absshift - floor(absshift)) origvalue += shiftdir;
00445 
00446   return origvalue;
00447 }

void ShiftHoveStrip ( NuEvent nu  ) 

Shift stripHoveNumTrkVtx to account for the actual alignment of the horizontal and vertical edges of the detector not being perfect as it is in daikon. See doc 6995.

Definition at line 453 of file NuReco.cxx.

References NuEvent::edgeRegionTrkVtx, NuEvent::index, IntegerProbShift(), SimFlag::kData, NuEvent::regionTrkVtx, NuEvent::run, NuEvent::simFlag, and NuEvent::stripHoveNumTrkVtx.

Referenced by NuReco::ApplyReweights(), and RockEvent::Fill().

00454 {
00455   if(nu.simFlag == SimFlag::kData) return;
00456 
00457   // regionTrkVtx: lower two bits give transverse region.  1 means edge
00458   // edgeRegionTrkVtx: horizontal/vertical edges are 0, 2, 4, 6
00459   if(nu.regionTrkVtx%4 != 1 || nu.edgeRegionTrkVtx%2 != 0) return;
00460 
00461   float shift, zerotoone;
00462   {
00463     // NOTE: It used to be extremely important to getting consistent random
00464     // numbers here and in NuSystematic.  This care should no longer be 
00465     // necessary since we now store the unshifted value of stripHoveNumTrkVtx.
00466     // However, it doesn't hurt to continue seeding by run and index for
00467     // consistent results.
00468 
00469     // Make a random number generator, seeded with run and index number
00470     // The seed is a 4 byte unsigned integer.  Don't overflow.
00471     // run 22035432, index 2601 --> seed = 543 202 601
00472     TRandom3 ionwalk((((UInt_t)nu.run)%10000)*100000+((UInt_t)nu.index)%100000);
00473 
00474     // fraction of a strip which is the RMS of the distribution of
00475     // daikon-reality. See doc 6995.  Not really good to three digits.
00476     // Represents strip length, transverse position and longitudinal
00477     // position uncertainties.
00478     const float hovefuzz = 10.1/(2*41.1);
00479 
00480     shift = ionwalk.Gaus(0, hovefuzz); // fraction of a strip
00481     zerotoone = ionwalk.Rndm(); // whether that fraction actually shifts
00482   }
00483 
00484   nu.stripHoveNumTrkVtx=IntegerProbShift(nu.stripHoveNumTrkVtx,shift,zerotoone);
00485 }

int ShiftHoveStripAnswer ( const NuEvent nu  ) 

Return what ShiftHoveStrip would shift stripHoveNumTrkVtx in this event to.

Definition at line 489 of file NuReco.cxx.

References NuEvent::edgeRegionTrkVtx, NuEvent::index, IntegerProbShift(), SimFlag::kData, NuEvent::regionTrkVtx, NuEvent::run, NuEvent::simFlag, and NuEvent::stripHoveNumTrkVtx.

Referenced by NuCutImps::RAF0720Std::PIDtype(), and NuCutImps::RAF0720Ext::PIDtype().

00490 {
00491   if(nu.simFlag == SimFlag::kData) return nu.stripHoveNumTrkVtx;
00492 
00493   if(nu.regionTrkVtx%4 != 1 || nu.edgeRegionTrkVtx%2 != 0)
00494     return nu.stripHoveNumTrkVtx;
00495 
00496   float shift, zerotoone;
00497   {
00498     TRandom3 ionwalk((((UInt_t)nu.run)%10000)*100000+((UInt_t)nu.index)%100000);
00499     const float hovefuzz = 10.1/(2*41.1);
00500     shift = ionwalk.Gaus(0, hovefuzz);
00501     zerotoone = ionwalk.Rndm();
00502   }
00503 
00504   return IntegerProbShift(nu.stripHoveNumTrkVtx,shift,zerotoone);
00505 }

template<class T >
T SQR ( x  )  [inline]

Definition at line 58 of file NuReco.cxx.

00058 {return x*x;}


Variable Documentation

const double kMuonMassSquared = SQR(105.658357*Munits::MeV)

Measured in GeV^2.

Definition at line 61 of file NuReco.cxx.

Referenced by NuReco::GetTrackEnergyFromCurvCor(), and NuReco::GetTrackEnergyFromRangeCor().


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1