]>
Commit | Line | Data |
---|---|---|
27eb9bff | 1 | /* |
2 | Template of calibration/filtering macro using ESD: | |
3 | - requires AliESDs.root and AliESDfriend.root | |
4 | - requires OCDB access (default set to "raw://") | |
5 | - requires run number as argument to init OCDB | |
6 | - calls LoadLibraries.C, ConfigCalibTrain.C and AddTaskTPCCalib.C macros | |
7 | - output AliESDfriends_v1.root with TPC and TRD calibration objects are created | |
8 | ||
9 | Example: | |
10 | .L $ALICE_ROOT/ANALYSIS/macros/runCalibTrain.C | |
11 | runCalibTrain("104892"); | |
12 | */ | |
13 | ||
14 | void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://") | |
15 | { | |
16 | // | |
17 | // macro to run TPC calibration train | |
18 | // | |
19 | AliLog::SetGlobalLogLevel(AliLog::kError); | |
cd9dc5c7 | 20 | gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C"); |
21 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/ConfigCalibTrain.C"); | |
27eb9bff | 22 | |
23 | // detector tasks | |
cd9dc5c7 | 24 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTaskTPCCalib.C"); |
25 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTaskTRDCalib.C"); | |
26 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTOFAnalysisTaskCalibPass0.C"); | |
27 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTaskT0Calib.C"); | |
28 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTaskMeanVertexCalib.C"); | |
29 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/AddTaskSDDCalib.C"); | |
27eb9bff | 30 | |
31 | // switch off debug | |
32 | AliLog::SetClassDebugLevel("AliESDEvent",0); | |
33 | ||
34 | // steering input chain | |
35 | TChain *chain = new TChain("esdTree"); | |
36 | chain->Add(inFileName); | |
37 | ||
38 | // config calibration train | |
39 | // setting geometry and B-field from GRP | |
40 | Int_t runNumber = runNumberString.Atoi(); | |
41 | printf("runNumber from runCalibTrain = %d\n",runNumber); | |
42 | printf("ocdb from runCalibTrain = %s\n",ocdb); | |
43 | ConfigCalibTrain(runNumber, ocdb); | |
44 | ||
45 | // | |
8d358369 | 46 | // check the presence of the detectors |
47 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
48 | AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
49 | if (!grpData) {printf("Failed to get GRP data for run",runNumber); return;} | |
50 | Int_t activeDetectors = grpData->GetDetectorMask(); | |
51 | TString detStr = AliDAQ::ListOfTriggeredDetectors(activeDetectors); | |
52 | printf("Detectors in the data:\n%s\n",detStr.Data()); | |
53 | ||
27eb9bff | 54 | // setup analysis |
55 | // | |
56 | AliAnalysisManager *mgr = new AliAnalysisManager("ESD to ESD", "Analysis Manager"); | |
57 | // mgr->SetDebugLevel(3); | |
64581572 | 58 | mgr->SetNSysInfo(50); |
27eb9bff | 59 | // Input |
60 | AliESDInputHandler* inpHandler = new AliESDInputHandler(); | |
61 | inpHandler->SetReadFriends(1); | |
62 | mgr->SetInputEventHandler(inpHandler); | |
63 | ||
64 | // Output | |
65 | const char *outFile = "AliESDfriends_v1.root"; | |
66 | AliESDHandler* esdHandler = new AliESDHandler(); | |
67 | mgr->SetOutputEventHandler(esdHandler); | |
68 | esdHandler->SetOutputFileName(outFile); | |
69 | mgr->SetCommonFileName(outFile); | |
70 | // | |
71 | // Detector Tasks | |
72 | AliAnalysisTask* tTPC = AddTaskTPCCalib(runNumber); | |
73 | AliAnalysisTask* tTRD = AddTaskTRDCalib(runNumber); | |
74 | AliTOFAnalysisTaskCalibPass0 *thisTask = AddTOFAnalysisTaskCalibPass0(); | |
75 | AliAnalysisTask* tT0 = AddTaskT0Calib(runNumber); | |
76 | AliMeanVertexCalibTask *tMeanVtx = AddTaskMeanVertexCalib(); | |
f28dbaea | 77 | // |
8d358369 | 78 | Bool_t okTPC = detStr.Contains("TPC"); |
79 | Bool_t useTPCcrv=kTRUE; | |
f28dbaea | 80 | Bool_t writeITSTP = kFALSE; |
8d358369 | 81 | if (!okTPC) useTPCcrv = kFALSE; |
f28dbaea | 82 | AliAnalysisTaskITSAlignQA *itsAlign = AddTaskSDDCalib(0,writeITSTP,useTPCcrv); |
8d358369 | 83 | if (!okTPC) itsAlign->SetUseITSstandaloneTracks(kTRUE); |
ef6fa479 | 84 | if (grpData->GetL3Current()[0] < 300) itsAlign->SetMinPt(0.001); |
8d358369 | 85 | // |
27eb9bff | 86 | // Run the analysis |
87 | if (!mgr->InitAnalysis()) { | |
88 | printf("Analysis cannot be started, returning\n"); | |
89 | return; | |
90 | } | |
91 | ||
92 | mgr->PrintStatus(); | |
93 | mgr->StartAnalysis("local", chain); | |
94 | ||
95 | return; | |
96 | } |