/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Authors: Friederike Bock, Baldo Sahlmueller * * Version 1.0 * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ //////////////////////////////////////////////// //--------------------------------------------- // Class handling all kinds of selection cuts for // Photon from EMCAL clusters //--------------------------------------------- //////////////////////////////////////////////// #include "AliCaloPhotonCuts.h" #include "AliAnalysisManager.h" #include "AliInputEventHandler.h" #include "AliMCEventHandler.h" #include "AliAODHandler.h" #include "TH1.h" #include "TH2.h" #include "TF1.h" #include "AliStack.h" #include "AliAODConversionMother.h" #include "TObjString.h" #include "AliAODEvent.h" #include "AliESDEvent.h" #include "AliCentrality.h" #include "TList.h" #include "TFile.h" #include "AliLog.h" #include "AliV0ReaderV1.h" #include "AliAODMCParticle.h" #include "AliAODMCHeader.h" class iostream; using namespace std; ClassImp(AliCaloPhotonCuts) const char* AliCaloPhotonCuts::fgkCutNames[AliCaloPhotonCuts::kNCuts] = { "ClusterType", //0 "EtaMin", //1 "EtaMax", //2 "PhiMin", //3 "PhiMax", //4 "DistanceToBadChannel", //5 "Timing", //6 "TrackMatching", //7 "ExoticCell", //8 "MinEnergy", //9 "MinNCells", //10 "MinM02", //11 "MaxM02", //12 "MinM20", //13 "MaxM20", //14 "MaximumDispersion", //15 "NLM" //16 }; //________________________________________________________________________ AliCaloPhotonCuts::AliCaloPhotonCuts(const char *name,const char *title) : AliAnalysisCuts(name,title), fHistograms(NULL), fClusterType(0), fMinEtaCut(-10), fMaxEtaCut(10), fMinPhiCut(-10000), fMaxPhiCut(-10000), fMinDistanceToBadChannel(0), fMaxTimeDiff(10e10), fMinDistTrackToCluster(0), fExoticCell(0), fMinEnergy(0), fMinNCells(0), fMaxM02(1000), fMinM02(0), fMaxM20(1000), fMinM20(0), fMaxDispersion(1000), fMinNLM(0), fMaxNLM(1000), fCutString(NULL), fHistCutIndex(NULL), fHistAcceptanceCuts(NULL), fHistClusterIdentificationCuts(NULL), fHistClusterEtavsPhiBeforeAcc(NULL), fHistClusterEtavsPhiAfterAcc(NULL), fHistClusterEtavsPhiAfterQA(NULL), fHistDistanceToBadChannelBeforeAcc(NULL), fHistDistanceToBadChannelAfterAcc(NULL), fHistClusterTimevsEBeforeQA(NULL), fHistClusterTimevsEAfterQA(NULL), fHistExoticCellBeforeQA(NULL), fHistExoticCellAfterQA(NULL), fHistDistanceTrackToClusterBeforeQA(NULL), fHistDistanceTrackToClusterAfterQA(NULL), fHistEnergyOfClusterBeforeQA(NULL), fHistEnergyOfClusterAfterQA(NULL), fHistNCellsBeforeQA(NULL), fHistNCellsAfterQA(NULL), fHistM02BeforeQA(NULL), fHistM02AfterQA(NULL), fHistM20BeforeQA(NULL), fHistM20AfterQA(NULL), fHistDispersionBeforeQA(NULL), fHistDispersionAfterQA(NULL), fHistNLMBeforeQA(NULL), fHistNLMAfterQA(NULL) { for(Int_t jj=0;jjSetOwner(kTRUE); if(name=="")fHistograms->SetName(Form("CaloCuts_%s",GetCutNumber().Data())); else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data())); } // IsPhotonSelected fHistCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",5,-0.5,4.5); fHistCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in"); fHistCutIndex->GetXaxis()->SetBinLabel(kDetector+1,"detector"); fHistCutIndex->GetXaxis()->SetBinLabel(kAcceptance+1,"acceptance"); fHistCutIndex->GetXaxis()->SetBinLabel(kClusterQuality+1,"cluster QA"); fHistCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out"); fHistograms->Add(fHistCutIndex); // Acceptance Cuts fHistAcceptanceCuts=new TH1F(Form("AcceptanceCuts %s",GetCutNumber().Data()),"AcceptanceCuts",5,-0.5,4.5); fHistAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in"); fHistAcceptanceCuts->GetXaxis()->SetBinLabel(2,"eta"); fHistAcceptanceCuts->GetXaxis()->SetBinLabel(3,"phi"); fHistAcceptanceCuts->GetXaxis()->SetBinLabel(4,"distance to bad channel"); fHistAcceptanceCuts->GetXaxis()->SetBinLabel(5,"out"); fHistograms->Add(fHistAcceptanceCuts); // Cluster Cuts fHistClusterIdentificationCuts =new TH1F(Form("ClusterQualityCuts %s",GetCutNumber().Data()),"ClusterQualityCuts",10,-0.5,9.5); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(1,"in"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(2,"timing"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(3,"track matching"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(4,"Exotics"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(5,"minimum energy"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(6,"M02"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(7,"M20"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(8,"dispersion"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(9,"NLM"); fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(10,"out"); fHistograms->Add(fHistClusterIdentificationCuts); // Acceptance related histogramms fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7); fHistograms->Add(fHistClusterEtavsPhiBeforeAcc); fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7); fHistograms->Add(fHistClusterEtavsPhiAfterAcc); fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7); fHistograms->Add(fHistClusterEtavsPhiAfterQA); fHistDistanceToBadChannelBeforeAcc = new TH1F(Form("DistanceToBadChannel_beforeAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_beforeAcceptance",200,0,40); fHistograms->Add(fHistDistanceToBadChannelBeforeAcc); fHistDistanceToBadChannelAfterAcc = new TH1F(Form("DistanceToBadChannel_afterAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_afterAcceptance",200,0,40); fHistograms->Add(fHistDistanceToBadChannelAfterAcc); // Cluster quality related histograms fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,-10e-6,10e-6,100,0.,40); fHistograms->Add(fHistClusterTimevsEBeforeQA); fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,-10e-6,10e-6,100,0.,40); fHistograms->Add(fHistClusterTimevsEAfterQA); fHistExoticCellBeforeQA=new TH2F(Form("ExoticCell_beforeClusterQA %s",GetCutNumber().Data()),"ExoticCell_beforeClusterQA",400,0,40,50,0.75,1); fHistograms->Add(fHistExoticCellBeforeQA); fHistExoticCellAfterQA=new TH2F(Form("ExoticCell_afterClusterQA %s",GetCutNumber().Data()),"ExoticCell_afterClusterQA",400,0,40,50,0.75,1); fHistograms->Add(fHistExoticCellAfterQA); fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,40); fHistograms->Add(fHistDistanceTrackToClusterBeforeQA); fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,40); fHistograms->Add(fHistDistanceTrackToClusterAfterQA); fHistEnergyOfClusterBeforeQA = new TH1F(Form("EnergyOfCluster_beforeClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_beforeClusterQA",300,0,30); fHistograms->Add(fHistEnergyOfClusterBeforeQA); fHistEnergyOfClusterAfterQA = new TH1F(Form("EnergyOfCluster_afterClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_afterClusterQA",300,0,30); fHistograms->Add(fHistEnergyOfClusterAfterQA); fHistNCellsBeforeQA = new TH1F(Form("NCellPerCluster_beforeClusterQA %s",GetCutNumber().Data()),"NCellPerCluster_beforeClusterQA",50,0,50); fHistograms->Add(fHistNCellsBeforeQA); fHistNCellsAfterQA = new TH1F(Form("NCellPerCluster_afterClusterQA %s",GetCutNumber().Data()),"NCellPerCluster_afterClusterQA",50,0,50); fHistograms->Add(fHistNCellsAfterQA); fHistM02BeforeQA = new TH1F(Form("M02_beforeClusterQA %s",GetCutNumber().Data()),"M02_beforeClusterQA",100,0,5); fHistograms->Add(fHistM02BeforeQA); fHistM02AfterQA = new TH1F(Form("M02_afterClusterQA %s",GetCutNumber().Data()),"M02_afterClusterQA",100,0,5); fHistograms->Add(fHistM02AfterQA); fHistM20BeforeQA = new TH1F(Form("M20_beforeClusterQA %s",GetCutNumber().Data()),"M20_beforeClusterQA",100,0,2.5); fHistograms->Add(fHistM20BeforeQA); fHistM20AfterQA = new TH1F(Form("M20_afterClusterQA %s",GetCutNumber().Data()),"M20_afterClusterQA",100,0,2.5); fHistograms->Add(fHistM20AfterQA); fHistDispersionBeforeQA = new TH1F(Form("Dispersion_beforeClusterQA %s",GetCutNumber().Data()),"Dispersion_beforeClusterQA",100,0,4); fHistograms->Add(fHistDispersionBeforeQA); fHistDispersionAfterQA = new TH1F(Form("Dispersion_afterClusterQA %s",GetCutNumber().Data()),"Dispersion_afterClusterQA",100,0,4); fHistograms->Add(fHistDispersionAfterQA); fHistNLMBeforeQA = new TH1F(Form("NLM_beforeClusterQA %s",GetCutNumber().Data()),"NLM_beforeClusterQA",10,0,10); fHistograms->Add(fHistNLMBeforeQA); fHistNLMAfterQA = new TH1F(Form("NLM_afterClusterQA %s",GetCutNumber().Data()),"NLM_afterClusterQA",10,0,10); fHistograms->Add(fHistNLMAfterQA); TH1::AddDirectory(kTRUE); } /* ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::ClusterIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){ // MonteCarlo Photon Selection if(!fMCStack)return kFALSE; if (particle->GetPdgCode() == 22){ if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ) return kFALSE; if(fEtaCutMin>-0.1){ if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ) return kFALSE; } if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){ return kFALSE; // no photon as mothers! } if(particle->GetMother(0) >= fMCStack->GetNprimary()){ return kFALSE; // the gamma has a mother, and it is not a primary particle } if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma // looking for conversion gammas (electron + positron from pairbuilding (= 5) ) TParticle* ePos = NULL; TParticle* eNeg = NULL; if(particle->GetNDaughters() >= 2){ for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){ TParticle *tmpDaughter = fMCStack->Particle(daughterIndex); if(tmpDaughter->GetUniqueID() == 5){ if(tmpDaughter->GetPdgCode() == 11){ eNeg = tmpDaughter; } else if(tmpDaughter->GetPdgCode() == -11){ ePos = tmpDaughter; } } } } if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production return kFALSE; } if(ePos->Pt()Pt()Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) || eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ) return kFALSE; if(fEtaCutMin > -0.1){ if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) || (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) ) return kFALSE; } if(ePos->R()>fMaxR){ return kFALSE; // cuts on distance from collision point } if(abs(ePos->Vz()) > fMaxZ){ return kFALSE; // outside material } if(abs(eNeg->Vz()) > fMaxZ){ return kFALSE; // outside material } if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){ return kFALSE; // line cut to exclude regions where we do not reconstruct } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){ return kFALSE; } if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){ return kFALSE; // line cut to exclude regions where we do not reconstruct } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){ return kFALSE; } return kTRUE; //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE; } return kFALSE; } ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::ClusterIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){ // MonteCarlo Photon Selection if(!aodmcArray)return kFALSE; if (particle->GetPdgCode() == 22){ if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) ) return kFALSE; if(fEtaCutMin>-0.1){ if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) ) return kFALSE; } if(particle->GetMother() > -1){ if((static_cast(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){ return kFALSE; // no photon as mothers! } if(!(static_cast(aodmcArray->At(particle->GetMother()))->IsPrimary())){ return kFALSE; // the gamma has a mother, and it is not a primary particle } } if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma // looking for conversion gammas (electron + positron from pairbuilding (= 5) ) AliAODMCParticle* ePos = NULL; AliAODMCParticle* eNeg = NULL; if(particle->GetNDaughters() >= 2){ for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){ AliAODMCParticle *tmpDaughter = static_cast(aodmcArray->At(daughterIndex)); if(!tmpDaughter) continue; if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX if(tmpDaughter->GetPdgCode() == 11){ eNeg = tmpDaughter; } else if(tmpDaughter->GetPdgCode() == -11){ ePos = tmpDaughter; } } } } if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production return kFALSE; } if(ePos->Pt()Pt()Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) || eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) ) return kFALSE; if(fEtaCutMin > -0.1){ if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) || (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) ) return kFALSE; } Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) ); Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) ); if(rPos>fMaxR){ return kFALSE; // cuts on distance from collision point } if(abs(ePos->Zv()) > fMaxZ){ return kFALSE; // outside material } if(abs(eNeg->Zv()) > fMaxZ){ return kFALSE; // outside material } if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){ return kFALSE; // line cut to exclude regions where we do not reconstruct } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){ return kFALSE; } if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){ return kFALSE; // line cut to exclude regions where we do not reconstruct } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){ return kFALSE; } return kTRUE; //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE; } return kFALSE; }*/ ///________________________________________________________________________ // This function selects the clusters based on their quality criteria ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *event, Bool_t isMC) { // Specific Photon Cuts Int_t cutIndex = 0; if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); cutIndex++; // Fill Histos before Cuts if(fHistClusterTimevsEBeforeQA) fHistClusterTimevsEBeforeQA->Fill(cluster->GetTOF(), cluster->E()); // if(fHistExoticCellBeforeQA) fHistExoticCellBeforeQA->Fill(cluster->E(), ); if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(cluster->GetEmcCpvDistance()); if(fHistEnergyOfClusterBeforeQA) fHistEnergyOfClusterBeforeQA->Fill(cluster->E()); if(fHistNCellsBeforeQA) fHistNCellsBeforeQA->Fill(cluster->GetNCells()); if(fHistM02BeforeQA) fHistM02BeforeQA->Fill(cluster->GetM02()); if(fHistM20BeforeQA) fHistM20BeforeQA->Fill(cluster->GetM20()); if(fHistDispersionBeforeQA) fHistDispersionBeforeQA->Fill(cluster->GetDispersion()); // if(fHistNLMBeforeQA) fHistNLMBeforeQA->Fill(cluster->GetNExMax()); // Check wether timing is ok if(abs(cluster->GetTOF()) > fMaxTimeDiff && !isMC){ if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //1 return kFALSE; } cutIndex++; //2, next cut // Minimum distance to track if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){ if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2 return kFALSE; } cutIndex++;//3, next cut // exotic cell cut --IMPLEMENT LATER--- // if(!AcceptanceCuts(photon)){ // if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //3 // return kFALSE; // } cutIndex++; //4, next cut // minimum cell energy cut if(cluster->E() < fMinEnergy){ if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //4 return kFALSE; } cutIndex++; //5, next cut // minimum number of cells if(cluster->GetNCells() < fMinNCells) { if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //5 return kFALSE; } cutIndex++; //6, next cut // M02 cut if( cluster->GetM02()< fMinM02 || cluster->GetM02() > fMaxM02 ) { if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //6 return kFALSE; } cutIndex++; //7, next cut // M20 cut if( cluster->GetM20()< fMinM20 || cluster->GetM20() > fMaxM20 ) { if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //7 return kFALSE; } cutIndex++; //8, next cut // dispersion cut if( cluster->GetDispersion()> fMaxDispersion) { if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //8 return kFALSE; } cutIndex++; //9, next cut // NLM cut --IMPLEMENT LATER--- if( cluster->GetDispersion()> fMaxDispersion) { if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //9 return kFALSE; } cutIndex++; //9, next cut // DONE with selecting photons if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //10 // Histos after Cuts Double_t vertex[3] = {0}; event->GetPrimaryVertex()->GetXYZ(vertex); // TLorentzvector with cluster TLorentzVector clusterVector; cluster->GetMomentum(clusterVector,vertex); Double_t etaCluster = clusterVector.Eta(); Double_t phiCluster = clusterVector.Phi(); if(fHistClusterEtavsPhiAfterQA) fHistClusterEtavsPhiAfterQA->Fill(phiCluster,etaCluster); if(fHistClusterTimevsEAfterQA) fHistClusterTimevsEAfterQA->Fill(cluster->GetTOF(), cluster->E()); // if(fHistExoticCellAfterQA) fHistExoticCellAfterQA->Fill(cluster->E(), ); if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(cluster->GetEmcCpvDistance()); if(fHistEnergyOfClusterAfterQA) fHistEnergyOfClusterAfterQA->Fill(cluster->E()); if(fHistNCellsAfterQA) fHistNCellsAfterQA->Fill(cluster->GetNCells()); if(fHistM02AfterQA) fHistM02AfterQA->Fill(cluster->GetM02()); if(fHistM20AfterQA) fHistM20AfterQA->Fill(cluster->GetM20()); if(fHistDispersionAfterQA) fHistDispersionAfterQA->Fill(cluster->GetDispersion()); // if(fHistNLMBeforeQA) fHistNLMAfterQA->Fill(cluster->GetNExMax()); return kTRUE; } ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::ClusterIsSelected(AliVCluster *cluster, AliVEvent * event, Bool_t isMC) { //Selection of Reconstructed photon clusters with Calorimeters FillClusterCutIndex(kPhotonIn); Double_t vertex[3] = {0}; event->GetPrimaryVertex()->GetXYZ(vertex); // TLorentzvector with cluster TLorentzVector clusterVector; cluster->GetMomentum(clusterVector,vertex); Double_t etaCluster = clusterVector.Eta(); Double_t phiCluster = clusterVector.Phi(); // Histos before cuts if(fHistClusterEtavsPhiBeforeAcc) fHistClusterEtavsPhiBeforeAcc->Fill(phiCluster,etaCluster); // Cluster Selection - 0= accept any calo cluster if (fClusterType > 0){ //Select EMCAL cluster if (fClusterType == 1 && !cluster->IsEMCAL()){ FillClusterCutIndex(kDetector); } //Select PHOS cluster if (fClusterType == 2 && !cluster->IsPHOS()){ FillClusterCutIndex(kDetector); } } // Acceptance Cuts if(!AcceptanceCuts(cluster,event)){ FillClusterCutIndex(kAcceptance); return kFALSE; } // Cluster Quality Cuts if(!ClusterQualityCuts(cluster,event,isMC)){ FillClusterCutIndex(kClusterQuality); return kFALSE; } // Photon passed cuts FillClusterCutIndex(kPhotonOut); return kTRUE; } ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::AcceptanceCuts(AliVCluster *cluster, AliVEvent* event) { // Exclude certain areas for photon reconstruction Int_t cutIndex=0; if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex); cutIndex++; Double_t vertex[3] = {0}; event->GetPrimaryVertex()->GetXYZ(vertex); // TLorentzvector with cluster TLorentzVector clusterVector; cluster->GetMomentum(clusterVector,vertex); Double_t etaCluster = clusterVector.Eta(); Double_t phiCluster = clusterVector.Phi(); // check eta range if (fMinEtaCut !=-10 && fMaxEtaCut !=10 ){ if (etaCluster < fMinEtaCut || etaCluster > fMaxEtaCut){ if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex); return kFALSE; } } cutIndex++; // check phi range if (fMinPhiCut !=-10000 && fMaxPhiCut !=-10000 ){ if (phiCluster < fMinPhiCut || phiCluster > fMaxEtaCut){ if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex); return kFALSE; } } cutIndex++; // check distance to bad channel if (cluster->GetDistanceToBadChannel() < fMinDistanceToBadChannel){ if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex); return kFALSE; } if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex); // Histos after cuts if(fHistClusterEtavsPhiAfterAcc) fHistClusterEtavsPhiAfterAcc->Fill(phiCluster,etaCluster); return kTRUE; } ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::UpdateCutString() { ///Update the cut string (if it has been created yet) if(fCutString && fCutString->GetString().Length() == kNCuts) { fCutString->SetString(GetCutNumber()); } else { return kFALSE; } return kTRUE; } ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) { // Initialize Cuts from a given Cut string AliInfo(Form("Set CaloCut Number: %s",analysisCutSelection.Data())); if(analysisCutSelection.Length()!=kNCuts) { AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts)); return kFALSE; } if(!analysisCutSelection.IsDigit()){ AliError("Cut selection contains characters"); return kFALSE; } const char *cutSelection = analysisCutSelection.Data(); #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0' for(Int_t ii=0;ii %3.2f\n", fMinDistanceToBadChannel ); printf("Cluster Quality cuts: \n"); printf("\t time difference < %3.2f\n", fMaxTimeDiff ); printf("\t min distance to track > %3.2f\n", fMinDistTrackToCluster ); printf("\t E_{cluster} > %3.2f\n", fMinEnergy ); printf("\t %3.2f < M02 < %3.2f\n", fMinM02, fMaxM02 ); } // EMCAL acceptance 2011 // 1.39626, 3.125 (phi) // -0.66687,,0.66465 ///________________________________________________________________________ Bool_t AliCaloPhotonCuts::SetClusterTypeCut(Int_t clusterType) { // Set Cut switch(clusterType){ case 0: // all clusters fClusterType=0; break; case 1: // EMCAL clusters fClusterType=1; break; case 2: // PHOS clusters fClusterType=2; break; default: AliError(Form("ClusterTypeCut not defined %d",clusterType)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinEtaCut(Int_t minEta) { switch(minEta){ case 0: fMinEtaCut=-0.6687; break; case 1: fClusterType=-0.5; break; case 2: fClusterType=-2; break; default: AliError(Form("MinEta Cut not defined %d",minEta)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMaxEtaCut(Int_t maxEta) { switch(maxEta){ case 0: fMaxEtaCut=0.66465; break; case 1: fMaxEtaCut=0.5; break; case 2: fMaxEtaCut=2; break; default: AliError(Form("MaxEta Cut not defined %d",maxEta)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinPhiCut(Int_t minPhi) { switch(minPhi){ case 0: fMinPhiCut=-10000; break; case 1: fMinPhiCut=1.39626; break; default: AliError(Form("MinPhi Cut not defined %d",minPhi)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMaxPhiCut(Int_t maxPhi) { switch(maxPhi){ case 0: fMaxPhiCut=-10000; break; case 1: fMaxPhiCut=3.125; break; default: AliError(Form("Max Phi Cut not defined %d",maxPhi)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetDistanceToBadChannelCut(Int_t distanceToBadChannel) { switch(distanceToBadChannel){ case 0: fMinDistanceToBadChannel=0; break; case 1: fMinDistanceToBadChannel=5; break; default: AliError(Form("minimum distance to bad channel Cut not defined %d",distanceToBadChannel)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetTimingCut(Int_t timing) { switch(timing){ case 0: fMaxTimeDiff=500; break; case 1: fMaxTimeDiff=10e-7; //1000ns break; case 2: fMaxTimeDiff=50e-8; //500ns break; case 3: fMaxTimeDiff=20e-8; //200ns break; case 4: fMaxTimeDiff=10e-8; //100ns break; case 5: fMaxTimeDiff=50e-9; //50ns break; default: AliError(Form("Timing Cut not defined %d",timing)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetTrackMatchingCut(Int_t trackMatching) { switch(trackMatching){ case 0: fMinDistTrackToCluster=0; break; case 1: fMinDistTrackToCluster=5; break; default: AliError(Form("Track Matching Cut not defined %d",trackMatching)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetExoticCellCut(Int_t exoticCell) { switch(exoticCell){ case 0: fExoticCell=0; break; case 1: fExoticCell=5; break; default: AliError(Form("Exotic cell Cut not defined %d",exoticCell)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinEnergyCut(Int_t minEnergy) { switch(minEnergy){ case 0: fMinEnergy=0; break; case 1: fMinEnergy=0.05; break; case 2: fMinEnergy=0.1; break; case 3: fMinEnergy=0.15; break; case 4: fMinEnergy=0.2; break; case 5: fMinEnergy=0.3; break; case 6: fMinEnergy=0.5; break; case 7: fMinEnergy=0.75; break; case 8: fMinEnergy=1.; break; case 9: fMinEnergy=1.25; break; default: AliError(Form("Minimum Energy Cut not defined %d",minEnergy)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinNCellsCut(Int_t minNCells) { switch(minNCells){ case 0: fMinNCells=0; break; case 1: fMinNCells=1; break; case 2: fMinNCells=2; break; case 3: fMinNCells=3; break; case 4: fMinNCells=4; break; case 5: fMinNCells=5; break; case 6: fMinNCells=6; break; default: AliError(Form("Min N cells Cut not defined %d",minNCells)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMaxM02(Int_t maxM02) { switch(maxM02){ case 0: fMaxM02=100; break; case 1: fMaxM02=1.; break; case 2: fMaxM02=0.7; break; case 3: fMaxM02=0.5; break; case 4: fMaxM02=0.4; break; default: AliError(Form("Max M02 Cut not defined %d",maxM02)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinM02(Int_t minM02) { switch(minM02){ case 0: fMinM02=0; break; case 1: fMinM02=0.002; break; default: AliError(Form("Min M02 not defined %d",minM02)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMaxM20(Int_t maxM20) { switch(maxM20){ case 0: fMaxM20=100; break; case 1: fMaxM20=0.5; break; default: AliError(Form("Max M20 Cut not defined %d",maxM20)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetMinM20(Int_t minM20) { switch(minM20){ case 0: fMinM20=0; break; case 1: fMinM20=0.002; break; default: AliError(Form("Min M20 Cut not defined %d",minM20)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetDispersion(Int_t dispersion) { switch(dispersion){ case 0: fMaxDispersion =100; break; case 1: fMaxDispersion=2.; break; default: AliError(Form("Maximum Dispersion Cut not defined %d",dispersion)); return kFALSE; } return kTRUE; } //___________________________________________________________________ Bool_t AliCaloPhotonCuts::SetNLM(Int_t nlm) { switch(nlm){ case 0: fMinNLM =0; fMaxNLM =100; break; case 1: fMinNLM =0; fMaxNLM =1; break; default: AliError(Form("NLM Cut not defined %d",nlm)); return kFALSE; } return kTRUE; } ///________________________________________________________________________ TString AliCaloPhotonCuts::GetCutNumber(){ // returns TString with current cut number TString a(kNCuts); for(Int_t ii=0;ii