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 "AliHFEpidBase.h"
74 #include "AliHFEpidQAmanager.h"
75 #include "AliHFEtools.h"
76 #include "AliCFContainer.h"
77 #include "AliCFManager.h"
78 #include "AliKFParticle.h"
79 #include "AliKFVertex.h"
80 #include "AliCentrality.h"
81 #include "AliVEvent.h"
83 #include "AliMCEvent.h"
85 #include "AliFlowCandidateTrack.h"
86 #include "AliFlowTrackCuts.h"
87 #include "AliFlowEventSimple.h"
88 #include "AliFlowCommonConstants.h"
89 #include "AliFlowEvent.h"
92 #include "AliESDVZERO.h"
93 #include "AliAODVZERO.h"
95 #include "AliPIDResponse.h"
96 #include "AliFlowTrack.h"
97 #include "AliAnalysisTaskVnV0.h"
98 #include "AliSelectNonHFE.h"
101 class AliFlowTrackCuts;
105 ClassImp(AliAnalysisTaskFlowITSTPCTOFQCSP)
106 //________________________________________________________________________
107 AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP(const char *name)
108 : AliAnalysisTaskSE(name)
113 ,fIdentifiedAsOutInz(kFALSE)
114 ,fPassTheEventCut(kFALSE)
118 ,fCutsRP(0) // track cuts for reference particles
119 ,fNullCuts(0) // dummy cuts for flow event tracks
120 ,fFlowEvent(0) //! flow events (one for each inv mass band)
121 ,fkCentralityMethod(0)
139 ,fTPCnsigmaVSptAft(0)
144 ,fCentralityNoPass(0)
151 ,fMultCorAfterCuts(0)
159 ,fMultCorBeforeCuts(0)
161 ,fminITSnsigmaLowpT(-1)
162 ,fmaxITSnsigmaLowpT(1)
163 ,fminITSnsigmaHighpT(-2)
164 ,fmaxITSnsigmaHighpT(2)
165 ,fminTPCnsigmaLowpT(-1)
166 ,fmaxTPCnsigmaLowpT(3)
167 ,fminTPCnsigmaHighpT(0)
168 ,fmaxTPCnsigmaHighpT(3)
169 //,fQAPIDSparse(kFALSE)
175 ,fOpeningAngleCut(0.1)
179 ,fNonHFE(new AliSelectNonHFE)
182 ,fTPCnsigmaAftITSTOF(0)
187 ,fTPCvsITSafterTOF(0)
190 ,fMultCorAfterCentrBeforeCuts(0)
191 ,fMultCorAfterVZTRKComp(0)
192 ,fCentralityBeforePileup(0)
193 ,fCentralityAfterVZTRK(0)
194 ,fCentralityAfterCorrCut(0)
195 ,fMultCorAfterCorrCut(0)
199 ,fSubEventDPhiv2new(0)
201 ,fHistCentrDistr(0x0)
202 ,fCentralityNoPassForFlattening(0)
207 fPID = new AliHFEpid("hfePid");
208 // Define input and output slots here
209 // Input slot #0 works with a TChain
210 DefineInput(0, TChain::Class());
211 // Output slot #0 id reserved by the base class for AOD
212 // Output slot #1 writes into a TH1 container
213 // DefineOutput(1, TH1I::Class());
214 DefineOutput(1, TList::Class());
215 DefineOutput(2, AliFlowEventSimple::Class());
218 //________________________________________________________________________
219 AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP()
220 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElectFlow")
225 ,fIdentifiedAsOutInz(kFALSE)
226 ,fPassTheEventCut(kFALSE)
230 ,fCutsRP(0) // track cuts for reference particles
231 ,fNullCuts(0) // dummy cuts for flow event tracks
232 ,fFlowEvent(0) //! flow events (one for each inv mass band)
233 ,fkCentralityMethod(0)
251 ,fTPCnsigmaVSptAft(0)
256 ,fCentralityNoPass(0)
263 ,fMultCorAfterCuts(0)
271 ,fMultCorBeforeCuts(0)
273 ,fminITSnsigmaLowpT(-1)
274 ,fmaxITSnsigmaLowpT(1)
275 ,fminITSnsigmaHighpT(-2)
276 ,fmaxITSnsigmaHighpT(2)
277 ,fminTPCnsigmaLowpT(-1)
278 ,fmaxTPCnsigmaLowpT(3)
279 ,fminTPCnsigmaHighpT(0)
280 ,fmaxTPCnsigmaHighpT(3)
281 //,fQAPIDSparse(kFALSE)
287 ,fOpeningAngleCut(0.1)
291 ,fNonHFE(new AliSelectNonHFE)
294 ,fTPCnsigmaAftITSTOF(0)
299 ,fTPCvsITSafterTOF(0)
302 ,fMultCorAfterCentrBeforeCuts(0)
303 ,fMultCorAfterVZTRKComp(0)
304 ,fCentralityBeforePileup(0)
305 ,fCentralityAfterVZTRK(0)
306 ,fCentralityAfterCorrCut(0)
307 ,fMultCorAfterCorrCut(0)
311 ,fSubEventDPhiv2new(0)
313 ,fHistCentrDistr(0x0)
314 ,fCentralityNoPassForFlattening(0)
317 //Default constructor
318 fPID = new AliHFEpid("hfePid");
320 // Define input and output slots here
321 // Input slot #0 works with a TChain
322 DefineInput(0, TChain::Class());
323 // Output slot #0 id reserved by the base class for AOD
324 // Output slot #1 writes into a TH1 container
325 // DefineOutput(1, TH1I::Class());
326 DefineOutput(1, TList::Class());
327 DefineOutput(2, AliFlowEventSimple::Class());
328 //DefineOutput(3, TTree::Class());
330 //_________________________________________
332 AliAnalysisTaskFlowITSTPCTOFQCSP::~AliAnalysisTaskFlowITSTPCTOFQCSP()
338 // delete fPIDResponse;
341 if (fOutputList) delete fOutputList;
342 if (fFlowEvent) delete fFlowEvent;
345 //_________________________________________
347 void AliAnalysisTaskFlowITSTPCTOFQCSP::UserExec(Option_t*)
350 //Called for each event
352 // create pointer to event
354 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
359 printf("ERROR: fAOD not available\n");
365 AliError("HFE cuts not available");
369 if(!fPID->IsInitialized())
371 // Initialize PID with the given run number
372 AliWarning("PID not initialised, get from Run no");
373 fPID->InitializePID(fAOD->GetRunNumber());
376 // cout << "kTrigger == " << fTrigger <<endl;
379 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral)) return;
382 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral)) return;
385 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA)) return;
388 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB)) return;
391 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kCentral | AliVEvent::kSemiCentral))) return;
396 //---------------CENTRALITY AND EVENT SELECTION-----------------------
400 Int_t fNOtrks = fAOD->GetNumberOfTracks();
402 const AliAODVertex* trkVtx = fAOD->GetPrimaryVertex();
403 if (!trkVtx || trkVtx->GetNContributors()<=0)return;
404 TString vtxTtl = trkVtx->GetTitle();
405 if (!vtxTtl.Contains("VertexerTracks"))return;
406 const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
407 if (!spdVtx || spdVtx->GetNContributors()<=0)return;
408 if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5)return;
409 vtxz = trkVtx->GetZ();
410 if(TMath::Abs(vtxz)>fVz)return;
413 if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) return;
414 if(fNOtrks<2) return;
417 Bool_t pass = kFALSE; //to select centrality
418 CheckCentrality(fAOD,pass);
425 PlotVZeroMultiplcities(fAOD);
428 PrepareFlowEvent(fAOD->GetNumberOfTracks(),fFlowEvent); //Calculate event plane Qvector and EP resolution for inclusive
430 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
433 AliDebug(1, "Using default PID Response");
434 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
437 fPID->SetPIDResponse(pidResponse);
439 fCFM->SetRecEventInfo(fAOD);
441 // Look for kink mother
442 Int_t numberofvertices = fAOD->GetNumberOfVertices();
443 Double_t listofmotherkink[numberofvertices];
444 Int_t numberofmotherkink = 0;
445 for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
446 AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
447 if(!aodvertex) continue;
448 if(aodvertex->GetType()==AliAODVertex::kKink) {
449 AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
450 if(!mother) continue;
451 Int_t idmother = mother->GetID();
452 listofmotherkink[numberofmotherkink] = idmother;
453 //printf("ID %d\n",idmother);
454 numberofmotherkink++;
458 //=============================================V0EP from Alex======================================================================
459 Double_t qxEPa = 0, qyEPa = 0;
460 Double_t qxEPc = 0, qyEPc = 0;
461 Double_t qxEP = 0, qyEP = 0;
463 Double_t evPlAngV0A = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 8, 2, qxEPa, qyEPa);
464 Double_t evPlAngV0C = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 9, 2, qxEPc, qyEPc);
465 Double_t evPlAngV0 = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 10, 2, qxEP, qyEP);
468 Double_t Qx2 = 0, Qy2 = 0;
469 Double_t Qx2p = 0, Qy2p = 0;
470 Double_t Qx2n = 0, Qy2n = 0;
472 for (Int_t iT = 0; iT < fAOD->GetNumberOfTracks(); iT++){
474 AliAODTrack* aodTrack = fAOD->GetTrack(iT);
479 if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < 70) || (aodTrack->Pt() >= 20.0))
482 if (!aodTrack->TestFilterBit(128))
486 if(aodTrack->Eta()>0 && aodTrack->Eta()<0.8){
488 Qx2p += TMath::Cos(2*aodTrack->Phi());
489 Qy2p += TMath::Sin(2*aodTrack->Phi());
491 if(aodTrack->Eta()<0 && aodTrack->Eta()> -0.8){
493 Qx2n += TMath::Cos(2*aodTrack->Phi());
494 Qy2n += TMath::Sin(2*aodTrack->Phi());
498 Qx2 += TMath::Cos(2*aodTrack->Phi());
499 Qy2 += TMath::Sin(2*aodTrack->Phi());
506 Double_t evPlAngTPC = TMath::ATan2(Qy2, Qx2)/2.;
507 Double_t evPlAngTPCn = TMath::ATan2(Qy2n, Qx2n)/2.;
508 Double_t evPlAngTPCp = TMath::ATan2(Qy2p, Qx2p)/2.;
510 EPVzA->Fill(evPlAngV0A);
511 EPVzC->Fill(evPlAngV0C);
512 EPTPC->Fill(evPlAngTPC);
514 EPTPCn->Fill(evPlAngTPCn);
515 EPTPCp->Fill(evPlAngTPCp);
516 EPVz->Fill(evPlAngV0);
518 fSubEventDPhiv2->Fill(0.5, TMath::Cos(2.*(evPlAngV0A-evPlAngTPC))); // vzeroa - tpc
519 fSubEventDPhiv2->Fill(1.5, TMath::Cos(2.*(evPlAngV0A-evPlAngV0C))); // vzeroa - vzeroc
520 fSubEventDPhiv2->Fill(2.5, TMath::Cos(2.*(evPlAngV0C-evPlAngTPC))); // tpc - vzeroc
523 fSubEventDPhiv2new->Fill(0.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCp))); // vzero - tpcp
524 fSubEventDPhiv2new->Fill(1.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCn))); // vzero - tpcn
525 fSubEventDPhiv2new->Fill(2.5, TMath::Cos(2.*(evPlAngTPCp-evPlAngTPCn))); // tpcp - tpcn
528 //====================================================================================================================
530 AliAODTrack *track = NULL;
533 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++)
535 track = fAOD->GetTrack(iTracks);
538 printf("ERROR: Could not receive track %d\n", iTracks);
541 if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; // TESTBIT FOR AOD double Counting
543 //--------------------------------------hfe begin-----------------------------------------------------------
544 //==========================================================================================================
545 //======================================track cuts==========================================================
546 if(track->Eta()<-0.8 || track->Eta()>0.8) continue; //eta cuts on candidates
548 // RecKine: ITSTPC cuts
549 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
551 // Reject kink mother
552 Bool_t kinkmotherpass = kTRUE;
553 for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
554 if(track->GetID() == listofmotherkink[kinkmother]) {
555 kinkmotherpass = kFALSE;
559 if(!kinkmotherpass) continue;
562 // if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; //deleted for DCA absence
563 // HFEcuts: ITS layers cuts
564 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
565 // HFE cuts: TPC PID cleanup
566 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
567 //==========================================================================================================
568 Double_t eta = track->Eta();
569 Double_t phi = track->Phi();
570 Double_t pt = track->Pt(); //pt track after cuts
571 if(pt<fpTCutmin || pt>fpTCutmax) continue;
572 //==========================================================================================================
573 //=========================================PID==============================================================
574 if(track->GetTPCsignalN() < fTPCS) continue;
575 Float_t fITSnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasITS(track, AliPID::kElectron) : 1000;
576 Float_t fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
577 Float_t fTOFnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTOF(track, AliPID::kElectron) : 1000;
578 // Float_t eDEDX = fPIDResponse->GetTPCResponse().GetExpectedSignal(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxDefault, kTRUE);
579 fITSnsigma->Fill(track->P(),fITSnSigma);
580 fTPCnsigma->Fill(track->P(),fTPCnSigma);
581 fTOFns->Fill(track->P(),fTOFnSigma);
582 fITSvsTOF->Fill(fTOFnSigma,fITSnSigma);
583 fTPCvsITS->Fill(fTPCnSigma,fITSnSigma);
584 fTPCvsTOF->Fill(fTPCnSigma,fTOFnSigma);
587 if(fTOFnSigma < fminTOFnSigma || fTOFnSigma > fmaxTOFnSigma) continue;
588 }//cuts on nsigma tof full pt range
590 fITSnsigmaAftTOF->Fill(track->P(),fITSnSigma);
591 fTPCnsigmaAftTOF->Fill(track->P(),fTPCnSigma);
592 fTPCvsITSafterTOF->Fill(fTPCnSigma,fITSnSigma);
594 Double_t valPidSparse[3] = {
599 fQAPidSparse->Fill(valPidSparse);
603 if(fITSnSigma < fminITSnsigmaLowpT || fITSnSigma > fmaxITSnsigmaLowpT)continue;
604 }//cuts on nsigma its low pt
606 if(fITSnSigma < fminITSnsigmaHighpT || fITSnSigma > fmaxITSnsigmaHighpT)continue;
607 }//cuts on nsigma its high pt
608 fTPCnsigmaAftITSTOF->Fill(track->P(),fTPCnSigma);
609 if(pt >= 0.25 && pt < 1.5){
610 if(fTPCnSigma < fminTPCnsigmaLowpT || fTPCnSigma > fmaxTPCnsigmaLowpT) continue;
611 }//cuts on nsigma tpc lowpt
613 if(fTPCnSigma < fminTPCnsigmaHighpT || fTPCnSigma > fmaxTPCnsigmaHighpT) continue;
614 }//cuts on nsigma tpc high pt
615 fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
616 fTPCnsigmaVSptAft->Fill(pt,fTPCnSigma);
618 //==========================================================================================================
619 //=========================================QA PID SPARSE====================================================
620 Float_t timeTOF = track->GetTOFsignal();
621 Double_t intTime[5] = {-99., -99., -99., -99., -99.};
622 track->GetIntegratedTimes(intTime);
623 Float_t timeElec = intTime[0];
624 Float_t intLength = 2.99792458e-2* timeElec;
626 if ((intLength > 0) && (timeTOF > 0))
627 beta = intLength/2.99792458e-2/timeTOF;
630 // Double_t valPid[4] = {
632 // track->GetTPCsignal(),
636 // fQAPid->Fill(valPid);
640 fITSnsigmaAft->Fill(track->P(),fITSnSigma);
641 fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
642 fTOFnsAft->Fill(track->P(),fTOFnSigma);
643 fTOFBetaAft->Fill(track->P(),beta);
644 fInclusiveElecPt->Fill(pt);
647 //=========================================================================================================
648 //----------------------Flow of Inclusive Electrons--------------------------------------------------------
649 AliFlowTrack *sTrack = new AliFlowTrack();
651 sTrack->SetID(track->GetID());
652 sTrack->SetForRPSelection(kTRUE);
653 sTrack->SetForPOISelection(kTRUE);
654 sTrack->SetMass(263732);
655 for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
657 // cout << " no of rps " << iRPs << endl;
658 AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
660 if (!iRP->InRPSelection()) continue;
661 if( sTrack->GetID() == iRP->GetID())
663 if(fDebug) printf(" was in RP set");
664 // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
665 iRP->SetForRPSelection(kFALSE);
666 // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
668 } //end of for loop on RPs
669 fFlowEvent->InsertTrack(((AliFlowTrack*) sTrack));
670 fFlowEvent->SetNumberOfPOIs(fFlowEvent->GetNumberOfPOIs()+1);
671 //============================Event Plane Method with V0====================================================
672 Double_t v2PhiV0A = TMath::Cos(2*(phi - evPlAngV0A));
673 Double_t v2PhiV0C = TMath::Cos(2*(phi - evPlAngV0C));
674 Double_t v2Phi[3] = {
680 Double_t v2PhiVz = TMath::Cos(2*(phi - evPlAngV0));
681 Double_t v2PhiV0tot[2] = {
684 fV2Phivzerotot->Fill(v2PhiV0tot);
686 //==========================================================================================================
687 //=========================================================================================================
691 fNonHFE = new AliSelectNonHFE();
692 fNonHFE->SetAODanalysis(kTRUE);
693 fNonHFE->SetInvariantMassCut(fInvmassCut);
694 if(fOP_angle) fNonHFE->SetOpeningAngleCut(fOpeningAngleCut);
695 //fNonHFE->SetChi2OverNDFCut(fChi2Cut);
696 //if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
697 fNonHFE->SetAlgorithm("DCA"); //KF
698 fNonHFE->SetPIDresponse(pidResponse);
699 fNonHFE->SetTrackCuts(-3,3);
701 fNonHFE->SetHistAngleBack(fOpeningAngleLS);
702 fNonHFE->SetHistAngle(fOpeningAngleULS);
703 //fNonHFE->SetHistDCABack(fDCABack);
704 //fNonHFE->SetHistDCA(fDCA);
705 fNonHFE->SetHistMassBack(fInvmassLS1);
706 fNonHFE->SetHistMass(fInvmassULS1);
708 fNonHFE->FindNonHFE(iTracks,track,fAOD);
710 // Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
711 // Int_t *fLsPartner = fNonHFE->GetPartnersLS();
712 // Bool_t fUlsIsPartner = kFALSE;
713 // Bool_t fLsIsPartner = kFALSE;
714 if(fNonHFE->IsULS()){
715 for(Int_t kULS =0; kULS < fNonHFE->GetNULS(); kULS++){
716 fULSElecPt->Fill(track->Pt());
721 for(Int_t kLS =0; kLS < fNonHFE->GetNLS(); kLS++){
722 fLSElecPt->Fill(track->Pt());
727 //=========================================================================================================
728 //----------------------Selection and Flow of Photonic Electrons-----------------------------
729 Bool_t fFlagPhotonicElec = kFALSE;
730 SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
731 if(fFlagPhotonicElec){fPhotoElecPt->Fill(pt);}
732 // Semi inclusive electron
733 if(!fFlagPhotonicElec){fSemiInclElecPt->Fill(pt);}
735 //-------------------------------------------------------------------------------------------
738 PostData(1, fOutputList);
739 PostData(2, fFlowEvent);
741 //----------hfe end---------
743 //_________________________________________
744 void AliAnalysisTaskFlowITSTPCTOFQCSP::SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track, Bool_t &fFlagPhotonicElec)
747 //Identify non-heavy flavour electrons using Invariant mass method
748 Bool_t flagPhotonicElec = kFALSE;
750 for(Int_t jTracks = 0; jTracks<fAOD->GetNumberOfTracks(); jTracks++){
751 AliAODTrack *trackAsso = fAOD->GetTrack(jTracks);
753 printf("ERROR: Could not receive track %d\n", jTracks);
756 // if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; // TESTBIT FOR AOD double Counting
757 if(!trackAsso->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
758 if((!(trackAsso->GetStatus()&AliESDtrack::kITSrefit)|| (!(trackAsso->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
761 if(jTracks == itrack) continue;
762 Double_t ptAsso=-999., nsigma=-999.0;
763 Double_t mass=-999., width = -999;
764 Double_t openingAngle = -999.;
765 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
768 ptAsso = trackAsso->Pt();
769 Short_t chargeAsso = trackAsso->Charge();
770 Short_t charge = track->Charge();
771 // nsigma = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
772 nsigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(trackAsso, AliPID::kElectron) : 1000;
775 if(trackAsso->GetTPCNcls() < 80) continue;
776 if(nsigma < -3 || nsigma > 3) continue;
777 if(trackAsso->Eta()<-0.9 || trackAsso->Eta()>0.9) continue;
778 if(ptAsso < fptminAsso) continue;
780 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
781 if(charge>0) fPDGe1 = -11;
782 if(chargeAsso>0) fPDGe2 = -11;
784 if(charge == chargeAsso) fFlagLS = kTRUE;
785 if(charge != chargeAsso) fFlagULS = kTRUE;
787 AliKFParticle::SetField(fAOD->GetMagneticField());
788 AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
789 AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
790 AliKFParticle recg(ge1, ge2);
792 if(recg.GetNDF()<1) continue;
793 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
794 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
795 recg.GetMass(mass,width);
797 openingAngle = ge1.GetAngle(ge2);
798 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
799 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
800 if(fOP_angle){if(openingAngle > fOpeningAngleCut) continue;}
803 if(fFlagLS) fInvmassLS1->Fill(mass);
804 if(fFlagULS) fInvmassULS1->Fill(mass);
806 if(mass<fInvmassCut){
807 if(fFlagULS){fULSElecPt->Fill(track->Pt());}
808 if(fFlagLS){fLSElecPt->Fill(track->Pt());}
811 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
812 flagPhotonicElec = kTRUE;
816 fFlagPhotonicElec = flagPhotonicElec;
818 //___________________________________________
819 void AliAnalysisTaskFlowITSTPCTOFQCSP::UserCreateOutputObjects()
823 //----------hfe initialising begin---------
824 fNullCuts = new AliFlowTrackCuts("null_cuts");
826 AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
827 cc->SetNbinsMult(10000);
829 cc->SetMultMax(10000);
835 cc->SetNbinsPhi(180);
837 cc->SetPhiMax(TMath::TwoPi());
848 // AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
849 // AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
850 // if (!inputHandler){
851 // AliFatal("Input handler needed");
854 // fPIDResponse=inputHandler->GetPIDResponse();
856 //pid response object
857 // if (!fPIDResponse)AliError("PIDResponse object was not created");
860 //--------Initialize PID
861 fPID->SetHasMCData(kFALSE);
862 if(!fPID->GetNumberOfPIDdetectors())
864 fPID->AddDetector("ITS", 0);
865 fPID->AddDetector("TOF", 1);
866 fPID->AddDetector("TPC", 2);
870 fPID->SortDetectors();
871 fPIDqa = new AliHFEpidQAmanager();
872 fPIDqa->Initialize(fPID);
876 //--------Initialize correction Framework and Cuts
877 fCFM = new AliCFManager;
878 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
879 fCFM->SetNStepParticle(kNcutSteps);
880 for(Int_t istep = 0; istep < kNcutSteps; istep++)
881 fCFM->SetParticleCutsList(istep, NULL);
884 AliWarning("Cuts not available. Default cuts will be used");
885 fCuts = new AliHFEcuts;
886 fCuts->CreateStandardCuts();
890 fCuts->Initialize(fCFM);
891 //----------hfe initialising end--------
892 //---------Output Tlist
893 fOutputList = new TList();
894 fOutputList->SetOwner();
895 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
897 fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
898 fOutputList->Add(fNoEvents);
900 fITSnsigma = new TH2F("fITSnsigma", "ITS - n sigma before HFE pid",600,0,6,400,-20,20);
901 fOutputList->Add(fITSnsigma);
903 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma before HFE pid",600,0,6,400,-20,20);
904 fOutputList->Add(fTPCnsigma);
906 fITSnsigmaAft = new TH2F("fITSnsigmaAft", "ITS - n sigma after HFE pid",1000,0,10,300,-10,20);
907 fOutputList->Add(fITSnsigmaAft);
908 fITSvsTOF = new TH2F("fITSvsTOF", "ITS tof",400,-20,20,400,-20,20);
909 fOutputList->Add(fITSvsTOF);
910 fTPCvsITS = new TH2F("TPCvsITS", "TPC ITS",400,-20,20,400,-20,20);
911 fOutputList->Add(fTPCvsITS);
912 fTPCvsTOF = new TH2F("TPCvsTOF", "TPC TOF",400,-20,20,400,-20,20);
913 fOutputList->Add(fTPCvsTOF);
914 fTPCvsITSafterTOF = new TH2F("TPCvsITSafterTOF", "TPC ITS",400,-20,20,400,-20,20);
915 fOutputList->Add(fTPCvsITSafterTOF);
918 fITSnsigmaAftTOF = new TH2F("fITSnsigmaAftTOF", "ITS - n sigma after HFE pid",600,0,6,400,-20,20);
919 fOutputList->Add(fITSnsigmaAftTOF);
921 fTPCnsigmaAft = new TH2F("fTPCnsigmaAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
922 fOutputList->Add(fTPCnsigmaAft);
924 fTPCnsigmaVSptAft = new TH2F("fTPCnsigmaVSptAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
925 fOutputList->Add(fTPCnsigmaVSptAft);
927 fTPCnsigmaAftITSTOF = new TH2F("fTPCnsigmaAftITSTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
928 fOutputList->Add(fTPCnsigmaAftITSTOF);
930 fTPCnsigmaAftTOF = new TH2F("fTPCnsigmaAftTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
931 fOutputList->Add(fTPCnsigmaAftTOF);
933 fTOFns = new TH2F("fTOFns","track TOFnSigma",600,0,6,400,-20,20);
934 fOutputList->Add(fTOFns);
936 fTOFnsAft = new TH2F("fTOFnsAft","track TOFnSigma",600,0,6,400,-20,20);
937 fOutputList->Add(fTOFnsAft);
939 fTOFBetaAft = new TH2F("fTOFBetaAft","track TOFBeta",600,0,6,120,0,1.2);
940 fOutputList->Add(fTOFBetaAft);
942 fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",100,0,5);
943 fOutputList->Add(fInclusiveElecPt);
945 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,5);
946 fOutputList->Add(fPhotoElecPt);
948 fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",100,0,5);
949 fOutputList->Add(fSemiInclElecPt);
951 fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",100,0,5);
952 fOutputList->Add(fULSElecPt);
954 fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",100,0,5);
955 fOutputList->Add(fLSElecPt);
957 fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
958 fOutputList->Add(fInvmassLS1);
960 fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
961 fOutputList->Add(fInvmassULS1);
963 fCentralityPass = new TH1F("fCentralityPass", "Centrality Pass", 101, -1, 100);
964 fOutputList->Add(fCentralityPass);
966 fCentralityNoPass = new TH1F("fCentralityNoPass", "Centrality No Pass", 101, -1, 100);
967 fOutputList->Add(fCentralityNoPass);
969 fCentralityNoPassForFlattening = new TH1F("fCentralityNoPassForFlattening", "Centrality No Pass for flattening", 101, -1, 100);
970 fOutputList->Add(fCentralityNoPassForFlattening);
972 fCentralityBeforePileup = new TH1F("fCentralityBeforePileup", "fCentralityBeforePileup Pass", 101, -1, 100);
973 fOutputList->Add(fCentralityBeforePileup);
975 fCentralityAfterVZTRK = new TH1F("fCentralityAfterVZTRK", "fCentralityAfterVZTRK Pass", 101, -1, 100);
976 fOutputList->Add(fCentralityAfterVZTRK);
978 fCentralityAfterCorrCut = new TH1F("fCentralityAfterCorrCut", "fCentralityAfterCorrCut Pass", 101, -1, 100);
979 fOutputList->Add(fCentralityAfterCorrCut);
981 fPhi = new TH1F("fPhi", "#phi distribution", 100, -.5, 7);
982 fOutputList->Add(fPhi);
984 fEta = new TH1F("fEta", "#eta distribution", 100, -1.1, 1.1);
985 fOutputList->Add(fEta);
987 fVZEROA = new TH1F("fVZEROA", "VZERO A Multiplicity", 1000, 0, 10000);
988 fOutputList->Add(fVZEROA);
990 fVZEROC = new TH1F("fVZEROC", "VZERO C Multiplicity", 1000, 0, 10000);
991 fOutputList->Add(fVZEROC);
993 fTPCM = new TH1F("fTPCM", "TPC multiplicity", 1000, 0, 10000);
994 fOutputList->Add(fTPCM);
996 fvertex = new TH1D("fvertex", "vertex distribution", 300, -15,15);
997 fOutputList->Add(fvertex);
999 fMultCorBeforeCuts = new TH2F("fMultCorBeforeCuts", "TPC vs Global multiplicity (Before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1000 fOutputList->Add(fMultCorBeforeCuts);
1002 fMultCorAfterCuts = new TH2F("fMultCorAfterCuts", "TPC vs Global multiplicity (After cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1003 fOutputList->Add(fMultCorAfterCuts);
1005 fMultCorAfterCentrBeforeCuts = new TH2F("fMultCorAfterCentrBeforeCuts", "TPC vs Global multiplicity (After CC before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1006 fOutputList->Add(fMultCorAfterCentrBeforeCuts);
1008 fMultCorAfterVZTRKComp = new TH2F("fMultCorAfterVZTRKComp", "TPC vs Global multiplicity (After V0-TRK); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1009 fOutputList->Add(fMultCorAfterVZTRKComp);
1011 fMultCorAfterCorrCut = new TH2F("fMultCorAfterCorrCut", "TPC vs Global multiplicity (After CorrCut); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
1012 fOutputList->Add(fMultCorAfterCorrCut);
1014 fMultvsCentr = new TH2F("fMultvsCentr", "Multiplicity vs centrality; centrality; Multiplicity", 100, 0., 100, 100, 0, 3000);
1015 fOutputList->Add(fMultvsCentr);
1017 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1018 fOutputList->Add(fOpeningAngleLS);
1020 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1021 fOutputList->Add(fOpeningAngleULS);
1025 //----------------------------------------------------------------------------
1026 EPVzA = new TH1D("EPVzA", "EPVzA", 80, -2, 2);
1027 fOutputList->Add(EPVzA);
1028 EPVzC = new TH1D("EPVzC", "EPVzC", 80, -2, 2);
1029 fOutputList->Add(EPVzC);
1030 EPTPC = new TH1D("EPTPC", "EPTPC", 80, -2, 2);
1031 fOutputList->Add(EPTPC);
1032 EPVz = new TH1D("EPVz", "EPVz", 80, -2, 2);
1033 fOutputList->Add(EPVz);
1034 EPTPCp = new TH1D("EPTPCp", "EPTPCp", 80, -2, 2);
1035 fOutputList->Add(EPTPCp);
1036 EPTPCn = new TH1D("EPTPCn", "EPTPCn", 80, -2, 2);
1037 fOutputList->Add(EPTPCn);
1040 //----------------------------------------------------------------------------
1041 fSubEventDPhiv2 = new TProfile("fSubEventDPhiv2", "fSubEventDPhiv2", 3, 0, 3);
1042 fSubEventDPhiv2->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
1043 fSubEventDPhiv2->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
1044 fSubEventDPhiv2->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
1045 fOutputList->Add(fSubEventDPhiv2);
1047 fSubEventDPhiv2new = new TProfile("fSubEventDPhiv2new", "fSubEventDPhiv2new", 3, 0, 3);
1048 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
1049 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
1050 fSubEventDPhiv2new->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
1051 fOutputList->Add(fSubEventDPhiv2new);
1053 //================================Event Plane with VZERO=====================
1054 const Int_t nPtBins = 12;
1055 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};
1057 Int_t bins[3] = { 50, 50, nPtBins};
1058 Double_t xmin[3] = { -1., -1., 0};
1059 Double_t xmax[3] = { 1., 1., 5};
1060 fV2Phi = new THnSparseF("fV2Phi", "v2A:v2C:pt", 3, bins, xmin, xmax);
1061 // Set bin limits for axes which are not standard binned
1062 fV2Phi->SetBinEdges(2, binsPt);
1064 fV2Phi->GetAxis(0)->SetTitle("v_{2} (V0A)");
1065 fV2Phi->GetAxis(1)->SetTitle("v_{2} (V0C)");
1066 fV2Phi->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
1067 fOutputList->Add(fV2Phi);
1068 //================================Event Plane with VZERO=====================
1069 Int_t binsV[2] = { 50, 100};
1070 Double_t xminV[2] = { -1., 0};
1071 Double_t xmaxV[2] = { 1., 5};
1072 fV2Phivzerotot = new THnSparseF("fV2Phivzerotot", "v2:pt", 2, binsV, xminV, xmaxV);
1073 // Set bin limits for axes which are not standard binned
1074 //fV2Phivzerotot->SetBinEdges(1, binsPt);
1076 fV2Phivzerotot->GetAxis(0)->SetTitle("v_{2} (V0)");
1077 fV2Phivzerotot->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
1078 fOutputList->Add(fV2Phivzerotot);
1082 //----------------------------------------------------------------------------
1083 //----------------------------------------------------------------------------
1084 // if(fQAPIDSparse){
1085 // Int_t binsQA[4] = { 150, 100, 120, 3};
1086 // Double_t xminQA[4] = { 0., 50, 0, -1.5};
1087 // Double_t xmaxQA[4] = { 15., 150, 1.2, 1.5};
1088 // fQAPid = new THnSparseF("fQAPid", "p:dEdx:beta:ch", 4, binsQA, xminQA, xmaxQA);
1089 // fQAPid->GetAxis(0)->SetTitle("p (Gev/c");
1090 // fQAPid->GetAxis(1)->SetTitle("dE/dx");
1091 // fQAPid->GetAxis(2)->SetTitle("#beta (TOF)");
1092 // fQAPid->GetAxis(3)->SetTitle("charge");
1093 // fOutputList->Add(fQAPid);
1095 //===========================================================================
1096 Int_t binsQA2[3] = { 100, 40, 150/*, 60*/};
1097 Double_t xminQA2[3] = { 0., -2, -15/*, -3*/};
1098 Double_t xmaxQA2[3] = { 5., 2, 15/*, 3*/};
1099 fQAPidSparse = new THnSparseF("fQAPidSparse", "pt:itsnsigma:tpcnsigma", 3, binsQA2, xminQA2, xmaxQA2);
1100 fQAPidSparse->GetAxis(0)->SetTitle("pt (Gev/c)");
1101 fQAPidSparse->GetAxis(1)->SetTitle("itsnsigma");
1102 fQAPidSparse->GetAxis(2)->SetTitle("tpcnsigma");
1103 fOutputList->Add(fQAPidSparse);
1104 //===========================================================================
1105 PostData(1,fOutputList);
1106 // create and post flowevent
1107 fFlowEvent = new AliFlowEvent(10000);
1108 PostData(2, fFlowEvent);
1111 //________________________________________________________________________
1112 void AliAnalysisTaskFlowITSTPCTOFQCSP::Terminate(Option_t *)
1114 // Info("Terminate");
1115 AliAnalysisTaskSE::Terminate();
1117 //_____________________________________________________________________________
1118 template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::PlotVZeroMultiplcities(const T* event) const
1120 // QA multiplicity plots
1121 fVZEROA->Fill(event->GetVZEROData()->GetMTotV0A());
1122 fVZEROC->Fill(event->GetVZEROData()->GetMTotV0C());
1124 //_____________________________________________________________________________
1125 template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::SetNullCuts(T* event)
1128 if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
1129 fCutsRP->SetEvent(event, MCEvent());
1130 fNullCuts->SetParamType(AliFlowTrackCuts::kGlobal);
1131 fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
1132 fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
1133 fNullCuts->SetEvent(event, MCEvent());
1135 //_____________________________________________________________________________
1136 void AliAnalysisTaskFlowITSTPCTOFQCSP::PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const
1138 //Prepare flow events
1139 FlowEv->ClearFast();
1140 FlowEv->Fill(fCutsRP, fNullCuts);
1141 FlowEv->SetReferenceMultiplicity(iMulti);
1142 FlowEv->DefineDeadZone(0, 0, 0, 0);
1143 // FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
1145 //_____________________________________________________________________________
1146 Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1148 // Check single track cuts for a given cut step
1149 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1150 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1153 //_________________________________________
1154 void AliAnalysisTaskFlowITSTPCTOFQCSP::CheckCentrality(AliAODEvent* event, Bool_t ¢ralitypass)
1156 //============================Multiplicity TPV vs Global===============================================================================
1157 const Int_t nGoodTracks = event->GetNumberOfTracks();
1158 Float_t multTPC(0.); // tpc mult estimate
1159 Float_t multGlob(0.); // global multiplicity
1160 for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
1161 AliAODTrack* trackAOD = event->GetTrack(iTracks);
1162 if (!trackAOD) continue;
1163 if (!(trackAOD->TestFilterBit(1))) continue;
1164 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;
1167 for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
1168 AliAODTrack* trackAOD = event->GetTrack(iTracks);
1169 if (!trackAOD) continue;
1170 if (!(trackAOD->TestFilterBit(16))) continue;
1171 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;
1172 Double_t b[2] = {-99., -99.};
1173 Double_t bCov[3] = {-99., -99., -99.};
1174 if (!(trackAOD->PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov))) continue;
1175 if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
1178 fMultCorBeforeCuts->Fill(multGlob, multTPC);//before all cuts...even before centrality selectrion
1179 //============================================================================================================================
1180 // Check if event is within the set centrality range. Falls back to V0 centrality determination if no method is set
1181 if (!fkCentralityMethod) AliFatal("No centrality method set! FATAL ERROR!");
1182 fCentrality = event->GetCentrality()->GetCentralityPercentile(fkCentralityMethod);
1183 // cout << "--------------Centrality evaluated-------------------------"<<endl;
1184 if ((fCentrality <= fCentralityMin) || (fCentrality > fCentralityMax))
1186 fCentralityNoPass->Fill(fCentrality);
1187 // cout << "--------------Fill no pass-----"<< fCentrality <<"--------------------"<<endl;
1188 centralitypass = kFALSE;
1191 // cout << "--------------Fill pass----"<< fCentrality <<"---------------------"<<endl;
1192 centralitypass = kTRUE;
1194 if (centralitypass){
1195 fMultCorAfterCentrBeforeCuts->Fill(multGlob, multTPC);
1196 fCentralityBeforePileup->Fill(fCentrality);
1197 }//...after centrality selectrion
1198 //============================================================================================================================
1199 //to remove the bias introduced by multeplicity outliers---------------------
1200 Float_t centTrk = event->GetCentrality()->GetCentralityPercentile("TRK");
1201 Float_t centv0 = event->GetCentrality()->GetCentralityPercentile("V0M");
1202 if (TMath::Abs(centv0 - centTrk) > 5.0){
1203 centralitypass = kFALSE;
1204 fCentralityNoPass->Fill(fCentrality);
1206 if (centralitypass){
1207 fMultCorAfterVZTRKComp->Fill(multGlob, multTPC);
1208 fCentralityAfterVZTRK->Fill(fCentrality);
1209 }//...after centrality selectrion
1210 //============================================================================================================================
1212 if(fTrigger==1 || fTrigger==4){
1213 if(! (multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob))){
1214 // cout <<" Trigger ==" <<fTrigger<< endl;
1215 centralitypass = kFALSE;
1216 fCentralityNoPass->Fill(fCentrality);
1220 if(! (multTPC > (77.9 + 1.395*multGlob) && multTPC < (187.3 + 1.665*multGlob))){
1221 // cout <<" Trigger ==" <<fTrigger<< endl;
1222 centralitypass = kFALSE;
1223 fCentralityNoPass->Fill(fCentrality);
1227 if (centralitypass){
1228 fMultCorAfterCorrCut->Fill(multGlob, multTPC);
1229 fCentralityAfterCorrCut->Fill(fCentrality);
1230 }//...after CORR CUT
1231 //=================================All cuts are passed==================++++==================================================
1232 //=================================Now Centrality flattening for central trigger==================++++==================================================
1233 if(fTrigger==0 || fTrigger==4){
1234 if(!IsEventSelectedForCentrFlattening(fCentrality)){
1235 centralitypass = kFALSE;
1236 fCentralityNoPassForFlattening->Fill(fCentrality);
1239 //==============================fill histo after all cuts==============================++++==================================================
1241 fCentralityPass->Fill(fCentrality);
1242 fMultCorAfterCuts->Fill(multGlob, multTPC);
1243 fMultvsCentr->Fill(fCentrality, multTPC);
1246 //_____________________________________________________________________________
1247 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod)
1249 // Set a centrality range ]min, max] and define the method to use for centrality selection
1250 fCentralityMin = CentralityMin;
1251 fCentralityMax = CentralityMax;
1252 fkCentralityMethod = CentralityMethod;
1254 //_____________________________________________________________________________
1255 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)
1258 fminTOFnSigma = minTOFnSigma;
1259 fmaxTOFnSigma = maxTOFnSigma;
1260 fminITSnsigmaLowpT = minITSnsigmalowpt;
1261 fmaxITSnsigmaLowpT = maxITSnsigmalowpt;
1262 fminITSnsigmaHighpT = minITSnsigmahighpt;
1263 fmaxITSnsigmaHighpT = maxITSnsigmahighpt;
1264 fminTPCnsigmaLowpT = minTPCnsigmalowpt;
1265 fmaxTPCnsigmaLowpT = maxTPCnsigmalowpt;
1266 fminTPCnsigmaHighpT = minTPCnsigmahighpt;
1267 fmaxTPCnsigmaHighpT = maxTPCnsigmahighpt;
1270 //_____________________________________________________________________________
1271 //_____________________________________________________________________________
1272 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetpTCuttrack(Double_t ptmin, Double_t ptmax)
1278 //_____________________________________________________________________________
1279 //_____________________________________________________________________________
1280 void AliAnalysisTaskFlowITSTPCTOFQCSP::SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef,Int_t switchTRand){
1281 // set the histo for centrality flattening
1282 // the centrality is flatten in the range minCentr,maxCentr
1283 // if centrRef is zero, the minimum in h within (minCentr,maxCentr) defines the reference
1284 // positive, the value of h(centrRef) defines the reference (-> the centrality distribution might be not flat in the whole desired range)
1285 // 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)
1286 // 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
1288 if(maxCentr<minCentr){
1289 AliWarning("AliAnalysisCheckCorrdist::Wrong centralities values while setting the histogram for centrality flattening");
1292 if(fHistCentrDistr)delete fHistCentrDistr;
1293 fHistCentrDistr=(TH1F*)h->Clone("hCentralityFlat");
1294 fHistCentrDistr->SetTitle("Reference histo for centrality flattening");
1295 Int_t minbin=fHistCentrDistr->FindBin(minCentr*1.00001); // fast if fix bin width
1296 Int_t maxbin=fHistCentrDistr->FindBin(maxCentr*0.9999);
1297 fHistCentrDistr->GetXaxis()->SetRange(minbin,maxbin);
1298 Double_t ref=0.,bincont=0.,binrefwidth=1.;
1300 if(TMath::Abs(centrRef)<0.0001){
1301 binref=fHistCentrDistr->GetMinimumBin();
1302 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1303 ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
1305 else if(centrRef>0.){
1306 binref=h->FindBin(centrRef);
1307 if(binref<1||binref>h->GetNbinsX()){
1308 AliWarning("AliRDHFCuts::Wrong centrality reference value while setting the histogram for centrality flattening");
1310 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1311 ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
1314 if(centrRef<-1) AliWarning("AliRDHFCuts: with this centrality reference no flattening will be applied");
1315 binref=fHistCentrDistr->GetMaximumBin();
1316 binrefwidth=fHistCentrDistr->GetBinWidth(binref);
1317 ref=fHistCentrDistr->GetMaximum()*TMath::Abs(centrRef)/binrefwidth;
1320 for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
1321 if(h->GetBinLowEdge(j)*1.0001>=minCentr&&h->GetBinLowEdge(j+1)*0.9999<=maxCentr){
1322 bincont=h->GetBinContent(j);
1323 fHistCentrDistr->SetBinContent(j,ref/bincont*h->GetBinWidth(j));
1324 fHistCentrDistr->SetBinError(j,h->GetBinError(j)*ref/bincont);
1327 h->SetBinContent(j,1.1);// prob > 1 to assure that events will not be rejected
1331 fHistCentrDistr->SetBinContent(0,switchTRand);
1336 //-------------------------------------------------
1337 Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::IsEventSelectedForCentrFlattening(Float_t centvalue){
1339 // Random event selection, based on fHistCentrDistr, to flatten the centrality distribution
1340 // Can be faster if it was required that fHistCentrDistr covers
1341 // exactly the desired centrality range (e.g. part of the lines below should be done during the
1342 // setting of the histo) and TH1::SetMinimum called
1345 if(!fHistCentrDistr) return kTRUE;
1346 // Int_t maxbin=fHistCentrDistr->FindBin(fMaxCentrality*0.9999);
1347 // if(maxbin>fHistCentrDistr->GetNbinsX()){
1348 // AliWarning("AliRDHFCuts: The maximum centrality exceeds the x-axis limit of the histogram for centrality flattening");
1351 Int_t bin=fHistCentrDistr->FindBin(centvalue); // Fast if the histo has a fix bin
1352 Double_t bincont=fHistCentrDistr->GetBinContent(bin);
1353 Double_t centDigits=centvalue-(Int_t)(centvalue*100.)/100.;// this is to extract a random number between 0 and 0.01
1355 if(fHistCentrDistr->GetBinContent(0)<-0.9999){
1356 if(gRandom->Uniform(1.)<bincont)return kTRUE;
1360 if(centDigits*100.<bincont)return kTRUE;
1364 //---------------------------------------------------------------------------
1367 //_____________________________________________________________________________