]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutEventUtils.cxx
Updated macros for D0 analysis (Massimo)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutEventUtils.cxx
1 //
2 // Class AliRsnCutEventUtils
3 //
4 // This cut implementation checks the quality of event primary vertex.
5 // It currently works only with ESD events (not AOD).
6 //
7 // authors: Martin Vala (martin.vala@cern.ch)
8 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
9 //
10
11 #include "AliRsnCutEventUtils.h"
12 #include "AliAnalysisUtils.h"
13
14 ClassImp(AliRsnCutEventUtils)
15
16 //_________________________________________________________________________________________________
17 AliRsnCutEventUtils::AliRsnCutEventUtils(const char *name, Bool_t rmFirstEvInChunck, Bool_t checkPileUppA2013) :
18 AliRsnCut(name, AliRsnCut::kEvent),
19   fIsRmFirstEvInChunck(rmFirstEvInChunck),
20   fCheckPileUppA2013(checkPileUppA2013),
21   fUseMVPlpSelection(kFALSE),
22   fMinPlpContribMV(5),
23   fMinPlpContribSPD(5),
24   fUseVertexSelection2013pA(kFALSE),
25   fUtils(0x0)
26 {
27   //
28   // Main constructor.
29   //This class is mainly used for pPb 2013 
30   //If the rmFirstEvInChunck flag is kTRUE, it removed the first event in chunk
31   //
32   //If the checkPileUp flag is kTRUE, it removes the events from pile-up
33   //- to be used for pA 2013, for other periods the rejection of pileup is implemented 
34   //ad an additional cut in the primary vertex
35   
36 }
37
38 //_________________________________________________________________________________________________
39 AliRsnCutEventUtils::AliRsnCutEventUtils(const AliRsnCutEventUtils &copy) :
40   AliRsnCut(copy),
41   fIsRmFirstEvInChunck(copy.fIsRmFirstEvInChunck),
42   fCheckPileUppA2013(copy.fCheckPileUppA2013),
43   fUseMVPlpSelection(copy.fUseMVPlpSelection),
44   fMinPlpContribMV(copy.fMinPlpContribMV),
45   fMinPlpContribSPD(copy.fMinPlpContribSPD),
46   fUseVertexSelection2013pA(copy.fUseVertexSelection2013pA),
47   fUtils(copy.fUtils)
48 {
49   //
50   // Copy constructor.
51   //
52 }
53
54 //-------------------------------------------------------------------------------------------------
55 AliRsnCutEventUtils &AliRsnCutEventUtils::operator=(const AliRsnCutEventUtils &copy)
56 {
57   //
58   // Assignment operator.
59   // Works like copy constructor.
60   //
61   AliRsnCut::operator=(copy);
62   if (this == &copy)
63     return *this;
64   
65   fIsRmFirstEvInChunck=copy.fIsRmFirstEvInChunck;
66   fCheckPileUppA2013=copy.fCheckPileUppA2013;
67   fUseMVPlpSelection=copy.fUseMVPlpSelection;
68   fMinPlpContribMV=copy.fMinPlpContribMV;
69   fMinPlpContribSPD=copy.fMinPlpContribSPD;
70   fUseVertexSelection2013pA=copy.fUseVertexSelection2013pA;
71
72   fUtils=copy.fUtils;
73         
74     return (*this);
75 }
76 //_________________________________________________________________________________________________
77 Bool_t AliRsnCutEventUtils::IsSelected(TObject *object)
78 {
79 //
80 // Cut checker
81 //
82    // coherence check
83    // which also fills data member objects
84    if (!TargetOK(object)) return kFALSE;
85
86    // retrieve event
87    AliVEvent *vevt = dynamic_cast<AliVEvent *>(fEvent->GetRef());
88    fUtils = new AliAnalysisUtils();
89    fUtils->SetUseMVPlpSelection(fUseMVPlpSelection);
90    fUtils->SetMinPlpContribMV(fMinPlpContribMV);
91    fUtils->SetMinPlpContribSPD(fMinPlpContribSPD);
92
93    // pile-up check
94    if ((fCheckPileUppA2013) && (fUtils->IsPileUpEvent(vevt)))
95      return kFALSE;
96   
97    //remove first event in chunk 
98    if ((fIsRmFirstEvInChunck) && (fUtils->IsFirstEventInChunk(vevt)))
99      return kFALSE;
100    
101    //apply vertex selection - for 2013 pPb data
102    if((fUseVertexSelection2013pA) && (!fUtils->IsVertexSelected2013pA(vevt)))
103       return kFALSE;
104  
105    return kTRUE;
106 }