Use abstract inteface for the calibration components using tracks
[u/mrichter/AliRoot.git] / TPC / AliAnaTPCTrackCalib.cxx
CommitLineData
e2b3cee0 1#include "AliAnaTPCTrackCalib.h"\r
2//\r
3// This class is ment as an example of how to get access to the \r
4// clusters associated with reconstructed ESD tracks \r
5//\r
6//\r
7\r
8// ROOT includes\r
9#include <TChain.h>\r
10#include <TMath.h>\r
11\r
12// ALIROOT includes\r
13#include <AliTPCclusterMI.h>\r
14#include <AliTPCcalibTracksCuts.h>\r
15#include <AliTPCClusterParam.h>\r
16\r
17// STL includes\r
18#include <iostream>\r
19\r
20using namespace std;\r
21\r
22ClassImp(AliAnaTPCTrackCalib)\r
23 \r
24//________________________________________________________________________\r
25AliAnaTPCTrackCalib::AliAnaTPCTrackCalib() : \r
26 AliAnaTPCTrackBase(), fNtracks(0), fNClusters(0), fCalibTracks(0)\r
27{\r
28 //\r
29 // Default constructor (should not be used)\r
30 //\r
31}\r
32\r
33//________________________________________________________________________\r
34AliAnaTPCTrackCalib::AliAnaTPCTrackCalib(const char *name) : \r
35 AliAnaTPCTrackBase(name), fNtracks(0), fNClusters(0), fCalibTracks(0)\r
36{\r
37 //\r
38 // Normal constructor\r
39 //\r
40 printf("Normal constructor called with name %s \n", name); \r
41 // Input slot #1 works with a AliTPCCalibTracksCuts\r
42 DefineInput(1, AliTPCcalibTracksCuts::Class());\r
43 // Input slot #2 works with a AliTPCClusterParam\r
44 DefineInput(2, AliTPCClusterParam::Class());\r
45 \r
46 // Output slot #0 writes into a TList\r
47 // DefineOutput(0, TList::Class());\r
48 }\r
49\r
50//________________________________________________________________________\r
51void AliAnaTPCTrackCalib::CreateOutputObjects() \r
52{\r
53 //\r
54 // Connect the output objects\r
55 //\r
56 if(fDebug>0)\r
57 cout << "AliAnaTPCTrackCalib::CreateOutputObjects()" << endl;\r
58\r
59 AliAnaTPCTrackBase::CreateOutputObjects();\r
60 \r
61 // user code to go here\r
62 if (GetInputData(0)) printf("Input slo 0, Class_Name: %s\n", GetInputData(0)->Class_Name());\r
63 \r
64 fNtracks = new TH1I("ntracks","Number of tracks", 100, 0, 400);\r
65 fListOfHists->Add(fNtracks);\r
66 fNClusters = new TH1I("ncluster","Number of clusters",100, 0, 200);\r
67 fListOfHists->Add(fNClusters);\r
68 \r
69 AliTPCcalibTracksCuts *cuts = (AliTPCcalibTracksCuts*)GetInputData(1);\r
70 AliTPCClusterParam *clusterParam = (AliTPCClusterParam*)GetInputData(2);\r
71 if (!cuts) Error("CreateOutputObjects", "No CUTS found in input slot 1");\r
72 else {\r
73 printf("\nCuts found :-) \n");\r
74 cuts->Print();\r
75 }\r
76 if (!clusterParam) Error("CreateOutputObjects", "No CLUSTERPARAM found in input slot 2");\r
77 \r
78/* if ( !fCalibTracks ) {\r
79 OpenFile(0, "RECREATE");*/\r
80 \r
81 fCalibTracks = new AliTPCcalibTracks("calibTracks", "Resolution calibration object for tracks", clusterParam, cuts);\r
82 fListOfHists->Add(fCalibTracks);\r
83}\r
84\r
85\r
86//________________________________________________________________________\r
87Int_t AliAnaTPCTrackCalib::FillTrackHistograms(Int_t nTracks, AliESDtrack* track, AliESDfriendTrack* friendTrack, AliTPCseed* seed) {\r
88 //\r
89 // This is the main method which rejects noise tracks and fills \r
90 // the histograms\r
91 //\r
92\r
93 if(!nTracks || !track || !friendTrack) {\r
94 if (fDebug > 1) AliWarning("WARNING: missing track information in AliAnaTPCTrackCalib");\r
95 return 0;\r
96 }\r
97 if(seed==0) {\r
98 if (fDebug > 1) AliWarning("WARNING: Missing seed in AliAnaTPCTrackCalib");\r
99 return 0;\r
100 }\r
101 \r
102 // calibration components to go here: \r
103 \r
104 if (seed) {\r
105 fNClusters->Fill(seed->GetNumberOfClusters());\r
c32da879 106 fCalibTracks->Process(seed); // analysis is done in fCalibTracks\r
e2b3cee0 107 }\r
108 \r
109 return 1;\r
110} \r
111\r