]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Use event initmagfield and cleanup of indent
authorConstantin Loizides <cloizides@lbl.gov>
Sun, 8 Dec 2013 05:56:48 +0000 (06:56 +0100)
committerConstantin Loizides <cloizides@lbl.gov>
Sun, 8 Dec 2013 05:56:48 +0000 (06:56 +0100)
EMCAL/AliEMCALRecoUtils.cxx

index 8a6751492ca8523c876395a84607abfca96a86e0..bf4b2ce513e62f16fb594b20b86ec5f2d25b69d7 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id: AliEMCALRecoUtils.cxx 33808 2009-07-15 09:48:08Z gconesab $ */
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -1829,19 +1829,7 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
   // 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");
     }
@@ -1862,16 +1850,16 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
   }
 
   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];
@@ -1937,10 +1925,10 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
     {
       printf("Wrong input data type! Should be \"AOD\" or \"ESD\"\n");
       if(clusterArray)
-  {
-    clusterArray->Clear();
-    delete clusterArray;
-  }
+      {
+       clusterArray->Clear();
+       delete clusterArray;
+      }
       return;
     }
     
@@ -1950,36 +1938,30 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
     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)
     {
@@ -1994,10 +1976,10 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
   }//track loop
 
   if(clusterArray)
-    {
-      clusterArray->Clear();
-      delete clusterArray;
-    }
+  {
+    clusterArray->Clear();
+    delete clusterArray;
+  }
   
   AliDebug(2,Form("Number of matched pairs = %d !\n",matched));
   
@@ -2073,43 +2055,43 @@ Int_t  AliEMCALRecoUtils::FindMatchedClusterInClusterArr(const AliExternalTrackP
 
   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;