]>
Commit | Line | Data |
---|---|---|
dadc7068 | 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: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no> * | |
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 AliHLTTPCNoiseMap.cxx | |
19 | @author Kalliopi Kanaki | |
3a3550fa | 20 | @date |
dadc7068 | 21 | @brief Class for reading the noise map from HCDB. |
22 | */ | |
23 | ||
24 | #if __GNUC__>= 3 | |
25 | using namespace std; | |
26 | #endif | |
27 | ||
28 | #include "AliHLTTPCNoiseMap.h" | |
29 | ||
30 | #include "AliCDBEntry.h" | |
31 | #include "AliCDBManager.h" | |
32 | #include "AliCDBStorage.h" | |
33 | #include "AliCDBPath.h" | |
34 | ||
35 | #include "TObjString.h" | |
36 | ||
37 | ClassImp(AliHLTTPCNoiseMap) | |
38 | ||
39 | AliHLTTPCNoiseMap::AliHLTTPCNoiseMap(){ | |
40 | // see header file for class documentation // | |
41 | // or // | |
42 | // refer to README to build package // | |
43 | // or // | |
44 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
45 | } | |
46 | ||
47 | AliHLTTPCNoiseMap* AliHLTTPCNoiseMap::pNoiseMapInstance = 0; // initialize pointer | |
48 | ||
49 | AliHLTTPCNoiseMap* AliHLTTPCNoiseMap::Instance(){ | |
50 | // see header file for class documentation | |
51 | ||
52 | if (pNoiseMapInstance == 0){ | |
53 | pNoiseMapInstance = new AliHLTTPCNoiseMap; // create sole instance | |
54 | } | |
55 | return pNoiseMapInstance; // address of sole instance | |
56 | } | |
57 | ||
b1d702f1 | 58 | AliTPCCalPad* AliHLTTPCNoiseMap::ReadNoiseMap(Int_t runNo){ |
dadc7068 | 59 | // see header file for class documentation |
dadc7068 | 60 | const char* pathNoiseMap = "TPC/Calib/PadNoise"; |
61 | AliTPCCalPad *padNoise = NULL; | |
62 | ||
63 | if(pathNoiseMap){ | |
64 | ||
65 | //AliCDBPath path(pathNoiseMap); | |
66 | //AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path); // read from the default storage | |
67 | // for local testing purposes | |
68 | ||
b1d702f1 | 69 | AliCDBStorage *stor = AliCDBManager::Instance()->GetDefaultStorage(); |
70 | if(!stor){ | |
71 | HLTError("Cannot get HCDB default storage."); | |
72 | return NULL; | |
73 | } | |
74 | ||
75 | AliCDBPath path(pathNoiseMap); | |
76 | Int_t version = stor->GetLatestVersion(pathNoiseMap, runNo); | |
77 | Int_t subVersion = stor->GetLatestSubVersion(pathNoiseMap, runNo, version); | |
dadc7068 | 78 | |
b1d702f1 | 79 | //HLTInfo("RunNo %d, version %d, subversion %d", runNo, version, subVersion); |
80 | ||
81 | AliCDBEntry *pEntry = stor->Get(path, runNo, version, subVersion); | |
82 | ||
dadc7068 | 83 | if(pEntry){ |
84 | padNoise = (AliTPCCalPad*)pEntry->GetObject(); | |
b1d702f1 | 85 | if(padNoise){ |
86 | TObjString *pString = dynamic_cast<TObjString*>(pEntry->GetObject()); | |
87 | if(pString){ | |
88 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); } | |
89 | } | |
dadc7068 | 90 | } // end if pEntry |
b1d702f1 | 91 | else { |
92 | HLTError("cannot fetch object \"%s\" from CDB", pathNoiseMap); | |
93 | } | |
dadc7068 | 94 | } // end if pathNoiseMap |
95 | return padNoise; | |
b1d702f1 | 96 | |
dadc7068 | 97 | } |