AliPhysics  f05a842 (f05a842)
 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;
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(AliTrackletBaseWeights* w) {};
332  virtual void SetWeightCalc(UChar_t mode=0) {}
338  virtual void SetWeightMask(UChar_t mask=0xFF) {}
346  virtual void SetWeightInverse(Bool_t inv) {}
352  virtual void SetWeightVeto(UChar_t veto=0xFF) {}
353  /* @} */
354  //__________________________________________________________________
358  struct Sub : public TObject
359  {
364  Sub(const char* name="") : fName(name), fContainer(0), fDebug(0) {}
370  Sub(const Sub& o) : TObject(o), fName(o.fName), fContainer(0), fDebug(0) {}
374  virtual ~Sub() {}
380  Sub& operator=(const Sub&) { return *this; }
384  const char* GetName() const { return fName.Data(); }
395  virtual Bool_t WorkerInit(Container* parent,
396  const TAxis& etaAxis,
397  const TAxis& ipzAxis,
398  const TAxis& deltaAxis)
399  {
400  fContainer = new Container;
401  fContainer->SetName(fName);
402  fContainer->SetOwner();
403  if (parent) parent->Add(fContainer);
404  return true;
405  }
416  virtual Bool_t ProcessTracklet(AliAODTracklet* tracklet,
417  Double_t ipz,
418  UShort_t signal,
419  Double_t weight) = 0;
429  virtual Bool_t FinalizeInit(Container* parent) = 0;
440  virtual Bool_t MasterFinalize(Container* parent,
441  TH1* ipz,
442  Double_t tailCut,
443  Double_t tailMax) = 0;
449  virtual void SetDebug(UShort_t lvl) { fDebug = lvl; }
450  protected:
457  ClassDef(Sub,1);
458  };
459 
460  //__________________________________________________________________
470  struct Histos : public Sub
471  {
476  Histos(const char* name="", Color_t color=kBlack, Style_t style=1,
477  UChar_t mask=0, UChar_t veto=0)
478  : Sub(name),
479  fMask(mask),
480  fVeto(veto),
481  fEtaIPz(0),
482  fEtaDeltaIPz(0),
483  fEtaPdgIPz(0),
484  fEtaPdg(0),
485  fEtaPt(0),
486  fColor(color),
487  fStyle(style)
488  {}
494  Histos(const Histos& o)
495  : Sub(o),
496  fMask(o.fMask),
497  fVeto(o.fVeto),
498  fEtaIPz(0),
499  fEtaDeltaIPz(0),
500  fEtaPdgIPz(0),
501  fEtaPdg(0),
502  fEtaPt(0),
503  fColor(o.fColor),
504  fStyle(o.fStyle)
505  {}
509  virtual ~Histos() {}
515  Histos& operator=(const Histos&) { return *this; }
520  {
521  return fMask == kMeasuredMask && fVeto == kMeasuredVeto;
522  }
527  {
528  return fMask == kInjectedMask && fVeto == kInjectedVeto;
529  }
534  {
536  }
542  {
543  return fMask == kDistinctMask && fVeto == kDistinctVeto;
544  }
549  {
550  return fMask == kPrimaryMask && fVeto == kPrimaryVeto;
551  }
556  {
557  return fMask == kSecondaryMask && fVeto == kSecondaryVeto;
558  }
563  {
564  return fMask == kGeneratedMask && fVeto == kGeneratedVeto;
565  }
576  Bool_t WorkerInit(Container* parent,
577  const TAxis& etaAxis,
578  const TAxis& ipzAxis,
579  const TAxis& deltaAxis);
586  void SetAttr(Color_t c, Style_t m);
598  Double_t ipz,
599  UShort_t signal,
600  Double_t weight);
610  Bool_t FinalizeInit(Container* parent);
622  TH1* ipz,
623  Double_t tailCut,
624  Double_t tailMax);
625 
626  UChar_t GetMask() const { return fMask; }
627  UChar_t GetVeto() const { return fVeto; }
633  void Print(Option_t* option="") const;
634  protected:
635  const UChar_t fMask;
636  const UChar_t fVeto;
642  public:
643  Color_t fColor;
644  Style_t fStyle;
645 
646  ClassDef(Histos,1);
647  };
648 
649 
650  //__________________________________________________________________
666  struct CentBin : public Sub
667  {
672  : Sub(""),
673  fSubs(0),
674  fLow(0),
675  fHigh(0),
676  fIPz(0),
677  fCent(0),
678  fCentIPz(0),
679  fMeasured(0),
680  fInjection(0)
681  {
682  }
689  CentBin(Double_t c1, Double_t c2);
695  CentBin(const CentBin& o)
696  : Sub(o),
697  fSubs(0),
698  fLow(o.fLow),
699  fIPz(0),
700  fCent(0),
701  fCentIPz(0),
702  fHigh(o.fHigh),
703  fMeasured(0),
704  fInjection(0)
705  {}
709  virtual ~CentBin() {}
715  CentBin& operator=(const CentBin&) { return *this; }
727  Histos* MakeHistos(const char* name,
728  Color_t color,
729  Style_t style,
730  UShort_t mask,
731  UShort_t veto);
742  Bool_t WorkerInit(Container* parent,
743  const TAxis& etaAxis,
744  const TAxis& ipzAxis,
745  const TAxis& deltaAxis);
754  Bool_t Accept(Double_t cent, Double_t ipz);
766  Double_t ipz,
767  UShort_t signal,
768  Double_t weight);
778  Bool_t FinalizeInit(Container* parent);
790  TH1* ipz,
791  Double_t tailCut,
792  Double_t tailMax);
806  Container* measCont,
807  Container* genCont,
808  Histos* h,
809  Double_t tailCut,
810  Double_t tailMax);
816  void Print(Option_t* option="") const;
822  virtual void SetDebug(UShort_t lvl);
823  protected:
829  TProfile* fCentIPz;
832 
833  ClassDef(CentBin,2);
834  };
835 
836 protected:
837  // -----------------------------------------------------------------
847  virtual Bool_t WorkerInit();
854  Bool_t InitCentBins(Container* existing);
864  {
865  return new CentBin(c1, c2);
866  }
867  /* @} */
868 
869  // -----------------------------------------------------------------
874  virtual const char* GetBranchName() const { return "AliAODTracklets"; }
884  Bool_t CheckEvent(Double_t& cent,
885  const AliVVertex*& ip,
886  TClonesArray*& tracklets);
894  TClonesArray* FindTracklets(AliVEvent* event);
904  const AliVVertex* FindSimpleIP(AliVEvent* event,
905  Double_t maxDispersion=0.04,
906  Double_t maxZError=0.25);
916  const AliVVertex* FindRealIP(AliVEvent* event,
917  Double_t maxDispersion=0.04,
918  Double_t maxZError=0.25);
928  const AliVVertex* CheckIP(const AliVVertex* ip,
929  Double_t maxDispersion=0.04,
930  Double_t maxZError=0.25);
931 
941  const AliVVertex* FindIP(AliVEvent* event,
942  Double_t maxDispersion=0.04,
943  Double_t maxZError=0.25);
954  Double_t FindMultCentrality(AliVEvent* event, Int_t& nTracklets);
964  Double_t FindCompatCentrality(AliVEvent* event);
976  Double_t FindCentrality(AliVEvent* event, Int_t& nTracklets);
983  /* @} */
984 
985  // -----------------------------------------------------------------
999  virtual Double_t LookupWeight(AliAODTracklet* tracklet,
1000  Double_t cent,
1001  Double_t ipz);
1011  virtual UShort_t CheckTracklet(AliAODTracklet* tracklet) const;
1012  /* @} */
1013 
1014  // -----------------------------------------------------------------
1026  void ProcessEvent(Double_t cent,const AliVVertex* ip,TClonesArray* tracklets);
1027  /* @} */
1028 
1029  // -----------------------------------------------------------------
1041  virtual Bool_t MasterFinalize(Container* results);
1042  /* @} */
1043 
1044  // -----------------------------------------------------------------
1046  enum {
1047  kAll=1, // Count all events
1048  kEvent, // Have event
1049  kTracklets, // Have tracklets
1050  kTrigger, // Have trigger
1051  kIP, // Have IP
1052  kCentrality, // Have centrality
1053  kCompleted // Have completed
1054  };
1055 
1056  // -----------------------------------------------------------------
1063 
1065 
1067 
1069 
1070  TProfile* fNBareVsGood;
1072  TProfile* fNBareVsFake;
1074  TProfile* fNTrackletVsGood;
1076  TProfile* fNTrackletVsFake;
1080  TProfile* fNGeneratedVsFake;
1082  TProfile* fCentTracklets;
1083 
1084  TProfile* fCentEst;
1085 
1113 
1115 };
1116 //====================================================================
1123 {
1124 public:
1126  typedef TList Container;
1132  {}
1136  AliTrackletAODMCdNdeta(const char* name)
1137  : AliTrackletAODdNdeta(name)
1138  {}
1146  {}
1151  //__________________________________________________________________
1168  {
1174  fCombinatorics(0),
1175  fDistinct(0),
1176  fPrimaries(0),
1177  fSecondaries(0),
1178  fGenerated(0)
1179  {
1180  }
1187  CentBin(Double_t c1, Double_t c2);
1193  CentBin(const CentBin& o)
1195  fCombinatorics(0),
1196  fPrimaries(0),
1197  fSecondaries(0),
1198  fGenerated(0)
1199  {}
1203  virtual ~CentBin() {}
1209  CentBin& operator=(const CentBin&) { return *this; }
1210  protected:
1216 
1217  ClassDef(CentBin,1);
1218  };
1219 
1220 protected:
1221  // -----------------------------------------------------------------
1235  {
1236  return new CentBin(c1, c2);
1237  }
1238  /* @} */
1239 
1240  // -----------------------------------------------------------------
1245  virtual const char* GetBranchName() const { return "AliAODMCTracklets"; }
1246  /* @} */
1247 
1249 };
1250 //====================================================================
1257 {
1258 public:
1260  typedef TList Container;
1266  fWeights(0),
1267  fEtaWeight(0),
1268  fWeightCorr(0)
1269  {}
1274  : AliTrackletAODMCdNdeta(name),
1275  fWeights(0),
1276  fEtaWeight(0),
1277  fWeightCorr(0)
1278  {}
1286  fWeights(0),
1287  fEtaWeight(0),
1288  fWeightCorr(0)
1289  {}
1308  void Print(Option_t* option="") const;
1309 
1310  // -----------------------------------------------------------------
1326  void SetWeightCalc(UChar_t mode=0) {
1327  Info("SetWeightCalc", "Use=%d", mode);
1328  if (fWeights) fWeights->SetCalc(mode);}
1334  void SetWeightMask(UChar_t mask=0xFF) {
1335  Info("SetWeightMask", "mask=0x%x", mask);
1336  if (fWeights) fWeights->SetMask(mask); }
1342  void SetWeightVeto(UChar_t veto=0x0) {
1343  Info("SetWeightVeto", "veto=0x%x", veto);
1344  if (fWeights) fWeights->SetVeto(veto); }
1353  /* @} */
1354 protected:
1355  // -----------------------------------------------------------------
1365  Bool_t WorkerInit();
1375  virtual Double_t LookupWeight(AliAODTracklet* tracklet,
1376  Double_t cent,
1377  Double_t ipz);
1378  /* @} */
1379  // -----------------------------------------------------------------
1391  Bool_t MasterFinalize(Container* results);
1392  /* @} */
1393  // -----------------------------------------------------------------
1395  TProfile2D* fEtaWeight;
1398 };
1399 
1400 //____________________________________________________________________
1402  : AliAnalysisTaskSE(),
1403  fContainer(0),
1404  fCentBins(0),
1405  fIPz(0),
1406  fCent(0),
1407  fStatus(0),
1408  fEtaPhi(0),
1409  fNBareVsGood(0),
1410  fNBareVsFake(0),
1411  fNTrackletVsGood(0),
1412  fNTrackletVsFake(0),
1413  fNGeneratedVsGood(0),
1414  fNGeneratedVsFake(0),
1415  fCentTracklets(0),
1416  fCentEst(0),
1417  fCentMethod(""),
1418  fCentIdx(-1),
1419  fTrkIdx(-1),
1420  fCentAxis(1,0,0),
1421  fIPzAxis(1,0,0),
1422  fEtaAxis(1,0,0),
1423  fPhiAxis(1,0,0),
1424  fMaxDelta(0),
1425  fTailDelta(0),
1426  fTailMax(-1),
1427  fDPhiShift(0),
1428  fShiftedDPhiCut(0),
1429  fDeltaCut(0),
1430  fAbsMinCent(-1)
1431 {}
1432 //____________________________________________________________________
1434  : AliAnalysisTaskSE(name),
1435  fContainer(0),
1436  fCentBins(0),
1437  fIPz(0),
1438  fCent(0),
1439  fStatus(0),
1440  fEtaPhi(0),
1441  fNBareVsGood(0),
1442  fNBareVsFake(0),
1443  fNTrackletVsGood(0),
1444  fNTrackletVsFake(0),
1445  fNGeneratedVsGood(0),
1446  fNGeneratedVsFake(0),
1447  fCentTracklets(0),
1448  fCentEst(0),
1449  fCentMethod("V0M"),
1450  fCentIdx(-1),
1451  fTrkIdx(-1),
1452  fCentAxis(10,0,100),
1453  fIPzAxis(30,-15,+15),
1454  fEtaAxis(16,-2,+2),
1455  fPhiAxis(100,0,TMath::TwoPi()),
1456  fMaxDelta(25),
1457  fTailDelta(5),
1458  fTailMax(-1),
1459  fDPhiShift(0.0045),
1460  fShiftedDPhiCut(-1),
1461  fDeltaCut(1.5),
1462  fAbsMinCent(-1)
1463 {
1464  FixAxis(fCentAxis, "Centrality [%]");
1465  FixAxis(fIPzAxis, "IP_{#it{z}} [cm]");
1466  FixAxis(fEtaAxis, "#eta");
1467  FixAxis(fPhiAxis, "#phi");
1468 
1469  DefineOutput(1, Container::Class());
1470  DefineOutput(2, Container::Class());
1471 }
1472 //____________________________________________________________________
1474  : AliAnalysisTaskSE(o),
1475  fContainer(0),
1476  fCentBins(0),
1477  fIPz(0),
1478  fCent(0),
1479  fStatus(0),
1480  fEtaPhi(0),
1481  fNBareVsGood(0),
1482  fNBareVsFake(0),
1483  fNTrackletVsGood(0),
1484  fNTrackletVsFake(0),
1485  fNGeneratedVsGood(0),
1486  fNGeneratedVsFake(0),
1487  fCentTracklets(0),
1488  fCentEst(0),
1489  fCentMethod(o.fCentMethod),
1490  fCentIdx(o.fCentIdx),
1491  fTrkIdx(o.fTrkIdx),
1492  fCentAxis(o.fCentAxis),
1493  fIPzAxis(o.fIPzAxis),
1494  fEtaAxis(o.fEtaAxis),
1495  fPhiAxis(o.fPhiAxis),
1496  fMaxDelta(o.fMaxDelta),
1497  fTailDelta(o.fTailDelta),
1498  fTailMax(o.fTailMax),
1499  fDPhiShift(o.fDPhiShift),
1500  fShiftedDPhiCut(o.fShiftedDPhiCut),
1501  fDeltaCut(o.fDeltaCut),
1502  fAbsMinCent(o.fAbsMinCent)
1503 {}
1504 //____________________________________________________________________
1507 {
1508  if (&o == this) return *this;
1509  if (fContainer) {
1510  delete fContainer;
1511  fContainer = 0;
1512  }
1513  if (fCentBins) {
1514  delete fCentBins;
1515  fCentBins = 0;
1516  }
1517  fIPz = 0;
1518  fCent = 0;
1520  fCentIdx = o.fCentIdx;
1521  fTrkIdx = o.fTrkIdx;
1522  fCentAxis = o.fCentAxis;
1523  fIPzAxis = o.fIPzAxis;
1524  fEtaAxis = o.fEtaAxis;
1525  fPhiAxis = o.fPhiAxis;
1526  fMaxDelta = o.fMaxDelta;
1527  fTailDelta = o.fTailDelta;
1528  fTailMax = o.fTailMax;
1529  fDPhiShift = o.fDPhiShift;
1531  fDeltaCut = o.fDeltaCut;
1533  return *this;
1534 }
1535 //____________________________________________________________________
1538  o)
1539 {
1540  if (&o == this) return *this;
1542  return *this;
1543 }
1544 //____________________________________________________________________
1546  const char* resFile)
1547 {
1548  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1549  if (!mgr) {
1550  AliError("No analysis manager to connect to.");
1551  return false;
1552  }
1553 
1554  // Add to the manager
1555  mgr->AddTask(this);
1556 
1557  // Create and connect output containers
1558  TString sumOut;
1559  TString resOut;
1560  if (sumFile && sumFile[0] != '\0') sumOut = sumFile;
1561  if (resFile && resFile[0] != '\0') resOut = resFile;
1562  else if (sumFile && sumFile[0] != '\0') resOut = sumFile;
1563 
1564  // If the string is null or 'default' connect to standard output file
1565  if (sumOut.IsNull() || sumOut.EqualTo("default", TString::kIgnoreCase))
1566  sumOut = AliAnalysisManager::GetCommonFileName();
1567  // If the string is null or 'default' connect to standard output file
1568  if (resOut.IsNull() || resOut.EqualTo("default", TString::kIgnoreCase))
1569  resOut = AliAnalysisManager::GetCommonFileName();
1570 
1571  // Always connect input
1572  mgr->ConnectInput(this, 0, mgr->GetCommonInputContainer());
1573 
1574  // Connect sum list unless the output 'none' is specified
1575  if (!sumOut.EqualTo("none", TString::kIgnoreCase)) {
1576  TString sumName(Form("%sSums", GetName()));
1577  AliAnalysisDataContainer* sumCon =
1578  mgr->CreateContainer(sumName, TList::Class(),
1579  AliAnalysisManager::kOutputContainer, sumOut);
1580  mgr->ConnectOutput(this, 1, sumCon);
1581  }
1582 
1583  // Connect the result list unless the output 'none' is specified
1584  if (!resOut.EqualTo("none", TString::kIgnoreCase)) {
1585  TString resName(Form("%sResults", GetName()));
1586  AliAnalysisDataContainer* resCon =
1587  mgr->CreateContainer(resName, TList::Class(),
1588  AliAnalysisManager::kParamContainer, resOut);
1589  mgr->ConnectOutput(this, 2, resCon);
1590  }
1591  return true;
1592 }
1593 //____________________________________________________________________
1595 {
1596  Double_t shiftedDPhiCut = fShiftedDPhiCut;
1597  if (shiftedDPhiCut < 0) shiftedDPhiCut = TMath::Sqrt(fDeltaCut)*0.06;
1598  Double_t tailMax = fTailMax;
1599  if (tailMax < 0) tailMax = fMaxDelta;
1600 
1601  Printf("%s: %s", ClassName(), GetName());
1602  Printf(" %22s: 0x%08x", "Off-line trigger mask", fOfflineTriggerMask);
1603  Printf(" %22s: %f", "Delta phi shift", fDPhiShift);
1604  Printf(" %22s: %f", "Shifted Delta phi cut", shiftedDPhiCut);
1605  Printf(" %22s: %f", "Delta cut", fDeltaCut);
1606  Printf(" %22s: %f", "max Delta", fMaxDelta);
1607  Printf(" %22s: %f", "tail Delta", fTailDelta);
1608  Printf(" %22s: %f", "tail maximum", tailMax);
1609  Printf(" %22s: %f%%", "Absolute least c", fAbsMinCent);
1612  PrintAxis(fIPzAxis,1,"IPz");
1613  PrintAxis(fCentAxis,0);
1614 
1615  if (!fCentBins) return;
1616 
1617  Printf("--- Centrality bins");
1618  TIter next(fCentBins);
1619  CentBin* bin = 0;
1620  while ((bin = static_cast<CentBin*>(next()))) {
1621  bin->Print(option);
1622  }
1623 }
1624 //____________________________________________________________________
1626 {
1628  if (!fWeights) return;
1629  fWeights->Print(option);
1630 }
1631 
1632 //____________________________________________________________________
1634 {
1635  Printf(" Centrality bin: %s", fName.Data());
1636  Printf(" Low cut: %5.1f", fLow);
1637  Printf(" High cut: %5.1f", fHigh);
1638 
1639  if (!fSubs) return;
1640  Printf(" --- Histogram sets");
1641  TIter next(fSubs);
1642  Histos* h = 0;
1643  while ((h = static_cast<Histos*>(next()))) {
1644  h->Print(option);
1645  }
1646 }
1647 
1648 //____________________________________________________________________
1650 {
1651  Sub::SetDebug(lvl);
1652  TIter next(fSubs);
1653  Histos* h = 0;
1654  while ((h = static_cast<Histos*>(next()))) {
1655  h->SetDebug(lvl);
1656  }
1657 }
1658 namespace {
1659  void Bits2String(UChar_t m, char out[7])
1660  {
1661  if (m & AliAODTracklet::kInjection) out[0] = 'I'; else out[0] = '-';
1662  if (m & AliAODTracklet::kCombinatorics) out[1] = 'C'; else out[1] = '-';
1663  if (m & AliAODTracklet::kSecondary) out[2] = 'S'; else out[2] = '-';
1664  if (m & AliAODTracklet::kDistinct) out[3] = 'D'; else out[3] = '-';
1665  if (m & AliAODTracklet::kSimulated) out[4] = 'X'; else out[4] = '-';
1666  if (m & AliAODTracklet::kGenerated) out[5] = 'G'; else out[5] = '-';
1667  out[6] = '\0';
1668  }
1669 }
1670 
1671 //____________________________________________________________________
1673 {
1674  char cMask[7]; Bits2String(fMask, cMask);
1675  char cVeto[7]; Bits2String(fVeto, cVeto);
1676  Printf(" Histograms: %s", fName.Data());
1677  Printf(" Mask: 0x%02x (%s)", fMask, cMask);
1678  Printf(" Veto: 0x%02x (%s)", fVeto, cVeto);
1679  Printf(" Delta: %s", fEtaDeltaIPz ? "yes" : "no");
1680 }
1681 
1682 
1683 //____________________________________________________________________
1684 void
1686 {
1687  if (!WorkerInit()) {
1688  AliWarning("Failed to initialize on worker");
1689  return;
1690  }
1691  PostData(1,fContainer);
1692 }
1693 
1694 //____________________________________________________________________
1696 {
1697  if (DebugLevel() > 1) Printf("Initialising on worker");
1698  if (fShiftedDPhiCut < 0) fShiftedDPhiCut = TMath::Sqrt(fDeltaCut)*0.06;
1699  if (fTailMax < 0) fTailMax = fMaxDelta;
1700 
1701  fContainer = new Container;
1702  fContainer->SetName(Form("%sSums", GetName()));
1703  fContainer->SetOwner();
1704 
1705  Bool_t save = TH1::GetDefaultSumw2();
1706  TH1::SetDefaultSumw2();
1707  fIPz = Make1D(fContainer, "ipz", "", kMagenta+2, 20, fIPzAxis);
1708  fCent = Make1D(fContainer, "cent", "", kMagenta+2, 20, fCentAxis);
1709  fEtaPhi = Make2D(fContainer, "etaPhi","",kMagenta+2, 20, fEtaAxis,fPhiAxis);
1710 
1711  TAxis trackletAxis(1000, 0, 10000);
1712  FixAxis(trackletAxis, "#it{N}_{tracklets}");
1713  fNBareVsGood = Make1P(fContainer, "nBareVsGood", "Good",
1714  kGreen+2, 20, trackletAxis);
1715  fNBareVsFake = Make1P(fContainer, "nBareVsFake", "Fake",
1716  kRed+2, 20, trackletAxis);
1717  fNBareVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1718  fNBareVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1719  fNBareVsGood->SetStats(0);
1720  fNBareVsFake->SetStats(0);
1721 
1722  fNTrackletVsGood = Make1P(fContainer, "nTrackletVsGood", "Good",
1723  kGreen+2, 20, trackletAxis);
1724  fNTrackletVsFake = Make1P(fContainer, "nTrackletVsFake", "Fake",
1725  kRed+2, 20, trackletAxis);
1726  fNTrackletVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1727  fNTrackletVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1728  fNTrackletVsGood->SetStats(0);
1729  fNTrackletVsFake->SetStats(0);
1730 
1731  TAxis generatedAxis(1000, 0, 15000);
1732  FixAxis(generatedAxis, "#it{N}_{generated,|#eta|<2}");
1733  fNGeneratedVsGood = Make1P(fContainer, "nGeneratedVsGood", "Good",
1734  kGreen+2, 24, generatedAxis);
1735  fNGeneratedVsFake = Make1P(fContainer, "nGeneratedVsFake", "Fake",
1736  kRed+2, 24, generatedAxis);
1737  fNGeneratedVsGood->SetYTitle("#LT#it{N}_{tracklet}#GT");
1738  fNGeneratedVsFake->SetYTitle("#LT#it{N}_{tracklet}#GT");
1739  fNGeneratedVsGood->SetStats(0);
1740  fNGeneratedVsFake->SetStats(0);
1741 
1742  fCentTracklets = new TProfile("centTracklets",
1743  "Mean number of tracklets per centrality",
1744  1050, 0, 105);
1745  fCentTracklets->SetXTitle("Centrality [%]");
1746  fCentTracklets->SetYTitle("#LTtracklets#GT");
1747  fCentTracklets->SetDirectory(0);
1748  fCentTracklets->SetMarkerStyle(20);
1749  fCentTracklets->SetMarkerColor(kMagenta+2);
1750  fCentTracklets->SetLineColor(kMagenta+2);
1751  fContainer->Add(fCentTracklets);
1752  fCentEst = Make1P(fContainer,"centEstimator","",kMagenta+2, 20, fCentAxis);
1753  fCentEst->SetYTitle(Form("#LT%s%GT",fCentMethod.Data()));
1754  TH1::SetDefaultSumw2(save);
1755 
1756  fStatus = new TH1F("status", "Status of task",
1757  kCompleted, .5, kCompleted+.5);
1758  fStatus->SetMarkerSize(2);
1759  fStatus->SetMarkerColor(kMagenta+2);
1760  fStatus->SetLineColor(kMagenta+2);
1761  fStatus->SetFillColor(kMagenta+2);
1762  fStatus->SetFillStyle(1001);
1763  fStatus->SetBarOffset(0.1);
1764  fStatus->SetBarWidth(0.4);
1765  fStatus->SetDirectory(0);
1766  fStatus->SetStats(0);
1767  fStatus->SetXTitle("Event have");
1768  fStatus->SetYTitle("# Events");
1769  fStatus->GetXaxis()->SetBinLabel(kAll, "Been seen");
1770  fStatus->GetXaxis()->SetBinLabel(kEvent, "Event data");
1771  fStatus->GetXaxis()->SetBinLabel(kTracklets, "Tracklets");
1772  fStatus->GetXaxis()->SetBinLabel(kTrigger, "Trigger");
1773  fStatus->GetXaxis()->SetBinLabel(kIP, "IP");
1774  fStatus->GetXaxis()->SetBinLabel(kCentrality, "Centrality");
1775  fStatus->GetXaxis()->SetBinLabel(kCompleted, "Completed");
1776  fContainer->Add(fStatus);
1777 
1778  typedef TParameter<double> DP;
1779  typedef TParameter<bool> BP;
1780  typedef TParameter<int> IP;
1781  Container* params = new Container;
1782  params->SetName("parameters");
1783  params->SetOwner();
1784  fContainer->Add(params);
1785  params->Add(new DP("DPhiShift", fDPhiShift, 'f'));
1786  params->Add(new DP("ShiftedDPhiCut", fShiftedDPhiCut, 'f'));
1787  params->Add(new DP("DeltaCut", fDeltaCut, 'f'));
1788  params->Add(new DP("MaxDelta", fMaxDelta, 'f'));
1789  params->Add(new DP("TailDelta", fTailDelta, 'f'));
1790  params->Add(new DP("TailMax", fTailMax, 'f'));
1791  params->Add(new DP("AbsMinCent", fAbsMinCent, 'f'));
1792  // Create our centrality bins
1793  if (!InitCentBins(0)) {
1794  AliWarning("Failed to initialize centrality bins");
1795  return false;
1796  }
1797 
1798  // Print information to log
1799  Print();
1800  return true;
1801 }
1802 //____________________________________________________________________
1804 {
1805  if (!AliTrackletAODMCdNdeta::WorkerInit()) return false;
1806  fEtaWeight = 0;
1807  if (!fWeights) {
1808  AliFatal("No weights set!");
1809  return false;
1810  }
1811 
1812  TAxis wAxis(100,0,10);
1813  FixAxis(wAxis,"#it{w}_{i}");
1814  fEtaWeight = Make2P(fContainer, "etaWeight", "#LTw#GT", kYellow+2, 24,
1815  fEtaAxis, fCentAxis);
1816  fWeightCorr = Make2D(fContainer, "weightCorr", "w_{1} vs w_{2}",
1817  kCyan+2, 24, wAxis, wAxis);
1818  fWeights->Store(fContainer);
1819  return true;
1820 }
1821 //____________________________________________________________________
1823 {
1824  if (DebugLevel() > 1)
1825  Printf("Initialising on centrality bins on %s",
1826  existing ? "master" : "worker");
1827  if (fCentBins) return true;
1828  fCentBins = new Container;
1829  fCentBins->SetName("centralityBins");
1830  fCentBins->SetOwner();
1831 
1832  TAxis deltaAxis (Int_t(5*fMaxDelta),0, fMaxDelta);
1833  FixAxis(deltaAxis,
1834  "#Delta=[(#Delta#phi-#delta#phi)/#sigma_{#phi}]^{2}+"
1835  "[#Delta#thetasin^{-2}(#theta)/#sigma_{#theta}]^{2}");
1836 
1837  // Add min-bias bin
1838  Bool_t ret = true;
1839  CentBin* bin = MakeCentBin(0, 100);
1840  if (!existing)
1841  ret = bin->WorkerInit(fContainer,fEtaAxis,fIPzAxis,deltaAxis);
1842  else
1843  ret = bin->FinalizeInit(existing);
1844  if (!ret) {
1845  AliWarningF("Failed to initialize bin %s", bin->GetName());
1846  return false;
1847  }
1848  bin->SetDebug(DebugLevel());
1849  fCentBins->AddAt(bin, 0);
1850 
1851  // Add other bins
1852  Int_t nCentBins = fCentAxis.GetNbins();
1853  for (Int_t i = 1; i <= nCentBins; i++) {
1854  Float_t c1 = fCentAxis.GetBinLowEdge(i);
1855  Float_t c2 = fCentAxis.GetBinUpEdge(i);
1856  bin = MakeCentBin(c1, c2);
1857  if (!existing)
1858  ret = bin->WorkerInit(fContainer,fEtaAxis,fIPzAxis,deltaAxis);
1859  else
1860  ret = bin->FinalizeInit(existing);
1861  if (!ret) {
1862  AliWarningF("Failed to initialize %s", bin->GetName());
1863  return false;
1864  }
1865  bin->SetDebug(DebugLevel());
1866  fCentBins->AddAt(bin, i);
1867  }
1868  return true;
1869 }
1870 
1871 //____________________________________________________________________
1873  : Sub(""),
1874  fSubs(0),
1875  fLow(c1),
1876  fHigh(c2),
1877  fIPz(0),
1878  fCent(0),
1879  fCentIPz(0),
1880  fMeasured(0),
1881  fInjection(0)
1882 {
1884  fMeasured = MakeHistos("measured", kRed+2, 20,
1885  kMeasuredMask, // No requirements, just veto
1886  kMeasuredVeto);
1887  fInjection = MakeHistos("injected", kOrange+2, 21,
1888  kInjectedMask,
1889  kInjectedVeto);
1890  fSubs = new Container;
1891  fSubs->SetOwner(true);
1892  fSubs->Add(fMeasured);
1893  fSubs->Add(fInjection);
1894 }
1895 
1896 //____________________________________________________________________
1898  : AliTrackletAODdNdeta::CentBin(c1, c2),
1899  fCombinatorics(0),
1900  fDistinct(0),
1901  fPrimaries(0),
1902  fSecondaries(0),
1903  fGenerated(0)
1904 {
1905  // Combinatorics is everything that has the combinatorics bit
1906  // Primaries all with simulated bit, but not secondary or
1907  // combinatorics bit.
1908  // Secondaries are all those with the secondary bit set
1909  fCombinatorics = MakeHistos("combinatorics", kMagenta+2, 30,
1912  fDistinct = MakeHistos("distinct", kCyan+2, 27,
1913  kDistinctMask,
1914  kDistinctVeto);
1915  fPrimaries = MakeHistos("primaries", kGreen+2, 26,
1916  kPrimaryMask,
1917  kPrimaryVeto);
1918  fSecondaries = MakeHistos("secondaries", kBlue+2, 32,
1920  kSecondaryVeto);
1921  fGenerated = MakeHistos("generated", kGray+1, 28,
1923  kGeneratedVeto);
1924  fMeasured->fStyle = 24;
1925  fInjection->fStyle = 25;
1926  fSubs->Add(fCombinatorics);
1927  fSubs->Add(fDistinct);
1928  fSubs->Add(fPrimaries);
1929  fSubs->Add(fSecondaries);
1930  fSubs->AddAfter(fMeasured, fGenerated);
1931 }
1932 
1933 //____________________________________________________________________
1936  Color_t color,
1937  Style_t style,
1938  UShort_t mask,
1939  UShort_t veto)
1940 {
1941  return new Histos(name, color, style, mask, veto);
1942 }
1943 
1944 //____________________________________________________________________
1946  const TAxis& etaAxis,
1947  const TAxis& ipzAxis,
1948  const TAxis& deltaAxis)
1949 {
1950  if (fDebug > 0)
1951  Printf("Initializing centrality bin %s", fName.Data());
1952  if (!Sub::WorkerInit(parent, etaAxis, ipzAxis, deltaAxis)) return false;
1953 
1954  TAxis centAxis(20, fLow, fHigh);
1955  FixAxis(centAxis, "Centrality [%]");
1956  fCent = Make1D(fContainer,"cent","Centrality [%]",
1957  kMagenta+2,20,centAxis);
1958  fIPz = Make1D(fContainer,"ipz","IP_{#it{z}} [cm]",kRed+2,20,ipzAxis);
1959  fCentIPz = Make1P(fContainer,"centIpz","#LTc#GT vs IP_{#it{z}}",kPink+2,
1960  20,ipzAxis);
1961  fCentIPz->SetYTitle("#LTc#GT");
1962  TIter next(fSubs);
1963  Histos* h = 0;
1964  while ((h = static_cast<Histos*>(next()))) {
1965  if (!h ->WorkerInit(fContainer, etaAxis,ipzAxis,deltaAxis))
1966  return false;
1967  }
1968 
1969  return true;
1970 }
1971 //____________________________________________________________________
1973  const TAxis& etaAxis,
1974  const TAxis& ipzAxis,
1975  const TAxis& deltaAxis)
1976 {
1977  if (!Sub::WorkerInit(parent, etaAxis, ipzAxis, deltaAxis)) return false;
1978  TString shrt(Form("%c", GetName()[0]));
1979  shrt.ToUpper();
1980  if (GetC(parent, "generated", false) != 0) shrt.Append("'");
1981 
1982  // Do not make eta vs IPz for secondaries and primaries
1983  if (!IsPrimary() && !IsSecondary())
1984  fEtaIPz = Make2D(fContainer, "etaIPz", shrt.Data(),
1985  kRed+2, 20, etaAxis, ipzAxis);
1986  // Always make eta vs Delta distribution, except for MC truth
1987  if (!IsGenerated())
1988  fEtaDeltaIPz = Make3D(fContainer, "etaDeltaIPz",
1989  Form("#Delta_{%s}",shrt.Data()),
1990  kBlue+2, 21, etaAxis, deltaAxis, ipzAxis);
1991  if (!IsGenerated() &&
1992  // !IsPrimary() &&
1993  // !IsSecondary() &&
1994  !IsInjected() &&
1995  fStyle != 20) // Last condition to not make this for real data
1996  fEtaPdgIPz = Make3D(fContainer, "etaPdgIPz",
1997  "Parent particle type",
1998  kGreen+2, 22, etaAxis, PdgAxis(), ipzAxis);
1999 
2000  if (IsGenerated()) {
2001  fEtaPdg = Make2D(fContainer, "etaPdg",
2002  "Primary particle type",
2003  kYellow+2, 30, etaAxis, PdgAxis());
2004  TAxis ptAxis(100, 0, 5);
2005  ptAxis.SetTitle("#it{p}_{T}");
2006  FixAxis(ptAxis);
2007  fEtaPt = Make2D(fContainer, "etaPt",
2008  "Primary transverse momentum",
2009  kCyan+2, 30, etaAxis, ptAxis);
2010  }
2011 
2012  SetAttr(fColor, fStyle);
2013  return true;
2014 }
2015 //____________________________________________________________________
2017 {
2018  if (fEtaIPz) {
2019  fEtaIPz->SetMarkerStyle(m);
2020  fEtaIPz->SetMarkerColor(c);
2021  fEtaIPz->SetLineColor(c);
2022  fEtaIPz->SetFillColor(c);
2023  }
2024  if (fEtaDeltaIPz) {
2025  fEtaDeltaIPz->SetMarkerStyle(m);
2026  fEtaDeltaIPz->SetMarkerColor(c);
2027  fEtaDeltaIPz->SetLineColor(c);
2028  fEtaDeltaIPz->SetFillColor(c);
2029  }
2030  if (fEtaPdgIPz) {
2031  fEtaPdgIPz->SetMarkerStyle(m);
2032  fEtaPdgIPz->SetMarkerColor(c);
2033  fEtaPdgIPz->SetLineColor(c);
2034  fEtaPdgIPz->SetFillColor(c);
2035  }
2036  if (fEtaPdg) {
2037  fEtaPdg->SetMarkerStyle(m);
2038  fEtaPdg->SetMarkerColor(c);
2039  fEtaPdg->SetLineColor(c);
2040  fEtaPdg->SetFillColor(c);
2041  }
2042  if (fEtaPt) {
2043  fEtaPt->SetMarkerStyle(m);
2044  fEtaPt->SetMarkerColor(c);
2045  fEtaPt->SetLineColor(c);
2046  fEtaPt->SetFillColor(c);
2047  }
2048 }
2049 
2050 //____________________________________________________________________
2051 void
2053 {
2054  if (DebugLevel() > 0) Printf("In user exec");
2055  Double_t cent = -1;
2056  const AliVVertex* ip = 0;
2057  TClonesArray* tracklets = 0;
2058  if (!CheckEvent(cent, ip, tracklets)) {
2059  AliWarningF("Event didn't pass %f, %p, %p", cent, ip, tracklets);
2060  Printf("Argh, check data failed %f, %p, %p", cent, ip, tracklets);
2061  return;
2062  }
2063  if (DebugLevel() > 0) Printf("Got centrality=%f ipZ=%f %d tracklets",
2064  cent, ip->GetZ(), tracklets->GetEntriesFast());
2065  ProcessEvent(cent, ip, tracklets);
2066 
2067  PostData(1,fContainer);
2068  fStatus->Fill(kCompleted);
2069 }
2070 
2071 //____________________________________________________________________
2073  const AliVVertex*& ip,
2074  TClonesArray*& tracklets)
2075 {
2076  // Count all events
2077  fStatus->Fill(kAll);
2078 
2079  // Check for event
2080  AliVEvent* event = InputEvent();
2081  if (!event) {
2082  AliWarning("No event");
2083  return false;
2084  }
2085  fStatus->Fill(kEvent);
2086 
2087  // Check if we have the tracklets
2088  tracklets = FindTracklets(event);
2089  if (!tracklets) return false;
2090  fStatus->Fill(kTracklets);
2091 
2092  // Check if event was triggered
2093  Bool_t trg = FindTrigger();
2094  if (!trg) return false;
2095  fStatus->Fill(kTrigger);
2096 
2097  // Check the interaction point
2098  ip = FindIP(event);
2099  if (!ip) return false;
2100  fStatus->Fill(kIP);
2101 
2102  // Check the centrality
2103  Int_t nTracklets = 0;
2104  cent = FindCentrality(event, nTracklets);
2105  if (cent < 0) return false;
2106  fStatus->Fill(kCentrality);
2107 
2108  fIPz->Fill(ip->GetZ());
2109  fCent->Fill(cent);
2110  fCentTracklets->Fill(cent, nTracklets);
2111 
2112  return true;
2113 }
2114 
2115 //____________________________________________________________________
2116 TClonesArray* AliTrackletAODdNdeta::FindTracklets(AliVEvent* event)
2117 {
2118  // Check the multiplicity
2119  TObject* obj = event->FindListObject(GetBranchName());
2120  if (!obj) {
2121  AliWarningF("Couldn't get object %s", GetBranchName());
2122  // event->GetList()->Print();
2123  return 0;
2124  }
2125  if (!obj->IsA()->InheritsFrom(TClonesArray::Class())) {
2126  AliWarningF("Object %s is not a TClonesArray but a %s",
2127  obj->GetName(), obj->ClassName());
2128  return 0;
2129  }
2130  return static_cast<TClonesArray*>(obj);
2131 }
2132 
2133 //____________________________________________________________________
2134 const AliVVertex* AliTrackletAODdNdeta::CheckIP(const AliVVertex* ip,
2135  Double_t maxDispersion,
2136  Double_t maxZError)
2137 {
2138  if (!ip) return 0;
2139  if (ip->GetNContributors() <= 0) {
2140  AliWarning("Not enough contributors for IP");
2141  return 0;
2142  }
2143  // If this is from the Z vertexer, do some checks
2144  if (ip->IsFromVertexerZ()) {
2145  // Get covariance matrix
2146  Double_t covar[6];
2147  ip->GetCovarianceMatrix(covar);
2148  Double_t sigmaZ = TMath::Sqrt(covar[5]);
2149  if (sigmaZ >= maxZError) {
2150  AliWarningF("IPz resolution = %f >= %f", sigmaZ, maxZError);
2151  return 0;
2152  }
2153 
2154  // If this IP doesn not derive from AliVertex, don't check dispersion.
2155  if (ip->IsA()->InheritsFrom(AliVertex::Class())) {
2156  const AliVertex* ipv = static_cast<const AliVertex*>(ip);
2157  // Dispersion is the parameter used by the vertexer for finding the IP.
2158  if (ipv->GetDispersion() >= maxDispersion) {
2159  AliWarningF("IP dispersion = %f >= %f",
2160  ipv->GetDispersion(), maxDispersion);
2161  return 0;
2162  }
2163  }
2164  }
2165 
2166  // If we get here, we either have a full 3D vertex or track
2167  // vertex, and we should check if it is in range
2168  if (ip->GetZ() < fIPzAxis.GetXmin() || ip->GetZ() > fIPzAxis.GetXmax()) {
2169  AliWarningF("IPz = %fcm out of range [%f,%f]cm",
2170  ip->GetZ(), fIPzAxis.GetXmin(), fIPzAxis.GetXmax());
2171  return 0;
2172  }
2173  return ip;
2174 }
2175 
2176 //____________________________________________________________________
2177 const AliVVertex* AliTrackletAODdNdeta::FindRealIP(AliVEvent* event,
2178  Double_t maxDispersion,
2179  Double_t maxZError)
2180 {
2181  const AliVVertex* ip = event->GetPrimaryVertex();
2182  if (!ip) {
2183  if (DebugLevel() > 1) AliWarning("No real IP for this event found!");
2184  return 0;
2185  }
2186  return CheckIP(ip, maxDispersion, maxZError);
2187 }
2188 
2189 //____________________________________________________________________
2190 const AliVVertex* AliTrackletAODdNdeta::FindSimpleIP(AliVEvent* event,
2191  Double_t maxDispersion,
2192  Double_t maxZError)
2193 {
2194  static AliVertex* ip;
2195  AliAODSimpleHeader* head =
2196  static_cast<AliAODSimpleHeader*>(event
2197  ->FindListObject("AliAODSimpleHeader"));
2198  if (!head) {
2199  if (DebugLevel() > 1) AliWarning("No simple header");
2200  return 0;
2201  }
2202  if (!ip)
2203  ip = new AliVertex;
2204  ip->SetXv(head->fRecIP.X());
2205  ip->SetYv(head->fRecIP.Y());
2206  ip->SetZv(head->fRecIP.Z());
2207  ip->SetNContributors(10);
2208  ip->SetTitle("");
2209  return CheckIP(ip, maxDispersion, maxZError);
2210 }
2211 
2212 //____________________________________________________________________
2213 const AliVVertex* AliTrackletAODdNdeta::FindIP(AliVEvent* event,
2214  Double_t maxDispersion,
2215  Double_t maxZError)
2216 {
2217  const AliVVertex* ip = FindRealIP(event,maxDispersion,maxZError);
2218  if (!ip) {
2219  ip = FindSimpleIP(event,maxDispersion,maxZError);
2220  if (!ip) {
2221  if (DebugLevel() > 1) AliWarning("No IP for this event found!");
2222  return 0;
2223  }
2224  }
2225  // Good vertex, return it
2226  return ip;
2227 }
2228 //____________________________________________________________________
2230 {
2231  UInt_t evBits = fInputHandler->IsEventSelected();
2232  Bool_t trgOK = (evBits & fOfflineTriggerMask || fOfflineTriggerMask == 0);
2233  if (DebugLevel())
2234  Printf("Trigger bits=0x%08x mask=0x%08x masked=0x%08x -> %s",
2235  evBits, fOfflineTriggerMask, evBits & fOfflineTriggerMask,
2236  trgOK ? "selected" : "rejected");
2237  return trgOK;
2238 }
2239 //____________________________________________________________________
2241 {
2242  static TString centMeth;
2243  if (centMeth.IsNull()) {
2244  centMeth = fCentMethod(3,fCentMethod.Length()-3);
2245  }
2246  AliCentrality* cent = event->GetCentrality();
2247  if (!cent) return -1;
2248 
2249  Double_t centPer = cent->GetCentralityPercentileUnchecked(centMeth);
2250  return centPer;
2251 }
2252 //____________________________________________________________________
2254  Int_t& nTracklets)
2255 {
2256  AliMultSelection* cent =
2257  static_cast<AliMultSelection*>(event->FindListObject("MultSelection"));
2258  if (!cent) {
2259  AliWarning("No centrality in event");
2260  event->GetList()->Print();
2261  return -1;
2262  }
2263  if (fCentIdx < 0) {
2264  TString trkName("SPDTracklets");
2265  for (Int_t i = 0; i < cent->GetNEstimators(); i++) {
2266  AliMultEstimator* e = cent->GetEstimator(i);
2267  if (!e) continue;
2268  if (fCentMethod.EqualTo(e->GetName())) fCentIdx = i;
2269  if (trkName.EqualTo(e->GetName())) fTrkIdx = i;
2270  }
2271  }
2272  if (fCentIdx < 0) {
2273  AliWarningF("Centrality estimator %s not found", fCentMethod.Data());
2274  return -1;
2275  }
2276 
2277  // Use cached index to look up the estimator
2278  AliMultEstimator* estCent = cent->GetEstimator(fCentIdx);
2279  if (!estCent) {
2280  AliWarningF("Centrality estimator %s not available for this event",
2281  fCentMethod.Data());
2282  return -1;
2283  }
2284  fCentEst->Fill(estCent->GetPercentile(), estCent->GetValue());
2285 
2286  // Now look up tracklet value using cached index
2287  if (fTrkIdx < 0) return estCent->GetPercentile();
2288  AliMultEstimator* estTracklets = cent->GetEstimator(fTrkIdx);
2289  if (estTracklets) nTracklets = estTracklets->GetValue();
2290 
2291  return estCent->GetPercentile();
2292 }
2293 
2294 //____________________________________________________________________
2296  Int_t& nTracklets)
2297 {
2298  if (fCentMethod.EqualTo("MB", TString::kIgnoreCase)) {
2299  Printf("MB centrality - not checked");
2300  return 0;
2301  }
2302  Double_t centPer = -1;
2303  if (fCentMethod.BeginsWith("OLD"))
2304  centPer = FindCompatCentrality(event);
2305  else
2306  centPer = FindMultCentrality(event, nTracklets);
2307  const Double_t safety = 1e-3;
2308  if (DebugLevel() > 1) Printf("Read centrality: %f%%", centPer);
2309  if (centPer < -safety) return -2;
2310  if (centPer < +safety) centPer = safety;
2311  else if (centPer > 100-safety) centPer = 100-safety;
2312 
2313  if (fAbsMinCent >= 0 && centPer < fAbsMinCent) {
2314  AliWarningF("Centrality = %f lower than absolute minimum [%f]",
2315  centPer, fAbsMinCent);
2316  return -3;
2317  }
2318  if (centPer < fCentAxis.GetXmin() || centPer > fCentAxis.GetXmax()) {
2319  AliWarningF("Centrality = %f out of range [%f,%f]",
2320  centPer, fCentAxis.GetXmin(), fCentAxis.GetXmax());
2321  return -3;
2322  }
2323  return centPer;
2324 }
2325 
2326 //____________________________________________________________________
2328  Double_t cent,
2329  Double_t ipz)
2330 {
2331  return 1;
2332 }
2333 //____________________________________________________________________
2335  Double_t cent,
2336  Double_t ipz)
2337 {
2338  // We don't check for weights, as we must have them to come this far
2339  // if (!fWeights) {
2340  // AliWarning("No weights defined");
2341  // return 1;
2342  // }
2343  Double_t w = fWeights->LookupWeight(tracklet, cent, ipz, fWeightCorr);
2344  if (tracklet->IsMeasured())
2345  fEtaWeight->Fill(tracklet->GetEta(), cent, w);
2346 
2347  // printf("Looking up weight of tracklet -> %f ", w);
2348  // tracklet->Print();
2349  return w;
2350 }
2351 //____________________________________________________________________
2353 {
2354  Double_t dPhiS = (tracklet->GetDPhi() -
2355  TMath::Sign(fDPhiShift,Double_t(tracklet->GetDPhi())));
2356  UShort_t ret = 0;
2357  ret |= ((tracklet->GetDelta() <= fDeltaCut) ? 0x1 : 0);
2358  ret |= ((dPhiS < fShiftedDPhiCut) ? 0x2 : 0);
2359  // Printf("dPhiS=%f (%f) Delta=%f (%f) -> 0x%x",
2360  // dPhiS, fShiftedDPhiCut,
2361  // tracklet->GetDelta(), fDeltaCut,
2362  // ret);
2363  return ret;
2364 }
2365 
2366 
2367 //____________________________________________________________________
2369  const AliVVertex* ip,
2370  TClonesArray* tracklets)
2371 {
2372  // Figure out which centrality bins to fill
2373  Int_t nAcc = 0;
2374  TIter nextAcc(fCentBins);
2375  CentBin* bin = 0;
2376  TList toRun;
2377  while ((bin = static_cast<CentBin*>(nextAcc()))) {
2378  if (!bin->Accept(cent, ip->GetZ())) continue; // Not in range for this bin
2379  toRun.Add(bin);
2380  nAcc++;
2381  }
2382  // If we have no centrality bins to fill, we return immediately
2383  if (nAcc <= 0) return;
2384 
2385  Double_t ipz = ip->GetZ();
2386  Double_t nBare = 0;
2387  Double_t nMeasured = 0;
2388  Double_t nGenerated = 0;
2389  Double_t nGood = 0;
2390  Double_t nFake = 0;
2391  AliAODTracklet* tracklet = 0;
2392  TIter nextTracklet(tracklets);
2393  while ((tracklet = static_cast<AliAODTracklet*>(nextTracklet()))) {
2394  Double_t weight = LookupWeight(tracklet, cent, ipz);
2395  UShort_t signal = CheckTracklet(tracklet);
2396  if (signal) fEtaPhi->Fill(tracklet->GetEta(), tracklet->GetPhi());
2397  if (tracklet->IsMeasured()) {
2398  nMeasured += weight;
2399  nBare ++;
2400  if (tracklet->IsCombinatorics()) nFake += weight;
2401  else nGood += weight;
2402  }
2403  else if (tracklet->IsGenerated() &&
2404  !tracklet->IsNeutral() &&
2405  TMath::Abs(tracklet->GetEta()) <= 2) nGenerated ++; // += weight;
2406  TIter nextBin(&toRun);
2407  while ((bin = static_cast<CentBin*>(nextBin()))) {
2408  bin->ProcessTracklet(tracklet, ip->GetZ(), signal, weight);
2409  }
2410  }
2411  fNBareVsFake ->Fill(nBare, nFake);
2412  fNBareVsGood ->Fill(nBare, nGood);
2413  fNTrackletVsFake ->Fill(nMeasured, nFake);
2414  fNTrackletVsGood ->Fill(nMeasured, nGood);
2415  fNGeneratedVsFake->Fill(nGenerated, nFake);
2416  fNGeneratedVsGood->Fill(nGenerated, nGood);
2417 }
2418 
2419 //____________________________________________________________________
2421 {
2422  if (cent < fLow || cent >= fHigh) return false;
2423  fCent ->Fill(cent);
2424  fIPz ->Fill(ipz);
2425  fCentIPz->Fill(ipz, cent);
2426  return true;
2427 }
2428 
2429 //____________________________________________________________________
2431  Double_t ipZ,
2432  UShort_t signal,
2433  Double_t weight)
2434 {
2435  TIter next(fSubs);
2436  Histos* h = 0;
2437  if (fDebug > 3) tracklet->Print();
2438  while ((h = static_cast<Histos*>(next())))
2439  h->ProcessTracklet(tracklet, ipZ, signal, weight);
2440 
2441  return true;
2442 }
2443 //____________________________________________________________________
2445  Double_t ipZ,
2446  UShort_t signal,
2447  Double_t weight)
2448 {
2449  if (!fEtaIPz && !fEtaDeltaIPz) return true;
2450  // Get tracklet info
2451  Double_t eta = tracklet->GetEta();
2452  Double_t delta = tracklet->GetDelta();
2453  UChar_t flags = tracklet->GetFlags();
2454  Int_t pdgBin = -1;
2455 
2456  // For debugging
2457  char m[7];
2458  if (fDebug > 3) Bits2String(flags, m);
2459 
2460  // Check the filter mask
2461  if (fMask != 0 && (flags & fMask) == 0) {
2462  if (fDebug > 3) Printf("%14s (0x%02x,----) %6s %7s (0x%02x) ",
2463  GetName(),fMask,"reject",m,flags);
2464  return false;
2465  }
2466 
2467  // If we need the PDG code, get that here
2468  if (fEtaPdgIPz || fEtaPdg) pdgBin = PdgBin(tracklet->GetParentPdg());
2469 
2470  // If we have the eta-vs-pdg histogram, we should fill before the
2471  // veto, which filters out the neutral particles.
2472  if (fEtaPdg) fEtaPdg->Fill(eta, pdgBin, weight);
2473 
2474  // Check the veto mask
2475  if (fVeto != 0 && (flags & fVeto) != 0) {
2476  if (fDebug > 3) Printf("%14s (----,0x%02x) %6s %7s (0x%02x) ",
2477  GetName(), fVeto, "veto", m, flags);
2478  return false;
2479  }
2480  // Debug message that we accepted tracklet
2481  if (fDebug > 3) Printf("%14s (0x%02x,0x%02x) %6s %7s (0x%02x) ",
2482  GetName(), fMask, fVeto, "accept", m, flags);
2483 
2484  // Both reguirements (Delta < cut, dPhi < cut)
2485  if (fEtaIPz && (signal == 0x3)) fEtaIPz->Fill(eta, ipZ, weight);
2486  // Just check dPhi
2487  if (fEtaDeltaIPz && (signal & 0x2)) fEtaDeltaIPz->Fill(eta,delta,ipZ,weight);
2488 
2489  // If we do not need the eta-PDG-IPz or eta-Pt, return now
2490  if (!fEtaPdgIPz && !fEtaPt) return true;
2491 
2492  if (fEtaPdgIPz) {
2493  fEtaPdgIPz->Fill(eta, pdgBin, ipZ, weight);
2494  if (tracklet->IsCombinatorics())
2495  // Fill both particles
2496  fEtaPdgIPz->Fill(eta, PdgBin(tracklet->GetParentPdg(true)), ipZ, weight);
2497  }
2498 
2499  if (fEtaPt) fEtaPt ->Fill(eta, tracklet->GetParentPt(), weight);
2500 
2501  return true;
2502 }
2503 
2504 
2505 //____________________________________________________________________
2506 void
2508 {
2509  Container* results = new Container;
2510  results->SetName(Form("%sResults",GetName()));
2511  results->SetOwner();
2512 
2513  Print("");
2514  fContainer = static_cast<Container*>(GetOutputData(1));
2515  if (!fContainer) {
2516  AliWarning("No sum container found!");
2517  return;
2518  }
2519 
2520  if (!InitCentBins(fContainer)) {
2521  AliWarningF("Failed to initialize centrality bins from %s",
2522  fContainer->GetName());
2523  return;
2524  }
2525 
2526  if (!MasterFinalize(results)) {
2527  AliWarning("Failed to finalize results");
2528  return;
2529  }
2530 
2531  PostData(2, results);
2532 }
2533 
2534 
2535 //____________________________________________________________________
2537 {
2538  fContainer = GetC(parent, fName);
2539  fCent = GetH1(fContainer, "cent");
2540  fIPz = GetH1(fContainer, "ipz");
2541  fCentIPz = GetP1(fContainer, "centIpz");
2542  if (!fContainer || !fCent || !fIPz) return false;
2543  TIter next(fSubs);
2544  Histos* h = 0;
2545  while ((h = static_cast<Histos*>(next())))
2546  if (!h->FinalizeInit(fContainer)) return false;
2547  return true;
2548 }
2549 //____________________________________________________________________
2551 {
2552  fContainer = GetC(parent, fName);
2553  fEtaIPz = GetH2(fContainer, "etaIPz", false); // No complaints
2554  fEtaDeltaIPz = GetH3(fContainer, "etaDeltaIPz", false);
2555  fEtaPdgIPz = GetH3(fContainer, "etaPdgIPz", false);
2556  fEtaPdg = GetH2(fContainer, "etaPdg", false);
2557  fEtaPt = GetH2(fContainer, "etaPt", false);
2558  if (GetName()[0] == 'm' && GetC(parent,"generated")) {
2559  // Fix up titles
2560  if (fEtaIPz)
2561  fEtaIPz->SetTitle(Form("%s'", fEtaIPz->GetTitle()));
2562  if (fEtaDeltaIPz)
2563  fEtaDeltaIPz->SetTitle(Form("#Delta_{%s}", fEtaIPz->GetTitle()));
2564  }
2565  return (fContainer != 0); // && fEtaIPz != 0);
2566 }
2567 
2568 //____________________________________________________________________
2570 {
2571  // Make copies of histograms and store
2572  fIPz = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"ipz")));
2573  fCent = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"cent")));
2574  fStatus = static_cast<TH1*>(CloneAndAdd(results,GetH1(fContainer,"status")));
2575  fEtaPhi = static_cast<TH2*>(CloneAndAdd(results,GetH2(fContainer,"etaPhi")));
2576  fCentTracklets =
2577  static_cast<TProfile*>(CloneAndAdd(results,GetP(fContainer,
2578  "centTracklets")));
2579  fCentEst =
2580  static_cast<TProfile*>(CloneAndAdd(results,GetP(fContainer,
2581  "centEstimator")));
2582  Double_t nEvents = fIPz->GetEntries();
2583  Printf("Event summary:");
2584  for (Int_t i = 1; i <= fStatus->GetNbinsX(); i++)
2585  Printf(" %10d %s",
2586  Int_t(fStatus->GetBinContent(i)),
2587  fStatus->GetXaxis()->GetBinLabel(i));
2588  for (Int_t i = 1; i <= fCent->GetNbinsX(); i++)
2589  Printf(" %6.2f-%6.2f%%: %d",
2590  fCent->GetXaxis()->GetBinLowEdge(i),
2591  fCent->GetXaxis()->GetBinUpEdge(i),
2592  Int_t(fCent->GetBinContent(i)));
2593 
2594 
2595  fIPz ->Scale(1./nEvents);
2596  fCent ->Scale(1./fCent->GetEntries());
2597  fStatus->Scale(1./fStatus->GetBinContent(1));
2598  fEtaPhi->Scale(1./nEvents);
2599 
2600  if (fTailMax < 0) fTailMax = fMaxDelta;
2601  TIter next(fCentBins);
2602  CentBin* bin = 0;
2603  while ((bin = static_cast<CentBin*>(next()))) {
2604  if (!bin->MasterFinalize(results, 0, fTailDelta, fTailMax)) {
2605  AliWarningF("Failed to finalize %s", bin->GetName());
2606  return false;
2607  }
2608  }
2609  return true;
2610 }
2611 //____________________________________________________________________
2613 {
2614  if (!AliTrackletAODMCdNdeta::MasterFinalize(results)) return false;
2615 
2616  TObject* o = fContainer->FindObject("etaWeight");
2617  if (o && o->IsA()->InheritsFrom(TH1::Class())) {
2618  TH1* h = static_cast<TH1*>(o->Clone());
2619  h->SetDirectory(0);
2620  results->Add(h);
2621  }
2622  else {
2623  AliWarningF("Object %p (etaWeight) is not a TH1 or not found",o);
2624  }
2625  o = fContainer->FindObject("weightCorr");
2626  if (o && o->IsA()->InheritsFrom(TH1::Class())) {
2627  TH1* h = static_cast<TH1*>(o->Clone());
2628  h->SetDirectory(0);
2629  results->Add(h);
2630  }
2631  else {
2632  AliWarningF("Object %p (weightCorr) is not a TH1 or not found",o);
2633  }
2634  if (!fWeights) return true;
2635 
2636  if (!fWeights->Retrieve(fContainer)) return false;
2637  fWeights->Store(results);
2638 
2639  return true;
2640 }
2641 
2642 
2643 //____________________________________________________________________
2645  TH1* ,
2646  Double_t tailDelta,
2647  Double_t tailMax)
2648 {
2649  Container* result = new Container;
2650  result->SetName(fName);
2651  result->SetOwner(true);
2652  parent->Add(result);
2653 
2654  Double_t nEvents = fIPz->GetEntries();
2655  // Copy ipZ histogram and scale by number of events
2656  TH1* ipZ = static_cast<TH1*>(CloneAndAdd(result, fIPz));
2657  ipZ->Scale(1./nEvents);
2658 
2659  TH1* cent = static_cast<TH1*>(CloneAndAdd(result, fCent));
2660  cent->Scale(1./nEvents);
2661 
2662  CloneAndAdd(result, fCentIPz);
2663 
2664  Container* measCont = 0;
2665  Container* genCont = 0;
2666  TIter next(fSubs);
2667  Histos* h = 0;
2668  while ((h = static_cast<Histos*>(next()))) {
2669  if (h->GetMask() != AliAODTracklet::kInjection &&
2671  // For the anything but injection or MC-labels, we just finalize
2672  if (!h->MasterFinalize(result, fIPz, tailDelta, tailMax)) {
2673  AliWarningF("Failed to finalize %s/%s", GetName(), h->GetName());
2674  return false;
2675  }
2676  if (h->GetMask() == AliAODTracklet::kGenerated)
2677  // Set MC truth container
2678  genCont = GetC(result, h->GetName());
2679  if (h == fMeasured)
2680  measCont = GetC(result, h->GetName());
2681  continue;
2682  }
2683  if (!EstimateBackground(result, measCont, genCont, h, tailDelta, tailMax)) {
2684  AliWarningF("Failed to estimate Bg in %s/%s", GetName(), h->GetName());
2685  return false;
2686  }
2687  }
2688  return true;
2689 }
2690 
2691 //____________________________________________________________________
2692 Bool_t
2694  TH1* ipz,
2695  Double_t tailDelta,
2696  Double_t tailMax)
2697 {
2698  Container* result = new Container;
2699  result->SetName(fName);
2700  result->SetOwner(true);
2701  parent->Add(result);
2702 
2703  // Get the number of events
2704  Double_t nEvents = ipz->GetEntries();
2705 
2706  // Scale each vertex range by number of events in that range
2707  TH2* etaIPz = 0;
2708  if (fEtaIPz) {
2709  etaIPz = ScaleToIPz(fEtaIPz, ipz);
2710  result->Add(etaIPz);
2711  }
2712 
2713  // Scale distribution of PDGs to number of events and bin width
2714  if (fEtaPdg) {
2715  TH2* etaPdg = static_cast<TH2*>(fEtaPdg->Clone());
2716  etaPdg->SetDirectory(0);
2717  etaPdg->Scale(1. / nEvents, "width");
2718  result->Add(etaPdg);
2719 
2720  // Loop over PDG types and create 2D and 1D distributions
2721  TAxis* yaxis = etaPdg->GetYaxis();
2722  Int_t first = yaxis->GetFirst();
2723  Int_t last = yaxis->GetLast();
2724  THStack* pdgs = new THStack("all","");
2725  THStack* toPion = new THStack("toPion", "");
2726  THStack* toAll = new THStack("toAll", "");
2727  TH1* pion = 0;
2728  Container* pdgOut = new Container();
2729  pdgOut->SetName("mix");
2730  result->Add(pdgOut);
2731  pdgOut->Add(pdgs);
2732  pdgOut->Add(toPion);
2733  pdgOut->Add(toAll);
2734 
2735  TH1* all = static_cast<TH1*>(etaPdg->ProjectionX("total",
2736  1,etaPdg->GetNbinsY()));
2737  all->SetDirectory(0);
2738  all->SetName("total");
2739  all->SetTitle("All");
2740  all->SetYTitle(Form("d#it{N}_{%s}/d#eta", "all"));
2741  all->SetFillColor(kBlack);
2742  all->SetMarkerColor(kBlack);
2743  all->SetLineColor(kBlack);
2744  all->SetMarkerStyle(20);
2745  all->SetFillStyle(0);
2746  all->SetFillColor(0);
2747  all->Reset();
2748  pdgs->Add(all);
2749  for (Int_t i = 1; i <= etaPdg->GetNbinsY(); i++) {
2750  Int_t pdg = TString(yaxis->GetBinLabel(i)).Atoi();
2751  TString nme;
2752  Style_t sty;
2753  Color_t col;
2754  PdgAttr(pdg, nme, col, sty);
2755  if (pdg < 0) pdg = 0;
2756  if (pdg == 22) continue; // Ignore photons
2757 
2758  TH1* h1 = static_cast<TH1*>(etaPdg->ProjectionX(Form("h%d", pdg),i,i));
2759  if (h1->GetEntries() <= 0) continue; // Do not store if empty
2760  h1->SetDirectory(0);
2761  h1->SetName(Form("eta_%d", pdg));
2762  h1->SetTitle(nme);
2763  h1->SetYTitle(Form("d#it{N}_{%s}/d#eta", nme.Data()));
2764  h1->SetFillColor(col);
2765  h1->SetMarkerColor(col);
2766  h1->SetLineColor(col);
2767  h1->SetMarkerStyle(sty);
2768  h1->SetFillStyle(0);
2769  h1->SetFillColor(0);
2770  h1->SetBinContent(0,0);
2771  all->Add(h1);
2772  pdgs->Add(h1);
2773  switch (pdg) {
2774  case 321: h1->SetBinContent(0, 0.15); break; // PRC88,044910
2775  case 2212: h1->SetBinContent(0, 0.05); break; // PRC88,044910
2776  case 310: h1->SetBinContent(0, 0.075); break; // PRL111,222301
2777  case 3122: h1->SetBinContent(0, 0.018); break; // PRL111,222301
2778  case 3212: h1->SetBinContent(0, 0.0055); break; // NPA904,539
2779  case 3322: h1->SetBinContent(0, 0.005); break; // PLB734,409
2780  case 211: h1->SetBinContent(0, 1); break; // it self
2781  default: h1->SetBinContent(0, -1); break; // Unknown
2782  }
2783  pdgOut->Add(h1);
2784 
2785  if (pdg == 211) pion = h1;
2786  }
2787  if (pdgs->GetHists()) {
2788  TIter next(pdgs->GetHists());
2789  TH1* tmp = 0;
2790  Double_t rmin = +1e9;
2791  Double_t rmax = -1e9;
2792  while ((tmp = static_cast<TH1*>(next()))) {
2793  if (tmp == all) continue;
2794  // Calculate ratio to all
2795  TH1* rat = static_cast<TH1*>(tmp->Clone());
2796  rat->Divide(all);
2797  rat->SetDirectory(0);
2798  rat->SetTitle(Form("%s / all", tmp->GetTitle()));
2799  toAll->Add(rat);
2800 
2801  if (tmp == pion) continue;
2802  Double_t r276 = tmp->GetBinContent(0);
2803  if (r276 < 0 || r276 >= 1) continue;
2804 
2805  // Calulate ratio to pions
2806  rat = static_cast<TH1*>(tmp->Clone());
2807  rat->Divide(pion);
2808  rat->SetTitle(Form("%s / %s", tmp->GetTitle(), pion->GetTitle()));
2809  rat->SetDirectory(0);
2810 
2811  TGraphErrors* g = new TGraphErrors(1);
2812  g->SetName(Form("%s_2760", rat->GetName()));
2813  g->SetTitle(Form("%s in #sqrt{s_{NN}}=2.76TeV", rat->GetTitle()));
2814  g->SetPoint(0,0,r276);
2815  g->SetPointError(0,.5,0);
2816  g->SetLineColor(rat->GetLineColor());
2817  g->SetLineStyle(rat->GetLineStyle());
2818  g->SetMarkerColor(rat->GetMarkerColor());
2819  g->SetMarkerStyle(rat->GetMarkerStyle());
2820  g->SetMarkerSize(1.5*rat->GetMarkerSize());
2821  rat->GetListOfFunctions()->Add(g,"p");
2822  rat->SetMaximum(TMath::Max(rat->GetMaximum(),r276));
2823  rat->SetMinimum(TMath::Min(rat->GetMinimum(),r276));
2824  rmin = TMath::Min(rat->GetMinimum(),rmin);
2825  rmax = TMath::Max(rat->GetMaximum(),rmax);
2826 
2827  toPion->Add(rat);
2828  }
2829  // toPion->SetMinimum(rmin);
2830  toPion->SetMaximum(1.1*rmax);
2831  }
2832  }
2833 
2834  // Scale distribution of Pt to number of events and bin width
2835  if (fEtaPt) {
2836  TH2* etaPt = static_cast<TH2*>(fEtaPt->Clone());
2837  etaPt->SetDirectory(0);
2838  etaPt->Scale(1. / nEvents, "width");
2839  result->Add(etaPt);
2840 
2841  }
2842 
2843  // Short-hand-name
2844  TString shn(etaIPz ? etaIPz->GetTitle() : "X");
2845 
2846  // If we have the PDG distributions, we project on eta,IPz, and then
2847  // average over IPz to get dNpdg/deta.
2848  if (fEtaPdgIPz) {
2849  // Scale each vertex range by number of events in that range
2850  TH3* etaPdgIPz = ScaleToIPz(fEtaPdgIPz, ipz, false);
2851  result->Add(etaPdgIPz);
2852 
2853  // Loop over PDG types and create 2D and 1D distributions
2854  TAxis* yaxis = etaPdgIPz->GetYaxis();
2855  Int_t first = yaxis->GetFirst();
2856  Int_t last = yaxis->GetLast();
2857  THStack* pdgs = new THStack("all","");
2858  THStack* ratios = new THStack("toPion", "");
2859  TH1* pion = 0;
2860  Container* pdgOut = new Container();
2861  pdgOut->SetName("types");
2862  result->Add(pdgOut);
2863  pdgOut->Add(pdgs);
2864  pdgOut->Add(ratios);
2865  for (Int_t i = 1; i <= etaPdgIPz->GetNbinsY(); i++) {
2866  yaxis->SetRange(i,i);
2867 
2868  Int_t pdg = TString(yaxis->GetBinLabel(i)).Atoi();
2869  TString nme;
2870  Style_t sty;
2871  Color_t col;
2872  PdgAttr(pdg, nme, col, sty);
2873  if (pdg < 0) pdg = 0;
2874 
2875  TH2* h2 = static_cast<TH2*>(etaPdgIPz->Project3D("zx e"));
2876  if (h2->GetEntries() <= 0) continue; // Do not store if empty
2877  h2->SetDirectory(0);
2878  h2->SetName(Form("etaIPz_%d", pdg));
2879  h2->SetTitle(Form("%s#rightarrowX_{%s}", nme.Data(), shn.Data()));
2880  h2->SetYTitle(Form("d#it{N}^{2}_{%s#rightarrow%s}/"
2881  "(d#etadIP_{#it{z}})",
2882  nme.Data(), shn.Data()));
2883  h2->SetFillColor(col);
2884  h2->SetMarkerColor(col);
2885  h2->SetLineColor(col);
2886  pdgOut->Add(h2);
2887 
2888  TH1* h1 = AverageOverIPz(h2, Form("eta_%d",pdg), 1, ipz, 0, false);
2889  h1->SetDirectory(0);
2890  h1->SetYTitle(Form("d#it{N}_{%s#rightarrow%s}/d#eta",
2891  nme.Data(), shn.Data()));
2892  h1->SetMarkerStyle(sty);
2893  pdgs->Add(h1);
2894 
2895  if (pdg == 211) pion = h1;
2896  }
2897  if (pdgs->GetHists()) {
2898  TIter next(pdgs->GetHists());
2899  TH1* tmp = 0;
2900  while ((tmp = static_cast<TH1*>(next()))) {
2901  if (tmp == pion) continue;
2902  TH1* rat = static_cast<TH1*>(tmp->Clone());
2903  rat->Divide(pion);
2904  rat->SetDirectory(0);
2905  ratios->Add(rat);
2906  }
2907  }
2908 
2909  yaxis->SetRange(first, last);
2910  }
2911  // If we do not have eta vs Delta, just return
2912  if (!fEtaDeltaIPz) return true;
2913 
2914  // Normalize delta distribution to integral number of events
2915  // static_cast<TH3*>(CloneAndAdd(result, fEtaDeltaIPz));
2916  TH3* etaDeltaIPz = ScaleToIPz(fEtaDeltaIPz, ipz, false);
2917  // ipz->GetEntries()>1000);
2918  result->Add(etaDeltaIPz);
2919 
2920  // Make 2D projection to eta,Delta
2921  TH2* etaDelta = ProjectEtaDelta(etaDeltaIPz);
2922  result->Add(etaDelta);
2923 
2924  // Make projection of delta
2925  TH1* delta = ProjectDelta(etaDelta);
2926  result->Add(delta);
2927 
2928  // PArameters of integrals
2929  Double_t maxDelta = etaDeltaIPz->GetYaxis()->GetXmax();
2930  Int_t lowBin = etaDeltaIPz->GetYaxis()->FindBin(tailDelta);
2931  Int_t sigBin = etaDeltaIPz->GetYaxis()->FindBin(1.5);
2932  Int_t highBin = TMath::Min(etaDeltaIPz->GetYaxis()->FindBin(tailMax),
2933  etaDeltaIPz->GetYaxis()->GetNbins());
2934 
2935 
2936  TH1* etaDeltaTail = etaDelta->ProjectionX("etaDeltaTail");
2937  etaDeltaTail ->SetDirectory(0);
2938  etaDeltaTail ->Reset();
2939  etaDeltaTail ->SetTitle(Form("#scale[.7]{#int}_{%3.1f}^{%4.1f}"
2940  "d%s d#it{N}/d%s",
2941  tailDelta,maxDelta,
2942  etaDeltaIPz->GetTitle(),
2943  etaDeltaIPz->GetTitle()));
2944  etaDeltaTail ->SetYTitle("#scale[.7]{#int}_{tail}d#Delta d#it{N}/d#Delta");
2945 
2946  TH2* etaIPzDeltaTail = static_cast<TH2*>(etaDeltaIPz->Project3D("zx e"));
2947  etaIPzDeltaTail->SetName("etaIPzDeltaTail");
2948  etaIPzDeltaTail->SetDirectory(0);
2949  etaIPzDeltaTail->Reset();
2950  etaIPzDeltaTail->SetTitle(etaDeltaTail->GetTitle());
2951  etaIPzDeltaTail->SetZTitle(etaDelta->GetYaxis()->GetTitle());
2952  TH2* etaIPzDeltaMain = static_cast<TH2*>(etaDeltaIPz->Project3D("zx e"));
2953  etaIPzDeltaMain->SetName("etaIPzDeltaMain");
2954  etaIPzDeltaMain->SetDirectory(0);
2955  etaIPzDeltaMain->Reset();
2956  etaIPzDeltaMain->SetTitle(etaDeltaTail->GetTitle());
2957  etaIPzDeltaMain->SetZTitle(etaDelta->GetYaxis()->GetTitle());
2958  // Loop over eta
2959  Double_t intg = 0, eintg = 0;
2960  for (Int_t i = 1; i <= etaDeltaTail->GetNbinsX(); i++) {
2961  // Integrate over Delta
2962  intg = etaDelta->IntegralAndError(i, i, lowBin, highBin, eintg);
2963  etaDeltaTail->SetBinContent(i, intg);
2964  etaDeltaTail->SetBinError (i, eintg);
2965  // Loop over IPz
2966  for (Int_t j = 1; j <= etaIPzDeltaTail->GetNbinsY(); j++) {
2967  // Integrate over Delta
2968  intg = etaDeltaIPz->IntegralAndError(i,i,lowBin,highBin,j,j,eintg);
2969  etaIPzDeltaTail->SetBinContent(i, j, intg);
2970  etaIPzDeltaTail->SetBinError (i, j, eintg);
2971 
2972  intg = etaDeltaIPz->IntegralAndError(i,i,1,sigBin,j,j,eintg);
2973  etaIPzDeltaMain->SetBinContent(i, j, intg);
2974  etaIPzDeltaMain->SetBinError (i, j, eintg);
2975  }
2976  }
2977  result->Add(etaIPzDeltaTail);
2978  result->Add(etaIPzDeltaMain);
2979  result->Add(etaDeltaTail);
2980 
2981  // Integrate full tail
2982  intg = etaDeltaIPz->IntegralAndError(1,etaDeltaIPz->GetNbinsX(),
2983  lowBin, highBin,
2984  1,etaDeltaIPz->GetNbinsZ(),
2985  eintg);
2986  result->Add(new TParameter<double>("deltaTail", intg));
2987  result->Add(new TParameter<double>("deltaTailError", eintg));
2988 
2989  // Some consistency checks:
2990  if (fDebug > 1) {
2991  Printf("%10s: Integral over eta,IPz: %9.4f +/- %9.4f",
2992  GetName(), intg, eintg);
2993  intg = etaDelta->IntegralAndError(1,etaDeltaIPz->GetNbinsX(),
2994  lowBin, highBin,
2995  eintg);
2996  Printf("%10s: Integral over eta: %9.4f +/- %9.4f",
2997  GetName(), intg, eintg);
2998  intg = delta->IntegralAndError(lowBin, highBin, eintg);
2999  Printf("%10s: Integral: %9.4f +/- %9.4f",
3000  GetName(), intg, eintg);
3001  }
3002 
3003  return true;
3004 }
3005 
3006 //____________________________________________________________________
3008  Container* measCont,
3009  Container* genCont,
3010  Histos* h,
3011  Double_t tailCut,
3012  Double_t tailMax)
3013 {
3014  if (!h || !measCont) {
3015  AliWarningF("No sub-histos or measured container in %s", GetName());
3016  return false;
3017  }
3018 
3019  if (!h->MasterFinalize(result, fIPz, tailCut,tailMax)) {
3020  AliWarningF("Failed to finalize %s/%s", GetName(), h->GetName());
3021  return false;
3022  }
3023 
3024  Container* bgCont = GetC(result, h->GetName());
3025  if (!bgCont) {
3026  AliWarningF("%s/%s didn't put a container on output",
3027  GetName(), h->GetName());
3028  return false;
3029  }
3030  const char* sub = h->GetName();
3031  TString shrt(Form("%c", sub[0]));
3032  shrt.ToUpper();
3033  if (genCont) shrt.Append("'");
3034 
3035  TH2* background = 0;
3036  TH2* etaIPzScale = 0;
3037  if (h->GetMask() == AliAODTracklet::kInjection) {
3038  // Get the tail ratio per eta, ipZ
3039  // We get the integral of the measured eta,IPz,Delta dist
3040  // We get the integral of the injected eta,IPz,Delta dist
3041  // Then we take the ratio
3042  etaIPzScale = CopyH2(measCont, "etaIPzDeltaTail",
3043  "etaIPzScale");
3044  etaIPzScale->Divide(GetH2(bgCont, "etaIPzDeltaTail"));
3045  etaIPzScale->SetZTitle("k_{#eta,IP_{#it{z}}}");
3046  etaIPzScale->SetTitle(Form("k_{%s,#eta,IP_{#it{z}}}",shrt.Data()));
3047  bgCont->Add(etaIPzScale);
3048 
3049  // Get the tail ratio per eta
3050  // We get the integral of the measured eta,Delta dist
3051  // We get the integral of the injected eta,Detla dist
3052  // Then we take the ratio
3053  TH1* etaScale = CopyH1(measCont, "etaDeltaTail",
3054  "etaScale");
3055  etaScale->Divide(GetH1(bgCont, "etaDeltaTail"));
3056  etaScale->SetYTitle("k_{#eta}");
3057  etaScale->SetTitle(Form("k_{%s,#eta}", shrt.Data()));
3058  bgCont->Add(etaScale);
3059 
3060  // Get the integrated tail ratio.
3061  // We get the integrated tail of the measured delta dist
3062  // We get the integrated tail of the ianjection delta dist
3063  // We then get the ratio.
3064  Double_t measIntg = GetD(measCont, "deltaTail", -1);
3065  Double_t measIntE = GetD(measCont, "deltaTailError", -1);
3066  Double_t bgIntg = GetD(bgCont, "deltaTail", -1);
3067  Double_t bgIntE = GetD(bgCont, "deltaTailError", -1);
3068  Double_t scaleE = 0;
3069  Double_t scale = RatioE(measIntg, measIntE, bgIntg, bgIntE, scaleE);
3070  bgCont->Add(new TParameter<double>("scale", scale));
3071  bgCont->Add(new TParameter<double>("scaleError", scaleE));
3072 
3073  // Get the fully differential Delta distribution and scale by the
3074  // eta,IPz scalar.
3075  TH3* scaledEtaDeltaIPz = ScaleDelta(CopyH3(bgCont, "etaDeltaIPz",
3076  "scaleEtaDeltaIPz"),
3077  etaIPzScale);
3078  scaledEtaDeltaIPz->SetTitle(Form("%5.3f#times%s",
3079  scale, scaledEtaDeltaIPz->GetTitle()));
3080  scaledEtaDeltaIPz->SetDirectory(0);
3081  scaledEtaDeltaIPz->SetYTitle("k#timesd^{3}#it{N}/"
3082  "(d#Deltad#etadIP_{#it{z}})");
3083  bgCont->Add(scaledEtaDeltaIPz);
3084 #if 0
3085  // scale by derived scalars, rather than by taking the scaled full
3086  // distribution.
3087  TH2* scaledEtaDelta = CopyH2(bgCont, "etaDelta", "scaledEtaDelta");
3088  scaledEtaDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3089  scaledEtaDelta->SetZTitle("k#timesd^{2}#it{N}/(d#Deltad#eta)");
3090  Scale(scaledEtaDelta, etaScale);
3091  bgCont->Add(scaledEtaDelta);
3092 
3093  TH1* scaledDelta = CopyH1(bgCont, "delta", "scaledDelta");
3094  scaledDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3095  scaledDelta->SetYTitle("k#timesd#it{N}/d#Delta");
3096  Scale(scaledDelta,scale,scaleE);
3097  bgCont->Add(scaledDelta);
3098 #else
3099  // Make 2D projection to eta,Delta
3100  TH2* scaledEtaDelta = ProjectEtaDelta(scaledEtaDeltaIPz);
3101  scaledEtaDelta->SetName("scaledEtaDelta");
3102  scaledEtaDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3103  scaledEtaDelta->SetYTitle("k#timesd^{2}#it{N}/(d#Deltad#eta)");
3104  bgCont->Add(scaledEtaDelta);
3105 
3106  // Make projection of delta
3107  TH1* scaledDelta = ProjectDelta(scaledEtaDelta);
3108  scaledDelta->SetName("scaledDelta");
3109  scaledDelta->SetTitle(scaledEtaDeltaIPz->GetTitle());
3110  scaledDelta->SetYTitle("k#timesd#it{N}/d#Delta");
3111  bgCont->Add(scaledDelta);
3112 #endif
3113  // Make background scaled by full tail
3114  background = CopyH2(bgCont, "etaIPz", "background");
3115  if (!background) AliWarningF("Didn't get background in %s", sub);
3116  else background->Multiply(etaIPzScale);
3117  // else Scale(background, scale, scaleE);
3118  }
3119  else {
3120  // For non-injection sets (i.e., combinatorics) we cannot form the
3121  // scaled background until we have the real data, so we calculate
3122  // beta instead.
3123  background = CopyH2(bgCont, "etaIPz", "background");
3124  TH2* beta = CopyH2(bgCont, "etaIPz", "beta");
3125  if (!background || !beta)
3126  AliWarningF("Didn't get background or beta in %s", sub);
3127  else {
3128  beta->Divide(GetH1(measCont, "etaIPz"));
3129  beta->SetTitle(Form("#beta_{%s}", shrt.Data()));
3130  bgCont->Add(beta);
3131  }
3132  }
3133  if (!background) {
3134  AliWarningF("Didn't get background in %s", sub);
3135  return false;
3136  }
3137  background->SetTitle(Form("#it{B}_{%s}", shrt.Data()));
3138  bgCont->Add(background);
3139 
3140  TH2* signal = CopyH2(measCont, "etaIPz", "signal");
3141  if (!signal) {
3142  AliWarningF("Didn't get signal in %s", sub);
3143  return false;
3144  }
3145  else {
3146  signal->SetTitle(Form("#it{S}_{%s}", shrt.Data()));
3147  signal->Add(background,-1);
3148  // Zero small bins
3149  for (Int_t i = 1; i <= signal->GetNbinsX(); i++) {
3150  for (Int_t j = 1; j <= signal->GetNbinsX(); j++) {
3151  if (signal->GetBinContent(i,j)<1e-6) {
3152  signal->SetBinContent(i,j,0);
3153  signal->SetBinError (i,j,0);
3154  }
3155  }
3156  }
3157  CopyAttr(background, signal);
3158  bgCont->Add(signal);
3159  }
3160 
3161  TH1* alpha = 0;
3162  if (genCont) {
3163  alpha = CopyH2(genCont, "etaIPz", "alpha");
3164  if (alpha && signal) {
3165  alpha->Divide(signal);
3166  alpha->SetTitle(Form("#alpha_{%s}", shrt.Data()));
3167  CopyAttr(signal, alpha);
3168  bgCont->Add(alpha);
3169  }
3170  }
3171 
3172  return true;
3173 }
3174 
3175 //====================================================================
3178  const char* weights,
3179  const char* sumFile,
3180  const char* resFile)
3181 {
3182  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
3183  if (!mgr) {
3184  ::Error("Create","No analysis manager to connect to.");
3185  return 0;
3186  }
3187  AliTrackletAODdNdeta* ret = 0;
3188  if (mc) {
3189  if (weights && weights[0] != '\0') {
3191  new AliTrackletAODWeightedMCdNdeta("MidRapidityMC");
3192  TUrl wurl(weights);
3193  TFile* wfile = TFile::Open(wurl.GetFile());
3194  if (!wfile) {
3195  ::Warning("Create", "Failed to open weights file: %s",
3196  wurl.GetUrl());
3197  return 0;
3198  }
3199  TString wnam(wurl.GetAnchor());
3200  if (wnam.IsNull()) wnam = "weights";
3201  TObject* wobj = wfile->Get(wnam);
3202  if (!wobj) {
3203  ::Warning("Create", "Failed to get weights %s from file %s",
3204  wnam.Data(), wfile->GetName());
3205  return 0;
3206  }
3207  if (!wobj->IsA()->InheritsFrom(AliTrackletBaseWeights::Class())) {
3208  ::Warning("Create", "Object %s from file %s not an "
3209  "AliTrackletBaseWeights but a %s",
3210  wnam.Data(), wfile->GetName(), wobj->ClassName());
3211  return 0;
3212  }
3213  wret->SetWeights(static_cast<AliTrackletBaseWeights*>(wobj));
3214  ret = wret;
3215  }
3216  else
3217  ret = new AliTrackletAODMCdNdeta("MidRapidityMC");
3218  }
3219  else ret = new AliTrackletAODdNdeta("MidRapidity");
3220  if (ret) ret->Connect();
3221 
3222  return ret;
3223 
3224 }
3225 
3226 
3227 
3228 
3229 //____________________________________________________________________
virtual Bool_t ProcessTracklet(AliAODTracklet *tracklet, Double_t ipz, UShort_t signal, Double_t weight)=0
Int_t color[]
static TProfile * GetP1(Container *parent, const char *name, Bool_t verb=true)
virtual void SetWeights(AliTrackletBaseWeights *w)
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)
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)
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)
virtual Double_t LookupWeight(AliAODTracklet *tracklet, Double_t cent, Double_t ipz)
void SetCalc(UChar_t mode=kProduct)
Double_t FindCompatCentrality(AliVEvent *event)
virtual void SetWeightInverse(Bool_t inv)
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)
static const char * CentName(Double_t c1, Double_t c2)
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)
void SetInverse(Bool_t inv)
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
static TH2 * ProjectEtaDelta(TH3 *h)
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
void SetMask(UChar_t mask)
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 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 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)
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)
virtual void Print(Option_t *option="") const
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
void SetVeto(UChar_t veto)
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 Double_t LookupWeight(AliAODTracklet *tracklet, Double_t cent, Double_t ipz)
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)
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)
AliTrackletBaseWeights * fWeights
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 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)
void SetWeights(AliTrackletBaseWeights *w)
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)