LCOV - code coverage report
Current view: top level - HLT/VZERO - AliHLTVZERORecoComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 152 6.6 %
Date: 2016-06-14 17:26:59 Functions: 7 19 36.8 %

          Line data    Source code
       1             : // $Id$
       2             : /**************************************************************************
       3             :  * This file is property of and copyright by the ALICE HLT Project        * 
       4             :  * ALICE Experiment at CERN, All rights reserved.                         *
       5             :  *                                                                        *
       6             :  * Primary Authors: Jochen Thaeder <jochen@thaeder.de>                    *
       7             :  *                  for The ALICE HLT Project.                            *
       8             :  *                                                                        *
       9             :  * Permission to use, copy, modify and distribute this software and its   *
      10             :  * documentation strictly for non-commercial purposes is hereby granted   *
      11             :  * without fee, provided that the above copyright notice appears in all   *
      12             :  * copies and that both the copyright notice and this permission notice   *
      13             :  * appear in the supporting documentation. The authors make no claims     *
      14             :  * about the suitability of this software for any purpose. It is          *
      15             :  * provided "as is" without express or implied warranty.                  *
      16             :  **************************************************************************/
      17             : 
      18             : /** @file    AliHLTVZERORecoComponent.cxx
      19             :     @author  Jochen Thaeder <jochen@thaeder.de>
      20             :     @brief   VZERO reconstruction component
      21             : */
      22             : 
      23             : #include "TTree.h"
      24             : #include "TMap.h"
      25             : #include "TObjString.h"
      26             : #include "TDatime.h"
      27             : 
      28             : #include "AliLog.h"
      29             : #include "AliRunInfo.h"
      30             : #include "AliGRPObject.h"
      31             : #include "AliRawReaderMemory.h"
      32             : #include "AliGeomManager.h"
      33             : 
      34             : #include "AliVZERORecoParam.h"
      35             : #include "AliVZEROReconstructor.h"
      36             : 
      37             : #include "AliHLTErrorGuard.h"
      38             : #include "AliHLTDataTypes.h"
      39             : #include "AliHLTVZERORecoComponent.h"
      40             : 
      41             : #include "AliESDVZEROfriend.h"
      42             : 
      43             : using namespace std;
      44             : 
      45             : /** ROOT macro for the implementation of ROOT specific class methods */
      46           6 : ClassImp(AliHLTVZERORecoComponent)
      47             : 
      48             : /*
      49             :  * ---------------------------------------------------------------------------------
      50             :  *                            Constructor / Destructor
      51             :  * ---------------------------------------------------------------------------------
      52             :  */
      53             : 
      54             : // #################################################################################
      55             : AliHLTVZERORecoComponent::AliHLTVZERORecoComponent() :
      56           3 :   AliHLTProcessor(),
      57           3 :   fRunInfo(NULL),  
      58           3 :   fVZERORecoParam(NULL),
      59           3 :   fVZEROReconstructor(NULL),
      60          18 :   fRawReader(NULL) {
      61             :   // an example component which implements the ALICE HLT processor
      62             :   // interface and does some analysis on the input raw data
      63             :   //
      64             :   // see header file for class documentation
      65             :   // or
      66             :   // refer to README to build package
      67             :   // or
      68             :   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      69             :   //
      70             :   // NOTE: all helper classes should be instantiated in DoInit()
      71           6 : }
      72             : 
      73             : // #################################################################################
      74          12 : AliHLTVZERORecoComponent::~AliHLTVZERORecoComponent() {
      75             :   // see header file for class documentation
      76          12 : }
      77             : 
      78             : /*
      79             :  * ---------------------------------------------------------------------------------
      80             :  * Public functions to implement AliHLTComponent's interface.
      81             :  * These functions are required for the registration process
      82             :  * ---------------------------------------------------------------------------------
      83             :  */
      84             : 
      85             : // #################################################################################
      86             : const Char_t* AliHLTVZERORecoComponent::GetComponentID() { 
      87             :   // see header file for class documentation
      88          12 :   return "VZEROReconstruction";
      89             : }
      90             : 
      91             : // #################################################################################
      92             : void AliHLTVZERORecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
      93             :   // see header file for class documentation
      94           0 :   list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
      95           0 : }
      96             : 
      97             : // #################################################################################
      98             : AliHLTComponentDataType AliHLTVZERORecoComponent::GetOutputDataType() 
      99             : {
     100             :   // see header file for class documentation
     101           0 :   return kAliHLTMultipleDataType;
     102             : }
     103             : 
     104             : int AliHLTVZERORecoComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
     105             : { 
     106             :   // see header file for class documentation
     107           0 :   tgtList.clear();
     108           0 :   tgtList.push_back( kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
     109           0 :   tgtList.push_back( kAliHLTDataTypeESDFriendContent|kAliHLTDataOriginVZERO);
     110           0 :   return tgtList.size();
     111             : }
     112             : 
     113             : // #################################################################################
     114             : void AliHLTVZERORecoComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
     115             :   // see header file for class documentation
     116           0 :   constBase = 3000;
     117           0 :   inputMultiplier = 0.7;
     118           0 : }
     119             : 
     120             : // #################################################################################
     121             : void AliHLTVZERORecoComponent::GetOCDBObjectDescription( TMap* const targetMap) {
     122             :   // see header file for class documentation
     123             : 
     124           0 :   if (!targetMap) return;
     125           0 :   targetMap->Add(new TObjString("HLT/ConfigVZERO/VZEROReconstruction"),
     126           0 :                  new TObjString("configuration object"));
     127             : 
     128           0 :   targetMap->Add(new TObjString("GRP/GRP/Data"),
     129           0 :                  new TObjString("GRP object - run information"));
     130           0 :   targetMap->Add(new TObjString("GRP/CTP/CTPtiming"),
     131           0 :                  new TObjString("GRP object - CTP information"));
     132           0 :   targetMap->Add(new TObjString("GRP/CTP/TimeAlign"),
     133           0 :                  new TObjString("GRP object - CTP information"));
     134           0 :   targetMap->Add(new TObjString("GRP/Calib/LHCClockPhase"),
     135           0 :                  new TObjString("GRP object - time calibration"));
     136             : 
     137           0 :   targetMap->Add(new TObjString("VZERO/Calib/Data"),
     138           0 :                  new TObjString("VZERO calibration object"));
     139           0 :   targetMap->Add(new TObjString("VZERO/Calib/TimeDelays"),
     140           0 :                  new TObjString("VZERO calibration object"));
     141           0 :   targetMap->Add(new TObjString("VZERO/Calib/TimeSlewing"),
     142           0 :                  new TObjString("VZERO calibration object"));
     143           0 :   targetMap->Add(new TObjString("VZERO/Trigger/Data"),
     144           0 :                  new TObjString("VZERO calibration object"));
     145             : 
     146           0 :   return;
     147           0 : }
     148             : 
     149             : // #################################################################################
     150             : AliHLTComponent* AliHLTVZERORecoComponent::Spawn() {
     151             :   // see header file for class documentation
     152           0 :   return new AliHLTVZERORecoComponent;
     153           0 : }
     154             : 
     155             : /*
     156             :  * ---------------------------------------------------------------------------------
     157             :  * Protected functions to implement AliHLTComponent's interface.
     158             :  * These functions provide initialization as well as the actual processing
     159             :  * capabilities of the component. 
     160             :  * ---------------------------------------------------------------------------------
     161             :  */
     162             : 
     163             : // #################################################################################
     164             : Int_t AliHLTVZERORecoComponent::DoInit( Int_t argc, const Char_t** argv ) {
     165             :   // see header file for class documentation
     166             :   //cout<<"\n\n\nVZero Reconstruction Init\n\n\n"<<endl;
     167             :  
     168             :   Int_t iResult=0;
     169             : 
     170             :   // -- Load GeomManager
     171           0 :   if(AliGeomManager::GetGeometry()==NULL){
     172           0 :     AliGeomManager::LoadGeometry();
     173           0 :   }
     174             :   
     175             :   // -- Read configuration object : HLT/ConfigVZERO/VZEROReconstruction
     176           0 :   TString cdbPath="HLT/ConfigVZERO/";
     177           0 :   cdbPath+=GetComponentID();
     178           0 :   iResult=ConfigureFromCDBTObjString(cdbPath);
     179             : 
     180             :   // -- Read the component arguments
     181           0 :   if (iResult>=0) {
     182           0 :     iResult=ConfigureFromArgumentString(argc, argv);
     183           0 :   }
     184             : 
     185             :   // -- Get AliRunInfo variables
     186             :   // -----------------------------
     187           0 :   TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
     188           0 :   AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
     189             :   
     190           0 :   TString beamType = "";
     191           0 :   TString lhcState = "";
     192           0 :   TString runType = "";
     193             :   Float_t beamEnergy = 0.;
     194             :   UInt_t activeDetectors = 0;
     195             :   
     196           0 :   if (pGRP) {
     197           0 :     lhcState        = pGRP->GetLHCState();              
     198           0 :     beamType        = pGRP->GetBeamType(); 
     199           0 :     runType         = pGRP->GetRunType(); 
     200           0 :     beamEnergy      = pGRP->GetBeamEnergy();
     201           0 :     activeDetectors = pGRP->GetDetectorMask();
     202           0 :   }
     203             :   
     204             :   // -- Initialize members
     205             :   // -----------------------
     206             :   do {
     207           0 :     if (iResult<0) break;
     208             : 
     209           0 :     fRawReader = new AliRawReaderMemory;
     210           0 :     if (!fRawReader) {
     211             :       iResult=-ENOMEM;
     212           0 :       break;
     213             :     }
     214             : 
     215             :     // AliGRPManager grpMan;
     216             :     // Bool_t status       = grpMan.ReadGRPEntry(); // Read the corresponding OCDB entry
     217             :     // status              = grpMan.SetMagField();  // Set global field instanton
     218             :     // AliRunInfo *runInfo = grpMan.GetRunInfo();   // Get instance of run info
     219             : 
     220           0 :     fRunInfo = new AliRunInfo(lhcState.Data(), beamType.Data(),
     221           0 :                               beamEnergy, runType.Data(), activeDetectors);
     222           0 :     if (!fRunInfo) {
     223             :       iResult=-ENOMEM;
     224           0 :       break;
     225             :     }
     226             : 
     227           0 :     fVZERORecoParam = new AliVZERORecoParam;
     228           0 :     if (!fVZERORecoParam) {
     229             :       iResult=-ENOMEM;
     230           0 :       break;
     231             :     }  
     232             : 
     233           0 :     fVZEROReconstructor = new AliVZEROReconstructor;
     234           0 :     if (!fVZEROReconstructor) {
     235             :       iResult=-ENOMEM;
     236           0 :       break;
     237             :     }
     238             : 
     239             :     // implement further initialization
     240             :   } while (0);
     241             : 
     242           0 :   if (iResult<0) {
     243             :     // implement cleanup
     244             : 
     245           0 :     if (fRawReader) 
     246           0 :       delete fRawReader;
     247           0 :     fRawReader = NULL;
     248             : 
     249           0 :     if (fVZERORecoParam)
     250           0 :       delete fVZERORecoParam;
     251           0 :     fVZERORecoParam = NULL;
     252             : 
     253           0 :     if (fVZEROReconstructor)
     254           0 :       delete fVZEROReconstructor;
     255           0 :     fVZEROReconstructor = NULL;
     256             : 
     257           0 :     if (fRunInfo)
     258           0 :       delete fRunInfo;
     259           0 :     fRunInfo = NULL;
     260           0 :   }
     261             : 
     262           0 :   if (iResult>=0) {
     263           0 :     fVZEROReconstructor->SetRunInfo(fRunInfo);
     264           0 :     fVZEROReconstructor->Init();
     265             : 
     266           0 :     fVZEROReconstructor->SetRecoParam(fVZERORecoParam);
     267             :   }
     268             : 
     269             :   return iResult;
     270           0 : }
     271             : 
     272             : // #################################################################################
     273             : Int_t AliHLTVZERORecoComponent::ScanConfigurationArgument(Int_t /*argc*/, const Char_t** argv) {
     274             :   // Scan configuration arguments
     275             :   // Return the number of processed arguments
     276             :   //        -EPROTO if argument format error (e.g. number expected but not found)
     277             :   //
     278             :   // The AliHLTComponent base class implements a parsing loop for argument strings and
     279             :   // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
     280             :   // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
     281             : 
     282             :   Int_t ii =0;
     283           0 :   TString argument=argv[ii];
     284             : 
     285           0 :   if (argument.IsNull()) return 0;
     286             : 
     287             :   return 0;
     288           0 : }
     289             : 
     290             : // #################################################################################
     291             : Int_t AliHLTVZERORecoComponent::DoDeinit() {
     292             :   // see header file for class documentation
     293             : 
     294           0 :   if (fRawReader) 
     295           0 :     delete fRawReader;
     296           0 :   fRawReader = NULL;
     297             :   
     298           0 :   if (fVZERORecoParam)
     299           0 :     delete fVZERORecoParam;
     300           0 :   fVZERORecoParam = NULL;
     301             :   
     302           0 :   if (fVZEROReconstructor)
     303           0 :     delete fVZEROReconstructor;
     304           0 :   fVZEROReconstructor = NULL;
     305             :   
     306           0 :   if (fRunInfo)
     307           0 :     delete fRunInfo;
     308           0 :   fRunInfo = NULL;
     309             :   
     310           0 :   return 0;
     311             : }
     312             : 
     313             : // #################################################################################
     314             : Int_t AliHLTVZERORecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
     315             :                                         AliHLTComponentTriggerData& /*trigData*/) {
     316             :   // see header file for class documentation
     317             :   Int_t iResult=0;
     318             : 
     319             :   // -- Only use data event
     320           0 :   if (!IsDataEvent()) 
     321           0 :     return 0;
     322             :  
     323             :   //cout<<"\n\n\nVZero Reconstruction Do Event\n\n\n"<<endl;
     324             : 
     325             :   // -- Get VZERO raw dat a input block and set up the rawreader
     326           0 :   const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO);
     327           0 :   if (!pBlock) {
     328             :     //cout<<"No VZERO input block at event"<<endl;
     329           0 :     HLTInfo("No VZERO input block at event %d", GetEventCount());
     330           0 :     return 0;
     331             :   }
     332             :   
     333             :   //cout<<"VZERO input block found"<<endl;
     334             :  
     335             :   // -- Add input block to raw reader
     336           0 :   if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){
     337           0 :     cout<<"Could not add buffer of data block to rawreader"<<endl;
     338           0 :     HLTError("Could not add buffer of data block  %s, 0x%08x to rawreader",
     339             :              DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
     340             :     iResult = -1;
     341           0 :   }
     342             :   
     343           0 :   TTree *digitsTree = new TTree("D", "Digits Tree");
     344           0 :   if (!digitsTree) {
     345           0 :     cout<<"No digit tree created"<<endl;
     346             :     iResult=-ENOMEM;
     347           0 :   }
     348             : 
     349           0 :   if (iResult >= 0) {
     350             :     //cout<<"ok 1"<<endl;
     351             :     // -- Set VZERO EquipmentID
     352           0 :     fRawReader->SetEquipmentID(3584);
     353             :   
     354             :     // -- 1. step VZERO reconstruction
     355           0 :     fVZEROReconstructor->ConvertDigits(fRawReader, digitsTree);
     356             : 
     357             :     // -- 2. step VZERO reconstruction -- fill AliESDVZERO object
     358           0 :     fVZEROReconstructor->FillESD(digitsTree, NULL, NULL);
     359             : 
     360           0 :     AliESDVZERO *esdVZERO = fVZEROReconstructor->GetESDVZERO();
     361           0 :     AliESDVZEROfriend *esdVZEROfriend = fVZEROReconstructor->GetESDVZEROfriend();
     362             :    
     363             :     // Send info every 10 s
     364           0 :     const TDatime time;    
     365             :     static UInt_t lastTime=0;
     366           0 :     if (time.Get()-lastTime>10) {
     367           0 :       lastTime=time.Get();
     368           0 :       HLTInfo("VZERO Multiplicity A %f - C %f", esdVZERO->GetMTotV0A(), esdVZERO->GetMTotV0A() );
     369             :     }
     370             : 
     371             :     // -- Send AliESDVZERO & friend object
     372           0 :     PushBack(esdVZERO, kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO,0);
     373           0 :     PushBack( esdVZEROfriend, kAliHLTDataTypeESDFriendContent|kAliHLTDataOriginVZERO,0);
     374           0 :   }
     375             :   
     376             :   // -- Clean up
     377           0 :   delete digitsTree;
     378           0 :   fRawReader->ClearBuffers();   
     379             : 
     380             :   return iResult;
     381           0 : }
     382             : 
     383             : // #################################################################################
     384             : Int_t AliHLTVZERORecoComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
     385             :   // see header file for class documentation
     386             : 
     387             :   Int_t iResult=0;
     388           0 :   TString cdbPath;
     389           0 :   if (cdbEntry) {
     390           0 :     cdbPath=cdbEntry;
     391             :   } else {
     392           0 :     cdbPath="HLT/ConfigVZERO/";
     393           0 :     cdbPath+=GetComponentID();
     394             :   }
     395             : 
     396           0 :   AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
     397           0 :   iResult=ConfigureFromCDBTObjString(cdbPath);
     398             : 
     399             :   return iResult;
     400           0 : }
     401             : 
     402             : // #################################################################################
     403             : Int_t AliHLTVZERORecoComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
     404             :   // see header file for class documentation
     405           0 :   return 0;
     406             : }

Generated by: LCOV version 1.11