ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/*
$Log$
*/ 

#include "Riostream.h"
#include "AliFlowLYZHist2.h"
#include "AliFlowCommonConstants.h" 
#include "TProfile.h"
#include "TProfile2D.h"
#include "TString.h" 
#include "TComplex.h"
#include "TList.h"
#include "TBrowser.h"

class TH1D;

// Class to organize the histograms in the second run
// in the Lee Yang Zeros Flow analysis.
// Also contains methods to get values from the histograms
// which are called in AliFlowLeeYandZerosMaker::Finish().
// author: N. van der Kolk (kolk@nikhef.nl)

ClassImp(AliFlowLYZHist2)
  
//-----------------------------------------------------------------------

  AliFlowLYZHist2::AliFlowLYZHist2():
    TNamed(),
    fHistProReNumer(0),
    fHistProImNumer(0),
    fHistProReNumerPt(0),
    fHistProImNumerPt(0),
    fHistProReNumer2D(0),
    fHistProImNumer2D(0),
    fHistList(NULL)
{
  //default constructor
}
 
//-----------------------------------------------------------------------

  AliFlowLYZHist2::AliFlowLYZHist2(Int_t theta, const char* aSelection, const char *anInput, Bool_t useSum):
    TNamed(anInput,anInput),
    fHistProReNumer(0),
    fHistProImNumer(0),
    fHistProReNumerPt(0),
    fHistProImNumerPt(0),
    fHistProReNumer2D(0),
    fHistProImNumer2D(0),
    fHistList(NULL)
{

  //constructor creating histograms 
  TString title, name, addlast;

  if (useSum) { addlast = "LYZSUM"; }
  else { addlast = "LYZPROD"; }

  Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
  Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();

  Double_t  dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();	     
  Double_t  dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
  Double_t  dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();	     
  Double_t  dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
    
  //fHistProReNumer
  name = "Second_FlowPro_ReNumer";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProReNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax); 
  fHistProReNumer->SetXTitle("eta");
  fHistProReNumer->SetYTitle("v (%)");

  //fHistProImNumer
  name = "Second_FlowPro_ImNumer";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProImNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);  
  fHistProImNumer->SetXTitle("eta");
  fHistProImNumer->SetYTitle("v (%)");

  //fHistProReNumerPt
  name = "Second_FlowPro_ReNumerPt";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProReNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax); 
  fHistProReNumerPt->SetXTitle("Pt");
  fHistProReNumerPt->SetYTitle("v (%)");

  //fHistProImNumerPt
  name = "Second_FlowPro_ImNumerPt";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProImNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);  
  fHistProImNumerPt->SetXTitle("Pt");
  fHistProImNumerPt->SetYTitle("v (%)");

  //fHistProReNumer2D
  name = "Second_FlowPro_ReNumer2D";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProReNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);  
  fHistProReNumer2D->SetXTitle("eta");
  fHistProReNumer2D->SetYTitle("Pt (GeV/c)");

  //fHistProImNumer2D 
  name = "Second_FlowPro_ImNumer2D";
  name +=theta;
  name +=aSelection;
  name +=addlast;
  title = name;
  fHistProImNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);  
  fHistProImNumer2D->SetXTitle("eta");
  fHistProImNumer2D->SetYTitle("Pt (GeV/c)");

  //list of histograms
  fHistList = new TList();
  fHistList-> Add(fHistProReNumer);
  fHistList-> Add(fHistProImNumer);
  fHistList-> Add(fHistProReNumerPt);
  fHistList-> Add(fHistProImNumerPt);
  fHistList-> Add(fHistProReNumer2D);
  fHistList-> Add(fHistProImNumer2D);

}

//----------------------------------------------------------------------- 

AliFlowLYZHist2::~AliFlowLYZHist2()
{
  //deletes histograms
  delete fHistProReNumer;
  delete fHistProImNumer;
  delete fHistProReNumerPt;
  delete fHistProImNumerPt;
  delete fHistProReNumer2D;
  delete fHistProImNumer2D;
  delete fHistList;
}

//----------------------------------------------------------------------- 
void AliFlowLYZHist2::Fill(Double_t d1, Double_t d2, TComplex c)
{
  //fill the real and imaginary part of fNumer

  fHistProReNumer->Fill(d1, c.Re());  
  fHistProImNumer->Fill(d1, c.Im());
   
  fHistProReNumerPt->Fill(d2, c.Re());  
  fHistProImNumerPt->Fill(d2, c.Im());
  
  fHistProReNumer2D->Fill(d1, d2, c.Re());          
  fHistProImNumer2D->Fill(d1, d2, c.Im());           
}

//-----------------------------------------------------------------------
TComplex AliFlowLYZHist2::GetNumerEta(Int_t i)
{
  //get the real and imaginary part of fNumer
  Double_t dReNumer = fHistProReNumer->GetBinContent(i);
  Double_t dImNumer = fHistProImNumer->GetBinContent(i);
  TComplex cNumer(dReNumer,dImNumer);
  //if (dNumer.Rho()==0) {cerr<<"modulus of dNumer is zero in AliFlowLYZHist2::GetNumer(Int_t i)"<<endl;}
  return cNumer;
}

//----------------------------------------------------------------------- 
TComplex AliFlowLYZHist2::GetNumerPt(Int_t i)
{
  //get the real and imaginary part of fNumer
  Double_t dReNumer = fHistProReNumerPt->GetBinContent(i);
  Double_t dImNumer = fHistProImNumerPt->GetBinContent(i);
  TComplex cNumer(dReNumer,dImNumer);
  return cNumer;
}

//----------------------------------------------------------------------- 
 Double_t AliFlowLYZHist2::Merge(TCollection *aList)
{
  //merge fuction
  if (!aList) return 0;
  if (aList->IsEmpty()) return 0; //no merging is needed

  Int_t iCount = 0;
  TIter next(aList); // list is supposed to contain only objects of the same type as this
  AliFlowLYZHist2 *toMerge;
  // make a temporary list
  TList *pTemp = new TList();
  while ((toMerge=(AliFlowLYZHist2*)next())) {
    pTemp->Add(toMerge->GetHistList()); 
    iCount++;
  }
  // Now call merge for fHistList providing temp list
  fHistList->Merge(pTemp);
  // Cleanup
  delete pTemp;
    
  return (double)iCount;
    
}

//----------------------------------------------------------------------- 
void AliFlowLYZHist2::Print(Option_t *option) const
{
  //   -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
  //             ===============================================
  //   printf( "TH1.Print Name  = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
  printf( "Class.Print Name = %s, Histogram list:\n",GetName());

  if (fHistList) {  
    fHistList->Print(option);
  }
  else
    {
      printf( "Empty histogram list \n");
    }
}

//----------------------------------------------------------------------- 
 void AliFlowLYZHist2::Browse(TBrowser *b)
{

  if (!b) return;
  if (fHistList) b->Add(fHistList,"AliFlowLYZHist2List");
}
 AliFlowLYZHist2.cxx:1
 AliFlowLYZHist2.cxx:2
 AliFlowLYZHist2.cxx:3
 AliFlowLYZHist2.cxx:4
 AliFlowLYZHist2.cxx:5
 AliFlowLYZHist2.cxx:6
 AliFlowLYZHist2.cxx:7
 AliFlowLYZHist2.cxx:8
 AliFlowLYZHist2.cxx:9
 AliFlowLYZHist2.cxx:10
 AliFlowLYZHist2.cxx:11
 AliFlowLYZHist2.cxx:12
 AliFlowLYZHist2.cxx:13
 AliFlowLYZHist2.cxx:14
 AliFlowLYZHist2.cxx:15
 AliFlowLYZHist2.cxx:16
 AliFlowLYZHist2.cxx:17
 AliFlowLYZHist2.cxx:18
 AliFlowLYZHist2.cxx:19
 AliFlowLYZHist2.cxx:20
 AliFlowLYZHist2.cxx:21
 AliFlowLYZHist2.cxx:22
 AliFlowLYZHist2.cxx:23
 AliFlowLYZHist2.cxx:24
 AliFlowLYZHist2.cxx:25
 AliFlowLYZHist2.cxx:26
 AliFlowLYZHist2.cxx:27
 AliFlowLYZHist2.cxx:28
 AliFlowLYZHist2.cxx:29
 AliFlowLYZHist2.cxx:30
 AliFlowLYZHist2.cxx:31
 AliFlowLYZHist2.cxx:32
 AliFlowLYZHist2.cxx:33
 AliFlowLYZHist2.cxx:34
 AliFlowLYZHist2.cxx:35
 AliFlowLYZHist2.cxx:36
 AliFlowLYZHist2.cxx:37
 AliFlowLYZHist2.cxx:38
 AliFlowLYZHist2.cxx:39
 AliFlowLYZHist2.cxx:40
 AliFlowLYZHist2.cxx:41
 AliFlowLYZHist2.cxx:42
 AliFlowLYZHist2.cxx:43
 AliFlowLYZHist2.cxx:44
 AliFlowLYZHist2.cxx:45
 AliFlowLYZHist2.cxx:46
 AliFlowLYZHist2.cxx:47
 AliFlowLYZHist2.cxx:48
 AliFlowLYZHist2.cxx:49
 AliFlowLYZHist2.cxx:50
 AliFlowLYZHist2.cxx:51
 AliFlowLYZHist2.cxx:52
 AliFlowLYZHist2.cxx:53
 AliFlowLYZHist2.cxx:54
 AliFlowLYZHist2.cxx:55
 AliFlowLYZHist2.cxx:56
 AliFlowLYZHist2.cxx:57
 AliFlowLYZHist2.cxx:58
 AliFlowLYZHist2.cxx:59
 AliFlowLYZHist2.cxx:60
 AliFlowLYZHist2.cxx:61
 AliFlowLYZHist2.cxx:62
 AliFlowLYZHist2.cxx:63
 AliFlowLYZHist2.cxx:64
 AliFlowLYZHist2.cxx:65
 AliFlowLYZHist2.cxx:66
 AliFlowLYZHist2.cxx:67
 AliFlowLYZHist2.cxx:68
 AliFlowLYZHist2.cxx:69
 AliFlowLYZHist2.cxx:70
 AliFlowLYZHist2.cxx:71
 AliFlowLYZHist2.cxx:72
 AliFlowLYZHist2.cxx:73
 AliFlowLYZHist2.cxx:74
 AliFlowLYZHist2.cxx:75
 AliFlowLYZHist2.cxx:76
 AliFlowLYZHist2.cxx:77
 AliFlowLYZHist2.cxx:78
 AliFlowLYZHist2.cxx:79
 AliFlowLYZHist2.cxx:80
 AliFlowLYZHist2.cxx:81
 AliFlowLYZHist2.cxx:82
 AliFlowLYZHist2.cxx:83
 AliFlowLYZHist2.cxx:84
 AliFlowLYZHist2.cxx:85
 AliFlowLYZHist2.cxx:86
 AliFlowLYZHist2.cxx:87
 AliFlowLYZHist2.cxx:88
 AliFlowLYZHist2.cxx:89
 AliFlowLYZHist2.cxx:90
 AliFlowLYZHist2.cxx:91
 AliFlowLYZHist2.cxx:92
 AliFlowLYZHist2.cxx:93
 AliFlowLYZHist2.cxx:94
 AliFlowLYZHist2.cxx:95
 AliFlowLYZHist2.cxx:96
 AliFlowLYZHist2.cxx:97
 AliFlowLYZHist2.cxx:98
 AliFlowLYZHist2.cxx:99
 AliFlowLYZHist2.cxx:100
 AliFlowLYZHist2.cxx:101
 AliFlowLYZHist2.cxx:102
 AliFlowLYZHist2.cxx:103
 AliFlowLYZHist2.cxx:104
 AliFlowLYZHist2.cxx:105
 AliFlowLYZHist2.cxx:106
 AliFlowLYZHist2.cxx:107
 AliFlowLYZHist2.cxx:108
 AliFlowLYZHist2.cxx:109
 AliFlowLYZHist2.cxx:110
 AliFlowLYZHist2.cxx:111
 AliFlowLYZHist2.cxx:112
 AliFlowLYZHist2.cxx:113
 AliFlowLYZHist2.cxx:114
 AliFlowLYZHist2.cxx:115
 AliFlowLYZHist2.cxx:116
 AliFlowLYZHist2.cxx:117
 AliFlowLYZHist2.cxx:118
 AliFlowLYZHist2.cxx:119
 AliFlowLYZHist2.cxx:120
 AliFlowLYZHist2.cxx:121
 AliFlowLYZHist2.cxx:122
 AliFlowLYZHist2.cxx:123
 AliFlowLYZHist2.cxx:124
 AliFlowLYZHist2.cxx:125
 AliFlowLYZHist2.cxx:126
 AliFlowLYZHist2.cxx:127
 AliFlowLYZHist2.cxx:128
 AliFlowLYZHist2.cxx:129
 AliFlowLYZHist2.cxx:130
 AliFlowLYZHist2.cxx:131
 AliFlowLYZHist2.cxx:132
 AliFlowLYZHist2.cxx:133
 AliFlowLYZHist2.cxx:134
 AliFlowLYZHist2.cxx:135
 AliFlowLYZHist2.cxx:136
 AliFlowLYZHist2.cxx:137
 AliFlowLYZHist2.cxx:138
 AliFlowLYZHist2.cxx:139
 AliFlowLYZHist2.cxx:140
 AliFlowLYZHist2.cxx:141
 AliFlowLYZHist2.cxx:142
 AliFlowLYZHist2.cxx:143
 AliFlowLYZHist2.cxx:144
 AliFlowLYZHist2.cxx:145
 AliFlowLYZHist2.cxx:146
 AliFlowLYZHist2.cxx:147
 AliFlowLYZHist2.cxx:148
 AliFlowLYZHist2.cxx:149
 AliFlowLYZHist2.cxx:150
 AliFlowLYZHist2.cxx:151
 AliFlowLYZHist2.cxx:152
 AliFlowLYZHist2.cxx:153
 AliFlowLYZHist2.cxx:154
 AliFlowLYZHist2.cxx:155
 AliFlowLYZHist2.cxx:156
 AliFlowLYZHist2.cxx:157
 AliFlowLYZHist2.cxx:158
 AliFlowLYZHist2.cxx:159
 AliFlowLYZHist2.cxx:160
 AliFlowLYZHist2.cxx:161
 AliFlowLYZHist2.cxx:162
 AliFlowLYZHist2.cxx:163
 AliFlowLYZHist2.cxx:164
 AliFlowLYZHist2.cxx:165
 AliFlowLYZHist2.cxx:166
 AliFlowLYZHist2.cxx:167
 AliFlowLYZHist2.cxx:168
 AliFlowLYZHist2.cxx:169
 AliFlowLYZHist2.cxx:170
 AliFlowLYZHist2.cxx:171
 AliFlowLYZHist2.cxx:172
 AliFlowLYZHist2.cxx:173
 AliFlowLYZHist2.cxx:174
 AliFlowLYZHist2.cxx:175
 AliFlowLYZHist2.cxx:176
 AliFlowLYZHist2.cxx:177
 AliFlowLYZHist2.cxx:178
 AliFlowLYZHist2.cxx:179
 AliFlowLYZHist2.cxx:180
 AliFlowLYZHist2.cxx:181
 AliFlowLYZHist2.cxx:182
 AliFlowLYZHist2.cxx:183
 AliFlowLYZHist2.cxx:184
 AliFlowLYZHist2.cxx:185
 AliFlowLYZHist2.cxx:186
 AliFlowLYZHist2.cxx:187
 AliFlowLYZHist2.cxx:188
 AliFlowLYZHist2.cxx:189
 AliFlowLYZHist2.cxx:190
 AliFlowLYZHist2.cxx:191
 AliFlowLYZHist2.cxx:192
 AliFlowLYZHist2.cxx:193
 AliFlowLYZHist2.cxx:194
 AliFlowLYZHist2.cxx:195
 AliFlowLYZHist2.cxx:196
 AliFlowLYZHist2.cxx:197
 AliFlowLYZHist2.cxx:198
 AliFlowLYZHist2.cxx:199
 AliFlowLYZHist2.cxx:200
 AliFlowLYZHist2.cxx:201
 AliFlowLYZHist2.cxx:202
 AliFlowLYZHist2.cxx:203
 AliFlowLYZHist2.cxx:204
 AliFlowLYZHist2.cxx:205
 AliFlowLYZHist2.cxx:206
 AliFlowLYZHist2.cxx:207
 AliFlowLYZHist2.cxx:208
 AliFlowLYZHist2.cxx:209
 AliFlowLYZHist2.cxx:210
 AliFlowLYZHist2.cxx:211
 AliFlowLYZHist2.cxx:212
 AliFlowLYZHist2.cxx:213
 AliFlowLYZHist2.cxx:214
 AliFlowLYZHist2.cxx:215
 AliFlowLYZHist2.cxx:216
 AliFlowLYZHist2.cxx:217
 AliFlowLYZHist2.cxx:218
 AliFlowLYZHist2.cxx:219
 AliFlowLYZHist2.cxx:220
 AliFlowLYZHist2.cxx:221
 AliFlowLYZHist2.cxx:222
 AliFlowLYZHist2.cxx:223
 AliFlowLYZHist2.cxx:224
 AliFlowLYZHist2.cxx:225
 AliFlowLYZHist2.cxx:226
 AliFlowLYZHist2.cxx:227
 AliFlowLYZHist2.cxx:228
 AliFlowLYZHist2.cxx:229
 AliFlowLYZHist2.cxx:230
 AliFlowLYZHist2.cxx:231
 AliFlowLYZHist2.cxx:232
 AliFlowLYZHist2.cxx:233
 AliFlowLYZHist2.cxx:234
 AliFlowLYZHist2.cxx:235
 AliFlowLYZHist2.cxx:236
 AliFlowLYZHist2.cxx:237
 AliFlowLYZHist2.cxx:238
 AliFlowLYZHist2.cxx:239
 AliFlowLYZHist2.cxx:240
 AliFlowLYZHist2.cxx:241
 AliFlowLYZHist2.cxx:242
 AliFlowLYZHist2.cxx:243
 AliFlowLYZHist2.cxx:244
 AliFlowLYZHist2.cxx:245
 AliFlowLYZHist2.cxx:246
 AliFlowLYZHist2.cxx:247
 AliFlowLYZHist2.cxx:248
 AliFlowLYZHist2.cxx:249
 AliFlowLYZHist2.cxx:250
 AliFlowLYZHist2.cxx:251