AliPhysics  d497afb (d497afb)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliPicoHeaderV0.cxx
Go to the documentation of this file.
1 #include "AliVEvent.h"
2 #include "AliVVertex.h"
3 
4 #include "AliCentrality.h"
5 #include "AliEventplane.h"
6 #include "AliMultSelection.h"
7 #include "AliInputEventHandler.h"
8 
9 #include "AliPicoHeaderV0.h"
10 
11 ClassImp(AliPicoHeaderV0)
12 
13 //_____________________________________________________________________________
15 TNamed(s.Data(), ""),
16 fPS(0),
17 fTrg(""),
18 fEP(-999.),
19 fAct(nullptr)
20 {
21 //
22 // AliPicoHeaderV0::AliPicoHeaderV0
23 //
24 
25  for (auto &d : fVtx) d = -999.;
26 }
27 
28 //_____________________________________________________________________________
30 TNamed(src),
31 fPS(src.fPS),
32 fTrg(src.fTrg),
33 fEP(src.fEP)
34 {
35 //
36 // AliPicoHeaderV0::AliPicoHeaderV0
37 //
38 
39  if (src.fAct) {
40  TObjString *ps(nullptr);
41  if (fAct) { delete fAct; fAct = nullptr; }
42 
43  fAct = new TMap();
44  const auto next(src.fAct->MakeIterator());
45  while ((ps = static_cast<TObjString*>((*next)()))) {
46  const auto s(ps->String());
47  const auto p(static_cast<TParameter<Float_t>*>((*src.fAct)(s.Data())));
48 
49  if (p) fAct->Add(new TObjString(s.Data()),
50  new TParameter<Float_t>(s.Data(),p->GetVal()));
51  }
52  }
53 
54  auto l(0);
55  for (auto &d : src.fVtx) fVtx[l++] = d;
56 }
57 
58 //_____________________________________________________________________________
60 {
61 //
62 // AliPicoHeaderV0::operator=
63 //
64 
65  if (&src==this) return *this;
66 
67  TNamed::operator=(src);
68 
69  fPS = src.fPS;
70  fTrg = src.fTrg;
71  fEP = src.fEP;
72 
73  if (src.fAct) {
74  TObjString *ps(nullptr);
75  if (fAct) { delete fAct; fAct = nullptr; }
76 
77  fAct = new TMap();
78  const auto next(src.fAct->MakeIterator());
79  while ((ps = static_cast<TObjString*>((*next)()))) {
80  const auto s(ps->String());
81  const auto p(static_cast<TParameter<Float_t>*>((*src.fAct)(s.Data())));
82 
83  if (p) fAct->Add(new TObjString(s.Data()),
84  new TParameter<Float_t>(s.Data(),p->GetVal()));
85  }
86  }
87 
88  auto l(0);
89  for (auto &d : src.fVtx) fVtx[l++] = d;
90 
91  return *this;
92 }
93 
94 //_____________________________________________________________________________
96 {
97 //
98 // AliPicoHeaderV0::~AliPicoHeaderV0
99 //
100  if (fAct) { delete fAct; fAct = nullptr; }
101 }
102 
103 //_____________________________________________________________________________
104 void AliPicoHeaderV0::SetEventInfo(AliInputEventHandler* const pH)
105 {
106 //
107 // AliPicoHeaderV0::SetEventInfo
108 //
109 
110  const auto pV(pH->GetEvent()); if (!pV) return;
111 //============================================================================-
112 
113  fPS = pH->IsEventSelected();
114  fTrg = pV->GetFiredTriggerClasses();
115 //============================================================================-
116 
117  const auto pVtx(pV->GetPrimaryVertex());
118  SetTitle(pVtx->GetTitle());
119  pVtx->GetXYZ(fVtx);
120 //============================================================================-
121 
122  if (fAct) {
123  TObjString *ps(nullptr);
124  const auto next(fAct->MakeIterator());
125 
126  if (TString(GetName()).Contains("old")) {
127  const auto pm(pV->GetCentrality());
128  if (pm) while ((ps = static_cast<TObjString*>((*next)()))) {
129  const auto s(ps->String());
130  const auto p(static_cast<TParameter<Float_t>*>((*fAct)(s.Data())));
131  if (p) p->SetVal(pm->GetCentralityPercentile(s.Data()));
132  }
133  } else {
134  const auto pm(static_cast<AliMultSelection*>(pV->FindListObject("MultSelection")));
135  if (pm) while ((ps = static_cast<TObjString*>((*next)()))) {
136  const auto s(ps->String());
137  const auto p(static_cast<TParameter<Float_t>*>((*fAct)(s.Data())));
138  if (p) p->SetVal(pm->GetMultiplicityPercentile(s.Data()));
139  }
140  }
141  }
142 //============================================================================-
143 
144  const auto pEP(pV->GetEventplane());
145  if (pEP) fEP = pEP->GetEventplane("Q");
146 //============================================================================-
147 
148  return;
149 }
150 
151 //_____________________________________________________________________________
153 {
154 //
155 // AliPicoHeaderV0::CentralityPercentile(const TString s) const
156 //
157 
158  if (!fAct) return -999.;
159  if (s.IsNull()) return -999.;
160 //=============================================================================
161 
162  const auto p(static_cast<TParameter<Float_t>*>((*fAct)(s.Data())));
163  if (!p) return -999.;
164 //=============================================================================
165 
166  return p->GetVal();
167 }
168 
169 //_____________________________________________________________________________
171 {
172 //
173 // AliPicoHeaderV0::Reset
174 //
175 
176  fPS = 0;
177  fTrg = "";
178 
179  fEP = -999.;
180  for (auto &d : fVtx) d = -999.;
181 //=============================================================================
182 
183  if (fAct) {
184  TObjString *ps(nullptr);
185  const auto next(fAct->MakeIterator());
186  while ((ps = static_cast<TObjString*>((*next)()))) {
187  const auto s(ps->String());
188  const auto p(static_cast<TParameter<Float_t>*>((*fAct)(s.Data())));
189  if (p) p->SetVal(-999.);
190  }
191  }
192 //=============================================================================
193 
194  return;
195 }
void SetEventInfo(AliInputEventHandler *const pH)
Float_t MultiplicityPercentile(const TString &s)
AliPicoHeaderV0 & operator=(const AliPicoHeaderV0 &src)
Double_t fVtx[3]
float Float_t
Definition: External.C:68
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
virtual ~AliPicoHeaderV0()
AliPicoHeaderV0(const TString s="")