2 #include <TSystemDirectory.h>
5 #include <AliCDBEntry.h>
7 #include <AliFMDCalibPedestal.h>
8 #include <AliFMDCalibGain.h>
9 #include <AliFMDCalibStripRange.h>
10 #include <AliFMDCalibSampleRate.h>
19 CheckMap(const char* path, const AliFMDMap* map)
22 Warning("CheckFile", "No map in %s", path);
25 if (!map->Ptr() || map->MaxIndex() <= 0) {
26 Warning("CheckFile", "Map %p (%d) has no data in %s",
27 map->Ptr(), map->MaxIndex(), path);
42 CheckFile(const char* name, const char* dirName, Int_t which)
44 TString path(gSystem->ConcatFileName(dirName, name));
45 TFile* file = TFile::Open(path, "READ");
47 Warning("CheckFile", "Failed to open %s", path.Data());
50 AliCDBEntry* entry = static_cast<AliCDBEntry*>(file->Get("AliCDBEntry"));
52 Warning("CheckFile", "No entry in %s", path.Data());
56 TObject* object = entry->GetObject();
58 Warning("CheckFile", "Entry has no object in %s", path.Data());
63 const AliFMDMap* map = 0;
64 if (which == kMap) map = static_cast<AliFMDMap*>(object);
65 else if (which == kPedestal)
66 map = &(static_cast<AliFMDCalibPedestal*>(object)->Values());
67 else if (which == kGain)
68 map = &(static_cast<AliFMDCalibGain*>(object)->Values());
69 else if (which == kRate)
70 map = &(static_cast<AliFMDCalibSampleRate*>(object)->Rates());
71 else if (which == kRange)
72 map = &(static_cast<AliFMDCalibStripRange*>(object)->Ranges());
74 Warning("CheckFile", "Don't now how to deal with what=%d", which);
78 if (!CheckMap(path.Data(), map)) {
82 Info("CheckFile", "Map OK in %s", path.Data());
89 CheckCalibData(const char* dirName)
91 TString dirS(dirName);
92 if (dirS.EndsWith("/")) dirS.Remove(dirS.Length()-1);
93 dirS = gSystem->BaseName(dirS.Data());
95 if (dirS == "Dead" || dirS == "ZeroSuppression") what = kMap;
96 else if (dirS == "Pedestal") what = kPedestal;
97 else if (dirS == "PulseGain") what = kGain;
98 else if (dirS == "SampleRate") what = kRate;
99 else if (dirS == "StripRange") what = kRange;
101 Error("CheckCalibData", "Don't know how to deal with %s in %s",
102 dirS.Data(), dirName);
106 TSystemDirectory dir(dirName, dirName);
107 TList* files(dir.GetListOfFiles());
113 while ((obj = next())) {
114 TString name(obj->GetName());
115 if (!name.EndsWith(".root")) continue;
117 if (CheckFile(name, dirName, what)) nOk++;
119 Info("CheckCalibData", "Total: %d, OK: %d, Bad: %d in %s ",
120 nTotal, nOk, nTotal - nOk, dirName);