added TOF calibration library and code for pass0/passX calibration
[u/mrichter/AliRoot.git] / TOF / TOFCalibPass0.C
CommitLineData
3c8efc07 1//___________________________________________________________________________
2
3LoadLibraries()
4{
5 gSystem->Load("libANALYSIS");
6 gSystem->Load("libANALYSISalice");
7 gSystem->Load("libTOFcalib");
8}
9
10//___________________________________________________________________________
11
12MakeOCDB(const Char_t *filename = "TOFCalibPass0.root", const Char_t *dbString = "local://$HOME/OCDB")
13{
14 LoadLibraries();
15 AliTOFAnalysisTaskCalibPass0 calibTask;
16 calibTask.ProcessOutput(filename, dbString);
17}
18
19//___________________________________________________________________________
20
21SteerTask(const Char_t *inputfilename, Int_t maxFiles = kMaxInt, Int_t maxEv = kMaxInt)
22{
23
24 LoadLibraries();
25
26 /* setup input chain */
27 TString str = inputfilename;
28 const Char_t *filename;
29 TChain *chain = new TChain("esdTree");
30 if (str.EndsWith(".xml")) {
31 TGrid::Connect("alien://");
32 Info("SteerTaskEventTime", "reading data list from collection:");
33 TAlienCollection coll(inputfilename, maxFiles);
34 coll.Reset();
35 while (coll.Next()) {
36 filename = coll.GetTURL();
37 Info("SteerTaskEventTime", Form("%s", filename));
38 chain->Add(filename);
39 }
40 }
41 else if (str.EndsWith(".txt")) {
42 Info("SteerTaskEventTime", "reading data list from text file:");
43 ifstream is(inputfilename);
44 Char_t buf[4096];
45 while(!is.eof()) {
46 is.getline(buf, 4096);
47 if (is.eof()) break;
48 chain->Add(buf);
49 Info("SteerTaskEventTime", Form("%s", buf));
50 }
51 is.close();
52 }
53 else {
54 Info("SteerTaskEventTime", "single file:");
55 filename = inputfilename;
56 Info("SteerTaskEventTime", Form("%s", filename));
57 chain->Add(filename);
58 }
59 Info("SteerTaskEventTime", Form("chain is ready: %d events", chain->GetEntries()));
60
61 /* create analysis manager */
62 AliAnalysisManager *mgr = new AliAnalysisManager("EventTime");
63
64 /* define input event handler */
65 AliESDInputHandler *esdh = new AliESDInputHandler();
66 esdh->SetReadFriends(kFALSE);
67 mgr->SetInputEventHandler(esdh);
68
69 /* add tasks */
70 gROOT->LoadMacro("$ALICE_ROOT/TOF/AddTOFAnalysisTaskCalibPass0.C");
71 AliTOFAnalysisTaskCalibPass0 *thisTask = AddTOFAnalysisTaskCalibPass0();
72
73 /* start analysis */
74 mgr->SetDebugLevel(0);
75 if (!mgr->InitAnalysis()) return;
76 mgr->PrintStatus();
77 mgr->StartAnalysis("local", chain, maxEv);
78
79 /* create dummy file to tell we are done */
80 gSystem->Exec("touch done");
81
82}