25 #include "AliAnalysisManager.h" 26 #include "TParticle.h" 28 #include "AliPIDResponse.h" 30 #include "AliESDtrackCuts.h" 31 #include "AliAODMCParticle.h" 32 #include "AliAODMCHeader.h" 33 #include "AliAODEvent.h" 44 fV0ReaderName("V0ReaderV1"),
46 fConversionCuts(NULL),
48 fClusterCutsEMC(NULL),
49 fClusterCutsDMC(NULL),
60 ffillHistograms(kFALSE),
63 fCorrectForNonlinearity(kFALSE),
64 fSaveEventProperties(0),
66 fSaveSurroundingCells(0),
67 fSaveMCInformation(0),
68 fNSurroundingCells(10),
69 fExtractionPercentages(),
70 fExtractionPercentagePtBins(),
72 fBuffer_ClusterPhi(0),
73 fBuffer_ClusterEta(0),
74 fBuffer_ClusterIsEMCAL(kFALSE),
75 fBuffer_MC_Cluster_Flag(0),
76 fBuffer_ClusterNumCells(0),
77 fBuffer_LeadingCell_ID(0),
78 fBuffer_LeadingCell_Row(0),
79 fBuffer_LeadingCell_Column(0),
80 fBuffer_ClusterM02(0),
81 fBuffer_ClusterM20(0),
82 fBuffer_Event_Vertex_X(0),
83 fBuffer_Event_Vertex_Y(0),
84 fBuffer_Event_Vertex_Z(0),
85 fBuffer_Event_Multiplicity(0),
86 fBuffer_Event_NumActiveCells(0),
89 fBuffer_Cells_RelativeRow(0),
90 fBuffer_Cells_RelativeColumn(0),
91 fBuffer_Surrounding_Cells_ID(0),
92 fBuffer_Surrounding_Cells_E(0),
93 fBuffer_Surrounding_Cells_RelativeRow(0),
94 fBuffer_Surrounding_Cells_RelativeColumn(0),
95 fBuffer_Cluster_MC_Label(-10)
109 fV0ReaderName(
"V0ReaderV1"),
110 fCorrTaskSetting(
""),
111 fConversionCuts(NULL),
113 fClusterCutsEMC(NULL),
114 fClusterCutsDMC(NULL),
125 ffillHistograms(kFALSE),
128 fCorrectForNonlinearity(kFALSE),
129 fSaveEventProperties(0),
131 fSaveSurroundingCells(0),
132 fSaveMCInformation(0),
133 fNSurroundingCells(10),
134 fExtractionPercentages(),
135 fExtractionPercentagePtBins(),
137 fBuffer_ClusterPhi(0),
138 fBuffer_ClusterEta(0),
139 fBuffer_ClusterIsEMCAL(kFALSE),
140 fBuffer_MC_Cluster_Flag(0),
141 fBuffer_ClusterNumCells(0),
142 fBuffer_LeadingCell_ID(0),
143 fBuffer_LeadingCell_Row(0),
144 fBuffer_LeadingCell_Column(0),
145 fBuffer_ClusterM02(0),
146 fBuffer_ClusterM20(0),
147 fBuffer_Event_Vertex_X(0),
148 fBuffer_Event_Vertex_Y(0),
149 fBuffer_Event_Vertex_Z(0),
150 fBuffer_Event_Multiplicity(0),
151 fBuffer_Event_NumActiveCells(0),
154 fBuffer_Cells_RelativeRow(0),
155 fBuffer_Cells_RelativeColumn(0),
156 fBuffer_Surrounding_Cells_ID(0),
157 fBuffer_Surrounding_Cells_E(0),
158 fBuffer_Surrounding_Cells_RelativeRow(0),
159 fBuffer_Surrounding_Cells_RelativeColumn(0),
160 fBuffer_Cluster_MC_Label(-10)
172 DefineInput(0, TChain::Class());
173 DefineOutput(1, TList::Class());
276 if(eventQuality != 0){
283 if(eventNotAccepted)
return;
286 if(!
fGeomEMCAL){ AliFatal(
"EMCal geometry not initialized!");}
289 TClonesArray * arrClustersProcess = NULL;
295 if(!arrClustersProcess)
296 AliFatal(Form(
"%sClustersBranch was not found in AliAnalysisTaskGammaCalo! Check the correction framework settings!",
fCorrTaskSetting.Data()));
297 nclus = arrClustersProcess->GetEntries();
300 if(nclus == 0)
return;
311 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
313 map<Long_t,Int_t> mapIsClusterAccepted;
314 map<Long_t,Int_t> mapIsClusterAcceptedWithoutTrackMatch;
316 for(Long_t i = 0; i < nclus; i++){
318 AliVCluster* clus = NULL;
320 if(arrClustersProcess)
321 clus =
new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
323 clus =
new AliESDCaloCluster(*(AliESDCaloCluster*)
fInputEvent->GetCaloCluster(i));
324 }
else if(
fInputEvent->IsA()==AliAODEvent::Class()){
325 if(arrClustersProcess)
326 clus =
new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
328 clus =
new AliAODCaloCluster(*(AliAODCaloCluster*)
fInputEvent->GetCaloCluster(i));
333 if ( !clus->IsEMCAL()){
339 if(!((
AliCaloPhotonCuts*)
fClusterCutsEMC)->ClusterIsSelected(clus,
fInputEvent,fMCEvent,
fIsMC, tempClusterWeight,i) && !((
AliCaloPhotonCuts*)
fClusterCutsDMC)->ClusterIsSelected(clus,
fInputEvent,fMCEvent,
fIsMC, tempClusterWeight,i)){
351 Float_t clusPos[3] = { 0,0,0 };
352 cluster->GetPosition(clusPos);
353 TVector3 clusterVector(clusPos[0],clusPos[1],clusPos[2]);
354 Double_t etaCluster = clusterVector.Eta();
355 Double_t phiCluster = clusterVector.Phi();
356 if (phiCluster < 0) phiCluster += 2*TMath::Pi();
369 if(etaCluster < 0.67 && etaCluster > -0.67){
370 if(phiCluster < 3.2 && phiCluster > 1.4){
373 }
else if(etaCluster < 0.67 && etaCluster > -0.67){
374 if(etaCluster > 0.23 || etaCluster < -0.23){
375 if(phiCluster < 5.6 && phiCluster > 4.6){
387 AliVCaloCells* cells = NULL;
388 if(cluster->IsEMCAL())
389 cells = event->GetEMCALCells();
390 else if(cluster->IsPHOS())
391 cells = event->GetPHOSCells();
397 Int_t nCellCluster = cluster->GetNCells();
401 Int_t rowLeading=0, columnLeading=0;
408 for(
Int_t iCell=0;iCell<nCellCluster;iCell++){
410 fBuffer_Cells_E[iCell] = cells->GetCellAmplitude(cluster->GetCellAbsId(iCell));
411 Int_t row=0, column=0;
418 for(
Int_t aCell=0;aCell<cells->GetNumberOfCells();aCell++){
421 Double_t cellAmplitude = 0, cellTime = 0, cellEFrac = 0;
422 Int_t cellMCLabel = 0, row = 0, column = 0;
425 cells->GetCell(aCell,cellNumber,cellAmplitude,cellTime,cellMCLabel,cellEFrac);
452 const Int_t nCells = cluster->GetNCells();
453 AliVCaloCells* cells = NULL;
455 if(cluster->IsEMCAL())
456 cells = event->GetEMCALCells();
457 else if(cluster->IsPHOS())
458 cells = event->GetPHOSCells();
463 if (nCells < 1)
return idMax;
464 for (
Int_t iCell = 0;iCell < nCells;iCell++){
465 Int_t cellAbsID = cluster->GetCellsAbsId()[iCell];
466 if (cells->GetCellAmplitude(cellAbsID)> eMax){
467 eMax = cells->GetCellAmplitude(cellAbsID);
476 Int_t nSupMod=0, nModule=0, nIphi=0, nIeta=0;
480 fGeomEMCAL->GetCellIndex(cellIndex, nSupMod,nModule,nIphi,nIeta);
481 fGeomEMCAL->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, row,column);
482 row += nSupMod/2 * 24;
483 column += nSupMod%2 * 48;
490 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
492 TLorentzVector clusterVector;
493 clus->GetMomentum(clusterVector,vertex);
495 TLorentzVector* tmpvec =
new TLorentzVector();
496 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
500 if(!PhotonCandidate){
503 if (PhotonCandidate)
delete PhotonCandidate;
512 Int_t* mclabelsCluster = clus->GetLabels();
513 Int_t nValidClusters = 0;
514 if (clus->GetNLabels()>0){
515 for (
Int_t k =0; k< (
Int_t)clus->GetNLabels(); k++){
516 if (mclabelsCluster[k]>0){
517 if (nValidClusters< 50)PhotonCandidate->
SetCaloPhotonMCLabel(nValidClusters,mclabelsCluster[k]);
525 AliAODCaloCluster* clusSub1 =
new AliAODCaloCluster();
526 AliAODCaloCluster* clusSub2 =
new AliAODCaloCluster();
536 const Int_t nc = clus->GetNCells();
537 Int_t absCellIdList[nc];
543 TLorentzVector clusterVector1;
544 clusSub1->GetMomentum(clusterVector1,vertex);
545 TLorentzVector* tmpvec1 =
new TLorentzVector();
546 tmpvec1->SetPxPyPzE(clusterVector1.Px(),clusterVector1.Py(),clusterVector1.Pz(),clusterVector1.E());
549 if(!PhotonCandidate1){
557 TLorentzVector clusterVector2;
558 clusSub2->GetMomentum(clusterVector2,vertex);
559 TLorentzVector* tmpvec2 =
new TLorentzVector();
560 tmpvec2->SetPxPyPzE(clusterVector2.Px(),clusterVector2.Py(),clusterVector2.Pz(),clusterVector2.E());
563 if(!PhotonCandidate2){
594 Int_t mcLabelCluster = -5;
595 const AliVVertex* primVtxMC =
fMCEvent->GetPrimaryVertex();
596 Double_t mcProdVtxX = primVtxMC->GetX();
597 Double_t mcProdVtxY = primVtxMC->GetY();
598 Double_t mcProdVtxZ = primVtxMC->GetZ();
600 TParticle *Photon = NULL;
601 if (!TrueClusterCandidate->
GetIsCaloPhoton()) AliFatal(
"CaloPhotonFlag has not been set task will abort");
604 else return mcLabelCluster;
607 return mcLabelCluster;
611 if (!mesonIsSelected){
613 return mcLabelCluster;
618 Int_t clusterClass = 0;
625 Long_t motherLab = -1;
655 TParticle *mother = NULL;
656 Int_t motherPDG = -1;
658 mother =
fMCEvent->Particle(motherLab);
660 motherPDG = TMath::Abs(mother->GetPdgCode());
663 if (clusterClass == 1 || clusterClass == 2 || clusterClass == 3 ){
665 if (clusterClass == 1 && TrueClusterCandidate->
IsMerged()){
666 if (motherPDG == 111){
668 if (!isPrimary && m02 >= 0 && m02 <= 4.8 )
671 if (motherPDG == 221)
674 if (motherPDG == 111){
676 if (!isPrimary && m02 >= 0 && m02 <= 4.8 )
679 if (motherPDG == 221)
681 }
else if (clusterClass == 2){
682 if (motherPDG == 111){
684 if (!isPrimary && m02 >= 0 && m02 <= 4.8 )
687 if (motherPDG == 221)
689 }
else if (clusterClass == 3){
690 if (motherPDG == 111) {
692 if (!isPrimary && m02 >= 0 && m02 <= 4.8 )
695 if (motherPDG == 221)
713 return mcLabelCluster;
void SetPeriodEnum(TString periodName)
void SetCaloClusterRef(Long_t ref)
Float_t fBuffer_ClusterPhi
! array buffer
virtual void UserExec(Option_t *option)
void SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort)
Float_t fBuffer_Event_Vertex_Y
! array buffer
Short_t fBuffer_LeadingCell_ID
! array buffer
Int_t MakePhotonCandidates(AliVCluster *clus, AliVCaloCells *cells, Long_t indexCluster)
PeriodVar GetPeriodEnum()
Bool_t fSaveMCInformation
save MC information
AliConvEventCuts * fEventCuts
void SetPeriodEnumExplicit(PeriodVar periodEnum)
Float_t fBuffer_ClusterE
! array buffer
Short_t * fBuffer_Surrounding_Cells_RelativeRow
! array buffer
Bool_t fSaveEventProperties
save general event properties (centrality etc.)
virtual ~AliAnalysisTaskClusterQA()
virtual void UserCreateOutputObjects()
Short_t fBuffer_Event_NumActiveCells
! array buffer
void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton)
Short_t fBuffer_ClusterNumCells
! array buffer
Float_t fBuffer_Event_Vertex_Z
! array buffer
Int_t GetCaloPhotonMotherMCLabel(Int_t i)
Bool_t fBuffer_ClusterIsEMCAL
! array buffer
Float_t fBuffer_Event_Vertex_X
! array buffer
void GetRowAndColumnFromAbsCellID(Int_t cellIndex, Int_t &row, Int_t &column)
Float_t fBuffer_Event_Multiplicity
! array buffer
Int_t FindLargestCellInCluster(AliVCluster *cluster, AliVEvent *event)
Short_t fBuffer_LeadingCell_Column
! array buffer
Float_t * fBuffer_Surrounding_Cells_E
! array buffer
Short_t * fBuffer_Surrounding_Cells_RelativeColumn
! array buffer
AliAnalysisTaskClusterQA()
Int_t fNSurroundingCells
save MC information
Int_t IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis)
Class handling all kinds of selection cuts for Gamma Calo analysis.
void ProcessQATreeCluster(AliVEvent *event, AliVCluster *cluster, Long_t indexCluster)
Short_t * fBuffer_Surrounding_Cells_ID
! array buffer
Bool_t IsConversionPrimaryESD(AliMCEvent *mcEvent, Long_t eventpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ)
AliCaloPhotonCuts * fClusterCutsEMC
Short_t * fBuffer_Cells_RelativeColumn
! array buffer
Bool_t fSaveSurroundingCells
save arrays of all cells in event
Short_t * fBuffer_Cells_ID
! array buffer
Float_t fBuffer_ClusterM20
! array buffer
Bool_t IsLargestComponentElectron()
Int_t fMaxNLMCut
save MC information
Int_t GetCaloPhotonMCLabel(Int_t i)
Float_t fBuffer_ClusterM02
! array buffer
Short_t fBuffer_LeadingCell_Row
! array buffer
virtual void Terminate(Option_t *)
Float_t fBuffer_ClusterEta
! array buffer
Int_t GetNCaloPhotonMCLabels()
Short_t fBuffer_Cluster_MC_Label
! array buffer
Bool_t fSaveCells
save arrays of cluster cells
AliEMCALGeometry * fGeomEMCAL
Class handling all kinds of selection cuts for Gamma Conversion analysis.
void SetNCaloPhotonMCLabels(Int_t nLabels)
Bool_t IsConversionFullyContained()
const Int_t kMaxActiveCells
Class handling all kinds of selection cuts for Gamma Conversion analysis.
AliConversionMesonCuts * fMesonCuts
Int_t GetNCaloPhotonMotherMCLabels()
AliConvEventCuts * GetEventCuts()
Bool_t IsElectronFromFragPhoton()
AliV0ReaderV1 * fV0Reader
Float_t * fBuffer_Cells_E
! array buffer
Int_t fMinNLMCut
save MC information
Short_t * fBuffer_Cells_RelativeRow
! array buffer
AliCaloPhotonCuts * fClusterCutsDMC
Bool_t IsLargestComponentPhoton()
Int_t ProcessTrueClusterCandidates(AliAODConversionPhoton *TrueClusterCandidate, Float_t m02, AliAODConversionPhoton *TrueSubClusterCandidate1, AliAODConversionPhoton *TrueSubClusterCandidate2)
Bool_t IsMergedPartConv()