LCOV - code coverage report
Current view: top level - HLT/ZDC - AliHLTZDCESDRecoComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 90 10.0 %
Date: 2016-06-14 17:26:59 Functions: 7 17 41.2 %

          Line data    Source code
       1             : //-*- Mode: C++ -*-
       2             : // $Id$
       3             : /**************************************************************************
       4             :  * This file is property of and copyright by the ALICE HLT Project        * 
       5             :  * ALICE Experiment at CERN, All rights reserved.                         *
       6             :  *                                                                        *
       7             :  * Primary Authors: Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>      *
       8             :  *                  for The ALICE HLT Project.                            *
       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             : /** @file    AliHLTZDCESDRecoComponent.cxx
      20             :     @author  Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>
      21             :     @brief   ZDC reconstruction component
      22             : */
      23             : 
      24             : #include "AliHLTErrorGuard.h"
      25             : #include "AliHLTSystem.h"
      26             : #include "AliHLTZDCESDRecoComponent.h"
      27             : #include "AliHLTDefinitions.h"
      28             : #include "AliRawReaderMemory.h"
      29             : #include "AliGeomManager.h"
      30             : #include "AliGRPObject.h"
      31             : #include "AliZDCReconstructor.h"
      32             : #include "AliZDCRecoParam.h"
      33             : #include "AliZDCRecoParampp.h"
      34             : #include "AliZDCRecoParamPbPb.h"
      35             : #include "AliESDEvent.h"
      36             : #include "AliESDZDC.h"
      37             : #include "AliCDBManager.h"
      38             : #include "AliHLTDataTypes.h"
      39             : #include <cstdlib>
      40             : #include <cerrno>
      41             : 
      42             : using namespace std;
      43             : 
      44           6 : ClassImp(AliHLTZDCESDRecoComponent)
      45             :     
      46             : //_____________________________________________________________________
      47             : AliHLTZDCESDRecoComponent::AliHLTZDCESDRecoComponent()
      48           3 :   : AliHLTProcessor(),    
      49           3 :     fRawReader(NULL),
      50           3 :     fReconstructor(NULL)
      51          15 : {
      52           6 : }
      53             : 
      54             : //_____________________________________________________________________
      55             : AliHLTZDCESDRecoComponent::~AliHLTZDCESDRecoComponent()
      56          12 : {
      57             :     // see header file for class documentation
      58          12 : }
      59             : 
      60             : //_____________________________________________________________________
      61             : const char* AliHLTZDCESDRecoComponent::GetComponentID()
      62             : {
      63             :     // see header file for class documentation
      64           6 :     return "ZDCESDReco"; // The ID of this component
      65             : }
      66             : 
      67             : //_____________________________________________________________________
      68             : void AliHLTZDCESDRecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
      69             : {
      70             :     // see header file for class documentation
      71           0 :       list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
      72           0 : }
      73             : 
      74             : //_____________________________________________________________________
      75             : AliHLTComponentDataType AliHLTZDCESDRecoComponent::GetOutputDataType()
      76             : {
      77           0 :       return kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC;
      78             : }
      79             : 
      80             : //_____________________________________________________________________
      81             : void AliHLTZDCESDRecoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
      82             : {
      83             :     // see header file for class documentation
      84           0 :     constBase = 1000;
      85           0 :     inputMultiplier = 0;
      86           0 : }
      87             : 
      88             : //_____________________________________________________________________
      89             : AliHLTComponent* AliHLTZDCESDRecoComponent::Spawn()
      90             : {
      91             :     // see header file for class documentation
      92           0 :     return new AliHLTZDCESDRecoComponent;
      93           0 : }
      94             : 
      95             : //_____________________________________________________________________
      96             : int AliHLTZDCESDRecoComponent::DoInit( int argc, const char** argv )
      97             : {
      98             :   // see header file for class documentation
      99             :   int iResult=0;
     100             : 
     101             :   // -- Load GeomManager
     102           0 :   if(AliGeomManager::GetGeometry()==NULL){
     103           0 :     AliGeomManager::LoadGeometry();
     104           0 :   }
     105             :   
     106             :   // read configuration object : HLT/ConfigZDC/
     107           0 :   TString cdbPath="HLT/ConfigZDC/";
     108           0 :   cdbPath+=GetComponentID();
     109           0 :   iResult=ConfigureFromCDBTObjString(cdbPath);
     110             : 
     111             :   // init stage 3: read the component arguments
     112           0 :   if (iResult>=0) {
     113           0 :     iResult=ConfigureFromArgumentString(argc, argv);
     114           0 :   }
     115             : 
     116             :   // init stage 1: default values for all data members
     117             :   
     118           0 :   TObject* pOCDBEntry = LoadAndExtractOCDBObject("GRP/GRP/Data");
     119           0 :   AliGRPObject* pGRP = pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
     120             :   Float_t  beamEnergy=0.;
     121           0 :   if(pGRP) beamEnergy = pGRP->GetBeamEnergy(); 
     122             : 
     123           0 :   TString beamType="";
     124           0 :   if(pGRP) beamType = pGRP->GetBeamType();
     125             : 
     126             :   //!!! set the beam type and the energy explicitly
     127             : 
     128           0 :   beamType="A-A"; 
     129             :   beamEnergy = 2760.;
     130             : 
     131             :   // implement the component initialization
     132             :   do {
     133           0 :     if (iResult<0) break;
     134             : 
     135           0 :     fReconstructor = new AliZDCReconstructor;
     136           0 :     if (!fReconstructor) {
     137             :       iResult=-ENOMEM;
     138           0 :       break;
     139             :     }
     140             : 
     141           0 :     fRawReader = new AliRawReaderMemory;
     142           0 :     if (!fRawReader) {
     143             :       iResult=-ENOMEM;
     144           0 :       break;
     145             :     }
     146             : 
     147             :     // implement further initialization
     148             :   } while (0);
     149             : 
     150           0 :   if (iResult<0) {
     151             :     // implement cleanup
     152             : 
     153           0 :     if (fRawReader) delete fRawReader;
     154           0 :     fRawReader = NULL;
     155             :     
     156           0 :     if (fReconstructor) delete fReconstructor;
     157           0 :     fReconstructor = NULL;
     158           0 :   }
     159             : 
     160           0 :   if (iResult>=0) {
     161             : 
     162           0 :    if((beamType.CompareTo("p-p"))==0) fReconstructor->SetRecoParam(AliZDCRecoParampp::GetLowFluxParam());
     163           0 :     else if((beamType.CompareTo("A-A"))==0) fReconstructor->SetRecoParam(AliZDCRecoParamPbPb::GetHighFluxParam(beamEnergy));
     164           0 :     else HLTWarning(" Beam type not known by ZDC!");
     165             :   
     166             : 
     167           0 :     fReconstructor->Init(beamType, beamEnergy);
     168           0 :   }
     169             : 
     170             :   return iResult;
     171           0 : }
     172             : 
     173             : //_____________________________________________________________________
     174             : int AliHLTZDCESDRecoComponent::ScanConfigurationArgument(int /*argc*/, const char** argv)
     175             : {
     176             :   // Scan configuration arguments
     177             :   // Return the number of processed arguments
     178             :   //        -EPROTO if argument format error (e.g. number expected but not found)
     179             :   //
     180             :   // The AliHLTComponent base class implements a parsing loop for argument strings and
     181             :   // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
     182             :   // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
     183             : 
     184             :   int i=0;
     185           0 :   TString argument=argv[i];
     186             : 
     187           0 :   if (argument.IsNull()) return 0;
     188             : 
     189             :   return 0;
     190           0 : }
     191             : 
     192             : //_____________________________________________________________________
     193             : int AliHLTZDCESDRecoComponent::DoDeinit()
     194             : {
     195           0 :     if(fRawReader) delete fRawReader;
     196           0 :     fRawReader=NULL;
     197           0 :     if(fReconstructor) delete fReconstructor;
     198           0 :     fReconstructor=NULL;
     199           0 :     return 0;
     200             : }
     201             : 
     202             : //_____________________________________________________________________
     203             : int AliHLTZDCESDRecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
     204             :                                        AliHLTComponentTriggerData& /*trigData*/)
     205             : {
     206             :   // event processing function
     207             :   int iResult=0;
     208             :   
     209             :   // check if this is a data event, there are a couple of special events
     210             :   // which should be ignored for normal processing
     211           0 :   if (!IsDataEvent()) return 0;
     212             :   
     213             :   // get ZDC raw input data block and set up the rawreader
     214           0 :   const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC);
     215           0 :   if (!pBlock) {
     216           0 :     HLTInfo("No ZDC input block at event %d", GetEventCount());
     217           0 :     return 0;
     218             :   }
     219             : 
     220             :   // add input block to raw reader
     221           0 :   if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
     222           0 :     HLTError("Could not add buffer of data block  %s, 0x%08x to rawreader",
     223             :              DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
     224             :     iResult = -1;
     225           0 :   }
     226             :   
     227           0 :   TTree *clusterTree = new TTree();
     228           0 :   if (!clusterTree) {
     229             :     iResult=-ENOMEM;
     230           0 :   }
     231             : 
     232           0 :   if (iResult >= 0) {
     233             : 
     234             :     // set ZDC EquipmentID
     235           0 :     fRawReader->SetEquipmentID(3840);
     236             : 
     237           0 :     fReconstructor->Reconstruct(fRawReader, clusterTree);
     238             : 
     239           0 :     fReconstructor->FillZDCintoESD(clusterTree, (AliESDEvent *) NULL);
     240             : 
     241             :     // send AliESDZDC
     242           0 :     PushBack(static_cast<TObject*>(fReconstructor->GetZDCESDData()), 
     243           0 :              kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC,0);
     244             :    
     245           0 :   }
     246             : 
     247           0 :   delete clusterTree;
     248             : 
     249             :   // clear the rawreader
     250           0 :   fRawReader->ClearBuffers();    
     251             :   
     252             :   return iResult;
     253           0 : }
     254             : 
     255             : 
     256             : //_____________________________________________________________________
     257             : int AliHLTZDCESDRecoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
     258             : {
     259             :   // reconfigure the component from the specified CDB entry, or default CDB entry
     260             :   // function is invoked by the framework if a reconfigure command was received.
     261             :   // 
     262             :   int iResult=0;
     263           0 :   TString cdbPath;
     264           0 :   if (cdbEntry) {
     265           0 :     cdbPath=cdbEntry;
     266             :   } else {
     267           0 :     cdbPath="HLT/ConfigZDC/";
     268           0 :     cdbPath+=GetComponentID();
     269             :   }
     270           0 :   AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
     271           0 :   iResult=ConfigureFromCDBTObjString(cdbPath);
     272             : 
     273             :   return iResult;
     274           0 : }
     275             : 
     276             : 
     277             : //_____________________________________________________________________
     278             : int AliHLTZDCESDRecoComponent::ReadPreprocessorValues(const char* /*modules*/)
     279             : {
     280             :   // see header file for class documentation
     281           0 :   return 0;
     282             : }

Generated by: LCOV version 1.11