ROOT logo
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// AliFemtoCutMonitorParticleMomRes - the cut monitor for particles to study    //
// the difference between reconstructed and true momentum                     //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
#include "AliFemtoCutMonitorParticleMomRes.h"
#include <TH1D.h>
#include <TH2D.h>
#include <TH3D.h>
#include <TList.h>
#include "AliFemtoModelHiddenInfo.h"

AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes():
  fMomRes3D(0),
  fMomResXvsP(0),
  fMomResYvsP(0),
  fMomResZvsP(0),
  fImpactXY(0),
  fImpactZ(0),
  fSigma(0)
{
  // Default constructor
  fMomRes3D = new TH3D("MomRes3D", "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
  fMomResXvsP = new TH2D("MomResXvsP", "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  fMomResYvsP = new TH2D("MomResYvsP", "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  fMomResZvsP = new TH2D("MomResZvsP", "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  fImpactXY   = new TH2D("ImpactXY", "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
  fImpactZ    = new TH2D("ImpactZ",  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
  fSigma      = new TH2D("Sigma",     "Sigma to vertex vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
}

AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const char *aName):
  fMomRes3D(0),
  fMomResXvsP(0),
  fMomResYvsP(0),
  fMomResZvsP(0),
  fImpactXY(0),
  fImpactZ(0),
  fSigma(0)
{
  // Normal constructor
  char name[200];
  snprintf(name, 200, "MomRes3D%s", aName);
  fMomRes3D = new TH3D(name, "Momentum resolution", 100, -0.05, 0.05, 100, -0.05, 0.05, 100, -0.05, 0.05);
  snprintf(name, 200, "MomResXvsP%s", aName);
  fMomResXvsP = new TH2D(name, "X momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  snprintf(name, 200, "MomResYvsP%s", aName);
  fMomResYvsP = new TH2D(name, "Y momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  snprintf(name, 200, "MomResZvsP%s", aName);
  fMomResZvsP = new TH2D(name, "Z momentum resolution vs P", 100, 0.1, 2.0, 100, -0.05, 0.05);
  snprintf(name, 200, "ImpactXY%s", aName);
  fImpactXY   = new TH2D(name, "XY impact parameter vs P", 100, 0.1, 2.0, 200, -1.0, 1.0);
  snprintf(name, 200, "ImpactZ%s", aName);
  fImpactZ    = new TH2D(name,  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -1.0, 1.0);
  snprintf(name, 200, "Sigma%s", aName);
  fSigma    = new TH2D(name,  "Z impact parameter vs P" , 100, 0.1, 2.0, 200, -5.0, 5.0);
}

AliFemtoCutMonitorParticleMomRes::AliFemtoCutMonitorParticleMomRes(const AliFemtoCutMonitorParticleMomRes &aCut):
  AliFemtoCutMonitor(),
  fMomRes3D(0),
  fMomResXvsP(0),
  fMomResYvsP(0),
  fMomResZvsP(0),
  fImpactXY(0),
  fImpactZ(0),
  fSigma(0)
{
  // copy constructor
  if (fMomRes3D) delete fMomRes3D;
  fMomRes3D = new TH3D(*aCut.fMomRes3D);
  if (fMomResXvsP) delete fMomResXvsP;
  fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
  if (fMomResYvsP) delete fMomResYvsP;
  fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
  if (fMomResZvsP) delete fMomResZvsP;
  fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
  if (fImpactXY) delete fImpactXY;
  fImpactXY = new TH2D(*aCut.fImpactXY);
  if (fImpactZ) delete fImpactZ;
  fImpactZ = new TH2D(*aCut.fImpactZ);
  if (fSigma) delete fSigma;
  fSigma = new TH2D(*aCut.fSigma);
}

AliFemtoCutMonitorParticleMomRes::~AliFemtoCutMonitorParticleMomRes()
{
  // Destructor
  delete fMomRes3D;
  delete fMomResXvsP;
  delete fMomResYvsP;
  delete fMomResZvsP;
  delete fImpactXY;
  delete fImpactZ;
  delete fSigma;
}

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

  if (fMomRes3D) delete fMomRes3D;
  fMomRes3D = new TH3D(*aCut.fMomRes3D);
  if (fMomResXvsP) delete fMomResXvsP;
  fMomResXvsP = new TH2D(*aCut.fMomResXvsP);
  if (fMomResYvsP) delete fMomResYvsP;
  fMomResYvsP = new TH2D(*aCut.fMomResYvsP);
  if (fMomResZvsP) delete fMomResZvsP;
  fMomResZvsP = new TH2D(*aCut.fMomResZvsP);
  if (fImpactXY) delete fImpactXY;
  fImpactXY = new TH2D(*aCut.fImpactXY);
  if (fImpactZ) delete fImpactZ;
  fImpactZ = new TH2D(*aCut.fImpactZ);
  if (fSigma) delete fSigma;
  fSigma = new TH2D(*aCut.fSigma);
  
  return *this;
}

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

void AliFemtoCutMonitorParticleMomRes::Fill(const AliFemtoTrack* aTrack)
{
  // Fill momentum resolution histograms for the particle
  AliFemtoModelHiddenInfo *tInf = ( AliFemtoModelHiddenInfo *) aTrack->GetHiddenInfo();
  if (tInf) {
    fMomRes3D->Fill(tInf->GetTrueMomentum()->x() - aTrack->P().x(),
		    tInf->GetTrueMomentum()->y() - aTrack->P().y(),
		    tInf->GetTrueMomentum()->z() - aTrack->P().z());
    
    fMomResXvsP->Fill(aTrack->P().Mag(),
		      tInf->GetTrueMomentum()->x() - aTrack->P().x());
    fMomResYvsP->Fill(aTrack->P().Mag(),
		      tInf->GetTrueMomentum()->y() - aTrack->P().y());
    fMomResZvsP->Fill(aTrack->P().Mag(),
		      tInf->GetTrueMomentum()->z() - aTrack->P().z());
    fImpactXY->Fill(aTrack->P().Mag(),
		    aTrack->ImpactD());
    fImpactZ->Fill(aTrack->P().Mag(),
		   aTrack->ImpactZ());
    fSigma->Fill(aTrack->P().Mag(),
		 aTrack->SigmaToVertex());
  }
}

void AliFemtoCutMonitorParticleMomRes::Write()
{
  // Write out the relevant histograms
  fMomRes3D->Write();
  fMomResXvsP->Write();
  fMomResYvsP->Write();
  fMomResZvsP->Write();
  fImpactXY->Write();
  fImpactZ->Write();
  fSigma->Write();
}

TList *AliFemtoCutMonitorParticleMomRes::GetOutputList()
{
  // Get the list of histograms to write
  TList *tOutputList = new TList();
  tOutputList->Add(fMomRes3D);
  tOutputList->Add(fMomResXvsP);
  tOutputList->Add(fMomResYvsP);
  tOutputList->Add(fMomResZvsP);
  tOutputList->Add(fImpactXY);
  tOutputList->Add(fImpactZ);
  tOutputList->Add(fSigma);

  return tOutputList;
}
 AliFemtoCutMonitorParticleMomRes.cxx:1
 AliFemtoCutMonitorParticleMomRes.cxx:2
 AliFemtoCutMonitorParticleMomRes.cxx:3
 AliFemtoCutMonitorParticleMomRes.cxx:4
 AliFemtoCutMonitorParticleMomRes.cxx:5
 AliFemtoCutMonitorParticleMomRes.cxx:6
 AliFemtoCutMonitorParticleMomRes.cxx:7
 AliFemtoCutMonitorParticleMomRes.cxx:8
 AliFemtoCutMonitorParticleMomRes.cxx:9
 AliFemtoCutMonitorParticleMomRes.cxx:10
 AliFemtoCutMonitorParticleMomRes.cxx:11
 AliFemtoCutMonitorParticleMomRes.cxx:12
 AliFemtoCutMonitorParticleMomRes.cxx:13
 AliFemtoCutMonitorParticleMomRes.cxx:14
 AliFemtoCutMonitorParticleMomRes.cxx:15
 AliFemtoCutMonitorParticleMomRes.cxx:16
 AliFemtoCutMonitorParticleMomRes.cxx:17
 AliFemtoCutMonitorParticleMomRes.cxx:18
 AliFemtoCutMonitorParticleMomRes.cxx:19
 AliFemtoCutMonitorParticleMomRes.cxx:20
 AliFemtoCutMonitorParticleMomRes.cxx:21
 AliFemtoCutMonitorParticleMomRes.cxx:22
 AliFemtoCutMonitorParticleMomRes.cxx:23
 AliFemtoCutMonitorParticleMomRes.cxx:24
 AliFemtoCutMonitorParticleMomRes.cxx:25
 AliFemtoCutMonitorParticleMomRes.cxx:26
 AliFemtoCutMonitorParticleMomRes.cxx:27
 AliFemtoCutMonitorParticleMomRes.cxx:28
 AliFemtoCutMonitorParticleMomRes.cxx:29
 AliFemtoCutMonitorParticleMomRes.cxx:30
 AliFemtoCutMonitorParticleMomRes.cxx:31
 AliFemtoCutMonitorParticleMomRes.cxx:32
 AliFemtoCutMonitorParticleMomRes.cxx:33
 AliFemtoCutMonitorParticleMomRes.cxx:34
 AliFemtoCutMonitorParticleMomRes.cxx:35
 AliFemtoCutMonitorParticleMomRes.cxx:36
 AliFemtoCutMonitorParticleMomRes.cxx:37
 AliFemtoCutMonitorParticleMomRes.cxx:38
 AliFemtoCutMonitorParticleMomRes.cxx:39
 AliFemtoCutMonitorParticleMomRes.cxx:40
 AliFemtoCutMonitorParticleMomRes.cxx:41
 AliFemtoCutMonitorParticleMomRes.cxx:42
 AliFemtoCutMonitorParticleMomRes.cxx:43
 AliFemtoCutMonitorParticleMomRes.cxx:44
 AliFemtoCutMonitorParticleMomRes.cxx:45
 AliFemtoCutMonitorParticleMomRes.cxx:46
 AliFemtoCutMonitorParticleMomRes.cxx:47
 AliFemtoCutMonitorParticleMomRes.cxx:48
 AliFemtoCutMonitorParticleMomRes.cxx:49
 AliFemtoCutMonitorParticleMomRes.cxx:50
 AliFemtoCutMonitorParticleMomRes.cxx:51
 AliFemtoCutMonitorParticleMomRes.cxx:52
 AliFemtoCutMonitorParticleMomRes.cxx:53
 AliFemtoCutMonitorParticleMomRes.cxx:54
 AliFemtoCutMonitorParticleMomRes.cxx:55
 AliFemtoCutMonitorParticleMomRes.cxx:56
 AliFemtoCutMonitorParticleMomRes.cxx:57
 AliFemtoCutMonitorParticleMomRes.cxx:58
 AliFemtoCutMonitorParticleMomRes.cxx:59
 AliFemtoCutMonitorParticleMomRes.cxx:60
 AliFemtoCutMonitorParticleMomRes.cxx:61
 AliFemtoCutMonitorParticleMomRes.cxx:62
 AliFemtoCutMonitorParticleMomRes.cxx:63
 AliFemtoCutMonitorParticleMomRes.cxx:64
 AliFemtoCutMonitorParticleMomRes.cxx:65
 AliFemtoCutMonitorParticleMomRes.cxx:66
 AliFemtoCutMonitorParticleMomRes.cxx:67
 AliFemtoCutMonitorParticleMomRes.cxx:68
 AliFemtoCutMonitorParticleMomRes.cxx:69
 AliFemtoCutMonitorParticleMomRes.cxx:70
 AliFemtoCutMonitorParticleMomRes.cxx:71
 AliFemtoCutMonitorParticleMomRes.cxx:72
 AliFemtoCutMonitorParticleMomRes.cxx:73
 AliFemtoCutMonitorParticleMomRes.cxx:74
 AliFemtoCutMonitorParticleMomRes.cxx:75
 AliFemtoCutMonitorParticleMomRes.cxx:76
 AliFemtoCutMonitorParticleMomRes.cxx:77
 AliFemtoCutMonitorParticleMomRes.cxx:78
 AliFemtoCutMonitorParticleMomRes.cxx:79
 AliFemtoCutMonitorParticleMomRes.cxx:80
 AliFemtoCutMonitorParticleMomRes.cxx:81
 AliFemtoCutMonitorParticleMomRes.cxx:82
 AliFemtoCutMonitorParticleMomRes.cxx:83
 AliFemtoCutMonitorParticleMomRes.cxx:84
 AliFemtoCutMonitorParticleMomRes.cxx:85
 AliFemtoCutMonitorParticleMomRes.cxx:86
 AliFemtoCutMonitorParticleMomRes.cxx:87
 AliFemtoCutMonitorParticleMomRes.cxx:88
 AliFemtoCutMonitorParticleMomRes.cxx:89
 AliFemtoCutMonitorParticleMomRes.cxx:90
 AliFemtoCutMonitorParticleMomRes.cxx:91
 AliFemtoCutMonitorParticleMomRes.cxx:92
 AliFemtoCutMonitorParticleMomRes.cxx:93
 AliFemtoCutMonitorParticleMomRes.cxx:94
 AliFemtoCutMonitorParticleMomRes.cxx:95
 AliFemtoCutMonitorParticleMomRes.cxx:96
 AliFemtoCutMonitorParticleMomRes.cxx:97
 AliFemtoCutMonitorParticleMomRes.cxx:98
 AliFemtoCutMonitorParticleMomRes.cxx:99
 AliFemtoCutMonitorParticleMomRes.cxx:100
 AliFemtoCutMonitorParticleMomRes.cxx:101
 AliFemtoCutMonitorParticleMomRes.cxx:102
 AliFemtoCutMonitorParticleMomRes.cxx:103
 AliFemtoCutMonitorParticleMomRes.cxx:104
 AliFemtoCutMonitorParticleMomRes.cxx:105
 AliFemtoCutMonitorParticleMomRes.cxx:106
 AliFemtoCutMonitorParticleMomRes.cxx:107
 AliFemtoCutMonitorParticleMomRes.cxx:108
 AliFemtoCutMonitorParticleMomRes.cxx:109
 AliFemtoCutMonitorParticleMomRes.cxx:110
 AliFemtoCutMonitorParticleMomRes.cxx:111
 AliFemtoCutMonitorParticleMomRes.cxx:112
 AliFemtoCutMonitorParticleMomRes.cxx:113
 AliFemtoCutMonitorParticleMomRes.cxx:114
 AliFemtoCutMonitorParticleMomRes.cxx:115
 AliFemtoCutMonitorParticleMomRes.cxx:116
 AliFemtoCutMonitorParticleMomRes.cxx:117
 AliFemtoCutMonitorParticleMomRes.cxx:118
 AliFemtoCutMonitorParticleMomRes.cxx:119
 AliFemtoCutMonitorParticleMomRes.cxx:120
 AliFemtoCutMonitorParticleMomRes.cxx:121
 AliFemtoCutMonitorParticleMomRes.cxx:122
 AliFemtoCutMonitorParticleMomRes.cxx:123
 AliFemtoCutMonitorParticleMomRes.cxx:124
 AliFemtoCutMonitorParticleMomRes.cxx:125
 AliFemtoCutMonitorParticleMomRes.cxx:126
 AliFemtoCutMonitorParticleMomRes.cxx:127
 AliFemtoCutMonitorParticleMomRes.cxx:128
 AliFemtoCutMonitorParticleMomRes.cxx:129
 AliFemtoCutMonitorParticleMomRes.cxx:130
 AliFemtoCutMonitorParticleMomRes.cxx:131
 AliFemtoCutMonitorParticleMomRes.cxx:132
 AliFemtoCutMonitorParticleMomRes.cxx:133
 AliFemtoCutMonitorParticleMomRes.cxx:134
 AliFemtoCutMonitorParticleMomRes.cxx:135
 AliFemtoCutMonitorParticleMomRes.cxx:136
 AliFemtoCutMonitorParticleMomRes.cxx:137
 AliFemtoCutMonitorParticleMomRes.cxx:138
 AliFemtoCutMonitorParticleMomRes.cxx:139
 AliFemtoCutMonitorParticleMomRes.cxx:140
 AliFemtoCutMonitorParticleMomRes.cxx:141
 AliFemtoCutMonitorParticleMomRes.cxx:142
 AliFemtoCutMonitorParticleMomRes.cxx:143
 AliFemtoCutMonitorParticleMomRes.cxx:144
 AliFemtoCutMonitorParticleMomRes.cxx:145
 AliFemtoCutMonitorParticleMomRes.cxx:146
 AliFemtoCutMonitorParticleMomRes.cxx:147
 AliFemtoCutMonitorParticleMomRes.cxx:148
 AliFemtoCutMonitorParticleMomRes.cxx:149
 AliFemtoCutMonitorParticleMomRes.cxx:150
 AliFemtoCutMonitorParticleMomRes.cxx:151
 AliFemtoCutMonitorParticleMomRes.cxx:152
 AliFemtoCutMonitorParticleMomRes.cxx:153
 AliFemtoCutMonitorParticleMomRes.cxx:154
 AliFemtoCutMonitorParticleMomRes.cxx:155
 AliFemtoCutMonitorParticleMomRes.cxx:156
 AliFemtoCutMonitorParticleMomRes.cxx:157
 AliFemtoCutMonitorParticleMomRes.cxx:158
 AliFemtoCutMonitorParticleMomRes.cxx:159
 AliFemtoCutMonitorParticleMomRes.cxx:160
 AliFemtoCutMonitorParticleMomRes.cxx:161
 AliFemtoCutMonitorParticleMomRes.cxx:162
 AliFemtoCutMonitorParticleMomRes.cxx:163
 AliFemtoCutMonitorParticleMomRes.cxx:164
 AliFemtoCutMonitorParticleMomRes.cxx:165
 AliFemtoCutMonitorParticleMomRes.cxx:166
 AliFemtoCutMonitorParticleMomRes.cxx:167
 AliFemtoCutMonitorParticleMomRes.cxx:168
 AliFemtoCutMonitorParticleMomRes.cxx:169
 AliFemtoCutMonitorParticleMomRes.cxx:170
 AliFemtoCutMonitorParticleMomRes.cxx:171
 AliFemtoCutMonitorParticleMomRes.cxx:172
 AliFemtoCutMonitorParticleMomRes.cxx:173
 AliFemtoCutMonitorParticleMomRes.cxx:174
 AliFemtoCutMonitorParticleMomRes.cxx:175
 AliFemtoCutMonitorParticleMomRes.cxx:176
 AliFemtoCutMonitorParticleMomRes.cxx:177
 AliFemtoCutMonitorParticleMomRes.cxx:178
 AliFemtoCutMonitorParticleMomRes.cxx:179