2 #include "AliMCEvent.h" 3 #include "AliESDEvent.h" 8 #include "AliGenEventHeader.h" 46 if (!useTuple)
return;
48 fTuple =
new TNtuple(
"hits",
"Hits",
49 "primary:eta:phi:edep:length:" 50 "detector:ring:sector:strip:ipz");
61 DGUARD(
fDebug, 2,
"Create output objects w/MC hits (%p)", dir);
69 DGUARD(
fDebug, 5,
"Reset for event w/MC hits (%p)", &mcInput);
73 AliMCEvent& mc =
const_cast<AliMCEvent&
>(mcInput);
74 AliHeader* header = mc.Header();
75 AliStack*
stack = mc.Stack();
76 AliGenEventHeader* genHeader = header->GenEventHeader();
78 genHeader->PrimaryVertex(
fIp);
88 const AliMCEvent& mcInput,
91 DGUARD(
fDebug, 5,
"Process an event for MC hits (%p,%p,%p)",
92 &esdInput, &mcInput, &handler);
96 DMSG(
fDebug,5,
"We got a total of %d particles", nEntries);
98 for (
Int_t i = 0; i < nEntries; i++) {
110 const TClonesArray& hits)
112 DGUARD(
fDebug, 5,
"Accumulate MC hit energy loss (%p,%p,%d)",
113 &mcInput, &hits, hits.GetEntries());
115 AliStack*
stack =
const_cast<AliMCEvent&
>(mcInput).Stack();
117 Int_t nHit = hits.GetEntries();
121 for (
Int_t j = 0; j < nHit; j++) {
124 AliFMDHit* hit =
static_cast<AliFMDHit*
>(hits.At(j));
128 if (
fTuple)
for (
Int_t k = 0; k < 10; k++) cache[k] = 0;
131 Int_t iTr = hit->Track();
133 AliWarningF(
"Track # %d seems out of bounds [0,%d]",
137 AliMCParticle* particle =
138 static_cast<AliMCParticle*
>(mcInput.GetTrack(iTr));
146 if (!particle->Charge() != 0)
continue;
155 Double_t r = TMath::Sqrt(x*x + y*y);
157 Double_t theta = TMath::ATan2(r, z);
158 Double_t eta = -TMath::Log(TMath::Tan(theta/2));
164 Bool_t isDistinct = (iTr != oldTr) || (det != oldD) || (rng != oldR);
167 h->
fKind->Fill(eta, isPrimary ? .5 : 1.5);
175 sum(det, rng, sec, str) += eloss;
177 Info(
"",
"FMD%d%c[%02d,%03d]-%s: Adding %10.7f to %10.7f -> %10.7f",
178 det, rng, sec, str, (isPrimary ?
"1st" :
"2nd"),
179 eloss, old, sum(det, rng, sec, str));
184 cache[0] = isPrimary ? 1 : 0;
189 cache[5] = hit->Detector();
190 cache[6] =
Int_t(hit->Ring());
191 cache[7] = hit->Sector();
192 cache[8] = hit->Strip();
202 DGUARD(
fDebug, 5,
"Convert MC hit energy loss (%p)", &input);
210 Char_t r = (q == 0 ?
'I' :
'O');
219 Float_t totAll = totPrim + totSec;
220 Double_t esdEta = esdFMD->Eta(d, r, s, t);
221 if (totAll > 0) h->
FillMC(0, esdEta, totAll);
222 if (totPrim > 0) h->
FillMC(1, esdEta, totPrim);
223 if (totSec > 0) h->
FillMC(2, esdEta, totSec);
280 fHist =
Make(
"eloss",
"#sum#Delta_{true} of all",
281 eAxis, maxDE, nDEbins, useIncrBin);
282 fPrimary =
Make(
"primary",
"#sum#Delta_{true} of primaries",
283 eAxis, maxDE, nDEbins, useIncrBin);
285 eAxis, maxDE, nDEbins, useIncrBin);
286 fHist->SetXTitle(
"#Delta_{true}");
288 fPrimary->SetXTitle(
"#Delta_{true}");
291 if (eAxis.GetXbins()->GetArray())
292 fKind =
new TH2I(
"kind",
"Particle types",
293 eAxis.GetNbins(), eAxis.GetXbins()->GetArray(),
296 fKind =
new TH2I(
"kind",
"Particle types",
297 eAxis.GetNbins(), eAxis.GetXmin(), eAxis.GetXmax(),
299 fKind->SetXTitle(
"#eta");
300 fKind->GetYaxis()->SetBinLabel(1,
"Primary");
301 fKind->GetYaxis()->SetBinLabel(2,
"Secondary");
302 fKind->SetDirectory(0);
318 case 0:
fHist->Fill(eta, mult);
break;
319 case 1:
fPrimary->Fill(eta, mult);
break;
338 minusBins, relErrorCut, chi2nuCut, minWeight,
339 regCut, residuals,
false, 0);
341 minusBins, relErrorCut, chi2nuCut, minWeight,
342 regCut, residuals,
false, 0);
344 minEntries, minusBins, relErrorCut, chi2nuCut,
345 minWeight, regCut, residuals,
false, 0);
346 if (!all || !prim || !sec) {
347 AliWarningF(
"Failed to get results for all(%p), primary(%p), and/or " 348 "secondary(%p)", all, prim, sec);
356 Int_t nPrim = prim->GetEntriesFast();
358 for (
Int_t i = 0; i < nPrim; i++) {
359 TH1* h =
static_cast<TH1*
>(prim->At(i));
362 TAxis* xAxis = h->GetXaxis();
364 if (xAxis->GetXbins()->GetArray())
365 hh =
new TH2D(h->GetName(), h->GetTitle(),
366 xAxis->GetNbins(), xAxis->GetXbins()->GetArray(),
369 hh =
new TH2D(h->GetName(), h->GetTitle(),
370 xAxis->GetNbins(), xAxis->GetXmin(), xAxis->GetXmax(),
372 hh->GetYaxis()->SetBinLabel(1,
"Primary");
373 hh->GetYaxis()->SetBinLabel(2,
"Secondary");
374 hh->GetYaxis()->SetBinLabel(3,
"All");
375 hh->GetXaxis()->SetTitle(
"#eta");
378 for (
Int_t i = 0; i < nPrim; i++) {
379 TH2* h =
static_cast<TH2*
>(out->At(i));
382 TH1* hp =
static_cast<TH1*
>(prim->At(i));
383 TH1* hs =
static_cast<TH1*
>(sec->At(i));
384 TH1* ha =
static_cast<TH1*
>(all->At(i));
385 TH1* hh[] = { hp, hs, ha };
386 for (
Int_t j = 0; j < 3; j++) {
390 for (
Int_t k = 1; k <= ph->GetNbinsX(); k++) {
393 h->SetBinContent(k, j+1, c);
394 h->SetBinError(k, j+1, e);
401 out->SetName(
"compartive");
virtual Bool_t AccumulateHits(const AliMCEvent &mcInput, const TClonesArray &hits)
EResidualMethod fResidualMethod
virtual void SetupForData(const TAxis &eAxis, const TAxis &cAxis, Double_t maxDE=10, Int_t nDEbins=300, Bool_t useIncrBin=true)
Bool_t fUseIncreasingBins
virtual Bool_t PostEvent(const AliESDEvent &esdInput)
virtual void CreateOutputObjects(TList *dir)
AliFMDMCHitEnergyFitter()
static const Spec & GetdEAxis()
#define DMSG(L, N, F,...)
virtual void FillMC(UShort_t flag, Double_t eta, Double_t mult)
AliFMDEnergyFitter::RingHistos * CreateRingHistos(UShort_t d, Char_t r) const
AliFMDFloatMap fSumSecondary
TH2 * Make(const char *name, const char *title, const TAxis &eAxis, Double_t deMax=12, Int_t nDeBins=300, Bool_t incr=true)
TArrayD MakeIncreasingAxis(Int_t nBins, Double_t low, Double_t high) const
virtual void CreateOutputObjects(TList *dir)
virtual Bool_t PreEvent(const AliMCEvent &mcInput)
void FillBinArray(TArrayD &a) const
Class to encode the energy loss and path length of a particle into track reference bits...
#define DGUARD(L, N, F,...)
AliFMDFloatMap fSumPrimary
virtual ~AliFMDMCHitEnergyFitter()
RingHistos * GetRingHistos(UShort_t d, Char_t r) const
virtual TObjArray * FitSlices(TList *dir, const char *name, Double_t lowCut, UShort_t nParticles, UShort_t minEntries, UShort_t minusBins, Double_t relErrorCut, Double_t chi2nuCut, Double_t minWeight, Double_t regCut, EResidualMethod residuals, Bool_t scaleToPeak=true, TObjArray *best=0) const
TObjArray * Fit(TList *dir, Double_t lowCut, UShort_t nParticles, UShort_t minEntries, UShort_t minusBins, Double_t relErrorCut, Double_t chi2nuCut, Double_t minWeight, Double_t regCut, EResidualMethod residuals) const
TList * GetOutputList(const TList *d) const
virtual Bool_t Event(const AliESDEvent &esdInput, const AliMCEvent &mcInput, AliMCAuxHandler &handler)
TClonesArray * GetEntryArray(Int_t entry)