ROOT logo
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// AliFemtoCutMonitorEventVertex - the cut monitor for events to study        //
// the distribution and error of the primary vertex                           //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
#include "AliFemtoCutMonitorEventVertex.h"
#include "AliFemtoModelHiddenInfo.h"
#include "AliFemtoEvent.h"
#include <TH1D.h>
#include <TH2D.h>
#include <TList.h>
#include <TMath.h>

AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex():
  AliFemtoCutMonitor(),
  fEvVertRad(0),
  fEvVertXY(0),
  fEvVertSigXY(0),
  fEvVertZ(0),
  fEvVertSigZ(0)
{
  // Default constructor
  fEvVertRad   = new TH1D("EvVertRad",   "Vertex position radial", 200, 0.0, 0.2);
  fEvVertXY    = new TH2D("EvVertXY",    "Vertex position xy plane", 200, -0.2, 0.2, 200, -0.2, 0.2);
  fEvVertSigXY = new TH1D("EvVertSigXY", "Vertex error in xy plane", 200, 0.0, 0.2);
  fEvVertZ     = new TH1D("EvVertZ",     "Vertex position in z", 500, -50.0, 50.0);
  fEvVertSigZ  = new TH1D("EvVertSigZ",  "Vertex error in z", 100, 0.0, 0.2);
}

AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex(const char *aName):
  AliFemtoCutMonitor(),
  fEvVertRad(0),
  fEvVertXY(0),
  fEvVertSigXY(0),
  fEvVertZ(0),
  fEvVertSigZ(0)
{
  // Normal constructor
  char name[200];
  snprintf(name, 200, "EvVertRad%s", aName);
  fEvVertRad   = new TH1D(name,   "Vertex position radial", 200, 0.0, 0.2);
  snprintf(name, 200, "EvVertXY%s", aName);
  fEvVertXY    = new TH2D(name,    "Vertex position xy plane", 200, -0.2, 0.2, 200, -0.2, 0.2);
  snprintf(name, 200, "EvVertSigXY%s", aName);
  fEvVertSigXY = new TH1D(name, "Vertex error in xy plane", 200, 0.0, 0.2);
  snprintf(name, 200, "EvVertZ%s", aName);
  fEvVertZ     = new TH1D(name,     "Vertex position in z", 500, -50.0, 50.0);
  snprintf(name, 200, "EvVertSigZ%s", aName);
  fEvVertSigZ  = new TH1D(name,  "Vertex error in z", 100, 0.0, 0.2);
}

AliFemtoCutMonitorEventVertex::AliFemtoCutMonitorEventVertex(const AliFemtoCutMonitorEventVertex &aCut):
  AliFemtoCutMonitor(),
  fEvVertRad(0),
  fEvVertXY(0),
  fEvVertSigXY(0),
  fEvVertZ(0),
  fEvVertSigZ(0)
{
  // copy constructor
  if (fEvVertRad) delete fEvVertRad;
  fEvVertRad = new TH1D(*aCut.fEvVertRad);
  if (fEvVertXY) delete fEvVertXY;
  fEvVertXY = new TH2D(*aCut.fEvVertXY);
  if (fEvVertSigXY) delete fEvVertSigXY;
  fEvVertSigXY = new TH1D(*aCut.fEvVertSigXY);
  if (fEvVertZ) delete fEvVertZ;
  fEvVertZ = new TH1D(*aCut.fEvVertZ);
  if (fEvVertSigZ) delete fEvVertSigZ;
  fEvVertSigZ = new TH1D(*aCut.fEvVertSigZ);
}

AliFemtoCutMonitorEventVertex::~AliFemtoCutMonitorEventVertex()
{
  // Destructor
  delete fEvVertRad;
  delete fEvVertXY;
  delete fEvVertSigXY;
  delete fEvVertZ;
  delete fEvVertSigZ;
}

AliFemtoCutMonitorEventVertex& AliFemtoCutMonitorEventVertex::operator=(const AliFemtoCutMonitorEventVertex& aCut)
{
  // assignment operator
  if (this == &aCut) 
    return *this;

  if (fEvVertRad) delete fEvVertRad;
  fEvVertRad = new TH1D(*aCut.fEvVertRad);
  if (fEvVertXY) delete fEvVertXY;
  fEvVertXY = new TH2D(*aCut.fEvVertXY);
  if (fEvVertSigXY) delete fEvVertSigXY;
  fEvVertSigXY = new TH1D(*aCut.fEvVertSigXY);
  if (fEvVertZ) delete fEvVertZ;
  fEvVertZ = new TH1D(*aCut.fEvVertZ);
  if (fEvVertSigZ) delete fEvVertSigZ;
  fEvVertSigZ = new TH1D(*aCut.fEvVertSigZ);
  
  return *this;
}

AliFemtoString AliFemtoCutMonitorEventVertex::Report(){ 
  // Prepare report from the execution
  string stemp = "*** AliFemtoCutMonitorEventVertex report"; 
  AliFemtoString returnThis = stemp;
  return returnThis; 
}

void AliFemtoCutMonitorEventVertex::Fill(const AliFemtoEvent* aEvent)
{
  // Fill in the monitor histograms with the values from the current track
  fEvVertRad->Fill(TMath::Hypot(aEvent->PrimVertPos().x(), aEvent->PrimVertPos().y()));
  fEvVertXY->Fill(aEvent->PrimVertPos().x(), aEvent->PrimVertPos().y());
  fEvVertSigXY->Fill(TMath::Sqrt(aEvent->PrimVertCov()[0]+aEvent->PrimVertCov()[2]));
  fEvVertZ->Fill(aEvent->PrimVertPos().z());
  fEvVertSigZ->Fill(TMath::Sqrt(aEvent->PrimVertCov()[5]));
}

void AliFemtoCutMonitorEventVertex::Write()
{
  // Write out the relevant histograms
  fEvVertRad->Write();
  fEvVertXY->Write();
  fEvVertSigXY->Write();
  fEvVertZ->Write();
  fEvVertSigZ->Write();
}

TList *AliFemtoCutMonitorEventVertex::GetOutputList()
{
  TList *tOutputList = new TList();
  tOutputList->Add(fEvVertRad);
  tOutputList->Add(fEvVertXY);
  tOutputList->Add(fEvVertSigXY);
  tOutputList->Add(fEvVertZ);
  tOutputList->Add(fEvVertSigZ);

  return tOutputList;
}
 AliFemtoCutMonitorEventVertex.cxx:1
 AliFemtoCutMonitorEventVertex.cxx:2
 AliFemtoCutMonitorEventVertex.cxx:3
 AliFemtoCutMonitorEventVertex.cxx:4
 AliFemtoCutMonitorEventVertex.cxx:5
 AliFemtoCutMonitorEventVertex.cxx:6
 AliFemtoCutMonitorEventVertex.cxx:7
 AliFemtoCutMonitorEventVertex.cxx:8
 AliFemtoCutMonitorEventVertex.cxx:9
 AliFemtoCutMonitorEventVertex.cxx:10
 AliFemtoCutMonitorEventVertex.cxx:11
 AliFemtoCutMonitorEventVertex.cxx:12
 AliFemtoCutMonitorEventVertex.cxx:13
 AliFemtoCutMonitorEventVertex.cxx:14
 AliFemtoCutMonitorEventVertex.cxx:15
 AliFemtoCutMonitorEventVertex.cxx:16
 AliFemtoCutMonitorEventVertex.cxx:17
 AliFemtoCutMonitorEventVertex.cxx:18
 AliFemtoCutMonitorEventVertex.cxx:19
 AliFemtoCutMonitorEventVertex.cxx:20
 AliFemtoCutMonitorEventVertex.cxx:21
 AliFemtoCutMonitorEventVertex.cxx:22
 AliFemtoCutMonitorEventVertex.cxx:23
 AliFemtoCutMonitorEventVertex.cxx:24
 AliFemtoCutMonitorEventVertex.cxx:25
 AliFemtoCutMonitorEventVertex.cxx:26
 AliFemtoCutMonitorEventVertex.cxx:27
 AliFemtoCutMonitorEventVertex.cxx:28
 AliFemtoCutMonitorEventVertex.cxx:29
 AliFemtoCutMonitorEventVertex.cxx:30
 AliFemtoCutMonitorEventVertex.cxx:31
 AliFemtoCutMonitorEventVertex.cxx:32
 AliFemtoCutMonitorEventVertex.cxx:33
 AliFemtoCutMonitorEventVertex.cxx:34
 AliFemtoCutMonitorEventVertex.cxx:35
 AliFemtoCutMonitorEventVertex.cxx:36
 AliFemtoCutMonitorEventVertex.cxx:37
 AliFemtoCutMonitorEventVertex.cxx:38
 AliFemtoCutMonitorEventVertex.cxx:39
 AliFemtoCutMonitorEventVertex.cxx:40
 AliFemtoCutMonitorEventVertex.cxx:41
 AliFemtoCutMonitorEventVertex.cxx:42
 AliFemtoCutMonitorEventVertex.cxx:43
 AliFemtoCutMonitorEventVertex.cxx:44
 AliFemtoCutMonitorEventVertex.cxx:45
 AliFemtoCutMonitorEventVertex.cxx:46
 AliFemtoCutMonitorEventVertex.cxx:47
 AliFemtoCutMonitorEventVertex.cxx:48
 AliFemtoCutMonitorEventVertex.cxx:49
 AliFemtoCutMonitorEventVertex.cxx:50
 AliFemtoCutMonitorEventVertex.cxx:51
 AliFemtoCutMonitorEventVertex.cxx:52
 AliFemtoCutMonitorEventVertex.cxx:53
 AliFemtoCutMonitorEventVertex.cxx:54
 AliFemtoCutMonitorEventVertex.cxx:55
 AliFemtoCutMonitorEventVertex.cxx:56
 AliFemtoCutMonitorEventVertex.cxx:57
 AliFemtoCutMonitorEventVertex.cxx:58
 AliFemtoCutMonitorEventVertex.cxx:59
 AliFemtoCutMonitorEventVertex.cxx:60
 AliFemtoCutMonitorEventVertex.cxx:61
 AliFemtoCutMonitorEventVertex.cxx:62
 AliFemtoCutMonitorEventVertex.cxx:63
 AliFemtoCutMonitorEventVertex.cxx:64
 AliFemtoCutMonitorEventVertex.cxx:65
 AliFemtoCutMonitorEventVertex.cxx:66
 AliFemtoCutMonitorEventVertex.cxx:67
 AliFemtoCutMonitorEventVertex.cxx:68
 AliFemtoCutMonitorEventVertex.cxx:69
 AliFemtoCutMonitorEventVertex.cxx:70
 AliFemtoCutMonitorEventVertex.cxx:71
 AliFemtoCutMonitorEventVertex.cxx:72
 AliFemtoCutMonitorEventVertex.cxx:73
 AliFemtoCutMonitorEventVertex.cxx:74
 AliFemtoCutMonitorEventVertex.cxx:75
 AliFemtoCutMonitorEventVertex.cxx:76
 AliFemtoCutMonitorEventVertex.cxx:77
 AliFemtoCutMonitorEventVertex.cxx:78
 AliFemtoCutMonitorEventVertex.cxx:79
 AliFemtoCutMonitorEventVertex.cxx:80
 AliFemtoCutMonitorEventVertex.cxx:81
 AliFemtoCutMonitorEventVertex.cxx:82
 AliFemtoCutMonitorEventVertex.cxx:83
 AliFemtoCutMonitorEventVertex.cxx:84
 AliFemtoCutMonitorEventVertex.cxx:85
 AliFemtoCutMonitorEventVertex.cxx:86
 AliFemtoCutMonitorEventVertex.cxx:87
 AliFemtoCutMonitorEventVertex.cxx:88
 AliFemtoCutMonitorEventVertex.cxx:89
 AliFemtoCutMonitorEventVertex.cxx:90
 AliFemtoCutMonitorEventVertex.cxx:91
 AliFemtoCutMonitorEventVertex.cxx:92
 AliFemtoCutMonitorEventVertex.cxx:93
 AliFemtoCutMonitorEventVertex.cxx:94
 AliFemtoCutMonitorEventVertex.cxx:95
 AliFemtoCutMonitorEventVertex.cxx:96
 AliFemtoCutMonitorEventVertex.cxx:97
 AliFemtoCutMonitorEventVertex.cxx:98
 AliFemtoCutMonitorEventVertex.cxx:99
 AliFemtoCutMonitorEventVertex.cxx:100
 AliFemtoCutMonitorEventVertex.cxx:101
 AliFemtoCutMonitorEventVertex.cxx:102
 AliFemtoCutMonitorEventVertex.cxx:103
 AliFemtoCutMonitorEventVertex.cxx:104
 AliFemtoCutMonitorEventVertex.cxx:105
 AliFemtoCutMonitorEventVertex.cxx:106
 AliFemtoCutMonitorEventVertex.cxx:107
 AliFemtoCutMonitorEventVertex.cxx:108
 AliFemtoCutMonitorEventVertex.cxx:109
 AliFemtoCutMonitorEventVertex.cxx:110
 AliFemtoCutMonitorEventVertex.cxx:111
 AliFemtoCutMonitorEventVertex.cxx:112
 AliFemtoCutMonitorEventVertex.cxx:113
 AliFemtoCutMonitorEventVertex.cxx:114
 AliFemtoCutMonitorEventVertex.cxx:115
 AliFemtoCutMonitorEventVertex.cxx:116
 AliFemtoCutMonitorEventVertex.cxx:117
 AliFemtoCutMonitorEventVertex.cxx:118
 AliFemtoCutMonitorEventVertex.cxx:119
 AliFemtoCutMonitorEventVertex.cxx:120
 AliFemtoCutMonitorEventVertex.cxx:121
 AliFemtoCutMonitorEventVertex.cxx:122
 AliFemtoCutMonitorEventVertex.cxx:123
 AliFemtoCutMonitorEventVertex.cxx:124
 AliFemtoCutMonitorEventVertex.cxx:125
 AliFemtoCutMonitorEventVertex.cxx:126
 AliFemtoCutMonitorEventVertex.cxx:127
 AliFemtoCutMonitorEventVertex.cxx:128
 AliFemtoCutMonitorEventVertex.cxx:129
 AliFemtoCutMonitorEventVertex.cxx:130
 AliFemtoCutMonitorEventVertex.cxx:131
 AliFemtoCutMonitorEventVertex.cxx:132
 AliFemtoCutMonitorEventVertex.cxx:133
 AliFemtoCutMonitorEventVertex.cxx:134
 AliFemtoCutMonitorEventVertex.cxx:135
 AliFemtoCutMonitorEventVertex.cxx:136
 AliFemtoCutMonitorEventVertex.cxx:137
 AliFemtoCutMonitorEventVertex.cxx:138
 AliFemtoCutMonitorEventVertex.cxx:139
 AliFemtoCutMonitorEventVertex.cxx:140
 AliFemtoCutMonitorEventVertex.cxx:141