CbmRoot
Loading...
Searching...
No Matches
PairAnalysisPairLegCuts.cxx
Go to the documentation of this file.
1
2// //
3// //
4// Authors:
5// * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
6// Julian Book <Julian.Book@cern.ch>
7/*
8 Cut class providing cuts for both legs in the PairAnalysisPair
9 Add any number of leg cuts using e.g. for leg 1
10 GetFilterLeg1().AddCuts(mycut)
11 where mycut has to inherit from AnalysisCuts.
12
13 the following cut types are defined and selected via SetCutType():
14 kBothLegs, kAnyLeg, kMixLegs, kOneLeg
15
16*/
17// //
19
21
22#include <TList.h>
23
24#include "PairAnalysisPairLV.h"
25#include "PairAnalysisTrack.h"
26
28
29
31 : PairAnalysisPairLegCuts("pairlegcut", "pairlegcut")
32{
33 //
34 // Default contructor
35 //
36}
37
38//________________________________________________________________________
39PairAnalysisPairLegCuts::PairAnalysisPairLegCuts(const char* name, const char* title)
40 : AnalysisCuts(name, title)
41 , fFilterLeg1("PairFilterLeg1", "PairFilterLeg1")
42 , fFilterLeg2("PairFilterLeg2", "PairFilterLeg2")
43{
44 //
45 // Named contructor
46 //
47}
48
49
50//________________________________________________________________________
52{
53 //
54 // check if cuts are fulfilled
55 //
56
57 //check if we have a PairAnalysisPair
58 PairAnalysisPair* pair = dynamic_cast<PairAnalysisPair*>(track);
59 if (!pair) return kFALSE;
60
61 //get both legs
62 PairAnalysisTrack* leg1 = pair->GetFirstDaughter();
63 PairAnalysisTrack* leg2 = pair->GetSecondDaughter();
64
65 //mask used to require that all cuts are fulfilled
66 UInt_t selectedMaskLeg1 = (1 << fFilterLeg1.GetCuts()->GetEntries()) - 1;
67 UInt_t selectedMaskLeg2 = (1 << fFilterLeg2.GetCuts()->GetEntries()) - 1;
68
69 //test cuts
70 Bool_t isLeg1selected = (fFilterLeg1.IsSelected(leg1) == selectedMaskLeg1);
71 if (fCutType == kBothLegs && !isLeg1selected) {
72 SetSelected(isLeg1selected);
73 return isLeg1selected;
74 }
75 //skip further checks if first leg passes cuts and cuttype is any
76 if (fCutType == kAnyLeg && isLeg1selected) {
77 SetSelected(isLeg1selected);
78 return isLeg1selected;
79 }
80
81 Bool_t isLeg2selected = (fFilterLeg2.IsSelected(leg2) == selectedMaskLeg2);
82 Bool_t isSelected = isLeg1selected && isLeg2selected;
83 if (fCutType == kAnyLeg) {
84 isSelected = isLeg1selected || isLeg2selected;
85 SetSelected(isSelected);
86 return isSelected;
87 }
88 if (fCutType == kOneLeg) {
89 isSelected = (isLeg1selected != isLeg2selected);
90 SetSelected(isSelected);
91 return isSelected;
92 }
93
94 if (fCutType == kMixLegs) {
95 Bool_t isLeg1selectedMirror = (fFilterLeg1.IsSelected(leg2) == selectedMaskLeg1);
96 Bool_t isLeg2selectedMirror = (fFilterLeg2.IsSelected(leg1) == selectedMaskLeg2);
97 isSelected = (isLeg1selected && isLeg2selected) || (isLeg1selectedMirror && isLeg2selectedMirror);
98 SetSelected(isSelected);
99 }
100 return isSelected;
101}
102
103//________________________________________________________________________
104void PairAnalysisPairLegCuts::Print(const Option_t* /*option*/) const
105{
106 //
107 // Print cuts and the range
108 //
109 printf("------------------------------------------\n");
110 printf("pair-leg cut ranges for '%s'\n", GetTitle());
111 switch (fCutType) {
112 case kBothLegs: printf("Both legs have to fulfill the cuts\n"); break;
113 case kAnyLeg: printf("Any leg have to fulfill the cuts\n"); break;
114 case kMixLegs: printf("Leg1(leg2) has to fullfill the leg1(2)- or leg2(1)-cuts (mix mode)\n"); break;
115 case kOneLeg: printf("Only one of legs is allowed to fulfill the cuts\n"); break;
116 }
117
118 printf("Leg filter1: \n");
119 TIter listIterator(fFilterLeg1.GetCuts());
120 while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator()) {
121 thisCut->Print();
122 }
123
124 printf("Leg filter2: \n");
125 TIter listIterator2(fFilterLeg2.GetCuts());
126 while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator2()) {
127 thisCut->Print();
128 }
129 printf("------------------------------------------\n");
130}
ClassImp(PairAnalysisPairLegCuts) PairAnalysisPairLegCuts
virtual void SetSelected(Bool_t dec)
TList * GetCuts() const
virtual UInt_t IsSelected(Double_t *const values)
virtual Bool_t IsSelected(TObject *track)
virtual void Print(const Option_t *option="") const