]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/AliDxHFECorrelationMC.cxx
ab0426529431127743b582bcdc0dbc5a8bfadcbc
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliDxHFECorrelationMC.cxx
1
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE Project            * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
7 //*                  Sedat Altinpinar <Sedat.Altinpinar@cern.ch>           *
8 //*                  Hege Erdal       <hege.erdal@gmail.com>               *
9 //*                                                                        *
10 //* Permission to use, copy, modify and distribute this software and its   *
11 //* documentation strictly for non-commercial purposes is hereby granted   *
12 //* without fee, provided that the above copyright notice appears in all   *
13 //* copies and that both the copyright notice and this permission notice   *
14 //* appear in the supporting documentation. The authors make no claims     *
15 //* about the suitability of this software for any purpose. It is          *
16 //* provided "as is" without express or implied warranty.                  *
17 //**************************************************************************
18
19 /// @file   AliDxHFECorrelationMC.cxx
20 /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
21 /// @date   2012-11-02
22 /// @brief  Worker class for DxHFE correlation
23 ///
24
25 #include "AliDxHFECorrelationMC.h"
26 #include "AliVParticle.h"
27 #include "AliLog.h"
28 //#include "AliAnalysisCuts.h"         // required dependency libANALYSISalice.so
29 //#include "AliFlowTrackSimple.h"      // required dependency libPWGflowBase.so
30 //#include "AliFlowCandidateTrack.h"   // required dependency libPWGflowTasks.so
31 //#include "AliCFContainer.h"          // required dependency libCORRFW.so
32 //#include "AliAODRecoDecayHF2Prong.h"   // libPWGHFvertexingHF
33 #include "TObjArray.h"
34 #include "AliDxHFECorrelation.h"
35 #include "TMath.h"
36 #include "TFile.h"
37 #include "TCanvas.h"
38 #include "TDatabasePDG.h"
39 #include "TLorentzVector.h"
40 #include "AliReducedParticle.h"
41 #include "AliDxHFEParticleSelection.h"
42 #include <iostream>
43 #include <cerrno>
44 #include <memory>
45
46 using namespace std;
47
48 ClassImp(AliDxHFECorrelationMC)
49
50 AliDxHFECorrelationMC::AliDxHFECorrelationMC(const char* name)
51   : AliDxHFECorrelation(name?name:"AliDxHFECorrelationMC")
52   , fMCEventType(0)
53 {
54   // default constructor
55   // 
56   //
57
58 }
59
60
61 AliDxHFECorrelationMC::~AliDxHFECorrelationMC()
62 {
63   // destructor
64   //
65   //
66
67 }
68
69 THnSparse* AliDxHFECorrelationMC::DefineTHnSparse()
70 {
71   //
72   // Defines the THnSparse. 
73
74   // here is the only place to change the dimension
75   static const int sizeEventdphi = 10;  
76   InitTHnSparseArray(sizeEventdphi);
77   const double pi=TMath::Pi();
78   Double_t minPhi=GetMinPhi();
79   Double_t maxPhi=GetMaxPhi();
80
81   // TODO: Everything here needed for eventmixing? 
82   //                                            0        1     2      3      4     5       6      7    8      9
83   //                                          D0invmass  PtD0 PhiD0 PtbinD0 Pte  dphi    dEta OrigD0 origEl process
84   int         binsEventdphi[sizeEventdphi] = {   200,   1000,  100,  21,   1000, 100,     100,   10,     14,  100 };
85   double      minEventdphi [sizeEventdphi] = { 1.5648,     0,    0,   0,     0 , minPhi, -0.9, -1.5,   -1.5, -0.5 };
86   double      maxEventdphi [sizeEventdphi] = { 2.1648,   100, 2*pi,  20,    100, maxPhi,  0.9,  8.5,   12.5, 99.5 };
87   const char* nameEventdphi[sizeEventdphi] = {
88     "D0InvMass",
89     "PtD0",
90     "PhiD0",
91     "PtBinD0",
92     "PtEl",
93     "#Delta#Phi",
94     "#Delta#eta", 
95     "Origin D0", 
96     "Origin Electron",
97     "Original Process"
98 };
99
100   TString name;
101   name.Form("%s info", GetName());
102
103
104   return CreateControlTHnSparse(name,sizeEventdphi,binsEventdphi,minEventdphi,maxEventdphi,nameEventdphi);
105
106
107 }
108
109
110 int AliDxHFECorrelationMC::FillParticleProperties(AliVParticle* tr, AliVParticle *as, Double_t* data, int dimension) const
111 {
112   // fill the data array from the particle data
113   if (!data) return -EINVAL;
114   AliReducedParticle *ptrigger=(AliReducedParticle*)tr;
115   AliReducedParticle *assoc=(AliReducedParticle*)as;
116   if (!ptrigger || !assoc) return -ENODATA;
117   int i=0;
118   if (dimension!=GetDimTHnSparse()) {
119     // TODO: think about filling only the available data and throwing a warning
120     return -ENOSPC;
121   }
122   data[i++]=ptrigger->GetInvMass();
123   data[i++]=ptrigger->Pt();
124   data[i++]=ptrigger->Phi();
125   data[i++]=ptrigger->GetPtBin(); 
126   data[i++]=assoc->Pt();
127   data[i++]=AliDxHFECorrelation::GetDeltaPhi();
128   data[i++]=AliDxHFECorrelation::GetDeltaEta();
129   data[i++]=ptrigger->GetOriginMother();
130   data[i++]=assoc->GetOriginMother();
131   data[i++]=fMCEventType;
132   
133   return i;
134 }
135
136 int AliDxHFECorrelationMC::Fill(const TObjArray* triggerCandidates, TObjArray* associatedTracks, const AliVEvent* pEvent)
137 {
138   // TODO: Implement more on MC?? (Needed?)
139   return AliDxHFECorrelation::Fill(triggerCandidates,associatedTracks,pEvent);
140 }
141