1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
17 // Cut class providing cuts for both legs in the AliDielectronPair //
21 Add any number of leg cuts using e.g. for leg 1
22 GetFilterLeg1().AddCuts(mycut)
23 where mycut has to inherit from AliAnalysisCuts
27 ///////////////////////////////////////////////////////////////////////////
31 #include "AliDielectronPair.h"
32 #include "AliVParticle.h"
34 #include "AliDielectronPairLegCuts.h"
36 ClassImp(AliDielectronPairLegCuts)
39 AliDielectronPairLegCuts::AliDielectronPairLegCuts() :
41 fFilterLeg1("PairFilterLeg1","PairFilterLeg1"),
42 fFilterLeg2("PairFilterLeg2","PairFilterLeg2"),
50 //________________________________________________________________________
51 AliDielectronPairLegCuts::AliDielectronPairLegCuts(const char* name, const char* title) :
52 AliAnalysisCuts(name,title),
53 fFilterLeg1("PairFilterLeg1","PairFilterLeg1"),
54 fFilterLeg2("PairFilterLeg2","PairFilterLeg2"),
63 //________________________________________________________________________
64 Bool_t AliDielectronPairLegCuts::IsSelected(TObject* track)
67 // check if cuts are fulfilled
70 //check if we have a AliDielectronPair
71 AliDielectronPair *pair=dynamic_cast<AliDielectronPair*>(track);
72 if (!pair) return kFALSE;
75 AliVParticle *leg1=pair->GetFirstDaughter();
76 AliVParticle *leg2=pair->GetSecondDaughter();
78 //mask used to require that all cuts are fulfilled
79 UInt_t selectedMaskLeg1=(1<<fFilterLeg1.GetCuts()->GetEntries())-1;
80 UInt_t selectedMaskLeg2=(1<<fFilterLeg2.GetCuts()->GetEntries())-1;
83 Bool_t isLeg1selected=(fFilterLeg1.IsSelected(leg1)==selectedMaskLeg1);
84 if(fCutType==kBothLegs && !isLeg1selected) {
85 SetSelected(isLeg1selected);
86 return isLeg1selected;
88 Bool_t isLeg2selected=(fFilterLeg2.IsSelected(leg2)==selectedMaskLeg2);
90 Bool_t isLeg1selectedMirror=(fFilterLeg1.IsSelected(leg2)==selectedMaskLeg1);
91 Bool_t isLeg2selectedMirror=(fFilterLeg2.IsSelected(leg1)==selectedMaskLeg2);
93 Bool_t isSelected=isLeg1selected&&isLeg2selected;
94 if (fCutType==kAnyLeg)
95 isSelected=isLeg1selected||isLeg2selected;
97 if (fCutType==kMixLegs)
98 isSelected=(isLeg1selected&&isLeg2selected)||(isLeg1selectedMirror&&isLeg2selectedMirror);
100 SetSelected(isSelected);