]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/SampleLib/AliHLTSamplePreprocessor.cxx
Removing leftover return
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTSamplePreprocessor.cxx
1 // $Id: AliHLTSamplePreprocessor.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: Sebastian Bablok <Sebastian.Bablok@ift.uib.no>        *
8  *                  Kenneth Aamodt                                        *
9  *                  for The ALICE HLT Project.                            *
10  *                                                                        *
11  * Permission to use, copy, modify and distribute this software and its   *
12  * documentation strictly for non-commercial purposes is hereby granted   *
13  * without fee, provided that the above copyright notice appears in all   *
14  * copies and that both the copyright notice and this permission notice   *
15  * appear in the supporting documentation. The authors make no claims     *
16  * about the suitability of this software for any purpose. It is          *
17  * provided "as is" without express or implied warranty.                  *
18  **************************************************************************/
19
20 /// @file   AliHLTSamplePreprocessor.cxx
21 /// @author Kenneth Aamodt, Sebastian Bablok
22 /// @date   2007-12-06
23 /// @brief  HLT Preprocessor plugin for the AliHLTComp library
24 /// 
25
26 #include "AliHLTSamplePreprocessor.h"
27 #include "AliPreprocessor.h"
28
29 #include <AliCDBMetaData.h>
30 #include <TObjString.h>
31 #include <TString.h>
32 #include <TList.h>
33 #include <TFile.h>
34
35 ClassImp(AliHLTSamplePreprocessor)
36
37 AliHLTSamplePreprocessor::AliHLTSamplePreprocessor()
38 {
39   // see header file for class documentation
40   // or
41   // refer to README to build package
42   // or
43   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 }
45
46 const char* AliHLTSamplePreprocessor::fgkTempHistoFileName = "HLTTemperatureHistograms.root";
47
48 AliHLTSamplePreprocessor::~AliHLTSamplePreprocessor()
49 {
50   // see header file for function documentation
51 }
52
53 void AliHLTSamplePreprocessor::Initialize(Int_t /*run*/, UInt_t /*startTime*/, 
54                                           UInt_t /*endTime*/)
55 {
56   // see header file for function documentation
57 }
58
59
60 UInt_t AliHLTSamplePreprocessor::Process(TMap* /*dcsAliasMap*/)
61 {
62   // see header file for function documentation
63   UInt_t retVal = 0;
64   if (GetTempHisto() != 0) {
65     // unable to fetch the temperature histogram from HLT
66     retVal = 1;
67     // but if set to 1, then also file from GetHuffmanTables won't be saved !!!
68   }
69
70   return retVal;
71 }
72
73 UInt_t AliHLTSamplePreprocessor::GetTempHisto()
74 {
75   // see header file for function documentation
76
77         UInt_t retVal = 0;
78     // get Temp Histogram map
79     TList* hltList = GetFileSources(AliPreprocessor::kHLT, fgkTempHistoFileName);
80     if (!hltList) {
81         Log("Missing list for the HLT");
82    
83         return 1;
84     }
85
86         if (hltList->GetSize() == 0) {
87                 Log("No Temperature histogram produced inside the HLT by a DA for this run.");
88                 return retVal; 
89                 // return no error -> DA might not have run, but other file shall be saved.
90         } else if (hltList->GetSize() > 1) {
91         Log(Form("Problem on the size of the list: %d (HLT)", hltList->GetSize()));
92         return 0; // might have to be changed, when there will be more than one histogram file
93     }
94
95     TObjString* location = (TObjString*) hltList->At(0);
96     if (location == 0) {
97         Log("Error in location HLT list.");
98         return 0;
99     }
100     TString localFileName = GetFile(AliPreprocessor::kHLT, fgkTempHistoFileName,
101                 location->String().Data());
102         if (!(localFileName.Length() > 0)) {
103                 Log("Local file name for Temperature Histogram has zero length.");
104                 return 1;
105         }
106         
107 /*
108     TFile localFile(localFileName);
109     AliCDBMetaData meta("Sebastian Bablok");
110
111     if (!(Store("Calib", kTempHistoFileName, (TObject*) &localFile, &meta, 0, kTRUE))) {
112 */
113     if (!(StoreReferenceFile(localFileName.Data(), fgkTempHistoFileName))) {
114         TString msg("Storing of object '");
115         msg += fgkTempHistoFileName;
116         msg += "' to Reference Storage failed!";
117         Log(msg.Data());
118         retVal = 1;
119     }
120
121         return retVal;
122 }