Script to get # of dead channels from OCDB
[u/mrichter/AliRoot.git] / FMD / scripts / dqm / PatternCalib.C
CommitLineData
e064ab4a 1//____________________________________________________________________
2//
3// $Id: PatternDigits.C 28055 2008-08-18 00:33:20Z cholm $
4//
5// Draw hits in the specialised FMD event display
6//
7/** Display hits
8 @ingroup FMD_script
9 */
10Bool_t
4125e138 11CheckFile(const char* prefix, const char* path, int number, TString& f)
e064ab4a 12{
13 f = (Form("%s%d.csv", prefix, number));
4125e138 14 std::cout << "Checking if " << f << " exists in " << path << " ... "
15 << std::flush;
16 f = gSystem->Which(path, f.Data());
e064ab4a 17 std::cout << '"' << f << '"' << std::endl;
18 return !f.IsNull();
19}
20void
4125e138 21PatternCalib(const char* file="raw.root", const char* calib="$(HOME)/calib/",
22 Int_t runno=0)
e064ab4a 23{
24 // AliLog::SetModuleDebugLevel("FMD", 1);
25 gSystem->Load("libFMDutil.so");
26
27 AliCDBManager* cdb = AliCDBManager::Instance();
28 const char* cdbUri = gSystem->Getenv("AMORE_CDB_URI");
29 cdb->SetDefaultStorage(cdbUri);
30 cdb->SetRun(runno);
31
32 AliFMDCalibStripRange* range = new AliFMDCalibStripRange;
33 AliFMDCalibSampleRate* rate = new AliFMDCalibSampleRate;
34 AliFMDCalibPedestal* peds = new AliFMDCalibPedestal;
35 AliFMDCalibGain* gains = new AliFMDCalibGain;
36 Bool_t gotConds = kFALSE;
37 Bool_t gotPeds = kFALSE;
38 Bool_t gotGains = kFALSE;
39 for (Int_t i = 1; i <= 3; i++) {
40 TString f;
4125e138 41 if (CheckFile("conditions", calib, i, f)) {
e064ab4a 42 gotConds = kTRUE;
43 std::cout << "Reading conditions for FMD" <<i<< " from " <<f<< std::endl;
44 std::ifstream in(f.Data());
45 range->ReadFromFile(in);
46 rate->ReadFromFile(in);
47 }
4125e138 48 if (CheckFile("peds", calib, i, f)) {
e064ab4a 49 gotPeds = kTRUE;
50 std::cout << "Reading pedestals for FMD" <<i<< " from " <<f<< std::endl;
51 std::ifstream in(f.Data());
52 peds->ReadFromFile(in);
53 }
4125e138 54 if (CheckFile("gains", calib, i, f)) {
e064ab4a 55 gotGains = kTRUE;
56 std::cout << "Reading gains for FMD" <<i<< " from " <<f<< std::endl;
57 std::ifstream in(f.Data());
58 gains->ReadFromFile(in);
59 }
60 }
61
62 Int_t mask = (AliFMDParameters::kDeadMap|
63 AliFMDParameters::kZeroSuppression|
64 AliFMDParameters::kAltroMap);
65
66
67 if (!gotConds) mask |= AliFMDParameters::kStripRange;
68 if (!gotConds) mask |= AliFMDParameters::kSampleRate;
69 if (!gotPeds) mask |= AliFMDParameters::kPedestal;
70 if (!gotGains) mask |= AliFMDParameters::kPulseGain;
71
72 AliFMDParameters* pars = AliFMDParameters::Instance();
73 pars->Init(kFALSE, mask);
74
75 if (gotConds) pars->SetStripRange(range);
76 if (gotConds) pars->SetSampleRate(rate);
77 if (gotPeds) pars->SetPedestal(peds);
78 if (gotGains) pars->SetGain(gains);
79
80 // pars->Print("pedestal");
81
82 AliFMDPattern* d = new AliFMDPattern;
83 d->AddLoad(AliFMDInput::kRawCalib);
84 d->SetRawFile(file);
85 d->SetName("rawCalib");
86 d->SetTitle("Calibrated Raw");
e1a9aea4 87 d->SetFactor(5);
88 d->SetCut(0.02, 1);
e064ab4a 89 d->Run();
90}
91
92//____________________________________________________________________
93//
94// EOF
95//