AliPhysics  026afea (026afea)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTrackletAODdNdeta.C
Go to the documentation of this file.
1 
12 #include <AliAnalysisTaskSE.h>
13 #include <AliTrackletAODUtils.C>
14 #include <AliAODTracklet.C>
15 #ifndef __CINT__
16 #include <cctype>
17 #include "AliAODSimpleHeader.C"
18 #include <AliVVertex.h>
19 #include <AliVertex.h>
20 #include <AliAnalysisManager.h>
21 #include <AliVEventHandler.h>
22 #include <AliInputEventHandler.h>
23 #include <AliMultSelection.h>
24 #include <AliCentrality.h>
25 #include <AliLog.h>
26 #include <TClonesArray.h>
27 #include "AliTrackletWeights.C"
28 #include <TUrl.h>
29 #include <TFile.h>
30 #include <TGraphErrors.h>
31 #else
32 // class AliAODTracklet;
33 class AliTrackletWeights;
34 class AliVEvent;
35 class AliMultSelection; // Auto-load
36 class TClonesArray;
37 #endif
38 
39 //====================================================================
46  public AliTrackletAODUtils
47 {
48 public:
52  enum {
62  kPrimaryMask = 0x0,
71  };
72 
74  typedef TList Container;
82  AliTrackletAODdNdeta(const char* name);
92  virtual ~AliTrackletAODdNdeta() {}
110  virtual void Print(Option_t* option="") const;
117  Bool_t Connect(const char* sumFile=0,const char* resFile=0);
128  static AliTrackletAODdNdeta* Create(Bool_t mc=false,
129  const char* weights=0,
130  const char* sumFile=0,
131  const char* resFile=0);
132  /* @} */
133 
134  // -----------------------------------------------------------------
147  void UserExec(Option_t*);
152  void FinishTaskOutput() { /*WorkerFinalize();*/ }
157  void Terminate(Option_t*);
158  /* @} */
159 
160  // -----------------------------------------------------------------
170  void SetCentralityMethod(const TString& name) { fCentMethod = name; }
178  {
179  SetAxis(fCentAxis,n,bins);
180  }
186  void SetCentralityAxis(const TString& spec)
187  {
188  SetAxis(fCentAxis, spec, "-:,");
189  }
197  void SetIPzAxis(Int_t n, Double_t min, Double_t max)
198  {
199  SetAxis(fIPzAxis, n, min, max);
200  }
207  void SetIPzAxis(Int_t n, Double_t max)
208  {
209  SetAxis(fIPzAxis, n, max);
210  }
216  void SetIPzAxis(const TString& spec)
217  {
218  SetAxis(fIPzAxis, spec);
219  }
227  void SetPhiAxis(Int_t n, Double_t min, Double_t max)
228  {
229  SetAxis(fPhiAxis, n, min, max);
230  }
237  void SetPhiAxis(Int_t n, Double_t max)
238  {
239  SetAxis(fPhiAxis, n, max);
240  }
248  void SetEtaAxis(Int_t n, Double_t min, Double_t max)
249  {
250  SetAxis(fEtaAxis, n, min, max);
251  }
258  void SetEtaAxis(Int_t n, Double_t max)
259  {
260  SetAxis(fEtaAxis, n, max);
261  }
267  void SetEtaAxis(const TString& spec)
268  {
269  SetAxis(fEtaAxis, spec);
270  }
276  void SetDPhiShift(Double_t x=0.0045) { fDPhiShift = x; }
288  void SetDeltaCut(Double_t x=1.5) { fDeltaCut = x; }
294  void SetMaxDelta(Double_t x=25) { fMaxDelta = x; }
300  void SetTailDelta(Double_t x=5) { fTailDelta = x; }
306  void SetTailMaximum(Double_t x=-1) { fTailMax = x; }
320  void SetAbsMinCent(Double_t x=-1) { fAbsMinCent = x; }
326  virtual void SetWeights(AliTrackletWeights* w) {};
332  virtual void SetWeightCalc(UChar_t mode=0) {}
338  virtual void SetWeightMask(UChar_t mask=0xFF) {}
344  virtual void SetWeightVeto(UChar_t veto=0xFF) {}
345  /* @} */
346  //__________________________________________________________________
350  struct Sub : public TObject
351  {
356  Sub(const char* name="") : fName(name), fContainer(0), fDebug(0) {}
362  Sub(const Sub& o) : TObject(o), fName(o.fName), fContainer(0), fDebug(0) {}
366  virtual ~Sub() {}
372  Sub& operator=(const Sub&) { return *this; }
376  const char* GetName() const { return fName.Data(); }
387  virtual Bool_t WorkerInit(Container* parent,
388  const TAxis& etaAxis,
389  const TAxis& ipzAxis,
390  const TAxis& deltaAxis)
391  {
392  fContainer = new Container;
393  fContainer->SetName(fName);
394  fContainer->SetOwner();
395  if (parent) parent->Add(fContainer);
396  return true;
397  }
408  virtual Bool_t ProcessTracklet(AliAODTracklet* tracklet,
409  Double_t ipz,
410  UShort_t signal,
411  Double_t weight) = 0;
421  virtual Bool_t FinalizeInit(Container* parent) = 0;
432  virtual Bool_t MasterFinalize(Container* parent,
433  TH1* ipz,
434  Double_t tailCut,
435  Double_t tailMax) = 0;
441  virtual void SetDebug(UShort_t lvl) { fDebug = lvl; }
442  protected:
449  ClassDef(Sub,1);
450  };
451 
452  //__________________________________________________________________
462  struct Histos : public Sub
463  {
468  Histos(const char* name="", Color_t color=kBlack, Style_t style=1,
469  UChar_t mask=0, UChar_t veto=0)
470  : Sub(name),
471  fMask(mask),
472  fVeto(veto),
473  fEtaIPz(0),
474  fEtaDeltaIPz(0),
475  fEtaPdgIPz(0),
476  fEtaPdg(0),
477  fEtaPt(0),
478  fColor(color),
479  fStyle(style)
480  {}
486  Histos(const Histos& o)
487  : Sub(o),
488  fMask(o.fMask),
489  fVeto(o.fVeto),
490  fEtaIPz(0),
491  fEtaDeltaIPz(0),
492  fEtaPdgIPz(0),
493  fEtaPdg(0),
494  fEtaPt(0),
495  fColor(o.fColor),
496  fStyle(o.fStyle)
497  {}
501  virtual ~Histos() {}
507  Histos& operator=(const Histos&) { return *this; }
512  {
513  return fMask == kMeasuredMask && fVeto == kMeasuredVeto;
514  }
519  {
520  return fMask == kInjectedMask && fVeto == kInjectedVeto;
521  }
526  {
528  }
534  {
535  return fMask == kDistinctMask && fVeto == kDistinctVeto;
536  }
541  {
542  return fMask == kPrimaryMask && fVeto == kPrimaryVeto;
543  }
548  {
549  return fMask == kSecondaryMask && fVeto == kSecondaryVeto;
550  }
555  {
556  return fMask == kGeneratedMask && fVeto == kGeneratedVeto;
557  }
568  Bool_t WorkerInit(Container* parent,
569  const TAxis& etaAxis,
570  const TAxis& ipzAxis,
571  const TAxis& deltaAxis);
578  void SetAttr(Color_t c, Style_t m);
590  Double_t ipz,
591  UShort_t signal,
592  Double_t weight);
602  Bool_t FinalizeInit(Container* parent);
614  TH1* ipz,
615  Double_t tailCut,
616  Double_t tailMax);
617 
618  UChar_t GetMask() const { return fMask; }
619  UChar_t GetVeto() const { return fVeto; }
625  void Print(Option_t* option="") const;
626  protected:
627  const UChar_t fMask;
628  const UChar_t fVeto;
634  public:
635  Color_t fColor;
636  Style_t fStyle;
637 
638  ClassDef(Histos,1);
639  };
640 
641 
642  //__________________________________________________________________
658  struct CentBin : public Sub
659  {
664  : Sub(""),
665  fSubs(0),
666  fLow(0),
667  fHigh(0),
668  fIPz(0),
669  fCent(0),
670  fCentIPz(0),
671  fMeasured(0),
672  fInjection(0)
673  {
674  }
681  CentBin(Double_t c1, Double_t c2);
687  CentBin(const CentBin& o)
688  : Sub(o),
689  fSubs(0),
690  fLow(o.fLow),
691  fIPz(0),
692  fCent(0),
693  fCentIPz(0),
694  fHigh(o.fHigh),
695  fMeasured(0),
696  fInjection(0)
697  {}
701  virtual ~CentBin() {}
707  CentBin& operator=(const CentBin&) { return *this; }
719  Histos* MakeHistos(const char* name,
720  Color_t color,
721  Style_t style,
722  UShort_t mask,
723  UShort_t veto);
734  Bool_t WorkerInit(Container* parent,
735  const TAxis& etaAxis,
736  const TAxis& ipzAxis,
737  const TAxis& deltaAxis);
746  Bool_t Accept(Double_t cent, Double_t ipz);
758  Double_t ipz,
759  UShort_t signal,
760  Double_t weight);
770  Bool_t FinalizeInit(Container* parent);
782  TH1* ipz,
783  Double_t tailCut,
784  Double_t tailMax);
798  Container* measCont,
799  Container* genCont,
800  Histos* h,
801  Double_t tailCut,
802  Double_t tailMax);
808  void Print(Option_t* option="") const;
814  virtual void SetDebug(UShort_t lvl);
815  protected:
821  TProfile* fCentIPz;
824 
825  ClassDef(CentBin,2);
826  };
827 
828 protected:
829  // -----------------------------------------------------------------
839  virtual Bool_t WorkerInit();
846  Bool_t InitCentBins(Container* existing);
856  {
857  return new CentBin(c1, c2);
858  }
859  /* @} */
860 
861  // -----------------------------------------------------------------
866  virtual const char* GetBranchName() const { return "AliAODTracklets"; }
876  Bool_t CheckEvent(Double_t& cent,
877  const AliVVertex*& ip,
878  TClonesArray*& tracklets);
886  TClonesArray* FindTracklets(AliVEvent* event);
896  const AliVVertex* FindSimpleIP(AliVEvent* event,
897  Double_t maxDispersion=0.04,
898  Double_t maxZError=0.25);
908  const AliVVertex* FindRealIP(AliVEvent* event,
909  Double_t maxDispersion=0.04,
910  Double_t maxZError=0.25);
920  const AliVVertex* CheckIP(const AliVVertex* ip,
921  Double_t maxDispersion=0.04,
922  Double_t maxZError=0.25);
923 
933  const AliVVertex* FindIP(AliVEvent* event,
934  Double_t maxDispersion=0.04,
935  Double_t maxZError=0.25);
946  Double_t FindMultCentrality(AliVEvent* event, Int_t& nTracklets);
956  Double_t FindCompatCentrality(AliVEvent* event);
968  Double_t FindCentrality(AliVEvent* event, Int_t& nTracklets);
975  /* @} */
976 
977  // -----------------------------------------------------------------
990  virtual Double_t LookupWeight(AliAODTracklet* tracklet, Double_t cent);
1000  virtual UShort_t CheckTracklet(AliAODTracklet* tracklet) const;
1001  /* @} */
1002 
1003  // -----------------------------------------------------------------
1015  void ProcessEvent(Double_t cent,const AliVVertex* ip,TClonesArray* tracklets);
1016  /* @} */
1017 
1018  // -----------------------------------------------------------------
1030  virtual Bool_t MasterFinalize(Container* results);
1031  /* @} */
1032 
1033  // -----------------------------------------------------------------
1035  enum {
1036  kAll=1, // Count all events
1037  kEvent, // Have event
1038  kTracklets, // Have tracklets
1039  kTrigger, // Have trigger
1040  kIP, // Have IP
1041  kCentrality, // Have centrality
1042  kCompleted // Have completed
1043  };
1044 
1045  // -----------------------------------------------------------------
1052 
1054 
1056 
1058 
1059  TProfile* fNBareVsGood;
1061  TProfile* fNBareVsFake;
1063  TProfile* fNTrackletVsGood;
1065  TProfile* fNTrackletVsFake;
1069  TProfile* fNGeneratedVsFake;
1071  TProfile* fCentTracklets;
1072 
1073  TProfile* fCentEst;
1074 
1102 
1104 };
1105 //====================================================================
1112 {
1113 public:
1115  typedef TList Container;
1121  {}
1125  AliTrackletAODMCdNdeta(const char* name)
1126  : AliTrackletAODdNdeta(name)
1127  {}
1135  {}
1140  //__________________________________________________________________
1157  {
1163  fCombinatorics(0),
1164  fDistinct(0),
1165  fPrimaries(0),
1166  fSecondaries(0),
1167  fGenerated(0)
1168  {
1169  }
1176  CentBin(Double_t c1, Double_t c2);
1182  CentBin(const CentBin& o)
1184  fCombinatorics(0),
1185  fPrimaries(0),
1186  fSecondaries(0),
1187  fGenerated(0)
1188  {}
1192  virtual ~CentBin() {}
1198  CentBin& operator=(const CentBin&) { return *this; }
1199  protected:
1205 
1206  ClassDef(CentBin,1);
1207  };
1208 
1209 protected:
1210  // -----------------------------------------------------------------
1224  {
1225  return new CentBin(c1, c2);
1226  }
1227  /* @} */
1228 
1229  // -----------------------------------------------------------------
1234  virtual const char* GetBranchName() const { return "AliAODMCTracklets"; }
1235  /* @} */
1236 
1238 };
1239 //====================================================================
1246 {
1247 public:
1249  typedef TList Container;
1255  fWeights(0),
1256  fEtaWeight(0),
1257  fWeightCorr(0)
1258  {}
1263  : AliTrackletAODMCdNdeta(name),
1264  fWeights(0),
1265  fEtaWeight(0),
1266  fWeightCorr(0)
1267  {}
1275  fWeights(0),
1276  fEtaWeight(0),
1277  fWeightCorr(0)
1278  {}
1297  void Print(Option_t* option="") const;
1298 
1299  // -----------------------------------------------------------------
1315  void SetWeightCalc(UChar_t mode=0) {
1316  Info("SetWeightCalc", "Use=%d", mode);
1317  if (fWeights) fWeights->SetCalc(mode);}
1323  void SetWeightMask(UChar_t mask=0xFF) {
1324  Info("SetWeightMask", "mask=0x%x", mask);
1325  if (fWeights) fWeights->SetMask(mask); }
1331  void SetWeightVeto(UChar_t veto=0x0) {
1332  Info("SetWeightVeto", "veto=0x%x", veto);
1333  if (fWeights) fWeights->SetVeto(veto); }
1334  /* @} */
1335 protected:
1336  // -----------------------------------------------------------------
1346  Bool_t WorkerInit();
1355  virtual Double_t LookupWeight(AliAODTracklet* tracklet, Double_t cent);
1356  /* @} */
1357  // -----------------------------------------------------------------
1369  Bool_t MasterFinalize(Container* results);
1370  /* @} */
1371  // -----------------------------------------------------------------
1373  TProfile2D* fEtaWeight;
1376 };
1377 
1378 //____________________________________________________________________
1380  : AliAnalysisTaskSE(),
1381  fContainer(0),
1382  fCentBins(0),
1383  fIPz(0),
1384  fCent(0),
1385  fStatus(0),
1386  fEtaPhi(0),
1387  fNBareVsGood(0),
1388  fNBareVsFake(0),
1389  fNTrackletVsGood(0),
1390  fNTrackletVsFake(0),
1391  fNGeneratedVsGood(0),
1392  fNGeneratedVsFake(0),
1393  fCentTracklets(0),
1394  fCentEst(0),
1395  fCentMethod(""),
1396  fCentIdx(-1),
1397  fTrkIdx(-1),
1398  fCentAxis(1,0,0),
1399  fIPzAxis(1,0,0),
1400  fEtaAxis(1,0,0),
1401  fPhiAxis(1,0,0),
1402  fMaxDelta(0),
1403  fTailDelta(0),
1404  fTailMax(-1),
1405  fDPhiShift(0),
1406  fShiftedDPhiCut(0),
1407  fDeltaCut(0),
1408  fAbsMinCent(-1)
1409 {}
1410 //____________________________________________________________________
1412  : AliAnalysisTaskSE(name),
1413  fContainer(0),
1414  fCentBins(0),
1415  fIPz(0),
1416  fCent(0),
1417  fStatus(0),
1418  fEtaPhi(0),
1419  fNBareVsGood(0),
1420  fNBareVsFake(0),
1421  fNTrackletVsGood(0),
1422  fNTrackletVsFake(0),
1423  fNGeneratedVsGood(0),
1424  fNGeneratedVsFake(0),
1425  fCentTracklets(0),
1426  fCentEst(0),
1427  fCentMethod("V0M"),
1428  fCentIdx(-1),
1429  fTrkIdx(-1),
1430  fCentAxis(10,0,100),
1431  fIPzAxis(30,-15,+15),
1432  fEtaAxis(16,-2,+2),
1433  fPhiAxis(100,0,TMath::TwoPi()),
1434  fMaxDelta(25),
1435  fTailDelta(5),
1436  fTailMax(-1),
1437  fDPhiShift(0.0045),
1438  fShiftedDPhiCut(-1),
1439  fDeltaCut(1.5),
1440  fAbsMinCent(-1)
1441 {
1442  FixAxis(fCentAxis, "Centrality [%]");
1443  FixAxis(fIPzAxis, "IP_{#it{z}} [cm]");
1444  FixAxis(fEtaAxis, "#eta");
1445  FixAxis(fPhiAxis, "#phi");
1446 
1447  DefineOutput(1, Container::Class());
1448  DefineOutput(2, Container::Class());
1449 }
1450 //____________________________________________________________________
1452  : AliAnalysisTaskSE(o),
1453  fContainer(0),
1454  fCentBins(0),
1455  fIPz(0),
1456  fCent(0),
1457  fStatus(0),
1458  fEtaPhi(0),
1459  fNBareVsGood(0),
1460  fNBareVsFake(0),
1461  fNTrackletVsGood(0),
1462  fNTrackletVsFake(0),
1463  fNGeneratedVsGood(0),
1464  fNGeneratedVsFake(0),
1465  fCentTracklets(0),
1466  fCentEst(0),
1467  fCentMethod(o.fCentMethod),
1468  fCentIdx(o.fCentIdx),
1469  fTrkIdx(o.fTrkIdx),
1470  fCentAxis(o.fCentAxis),
1471  fIPzAxis(o.fIPzAxis),
1472  fEtaAxis(o.fEtaAxis),
1473  fPhiAxis(o.fPhiAxis),
1474  fMaxDelta(o.fMaxDelta),
1475  fTailDelta(o.fTailDelta),
1476  fTailMax(o.fTailMax),
1477  fDPhiShift(o.fDPhiShift),
1478  fShiftedDPhiCut(o.fShiftedDPhiCut),
1479  fDeltaCut(o.fDeltaCut),
1480  fAbsMinCent(o.fAbsMinCent)
1481 {}
1482 //____________________________________________________________________
1485 {
1486  if (&o == this) return *this;
1487  if (fContainer) {
1488  delete fContainer;
1489  fContainer = 0;
1490  }
1491  if (fCentBins) {
1492  delete fCentBins;
1493  fCentBins = 0;
1494  }
1495  fIPz = 0;
1496  fCent = 0;
1498  fCentIdx = o.fCentIdx;
1499  fTrkIdx = o.fTrkIdx;
1500  fCentAxis = o.fCentAxis;
1501  fIPzAxis = o.fIPzAxis;
1502  fEtaAxis = o.fEtaAxis;
1503  fPhiAxis = o.fPhiAxis;
1504  fMaxDelta = o.fMaxDelta;
1505  fTailDelta = o.fTailDelta;
1506  fTailMax = o.fTailMax;
1507  fDPhiShift = o.fDPhiShift;
1509  fDeltaCut = o.fDeltaCut;
1511  return *this;
1512 }
1513 //____________________________________________________________________
1516  o)
1517 {
1518  if (&o == this) return *this;
1520  return *this;
1521 }
1522 //____________________________________________________________________
1524  const char* resFile)
1525 {
1526  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1527  if (!mgr) {
1528  AliError("No analysis manager to connect to.");
1529  return false;
1530  }
1531 
1532  // Add to the manager
1533  mgr->AddTask(this);
1534 
1535  // Create and connect output containers
1536  TString sumOut;
1537  TString resOut;
1538  if (sumFile && sumFile[0] != '\0') sumOut = sumFile;
1539  if (resFile && resFile[0] != '\0') resOut = resFile;
1540  else if (sumFile && sumFile[0] != '\0') resOut = sumFile;
1541 
1542  // If the string is null or 'default' connect to standard output file
1543  if (sumOut.IsNull() || sumOut.EqualTo("default", TString::kIgnoreCase))
1544  sumOut = AliAnalysisManager::GetCommonFileName();
1545  // If the string is null or 'default' connect to standard output file
1546  if (resOut.IsNull() || resOut.EqualTo("default", TString::kIgnoreCase))
1547  resOut = AliAnalysisManager::GetCommonFileName();
1548 
1549  // Always connect input
1550  mgr->ConnectInput(this, 0, mgr->GetCommonInputContainer());
1551 
1552  // Connect sum list unless the output 'none' is specified
1553  if (!sumOut.EqualTo("none", TString::kIgnoreCase)) {
1554  TString sumName(Form("%sSums", GetName()));
1555  AliAnalysisDataContainer* sumCon =
1556  mgr->CreateContainer(sumName, TList::Class(),
1557  AliAnalysisManager::kOutputContainer, sumOut);
1558  mgr->ConnectOutput(this, 1, sumCon);
1559  }
1560 
1561  // Connect the result list unless the output 'none' is specified
1562  if (!resOut.EqualTo("none", TString::kIgnoreCase)) {
1563  TString resName(Form("%sResults", GetName()));
1564  AliAnalysisDataContainer* resCon =
1565  mgr->CreateContainer(resName, TList::Class(),
1566  AliAnalysisManager::kParamContainer, resOut);
1567  mgr->ConnectOutput(this, 2, resCon);
1568  }
1569  return true;
1570 }
1571 //____________________________________________________________________
1573 {
1574  Double_t shiftedDPhiCut = fShiftedDPhiCut;
1575  if (shiftedDPhiCut < 0) shiftedDPhiCut = TMath::Sqrt(fDeltaCut)*0.06;
1576  Double_t tailMax = fTailMax;
1577  if (tailMax < 0) tailMax = fMaxDelta;
1578 
1579  Printf("%s: %s", ClassName(), GetName());
1580  Printf(" %22s: 0x%08x", "Off-line trigger mask", fOfflineTriggerMask);
1581  Printf(" %22s: %f", "Delta phi shift", fDPhiShift);
1582  Printf(" %22s: %f", "Shifted Delta phi cut", shiftedDPhiCut);
1583  Printf(" %22s: %f", "Delta cut", fDeltaCut);
1584  Printf(" %22s: %f", "max Delta", fMaxDelta);
1585  Printf(" %22s: %f", "tail Delta", fTailDelta);
1586  Printf(" %22s: %f", "tail maximum", tailMax);
1587  Printf(" %22s: %f%%", "Absolute least c", fAbsMinCent);
1590  PrintAxis(fIPzAxis,1,"IPz");
1591  PrintAxis(fCentAxis,0);
1592 
1593  if (!fCentBins) return;
1594 
1595  Printf("--- Centrality bins");
1596  TIter next(fCentBins);
1597  CentBin* bin = 0;
1598  while ((bin = static_cast<CentBin*>(next()))) {
1599  bin->Print(option);
1600  }
1601 }
1602 //____________________________________________________________________
1604 {
1606  if (!fWeights) return;
1607  fWeights->Print(option);
1608 }
1609 
1610 //____________________________________________________________________
1612 {
1613  Printf(" Centrality bin: %s", fName.Data());
1614  Printf(" Low cut: %5.1f", fLow);
1615  Printf(" High cut: %5.1f", fHigh);
1616 
1617  if (!fSubs) return;
1618  Printf(" --- Histogram sets");
1619  TIter next(fSubs);
1620  Histos* h = 0;
1621  while ((h = static_cast<Histos*>(next()))) {
1622  h->Print(option);
1623  }
1624 }
1625 
1626 //____________________________________________________________________
1628 {
1629  Sub::SetDebug(lvl);
1630  TIter next(fSubs);
1631  Histos* h = 0;
1632  while ((h = static_cast<Histos*>(next()))) {
1633  h->SetDebug(lvl);
1634  }
1635 }
1636 namespace {
1637  void Bits2String(UChar_t m, char out[7])
1638  {
1639  if (m & AliAODTracklet::kInjection) out[0] = 'I'; else out[0] = '-';
1640  if (m & AliAODTracklet::kCombinatorics) out[1] = 'C'; else out[1] = '-';
1641  if (m & AliAODTracklet::kSecondary) out[2] = 'S'; else out[2] = '-';
1642  if (m & AliAODTracklet::kDistinct) out[3] = 'D'; else out[3] = '-';
1643  if (m & AliAODTracklet::kSimulated) out[4] = 'X'; else out[4] = '-';
1644  if (m & AliAODTracklet::kGenerated) out[5] = 'G'; else out[5] = '-';
1645  out[6] = '\0';
1646  }
1647 }
1648 
1649 //____________________________________________________________________
1651 {
1652  char cMask[7]; Bits2String(fMask, cMask);
1653  char cVeto[7]; Bits2String(fVeto, cVeto);
1654  Printf(" Histograms: %s", fName.Data());
1655  Printf(" Mask: 0x%02x (%s)", fMask, cMask);
1656  Printf(" Veto: 0x%02x (%s)", fVeto, cVeto);
1657  Printf(" Delta: %s", fEtaDeltaIPz ? "yes" : "no");
1658 }
1659 
1660 
1661 //____________________________________________________________________
1662 void
1664 {
1665  if (!WorkerInit()) {
1666  AliWarning("Failed to initialize on worker");
1667  return;
1668  }
1669  PostData(1,fContainer);
1670 }
1671 
1672 //____________________________________________________________________
1674 {
1675  if (DebugLevel() > 1) Printf("Initialising on worker");
1676  if (fShiftedDPhiCut < 0) fShiftedDPhiCut = TMath::Sqrt(fDeltaCut)*0.06;
1677  if (fTailMax < 0) fTailMax = fMaxDelta;
1678 
1679  fContainer = new Container;
1680  fContainer->SetName(Form("%sSums", GetName()));
1681  fContainer->SetOwner();
1682 
1683  Bool_t save = TH1::GetDefaultSumw2();
1684  TH1::SetDefaultSumw2();
1685  fIPz = Make1D(fContainer, "ipz", "", kMagenta+2, 20, fIPzAxis);
1686  fCent = Make1D(fContainer, "cent", "", kMagenta+2, 20, fCentAxis);
1687  fEtaPhi = Make2D(fContainer, "etaPhi","",kMagenta+2, 20, fEtaAxis,fPhiAxis);
1688 
1689  TAxis trackletAxis(1000, 0, 10000);
1690  FixAxis(trackletAxis, "#it{N}_{tracklets}");
1691  fNBareVsGood = Make1P(fContainer, "nBareVsGood", "Good",
1692  kGreen+2, 20, trackletAxis);
1693  fNBareVsFake = Make1P(fContainer, "nBareVsFake", "Fake",
1694  kRed+2, 20, trackletAxis);
1695  fNBareVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1696  fNBareVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1697  fNBareVsGood->SetStats(0);
1698  fNBareVsFake->SetStats(0);
1699 
1700  fNTrackletVsGood = Make1P(fContainer, "nTrackletVsGood", "Good",
1701  kGreen+2, 20, trackletAxis);
1702  fNTrackletVsFake = Make1P(fContainer, "nTrackletVsFake", "Fake",
1703  kRed+2, 20, trackletAxis);
1704  fNTrackletVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1705  fNTrackletVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1706  fNTrackletVsGood->SetStats(0);
1707  fNTrackletVsFake->SetStats(0);
1708 
1709  TAxis generatedAxis(1000, 0, 15000);
1710  FixAxis(generatedAxis, "#it{N}_{generated,|#eta|<2}");
1711  fNGeneratedVsGood = Make1P(fContainer, "nGeneratedVsGood", "Good",
1712  kGreen+2, 24, generatedAxis);
1713  fNGeneratedVsFake = Make1P(fContainer, "nGeneratedVsFake", "Fake",
1714  kRed+2, 24, generatedAxis);
1715  fNGeneratedVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1716  fNGeneratedVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1717  fNGeneratedVsGood->SetStats(0);
1718  fNGeneratedVsFake->SetStats(0);
1719 
1720  fCentTracklets = new TProfile("centTracklets",
1721  "Mean number of tracklets per centrality",
1722  1050, 0, 105);
1723  fCentTracklets->SetXTitle("Centrality [%]");
1724  fCentTracklets->SetYTitle("#LTtracklets#GT");
1725  fCentTracklets->SetDirectory(0);
1726  fCentTracklets->SetMarkerStyle(20);
1727  fCentTracklets->SetMarkerColor(kMagenta+2);
1728  fCentTracklets->SetLineColor(kMagenta+2);
1729  fContainer->Add(fCentTracklets);
1730  fCentEst = Make1P(fContainer,"centEstimator","",kMagenta+2, 20, fCentAxis);
1731  fCentEst->SetYTitle(Form("#LT%s%GT",fCentMethod.Data()));
1732  TH1::SetDefaultSumw2(save);
1733 
1734  fStatus = new TH1F("status", "Status of task",
1735  kCompleted, .5, kCompleted+.5);
1736  fStatus->SetMarkerSize(2);
1737  fStatus->SetMarkerColor(kMagenta+2);
1738  fStatus->SetLineColor(kMagenta+2);
1739  fStatus->SetFillColor(kMagenta+2);
1740  fStatus->SetFillStyle(1001);
1741  fStatus->SetBarOffset(0.1);
1742  fStatus->SetBarWidth(0.4);
1743  fStatus->SetDirectory(0);
1744  fStatus->SetStats(0);
1745  fStatus->SetXTitle("Event have");
1746  fStatus->SetYTitle("# Events");
1747  fStatus->GetXaxis()->SetBinLabel(kAll, "Been seen");
1748  fStatus->GetXaxis()->SetBinLabel(kEvent, "Event data");
1749  fStatus->GetXaxis()->SetBinLabel(kTracklets, "Tracklets");
1750  fStatus->GetXaxis()->SetBinLabel(kTrigger, "Trigger");
1751  fStatus->GetXaxis()->SetBinLabel(kIP, "IP");
1752  fStatus->GetXaxis()->SetBinLabel(kCentrality, "Centrality");
1753  fStatus->GetXaxis()->SetBinLabel(kCompleted, "Completed");
1754  fContainer->Add(fStatus);
1755 
1756  typedef TParameter<double> DP;
1757  typedef TParameter<bool> BP;
1758  typedef TParameter<int> IP;
1759  Container* params = new Container;
1760  params->SetName("parameters");
1761  params->SetOwner();
1762  fContainer->Add(params);
1763  params->Add(new DP("DPhiShift", fDPhiShift, 'f'));
1764  params->Add(new DP("ShiftedDPhiCut", fShiftedDPhiCut, 'f'));
1765  params->Add(new DP("DeltaCut", fDeltaCut, 'f'));
1766  params->Add(new DP("MaxDelta", fMaxDelta, 'f'));
1767  params->Add(new DP("TailDelta", fTailDelta, 'f'));
1768  params->Add(new DP("TailMax", fTailMax, 'f'));
1769  params->Add(new DP("AbsMinCent", fAbsMinCent, 'f'));
1770  // Create our centrality bins
1771  if (!InitCentBins(0)) {
1772  AliWarning("Failed to initialize centrality bins");
1773  return false;
1774  }
1775 
1776  // Print information to log
1777  Print();
1778  return true;
1779 }
1780 //____________________________________________________________________
1782 {
1783  if (!AliTrackletAODMCdNdeta::WorkerInit()) return false;
1784  fEtaWeight = 0;
1785  if (!fWeights) {
1786  AliFatal("No weights set!");
1787  return false;
1788  }
1789 
1790  TAxis wAxis(100,0,10);
1791  FixAxis(wAxis,"#it{w}_{i}");
1792  fEtaWeight = Make2P(fContainer, "etaWeight", "#LTw#GT", kYellow+2, 24,
1793  fEtaAxis, fCentAxis);
1794  fWeightCorr = Make2D(fContainer, "weightCorr", "w_{1} vs w_{2}",
1795  kCyan+2, 24, wAxis, wAxis);
1796  fWeights->Store(fContainer);
1797  return true;
1798 }
1799 //____________________________________________________________________
1801 {
1802  if (DebugLevel() > 1)
1803  Printf("Initialising on centrality bins on %s",
1804  existing ? "master" : "worker");
1805  if (fCentBins) return true;
1806  fCentBins = new Container;
1807  fCentBins->SetName("centralityBins");
1808  fCentBins->SetOwner();
1809 
1810  TAxis deltaAxis (Int_t(5*fMaxDelta),0, fMaxDelta);
1811  FixAxis(deltaAxis,
1812  "#Delta=[(#Delta#phi-#delta#phi)/#sigma_{#phi}]^{2}+"
1813  "[#Delta#thetasin^{-2}(#theta)/#sigma_{#theta}]^{2}");
1814 
1815  // Add min-bias bin
1816  Bool_t ret = true;
1817  CentBin* bin = MakeCentBin(0, 100);
1818  if (!existing)
1819  ret = bin->WorkerInit(fContainer,fEtaAxis,fIPzAxis,deltaAxis);
1820  else
1821  ret = bin->FinalizeInit(existing);
1822  if (!ret) {
1823  AliWarningF("Failed to initialize bin %s", bin->GetName());
1824  return false;
1825  }
1826  bin->SetDebug(DebugLevel());
1827  fCentBins->AddAt(bin, 0);
1828 
1829  // Add other bins
1830  Int_t nCentBins = fCentAxis.GetNbins();
1831  for (Int_t i = 1; i <= nCentBins; i++) {
1832  Float_t c1 = fCentAxis.GetBinLowEdge(i);
1833  Float_t c2 = fCentAxis.GetBinUpEdge(i);
1834  bin = MakeCentBin(c1, c2);
1835  if (!existing)
1836  ret = bin->WorkerInit(fContainer,fEtaAxis,fIPzAxis,deltaAxis);
1837  else
1838  ret = bin->FinalizeInit(existing);
1839  if (!ret) {
1840  AliWarningF("Failed to initialize %s", bin->GetName());
1841  return false;
1842  }
1843  bin->SetDebug(DebugLevel());
1844  fCentBins->AddAt(bin, i);
1845  }
1846  return true;
1847 }
1848 
1849 //____________________________________________________________________
1851  : Sub(""),
1852  fSubs(0),
1853  fLow(c1),
1854  fHigh(c2),
1855  fIPz(0),
1856  fCent(0),
1857  fCentIPz(0),
1858  fMeasured(0),
1859  fInjection(0)
1860 {
1861  fName.Form("cent%03dd%02d_%03dd%02d",
1862  Int_t(fLow), Int_t(fLow*100)%100,
1863  Int_t(fHigh), Int_t(fHigh*100)%100);
1864  fMeasured = MakeHistos("measured", kRed+2, 20,
1865  kMeasuredMask, // No requirements, just veto
1866  kMeasuredVeto);
1867  fInjection = MakeHistos("injected", kOrange+2, 21,
1868  kInjectedMask,
1869  kInjectedVeto);
1870  fSubs = new Container;
1871  fSubs->SetOwner(true);
1872  fSubs->Add(fMeasured);
1873  fSubs->Add(fInjection);
1874 }
1875 
1876 //____________________________________________________________________
1878  : AliTrackletAODdNdeta::CentBin(c1, c2),
1879  fCombinatorics(0),
1880  fDistinct(0),
1881  fPrimaries(0),
1882  fSecondaries(0),
1883  fGenerated(0)
1884 {
1885  // Combinatorics is everything that has the combinatorics bit
1886  // Primaries all with simulated bit, but not secondary or
1887  // combinatorics bit.
1888  // Secondaries are all those with the secondary bit set
1889  fCombinatorics = MakeHistos("combinatorics", kMagenta+2, 30,
1892  fDistinct = MakeHistos("distinct", kCyan+2, 27,
1893  kDistinctMask,
1894  kDistinctVeto);
1895  fPrimaries = MakeHistos("primaries", kGreen+2, 26,
1896  kPrimaryMask,
1897  kPrimaryVeto);
1898  fSecondaries = MakeHistos("secondaries", kBlue+2, 32,
1900  kSecondaryVeto);
1901  fGenerated = MakeHistos("generated", kGray+1, 28,
1903  kGeneratedVeto);
1904  fMeasured->fStyle = 24;
1905  fInjection->fStyle = 25;
1906  fSubs->Add(fCombinatorics);
1907  fSubs->Add(fDistinct);
1908  fSubs->Add(fPrimaries);
1909  fSubs->Add(fSecondaries);
1910  fSubs->AddAfter(fMeasured, fGenerated);
1911 }
1912 
1913 //____________________________________________________________________
1916  Color_t color,
1917  Style_t style,
1918  UShort_t mask,
1919  UShort_t veto)
1920 {
1921  return new Histos(name, color, style, mask, veto);
1922 }
1923 
1924 //____________________________________________________________________
1926  const TAxis& etaAxis,
1927  const TAxis& ipzAxis,
1928  const TAxis& deltaAxis)
1929 {
1930  if (fDebug > 0)
1931  Printf("Initializing centrality bin %s", fName.Data());
1932  if (!Sub::WorkerInit(parent, etaAxis, ipzAxis, deltaAxis)) return false;
1933 
1934  TAxis centAxis(20, fLow, fHigh);
1935  FixAxis(centAxis, "Centrality [%]");
1936  fCent = Make1D(fContainer,"cent","Centrality [%]",
1937  kMagenta+2,20,centAxis);
1938  fIPz = Make1D(fContainer,"ipz","IP_{#it{z}} [cm]",kRed+2,20,ipzAxis);
1939  fCentIPz = Make1P(fContainer,"centIpz","#LTc#GT vs IP_{#it{z}}",kPink+2,
1940  20,ipzAxis);
1941  fCentIPz->SetYTitle("#LTc#GT");
1942  TIter next(fSubs);
1943  Histos* h = 0;
1944  while ((h = static_cast<Histos*>(next()))) {
1945  if (!h ->WorkerInit(fContainer, etaAxis,ipzAxis,deltaAxis))
1946  return false;
1947  }
1948 
1949  return true;
1950 }
1951 //____________________________________________________________________
1953  const TAxis& etaAxis,
1954  const TAxis& ipzAxis,
1955  const TAxis& deltaAxis)
1956 {
1957  if (!Sub::WorkerInit(parent, etaAxis, ipzAxis, deltaAxis)) return false;
1958  TString shrt(Form("%c", GetName()[0]));
1959  shrt.ToUpper();
1960  if (GetC(parent, "generated", false) != 0) shrt.Append("'");
1961 
1962  // Do not make eta vs IPz for secondaries and primaries
1963  if (!IsPrimary() && !IsSecondary())
1964  fEtaIPz = Make2D(fContainer, "etaIPz", shrt.Data(),
1965  kRed+2, 20, etaAxis, ipzAxis);
1966  // Always make eta vs Delta distribution, except for MC truth
1967  if (!IsGenerated())
1968  fEtaDeltaIPz = Make3D(fContainer, "etaDeltaIPz",
1969  Form("#Delta_{%s}",shrt.Data()),
1970  kBlue+2, 21, etaAxis, deltaAxis, ipzAxis);
1971  if (!IsGenerated() &&
1972  // !IsPrimary() &&
1973  // !IsSecondary() &&
1974  !IsInjected() &&
1975  fStyle != 20) // Last condition to not make this for real data
1976  fEtaPdgIPz = Make3D(fContainer, "etaPdgIPz",
1977  "Parent particle type",
1978  kGreen+2, 22, etaAxis, PdgAxis(), ipzAxis);
1979 
1980  if (IsGenerated()) {
1981  fEtaPdg = Make2D(fContainer, "etaPdg",
1982  "Primary particle type",
1983  kYellow+2, 30, etaAxis, PdgAxis());
1984  TAxis ptAxis(100, 0, 5);
1985  ptAxis.SetTitle("#it{p}_{T}");
1986  FixAxis(ptAxis);
1987  fEtaPt = Make2D(fContainer, "etaPt",
1988  "Primary transverse momentum",
1989  kCyan+2, 30, etaAxis, ptAxis);
1990  }
1991 
1992  SetAttr(fColor, fStyle);
1993  return true;
1994 }
1995 //____________________________________________________________________
1997 {
1998  if (fEtaIPz) {
1999  fEtaIPz->SetMarkerStyle(m);
2000  fEtaIPz->SetMarkerColor(c);
2001  fEtaIPz->SetLineColor(c);
2002  fEtaIPz->SetFillColor(c);
2003  }
2004  if (fEtaDeltaIPz) {
2005  fEtaDeltaIPz->SetMarkerStyle(m);
2006  fEtaDeltaIPz->SetMarkerColor(c);
2007  fEtaDeltaIPz->SetLineColor(c);
2008  fEtaDeltaIPz->SetFillColor(c);
2009  }
2010  if (fEtaPdgIPz) {
2011  fEtaPdgIPz->SetMarkerStyle(m);
2012  fEtaPdgIPz->SetMarkerColor(c);
2013  fEtaPdgIPz->SetLineColor(c);
2014  fEtaPdgIPz->SetFillColor(c);
2015  }
2016  if (fEtaPdg) {
2017  fEtaPdg->SetMarkerStyle(m);
2018  fEtaPdg->SetMarkerColor(c);
2019  fEtaPdg->SetLineColor(c);
2020  fEtaPdg->SetFillColor(c);
2021  }
2022  if (fEtaPt) {
2023  fEtaPt->SetMarkerStyle(m);
2024  fEtaPt->SetMarkerColor(c);
2025  fEtaPt->SetLineColor(c);
2026  fEtaPt->SetFillColor(c);
2027  }
2028 }
2029 
2030 //____________________________________________________________________
2031 void
2033 {
2034  if (DebugLevel() > 0) Printf("In user exec");
2035  Double_t cent = -1;
2036  const AliVVertex* ip = 0;
2037  TClonesArray* tracklets = 0;
2038  if (!CheckEvent(cent, ip, tracklets)) {
2039  AliWarningF("Event didn't pass %f, %p, %p", cent, ip, tracklets);
2040  Printf("Argh, check data failed %f, %p, %p", cent, ip, tracklets);
2041  return;
2042  }
2043  if (DebugLevel() > 0) Printf("Got centrality=%f ipZ=%f %d tracklets",
2044  cent, ip->GetZ(), tracklets->GetEntriesFast());
2045  ProcessEvent(cent, ip, tracklets);
2046 
2047  PostData(1,fContainer);
2048  fStatus->Fill(kCompleted);
2049 }
2050 
2051 //____________________________________________________________________
2053  const AliVVertex*& ip,
2054  TClonesArray*& tracklets)
2055 {
2056  // Count all events
2057  fStatus->Fill(kAll);
2058 
2059  // Check for event
2060  AliVEvent* event = InputEvent();
2061  if (!event) {
2062  AliWarning("No event");
2063  return false;
2064  }
2065  fStatus->Fill(kEvent);
2066 
2067  // Check if we have the tracklets
2068  tracklets = FindTracklets(event);
2069  if (!tracklets) return false;
2070  fStatus->Fill(kTracklets);
2071 
2072  // Check if event was triggered
2073  Bool_t trg = FindTrigger();
2074  if (!trg) return false;
2075  fStatus->Fill(kTrigger);
2076 
2077  // Check the interaction point
2078  ip = FindIP(event);
2079  if (!ip) return false;
2080  fStatus->Fill(kIP);
2081 
2082  // Check the centrality
2083  Int_t nTracklets = 0;
2084  cent = FindCentrality(event, nTracklets);
2085  if (cent < 0) return false;
2086  fStatus->Fill(kCentrality);
2087 
2088  fIPz->Fill(ip->GetZ());
2089  fCent->Fill(cent);
2090  fCentTracklets->Fill(cent, nTracklets);
2091 
2092  return true;
2093 }
2094 
2095 //____________________________________________________________________
2096 TClonesArray* AliTrackletAODdNdeta::FindTracklets(AliVEvent* event)
2097 {
2098  // Check the multiplicity
2099  TObject* obj = event->FindListObject(GetBranchName());
2100  if (!obj) {
2101  AliWarningF("Couldn't get object %s", GetBranchName());
2102  // event->GetList()->Print();
2103  return 0;
2104  }
2105  if (!obj->IsA()->InheritsFrom(TClonesArray::Class())) {
2106  AliWarningF("Object %s is not a TClonesArray but a %s",
2107  obj->GetName(), obj->ClassName());
2108  return 0;
2109  }
2110  return static_cast<TClonesArray*>(obj);
2111 }
2112 
2113 //____________________________________________________________________
2114 const AliVVertex* AliTrackletAODdNdeta::CheckIP(const AliVVertex* ip,
2115  Double_t maxDispersion,
2116  Double_t maxZError)
2117 {
2118  if (!ip) return 0;
2119  if (ip->GetNContributors() <= 0) {
2120  AliWarning("Not enough contributors for IP");
2121  return 0;
2122  }
2123  // If this is from the Z vertexer, do some checks
2124  if (ip->IsFromVertexerZ()) {
2125  // Get covariance matrix
2126  Double_t covar[6];
2127  ip->GetCovarianceMatrix(covar);
2128  Double_t sigmaZ = TMath::Sqrt(covar[5]);
2129  if (sigmaZ >= maxZError) {
2130  AliWarningF("IPz resolution = %f >= %f", sigmaZ, maxZError);
2131  return 0;
2132  }
2133 
2134  // If this IP doesn not derive from AliVertex, don't check dispersion.
2135  if (ip->IsA()->InheritsFrom(AliVertex::Class())) {
2136  const AliVertex* ipv = static_cast<const AliVertex*>(ip);
2137  // Dispersion is the parameter used by the vertexer for finding the IP.
2138  if (ipv->GetDispersion() >= maxDispersion) {
2139  AliWarningF("IP dispersion = %f >= %f",
2140  ipv->GetDispersion(), maxDispersion);
2141  return 0;
2142  }
2143  }
2144  }
2145 
2146  // If we get here, we either have a full 3D vertex or track
2147  // vertex, and we should check if it is in range
2148  if (ip->GetZ() < fIPzAxis.GetXmin() || ip->GetZ() > fIPzAxis.GetXmax()) {
2149  AliWarningF("IPz = %fcm out of range [%f,%f]cm",
2150  ip->GetZ(), fIPzAxis.GetXmin(), fIPzAxis.GetXmax());
2151  return 0;
2152  }
2153  return ip;
2154 }
2155 
2156 //____________________________________________________________________
2157 const AliVVertex* AliTrackletAODdNdeta::FindRealIP(AliVEvent* event,
2158  Double_t maxDispersion,
2159  Double_t maxZError)
2160 {
2161  const AliVVertex* ip = event->GetPrimaryVertex();
2162  if (!ip) {
2163  if (DebugLevel() > 1) AliWarning("No real IP for this event found!");
2164  return 0;
2165  }
2166  return CheckIP(ip, maxDispersion, maxZError);
2167 }
2168 
2169 //____________________________________________________________________
2170 const AliVVertex* AliTrackletAODdNdeta::FindSimpleIP(AliVEvent* event,
2171  Double_t maxDispersion,
2172  Double_t maxZError)
2173 {
2174  static AliVertex* ip;
2175  AliAODSimpleHeader* head =
2176  static_cast<AliAODSimpleHeader*>(event
2177  ->FindListObject("AliAODSimpleHeader"));
2178  if (!head) {
2179  if (DebugLevel() > 1) AliWarning("No simple header");
2180  return 0;
2181  }
2182  if (!ip)
2183  ip = new AliVertex;
2184  ip->SetXv(head->fRecIP.X());
2185  ip->SetYv(head->fRecIP.Y());
2186  ip->SetZv(head->fRecIP.Z());
2187  ip->SetNContributors(10);
2188  ip->SetTitle("");
2189  return CheckIP(ip, maxDispersion, maxZError);
2190 }
2191 
2192 //____________________________________________________________________
2193 const AliVVertex* AliTrackletAODdNdeta::FindIP(AliVEvent* event,
2194  Double_t maxDispersion,
2195  Double_t maxZError)
2196 {
2197  const AliVVertex* ip = FindRealIP(event,maxDispersion,maxZError);
2198  if (!ip) {
2199  ip = FindSimpleIP(event,maxDispersion,maxZError);
2200  if (!ip) {
2201  if (DebugLevel() > 1) AliWarning("No IP for this event found!");
2202  return 0;
2203  }
2204  }
2205  // Good vertex, return it
2206  return ip;
2207 }
2208 //____________________________________________________________________
2210 {
2211  UInt_t evBits = fInputHandler->IsEventSelected();
2212  Bool_t trgOK = (evBits & fOfflineTriggerMask || fOfflineTriggerMask == 0);
2213  if (DebugLevel())
2214  Printf("Trigger bits=0x%08x mask=0x%08x masked=0x%08x -> %s",
2215  evBits, fOfflineTriggerMask, evBits & fOfflineTriggerMask,
2216  trgOK ? "selected" : "rejected");
2217  return trgOK;
2218 }
2219 //____________________________________________________________________
2221 {
2222  static TString centMeth;
2223  if (centMeth.IsNull()) {
2224  centMeth = fCentMethod(3,fCentMethod.Length()-3);
2225  }
2226  AliCentrality* cent = event->GetCentrality();
2227  if (!cent) return -1;
2228 
2229  Double_t centPer = cent->GetCentralityPercentileUnchecked(centMeth);
2230  return centPer;
2231 }
2232 //____________________________________________________________________
2234  Int_t& nTracklets)
2235 {
2236  AliMultSelection* cent =
2237  static_cast<AliMultSelection*>(event->FindListObject("MultSelection"));
2238  if (!cent) {
2239  AliWarning("No centrality in event");
2240  event->GetList()->Print();
2241  return -1;
2242  }
2243  if (fCentIdx < 0) {
2244  TString trkName("SPDTracklets");
2245  for (Int_t i = 0; i < cent->GetNEstimators(); i++) {
2246  AliMultEstimator* e = cent->GetEstimator(i);
2247  if (!e) continue;
2248  if (fCentMethod.EqualTo(e->GetName())) fCentIdx = i;
2249  if (trkName.EqualTo(e->GetName())) fTrkIdx = i;
2250  }
2251  }
2252  if (fCentIdx < 0) {
2253  AliWarningF("Centrality estimator %s not found", fCentMethod.Data());
2254  return -1;
2255  }
2256 
2257  // Use cached index to look up the estimator
2258  AliMultEstimator* estCent = cent->GetEstimator(fCentIdx);
2259  if (!estCent) {
2260  AliWarningF("Centrality estimator %s not available for this event",
2261  fCentMethod.Data());
2262  return -1;
2263  }
2264  fCentEst->Fill(estCent->GetPercentile(), estCent->GetValue());
2265 
2266  // Now look up tracklet value using cached index
2267  if (fTrkIdx < 0) return estCent->GetPercentile();
2268  AliMultEstimator* estTracklets = cent->GetEstimator(fTrkIdx);
2269  if (estTracklets) nTracklets = estTracklets->GetValue();
2270 
2271  return estCent->GetPercentile();
2272 }
2273 
2274 //____________________________________________________________________
2276  Int_t& nTracklets)
2277 {
2278  if (fCentMethod.EqualTo("MB", TString::kIgnoreCase)) {
2279  Printf("MB centrality - not checked");
2280  return 0;
2281  }
2282  Double_t centPer = -1;
2283  if (fCentMethod.BeginsWith("OLD"))
2284  centPer = FindCompatCentrality(event);
2285  else
2286  centPer = FindMultCentrality(event, nTracklets);
2287  const Double_t safety = 1e-3;
2288  if (DebugLevel() > 1) Printf("Read centrality: %f%%", centPer);
2289  if (centPer < -safety) return -2;
2290  if (centPer < +safety) centPer = safety;
2291  else if (centPer > 100-safety) centPer = 100-safety;
2292 
2293  if (fAbsMinCent >= 0 && centPer < fAbsMinCent) {
2294  AliWarningF("Centrality = %f lower than absolute minimum [%f]",
2295  centPer, fAbsMinCent);
2296  return -3;
2297  }
2298  if (centPer < fCentAxis.GetXmin() || centPer > fCentAxis.GetXmax()) {
2299  AliWarningF("Centrality = %f out of range [%f,%f]",
2300  centPer, fCentAxis.GetXmin(), fCentAxis.GetXmax());
2301  return -3;
2302  }
2303  return centPer;
2304 }
2305 
2306 //____________________________________________________________________
2308  Double_t cent)
2309 {
2310  return 1;
2311 }
2312 //____________________________________________________________________
2314  Double_t cent)
2315 {
2316  // We don't check for weights, as we must have them to come this far
2317  // if (!fWeights) {
2318  // AliWarning("No weights defined");
2319  // return 1;
2320  // }
2321  Double_t w = fWeights->LookupWeight(tracklet, cent, fWeightCorr);
2322  if (tracklet->IsMeasured())
2323  fEtaWeight->Fill(tracklet->GetEta(), cent, w);
2324 
2325  // printf("Looking up weight of tracklet -> %f ", w);
2326  // tracklet->Print();
2327  return w;
2328 }
2329 //____________________________________________________________________
2331 {
2332  Double_t dPhiS = (tracklet->GetDPhi() -
2333  TMath::Sign(fDPhiShift,Double_t(tracklet->GetDPhi())));
2334  UShort_t ret = 0;
2335  ret |= ((tracklet->GetDelta() <= fDeltaCut) ? 0x1 : 0);
2336  ret |= ((dPhiS < fShiftedDPhiCut) ? 0x2 : 0);
2337  // Printf("dPhiS=%f (%f) Delta=%f (%f) -> 0x%x",
2338  // dPhiS, fShiftedDPhiCut,
2339  // tracklet->GetDelta(), fDeltaCut,
2340  // ret);
2341  return ret;
2342 }
2343 
2344 
2345 //____________________________________________________________________
2347  const AliVVertex* ip,
2348  TClonesArray* tracklets)
2349 {
2350  // Figure out which centrality bins to fill
2351  Int_t nAcc = 0;
2352  TIter nextAcc(fCentBins);
2353  CentBin* bin = 0;
2354  TList toRun;
2355  while ((bin = static_cast<CentBin*>(nextAcc()))) {
2356  if (!bin->Accept(cent, ip->GetZ())) continue; // Not in range for this bin
2357  toRun.Add(bin);
2358  nAcc++;
2359  }
2360  // If we have no centrality bins to fill, we return immediately
2361  if (nAcc <= 0) return;
2362 
2363  Double_t nBare = 0;
2364  Double_t nMeasured = 0;
2365  Double_t nGenerated = 0;
2366  Double_t nGood = 0;
2367  Double_t nFake = 0;
2368  AliAODTracklet* tracklet = 0;
2369  TIter nextTracklet(tracklets);
2370  while ((tracklet = static_cast<AliAODTracklet*>(nextTracklet()))) {
2371  Double_t weight = LookupWeight(tracklet, cent);
2372  UShort_t signal = CheckTracklet(tracklet);
2373  if (signal) fEtaPhi->Fill(tracklet->GetEta(), tracklet->GetPhi());
2374  if (tracklet->IsMeasured()) {
2375  nMeasured += weight;
2376  nBare ++;
2377  if (tracklet->IsCombinatorics()) nFake += weight;
2378  else nGood += weight;
2379  }
2380  else if (tracklet->IsGenerated() &&
2381  !tracklet->IsNeutral() &&
2382  TMath::Abs(tracklet->GetEta()) <= 2) nGenerated ++; // += weight;
2383  TIter nextBin(&toRun);
2384  while ((bin = static_cast<CentBin*>(nextBin()))) {
2385  bin->ProcessTracklet(tracklet, ip->GetZ(), signal, weight);
2386  }
2387  }
2388  fNBareVsFake ->Fill(nBare, nFake);
2389  fNBareVsGood ->Fill(nBare, nGood);
2390  fNTrackletVsFake ->Fill(nMeasured, nFake);
2391  fNTrackletVsGood ->Fill(nMeasured, nGood);
2392  fNGeneratedVsFake->Fill(nGenerated, nFake);
2393  fNGeneratedVsGood->Fill(nGenerated, nGood);
2394 }
2395 
2396 //____________________________________________________________________
2398 {
2399  if (cent < fLow || cent >= fHigh) return false;
2400  fCent ->Fill(cent);
2401  fIPz ->Fill(ipz);
2402  fCentIPz->Fill(ipz, cent);
2403  return true;
2404 }
2405 
2406 //____________________________________________________________________
2408  Double_t ipZ,
2409  UShort_t signal,
2410  Double_t weight)
2411 {
2412  TIter next(fSubs);
2413  Histos* h = 0;
2414  if (fDebug > 3) tracklet->Print();
2415  while ((h = static_cast<Histos*>(next())))
2416  h->ProcessTracklet(tracklet, ipZ, signal, weight);
2417 
2418  return true;
2419 }
2420 //____________________________________________________________________
2422  Double_t ipZ,
2423  UShort_t signal,
2424  Double_t weight)
2425 {
2426  if (!fEtaIPz && !fEtaDeltaIPz) return true;
2427  // Get tracklet info
2428  Double_t eta = tracklet->GetEta();
2429  Double_t delta = tracklet->GetDelta();
2430  UChar_t flags = tracklet->GetFlags();
2431  Int_t pdgBin = -1;
2432 
2433  // For debugging
2434  char m[7];
2435  if (fDebug > 3) Bits2String(flags, m);
2436 
2437  // Check the filter mask
2438  if (fMask != 0 && (flags & fMask) == 0) {
2439  if (fDebug > 3) Printf("%14s (0x%02x,----) %6s %7s (0x%02x) ",
2440  GetName(),fMask,"reject",m,flags);
2441  return false;
2442  }
2443 
2444  // If we need the PDG code, get that here
2445  if (fEtaPdgIPz || fEtaPdg) pdgBin = PdgBin(tracklet->GetParentPdg());
2446 
2447  // If we have the eta-vs-pdg histogram, we should fill before the
2448  // veto, which filters out the neutral particles.
2449  if (fEtaPdg) fEtaPdg->Fill(eta, pdgBin, weight);
2450 
2451  // Check the veto mask
2452  if (fVeto != 0 && (flags & fVeto) != 0) {
2453  if (fDebug > 3) Printf("%14s (----,0x%02x) %6s %7s (0x%02x) ",
2454  GetName(), fVeto, "veto", m, flags);
2455  return false;
2456  }
2457  // Debug message that we accepted tracklet
2458  if (fDebug > 3) Printf("%14s (0x%02x,0x%02x) %6s %7s (0x%02x) ",
2459  GetName(), fMask, fVeto, "accept", m, flags);
2460 
2461  // Both reguirements (Delta < cut, dPhi < cut)
2462  if (fEtaIPz && (signal == 0x3)) fEtaIPz->Fill(eta, ipZ, weight);
2463  // Just check dPhi
2464  if (fEtaDeltaIPz && (signal & 0x2)) fEtaDeltaIPz->Fill(eta,delta,ipZ,weight);
2465 
2466  // If we do not need the eta-PDG-IPz or eta-Pt, return now
2467  if (!fEtaPdgIPz && !fEtaPt) return true;
2468 
2469  if (fEtaPdgIPz) {
2470  fEtaPdgIPz->Fill(eta, pdgBin, ipZ, weight);
2471  if (tracklet->IsCombinatorics())
2472  // Fill both particles
2473  fEtaPdgIPz->Fill(eta, PdgBin(tracklet->GetParentPdg(true)), ipZ, weight);
2474  }
2475 
2476  if (fEtaPt) fEtaPt ->Fill(eta, tracklet->GetParentPt(), weight);
2477 
2478  return true;
2479 }
2480 
2481 
2482 //____________________________________________________________________
2483 void
2485 {
2486  Container* results = new Container;
2487  results->SetName(Form("%sResults",GetName()));
2488  results->SetOwner();
2489 
2490  Print("");
2491  fContainer = static_cast<Container*>(GetOutputData(1));
2492  if (!fContainer) {
2493  AliWarning("No sum container found!");
2494  return;
2495  }
2496 
2497  if (!InitCentBins(fContainer)) {
2498  AliWarningF("Failed to initialize centrality bins from %s",
2499  fContainer->GetName());
2500  return;
2501  }
2502 
2503  if (!MasterFinalize(results)) {
2504  AliWarning("Failed to finalize results");
2505  return;
2506  }
2507 
2508  PostData(2, results);
2509 }
2510 
2511 
2512 //____________________________________________________________________
2514 {
2515  fContainer = GetC(parent, fName);
2516  fCent = GetH1(fContainer, "cent");
2517  fIPz = GetH1(fContainer, "ipz");
2518  fCentIPz = GetP1(fContainer, "centIpz");
2519  if (!fContainer || !fCent || !fIPz) return false;
2520  TIter next(fSubs);
2521  Histos* h = 0;
2522  while ((h = static_cast<Histos*>(next())))
2523  if (!h->FinalizeInit(fContainer)) return false;
2524  return true;
2525 }
2526 //____________________________________________________________________
2528 {
2529  fContainer = GetC(parent, fName);
2530  fEtaIPz = GetH2(fContainer, "etaIPz", false); // No complaints
2531  fEtaDeltaIPz = GetH3(fContainer, "etaDeltaIPz", false);
2532  fEtaPdgIPz = GetH3(fContainer, "etaPdgIPz", false);
2533  fEtaPdg = GetH2(fContainer, "etaPdg", false);
2534  fEtaPt = GetH2(fContainer, "etaPt", false);
2535  if (GetName()[0] == 'm' && GetC(parent,"generated")) {
2536  // Fix up titles
2537  if (fEtaIPz)
2538  fEtaIPz->SetTitle(Form("%s'", fEtaIPz->GetTitle()));
2539  if (fEtaDeltaIPz)
2540  fEtaDeltaIPz->SetTitle(Form("#Delta_{%s}", fEtaIPz->GetTitle()));
2541  }
2542  return (fContainer != 0); // && fEtaIPz != 0);
2543 }
2544 
2545 //____________________________________________________________________
2547 {
2548  // Make copies of histograms and store
2549  fIPz = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"ipz")));
2550  fCent = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"cent")));
2551  fStatus = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"status")));
2552  fEtaPhi = static_cast<TH2*>(CloneAndAdd(results,GetH2(fContainer,"etaPhi")));
2553  fCentTracklets =
2554  static_cast<TProfile*>(CloneAndAdd(results,GetP(fContainer,
2555  "centTracklets")));
2556  fCentEst =
2557  static_cast<TProfile*>(CloneAndAdd(results,GetP(fContainer,
2558  "centEstimator")));
2559  Double_t nEvents = fIPz->GetEntries();
2560  Printf("Event summary:");
2561  for (Int_t i = 1; i <= fStatus->GetNbinsX(); i++)
2562  Printf(" %10d %s",
2563  Int_t(fStatus->GetBinContent(i)),
2564  fStatus->GetXaxis()->GetBinLabel(i));
2565  for (Int_t i = 1; i <= fCent->GetNbinsX(); i++)
2566  Printf(" %6.2f-%6.2f%%: %d",
2567  fCent->GetXaxis()->GetBinLowEdge(i),
2568  fCent->GetXaxis()->GetBinUpEdge(i),
2569  Int_t(fCent->GetBinContent(i)));
2570 
2571 
2572  fIPz ->Scale(1./nEvents);
2573  fCent ->Scale(1./fCent->GetEntries());
2574  fStatus->Scale(1./fStatus->GetBinContent(1));
2575  fEtaPhi->Scale(1./nEvents);
2576 
2577  if (fTailMax < 0) fTailMax = fMaxDelta;
2578  TIter next(fCentBins);
2579  CentBin* bin = 0;
2580  while ((bin = static_cast<CentBin*>(next()))) {
2581  if (!bin->MasterFinalize(results, 0, fTailDelta, fTailMax)) {
2582  AliWarningF("Failed to finalize %s", bin->GetName());
2583  return false;
2584  }
2585  }
2586  return true;
2587 }
2588 //____________________________________________________________________
2590 {
2591  if (!AliTrackletAODMCdNdeta::MasterFinalize(results)) return false;
2592 
2593  TObject* o = fContainer->FindObject("etaWeight");
2594  if (o && o->IsA()->InheritsFrom(TH1::Class())) {
2595  TH1* h = static_cast<TH1*>(o->Clone());
2596  h->SetDirectory(0);
2597  results->Add(h);
2598  }
2599  else {
2600  AliWarningF("Object %p (etaWeight) is not a TH1 or not found",o);
2601  }
2602  o = fContainer->FindObject("weightCorr");
2603  if (o && o->IsA()->InheritsFrom(TH1::Class())) {
2604  TH1* h = static_cast<TH1*>(o->Clone());
2605  h->SetDirectory(0);
2606  results->Add(h);
2607  }
2608  else {
2609  AliWarningF("Object %p (weightCorr) is not a TH1 or not found",o);
2610  }
2611  if (!fWeights) return true;
2612 
2613  if (!fWeights->Retrieve(fContainer)) return false;
2614  fWeights->Store(results);
2615 
2616  return true;
2617 }
2618 
2619 
2620 //____________________________________________________________________
2622  TH1* ,
2623  Double_t tailDelta,
2624  Double_t tailMax)
2625 {
2626  Container* result = new Container;
2627  result->SetName(fName);
2628  result->SetOwner(true);
2629  parent->Add(result);
2630 
2631  Double_t nEvents = fIPz->GetEntries();
2632  // Copy ipZ histogram and scale by number of events
2633  TH1* ipZ = static_cast<TH1*>(CloneAndAdd(result, fIPz));
2634  ipZ->Scale(1./nEvents);
2635 
2636  TH1* cent = static_cast<TH1*>(CloneAndAdd(result, fCent));
2637  cent->Scale(1./nEvents);
2638 
2639  CloneAndAdd(result, fCentIPz);
2640 
2641  Container* measCont = 0;
2642  Container* genCont = 0;
2643  TIter next(fSubs);
2644  Histos* h = 0;
2645  while ((h = static_cast<Histos*>(next()))) {
2646  if (h->GetMask() != AliAODTracklet::kInjection &&
2648  // For the anything but injection or MC-labels, we just finalize
2649  if (!h->MasterFinalize(result, fIPz, tailDelta, tailMax)) {
2650  AliWarningF("Failed to finalize %s/%s", GetName(), h->GetName());
2651  return false;
2652  }
2653  if (h->GetMask() == AliAODTracklet::kGenerated)
2654  // Set MC truth container
2655  genCont = GetC(result, h->GetName());
2656  if (h == fMeasured)
2657  measCont = GetC(result, h->GetName());
2658  continue;
2659  }
2660  if (!EstimateBackground(result, measCont, genCont, h, tailDelta, tailMax)) {
2661  AliWarningF("Failed to estimate Bg in %s/%s", GetName(), h->GetName());
2662  return false;
2663  }
2664  }
2665  return true;
2666 }
2667 
2668 //____________________________________________________________________
2669 Bool_t
2671  TH1* ipz,
2672  Double_t tailDelta,
2673  Double_t tailMax)
2674 {
2675  Container* result = new Container;
2676  result->SetName(fName);
2677  result->SetOwner(true);
2678  parent->Add(result);
2679 
2680  // Get the number of events
2681  Double_t nEvents = ipz->GetEntries();
2682 
2683  // Scale each vertex range by number of events in that range
2684  TH2* etaIPz = 0;
2685  if (fEtaIPz) {
2686  etaIPz = ScaleToIPz(fEtaIPz, ipz);
2687  result->Add(etaIPz);
2688  }
2689 
2690  // Scale distribution of PDGs to number of events and bin width
2691  if (fEtaPdg) {
2692  TH2* etaPdg = static_cast<TH2*>(fEtaPdg->Clone());
2693  etaPdg->SetDirectory(0);
2694  etaPdg->Scale(1. / nEvents, "width");
2695  result->Add(etaPdg);
2696 
2697  // Loop over PDG types and create 2D and 1D distributions
2698  TAxis* yaxis = etaPdg->GetYaxis();
2699  Int_t first = yaxis->GetFirst();
2700  Int_t last = yaxis->GetLast();
2701  THStack* pdgs = new THStack("all","");
2702  THStack* toPion = new THStack("toPion", "");
2703  THStack* toAll = new THStack("toAll", "");
2704  TH1* pion = 0;
2705  Container* pdgOut = new Container();
2706  pdgOut->SetName("mix");
2707  result->Add(pdgOut);
2708  pdgOut->Add(pdgs);
2709  pdgOut->Add(toPion);
2710  pdgOut->Add(toAll);
2711 
2712  TH1* all = static_cast<TH1*>(etaPdg->ProjectionX("total",
2713  1,etaPdg->GetNbinsY()));
2714  all->SetDirectory(0);
2715  all->SetName("total");
2716  all->SetTitle("All");
2717  all->SetYTitle(Form("d#it{N}_{%s}/d#eta", "all"));
2718  all->SetFillColor(kBlack);
2719  all->SetMarkerColor(kBlack);
2720  all->SetLineColor(kBlack);
2721  all->SetMarkerStyle(20);
2722  all->SetFillStyle(0);
2723  all->SetFillColor(0);
2724  all->Reset();
2725  pdgs->Add(all);
2726  for (Int_t i = 1; i <= etaPdg->GetNbinsY(); i++) {
2727  Int_t pdg = TString(yaxis->GetBinLabel(i)).Atoi();
2728  TString nme;
2729  Style_t sty;
2730  Color_t col;
2731  PdgAttr(pdg, nme, col, sty);
2732  if (pdg < 0) pdg = 0;
2733  if (pdg == 22) continue; // Ignore photons
2734 
2735  TH1* h1 = static_cast<TH1*>(etaPdg->ProjectionX(Form("h%d", pdg),i,i));
2736  if (h1->GetEntries() <= 0) continue; // Do not store if empty
2737  h1->SetDirectory(0);
2738  h1->SetName(Form("eta_%d", pdg));
2739  h1->SetTitle(nme);
2740  h1->SetYTitle(Form("d#it{N}_{%s}/d#eta", nme.Data()));
2741  h1->SetFillColor(col);
2742  h1->SetMarkerColor(col);
2743  h1->SetLineColor(col);
2744  h1->SetMarkerStyle(sty);
2745  h1->SetFillStyle(0);
2746  h1->SetFillColor(0);
2747  h1->SetBinContent(0,0);
2748  all->Add(h1);
2749  pdgs->Add(h1);
2750  switch (pdg) {
2751  case 321: h1->SetBinContent(0, 0.15); break; // PRC88,044910
2752  case 2212: h1->SetBinContent(0, 0.05); break; // PRC88,044910
2753  case 310: h1->SetBinContent(0, 0.075); break; // PRL111,222301
2754  case 3122: h1->SetBinContent(0, 0.018); break; // PRL111,222301
2755  case 3212: h1->SetBinContent(0, 0.0055); break; // NPA904,539
2756  case 3322: h1->SetBinContent(0, 0.005); break; // PLB734,409
2757  case 211: h1->SetBinContent(0, 1); break; // it self
2758  default: h1->SetBinContent(0, -1); break; // Unknown
2759  }
2760  pdgOut->Add(h1);
2761 
2762  if (pdg == 211) pion = h1;
2763  }
2764  if (pdgs->GetHists()) {
2765  TIter next(pdgs->GetHists());
2766  TH1* tmp = 0;
2767  Double_t rmin = +1e9;
2768  Double_t rmax = -1e9;
2769  while ((tmp = static_cast<TH1*>(next()))) {
2770  if (tmp == all) continue;
2771  // Calculate ratio to all
2772  TH1* rat = static_cast<TH1*>(tmp->Clone());
2773  rat->Divide(all);
2774  rat->SetDirectory(0);
2775  rat->SetTitle(Form("%s / all", tmp->GetTitle()));
2776  toAll->Add(rat);
2777 
2778  if (tmp == pion) continue;
2779  Double_t r276 = tmp->GetBinContent(0);
2780  if (r276 < 0 || r276 >= 1) continue;
2781 
2782  // Calulate ratio to pions
2783  rat = static_cast<TH1*>(tmp->Clone());
2784  rat->Divide(pion);
2785  rat->SetTitle(Form("%s / %s", tmp->GetTitle(), pion->GetTitle()));
2786  rat->SetDirectory(0);
2787 
2788  TGraphErrors* g = new TGraphErrors(1);
2789  g->SetName(Form("%s_2760", rat->GetName()));
2790  g->SetTitle(Form("%s in #sqrt{s_{NN}}=2.76TeV", rat->GetTitle()));
2791  g->SetPoint(0,0,r276);
2792  g->SetPointError(0,.5,0);
2793  g->SetLineColor(rat->GetLineColor());
2794  g->SetLineStyle(rat->GetLineStyle());
2795  g->SetMarkerColor(rat->GetMarkerColor());
2796  g->SetMarkerStyle(rat->GetMarkerStyle());
2797  g->SetMarkerSize(1.5*rat->GetMarkerSize());
2798  rat->GetListOfFunctions()->Add(g,"p");
2799  rat->SetMaximum(TMath::Max(rat->GetMaximum(),r276));
2800  rat->SetMinimum(TMath::Min(rat->GetMinimum(),r276));
2801  rmin = TMath::Min(rat->GetMinimum(),rmin);
2802  rmax = TMath::Max(rat->GetMaximum(),rmax);
2803 
2804  toPion->Add(rat);
2805  }
2806  // toPion->SetMinimum(rmin);
2807  toPion->SetMaximum(1.1*rmax);
2808  }
2809  }
2810 
2811  // Scale distribution of Pt to number of events and bin width
2812  if (fEtaPt) {
2813  TH2* etaPt = static_cast<TH2*>(fEtaPt->Clone());
2814  etaPt->SetDirectory(0);
2815  etaPt->Scale(1. / nEvents, "width");
2816  result->Add(etaPt);
2817 
2818  }
2819 
2820  // Short-hand-name
2821  TString shn(etaIPz ? etaIPz->GetTitle() : "X");
2822 
2823  // If we have the PDG distributions, we project on eta,IPz, and then
2824  // average over IPz to get dNpdg/deta.
2825  if (fEtaPdgIPz) {
2826  // Scale each vertex range by number of events in that range
2827  TH3* etaPdgIPz = ScaleToIPz(fEtaPdgIPz, ipz, false);
2828  result->Add(etaPdgIPz);
2829 
2830  // Loop over PDG types and create 2D and 1D distributions
2831  TAxis* yaxis = etaPdgIPz->GetYaxis();
2832  Int_t first = yaxis->GetFirst();
2833  Int_t last = yaxis->GetLast();
2834  THStack* pdgs = new THStack("all","");
2835  THStack* ratios = new THStack("toPion", "");
2836  TH1* pion = 0;
2837  Container* pdgOut = new Container();
2838  pdgOut->SetName("types");
2839  result->Add(pdgOut);
2840  pdgOut->Add(pdgs);
2841  pdgOut->Add(ratios);
2842  for (Int_t i = 1; i <= etaPdgIPz->GetNbinsY(); i++) {
2843  yaxis->SetRange(i,i);
2844 
2845  Int_t pdg = TString(yaxis->GetBinLabel(i)).Atoi();
2846  TString nme;
2847  Style_t sty;
2848  Color_t col;
2849  PdgAttr(pdg, nme, col, sty);
2850  if (pdg < 0) pdg = 0;
2851 
2852  TH2* h2 = static_cast<TH2*>(etaPdgIPz->Project3D("zx e"));
2853  if (h2->GetEntries() <= 0) continue; // Do not store if empty
2854  h2->SetDirectory(0);
2855  h2->SetName(Form("etaIPz_%d", pdg));
2856  h2->SetTitle(Form("%s#rightarrowX_{%s}", nme.Data(), shn.Data()));
2857  h2->SetYTitle(Form("d#it{N}^{2}_{%s#rightarrow%s}/"
2858  "(d#etadIP_{#it{z}})",
2859  nme.Data(), shn.Data()));
2860  h2->SetFillColor(col);
2861  h2->SetMarkerColor(col);
2862  h2->SetLineColor(col);
2863  pdgOut->Add(h2);
2864 
2865  TH1* h1 = AverageOverIPz(h2, Form("eta_%d",pdg), 1, ipz, 0, false);
2866  h1->SetDirectory(0);
2867  h1->SetYTitle(Form("d#it{N}_{%s#rightarrow%s}/d#eta",
2868  nme.Data(), shn.Data()));
2869  h1->SetMarkerStyle(sty);
2870  pdgs->Add(h1);
2871 
2872  if (pdg == 211) pion = h1;
2873  }
2874  if (pdgs->GetHists()) {
2875  TIter next(pdgs->GetHists());
2876  TH1* tmp = 0;
2877  while ((tmp = static_cast<TH1*>(next()))) {
2878  if (tmp == pion) continue;
2879  TH1* rat = static_cast<TH1*>(tmp->Clone());
2880  rat->Divide(pion);
2881  rat->SetDirectory(0);
2882  ratios->Add(rat);
2883  }
2884  }
2885 
2886  yaxis->SetRange(first, last);
2887  }
2888  // If we do not have eta vs Delta, just return
2889  if (!fEtaDeltaIPz) return true;
2890 
2891  // Normalize delta distribution to integral number of events
2892  // static_cast<TH3*>(CloneAndAdd(result, fEtaDeltaIPz));
2893  TH3* etaDeltaIPz = ScaleToIPz(fEtaDeltaIPz, ipz, false);
2894  // ipz->GetEntries()>1000);
2895  result->Add(etaDeltaIPz);
2896 
2897  // Make 2D projection to eta,Delta
2898  TH2* etaDelta = ProjectEtaDelta(etaDeltaIPz);
2899  result->Add(etaDelta);
2900 
2901  // Make projection of delta
2902  TH1* delta = ProjectDelta(etaDelta);
2903  result->Add(delta);
2904 
2905  // PArameters of integrals
2906  Double_t maxDelta = etaDeltaIPz->GetYaxis()->GetXmax();
2907  Int_t lowBin = etaDeltaIPz->GetYaxis()->FindBin(tailDelta);
2908  Int_t sigBin = etaDeltaIPz->GetYaxis()->FindBin(1.5);
2909  Int_t highBin = TMath::Min(etaDeltaIPz->GetYaxis()->FindBin(tailMax),
2910  etaDeltaIPz->GetYaxis()->GetNbins());
2911 
2912 
2913  TH1* etaDeltaTail = etaDelta->ProjectionX("etaDeltaTail");
2914  etaDeltaTail ->SetDirectory(0);
2915  etaDeltaTail ->Reset();
2916  etaDeltaTail ->SetTitle(Form("#scale[.7]{#int}_{%3.1f}^{%4.1f}"
2917  "d%s d#it{N}/d%s",
2918  tailDelta,maxDelta,
2919  etaDeltaIPz->GetTitle(),
2920  etaDeltaIPz->GetTitle()));
2921  etaDeltaTail ->SetYTitle("#scale[.7]{#int}_{tail}d#Delta d#it{N}/d#Delta");
2922 
2923  TH2* etaIPzDeltaTail = static_cast<TH2*>(etaDeltaIPz->Project3D("zx e"));
2924  etaIPzDeltaTail->SetName("etaIPzDeltaTail");
2925  etaIPzDeltaTail->SetDirectory(0);
2926  etaIPzDeltaTail->Reset();
2927  etaIPzDeltaTail->SetTitle(etaDeltaTail->GetTitle());
2928  etaIPzDeltaTail->SetZTitle(etaDelta->GetYaxis()->GetTitle());
2929  TH2* etaIPzDeltaMain = static_cast<TH2*>(etaDeltaIPz->Project3D("zx e"));
2930  etaIPzDeltaMain->SetName("etaIPzDeltaMain");
2931  etaIPzDeltaMain->SetDirectory(0);
2932  etaIPzDeltaMain->Reset();
2933  etaIPzDeltaMain->SetTitle(etaDeltaTail->GetTitle());
2934  etaIPzDeltaMain->SetZTitle(etaDelta->GetYaxis()->GetTitle());
2935  // Loop over eta
2936  Double_t intg = 0, eintg = 0;
2937  for (Int_t i = 1; i <= etaDeltaTail->GetNbinsX(); i++) {
2938  // Integrate over Delta
2939  intg = etaDelta->IntegralAndError(i, i, lowBin, highBin, eintg);
2940  etaDeltaTail->SetBinContent(i, intg);
2941  etaDeltaTail->SetBinError (i, eintg);
2942  // Loop over IPz
2943  for (Int_t j = 1; j <= etaIPzDeltaTail->GetNbinsY(); j++) {
2944  // Integrate over Delta
2945  intg = etaDeltaIPz->IntegralAndError(i,i,lowBin,highBin,j,j,eintg);
2946  etaIPzDeltaTail->SetBinContent(i, j, intg);
2947  etaIPzDeltaTail->SetBinError (i, j, eintg);
2948 
2949  intg = etaDeltaIPz->IntegralAndError(i,i,1,sigBin,j,j,eintg);
2950  etaIPzDeltaMain->SetBinContent(i, j, intg);
2951  etaIPzDeltaMain->SetBinError (i, j, eintg);
2952  }
2953  }
2954  result->Add(etaIPzDeltaTail);
2955  result->Add(etaIPzDeltaMain);
2956  result->Add(etaDeltaTail);
2957 
2958  // Integrate full tail
2959  intg = etaDeltaIPz->IntegralAndError(1,etaDeltaIPz->GetNbinsX(),
2960  lowBin, highBin,
2961  1,etaDeltaIPz->GetNbinsZ(),
2962  eintg);
2963  result->Add(new TParameter<double>("deltaTail", intg));
2964  result->Add(new TParameter<double>("deltaTailError", eintg));
2965 
2966  // Some consistency checks:
2967  if (fDebug > 1) {
2968  Printf("%10s: Integral over eta,IPz: %9.4f +/- %9.4f",
2969  GetName(), intg, eintg);
2970  intg = etaDelta->IntegralAndError(1,etaDeltaIPz->GetNbinsX(),
2971  lowBin, highBin,
2972  eintg);
2973  Printf("%10s: Integral over eta: %9.4f +/- %9.4f",
2974  GetName(), intg, eintg);
2975  intg = delta->IntegralAndError(lowBin, highBin, eintg);
2976  Printf("%10s: Integral: %9.4f +/- %9.4f",
2977  GetName(), intg, eintg);
2978  }
2979 
2980  return true;
2981 }
2982 
2983 //____________________________________________________________________
2985  Container* measCont,
2986  Container* genCont,
2987  Histos* h,
2988  Double_t tailCut,
2989  Double_t tailMax)
2990 {
2991  if (!h || !measCont) {
2992  AliWarningF("No sub-histos or measured container in %s", GetName());
2993  return false;
2994  }
2995 
2996  if (!h->MasterFinalize(result, fIPz, tailCut,tailMax)) {
2997  AliWarningF("Failed to finalize %s/%s", GetName(), h->GetName());
2998  return false;
2999  }
3000 
3001  Container* bgCont = GetC(result, h->GetName());
3002  if (!bgCont) {
3003  AliWarningF("%s/%s didn't put a container on output",
3004  GetName(), h->GetName());
3005  return false;
3006  }
3007  const char* sub = h->GetName();
3008  TString shrt(Form("%c", sub[0]));
3009  shrt.ToUpper();
3010  if (genCont) shrt.Append("'");
3011 
3012  TH2* background = 0;
3013  TH2* etaIPzScale = 0;
3014  if (h->GetMask() == AliAODTracklet::kInjection) {
3015  // Get the tail ratio per eta, ipZ
3016  // We get the integral of the measured eta,IPz,Delta dist
3017  // We get the integral of the injected eta,IPz,Delta dist
3018  // Then we take the ratio
3019  etaIPzScale = CopyH2(measCont, "etaIPzDeltaTail",
3020  "etaIPzScale");
3021  etaIPzScale->Divide(GetH2(bgCont, "etaIPzDeltaTail"));
3022  etaIPzScale->SetZTitle("k_{#eta,IP_{#it{z}}}");
3023  etaIPzScale->SetTitle(Form("k_{%s,#eta,IP_{#it{z}}}",shrt.Data()));
3024  bgCont->Add(etaIPzScale);
3025 
3026  // Get the tail ratio per eta
3027  // We get the integral of the measured eta,Delta dist
3028  // We get the integral of the injected eta,Detla dist
3029  // Then we take the ratio
3030  TH1* etaScale = CopyH1(measCont, "etaDeltaTail",
3031  "etaScale");
3032  etaScale->Divide(GetH1(bgCont, "etaDeltaTail"));
3033  etaScale->SetYTitle("k_{#eta}");
3034  etaScale->SetTitle(Form("k_{%s,#eta}", shrt.Data()));
3035  bgCont->Add(etaScale);
3036 
3037  // Get the integrated tail ratio.
3038  // We get the integrated tail of the measured delta dist
3039  // We get the integrated tail of the ianjection delta dist
3040  // We then get the ratio.
3041  Double_t measIntg = GetD(measCont, "deltaTail", -1);
3042  Double_t measIntE = GetD(measCont, "deltaTailError", -1);
3043  Double_t bgIntg = GetD(bgCont, "deltaTail", -1);
3044  Double_t bgIntE = GetD(bgCont, "deltaTailError", -1);
3045  Double_t scaleE = 0;
3046  Double_t scale = RatioE(measIntg, measIntE, bgIntg, bgIntE, scaleE);
3047  bgCont->Add(new TParameter<double>("scale", scale));
3048  bgCont->Add(new TParameter<double>("scaleError", scaleE));
3049 
3050  // Get the fully differential Delta distribution and scale by the
3051  // eta,IPz scalar.
3052  TH3* scaledEtaDeltaIPz = ScaleDelta(CopyH3(bgCont, "etaDeltaIPz",
3053  "scaleEtaDeltaIPz"),
3054  etaIPzScale);
3055  scaledEtaDeltaIPz->SetTitle(Form("%5.3f#times%s",
3056  scale, scaledEtaDeltaIPz->GetTitle()));
3057  scaledEtaDeltaIPz->SetDirectory(0);
3058  scaledEtaDeltaIPz->SetYTitle("k#timesd^{3}#it{N}/"
3059  "(d#Deltad#etadIP_{#it{z}})");
3060  bgCont->Add(scaledEtaDeltaIPz);
3061 #if 0
3062  // scale by derived scalars, rather than by taking the scaled full
3063  // distribution.
3064  TH2* scaledEtaDelta = CopyH2(bgCont, "etaDelta", "scaledEtaDelta");
3065  scaledEtaDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3066  scaledEtaDelta->SetZTitle("k#timesd^{2}#it{N}/(d#Deltad#eta)");
3067  Scale(scaledEtaDelta, etaScale);
3068  bgCont->Add(scaledEtaDelta);
3069 
3070  TH1* scaledDelta = CopyH1(bgCont, "delta", "scaledDelta");
3071  scaledDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3072  scaledDelta->SetYTitle("k#timesd#it{N}/d#Delta");
3073  Scale(scaledDelta,scale,scaleE);
3074  bgCont->Add(scaledDelta);
3075 #else
3076  // Make 2D projection to eta,Delta
3077  TH2* scaledEtaDelta = ProjectEtaDelta(scaledEtaDeltaIPz);
3078  scaledEtaDelta->SetName("scaledEtaDelta");
3079  scaledEtaDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3080  scaledEtaDelta->SetYTitle("k#timesd^{2}#it{N}/(d#Deltad#eta)");
3081  bgCont->Add(scaledEtaDelta);
3082 
3083  // Make projection of delta
3084  TH1* scaledDelta = ProjectDelta(scaledEtaDelta);
3085  scaledDelta->SetName("scaledDelta");
3086  scaledDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3087  scaledDelta->SetYTitle("k#timesd#it{N}/d#Delta");
3088  bgCont->Add(scaledDelta);
3089 #endif
3090  // Make background scaled by full tail
3091  background = CopyH2(bgCont, "etaIPz", "background");
3092  if (!background) AliWarningF("Didn't get background in %s", sub);
3093  else background->Multiply(etaIPzScale);
3094  // else Scale(background, scale, scaleE);
3095  }
3096  else {
3097  // For non-injection sets (i.e., combinatorics) we cannot form the
3098  // scaled background until we have the real data, so we calculate
3099  // beta instead.
3100  background = CopyH2(bgCont, "etaIPz", "background");
3101  TH2* beta = CopyH2(bgCont, "etaIPz", "beta");
3102  if (!background || !beta)
3103  AliWarningF("Didn't get background or beta in %s", sub);
3104  else {
3105  beta->Divide(GetH1(measCont, "etaIPz"));
3106  beta->SetTitle(Form("#beta_{%s}", shrt.Data()));
3107  bgCont->Add(beta);
3108  }
3109  }
3110  if (!background) {
3111  AliWarningF("Didn't get background in %s", sub);
3112  return false;
3113  }
3114  background->SetTitle(Form("#it{B}_{%s}", shrt.Data()));
3115  bgCont->Add(background);
3116 
3117  TH2* signal = CopyH2(measCont, "etaIPz", "signal");
3118  if (!signal) {
3119  AliWarningF("Didn't get signal in %s", sub);
3120  return false;
3121  }
3122  else {
3123  signal->SetTitle(Form("#it{S}_{%s}", shrt.Data()));
3124  signal->Add(background,-1);
3125  // Zero small bins
3126  for (Int_t i = 1; i <= signal->GetNbinsX(); i++) {
3127  for (Int_t j = 1; j <= signal->GetNbinsX(); j++) {
3128  if (signal->GetBinContent(i,j)<1e-6) {
3129  signal->SetBinContent(i,j,0);
3130  signal->SetBinError (i,j,0);
3131  }
3132  }
3133  }
3134  CopyAttr(background, signal);
3135  bgCont->Add(signal);
3136  }
3137 
3138  TH1* alpha = 0;
3139  if (genCont) {
3140  alpha = CopyH2(genCont, "etaIPz", "alpha");
3141  if (alpha && signal) {
3142  alpha->Divide(signal);
3143  alpha->SetTitle(Form("#alpha_{%s}", shrt.Data()));
3144  CopyAttr(signal, alpha);
3145  bgCont->Add(alpha);
3146  }
3147  }
3148 
3149  return true;
3150 }
3151 
3152 //====================================================================
3155  const char* weights,
3156  const char* sumFile,
3157  const char* resFile)
3158 {
3159  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
3160  if (!mgr) {
3161  ::Error("Create","No analysis manager to connect to.");
3162  return 0;
3163  }
3164  AliTrackletAODdNdeta* ret = 0;
3165  if (mc) {
3166  if (weights && weights[0] != '\0') {
3168  new AliTrackletAODWeightedMCdNdeta("MidRapidityMC");
3169  TUrl wurl(weights);
3170  TFile* wfile = TFile::Open(wurl.GetFile());
3171  if (!wfile) {
3172  ::Warning("Create", "Failed to open weights file: %s",
3173  wurl.GetUrl());
3174  return 0;
3175  }
3176  TString wnam(wurl.GetAnchor());
3177  if (wnam.IsNull()) wnam = "weights";
3178  TObject* wobj = wfile->Get(wnam);
3179  if (!wobj) {
3180  ::Warning("Create", "Failed to get weights %s from file %s",
3181  wnam.Data(), wfile->GetName());
3182  return 0;
3183  }
3184  if (!wobj->IsA()->InheritsFrom(AliTrackletWeights::Class())) {
3185  ::Warning("Create", "Object %s from file %s not an "
3186  "AliTrackletWeights but a %s",
3187  wnam.Data(), wfile->GetName(), wobj->ClassName());
3188  return 0;
3189  }
3190  wret->SetWeights(static_cast<AliTrackletWeights*>(wobj));
3191  ret = wret;
3192  }
3193  else
3194  ret = new AliTrackletAODMCdNdeta("MidRapidityMC");
3195  }
3196  else ret = new AliTrackletAODdNdeta("MidRapidity");
3197  if (ret) ret->Connect();
3198 
3199  return ret;
3200 
3201 }
3202 
3203 
3204 
3205 
3206 //____________________________________________________________________
virtual Bool_t ProcessTracklet(AliAODTracklet *tracklet, Double_t ipz, UShort_t signal, Double_t weight)=0
Int_t color[]
virtual Double_t LookupWeight(AliAODTracklet *tracklet, Double_t cent)
static TProfile * GetP1(Container *parent, const char *name, Bool_t verb=true)
Int_t pdg
Histos & operator=(const Histos &)
static const TAxis & PdgAxis()
static void PdgAttr(Int_t pdg, TString &nme, Color_t &c, Style_t &s)
static TH2 * Make2D(Container *c, const TString &name, const TString &title, Color_t color, Style_t style, const TAxis &xAxis, const TAxis &yAxis)
virtual void SetWeightCalc(UChar_t mode=0)
virtual Double_t LookupWeight(AliAODTracklet *tracklet, Double_t cent)
void Print(Option_t *option="") const
Real_t GetEta() const
double Double_t
Definition: External.C:58
Bool_t Connect(const char *sumFile=0, const char *resFile=0)
const AliVVertex * CheckIP(const AliVVertex *ip, Double_t maxDispersion=0.04, Double_t maxZError=0.25)
void SetMask(UChar_t mask)
virtual Bool_t FinalizeInit(Container *parent)=0
virtual void SetWeightMask(UChar_t mask=0xFF)
AliTrackletAODWeightedMCdNdeta & operator=(const AliTrackletAODWeightedMCdNdeta &o)
Bool_t MasterFinalize(Container *parent, TH1 *ipz, Double_t tailCut, Double_t tailMax)
Bool_t FinalizeInit(Container *parent)
Definition: External.C:244
static void PrintAxis(const TAxis &axis, Int_t nSig=2, const char *alt=0)
Double_t FindMultCentrality(AliVEvent *event, Int_t &nTracklets)
static void SetAxis(TAxis &axis, Int_t n, Double_t *borders)
Double_t FindCompatCentrality(AliVEvent *event)
static TProfile2D * Make2P(Container *c, const TString &name, const TString &title, Color_t color, Style_t style, const TAxis &xAxis, const TAxis &yAxis)
static TH1 * GetH1(Container *parent, const char *name, Bool_t verb=true)
void SetEtaAxis(Int_t n, Double_t max)
static TH3 * ScaleDelta(TH3 *h, TH2 *scale)
Bool_t WorkerInit(Container *parent, const TAxis &etaAxis, const TAxis &ipzAxis, const TAxis &deltaAxis)
TCanvas * c
Definition: TestFitELoss.C:172
virtual void SetWeightVeto(UChar_t veto=0xFF)
TH1 * SetAttr(TH1 *h, Color_t color, Style_t marker=20, Double_t size=1., Style_t fill=0, Style_t line=1, Width_t width=1)
void SetMaxDelta(Double_t x=25)
ClassDef(AliTrackletAODdNdeta, 1)
static TH2 * ScaleToIPz(TH2 *h, TH1 *ipZ, Bool_t full=false)
Int_t nCentBins
void SetCentralityAxis(const TString &spec)
static TH1 * AverageOverIPz(TH2 *h, const char *name, UShort_t mode, TH1 *ipz, TH2 *mask=0, Bool_t verb=true)
static TH1 * ProjectDelta(TH2 *h)
void SetWeightVeto(UChar_t veto=0x0)
static Double_t GetD(Container *parent, const char *name, Double_t def=-1, Bool_t verb=true)
virtual Real_t GetParentPt(Bool_t second=false) const
void SetTailDelta(Double_t x=5)
static TH3 * Make3D(Container *c, const TString &name, const TString &title, Color_t color, Style_t style, const TAxis &xAxis, const TAxis &yAxis, const TAxis &zAxis)
static TH1 * Scale(TH1 *h, Double_t x, Double_t xe)
Definition: External.C:92
Bool_t IsCombinatorics() const
CentBin & operator=(const CentBin &)
virtual Bool_t WorkerInit(Container *parent, const TAxis &etaAxis, const TAxis &ipzAxis, const TAxis &deltaAxis)
Bool_t CheckEvent(Double_t &cent, const AliVVertex *&ip, TClonesArray *&tracklets)
void SetIPzAxis(Int_t n, Double_t max)
Utilities for midrapidity analysis.
void SetAbsMinCent(Double_t x=-1)
Tracklet AOD object.
CentBin & operator=(const CentBin &)
void Print(Option_t *option="") const
TClonesArray * FindTracklets(AliVEvent *event)
Bool_t MasterFinalize(Container *parent, TH1 *ipz, Double_t tailCut, Double_t tailMax)
ClassDef(AliTrackletAODMCdNdeta, 1)
void SetTailMaximum(Double_t x=-1)
void SetWeights(AliTrackletWeights *w)
void SetEtaAxis(Int_t n, Double_t min, Double_t max)
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
Bool_t InitCentBins(Container *existing)
float Float_t
Definition: External.C:68
virtual void SetDebug(UShort_t lvl)
Real_t GetDPhi() const
virtual void SetWeights(AliTrackletWeights *w)
virtual Bool_t MasterFinalize(Container *parent, TH1 *ipz, Double_t tailCut, Double_t tailMax)=0
void SetCentralityMethod(const TString &name)
Bool_t FinalizeInit(Container *parent)
Real_t GetPhi() const
Encode simulation weights for 2nd pass.
const AliVVertex * FindIP(AliVEvent *event, Double_t maxDispersion=0.04, Double_t maxZError=0.25)
const AliVVertex * FindSimpleIP(AliVEvent *event, Double_t maxDispersion=0.04, Double_t maxZError=0.25)
void SetDPhiShift(Double_t x=0.0045)
void SetCalc(UChar_t mode=kProduct)
AliTrackletAODMCdNdeta(const AliTrackletAODdNdeta &o)
Double_t FindCentrality(AliVEvent *event, Int_t &nTracklets)
virtual AliTrackletAODdNdeta::CentBin * MakeCentBin(Float_t c1, Float_t c2)
void SetShiftedDPhiCut(Double_t x=-1)
void Print(Option_t *option="") const
void SetIPzAxis(Int_t n, Double_t min, Double_t max)
const AliVVertex * FindRealIP(AliVEvent *event, Double_t maxDispersion=0.04, Double_t maxZError=0.25)
Bool_t IsMeasured() const
static TH2 * CopyH2(Container *parent, const char *name, const char *newName=0, Bool_t verb=true)
virtual Short_t GetParentPdg(Bool_t second=false) const
AliTrackletAODWeightedMCdNdeta(const char *name)
Bool_t EstimateBackground(Container *result, Container *measCont, Container *genCont, Histos *h, Double_t tailCut, Double_t tailMax)
void SetDeltaCut(Double_t x=1.5)
Int_t mode
Definition: anaM.C:40
static TH1 * CopyH1(Container *parent, const char *name, const char *newName=0, Bool_t verb=true)
virtual const char * GetBranchName() const
static TH3 * GetH3(Container *parent, const char *name, Bool_t verb=true)
const char * GetName() const
static Double_t RatioE(Double_t n, Double_t en, Double_t d, Double_t ed, Double_t &er)
static TH2 * GetH2(Container *parent, const char *name, Bool_t verb=true)
static AliTrackletAODdNdeta * Create(Bool_t mc=false, const char *weights=0, const char *sumFile=0, const char *resFile=0)
UChar_t GetFlags() const
Histos * MakeHistos(const char *name, Color_t color, Style_t style, UShort_t mask, UShort_t veto)
Bool_t IsNeutral() const
AliTrackletAODMCdNdeta(const char *name)
Bool_t MasterFinalize(Container *results)
void SetPhiAxis(Int_t n, Double_t min, Double_t max)
Bool_t IsGenerated() const
ClassDef(AliTrackletAODWeightedMCdNdeta, 1)
Float_t nEvents[nProd]
void SetAttr(Color_t c, Style_t m)
Definition: External.C:220
void SetEtaAxis(const TString &spec)
virtual void Print(Option_t *option="") const
static Container * GetC(Container *parent, const char *name, Bool_t verb=true)
static Int_t PdgBin(Int_t pdg)
void SetVeto(UChar_t veto)
AliTrackletAODWeightedMCdNdeta(const AliTrackletAODWeightedMCdNdeta &o)
Bool_t ProcessTracklet(AliAODTracklet *tracklet, Double_t ipz, UShort_t signal, Double_t weight)
Bool_t Accept(Double_t cent, Double_t ipz)
unsigned short UShort_t
Definition: External.C:28
void Print(Option_t *option="") const
virtual UShort_t CheckTracklet(AliAODTracklet *tracklet) const
void SetIPzAxis(const TString &spec)
const char Option_t
Definition: External.C:48
virtual Bool_t MasterFinalize(Container *results)
Real_t GetDelta() const
void SetWeightMask(UChar_t mask=0xFF)
static TH3 * CopyH3(Container *parent, const char *name, const char *newName=0, Bool_t verb=true)
Histos(const char *name="", Color_t color=kBlack, Style_t style=1, UChar_t mask=0, UChar_t veto=0)
bool Bool_t
Definition: External.C:53
static TObject * CloneAndAdd(Container *c, TObject *o)
virtual void SetDebug(UShort_t lvl)
virtual const char * GetBranchName() const
Bool_t WorkerInit(Container *parent, const TAxis &etaAxis, const TAxis &ipzAxis, const TAxis &deltaAxis)
static TH1 * Make1D(Container *c, const TString &name, const TString &title, Color_t color, Style_t style, const TAxis &xAxis)
virtual CentBin * MakeCentBin(Float_t c1, Float_t c2)
static TProfile * Make1P(Container *c, const TString &name, const TString &title, Color_t color, Style_t style, const TAxis &xAxis)
void Print(Option_t *option="") const
void SetPhiAxis(Int_t n, Double_t max)
static void FixAxis(TAxis &axis, const char *title=0)
A simplified AOD header.
Definition: External.C:196
void SetCentralityAxis(Int_t n, Double_t *bins)
AliTrackletAODdNdeta & operator=(const AliTrackletAODdNdeta &o)
Bool_t ProcessTracklet(AliAODTracklet *tracklet, Double_t ipz, UShort_t signal, Double_t weight)
void ProcessEvent(Double_t cent, const AliVVertex *ip, TClonesArray *tracklets)
static TProfile * GetP(Container *parent, const char *name, Bool_t verb=true)
static void CopyAttr(const TH1 *src, TH1 *dest)