]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronPairLegCuts.cxx
Update for PbPb (Chiara)
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectronPairLegCuts.cxx
1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
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 **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////
19 //   Cut class providing cuts for both legs in the AliDielectronPair     //
20 //                                                                       //
21 //                                                                       //
22 /*
23 Add any number of leg cuts using e.g. for leg 1
24 GetFilterLeg1().AddCuts(mycut)
25 where mycut has to inherit from AliAnalysisCuts
26
27 */
28 //                                                                       //
29 ///////////////////////////////////////////////////////////////////////////
30
31 #include <TList.h>
32
33 #include "AliDielectronPair.h"
34 #include "AliVParticle.h"
35
36 #include "AliDielectronPairLegCuts.h"
37
38 ClassImp(AliDielectronPairLegCuts)
39
40
41 AliDielectronPairLegCuts::AliDielectronPairLegCuts() :
42   AliAnalysisCuts(),
43   fFilterLeg1("PairFilterLeg1","PairFilterLeg1"),
44   fFilterLeg2("PairFilterLeg2","PairFilterLeg2"),
45   fCutType(kBothLegs)
46 {
47   //
48   // Default contructor
49   //
50 }
51
52 //________________________________________________________________________
53 AliDielectronPairLegCuts::AliDielectronPairLegCuts(const char* name, const char* title) :
54   AliAnalysisCuts(name,title),
55   fFilterLeg1("PairFilterLeg1","PairFilterLeg1"),
56   fFilterLeg2("PairFilterLeg2","PairFilterLeg2"),
57   fCutType(kBothLegs)
58 {
59   //
60   // Named contructor
61   //
62 }
63
64
65 //________________________________________________________________________
66 Bool_t AliDielectronPairLegCuts::IsSelected(TObject* track)
67 {
68   //
69   // check if cuts are fulfilled
70   //
71   
72   //check if we have a AliDielectronPair
73   AliDielectronPair *pair=dynamic_cast<AliDielectronPair*>(track);
74   if (!pair) return kFALSE;
75
76   //get both legs
77   AliVParticle *leg1=pair->GetFirstDaughter();
78   AliVParticle *leg2=pair->GetSecondDaughter();
79
80   //mask used to require that all cuts are fulfilled
81   UInt_t selectedMaskLeg1=(1<<fFilterLeg1.GetCuts()->GetEntries())-1;
82   UInt_t selectedMaskLeg2=(1<<fFilterLeg2.GetCuts()->GetEntries())-1;
83   
84   //test cuts
85   Bool_t isLeg1selected=(fFilterLeg1.IsSelected(leg1)==selectedMaskLeg1);
86   Bool_t isLeg2selected=(fFilterLeg2.IsSelected(leg2)==selectedMaskLeg2);
87   
88   Bool_t isLeg1selectedMirror=(fFilterLeg1.IsSelected(leg2)==selectedMaskLeg1);
89   Bool_t isLeg2selectedMirror=(fFilterLeg2.IsSelected(leg1)==selectedMaskLeg2);
90   
91   Bool_t isSelected=isLeg1selected&&isLeg2selected;
92   if (fCutType==kAnyLeg)
93     isSelected=isLeg1selected||isLeg2selected;
94   
95   if (fCutType==kMixLegs)
96     isSelected=(isLeg1selected&&isLeg2selected)||(isLeg1selectedMirror&&isLeg2selectedMirror);
97   
98   SetSelected(isSelected);
99   return isSelected;
100 }
101
102
103