From: gconesab Date: Mon, 1 Nov 2010 22:43:51 +0000 (+0000) Subject: All: Add possibility to recalculate track matching in EMCAL X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=f2ccb5b8f5140ccc03f10ec9a314b38c3bd4e99b;p=u%2Fmrichter%2FAliRoot.git All: Add possibility to recalculate track matching in EMCAL EMCALCalibTask: Read geometry matrices if gGeoManager not existing --- diff --git a/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx b/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx index 3ca24840c96..c21d018f964 100644 --- a/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx +++ b/PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx @@ -196,28 +196,24 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); Int_t jClusters=0; - for (Int_t iClust=0; iClustGetCaloCluster(iClust); - - //Check which calorimeter information we want to keep. - - if(fCaloFilter!=kBoth){ - if (fCaloFilter==kPHOS && cluster->IsEMCAL()) continue ; - else if(fCaloFilter==kEMCAL && cluster->IsPHOS()) continue ; - } - - //-------------------------------------------------------------- - //If EMCAL, and requested, correct energy, position ... - if(cluster->IsEMCAL() && fCorrect){ + //Do Corrections in EMCAL + //If EMCAL, and requested, correct energy, position ... + //Need to do this in a separate loop before filling the ESDs because of the track matching recalculations + if(fCorrect && (fCaloFilter==kEMCAL || fCaloFilter==kBoth) ) { + //Cluster Loop + for (Int_t iClust=0; iClustGetCaloCluster(iClust); + if(cluster->IsPHOS()) continue ; + Float_t position[]={0,0,0}; if(DebugLevel() > 2) printf("Check cluster %d for bad channels and close to border\n",cluster->GetID()); if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue; -// if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) { -// printf("Finally reject\n"); -// continue; -// } + // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) { + // printf("Finally reject\n"); + // continue; + // } if(DebugLevel() > 2) { printf("Filter, before : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",iClust,cluster->E(), @@ -225,17 +221,16 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) cluster->GetPosition(position); printf("Filter, before : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]); } - + if(fEMCALRecoUtils->IsRecalibrationOn()) { fEMCALRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, cluster, event->GetEMCALCells()); fEMCALRecoUtils->RecalculateClusterShowerShapeParameters(fEMCALGeo, event->GetEMCALCells(),cluster); fEMCALRecoUtils->RecalculateClusterPID(cluster); - } cluster->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(cluster)); fEMCALRecoUtils->RecalculateClusterPosition(fEMCALGeo, event->GetEMCALCells(),cluster); - + if(DebugLevel() > 2) { printf("Filter, after : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",cluster->GetID(),cluster->E(), @@ -244,10 +239,49 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) printf("Filter, after : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]); } + } + //Recalculate track-matching + fEMCALRecoUtils->FindMatches(event); + + } // corrections in EMCAL + + //Now loop on clusters to fill AODs + for (Int_t iClust=0; iClustGetCaloCluster(iClust); + + //Check which calorimeter information we want to keep. + + if(fCaloFilter!=kBoth){ + if (fCaloFilter==kPHOS && cluster->IsEMCAL()) continue ; + else if(fCaloFilter==kEMCAL && cluster->IsPHOS()) continue ; + } + + //Temporary trick, FIXME + Float_t dR = cluster->GetTrackDx(); + Float_t dZ = cluster->GetTrackDz(); + if(DebugLevel() > 2) + printf("Original residuals : dZ %f, dR %f\n ",dZ, dR); + //-------------------------------------------------------------- + //If EMCAL and corrections done, get the new matching parameters, do not copy noisy clusters + if(cluster->IsEMCAL() && fCorrect){ + if(DebugLevel() > 2) + printf("Check cluster %d for bad channels and close to border\n",cluster->GetID()); + if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue; + // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) { + // printf("Finally reject\n"); + // continue; + // } + + fEMCALRecoUtils->GetMatchedResiduals(cluster->GetID(),dR,dZ); + if(DebugLevel() > 2) + printf("Corrected Residuals : dZ %f, dR %f\n ",dZ, dR); + } //-------------------------------------------------------------- //Now fill AODs + Int_t id = cluster->GetID(); Float_t energy = cluster->E(); cluster->GetPosition(posF); @@ -261,10 +295,11 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) NULL, cluster->GetType()); + caloCluster->SetChi2(dZ);//Temporary trick, FIXME caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), - cluster->GetEmcCpvDistance(), + dR, //Temporary trick, FIXME cluster->GetNExMax(),cluster->GetTOF()) ; caloCluster->SetPIDFromESD(cluster->GetPID()); @@ -274,23 +309,29 @@ void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) if(DebugLevel() > 2) { - printf("Filter, aod : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",caloCluster->GetID(),caloCluster->E(), + printf("Filter, aod : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",caloCluster->GetID(),caloCluster->E(), caloCluster->GetDispersion(),caloCluster->GetM02(),caloCluster->GetM20()); caloCluster->GetPosition(posF); - printf("Filter, aod : i %d, x %f, y %f, z %f\n",caloCluster->GetID(), posF[0], posF[1], posF[2]); + printf("Filter, aod : i %d, x %f, y %f, z %f\n",caloCluster->GetID(), posF[0], posF[1], posF[2]); } //Matched tracks, just to know if there was any match, the track pointer is useless. + //Temporary trick, FIXME if(bESD){ - TArrayI* matchedT = ((AliESDCaloCluster*)cluster)->GetTracksMatched(); - if (InputEvent()->GetNumberOfTracks() > 0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) { - for (Int_t im = 0; im < matchedT->GetSize(); im++) { - Int_t iESDtrack = matchedT->At(im);; - if ((AliVTrack*)InputEvent()->GetTrack(iESDtrack) != 0) { - caloCluster->AddTrackMatched((AliVTrack*)InputEvent()->GetTrack(iESDtrack)); - } - } - }// There is at least a match with a track + if(TMath::Abs(dR) < 990 && TMath::Abs(dZ) < 990) { //Default value in PHOS 999, in EMCAL 1024, why? + if(DebugLevel() > 2) + printf("*** Cluster Track-Matched *** dR %f, dZ %f\n",caloCluster->GetEmcCpvDistance(),caloCluster->Chi2()); + caloCluster->AddTrackMatched(0x0); + }// fill the array with one entry to signal a possible match + //TArrayI* matchedT = ((AliESDCaloCluster*)cluster)->GetTracksMatched(); + //if (InputEvent()->GetNumberOfTracks() > 0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) { + // for (Int_t im = 0; im < matchedT->GetSize(); im++) { + // Int_t iESDtrack = matchedT->At(im);; + // if ((AliVTrack*)InputEvent()->GetTrack(iESDtrack) != 0) { + // caloCluster->AddTrackMatched((AliVTrack*)InputEvent()->GetTrack(iESDtrack)); + // } + // } + //}// There is at least a match with a track } } caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters diff --git a/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx b/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx index ef22467de81..5a4a50dc466 100644 --- a/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx +++ b/PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx @@ -370,24 +370,27 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */) //Int_t runNum = aod->GetRunNumber(); //if(DebugLevel() > 1) printf("Run number: %d\n",runNum); - //FIXME Not need the matrices for the moment MEFIX //Get the matrix with geometry information //Still not implemented in AOD, just a workaround to be able to work at least with ESDs - // if(!strcmp(InputEvent()->GetName(),"AliAODEvent")) { - // if(DebugLevel() > 1) - // printf("AliAnalysisTaskEMCALPi0CalibSelection Use ideal geometry, values geometry matrix not kept in AODs.\n"); - // } - // else{ - // if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Load Misaligned matrices. \n"); - // AliESDEvent* esd = dynamic_cast(InputEvent()) ; - // if(!esd) { - // printf("AliAnalysisTaskEMCALPi0CalibSelection::UserExec() - This event does not contain ESDs?"); - // return; - // } - // for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ - // if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ; - // } - // } + if(!gGeoManager && fhNEvents->GetEntries()==1){ + printf("AliAnalysisTaskEMCALPi0CalibSelection::UserExec() - Get geo matrices from data\n"); + if(!strcmp(event->GetName(),"AliAODEvent")) { + if(DebugLevel() > 1) + printf("AliAnalysisTaskEMCALPi0CalibSelection Use ideal geometry, values geometry matrix not kept in AODs.\n"); + }//AOD + else { + if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Load Misaligned matrices. \n"); + AliESDEvent* esd = dynamic_cast(event) ; + if(!esd) { + printf("AliAnalysisTaskEMCALPi0CalibSelection::UserExec() - This event does not contain ESDs?"); + return; + } + for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ + if(DebugLevel() > 1) esd->GetEMCALMatrix(mod)->Print(); + if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ; + } + }//ESD + }//first event if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Will use fLogWeight %.3f .\n",fLogWeight); Int_t absId1 = -1; @@ -538,22 +541,24 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */) Float_t opangle = p1.Angle(p2.Vect())*TMath::RadToDeg(); //printf("*******>>>>>>>> In PEAK pt %f, angle %f \n",p12.Pt(),opangle); - //Inciden angle of each photon - Float_t posSM1cen[3]={0.,0.,0.}; - Float_t depth = fRecoUtils->GetDepth(p1.Energy(),fRecoUtils->GetParticleType(),iSupMod1); - fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod1, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM1cen); - Float_t posSM2cen[3]={0.,0.,0.}; - depth = fRecoUtils->GetDepth(p2.Energy(),fRecoUtils->GetParticleType(),iSupMod2); - fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod2, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM2cen); - //printf("SM1 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod1,posSM1cen[0],posSM1cen[1],posSM1cen[2]); - //printf("SM2 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod2,posSM2cen[0],posSM2cen[1],posSM2cen[2]); - - TVector3 vecSM1cen(posSM1cen[0]-v[0],posSM1cen[1]-v[1],posSM1cen[2]-v[2]); - TVector3 vecSM2cen(posSM2cen[0]-v[0],posSM2cen[1]-v[1],posSM2cen[2]-v[2]); - Float_t inangle1 = p1.Angle(vecSM1cen)*TMath::RadToDeg(); - Float_t inangle2 = p2.Angle(vecSM2cen)*TMath::RadToDeg(); - //printf("Incident angle: cluster 1 %2.3f; cluster 2 %2.3f\n",inangle1,inangle2); - + //Incident angle of each photon + Float_t inangle1 =0., inangle2=0.; + if(gGeoManager){ + Float_t posSM1cen[3]={0.,0.,0.}; + Float_t depth = fRecoUtils->GetDepth(p1.Energy(),fRecoUtils->GetParticleType(),iSupMod1); + fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod1, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM1cen); + Float_t posSM2cen[3]={0.,0.,0.}; + depth = fRecoUtils->GetDepth(p2.Energy(),fRecoUtils->GetParticleType(),iSupMod2); + fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod2, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM2cen); + //printf("SM1 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod1,posSM1cen[0],posSM1cen[1],posSM1cen[2]); + //printf("SM2 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod2,posSM2cen[0],posSM2cen[1],posSM2cen[2]); + + TVector3 vecSM1cen(posSM1cen[0]-v[0],posSM1cen[1]-v[1],posSM1cen[2]-v[2]); + TVector3 vecSM2cen(posSM2cen[0]-v[0],posSM2cen[1]-v[1],posSM2cen[2]-v[2]); + inangle1 = p1.Angle(vecSM1cen)*TMath::RadToDeg(); + inangle2 = p2.Angle(vecSM2cen)*TMath::RadToDeg(); + //printf("Incident angle: cluster 1 %2.3f; cluster 2 %2.3f\n",inangle1,inangle2); + } fHOpeningAngle ->Fill(opangle,p12.Pt()); fHIncidentAngle->Fill(inangle1,p1.Pt()); fHIncidentAngle->Fill(inangle2,p2.Pt()); diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h index b0e5233117a..d9ac191305d 100755 --- a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h @@ -244,7 +244,7 @@ public: virtual void GetVertex(Double_t vertex[3],const Int_t evtIndex) const { GetReader()->GetVertex(vertex,evtIndex) ; } virtual Double_t* GetVertex(const Int_t evtIndex) const { return GetReader()->GetVertex(evtIndex) ; } - virtual Bool_t IsTrackMatched(const AliVCluster * cluster) const { return fCaloPID->IsTrackMatched(cluster); } + virtual Bool_t IsTrackMatched(const AliVCluster * cluster) const { return fCaloPID->IsTrackMatched(cluster, fCaloUtils); } void SwitchOnPlotsMaking() {fMakePlots = kTRUE ;} void SwitchOffPlotsMaking() {fMakePlots = kFALSE ;} diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx index 973c4b7515f..cab8074570e 100755 --- a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx +++ b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx @@ -41,6 +41,7 @@ #include "AliMixedEvent.h" #include "AliAODEvent.h" #include "AliESDEvent.h" +#include "AliAnalysisDataSlot.h" ClassImp(AliAnalysisTaskParticleCorrelationM) @@ -213,12 +214,14 @@ void AliAnalysisTaskParticleCorrelationM::UserExec(Option_t */*option*/) fAna->ProcessEvent((Int_t) Entry(), CurrentFileName()); //printf("AliAnalysisTaskParticleCorrelationM::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName()); if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserExec() - End\n"); - + PostData(1, fOutputContainer); + AliAnalysisDataSlot *out0 = GetOutputSlot(0); + if (out0 && out0->IsConnected()) PostData(0, fTreeA); + //gObjectTable->Print(); - } //_____________________________________________________ diff --git a/PWG4/PartCorrBase/AliCaloPID.cxx b/PWG4/PartCorrBase/AliCaloPID.cxx index f52013f57f8..49c5b7b5cfd 100755 --- a/PWG4/PartCorrBase/AliCaloPID.cxx +++ b/PWG4/PartCorrBase/AliCaloPID.cxx @@ -49,6 +49,8 @@ #include "AliVCluster.h" #include "AliAODPWG4Particle.h" #include "AliEMCALPIDUtils.h" +#include "AliCalorimeterUtils.h" + ClassImp(AliCaloPID) @@ -62,7 +64,8 @@ fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), //fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0), fDispCut(0.),fTOFCut(0.), fDebug(-1), -fRecalculateBayesian(kFALSE), fParticleFlux(kLow), fEMCALPIDUtils(new AliEMCALPIDUtils) +fRecalculateBayesian(kFALSE), fParticleFlux(kLow), +fEMCALPIDUtils(new AliEMCALPIDUtils) { //Ctor @@ -80,7 +83,8 @@ fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), //fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0), fDispCut(0.),fTOFCut(0.), fDebug(-1), -fRecalculateBayesian(kTRUE), fParticleFlux(flux), fEMCALPIDUtils(new AliEMCALPIDUtils) +fRecalculateBayesian(kTRUE), fParticleFlux(flux), +fEMCALPIDUtils(new AliEMCALPIDUtils) { //Ctor @@ -98,7 +102,8 @@ fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), //fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0), fDispCut(0.),fTOFCut(0.), fDebug(-1), -fRecalculateBayesian(kTRUE), fParticleFlux(-1), fEMCALPIDUtils( (AliEMCALPIDUtils*) emcalpid) +fRecalculateBayesian(kTRUE), fParticleFlux(-1), +fEMCALPIDUtils( (AliEMCALPIDUtils*) emcalpid) { //Ctor @@ -416,7 +421,7 @@ void AliCaloPID::Print(const Option_t * opt) const } //_______________________________________________________________ -void AliCaloPID::SetPIDBits(const TString calo, const AliVCluster * cluster, AliAODPWG4Particle * ph) { +void AliCaloPID::SetPIDBits(const TString calo, const AliVCluster * cluster, AliAODPWG4Particle * ph, const AliCalorimeterUtils* cu) { //Set Bits for PID selection //Dispersion/lambdas @@ -454,7 +459,7 @@ void AliCaloPID::SetPIDBits(const TString calo, const AliVCluster * cluster, Ali //Bool_t isNeutral = kTRUE ; //if(cluster->IsPHOS()) isNeutral = cluster->GetEmcCpvDistance() > 5. ; //else - Bool_t isNeutral = IsTrackMatched(cluster); + Bool_t isNeutral = IsTrackMatched(cluster,cu); ph->SetChargedBit(isNeutral); @@ -469,7 +474,7 @@ void AliCaloPID::SetPIDBits(const TString calo, const AliVCluster * cluster, Ali } //__________________________________________________________________________ -Bool_t AliCaloPID::IsTrackMatched(const AliVCluster* cluster) const { +Bool_t AliCaloPID::IsTrackMatched(const AliVCluster* cluster, const AliCalorimeterUtils * cu) const { //Check if there is any track attached to this cluster Int_t nMatches = cluster->GetNTracksMatched(); @@ -478,8 +483,17 @@ Bool_t AliCaloPID::IsTrackMatched(const AliVCluster* cluster) const { // if (cluster->GetTrackMatched(0)) printf("\t matched track id %d\n",((AliVTrack*)cluster->GetTrackMatched(0))->GetID()) ; // else if(cluster->GetTrackMatchedIndex()>=0) printf("\t matched track id %d\n",((AliVTrack*) GetReader()->GetInputEvent()->GetTrack(cluster->GetTrackMatchedIndex()))->GetID()) ; + if(!strcmp("AliESDCaloCluster",Form("%s",cluster->ClassName()))) { + //If EMCAL track matching needs to be recalculated + if(cluster->IsEMCAL() && cu && cu->IsRecalculationOfClusterTrackMatchingOn()){ + Float_t dR = 999., dZ = 999.; + cu->GetEMCALRecoUtils()->GetMatchedResiduals(cluster->GetID(),dR,dZ); + if(dR < 999) return kTRUE; + else return kFALSE; + } + if (nMatches > 0) { if (nMatches == 1 ) { Int_t iESDtrack = cluster->GetTrackMatchedIndex(); @@ -495,9 +509,15 @@ Bool_t AliCaloPID::IsTrackMatched(const AliVCluster* cluster) const { else { //AODs - if(nMatches > 0) return kTRUE; //There is at least one match. - else return kFALSE; - + if(cu && cu->IsRecalculationOfClusterTrackMatchingOn()){ + Float_t dR = TMath::Abs(cluster->GetEmcCpvDistance()) ; //FIXME + if(dR > cu->GetCutR()) return kFALSE; + else return kTRUE; + } + else { + if(nMatches > 0) return kTRUE; //There is at least one match. + else return kFALSE; + } }//AODs or MC (copy into AOD) return kFALSE; diff --git a/PWG4/PartCorrBase/AliCaloPID.h b/PWG4/PartCorrBase/AliCaloPID.h index f270cef9b5e..22c597bae67 100755 --- a/PWG4/PartCorrBase/AliCaloPID.h +++ b/PWG4/PartCorrBase/AliCaloPID.h @@ -38,6 +38,7 @@ class TTask; class AliVCluster; class AliAODPWG4Particle; class AliEMCALPIDUtils; +class AliCalorimeterUtils; class AliCaloPID : public TObject { @@ -76,7 +77,7 @@ public: TString GetPIDParametersList(); - void SetPIDBits(const TString calo, const AliVCluster * cluster, AliAODPWG4Particle *aodph); + void SetPIDBits(const TString calo, const AliVCluster * cluster, AliAODPWG4Particle *aodph, const AliCalorimeterUtils* cu); void Print(const Option_t * opt)const; @@ -114,7 +115,7 @@ public: //PID bits setters and getters - Bool_t IsTrackMatched(const AliVCluster * cluster) const ; + Bool_t IsTrackMatched(const AliVCluster * cluster, const AliCalorimeterUtils* cu) const ; void SetDispersionCut(Float_t dcut ) {fDispCut = dcut; } Float_t GetDispersionCut() const {return fDispCut ;} @@ -131,7 +132,7 @@ public: void SetLowParticleFlux() {fParticleFlux = kLow;} void SetHighParticleFlux() {fParticleFlux = kHigh;} - private: +private: Float_t fEMCALPhotonWeight; //Bayesian PID weight for photons in EMCAL Float_t fEMCALPi0Weight; //Bayesian PID weight for pi0 in EMCAL @@ -153,10 +154,9 @@ public: Int_t fDebug; //Debug level - Bool_t fRecalculateBayesian; // Recalculate PID bayesian or use simple PID? - Int_t fParticleFlux; // Particle flux for setting PID parameters - AliEMCALPIDUtils * fEMCALPIDUtils; //Pointer to EMCALPID to redo the PID Bayesian calculation - + Bool_t fRecalculateBayesian; // Recalculate PID bayesian or use simple PID? + Int_t fParticleFlux; // Particle flux for setting PID parameters + AliEMCALPIDUtils * fEMCALPIDUtils; // Pointer to EMCALPID to redo the PID Bayesian calculation ClassDef(AliCaloPID,4) } ; diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx index a331d006e13..aee77b775b2 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackReader.cxx @@ -706,6 +706,10 @@ void AliCaloTrackReader::FillInputEMCAL() { }//EMCAL cluster }// cluster exists }// cluster loop + + //Recalculate track matching + GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent); + //fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast(); if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n", fAODEMCAL->GetEntriesFast());//fAODEMCALNormalInputEntries); diff --git a/PWG4/PartCorrBase/AliCalorimeterUtils.cxx b/PWG4/PartCorrBase/AliCalorimeterUtils.cxx index 21bea800cc2..886dd8de47b 100755 --- a/PWG4/PartCorrBase/AliCalorimeterUtils.cxx +++ b/PWG4/PartCorrBase/AliCalorimeterUtils.cxx @@ -49,7 +49,8 @@ ClassImp(AliCalorimeterUtils) fNCellsFromPHOSBorder(0), fRecalibration(kFALSE), fPHOSRecalibrationFactors(), fEMCALRecoUtils(new AliEMCALRecoUtils), - fRecalculatePosition(kFALSE),fCorrectELinearity(kFALSE) + fRecalculatePosition(kFALSE),fCorrectELinearity(kFALSE), + fRecalculateMatching(kFALSE),fCutR(20), fCutZ(20) { //Ctor @@ -510,6 +511,7 @@ void AliCalorimeterUtils::Print(const Option_t * opt) const printf("Recalibrate Clusters? %d\n",fRecalibration); printf("Recalculate Clusters Position? %d\n",fRecalculatePosition); printf("Recalculate Clusters Energy? %d\n",fCorrectELinearity); + printf("Matching criteria: dR < %2.2f[cm], dZ < %2.2f[cm]\n",fCutR,fCutZ); printf(" \n") ; } diff --git a/PWG4/PartCorrBase/AliCalorimeterUtils.h b/PWG4/PartCorrBase/AliCalorimeterUtils.h index e5828cce5fd..d2a1e1fec62 100755 --- a/PWG4/PartCorrBase/AliCalorimeterUtils.h +++ b/PWG4/PartCorrBase/AliCalorimeterUtils.h @@ -137,6 +137,7 @@ class AliCalorimeterUtils : public TObject { Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells); + //EMCAL specific utils for the moment void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) {fEMCALRecoUtils = ru;} AliEMCALRecoUtils* GetEMCALRecoUtils() const {return fEMCALRecoUtils;} @@ -154,6 +155,19 @@ class AliCalorimeterUtils : public TObject { } void RecalculateClusterPID(AliVCluster* clu) {fEMCALRecoUtils->RecalculateClusterPID(clu);} + //Track matching recalculation + void RecalculateClusterTrackMatching(AliVEvent * event) {if (fRecalculateMatching) fEMCALRecoUtils->FindMatches(event);} + void GetMatchedResiduals(Int_t index, Float_t &dR, Float_t &dZ) {if (fRecalculateMatching) fEMCALRecoUtils->GetMatchedResiduals(index,dR,dZ);} + //This could be used for PHOS ... + void SwitchOnRecalculateClusterTrackMatching() { fRecalculateMatching = kTRUE; } + void SwitchOffRecalculateClusterTrackMatching() { fRecalculateMatching = kFALSE; } + Bool_t IsRecalculationOfClusterTrackMatchingOn() const { return fRecalculateMatching ; } + Float_t GetCutR() const { return fCutR; } + Float_t GetCutZ() const { return fCutZ; } + + void SetCutR(Float_t cutR) { fCutR=cutR; fEMCALRecoUtils->SetCutR(cutR); } + void SetCutZ(Float_t cutZ) { fCutZ=cutZ; fEMCALRecoUtils->SetCutZ(cutZ);} + private: Int_t fDebug; // Debugging level @@ -171,8 +185,11 @@ class AliCalorimeterUtils : public TObject { AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction Bool_t fRecalculatePosition; // Recalculate cluster position Bool_t fCorrectELinearity ; // Correct cluster energy linearity - - ClassDef(AliCalorimeterUtils,3) + Bool_t fRecalculateMatching; // Recalculate cluster position + Float_t fCutR; // dR cut on matching + Float_t fCutZ; // dZ cut on matching + + ClassDef(AliCalorimeterUtils,4) } ; diff --git a/PWG4/PartCorrDep/AliAnaPhoton.cxx b/PWG4/PartCorrDep/AliAnaPhoton.cxx index 771e18322db..2f6049e6e66 100755 --- a/PWG4/PartCorrDep/AliAnaPhoton.cxx +++ b/PWG4/PartCorrDep/AliAnaPhoton.cxx @@ -495,7 +495,7 @@ void AliAnaPhoton::MakeAnalysisFillAOD() else{ //Set PID bits for later selection (AliAnaPi0 for example) //GetPDG already called in SetPIDBits. - GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph); + GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph, GetCaloUtils()); if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PID Bits set \n"); } diff --git a/PWG4/PartCorrDep/AliAnaPi0EbE.cxx b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx index 900fa5fc177..11dd298cc88 100755 --- a/PWG4/PartCorrDep/AliAnaPi0EbE.cxx +++ b/PWG4/PartCorrDep/AliAnaPi0EbE.cxx @@ -612,7 +612,7 @@ void AliAnaPi0EbE::MakeShowerShapeIdentification() else{ //Set PID bits for later selection (AliAnaPi0 for example) //GetPDG already called in SetPIDBits. - GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0); + GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0, GetCaloUtils()); if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PID Bits set \n"); } diff --git a/PWG4/PartCorrDep/AliAnaShowerParameter.cxx b/PWG4/PartCorrDep/AliAnaShowerParameter.cxx index dc90d23f147..08f5e183f41 100644 --- a/PWG4/PartCorrDep/AliAnaShowerParameter.cxx +++ b/PWG4/PartCorrDep/AliAnaShowerParameter.cxx @@ -728,7 +728,7 @@ void AliAnaShowerParameter::MakeAnalysisFillAOD() //Set PID bits for later selection (AliAnaPi0 for example) //GetPDG already called in SetPIDBits. - GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph); + GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph, GetCaloUtils()); if(GetDebug() > 1) printf("AliAnaShowerParameter::MakeAnalysisFillAOD() - PID Bits set \n"); //Play with the MC stack if available