]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSJetFinder.cxx
Mods in QuadraticRoots
[u/mrichter/AliRoot.git] / PHOS / AliPHOSJetFinder.cxx
index 1258825da39bcd673a14e8a58524227e020695ca..8cc03088b6fa85b61331153a6e5f2211685ace53 100644 (file)
 
 //_________________________________________________________________________
 // C++ version of UA2 and/or Lund jet finding algorithm
-//  UA1 jet algorithm from LUND JETSET (LUCELL)
-//
+// UA1 jet algorithm from LUND JETSET (LUCELL)
+// Find jets at the level of no detector and Digits.
+// Needs modifications. 
 //*-- Author : D.Peressounko after UA1 coll. etc
 //////////////////////////////////////////////////////////////////////////////
 
+/* $Id$ */
+
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.8  2005/05/28 14:19:04  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
 // --- ROOT system ---
 #include "TClonesArray.h"
 //      #include "TIter.h"
 // --- Standard library ---
 
 // --- AliRoot header files ---
+#include "AliLog.h"
 #include "AliPHOSJet.h"
+#include "AliPHOSGeometry.h"
 #include "AliPHOSDigit.h"
-#include "AliPHOSGetter.h"
 #include "AliPHOSJetFinder.h"
 #include "AliPHOSDigitizer.h"
 
@@ -38,29 +50,50 @@ ClassImp(AliPHOSJetFinder)
 
 
 //____________________________________________________________________________ 
-  AliPHOSJetFinder::AliPHOSJetFinder():TNamed("AliPHOSJetFinder","") 
+AliPHOSJetFinder::AliPHOSJetFinder():
+  TNamed("AliPHOSJetFinder",""),
+  fNJets(0),
+  fStatusCode(-999),
+  fMode(0),
+  fConeRad(1.),
+  fMaxConeMove(0.15),
+  fMinConeMove(0.05),
+  fEtSeed(4.),
+  fEtMin(5.),
+  fPrecBg(0.00035),
+  fSimGain(0.),
+  fSimPedestal(0.),
+  fParticles(0),
+  fJets(0)
 {
-  fNJets = 0 ;
-  fMode  = 0 ;   //No iterations 
-  fStatusCode = -999 ; //no selection
-
-  fConeRad = 1.;   //Radius of jet value?????????
-  fMaxConeMove = 0.15 ; //value???????
-  fMinConeMove = 0.05 ; //value???????
-  fEtSeed = 4. ; //Energy of seed particle value??????????
-  fEtMin = 5.;   //minimal energy of jet   value??????????
-  fPrecBg = 0.00035 ; //value????????
-  fSimGain = 0.;
-  fSimPedestal = 0.;
+  //Initialize jet parameters
+}
 
-  fParticles = 0;
-  fJets = 0 ;
-  
+//____________________________________________________________________________ 
+AliPHOSJetFinder::AliPHOSJetFinder(const AliPHOSJetFinder & jet) : 
+  TNamed(jet),
+  fNJets(0),
+  fStatusCode(-999),
+  fMode(0),
+  fConeRad(1.),
+  fMaxConeMove(0.15),
+  fMinConeMove(0.05),
+  fEtSeed(4.),
+  fEtMin(5.),
+  fPrecBg(0.00035),
+  fSimGain(0.),
+  fSimPedestal(0.),
+  fParticles(0),
+  fJets(0)
+{
+  // copy ctor: no implementation yet
+  Fatal("cpy ctor", "not implemented");
 }
 
 //____________________________________________________________________________ 
   AliPHOSJetFinder::~AliPHOSJetFinder()
 {
+  //dtor
   if(fParticles){
     delete fParticles ;
     fParticles = 0 ;
@@ -74,7 +107,7 @@ ClassImp(AliPHOSJetFinder)
 //____________________________________________________________________________ 
 void  AliPHOSJetFinder::FindJetsFromParticles(const TClonesArray * plist,TObjArray * jetslist) 
 {
-
+  //Find jets in the case without detector.
   TIter next(plist) ;
 
   TIter nextJet(jetslist) ;
@@ -160,9 +193,9 @@ void  AliPHOSJetFinder::FindJetsFromParticles(const TClonesArray * plist,TObjArr
 }
 //____________________________________________________________________________ 
 void AliPHOSJetFinder::FindJetsFromDigits(const TClonesArray * digits, TObjArray * jets){
-
+  //Find jets in the case witht detector at the level of digits.
   if(digits->GetEntries()==0){
-    Error("JetsFromDigits","No entries in digits list \n") ;
+    AliError(Form("No entries in digits list \n")) ;
     return ;
   }
 
@@ -220,11 +253,11 @@ void AliPHOSJetFinder::FindJetsFromDigits(const TClonesArray * digits, TObjArray
        CalculateEEtaPhi(digit,e,eta,phi) ;
        jet->AddDigit(e,eta,phi,-1) ;  
        //loop over left digits
-       for(Int_t iDigit = 0 ; iDigit < copyDigits->GetEntries() ; iDigit++){
+       for(iDigit = 0 ; iDigit < copyDigits->GetEntries() ; iDigit++){
          if(iDigit!= ind){ //first digit already in jet
            digit = static_cast<AliPHOSDigit *>(copyDigits->At(iDigit));
            CalculateEEtaPhi(digit,e,eta,phi) ;     
-           if(jet->IsInCone(e,eta,phi) && //is cell in cone
+           if(jet->IsInCone(eta,phi) && //is cell in cone
               jet->AcceptConeDeviation(e,eta,phi)){//if cone does not move too much          
              jet->AddDigit(e,eta,phi,-1) ;  //accept new direction
            }
@@ -235,7 +268,7 @@ void AliPHOSJetFinder::FindJetsFromDigits(const TClonesArray * digits, TObjArray
        //note, that digits might be returned as anused later
        for(Int_t icell = 0 ; icell < copyDigits->GetEntries() ; icell++){
          digit = static_cast<AliPHOSDigit *>(copyDigits->At(icell));
-         if(jet->IsInCone(e,eta,phi)){ //is cell in cone
+         if(jet->IsInCone(eta,phi)){ //is cell in cone
            CalculateEEtaPhi(digit,e,eta,phi) ;
            jet->AddDigit(e,eta,phi,digit->GetIndexInList()) ; 
          }
@@ -270,8 +303,8 @@ void AliPHOSJetFinder::FindJetsFromDigits(const TClonesArray * digits, TObjArray
        if(digit)
          totalEnergy+=energy[i] ;
       }
-      if(!fMode || (oldTotalEnergy != 0) && 
-        (TMath::Abs(oldTotalEnergy - totalEnergy)/oldTotalEnergy < fPrecBg))
+      if(!fMode || ((oldTotalEnergy != 0) && 
+                   (TMath::Abs(oldTotalEnergy - totalEnergy)/oldTotalEnergy < fPrecBg)))
        break ; 
     }
   }
@@ -282,38 +315,15 @@ void AliPHOSJetFinder::FindJetsFromDigits(const TClonesArray * digits, TObjArray
 }
 //____________________________________________________________________________ 
 Double_t AliPHOSJetFinder::Calibrate(const AliPHOSDigit * digit){ 
-//   if(fPedestals || fGains ){  //use calibration data
-//     if(!fPedestals || !fGains ){
-//       Error("Calibrate","Either Pedestals of Gains not set!") ;
-//       return 0 ;
-//     }
-//     Float_t en=(digit->GetAmp() - fPedestals->Data(digit->GetId)()))*fGains->Data(digit->GetId()) ;
-//     if(en>0)
-//       return en ;
-//     else
-//       return 0. ;
-//   }
-//   else{ //simulation
-  if(fSimGain==0){ //read simulation parameters
-    AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-    if(!gime){
-      Error("Calibrate","Can not read Calibration parameters") ;
-      return 0 ;
-    }
-    const TTask * task = gime->Digitizer() ;
-    if(strcmp(task->IsA()->GetName(),"AliPHOSDigitizer")==0){
-      const AliPHOSDigitizer * dig = static_cast<const AliPHOSDigitizer *>(task) ;
-      fSimGain     = dig->GetEMCchannel() ;
-      fSimPedestal = dig->GetEMCpedestal();
-    }
-  }
+  //Both simulated and raw digits are already calibrated
   
-  return fSimPedestal + digit->GetAmp()*fSimGain ;        
+  return digit->GetEnergy() ;        
   
   //  }  
 }
 //____________________________________________________________________________ 
 void AliPHOSJetFinder::CalculateEEtaPhi(const AliPHOSDigit * d,Double_t &e, Double_t &eta, Double_t &phi){
+  //Calculate direction of the jet
   e=Calibrate(d) ;
   AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance("GPS2","") ;
   TVector3 pos ;
@@ -322,7 +332,8 @@ void AliPHOSJetFinder::CalculateEEtaPhi(const AliPHOSDigit * d,Double_t &e, Doub
   phi = pos.Phi() ;
 }
 //____________________________________________________________________________ 
-void AliPHOSJetFinder::Print(Option_t * option){       
+void AliPHOSJetFinder::Print(const Option_t *) const { 
+  //Print parameters of the found jet
   printf("\n --------------- AliPHOSJetFinder --------------- \n") ;
   printf(" Jets found .........%d \n",fNJets) ;
   printf(" Seed energy cut ....%f \n",fEtSeed) ;