LCOV - code coverage report
Current view: top level - EMCAL/EMCALrec - AliEMCALPID.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 39 69 56.5 %
Date: 2016-06-14 17:26:59 Functions: 5 7 71.4 %

          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             : // STEER includes
      17             : #include "AliESDEvent.h"
      18             : #include "AliESDCaloCluster.h"
      19             : 
      20             : // EMCAL includes
      21             : #include "AliEMCALReconstructor.h"
      22             : #include "AliEMCALPID.h"
      23             : 
      24             : /// \cond CLASSIMP
      25          42 : ClassImp(AliEMCALPID) ;
      26             : /// \endcond
      27             :  
      28             : ///
      29             : /// Constructor.
      30             : /// Initialize all constant values which have to be used
      31             : /// during PID algorithm execution.
      32             : ///
      33             : //______________________________________________
      34             : AliEMCALPID::AliEMCALPID()
      35          16 : : AliEMCALPIDUtils(), fReconstructor(kTRUE)
      36          40 : {  
      37           8 :   InitParameters(); 
      38          16 : }
      39             : 
      40             : ///
      41             : /// Constructor.
      42             : /// Initialize all constant values which have to be used
      43             : /// during PID algorithm execution called when used in standalone mode. 
      44             : ///
      45             : /// \param reconstructor: bool with reconstruction/analysis mode
      46             : ///
      47             : //______________________________________________
      48             : AliEMCALPID::AliEMCALPID(Bool_t reconstructor)
      49           0 : : AliEMCALPIDUtils(), fReconstructor(reconstructor)
      50           0 : {  
      51           0 :   InitParameters(); 
      52           0 : }
      53             : 
      54             : ///
      55             : /// Make the PID for all the EMCAL clusters containedin the ESDs File
      56             : /// but just gamma/PiO/Hadron.
      57             : ///
      58             : /// Generalize to VEvents? Move to AliEMCALPIDUtils?
      59             : ///
      60             : /// \param esd: pointer to ESD event 
      61             : ///
      62             : //______________________________________________
      63             : void AliEMCALPID::RunPID(AliESDEvent *esd)
      64             : {
      65             :   // Trivial check against NULL object passed.
      66          16 :   if (esd == 0x0) 
      67             :   {
      68           0 :     AliInfo("NULL ESD object passed !!" );
      69           0 :     return ;
      70             :   }
      71             :   
      72           8 :   Int_t nClusters = esd->GetNumberOfCaloClusters();
      73             :   Int_t firstCluster = 0;
      74             :   Double_t energy=0., lambda0=0.;
      75             :   
      76         102 :   for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) 
      77             :   {
      78          43 :     AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster);
      79          53 :     if (!clust->IsEMCAL()) continue ; 
      80             :     
      81          33 :     energy = clust->E();
      82          33 :     lambda0 = clust->GetM02();
      83             :     
      84          33 :     if (lambda0 != 0  && energy < 1000) 
      85             :     {
      86             :       // reject clusters with lambda0 = 0
      87             :       
      88          15 :       ComputePID(energy, lambda0);
      89             :       
      90          15 :       if ( fPrintInfo ) 
      91             :       {
      92           0 :         AliInfo("___________________________________________________");
      93           0 :         AliInfo(Form( "Particle Energy = %f",energy));
      94           0 :         AliInfo(Form( "Particle Lambda0 of the particle = %f", lambda0) );
      95           0 :         AliInfo("PIDWeight of the particle :" );
      96           0 :         AliInfo(Form( " GAMMA  : %f",fPID[0] ));
      97           0 :         AliInfo(Form( " PiZero : %f",fPID[1] ));
      98           0 :         AliInfo(Form( " HADRON : %f", fPID[2] ));
      99           0 :         AliInfo("_________________________________________");
     100           0 :         AliInfo(Form( " kElectron : %f", fPIDFinal[0]) );
     101           0 :         AliInfo(Form( " kMuon     : %f", fPIDFinal[1] ));
     102           0 :         AliInfo(Form( " kPion          : %f", fPIDFinal[2] ));
     103           0 :         AliInfo(Form( " kKaon          : %f", fPIDFinal[3] ));
     104           0 :         AliInfo(Form( " kProton   : %f", fPIDFinal[4] ));
     105           0 :         AliInfo(Form( " kPhoton   : %f", fPIDFinal[5] ));
     106           0 :         AliInfo(Form( " kPi0           : %f", fPIDFinal[6] ));
     107           0 :         AliInfo(Form( " kNeutron  : %f", fPIDFinal[7] ));
     108           0 :         AliInfo(Form( " kKaon0     : %f", fPIDFinal[8] ));
     109           0 :         AliInfo(Form( " kEleCon   : %f", fPIDFinal[9] ));
     110           0 :         AliInfo(Form( " kUnknown  : %f", fPIDFinal[10] ));
     111           0 :         AliInfo("___________________________________________________");
     112           0 :       }
     113             :       
     114          15 :       if ( fReconstructor )
     115             :       { // In case it is called during reconstruction.
     116             :         //      cout << "############# Fill ESDs with PIDWeight ##########" << endl;
     117          15 :         clust->SetPID(fPIDFinal);
     118          15 :       }
     119             :       
     120             :     } // end if (lambda0 != 0  && energy < 1000)
     121          33 :   } // end for (iCluster...)
     122          16 : }
     123             : 
     124             : ///
     125             : /// Initialize PID parameters, depending on the use or not of the reconstructor
     126             : /// and the kind of event type if the reconstructor is not used.
     127             : ///
     128             : //______________________________________________
     129             : void AliEMCALPID::InitParameters()
     130             : {
     131             :   //  fWeightHadronEnergy=0.;
     132             :   //  fWeightPiZeroEnergy=0.;
     133             :   //  fWeightGammaEnergy=0.;
     134             :   
     135          16 :   fPIDWeight[0] = -1;
     136           8 :   fPIDWeight[1] = -1;
     137           8 :   fPIDWeight[2] = -1;
     138             :   
     139         256 :   for(Int_t i=0; i<AliPID::kSPECIESCN+1; i++)
     140         120 :     fPIDFinal[i]= 0;
     141             :   
     142           8 :   const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
     143             :   
     144           8 :   if(fReconstructor)
     145             :   {
     146           8 :     if(!recParam) 
     147             :     {
     148           0 :       AliFatal("Reconstruction parameters for EMCAL not set!");
     149           0 :     }
     150             :     else 
     151             :     {
     152         112 :       for(Int_t i=0; i<6; i++)
     153             :       {
     154         672 :         for(Int_t j=0; j<6; j++)
     155             :         {
     156         288 :           fGamma[i][j]       = recParam->GetGamma(i,j);
     157         288 :           fGamma1to10[i][j]  = recParam->GetGamma1to10(i,j);
     158         288 :           fHadron[i][j]      = recParam->GetHadron(i,j);
     159         288 :           fHadron1to10[i][j] = recParam->GetHadron1to10(i,j);
     160         288 :           fPiZero[i][j]      = recParam->GetPiZero(i,j);
     161             :           
     162             :           
     163             :           //    AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
     164             :           //                    i,j, fGamma[i][j],fPiZero[i][j],fHadron[i][j] ));
     165             :           //    cout << "PID parameters (" << i << " ,"<<j<<") fGamma= "<<  fGamma[i][j]<<" fPi0 ="<<  fPiZero[i][j]<< endl;
     166             :           
     167             :         } // end loop j
     168             :         
     169          48 :         fHadronEnergyProb[i] = recParam->GetHadronEnergyProb(i);
     170          48 :         fPiZeroEnergyProb[i] = recParam->GetPiZeroEnergyProb(i);
     171          48 :         fGammaEnergyProb[i]  = recParam->GetGammaEnergyProb(i);
     172             :       } //end loop i
     173             :       
     174             :     } // end if !recparam 
     175             :     
     176             :   } 
     177             :   
     178             :   else
     179             :   {
     180             :     //   init the parameters here instead of from loading from recparam
     181             :     //   default parameters are PbPb parameters.
     182           0 :     SetHighFluxParam();
     183             :   }
     184             :   
     185           8 : }
     186             : 

Generated by: LCOV version 1.11