New TOF Tender Sussplies (F. Noferini)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Oct 2010 15:50:22 +0000 (15:50 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Oct 2010 15:50:22 +0000 (15:50 +0000)
ANALYSIS/TenderSupplies/AliTOFTenderSupply.cxx [new file with mode: 0644]
ANALYSIS/TenderSupplies/AliTOFTenderSupply.h [new file with mode: 0644]

diff --git a/ANALYSIS/TenderSupplies/AliTOFTenderSupply.cxx b/ANALYSIS/TenderSupplies/AliTOFTenderSupply.cxx
new file mode 100644 (file)
index 0000000..e87056e
--- /dev/null
@@ -0,0 +1,141 @@
+/**************************************************************************\r
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ *                                                                        *\r
+ * Author: The ALICE Off-line Project.                                    *\r
+ * Contributors are mentioned in the code where appropriate.              *\r
+ *                                                                        *\r
+ * Permission to use, copy, modify and distribute this software and its   *\r
+ * documentation strictly for non-commercial purposes is hereby granted   *\r
+ * without fee, provided that the above copyright notice appears in all   *\r
+ * copies and that both the copyright notice and this permission notice   *\r
+ * appear in the supporting documentation. The authors make no claims     *\r
+ * about the suitability of this software for any purpose. It is          *\r
+ * provided "as is" without express or implied warranty.                  *\r
+ **************************************************************************/\r
+\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+//                                                                           //\r
+// TOF tender: reapply TOF pid on the fly                                    //\r
+//                                                                           //\r
+///////////////////////////////////////////////////////////////////////////////\r
+#include <AliLog.h>\r
+#include <AliESDEvent.h>\r
+#include <AliESDInputHandler.h>\r
+#include <AliAnalysisManager.h>\r
+#include <AliESDpid.h>\r
+#include <AliTender.h>\r
+\r
+#include "AliTOFcalib.h"\r
+#include "AliTOFT0maker.h"\r
+\r
+#include "AliTOFTenderSupply.h"\r
+\r
+\r
+AliTOFTenderSupply::AliTOFTenderSupply() :\r
+  AliTenderSupply(),\r
+  fESDpid(0x0),\r
+  fTOFCalib(0x0),\r
+  fTOFT0maker(0x0),\r
+  fTOFres(100.),\r
+  fIsMC(kFALSE)\r
+{\r
+  //\r
+  // default ctor\r
+  //\r
+}\r
+\r
+//_____________________________________________________\r
+AliTOFTenderSupply::AliTOFTenderSupply(const char *name, const AliTender *tender) :\r
+  AliTenderSupply(name,tender),\r
+  fESDpid(0x0),\r
+  fTOFCalib(0x0),\r
+  fTOFT0maker(0x0),\r
+  fTOFres(100.),\r
+  fIsMC(kFALSE)\r
+{\r
+  //\r
+  // named ctor\r
+  //\r
+}\r
+\r
+//_____________________________________________________\r
+void AliTOFTenderSupply::Init()\r
+{\r
+  //\r
+  // Initialise TOF tender\r
+  //\r
+\r
+\r
+  //\r
+  // Setup PID object\r
+  //\r
+\r
+  // Check if another detector already created the esd pid object\r
+  // if not we create it and set it to the ESD input handler\r
+  fESDpid=fTender->GetESDhandler()->GetESDpid();\r
+  if (!fESDpid) {\r
+    fESDpid=new AliESDpid;\r
+    fTender->GetESDhandler()->SetESDpid(fESDpid);\r
+  }\r
+\r
+  //Set proper resolution in case of MC\r
+  AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();\r
+  if (mgr->GetMCtruthEventHandler()) fIsMC=kTRUE;\r
+\r
+\r
+  //\r
+  // Create TOF calibration classes\r
+  //\r
+  if (!fTOFCalib){\r
+      fTOFCalib=new AliTOFcalib();\r
+      fTOFCalib->SetCorrectTExp(kTRUE); // apply a fine tuning on the expected times at low momenta\r
+      if(fIsMC) fTOFCalib->SetCalibrateTOFsignal(kFALSE); // no new calibration\r
+      fTOFCalib->Init();\r
+  }\r
+  if (!fTOFT0maker) {\r
+      fTOFT0maker = new AliTOFT0maker(fESDpid,fTOFCalib);\r
+      fTOFT0maker->SetTimeResolution(fTOFres); // set TOF resolution for the PID\r
+  }\r
+}\r
+\r
+//_____________________________________________________\r
+void AliTOFTenderSupply::ProcessEvent()\r
+{\r
+  //\r
+  // Reapply pid information\r
+  //\r
+\r
+  //no corrections for MC\r
+  AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();\r
+  if (mgr->GetMCtruthEventHandler()) return;\r
+\r
+  AliESDEvent *event=fTender->GetEvent();\r
+  if (!event) return;\r
+\r
+  //recalculate TOF signal\r
+  if (fTender->RunChanged()){\r
+    fTOFCalib->Init();\r
+  }\r
+  fTOFCalib->CalibrateESD(event);\r
+\r
+  if(fIsMC) fTOFT0maker->TuneForMC(event);\r
+\r
+  //Calculate event time zero\r
+  fTOFT0maker->ComputeT0TOF(event);\r
+  fTOFT0maker->ApplyT0TOF(event);\r
+\r
+  event->SetT0(0.0);\r
+\r
+  //\r
+  // recalculate PID probabilities\r
+  //\r
+\r
+  Int_t ntracks=event->GetNumberOfTracks();\r
+  for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
+    fESDpid->MakeTOFPID(event->GetTrack(itrack),0);\r
+  }\r
+\r
+}\r
+\r
+\r
diff --git a/ANALYSIS/TenderSupplies/AliTOFTenderSupply.h b/ANALYSIS/TenderSupplies/AliTOFTenderSupply.h
new file mode 100644 (file)
index 0000000..a512657
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef ALITOFTENDERSUPPLY_H\r
+#define ALITOFTENDERSUPPLY_H\r
+\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+////////////////////////////////////////////////////////////////////////\r
+//                                                                    //\r
+//  TPC tender, reapply pid on the fly                                //\r
+//                                                                    //\r
+////////////////////////////////////////////////////////////////////////\r
+\r
+#include <AliTenderSupply.h>\r
+\r
+class AliESDpid;\r
+class AliTOFcalib;\r
+class AliTOFT0maker;\r
+\r
+class AliTOFTenderSupply: public AliTenderSupply {\r
+\r
+public:\r
+  AliTOFTenderSupply();\r
+  AliTOFTenderSupply(const char *name, const AliTender *tender=NULL);\r
+\r
+  virtual ~AliTOFTenderSupply(){;}\r
+\r
+  virtual void              Init();\r
+  virtual void              ProcessEvent();\r
+\r
+  // TOF method\r
+  void SetTOFres(Float_t res){fTOFres=res;}\r
+\r
+private:\r
+  AliESDpid          *fESDpid;         //! ESD pid object\r
+\r
+  Bool_t fIsMC;\r
+\r
+  // variables for TOF calibrations\r
+  AliTOFcalib     *fTOFCalib;    //! recalibrate TOF signal with OCDB\r
+  AliTOFT0maker   *fTOFT0maker;     //! TOF maker objects (apply all the correction for T0)\r
+\r
+  Float_t fTOFres;                   // TOF resolution\r
+\r
+  AliTOFTenderSupply(const AliTOFTenderSupply&c);\r
+  AliTOFTenderSupply& operator= (const AliTOFTenderSupply&c);\r
+\r
+  ClassDef(AliTOFTenderSupply, 1);\r
+};\r
+\r
+\r
+#endif \r