commenting unused variable to fix compiler warning
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalPreprocessor.cxx
CommitLineData
a37fc0f5 1// $Id$
2
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: 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// @file AliHLTGlobalPreprocessor.cxx
20// @author Matthias Richter
21// @date 2010-08-20
22// @brief HLT Preprocessor plugin for global HLT
23//
24
25#include "AliHLTGlobalPreprocessor.h"
26#include "AliHLTRootSchemaEvolutionComponent.h"
27#include "AliCDBManager.h"
28#include "AliCDBEntry.h"
29#include "AliGRPObject.h"
30#include "AliCDBMetaData.h"
31#include "AliCDBId.h"
32#include "AliLog.h"
33#include <cassert>
34#include <cerrno>
35
36#include <TObjArray.h>
37#include <TStreamerInfo.h>
38//#include <AliDCSValue.h>
39//#include <TTimeStamp.h>
40
41
42ClassImp(AliHLTGlobalPreprocessor)
43
44AliHLTGlobalPreprocessor::AliHLTGlobalPreprocessor()
45 : AliHLTModulePreprocessor()
46{
47 // constructor
48 // see header file for class documentation
49 // or
50 // refer to README to build package
51 // or
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53}
54
55const char* AliHLTGlobalPreprocessor::fgkStreamerInfoAlias="StreamerInfo";
56const char* AliHLTGlobalPreprocessor::fgkStreamerInfoName="StreamerInfo";
57const char* AliHLTGlobalPreprocessor::fgkStreamerInfoType="Calib";
58
59AliHLTGlobalPreprocessor::~AliHLTGlobalPreprocessor()
60{
61 // destructor
62}
63
64
65void AliHLTGlobalPreprocessor::Initialize(Int_t /*run*/, UInt_t /*startTime*/,
66 UInt_t /*endTime*/)
67{
68 // initializes AliHLTGlobalPreprocessor
69
70}
71
72
73UInt_t AliHLTGlobalPreprocessor::Process(TMap* dcsAliasMap)
74{
75 // processes the DCS value map
76
77 if (!dcsAliasMap) return -EINVAL;
78 if (dcsAliasMap->GetEntries() == 0 ) return 0;
79
80 TObject* streamerinfo=GetFromMap(dcsAliasMap, fgkStreamerInfoAlias);
81 if (streamerinfo) ProcessStreamerInfo(streamerinfo);
82
83 return 0;
84}
85
86Int_t AliHLTGlobalPreprocessor::GetModuleNumber() {
87 Int_t modulenumber = 0;
88 //modulenumber = AliHLTModulePreprocessor::DetectorBitMask("GRP");
89 return modulenumber;
90};
91
92int AliHLTGlobalPreprocessor::ProcessStreamerInfo(TObject* object)
93{
94 /// process the StreamerInfo object
95 int iResult=0;
96 if (!object) return -EINVAL;
97
98 TObjArray* streamerinfos=dynamic_cast<TObjArray*>(object);
99 if (!streamerinfos) {
100 AliError(Form("StreamerInfo object has wrong class type %s, expecting TObjArray", object->ClassName()));
101 return -EINVAL;
102 }
103 if (streamerinfos->GetEntriesFast()==0) return 0;
104
65a5bf08 105 //bool bStore=false;
a37fc0f5 106 AliCDBEntry* entry = GetFromOCDB(fgkStreamerInfoType, fgkStreamerInfoName);
107 TObjArray* clone=NULL;
108 if (entry && entry->GetObject()) {
109 TObject* cloneObj=entry->GetObject()->Clone();
110 if (cloneObj) clone=dynamic_cast<TObjArray*>(cloneObj);
65a5bf08 111 //bStore=AliHLTRootSchemaEvolutionComponent::MergeStreamerInfo(clone, streamerinfos)>0;
a37fc0f5 112 } else {
113 TObject* cloneObj=streamerinfos->Clone();
114 if (cloneObj) clone=dynamic_cast<TObjArray*>(cloneObj);
65a5bf08 115 //bStore=true;
a37fc0f5 116 }
117
118 if (clone) {
119 AliCDBMetaData* metaData=entry?entry->GetMetaData():NULL;
120 AliCDBMetaData* newMetaData=NULL;
121 if (!metaData) {
122 newMetaData=new AliCDBMetaData;
123 if (newMetaData) {
124 metaData=newMetaData;
125 metaData->SetBeamPeriod(0);
126 metaData->SetResponsible("ALICE HLT Matthias.Richter@cern.ch");
127 metaData->SetComment("Streamer info for HLTOUT payload");
128 //metaData->SetAliRootVersion(ALIROOT_SVN_BRANCH);
129 } else {
130 iResult=-ENOMEM;
131 }
132 }
133 Store(fgkStreamerInfoType, fgkStreamerInfoName, clone, metaData, GetRun(), kFALSE);
134 delete clone;
135 if (newMetaData) delete newMetaData;
136 newMetaData=NULL;
137 metaData=NULL;
138 // TODO
139 // - what to do with variable 'entry', to be deleted?
140
141 } else {
142 AliError("failed to clone streamer info object array");
143 return -ENOMEM;
144 }
145
146 return iResult;
147}