]>
Commit | Line | Data |
---|---|---|
c43e2d89 | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /* | |
18 | // Load libraries | |
19 | gSystem->Load("libANALYSIS"); | |
20 | gSystem->Load("libTPCcalib"); | |
21 | ||
22 | ||
23 | .x ~/NimStyle.C | |
24 | gSystem->Load("libANALYSIS"); | |
25 | gSystem->Load("libTPCcalib"); | |
26 | ||
27 | TFile f("CalibObjects.root"); | |
28 | AliTPCcalibTrigger *calibTrigger = (AliTPCcalibTrigger *)f->Get("TPCCalib")->FindObject("calibTrigger"); | |
29 | ||
30 | ||
31 | */ | |
32 | ||
33 | #include "Riostream.h" | |
34 | #include "TChain.h" | |
35 | #include "TTree.h" | |
36 | #include "TH1F.h" | |
37 | #include "TH2F.h" | |
38 | #include "TH3F.h" | |
39 | #include "THnSparse.h" | |
40 | #include "TList.h" | |
41 | #include "TMath.h" | |
42 | #include "TCanvas.h" | |
43 | #include "TFile.h" | |
44 | #include "TF1.h" | |
45 | #include "TVectorD.h" | |
46 | #include "TProfile.h" | |
47 | #include "TGraphErrors.h" | |
48 | #include "TCanvas.h" | |
49 | ||
50 | #include "AliTPCclusterMI.h" | |
51 | #include "AliTPCseed.h" | |
52 | #include "AliESDVertex.h" | |
53 | #include "AliESDEvent.h" | |
54 | #include "AliESDfriend.h" | |
55 | #include "AliESDInputHandler.h" | |
56 | #include "AliAnalysisManager.h" | |
57 | ||
58 | #include "AliTracker.h" | |
59 | #include "AliMagF.h" | |
60 | #include "AliTPCCalROC.h" | |
61 | ||
62 | #include "AliLog.h" | |
63 | ||
64 | #include "AliTPCcalibTrigger.h" | |
65 | ||
66 | #include "TTreeStream.h" | |
67 | #include "AliTPCTracklet.h" | |
68 | #include "TTimeStamp.h" | |
69 | #include "AliTPCcalibDB.h" | |
70 | #include "AliTPCcalibLaser.h" | |
71 | #include "AliDCSSensorArray.h" | |
72 | #include "AliDCSSensor.h" | |
73 | ||
74 | ClassImp(AliTPCcalibTrigger) | |
75 | ||
76 | AliTPCcalibTrigger::AliTPCcalibTrigger(): | |
77 | AliTPCcalibBase("calibTrigger","calibTrigger"), | |
78 | fHisMap(0) | |
79 | { | |
80 | ||
81 | } | |
82 | ||
83 | AliTPCcalibTrigger::AliTPCcalibTrigger(const char * name, const char * title): | |
84 | AliTPCcalibBase(name,title), | |
85 | fHisMap(0) | |
86 | { | |
87 | // | |
88 | // | |
89 | // | |
90 | fHisMap = new TMap; | |
91 | } | |
92 | ||
93 | Long64_t AliTPCcalibTrigger::Merge(TCollection *li) { | |
94 | // | |
95 | // Merge histograms | |
96 | // | |
97 | TIterator* iter = li->MakeIterator(); | |
98 | AliTPCcalibTrigger* cal = 0; | |
99 | ||
100 | while ((cal = (AliTPCcalibTrigger*)iter->Next())) { | |
101 | if (!cal->InheritsFrom(AliTPCcalibTrigger::Class())) { | |
102 | Error("Merge","Attempt to add object of class %s to a %s", cal->ClassName(), this->ClassName()); | |
103 | return -1; | |
104 | } | |
105 | TMap * addMap=(cal->fHisMap); | |
106 | if(!addMap) return 0; | |
107 | TIterator* iterator = addMap->MakeIterator(); | |
108 | iterator->Reset(); | |
109 | TPair* addPair=0; | |
110 | while((addPair=(TPair *)(addMap->FindObject(iterator->Next())))){ | |
111 | THnSparse* addHist=dynamic_cast<THnSparseF*>(addPair->Value()); | |
112 | if (!addHist) continue; | |
113 | addHist->Print(); | |
114 | THnSparse* localHist=dynamic_cast<THnSparseF*>(fHisMap->GetValue(addHist->GetName())); | |
115 | if(!localHist){ | |
116 | localHist=MakeHisto(addHist->GetName()); | |
117 | fHisMap->Add(new TObjString(addHist->GetName()),localHist); | |
118 | } | |
119 | localHist->Add(addHist); | |
120 | } | |
121 | } | |
122 | return 0; | |
123 | } | |
124 | ||
125 | ||
126 | ||
127 | void AliTPCcalibTrigger::Process(AliESDEvent *event){ | |
128 | // | |
129 | // | |
130 | // | |
131 | if (!event) return; | |
132 | const TString &trigger = event->GetFiredTriggerClasses(); | |
133 | // | |
134 | if (!GetHisto(trigger.Data())){ | |
135 | AddHisto(trigger.Data(),MakeHisto(trigger.Data())); | |
136 | } | |
137 | if (!GetHisto("all")){ | |
138 | AddHisto("all",MakeHisto("all")); | |
139 | } | |
140 | ||
141 | THnSparse *histoAll = GetHisto("all"); | |
142 | THnSparse *histo = GetHisto(trigger.Data()); | |
143 | Double_t xcont[8]={0,0,0,0,0,0,0,0}; | |
144 | ||
145 | Int_t ntracks = event->GetNumberOfTracks(); | |
146 | xcont[0] = ntracks; | |
147 | // | |
148 | // GetLongest track | |
149 | // | |
150 | AliESDtrack * longest=0; | |
151 | Int_t nclmax=0; | |
152 | for (Int_t itrack=0; itrack<ntracks; itrack++){ | |
153 | AliESDtrack *track=event->GetTrack(itrack); | |
154 | if (!track) continue; | |
155 | if (track->GetTPCNcls()<=nclmax) continue; | |
156 | nclmax = track->GetTPCNcls(); | |
157 | longest= track; | |
158 | } | |
159 | // | |
160 | // get inof of longest track | |
161 | /*TString axisName[8]={ | |
162 | "ntracks", | |
163 | "nclMax", | |
164 | "dcaR", | |
165 | "dcaZ", | |
166 | "alpha", | |
167 | "theta", | |
168 | "pt", | |
169 | "dEdx" | |
170 | }; | |
171 | */ | |
172 | if (longest){ | |
173 | Float_t dca[2]; | |
174 | Double_t pxyz[3]; | |
175 | longest->GetDZ(0.,0.,0.,event->GetMagneticField(),dca); | |
176 | Bool_t status = longest->GetPxPyPz(pxyz); | |
177 | xcont[1]=nclmax; | |
178 | xcont[2]=dca[0]; | |
179 | xcont[3]=dca[1]; | |
180 | xcont[4]=TMath::ATan2(pxyz[1],pxyz[0]); | |
181 | xcont[5]=longest->GetParameter()[3]; | |
182 | xcont[6]=longest->Pt(); | |
183 | xcont[7]=longest->GetTPCsignal(); | |
184 | } | |
185 | // | |
186 | histoAll->Fill(xcont); | |
187 | histo->Fill(xcont); | |
188 | ||
189 | } | |
190 | ||
191 | THnSparse *AliTPCcalibTrigger::MakeHisto(const char* trigger){ | |
192 | // | |
193 | // Make event/track histograms | |
194 | // trigger histo | |
195 | // | |
196 | // ntracks nclMax dcaR dcaZ alpha theta pt dEdx | |
197 | Int_t bins[8] = {50, 20, 20, 20, 18, 25, 25, 25 }; | |
198 | //Int_t bins[8] = {50* 20* 25* 25* 18* 25* 25* 25 }; | |
199 | Double_t xmin[8] = {0., 0, 0, 0, -3.14, -1.5, 0, 0}; | |
200 | Double_t xmax[8] = {50, 160, 150, 250, 3.14, 1.5, 100, 100}; | |
201 | TString axisName[8]={ | |
202 | "ntracks", | |
203 | "nclMax", | |
204 | "dcaR", | |
205 | "dcaZ", | |
206 | "alpha", | |
207 | "theta", | |
208 | "pt", | |
209 | "dEdx" | |
210 | }; | |
211 | TString axisTitle[8]={ | |
212 | "Number of tracks", | |
213 | "N_{cl}", | |
214 | "dca_{R} (cm)", | |
215 | "dca_{z} (cm)", | |
216 | "alpha (mrad)", | |
217 | "theta", | |
218 | "p_{t} (GeV/c)", | |
219 | "dEdx (a.u.)" | |
220 | }; | |
221 | ||
222 | ||
223 | THnSparse *sparse = new THnSparseF(Form("his_%s",trigger), Form("his_%s",trigger), 8, bins, xmin, xmax); | |
224 | for (Int_t iaxis=0; iaxis<8; iaxis++){ | |
225 | sparse->GetAxis(iaxis)->SetName(axisName[iaxis]); | |
226 | sparse->GetAxis(iaxis)->SetTitle(axisTitle[iaxis]); | |
227 | } | |
228 | return sparse; | |
229 | } | |
230 | ||
231 | THnSparse * AliTPCcalibTrigger::GetHisto(const char *trigger) { | |
232 | // | |
233 | // return histogram for given class | |
234 | if (!fHisMap) fHisMap=new TMap; | |
235 | return (THnSparse*) fHisMap->GetValue(trigger); | |
236 | } | |
237 | ||
238 | void AliTPCcalibTrigger::AddHisto(const char *trigger, THnSparse *his) { | |
239 | if (!GetHisto(trigger)) { | |
240 | TObjString *pstr = new TObjString(trigger); | |
241 | fHisMap->Add(pstr,his); | |
242 | } | |
243 | } |