]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/TenderSupplies/AliTOFTenderSupply.cxx
patch to fix wrong initialization of TOFcalib object
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AliTOFTenderSupply.cxx
CommitLineData
6ba6e918 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16\r
17///////////////////////////////////////////////////////////////////////////////\r
18// //\r
19// TOF tender: reapply TOF pid on the fly //\r
20// //\r
21///////////////////////////////////////////////////////////////////////////////\r
22#include <AliLog.h>\r
23#include <AliESDEvent.h>\r
24#include <AliESDInputHandler.h>\r
25#include <AliAnalysisManager.h>\r
26#include <AliESDpid.h>\r
27#include <AliTender.h>\r
28\r
29#include "AliTOFcalib.h"\r
30#include "AliTOFT0maker.h"\r
31\r
32#include "AliTOFTenderSupply.h"\r
33\r
34\r
35AliTOFTenderSupply::AliTOFTenderSupply() :\r
36 AliTenderSupply(),\r
37 fESDpid(0x0),\r
bac58b2a 38 fIsMC(kFALSE),\r
6ba6e918 39 fTOFCalib(0x0),\r
40 fTOFT0maker(0x0),\r
bac58b2a 41 fTOFres(100.)\r
6ba6e918 42{\r
43 //\r
44 // default ctor\r
45 //\r
46}\r
47\r
48//_____________________________________________________\r
49AliTOFTenderSupply::AliTOFTenderSupply(const char *name, const AliTender *tender) :\r
50 AliTenderSupply(name,tender),\r
51 fESDpid(0x0),\r
bac58b2a 52 fIsMC(kFALSE),\r
6ba6e918 53 fTOFCalib(0x0),\r
54 fTOFT0maker(0x0),\r
bac58b2a 55 fTOFres(100.)\r
6ba6e918 56{\r
57 //\r
58 // named ctor\r
59 //\r
60}\r
61\r
62//_____________________________________________________\r
63void AliTOFTenderSupply::Init()\r
64{\r
65 //\r
66 // Initialise TOF tender\r
67 //\r
68\r
69\r
70 //\r
71 // Setup PID object\r
72 //\r
73\r
74 // Check if another detector already created the esd pid object\r
75 // if not we create it and set it to the ESD input handler\r
76 fESDpid=fTender->GetESDhandler()->GetESDpid();\r
77 if (!fESDpid) {\r
78 fESDpid=new AliESDpid;\r
79 fTender->GetESDhandler()->SetESDpid(fESDpid);\r
80 }\r
81\r
82 //Set proper resolution in case of MC\r
83 AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();\r
84 if (mgr->GetMCtruthEventHandler()) fIsMC=kTRUE;\r
85\r
86\r
87 //\r
88 // Create TOF calibration classes\r
89 //\r
90 if (!fTOFCalib){\r
91 fTOFCalib=new AliTOFcalib();\r
92 fTOFCalib->SetCorrectTExp(kTRUE); // apply a fine tuning on the expected times at low momenta\r
93 if(fIsMC) fTOFCalib->SetCalibrateTOFsignal(kFALSE); // no new calibration\r
c5b1d265 94// fTOFCalib->Init();\r
6ba6e918 95 }\r
96 if (!fTOFT0maker) {\r
97 fTOFT0maker = new AliTOFT0maker(fESDpid,fTOFCalib);\r
98 fTOFT0maker->SetTimeResolution(fTOFres); // set TOF resolution for the PID\r
99 }\r
100}\r
101\r
102//_____________________________________________________\r
103void AliTOFTenderSupply::ProcessEvent()\r
104{\r
105 //\r
106 // Reapply pid information\r
107 //\r
108\r
109 //no corrections for MC\r
110 AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();\r
111 if (mgr->GetMCtruthEventHandler()) return;\r
112\r
113 AliESDEvent *event=fTender->GetEvent();\r
114 if (!event) return;\r
115\r
116 //recalculate TOF signal\r
117 if (fTender->RunChanged()){\r
bac58b2a 118 fTOFCalib->Init(fTender->GetRun());\r
6ba6e918 119 }\r
120 fTOFCalib->CalibrateESD(event);\r
121\r
122 if(fIsMC) fTOFT0maker->TuneForMC(event);\r
123\r
124 //Calculate event time zero\r
125 fTOFT0maker->ComputeT0TOF(event);\r
126 fTOFT0maker->ApplyT0TOF(event);\r
127\r
128 event->SetT0(0.0);\r
129\r
130 //\r
131 // recalculate PID probabilities\r
132 //\r
133\r
134 Int_t ntracks=event->GetNumberOfTracks();\r
135 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
136 fESDpid->MakeTOFPID(event->GetTrack(itrack),0);\r
137 }\r
138\r
139}\r
140\r
141\r