LCOV - code coverage report
Current view: top level - HLT/BASE/util - AliHLTESDCaloClusterMaker.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 44 2.3 %
Date: 2016-06-14 17:26:59 Functions: 1 7 14.3 %

          Line data    Source code
       1             : //-*- Mode: C++ -*-
       2             : // $Id$
       3             : 
       4             : /**************************************************************************
       5             :  * This file is property of and copyright by the ALICE HLT Project        * 
       6             :  * All rights reserved.                                                   *
       7             :  *                                                                        *
       8             :  * Primary Authors: Oystein Djuvsland                                     *
       9             :  *                                                                        *
      10             :  * Permission to use, copy, modify and distribute this software and its   *
      11             :  * documentation strictly for non-commercial purposes is hereby granted   *
      12             :  * without fee, provided that the above copyright notice appears in all   *
      13             :  * copies and that both the copyright notice and this permission notice   *
      14             :  * appear in the supporting documentation. The authors make no claims     *
      15             :  * about the suitability of this software for any purpose. It is          * 
      16             :  * provided "as is" without express or implied warranty.                  *
      17             :  **************************************************************************/
      18             : 
      19             : 
      20             : /** 
      21             :  * @file   AliHLTESDCaloClusterMaker.cxx
      22             :  * @author Oystein Djuvsland
      23             :  * @date 
      24             :  * @brief  ESD Calo Cluster maker for  HLT 
      25             :  */
      26             : 
      27             : // see header file for class documentation
      28             : // or
      29             : // refer to README to build package
      30             : // or 
      31             : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      32             : 
      33             : #include "AliESDEvent.h"
      34             : #include "AliHLTESDCaloClusterMaker.h"
      35             : #include "AliHLTCaloClusterDataStruct.h"
      36             : #include "AliHLTCaloClusterReader.h"
      37             : #include "AliESDCaloCluster.h"
      38             : #include <iostream>
      39             : 
      40           8 : ClassImp(AliHLTESDCaloClusterMaker);
      41             : 
      42             : AliHLTESDCaloClusterMaker::AliHLTESDCaloClusterMaker() : 
      43           0 :   fClusterReaderPtr(0)
      44           0 : {
      45             :   //See header file for documentation
      46           0 :   fClusterReaderPtr = new AliHLTCaloClusterReader();
      47             : 
      48           0 : }
      49             : 
      50             : AliHLTESDCaloClusterMaker::~AliHLTESDCaloClusterMaker()
      51           0 : {
      52             :   //See header file for documentation
      53           0 :   delete fClusterReaderPtr;
      54           0 : }
      55             : 
      56             : Int_t 
      57             : AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr)
      58             : {
      59             :   // See header file for documentation
      60             : 
      61             :   AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
      62             : 
      63           0 :   fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
      64             : 
      65             :   Int_t nClusters = 0;
      66             : 
      67           0 :   while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
      68             :     {
      69           0 :       AliESDCaloCluster esdCluster;
      70             : 
      71           0 :       esdCluster.SetID(caloClusterStructPtr->fID);
      72           0 :       esdCluster.SetType(caloClusterStructPtr->fClusterType);
      73           0 :       esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos));
      74           0 :       esdCluster.SetE(caloClusterStructPtr->fEnergy);
      75           0 :       esdCluster.SetTOF(caloClusterStructPtr->fTOF);
      76           0 :       esdCluster.SetDispersion(caloClusterStructPtr->fDispersion);
      77           0 :       esdCluster.SetChi2(caloClusterStructPtr->fFitQuality);
      78           0 :       const Float_t *pid = caloClusterStructPtr->fPID;
      79           0 :       esdCluster.SetPID(pid);
      80           0 :       esdCluster.SetM20(caloClusterStructPtr->fM20);
      81           0 :       esdCluster.SetM02(caloClusterStructPtr->fM02);
      82           0 :       esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
      83           0 :       esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
      84           0 :       esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
      85           0 :       esdCluster.SetNCells(caloClusterStructPtr->fNCells);
      86             :       //esdCluster.SetNCells(0);
      87           0 :       if(caloClusterStructPtr->GetNTracksMatched())
      88             :       {
      89           0 :          TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched);
      90           0 :          esdCluster.AddTracksMatched(tracksMatched);
      91           0 :       }
      92           0 :       UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
      93           0 :      Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
      94             :       
      95           0 :       for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
      96             :         {
      97           0 :             fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
      98             :             //printf("EM: cellId: %d\n", idArrayPtr[index]);;
      99             :         }
     100           0 :       esdCluster.SetCellsAbsId(idArrayPtr);
     101           0 :       esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
     102             : #ifndef HAVE_NOT_ALIESDCALOCLUSTER_r38477
     103             :       // this is to ensure compilation with the v4-18-Release branch for the moment
     104             :       // until the changes of AliESDCaloCluster have been ported
     105           0 :       esdCluster.SetTrackDistance(caloClusterStructPtr->fTrackDx, caloClusterStructPtr->fTrackDz);
     106             : #endif //HAVE_NOT_ALIESDCALOCLUSTER_r38477
     107             :    
     108           0 :       delete [] idArrayPtr;
     109           0 :       delete [] ampFracArrayPtr;
     110             : //      idArrayPtr = 0;
     111             :       //ampFracArrayPtr = 0;
     112             :       
     113           0 :       esdPtr->AddCaloCluster(&esdCluster);
     114             :       //printf("EM: Energy: %f\n", esdCluster.E());
     115           0 :       nClusters++;
     116           0 :     }
     117           0 :   return nClusters;
     118           0 : }

Generated by: LCOV version 1.11