* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id: AliEMCALRecoUtils.cxx 33808 2009-07-15 09:48:08Z gconesab $ */
+/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
//
// init the magnetic field if not already on
if(!TGeoGlobalMagField::Instance()->GetField())
{
- AliInfo("Init the magnetic field\n");
- if (esdevent)
- {
- esdevent->InitMagneticField();
- }
- else if(aodevent)
- {
- Double_t curSol = 30000*aodevent->GetMagneticField()/5.00668;
- Double_t curDip = 6000 *aodevent->GetMuonMagFieldScale();
- AliMagF *field = AliMagF::CreateFieldMap(curSol,curDip);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
- else
+ if (!event->InitMagneticField())
{
AliInfo("Mag Field not initialized, null esd/aod evetn pointers");
}
}
TObjArray *clusterArray = 0x0;
- if(!clusterArr)
- {
- clusterArray = new TObjArray(event->GetNumberOfCaloClusters());
- for(Int_t icl=0; icl<event->GetNumberOfCaloClusters(); icl++)
+ if(!clusterArr)
{
- AliVCluster *cluster = (AliVCluster*) event->GetCaloCluster(icl);
- if(geom && !IsGoodCluster(cluster,geom,(AliVCaloCells*)event->GetEMCALCells())) continue;
- clusterArray->AddAt(cluster,icl);
- }
+ clusterArray = new TObjArray(event->GetNumberOfCaloClusters());
+ for(Int_t icl=0; icl<event->GetNumberOfCaloClusters(); icl++)
+ {
+ AliVCluster *cluster = (AliVCluster*) event->GetCaloCluster(icl);
+ if(geom && !IsGoodCluster(cluster,geom,(AliVCaloCells*)event->GetEMCALCells())) continue;
+ clusterArray->AddAt(cluster,icl);
}
+ }
Int_t matched=0;
Double_t cv[21];
{
printf("Wrong input data type! Should be \"AOD\" or \"ESD\"\n");
if(clusterArray)
- {
- clusterArray->Clear();
- delete clusterArray;
- }
+ {
+ clusterArray->Clear();
+ delete clusterArray;
+ }
return;
}
AliExternalTrackParam emcalParam(*trackParam);
Float_t eta, phi, pt;
if(!ExtrapolateTrackToEMCalSurface(&emcalParam, fEMCalSurfaceDistance, fMass, fStepSurface, eta, phi, pt))
- {
- if(aodevent && trackParam) delete trackParam;
- if(fITSTrackSA && trackParam) delete trackParam;
- continue;
- }
-
-// if(esdevent)
-// {
-// esdTrack->SetOuterParam(&emcalParam,AliExternalTrackParam::kMultSec);
-// }
+ {
+ if(aodevent && trackParam) delete trackParam;
+ if(fITSTrackSA && trackParam) delete trackParam;
+ continue;
+ }
if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad())
- {
- if(aodevent && trackParam) delete trackParam;
- if(fITSTrackSA && trackParam) delete trackParam;
- continue;
- }
-
+ {
+ if(aodevent && trackParam) delete trackParam;
+ if(fITSTrackSA && trackParam) delete trackParam;
+ continue;
+ }
//Find matched clusters
Int_t index = -1;
Float_t dEta = -999, dPhi = -999;
if(!clusterArr)
- {
- index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArray, dEta, dPhi);
- }
+ {
+ index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArray, dEta, dPhi);
+ }
else
- {
- index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArr, dEta, dPhi);
- }
+ {
+ index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArr, dEta, dPhi);
+ }
if(index>-1)
{
}//track loop
if(clusterArray)
- {
- clusterArray->Clear();
- delete clusterArray;
- }
+ {
+ clusterArray->Clear();
+ delete clusterArray;
+ }
AliDebug(2,Form("Number of matched pairs = %d !\n",matched));
Float_t clsPos[3] = {0.,0.,0.};
for(Int_t icl=0; icl<clusterArr->GetEntriesFast(); icl++)
+ {
+ AliVCluster *cluster = dynamic_cast<AliVCluster*> (clusterArr->At(icl)) ;
+ if(!cluster || !cluster->IsEMCAL()) continue;
+ cluster->GetPosition(clsPos);
+ Double_t dR = TMath::Sqrt(TMath::Power(exPos[0]-clsPos[0],2)+TMath::Power(exPos[1]-clsPos[1],2)+TMath::Power(exPos[2]-clsPos[2],2));
+ if(dR > fClusterWindow) continue;
+
+ AliExternalTrackParam trkPamTmp (*trkParam);//Retrieve the starting point every time before the extrapolation
+ if(!ExtrapolateTrackToCluster(&trkPamTmp, cluster, fMass, fStepCluster, tmpEta, tmpPhi)) continue;
+ if(fCutEtaPhiSum)
{
- AliVCluster *cluster = dynamic_cast<AliVCluster*> (clusterArr->At(icl)) ;
- if(!cluster || !cluster->IsEMCAL()) continue;
- cluster->GetPosition(clsPos);
- Double_t dR = TMath::Sqrt(TMath::Power(exPos[0]-clsPos[0],2)+TMath::Power(exPos[1]-clsPos[1],2)+TMath::Power(exPos[2]-clsPos[2],2));
- if(dR > fClusterWindow) continue;
-
- AliExternalTrackParam trkPamTmp (*trkParam);//Retrieve the starting point every time before the extrapolation
- if(!ExtrapolateTrackToCluster(&trkPamTmp, cluster, fMass, fStepCluster, tmpEta, tmpPhi)) continue;
- if(fCutEtaPhiSum)
- {
- Float_t tmpR=TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi);
- if(tmpR<dRMax)
+ Float_t tmpR=TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi);
+ if(tmpR<dRMax)
{
dRMax=tmpR;
dEtaMax=tmpEta;
dPhiMax=tmpPhi;
index=icl;
}
- }
- else if(fCutEtaPhiSeparate)
- {
- if(TMath::Abs(tmpEta)<TMath::Abs(dEtaMax) && TMath::Abs(tmpPhi)<TMath::Abs(dPhiMax))
+ }
+ else if(fCutEtaPhiSeparate)
+ {
+ if(TMath::Abs(tmpEta)<TMath::Abs(dEtaMax) && TMath::Abs(tmpPhi)<TMath::Abs(dPhiMax))
{
dEtaMax = tmpEta;
dPhiMax = tmpPhi;
index=icl;
}
- }
- else
- {
- printf("Error: please specify your cut criteria\n");
- printf("To cut on sqrt(dEta^2+dPhi^2), use: SwitchOnCutEtaPhiSum()\n");
- printf("To cut on dEta and dPhi separately, use: SwitchOnCutEtaPhiSeparate()\n");
- return index;
- }
}
+ else
+ {
+ printf("Error: please specify your cut criteria\n");
+ printf("To cut on sqrt(dEta^2+dPhi^2), use: SwitchOnCutEtaPhiSum()\n");
+ printf("To cut on dEta and dPhi separately, use: SwitchOnCutEtaPhiSeparate()\n");
+ return index;
+ }
+ }
dEta=dEtaMax;
dPhi=dPhiMax;