1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // driver for computing the pt and spectra
17 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
19 #include <Riostream.h>
22 #include <TFileMerger.h>
27 #include "AliLnCorr.h"
29 #include "AliLnSecondaries.h"
30 #include "AliLnEfficiency.h"
31 #include "AliLnRatio.h"
32 #include "AliLnSpectra.h"
34 #include "AliLnDriver.h"
39 AliLnDriver::AliLnDriver()
41 , fSpecies("Deuteron")
59 , fSecProd(AliLnSecondaries::kTFractionFitter)
60 , fMatDCAxyMod(AliLnSecondaries::kGeantDCAxy)
84 , fOutputPtCorrDebug()
95 for(Int_t i=0; i<3; ++i)
101 gErrorIgnoreLevel = kWarning;
102 // gErrorIgnoreLevel = kPrint, kInfo, kWarning, kError, kBreak, kSysError, kFatal;
105 AliLnDriver::~AliLnDriver()
112 void AliLnDriver::SetInputFilenames(const TString& data, const TString& simu, const TString& simuFix, const TString& ptcorr)
115 // input filenames to get the pt
119 fInputSimuFix = simuFix;
120 fOutputPtCorr = ptcorr;
122 fOutputPtCorrDebug = ptcorr;
123 fOutputPtCorrDebug.Replace(ptcorr.Length()-5,5,"-debug.root");
126 void AliLnDriver::SetOutputFilenames(const TString& pt, const TString& ratio, const TString& spectra)
133 fOutputSpectra=spectra;
136 fOutputPtDebug.Replace(pt.Length()-5,5,"-debug.root");
139 void AliLnDriver::PrintFilenames() const
142 // print filenames to stdout
147 cout << "input data : " << fInputData << endl;
148 cout << "input simulation : " << fInputSimu << endl;
149 cout << "input simu. fix : " << fInputSimuFix << endl;
151 cout << "corrections : " << fOutputPtCorr << endl;
152 cout << "corrections debug : " << fOutputPtCorrDebug << endl;
154 cout << "output pt : " << fOutputPt << endl;
155 cout << "output pt debug : " << fOutputPtDebug << endl;
156 cout << "output ratio : " << fOutputRatio << endl;
157 cout << "output spectra : " << fOutputSpectra << endl;
161 void AliLnDriver::SetTriggerEfficiency(Double_t eff[3])
164 // set trigger efficiency
166 for(Int_t i=0; i<3; ++i) fTrigEff[i] = eff[i];
169 void AliLnDriver::SetInelXSection(Double_t xsec[3])
172 // set total cross section, stat. and syst. errors
174 for(Int_t i=0; i<3; ++i) fXsec[i] = xsec[i];
177 Int_t AliLnDriver::Run() const
182 if(!fIsOnlyGen && fMakeCorr) this->MakePtCorr();
184 if(fMakePt) this->MakePt();
186 if(fMakeRatio) this->MakeRatio();
188 if(fMakeSpectra) this->MakeSpectra();
193 void AliLnDriver::MakePtCorr() const
196 // make pt correction file
198 const Int_t kNpart = 2;
199 const TString kParticle[kNpart] = {fSpecies, Form("Anti%s",fSpecies.Data())};
203 for(Int_t i=0; i<kNpart; ++i)
205 TString outputfile1 = kParticle[i] + "-corrections.root";
206 TString outputfile2 = Form("debug-%s", outputfile1.Data());
208 AliLnCorr lncorr(kParticle[i], fInputData, fInputSimu, fInputSimuFix, outputfile1, fOutputCorTag);
210 lncorr.GetLnSecondaries()->SetCorBins(fLowPtBin, fHiPtBin);
211 lncorr.GetLnSecondaries()->SetProcedure(fSecProd);
212 lncorr.GetLnSecondaries()->SetMatDCAxyModel(fMatDCAxyMod);
213 lncorr.GetLnSecondaries()->SetAntiNucleusAsTemplate(fANucTemplate);
214 lncorr.GetLnSecondaries()->SetDCAxyInterval(fMinDCAxy, fMaxDCAxy);
215 lncorr.GetLnSecondaries()->SetNBin(fNbin);
216 lncorr.GetLnSecondaries()->SetScalingFactors(fScMat, fScFd);
218 lncorr.GetLnEfficiency()->SetG3Fluka(fG3Fluka);
222 m1.AddFile(outputfile1.Data(),0);
223 m2.AddFile(outputfile2.Data(),0);
226 // merge and remove tmp files
228 m1.OutputFile(fOutputPtCorr.Data());
231 gSystem->Exec(Form("rm -f %s-corrections.root Anti%s-corrections.root", fSpecies.Data(), fSpecies.Data()));
233 m2.OutputFile(fOutputPtCorrDebug.Data());
236 gSystem->Exec(Form("rm -f debug-%s-corrections.root debug-Anti%s-corrections.root", fSpecies.Data(), fSpecies.Data()));
239 void AliLnDriver::MakePt() const
242 // make pt from data and correction file
244 const Int_t kNpart = 2;
246 const TString kParticle[kNpart] = { fSpecies, Form("Anti%s",fSpecies.Data())};
250 for(Int_t i=0; i<kNpart; ++i)
252 TString ptfile = kParticle[i] + "-Pt.root";
254 AliLnPt lnpt(kParticle[i], fTrigEff[0], fInputData, ptfile, fOutputTag, fOutputPtCorr, fOutputCorTag);
256 lnpt.SetOnlyGeneration(fIsOnlyGen);
257 lnpt.SetRapidityInterval(fYMin, fYMax);
259 lnpt.SetPtBinInterval(fLowPtBin, fHiPtBin);
260 lnpt.SetM2BinInterval(fLowM2Bin, fHighM2Bin);
261 lnpt.SetM2BkgInterval(fMinM2Bkg, fMaxM2Bkg);
262 lnpt.SetM2TPCInterval(fMinM2tpc, fMaxM2tpc);
263 lnpt.SetPidM2(fPidM2);
264 lnpt.SetUnfolding(fUnfolding, fNIter);
265 lnpt.SetFakeTracks(fFakeTracks);
266 lnpt.SetSecondaries(fSecondaries);
267 lnpt.SetEfficiency(fEfficiency);
268 lnpt.SetMakeStats(fMakeStats);
269 lnpt.SetVertexCorrection(fVtxCorr, fVtxCorrVal);
270 lnpt.SetFitFractionCorr(fFitFrac);
271 lnpt.SetFeedDownCorr(fFdwnCorr);
272 lnpt.SetSameFeedDownCorr(fSameFdwn);
276 m.AddFile(ptfile.Data(),0);
277 if(!fIsOnlyGen) m2.AddFile(Form("debug-%s",ptfile.Data()),0);
280 // merge and remove tmp files
282 m.OutputFile(fOutputPt.Data());
285 gSystem->Exec(Form("rm -f %s-Pt.root Anti%s-Pt.root", fSpecies.Data(), fSpecies.Data()));
289 m2.OutputFile(fOutputPtDebug.Data());
292 gSystem->Exec(Form("rm -f debug-%s-Pt.root debug-Anti%s-Pt.root", fSpecies.Data(),fSpecies.Data()));
296 void AliLnDriver::MakeRatio() const
299 // make antiparticle/particle ratio
301 AliLnRatio lnr(fSpecies, fOutputPt, fOutputTag, fOutputRatio, fOutputTag);
306 void AliLnDriver::MakeSpectra() const
309 // make differential yields
313 const TString kParticle[] = { fSpecies, Form("Anti%s",fSpecies.Data())};
314 const Double_t kSysErr[] = { fSysPos, fSysNeg };
316 for(Int_t i=0; i<2; ++i)
318 TString spectrafile = kParticle[i] + "-Spectra.root";
320 AliLnSpectra lnspectra(kParticle[i], fOutputPt, fOutputTag, spectrafile, fOutputTag, fXsec);
322 lnspectra.SetRapidityInterval(fYMin, fYMax);
323 lnspectra.SetNormalizeToINEL(fNormToInel);
324 lnspectra.SetOnlyGeneration(fIsOnlyGen);
325 lnspectra.SetScalingFactor(kSysErr[i]);
329 m.AddFile(spectrafile.Data(),0);
332 // merge and remove tmp files
334 m.OutputFile(fOutputSpectra.Data());
337 gSystem->Exec(Form("rm -f %s-Spectra.root Anti%s-Spectra.root", fSpecies.Data(), fSpecies.Data()));