Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id$
3 :
4 : #ifndef ALIHLTMODULEPREPROCESSOR_H
5 : #define ALIHLTMODULEPREPROCESSOR_H
6 : //* This file is property of and copyright by the ALICE HLT Project *
7 : //* ALICE Experiment at CERN, All rights reserved. *
8 : //* See cxx source for full Copyright notice *
9 :
10 : // @file AliHLTModulePreprocessor.h
11 : // @author Matthias Richter
12 : // @date 2008-01-22
13 : // @brief Base class for HLT module preprocessors
14 : //
15 :
16 : // see below for class documentation
17 : // or
18 : // refer to README to build package
19 : // or
20 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21 :
22 : #include "TObject.h"
23 :
24 : class AliHLTPreprocessor;
25 : class TMap;
26 : class AliCDBMetaData;
27 : class AliCDBEntry;
28 : class AliHLTShuttleInterface;
29 :
30 : /**
31 : * @class AliHLTModulePreprocessor
32 : * Implementation of the HLT version for the Shuttle Preprocessor.
33 : * This class implements the same interface as the AliPreprocessor and
34 : * allows multiple preprocessors for the HLT. All methods are redirected
35 : * to the AliHLTPreprocessor, which acts as the HLT preprocessor
36 : * to the outside, and a container for all module preprocessors to the
37 : * inside.
38 : *
39 : * @author Matthias Richter
40 : */
41 : class AliHLTModulePreprocessor : public TObject
42 : {
43 : public:
44 : /** Constructor*/
45 : AliHLTModulePreprocessor();
46 : /** Destructor */
47 : virtual ~AliHLTModulePreprocessor();
48 :
49 : /**
50 : * Set the container class which is the gateway to the shuttle.
51 : */
52 : void SetShuttleInterface(AliHLTShuttleInterface* pInterface);
53 :
54 : /**
55 : * Initialize the Preprocessor.
56 : *
57 : * @param run run number
58 : * @param startTime start time of data
59 : * @param endTime end time of data
60 : */
61 : virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime) = 0;
62 :
63 : /**
64 : * Function to process data. Inside the preparation and storing to OCDB
65 : * should be handled.
66 : *
67 : * @param dcsAliasMap the map containing aliases and corresponding DCS
68 : * values and timestamps
69 : *
70 : * @return 0 on success; error code otherwise
71 : */
72 : virtual UInt_t Process(TMap* dcsAliasMap) = 0;
73 :
74 : /** Get the run no */
75 : Int_t GetRun() const;
76 :
77 : /** Get the start time */
78 : UInt_t GetStartTime() const;
79 :
80 : /** Get the end time */
81 : UInt_t GetEndTime() const;
82 :
83 : /**
84 : * Get the id of the module
85 : * Each module preprocessor is identified by a unique id.
86 : * The function is pure virtual and must be implemented by the child class.
87 : * @return module id (string)
88 : */
89 0 : virtual const char* GetModuleID() {return ClassName();}
90 :
91 : /**
92 : * Get all detectors the module process
93 : * Detectors are determined in the bit mask as provided by "detectorMask"
94 : * implement: GetModuleNumber() {return AliHLTModulePreprocessor::DetetorID("detectorname");}
95 : * The function is pure virtual and must be implemented by the child class.
96 : * @return bit mask for active detectors (Int_t)
97 : */
98 : virtual Int_t GetModuleNumber() = 0;
99 :
100 : /** Get detector bit mask (bit mask comparable to the detectorMask but for the respective detector only)
101 : * out of detector name
102 : *@param detectorName const char* of the detector
103 : *@return Int_t for the detector bit mask
104 : */
105 : Int_t DetectorBitMask(const char *detectorName);
106 :
107 : /** Get the information whether detector was active (return value: 1 = active, 0 = inactive)
108 : @param detectorbitmask bitmask of the detector to be checked (s. DetectorBitMask)
109 : @return 1 if active 0 if inactive
110 : */
111 : Bool_t GetDetectorStatus(Int_t detectorbitmask);
112 :
113 : /** Get detector name out of detector id (bit position in detectorMask of the resp. detector)
114 : *@param detectorID integer ID of the detector
115 : *@return const char* name of the detector corresponding to the ID
116 : */
117 : const char *DetectorName(Int_t detectorID);
118 :
119 : /// extract object from the alias map
120 : /// return the last object from the value set
121 : TObject* GetFromMap(TMap* dcsAliasMap, const char* stringId) const;
122 :
123 : /** number of detectors */
124 : //static const Int_t kNDetectors; // Number of detectors
125 :
126 : protected:
127 : // the AliPreprocessor interface, all functions redirected via the
128 : // AliHLTShuttleInterface to the AliHLTPreprocessor
129 : Bool_t Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
130 : AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
131 : Bool_t StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
132 : AliCDBMetaData* metaData);
133 : Bool_t StoreReferenceFile(const char* localFile, const char* gridFileName);
134 :
135 : Bool_t StoreRunMetadataFile(const char* localFile, const char* gridFileName);
136 :
137 : const char* GetFile(Int_t system, const char* id, const char* source);
138 :
139 : TList* GetFileSources(Int_t system, const char* id = 0);
140 :
141 : TList* GetFileIDs(Int_t system, const char* source);
142 :
143 : const char* GetRunParameter(const char* param);
144 :
145 : AliCDBEntry* GetFromOCDB(const char* pathLevel2, const char* pathLevel3);
146 :
147 : const char* GetRunType();
148 :
149 : void Log(const char* message);
150 :
151 : private:
152 : /** copy constructor prohibited */
153 : AliHLTModulePreprocessor(const AliHLTModulePreprocessor& preproc);
154 : /** assignment operator prohibited */
155 : AliHLTModulePreprocessor& operator=(const AliHLTModulePreprocessor& rhs);
156 :
157 : /** the interface class which is the gateway to the shuttle */
158 : AliHLTShuttleInterface* fpInterface; //! transient
159 :
160 : /** determine which which detectors were active */
161 : Int_t fActiveDetectors; // bit array of active detectors
162 :
163 : /** array of detector names */
164 : //static const char *fgkDetectorName[]; // Detector names
165 :
166 126 : ClassDef(AliHLTModulePreprocessor, 1);
167 : };
168 : #endif
|