Adding the TOF and T0 to the Pass0
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Apr 2011 11:00:29 +0000 (11:00 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 16 Apr 2011 11:00:29 +0000 (11:00 +0000)
PWG1/CalibMacros/Pass0/AddTOFAnalysisTaskCalibPass0.C [new file with mode: 0644]
PWG1/CalibMacros/Pass0/AddTaskT0Calib.C [new file with mode: 0755]
PWG1/CalibMacros/Pass0/LoadLibraries.C
PWG1/CalibMacros/Pass0/runCalibTrain.C

diff --git a/PWG1/CalibMacros/Pass0/AddTOFAnalysisTaskCalibPass0.C b/PWG1/CalibMacros/Pass0/AddTOFAnalysisTaskCalibPass0.C
new file mode 100644 (file)
index 0000000..a65604d
--- /dev/null
@@ -0,0 +1,73 @@
+AliTOFAnalysisTaskCalibPass0 *
+AddTOFAnalysisTaskCalibPass0()
+{
+
+  /* check analysis manager */
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddAnalysisTaskEventTime", "cannot get analysis manager");
+    return NULL;
+  }
+
+  /* check input event handler */
+  if (!mgr->GetInputEventHandler()) {
+    Error("AddAnalysisTaskEventTime", "cannot get input event handler");
+    return NULL;
+  }
+  
+  /* check input data type */
+  TString str = mgr->GetInputEventHandler()->GetDataType();
+  if (str.CompareTo("ESD")) {
+    Error("AddAnalysisTaskEventTime", "input data type is not \"ESD\"");
+    return NULL;
+  }
+
+  /* get common input data container */
+  AliAnalysisDataContainer *inputc = mgr->GetCommonInputContainer();
+  if (!inputc) {
+    Error("AddAnalysisTaskEventTime", "cannot get common input container");
+    return NULL;
+  }
+  
+  /* create output data container */
+  AliAnalysisDataContainer *outputc1 = mgr->CreateContainer("TOFHistos", TList::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");
+  if (!outputc1) {
+    Error("AddAnalysisTaskEventTime", "cannot create output container \"Histos\"");
+    return NULL;
+  }
+
+  /*  create task and connect input/output */
+  AliTOFAnalysisTaskCalibPass0 *task = new AliTOFAnalysisTaskCalibPass0();
+
+  // adding the task
+  mgr->AddTask(task);
+
+  mgr->ConnectInput(task, 0, inputc);
+  mgr->ConnectOutput(task, 1, outputc1);
+
+  /* setup task */
+  task->SetEventSelectionFlag(kFALSE);
+  task->SetVertexSelectionFlag(kTRUE);
+  task->SetVertexCut(25.0);
+  /* setup TOF calib */
+  task->GetTOFcalib()->SetRemoveMeanT0(kFALSE);
+  task->GetTOFcalib()->SetCalibrateTOFsignal(kTRUE);
+  task->GetTOFcalib()->SetCorrectTExp(kFALSE);
+  /* setup track cuts */
+  AliESDtrackCuts *trackCuts = task->GetTrackCuts();
+  trackCuts->SetPtRange(0.5, 10.);
+  trackCuts->SetEtaRange(-1.0, 1.0);
+  trackCuts->SetRequireITSRefit(kTRUE);
+  trackCuts->SetMinNClustersITS(1);
+  trackCuts->SetRequireTPCRefit(kTRUE);
+  trackCuts->SetMinNClustersTPC(70);
+  trackCuts->SetMaxChi2PerClusterTPC(4.);
+  trackCuts->SetAcceptKinkDaughters(kFALSE);
+  trackCuts->SetMaxDCAToVertexZ(3.2);
+  trackCuts->SetMaxDCAToVertexXY(2.4);
+  trackCuts->SetDCAToVertex2D(kTRUE);
+
+  /* return task */
+  return task;
+
+}
diff --git a/PWG1/CalibMacros/Pass0/AddTaskT0Calib.C b/PWG1/CalibMacros/Pass0/AddTaskT0Calib.C
new file mode 100755 (executable)
index 0000000..8f79a75
--- /dev/null
@@ -0,0 +1,37 @@
+//_____________________________________________________________________________
+AliAnalysisTask  *AddTaskT0Calib(Int_t runNumber)
+{
+  //
+  // add calibration task
+  //
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskT0Calib", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // check the input handler
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskT0Calib", "This task requires an input event handler");
+    return NULL;
+  }  
+
+  // set TPC OCDB parameters
+  //ConfigOCDB(runNumber);
+
+  // setup task
+ AliT0CalibOffsetChannelsTask  *task1 = new AliT0CalibOffsetChannelsTask("CalibObjectsTrain1");
+   mgr->AddTask(task1);
+
+  //  AliT0AnalysisTaskQA * task2 = new AliT0AnalysisTaskQA("QA task");
+  //    mgr->AddTask(task2);
+
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                      AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("T0Calib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
+
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,1,coutput1);
+  return task1;
+}
index 7be6fbf..7980397 100644 (file)
@@ -11,4 +11,6 @@ void LoadLibraries() {
     //    
     gSystem->Load("libTPCcalib");
     gSystem->Load("libTRDcalib");
+    gSystem->Load("libT0calib");
+    gSystem->Load("libTOFcalib");
 }
index 3d57665..e005b3b 100644 (file)
@@ -22,7 +22,10 @@ void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.ro
   // detector tasks
   gROOT->LoadMacro("AddTaskTPCCalib.C");
   gROOT->LoadMacro("AddTaskTRDCalib.C");
-  
+  gROOT->LoadMacro("AddTOFAnalysisTaskCalibPass0.C");
+  gROOT->LoadMacro("AddTaskT0Calib.C");
+
+
   // switch off debug 
   AliLog::SetClassDebugLevel("AliESDEvent",0);
   
@@ -56,7 +59,9 @@ void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.ro
   // Detector Tasks
   AliAnalysisTask* tTPC = AddTaskTPCCalib(runNumber);
   AliAnalysisTask* tTRD = AddTaskTRDCalib(runNumber);
-  
+  AliTOFAnalysisTaskCalibPass0 *thisTask = AddTOFAnalysisTaskCalibPass0();
+  AliAnalysisTask* tT0 = AddTaskT0Calib(runNumber);
+
   // Run the analysis
   if (!mgr->InitAnalysis()) {
     printf("Analysis cannot be started, returning\n");