added CheckActiveChannels.C macro used to check active channels as declared in TOF...
[u/mrichter/AliRoot.git] / TOF / CheckActiveChannels.C
CommitLineData
263be2fe 1CheckActiveChannels(const Char_t *);
2CheckActiveChannels(Int_t);
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
18CheckActiveChannels(Int_t run)
19{
20
21 TGrid *alien = TGrid::Connect("alien://");
22 if (!alien || !alien->IsConnected()) return;
23 AliCDBManager *cdbm = AliCDBManager::Instance();
24 cdbm->SetDefaultStorage("raw://");
25 cdbm->SetRun(80015);
26 AliCDBEntry *cdbe = cdbm->Get("TOF/Calib/Status");
27 CheckActiveChannelsFromCDBEntry(cdbe);
28
29}
30
31//____________________________________________________________________
32
33CheckActiveChannelsFromCDBEntry(AliCDBEntry *cdbe)
34{
35
36 AliTOFChannelOnlineStatusArray *array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
37 TH1F *hStatus_hw_ok = new TH1F("hStatus_hw_ok", "HW status;index;status ok", array->GetSize(), 0., array->GetSize(););
38 TH1F *hStatus_pulser_ok = new TH1F("hStatus_pulser_ok", "pulser status;index;status ok", array->GetSize(), 0., array->GetSize(););
39 TH1F *hStatus_noise_ok = new TH1F("hStatus_noise_ok", "noise status;index;status ok", array->GetSize(), 0., array->GetSize(););
40 TH1F *hStatus_active = new TH1F("hStatus_active", "active status;index;status ok", array->GetSize(), 0., array->GetSize(););
41 Bool_t hw_ok, pulser_ok, noise_ok;
42 for (Int_t i = 0; i < array->GetSize(); i++) {
43 hw_ok = array->GetHWStatus(i) & AliTOFChannelOnlineStatusArray::kTOFHWOk;
44 pulser_ok = array->GetPulserStatus(i) & AliTOFChannelOnlineStatusArray::kTOFPulserOk;
45 noise_ok = array->GetNoiseStatus(i) & AliTOFChannelOnlineStatusArray::kTOFNoiseOk;
46 hStatus_hw_ok->SetBinContent(i + 1, hw_ok);
47 hStatus_pulser_ok->SetBinContent(i + 1, pulser_ok);
48 hStatus_noise_ok->SetBinContent(i + 1, noise_ok);
49 hStatus_active->SetBinContent(i + 1, hw_ok && pulser_ok && noise_ok);
50 }
51 printf("%d active channels\n", hStatus_active->Integral());
52
53 TFile *fileout = TFile::Open("ChannelStatus.root", "RECREATE");
54 hStatus_hw_ok->Write();
55 hStatus_pulser_ok->Write();
56 hStatus_noise_ok->Write();
57 hStatus_active->Write();
58 fileout->Close();
59
60}
61
62