1 /*************************************************************************
2 * Copyright(c) 1998-2008, 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 ///////////////////////////////////////////////////////////////////////////
17 // Class AliTrackletTaskMultipp //
18 // Analysis task to produce data and MC histos needed for tracklets //
19 // dNdEta extraction in multiple bins in one go //
20 // Author: ruben.shahoyan@cern.ch //
21 ///////////////////////////////////////////////////////////////////////////
23 Important parameters to set:
24 1) make sure to initialize correct geometry in UserCreateOutputObjects
25 2) The cut on signal selection variable (delta, dphi ...) should be decided beforehand
35 #include "THnSparse.h"
38 #include "TObjArray.h"
39 #include "TGeoGlobalMagField.h"
41 #include "AliAnalysisManager.h"
43 #include "AliMultiplicity.h"
44 #include "AliESDEvent.h"
45 #include "AliESDInputHandler.h"
46 #include "AliESDInputHandlerRP.h"
47 #include "../ANALYSIS/EventMixing/AliMixEventInputHandler.h"
48 #include "AliCDBPath.h"
49 #include "AliCDBManager.h"
50 #include "AliCDBEntry.h"
51 #include "AliCDBStorage.h"
52 #include "AliGeomManager.h"
54 #include "AliESDVZERO.h"
55 #include "AliESDZDC.h"
56 #include "AliRunLoader.h"
57 #include "AliMCEventHandler.h"
58 #include "AliMCEvent.h"
59 #include "AliMCParticle.h"
61 #include "AliGenEventHeader.h"
62 #include "AliCentrality.h"
63 #include "../ITS/AliITSRecPoint.h"
64 #include "../ITS/AliITSgeomTGeo.h"
65 #include "../ITS/AliITSMultReconstructor.h"
66 #include "../ITS/AliITSsegmentationSPD.h"
70 #include "AliPhysicsSelection.h"
71 #include "AliTrackletTaskMultipp.h"
72 #include "AliITSMultRecBg.h"
73 #include "AliGenEventHeader.h"
74 #include "AliGenHijingEventHeader.h"
75 #include "AliGenDPMjetEventHeader.h"
76 #include "AliESDtrackCuts.h"
78 ClassImp(AliTrackletTaskMultipp)
80 // centrality percentile (inverted: 100% - most central)
81 const Float_t AliTrackletTaskMultipp::fgkCentPerc[] = {0,100};//{0,5,10,20,30};
82 //const Float_t AliTrackletTaskMultipp::fgkCentPerc[] = {0,5,10,20,30,40};
83 //{0,10,20,30,40,50,60,70,80,90,95,101};
85 const char* AliTrackletTaskMultipp::fgkCentSelName[] = {"V0M","FMD","TRK","TKL","CL0","CL1","V0MvsFMD","TKLvsV0M","ZENvsZDC"};
87 const char* AliTrackletTaskMultipp::fgkPDGNames[] = {
138 const int AliTrackletTaskMultipp::fgkPDGCodes[] = {
189 //________________________________________________________________________
190 /*//Default constructor
191 AliTrackletTaskMultipp::AliTrackletTaskMultipp(const char *name)
192 : AliAnalysisTaskSE(name),
194 //________________________________________________________________________
195 AliTrackletTaskMultipp::AliTrackletTaskMultipp(const char *name)
196 : AliAnalysisTaskSE(name),
200 fDoNormalReco(kFALSE),
201 fDoInjection(kFALSE),
206 fCheckReconstructables(kFALSE),
218 fHistosTrRcblPrim(0),
227 fScaleDTBySin2T(kFALSE),
228 fCutOnDThetaX(kFALSE),
231 fDThetaWindow(0.025),
233 fPhiOverlapCut(0.005),
237 fRemoveOverlaps(kFALSE),
253 fUseCentralityVar(kCentV0M)
257 DefineOutput(1, TList::Class());
259 SetScaleDThetaBySin2T();
271 //________________________________________________________________________
272 AliTrackletTaskMultipp::~AliTrackletTaskMultipp()
275 // histograms are in the output list and deleted when the output
276 // list is deleted by the TSelector dtor
277 if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { //RRR
278 printf("Deleteing output\n");
284 delete fHistosTrData;
285 delete fHistosTrPrim;
287 delete fHistosTrComb;
288 delete fHistosTrCombU;
292 delete fHistosTrRcblPrim;
293 delete fHistosTrRcblSec;
294 delete fHistosCustom;
298 //________________________________________________________________________
299 void AliTrackletTaskMultipp::UserCreateOutputObjects()
302 fOutput = new TList();
306 Bool_t needGeom = GetDoNormalReco() || GetDoInjection() || GetDoRotation() || GetDoMixing();
308 AliCDBManager *man = AliCDBManager::Instance();
310 Bool_t newGeom = kTRUE;
311 man->SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Residual");
314 AliCDBEntry* obj = man->Get("GRP/Geometry/Data",130844,8);
315 AliGeomManager::SetGeometry((TGeoManager*) obj->GetObject());
316 if (!AliGeomManager::ApplyAlignObjsToGeom("ITS",130844,6,-1)) AliFatal("Failed to misalign geometry");
320 AliCDBEntry* obj = man->Get("GRP/Geometry/Data",130845,7);
321 AliGeomManager::SetGeometry((TGeoManager*) obj->GetObject());
322 if (!AliGeomManager::ApplyAlignObjsToGeom("ITS",130845,5,-1)) AliFatal("Failed to misalign geometry");
326 man->SetDefaultStorage("alien://Folder=/alice/data/2010/OCDB"); //man->SetRun(137366);
327 AliCDBEntry* obj = man->Get("GRP/Geometry/Data",137366);
328 AliGeomManager::SetGeometry((TGeoManager*) obj->GetObject());
329 if (!AliGeomManager::ApplyAlignObjsToGeom("ITS",137366,-1,-1)) AliFatal("Failed to misalign geometry");
334 fNCentBins = sizeof(fgkCentPerc)/sizeof(Float_t)-1;
335 //---------------------------------------------Standard histos per tracklet type--->>
336 UInt_t hPattern = 0xffffffff;
337 fHistosTrData = BookHistosSet("TrData",hPattern);
338 hPattern &= ~(BIT(kHEtaZvSPD1)); // fill single clusters for "data" only
339 if (GetDoInjection()) fHistosTrInj = BookHistosSet("TrInj",hPattern);
340 if (GetDoRotation()) fHistosTrRot = BookHistosSet("TrRot",hPattern);
341 if (GetDoMixing()) fHistosTrMix = BookHistosSet("TrMix",hPattern);
343 fHistosTrPrim = BookHistosSet("TrPrim",hPattern);
344 fHistosTrSec = BookHistosSet("TrSec",hPattern);
345 fHistosTrComb = BookHistosSet("TrComb",hPattern);
346 fHistosTrCombU = BookHistosSet("TrCombU",hPattern);
347 if (fCheckReconstructables) {
348 fHistosTrRcblPrim = BookHistosSet("TrRcblPrim",hPattern);
349 fHistosTrRcblSec = BookHistosSet("TrRcblSec",hPattern);
352 //---------------------------------------------Standard histos per tracklet type---<<
354 //---------------------------------------------Custom Histos----------------------->>
355 // put here any non standard histos
356 fHistosCustom = BookCustomHistos();
358 //---------------------------------------------Custom Histos-----------------------<<
359 int nhist = fOutput->GetEntries();
360 for (int i=0;i<nhist;i++) {
361 TObject* hst = fOutput->At(i);
362 if (!hst || !(hst->InheritsFrom(TH1::Class()))) continue;
363 ((TH1*)hst)->Sumw2();
366 if (fUseCentralityVar<0||fUseCentralityVar>kNCentTypes) {
367 printf("Wrong centrality type %d\n",fUseCentralityVar);
370 AliInfo(Form("Centrality type selected: %s\n",fgkCentSelName[fUseCentralityVar]));
371 PostData(1, fOutput);
375 //________________________________________________________________________
376 void AliTrackletTaskMultipp::UserExec(Option_t *)
380 Bool_t needRecPoints = GetDoNormalReco() || GetDoInjection() || GetDoRotation() || GetDoMixing();
382 AliAnalysisManager* anMan = AliAnalysisManager::GetAnalysisManager();
383 fRPTree = fRPTreeMix = 0;
384 AliESDInputHandler *handler = (AliESDInputHandler*)anMan->GetInputEventHandler();
385 AliESDInputHandlerRP *handRP = 0;
387 handRP = (AliESDInputHandlerRP*)handler;
388 if (!handRP) { printf("No RP handler\n"); return; }
390 AliESDEvent *esd = handler->GetEvent();
391 if (!esd) { printf("No AliESDEvent\n"); return; }
393 // do we need to initialize the field?
394 AliMagF* field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
395 if (!field && !esd->InitMagneticField()) {printf("Failed to initialize the B field\n");return;}
398 TH1* hstat = (TH1*)fHistosCustom->UncheckedAt(kHStat);
399 hstat->Fill(kEvTot0); // RS
400 const AliESDVertex* vtxESD = esd->GetPrimaryVertexSPD();
401 const AliMultiplicity* multESD = esd->GetMultiplicity();
403 if (vtxESD->GetNContributors()<1) return;
404 TString vtxTyp = vtxESD->GetTitle();
405 if (vtxTyp.Contains("vertexer: Z")) {
406 if (vtxESD->GetDispersion()>0.04) return;
407 if (vtxESD->GetZRes()>0.25) return;
410 AliCentrality *centrality = esd->GetCentrality();
412 hstat->Fill(kEvTot); // RS
415 vtxESD->GetXYZ(esdvtx);
416 for (int i=3;i--;) fESDVtx[i] = esdvtx[i];
418 float vtxf[3] = {vtxESD->GetX(),vtxESD->GetY(),vtxESD->GetZ()};
420 // registed Ntracklets and ZVertex of the event
421 ((TH1*)fHistosCustom->UncheckedAt(kHZVtxNoSel))->Fill(esdvtx[2]);
423 if(vtxf[2] < fZVertexMin || vtxf[2] > fZVertexMax) return;
425 // centrality->Dump();
427 AliESDVZERO* esdV0 = esd->GetVZEROData();
429 multV0 = esdV0->GetMTotV0A()+esdV0->GetMTotV0C();
430 if (fUseMC) multV0 *= fMCV0Scale;
432 ((TH1*)fHistosCustom->UncheckedAt(kHV0NoSel))->Fill(multV0);
434 float nSPD2 = multESD->GetNumberOfITSClusters(1);
435 ((TH1*)fHistosCustom->UncheckedAt(kHNClSPD2NoSel))->Fill(nSPD2);
437 //------------------------------------------------------
438 AliESDZDC *esdZDC = esd->GetESDZDC();
439 float zdcEnergy=0,zemEnergy=0;
441 zdcEnergy = (esdZDC->GetZDCN1Energy() + esdZDC->GetZDCP1Energy() + esdZDC->GetZDCN2Energy()+ esdZDC->GetZDCP2Energy());
442 zemEnergy = (esdZDC->GetZDCEMEnergy(0)+esdZDC->GetZDCEMEnergy(1))/8.;
444 ((TH2*)fHistosCustom->UncheckedAt(kHZDCZEMNoSel))->Fill(zemEnergy,zdcEnergy);
446 Float_t centPercentile = centrality->GetCentralityPercentileUnchecked(fgkCentSelName[fUseCentralityVar]);
448 // temporary >>>>>>>>>>>>>>>>>>>>>>>>
449 if (fUseCentralityVar==kCentZEMvsZDC) {
450 float zdcEn = zdcEnergy;
451 float zemEn = zemEnergy;
453 Float_t zdcPercentile;
455 slope = (zdcEn + 15000.)/(zemEn - 295.);
456 slope += 2.23660e+02;
457 zdcPercentile = (TMath::ATan(slope) - 1.56664)/8.99571e-05;
458 if (zdcPercentile<0) zdcPercentile = 0;
460 else zdcPercentile = 100;
461 centPercentile = zdcPercentile;
463 // temporary >>>>>>>>>>>>>>>>>>>>>>>>
465 fCurrCentBin = GetCentralityBin(centPercentile);
467 // printf("CentPerc: %f : Bin %d\n",centPercentile, fCurrCentBin);
468 if (fCurrCentBin<0) {
469 //printf("Reject: %.1f : V0:%.1f V0Cor:%.1f V0CR:%.1f SPD2c:%.1f\n",mltTst, multV0,multV0Corr,multV0CorrResc,nSPD2Corr);
473 ((TH1*)fHistosCustom->UncheckedAt(kHStatCentBin))->Fill(fCurrCentBin);
474 ((TH1*)fHistosCustom->UncheckedAt(kHStatCent))->Fill(centPercentile);
476 AliMCEventHandler* eventHandler = 0;
481 eventHandler = (AliMCEventHandler*)anMan->GetMCtruthEventHandler();
482 if (!eventHandler) { printf("ERROR: Could not retrieve MC event handler\n"); return; }
483 fMCevent = eventHandler->MCEvent();
484 if (!fMCevent) { printf("ERROR: Could not retrieve MC event\n"); return; }
485 fStack = fMCevent->Stack();
486 if (!fStack) { printf("Stack not available\n"); return; }
490 fRPTree = handRP->GetTreeR("ITS");
491 if (!fRPTree) { AliError(" Invalid ITS cluster tree !\n"); return; }
494 // =============================================================================>>>
496 AliGenEventHeader* mcGenH = 0;
500 mcGenH = fMCevent->GenEventHeader();
501 if (mcGenH->InheritsFrom(AliGenHijingEventHeader::Class())) {
502 AliGenHijingEventHeader* hHijing = (AliGenHijingEventHeader*)mcGenH;
503 fNPart = (hHijing->ProjectileParticipants()+hHijing->TargetParticipants())/2.;
504 fNBColl = hHijing->NN()+hHijing->NNw()+hHijing->NwN()+hHijing->NwNw();
506 else if (mcGenH->InheritsFrom(AliGenDPMjetEventHeader::Class())) {
507 AliGenDPMjetEventHeader* hDpmJet = (AliGenDPMjetEventHeader*)mcGenH;
508 fNPart = (hDpmJet->ProjectileParticipants()+hDpmJet->TargetParticipants())/2.;
509 fNBColl = hDpmJet->NN()+hDpmJet->NNw()+hDpmJet->NwN()+hDpmJet->NwNw();
511 else {} // unknown generator
514 // register Ntracklets and ZVertex of the event
515 ((TH2*)fHistosCustom->UncheckedAt(kHZVtx))->Fill(esdvtx[2],fCurrCentBin);
516 ((TH2*)fHistosCustom->UncheckedAt(kHV0))->Fill(multV0,fCurrCentBin);
517 ((TH2*)fHistosCustom->UncheckedAt(kHNClSPD2))->Fill(nSPD2,fCurrCentBin);
518 ((TH3*)fHistosCustom->UncheckedAt(kHZDCZEM))->Fill(zemEnergy,zdcEnergy,fCurrCentBin);
520 if (fUseMC) FillMCPrimaries();
522 // normal reconstruction
523 hstat->Fill(kBinEntries+kEvProcData + kEntriesPerBin*fCurrCentBin);
525 if (GetDoNormalReco() || GetDoInjection()) { // for the injection the normal reco should be done
527 fMultReco->Run(fRPTree, vtxf);
528 printf("Multiplicity Reconstructed:\n");
529 AliMultiplicity* mlt = fMultReco->GetMultiplicity();
530 if (mlt) mlt->Print();
531 if (GetDoNormalReco()) FillHistos(kData,mlt);
535 if (!GetDoNormalReco()) {
536 FillHistos(kData,multESD); // fill data histos from ESD
537 FillClusterInfoFromMult(multESD, vtxf[2] );
538 FillClusterAutoCorrelationFromMult(multESD, vtxf[2]);
541 // Injection: it must come right after the normal reco since needs its results
542 if (GetDoInjection()) {
543 if (!fMultReco) InitMultReco(); // in principle, not needed, the reco is created above
544 fMultReco->SetRecType(AliITSMultRecBg::kBgInj);
545 fMultReco->Run(fRPTree, vtxf);
546 printf("Multiplicity from Injection:\n");
547 AliMultiplicity* mlt = fMultReco->GetMultiplicity();
548 if (mlt) mlt->Print();
549 hstat->Fill(kBinEntries + kEvProcInj + kEntriesPerBin*fCurrCentBin);
550 FillHistos(kBgInj,mlt);
554 if (GetDoRotation()) {
556 fMultReco->SetRecType(AliITSMultRecBg::kBgRot);
557 fMultReco->SetPhiRotationAngle(fPhiRot);
558 fMultReco->Run(fRPTree, vtxf);
559 printf("Multiplicity from Rotation:\n");
560 AliMultiplicity* mlt = fMultReco->GetMultiplicity();
561 if (mlt) mlt->Print();
562 hstat->Fill(kBinEntries + kEvProcRot + kEntriesPerBin*fCurrCentBin);
563 FillHistos(kBgRot,mlt);
568 AliMixEventInputHandler* handToMix = (AliMixEventInputHandler*)handRP->MixingHandler();
569 if (!handToMix) { printf("No Mixing handler\n"); return; }
570 handToMix->GetEntry();
571 if(handToMix->MixedEventNumber()<1) {printf("Mixing: No enough events in pool\n"); return;}
572 AliESDInputHandlerRP* handRPMix = (AliESDInputHandlerRP*) handToMix->InputEventHandler(0);
574 if (!handRPMix) { printf("No Mixing RP handler\n"); return; }
575 fRPTreeMix = handRPMix->GetTreeR("ITS");
576 if (!fRPTreeMix) { AliError(" Invalid ITS cluster tree of the 2nd event!\n"); return; }
578 AliESDEvent *esdMix = handRPMix->GetEvent();
579 const AliESDVertex* vtxESDmix = esdMix->GetVertex();
580 ((TH2*)fHistosCustom->UncheckedAt(kHZVtxMixDiff))->Fill(vtxESDmix->GetZ()-esdvtx[2],fCurrCentBin);
581 ((TH2*)fHistosCustom->UncheckedAt(kHNTrMixDiff) )->
582 Fill(esdMix->GetMultiplicity()->GetNumberOfTracklets() - multESD->GetNumberOfTracklets(),fCurrCentBin);
585 fMultReco->SetRecType(AliITSMultRecBg::kBgMix);
586 fMultReco->Run(fRPTree, vtxf,fRPTreeMix);
587 printf("Multiplicity from Mixing:\n");
588 AliMultiplicity* mlt = fMultReco->GetMultiplicity();
589 if (mlt) mlt->Print();
590 hstat->Fill(kBinEntries + kEvProcMix + kEntriesPerBin*fCurrCentBin);
591 FillHistos(kBgMix,mlt);
595 // =============================================================================<<<
597 if (fMultReco) delete fMultReco;
603 //________________________________________________________________________
604 void AliTrackletTaskMultipp::Terminate(Option_t *)
607 Printf("Terminating...");
609 TList *lst = dynamic_cast<TList*>(GetOutputData(1));
610 printf("Term: %p %p %p\n",fOutput,lst,fHistosCustom);
611 if (lst && (hstat=(TH1*)lst->FindObject("hStat"))) {
612 Info("Terminate","Registering used settings");
613 // fill used settings
614 hstat->Fill(kOneUnit,1.);
615 hstat->Fill(kCentVar,fUseCentralityVar);
616 hstat->Fill(kDPhi,fDPhiWindow);
617 hstat->Fill(kDTht,fDThetaWindow);
618 hstat->Fill(kNStd,fNStdDev);
619 hstat->Fill(kPhiShift,fDPhiShift);
620 hstat->Fill(kThtS2,fScaleDTBySin2T);
621 hstat->Fill(kThtCW,fCutOnDThetaX);
622 hstat->Fill(kPhiOvl,fPhiOverlapCut);
623 hstat->Fill(kZEtaOvl,fZetaOverlap);
624 hstat->Fill(kNoOvl,fRemoveOverlaps);
626 hstat->Fill(kPhiRot,fPhiRot);
627 hstat->Fill(kInjScl,fInjScale);
628 hstat->Fill(kEtaMin,fEtaMin);
629 hstat->Fill(kEtaMax,fEtaMax);
630 hstat->Fill(kZVMin,fZVertexMin);
631 hstat->Fill(kZVMax,fZVertexMax);
633 hstat->Fill(kDPiSCut,fDPhiSCut);
634 hstat->Fill(kNStdCut,fNStdCut);
635 hstat->Fill(kMCV0Scale, fMCV0Scale);
639 // AliAnalysisTaskSE::Terminate();
643 //_________________________________________________________________________
644 void AliTrackletTaskMultipp::InitMultReco()
646 // create mult reconstructor
647 if (fMultReco) delete fMultReco;
648 fMultReco = new AliITSMultRecBg();
649 fMultReco->SetCreateClustersCopy(kTRUE);
650 fMultReco->SetScaleDThetaBySin2T(fScaleDTBySin2T);
651 fMultReco->SetNStdDev(fNStdDev);
652 fMultReco->SetPhiWindow( fDPhiWindow );
653 fMultReco->SetThetaWindow( fDThetaWindow );
654 fMultReco->SetPhiShift( fDPhiShift );
655 fMultReco->SetRemoveClustersFromOverlaps(fRemoveOverlaps);
656 fMultReco->SetPhiOverlapCut(fPhiOverlapCut);
657 fMultReco->SetZetaOverlapCut(fZetaOverlap);
658 fMultReco->SetHistOn(kFALSE);
659 fMultReco->SetRecType( AliITSMultRecBg::kData );
662 //_________________________________________________________________________
663 TObjArray* AliTrackletTaskMultipp::BookCustomHistos()
665 // book custom histos, not related to specific tracklet type
666 TObjArray* histos = new TObjArray();
669 // ------------ job parameters, statistics ------------------------------>>>
670 int nbs = kBinEntries + fNCentBins*kEntriesPerBin;
671 hstat = new TH1F("hStat","Run statistics",nbs,0.5,nbs+0.5);
673 hstat->GetXaxis()->SetBinLabel(kEvTot, "Ev.Tot0");
674 hstat->GetXaxis()->SetBinLabel(kEvTot, "Ev.Tot");
675 hstat->GetXaxis()->SetBinLabel(kOneUnit,"ScaleMerge");
676 hstat->GetXaxis()->SetBinLabel(kNWorkers,"Workers");
678 hstat->GetXaxis()->SetBinLabel(kCentVar, fgkCentSelName[fUseCentralityVar]);
679 hstat->GetXaxis()->SetBinLabel(kDPhi, "#Delta#varphi");
680 hstat->GetXaxis()->SetBinLabel(kDTht, "#Delta#theta");
681 hstat->GetXaxis()->SetBinLabel(kNStd, "N.std");
682 hstat->GetXaxis()->SetBinLabel(kPhiShift,"#delta#varphi");
683 hstat->GetXaxis()->SetBinLabel(kThtS2,"scale #Delta#theta");
684 hstat->GetXaxis()->SetBinLabel(kPhiOvl,"#varpho_{Ovl}");
685 hstat->GetXaxis()->SetBinLabel(kZEtaOvl,"#z_{Ovl}");
686 hstat->GetXaxis()->SetBinLabel(kNoOvl, "rem.ovl");
688 hstat->GetXaxis()->SetBinLabel(kPhiRot,"#varphi_{rot}");
689 hstat->GetXaxis()->SetBinLabel(kInjScl,"inj");
690 hstat->GetXaxis()->SetBinLabel(kEtaMin,"#eta_{min}");
691 hstat->GetXaxis()->SetBinLabel(kEtaMax,"#eta_{max}");
692 hstat->GetXaxis()->SetBinLabel(kZVMin,"ZV_{min} cut");
693 hstat->GetXaxis()->SetBinLabel(kZVMax,"ZV_{max} cut");
695 hstat->GetXaxis()->SetBinLabel(kDPiSCut,"#Delta#varphi-#delta_{#phi} cut");
696 hstat->GetXaxis()->SetBinLabel(kNStdCut,"#Delta cut");
698 hstat->GetXaxis()->SetBinLabel(kMCV0Scale,"MC V0 scale");
700 for (int i=0;i<fNCentBins;i++) {
701 TString bnt = "b"; bnt+= i;
702 int offs = kBinEntries + i*kEntriesPerBin;
703 hstat->GetXaxis()->SetBinLabel(offs + kEvProcData, bnt+" Ev.ProcData");
704 hstat->GetXaxis()->SetBinLabel(offs + kEvProcInj, bnt+" Ev.ProcInj");
705 hstat->GetXaxis()->SetBinLabel(offs + kEvProcRot, bnt+" Ev.ProcRot");
706 hstat->GetXaxis()->SetBinLabel(offs + kEvProcMix, bnt+" Ev.ProcMix");
710 hstat->Fill(kNWorkers);
712 AddHisto(histos,hstat,kHStat);
714 // ------------------------ events per centrality bin ----------------------
715 TH1D* hCentAx = new TH1D("EvCentr","Events per centrality",fNCentBins,fgkCentPerc);
716 hCentAx->GetXaxis()->SetTitle("Centrality parameter");
717 AddHisto(histos,hCentAx,kHStatCent);
719 TH1D* hCentBin = new TH1D("EvCentrBin","Events per centrality bin",fNCentBins,-0.5,fNCentBins-0.5);
720 hCentBin->GetXaxis()->SetTitle("Centrality Bin");
721 AddHisto(histos,hCentBin,kHStatCentBin);
723 // ------------ job parameters, statistics ------------------------------<<<
725 double etaMn=-3,etaMx=3;
726 double zMn=-30, zMx=30;
727 int nEtaBins = int((etaMx-etaMn)/0.1);
728 if (nEtaBins<1) nEtaBins = 1;
730 int nZVBins = int(zMx-zMn);
731 if (nZVBins<1) nZVBins = 1;
733 // Z vertex distribution for events before selection
734 TH1F* hzvns = new TH1F("zvNoSel","Z vertex before selection",nZVBins,zMn,zMx);
735 hzvns->GetXaxis()->SetTitle("Zvertex");
736 AddHisto(histos,hzvns,kHZVtxNoSel);
738 // V0 for events before selection
740 double maxmltV0 = 25000;
742 TH1F* hnV0ns = new TH1F("V0NoSel","V0 signal Before Cent. Selection",nbmltV0,0,maxmltV0);
743 hnV0ns->GetXaxis()->SetTitle("V0 signal");
744 AddHisto(histos,hnV0ns,kHV0NoSel);
748 double maxmltSPD2 = 7000;
749 TH1F* hncl2ns = new TH1F("NClustersSPD2NoSel","N Clusters on SPD2 Before Cent Selection",nbmltSPD2,0,maxmltSPD2);
750 hncl2ns->GetXaxis()->SetTitle("N Clus SPD2");
751 AddHisto(histos,hncl2ns,kHNClSPD2NoSel);
754 double maxZDC=6000., maxZEM=2500.;
755 TH2F* hzdczemns = new TH2F("ZDCZEMNoSel","ZDC vs ZEM Before Cent Selection",
756 nbzdc,0,maxZEM,nbzdc,0,maxZDC);
757 hzdczemns->GetXaxis()->SetTitle("ZEM");
758 hzdczemns->GetXaxis()->SetTitle("ZDC");
759 AddHisto(histos,hzdczemns,kHZDCZEMNoSel);
761 TH2F* hzv = new TH2F("zv","Z vertex after Selection per Cent.Bin",nZVBins,zMn,zMx, fNCentBins, -0.5,fNCentBins-0.5);
762 hzv->GetXaxis()->SetTitle("Zvertex");
763 hzv->GetYaxis()->SetTitle("Cent.Bin ID");
764 AddHisto(histos,hzv,kHZVtx);
767 TH2F* hnV0 = new TH2F("V0","V0 signal per Cent.Bin ",nbmltV0,0,maxmltV0, fNCentBins, -0.5,fNCentBins-0.5);
768 hnV0->GetXaxis()->SetTitle("V0 signal");
769 hnV0->GetYaxis()->SetTitle("Cent.Bin ID");
770 AddHisto(histos,hnV0,kHV0);
773 TH2F* hncl2 = new TH2F("NClustersSPD2","N Clusters on SPD2 per Cent.Bin",nbmltSPD2,0,maxmltSPD2, fNCentBins, -0.5,fNCentBins-0.5);
774 hncl2->GetXaxis()->SetTitle("N Clus SPD2");
775 hncl2->GetYaxis()->SetTitle("Cent.Bin ID");
776 AddHisto(histos,hncl2,kHNClSPD2);
779 TH3F* hzdczem = new TH3F("ZDCZEM","ZDC vs ZEM per Cent.Bin",nbzdc,0,maxZEM,nbzdc,0,maxZDC, fNCentBins, -0.5,fNCentBins-0.5);
780 hzdczem->GetXaxis()->SetTitle("ZEM");
781 hzdczem->GetYaxis()->SetTitle("ZDC");
782 AddHisto(histos,hzdczem,kHZDCZEM);
784 //----------------------------------------------------------------------
785 int nEtaBinsS = int((fEtaMax-fEtaMin)/0.1);
786 if (nEtaBinsS<1) nEtaBins = 1;
788 int nZVBinsS = int(fZVertexMax-fZVertexMin);
789 if (nZVBinsS<1) nZVBinsS = 1;
792 // Z vertex vs Eta distribution for primaries
793 char buffn[100],bufft[500];
794 for (int ib=0;ib<fNCentBins;ib++) {
795 sprintf(buffn,"b%d_zvEtaPrimMC",ib);
796 sprintf(bufft,"bin%d Zvertex vs #eta PrimMC",ib);
797 TH2F* hzvetap = new TH2F(buffn,bufft, nEtaBinsS,fEtaMin,fEtaMax,nZVBinsS,fZVertexMin,fZVertexMax);
798 hzvetap->GetXaxis()->SetTitle("#eta");
799 hzvetap->GetYaxis()->SetTitle("Zvertex");
800 AddHisto(histos,hzvetap,kHZVEtaPrimMC+ib);
803 // <n> primaries according to MC generator
804 TH1F* hnprimM = new TH1F("nPrimMean","<N> primaries",fNCentBins, -0.5,fNCentBins-0.5);
805 hnprimM->GetXaxis()->SetTitle("Cent.Bin ID");
806 AddHisto(histos,hnprimM,kHNPrimMeanMC);
808 // <n> primaries per part.pair according to MC generator
809 TH1F* hnprim2partM = new TH1F("nPrim2Part","<N> primaries per part.pair",fNCentBins, -0.5,fNCentBins-0.5);
810 hnprim2partM->GetXaxis()->SetTitle("Cent.Bin ID");
811 AddHisto(histos,hnprim2partM,kHNPrim2PartMC);
813 // <n> primaries per part.pair vs npart.pair according to MC generator
814 TH2F* hnprim2partNp = new TH2F("nPrim2Part_vs_NPart","<N> primaries per part.pair vs N part.pairs",105,0,210,200,0,40);
815 hnprim2partNp->GetXaxis()->SetTitle("N.part.pairs");
816 hnprim2partNp->GetYaxis()->SetTitle("N.prim/N.part.pairs");
817 AddHisto(histos,hnprim2partNp,kHNPrim2PartNpMC);
819 // <n> primaries per b.coll vs npart.pair according to MC generator
820 TH2F* hnprim2BCollNp = new TH2F("nPrim2BColl_vs_NPart","<N> primaries per bin.coll vs N part.pairs",105,0,210,200,0,40);
821 hnprim2BCollNp->GetXaxis()->SetTitle("N.part.pairs");
822 hnprim2BCollNp->GetYaxis()->SetTitle("N.prim/N.bin.coll.");
823 AddHisto(histos,hnprim2BCollNp,kHNPrim2BCollNpMC);
825 // <n> primaries per bin.coll. according to MC generator
826 TH1F* hnprim2BCollM = new TH1F("nPrim2BColl","<N> primaries per bin.coll",fNCentBins, -0.5,fNCentBins-0.5);
827 hnprim2BCollM->GetXaxis()->SetTitle("Cent.Bin ID");
828 AddHisto(histos,hnprim2BCollM,kHNPrim2BCollMC);
830 // n participants according to MC generator
831 TH2F* hnpart = new TH2F("nPart","N participant pairs",210,0,210,fNCentBins, -0.5,fNCentBins-0.5);
832 hnpart->GetXaxis()->SetTitle("N part. pairs");
833 hnpart->GetYaxis()->SetTitle("Cent.Bin ID");
834 AddHisto(histos,hnpart,kHNPartMC);
836 // <n> participants according to MC generator
837 TH1F* hnpartM = new TH1F("nPartMean","<N> participant pairs",fNCentBins, -0.5,fNCentBins-0.5);
838 hnpartM->GetXaxis()->SetTitle("Cent.Bin ID");
839 AddHisto(histos,hnpartM,kHNPartMeanMC);
841 // n bin coll. according to MC generator
842 TH2F* hnbcoll = new TH2F("nBColl","N bin. coll",2000,0,2000,fNCentBins, -0.5,fNCentBins-0.5);
843 hnbcoll->GetXaxis()->SetTitle("N bin. coll");
844 hnbcoll->GetYaxis()->SetTitle("Cent.Bin ID");
845 AddHisto(histos,hnbcoll,kHNBCollMC);
847 // <n> bin col according to MC generator
848 TH1F* hnbcollM = new TH1F("nBCollMean","<N> bin.colls",fNCentBins, -0.5,fNCentBins-0.5);
849 hnbcollM->GetXaxis()->SetTitle("Cent.Bin ID");
850 AddHisto(histos,hnbcollM,kHNBCollMeanMC);
856 // Difference in Z vertex for mixed events
857 TH2F* hzdiff = new TH2F("MixSPDVertexDiff","SPD #Delta Z Vertex distribution per mult bin ",100,-5,5, fNCentBins, -0.5,fNCentBins-0.5);
858 hzdiff->GetXaxis()->SetTitle("#Delta Z Vertex [cm]");
859 hzdiff->GetYaxis()->SetTitle(Form("Entries / %1.2f [cm] per mult bin",10./100.));
860 AddHisto(histos,hzdiff,kHZVtxMixDiff);
862 // Difference in N tracklets for mixed events
863 TH2F* hntdiff = new TH2F("MixNTrackletsDiff"," SPD tracklets Diff ",200,-1000,1000, fNCentBins, -0.5,fNCentBins-0.5);
864 hntdiff->GetXaxis()->SetTitle("# tracklet diff");
865 AddHisto(histos,hntdiff,kHNTrMixDiff);
868 // --------------------------------------------------
870 int npdg = sizeof(fgkPDGNames)/sizeof(char*);
871 TH2F* hpdgP = new TH2F("pdgPrim","primary PDG",npdg,0,npdg,fNCentBins, -0.5,fNCentBins-0.5);
872 AddHisto(histos,hpdgP,kHPrimPDG);
873 TH2F* hpdgS = new TH2F("pdgSec","secondary PDG",npdg,0,npdg,fNCentBins, -0.5,fNCentBins-0.5);
874 AddHisto(histos,hpdgS,kHSecPDG);
875 TH2F* hpdgPP = new TH2F("pdgPrimPar","primary parent PDG ",npdg,0,npdg,fNCentBins, -0.5,fNCentBins-0.5);
876 AddHisto(histos,hpdgPP,kHPrimParPDG);
877 TH2F* hpdgSP = new TH2F("pdgSecPar","secondary parent PDG",npdg,0,npdg,fNCentBins, -0.5,fNCentBins-0.5);
878 AddHisto(histos,hpdgSP,kHSecParPDG);
879 for (int i=0;i<npdg;i++) {
880 hpdgP->GetXaxis()->SetBinLabel(i+1,fgkPDGNames[i]);
881 hpdgS->GetXaxis()->SetBinLabel(i+1,fgkPDGNames[i]);
882 hpdgPP->GetXaxis()->SetBinLabel(i+1,fgkPDGNames[i]);
883 hpdgSP->GetXaxis()->SetBinLabel(i+1,fgkPDGNames[i]);
887 // -------------------------------------------------
889 hclinf = new TH2F("cl0InfoUsed","#phi vs Z of used clusters, Lr0",60,-15,15, 80,0,2*TMath::Pi());
890 AddHisto(histos,hclinf,kHClUsedInfoL0);
891 hclinf = new TH2F("cl1InfoUsed","#phi vs Z of used clusters, Lr1",60,-15,15, 2*80,0,2*TMath::Pi());
892 AddHisto(histos,hclinf,kHClUsedInfoL1);
893 hclinf = new TH2F("cl0InfoAll","#phi vs Z of all clusters, Lr0",60,-15,15, 80,0,2*TMath::Pi());
894 AddHisto(histos,hclinf,kHClAllInfoL0);
895 hclinf = new TH2F("cl1InfoAll","#phi vs Z of all clusters, Lr1",60,-15,15, 2*80,0,2*TMath::Pi());
896 AddHisto(histos,hclinf,kHClAllInfoL1);
898 // -------------------------------------------------
899 // correlations between SPD1 clusters
900 hclinf = new TH2F("clDstVsZall","Distance between SPD1 clusters vs Z, all cl",30,-15,15, 50,0.,5.);
901 AddHisto(histos,hclinf,kHclDstZAll);
902 hclinf = new TH2F("clDstVsPhiall","Distance between SPD1 clusters vs #phi, all cl",30,0,2*TMath::Pi(),50,0.,5.);
903 AddHisto(histos,hclinf,kHclDstPhiAll);
905 hclinf = new TH2F("clDstVsZused","Distance between SPD1 clusters vs Z, used-unused cl",30,-15,15, 50,0.,5.);
906 AddHisto(histos,hclinf,kHclDstZUsed);
907 hclinf = new TH2F("clDstVsPhiused","Distance between SPD1 clusters vs #phi, used-unused cl",30,0,2*TMath::Pi(),50,0.,5.);
908 AddHisto(histos,hclinf,kHclDstPhiUsed);
910 histos->SetOwner(kFALSE);
915 //_________________________________________________________________________
916 TObjArray* AliTrackletTaskMultipp::BookHistosSet(const char* pref, UInt_t selHistos)
918 // book standard set of histos attaching the pref in front of the name/title
920 const int kNDPhiBins = 100;
921 const int kNDThtBins = 100;
922 int nDistBins = int(fNStdDev)*5;
924 int nEtaBins = int((fEtaMax-fEtaMin)/0.1);
925 if (nEtaBins<1) nEtaBins = 1;
927 int nZVBins = int(fZVertexMax-fZVertexMin);
928 if (nZVBins<1) nZVBins = 1;
929 float dphir = fDPhiWindow*TMath::Sqrt(fNStdDev);
930 float dthtr = fDThetaWindow*TMath::Sqrt(fNStdDev);
932 TObjArray* histos = new TObjArray();
935 char buffn[100],bufft[500];
937 for (int ib=0;ib<fNCentBins;ib++) {
939 int offs = ib*kNStandardH;
940 if (selHistos & (0x1<<kHEtaZvCut) ) {
941 sprintf(buffn,"b%d_%s_ZvEtaCutT",ib,pref);
942 sprintf(bufft,"bin%d (%s) Zv vs Eta with tracklet cut",ib,pref);
943 h2 = new TH2F(buffn,bufft,nEtaBins,fEtaMin,fEtaMax, nZVBins, fZVertexMin,fZVertexMax);
944 h2->GetXaxis()->SetTitle("#eta");
945 h2->GetYaxis()->SetTitle("Zv");
946 AddHisto(histos,h2,offs+kHEtaZvCut);
949 if (selHistos & (0x1<<kHDPhiDTheta) ) {
950 sprintf(buffn,"b%d_%s_dPhidTheta",ib,pref);
951 sprintf(bufft,"bin%d (%s) #Delta#theta vs #Delta#varphi",ib,pref);
952 h2 = new TH2F(buffn,bufft,kNDPhiBins,-dphir,dphir,kNDThtBins,-dthtr,dthtr);
953 h2->GetXaxis()->SetTitle("#Delta#varphi [rad]");
954 h2->GetYaxis()->SetTitle("#Delta#theta [rad]");
955 AddHisto(histos,h2,offs+kHDPhiDTheta);
958 if (selHistos & (0x1<<kHDPhiSDThetaX) ) {
959 sprintf(buffn,"b%d_%s_dPhiSdThetaX",ib,pref);
960 sprintf(bufft,"bin%d (%s) #Delta#theta%s vs #Delta#varphi-#delta_{#varphi}",ib,pref,fScaleDTBySin2T ? "/sin^{2}(#theta)":"");
961 h2 = new TH2F(buffn,bufft,kNDPhiBins,-dphir,dphir,kNDThtBins,-dthtr,dthtr);
962 h2->GetXaxis()->SetTitle("#Delta#varphi-#delta_{#varphi} [rad]");
963 sprintf(bufft,"#Delta#theta%s",fScaleDTBySin2T ? "/sin^{2}(#theta)":"");
964 h2->GetYaxis()->SetTitle(bufft);
965 AddHisto(histos,h2,offs+kHDPhiSDThetaX);
968 if (selHistos & (0x1<<kHWDist) ) {
969 sprintf(buffn,"b%d_%s_WDist",ib,pref);
970 sprintf(bufft,"bin%d #Delta=[(#Delta#varphi-#delta_{#varphi})/#sigma#varphi]^{2}+"
971 "[#Delta#theta%s/#sigma#theta]^{2}",ib,fScaleDTBySin2T ? "*sin^{-2}(#theta)":"");
972 h1 = new TH1F(buffn,bufft,nDistBins,0,fNStdDev);
973 sprintf(bufft,"#Delta=[(#Delta#varphi-#delta_{#varphi})/#sigma#varphi]^{2}+"
974 "[#Delta#theta%s/#sigma#theta]^{2}",fScaleDTBySin2T ? "*sin^{-2}(#theta)":"");
975 h1->GetXaxis()->SetTitle(bufft);
976 AddHisto(histos,h1,offs+kHWDist);
979 if (selHistos & (0x1<<kHEtaZvSPD1) ) {
980 sprintf(buffn,"b%d_%s_ZvEtaSPD1",ib,pref);
981 sprintf(bufft,"bin%d (%s) Zv vs Eta SPD1 clusters",ib,pref);
982 h2 = new TH2F(buffn,bufft,nEtaBins,fEtaMin,fEtaMax, nZVBins, fZVertexMin,fZVertexMax);
983 h2->GetXaxis()->SetTitle("#eta");
984 h2->GetYaxis()->SetTitle("Zv");
985 AddHisto(histos,h2,offs+kHEtaZvSPD1);
990 histos->SetOwner(kFALSE);
994 //_________________________________________________________________________
995 void AliTrackletTaskMultipp::AddHisto(TObjArray* histos, TObject* h, Int_t at)
997 // add single histo to the set
998 if (at>=0) histos->AddAtAndExpand(h,at);
1003 //_________________________________________________________________________
1004 void AliTrackletTaskMultipp::FillHistos(Int_t type, const AliMultiplicity* mlt)
1006 // fill histos of given type
1009 TObjArray* histos = 0;
1010 if (type == kData) histos = fHistosTrData;
1011 else if (type == kBgInj) histos = fHistosTrInj;
1012 else if (type == kBgRot) histos = fHistosTrRot;
1013 else if (type == kBgMix) histos = fHistosTrMix;
1015 Bool_t fillMC = (type==kData) && fUseMC && fStack;
1018 //---------------------------------------- CHECK ------------------------------>>>
1020 AliGenHijingEventHeader* pyHeader = 0;
1023 pyHeader = (AliGenHijingEventHeader*) fMCevent->GenEventHeader();//header->GenEventHeader();
1024 pyHeader->PrimaryVertex(vtxMC);
1026 //---------------------------------------- CHECK ------------------------------<<<
1028 if (!histos) return;
1029 int ntr = mlt->GetNumberOfTracklets();
1030 for (int itr=ntr;itr--;) {
1032 //---------------------------------------- CHECK ------------------------------>>>
1035 Bool_t reject = kFALSE;
1037 int lab0 = mlt->GetLabel(itr,0);
1038 int lab1 = mlt->GetLabel(itr,1);
1039 if (lab0!=lab1) break;
1040 if (!fStack->IsPhysicalPrimary(lab0)) break;
1042 TParticle* part = fStack->Particle(lab0);
1043 Float_t dz = part->Vz() - vtxMC[2];
1044 if (TMath::Abs(dz)<1e-6) break;
1048 if (reject) continue;
1051 //---------------------------------------- CHECK ------------------------------<<<
1053 double theta = mlt->GetTheta(itr);
1054 double eta = -TMath::Log(TMath::Tan(theta/2));
1055 if (eta<fEtaMin || eta>fEtaMax) continue;
1057 double dtheta = mlt->GetDeltaTheta(itr);
1058 double dThetaX = dtheta;
1059 if (fScaleDTBySin2T) {
1060 double sint = TMath::Sin(theta);
1061 dThetaX /= (sint*sint);
1063 if (fCutOnDThetaX && TMath::Abs(dThetaX)>fDThetaWindow) continue;
1064 // double phi = mlt->GetPhi(itr);
1065 double dphi = mlt->GetDeltaPhi(itr);
1066 double dist = mlt->CalcDist(itr);
1068 FillHistosSet(histos,eta,/*phi,theta,*/dphi,dtheta,dThetaX,dist);
1069 // special handling for mc info
1070 if (fillMC && fStack) {
1071 int lab0 = mlt->GetLabel(itr,0);
1072 int lab1 = mlt->GetLabel(itr,1);
1073 int typeMC = 2; // comb.bg.
1074 if (lab0 == lab1) typeMC = fStack->IsPhysicalPrimary(lab0) ? 0:1; // prim or sec
1075 if (typeMC==0) FillHistosSet(fHistosTrPrim,eta,/*phi,theta,*/dphi,dtheta,dThetaX,dist); // primary
1076 else if (typeMC==1) FillHistosSet(fHistosTrSec, eta,/*phi,theta,*/dphi,dtheta,dThetaX,dist); // secondary
1078 FillHistosSet(fHistosTrComb,eta,/*phi,theta,*/dphi,dtheta,dThetaX,dist); // comb
1079 // for combinatorals fill also the uncorrelated part
1081 float *trl = fMultReco->GetTracklet(itr);
1082 int clId0 = (int)trl[AliITSMultReconstructor::kClID1];
1083 int clId1 = (int)trl[AliITSMultReconstructor::kClID2];
1084 float *clLabs0 = fMultReco->GetClusterOfLayer(0,clId0) + AliITSMultReconstructor::kClMC0;
1085 float *clLabs1 = fMultReco->GetClusterOfLayer(1,clId1) + AliITSMultReconstructor::kClMC0;
1086 if (!HaveCommonParent(clLabs0,clLabs1))
1087 FillHistosSet(fHistosTrCombU,eta,/*phi,theta,*/dphi,dtheta,dThetaX,dist);
1091 if (dist<fNStdCut) {
1092 double dphiS = TMath::Abs(dphi) - fDPhiShift; if (dphi<0) dphiS = -dphiS;
1093 if (dphiS<fDPhiSCut) FillSpecies(typeMC, lab0);
1095 if (fCheckReconstructables) CheckReconstructables();
1099 //-------------------------------------------------------------TMP RS - singles ------->>>
1100 int offsH = fCurrCentBin*kNStandardH;
1101 TH2* hSingles = (TH2*)histos->UncheckedAt(offsH+kHEtaZvSPD1);
1103 int nclS = mlt->GetNumberOfSingleClusters();
1104 double *thtS = mlt->GetThetaSingle();
1105 for (int ics=nclS;ics--;) {
1106 double etaS = -TMath::Log(TMath::Tan(thtS[ics]/2));
1107 if (etaS<fEtaMin || etaS>fEtaMax) continue;
1108 hSingles->Fill(etaS,fESDVtx[2]);
1111 //-------------------------------------------------------------TMP RS - singles -------<<<
1115 //_________________________________________________________________________
1116 void AliTrackletTaskMultipp::FillMCPrimaries()
1118 // fill all MC primaries Zv vs Eta
1119 if (!fStack || !fMCevent) return;
1121 //---------------------------------------- CHECK ------------------------------>>>
1123 AliGenHijingEventHeader* pyHeader = 0;
1126 pyHeader = (AliGenHijingEventHeader*) fMCevent->GenEventHeader();//header->GenEventHeader();
1127 pyHeader->PrimaryVertex(vtxMC);
1129 //---------------------------------------- CHECK ------------------------------<<<
1131 int ntr = fStack->GetNtrack();
1132 TH2* hprimEtaZ = (TH2F*)fHistosCustom->UncheckedAt(kHZVEtaPrimMC+fCurrCentBin);
1134 for (int itr=ntr;itr--;) {
1135 if (!fStack->IsPhysicalPrimary(itr)) continue;
1136 AliMCParticle *part = (AliMCParticle*)fMCevent->GetTrack(itr);
1137 if (!part->Charge()) continue;
1139 //---------------------------------------- CHECK ------------------------------>>>
1141 Float_t dz = part->Zv() - vtxMC[2];
1142 if (TMath::Abs(dz)>1e-6) continue; // reject
1144 //---------------------------------------- CHECK ------------------------------<<<
1146 Float_t theta = part->Theta();
1147 if (theta<1e-6 || theta>TMath::Pi()-1e-6) continue;
1148 Float_t eta = part->Eta();
1149 if (eta<fEtaMin || eta>fEtaMax) continue;
1150 hprimEtaZ->Fill(eta, fESDVtx[2]);
1154 ((TH1*)fHistosCustom->UncheckedAt(kHNPrimMeanMC))->Fill(fCurrCentBin,nprim);
1156 ((TH1*)fHistosCustom->UncheckedAt(kHNPrim2PartMC))->Fill(fCurrCentBin,nprim/fNPart);
1157 ((TH2*)fHistosCustom->UncheckedAt(kHNPrim2PartNpMC))->Fill(fNPart,nprim/fNPart);
1158 ((TH2*)fHistosCustom->UncheckedAt(kHNPartMC))->Fill(fNPart,fCurrCentBin);
1159 ((TH1*)fHistosCustom->UncheckedAt(kHNPartMeanMC))->Fill(fCurrCentBin,fNPart);
1162 ((TH1*)fHistosCustom->UncheckedAt(kHNPrim2BCollMC))->Fill(fCurrCentBin,nprim/fNBColl);
1163 ((TH2*)fHistosCustom->UncheckedAt(kHNPrim2BCollNpMC))->Fill(fNPart,nprim/fNBColl);
1164 ((TH2*)fHistosCustom->UncheckedAt(kHNBCollMC))->Fill(fNBColl,fCurrCentBin);
1165 ((TH1*)fHistosCustom->UncheckedAt(kHNBCollMeanMC))->Fill(fCurrCentBin,fNBColl);
1170 //_________________________________________________________________________
1171 void AliTrackletTaskMultipp::FillHistosSet(TObjArray* histos, double eta,
1172 //double /*phi*/,double /*theta*/,
1173 double dphi,double dtheta,double dThetaX,
1176 // fill standard set of histos
1177 if (dist>fNStdDev) return;
1179 double dphiS = TMath::Abs(dphi) - fDPhiShift;
1180 if (dphi<0) dphiS = -dphiS;
1182 int offs = fCurrCentBin*kNStandardH;
1184 if (histos->UncheckedAt(offs+kHDPhiSDThetaX))
1185 ((TH2*)histos->UncheckedAt(offs+kHDPhiSDThetaX))->Fill(dphiS,dThetaX);
1187 if (histos->UncheckedAt(offs+kHDPhiDTheta))
1188 ((TH2*)histos->UncheckedAt(offs+kHDPhiDTheta))->Fill(dphi,dtheta);
1190 if (histos->UncheckedAt(kHWDist))
1191 ((TH2*)histos->UncheckedAt(offs+kHWDist))->Fill(dist);
1193 if (dist<fNStdCut && dphiS<fDPhiSCut && histos->UncheckedAt(offs+kHEtaZvCut))
1194 ((TH2*)histos->UncheckedAt(offs+kHEtaZvCut))->Fill(eta,fESDVtx[2]);
1198 //__________________________________________________________________
1199 void AliTrackletTaskMultipp::FillSpecies(Int_t primsec, Int_t id)
1202 TH1 *hPart=0,*hParent=0;
1204 hPart = (TH1*)fHistosCustom->UncheckedAt(kHPrimPDG);
1205 hParent = (TH1*)fHistosCustom->UncheckedAt(kHPrimParPDG);
1207 else if (primsec==1) {
1208 hPart = (TH1*)fHistosCustom->UncheckedAt(kHSecPDG);
1209 hParent = (TH1*)fHistosCustom->UncheckedAt(kHSecParPDG);
1212 int ntr = fStack->GetNtrack();
1213 TParticle* part = fStack->Particle(id);
1214 int pdgCode = TMath::Abs(part->GetPdgCode());
1215 int pdgBin = GetPdgBin(pdgCode);
1216 int parID = part->GetFirstMother();
1217 int pdgCodePar = -1;
1219 while (parID>=0 && parID<ntr) {
1220 part = fStack->Particle(parID);
1221 pdgCodePar = TMath::Abs(part->GetPdgCode());
1222 parID = part->GetFirstMother();
1224 if (pdgCodePar>0) pdgBinPar = GetPdgBin(pdgCodePar);
1226 hPart->Fill(pdgBin,fCurrCentBin);
1227 hParent->Fill(pdgBinPar,fCurrCentBin);
1231 //_________________________________________________________________________
1232 Int_t AliTrackletTaskMultipp::GetCentralityBin(Float_t perc) const
1234 // calculate centrality bin
1235 for (int i=0;i<fNCentBins;i++) if (perc>=fgkCentPerc[i] && perc<=fgkCentPerc[i+1]) return i;
1239 //_________________________________________________________________________
1240 Int_t AliTrackletTaskMultipp::GetPdgBin(Int_t pdgCode)
1242 // return my pdg bin
1243 int ncodes = sizeof(fgkPDGCodes)/sizeof(int);
1245 for (pdgBin=0;pdgBin<ncodes;pdgBin++) if (pdgCode==fgkPDGCodes[pdgBin]) break;
1246 if (pdgBin>=ncodes) {
1247 if (float(pdgCode)>1e9) pdgBin = ncodes; // nuclei
1248 else pdgBin = ncodes+1; // unknown
1253 //_________________________________________________________________________
1254 Bool_t AliTrackletTaskMultipp::HaveCommonParent(const float* clLabs0,const float* clLabs1)
1256 // do 2 clusters have common parrent
1257 const int kMaxPar = 50;
1258 static int pars[2][50];
1260 const float *labs[2] = {clLabs0,clLabs1};
1261 int ntr = fStack->GetNtrack();
1262 // printf("\nHaveCommonParent \n");
1263 for (int il=0;il<2;il++) {
1265 for (int ilb=0;ilb<3;ilb++) {
1266 int lbl = (int)labs[il][ilb];
1267 if (lbl<2 || lbl>=ntr) continue;
1269 while (npars[il]<kMaxPar-1) {
1270 TParticle* part = fStack->Particle(lbl);
1272 int code = TMath::Abs(part->GetPdgCode());
1273 int q = (int)TMath::Abs(part->GetPDG()->Charge());
1274 if (code==21 || code<10 || q==1 || q==2 || q==4 ) break;
1275 //printf("%d/%d/%d: %4d (%d)%s|",il,ilb,npars[il],lbl,part->GetStatusCode(),part->GetName());
1276 pars[il][ npars[il]++ ] = lbl;
1277 lbl = part->GetFirstMother();
1278 if (lbl<1 || lbl>=ntr) break;
1283 // compare array of parents
1284 for (int i0=npars[0];i0--;) for (int i1=npars[1];i1--;) if (pars[0][i0]==pars[1][i1]) return kTRUE;
1289 //_________________________________________________________________________
1290 void AliTrackletTaskMultipp::CheckReconstructables()
1292 // fill reconstructable tracklets hitsos
1293 static TArrayI trInd;
1294 static TBits isPrimArr;
1296 if (!fMultReco || !fMultReco->IsRecoDone()) {AliInfo("To check reconstructables the reco had to be requested"); return;}
1297 if (!fStack) {AliInfo("MC Stack is not availalble"); return;}
1298 const double kPtMin = 0.05;
1300 TClonesArray *clArr[2];
1301 for (int ilr=0;ilr<2;ilr++) {
1302 clArr[ilr] = fMultReco->GetClustersOfLayer(ilr);
1303 if (!clArr[ilr]) {AliInfo("Clusters are not available"); return;}
1306 int ntr = fStack->GetNtrack();
1309 if (trInd.GetSize()<ntr) trInd.Set(ntr);
1310 isPrimArr.ResetAllBits();
1311 // count track wich may be reconstructable
1313 int ntrStore=0,ntrStorePrim=0;
1314 Int_t *trIndArr = trInd.GetArray();
1315 for (Int_t it=0; it<ntr; it++) {
1316 TParticle* part = fStack->Particle(it);
1317 if (TMath::Abs(part->Eta())>2.2) continue;
1318 if (TMath::Abs(part->Pt())<kPtMin) continue;
1319 if (fStack->IsPhysicalPrimary(it)) {
1320 isPrimArr.SetBitNumber(it);
1323 else { // check if secondary is worth cheking
1324 TParticlePDG* pdgPart = part->GetPDG();
1325 if (TMath::Abs(pdgPart->Charge())!=3) continue;
1326 if (part->R()>5.) continue;
1328 trIndArr[it] = ++ntrStore;
1331 AliInfo(Form("Selected %d MC particles (%d prim) out of %d in the stack\n",ntrStore,ntrStorePrim,ntr));
1334 AliITSRecPoint **clIndL[2];
1335 clIndL[0] = new AliITSRecPoint*[kMaxCl*ntrStore]; // max 2 clusters per layer
1336 clIndL[1] = new AliITSRecPoint*[kMaxCl*ntrStore]; // max 2 clusters per layer
1337 memset(clIndL[0],0,kMaxCl*ntrStore*sizeof(AliITSRecPoint*));
1338 memset(clIndL[1],0,kMaxCl*ntrStore*sizeof(AliITSRecPoint*));
1340 for (int ilr=0;ilr<2;ilr++) {
1341 TClonesArray *clusters = clArr[ilr];
1342 int ncl = clusters->GetEntriesFast();
1343 for (int icl=ncl;icl--;) {
1344 AliITSRecPoint *cl = (AliITSRecPoint*)clusters->UncheckedAt(icl);
1345 for (int ilb=3;ilb--;) {
1346 int lbl = cl->GetLabel(ilb); if (lbl<0 || lbl>=ntr) continue;
1347 int lblI = trIndArr[lbl];
1348 if (--lblI<0) continue; // not kept
1349 for (int icc=0;icc<kMaxCl;icc++) if (!clIndL[ilr][lblI+icc*ntrStore]) {clIndL[ilr][lblI+ntrStore*icc] = cl; break;} // first empty one
1354 Float_t clusterLay[2][AliITSMultReconstructor::kClNPar];
1355 double trComp[6][kMaxCl*kMaxCl];
1356 int indQual[kMaxCl*kMaxCl];
1358 for (int itr=ntr;itr--;) {
1359 int lblI = trIndArr[itr];
1360 if (--lblI<0) continue; // discarded
1361 int ntrCand = 0; // number of tracklet candidates (including overlaps)
1362 for (int icl0=0;icl0<kMaxCl;icl0++) {
1363 AliITSRecPoint *cl0 = clIndL[0][lblI+icl0*ntrStore];
1364 if (!cl0 || !clIndL[1][lblI]) break;
1365 cl0->GetGlobalXYZ( clusterLay[0] );
1366 fMultReco->ClusterPos2Angles(clusterLay[0], fESDVtx);
1367 for (int icl1=0;icl1<kMaxCl;icl1++) {
1368 AliITSRecPoint *cl1 = clIndL[1][lblI+icl1*ntrStore];
1370 cl1->GetGlobalXYZ( clusterLay[1] );
1371 fMultReco->ClusterPos2Angles(clusterLay[1], fESDVtx);
1372 trComp[AliITSMultReconstructor::kTrPhi][ntrCand] = clusterLay[0][AliITSMultReconstructor::kClPh];
1373 trComp[AliITSMultReconstructor::kTrTheta][ntrCand] = clusterLay[0][AliITSMultReconstructor::kClTh];
1374 trComp[AliITSMultReconstructor::kTrDTheta][ntrCand] = clusterLay[0][AliITSMultReconstructor::kClTh] - clusterLay[1][AliITSMultReconstructor::kClTh];
1375 trComp[AliITSMultReconstructor::kTrDPhi][ntrCand] = clusterLay[0][AliITSMultReconstructor::kClPh] - clusterLay[1][AliITSMultReconstructor::kClPh];
1376 trComp[AliITSMultReconstructor::kTrLab1][ntrCand] = icl1*10 + icl0;
1377 double &dphi = trComp[ntrCand][3];
1378 if (dphi>TMath::Pi()) dphi=2.*TMath::Pi()-dphi; // take into account boundary condition
1379 trComp[5][ntrCand] = fMultReco->CalcDist(trComp[AliITSMultReconstructor::kTrDPhi][ntrCand],
1380 trComp[AliITSMultReconstructor::kTrDTheta][ntrCand],
1381 trComp[AliITSMultReconstructor::kTrTheta][ntrCand]);
1385 if (!ntrCand) continue; // no tracklets
1386 if (ntrCand>1) TMath::Sort(ntrCand,trComp[5],indQual,kFALSE); else indQual[0] = 0; // sort in weighted distance
1387 if (fRemoveOverlaps) ntrCand = 1; // select the best
1389 // disable worst tracklet with shared cluster
1390 for (int itc=0;itc<ntrCand;itc++) {
1391 int ind = indQual[itc];
1392 if (trComp[AliITSMultReconstructor::kTrLab1][ind]<0) continue; // already disabled
1393 for (int jtc=itc+1;jtc<ntrCand;jtc++) {
1394 int jnd = indQual[jtc];
1395 if (trComp[AliITSMultReconstructor::kTrLab1][jnd]<0) continue; // already disabled
1396 if ( int(trComp[AliITSMultReconstructor::kTrLab1][ind])/10 == int(trComp[AliITSMultReconstructor::kTrLab1][jnd])/10 ||
1397 int(trComp[AliITSMultReconstructor::kTrLab1][ind])%10 == int(trComp[AliITSMultReconstructor::kTrLab1][jnd])%10) trComp[AliITSMultReconstructor::kTrLab1][jnd] = -1;
1401 // store, but forbid cluster reusing
1402 TObjArray* histos = isPrimArr.TestBitNumber(itr) ? fHistosTrRcblPrim : fHistosTrRcblSec;
1403 for (int itc=0;itc<ntrCand;itc++) {
1404 int ind = indQual[itc];
1405 if (trComp[4][ind]<0) continue; // discarded
1406 double eta = -TMath::Log(TMath::Tan(trComp[AliITSMultReconstructor::kTrTheta][ind]/2));
1407 if (eta<fEtaMin || eta>fEtaMax) continue;
1408 double dThetaX = trComp[AliITSMultReconstructor::kTrTheta][ind];
1409 if (fScaleDTBySin2T) {
1410 double sint = TMath::Sin(trComp[AliITSMultReconstructor::kTrTheta][ind]);
1411 dThetaX /= (sint*sint);
1413 FillHistosSet(histos,eta,
1414 //trComp[AliITSMultReconstructor::kTrPhi][ind],trComp[AliITSMultReconstructor::kTrTheta][ind],
1415 trComp[AliITSMultReconstructor::kTrDPhi][ind],trComp[AliITSMultReconstructor::kTrDTheta][ind],
1416 dThetaX,trComp[5][ind]);
1424 //_________________________________________________________________________
1425 void AliTrackletTaskMultipp::FillClusterInfo()
1427 // fill info on clusters associated to good tracklets
1428 if (!fMultReco) return;
1429 int ntr = fMultReco->GetNTracklets();
1431 TH2F *hclU[2] = {(TH2F*)fHistosCustom->UncheckedAt(kHClUsedInfoL0),(TH2F*)fHistosCustom->UncheckedAt(kHClUsedInfoL1)};
1432 TH2F *hclA[2] = {(TH2F*)fHistosCustom->UncheckedAt(kHClAllInfoL0),(TH2F*)fHistosCustom->UncheckedAt(kHClAllInfoL1)};
1433 for (int itr=ntr;itr--;) {
1434 Float_t *trc = fMultReco->GetTracklet(itr);
1435 if (TMath::Abs(TMath::Abs(trc[AliITSMultReconstructor::kTrDPhi])-fDPhiShift)>fDPhiSCut) continue;
1436 if (fMultReco->CalcDist(trc[AliITSMultReconstructor::kTrDPhi],
1437 trc[AliITSMultReconstructor::kTrDTheta],
1438 trc[AliITSMultReconstructor::kTrTheta]) > fNStdCut) continue;
1439 clID[0] = (int)trc[AliITSMultReconstructor::kClID1];
1440 clID[1] = (int)trc[AliITSMultReconstructor::kClID2];
1441 for (int il=0;il<2;il++) {
1442 Float_t *clinf = fMultReco->GetClusterOfLayer(il,clID[il]);
1443 hclU[il]->Fill( clinf[AliITSMultReconstructor::kClZ], clinf[AliITSMultReconstructor::kClPh]);
1447 for (int il=0;il<2;il++) for (int ic=fMultReco->GetNClustersLayer(il);ic--;) {
1448 Float_t *clinf = fMultReco->GetClusterOfLayer(il,ic);
1449 hclA[il]->Fill( clinf[AliITSMultReconstructor::kClZ], clinf[AliITSMultReconstructor::kClPh]);
1454 //_________________________________________________________________________
1455 void AliTrackletTaskMultipp::FillClusterInfoFromMult(const AliMultiplicity* mlt, double zVertex)
1457 // fill info on clusters taking them from Multiplicity object
1458 const double kRSPD1 = 3.9;
1459 TH2F *hclU = (TH2F*)fHistosCustom->UncheckedAt(kHClUsedInfoL0);
1460 TH2F *hclA = (TH2F*)fHistosCustom->UncheckedAt(kHClAllInfoL0);
1461 int ntr = mlt->GetNumberOfTracklets();
1462 for (int itr=ntr;itr--;) {
1463 Bool_t goodTracklet = kTRUE;
1464 if (TMath::Abs( mlt->GetDeltaPhi(itr)-fDPhiShift)>fDPhiSCut) goodTracklet = kFALSE;
1465 if (mlt->CalcDist(itr) > fNStdCut) goodTracklet = kFALSE;
1466 double phi = mlt->GetPhi(itr);
1467 double z = kRSPD1/TMath::Tan(mlt->GetTheta(itr)) + zVertex;
1468 if (goodTracklet) hclU->Fill(z,phi);
1472 int ncl = mlt->GetNumberOfSingleClusters();
1473 for (int icl=ncl;icl--;) {
1474 double phi = mlt->GetPhiSingle(icl);
1475 double z = kRSPD1/TMath::Tan(mlt->GetThetaSingle(icl)) + zVertex;
1481 //_________________________________________________________________________
1482 void AliTrackletTaskMultipp::FillClusterAutoCorrelationFromMult(const AliMultiplicity* mlt, double zVertex)
1484 // fill mutual distance between SPD1 clusters
1485 const double kRSPD1 = 3.9;
1486 enum {kX=0,kY,kZ,kPhi,kNV};
1488 TH2F *hclDstZAll = (TH2F*)fHistosCustom->UncheckedAt(kHclDstZAll);
1489 TH2F *hclDstPhiAll = (TH2F*)fHistosCustom->UncheckedAt(kHclDstPhiAll);
1490 TH2F *hclDstZUsed = (TH2F*)fHistosCustom->UncheckedAt(kHclDstZUsed);
1491 TH2F *hclDstPhiUsed = (TH2F*)fHistosCustom->UncheckedAt(kHclDstPhiUsed);
1492 if (!hclDstZAll && !hclDstPhiAll && !hclDstZUsed && !hclDstPhiUsed) return; // nothing to fill
1494 int nCl = mlt->GetNumberOfTracklets() + mlt->GetNumberOfSingleClusters();
1496 double *clXYZPhi = new Double_t[kNV*nCl];
1498 for (int itr=mlt->GetNumberOfTracklets();itr--;) { // extract coordinates of used SPD1 clusters
1499 double phi = mlt->GetPhi(itr); if (phi<0) phi += 2*TMath::Pi();
1501 clXYZPhi[offs + kX] = TMath::Cos(phi)*kRSPD1;
1502 clXYZPhi[offs + kY] = TMath::Sin(phi)*kRSPD1;
1503 clXYZPhi[offs + kZ] = kRSPD1/TMath::Tan(mlt->GetTheta(itr)) + zVertex;
1504 clXYZPhi[offs + kPhi] = phi;
1508 for (int icl=mlt->GetNumberOfSingleClusters();icl--;) { // extract coordinates of unused SPD1 clusters
1509 double phi = mlt->GetPhiSingle(icl); if (phi<0) phi += 2*TMath::Pi();
1511 clXYZPhi[offs + kX] = TMath::Cos(phi)*kRSPD1;
1512 clXYZPhi[offs + kY] = TMath::Sin(phi)*kRSPD1;
1513 clXYZPhi[offs + kZ] = kRSPD1/TMath::Tan(mlt->GetThetaSingle(icl)) + zVertex;
1514 clXYZPhi[offs + kPhi] = phi;
1518 for (int icl=0;icl<nCl;icl++) {
1520 if (hclDstZAll) hclDstZAll->Fill(clXYZPhi[offs+kZ],-1,2); // fill in underflow, to count the clusters
1521 if (hclDstPhiAll) hclDstPhiAll->Fill(clXYZPhi[offs+kPhi],-1,2); // fill in underflow, to count the clusters
1522 if (icl<mlt->GetNumberOfTracklets()) {
1523 if (hclDstZUsed) hclDstZUsed->Fill(clXYZPhi[offs+kZ],-1); // fill in underflow, to count the clusters
1524 if (hclDstPhiUsed) hclDstPhiUsed->Fill(clXYZPhi[offs+kPhi],-1); // fill in underflow, to count the clusters
1526 for (int icl1=icl+1;icl1<nCl;icl1++) {
1527 int offs1 =icl1*kNV;
1528 double dx = clXYZPhi[offs+kX]-clXYZPhi[offs1+kX];
1529 double dy = clXYZPhi[offs+kY]-clXYZPhi[offs1+kY];
1530 double dz = clXYZPhi[offs+kZ]-clXYZPhi[offs1+kZ];
1531 double dst = TMath::Sqrt(dx*dx+dy*dy+dz*dz);
1534 hclDstZAll->Fill(clXYZPhi[offs+kZ],dst);
1535 hclDstZAll->Fill(clXYZPhi[offs1+kZ],dst);
1538 hclDstPhiAll->Fill(clXYZPhi[offs+kPhi],dst);
1539 hclDstPhiAll->Fill(clXYZPhi[offs1+kPhi],dst);
1542 // tracklets with singles only
1543 if (icl>=mlt->GetNumberOfTracklets() || icl1<mlt->GetNumberOfTracklets()) continue;
1544 if (hclDstZUsed) hclDstZUsed->Fill(clXYZPhi[offs+kZ],dst);
1545 if (hclDstPhiUsed) hclDstPhiUsed->Fill(clXYZPhi[offs+kPhi],dst);