LCOV - code coverage report
Current view: top level - HLT/shuttle - AliHLTPreprocessor.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 66 1.5 %
Date: 2016-06-14 17:26:59 Functions: 1 10 10.0 %

          Line data    Source code
       1             : // $Id: AliHLTPreprocessor.cxx 23039 2007-12-13 20:53:02Z richterm $
       2             : 
       3             : //**************************************************************************
       4             : //* This file is property of and copyright by the                          *
       5             : //* ALICE Experiment at CERN, All rights reserved.                         *
       6             : //*                                                                        *
       7             : //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
       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             : 
      20             : // @file   AliHLTPreprocessor.cxx
      21             : // @author Matthias Richter
      22             : // @brief  Container for HLT module preprocessors, acts to the outside as
      23             : //         HLT preprocessor used by the Offline Shuttle 
      24             : // 
      25             : 
      26             : #include "AliHLTPreprocessor.h"
      27             : #include "AliHLTModulePreprocessor.h"
      28             : #include "AliHLTSystem.h"
      29             : #include "AliHLTModuleAgent.h"
      30             : #include "TSystem.h"
      31             : 
      32          12 : ClassImp(AliHLTPreprocessor)
      33             : 
      34           0 : AliHLTPreprocessor::AliHLTPreprocessor(AliShuttleInterface* shuttle) 
      35             :   :
      36           0 :   AliPreprocessor(fgkHLTPreproc, shuttle),
      37           0 :   fProcessors(),
      38           0 :   fActiveDetectors(0)
      39           0 : {
      40             :   // Implementation of the HLT version for the Shuttle Preprocessor.
      41             :   // Since HLT requires a more modular concept of the pre-processors, this
      42             :   // class acts as HLT pre-processor to the outside and container class for
      43             :   // the specific HLT module pre-processors to the inside.
      44             : 
      45             :   // run types according to 
      46             :   // http://alice-ecs.web.cern.ch/alice-ecs/runtypes_3.16.html
      47             : 
      48             :   // PHOS (retrieve Huffman tables)
      49           0 :   AddRunType("STANDALONE");
      50             : 
      51             :   // TPC (retrieve Huffman tables and temperature data)
      52           0 :   AddRunType("PHYSICS");
      53           0 :   AddRunType("COSMIC");
      54           0 :   AddRunType("LASER");
      55           0 :   AddRunType("PEDESTAL");
      56           0 :   AddRunType("PULSER");
      57             : 
      58             :   // TRD
      59           0 :   AddRunType("PEDESTAL");
      60           0 :   AddRunType("STANDALONE");
      61             :  
      62           0 :   fProcessors.SetOwner();
      63             : 
      64           0 : }
      65             : 
      66             : const char* AliHLTPreprocessor::fgkHLTPreproc = "HLT";
      67             : 
      68             : /** HLT default component libraries */
      69             : const char* AliHLTPreprocessor::fgkHLTDefaultShuttleLibs[]= {
      70             :   "libAliHLTUtil.so", 
      71             :   "libAliHLTRCU.so", 
      72             :   "libAliHLTTPC.so", 
      73             :   "libAliHLTComp.so", 
      74             :   //"libAliHLTPHOS.so",
      75             :   //"libAliHLTMUON.so",
      76             :   "libAliHLTTRD.so",
      77             :   "libAliHLTGlobal.so",
      78             :   "libAliHLTTrigger.so",
      79             :   NULL
      80             : };
      81             : 
      82           0 : AliHLTPreprocessor::~AliHLTPreprocessor()
      83           0 : {
      84             :   // destructor
      85           0 : }
      86             : 
      87             : void AliHLTPreprocessor::Initialize(Int_t run, UInt_t startTime, 
      88             :                         UInt_t endTime) 
      89             : {
      90             :   // init the preprocessor
      91           0 :   fRun = run;
      92           0 :   fStartTime = startTime;
      93           0 :   fEndTime = endTime;
      94             : 
      95             :   // TODO: read a configuration object from OCDB
      96             :   // configure
      97             :   // - component libraries
      98             : 
      99             :   // retrieve list of active detectors from previous run.
     100           0 :   fActiveDetectors = atoi(AliPreprocessor::GetRunParameter("detectorMask"));
     101             : 
     102             :   //   TString msg("Preprocessor for HLT initialized for run: ");
     103             :   //   msg += run;
     104             :   //   Log(msg.Data());
     105             :   
     106             :   // load component libraries
     107           0 :   TString libs;
     108             :   const char** deflib=fgkHLTDefaultShuttleLibs;
     109           0 :   while (*deflib) {
     110           0 :     if (gSystem->Load(*deflib)==0) {
     111           0 :       Log(Form("HLT component library %s loaded", *deflib));
     112             :     }
     113             :     
     114           0 :     deflib++;
     115             :   }
     116             : 
     117           0 :   for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
     118           0 :        pAgent!=NULL;
     119           0 :        pAgent=AliHLTModuleAgent::GetNextAgent()) {
     120           0 :     AliHLTModulePreprocessor* pProc=pAgent->GetPreprocessor();
     121           0 :     if (pProc) 
     122             :       {
     123             : 
     124             :         // filter preprocessors according to active detector pattern
     125             :         // don't filter if module returns 0 (i.e. always active)
     126           0 :         int moduleNo=pProc->GetModuleNumber();
     127           0 :         if(moduleNo>0 && (moduleNo & fActiveDetectors) == 0)
     128             :           {
     129           0 :             TString msg;
     130           0 :             msg.Form("preprocessor module %s inactive", pProc->GetModuleID());
     131           0 :             Log(msg.Data());
     132             :             continue;
     133           0 :           }
     134             :         
     135           0 :         pProc->SetShuttleInterface(this);
     136           0 :         pProc->Initialize(run, startTime, endTime);
     137           0 :         fProcessors.Add(pProc);
     138           0 :         TString msg;
     139           0 :         msg.Form("added preprocessor %p with ID %s for module %p", pProc, pProc->GetModuleID(), pAgent);
     140           0 :         Log(msg.Data());
     141           0 :       }
     142           0 :   }
     143           0 : }
     144             : 
     145             : UInt_t AliHLTPreprocessor::Process(TMap* dcsAliasMap)
     146             : {
     147             :   // process map of objects
     148             :   UInt_t retVal = 0;
     149             : 
     150           0 :   if (!GetHLTStatus()) {
     151           0 :     return 0;
     152             :   }
     153             : 
     154           0 :   bool bAllFailed=fProcessors.GetEntries()>0;
     155             :   TObjLink *lnk = NULL;
     156           0 :   lnk=fProcessors.FirstLink();
     157           0 :   while (lnk) {
     158           0 :     AliHLTModulePreprocessor* pProc=dynamic_cast<AliHLTModulePreprocessor*>(lnk->GetObject());
     159           0 :     if (pProc) {
     160           0 :       UInt_t result=pProc->Process(dcsAliasMap);
     161           0 :       if (result) {
     162           0 :         TString msg;
     163           0 :         msg.Form("preprocessor for module %s failed with error code %d", pProc->GetName(), result);
     164           0 :         Log(msg.Data());
     165           0 :       } else {
     166             :         bAllFailed=false;
     167             :       }
     168           0 :     }
     169           0 :     lnk = lnk->Next();
     170             :   }
     171             : 
     172             :   // error if all preprocessors failed
     173           0 :   if (bAllFailed) return 1;
     174           0 :   return retVal;
     175           0 : }

Generated by: LCOV version 1.11