HighLAND
numuBkgInAntiNuModeCCFGD2Selection.cxx
1 #include "baseSelection.hxx"
2 #include "numuBkgInAntiNuModeCCFGD2Selection.hxx"
3 #include "CutUtils.hxx"
4 #include "SubDetId.hxx"
5 #include "EventBoxId.hxx"
6 
7 //********************************************************************
8 numuBkgInAntiNuModeCCFGD2Selection::numuBkgInAntiNuModeCCFGD2Selection(bool forceBreak): SelectionBase(forceBreak,EventBoxId::kEventBoxTracker) {
9 //********************************************************************
10 
11  // initialize selections being used
12  _numuCCFGD2Selection.Initialize();
13  _numuBkgInAntiNuModeCCSelection.Initialize();
14 }
15 
16 //********************************************************************
18 //********************************************************************
19 
20  // Cuts must be added in the right order
21  // last "true" means the step sequence is broken if cut is not passed (default is "false")
22  AddStep(StepBase::kCut, "event quality", new EventQualityCut(), true);
23  AddStep(StepBase::kCut, "> 0 tracks ", new TotalMultiplicityCut(), true);
24  AddStep(StepBase::kAction, "find leading tracks",new FindLeadingTracksAction());
25  AddStep(StepBase::kAction, "find vertex", new FindVertexAction());
26  AddStep(StepBase::kAction, "fill_summary", new FillSummaryAction_numuBkgFGD2());
27  AddStep(StepBase::kCut, "quality+fiducial", new TrackQualityFiducialCut(), true);
28  AddStep(StepBase::kCut, "neg_mult", new NegativeMultiplicityCut());
29  AddStep(StepBase::kAction, "find veto track", new FindVetoTrackAction());
30  AddStep(StepBase::kCut, "veto", new ExternalFGD2VetoCut());
31  AddStep(StepBase::kAction, "find oofv track", new FindOOFVTrackAction());
32  AddStep(StepBase::kCut, "External FGD2", new ExternalFGD2LastLayersCut());
33  AddStep(StepBase::kCut, "Muon PID", new NumuBkgMuonPIDCut());
34 
35  SetBranchAlias(0,"trunk");
36 
37  // By default the preselection correspond to cuts 0-2
38  SetPreSelectionAccumLevel(2);
39 }
40 
41 //********************************************************************
43 //********************************************************************
44 
45  // The detector in which the selection is applied
46  SetDetectorFV(SubDetId::kFGD2);
47 
48  _numuCCFGD2Selection.SetDetectorFV(SubDetId::kFGD2);
49  _numuBkgInAntiNuModeCCSelection.SetDetectorFV(SubDetId::kFGD2);
50 }
51 
52 //********************************************************************
53 bool numuBkgInAntiNuModeCCFGD2Selection::FillEventSummary(AnaEventC& event, Int_t allCutsPassed[]){
54 //********************************************************************
55 
56  if(allCutsPassed[0]){
57  static_cast<AnaEventSummaryB*>(event.Summary)->EventSample = SampleId::kFGD2NuMuBkgInAntiNuModeCC;
58  }
59  return (static_cast<AnaEventSummaryB*>(event.Summary)->EventSample != SampleId::kUnassigned);
60 }
61 
62 //********************************************************************
64 //********************************************************************
65 
66  // Cast the ToyBox to the appropriate type
67  ToyBoxTracker& box = *static_cast<ToyBoxTracker*>(&boxB);
68 
69  if(!box.HMNtrack) return 1;
70 
71  static_cast<AnaEventSummaryB*>(event.Summary)->LeptonCandidate[SampleId::kFGD2NuMuBkgInAntiNuModeCC] = box.HMNtrack;
72  for(int i = 0; i < 4; ++i){
73  static_cast<AnaEventSummaryB*>(event.Summary)->VertexPosition[SampleId::kFGD2NuMuBkgInAntiNuModeCC][i] = box.HMNtrack->PositionStart[i];
74  }
75  if(box.HMNtrack->GetTrueParticle()) static_cast<AnaEventSummaryB*>(event.Summary)->TrueVertex[SampleId::kFGD2NuMuBkgInAntiNuModeCC] = box.HMNtrack->GetTrueParticle()->TrueVertex;
76 
77  return true;
78 }
79 
80 //**************************************************
81 bool numuBkgInAntiNuModeCCFGD2Selection::IsRelevantRecObjectForSystematic(const AnaEventC& event, AnaRecObjectC* track, SystId_h systId, Int_t branch) const{
82 //**************************************************
83 
84  return _numuCCFGD2Selection.IsRelevantRecObjectForSystematic(event,track,systId,branch);
85 
86 }
87 
88 //**************************************************
89 bool numuBkgInAntiNuModeCCFGD2Selection::IsRelevantTrueObjectForSystematic(const AnaEventC& event, AnaTrueObjectC* trueTrack, SystId_h systId, Int_t branch) const{
90 //**************************************************
91 
92  return _numuCCFGD2Selection.IsRelevantTrueObjectForSystematic(event,trueTrack,systId,branch);
93 
94 }
95 
96 //**************************************************
97 bool numuBkgInAntiNuModeCCFGD2Selection::IsRelevantSystematic(const AnaEventC& event, const ToyBoxB& box, SystId_h systId, Int_t branch) const{
98 //**************************************************
99 
100  return _numuBkgInAntiNuModeCCSelection.IsRelevantSystematic(event, box, systId, branch);
101 }
102 
103 //**************************************************
105 //**************************************************
106 
107  _numuCCFGD2Selection.InitializeEvent(event);
108 }
109 
110 //********************************************************************
111 bool numuBkgInAntiNuModeCCFGD2Selection::CheckRedoSelection(const AnaEventC& event, const ToyBoxB& PreviousToyBox, Int_t& redoFromStep){
112 //********************************************************************
113 
114  return _numuCCFGD2Selection.CheckRedoSelection(event, PreviousToyBox, redoFromStep);
115 }
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Float_t PositionStart[4]
The reconstructed start position of the particle.
bool IsRelevantRecObjectForSystematic(const AnaEventC &event, AnaRecObjectC *recObj, SystId_h systId, Int_t branch) const
Is this track relevant for a given systematic (prior to selection, call when initializing the event...
void InitializeEvent(AnaEventC &event)
Fill the EventBox with the objects needed by this selection.
bool IsRelevantTrueObjectForSystematic(const AnaEventC &event, AnaTrueObjectC *trueObj, SystId_h systId, Int_t branch) const
Is this true track relevant for a given systematic (prior to selection, call when initializing the ev...
void DefineDetectorFV()
Define the detector Fiducial Volume in which this selection is applied.
void DefineSteps()
Define all steps in the selection.
Leading tracks with good quality in FGD1.
bool CheckRedoSelection(const AnaEventC &event, const ToyBoxB &PreviousToyBox, Int_t &redoFromStep)
bool IsRelevantSystematic(const AnaEventC &event, const ToyBoxB &box, SystId_h systId, Int_t branch) const
Is this systematic relevant for this selection.
AnaTrackB * HMNtrack
For storing the highest momentum negative track.
bool Apply(AnaEventC &event, ToyBoxB &box) const
AnaEventSummaryC * Summary
A summary of the event with high level quantities.
Find the Vertex. For the moment it&#39;s just the Star position of the HM track.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
A cut on event quality. Requires good beam and ND280 data quality flags.
void Initialize()
Initialize this selection: defines the steps and the detectorFV.