3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 // @file AliHLTGlobalPreprocessor.cxx
20 // @author Matthias Richter
22 // @brief HLT Preprocessor plugin for global HLT
25 #include "AliHLTGlobalPreprocessor.h"
26 #include "AliHLTRootSchemaEvolutionComponent.h"
27 #include "AliCDBManager.h"
28 #include "AliCDBEntry.h"
29 #include "AliGRPObject.h"
30 #include "AliCDBMetaData.h"
36 #include <TObjArray.h>
37 #include <TStreamerInfo.h>
38 //#include <AliDCSValue.h>
39 //#include <TTimeStamp.h>
42 ClassImp(AliHLTGlobalPreprocessor)
44 AliHLTGlobalPreprocessor::AliHLTGlobalPreprocessor()
45 : AliHLTModulePreprocessor()
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
55 const char* AliHLTGlobalPreprocessor::fgkStreamerInfoAlias="StreamerInfo";
56 const char* AliHLTGlobalPreprocessor::fgkStreamerInfoName="StreamerInfo";
57 const char* AliHLTGlobalPreprocessor::fgkStreamerInfoType="Calib";
59 AliHLTGlobalPreprocessor::~AliHLTGlobalPreprocessor()
65 void AliHLTGlobalPreprocessor::Initialize(Int_t /*run*/, UInt_t /*startTime*/,
68 // initializes AliHLTGlobalPreprocessor
73 UInt_t AliHLTGlobalPreprocessor::Process(TMap* dcsAliasMap)
75 // processes the DCS value map
77 if (!dcsAliasMap) return -EINVAL;
78 if (dcsAliasMap->GetEntries() == 0 ) return 0;
80 TObject* streamerinfo=GetFromMap(dcsAliasMap, fgkStreamerInfoAlias);
81 if (streamerinfo) ProcessStreamerInfo(streamerinfo);
86 Int_t AliHLTGlobalPreprocessor::GetModuleNumber() {
87 Int_t modulenumber = 0;
88 //modulenumber = AliHLTModulePreprocessor::DetectorBitMask("GRP");
92 int AliHLTGlobalPreprocessor::ProcessStreamerInfo(TObject* object)
94 /// process the StreamerInfo object
96 if (!object) return -EINVAL;
98 TObjArray* streamerinfos=dynamic_cast<TObjArray*>(object);
100 AliError(Form("StreamerInfo object has wrong class type %s, expecting TObjArray", object->ClassName()));
103 if (streamerinfos->GetEntriesFast()==0) return 0;
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);
111 bStore=AliHLTRootSchemaEvolutionComponent::MergeStreamerInfo(clone, streamerinfos)>0;
113 TObject* cloneObj=streamerinfos->Clone();
114 if (cloneObj) clone=dynamic_cast<TObjArray*>(cloneObj);
119 AliCDBMetaData* metaData=entry?entry->GetMetaData():NULL;
120 AliCDBMetaData* newMetaData=NULL;
122 newMetaData=new AliCDBMetaData;
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);
133 Store(fgkStreamerInfoType, fgkStreamerInfoName, clone, metaData, GetRun(), kFALSE);
135 if (newMetaData) delete newMetaData;
139 // - what to do with variable 'entry', to be deleted?
142 AliError("failed to clone streamer info object array");