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"
33 #include "AliLnDriver.h"
39 AliLnDriver::AliLnDriver()
41 , fSpecies("Deuteron")
56 , fSecProc(AliLnSecondaries::kTFractionFitter)
57 , fMatDCAxyMod(AliLnSecondaries::kGeantDCAxy)
79 , fOutputPtCorrDebug()
86 , fPidProc(AliLnPt::kMassSquared)
93 for(Int_t i=0; i<3; ++i)
98 gErrorIgnoreLevel = kWarning;
99 // gErrorIgnoreLevel = kPrint, kInfo, kWarning, kError, kBreak, kSysError, kFatal;
102 AliLnDriver::~AliLnDriver()
109 void AliLnDriver::SetInputFilenames(const TString& data, const TString& simu, const TString& simuFix, const TString& ptcorr)
112 // input filenames to get the pt
116 fInputSimuFix = simuFix;
117 fOutputPtCorr = ptcorr;
119 fOutputPtCorrDebug = ptcorr;
120 fOutputPtCorrDebug.Replace(ptcorr.Length()-5,5,"-debug.root");
123 void AliLnDriver::SetOutputFilenames(const TString& pt, const TString& ratio, const TString& spectra)
130 fOutputSpectra=spectra;
133 fOutputPtDebug.Replace(pt.Length()-5,5,"-debug.root");
136 void AliLnDriver::SetTriggerEfficiency(Double_t eff[3])
139 // set trigger efficiency
141 for(Int_t i=0; i<3; ++i) fTrigEff[i] = eff[i];
144 Int_t AliLnDriver::Run() const
151 if(!fIsOnlyGen && fMakeCorr)
156 cout << "********* Rebuild corrections ***********" << endl;
157 cout << "Species : " << fSpecies << endl;
158 cout << "Simulation file : " << fInputSimu << endl;
159 cout << "Simulation file (fix) : " << fInputSimuFix << endl;
160 cout << "Output file : " << fOutputPtCorr << endl;
161 cout << "Output file (debug) : " << fOutputPtCorrDebug << endl;
173 cout << "********* Make pt ***********" << endl;
174 cout << "Species : " << fSpecies << endl;
175 cout << "pt interval (GeV/c) : (" << fPtMin << ", " << fPtMax << ")" << endl;
176 cout << "pid pt (GeV/c) : " << fPidPt << endl;
177 cout << "Input file : " << fInputData << endl;
178 cout << "Correction file : " << fOutputPtCorr << endl;
179 cout << "Output file : " << fOutputPt << endl;
180 cout << "Output file (debug) : " << fOutputPtDebug << endl;
192 cout << "********* Make ratio ***********" << endl;
193 cout << "Species : " << fSpecies << endl;
194 cout << "Input file : " << fOutputPt << endl;
195 cout << "Output file : " << fOutputRatio << endl;
207 cout << "********* Make spectra ***********" << endl;
208 cout << "Species : " << fSpecies << endl;
209 cout << "INEL extrapolation : " << fINEL << endl;
210 cout << "Rapidity interval : (" << fYMin << ", " << fYMax << ")" << endl;
211 cout << "Input file : " << fOutputPt << endl;
212 cout << "Output file : " << fOutputSpectra << endl;
222 void AliLnDriver::MakePtCorr() const
225 // make pt correction file
227 const Int_t kNpart = 2;
228 const TString kParticle[kNpart] = {fSpecies, Form("Anti%s",fSpecies.Data())};
232 for(Int_t i=0; i<kNpart; ++i)
234 TString outputfile1 = kParticle[i] + "-corrections.root";
235 TString outputfile2 = Form("debug-%s", outputfile1.Data());
237 AliLnCorr lncorr(kParticle[i], fInputData, fInputSimu, fInputSimuFix, outputfile1, fOutputCorTag);
239 lncorr.GetLnSecondaries()->SetCorBins(fPtMin, fPtMax);
240 lncorr.GetLnSecondaries()->SetProcedure(fSecProc);
241 lncorr.GetLnSecondaries()->SetMatDCAxyModel(fMatDCAxyMod);
242 lncorr.GetLnSecondaries()->SetAntiNucleusAsTemplate(fANucTemplate);
243 lncorr.GetLnSecondaries()->SetDCAxyInterval(fMinDCAxy, fMaxDCAxy);
244 lncorr.GetLnSecondaries()->SetNBin(fNbin);
245 lncorr.GetLnSecondaries()->SetScalingFactors(fScMat, fScFd);
246 lncorr.GetLnSecondaries()->SetAddFakeTracks(fAddFakeTracks);
248 lncorr.GetLnEfficiency()->SetG3Fluka(fG3Fluka);
249 lncorr.GetLnEfficiency()->SetAddFakeTracks(fAddFakeTracks);
253 m1.AddFile(outputfile1.Data(),0);
254 m2.AddFile(outputfile2.Data(),0);
257 // merge and remove tmp files
259 m1.OutputFile(fOutputPtCorr.Data());
262 gSystem->Exec(Form("rm -f %s-corrections.root Anti%s-corrections.root", fSpecies.Data(), fSpecies.Data()));
264 m2.OutputFile(fOutputPtCorrDebug.Data());
267 gSystem->Exec(Form("rm -f debug-%s-corrections.root debug-Anti%s-corrections.root", fSpecies.Data(), fSpecies.Data()));
270 void AliLnDriver::MakePt() const
273 // make pt from data and correction file
275 const Int_t kNpart = 2;
277 const TString kParticle[kNpart] = { fSpecies, Form("Anti%s",fSpecies.Data())};
281 for(Int_t i=0; i<kNpart; ++i)
283 TString ptfile = kParticle[i] + "-Pt.root";
285 AliLnPt lnpt(kParticle[i], fTrigEff[0], fInputData, ptfile, fOutputTag, fOutputPtCorr, fOutputCorTag);
287 lnpt.SetOnlyGeneration(fIsOnlyGen);
289 lnpt.SetPtInterval(fPtMin, fPtMax);
291 lnpt.SetPidProcedure(fPidProc);
292 lnpt.SetPidPt(fPidPt);
293 lnpt.SetBkgInterval(fBkgMin, fBkgMax);
294 lnpt.SetPidInterval(fIntMin, fIntMax);
295 lnpt.SetSecondaries(fSecondaries);
296 lnpt.SetEfficiency(fEfficiency);
297 lnpt.SetMakeStats(fMakeStats);
298 lnpt.SetMCtoINEL(fMCtoINEL);
299 lnpt.SetFitFractionCorr(fFitFrac);
300 lnpt.SetFeedDownCorr(fFdwnCorr);
301 lnpt.SetSameFeedDownCorr(fSameFdwn);
302 lnpt.SetPidEfficiency(fPidEff);
303 lnpt.SetDebugLevel(fDebugLevel);
307 m.AddFile(ptfile.Data(),0);
308 if(!fIsOnlyGen) m2.AddFile(Form("debug-%s",ptfile.Data()),0);
311 // merge and remove tmp files
313 m.OutputFile(fOutputPt.Data());
316 gSystem->Exec(Form("rm -f %s-Pt.root Anti%s-Pt.root", fSpecies.Data(), fSpecies.Data()));
320 m2.OutputFile(fOutputPtDebug.Data());
323 gSystem->Exec(Form("rm -f debug-%s-Pt.root debug-Anti%s-Pt.root", fSpecies.Data(),fSpecies.Data()));
327 void AliLnDriver::MakeRatio() const
330 // make antiparticle/particle ratio
332 AliLnRatio lnr(fSpecies, fOutputPt, fOutputTag, fOutputRatio, fOutputTag);
337 void AliLnDriver::MakeSpectra() const
340 // make differential yields
344 const TString kParticle[2] = { fSpecies, Form("Anti%s",fSpecies.Data())};
346 for(Int_t i=0; i<2; ++i)
348 TString spectrafile = kParticle[i] + "-Spectra.root";
350 AliLnSpectra lnspectra(kParticle[i], fOutputPt, fOutputTag, spectrafile, fOutputTag);
352 lnspectra.SetRapidityInterval(fYMin, fYMax);
353 lnspectra.SetExtrapolateToINEL(fINEL);
357 m.AddFile(spectrafile.Data(),0);
360 // merge and remove tmp files
362 m.OutputFile(fOutputSpectra.Data());
365 gSystem->Exec(Form("rm -f %s-Spectra.root Anti%s-Spectra.root", fSpecies.Data(), fSpecies.Data()));