From c4eec29fc94ea973ec7ca891ef3082a104117530 Mon Sep 17 00:00:00 2001 From: gconesab Date: Wed, 5 Jan 2011 14:08:42 +0000 Subject: [PATCH] Recover the list of EMCAL clusters in a different outout branch --- PWG4/PartCorrBase/AliCaloTrackReader.cxx | 162 +++++++++++++---------- PWG4/PartCorrBase/AliCaloTrackReader.h | 8 +- 2 files changed, 96 insertions(+), 74 deletions(-) diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx index 11cb868996d..d2fbbd61c48 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackReader.cxx @@ -68,7 +68,8 @@ ClassImp(AliCaloTrackReader) fDeltaAODFileName("deltaAODPartCorr.root"),fFiredTriggerClassName(""), fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0), fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL), - fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),fCaloFilterPatch(kFALSE) + fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),fCaloFilterPatch(kFALSE), + fEMCALClustersListName("") { //Ctor @@ -668,82 +669,101 @@ void AliCaloTrackReader::FillInputCTS() { // } - //____________________________________________________________________________ +//____________________________________________________________________________ +void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, const Int_t iclus) { + //Fill the EMCAL data in the array, do it + + Int_t vindex = 0 ; + if (fMixedEvent) + vindex = fMixedEvent->EventIndexForCaloCluster(iclus); + + //Check if the cluster contains any bad channel and if close to calorimeter borders + if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) + return; + if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliVCaloCells*)fInputEvent->GetEMCALCells(), fInputEvent, vindex)) + return; + + TLorentzVector momentum ; + + clus->GetMomentum(momentum, fVertex[vindex]); + + if(fEMCALPtMin < momentum.Pt()){ + + if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) + return; + + if(fDebug > 2 && momentum.E() > 0.1) + printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + //Float_t pos[3]; + //clus->GetPosition(pos); + //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); + + //Recalibrate the cluster energy + if(GetCaloUtils()->IsRecalibrationOn()) { + Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells()); + clus->SetE(energy); + //printf("Recalibrated Energy %f\n",clus->E()); + GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus); + GetCaloUtils()->RecalculateClusterPID(clus); + + } + + //Recalculate distance to bad channels, if new list of bad channels provided + GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus); + + //Recalculate cluster position + if(GetCaloUtils()->IsRecalculationOfClusterPositionOn()){ + GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus); + //clus->GetPosition(pos); + //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); + } + + //Correct non linearity + if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn()){ + GetCaloUtils()->CorrectClusterEnergy(clus) ; + //printf("Linearity Corrected Energy %f\n",clus->E()); + } + + if (fMixedEvent) + clus->SetID(iclus) ; + + fAODEMCAL->Add(clus); + } +} + +//____________________________________________________________________________ void AliCaloTrackReader::FillInputEMCAL() { //Return array with EMCAL clusters in aod format if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n"); //Loop to select clusters in fiducial cut and fill container with aodClusters - Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); - for (Int_t iclus = 0; iclus < nclusters; iclus++) { - AliVCluster * clus = 0; - if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { - if (IsEMCALCluster(clus)){ - - //Check if the cluster contains any bad channel and if close to calorimeter borders - Int_t vindex = 0 ; - if (fMixedEvent) - vindex = fMixedEvent->EventIndexForCaloCluster(iclus); - - if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) - continue; - if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliVCaloCells*)fInputEvent->GetEMCALCells(), fInputEvent, vindex)) - continue; - - TLorentzVector momentum ; - - clus->GetMomentum(momentum, fVertex[vindex]); - - if(fEMCALPtMin < momentum.Pt()){ - - if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) - continue; - - if(fDebug > 2 && momentum.E() > 0.1) - printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", - momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); - - //Float_t pos[3]; - //clus->GetPosition(pos); - //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); - - //Recalibrate the cluster energy - if(GetCaloUtils()->IsRecalibrationOn()) { - Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells()); - clus->SetE(energy); - //printf("Recalibrated Energy %f\n",clus->E()); - GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus); - GetCaloUtils()->RecalculateClusterPID(clus); - - } - - //Recalculate distance to bad channels, if new list of bad channels provided - GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus); - - //Recalculate cluster position - if(GetCaloUtils()->IsRecalculationOfClusterPositionOn()){ - GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus); - //clus->GetPosition(pos); - //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); - } - - //Correct non linearity - if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn()){ - GetCaloUtils()->CorrectClusterEnergy(clus) ; - //printf("Linearity Corrected Energy %f\n",clus->E()); - } - - if (fMixedEvent) { - clus->SetID(iclus) ; - } - - fAODEMCAL->Add(clus); - - }//Pt and Fiducial cut passed. - }//EMCAL cluster - }// cluster exists - }// cluster loop + if(fEMCALClustersListName==""){ + Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); + for (Int_t iclus = 0; iclus < nclusters; iclus++) { + AliVCluster * clus = 0; + if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { + if (IsEMCALCluster(clus)){ + FillInputEMCALAlgorithm(clus, iclus); + }//EMCAL cluster + }// cluster exists + }// cluster loop + }//Get the clusters from the input event + else { + TClonesArray * clusterList = dynamic_cast (fOutputEvent->FindListObject(fEMCALClustersListName)); + if(!clusterList){ + printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data()); + return; + } + Int_t nclusters = clusterList->GetEntriesFast(); + for (Int_t iclus = 0; iclus < nclusters; iclus++) { + AliVCluster * clus = dynamic_cast (clusterList->At(iclus)); + //printf("E %f\n",clus->E()); + FillInputEMCALAlgorithm(clus, iclus); + }// cluster loop + } //Recalculate track matching GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent); diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.h b/PWG4/PartCorrBase/AliCaloTrackReader.h index 728d7297acf..2268a05feee 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackReader.h @@ -106,10 +106,12 @@ public: virtual Bool_t FillInputEvent(const Int_t iEntry, const char *currentFileName) ; virtual void FillInputCTS() ; virtual void FillInputEMCAL() ; + virtual void FillInputEMCALAlgorithm(AliVCluster * clus, const Int_t iclus) ; virtual void FillInputPHOS() ; virtual void FillInputEMCALCells() ; virtual void FillInputPHOSCells() ; - + void SetEMCALClusterListName(TString &name) {fEMCALClustersListName = name;} + virtual TList * GetAODBranchList() const { return fAODBranchList ; } virtual TObjArray* GetAODCTS() const {return fAODCTS ;} @@ -244,7 +246,6 @@ public: virtual void SetEMCALOverlapAngle(Float_t /*angle*/) { ; } virtual void SetPHOSOverlapAngle(Float_t /*angle*/) { ; } - protected: @@ -315,8 +316,9 @@ public: Int_t fV0Mul[2] ; // Integrated V0 Multiplicity Bool_t fCaloFilterPatch; // CaloFilter patch + TString fEMCALClustersListName; //Alternative list of clusters produced elsewhere and not from InputEvent - ClassDef(AliCaloTrackReader,21) + ClassDef(AliCaloTrackReader,22) } ; -- 2.43.0