AliAODEvent::GetHeader() returns AliVHeader
[u/mrichter/AliRoot.git] / PWG / DevNanoAOD / AliAnalysisNanoAODCuts.cxx
CommitLineData
778636d4 1#include "AliAnalysisNanoAODCuts.h"
2#include "AliAODTrack.h"
3#include "AliAODEvent.h"
4#include "AliNanoAODHeader.h"
5#include "AliNanoAODTrack.h"
5cb630d4 6#include <iomanip>
778636d4 7
8ClassImp(AliAnalysisNanoAODTrackCuts)
5cb630d4 9ClassImp(AliAnalysisNanoAODEventCuts)
10ClassImp(AliNanoAODSimpleSetter)
778636d4 11
12
13AliAnalysisNanoAODTrackCuts::AliAnalysisNanoAODTrackCuts():
5cb630d4 14AliAnalysisCuts(), fBitMask(1), fMinPt(0), fMaxEta(10)
778636d4 15{
16 // default ctor
17}
18
19Bool_t AliAnalysisNanoAODTrackCuts::IsSelected(TObject* obj)
20{
21 // Returns true if the track is good!
22 AliAODTrack* track = dynamic_cast<AliAODTrack*>(obj);
5cb630d4 23
24
25 if (!track->TestFilterBit(fBitMask)) return kFALSE;
26 if (track->Pt() < fMinPt) return kFALSE;
27 if (TMath::Abs(track->Eta()) > fMaxEta) return kFALSE;
28
29 return kTRUE;
778636d4 30
31}
32
33AliAnalysisNanoAODEventCuts::AliAnalysisNanoAODEventCuts():
34 AliAnalysisCuts(), fVertexRange(10)
35{
36 // default ctor
37}
38
39Bool_t AliAnalysisNanoAODEventCuts::IsSelected(TObject* obj)
40{
41 // Returns true if the object is a primary vertex
42 AliAODEvent * evt = dynamic_cast<AliAODEvent*>(obj);
43
44 AliAODVertex * vertex = evt->GetPrimaryVertex();
45 if (!vertex) return kFALSE;
46 if (TMath::Abs(vertex->GetZ()) > fVertexRange) return kFALSE;
5cb630d4 47
778636d4 48 return kTRUE;
49
50}
5cb630d4 51
52
53void AliNanoAODSimpleSetter::SetNanoAODHeader(const AliAODEvent * event , AliNanoAODHeader * head ) {
0a918d8d 54
55 AliAODHeader * header = dynamic_cast<AliAODHeader*>(event->GetHeader());
56 if (!header) AliFatal("Not a standard AOD");
5cb630d4 57 // Set custom nano aod vars
0a918d8d 58 Double_t centr = header->GetCentralityP()->GetCentralityPercentile("V0M");
59 Double_t magfield = header->GetMagneticField();
5cb630d4 60 head->SetVar(0, centr);
61 head->SetVar(1, magfield);
62
63}