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 **************************************************************************/
17 ////////////////////////////////////////////////////////////////////////
19 // Task for Heavy Flavour Electron Flow with TPC plus TOF //
20 // Non-Photonic Electron identified with Invariant mass //
21 // analysis methos in function SelectPhotonicElectron //
24 // Author: Andrea Dubla (Utrecht University) //
27 ////////////////////////////////////////////////////////////////////////
34 #include "THnSparse.h"
35 #include "TLorentzVector.h"
38 #include "AliAnalysisTask.h"
39 #include "AliAnalysisManager.h"
40 #include "AliESDEvent.h"
41 #include "AliESDHandler.h"
42 #include "AliAODEvent.h"
43 #include "AliAODHandler.h"
44 #include "AliAnalysisTaskFlowITSTPCTOFQCSP.h"
45 #include "TGeoGlobalMagField.h"
47 #include "AliAnalysisTaskSE.h"
48 #include "TRefArray.h"
50 #include "AliESDInputHandler.h"
51 #include "AliESDpid.h"
52 #include "AliAODInputHandler.h"
53 #include "AliAODPid.h"
54 #include "AliESDtrackCuts.h"
55 #include "AliPhysicsSelection.h"
56 #include "AliCentralitySelectionTask.h"
57 #include "AliESDCaloCluster.h"
58 #include "AliAODCaloCluster.h"
59 #include "AliESDCaloTrigger.h"
60 #include "AliGeomManager.h"
62 #include "TGeoManager.h"
65 #include "AliEMCALTrack.h"
66 //#include "AliEMCALTracker.h"
68 #include "AliKFParticle.h"
69 #include "AliKFVertex.h"
70 #include "AliHFEcontainer.h"
71 #include "AliHFEcuts.h"
72 #include "AliHFEpid.h"
73 #include "AliHFEpidTPC.h"
74 #include "AliHFEpidBase.h"
75 #include "AliHFEpidQAmanager.h"
76 #include "AliHFEtools.h"
77 #include "AliCFContainer.h"
78 #include "AliCFManager.h"
79 #include "AliKFParticle.h"
80 #include "AliKFVertex.h"
81 #include "AliCentrality.h"
82 #include "AliVEvent.h"
84 #include "AliMCEvent.h"
86 #include "AliFlowCandidateTrack.h"
87 #include "AliFlowTrackCuts.h"
88 #include "AliFlowEventSimple.h"
89 #include "AliFlowCommonConstants.h"
90 #include "AliFlowEvent.h"
93 #include "AliESDVZERO.h"
94 #include "AliAODVZERO.h"
96 #include "AliPIDResponse.h"
97 #include "AliFlowTrack.h"
98 #include "AliAnalysisTaskVnV0.h"
99 #include "AliSelectNonHFE.h"
102 class AliFlowTrackCuts;
106 ClassImp(AliAnalysisTaskFlowITSTPCTOFQCSP)
107 //________________________________________________________________________
108 AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP(const char *name)
109 : AliAnalysisTaskSE(name)
115 ,fIdentifiedAsOutInz(kFALSE)
116 ,fPassTheEventCut(kFALSE)
121 ,fCutsRP(0) // track cuts for reference particles
122 ,fNullCuts(0) // dummy cuts for flow event tracks
123 ,fFlowEvent(0) //! flow events (one for each inv mass band)
124 ,fkCentralityMethod(0)
142 ,fTPCnsigmaVSptAft(0)
147 ,fCentralityNoPass(0)
154 ,fMultCorAfterCuts(0)
162 ,fMultCorBeforeCuts(0)
164 ,fminITSnsigmaLowpT(-1)
165 ,fmaxITSnsigmaLowpT(1)
166 ,fminITSnsigmaHighpT(-2)
167 ,fmaxITSnsigmaHighpT(2)
168 ,fminTPCnsigmaLowpT(-1)
169 ,fmaxTPCnsigmaLowpT(3)
170 ,fminTPCnsigmaHighpT(0)
171 ,fmaxTPCnsigmaHighpT(3)
172 //,fQAPIDSparse(kFALSE)
178 ,fOpeningAngleCut(0.1)
182 ,fNonHFE(new AliSelectNonHFE)
185 ,fTPCnsigmaAftITSTOF(0)
190 ,fTPCvsITSafterTOF(0)
193 ,fMultCorAfterCentrBeforeCuts(0)
194 ,fMultCorAfterVZTRKComp(0)
195 ,fCentralityBeforePileup(0)
196 ,fCentralityAfterVZTRK(0)
197 ,fCentralityAfterCorrCut(0)
198 ,fMultCorAfterCorrCut(0)
202 ,fSubEventDPhiv2new(0)
204 ,fHistCentrDistr(0x0)
205 ,fCentralityNoPassForFlattening(0)
214 ,fHistEPDistrWeight(0)
221 fPID = new AliHFEpid("hfePid");
222 // Define input and output slots here
223 // Input slot #0 works with a TChain
224 DefineInput(0, TChain::Class());
225 // Output slot #0 id reserved by the base class for AOD
226 // Output slot #1 writes into a TH1 container
227 // DefineOutput(1, TH1I::Class());
228 DefineOutput(1, TList::Class());
229 DefineOutput(2, AliFlowEventSimple::Class());
232 //________________________________________________________________________
233 AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP()
234 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElectFlow")
240 ,fIdentifiedAsOutInz(kFALSE)
241 ,fPassTheEventCut(kFALSE)
246 ,fCutsRP(0) // track cuts for reference particles
247 ,fNullCuts(0) // dummy cuts for flow event tracks
248 ,fFlowEvent(0) //! flow events (one for each inv mass band)
249 ,fkCentralityMethod(0)
267 ,fTPCnsigmaVSptAft(0)
272 ,fCentralityNoPass(0)
279 ,fMultCorAfterCuts(0)
287 ,fMultCorBeforeCuts(0)
289 ,fminITSnsigmaLowpT(-1)
290 ,fmaxITSnsigmaLowpT(1)
291 ,fminITSnsigmaHighpT(-2)
292 ,fmaxITSnsigmaHighpT(2)
293 ,fminTPCnsigmaLowpT(-1)
294 ,fmaxTPCnsigmaLowpT(3)
295 ,fminTPCnsigmaHighpT(0)
296 ,fmaxTPCnsigmaHighpT(3)
297 //,fQAPIDSparse(kFALSE)
303 ,fOpeningAngleCut(0.1)
307 ,fNonHFE(new AliSelectNonHFE)
310 ,fTPCnsigmaAftITSTOF(0)
315 ,fTPCvsITSafterTOF(0)
318 ,fMultCorAfterCentrBeforeCuts(0)
319 ,fMultCorAfterVZTRKComp(0)
320 ,fCentralityBeforePileup(0)
321 ,fCentralityAfterVZTRK(0)
322 ,fCentralityAfterCorrCut(0)
323 ,fMultCorAfterCorrCut(0)
327 ,fSubEventDPhiv2new(0)
329 ,fHistCentrDistr(0x0)
330 ,fCentralityNoPassForFlattening(0)
339 ,fHistEPDistrWeight(0)
344 //Default constructor
345 fPID = new AliHFEpid("hfePid");
347 // Define input and output slots here
348 // Input slot #0 works with a TChain
349 DefineInput(0, TChain::Class());
350 // Output slot #0 id reserved by the base class for AOD
351 // Output slot #1 writes into a TH1 container
352 // DefineOutput(1, TH1I::Class());
353 DefineOutput(1, TList::Class());
354 DefineOutput(2, AliFlowEventSimple::Class());
355 //DefineOutput(3, TTree::Class());
357 //_________________________________________
359 AliAnalysisTaskFlowITSTPCTOFQCSP::~AliAnalysisTaskFlowITSTPCTOFQCSP()
365 // delete fPIDResponse;
368 if (fOutputList) delete fOutputList;
369 if (fFlowEvent) delete fFlowEvent;
372 //_________________________________________
374 void AliAnalysisTaskFlowITSTPCTOFQCSP::UserExec(Option_t*)
377 //Called for each event
379 // create pointer to event
381 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
382 fVevent = dynamic_cast<AliVEvent*>(InputEvent());
387 printf("ERROR: fAOD not available\n");
393 AliError("HFE cuts not available");
397 if(!fPID->IsInitialized())
399 // Initialize PID with the given run number
400 AliWarning("PID not initialised, get from Run no");
401 fPID->InitializePID(fAOD->GetRunNumber());
404 // cout << "kTrigger == " << fTrigger <<endl;
407 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral)) return;
411 if ( !(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAny) ) return;
413 TString firedTriggerClasses = static_cast<const AliAODEvent*>(InputEvent())->GetFiredTriggerClasses();
415 if ( ! ( firedTriggerClasses.Contains("CVLN_B2-B-NOPF-ALLNOTRD") || firedTriggerClasses.Contains("CVLN_R1-B-NOPF-ALLNOTRD") || firedTriggerClasses.Contains("CSEMI_R1-B-NOPF-ALLNOTRD") ) ) return;
418 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA)) return;
421 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB)) return;
424 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kCentral | AliVEvent::kSemiCentral))) return;
427 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kSemiCentral))) return;
433 //---------------CENTRALITY AND EVENT SELECTION-----------------------
437 Int_t fNOtrks = fAOD->GetNumberOfTracks();
439 const AliAODVertex* trkVtx = fAOD->GetPrimaryVertex();
440 if (!trkVtx || trkVtx->GetNContributors()<=0)return;
441 TString vtxTtl = trkVtx->GetTitle();
442 if (!vtxTtl.Contains("VertexerTracks"))return;
443 const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
444 if (!spdVtx || spdVtx->GetNContributors()<=0)return;
445 if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5)return;
446 vtxz = trkVtx->GetZ();
447 if(TMath::Abs(vtxz)>fVz)return;
450 if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) return;
451 if(fNOtrks<2) return;
454 Bool_t pass = kFALSE; //to select centrality
455 CheckCentrality(fAOD,pass);
462 PlotVZeroMultiplcities(fAOD);
465 PrepareFlowEvent(fAOD->GetNumberOfTracks(),fFlowEvent); //Calculate event plane Qvector and EP resolution for inclusive
467 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
470 AliDebug(1, "Using default PID Response");
471 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
474 fPID->SetPIDResponse(pidResponse);
476 fCFM->SetRecEventInfo(fAOD);
478 // Look for kink mother
479 Int_t numberofvertices = fAOD->GetNumberOfVertices();
480 Double_t listofmotherkink[numberofvertices];
481 Int_t numberofmotherkink = 0;
482 for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
483 AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
484 if(!aodvertex) continue;
485 if(aodvertex->GetType()==AliAODVertex::kKink) {
486 AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
487 if(!mother) continue;
488 Int_t idmother = mother->GetID();
489 listofmotherkink[numberofmotherkink] = idmother;
490 //printf("ID %d\n",idmother);
491 numberofmotherkink++;
495 //=============================================V0EP from Alex======================================================================
496 Double_t qxEPa = 0, qyEPa = 0;
497 Double_t qxEPc = 0, qyEPc = 0;
498 Double_t qxEP = 0, qyEP = 0;
500 Double_t evPlAngV0A = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 8, 2, qxEPa, qyEPa);
501 Double_t evPlAngV0C = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 9, 2, qxEPc, qyEPc);
502 Double_t evPlAngV0 = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 10, 2, qxEP, qyEP);
505 Double_t Qx2 = 0, Qy2 = 0;
506 Double_t Qx2p = 0, Qy2p = 0;
507 Double_t Qx2n = 0, Qy2n = 0;
509 for (Int_t iT = 0; iT < fAOD->GetNumberOfTracks(); iT++){
511 AliAODTrack* aodTrack = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iT));
512 if(!aodTrack) AliFatal("Not a standard AOD");
517 if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < 70) || (aodTrack->Pt() >= 20.0))
520 if (!aodTrack->TestFilterBit(128))
524 if(aodTrack->Eta()>0 && aodTrack->Eta()<0.8){
526 Qx2p += TMath::Cos(2*aodTrack->Phi());
527 Qy2p += TMath::Sin(2*aodTrack->Phi());
529 if(aodTrack->Eta()<0 && aodTrack->Eta()> -0.8){
531 Qx2n += TMath::Cos(2*aodTrack->Phi());
532 Qy2n += TMath::Sin(2*aodTrack->Phi());
536 Qx2 += TMath::Cos(2*aodTrack->Phi());
537 Qy2 += TMath::Sin(2*aodTrack->Phi());
544 Double_t evPlAngTPC = TMath::ATan2(Qy2, Qx2)/2.;
545 Double_t evPlAngTPCn = TMath::ATan2(Qy2n, Qx2n)/2.;
546 Double_t evPlAngTPCp = TMath::ATan2(Qy2p, Qx2p)/2.;
548 EPVzA->Fill(evPlAngV0A);
549 EPVzC->Fill(evPlAngV0C);
550 EPTPC->Fill(evPlAngTPC);
552 EPTPCn->Fill(evPlAngTPCn);
553 EPTPCp->Fill(evPlAngTPCp);
554 EPVz->Fill(evPlAngV0);
558 Double_t weightEP =1;
560 weightEP = GiveMeWeight(evPlAngV0);
561 EPVzAftW->Fill(evPlAngV0,weightEP);
567 fSubEventDPhiv2->Fill(0.5, TMath::Cos(2.*(evPlAngV0A-evPlAngTPC))); // vzeroa - tpc
568 fSubEventDPhiv2->Fill(1.5, TMath::Cos(2.*(evPlAngV0A-evPlAngV0C))); // vzeroa - vzeroc
569 fSubEventDPhiv2->Fill(2.5, TMath::Cos(2.*(evPlAngV0C-evPlAngTPC))); // tpc - vzeroc
573 fSubEventDPhiv2new->Fill(0.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCp)),weightEP); // vzero - tpcp
574 fSubEventDPhiv2new->Fill(1.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCn)),weightEP); // vzero - tpcn
575 fSubEventDPhiv2new->Fill(2.5, TMath::Cos(2.*(evPlAngTPCp-evPlAngTPCn))); // tpcp - tpcn
578 fSubEventDPhiv2new->Fill(0.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCp))); // vzero - tpcp
579 fSubEventDPhiv2new->Fill(1.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCn))); // vzero - tpcn
580 fSubEventDPhiv2new->Fill(2.5, TMath::Cos(2.*(evPlAngTPCp-evPlAngTPCn))); // tpcp - tpcn
582 //====================================================================================================================
584 AliAODTrack *track = NULL;
587 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++)
589 track = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iTracks));
590 if(!track) AliFatal("Not a standard AOD");
593 printf("ERROR: Could not receive track %d\n", iTracks);
596 if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; // TESTBIT FOR AOD double Counting
598 //--------------------------------------hfe begin-----------------------------------------------------------
599 //==========================================================================================================
600 //======================================track cuts==========================================================
601 if(track->Eta()<-0.8 || track->Eta()>0.8) continue; //eta cuts on candidates
603 // RecKine: ITSTPC cuts
604 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
606 // Reject kink mother
607 Bool_t kinkmotherpass = kTRUE;
608 for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
609 if(track->GetID() == listofmotherkink[kinkmother]) {
610 kinkmotherpass = kFALSE;
614 if(!kinkmotherpass) continue;
617 // if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; //deleted for DCA absence
618 // HFEcuts: ITS layers cuts
619 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
620 // HFE cuts: TPC PID cleanup
621 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
622 //==========================================================================================================
623 Double_t eta = track->Eta();
624 Double_t phi = track->Phi();
627 if(phi<1.4 || phi >3.14)continue; //to have same EMCal phi acceptance
632 Double_t pt = track->Pt(); //pt track after cuts
633 if(pt<fpTCutmin || pt>fpTCutmax) continue;
634 //==========================================================================================================
635 //=========================================PID==============================================================
636 if(track->GetTPCsignalN() < fTPCS) continue;
637 Float_t fITSnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasITS(track, AliPID::kElectron) : 1000;
638 Float_t fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
639 Float_t fTOFnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTOF(track, AliPID::kElectron) : 1000;
640 // Float_t eDEDX = fPIDResponse->GetTPCResponse().GetExpectedSignal(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxDefault, kTRUE);
642 Double_t CorrectTPCNSigma;
643 Double_t mult = fVevent->GetNumberOfESDTracks()/8;
646 CorrectTPCNSigma = ftpcpid->GetCorrectedTPCnSigma(eta, mult, fTPCnSigma);
647 // cout <<fTPCnSigma << " ==== " <<COrrectTPCNSigma<<endl;
648 fTPCnSigma = CorrectTPCNSigma;
649 // cout <<fTPCnSigma << " ==== " <<COrrectTPCNSigma<<endl;
654 fITSnsigma->Fill(track->P(),fITSnSigma);
655 fTPCnsigma->Fill(track->P(),fTPCnSigma);
656 fTOFns->Fill(track->P(),fTOFnSigma);
657 fITSvsTOF->Fill(fTOFnSigma,fITSnSigma);
658 fTPCvsITS->Fill(fTPCnSigma,fITSnSigma);
659 fTPCvsTOF->Fill(fTPCnSigma,fTOFnSigma);
662 if(fTOFnSigma < fminTOFnSigma || fTOFnSigma > fmaxTOFnSigma) continue;
663 }//cuts on nsigma tof full pt range
665 fITSnsigmaAftTOF->Fill(track->P(),fITSnSigma);
666 fTPCnsigmaAftTOF->Fill(track->P(),fTPCnSigma);
667 fTPCvsITSafterTOF->Fill(fTPCnSigma,fITSnSigma);
669 Double_t valPidSparse[3] = {
674 fQAPidSparse->Fill(valPidSparse);
678 if(fITSnSigma < fminITSnsigmaLowpT || fITSnSigma > fmaxITSnsigmaLowpT)continue;
679 }//cuts on nsigma its low pt
681 if(fITSnSigma < fminITSnsigmaHighpT || fITSnSigma > fmaxITSnsigmaHighpT)continue;
682 }//cuts on nsigma its high pt
683 fTPCnsigmaAftITSTOF->Fill(track->P(),fTPCnSigma);
684 if(pt >= 0.25 && pt < 1.5){
685 if(fTPCnSigma < fminTPCnsigmaLowpT || fTPCnSigma > fmaxTPCnsigmaLowpT) continue;
686 }//cuts on nsigma tpc lowpt
688 if(fTPCnSigma < fminTPCnsigmaHighpT || fTPCnSigma > fmaxTPCnsigmaHighpT) continue;
689 }//cuts on nsigma tpc high pt
690 fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
691 fTPCnsigmaVSptAft->Fill(pt,fTPCnSigma);
693 //==========================================================================================================
694 //=========================================QA PID SPARSE====================================================
695 Float_t timeTOF = track->GetTOFsignal();
696 Double_t intTime[5] = {-99., -99., -99., -99., -99.};
697 track->GetIntegratedTimes(intTime);
698 Float_t timeElec = intTime[0];
699 Float_t intLength = 2.99792458e-2* timeElec;
701 if ((intLength > 0) && (timeTOF > 0))
702 beta = intLength/2.99792458e-2/timeTOF;
705 // Double_t valPid[4] = {
707 // track->GetTPCsignal(),
711 // fQAPid->Fill(valPid);
715 fITSnsigmaAft->Fill(track->P(),fITSnSigma);
716 fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
717 fTOFnsAft->Fill(track->P(),fTOFnSigma);
718 fTOFBetaAft->Fill(track->P(),beta);
719 fInclusiveElecPt->Fill(pt);
722 //=========================================================================================================
723 //----------------------Flow of Inclusive Electrons--------------------------------------------------------
724 AliFlowTrack *sTrack = new AliFlowTrack();
726 sTrack->SetID(track->GetID());
727 sTrack->SetForRPSelection(kTRUE);
728 sTrack->SetForPOISelection(kTRUE);
729 sTrack->SetMass(263732);
730 for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
732 // cout << " no of rps " << iRPs << endl;
733 AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
735 if (!iRP->InRPSelection()) continue;
736 if( sTrack->GetID() == iRP->GetID())
738 if(fDebug) printf(" was in RP set");
739 // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
740 iRP->SetForRPSelection(kFALSE);
741 // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
743 } //end of for loop on RPs
744 fFlowEvent->InsertTrack(((AliFlowTrack*) sTrack));
745 fFlowEvent->SetNumberOfPOIs(fFlowEvent->GetNumberOfPOIs()+1);
746 //============================Event Plane Method with V0====================================================
747 Double_t v2PhiV0A = TMath::Cos(2*(phi - evPlAngV0A));
748 Double_t v2PhiV0C = TMath::Cos(2*(phi - evPlAngV0C));
749 Double_t v2Phi[3] = {
755 Double_t v2PhiVz = TMath::Cos(2*(phi - evPlAngV0));
756 Double_t v2PhiV0tot[2] = {
760 if(EPweights) fV2Phivzerotot->Fill(v2PhiV0tot,weightEP);
761 if(!EPweights) fV2Phivzerotot->Fill(v2PhiV0tot);
764 //==========================================================================================================
765 //=========================================================================================================
769 fNonHFE = new AliSelectNonHFE();
770 fNonHFE->SetAODanalysis(kTRUE);
771 fNonHFE->SetInvariantMassCut(fInvmassCut);
772 if(fOP_angle) fNonHFE->SetOpeningAngleCut(fOpeningAngleCut);
773 //fNonHFE->SetChi2OverNDFCut(fChi2Cut);
774 //if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
775 fNonHFE->SetAlgorithm("DCA"); //KF
776 fNonHFE->SetPIDresponse(pidResponse);
777 fNonHFE->SetTrackCuts(-3,3);
779 fNonHFE->SetHistAngleBack(fOpeningAngleLS);
780 fNonHFE->SetHistAngle(fOpeningAngleULS);
781 //fNonHFE->SetHistDCABack(fDCABack);
782 //fNonHFE->SetHistDCA(fDCA);
783 fNonHFE->SetHistMassBack(fInvmassLS1);
784 fNonHFE->SetHistMass(fInvmassULS1);
786 fNonHFE->FindNonHFE(iTracks,track,fAOD);
788 // Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
789 // Int_t *fLsPartner = fNonHFE->GetPartnersLS();
790 // Bool_t fUlsIsPartner = kFALSE;
791 // Bool_t fLsIsPartner = kFALSE;
792 if(fNonHFE->IsULS()){
793 for(Int_t kULS =0; kULS < fNonHFE->GetNULS(); kULS++){
794 fULSElecPt->Fill(track->Pt());
799 for(Int_t kLS =0; kLS < fNonHFE->GetNLS(); kLS++){
800 fLSElecPt->Fill(track->Pt());
805 //=========================================================================================================
806 //----------------------Selection and Flow of Photonic Electrons-----------------------------
807 Bool_t fFlagPhotonicElec = kFALSE;
808 SelectPhotonicElectron(iTracks,track,fTPCnSigma,evPlAngV0,fFlagPhotonicElec,weightEP,mult);
809 if(fFlagPhotonicElec){fPhotoElecPt->Fill(pt);}
810 // Semi inclusive electron
811 if(!fFlagPhotonicElec){fSemiInclElecPt->Fill(pt);}
813 //-------------------------------------------------------------------------------------------
816 PostData(1, fOutputList);
817 PostData(2, fFlowEvent);
819 //----------hfe end---------
821 //_________________________________________
822 void AliAnalysisTaskFlowITSTPCTOFQCSP::SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track,Float_t fTPCnSigma,Double_t evPlAngV0, Bool_t &fFlagPhotonicElec, Double_t weightEPflat, Double_t multev)
825 //Identify non-heavy flavour electrons using Invariant mass method
826 Bool_t flagPhotonicElec = kFALSE;
828 for(Int_t jTracks = 0; jTracks<fAOD->GetNumberOfTracks(); jTracks++){
829 AliAODTrack *trackAsso = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(jTracks));
830 if(!trackAsso) AliFatal("Not a standard AOD");
832 printf("ERROR: Could not receive track %d\n", jTracks);
835 // if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; // TESTBIT FOR AOD double Counting
836 if(!trackAsso->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
839 if(!(trackAsso->GetStatus()&AliESDtrack::kITSrefit)) continue;
842 if(!(trackAsso->GetStatus()&AliESDtrack::kTPCrefit)) continue;
844 // if((!(trackAsso->GetStatus()&AliESDtrack::kITSrefit)|| (!(trackAsso->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
847 if(jTracks == itrack) continue;
848 Double_t ptAsso=-999., nsigma=-999.0;
849 Double_t mass=-999., width = -999;
850 Double_t openingAngle = -999.;
851 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
854 ptAsso = trackAsso->Pt();
855 Short_t chargeAsso = trackAsso->Charge();
856 Short_t charge = track->Charge();
857 // nsigma = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
858 if(trackAsso->Eta()<-0.9 || trackAsso->Eta()>0.9) continue;
859 if(ptAsso < fptminAsso) continue;
861 nsigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(trackAsso, AliPID::kElectron) : 1000;
864 Double_t CorrectTPCNSigma;
866 CorrectTPCNSigma = ftpcpid->GetCorrectedTPCnSigma(trackAsso->Eta(), multev, nsigma);
867 nsigma = CorrectTPCNSigma;
872 //if(trackAsso->GetTPCNcls() < 80) continue;
873 if(trackAsso->GetTPCNcls() < fAssoTPCCluster) continue;
874 if(nsigma < -3 || nsigma > 3) continue;
876 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
877 if(charge>0) fPDGe1 = -11;
878 if(chargeAsso>0) fPDGe2 = -11;
880 if(charge == chargeAsso) fFlagLS = kTRUE;
881 if(charge != chargeAsso) fFlagULS = kTRUE;
883 AliKFParticle::SetField(fAOD->GetMagneticField());
884 AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
885 AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
886 AliKFParticle recg(ge1, ge2);
888 if(recg.GetNDF()<1) continue;
889 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
890 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
891 recg.GetMass(mass,width);
893 openingAngle = ge1.GetAngle(ge2);
894 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
895 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
896 if(fOP_angle){if(openingAngle > fOpeningAngleCut) continue;}
899 if(fFlagLS) fInvmassLS1->Fill(mass);
900 if(fFlagULS) fInvmassULS1->Fill(mass);
903 Double_t MassSparseULS[3] = {
907 fSparseMassULS->Fill(MassSparseULS);
910 Double_t MassSparseLS[3] = {
914 fSparseMassLS->Fill(MassSparseLS);
918 if(mass<fInvmassCut){
919 if(fFlagULS){fULSElecPt->Fill(track->Pt());}
920 if(fFlagLS){fLSElecPt->Fill(track->Pt());}
924 Double_t phi = track->Phi();
925 Float_t DeltaPhi_eEP = TVector2::Phi_0_2pi(phi - evPlAngV0);
926 if(DeltaPhi_eEP > TMath::Pi()) {DeltaPhi_eEP = DeltaPhi_eEP - TMath::Pi();}
929 if(mass<fInvmassCut){
931 Double_t ulsSparse[3] = {
936 if(EPweights) fSparsephipsiULS->Fill(ulsSparse,weightEPflat);
937 if(!EPweights) fSparsephipsiULS->Fill(ulsSparse);
940 Double_t lsSparse[3] = {
945 if(EPweights) fSparsephipsiLS->Fill(lsSparse,weightEPflat);
946 if(!EPweights)fSparsephipsiLS->Fill(lsSparse);
952 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
953 flagPhotonicElec = kTRUE;
957 fFlagPhotonicElec = flagPhotonicElec;
959 //___________________________________________
960 void AliAnalysisTaskFlowITSTPCTOFQCSP::UserCreateOutputObjects()
964 //----------hfe initialising begin---------
965 fNullCuts = new AliFlowTrackCuts("null_cuts");
967 AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
968 cc->SetNbinsMult(10000);
970 cc->SetMultMax(10000);
976 cc->SetNbinsPhi(180);
978 cc->SetPhiMax(TMath::TwoPi());
989 // AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
990 // AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
991 // if (!inputHandler){
992 // AliFatal("Input handler needed");
995 // fPIDResponse=inputHandler->GetPIDResponse();
997 //pid response object
998 // if (!fPIDResponse)AliError("PIDResponse object was not created");
1001 //--------Initialize PID
1002 fPID->SetHasMCData(kFALSE);
1003 if(!fPID->GetNumberOfPIDdetectors())
1005 fPID->AddDetector("ITS", 0);
1006 fPID->AddDetector("TOF", 1);
1007 fPID->AddDetector("TPC", 2);
1011 fPID->SortDetectors();
1012 fPIDqa = new AliHFEpidQAmanager();
1013 fPIDqa->Initialize(fPID);
1017 //--------Initialize correction Framework and Cuts
1018 fCFM = new AliCFManager;
1019 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
1020 fCFM->SetNStepParticle(kNcutSteps);
1021 for(Int_t istep = 0; istep < kNcutSteps; istep++)
1022 fCFM->SetParticleCutsList(istep, NULL);
1025 AliWarning("Cuts not available. Default cuts will be used");
1026 fCuts = new AliHFEcuts;
1027 fCuts->CreateStandardCuts();
1031 fCuts->Initialize(fCFM);
1032 //----------hfe initialising end--------
1033 //---------Output Tlist
1034 fOutputList = new TList();
1035 fOutputList->SetOwner();
1036 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
1038 fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
1039 fOutputList->Add(fNoEvents);
1041 fITSnsigma = new TH2F("fITSnsigma", "ITS - n sigma before HFE pid",600,0,6,400,-20,20);
1042 fOutputList->Add(fITSnsigma);
1044 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma before HFE pid",600,0,6,400,-20,20);
1045 fOutputList->Add(fTPCnsigma);
1047 fITSnsigmaAft = new TH2F("fITSnsigmaAft", "ITS - n sigma after HFE pid",1000,0,10,300,-10,20);
1048 fOutputList->Add(fITSnsigmaAft);
1049 fITSvsTOF = new TH2F("fITSvsTOF", "ITS tof",400,-20,20,400,-20,20);
1050 fOutputList->Add(fITSvsTOF);
1051 fTPCvsITS = new TH2F("TPCvsITS", "TPC ITS",400,-20,20,400,-20,20);
1052 fOutputList->Add(fTPCvsITS);
1053 fTPCvsTOF = new TH2F("TPCvsTOF", "TPC TOF",400,-20,20,400,-20,20);
1054 fOutputList->Add(fTPCvsTOF);
1055 fTPCvsITSafterTOF = new TH2F("TPCvsITSafterTOF", "TPC ITS",400,-20,20,400,-20,20);
1056 fOutputList->Add(fTPCvsITSafterTOF);
1059 fITSnsigmaAftTOF = new TH2F("fITSnsigmaAftTOF", "ITS - n sigma after HFE pid",600,0,6,400,-20,20);
1060 fOutputList->Add(fITSnsigmaAftTOF);
1062 fTPCnsigmaAft = new TH2F("fTPCnsigmaAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
1063 fOutputList->Add(fTPCnsigmaAft);
1065 fTPCnsigmaVSptAft = new TH2F("fTPCnsigmaVSptAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
1066 fOutputList->Add(fTPCnsigmaVSptAft);
1068 fTPCnsigmaAftITSTOF = new TH2F("fTPCnsigmaAftITSTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
1069 fOutputList->Add(fTPCnsigmaAftITSTOF);
1071 fTPCnsigmaAftTOF = new TH2F("fTPCnsigmaAftTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
1072 fOutputList->Add(fTPCnsigmaAftTOF);
1074 fTOFns = new TH2F("fTOFns","track TOFnSigma",600,0,6,400,-20,20);
1075 fOutputList->Add(fTOFns);
1077 fTOFnsAft = new TH2F("fTOFnsAft","track TOFnSigma",600,0,6,400,-20,20);
1078 fOutputList->Add(fTOFnsAft);
1080 fTOFBetaAft = new TH2F("fTOFBetaAft","track TOFBeta",600,0,6,120,0,1.2);
1081 fOutputList->Add(fTOFBetaAft);
1083 fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",100,0,5);
1084 fOutputList->Add(fInclusiveElecPt);
1086 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,5);
1087 fOutputList->Add(fPhotoElecPt);
1089 fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",100,0,5);
1090 fOutputList->Add(fSemiInclElecPt);
1092 fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",100,0,5);
1093 fOutputList->Add(fULSElecPt);
1095 fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",100,0,5);
1096 fOutputList->Add(fLSElecPt);
1098 fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
1099 fOutputList->Add(fInvmassLS1);
1101 fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
1102 fOutputList->Add(fInvmassULS1);
1104 fCentralityPass = new TH1F("fCentralityPass", "Centrality Pass", 101, -1, 100);
1105 fOutputList->Add(fCentralityPass);
1107 fCentralityNoPass = new TH1F("fCentralityNoPass", "Centrality No Pass", 101, -1, 100);
1108 fOutputList->Add(fCentralityNoPass);
1110 fCentralityNoPassForFlattening = new TH1F("fCentralityNoPassForFlattening", "Centrality No Pass for flattening", 101, -1, 100);
1111 fOutputList->Add(fCentralityNoPassForFlattening);
1113 fCentralityBeforePileup = new TH1F("fCentralityBeforePileup", "fCentralityBeforePileup Pass", 101, -1, 100);
1114 fOutputList->Add(fCentralityBeforePileup);
1116 fCentralityAfterVZTRK = new TH1F("fCentralityAfterVZTRK", "fCentralityAfterVZTRK Pass", 101, -1, 100);
1117 fOutputList->Add(fCentralityAfterVZTRK);
1119 fCentralityAfterCorrCut = new TH1F("fCentralityAfterCorrCut", "fCentralityAfterCorrCut Pass", 101, -1, 100);
1120 fOutputList->Add(fCentralityAfterCorrCut);
1122 fPhi = new TH1F("fPhi", "#phi distribution", 100, -.5, 7);
1123 fOutputList->Add(fPhi);
1125 fEta = new TH1F("fEta", "#eta distribution", 100, -1.1, 1.1);
1126 fOutputList->Add(fEta);
1128 fVZEROA = new TH1F("fVZEROA", "VZERO A Multiplicity", 1000, 0, 10000);
1129 fOutputList->Add(fVZEROA);
1131 fVZEROC = new TH1F("fVZEROC", "VZERO C Multiplicity", 1000, 0, 10000);
1132 fOutputList->Add(fVZEROC);
1134 fTPCM = new TH1F("fTPCM", "TPC multiplicity", 1000, 0, 10000);
1135 fOutputList->Add(fTPCM);
1137 fvertex = new TH1D("fvertex", "vertex distribution", 300, -15,15);
1138 fOutputList->Add(fvertex);
1140 fMultCorBeforeCuts = new TH2F("fMultCorBeforeCuts", "TPC vs Global multiplicity (Before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1141 fOutputList->Add(fMultCorBeforeCuts);
1143 fMultCorAfterCuts = new TH2F("fMultCorAfterCuts", "TPC vs Global multiplicity (After cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1144 fOutputList->Add(fMultCorAfterCuts);
1146 fMultCorAfterCentrBeforeCuts = new TH2F("fMultCorAfterCentrBeforeCuts", "TPC vs Global multiplicity (After CC before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1147 fOutputList->Add(fMultCorAfterCentrBeforeCuts);
1149 fMultCorAfterVZTRKComp = new TH2F("fMultCorAfterVZTRKComp", "TPC vs Global multiplicity (After V0-TRK); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1150 fOutputList->Add(fMultCorAfterVZTRKComp);
1152 fMultCorAfterCorrCut = new TH2F("fMultCorAfterCorrCut", "TPC vs Global multiplicity (After CorrCut); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1153 fOutputList->Add(fMultCorAfterCorrCut);
1155 fMultvsCentr = new TH2F("fMultvsCentr", "Multiplicity vs centrality; centrality; Multiplicity", 100, 0., 100, 100, 0, 3000);
1156 fOutputList->Add(fMultvsCentr);
1158 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1159 fOutputList->Add(fOpeningAngleLS);
1161 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1162 fOutputList->Add(fOpeningAngleULS);
1166 //----------------------------------------------------------------------------
1167 EPVzA = new TH1D("EPVzA", "EPVzA", 60, -TMath::Pi()/2, TMath::Pi()/2);
1168 fOutputList->Add(EPVzA);
1169 EPVzC = new TH1D("EPVzC", "EPVzC", 60, -TMath::Pi()/2, TMath::Pi()/2);
1170 fOutputList->Add(EPVzC);
1171 EPTPC = new TH1D("EPTPC", "EPTPC", 60, -TMath::Pi()/2, TMath::Pi()/2);
1172 fOutputList->Add(EPTPC);
1173 EPVz = new TH1D("EPVz", "EPVz", 60, -TMath::Pi()/2, TMath::Pi()/2);
1174 fOutputList->Add(EPVz);
1175 EPTPCp = new TH1D("EPTPCp", "EPTPCp", 60, -TMath::Pi()/2, TMath::Pi()/2);
1176 fOutputList->Add(EPTPCp);
1177 EPTPCn = new TH1D("EPTPCn", "EPTPCn", 60, -TMath::Pi()/2, TMath::Pi()/2);
1178 fOutputList->Add(EPTPCn);
1181 //----------------------------------------------------------------------------
1182 fSubEventDPhiv2 = new TProfile("fSubEventDPhiv2", "fSubEventDPhiv2", 3, 0, 3);
1183 fSubEventDPhiv2->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
1184 fSubEventDPhiv2->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
1185 fSubEventDPhiv2->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
1186 fSubEventDPhiv2->Sumw2();
1187 fOutputList->Add(fSubEventDPhiv2);
1189 fSubEventDPhiv2new = new TProfile("fSubEventDPhiv2new", "fSubEventDPhiv2new", 3, 0, 3);
1190 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
1191 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
1192 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
1193 fSubEventDPhiv2new->Sumw2();
1194 fOutputList->Add(fSubEventDPhiv2new);
1196 //================================Event Plane with VZERO A and C=====================
1197 const Int_t nPtBins = 12;
1198 Double_t binsPt[nPtBins+1] = {0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5};
1200 Int_t bins[3] = { 50, 50, nPtBins};
1201 Double_t xmin[3] = { -1., -1., 0};
1202 Double_t xmax[3] = { 1., 1., 5};
1203 fV2Phi = new THnSparseF("fV2Phi", "v2A:v2C:pt", 3, bins, xmin, xmax);
1204 // Set bin limits for axes which are not standard binned
1205 fV2Phi->SetBinEdges(2, binsPt);
1207 fV2Phi->GetAxis(0)->SetTitle("v_{2} (V0A)");
1208 fV2Phi->GetAxis(1)->SetTitle("v_{2} (V0C)");
1209 fV2Phi->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
1211 fOutputList->Add(fV2Phi);
1214 //================================Event Plane with VZERO=====================
1215 Int_t binsV[2] = { 50, 100};
1216 Double_t xminV[2] = { -1., 0};
1217 Double_t xmaxV[2] = { 1., 5};
1218 fV2Phivzerotot = new THnSparseF("fV2Phivzerotot", "v2:pt", 2, binsV, xminV, xmaxV);
1219 // Set bin limits for axes which are not standard binned
1220 //fV2Phivzerotot->SetBinEdges(1, binsPt);
1222 fV2Phivzerotot->GetAxis(0)->SetTitle("v_{2} (V0)");
1223 fV2Phivzerotot->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
1224 fV2Phivzerotot->Sumw2();
1225 fOutputList->Add(fV2Phivzerotot);
1229 //----------------------------------------------------------------------------
1230 //----------------------------------------------------------------------------
1231 // if(fQAPIDSparse){
1232 // Int_t binsQA[4] = { 150, 100, 120, 3};
1233 // Double_t xminQA[4] = { 0., 50, 0, -1.5};
1234 // Double_t xmaxQA[4] = { 15., 150, 1.2, 1.5};
1235 // fQAPid = new THnSparseF("fQAPid", "p:dEdx:beta:ch", 4, binsQA, xminQA, xmaxQA);
1236 // fQAPid->GetAxis(0)->SetTitle("p (Gev/c");
1237 // fQAPid->GetAxis(1)->SetTitle("dE/dx");
1238 // fQAPid->GetAxis(2)->SetTitle("#beta (TOF)");
1239 // fQAPid->GetAxis(3)->SetTitle("charge");
1240 // fOutputList->Add(fQAPid);
1242 //===========================================================================
1243 Int_t binsQA2[3] = { 100, 40, 150/*, 60*/};
1244 Double_t xminQA2[3] = { 0., -2, -15/*, -3*/};
1245 Double_t xmaxQA2[3] = { 5., 2, 15/*, 3*/};
1246 fQAPidSparse = new THnSparseF("fQAPidSparse", "pt:itsnsigma:tpcnsigma", 3, binsQA2, xminQA2, xmaxQA2);
1247 fQAPidSparse->GetAxis(0)->SetTitle("pt (Gev/c)");
1248 fQAPidSparse->GetAxis(1)->SetTitle("itsnsigma");
1249 fQAPidSparse->GetAxis(2)->SetTitle("tpcnsigma");
1250 fOutputList->Add(fQAPidSparse);
1251 //===========================================================================
1255 Int_t binsphipsi[3] = { 100, 150, 6};
1256 Double_t xminphipsi[3] = { 0., -15, 0};
1257 Double_t xmaxphipsi[3] = { 5., 15, TMath::Pi()};
1258 fSparsephipsiULS = new THnSparseF("fSparsephipsiULS", "pt:tpcnsigma:DeltaPhiULS", 3, binsphipsi, xminphipsi, xmaxphipsi);
1259 fSparsephipsiULS->GetAxis(0)->SetTitle("pt (Gev/c)");
1260 fSparsephipsiULS->GetAxis(1)->SetTitle("tpcnsigma");
1261 fSparsephipsiULS->GetAxis(2)->SetTitle("DeltaPhiULS");
1262 fSparsephipsiULS->Sumw2();
1263 fOutputList->Add(fSparsephipsiULS);
1265 fSparsephipsiLS = new THnSparseF("fSparsephipsiLS", "pt:tpcnsigma:DeltaPhiLS", 3, binsphipsi, xminphipsi, xmaxphipsi);
1266 fSparsephipsiLS->GetAxis(0)->SetTitle("pt (Gev/c)");
1267 fSparsephipsiLS->GetAxis(1)->SetTitle("tpcnsigma");
1268 fSparsephipsiLS->GetAxis(2)->SetTitle("DeltaPhiLS");
1269 fSparsephipsiLS->Sumw2();
1270 fOutputList->Add(fSparsephipsiLS);
1273 Int_t binsmass[2] = { 100, 200};
1274 Double_t xminmass[2] = { 0., 0};
1275 Double_t xmaxmass[2] = { 5., 1.};
1276 fSparseMassULS = new THnSparseF("fSparseMassULS", "pt:mass (GeV/c^{2})", 2, binsmass, xminmass, xmaxmass);
1277 fSparseMassULS->GetAxis(0)->SetTitle("pt (Gev/c)");
1278 fSparseMassULS->GetAxis(1)->SetTitle("mass");
1279 fOutputList->Add(fSparseMassULS);
1281 fSparseMassLS = new THnSparseF("fSparseMassLS", "pt:mass (GeV/c^{2})", 2, binsmass, xminmass, xmaxmass);
1282 fSparseMassLS->GetAxis(0)->SetTitle("pt (Gev/c)");
1283 fSparseMassLS->GetAxis(1)->SetTitle("mass");
1284 fOutputList->Add(fSparseMassLS);
1287 EPVzAftW = new TH1D("EPVzAftW", "EPVzAftW",60, -TMath::Pi()/2, TMath::Pi()/2);
1288 fOutputList->Add(EPVzAftW);
1291 fOutputList->Add(fHistEPDistrWeight);
1294 PostData(1,fOutputList);
1295 // create and post flowevent
1296 fFlowEvent = new AliFlowEvent(10000);
1297 PostData(2, fFlowEvent);
1300 //________________________________________________________________________
1301 void AliAnalysisTaskFlowITSTPCTOFQCSP::Terminate(Option_t *)
1303 // Info("Terminate");
1304 AliAnalysisTaskSE::Terminate();
1306 //_____________________________________________________________________________
1307 template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::PlotVZeroMultiplcities(const T* event) const
1309 // QA multiplicity plots
1310 fVZEROA->Fill(event->GetVZEROData()->GetMTotV0A());
1311 fVZEROC->Fill(event->GetVZEROData()->GetMTotV0C());
1313 //_____________________________________________________________________________
1314 template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::SetNullCuts(T* event)
1317 if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
1318 fCutsRP->SetEvent(event, MCEvent());
1319 fNullCuts->SetParamType(AliFlowTrackCuts::kGlobal);
1320 fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
1321 fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
1322 fNullCuts->SetEvent(event, MCEvent());
1324 //_____________________________________________________________________________
1325 void AliAnalysisTaskFlowITSTPCTOFQCSP::PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const
1327 //Prepare flow events
1328 FlowEv->ClearFast();
1329 FlowEv->Fill(fCutsRP, fNullCuts);
1330 FlowEv->SetReferenceMultiplicity(iMulti);
1331 FlowEv->DefineDeadZone(0, 0, 0, 0);
1332 // FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
1334 //_____________________________________________________________________________
1335 Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1337 // Check single track cuts for a given cut step
1338 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1339 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1342 //_________________________________________
1343 void AliAnalysisTaskFlowITSTPCTOFQCSP::CheckCentrality(AliAODEvent* event, Bool_t ¢ralitypass)
1345 //============================Multiplicity TPV vs Global===============================================================================
1346 const Int_t nGoodTracks = event->GetNumberOfTracks();
1347 Float_t multTPC(0.); // tpc mult estimate
1348 Float_t multGlob(0.); // global multiplicity
1349 for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
1350 AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(event->GetTrack(iTracks));
1351 if(!trackAOD) AliFatal("Not a standard AOD");
1352 if (!trackAOD) continue;
1353 if (!(trackAOD->TestFilterBit(1))) continue;
1354 if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;
1357 for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
1358 AliAODTrack* trackAOD = dynamic_cast<AliAODTrack*>(event->GetTrack(iTracks));
1359 if(!trackAOD) AliFatal("Not a standard AOD");
1360 if (!trackAOD) continue;
1361 if (!(trackAOD->TestFilterBit(16))) continue;
1362 if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;
1363 Double_t b[2] = {-99., -99.};
1364 Double_t bCov[3] = {-99., -99., -99.};
1365 if (!(trackAOD->PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov))) continue;
1366 if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
1369 fMultCorBeforeCuts->Fill(multGlob, multTPC);//before all cuts...even before centrality selectrion
1370 //============================================================================================================================
1371 // Check if event is within the set centrality range. Falls back to V0 centrality determination if no method is set
1372 if (!fkCentralityMethod) AliFatal("No centrality method set! FATAL ERROR!");
1373 fCentrality = event->GetCentrality()->GetCentralityPercentile(fkCentralityMethod);
1374 // cout << "--------------Centrality evaluated-------------------------"<<endl;
1375 if ((fCentrality <= fCentralityMin) || (fCentrality > fCentralityMax))
1377 fCentralityNoPass->Fill(fCentrality);
1378 // cout << "--------------Fill no pass-----"<< fCentrality <<"--------------------"<<endl;
1379 centralitypass = kFALSE;
1382 // cout << "--------------Fill pass----"<< fCentrality <<"---------------------"<<endl;
1383 centralitypass = kTRUE;
1385 if (centralitypass){
1386 fMultCorAfterCentrBeforeCuts->Fill(multGlob, multTPC);
1387 fCentralityBeforePileup->Fill(fCentrality);
1388 }//...after centrality selectrion
1389 //============================================================================================================================
1390 //to remove the bias introduced by multeplicity outliers---------------------
1391 Float_t centTrk = event->GetCentrality()->GetCentralityPercentile("TRK");
1392 Float_t centv0 = event->GetCentrality()->GetCentralityPercentile("V0M");
1393 if (TMath::Abs(centv0 - centTrk) > 5.0){
1394 centralitypass = kFALSE;
1395 fCentralityNoPass->Fill(fCentrality);
1397 if (centralitypass){
1398 fMultCorAfterVZTRKComp->Fill(multGlob, multTPC);
1399 fCentralityAfterVZTRK->Fill(fCentrality);
1400 }//...after centrality selectrion
1401 //============================================================================================================================
1403 if(fTrigger==1 || fTrigger==4 || fTrigger==5){
1404 if(! (multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob))){
1405 // cout <<" Trigger ==" <<fTrigger<< endl;
1406 centralitypass = kFALSE;
1407 fCentralityNoPass->Fill(fCentrality);
1411 if(! (multTPC > (77.9 + 1.395*multGlob) && multTPC < (187.3 + 1.665*multGlob))){
1412 // cout <<" Trigger ==" <<fTrigger<< endl;
1413 centralitypass = kFALSE;
1414 fCentralityNoPass->Fill(fCentrality);
1418 if (centralitypass){
1419 fMultCorAfterCorrCut->Fill(multGlob, multTPC);
1420 fCentralityAfterCorrCut->Fill(fCentrality);
1421 }//...after CORR CUT
1422 //=================================All cuts are passed==================++++==================================================
1423 //=================================Now Centrality flattening for central trigger==================++++==================================================
1424 if(fTrigger==0 || fTrigger==4){
1425 if(!IsEventSelectedForCentrFlattening(fCentrality)){
1426 centralitypass = kFALSE;
1427 fCentralityNoPassForFlattening->Fill(fCentrality);
1430 //==============================fill histo after all cuts==============================++++==================================================
1432 fCentralityPass->Fill(fCentrality);
1433 fMultCorAfterCuts->Fill(multGlob, multTPC);
1434 fMultvsCentr->Fill(fCentrality, multTPC);
1437 //_____________________________________________________________________________
1438 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod)
1440 // Set a centrality range ]min, max] and define the method to use for centrality selection
1441 fCentralityMin = CentralityMin;
1442 fCentralityMax = CentralityMax;
1443 fkCentralityMethod = CentralityMethod;
1445 //_____________________________________________________________________________
1446 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetIDCuts(Double_t minTOFnSigma, Double_t maxTOFnSigma, Double_t minITSnsigmalowpt, Double_t maxITSnsigmalowpt, Double_t minITSnsigmahighpt, Double_t maxITSnsigmahighpt, Double_t minTPCnsigmalowpt, Double_t maxTPCnsigmalowpt, Double_t minTPCnsigmahighpt, Double_t maxTPCnsigmahighpt)
1449 fminTOFnSigma = minTOFnSigma;
1450 fmaxTOFnSigma = maxTOFnSigma;
1451 fminITSnsigmaLowpT = minITSnsigmalowpt;
1452 fmaxITSnsigmaLowpT = maxITSnsigmalowpt;
1453 fminITSnsigmaHighpT = minITSnsigmahighpt;
1454 fmaxITSnsigmaHighpT = maxITSnsigmahighpt;
1455 fminTPCnsigmaLowpT = minTPCnsigmalowpt;
1456 fmaxTPCnsigmaLowpT = maxTPCnsigmalowpt;
1457 fminTPCnsigmaHighpT = minTPCnsigmahighpt;
1458 fmaxTPCnsigmaHighpT = maxTPCnsigmahighpt;
1461 //_____________________________________________________________________________
1462 //_____________________________________________________________________________
1463 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetpTCuttrack(Double_t ptmin, Double_t ptmax)
1469 //_____________________________________________________________________________
1470 //_____________________________________________________________________________
1471 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef,Int_t switchTRand){
1472 // set the histo for centrality flattening
1473 // the centrality is flatten in the range minCentr,maxCentr
1474 // if centrRef is zero, the minimum in h within (minCentr,maxCentr) defines the reference
1475 // positive, the value of h(centrRef) defines the reference (-> the centrality distribution might be not flat in the whole desired range)
1476 // negative, h(bin with max in range)*centrRef is used to define the reference (-> defines the maximum loss of events, also in this case the distribution might be not flat)
1477 // switchTRand is used to set the unerflow bin of the histo: if it is < -1 in the analysis the random event selection will be done on using TRandom
1479 if(maxCentr<minCentr){
1480 AliWarning("AliAnalysisCheckCorrdist::Wrong centralities values while setting the histogram for centrality flattening");
1483 if(fHistCentrDistr)delete fHistCentrDistr;
1484 fHistCentrDistr=(TH1F*)h->Clone("hCentralityFlat");
1485 fHistCentrDistr->SetTitle("Reference histo for centrality flattening");
1486 Int_t minbin=fHistCentrDistr->FindBin(minCentr*1.00001); // fast if fix bin width
1487 Int_t maxbin=fHistCentrDistr->FindBin(maxCentr*0.9999);
1488 fHistCentrDistr->GetXaxis()->SetRange(minbin,maxbin);
1489 Double_t ref=0.,bincont=0.,binrefwidth=1.;
1491 if(TMath::Abs(centrRef)<0.0001){
1492 binref=fHistCentrDistr->GetMinimumBin();
1493 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1494 ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
1496 else if(centrRef>0.){
1497 binref=h->FindBin(centrRef);
1498 if(binref<1||binref>h->GetNbinsX()){
1499 AliWarning("AliRDHFCuts::Wrong centrality reference value while setting the histogram for centrality flattening");
1501 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1502 ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
1505 if(centrRef<-1) AliWarning("AliRDHFCuts: with this centrality reference no flattening will be applied");
1506 binref=fHistCentrDistr->GetMaximumBin();
1507 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1508 ref=fHistCentrDistr->GetMaximum()*TMath::Abs(centrRef)/binrefwidth;
1511 for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
1512 if(h->GetBinLowEdge(j)*1.0001>=minCentr&&h->GetBinLowEdge(j+1)*0.9999<=maxCentr){
1513 bincont=h->GetBinContent(j);
1514 fHistCentrDistr->SetBinContent(j,ref/bincont*h->GetBinWidth(j));
1515 fHistCentrDistr->SetBinError(j,h->GetBinError(j)*ref/bincont);
1518 h->SetBinContent(j,1.1);// prob > 1 to assure that events will not be rejected
1522 fHistCentrDistr->SetBinContent(0,switchTRand);
1527 //-------------------------------------------------
1528 Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::IsEventSelectedForCentrFlattening(Float_t centvalue){
1530 // Random event selection, based on fHistCentrDistr, to flatten the centrality distribution
1531 // Can be faster if it was required that fHistCentrDistr covers
1532 // exactly the desired centrality range (e.g. part of the lines below should be done during the
1533 // setting of the histo) and TH1::SetMinimum called
1536 if(!fHistCentrDistr) return kTRUE;
1537 // Int_t maxbin=fHistCentrDistr->FindBin(fMaxCentrality*0.9999);
1538 // if(maxbin>fHistCentrDistr->GetNbinsX()){
1539 // AliWarning("AliRDHFCuts: The maximum centrality exceeds the x-axis limit of the histogram for centrality flattening");
1542 Int_t bin=fHistCentrDistr->FindBin(centvalue); // Fast if the histo has a fix bin
1543 Double_t bincont=fHistCentrDistr->GetBinContent(bin);
1544 Double_t centDigits=centvalue-(Int_t)(centvalue*100.)/100.;// this is to extract a random number between 0 and 0.01
1546 if(fHistCentrDistr->GetBinContent(0)<-0.9999){
1547 if(gRandom->Uniform(1.)<bincont)return kTRUE;
1551 if(centDigits*100.<bincont)return kTRUE;
1555 //---------------------------------------------------------------------------
1556 //_____________________________________________________________________________
1557 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetHistoForEPFlattWeights(TH1D *h){
1559 if(fHistEPDistrWeight)delete fHistEPDistrWeight;
1560 fHistEPDistrWeight=(TH1D*)h->Clone("fHistEPDistrWeight");
1561 Double_t Inte = fHistEPDistrWeight->Integral()/fHistEPDistrWeight->GetNbinsX();
1565 for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
1566 Double_t w = Inte/fHistEPDistrWeight->GetBinContent(j);
1567 fHistEPDistrWeight->SetBinError(j,0./*h->GetBinError(j)*ref/bincont*/);
1569 fHistEPDistrWeight->SetBinContent(j,w);
1574 //-------------------------------------------------
1575 Double_t AliAnalysisTaskFlowITSTPCTOFQCSP::GiveMeWeight(Double_t EP){
1577 Int_t Bin = fHistEPDistrWeight->FindBin(EP);
1578 Double_t ww = fHistEPDistrWeight->GetBinContent(Bin);
1582 //-------------------------------------------------
1586 //_____________________________________________________________________________