]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/corrs/RunCopyVtxBias.C
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / RunCopyVtxBias.C
CommitLineData
970b1a8a 1/**
2 *
3 *
4 * @param d
5 * @param r
6 *
7 * @return
8 *
bd6f5206 9 * @ingroup pwglf_forward_scripts_corr
970b1a8a 10 */
ab0f914c 11Color_t Color(UShort_t d, Char_t r ) const
12{
13 return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
14 + ((r == 'I' || r == 'i') ? 2 : -2));
15}
970b1a8a 16/**
17 *
18 *
19 * @param sys
20 * @param cms
21 * @param field
22 * @param path
23 *
bd6f5206 24 * @ingroup pwglf_forward_scripts_corr
970b1a8a 25 */
cc83fca2 26void
27RunCopyVtxBias(UShort_t sys, UShort_t cms, Short_t field, const char* path=0)
28{
29 RunCopyVtxBias(sys == 1 ? "pp" : "PbPb", cms, field, path);
30}
31
ab0f914c 32/**
33 *
34 * @param sys Collision system
35 * @param cms Center of mass energy per nucleon in GeV
36 * @param field Magnetic field
970b1a8a 37 * @param path File path
38 *
ab0f914c 39 *
bd6f5206 40 * @ingroup pwglf_forward_scripts_corr
ab0f914c 41 */
42void
cc83fca2 43RunCopyVtxBias(const char* sys, UShort_t cms, Short_t field, const char* path=0)
ab0f914c 44{
bd6f5206 45 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
46 gSystem->Load("libPWGLFforward.so");
ab0f914c 47
48 AliFMDAnaParameters* p = AliFMDAnaParameters::Instance();
49 p->SetEnergy(Float_t(cms));
50 p->SetMagField(Float_t(field));
cc83fca2 51 p->SetCollisionSystem(sys);
52 if (path) {
53 p->SetBackgroundPath(path);
54 p->SetEnergyPath(path);
55 p->SetEventSelectionPath(path);
56 p->SetSharingEfficiencyPath(path);
57 }
ab0f914c 58 p->Init(true, AliFMDAnaParameters::kBackgroundCorrection|
59 AliFMDAnaParameters::kEventSelectionEfficiency);
60
61 Int_t nVtx = p->GetNvtxBins();
62 Double_t minVtx = -p->GetVtxCutZ();
63 Double_t maxVtx = -p->GetVtxCutZ();
64 Int_t nEta = p->GetNetaBins();
65 Double_t minEta = p->GetEtaMin();
66 Double_t maxEta = p->GetEtaMax();
67
68 TAxis vtxAxis(nVtx, minVtx, maxVtx);
69 AliFMDCorrVertexBias* obj = new AliFMDCorrVertexBias;
70 obj->SetVertexAxis(vtxAxis);
71
72 for (UShort_t b = 1; b <= nVtx; b++) {
73 for (UShort_t q = 0; q < 2; q++) {
74 Char_t r = q == 0 ? 'I' : 'O';
75
76 TH2F* oldcorr = p->GetEventSelectionEfficiency("INEL",b-1,r);
77 if (!oldcorr) {
78 Warning("RunCopyVtxBias",
79 "Didn't find secondary map correction "
80 "for ring type %c, vertex bin %3d", r, b);
81 continue;
82 }
83
84 TH2D* newcorr = new TH2D(Form("FMDX%c", r),
85 Form("Vertex bias correction for %c rings "
86 "in vertex bin %d [%+8.4f,%+8.4f]",
87 r, b, vtxAxis.GetBinLowEdge(b),
88 vtxAxis.GetBinUpEdge(b)),
89 nEta, minEta, maxEta,
90 oldcorr->GetYaxis()->GetNbins(),
91 oldcorr->GetYaxis()->GetXmin(),
92 oldcorr->GetYaxis()->GetXmax());
93 newcorr->SetXTitle("#eta");
94 newcorr->SetYTitle("#phi [radians]");
95 newcorr->SetZTitle("1/N_{t}#sum_{i}^{N_{tv}} N_{ch,i,primary} / "
96 "1/N_{v}#sum_{i}^{N_{v}} N_{ch,i,primary}");
97 newcorr->SetDirectory(0);
98 newcorr->SetStats(0);
99 newcorr->Sumw2();
100 newcorr->Add(oldcorr);
101
102 Info("RunCopyVtxBias",
103 "Copying %s to %s", oldcorr->GetName(), newcorr->GetName());
104
105 obj->SetCorrection(r, b, newcorr);
106 }
107 }
cc83fca2 108 UShort_t isys = AliForwardUtil::ParseCollisionSystem(sys);
ab0f914c 109 AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
110 TString fname(mgr.GetFileName(AliForwardCorrectionManager::kVertexBias,
cc83fca2 111 isys, cms, field, false));
ab0f914c 112 TFile* output = TFile::Open(fname.Data(), "RECREATE");
113 if (!output) {
114 Warning("Run", "Failed to open output file %s", fname.Data());
115 return kFALSE;
116 }
117 obj->Write(mgr.GetObjectName(AliForwardCorrectionManager::kVertexBias));
118 output->Write();
119 output->Close();
120 Info("Run", "File %s created. It should be copied to %s and stored in SVN",
121 fname.Data(),mgr.GetFileDir(AliForwardCorrectionManager::kVertexBias));
122
123}
124//
125// EOF
126//