HighLAND
Enumerations | Functions | Variables
anaUtils Namespace Reference

This namespace contains useful functions for analyses related to kinematics. More...

Enumerations

enum  TopoEnum {
  CC_0pi_0meson = 0, CC_1pi_0meson = 1, CC_other = 2, BKG = 3,
  CC_0pi_0meson_1p, CC_0pi_0meson_Np, CC_0pi_0meson_0n, CC_0pi_0meson_1n,
  CC_0pi_0meson_Nn, CC_1piplus_0meson, CC_1piminus_0meson, CC_1pi0_0meson,
  CC_Npi0_X
}
 
enum  massComponentEnum {
  kFGD1 =1, kFGD2 =2, kFGDs =3, kFGD2xymodules =4,
  kFGD2watermodules =5, kP0Dwater =6, kP0Dair =7, kFGD2waterlike =8,
  kFGD2xylike =9, kInvalid =-1
}
 

Functions

void CreateArray (AnaP0DCluster **&tgtArr, int nObj)
 
void CopyArray (AnaP0DCluster **const &src, AnaP0DCluster **&dest, int n)
 
void CreateArray (AnaP0DHit **&tgtArr, int nObj)
 
void CopyArray (AnaP0DHit **const &src, AnaP0DHit **&dest, int n)
 
void AddStandardCategories (const std::string &prefix="")
 Add the standard categories only, given a prefix for their name.
 
void AddStandardAntiNumuCategories (const std::string &prefix="")
 Add the standard categories only, given a prefix for their name.
 
Int_t GetTopology (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 Classify reaction topologies. More...
 
Int_t GetTopology_no1pi (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetTopology_withpi0 (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 Classify the topology type for nu-mu CC pi-zero analysis.
 
Int_t GetTopologyCCPiZero (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetMECTopology (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 Classify reaction topologies in special attention to MEC process.
 
void FillCategories (AnaEventB *event, AnaTrack *track, const std::string &prefix, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false, bool useCATSAND=true)
 Fill the track categories for color drawing.
 
void FillCategories (AnaEventB *event, AnaTrack *track, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false, bool useCATSAND=true)
 
void FillCategories (const AnaTrueVertexB *vertex, const std::string &prefix, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false, bool IsSand=false)
 
void FillCategories (const AnaTrueVertexB *vertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false, bool IsSand=false)
 
void SetCategoriesDefaultCode (const std::string &prefix, const int code=CATNOTRUTH)
 
 DEPRECATED (void FillTruthTreeCategories(const AnaTrueVertex &trueVertex, const std::string &prefix, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false))
 Fill the track categories for color drawing.
 
 DEPRECATED (void FillTruthTreeCategories(const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false))
 
Int_t GetAntiNuMuParent (AnaTrueVertex *trueVertex, AnaTrack *track)
 
Int_t GetReaction (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 Classify reaction types.
 
Int_t GetReactionCC (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetReactionNoFgdFv (const AnaTrueVertex &trueVertex, bool IsAntinu=false)
 
Int_t GetReactionSand (const AnaEventB &event, const AnaTrack &track, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetReactionSand (const AnaEventB &event, const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetReactionSandCC (const AnaEventB &event, const AnaTrack &track, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetReactionSandCC (const AnaEventB &event, const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1, bool IsAntinu=false)
 
Int_t GetTopology_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 Classify reaction types for antinu.
 
Int_t GetTopology_no1pi_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetTopology_withpi0_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetTopologyCCPiZero_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetMECTopology_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReaction_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReactionCC_antinu (const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReactionNoFgdFv_antinu (const AnaTrueVertex &trueVertex)
 
Int_t GetReactionSand_antinu (const AnaEventB &event, const AnaTrack &track, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReactionSand_antinu (const AnaEventB &event, const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReactionSandCC_antinu (const AnaEventB &event, const AnaTrack &track, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetReactionSandCC_antinu (const AnaEventB &event, const AnaTrueVertex &trueVertex, const SubDetId::SubDetEnum det=SubDetId::kFGD1)
 
Int_t GetTargetCode (const AnaTrueVertex *trueVertex)
 Get the code for filling the target PDG category.
 
template<size_t SIZE, class T >
size_t size_array (T(&)[SIZE])
 
ProdId_h GetProductionIdFromND280AnalysisTools ()
 Get Production Id from nd280AnalysisTools.
 
int GetAllTracksUsingDet (const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
 
int GetAllTracksUsingFGDAndNoTPC (const AnaBunchB &bunch, AnaTrackB *selTracks[])
 
int GetAllTracksUsingFGDorTPC (const AnaBunchB &bunch, AnaTrackB *selTracks[])
 
int GetAllTracksUsingOnlyDet (const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
 
void ComputeTPCPullIncludingKaon (const AnaTPCParticleB &track, Float_t *pulls)
 Function to recompute the pull for a TPC track segment including the kaon hypothesis.
 
Float_t GetPIDLikelihoodIncludingKaon (const AnaTrackB &track, Int_t hypo, bool prod5Cut=0)
 
void GetPIDLikelihoodIncludingKaon (const AnaTrackB &, Float_t *hypo, bool prod5Cut=0)
 Get all likelihoods including kaons.
 
int GetAllChargedTrajOnlyDsECal (const AnaEventB &event, AnaTrueParticleB *DsECalChargedTracks[])
 
int GetAllChargedTrajOnlyBrECal (const AnaEventB &event, AnaTrueParticleB *BrECalChargedTracks[])
 
AnaVertexBGetGlobalVertex (const AnaEventB &event, AnaTrackB **Tracks, int nTracks)
 
bool FillTrueVertexRooInfo (AnaTrueVertexB *vertexB, Int_t RunID, bool Neut, bool Genie, Int_t NNVtx, TClonesArray *NVtx, Int_t NGVtx, TClonesArray *GVtx, bool &foundCohOnH, bool &foundPauliBlocked)
 
void VectorToArray (const TLorentzVector &v, Float_t *array)
 
void VectorToArray (const TVector3 &v, Float_t *array)
 
TVector3 ArrayToTVector3 (const Float_t *array)
 
TLorentzVector ArrayToTLorentzVector (const Float_t *array)
 
Float_t ScalarProduct (Float_t *array1, Float_t *array2, Int_t size=3)
 Scalar product of two Float_t arrays. Provided their size.
 
void ConfigureTreeBranch (TTree *tree, const char *bname, void *add, TBranch **ptr=0)
 
void ClearArray (AnaRecObjectC **objArr, int nObj)
 
void ClearArray (AnaTrueObjectC **objArr, int nObj)
 
void ReserveArray (Int_t *arr, int n, Int_t ini=-999.)
 
void ReserveArray (Float_t *arr, int n, Float_t ini=-999.)
 
void CopyArray (const Int_t *src, Int_t *dest, int n)
 
void CopyArray (const Float_t *src, Float_t *dest, int n)
 
void CopyArray (const Double_t *src, Float_t *dest, int n)
 
void CopyArray (AnaRecObjectC **tgtArr, AnaRecObjectC **srcArr, int nObj)
 
void CopyArray (AnaTrueObjectC **tgtArr, AnaTrueObjectC **srcArr, int nObj)
 
void CreateArray (Weight_h *&tgtArr, int nObj, Weight_h ini=1)
 Create variable sized arrays of pointers.
 
void CreateArray (AnaRecObjectC **&tgtArr, int nObj)
 
void CreateArray (AnaTrueObjectC **&tgtArr, int nObj)
 
void CreateArray (Float_t *&tgtArr, int nObj, Float_t ini=0)
 
void CreateArray (Int_t *&tgtArr, int nObj, Int_t ini=0)
 
void CreateArray (bool *&tgtArr, int nObj, bool ini=true)
 
void ResizeArray (AnaRecObjectC **&tgtArr, int nObj)
 
void ResizeArray (AnaTrueObjectC **&tgtArr, int nObj)
 
void ResizeArray (Int_t *&tgtArr, int nObj)
 
bool CheckSkimmedEvent (Int_t sRun, Int_t sSubrun, Int_t sEvt)
 
void ClearArray (AnaTrackB *arr[], int n)
 
void ClearArray (AnaParticleB *arr[], int n)
 
void ClearArray (AnaTrueParticleB *arr[], int n)
 
void ClearArray (AnaTPCParticleB *arr[], int n)
 
void ClearArray (AnaFGDParticleB *arr[], int n)
 
void ClearArray (AnaECALParticleB *arr[], int n)
 
void ClearArray (AnaP0DParticleB *arr[], int n)
 
void ClearArray (AnaSMRDParticleB *arr[], int n)
 
void ReserveArray (AnaTrackB *arr[], int n)
 
void ReserveArray (AnaParticleB *arr[], int n)
 
void ReserveArray (AnaTrueParticleB *arr[], int n)
 
void ReserveArray (AnaTPCParticleB *arr[], int n)
 
void ReserveArray (AnaFGDParticleB *arr[], int n)
 
void ReserveArray (AnaECALParticleB *arr[], int n)
 
void ReserveArray (AnaP0DParticleB *arr[], int n)
 
void ReserveArray (AnaSMRDParticleB *arr[], int n)
 
void ReclaimArray (AnaTrackB *arr[], int n, int size)
 
void ReclaimArray (AnaParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaTrueParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaTPCParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaFGDParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaECALParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaP0DParticleB *arr[], int n, int size)
 
void ReclaimArray (AnaSMRDParticleB *arr[], int n, int size)
 
void CopyArray (AnaTrackB **const &src, AnaTrackB **&dest, int n)
 
void CopyArray (AnaECALParticleB **const &src, AnaECALParticleB **&dest, int n)
 
void CopyArray (AnaRecObjectC **tgtArr, AnaParticleB **srcArr, int nObj)
 
void CopyArray (AnaRecObjectC **tgtArr, AnaTrackB **srcArr, int nObj)
 
void CopyArray (AnaTrueObjectC **tgtArr, AnaTrueParticleB **srcArr, int nObj)
 
void CreateArray (AnaTrackB **&tgtArr, int nObj)
 Create varaible sized arrays of pointers.
 
void CreateArray (AnaTrueParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaVertexB **&tgtArr, int nObj)
 
void CreateArray (AnaTrueVertexB **&tgtArr, int nObj)
 
void CreateArray (AnaFgdTimeBinB **&tgtArr, int nObj)
 
void CreateArray (AnaParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaTPCParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaFGDParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaECALParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaP0DParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaSMRDParticleB **&tgtArr, int nObj)
 
void CreateArray (AnaDetCrossingB **&tgtArr, int nObj)
 
void CreateArray (SubDetId::SubDetEnum *&tgtArr, int nObj, SubDetId::SubDetEnum ini=SubDetId::kInvalid)
 
void CopyArray (AnaTrueParticleB **const &src, AnaTrueParticleB **&dest, int n)
 
void CopyArray (AnaParticleB **const &src, AnaParticleB **&dest, int n)
 
void ResizeArray (AnaTrueParticleB **&tgtArr, int nObj)
 
void ResizeArray (AnaTrackB **&tgtArr, int nObj)
 
void ResizeArray (AnaFgdTimeBinB **&tgtArr, int nObj)
 
bool InDetVolume (SubDetId::SubDetEnum det, const Float_t *pos)
 
bool InFiducialVolume (SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
 
bool InFiducialVolume (SubDetId::SubDetEnum det, const Float_t *pos)
 
Int_t GetFgdModuleType (bool IsMC, const Float_t *pos, SubDetId::SubDetEnum det, bool includeGlueSkin=true)
 
Int_t GetFgdModuleTypeNoFV (bool IsMC, const Float_t *pos, bool includeGlueSkin=true)
 
Int_t GetFgdMaterial (bool IsMC, const Float_t *pos, SubDetId::SubDetEnum det)
 
Int_t GetFgdMaterialNoFV (bool IsMC, const Float_t *pos)
 
SubDetId::SubDetEnum GetDetector (const Float_t *pos)
 Return the detector in which the position is.
 
Int_t GetOneSegmentPerTPC (AnaTPCParticleB *in[], Int_t nseg, AnaTPCParticleB *out[])
 
SubDetId::SubDetEnum GetClosestTPC (const AnaTrackB &track)
 For tracks that start in the FGD, get the closest TPC in the direction of the track.
 
int GetSegmentsInDet (const AnaTrackB &track, SubDetId::SubDetEnum det, AnaParticleB *selTracks[])
 
AnaParticleBGetSegmentWithMostNodesInDet (const AnaTrackB &track, SubDetId::SubDetEnum det)
 Method to get the subtrack with most nodes in a given detector.
 
AnaParticleBGetSegmentWithMostNodesInClosestTpc (const AnaTrackB &track)
 Combined function to address NuMu selection needs as efficiently as possible - gets the TPC segment with the most nodes in the TPC closest to the start of the global track.
 
AnaParticleBGetSegmentWithMostNodesInClosestTpc (const AnaTrackB &track, const Float_t *pos)
 Same as above but closest to a given point.
 
AnaParticleBGetSegmentInDet (const AnaTrackB &track, SubDetId::SubDetEnum det)
 
bool HasTrackUsingTPC (const AnaEventB &event)
 
int GetAllChargedTrajInTPCInBunch (const AnaEventB &event, AnaTrueParticleB *traj[])
 
int GetAllChargedTrajInFGDInBunch (const AnaEventB &event, AnaTrueParticleB *traj[], SubDetId::SubDetEnum det)
 
int GetAllBigEnoughChargedTrajInTPCInBunch (const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[])
 
int GetAllChargedTrajInTPCFGDInBunch (const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[])
 
int GetAllChargedTrajInFGDAndNoTPCInBunch (const AnaEventB &event, AnaTrueParticleB *chargedtrajInBunch[], SubDetId::SubDetEnum det)
 
int GetAllChargedTrajInP0DInBunch (const AnaEventB &event, AnaTrueParticleB *chargedTrajInBunch[])
 
int GetAllChargedTrajInP0DAndTPCInBunch (const AnaEventB &event, AnaTrueParticleB *chargedTrajInBunch[])
 
int GetAllChargedTrajInP0DAndNoTPCInBunch (const AnaEventB &event, AnaTrueParticleB *chargedTrajInBunch[])
 
int GetAllTracksUsingP0D (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingFGD (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingTPC (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingFGDorTPC (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingECAL (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingSMRD (const AnaEventB &event, AnaTrackB *selTracks[])
 
int GetAllTracksUsingFGDAndNoTPC (const AnaEventB &event, AnaTrackB *selTracks[], SubDetId::SubDetEnum fgddet)
 
int GetNTracksUsingTPCAndDet (const AnaEventB &event, SubDetId::SubDetEnum det)
 Returns the number of tracks using both the TPC and the subdetector 'det'.
 
bool UsesTrackerDsEcal (AnaTrackB *track)
 Whether this track has an ecal segment in the TrackerECal or DsECal.
 
bool UsesTrackerDsEcal (AnaECALParticleB *ecal)
 Whether this ecal segment is in the TrackerECal or DsECal (i.e. not in the P0DECal).
 
int GetTrackerDsEcals (AnaTrackB *track, AnaECALParticleB *selTracks[])
 
AnaTPCParticleBGetTPCBackSegment (const AnaTrackB *track)
 Get the most dowstream TPC segment of the track.
 
AnaECALParticleBGetMostUpstreamECalSegment (AnaTrackB *track)
 
int GetLocalDetEnum (SubDetId::SubDetEnum det, int i)
 Return an integer corresponding to the array index of the track in the old local detector enumeration. More...
 
massComponentEnum GetMassComponent (bool IsMC, const Float_t *pos)
 Get the detector component in which the position is.
 
int GetFGDMichelElectrons (const AnaEventB &event, const SubDetId::SubDetEnum det, AnaFgdTimeBinB **arr, bool prod5Cut=0)
 Get all delayed time bins as Michel Electron candidates.
 
Float_t MagnetIntensityCorrection (Int_t Run)
 
int GetRunPeriod (int run, int subrun=-1)
 Returns the run period (sequentially: 0,1,2,3,4,5 ...) More...
 
int GetSandMode (int run)
 Returns the sans muon modes (sequentially: 0,1,2)
 
template<int nIntBins, int nMomBins>
void LoadPionCrossSections (char *inputFileName, Float_t(&xsec_array)[nIntBins][nMomBins], Float_t(&err_array)[nIntBins][nMomBins])
 Method to load external ipon cross section data into arrays.
 
double GetNTargets (massComponentEnum massComponent=kFGD1, int target_nucleons=3)
 
double GetNucleonsPerNucleus (massComponentEnum massComponent=kFGD1, int target_nucleons=3)
 
double GetAreaFV (massComponentEnum massComponent=kFGD1)
 
void IncrementPOTBySpill (const AnaSpillB &spill, Header &header)
 
Float_t ComputeInversePT (const AnaDetCrossingB &cross, bool entrance=true)
 Compute inverse PT given an AnaDetCrossing.
 
Float_t ComputeInversePTFlip (const AnaTrackB &track)
 
Float_t ComputeMomentumFromInversePTFlip (const AnaParticleB &part, Float_t PTinv)
 Compute the total momentum (flip) given the part and the inverse transverse momentum.
 
Float_t ComputeTPCPull (const AnaTPCParticleB &track, const std::string &particle)
 Function to recompute the pull for a TPC track segment.
 
void ComputeTPCPull (const AnaTPCParticleB &track, Float_t *pulls)
 Function to recompute the pull for a TPC track segment for all hypotheses.
 
void RecomputeTPCPulls (AnaTPCParticleB &track)
 Function to recompute all the pull for a TPC track segment and save them into the segment.
 
Float_t ExpectedTPCdEdx (const AnaTPCParticleB &track, const std::string &particle)
 
Float_t GetPIDLikelihood (const AnaTrackB &track, Int_t hypo, bool prod5Cut=0)
 
void GetPIDLikelihood (const AnaTrackB &, Float_t *hypo, bool prod5Cut=0)
 Get all likelihoods.
 
Float_t GetPIDLikelihoodMIP (const AnaTrackB &track)
 Get the likelihood for MIP: (like_mu+like_pi)/(1-like_p)
 
Float_t GetPIDPrior (const AnaTrackB &track, Int_t hypo)
 A function that is not currently used, and will be documented when it is.
 
Int_t GetNMichelElectrons (const AnaTrueVertexB &trueVertex, SubDetId::SubDetEnum det=SubDetId::kFGD1)
 Get the number of true michel electrons. More...
 
Float_t GetTrueLinearLengthInTPC (const AnaTrueParticleB &trueTrack, Float_t &distz)
 Return the true linear length traversed in the TPC.
 
int GetAllChargedTrajsInFgdECalInBunch (const AnaEventB &event, AnaTrueParticleB *outTraj[], SubDetId::SubDetEnum det)
 
int GetAllTrajsInECalInBunch (const AnaEventB &event, AnaTrueParticleB *outTraj[])
 
bool TrueParticleCrossesSMRD (const AnaTrueParticleB *track, Float_t min_sep=48.)
 
bool TrueParticleCrossesTECal (const AnaTrueParticleB *track, Float_t min_sep=50.)
 
bool TrueParticleCrossesFGD (const AnaTrueParticleB *track, SubDetId::SubDetEnum det=SubDetId::kFGD)
 Whether a true track crosses a FGD so to be able to deposit charge in at least two layers.
 
bool TrueParticleCrossesTPC (const AnaTrueParticleB *track, SubDetId::SubDetEnum det=SubDetId::kTPC)
 Whether a true track crosses a TPC so to be able to reconstruct an object.
 
bool TrueParticleEntersDet (const AnaTrueParticleB *track, SubDetId::SubDetEnum det)
 Whether a true track enters a given sub-detector. More...
 
int GetSMRDDetCrossed (const AnaTrueParticleB *track, SubDetId::SubDetEnum det[])
 SMRD detectors crossed.
 
int GetECalDetCrossed (const AnaTrueParticleB *track, SubDetId::SubDetEnum det[])
 ECal detectors crossed: split based on geom info PECal and TECal sub-detectors, this may not be very accurate.
 
int GetFGDDetCrossed (const AnaTrueParticleB *track, SubDetId::SubDetEnum det[])
 FGD detectors crossed.
 
AnaDetCrossingBGetAnaDetCrossing (const AnaTrueParticleB *track, SubDetId::SubDetEnum det)
 
Float_t GetEntranceMomentum (const AnaDetCrossingB &cross)
 Get the momentum value from AnaDetCrossing.
 
Float_t GetExitMomentum (const AnaDetCrossingB &cross)
 Get the momentum value from AnaDetCrossing.
 
std::string GetSoftwareVersionFromPath (const std::string &path)
 Get The software version from the path of the package.
 
std::string GetPackageNameFromProgram (const std::string &program)
 Get the package name provided the name of the executable being run.
 
std::string GetPackageNameFromPath (const std::string &path)
 Get the package name provided a path containing the package name.
 
std::vector< std::string > GetPackageHierarchy ()
 Get the vector of packages ordered following the package hierarchy.
 
float GetSeparationSquared (const Float_t *pos1, const Float_t *pos2)
 Calculate the distance between two points.
 
std::vector< Float_t > ComputeWeights (const AnaEventB &event)
 Compute all event weights (FluxWeight, etc. not the systematic ones !!!) and return the vector.
 
AnaTrueParticleBGetTrueParticleByID (const AnaEventB &event, int ID)
 Get the AnaTrueParticleB in the current spill with the given ID. Return NULL if it can't be found.
 
std::vector< AnaTrackB * > MergeUniqueTracks (const std::vector< AnaTrackB *> &tracks1, const std::vector< AnaTrackB *> &tracks2)
 Merge the two vectors of AnaTrackBs into a single vector, with no duplicated tracks.
 
Float_t GetParticleMass (ParticleId::ParticleEnum id)
 
Float_t ComputeBetaGamma (Float_t mom, ParticleId::ParticleEnum id)
 
Float_t ComputeBeta (Float_t mom, ParticleId::ParticleEnum id)
 
Float_t ComputeInversePT (const AnaParticleMomB &part)
 compute the inverse transverse momentum given an AnaParticleMomB
 
Float_t ComputeInversePT (const AnaParticleB &part, Float_t mom)
 compute the inverse transverse momentum given an AnaParticleB and the momentum
 
Float_t ComputeInversePT (const AnaTrueParticleB &part)
 compute the inverse transverse momentum for a true part
 
Float_t ComputeMomentumFromInversePT (const AnaParticleB &part, Float_t PTinv)
 compute the total momentum given the part and the inverse transverse momentum
 
Float_t NeutrinoERecCCQE (Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton)
 
Float_t ComputeInvariantMass (const AnaParticleMomB &part1, const AnaParticleMomB &part2, Float_t mass1, Float_t mass2)
 Get invariant mass given two AnaParticleB's and corresponding masses.
 
Float_t ComputeRecNuEnergyCCQE (Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton, Float_t bindingEnergy=25.)
 
Float_t ComputeRecQ2CCQE (Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton)
 
Float_t ComputeQ2 (Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton, Float_t energy_neutrino)
 
Float_t ComputeKineticEnergy (Float_t mom, Float_t mass)
 Compute kinetic energy given momentum and mass.
 
Float_t * GetSLineDir (Float_t *start, Float_t *end)
 Direction assuming straight line between given start and end points.
 
TVector3 ProjectTransverse (TVector3 &nudir, TVector3 &thisvec)
 
Float_t GetDPhi (const Float_t *nudir, const Float_t *mudir, const Float_t *pdir)
 Returns pi-(the angle between muon and proton). Should be delta-fn in ideal back2back.
 
Float_t GetTransverseMom (const Float_t *nudir, const Float_t *thisdir, Float_t thismom)
 Get the transverse momentum.
 
void InitializeNeutrinoBeamLineParameters ()
 
void SetNeutrinoParentDecPointRec (TVector3 &vec)
 
TVector3 CalcNuDir (TVector3 &nup0Global, TVector3 &nup1Local)
 
TVector3 GetNuDirRec (const Float_t vertex_pos[])
 
Int_t GetNSegmentsInDet (const AnaTrackB &track, SubDetId::SubDetEnum det)
 Get the number of AnaParticle segments that use the specified detector system.
 
bool HasTrackUsingDet (const AnaEventB &event, SubDetId::SubDetEnum det)
 
int GetAllTrajInBunch (const AnaEventB &event, AnaTrueParticleB *traj[])
 
int GetAllChargedTrajInBunch (const AnaEventB &event, AnaTrueParticleB *traj[])
 
int GetAllTracksUsingDet (const AnaEventB &event, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
 
int GetAllTracksNotUsingDet (const AnaEventB &event, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
 
bool TrackUsesDets (const AnaTrackB &track, SubDetId::SubDetEnum dets[], int nDets)
 
bool TrackUsesDet (const AnaTrackB &track, SubDetId::SubDetEnum det)
 
bool TrackUsesDet (const AnaParticleB &track, SubDetId::SubDetEnum det)
 
int GetAllTracksUsingOnlyDet (const AnaEventB &event, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
 
bool TrackUsesOnlyDet (const AnaTrackB &track, SubDetId::SubDetEnum det)
 
bool TrackUsesOnlyDet (const AnaParticleB &track, SubDetId::SubDetEnum det)
 

Variables

CategoryManager_categ =NULL
 
std::string skimFileName =""
 
bool breakLoop =false
 
bool NeutrinoBeamLineParametersInitialized =false
 
Float_t BeamPipePosition [3] ={0,0,0}
 
Float_t NeutrinoParentDecay [3] ={0,0,0}
 

Detailed Description

This namespace contains useful functions for analyses related to kinematics.

This namespace contains useful functions for analyses. Functions include those related to fiducial volumes, accessing tracks with specific characteristics, and more.

This namespace contains useful functions for analyses. This is in addition to those defined in psycheUtils

This namespace contains useful functions for analyses SHOULD CONSIDER TEMPLATING THE METHODS!

Function Documentation

§ ComputeQ2()

Float_t anaUtils::ComputeQ2 ( Float_t  mom_lepton,
Float_t  mass_lepton,
Float_t  costheta_lepton,
Float_t  energy_neutrino 
)

Compute the Q2 using muon variables and neutrino energy It considers neutron/proton mass difference and binding energy.

Definition at line 178 of file KinematicsUtils.cxx.

178  {
179 //********************************************************************
180 
181  // computes the Q2
182 
183  // reconstructed muon energy
184  Float_t Emu = sqrt( pow(mass_lepton,2) + pow(mom_lepton,2) );
185 
186  // Q2. In GeV^2
187  Float_t Q2 = (2 * e_neutrino * (Emu - (mom_lepton * costheta_lepton)) - pow(mass_lepton,2)) / 1e6;
188 
189  return Q2;
190 }

§ ComputeRecNuEnergyCCQE()

Float_t anaUtils::ComputeRecNuEnergyCCQE ( Float_t  mom_lepton,
Float_t  mass_lepton,
Float_t  costheta_lepton,
Float_t  bindingEnergy = 25. 
)

Compute the reconstructed neutrino energy assuming CCQE kinematics. It considers neutron/proton mass difference and binding energy.

Definition at line 138 of file KinematicsUtils.cxx.

138  {
139 //********************************************************************
140 
141  // computes the reconstructed neutrino energy using only muon kinematics
142  // all masses in MeV
143  // bindingEnergy = - nuclear potential = 25 MeV for Carbon (default)
144 
145  Float_t reduced_nMass = units::mass_neutron - bindingEnergy;
146 
147  // muon energy
148  Float_t Emu = sqrt( (mass_lepton*mass_lepton) + (mom_lepton*mom_lepton) );
149 
150  // reconstructed neutrino energy
151  Float_t eNuRec = ( (units::mass_proton*units::mass_proton)
152  - (mass_lepton*mass_lepton)
153  - (reduced_nMass*reduced_nMass)
154  + (2 * Emu * reduced_nMass)
155  ) / (
156  2*(reduced_nMass + (mom_lepton * costheta_lepton) - Emu)
157  );
158 
159  return eNuRec;
160 }

§ ComputeRecQ2CCQE()

Float_t anaUtils::ComputeRecQ2CCQE ( Float_t  mom_lepton,
Float_t  mass_lepton,
Float_t  costheta_lepton 
)

Compute the reconstructed Q2 assuming CCQE kinematics to compute neutrino energy. It considers neutron/proton mass difference and binding energy.

Definition at line 163 of file KinematicsUtils.cxx.

163  {
164 //********************************************************************
165 
166  // computes the reconstructed Q2 using reconstructed quantities
167 
168  // reconstructed neutrino energy using only the kinematic of the muon
169  Float_t eNuRec = ComputeRecNuEnergyCCQE(mom_lepton, mass_lepton, costheta_lepton);
170 
171  // Q2 (using reconstructed neutrino energy). In GeV^2
172  Float_t Q2 = ComputeQ2(mom_lepton, mass_lepton,costheta_lepton,eNuRec);
173 
174  return Q2;
175 }
Float_t ComputeQ2(Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton, Float_t energy_neutrino)
Float_t ComputeRecNuEnergyCCQE(Float_t mom_lepton, Float_t mass_lepton, Float_t costheta_lepton, Float_t bindingEnergy=25.)

§ ExpectedTPCdEdx()

Float_t anaUtils::ExpectedTPCdEdx ( const AnaTPCParticleB track,
const std::string &  particle 
)

Compute the expected TPC dEdx for a track, using a different parameterisation than the one in tpcRecon.

Definition at line 36 of file PIDUtils.cxx.

36  {
37 //********************************************************************
38 
39  // for production 5
40  Float_t ExpecteddEP0 = 149.4;
41  Float_t ExpecteddEP1 = 2.765;
42  Float_t ExpecteddEP2 = 0.103;
43  Float_t ExpecteddEP3 = 2.052;
44  Float_t ExpecteddEP4 = 0.5104;
45 
46  if (versionUtils::prod6_corrections){
47  // for production 6
48  ExpecteddEP0 = 53.87;
49  ExpecteddEP1 = 5.551;
50  ExpecteddEP2 = 0.001913;
51  ExpecteddEP3 = 2.283;
52  ExpecteddEP4 = 1.249;
53  }
54 
55  Float_t mass = -1;
56 
57  if (particle == "electron") {
58  mass = 0.511;
59  } else if (particle == "pion") {
60  mass = 139.57;
61  } else if (particle == "muon") {
62  mass = 105.66;
63  } else if (particle == "proton") {
64  mass = 938.27;
65  } else if (particle == "kaon") {
66  mass = 493.67;
67  } else {
68  std::cout << "Tried to compute dEdx for invalid particle hypothesis" << std::endl;
69  return -10000;
70  }
71 
72  Float_t bg = track.Momentum / mass;
73  Float_t beta = bg / sqrt(1. + bg * bg);
74  Float_t func = ExpecteddEP1 - pow(beta, ExpecteddEP3) - log(ExpecteddEP2 + 1. / pow(bg, ExpecteddEP4));
75  func = func * ExpecteddEP0 / pow(beta, ExpecteddEP3);
76 
77  return func;
78 }
Float_t Momentum
The reconstructed momentum of the particle, at the start position.

§ GetAllBigEnoughChargedTrajInTPCInBunch()

int anaUtils::GetAllBigEnoughChargedTrajInTPCInBunch ( const AnaEventB event,
AnaTrueParticleB chargedtrajInBunch[] 
)

Get all the true traj. in the bunch that are charged and crosses the TPC with a length > 1/4 of the TPC Returns the number of entries in the input array, the number of tracks found

Definition at line 1039 of file ConstituentsUtils.cxx.

1039  {
1040 //**************************************************
1041 
1042  int count = 0;
1043 
1044  for(Int_t i=0;i< event.nTrueParticles;i++){
1045  if(!event.TrueParticles[i]->TrueVertex) continue;
1046  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
1047  if(event.TrueParticles[i]->Charge==0)continue;
1048 
1049  Float_t dist=0;
1050  for(Int_t idet=0;idet<event.TrueParticles[i]->nDetCrossings;idet++){
1051  //i.e crossing the active part of the tpc
1052  if(SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kTPC) && event.TrueParticles[i]->DetCrossings[idet]->InActive) {
1054  if(sep>dist) dist=sep;
1055  }
1056  }
1057  //250*250 originally
1058  if(dist>62500){//bigger than the ~1/4 of the width of the TPC
1059  chargedtrajInBunch[count] = event.TrueParticles[i];
1060  ++count;
1061  }
1062 
1063  }
1064  return count;
1065 }
bool InActive
If the particle passes through an active part of the subdetector.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
unsigned long Detector
Float_t ExitPosition[4]
for each subdetector tell the exit position
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
AnaDetCrossingB ** DetCrossings
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t Charge
The true charge of the particle.

§ GetAllChargedTrajInBunch()

int anaUtils::GetAllChargedTrajInBunch ( const AnaEventB event,
AnaTrueParticleB traj[] 
)

Get all the true traj. in the bunch that are charged Returns the number of entries in the input array, the number of tracks found

Definition at line 26 of file SubDetUtils.cxx.

26  {
27 //**************************************************
28  int count = 0;
29  for(Int_t i=0;i< event.nTrueParticles;i++){
30  if(!event.TrueParticles[i]->TrueVertex) continue;
31  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
32 
33  if(event.TrueParticles[i]->Charge!=0){
34  chargedtrajInBunch[count] = event.TrueParticles[i];
35  ++count;
36  }
37  }
38  return count;
39 }
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t Charge
The true charge of the particle.

§ GetAllChargedTrajInFGDAndNoTPCInBunch()

int anaUtils::GetAllChargedTrajInFGDAndNoTPCInBunch ( const AnaEventB event,
AnaTrueParticleB chargedtrajInBunch[],
SubDetId::SubDetEnum  det 
)

Get all the true traj. in the bunch that are charged and crosses the the FGD but not the TPC Returns the number of entries in the input array, the number of tracks found

Definition at line 967 of file ConstituentsUtils.cxx.

967  {
968 //**************************************************
969  AnaTrueParticleB* trajInBunchInFgdx[NMAXTRUEPARTICLES];
970  Int_t ntrajInBunchInFgdx = anaUtils::GetAllChargedTrajInFGDInBunch(event, trajInBunchInFgdx,det);
971 
972  Int_t count = 0;
973  for (Int_t i = 0; i < ntrajInBunchInFgdx; i++) {
974  Float_t dist=-999999.;
975  for(Int_t idet=0;idet<trajInBunchInFgdx[i]->nDetCrossings;idet++){
976  //i.e crossing the active part of the tpc
977  if(SubDetId::GetDetectorUsed(trajInBunchInFgdx[i]->DetCrossings[idet]->Detector, SubDetId::kTPC) && trajInBunchInFgdx[i]->DetCrossings[idet]->InActive) {
978  Float_t sep = GetSeparationSquared(trajInBunchInFgdx[i]->DetCrossings[idet]->EntrancePosition, trajInBunchInFgdx[i]->DetCrossings[idet]->ExitPosition);
979 
980  if(sep>dist) dist=sep;
981  }
982  }
983 
984  bool cross_tpc = false;
985  // 250*250 originally
986  if(dist>62500)//bigger than the ~1/4 of the width of the TPC
987  cross_tpc = true;
988 
989  if (!cross_tpc){
990  chargedtrajInBunch[count] = trajInBunchInFgdx[i];
991  ++count;
992  }
993  }
994 
995  return count;
996 }
int nDetCrossings
The number of DetCrossing objects.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
Representation of a true Monte Carlo trajectory/particle.
int GetAllChargedTrajInFGDInBunch(const AnaEventB &event, AnaTrueParticleB *traj[], SubDetId::SubDetEnum det)

§ GetAllChargedTrajInFGDInBunch()

int anaUtils::GetAllChargedTrajInFGDInBunch ( const AnaEventB event,
AnaTrueParticleB traj[],
SubDetId::SubDetEnum  det 
)

Get all the true traj. in the bunch that are charged and crosses the FGD Returns the number of entries in the input array, the number of tracks found

Definition at line 925 of file ConstituentsUtils.cxx.

925  {
926 //**************************************************
927  /*
928  * we need here to select in-FGD tracks that potentially should have been reconstruced
929  * by FGD iso recon (the function name is confusing);
930  * this involves putting some min requirements for the true tracks:
931  * since FGD iso recon requires a track to extend for at least 4 Z layers (i.e. having hits in five consequitive layers)
932  * in order to be reconstruced this requirement should be applied for the true tracks as well.
933  * In principle one can use the geometry info to retrieve layers that true entrance and exit point correspond to
934  * but it can be time taking, so we use an approximation: a true trajectory should have a length in Z at least of the one of 4 FGD layers:
935  * so 4 cm
936 
937  */
938 
939  int count = 0;
940  for (Int_t i = 0; i < event.nTrueParticles; i++) {
941  if(!event.TrueParticles[i]->TrueVertex) continue;
942  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
943  if(event.TrueParticles[i]->Charge==0)continue;
944  Float_t dist = -9999999;
945  for (Int_t idet = 0; idet < event.TrueParticles[i]->nDetCrossings; idet++) {
946  // i.e crossing the active part of the FGD
947  if (SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kFGD)){
948  if (SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, det) && event.TrueParticles[i]->DetCrossings[idet]->InActive) {
949  //the separation should be done using the z position, since the fgd is separated by layer in z,
950  //making the z position the reconstructed quantity to be cut on
951  Float_t sep = fabs(event.TrueParticles[i]->DetCrossings[idet]->EntrancePosition[2] - event.TrueParticles[i]->DetCrossings[idet]->ExitPosition[2]);
952  if(sep>dist) dist=sep;
953  }
954  }
955  }
956  // apply the cut (this cut is only valid for FGD!)
957  if (dist > 40){
958  chargedtrajInBunch[count] = event.TrueParticles[i];
959  ++count;
960  }
961  }
962 
963  return count;
964 }
bool InActive
If the particle passes through an active part of the subdetector.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
unsigned long Detector
Float_t ExitPosition[4]
for each subdetector tell the exit position
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
AnaDetCrossingB ** DetCrossings
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t Charge
The true charge of the particle.

§ GetAllChargedTrajInTPCFGDInBunch()

int anaUtils::GetAllChargedTrajInTPCFGDInBunch ( const AnaEventB event,
AnaTrueParticleB chargedtrajInBunch[] 
)

Get all the true traj. in the bunch that are charged and crosses the TPC and the FGD (TPC1-FGD1, FGD1-TPC2, TPC2-FGD2, FGD2-TPC3) Returns the number of entries in the input array, the number of tracks found

Definition at line 999 of file ConstituentsUtils.cxx.

999  {
1000 //**************************************************
1001 
1002  int count = 0;
1003 
1004  for(Int_t i=0;i<event.nTrueParticles;i++){
1005  if(!event.TrueParticles[i]->TrueVertex) continue;
1006  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
1007  if(event.TrueParticles[i]->Charge==0)continue;
1008 
1009  Float_t dist=-9999999;
1010  for(Int_t idet=0;idet<event.TrueParticles[i]->nDetCrossings;idet++){
1011  //i.e crossing the active part of one of the FGDs
1012  if(SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kFGD)){
1013  for(Int_t idet1=0;idet1<event.TrueParticles[i]->nDetCrossings;idet1++){
1014  //look for TPC1-FGD1, FGD1-TPC2, TPC2-FGD2, FGD2-TPC3 trajectories
1015  if((SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kFGD1) &&
1016  (SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet1]->Detector, SubDetId::kTPC1) || SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet1]->Detector, SubDetId::kTPC2))) ||
1017  (SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kFGD2) &&
1018  (SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet1]->Detector, SubDetId::kTPC2) || SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet1]->Detector, SubDetId::kTPC3))))
1019  {
1020  Float_t sep = GetSeparationSquared(event.TrueParticles[i]->DetCrossings[idet1]->EntrancePosition, event.TrueParticles[i]->DetCrossings[idet1]->ExitPosition);
1021  if(sep>dist) dist=sep;
1022  }
1023  }
1024  }
1025  }
1026 
1027  // 10*10 originally, now 100
1028  if(dist>100){
1029  chargedtrajInBunch[count] = event.TrueParticles[i];
1030  ++count;
1031  }
1032  }
1033 
1034  return count;
1035 
1036 }
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
unsigned long Detector
Float_t ExitPosition[4]
for each subdetector tell the exit position
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
AnaDetCrossingB ** DetCrossings
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t Charge
The true charge of the particle.

§ GetAllChargedTrajInTPCInBunch()

int anaUtils::GetAllChargedTrajInTPCInBunch ( const AnaEventB event,
AnaTrueParticleB traj[] 
)

Get all the true traj. in the bunch that are charged and crosses the TPC Returns the number of entries in the input array, the number of tracks found

Definition at line 900 of file ConstituentsUtils.cxx.

900  {
901 //**************************************************
902  int count = 0;
903  for(Int_t i=0;i< event.nTrueParticles;i++){
904  if(!event.TrueParticles[i]->TrueVertex) continue;
905  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
906  if(event.TrueParticles[i]->Charge==0)continue;
907  Float_t dist=-9999999;
908  for(Int_t idet=0;idet<event.TrueParticles[i]->nDetCrossings;idet++){
909  //i.e crossing the active part of the tpc
910  if(SubDetId::GetDetectorUsed(event.TrueParticles[i]->DetCrossings[idet]->Detector, SubDetId::kTPC) && event.TrueParticles[i]->DetCrossings[idet]->InActive) {
912  if(sep>dist) dist=sep;
913  }
914  }
915  // 30* 30 originally
916  if((dist)>900 && event.TrueParticles[i]->Momentum>5){//bigger than 3 TPC hits (30*30 is faster that sqrt(dist)), and momentum > 5 MeV
917  chargedtrajInBunch[count] = event.TrueParticles[i];
918  ++count;
919  }
920  }
921  return count;
922 }
bool InActive
If the particle passes through an active part of the subdetector.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
unsigned long Detector
Float_t ExitPosition[4]
for each subdetector tell the exit position
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
Float_t Momentum
The initial momentum of the true particle.
float GetSeparationSquared(const Float_t *pos1, const Float_t *pos2)
Calculate the distance between two points.
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
AnaDetCrossingB ** DetCrossings
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t Charge
The true charge of the particle.

§ GetAllChargedTrajOnlyDsECal()

int anaUtils::GetAllChargedTrajOnlyDsECal ( const AnaEventB event,
AnaTrueParticleB DsECalChargedTracks[] 
)

*****mirar esto!! luego añadir varibales q puso sasha y mirar si pinta micro tree, añadir edeposit y posicion a ver q pinta y asociar edeposit con emenergy || mip energy

Definition at line 45 of file HighlandAnalysisUtils.cxx.

45  {///*****mirar esto!! luego añadir varibales q puso sasha y mirar si pinta micro tree, añadir edeposit y posicion a ver q pinta y asociar edeposit con emenergy || mip energy
46 //**************************************************
47  int nDsECalChargedTracks = 0;
48  AnaTrueParticleB* trajInBunch[NMAXPARTICLES];
49  int nChargedTrajInBunch = GetAllChargedTrajInBunch(event,trajInBunch);
50  for(int i=0;i<nChargedTrajInBunch;i++){
51  for(int idet=0;idet<trajInBunch[i]->nDetCrossings;idet++){
52  if((SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kFGD1)) ||
53  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kFGD2)) ||
54  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kTPC1)) ||
55  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kTPC2)) ||
56  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kTPC3)) ||
57  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kP0D)) ||
58  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kPECAL)) ||
59  (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kSMRD))) {continue;}
60 
61  //i.e crossing ONLY the active part of the DsECal, no POD ECal or any other sub-detector
62  if (SubDetId::GetDetectorUsed(trajInBunch[i]->DetCrossings[idet]->Detector, SubDetId::kDSECAL) && trajInBunch[i]->DetCrossings[idet]->InActive){
63  // In Ds not needed cut on lenght
64  /* double dist = sqrt(pow(trajInBunch[i]->DetCrossings[idet]->ExitPosition[0]-trajInBunch[i]->DetCrossings[idet]->EntrancePosition[0] ,2) +
65  pow(trajInBunch[i]->DetCrossings[idet]->ExitPosition[1]-trajInBunch[i]->DetCrossings[idet]->EntrancePosition[1] ,2) +
66  pow(trajInBunch[i]->DetCrossings[idet]->ExitPosition[2]-trajInBunch[i]->DetCrossings[idet]->EntrancePosition[2] ,2) +
67  pow(trajInBunch[i]->DetCrossings[idet]->ExitPosition[3]-trajInBunch[i]->DetCrossings[idet]->EntrancePosition[3] ,2)); */
68  // Value of ECal threshold to set
69  // if ((trajInBunch[i]->Momentum<80) ) continue;
70  DsEcalChargedTracks[nDsECalChargedTracks] = trajInBunch[i];
71  nDsECalChargedTracks++;
72  }
73  }
74  }
75  return nDsECalChargedTracks;
76 }
int nDetCrossings
The number of DetCrossing objects.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
int GetAllChargedTrajInBunch(const AnaEventB &event, AnaTrueParticleB *traj[])
Definition: SubDetUtils.cxx:26
Representation of a true Monte Carlo trajectory/particle.

§ GetAllChargedTrajsInFgdECalInBunch()

int anaUtils::GetAllChargedTrajsInFgdECalInBunch ( const AnaEventB event,
AnaTrueParticleB outTraj[],
SubDetId::SubDetEnum  det 
)

Get all the true traj. in the bunch that are charged and cross the FGD and ECal (Barrel) and no TPC Returns the number of entries in the input array, the number of tracks found

Definition at line 56 of file TruthUtils.cxx.

56  {
57  //********************************************************************
58  int count = 0;
59 
60  if (!SubDetId::IsFGDDetector(det))
61  return false;
62 
63  AnaTrueParticleB* tracks[NMAXTRUEPARTICLES];
64  int ntracks = anaUtils::GetAllChargedTrajInBunch(event, tracks);
65  if((UInt_t)ntracks>NMAXTRUEPARTICLES) ntracks = NMAXTRUEPARTICLES;
66 
67  for (int i=0; i<ntracks; i++){
68  AnaTrueParticleB* track = tracks[i];
69  if (!track) continue;
70 
71  //should satisfy some minimum criteria in FGD and ECal
72  if (anaUtils::TrueParticleEntersDet(track, det) && anaUtils::TrueParticleEntersDet(track, SubDetId::kTECAL) && !anaUtils::TrueParticleCrossesTPC(track))
73  outTraj[count++] = track;
74 
75  }
76 
77  return count;
78 }
bool TrueParticleEntersDet(const AnaTrueParticleB *track, SubDetId::SubDetEnum det)
Whether a true track enters a given sub-detector.
Definition: TruthUtils.cxx:108
static bool IsFGDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a FGD or not.
Definition: SubDetId.cxx:126
bool TrueParticleCrossesTPC(const AnaTrueParticleB *track, SubDetId::SubDetEnum det=SubDetId::kTPC)
Whether a true track crosses a TPC so to be able to reconstruct an object.
Definition: TruthUtils.cxx:278
int GetAllChargedTrajInBunch(const AnaEventB &event, AnaTrueParticleB *traj[])
Definition: SubDetUtils.cxx:26
Representation of a true Monte Carlo trajectory/particle.

§ GetAllTracksNotUsingDet()

int anaUtils::GetAllTracksNotUsingDet ( const AnaEventB event,
SubDetId::SubDetEnum  det,
AnaTrackB selTracks[] 
)

Get all the tracks not using a specific detector. See SubDetId::SubDetEnum for the detector numbering convention. Returns the number of entries in the input array, the number of tracks found

Definition at line 72 of file SubDetUtils.cxx.

72  {
73 //**************************************************
74 
75  int count = 0;
76 
77  for (int it = 0; it < event.nParticles; it++) {
78  AnaTrackB* track = static_cast<AnaTrackB*>(event.Particles[it]);
79  if (!SubDetId::GetDetectorUsed(track->Detector, det)) {
80  selTracks[count] = track;
81  ++count;
82  }
83  }
84 
85  return count;
86 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
Representation of a global track.

§ GetAllTracksUsingDet() [1/2]

int anaUtils::GetAllTracksUsingDet ( const AnaEventB event,
SubDetId::SubDetEnum  det,
AnaTrackB selTracks[] 
)

Get all the tracks using a specific detector. See SubDetId::SubDetEnum for the detector numbering convention. Returns the number of entries in the input array, the number of tracks found

Definition at line 56 of file SubDetUtils.cxx.

56  {
57 //**************************************************
58 
59  int count = 0;
60  for (int it = 0; it < event.nParticles; it++) {
61  AnaTrackB* track = static_cast<AnaTrackB*>(event.Particles[it]);
62  if (SubDetId::GetDetectorUsed(track->Detector, det)){
63  selTracks[count] = track;
64  count++;
65  }
66  }
67 
68  return count;
69 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
Representation of a global track.

§ GetAllTracksUsingDet() [2/2]

int anaUtils::GetAllTracksUsingDet ( const AnaBunchB bunch,
SubDetId::SubDetEnum  det,
AnaTrackB selTracks[] 
)

Get all the tracks in a given bunch using a specific detector. See SubDetId::SubDetEnum for the detector numbering convention. Returns the number of entries in the input array, the number of tracks found

Definition at line 7 of file HighlandConstituentsUtils.cxx.

7  {
8 //**************************************************
9 
10  int count = 0;
11  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
12  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
13  if (anaUtils::TrackUsesDet(*track, det)) {
14  selTracks[count] = track;
15  count++;
16  }
17  }
18 
19  return count;
20 }
bool TrackUsesDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
Representation of a global track.
std::vector< AnaParticleB * > Particles

§ GetAllTracksUsingECAL()

int anaUtils::GetAllTracksUsingECAL ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the ECAL, sorted by decreasing momentum. Returns the number of entries in the input array, the number of tracks found

Definition at line 1223 of file ConstituentsUtils.cxx.

1223  {
1224 //**************************************************
1225  return GetAllTracksUsingDet(event, SubDetId::kECAL, selTracks);
1226 }
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])

§ GetAllTracksUsingFGD()

int anaUtils::GetAllTracksUsingFGD ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the FGD, sorted by decreasing momentum. Returns the number of entries in the input array, the number of tracks found

Definition at line 1211 of file ConstituentsUtils.cxx.

1211  {
1212 //**************************************************
1213  return GetAllTracksUsingDet(event, SubDetId::kFGD, selTracks);
1214 }
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])

§ GetAllTracksUsingFGDAndNoTPC() [1/2]

int anaUtils::GetAllTracksUsingFGDAndNoTPC ( const AnaBunchB bunch,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the given bunch (AnaBunchB) that use the FGD and no TPC, sorted by decreasing NHits. Returns the number of entries in the input array, the number of tracks found

Definition at line 42 of file HighlandConstituentsUtils.cxx.

42  {
43 //**************************************************
44 
45  int count = 0;
46  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
47  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
48  if (!anaUtils::TrackUsesDet(*track, SubDetId::kTPC) && anaUtils::TrackUsesDet(*track, SubDetId::kFGD)) {
49  selTracks[count] = track;
50  ++count;
51  }
52  }
53 
54  // Sort by decreasing number of hits
55  std::sort(&selTracks[0], &selTracks[count], AnaParticleB::CompareNHits);
56 
57  return count;
58 }
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
bool TrackUsesDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
Representation of a global track.
std::vector< AnaParticleB * > Particles

§ GetAllTracksUsingFGDAndNoTPC() [2/2]

int anaUtils::GetAllTracksUsingFGDAndNoTPC ( const AnaEventB event,
AnaTrackB selTracks[],
SubDetId::SubDetEnum  fgddet 
)

Access function to get all the tracks in the bunch that use the FGD and no TPC, sorted by decreasing NHits. Returns the number of entries in the input array, the number of tracks found

Definition at line 1160 of file ConstituentsUtils.cxx.

1160  {
1161 //**************************************************
1162 
1163  int count = 0;
1164  for (int it = 0; it < event.nParticles; it++) {
1165  AnaTrackB* track = static_cast<AnaTrackB*>(event.Particles[it]);
1166  if (!SubDetId::GetDetectorUsed(track->Detector, SubDetId::kTPC) && SubDetId::GetDetectorUsed(track->Detector, fgddet)) {
1167  selTracks[count] = track;
1168  ++count;
1169  }
1170  }
1171 
1172  // Sort by decreasing number of hits
1173  std::sort(&selTracks[0], &selTracks[count], AnaParticleB::CompareNHits);
1174 
1175  return count;
1176 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
Representation of a global track.

§ GetAllTracksUsingFGDorTPC() [1/2]

int anaUtils::GetAllTracksUsingFGDorTPC ( const AnaBunchB bunch,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the given bunch (AnaBunchB) that use the FGD or TPC, not sorted. Returns the number of entries in the input array, the number of tracks found

Definition at line 62 of file HighlandConstituentsUtils.cxx.

62  {
63 //**************************************************
64 
65  int count = 0;
66  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
67  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
68  if ( ! (anaUtils::TrackUsesDet(*track, SubDetId::kTPC) || anaUtils::TrackUsesDet(*track, SubDetId::kFGD))) {
69  selTracks[count] = track;
70  ++count;
71  }
72  }
73 
74  return count;
75 }
bool TrackUsesDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
Representation of a global track.
std::vector< AnaParticleB * > Particles

§ GetAllTracksUsingFGDorTPC() [2/2]

int anaUtils::GetAllTracksUsingFGDorTPC ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the TPC or the FGD, sorted by decreasing number of hits Returns the number of entries in the input array, the number of tracks found

Definition at line 1180 of file ConstituentsUtils.cxx.

1180  {
1181 //**************************************************
1182 
1183  int count = 0;
1184  for (int it = 0; it < event.nParticles; it++) {
1185  AnaTrackB* track = static_cast<AnaTrackB*>(event.Particles[it]);
1186  if (SubDetId::GetDetectorUsed(track->Detector, SubDetId::kTPC) || SubDetId::GetDetectorUsed(track->Detector, SubDetId::kFGD)) {
1187  selTracks[count] = track;
1188  ++count;
1189  }
1190  }
1191 
1192  // Sort by decreasing number of hits
1193  std::sort(&selTracks[0], &selTracks[count], AnaParticleB::CompareNHits);
1194 
1195  return count;
1196 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
Representation of a global track.

§ GetAllTracksUsingOnlyDet() [1/2]

int anaUtils::GetAllTracksUsingOnlyDet ( const AnaBunchB bunch,
SubDetId::SubDetEnum  det,
AnaTrackB selTracks[] 
)

Get all the tracks in a given bunch using only a specific detector. See SubDetId::SubDetEnum for the detector numbering convention. Returns the number of entries in the input array, the number of tracks found

Definition at line 24 of file HighlandConstituentsUtils.cxx.

24  {
25 //**************************************************
26 
27  int count = 0;
28 
29  for (unsigned int it = 0; it < bunch.Particles.size(); it++) {
30  AnaTrackB* track = static_cast<AnaTrackB*>(bunch.Particles[it]);
31  if (anaUtils::TrackUsesOnlyDet(*track, det)) {
32  selTracks[count] = track;
33  ++count;
34  }
35  }
36 
37  return count;
38 }
Representation of a global track.
std::vector< AnaParticleB * > Particles
bool TrackUsesOnlyDet(const AnaTrackB &track, SubDetId::SubDetEnum det)

§ GetAllTracksUsingOnlyDet() [2/2]

int anaUtils::GetAllTracksUsingOnlyDet ( const AnaEventB event,
SubDetId::SubDetEnum  det,
AnaTrackB selTracks[] 
)

Get all the tracks using only a specific detector. See SubDetId::SubDetEnum for the detector numbering convention. Returns the number of entries in the input array, the number of tracks found

Definition at line 89 of file SubDetUtils.cxx.

89  {
90 //**************************************************
91 
92  int count = 0;
93 
94  for (int it = 0; it < event.nParticles; it++) {
95  AnaTrackB* track = static_cast<AnaTrackB*>(event.Particles[it]);
96  if (TrackUsesOnlyDet(*track, det)) {
97  selTracks[count] = track;
98  ++count;
99  }
100  }
101 
102  return count;
103 }
Representation of a global track.
bool TrackUsesOnlyDet(const AnaTrackB &track, SubDetId::SubDetEnum det)

§ GetAllTracksUsingP0D()

int anaUtils::GetAllTracksUsingP0D ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the P0D, sorted by decreasing momentum. Returns the number of entries in the input array, the number of tracks found

Definition at line 1205 of file ConstituentsUtils.cxx.

1205  {
1206 //**************************************************
1207  return GetAllTracksUsingDet(event, SubDetId::kP0D, selTracks);
1208 }
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])

§ GetAllTracksUsingSMRD()

int anaUtils::GetAllTracksUsingSMRD ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the SMRD, sorted by decreasing momentum. Returns the number of entries in the input array, the number of tracks found

Definition at line 1229 of file ConstituentsUtils.cxx.

1229  {
1230 //**************************************************
1231  return GetAllTracksUsingDet(event, SubDetId::kSMRD, selTracks);
1232 }
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])

§ GetAllTracksUsingTPC()

int anaUtils::GetAllTracksUsingTPC ( const AnaEventB event,
AnaTrackB selTracks[] 
)

Access function to get all the tracks in the bunch that use the TPC, sorted by decreasing momentum. Returns the number of entries in the input array, the number of tracks found

Definition at line 1217 of file ConstituentsUtils.cxx.

1217  {
1218 //**************************************************
1219  return GetAllTracksUsingDet(event, SubDetId::kTPC, selTracks);
1220 }
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])

§ GetAllTrajInBunch()

int anaUtils::GetAllTrajInBunch ( const AnaEventB event,
AnaTrueParticleB traj[] 
)

Get all the true traj. in the bunch, Returns the number of entries in the input array, the number of tracks found

Definition at line 12 of file SubDetUtils.cxx.

12  {
13 //**************************************************
14  int count = 0;
15  for(Int_t i=0;i< event.nTrueParticles;i++){
16  if(!event.TrueParticles[i]->TrueVertex) continue;
17  if(event.TrueParticles[i]->TrueVertex->Bunch!=event.Bunch) continue;
18  trajInBunch[count] = event.TrueParticles[i];
19  ++count;
20  }
21  return count;
22 }
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Int_t Bunch
The index of this bunch (0-7).
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.

§ GetAllTrajsInECalInBunch()

int anaUtils::GetAllTrajsInECalInBunch ( const AnaEventB event,
AnaTrueParticleB outTraj[] 
)

Get all true tajs that cross ECal(s) (Barrel) Returns the number of entries in the input array, the number of tracks found

Definition at line 82 of file TruthUtils.cxx.

82  {
83  //********************************************************************
84  int count = 0;
85 
86 
87  for(Int_t i = 0; i < event.nTrueParticles;i++){
88 
89  AnaTrueParticleB* track = event.TrueParticles[i];
90 
91  if (!track) continue;
92 
93  if(!track->TrueVertex) continue;
94  if(track->TrueVertex->Bunch != event.Bunch) continue;
95 
96  SubDetId::SubDetEnum ecal_det[20];
97 
98  int necal_det = anaUtils::GetECalDetCrossed(track, ecal_det);
99 
100  if (necal_det > 0)
101  outTraj[count++] = track;
102  }
103 
104  return count;
105 }
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
int GetECalDetCrossed(const AnaTrueParticleB *track, SubDetId::SubDetEnum det[])
ECal detectors crossed: split based on geom info PECal and TECal sub-detectors, this may not be very ...
Definition: TruthUtils.cxx:315
Representation of a true Monte Carlo trajectory/particle.
SubDetEnum
Enumeration of all detector systems and subdetectors.
Definition: SubDetId.hxx:25
Int_t Bunch
The index of this bunch (0-7).

§ GetAnaDetCrossing()

AnaDetCrossingB * anaUtils::GetAnaDetCrossing ( const AnaTrueParticleB track,
SubDetId::SubDetEnum  det 
)

Get an AnaDetCrossing corresponding to a given detector the first one found will be returned

Definition at line 422 of file TruthUtils.cxx.

422  {
423  //**************************************************
424 
425  AnaDetCrossingB* cross = NULL;
426 
427 
428  if (!track) return cross;
429 
430  for (int i = 0; i < track->nDetCrossings; i++){
431 
432  if (!track->DetCrossings[i]) continue;
433 
435 
436  if (det_bit == SubDetId::kInvalid) continue;
437 
438  if (det_bit != det) continue;
439 
440  if (!track->DetCrossings[i]->InActive) continue;
441 
442  cross = track->DetCrossings[i];
443 
444  }
445 
446  return cross;
447 
448 }
bool InActive
If the particle passes through an active part of the subdetector.
unsigned long Detector
int nDetCrossings
The number of DetCrossing objects.
AnaDetCrossingB ** DetCrossings
Representation of a detector crossing info for a true particle (G4 trajectory).
SubDetEnum
Enumeration of all detector systems and subdetectors.
Definition: SubDetId.hxx:25
static SubDetId::SubDetEnum GetSubdetectorEnum(unsigned long BitField)
Get the single subdetector that this track is from.
Definition: SubDetId.cxx:165

§ GetAntiNuMuParent()

Int_t anaUtils::GetAntiNuMuParent ( AnaTrueVertex trueVertex,
AnaTrack track 
)

Return the code for the "antinumuparent" category. Although this category is not one of the standard ones (it is added in antiNuMuCCAnalysis), the function is useful to have here as it is used in baseAnalysis::FillRedoSelectionVariables().

§ GetFgdModuleType()

Int_t anaUtils::GetFgdModuleType ( bool  IsMC,
const Float_t *  pos,
SubDetId::SubDetEnum  det,
bool  includeGlueSkin = true 
)

Return the module type in which the position is water module, 1st half XY layer, 2nd half XY layer, gaps should be empty

Definition at line 1330 of file ConstituentsUtils.cxx.

1330  {
1331 //********************************************************************
1332 
1333  if (det == SubDetId::kFGD1) std::cout << "FGD1 not supported" << std::endl;
1334  if ( ! anaUtils::InFiducialVolume(det,pos)) return 7; // here CATOUTFV is not known
1335  else return GetFgdModuleTypeNoFV(IsMC, pos, includeGlueSkin);
1336 }
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)

§ GetGlobalVertex()

AnaVertexB * anaUtils::GetGlobalVertex ( const AnaEventB event,
AnaTrackB **  Tracks,
int  nTracks 
)

An utility function that takes a set of tracks and returns a corresponding global vertex found in the event valid GV will be returned in case both tracks are its constituents (may be others), the first found will be returned note! it is assumed the GV for an event are ordered by PrimaryIndex, see TN-49

Definition at line 112 of file HighlandAnalysisUtils.cxx.

112  {
113 //*********************************************************
114  AnaVertexB* vertex = NULL;
115 
116  // Loop over vertices available in the event
117  for (int i = 0; i < event.nVertices; i++){
118 
119  if (!event.Vertices[i]) continue;
120 
121  int nMatch_tmp = 0;
122  int nTracks_tmp = 0;
123  bool tracks_loop = false;
124 
125  // Loop through vertex constituents
126  for (int j = 0; j < event.Vertices[i]->nParticles; j++){
127 
128  if (!event.Vertices[i]->Particles[j]) continue;
129 
130  // Loop through input tracks
131  for (int k = 0; k < nTracks; k++){
132  if (!Tracks[k]) continue;
133 
134  // Count valid tracks
135  if (!tracks_loop) nTracks_tmp++;
136 
137  // Check whether have the same objects, check UniqueID just in case some copying took place
138  // (probably redundunt)
139  if (event.Vertices[i]->Particles[j]->UniqueID == Tracks[k]->UniqueID)
140  nMatch_tmp++;
141  }
142 
143  tracks_loop = true;
144  }
145 
146  // Check whether all valid tracks provided belong to the vertex
147  if (nTracks_tmp == nMatch_tmp){
148  vertex = event.Vertices[i];
149  break;
150  }
151  }
152 
153  return vertex;
154 
155 }
AnaVertexB ** Vertices
The reconstructed objects in this bunch.
Int_t UniqueID
The UniqueID of this reconstructed object.
AnaParticleB ** Particles
Representation of a global vertex.

§ GetLocalDetEnum()

int anaUtils::GetLocalDetEnum ( SubDetId::SubDetEnum  det,
int  i 
)

Return an integer corresponding to the array index of the track in the old local detector enumeration.

Whether the ECal object is "contained" within the ECal volume. This is intended for deciding whether to trust the ECal EM energy or not. At the moment this is based on the start position of the shower. It will be updated to a more rigorous definition when production 5F files have been studied more closely.

§ GetMostUpstreamECalSegment()

AnaECALParticleB * anaUtils::GetMostUpstreamECalSegment ( AnaTrackB track)

Get the most upstream ECal component of a track, based on either the start or end position. Fill the pos variable with the position used. Return NULL if not found.

Definition at line 1288 of file ConstituentsUtils.cxx.

1288  {
1289 //********************************************************************
1290  AnaECALParticleB* upstream = NULL;
1291 
1292  Float_t pos_z = 1e4;
1293 
1294  if (track) {
1295  for (Int_t i = 0; i < track->nECALSegments; i++) {
1296  AnaECALParticleB* ecal = track->ECALSegments[i];
1297  if(!ecal) continue;
1298  if (ecal->PositionStart[2] < pos_z) {
1299  upstream = ecal;
1300  pos_z = ecal->PositionStart[2];
1301  }
1302  if (ecal->PositionEnd[2] < pos_z) {
1303  upstream = ecal;
1304  pos_z = ecal->PositionEnd[2];
1305  }
1306  }
1307  }
1308 
1309  return upstream;
1310 }
Float_t PositionStart[4]
The reconstructed start position of the particle.
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
Representation of an ECAL segment of a global track.
Float_t PositionEnd[4]
The reconstructed end position of the particle.

§ GetNMichelElectrons()

Int_t anaUtils::GetNMichelElectrons ( const AnaTrueVertexB trueVertex,
SubDetId::SubDetEnum  det = SubDetId::kFGD1 
)

Get the number of true michel electrons.

particles coming out the vertex

Definition at line 6 of file TruthUtils.cxx.

6  {
7  //**************************************************
8 
9  // out of FV
10  if ( ! InFiducialVolume(det, trueVertex.Position)) return -999;
11 
12  /// particles coming out the vertex
13  Int_t NMich=0;
14 
15  for (int tit = 0; tit < trueVertex.nTrueParticles; tit++) {
16  AnaTrueParticleB* true_track = trueVertex.TrueParticles[tit];
17 
18  //if not a pi+/-, a e+/-, a mu+/-
19  if( abs(true_track->GParentPDG)!=211) continue;
20  if( abs(true_track->ParentPDG)!=13 ) continue;
21  if( abs(true_track->PDG)!=11 ) continue;
22 
23  NMich++;
24  }
25 
26  // std::cout<<" nb of michel electrons "<<NMich << " " << trueVertex.nTrueParticles <<std::endl;
27 
28  return NMich;
29 }
int nTrueParticles
How many true particles are associated with this vertex.
Int_t GParentPDG
The PDG code of this particle&#39;s grandparent, or 0 if there is no grandparent.
AnaTrueParticleB ** TrueParticles
The true particles associated with this vertex.
Representation of a true Monte Carlo trajectory/particle.
Float_t Position[4]
The position the true interaction happened at.
Int_t PDG
The PDG code of this particle.
Int_t ParentPDG
The PDG code of this particle&#39;s immediate parent, or 0 if there is no parent.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)

§ GetPIDLikelihood()

Float_t anaUtils::GetPIDLikelihood ( const AnaTrackB track,
Int_t  hypo,
bool  prod5Cut = 0 
)

The likelihood of a track being a given particle hypothesis, based on the pull values of all TPC segments in the track.

hypo is one of:

  • 0 - muon
  • 1 - electron
  • 2 - proton
  • 3 - pion

Definition at line 180 of file PIDUtils.cxx.

180  {
181 //********************************************************************
182 
183  if( hypo >= 4 ) return -1.e+6;
184 
185  Float_t Likelihood[4];
186  GetPIDLikelihood(track,Likelihood,prod5Cut);
187  return Likelihood[hypo];
188 }
Float_t GetPIDLikelihood(const AnaTrackB &track, Int_t hypo, bool prod5Cut=0)
Definition: PIDUtils.cxx:180

§ GetPIDLikelihoodIncludingKaon()

Float_t anaUtils::GetPIDLikelihoodIncludingKaon ( const AnaTrackB track,
Int_t  hypo,
bool  prod5Cut = 0 
)

The likelihood of a track being a given particle hypothesis including kaons, based on the pull values of all TPC segments in the track.

hypo is one of:

  • 0 - muon
  • 1 - electron
  • 2 - proton
  • 3 - pion
  • 4 - kaon

Definition at line 130 of file HighlandPIDUtils.cxx.

130  {
131 //********************************************************************
132 
133  if( hypo >= 5 ) return -1.e+6;
134 
135  Float_t Likelihood[5];
136  GetPIDLikelihoodIncludingKaon(track,Likelihood,prod5Cut);
137  return Likelihood[hypo];
138 }
Float_t GetPIDLikelihoodIncludingKaon(const AnaTrackB &track, Int_t hypo, bool prod5Cut=0)

§ GetReactionSand()

Int_t anaUtils::GetReactionSand ( const AnaEventB event,
const AnaTrack track,
const SubDetId::SubDetEnum  det = SubDetId::kFGD1,
bool  IsAntinu = false 
)

Classify reaction types, Returns the same codes as GetReaction(), except for no '8', which corresponds to sand muons

§ GetRunPeriod()

Int_t anaUtils::GetRunPeriod ( int  run,
int  subrun = -1 
)

Returns the run period (sequentially: 0,1,2,3,4,5 ...)

Whether the ECal object is "contained" within the ECal volume. This is intended for deciding whether to trust the ECal EM energy or not. At the moment this is based on the start position of the shower. It will be updated to a more rigorous definition when production 5F files have been studied more closely.

Definition at line 17 of file ND280AnalysisUtils.cxx.

17  {
18 //**************************************************
19 
20  if ( run<6000) return 0;//run1 water
21  else if (run>=6462 && run<7664) return 1;//run2 water
22  else if (run>=7665 && run<7754) return 2;//run2 air
23  else if (run>=8000 && run<8550) return 3;//run3b air => mc associated to be the one of run2
24  else if (run>=8550 && run<8800) return 4;//run3c air
25  else if (run>=8983 && run<9414) return 5;//run4 water
26  else if (run>=9426 && run<9800) return 6;//run4 air
27  else if ((run>=10252 && run<10334) // + 10252_10 to 10333
28  || (run>=10519 && run<10522)) return 7;//run5 water + 10518_28 to 10521_13
29  else if (run>=10334 && run<10518) return 8;//run5 water (ANTINU) up to 10334_11 to 10518_9
30  else if (run == 10518){
31  if(subrun < 10) return 8; //run5 water (ANTINU)
32  else return 7; //run5 water
33  }
34  else if (run>=10828 && run<10954) return 13; //run6 air
35  else if (run == 10954){
36  if(subrun > -1 && subrun < 10) return 13; //run6 air
37  else return 9; // run6b air (ANTINU)
38  }
39  else if (run>=10955 && run<11240) return 9;//run6b air (ANTINU)
40  else if (run>=11305 && run<11443) return 13; //run6 air
41  else if (run>=11449 && run<11492) return 10;//run6c air (ANTINU)
42  else if (run>=11492 && run<11564) return 11;//run6d air (ANTINU)
43  else if (run>=11619 && run<11687) return 12;//run6e air (ANTINU)
44  else if (run == 11687){
45  if(subrun < 7) return 12;//run6e air (ANTINU)
46  else return 13; //run6 air
47  }
48 
49  else if (run>=90110000 && run<=90119999) return 0;//run1 water
50  else if (run>=90210000 && run<=90219999) return 1;//run2 water
51  else if (run>=90200000 && run<=90209999) return 2;//run2 air
52  else if (run>=90300000 && run<=90300015) return 3;//run3b air separated based on the pot of data (run3b/(run3b+run3c)=0.13542
53  else if (run>=90300016 && run<=90300110) return 4;//run3c air separated based on the pot of data
54  else if (run>=90410000 && run<=90419999) return 5;//run4 water
55  else if (run>=90400000 && run<=90409999) return 6;//run4 air
56  else if (run>=80510000 && run<=80519999) return 8;//run5 antinu-water
57  else if (run>=80600000 && run<=80600159) return 9;//run6b antinu-air
58  else if (run>=80600160 && run<=80600219) return 10;//run6c antinu-air - have to split Run 6 due to different flux tunings for the different parts
59  else if (run>=80600220 && run<=80600299) return 11;//run6d antinu-air
60  else if (run>=80600300 && run<=80600399) return 12;//run6e antinu-air
61  else if (run>=80600400 && run<=80609999) return 12;//run6e antinu-air - set this as default, to catch any files that are not currently at TRIUMF
62 
63  else if (run>=80307000 && run<=80307999) return 8;//sand muons antinu
64  else if (run>=90307000 && run<=90307999) return 4;//sand muons neut
65  else if (run>=92307000 && run<=92307999) return 4;//sand muons old neut
66 
67  // genie
68  else if (run>=91110000 && run<=91119999) return 0;//run1 water
69  else if (run>=91210000 && run<=91219999) return 1;//run2 water
70  else if (run>=91200000 && run<=91209999) return 2;//run2 air
71  else if (run>=91300000 && run<=91300015) return 3;//run3 air separated based on the pot of data (run3b/(run3b+run3c)=0.13542
72  else if (run>=91300016 && run<=91300110) return 4;//run3 air separated based on the pot of data (run3b/(run3b+run3c)=0.13542
73  else if (run>=91410000 && run<=91419999) return 5;//run4 water
74  else if (run>=91400000 && run<=91409999) return 6;//run4 air
75  else if (run>=81510000 && run<=81519999) return 8;//run5 antinu-water
76  else if (run>=81600000 && run<=81600159) return 9;//run6b antinu-air
77  else if (run>=81600160 && run<=81600219) return 10;//run6c antinu-air - have to split Run 6 due to different flux tunings for the different parts
78  else if (run>=81600220 && run<=81600299) return 11;//run6d antinu-air
79  else if (run>=81600300 && run<=81600399) return 12;//run6e antinu-air
80  else if (run>=81600400 && run<=81609999) return 12;//run6e antinu-air - set this as default, to catch any files that are not currently at TRIUMF
81  else return -1;
82 
83 }

§ GetSegmentInDet()

AnaParticleB * anaUtils::GetSegmentInDet ( const AnaTrackB track,
SubDetId::SubDetEnum  det 
)

Get the AnaParticle segment that uses the specified detector. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 325 of file ConstituentsUtils.cxx.

325  {
326 //**************************************************
327 
328  if(SubDetId::IsTPCDetector(det)){
329  for(int i = 0; i < track.nTPCSegments; ++i){
330  AnaTPCParticleB* tpc_track = track.TPCSegments[i];
331  if(SubDetId::GetDetectorUsed(tpc_track->Detector, det)){
332  return tpc_track;
333  }
334  }
335  }
336 
337  if(SubDetId::IsFGDDetector(det)){
338  for(int i = 0; i < track.nFGDSegments; ++i){
339  AnaFGDParticleB* fgd_track = track.FGDSegments[i];
340  if(SubDetId::GetDetectorUsed(fgd_track->Detector, det)){
341  return fgd_track;
342  }
343  }
344  }
345 
346  if(SubDetId::IsP0DDetector(det)){
347  for(int i = 0; i < track.nP0DSegments; ++i){
348  AnaP0DParticleB* p0d_track = track.P0DSegments[i];
349  if(SubDetId::GetDetectorUsed(p0d_track->Detector, det)){
350  return p0d_track;
351  }
352  }
353  }
354 
355  if(SubDetId::IsECALDetector(det)){
356  for(int i = 0; i < track.nECALSegments; ++i){
357  AnaECALParticleB* ecal_track = track.ECALSegments[i];
358  if(SubDetId::GetDetectorUsed(ecal_track->Detector, det)){
359  return ecal_track;
360  }
361  }
362  }
363 
364  if(SubDetId::IsSMRDDetector(det)){
365  for(int i = 0; i < track.nSMRDSegments; ++i){
366  AnaSMRDParticleB* smrd_track = track.SMRDSegments[i];
367  if(SubDetId::GetDetectorUsed(smrd_track->Detector, det)){
368  return smrd_track;
369  }
370  }
371  }
372  return NULL;
373 }
int nP0DSegments
How many P0D tracks are associated with this track.
AnaP0DParticleB * P0DSegments[NMAXP0DS]
The P0D segments that contributed to this global track.
unsigned long Detector
static bool IsFGDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a FGD or not.
Definition: SubDetId.cxx:126
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
AnaSMRDParticleB * SMRDSegments[NMAXSMRDS]
The SMRD segments that contributed to this global track.
static bool IsP0DDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRDP0D or not.
Definition: SubDetId.cxx:146
Representation of an ECAL segment of a global track.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
int nSMRDSegments
How many SMRD tracks are associated with this track.
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of an SMRD segment of a global track.
static bool IsTPCDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a TPC or not.
Definition: SubDetId.cxx:122
static bool IsECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a ECAL or not.
Definition: SubDetId.cxx:130
Representation of a TPC segment of a global track.
Representation of a FGD segment of a global track.
int nFGDSegments
How many FGD tracks are associated with this track.
Representation of a P0D segment of a global track.
AnaFGDParticleB * FGDSegments[NMAXFGDS]
The FGD segments that contributed to this global track.
static bool IsSMRDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRD or not.
Definition: SubDetId.cxx:142

§ GetSegmentsInDet()

int anaUtils::GetSegmentsInDet ( const AnaTrackB track,
SubDetId::SubDetEnum  det,
AnaParticleB selTracks[] 
)

Get the vector of AnaParticle segment that uses the specified detector. See SubDetId::SubDetEnum for the detector numbering convention. Return the number of entries in the input array, the number of tracks found

Definition at line 71 of file ConstituentsUtils.cxx.

71  {
72 //**************************************************
73  if (det == SubDetId::kInvalid) {
74  return 0;
75  }
76  if(!SubDetId::GetDetectorUsed(track.Detector, det)){
77  return 0;
78  }
79 
80  int count = 0;
81 
82  // Return segments for complete detector subsystems (all TPC etc.) first
83  switch(det){
84  case SubDetId::kTPC :
85  std::copy(&track.TPCSegments[0], &track.TPCSegments[track.nTPCSegments], segments);
86  return track.nTPCSegments;
87  break;
88  case SubDetId::kFGD :
89  std::copy(&track.FGDSegments[0], &track.FGDSegments[track.nFGDSegments], segments);
90  return track.nFGDSegments;
91  break;
92 
93  case SubDetId::kECAL :
94  std::copy(&track.ECALSegments[0], &track.ECALSegments[track.nECALSegments], segments);
95  return track.nECALSegments;
96  break;
97 
98  case SubDetId::kSMRD :
99  std::copy(&track.SMRDSegments[0], &track.SMRDSegments[track.nSMRDSegments], segments);
100  return track.nSMRDSegments;
101  break;
102 
103  case SubDetId::kP0D :
104  std::copy(&track.P0DSegments[0], &track.P0DSegments[track.nP0DSegments], segments);
105  return track.nP0DSegments;
106  break;
107  default:
108 
109  if(SubDetId::IsTPCDetector(det)){
110  for(int i = 0; i < track.nTPCSegments; ++i){
111  AnaTPCParticleB* tpc_track = track.TPCSegments[i];
112  if(SubDetId::GetDetectorUsed(tpc_track->Detector, det)){
113  segments[count] = tpc_track;
114  ++count;
115  }
116  }
117  }
118  else if(SubDetId::IsFGDDetector(det)){
119  for(int i = 0; i < track.nFGDSegments; ++i){
120  AnaFGDParticleB* fgd_track = track.FGDSegments[i];
121  if(SubDetId::GetDetectorUsed(fgd_track->Detector, det)){
122  segments[count] = fgd_track;
123  ++count;
124  }
125  }
126  }
127  else if(SubDetId::IsECALDetector(det)){
128  for(int i = 0; i < track.nECALSegments; ++i){
129  AnaECALParticleB* ecal_track = track.ECALSegments[i];
130  if(SubDetId::GetDetectorUsed(ecal_track->Detector, det)){
131  segments[count] = ecal_track;
132  ++count;
133  }
134  }
135  }
136  else if(SubDetId::IsSMRDDetector(det)){
137  for(int i = 0; i < track.nSMRDSegments; ++i){
138  AnaSMRDParticleB* smrd_track = track.SMRDSegments[i];
139  if(SubDetId::GetDetectorUsed(smrd_track->Detector, det)){
140  segments[count] = smrd_track;
141  ++count;
142  }
143  }
144  }
145  return count;
146  }
147  return count;
148 }
int nP0DSegments
How many P0D tracks are associated with this track.
AnaP0DParticleB * P0DSegments[NMAXP0DS]
The P0D segments that contributed to this global track.
unsigned long Detector
static bool IsFGDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a FGD or not.
Definition: SubDetId.cxx:126
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
AnaSMRDParticleB * SMRDSegments[NMAXSMRDS]
The SMRD segments that contributed to this global track.
Representation of an ECAL segment of a global track.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
int nSMRDSegments
How many SMRD tracks are associated with this track.
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of an SMRD segment of a global track.
static bool IsTPCDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a TPC or not.
Definition: SubDetId.cxx:122
static bool IsECALDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a ECAL or not.
Definition: SubDetId.cxx:130
Representation of a TPC segment of a global track.
Representation of a FGD segment of a global track.
int nFGDSegments
How many FGD tracks are associated with this track.
AnaFGDParticleB * FGDSegments[NMAXFGDS]
The FGD segments that contributed to this global track.
static bool IsSMRDDetector(SubDetId::SubDetEnum det)
Check if a detector enumeration refers to a SMRD or not.
Definition: SubDetId.cxx:142

§ GetTopology()

Int_t anaUtils::GetTopology ( const AnaTrueVertex trueVertex,
const SubDetId::SubDetEnum  det = SubDetId::kFGD1,
bool  IsAntinu = false 
)

Classify reaction topologies.

primary particles from the true vertex

Definition at line 145 of file CategoriesUtils.cxx.

145  {
146 //**************************************************
147 
148  /* Classify reaction types
149  -1 = no true vertex
150  0 = CC 0pi = mu + X nucleons (+ 0 mesons)
151  1 = CC 1pi+(-) = mu + X nucleons + 1 pion +(-)
152  2 = CC other
153  3 = BKG: not (anti-)numu, NC
154  7 = out of FV
155  */
156 
157  // out of FGD1 FV
158  if ( ! anaUtils::InFiducialVolume(det,trueVertex.Position)) return CATOUTFV;
159 
160  /// primary particles from the true vertex
161  Int_t Nmuon = trueVertex.NPrimaryParticles[ParticleId::kMuon];
162  Int_t Nantimuon = trueVertex.NPrimaryParticles[ParticleId::kAntiMuon];
163  Int_t Nmeson = trueVertex.NPrimaryParticles[ParticleId::kMesons];
164  Int_t Npipos = trueVertex.NPrimaryParticles[ParticleId::kPiPos];
165  Int_t Npineg = trueVertex.NPrimaryParticles[ParticleId::kPiNeg];
166 
167  // non numu CC, i.e. BKG
168  if ( ! IsAntinu && Nmuon <= 0) return BKG; // BKG
169  if (IsAntinu && Nantimuon <= 0) return BKG; // BKG
170 
171  // CC 0pi, i.e. mu & 0 mesons
172  if (Nmeson == 0) return CC_0pi_0meson;
173 
174  // CC 1pi+, i.e. mu & 1 pi & no other mesons
175  if (Nmeson == 1) {
176  if ( ! IsAntinu && Npipos == 1) return CC_1pi_0meson;
177  else if (IsAntinu && Npineg == 1) return CC_1pi_0meson;
178  }
179 
180  // CC other
181  return CC_other;
182 }
Float_t Position[4]
The position the true interaction happened at.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
Int_t NPrimaryParticles[Int_t(ParticleId::kLast)+1]
Array to count the outgoing primary particles of each type (.

§ GetTrackerDsEcals()

int anaUtils::GetTrackerDsEcals ( AnaTrackB track,
AnaECALParticleB selTracks[] 
)

Get the Tracker ECal and DsECal segments from the given track. Returns the number of entries in the input array, the number of tracks found

Definition at line 1262 of file ConstituentsUtils.cxx.

1262  {
1263 //********************************************************************
1264 
1265  int count = 0;
1266  for (Int_t i = 0; i < track->nECALSegments; i++) {
1267  AnaECALParticleB* ecal = track->ECALSegments[i];
1268  if (SubDetId::GetDetectorUsed(ecal->Detector, SubDetId::kTECAL) || SubDetId::GetDetectorUsed(ecal->Detector, SubDetId::kDSECAL)) {
1269  ecals[count] = ecal;
1270  count ++;
1271  }
1272  }
1273 
1274  return count;
1275 }
unsigned long Detector
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
int nECALSegments
How many ECAL tracks are associated with this track.
Representation of an ECAL segment of a global track.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40

§ InDetVolume()

bool anaUtils::InDetVolume ( SubDetId::SubDetEnum  det,
const Float_t *  pos 
)

Whether the specified position is in the volume of the given detector. Accepted detectors are kFGD1, kFGD2, kP0D, kDSECal, k(Top, Bottom, Left, Right)T(P)ECal (or SMRD)

Definition at line 387 of file ConstituentsUtils.cxx.

387  {
388 //**************************************************
389 
390  Float_t null[3] = {0.,0.,0.};
391 
392  //account for a case when a "general" volume is provided
393  switch(det){
394  case SubDetId::kFGD:
395  return (InFiducialVolume(SubDetId::kFGD1, pos, null, null) || InFiducialVolume(SubDetId::kFGD2, pos, null, null));
396  break;
397  case SubDetId::kFGD1:
398  return anaUtils::InFiducialVolume(SubDetId::kFGD1, pos, null, null);
399  break;
400  case SubDetId::kFGD2:
401  return anaUtils::InFiducialVolume(SubDetId::kFGD2, pos, null, null);
402  break;
403  case SubDetId::kTPC:
404  return (
405  InFiducialVolume(SubDetId::kTPC1, pos, null, null) ||
406  InFiducialVolume(SubDetId::kTPC2, pos, null, null) ||
407  InFiducialVolume(SubDetId::kTPC3, pos, null, null)
408  );
409  break;
410  case SubDetId::kTPC1:
411  return anaUtils::InFiducialVolume(SubDetId::kTPC1, pos, null, null);
412  break;
413  case SubDetId::kTPC2:
414  return anaUtils::InFiducialVolume(SubDetId::kTPC2, pos, null, null);
415  break;
416  case SubDetId::kTPC3:
417  return anaUtils::InFiducialVolume(SubDetId::kTPC3, pos, null, null);
418  break;
419  case SubDetId::kP0D:
420  return anaUtils::InFiducialVolume(SubDetId::kP0D, pos, null, null);
421  break;
422  case SubDetId::kECAL:
423  return (
424  anaUtils::InFiducialVolume(SubDetId::kTopTECAL, pos, null, null) ||
425  anaUtils::InFiducialVolume(SubDetId::kBottomTECAL, pos, null, null) ||
426  anaUtils::InFiducialVolume(SubDetId::kLeftTECAL, pos, null, null) ||
427  anaUtils::InFiducialVolume(SubDetId::kRightTECAL, pos, null, null) ||
428  anaUtils::InFiducialVolume(SubDetId::kTopPECAL, pos, null, null) ||
429  anaUtils::InFiducialVolume(SubDetId::kBottomPECAL, pos, null, null) ||
430  anaUtils::InFiducialVolume(SubDetId::kLeftPECAL, pos, null, null) ||
431  anaUtils::InFiducialVolume(SubDetId::kRightPECAL, pos, null, null) ||
432  anaUtils::InFiducialVolume(SubDetId::kDSECAL, pos, null, null)
433  );
434  break;
435  case SubDetId::kTECAL:
436  return (
437  anaUtils::InFiducialVolume(SubDetId::kTopTECAL, pos, null, null) ||
438  anaUtils::InFiducialVolume(SubDetId::kBottomTECAL, pos, null, null) ||
439  anaUtils::InFiducialVolume(SubDetId::kLeftTECAL, pos, null, null) ||
440  anaUtils::InFiducialVolume(SubDetId::kRightTECAL, pos, null, null)
441  );
442  break;
443  case SubDetId::kTopTECAL:
444  return anaUtils::InFiducialVolume(SubDetId::kTopTECAL, pos, null, null);
445  break;
446  case SubDetId::kBottomTECAL:
447  return anaUtils::InFiducialVolume(SubDetId::kBottomTECAL, pos, null, null);
448  break;
449  case SubDetId::kLeftTECAL:
450  return anaUtils::InFiducialVolume(SubDetId::kLeftTECAL, pos, null, null);
451  break;
452  case SubDetId::kRightTECAL:
453  return anaUtils::InFiducialVolume(SubDetId::kRightTECAL, pos, null, null);
454  break;
455  case SubDetId::kPECAL:
456  return (
457  anaUtils::InFiducialVolume(SubDetId::kTopPECAL, pos, null, null) ||
458  anaUtils::InFiducialVolume(SubDetId::kBottomPECAL, pos, null, null) ||
459  anaUtils::InFiducialVolume(SubDetId::kLeftPECAL, pos, null, null) ||
460  anaUtils::InFiducialVolume(SubDetId::kRightPECAL, pos, null, null)
461  );
462  break;
463  case SubDetId::kTopPECAL:
464  return anaUtils::InFiducialVolume(SubDetId::kTopPECAL, pos, null, null);
465  break;
466  case SubDetId::kBottomPECAL:
467  return anaUtils::InFiducialVolume(SubDetId::kBottomPECAL, pos, null, null);
468  break;
469  case SubDetId::kLeftPECAL:
470  return anaUtils::InFiducialVolume(SubDetId::kLeftPECAL, pos, null, null);
471  break;
472  case SubDetId::kRightPECAL:
473  return anaUtils::InFiducialVolume(SubDetId::kRightPECAL, pos, null, null);
474  break;
475  case SubDetId::kSMRD:
476  return (
477  anaUtils::InFiducialVolume(SubDetId::kTopSMRD, pos, null, null) ||
478  anaUtils::InFiducialVolume(SubDetId::kBottomSMRD, pos, null, null) ||
479  anaUtils::InFiducialVolume(SubDetId::kLeftSMRD, pos, null, null) ||
480  anaUtils::InFiducialVolume(SubDetId::kRightSMRD, pos, null, null)
481  );
482  break;
483  case SubDetId::kTopSMRD:
484  return anaUtils::InFiducialVolume(SubDetId::kTopSMRD, pos, null, null);
485  break;
486  case SubDetId::kBottomSMRD:
487  return anaUtils::InFiducialVolume(SubDetId::kBottomSMRD, pos, null, null);
488  break;
489  case SubDetId::kLeftSMRD:
490  return anaUtils::InFiducialVolume(SubDetId::kLeftSMRD, pos, null, null);
491  break;
492  case SubDetId::kRightSMRD:
493  return anaUtils::InFiducialVolume(SubDetId::kRightSMRD, pos, null, null);
494  break;
495  case SubDetId::kDSECAL:
496  return anaUtils::InFiducialVolume(SubDetId::kDSECAL, pos, null, null);
497  break;
498  default:
499  std::cout << "Warning: anaUtils::InDetVolume() No Volume set for " << det << std::endl;
500  return false;
501  break;
502  }
503 
504 }
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)

§ InFiducialVolume()

bool anaUtils::InFiducialVolume ( SubDetId::SubDetEnum  det,
const Float_t *  pos,
const Float_t *  FVdefmin,
const Float_t *  FVdefmax 
)

Whether the specified position is in the fiducial volume of the given detector. Accepted detectors are kFGD1, kFGD2, kP0D, kDSECal, k(Top, Bottom, Left, Right)T(P)ECal (or SMRD) The fiducial volume is specified using the FVdefmin and FVdefmax vectors. These vectors are the amount of space to exclude, compared to the nominal side of the detector.

Definition at line 628 of file ConstituentsUtils.cxx.

628  {
629 //**************************************************
630 
631  switch(det){
632  case SubDetId::kFGD1:
633  if (pos[0] > DetDef::fgd1min[0]+FVdefmin[0] &&
634  pos[0] < DetDef::fgd1max[0]-FVdefmax[0] &&
635  pos[1] > DetDef::fgd1min[1]+FVdefmin[1] &&
636  pos[1] < DetDef::fgd1max[1]-FVdefmax[1] &&
637  pos[2] > DetDef::fgd1min[2]+FVdefmin[2] &&
638  pos[2] < DetDef::fgd1max[2]-FVdefmax[2])
639  return true;
640  break;
641  case SubDetId::kFGD2:
642  if (pos[0] > DetDef::fgd2min[0]+FVdefmin[0] &&
643  pos[0] < DetDef::fgd2max[0]-FVdefmax[0] &&
644  pos[1] > DetDef::fgd2min[1]+FVdefmin[1] &&
645  pos[1] < DetDef::fgd2max[1]-FVdefmax[1] &&
646  pos[2] > DetDef::fgd2min[2]+FVdefmin[2] &&
647  pos[2] < DetDef::fgd2max[2]-FVdefmax[2])
648  return true;
649  break;
650  case SubDetId::kTPC1:
651  if (pos[0] > DetDef::tpc1min[0]+FVdefmin[0] &&
652  pos[0] < DetDef::tpc1max[0]-FVdefmax[0] &&
653  pos[1] > DetDef::tpc1min[1]+FVdefmin[1] &&
654  pos[1] < DetDef::tpc1max[1]-FVdefmax[1] &&
655  pos[2] > DetDef::tpc1min[2]+FVdefmin[2] &&
656  pos[2] < DetDef::tpc1max[2]-FVdefmax[2])
657  return true;
658  break;
659  case SubDetId::kTPC2:
660  if (pos[0] > DetDef::tpc2min[0]+FVdefmin[0] &&
661  pos[0] < DetDef::tpc2max[0]-FVdefmax[0] &&
662  pos[1] > DetDef::tpc2min[1]+FVdefmin[1] &&
663  pos[1] < DetDef::tpc2max[1]-FVdefmax[1] &&
664  pos[2] > DetDef::tpc2min[2]+FVdefmin[2] &&
665  pos[2] < DetDef::tpc2max[2]-FVdefmax[2])
666  return true;
667  break;
668  case SubDetId::kTPC3:
669  if (pos[0] > DetDef::tpc3min[0]+FVdefmin[0] &&
670  pos[0] < DetDef::tpc3max[0]-FVdefmax[0] &&
671  pos[1] > DetDef::tpc3min[1]+FVdefmin[1] &&
672  pos[1] < DetDef::tpc3max[1]-FVdefmax[1] &&
673  pos[2] > DetDef::tpc3min[2]+FVdefmin[2] &&
674  pos[2] < DetDef::tpc3max[2]-FVdefmax[2])
675  return true;
676  break;
677  case SubDetId::kP0D:
678  if (pos[0] > DetDef::p0dmin[0]+FVdefmin[0] &&
679  pos[0] < DetDef::p0dmax[0]-FVdefmax[0] &&
680  pos[1] > DetDef::p0dmin[1]+FVdefmin[1] &&
681  pos[1] < DetDef::p0dmax[1]-FVdefmax[1] &&
682  pos[2] > DetDef::p0dmin[2]+FVdefmin[2] &&
683  pos[2] < DetDef::p0dmax[2]-FVdefmax[2])
684  return true;
685  break;
686  //DsECal (Ecal)
687  case SubDetId::kDSECAL:
688  if (pos[0] > DetDef::dsecalmin[0]+FVdefmin[0] &&
689  pos[0] < DetDef::dsecalmax[0]-FVdefmax[0] &&
690  pos[1] > DetDef::dsecalmin[1]+FVdefmin[1] &&
691  pos[1] < DetDef::dsecalmax[1]-FVdefmax[1] &&
692  pos[2] > DetDef::dsecalmin[2]+FVdefmin[2] &&
693  pos[2] < DetDef::dsecalmax[2]-FVdefmax[2])
694  return true;
695  break;
696  //BarrelECal (TEcal)
697  case SubDetId::kLeftTECAL:
698  if (pos[0] > DetDef::tecalLmin[0]+FVdefmin[0] &&
699  pos[0] < DetDef::tecalLmax[0]-FVdefmax[0] &&
700  pos[1] > DetDef::tecalLmin[1]+FVdefmin[1] &&
701  pos[1] < DetDef::tecalLmax[1]-FVdefmax[1] &&
702  pos[2] > DetDef::tecalLmin[2]+FVdefmin[2] &&
703  pos[2] < DetDef::tecalLmax[2]-FVdefmax[2])
704  return true;
705  break;
706  case SubDetId::kRightTECAL:
707  if (pos[0] > DetDef::tecalRmin[0]+FVdefmin[0] &&
708  pos[0] < DetDef::tecalRmax[0]-FVdefmax[0] &&
709  pos[1] > DetDef::tecalRmin[1]+FVdefmin[1] &&
710  pos[1] < DetDef::tecalRmax[1]-FVdefmax[1] &&
711  pos[2] > DetDef::tecalRmin[2]+FVdefmin[2] &&
712  pos[2] < DetDef::tecalRmax[2]-FVdefmax[2])
713  return true;
714  break;
715  case SubDetId::kTopTECAL:
716  if (pos[0] > DetDef::tecalTLmin[0]+FVdefmin[0] &&
717  pos[0] < DetDef::tecalTLmax[0]-FVdefmax[0] &&
718  pos[1] > DetDef::tecalTLmin[1]+FVdefmin[1] &&
719  pos[1] < DetDef::tecalTLmax[1]-FVdefmax[1] &&
720  pos[2] > DetDef::tecalTLmin[2]+FVdefmin[2] &&
721  pos[2] < DetDef::tecalTLmax[2]-FVdefmax[2])
722  return true;
723  //two parts symmetric w.r.t to Z axis
724  if (pos[0] > DetDef::tecalTRmin[0]+FVdefmax[0] &&
725  pos[0] < DetDef::tecalTRmax[0]-FVdefmin[0] &&
726  pos[1] > DetDef::tecalTRmin[1]+FVdefmin[1] &&
727  pos[1] < DetDef::tecalTRmax[1]-FVdefmax[1] &&
728  pos[2] > DetDef::tecalTRmin[2]+FVdefmin[2] &&
729  pos[2] < DetDef::tecalTRmax[2]-FVdefmax[2])
730  return true;
731  break;
732  case SubDetId::kBottomTECAL:
733  if (pos[0] > DetDef::tecalBLmin[0]+FVdefmin[0] &&
734  pos[0] < DetDef::tecalBLmax[0]-FVdefmax[0] &&
735  pos[1] > DetDef::tecalBLmin[1]+FVdefmin[1] &&
736  pos[1] < DetDef::tecalBLmax[1]-FVdefmax[1] &&
737  pos[2] > DetDef::tecalBLmin[2]+FVdefmin[2] &&
738  pos[2] < DetDef::tecalBLmax[2]-FVdefmax[2])
739  return true;
740  //two parts symmetric w.r.t to Z axis
741  if (pos[0] > DetDef::tecalBRmin[0]+FVdefmax[0] &&
742  pos[0] < DetDef::tecalBRmax[0]-FVdefmin[0] &&
743  pos[1] > DetDef::tecalBRmin[1]+FVdefmin[1] &&
744  pos[1] < DetDef::tecalBRmax[1]-FVdefmax[1] &&
745  pos[2] > DetDef::tecalBRmin[2]+FVdefmin[2] &&
746  pos[2] < DetDef::tecalBRmax[2]-FVdefmax[2])
747  return true;
748  break;
749  //P0DECal (PEcal)
750  case SubDetId::kLeftPECAL:
751  if (pos[0] > DetDef::pecalLmin[0]+FVdefmin[0] &&
752  pos[0] < DetDef::pecalLmax[0]-FVdefmax[0] &&
753  pos[1] > DetDef::pecalLmin[1]+FVdefmin[1] &&
754  pos[1] < DetDef::pecalLmax[1]-FVdefmax[1] &&
755  pos[2] > DetDef::pecalLmin[2]+FVdefmin[2] &&
756  pos[2] < DetDef::pecalLmax[2]-FVdefmax[2])
757  return true;
758  break;
759  case SubDetId::kRightPECAL:
760  if (pos[0] > DetDef::pecalRmin[0]+FVdefmin[0] &&
761  pos[0] < DetDef::pecalRmax[0]-FVdefmax[0] &&
762  pos[1] > DetDef::pecalRmin[1]+FVdefmin[1] &&
763  pos[1] < DetDef::pecalRmax[1]-FVdefmax[1] &&
764  pos[2] > DetDef::pecalRmin[2]+FVdefmin[2] &&
765  pos[2] < DetDef::pecalRmax[2]-FVdefmax[2])
766  return true;
767  break;
768  case SubDetId::kTopPECAL:
769  if (pos[0] > DetDef::pecalTLmin[0]+FVdefmin[0] &&
770  pos[0] < DetDef::pecalTLmax[0]-FVdefmax[0] &&
771  pos[1] > DetDef::pecalTLmin[1]+FVdefmin[1] &&
772  pos[1] < DetDef::pecalTLmax[1]-FVdefmax[1] &&
773  pos[2] > DetDef::pecalTLmin[2]+FVdefmin[2] &&
774  pos[2] < DetDef::pecalTLmax[2]-FVdefmax[2])
775  return true;
776  //two parts symmetric w.r.t to Z axis
777  if (pos[0] > DetDef::pecalTRmin[0]+FVdefmax[0] &&
778  pos[0] < DetDef::pecalTRmax[0]-FVdefmin[0] &&
779  pos[1] > DetDef::pecalTRmin[1]+FVdefmin[1] &&
780  pos[1] < DetDef::pecalTRmax[1]-FVdefmax[1] &&
781  pos[2] > DetDef::pecalTRmin[2]+FVdefmin[2] &&
782  pos[2] < DetDef::pecalTRmax[2]-FVdefmax[2])
783  return true;
784  break;
785 
786  case SubDetId::kBottomPECAL:
787  if (pos[0] > DetDef::pecalBLmin[0]+FVdefmin[0] &&
788  pos[0] < DetDef::pecalBLmax[0]-FVdefmax[0] &&
789  pos[1] > DetDef::pecalBLmin[1]+FVdefmin[1] &&
790  pos[1] < DetDef::pecalBLmax[1]-FVdefmax[1] &&
791  pos[2] > DetDef::pecalBLmin[2]+FVdefmin[2] &&
792  pos[2] < DetDef::pecalBLmax[2]-FVdefmax[2])
793  return true;
794  //two parts symmetric w.r.t to Z axis
795  if (pos[0] > DetDef::pecalBRmin[0]+FVdefmax[0] &&
796  pos[0] < DetDef::pecalBRmax[0]-FVdefmin[0] &&
797  pos[1] > DetDef::pecalBRmin[1]+FVdefmin[1] &&
798  pos[1] < DetDef::pecalBRmax[1]-FVdefmax[1] &&
799  pos[2] > DetDef::pecalBRmin[2]+FVdefmin[2] &&
800  pos[2] < DetDef::pecalBRmax[2]-FVdefmax[2])
801  return true;
802  break;
803  //SMRD
804  case SubDetId::kLeftSMRD:
805  if (pos[1] > DetDef::smrd15Lmin[1]+FVdefmin[1] &&
806  pos[1] < DetDef::smrd15Lmax[1]-FVdefmax[1] &&
807  pos[2] > DetDef::smrd15Lmin[2]+FVdefmin[2] &&
808  pos[2] < DetDef::smrd78Lmax[2]-FVdefmax[2]){
809 
810  if (pos[2] > DetDef::smrd15Lmin[2] &&
811  pos[2] < DetDef::smrd6Lmin[2] &&
812  pos[0] > DetDef::smrd15Lmin[0]+FVdefmin[0] &&
813  pos[0] < DetDef::smrd15Lmax[0]-FVdefmax[0])
814  return true;
815 
816  if (pos[2] > DetDef::smrd6Lmin[2] &&
817  pos[2] < DetDef::smrd78Lmin[2] &&
818  pos[0] > DetDef::smrd6Lmin[0]+FVdefmin[0] &&
819  pos[0] < DetDef::smrd6Lmax[0]-FVdefmax[0])
820  return true;
821 
822  if (pos[2] > DetDef::smrd78Lmin[2] &&
823  pos[2] < DetDef::smrd78Lmax[2] &&
824  pos[0] > DetDef::smrd78Lmin[0]+FVdefmin[0] &&
825  pos[0] < DetDef::smrd78Lmax[0]-FVdefmax[0])
826  return true;
827  }
828  break;
829 
830  case SubDetId::kRightSMRD:
831  if (pos[1] > DetDef::smrd15Rmin[1]+FVdefmin[1] &&
832  pos[1] < DetDef::smrd15Rmax[1]-FVdefmax[1] &&
833  pos[2] > DetDef::smrd15Rmin[2]+FVdefmin[2] &&
834  pos[2] < DetDef::smrd78Rmax[2]-FVdefmax[2]){
835 
836  if (pos[2] > DetDef::smrd15Rmin[2] &&
837  pos[2] < DetDef::smrd6Rmin[2] &&
838  pos[0] > DetDef::smrd15Rmin[0]+FVdefmin[0] &&
839  pos[0] < DetDef::smrd15Rmax[0]-FVdefmax[0])
840  return true;
841 
842  if (pos[2] > DetDef::smrd6Rmin[2] &&
843  pos[2] < DetDef::smrd78Rmin[2] &&
844  pos[0] > DetDef::smrd6Rmin[0]+FVdefmin[0] &&
845  pos[0] < DetDef::smrd6Rmax[0]-FVdefmax[0])
846  return true;
847 
848  if (pos[2] > DetDef::smrd78Rmin[2] &&
849  pos[2] < DetDef::smrd78Rmax[2] &&
850  pos[0] > DetDef::smrd78Rmin[0]+FVdefmin[0] &&
851  pos[0] < DetDef::smrd78Rmax[0]-FVdefmax[0])
852  return true;
853  }
854  break;
855  case SubDetId::kTopSMRD:
856  if (pos[0] > DetDef::smrdTLmin[0]+FVdefmin[0] &&
857  pos[0] < DetDef::smrdTLmax[0]-FVdefmax[0] &&
858  pos[1] > DetDef::smrdTLmin[1]+FVdefmin[1] &&
859  pos[1] < DetDef::smrdTLmax[1]-FVdefmax[1] &&
860  pos[2] > DetDef::smrdTLmin[2]+FVdefmin[2] &&
861  pos[2] < DetDef::smrdTLmax[2]-FVdefmax[2])
862  return true;
863  //two parts symmetric w.r.t to Z axis
864  if (pos[0] > DetDef::smrdTRmin[0]+FVdefmax[0] &&
865  pos[0] < DetDef::smrdTRmax[0]-FVdefmin[0] &&
866  pos[1] > DetDef::smrdTRmin[1]+FVdefmin[1] &&
867  pos[1] < DetDef::smrdTRmax[1]-FVdefmax[1] &&
868  pos[2] > DetDef::smrdTRmin[2]+FVdefmin[2] &&
869  pos[2] < DetDef::smrdTRmax[2]-FVdefmax[2])
870  return true;
871  break;
872  case SubDetId::kBottomSMRD:
873  if (pos[0] > DetDef::smrdBLmin[0]+FVdefmin[0] &&
874  pos[0] < DetDef::smrdBLmax[0]-FVdefmax[0] &&
875  pos[1] > DetDef::smrdBLmin[1]+FVdefmin[1] &&
876  pos[1] < DetDef::smrdBLmax[1]-FVdefmax[1] &&
877  pos[2] > DetDef::smrdBLmin[2]+FVdefmin[2] &&
878  pos[2] < DetDef::smrdBLmax[2]-FVdefmax[2])
879  return true;
880  //two parts symmetric w.r.t to Z axis
881  if (pos[0] > DetDef::smrdBRmin[0]+FVdefmax[0] &&
882  pos[0] < DetDef::smrdBRmax[0]-FVdefmin[0] &&
883  pos[1] > DetDef::smrdBRmin[1]+FVdefmin[1] &&
884  pos[1] < DetDef::smrdBRmax[1]-FVdefmax[1] &&
885  pos[2] > DetDef::smrdBRmin[2]+FVdefmin[2] &&
886  pos[2] < DetDef::smrdBRmax[2]-FVdefmax[2])
887  return true;
888  break;
889  default:
890  std::cout << "Error: anaUtils::InFiducialVolume() given an unknown subdetector enumeration: " << det << std::endl;
891 
892  }
893 
894  return false;
895 
896 }

§ MagnetIntensityCorrection()

Float_t anaUtils::MagnetIntensityCorrection ( Int_t  Run)

Return a scale factor for the magnet intensity, based on the ND280 run number. THIS IS CURRENTLY DISABLED AND WILL ALWAYS RETURN 1!

§ NeutrinoERecCCQE()

Float_t anaUtils::NeutrinoERecCCQE ( Float_t  mom_lepton,
Float_t  mass_lepton,
Float_t  costheta_lepton 
)

Compute the reconstructed neutrino energy assuming CCQE kinematics. Uses the "basic" formula which doesn't consider neutron/proton mass difference or binding energy.

Formula is E_rec = 0.5 * (2 * M_p * E_l - m_l^2) / (M_p - E_l + p_l * costheta_l), where M_ is mass, E_ is energy, p_ is momentum, p is proton, l is lepton.

Definition at line 128 of file KinematicsUtils.cxx.

128  {
129 //********************************************************************
130  Float_t mass_proton = 938.272;
131  Float_t ene_lepton = sqrt(mom_lepton * mom_lepton + mass_lepton * mass_lepton);
132  return 0.5 * (2 * mass_proton * ene_lepton - mass_lepton * mass_lepton) /
133  (mass_proton - ene_lepton + mom_lepton * costheta_lepton);
134 
135 }

§ ProjectTransverse()

TVector3 anaUtils::ProjectTransverse ( TVector3 &  nudir,
TVector3 &  thisvec 
)

---— Transverse plane (i.e w.r.t. to neutrino direction) calculations -------— Returns the projection of thisvec onto the transverse nu plane

Definition at line 214 of file KinematicsUtils.cxx.

214  {
215 //***************************************************************
216  return thisvec - thisvec.Dot(nudir)/nudir.Mag2() * nudir;
217 }

§ TrackUsesDet() [1/2]

bool anaUtils::TrackUsesDet ( const AnaTrackB track,
SubDetId::SubDetEnum  det 
)

Whether a track uses the specified detector system. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 113 of file SubDetUtils.cxx.

113  {
114 //**************************************************
115  return SubDetId::GetDetectorUsed(track.Detector, det);
116 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40

§ TrackUsesDet() [2/2]

bool anaUtils::TrackUsesDet ( const AnaParticleB track,
SubDetId::SubDetEnum  det 
)

Whether a subtrack uses the specified detector. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 119 of file SubDetUtils.cxx.

119  {
120 //**************************************************
121  return SubDetId::GetDetectorUsed(track.Detector, det);
122 }
unsigned long Detector
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40

§ TrackUsesDets()

bool anaUtils::TrackUsesDets ( const AnaTrackB track,
SubDetId::SubDetEnum  dets[],
int  nDets 
)

Whether a track uses all the specified detector systems. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 107 of file SubDetUtils.cxx.

107  {
108 //**************************************************
109  return SubDetId::GetDetectorArrayUsed(track.Detector, dets, nDets);
110 }
unsigned long Detector

§ TrackUsesOnlyDet() [1/2]

bool anaUtils::TrackUsesOnlyDet ( const AnaTrackB track,
SubDetId::SubDetEnum  det 
)

Whether a track uses only the specified detector system. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 125 of file SubDetUtils.cxx.

125  {
126 //**************************************************
127  return SubDetId::TrackUsesOnlyDet(track.Detector, det);
128 }
unsigned long Detector
static bool TrackUsesOnlyDet(unsigned long BitFIeld, SubDetId::SubDetEnum det)
Check whether a track only uses a specified subdetector or detector system.
Definition: SubDetId.cxx:117

§ TrackUsesOnlyDet() [2/2]

bool anaUtils::TrackUsesOnlyDet ( const AnaParticleB track,
SubDetId::SubDetEnum  det 
)

Whether a subtrack uses only the specified detector. See SubDetId::SubDetEnum for the detector numbering convention.

Definition at line 131 of file SubDetUtils.cxx.

131  {
132 //**************************************************
133  return SubDetId::TrackUsesOnlyDet(track.Detector, det);
134 }
unsigned long Detector
static bool TrackUsesOnlyDet(unsigned long BitFIeld, SubDetId::SubDetEnum det)
Check whether a track only uses a specified subdetector or detector system.
Definition: SubDetId.cxx:117

§ TrueParticleCrossesSMRD()

bool anaUtils::TrueParticleCrossesSMRD ( const AnaTrueParticleB track,
Float_t  min_sep = 48. 
)

Whether a true track crosses a SMRD so to be able to deposit charge in at least one layer For the moment consider the minimum separation in the direction perpendicular to the beam as: 48 mm (iron) mm (we are intersted for tracks that come from inside, so should cross the first iron block) as it comes from oaAnalysis only one point is saved for SMRD, as I understand the code it should be the exit point so make a cut in X/Y distance between the point and particular surface inner border Note: this assumes track going from inside

Definition at line 186 of file TruthUtils.cxx.

186  {
187  //********************************************************************
188 
189  if(!track)
190  return false;
191 
192  Float_t surf_pos[4] = {
193  DetDef::smrdTLmin[1],
194  DetDef::smrdBLmax[1],
195  DetDef::smrd6Lmin[0],
196  DetDef::smrd6Rmax[0]
197  };
198 
199  //loop through det crossings
200  for(Int_t idet=0;idet<track->nDetCrossings;idet++){
201 
202  AnaDetCrossingB* cross = track->DetCrossings[idet];
203  if(!cross)
204  continue;
205 
206  //InActive flag is not set for SMRD in oaAnalysis
207  if(!(cross->Detector & (1<<SubDetId::kSMRD)))
208  continue;
209 
210  // top
211  Float_t sep = 0.;
212  if (cross->ExitPosition[1]>2010.){
213  sep = cross->ExitPosition[1]-surf_pos[0];
214  }
215  //bottom
216  else if (cross->ExitPosition[1]<-2010.){
217  sep = surf_pos[1]-cross->ExitPosition[1];
218  }
219  //left
220  else if (cross->ExitPosition[0]>1830.){
221  sep = cross->ExitPosition[0]-surf_pos[2];
222  }
223  //right
224  else if (cross->ExitPosition[0]<-1830.){
225  sep = surf_pos[3]-cross->ExitPosition[0];
226  }
227 
228  if(sep>min_sep)
229  return true;
230  }
231 
232  return false;
233 
234 }
unsigned long Detector
int nDetCrossings
The number of DetCrossing objects.
Float_t ExitPosition[4]
for each subdetector tell the exit position
AnaDetCrossingB ** DetCrossings
Representation of a detector crossing info for a true particle (G4 trajectory).

§ TrueParticleCrossesTECal()

bool anaUtils::TrueParticleCrossesTECal ( const AnaTrueParticleB track,
Float_t  min_sep = 50. 
)

Whether a true track crosses a TECal so to be able to reconstruct an object For the moment consider the minimum separation as four layers in the direction perpendicular to the beam (dealing with BarrelECal here) Note: this assumes track going from inside

Definition at line 134 of file TruthUtils.cxx.

134  {
135  //********************************************************************
136 
137  if(!track)
138  return false;
139 
140  Float_t surf_pos[4] = {
141  DetDef::tecalTLmin[1],
142  DetDef::tecalBLmax[1],
143  DetDef::tecalLmin[0],
144  DetDef::tecalRmax[0]
145  };
146 
147  //check that a trajectory crosses BarrelECal active volume
148  for(Int_t idet=0;idet<track->nDetCrossings;idet++){
149 
150  AnaDetCrossingB* cross = track->DetCrossings[idet];
151  if(!cross)
152  continue;
153 
154  if(!(cross->Detector & (1<<SubDetId::kTECAL)) || !cross->InActive) continue;
155 
156  //since truth info does not allow splitting the ecal sub-volumes --> use hard-coded values
157 
158  // top
159  Float_t sep = 0.;
160  if (cross->ExitPosition[1]>1265.){
161  sep = cross->ExitPosition[1]-surf_pos[0];
162  }
163  //bottom
164  else if (cross->ExitPosition[1]<-1265.){
165  sep = surf_pos[1]-cross->ExitPosition[1];
166  }
167  //left
168  else if (cross->ExitPosition[0]>1300.){
169  sep = cross->ExitPosition[0]-surf_pos[2];
170  }
171  //right
172  else if (cross->ExitPosition[0]<-1300.){
173  sep = surf_pos[3]-cross->ExitPosition[0];
174  }
175 
176  if(sep>min_sep)
177  return true;
178  }
179 
180  return false;
181 
182 }
bool InActive
If the particle passes through an active part of the subdetector.
unsigned long Detector
int nDetCrossings
The number of DetCrossing objects.
Float_t ExitPosition[4]
for each subdetector tell the exit position
AnaDetCrossingB ** DetCrossings
Representation of a detector crossing info for a true particle (G4 trajectory).

§ TrueParticleEntersDet()

bool anaUtils::TrueParticleEntersDet ( const AnaTrueParticleB track,
SubDetId::SubDetEnum  det 
)

Whether a true track enters a given sub-detector.

Check whether this TrueParticle enters a given subdetector.

Definition at line 108 of file TruthUtils.cxx.

108  {
109  //********************************************************************
110 
111  if(!track)
112  return false;
113 
114 
115  //this is a check to account for no splitting of truth into sub-detectors for SMRD and ECa
116  if (det > SubDetId::kDSECAL && det < SubDetId::kTPC){
117  std::cout<< "anaUtils::TrueParticleEntersDet() WARNING: " << det << " is not available from true info " << std::endl;
118  }
119 
120  //check that a trajectory crosses volume
121  for(Int_t idet=0;idet<track->nDetCrossings;idet++){
122 
123  if(!SubDetId::GetDetectorUsed(track->DetCrossings[idet]->Detector, det)) continue;
124 
125  return true;
126 
127  }
128 
129  return false;
130 
131 }
unsigned long Detector
int nDetCrossings
The number of DetCrossing objects.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Definition: SubDetId.cxx:40
AnaDetCrossingB ** DetCrossings