]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/Correlations/JCORRAN/AliJPhoton.cxx
update to master versions
[u/mrichter/AliRoot.git] / PWGCF / Correlations / JCORRAN / AliJPhoton.cxx
index 924c893b3394277056e03118ad781daae6cd3f49..40ae92529311734592f75efb85ca9a4550c3bea5 100644 (file)
@@ -1,3 +1,20 @@
+/**************************************************************************
+ * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+// Comment describing what this class does needed!
+
 // $Id: AliJPhoton.cxx,v 1.4 2008/05/08 13:44:45 djkim Exp $
 
 ////////////////////////////////////////////////////
@@ -13,7 +30,7 @@
 
 #include "AliJBaseTrack.h"
 #include "AliJPhoton.h"
-#include "TF1.h"
+#include <TF1.h>
 
 ClassImp(AliJPhoton);
 //______________________________________________________________________________
@@ -33,10 +50,19 @@ AliJPhoton::AliJPhoton() :
   fM20(-999),
   fM02(-999),
   fEmcCpvDist(-999),
-  fNCells(0),
+  fNCells(-999),
+  fNTracksMatched(-999),
   fSuperModuleId(-999),
   fCellsAbsId(0x0),
-  fCellsAmpFraction(0x0)
+  fCellsAmpFraction(0x0),
+  fNEMCLabel(0),
+  fEMCLabel(0x0),
+  fEMax(-999),
+  fECross(-999),
+  fECore(-999),
+  fNLM(-999),
+  fCellsIndex(0x0)
+//  fCellsAmp(0x0)
 
 {
   // default constructor
@@ -63,15 +89,48 @@ AliJPhoton::AliJPhoton(const AliJPhoton& a) :
   fM02(a.fM02),
   fEmcCpvDist(a.fEmcCpvDist),
   fNCells(a.fNCells),
+  fNTracksMatched(a.fNTracksMatched),
   fSuperModuleId(a.fSuperModuleId),
   fCellsAbsId(NULL),
-  fCellsAmpFraction(NULL)
+  fCellsAmpFraction(NULL),
+  fNEMCLabel(a.fNEMCLabel),
+  fEMCLabel(NULL),
+  fEMax(a.fEMax),
+  fECross(a.fECross),
+  fECore(a.fECore),
+  fNLM(a.fNLM),
+  fCellsIndex(NULL)
+//  fCellsAmp(NULL)
 
 {
   //copy constructor
   for(Int_t i=0;i<kUnknownAli+1;i++) fCaloPID[i] = a.fCaloPID[i];
   SetCellsAbsId( a.fCellsAbsId );
   SetCellsAmplitudeFraction( a.fCellsAmpFraction );
+  SetCellsIndex( a.fCellsIndex );
+       SetEMCLabel( a.fEMCLabel );
+//  SetCellsAmplitude( a.fCellsAmp );
+}
+
+
+//_____________________________________________________________________________
+AliJPhoton::~AliJPhoton(){
+  // destructor
+  Clear("");
+}
+
+//_____________________________________________________________________________
+void AliJPhoton::Clear( Option_t * /* option */ ){
+  // cleaner
+    if(fCellsAbsId)       delete [] fCellsAbsId;
+    if(fCellsAmpFraction) delete [] fCellsAmpFraction;
+    if( fEMCLabel )       delete [] fEMCLabel;
+    if( fCellsIndex )     delete [] fCellsIndex;
+    fCellsAbsId = 0;
+    fCellsAmpFraction = 0;
+               fEMCLabel = 0;
+    fCellsIndex = 0;
+//    if(fCellsAmp)         delete [] fCellsAmp;
 }
 
 //_____________________________________________________________________________
@@ -97,9 +156,17 @@ AliJPhoton& AliJPhoton::operator=(const AliJPhoton& photon){
     fM02           = photon.fM02;
     fEmcCpvDist    = photon.fEmcCpvDist;
     fNCells        = photon.fNCells;
+    fNTracksMatched = photon.fNTracksMatched;
     fSuperModuleId =  photon.fSuperModuleId;
     SetCellsAbsId( photon.fCellsAbsId );
     SetCellsAmplitudeFraction( photon.fCellsAmpFraction );
+    SetEMCLabel( photon.fEMCLabel );
+//    SetCellsAmplitude( photon.fCellsAmp );
+    fEMax = photon.fEMax;
+    fECross = photon.fECross;
+    fECore = photon.fECore;
+    fNLM  = photon.fNLM;
+    SetCellsIndex( photon.fCellsIndex );
 
   }
 
@@ -111,8 +178,8 @@ void  AliJPhoton::SetCellsAbsId(const UShort_t *array)
     //  Set the array of cell absId numbers 
     if (fNCells) {
         if(fCellsAbsId){ delete [] fCellsAbsId; fCellsAbsId = NULL; }
-       fCellsAbsId = new  UShort_t[fNCells];
-       for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
+  fCellsAbsId = new  UShort_t[fNCells];
+  for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
     }
 }
 
@@ -121,20 +188,91 @@ void  AliJPhoton::SetCellsAmplitudeFraction(const Double32_t *array)
 {
     //  Set the array of cell amplitude fraction
     if (fNCells) {
-       if(fCellsAmpFraction){ delete [] fCellsAmpFraction; fCellsAmpFraction = NULL;}
-       fCellsAmpFraction = new  Double32_t[fNCells];
-       for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
+  if(fCellsAmpFraction){ delete [] fCellsAmpFraction; fCellsAmpFraction = NULL;}
+  fCellsAmpFraction = new  Double32_t[fNCells];
+  for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
+    }
+}
+
+//______________________________________________________________________________
+void  AliJPhoton::SetEMCLabel(const Int_t *array)
+{
+    //  Set the array of cell absId numbers 
+    if (fNEMCLabel) {
+        if(fEMCLabel){ delete [] fEMCLabel; fEMCLabel = NULL; }
+  fEMCLabel = new  Int_t[fNEMCLabel];
+  for (Int_t i = 0; i < fNEMCLabel; i++) fEMCLabel[i] = array[i];
+    }
+}
+
+//______________________________________________________________________________
+void  AliJPhoton::SetCellsIndex(const Int_t *array)
+{
+  //  Set the array of cell absId numbers 
+  if( !array ){
+    if( fCellsIndex ){
+      delete [] fCellsIndex;
+      fCellsIndex = NULL;
+    }
+  }
+  else if (fNCells) {
+    if( fCellsIndex ){
+      delete [] fCellsIndex;
+      fCellsIndex = NULL;
     }
+    
+    fCellsIndex = new  Int_t[fNCells];
+    for (Int_t i = 0; i < fNCells; i++)
+      fCellsIndex[i] = array[i];
+  }
 }
 
 //______________________________________________________________________________
-void  AliJPhoton::SetPID(const Double_t *pid) {
+void  AliJPhoton::SetCellIndex(const Int_t pos, const Int_t ind)
+{
+  //  Set the array of cell absId numbers 
+
+  Int_t i;
+  if (fNCells) {
+    if( ! fCellsIndex ){
+      fCellsIndex = new  Int_t[fNCells];
+      for( i = 0; i < fNCells; i++ )
+        fCellsIndex[i] = -1;
+    }
+  }
+  
+  fCellsIndex[pos] = ind;
+}
+
+//______________________________________________________________________________
+void  AliJPhoton::ClearCellsIndex()
+{
+  //  Clears the array of cell absId numbers 
+  if(fCellsIndex){
+    delete [] fCellsIndex;
+    fCellsIndex = NULL;
+  }
+}
+
+// //_______________________________________________________________________
+// void  AliJPhoton::SetCellsAmplitude(const Double32_t *array)
+// {
+//     //  Set the array of cell amplitude fraction
+//     if (fNCells) {
+//   if(fCellsAmp){ delete [] fCellsAmp; fCellsAmp = NULL;}
+//   fCellsAmp = new  Double_t[fNCells];
+//   for (Int_t i = 0; i < fNCells; i++) fCellsAmp[i] = array[i];
+//     }
+// }
+
+//______________________________________________________________________________
+void  AliJPhoton::SetPID(const Double32_t *pid) {
    //set pid
     if(pid){
-       for(Int_t i=0; i<kUnknownAli+1; ++i) fCaloPID[i]=pid[i];
+       for(Int_t i=0; i<kUnknownAli; ++i) fCaloPID[i]=pid[i];
        SetProbPhot(fCaloPID[kPhotonAli]);
     }else{
-      for(Int_t i=0; i<kUnknownAli+1; fCaloPID[i++]=0.){} 
+      for(Int_t i=0; i<kUnknownAli; fCaloPID[i++]=0.){} 
       fCaloPID[kUnknownAli]=1.;
     }
 }
@@ -176,12 +314,12 @@ particleType AliJPhoton::GetParticleType() {
     }
     
   
-   particleType pdg = kHadron;
+   particleType pdg = kJHadron;
 
   //Select most probable ID
   if(fCaloType == kPHOSCalo){
-    if(fCaloPID[kPhotonAli] > wPhoton) pdg = kPhoton ;
-    else if(fCaloPID[kPi0Ali] > wPi0) pdg = kPizero ; 
+    if(fCaloPID[kPhotonAli] > wPhoton) pdg = kJPhoton ;
+    else if(fCaloPID[kPi0Ali] > wPi0) pdg = kJPizero ; 
     //else if(fCaloPID[kElectronAli] > wElectron)  pdg = electron ;
     //else if(fCaloPID[kEleConAli] >  wElectron) pdg = electronCon ;
     //else if(chargedHadronWeight > wCharged) pdg = chargedHadron ;  
@@ -193,8 +331,8 @@ particleType AliJPhoton::GetParticleType() {
   }
   else{//EMCAL
     //Temporal solution, electrons and photons not differenciated
-    if(fCaloPID[kPhotonAli] + fCaloPID[kElectronAli]  > wPhoton) pdg = kPhoton ;
-    else if(fCaloPID[kPi0Ali] > wPi0) pdg = kPizero ; 
+    if(fCaloPID[kPhotonAli] + fCaloPID[kElectronAli]  > wPhoton) pdg = kJPhoton ;
+    else if(fCaloPID[kPi0Ali] > wPi0) pdg = kJPizero ; 
     //else if(chargedHadronWeight + neutralHadronWeight > wCharged) pdg = chargedHadron ;  
     //else if(neutralHadronWeight + chargedHadronWeight > wNeutral) pdg = neutralHadron ; 
     //else pdg =  neutralUnknown ;