some coverity fixes
[u/mrichter/AliRoot.git] / TOF / CheckActiveChannels.C
CommitLineData
263be2fe 1CheckActiveChannels(const Char_t *);
1d834a1e 2CheckActiveChannels(Int_t nrun=-1);
263be2fe 3CheckActiveChannelsFromCDBEntry(AliCDBEntry *);
4
5//____________________________________________________________________
6
7CheckActiveChannels(const Char_t *fileName)
8{
9
10 TFile *file = TFile::Open(fileName);
11 AliCDBEntry *cdbe = (AliCDBEntry *)file->Get("AliCDBEntry");
12 CheckActiveChannelsFromCDBEntry(cdbe);
13
14}
15
16//____________________________________________________________________
17
1d834a1e 18CheckActiveChannels(Int_t nrun)
263be2fe 19{
20
21 TGrid *alien = TGrid::Connect("alien://");
22 if (!alien || !alien->IsConnected()) return;
23 AliCDBManager *cdbm = AliCDBManager::Instance();
24 cdbm->SetDefaultStorage("raw://");
1d834a1e 25 if (nrun==-1)
26 cdbm->SetRun(80015);
27 else
28 cdbm->SetRun(nrun);
263be2fe 29 AliCDBEntry *cdbe = cdbm->Get("TOF/Calib/Status");
30 CheckActiveChannelsFromCDBEntry(cdbe);
31
32}
33
34//____________________________________________________________________
35
36CheckActiveChannelsFromCDBEntry(AliCDBEntry *cdbe)
37{
38
39 AliTOFChannelOnlineStatusArray *array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
40 TH1F *hStatus_hw_ok = new TH1F("hStatus_hw_ok", "HW status;index;status ok", array->GetSize(), 0., array->GetSize(););
41 TH1F *hStatus_pulser_ok = new TH1F("hStatus_pulser_ok", "pulser status;index;status ok", array->GetSize(), 0., array->GetSize(););
42 TH1F *hStatus_noise_ok = new TH1F("hStatus_noise_ok", "noise status;index;status ok", array->GetSize(), 0., array->GetSize(););
43 TH1F *hStatus_active = new TH1F("hStatus_active", "active status;index;status ok", array->GetSize(), 0., array->GetSize(););
44 Bool_t hw_ok, pulser_ok, noise_ok;
45 for (Int_t i = 0; i < array->GetSize(); i++) {
46 hw_ok = array->GetHWStatus(i) & AliTOFChannelOnlineStatusArray::kTOFHWOk;
1d834a1e 47 pulser_ok = !(array->GetPulserStatus(i) & AliTOFChannelOnlineStatusArray::kTOFPulserBad);
263be2fe 48 noise_ok = array->GetNoiseStatus(i) & AliTOFChannelOnlineStatusArray::kTOFNoiseOk;
49 hStatus_hw_ok->SetBinContent(i + 1, hw_ok);
50 hStatus_pulser_ok->SetBinContent(i + 1, pulser_ok);
51 hStatus_noise_ok->SetBinContent(i + 1, noise_ok);
52 hStatus_active->SetBinContent(i + 1, hw_ok && pulser_ok && noise_ok);
53 }
54 printf("%d active channels\n", hStatus_active->Integral());
55
56 TFile *fileout = TFile::Open("ChannelStatus.root", "RECREATE");
57 hStatus_hw_ok->Write();
58 hStatus_pulser_ok->Write();
59 hStatus_noise_ok->Write();
60 hStatus_active->Write();
61 fileout->Close();
62
63}
64
65