LCOV - code coverage report
Current view: top level - STEER/ESD - AliESDCaloCluster.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 135 267 50.6 %
Date: 2016-06-14 17:26:59 Functions: 16 24 66.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : #include <TLorentzVector.h>
      17             : #include "AliLog.h"
      18             : #include "AliESDCaloCluster.h"
      19             : 
      20             : /// \cond CLASSIMP
      21         172 : ClassImp(AliESDCaloCluster) ;
      22             : /// \endcond
      23             : 
      24             : ///
      25             : /// The default ESD constructor 
      26             : ///
      27             : //_______________________________________________________________________
      28             : AliESDCaloCluster::AliESDCaloCluster() : 
      29         102 :   AliVCluster(),
      30         102 :   fTracksMatched(0x0),
      31         102 :   fLabels(0x0),
      32         102 :   fNCells(0),
      33         102 :   fCellsAbsId(0x0),
      34         102 :   fCellsAmpFraction(0x0),
      35         102 :   fEnergy(0),
      36         102 :   fDispersion(0),
      37         102 :   fChi2(0),
      38         102 :   fM20(0),
      39         102 :   fM02(0),
      40         102 :   fEmcCpvDistance(1024),
      41         102 :   fTrackDx(1024),fTrackDz(1024),
      42         102 :   fDistToBadChannel(1024),
      43         102 :   fID(0),
      44         102 :   fNExMax(0),
      45         102 :   fClusterType(kUndef), 
      46         102 :   fTOF(0.),
      47         102 :   fCoreEnergy(0.),
      48         102 :   fMCEnergyFraction(0.),
      49         102 :   fIsExotic(kFALSE),
      50         102 :   fNLabel(0),
      51         102 :   fClusterMCEdepFraction(0x0),
      52         102 :   fCellsMCEdepFractionMap(0x0)
      53         510 : {
      54         102 :   fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
      55        3060 :   for(Int_t i=0; i<AliPID::kSPECIESCN; i++) fPID[i] = 0.;
      56             : 
      57        1224 :   for (Int_t i = 0; i <= kLastUserDefEnergy; i++) {
      58         510 :     fUserDefEnergy[i] = 1.;
      59             :   }
      60         204 : }
      61             : 
      62             : ///
      63             : /// The copy constructor 
      64             : ///
      65             : //_______________________________________________________________________
      66             : AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) : 
      67          43 :   AliVCluster(clus),
      68         172 :   fTracksMatched(clus.fTracksMatched?new TArrayI(*clus.fTracksMatched):0x0),
      69         172 :   fLabels(clus.fLabels?new TArrayI(*clus.fLabels):0x0),
      70          43 :   fNCells(clus.fNCells),
      71          43 :   fCellsAbsId(),
      72          43 :   fCellsAmpFraction(),
      73          43 :   fEnergy(clus.fEnergy),
      74          43 :   fDispersion(clus.fDispersion),
      75          43 :   fChi2(clus.fChi2),
      76          43 :   fM20(clus.fM20),
      77          43 :   fM02(clus.fM02),
      78          43 :   fEmcCpvDistance(clus.fEmcCpvDistance),
      79          43 :   fTrackDx(clus.fTrackDx),
      80          43 :   fTrackDz(clus.fTrackDz),
      81          43 :   fDistToBadChannel(clus.fDistToBadChannel),
      82          43 :   fID(clus.fID),
      83          43 :   fNExMax(clus.fNExMax),
      84          43 :   fClusterType(clus.fClusterType),
      85          43 :   fTOF(clus.fTOF),
      86          43 :   fCoreEnergy(clus.fCoreEnergy),
      87          43 :   fMCEnergyFraction(clus.fMCEnergyFraction),
      88          43 :   fIsExotic(clus.fIsExotic),
      89          43 :   fNLabel(clus.fNLabel),
      90          43 :   fClusterMCEdepFraction(),
      91          43 :   fCellsMCEdepFractionMap()
      92         215 : {
      93          43 :   fGlobalPos[0] = clus.fGlobalPos[0];
      94          43 :   fGlobalPos[1] = clus.fGlobalPos[1];
      95          43 :   fGlobalPos[2] = clus.fGlobalPos[2];
      96             : 
      97        1290 :   for(Int_t i=0; i<AliPID::kSPECIESCN; i++) fPID[i] = clus.fPID[i];
      98             : 
      99          43 :   if (clus.fNCells > 0) 
     100             :   {
     101          43 :     if(clus.fCellsAbsId)
     102             :     {
     103          86 :       fCellsAbsId = new UShort_t[clus.fNCells];
     104         604 :       for (Int_t i=0; i<clus.fNCells; i++) fCellsAbsId[i]=clus.fCellsAbsId[i];
     105          43 :     }
     106             :     
     107          43 :     if(clus.fCellsAmpFraction)
     108             :     {
     109          86 :       fCellsAmpFraction = new Double32_t[clus.fNCells];
     110         604 :       for (Int_t i=0; i<clus.fNCells; i++) fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
     111          43 :     }
     112             : 
     113          43 :     if(clus.fCellsMCEdepFractionMap)
     114             :     {
     115          66 :       fCellsMCEdepFractionMap = new UInt_t[clus.fNCells];
     116         260 :       for (Int_t i=0; i<clus.fNCells; i++) fCellsMCEdepFractionMap[i]=clus.fCellsMCEdepFractionMap[i];
     117          33 :     }
     118             :   }
     119             :   
     120          60 :   if(clus.fClusterMCEdepFraction && clus.fNLabel > 0)
     121             :   {
     122          34 :     fClusterMCEdepFraction = new UShort_t[clus.fNLabel];
     123          70 :     for (Int_t i=0; i<clus.fNLabel; i++) fClusterMCEdepFraction[i]=clus.fClusterMCEdepFraction[i];
     124          17 :   }
     125             : 
     126         516 :   for (Int_t i = 0; i <= kLastUserDefEnergy; i++) 
     127         215 :     fUserDefEnergy[i] = clus.fUserDefEnergy[i];
     128             : 
     129          86 : }
     130             : 
     131             : ///
     132             : /// The assignment operator.
     133             : ///
     134             : //_______________________________________________________________________
     135             : AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
     136             : {
     137           0 :   if(&source == this) return *this;
     138           0 :   AliVCluster::operator=(source);
     139           0 :   fGlobalPos[0] = source.fGlobalPos[0];
     140           0 :   fGlobalPos[1] = source.fGlobalPos[1];
     141           0 :   fGlobalPos[2] = source.fGlobalPos[2];
     142             : 
     143           0 :   fEnergy = source.fEnergy;
     144           0 :   fDispersion = source.fDispersion;
     145           0 :   fChi2 = source.fChi2;
     146           0 :   fM20 = source.fM20;
     147           0 :   fM02 = source.fM02;
     148           0 :   fEmcCpvDistance = source.fEmcCpvDistance;
     149           0 :   fTrackDx= source.fTrackDx ;
     150           0 :   fTrackDz= source.fTrackDz ;
     151           0 :   fDistToBadChannel = source.fDistToBadChannel ;
     152           0 :   for(Int_t i=0; i<AliPID::kSPECIESCN; i++) fPID[i] = source.fPID[i];
     153           0 :   fID = source.fID;
     154             :   
     155           0 :   fNLabel = source.fNLabel;
     156           0 :   fNCells = source.fNCells;
     157             : 
     158           0 :   if (source.fNCells > 0) 
     159             :   {
     160           0 :     if(source.fCellsAbsId)
     161             :     {
     162           0 :       if(!fCellsAbsId)
     163             :       {
     164           0 :         if(fCellsAbsId)delete [] fCellsAbsId;
     165           0 :         fCellsAbsId = new UShort_t[source.fNCells];
     166           0 :       }
     167             :       
     168           0 :       for (Int_t i=0; i<source.fNCells; i++)
     169           0 :         fCellsAbsId[i]=source.fCellsAbsId[i];
     170           0 :     }
     171             :     
     172           0 :     if(source.fCellsAmpFraction)
     173             :     {
     174           0 :       if(!fCellsAmpFraction)
     175             :       {
     176           0 :         if(fCellsAmpFraction) delete [] fCellsAmpFraction;
     177           0 :         fCellsAmpFraction = new Double32_t[source.fNCells];
     178           0 :       }
     179             :       
     180           0 :       for (Int_t i=0; i<source.fNCells; i++)
     181           0 :         fCellsAmpFraction[i]=source.fCellsAmpFraction[i];
     182           0 :     }  
     183             :     
     184           0 :     if(source.fCellsMCEdepFractionMap)
     185             :     {
     186           0 :       if (!fCellsMCEdepFractionMap)
     187             :       {
     188           0 :         if(fCellsMCEdepFractionMap) delete [] fCellsMCEdepFractionMap;
     189           0 :         fCellsMCEdepFractionMap = new UInt_t[source.fNCells];
     190           0 :       }
     191             :       
     192           0 :       for (Int_t i=0; i<source.fNCells; i++) 
     193           0 :         fCellsMCEdepFractionMap[i]=source.fCellsMCEdepFractionMap[i];
     194           0 :     }
     195             :   } // fNCells > 0
     196             :   
     197           0 :   if(source.fClusterMCEdepFraction && source.fNLabel > 0)
     198             :   {
     199           0 :     if (!fClusterMCEdepFraction)
     200             :     {
     201           0 :       if(fClusterMCEdepFraction) delete [] fClusterMCEdepFraction;
     202           0 :       fClusterMCEdepFraction = new UShort_t[source.fNLabel];
     203           0 :     }
     204             :     
     205           0 :     for (Int_t i=0; i<source.fNLabel; i++) 
     206           0 :       fClusterMCEdepFraction[i]=source.fClusterMCEdepFraction[i];
     207           0 :   }
     208             : 
     209             :   
     210           0 :   fNExMax = source.fNExMax;
     211           0 :   fClusterType = source.fClusterType;
     212           0 :   fTOF = source.fTOF;
     213             : 
     214             :   //not in use
     215           0 :   if(source.fTracksMatched){
     216             :     // assign or copy construct
     217           0 :     if(fTracksMatched){
     218           0 :       *fTracksMatched = *source.fTracksMatched;
     219           0 :     }
     220           0 :     else fTracksMatched = new TArrayI(*source.fTracksMatched);
     221             :   }
     222             :   else{
     223           0 :     if(fTracksMatched)delete fTracksMatched;
     224           0 :     fTracksMatched = 0;
     225             :   }
     226             : 
     227           0 :   if(source.fLabels){
     228             :     // assign or copy construct
     229           0 :     if(fLabels){ 
     230           0 :       *fLabels = *source.fLabels;
     231           0 :     }
     232           0 :     else fLabels = new TArrayI(*source.fLabels);
     233             :   }
     234             :   else{
     235           0 :     if(fLabels)delete fLabels;
     236           0 :     fLabels = 0;
     237             :   }
     238             : 
     239           0 :   fCoreEnergy = source.fCoreEnergy;
     240             :   
     241           0 :   fMCEnergyFraction = source.fMCEnergyFraction;
     242           0 :   fIsExotic = source.fIsExotic;
     243             : 
     244           0 :   for (Int_t i = 0; i <= kLastUserDefEnergy; i++) {
     245           0 :     fUserDefEnergy[i] = source.fUserDefEnergy[i];
     246             :   }
     247             :   
     248           0 :   return *this;
     249             : 
     250           0 : }
     251             : 
     252             : ///
     253             : /// This method overwrites the virtual TObject::Copy()
     254             : /// to allow run time copying without casting
     255             : /// in AliESDEvent
     256             : //_______________________________________________________________________
     257             : void AliESDCaloCluster::Copy(TObject &obj) const 
     258             : {
     259           0 :   if(this==&obj)return;
     260             :  
     261           0 :   AliESDCaloCluster *robj = dynamic_cast<AliESDCaloCluster*>(&obj);
     262             :   
     263           0 :   if(!robj)return; // not an AliESDCluster
     264             :   
     265           0 :   *robj = *this;
     266           0 : }
     267             : 
     268             : ///
     269             : /// This is destructor according Coding Conventions. 
     270             : ///
     271             : //_______________________________________________________________________
     272             : AliESDCaloCluster::~AliESDCaloCluster()
     273         870 : { 
     274         572 :   if(fTracksMatched) delete fTracksMatched; fTracksMatched = 0;
     275         572 :   if(fLabels)        delete fLabels;        fLabels        = 0;
     276             :   
     277         568 :   if(fCellsAmpFraction)       { delete[] fCellsAmpFraction;       fCellsAmpFraction       = 0 ; }
     278         568 :   if(fCellsAbsId)             { delete[] fCellsAbsId;             fCellsAbsId             = 0 ; }
     279         313 :   if(fClusterMCEdepFraction)  { delete[] fClusterMCEdepFraction;  fClusterMCEdepFraction  = 0 ; }
     280         472 :   if(fCellsMCEdepFractionMap) { delete[] fCellsMCEdepFractionMap; fCellsMCEdepFractionMap = 0 ; }
     281         435 : }
     282             : 
     283             : //
     284             : // Delete pointers 
     285             : //
     286             : //_______________________________________________________________________
     287             : void AliESDCaloCluster::Clear(const Option_t*)
     288             : { 
     289           0 :   if(fTracksMatched) delete fTracksMatched; fTracksMatched = 0;
     290           0 :   if(fLabels)        delete fLabels;        fLabels        = 0;
     291             :   
     292           0 :   if(fCellsAmpFraction)       { delete[] fCellsAmpFraction;       fCellsAmpFraction       = 0 ; }
     293           0 :   if(fCellsAbsId)             { delete[] fCellsAbsId;             fCellsAbsId             = 0 ; }
     294           0 :   if(fClusterMCEdepFraction)  { delete[] fClusterMCEdepFraction;  fClusterMCEdepFraction  = 0 ; }
     295           0 :   if(fCellsMCEdepFractionMap) { delete[] fCellsMCEdepFractionMap; fCellsMCEdepFractionMap = 0 ; }
     296           0 : }
     297             : 
     298             : ///
     299             : /// Sets the probability of each particle type
     300             : /// Copied from AliESDtrack SetPIDValues
     301             : /// This function copies "n" PID weights from "scr" to "dest"
     302             : /// and normalizes their sum to 1 thus producing conditional
     303             : /// probabilities.
     304             : /// The negative weights are set to 0.
     305             : /// In case all the weights are non-positive they are replaced by
     306             : /// uniform probabilities
     307             : //_______________________________________________________________________
     308             : void AliESDCaloCluster::SetPID(const Float_t *p) 
     309             : {
     310             :   Int_t n = AliPID::kSPECIESCN;
     311             : 
     312          50 :   Float_t uniform = 1./(Float_t)n;
     313             : 
     314             :   Float_t sum = 0;
     315         750 :   for (Int_t i=0; i<n; i++)
     316         350 :     if (p[i]>=0) {
     317         350 :       sum+=p[i];
     318         350 :       fPID[i] = p[i];
     319         350 :     }
     320             :     else {
     321           0 :       fPID[i] = 0;
     322             :     }
     323             : 
     324          25 :   if(sum>0)
     325         775 :     for (Int_t i=0; i<n; i++) fPID[i] /= sum;
     326             :   else
     327           0 :     for (Int_t i=0; i<n; i++) fPID[i] = uniform;
     328             : 
     329          25 : }
     330             : 
     331             : ///
     332             : /// Returns TLorentzVector with momentum of the cluster. Only valid for clusters 
     333             : /// identified as photons or pi0 (overlapped gamma) produced on the vertex
     334             : /// Vertex can be recovered with esd pointer doing:  
     335             : ///    " Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
     336             : ///
     337             : //_______________________________________________________________________
     338             : void AliESDCaloCluster::GetMomentum(TLorentzVector& p, const Double_t *vertex ) const
     339             : {
     340           0 :   Double32_t pos[3]={ fGlobalPos[0], fGlobalPos[1], fGlobalPos[2]};
     341           0 :   if(vertex){//calculate direction from vertex
     342           0 :     pos[0]-=vertex[0];
     343           0 :     pos[1]-=vertex[1];
     344           0 :     pos[2]-=vertex[2];
     345           0 :   }
     346             :   
     347           0 :   Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]   ) ; 
     348             :   
     349           0 :   if ( r > 0 ) 
     350           0 :     p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ; 
     351             :   else
     352           0 :     AliInfo("Null cluster radius, momentum calculation not possible");
     353           0 : }
     354             : 
     355             : ///
     356             : /// Returns TLorentzVector with momentum of the cluster. Only valid for clusters 
     357             : /// identified as photons or pi0 (overlapped gamma) produced on the vertex
     358             : /// Uses the user defined energy t
     359             : /// Vertex can be recovered with esd pointer doing:  
     360             : ///   " Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
     361             : ///
     362             : //_______________________________________________________________________
     363             : void AliESDCaloCluster::GetMomentum(TLorentzVector& p, const Double_t *vertex, VCluUserDefEnergy_t t ) const
     364             : {
     365           0 :   Double32_t energy = GetUserDefEnergy(t);
     366           0 :   Float_t    pos[3];
     367           0 :   GetPosition(pos);
     368             :   
     369           0 :   if(vertex){//calculate direction from vertex
     370           0 :     pos[0]-=vertex[0];
     371           0 :     pos[1]-=vertex[1];
     372           0 :     pos[2]-=vertex[2];
     373           0 :   }
     374             :   
     375           0 :   Double_t r = TMath::Sqrt(pos[0]*pos[0]+
     376           0 :                            pos[1]*pos[1]+
     377           0 :                            pos[2]*pos[2]   ) ; 
     378             :   
     379           0 :   p.SetPxPyPzE( energy*pos[0]/r,  energy*pos[1]/r,  energy*pos[2]/r,  energy) ; 
     380             :   
     381           0 : }
     382             : 
     383             : ///
     384             : ///  Set the array of cell absId numbers. 
     385             : ///
     386             : //_______________________________________________________________________
     387             : void  AliESDCaloCluster::SetCellsAbsId(UShort_t *array)
     388             : {
     389          86 :   if (fNCells) {
     390          43 :     fCellsAbsId = new  UShort_t[fNCells];
     391         604 :     for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
     392          43 :   }
     393          43 : }
     394             : 
     395             : ///
     396             : ///  Set the array of cell amplitude fractions. 
     397             : ///  Cell can be shared between 2 clusters, here the fraction of energy
     398             : ///  assigned to each cluster is stored. Only in unfolded clusters.
     399             : ///
     400             : //_______________________________________________________________________
     401             : void  AliESDCaloCluster::SetCellsAmplitudeFraction(Double32_t *array)
     402             : {
     403          86 :   if (fNCells) {
     404          43 :     fCellsAmpFraction = new  Double32_t[fNCells];
     405         604 :     for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
     406          43 :   }
     407          43 : }
     408             : 
     409             : ///
     410             : /// Set the cluster global position.
     411             : ///
     412             : //______________________________________________________________________________
     413             : void AliESDCaloCluster::SetPosition(Float_t *x) 
     414             : {  
     415          86 :   if (x) {
     416          43 :     fGlobalPos[0] = x[0];
     417          43 :     fGlobalPos[1] = x[1];
     418          43 :     fGlobalPos[2] = x[2];
     419          43 :   } else {
     420             :     
     421           0 :     fGlobalPos[0] = -999.;
     422           0 :     fGlobalPos[1] = -999.;
     423           0 :     fGlobalPos[2] = -999.;
     424             :   }
     425          43 : }
     426             : 
     427             : ///
     428             : /// \return Index of track matched to cluster. Several matches are possible.
     429             : ///
     430             : /// \param i: matched track index in array of matches
     431             : ///
     432             : //______________________________________________________________________________
     433             : Int_t AliESDCaloCluster::GetTrackMatchedIndex(Int_t i) const
     434             : {
     435         129 :   if (fTracksMatched && i >= 0 && i < fTracksMatched->GetSize())  {
     436          18 :     return fTracksMatched->At(i);
     437             :   }
     438             :   else {
     439          25 :     return -1;
     440             :   }
     441          43 : }
     442             : 
     443             : ///
     444             : /// \param cellIndex: position of cell in array fCellsAbsId
     445             : /// \param eDep: Filled float array with 4 entries, each is the fraction of deposited 
     446             : ///              energy by 4 most significant MC particles (GetLabels()) in a cell of the cluster.
     447             : /// In this method, the 4 fractions  stored in % values (0 to 100) 
     448             : /// in each bit of the integer fCellsMCEdepFractionMap[cellIndex] are unpacked. 
     449             : //______________________________________________________________________________
     450             : void  AliESDCaloCluster::GetCellMCEdepFractionArray(Int_t cellIndex, Float_t * eDep) const
     451             : { 
     452           0 :   if ( cellIndex >= fNCells || fNCells < 0 || !fCellsMCEdepFractionMap)
     453             :   {
     454           0 :     eDep[0] = eDep[1] = eDep[2] = eDep[3] = 0. ;
     455           0 :     return;
     456             :   }
     457             :   
     458           0 :   eDep[0] =  (fCellsMCEdepFractionMap[cellIndex]&0x000000ff)        / 100.;
     459           0 :   eDep[1] = ((fCellsMCEdepFractionMap[cellIndex]&0x0000ff00) >>  8) / 100.;
     460           0 :   eDep[2] = ((fCellsMCEdepFractionMap[cellIndex]&0x00ff0000) >> 16) / 100.;
     461           0 :   eDep[3] = ((fCellsMCEdepFractionMap[cellIndex]&0xff000000) >> 24) / 100.;  
     462           0 : }
     463             : 
     464             : ///
     465             : /// \param eDep: Float array with 4 entries, each is the fraction of deposited 
     466             : ///              energy by an MC particle in a cell of the cluster.
     467             : /// 
     468             : /// The MC particle must correspond one of the 4 first labels in GetLabels(). This method
     469             : /// packs the 4 floats into an integer, assigning each bit a value between 0 and 100
     470             : //______________________________________________________________________________
     471             : UInt_t  AliESDCaloCluster::PackMCEdepFraction(Float_t * eDep) const
     472             : { 
     473          88 :   UInt_t intEDep[4];
     474             :   
     475         440 :   for(Int_t i = 0; i < 4; i++)
     476         176 :     intEDep[i] = TMath::Nint(eDep[i]*100) ;
     477             :   
     478          44 :   UInt_t map = intEDep[0]|(intEDep[1]<<8)|(intEDep[2]<<16)|(intEDep[3]<<24);
     479             : 
     480          44 :   return map;
     481          44 : }
     482             : 
     483             : ///
     484             : /// \return Fraction of deposited energy by one of the particles in array fLable
     485             : /// 
     486             : /// \param mcIndex: position of MC particle in array fLabel
     487             : ///
     488             : /// The parameter is stored as %, return the corresponding float.
     489             : //______________________________________________________________________________
     490             : Float_t  AliESDCaloCluster::GetClusterMCEdepFraction(Int_t mcIndex) const
     491             : { 
     492           0 :   if ( mcIndex < 0 ||  mcIndex >= GetNLabels() || !fClusterMCEdepFraction) return 0. ;
     493             : 
     494           0 :   return  fClusterMCEdepFraction[mcIndex]/100. ; 
     495           0 : }
     496             : 
     497             : ///
     498             : /// Set the array with the fraction of deposited energy in a cell belonging to 
     499             : /// the cluster by a given primary  particle. Each entry of the array corresponds 
     500             : /// to the same entry in fCellsAbsId. Each entry is an integer where a maximum 
     501             : /// of 4 energy deposition fractions are encoded, each corresponding to the 
     502             : /// first 4 entries in fLabels
     503             : //______________________________________________________________________________
     504             : void  AliESDCaloCluster::SetCellsMCEdepFractionMap(UInt_t *array)
     505             : {
     506          66 :   if ( fNCells <= 0 || !array) return; 
     507             :   
     508          33 :   fCellsMCEdepFractionMap = new  UInt_t[fNCells];
     509             :   
     510         260 :   for (Int_t i = 0; i < fNCells; i++) 
     511          97 :     fCellsMCEdepFractionMap[i] = array[i];
     512          33 : }
     513             : 
     514             : ///
     515             : /// Set the array with the fraction of deposited energy in cluster by a given primary 
     516             : /// particle. Each entry of the array corresponds to the same entry in GetLabels().
     517             : /// Set the fraction in % with respect the cluster energy, store a value between 0 and 100
     518             : ///
     519             : /// \param array: energy deposition array
     520             : //______________________________________________________________________________
     521             : void  AliESDCaloCluster::SetClusterMCEdepFractionFromEdepArray(Float_t *array)
     522             : {
     523          66 :   if ( fLabels->GetSize() <= 0 || !array) return ; 
     524             : 
     525          17 :   fClusterMCEdepFraction = new  UShort_t[fLabels->GetSize()];
     526             :   
     527             :   // Get total deposited energy (can be different from reconstructed energy)
     528             :   Float_t totalE = 0;
     529          70 :   for (Int_t i = 0; i < fLabels->GetSize(); i++) totalE+=array[i];
     530             : 
     531             :   // Set the fraction of energy per MC contributor in %
     532          70 :   for (Int_t i = 0; i < fLabels->GetSize(); i++)     
     533          18 :     fClusterMCEdepFraction[i] = TMath::Nint(array[i]/totalE*100.);
     534          50 : }
     535             : 
     536             : 
     537             : ///
     538             : /// Set the array with the fraction of deposited energy in cluster by a given primary 
     539             : /// particle. Each entry of the array corresponds to the same entry in GetLabels().
     540             : ///
     541             : /// The fraction must already be in % with respect the cluster energy, store a value between 0 and 100
     542             : /// \param array: array of fraction of energy deposition / cluster energy 
     543             : //______________________________________________________________________________
     544             : void  AliESDCaloCluster::SetClusterMCEdepFraction(UShort_t *array)
     545             : {
     546           0 :   if ( fLabels->GetSize() <= 0 || !array ) return ; 
     547             :   
     548           0 :   fClusterMCEdepFraction = new  UShort_t[fLabels->GetSize()];
     549             :   
     550           0 :   for (Int_t i = 0; i < fLabels->GetSize(); i++) 
     551           0 :     fClusterMCEdepFraction[i] = array[i];
     552           0 : }

Generated by: LCOV version 1.11