Update of calibration code (Raphaelle)
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibTask.cxx
CommitLineData
98937691 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//
19// AliTRDCalibTask
20//
21// Offline TRD calibration task
22//
23// Author:
24// R. Bailhache (R.Bailhache@gsi.de)
25//
26//////////////////////////////////////////////////////////////////////////////////////
27
01239968 28#include <iostream>
29using namespace std;
98937691 30#include "Riostream.h"
31#include "TChain.h"
32#include "TTree.h"
33#include "TFile.h"
34#include "TProfile2D.h"
35#include "TH2I.h"
36#include "TH1F.h"
37#include "TH2F.h"
38#include "TList.h"
39#include "TMath.h"
40#include "TObject.h"
41#include "TObjArray.h"
42#include "TString.h"
43#include "TCanvas.h"
44#include "TLegend.h"
45#include "TStyle.h"
46#include "TLine.h"
57185ead 47#include "TIterator.h"
98937691 48
49#include "AliAnalysisTask.h"
50#include "AliAnalysisManager.h"
51
52#include "AliESDVertex.h"
53#include "AliESDEvent.h"
54#include "AliESDfriend.h"
55#include "AliESDInputHandler.h"
56#include "AliESDtrack.h"
57#include "AliESDfriendTrack.h"
58#include "AliTRDtrackV1.h"
59#include "AliTRDseedV1.h"
60#include "AliTRDcluster.h"
61#include "AliTRDgeometry.h"
62#include "AliESDtrackCuts.h"
63#include "AliESDVertex.h"
64#include "AliTRDCalDet.h"
65
57185ead 66#include "AliTRDCalibraVector.h"
98937691 67#include "AliTRDCalibraFillHisto.h"
68#include "AliTRDCalibraVdriftLinearFit.h"
69
70#include "AliTRDcalibDB.h"
71
72
73#include "AliTRDCalibTask.h"
74
75
76ClassImp(AliTRDCalibTask)
77
78//________________________________________________________________________
79 AliTRDCalibTask::AliTRDCalibTask(const char *name)
01239968 80 : AliAnalysisTaskSE(name), fESD(0),
98937691 81 fESDfriend(0),
82 fkEsdTrack(0),
83 fFriendTrack(0),
84 fCalibObject(0),
85 fTrdTrack(0),
86 fCl(0),
87 fListHist(0),
88 fTRDCalibraFillHisto(0),
89 fNEvents(0),
90 fNbTRDTrack(0),
91 fNbTRDTrackOffline(0),
92 fNbTRDTrackStandalone(0),
93 fNbTPCTRDtrack(0),
94 fNbTimeBin(0),
95 fNbTimeBinOffline(0),
96 fNbTimeBinStandalone(0),
97 fNbClusters(0),
98 fNbClustersOffline(0),
99 fNbClustersStandalone(0),
100 fNbTracklets(0),
101 fNbTrackletsOffline(0),
102 fNbTrackletsStandalone(0),
103 fAbsoluteGain(0),
104 fCH2dSum(0),
105 fPH2dSum(0),
106 fCH2dSM(0),
107 fPH2dSM(0),
108 fHisto2d(kTRUE),
109 fVector2d(kFALSE),
110 fVdriftLinear(kTRUE),
111 fNbTimeBins(0),
112 fSelectedTrigger(new TObjArray()),
113 fRejected(kTRUE),
114 fEsdTrackCuts(0),
115 fRequirePrimaryVertex(kFALSE),
116 fVtxTPC(kFALSE),
117 fVtxSPD(kFALSE),
118 fMinNbContributors(0),
119 fRangePrimaryVertexZ(9999999.0),
120 fLow(0),
121 fHigh(30),
122 fFillZero(kFALSE),
123 fNormalizeNbOfCluster(kFALSE),
124 fRelativeScale(0.0),
125 fMaxCluster(100.0),
126 fNbMaxCluster(2),
127 fOfflineTracks(kFALSE),
128 fStandaloneTracks(kFALSE),
129 fCalDetGain(0x0),
130 fMaxEvent(0),
131 fCounter(0),
132 fDebug(0)
133{
134 //
135 // Default constructor
136 //
137
138 fNz[0] = 0;
139 fNz[1] = 0;
140 fNz[2] = 0;
141
142 fNrphi[0] = 0;
143 fNrphi[1] = 0;
144 fNrphi[2] = 0;
145
146 // Define input and output slots here
147 // Input slot #0 works with a TChain
148 DefineInput(0, TChain::Class());
149
150 // Output slot #0 writes into a TList container
01239968 151 DefineOutput(1, TList::Class());
98937691 152
153
154}
155//____________________________________________________________________________________
156AliTRDCalibTask::~AliTRDCalibTask()
157{
158 //
159 // AliTRDCalibTask destructor
160 //
161
162 // Pointeur
163 if(fNEvents) delete fNEvents;
164 if(fNbTRDTrack) delete fNbTRDTrack;
165 if(fNbTRDTrackOffline) delete fNbTRDTrackOffline;
166 if(fNbTRDTrackStandalone) delete fNbTRDTrackStandalone;
167 if(fNbTPCTRDtrack) delete fNbTPCTRDtrack;
168 if(fNbTimeBin) delete fNbTimeBin;
169 if(fNbTimeBinOffline) delete fNbTimeBinOffline;
170 if(fNbTimeBinStandalone) delete fNbTimeBinStandalone;
171 if(fNbClusters) delete fNbClusters;
172 if(fNbClustersOffline) delete fNbClustersOffline;
173 if(fNbClustersStandalone) delete fNbClustersStandalone;
174 if(fNbTracklets) delete fNbTracklets;
175 if(fNbTrackletsOffline) delete fNbTrackletsOffline;
176 if(fNbTrackletsStandalone) delete fNbTrackletsStandalone;
177 if(fAbsoluteGain) delete fAbsoluteGain;
178 if(fCH2dSum) delete fCH2dSum;
179 if(fPH2dSum) delete fPH2dSum;
180 if(fCH2dSM) delete fCH2dSM;
181 if(fPH2dSM) delete fPH2dSM;
182 if(fCalDetGain) delete fCalDetGain;
183
184 if(fSelectedTrigger) {
185 fSelectedTrigger->Delete();
186 delete fSelectedTrigger;
187 }
188 if(fEsdTrackCuts) {
189 delete fEsdTrackCuts;
190 }
191
192}
01239968 193
194/*
98937691 195//________________________________________________________________________
196void AliTRDCalibTask::ConnectInputData(Option_t *)
197{
198 // Connect ESD or AOD here
01239968 199 // Called once per event
98937691 200
01239968 201 cout << "AliTRDCalibTask::ConnectInputData() IN" << endl;
202
203
204 // TTree* tree = dynamic_cast<TTree*> (GetInputData(0)); //pointer wird "umgecastet" auf anderen Variablentyp
205 // if (!tree) {
98937691 206 //Printf("ERROR: Could not read chain from input slot 0");
01239968 207 // } else {
98937691 208
01239968 209 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
210
211 if (!esdH) {
212 //Printf("ERROR: Could not get ESDInputHandler");
213 } else {
214 fESD = esdH->GetEvent();
215 // esdH->SetActiveBranches("ESDfriend*");
216 if ((esdH->GetTree())->GetBranch("ESDfriend.")) fESDfriend = esdH->GetESDfriend();
217 //else printf("No friend ESD\n");
218 //Printf("*** CONNECTED NEW EVENT ****");
98937691 219 }
01239968 220
221
222 // }
223 //cout << "AliTRDCalibTask::ConnectInputData() OUT" << endl;
224
98937691 225}
01239968 226*/
227
98937691 228//________________________________________________________________________
01239968 229void AliTRDCalibTask::UserCreateOutputObjects()
98937691 230{
231 //
232 // Create the histos
233 //
01239968 234 //cout << "AliTRDCalibTask::CreateOutputObjects() IN" << endl;
98937691 235
236 // Number of time bins
237 if(fNbTimeBins==0) {
238 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
239 fNbTimeBins = cal->GetNumberOfTimeBinsDCS();
240 if(fNbTimeBins <= 0){
241 AliWarning(Form("No of TimeBins from DB [%d] use default [30]", fNbTimeBins));
242 fNbTimeBins = 30;
243 }
244 }
245
246 // instance calibration
247 fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
248 fTRDCalibraFillHisto->SetHisto2d(fHisto2d); // choose to use histograms
249 fTRDCalibraFillHisto->SetVector2d(fVector2d); // choose to use vectors
250 fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
251 fTRDCalibraFillHisto->SetPH2dOn(); // choose to calibrate the drift velocity
252 fTRDCalibraFillHisto->SetPRF2dOn(); // choose to look at the PRF
253 fTRDCalibraFillHisto->SetLinearFitterOn(fVdriftLinear); // Other possibility vdrift VDRIFT
254 fTRDCalibraFillHisto->SetLinearFitterDebugOn(fVdriftLinear); // Other possibility vdrift
255 for(Int_t k = 0; k < 3; k++){
256 if(((fNz[k] != 10) && (fNrphi[k] != 10)) && ((fNz[k] != 100) && (fNrphi[k] != 100))) {
257 fTRDCalibraFillHisto->SetNz(k,fNz[k]); // Mode calibration
258 fTRDCalibraFillHisto->SetNrphi(k,fNrphi[k]); // Mode calibration
259 }
260 else {
261 if((fNz[k] == 100) && (fNrphi[k] == 100)) {
262 if(fVector2d) AliInfo("The mode all together is not supported by the vector method");
263 fTRDCalibraFillHisto->SetAllTogether(k);
264 }
265 if((fNz[k] == 10) && (fNrphi[k] == 10)) {
266 if(fVector2d) AliInfo("The mode per supermodule is not supported by the vector method");
267 fTRDCalibraFillHisto->SetPerSuperModule(k);
268 }
269 }
270 }
271 // Variables for how to fill
272 fTRDCalibraFillHisto->SetFillWithZero(fFillZero);
273 fTRDCalibraFillHisto->SetNormalizeNbOfCluster(fNormalizeNbOfCluster);
274 fTRDCalibraFillHisto->SetMaxCluster(fMaxCluster);
275 fTRDCalibraFillHisto->SetNbMaxCluster(fNbMaxCluster);
276
277 // Init with 30 timebins
278 fTRDCalibraFillHisto->Init2Dhistos(fNbTimeBins); // initialise the histos
279 fTRDCalibraFillHisto->SetNumberClusters(fLow); // At least 11 clusters
280 fTRDCalibraFillHisto->SetNumberClustersf(fHigh); // At least 11 clusters
281 fRelativeScale = fTRDCalibraFillHisto->GetRelativeScale(); // Get the relative scale for the gain
282
283 // For testing only
284 if(fDebug > 2) fTRDCalibraFillHisto->SetDebugLevel(1); //debug stuff
285
286 // output list
287 fListHist = new TList();
288 if(fHisto2d) {
289 fListHist->Add(fTRDCalibraFillHisto->GetCH2d());
290 fListHist->Add(fTRDCalibraFillHisto->GetPH2d());
291 fListHist->Add(fTRDCalibraFillHisto->GetPRF2d());
292 }
293 if(fVdriftLinear) fListHist->Add((TObject *) fTRDCalibraFillHisto->GetVdriftLinearFit());
294 if(fVector2d) fListHist->Add((TObject *) fTRDCalibraFillHisto->GetCalibraVector()); //calibra vector
295 fNEvents = new TH1I("NEvents","NEvents", 2, 0, 2);
296 fListHist->Add(fNEvents);
297
298 // absolute gain calibration even without AliESDfriend
299 Int_t nBinsPt = 25;
300 Double_t minPt = 0.001;
301 Double_t maxPt = 10.0;
302
303 Double_t *binLimLogPt = new Double_t[nBinsPt+1];
304 Double_t *binLimPt = new Double_t[nBinsPt+1];
305 for(Int_t i=0; i<=nBinsPt; i++) binLimLogPt[i]=(Double_t)TMath::Log10(minPt) + (TMath::Log10(maxPt)-TMath::Log10(minPt))/nBinsPt*(Double_t)i ;
306 for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
307
308 fAbsoluteGain = new TH2F("AbsoluteGain","AbsoluteGain", 200, 0.0, 700.0, nBinsPt, binLimPt);
309 fAbsoluteGain->SetYTitle("Momentum at TRD");
310 fAbsoluteGain->SetXTitle("charge deposit [a.u]");
311 fAbsoluteGain->SetZTitle("counts");
312 fAbsoluteGain->SetStats(0);
313 fAbsoluteGain->Sumw2();
314 fListHist->Add(fAbsoluteGain);
315
316
317
318 /////////////////////////////////////////
319 // First debug level
320 ///////////////////////////////////////
321 if(fDebug > 0) {
322
323 // Standart with AliESDfriend
324 fPH2dSM = new TProfile2D("PH2dSM","Nz10Nrphi10"
325 ,fNbTimeBins,-0.05,(Double_t)((fNbTimeBins-0.5)/10.0)
326 ,18,0,18);
327 fPH2dSM->SetYTitle("Det/pad groups");
328 fPH2dSM->SetXTitle("time [#mus]");
329 fPH2dSM->SetZTitle("<PH> [a.u.]");
330 fPH2dSM->SetStats(0);
331 //
332 fCH2dSM = new TH2I("CH2dSM","Nz10Nrphi10",50,0,300,18,0,18);
333 fCH2dSM->SetYTitle("Det/pad groups");
334 fCH2dSM->SetXTitle("charge deposit [a.u]");
335 fCH2dSM->SetZTitle("counts");
336 fCH2dSM->SetStats(0);
337 fCH2dSM->Sumw2();
338 //
339 fPH2dSum = new TProfile2D("PH2dSum","Nz100Nrphi100"
340 ,fNbTimeBins,-0.05,(Double_t)((fNbTimeBins-0.5)/10.0)
341 ,1,0,1);
342 fPH2dSum->SetYTitle("Det/pad groups");
343 fPH2dSum->SetXTitle("time [#mus]");
344 fPH2dSum->SetZTitle("<PH> [a.u.]");
345 fPH2dSum->SetStats(0);
346 //
347 fCH2dSum = new TH2I("CH2dSum","Nz100Nrphi100",50,0,300,1,0,1);
348 fCH2dSum->SetYTitle("Det/pad groups");
349 fCH2dSum->SetXTitle("charge deposit [a.u]");
350 fCH2dSum->SetZTitle("counts");
351 fCH2dSum->SetStats(0);
352 fCH2dSum->Sumw2();
353
354 // Add them
355 fListHist->Add(fPH2dSM);
356 fListHist->Add(fCH2dSM);
357 fListHist->Add(fPH2dSum);
358 fListHist->Add(fCH2dSum);
359 }
360
361 /////////////////////////////////////////
362 // Second debug level
363 ///////////////////////////////////////
364 if(fDebug > 1) {
365
366 fNbTRDTrack = new TH1F("TRDTrack","TRDTrack",50,0,50);
367 fNbTRDTrack->Sumw2();
368 fNbTRDTrackOffline = new TH1F("TRDTrackOffline","TRDTrackOffline",50,0,50);
369 fNbTRDTrackOffline->Sumw2();
370 fNbTRDTrackStandalone = new TH1F("TRDTrackStandalone","TRDTrackStandalone",50,0,50);
371 fNbTRDTrackStandalone->Sumw2();
372 fNbTPCTRDtrack = new TH2F("NbTPCTRDtrack","NbTPCTRDtrack",100,0,100,100,0,100);
373 fNbTPCTRDtrack->Sumw2();
374 //
375 fNbTimeBin = new TH1F("NbTimeBin","NbTimeBin",35,0,35);
376 fNbTimeBin->Sumw2();
377 fNbTimeBinOffline = new TH1F("NbTimeBinOffline","NbTimeBinOffline",35,0,35);
378 fNbTimeBinOffline->Sumw2();
379 fNbTimeBinStandalone = new TH1F("NbTimeBinStandalone","NbTimeBinStandalone",35,0,35);
380 fNbTimeBinStandalone->Sumw2();
381 //
382 fNbClusters = new TH1F("NbClusters","",35,0,35);
383 fNbClusters->Sumw2();
384 fNbClustersOffline = new TH1F("NbClustersOffline","",35,0,35);
385 fNbClustersOffline->Sumw2();
386 fNbClustersStandalone = new TH1F("NbClustersStandalone","",35,0,35);
387 fNbClustersStandalone->Sumw2();
388 //
389 fNbTracklets = new TH1F("NbTracklets","NbTracklets",540,0.,540.);
390 fNbTracklets->Sumw2();
391 fNbTrackletsOffline = new TH1F("NbTrackletsOffline","NbTrackletsOffline",540,0.,540.);
392 fNbTrackletsOffline->Sumw2();
393 fNbTrackletsStandalone = new TH1F("NbTrackletsStandalone","NbTrackletsStandalone",540,0.,540.);
394 fNbTrackletsStandalone->Sumw2();
395
396 fListHist->Add(fNbTRDTrack);
397 fListHist->Add(fNbTRDTrackOffline);
398 fListHist->Add(fNbTRDTrackStandalone);
399 fListHist->Add(fNbTPCTRDtrack);
400
401 fListHist->Add(fNbTimeBin);
402 fListHist->Add(fNbTimeBinOffline);
403 fListHist->Add(fNbTimeBinStandalone);
404 fListHist->Add(fNbClusters);
405 fListHist->Add(fNbClustersOffline);
406 fListHist->Add(fNbClustersStandalone);
407 fListHist->Add(fNbTracklets);
408 fListHist->Add(fNbTrackletsOffline);
409 fListHist->Add(fNbTrackletsStandalone);
410
411 }
01239968 412 //cout << "AliTRDCalibTask::UserCreateOutputObjects() OUT" << endl;
413}
98937691 414
57185ead 415
01239968 416//________________________________________________________________________
417void AliTRDCalibTask::UserExec(Option_t *)
418{
419 //
420 // Filling of the histos
421 //
422 //cout << "AliTRDCalibTask::Exec() IN" << endl;
98937691 423
01239968 424 // AliLog::SetGlobalLogLevel(AliLog::kError);
425 // cout << "AliTRDCalibTask::Exec() 1" << endl;
426 fESD = dynamic_cast<AliESDEvent*>(fInputEvent);
427 if(!fESD){
428 AliError("ESD Event missing");
429 PostData(1, fListHist);
430 return;
431 }
432
433 //printf("Counter %d\n",fCounter);
434
435 fCounter++;
436 //cout << "maxEvent = " << fMaxEvent << endl;
437 //if(fCounter%100==0) cout << "fCounter = " << fCounter << endl;
438 if((fMaxEvent != 0) && (fMaxEvent < fCounter)) return;
439 //if(fCounter%100==0) cout << "fCounter1 = " << fCounter << endl;
440 //cout << "event = " << fCounter << endl;
441
442 //printf("Counter %d\n",fCounter);
443
444 ///////////////////
445 // Check trigger
446 ///////////////////
447 Bool_t pass = kTRUE;
448 Int_t numberOfTriggerSelected = fSelectedTrigger->GetEntriesFast();
449 //printf("numberofTriggerSelected %d\n",numberOfTriggerSelected);
450 if(fRejected) {
451 pass = kTRUE;
452 for(Int_t k = 0; k < numberOfTriggerSelected; k++){
453 const TObjString *const obString=(TObjString*)fSelectedTrigger->At(k);
454 const TString tString=obString->GetString();
455 if(fESD->IsTriggerClassFired((const char*)tString)) {
456 pass = kFALSE;
457 }
458 }
459 }
460 else {
461 pass = kFALSE;
462 for(Int_t k = 0; k < numberOfTriggerSelected; k++){
463 const TObjString *const obString=(TObjString*)fSelectedTrigger->At(k);
464 const TString tString=obString->GetString();
465 if(fESD->IsTriggerClassFired((const char*)tString)) {
466 pass = kTRUE;
467 }
468 }
469 }
470 if(!pass) {
471 PostData(1, fListHist);
472 return;
473 }
474 //printf("Class Fired %s\n",(const char*)fESD->GetFiredTriggerClasses());
475 //printf("Trigger passed\n");
476
477 ///////////////////////////////
478 // Require a primary vertex
479 //////////////////////////////
480 if(fRequirePrimaryVertex) {
481 const AliESDVertex* vtxESD = 0x0;
482 if (fVtxTPC) vtxESD = fESD->GetPrimaryVertexTPC() ;
483 else if (fVtxSPD) vtxESD = fESD->GetPrimaryVertexSPD() ;
484 else vtxESD = fESD->GetPrimaryVertexTracks() ;
485 if(!vtxESD){
486 PostData(1, fListHist);
487 return;
488 }
489 Int_t nCtrb = vtxESD->GetNContributors();
490 if(nCtrb < fMinNbContributors) {
491 PostData(1, fListHist);
492 return;
493 }
494 Double_t zPosition = vtxESD->GetZ();
495 if(TMath::Abs(zPosition) > fRangePrimaryVertexZ) {
496 PostData(1, fListHist);
497 return;
498 }
499
500 }
501
502 //printf("Primary vertex passed\n");
503
504 fNEvents->Fill(1);
505
506 // In total
507 Int_t nbTrdTracks = 0;
508 // standalone
509 Int_t nbTrdTracksStandalone = 0;
510 // offline
511 Int_t nbTrdTracksOffline = 0;
512 // TPC
513 Int_t nbtrackTPC = 0;
514
515 Double_t nbTracks = fESD->GetNumberOfTracks();
516 //printf("Number of tracks %f\n",nbTracks);
517
518 if (nbTracks <= 0.0) {
519
520 if(fDebug > 1) {
521 fNbTRDTrack->Fill(nbTrdTracks);
522 fNbTRDTrackStandalone->Fill(nbTrdTracksStandalone);
523 fNbTRDTrackOffline->Fill(nbTrdTracksOffline);
524 }
525 PostData(1, fListHist);
526 return;
527 }
528
529 fESDfriend = dynamic_cast<AliESDfriend*> (fESD->FindListObject("AliESDfriend"));
530 if(!fESDfriend){
531 AliError("fESDfriend not available");
532 PostData(1, fListHist);
533 return;
534 }
535
536 //printf("has friends\n");
98937691 537
01239968 538 /*
539 ////////////////////////////////////
98937691 540 // Check the number of TPC tracks
541 ///////////////////////////////////
542 //printf("Nb of tracks %f\n",nbTracks);
543 for(Int_t itrk = 0; itrk < nbTracks; itrk++){
544 // Get ESD track
545 fkEsdTrack = fESD->GetTrack(itrk);
546 ULong_t status = fkEsdTrack->GetStatus();
547 if(status&(AliESDtrack::kTPCout)) nbtrackTPC++;
01239968 548 if((status&(AliESDtrack::kTRDout)) && (!(status&(AliESDtrack::kTRDin)))) {
549 nbTrdTracks++;
550 nbTrdTracksStandalone++;
551 }
552 if((status&(AliESDtrack::kTRDin))) {
553 nbTrdTracks++;
554 nbTrdTracksOffline++;
98937691 555 }
556 }
01239968 557
98937691 558 if((nbtrackTPC>0) && (nbTrdTracks > (3.0*nbtrackTPC))) pass = kFALSE;
559
560 if(fDebug > 1) {
561
562 fNbTRDTrack->Fill(nbTrdTracks);
563 fNbTRDTrackStandalone->Fill(nbTrdTracksStandalone);
564 fNbTRDTrackOffline->Fill(nbTrdTracksOffline);
565 fNbTPCTRDtrack->Fill(nbTrdTracks,nbtrackTPC);
566
567 }
568
569 if(!pass) {
01239968 570 PostData(1, fListHist);
98937691 571 return;
572 }
01239968 573 */
574
575 /////////////////////////////////////
576 // Loop on AliESDtrack
577 ////////////////////////////////////
578 //printf("Nb of tracks %f\n",nbTracks);
579 for(int itrk=0; itrk < nbTracks; ++itrk){
98937691 580
01239968 581 // Get ESD track
582 fkEsdTrack = fESD->GetTrack(itrk);
583 if(!fkEsdTrack) continue;
584 ULong_t status = fkEsdTrack->GetStatus();
585 if(status&(AliESDtrack::kTPCout)) ++nbtrackTPC;
586
587 // Quality cuts on the AliESDtrack
588 if((fEsdTrackCuts) && (!fEsdTrackCuts->IsSelected((AliVParticle *)fkEsdTrack))) {
589 //printf("Not a good track\n");
590 continue;
591 }
592
593 // First Absolute gain calibration
594 Int_t trdNTracklets = (Int_t) fkEsdTrack->GetTRDntracklets();
595 Int_t trdNTrackletsPID = (Int_t) fkEsdTrack->GetTRDntrackletsPID();
596 if((trdNTracklets > 0) && (trdNTrackletsPID > 0)) {
597 for(Int_t iPlane = 0; iPlane < 6; ++iPlane){
598 //Double_t slide = fkEsdTrack->GetTRDslice(iPlane);
599 //printf("Number of slide %d\n",fkEsdTrack->GetNumberOfTRDslices());
600 //Double_t momentum = fkEsdTrack->GetTRDmomentum(iPlane);
601 //printf("momentum %f, slide %f\n",momentum,slide);
602 if(fkEsdTrack->GetTRDslice(iPlane) > 0.0)
603 fAbsoluteGain->Fill(fkEsdTrack->GetTRDslice(iPlane)*8.0/100.0,
604 fkEsdTrack->GetTRDmomentum(iPlane));
605 }
606 }
607
608 // Other cuts
609 Bool_t good = kTRUE;
610 Bool_t standalonetrack = kFALSE;
611 Bool_t offlinetrack = kFALSE;
612 //ULong_t status = fkEsdTrack->GetStatus();
613
614 fFriendTrack = fESDfriend->GetTrack(itrk);
615 if(!fFriendTrack) continue;
616 //////////////////////////////////////
617 // Loop on calibration objects
618 //////////////////////////////////////
619 Int_t icalib=0;
620 Int_t nTRDtrackV1=0;
621 while((fCalibObject = (TObject *)(fFriendTrack->GetCalibObject(icalib++)))){
622 if(strcmp(fCalibObject->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
623 //printf("Find the calibration object\n");
624 ++nTRDtrackV1;
625
626 if((status&(AliESDtrack::kTRDout)) && (!(status&(AliESDtrack::kTRDin)))) {
627 standalonetrack = kTRUE;
628 }
629 if((status&(AliESDtrack::kTRDin))) {
630 offlinetrack = kTRUE;
631 }
632 if(fOfflineTracks){
633 if(!offlinetrack){
634 good = kFALSE;
635 }
636 }
637 else if(fStandaloneTracks){
638 if(!standalonetrack){
639 good = kFALSE;
640 }
641 }
642
643 fTrdTrack = (AliTRDtrackV1 *)fCalibObject;
644 if(good) {
645 //cout << "good" << endl;
646 fTRDCalibraFillHisto->UpdateHistogramsV1(fTrdTrack);
647 //printf("Fill fTRDCalibraFillHisto\n");
648 }
649
650 //////////////////////////////////
651 // Debug
652 ////////////////////////////////
653
654 if(fDebug > 0) {
655
656 //printf("Enter debug\n");
657
658 Int_t nbtracklets = 0;
659
660 // Check some stuff
661 Bool_t standalonetracklet = kFALSE;
662 const AliTRDseedV1 *tracklet = 0x0;
663 //////////////////////////////////////
664 // Loop tracklets
665 /////////////////////////////////////
666 Int_t nbclusters=0;
667 Double_t phtb[AliTRDseedV1::kNtb];
668 memset(phtb, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
669 Double_t sum = 0.0;
670 Float_t normalisation = 6.67;
671 Int_t detector = 0;
672 Int_t sector = 0;
673 for(Int_t itr = 0; itr < 6; ++itr){
674
675 if(!(tracklet = fTrdTrack->GetTracklet(itr))) continue;
676 if(!tracklet->IsOK()) continue;
677 ++nbtracklets;
678 standalonetracklet = kFALSE;
679 if(tracklet->IsStandAlone()) standalonetracklet = kTRUE;
680
681 nbclusters = 0;
682 memset(phtb, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
683 sum = 0.0;
684 detector = 0;
685 sector = 0;
686 //Int_t crossrow = 0;
687
688 // Check no shared clusters
689 //for(int icc=AliTRDseedV1::kNtb; icc<AliTRDseedV1::kNclusters; icc++){
690 // if((fcl = tracklet->GetClusters(icc))) crossrow = 1;
691 // }
692
693 // Loop on clusters
694 Int_t time = 0;
695 Float_t ch = 0;
696 Float_t qcl = 0;
697 for(int ic=0; ic<AliTRDseedV1::kNtb; ++ic){
698
699 if(!(fCl = tracklet->GetClusters(ic))) continue;
700 ++nbclusters;
701 time = fCl->GetPadTime();
702 ch = tracklet->GetdQdl(ic);
703 qcl = TMath::Abs(fCl->GetQ());
704 detector = fCl->GetDetector();
705 // Add the charge if shared cluster
706 if((ic+AliTRDseedV1::kNtb) < AliTRDseedV1::kNclusters) {
707 if((fCl = tracklet->GetClusters(ic+AliTRDseedV1::kNtb))) {
708 qcl += TMath::Abs(fCl->GetQ());
709 //printf("Add the cluster charge\n");
710 }
711 }
712 if((time>-1) && (time<fNbTimeBins)) phtb[time]=qcl;
713 if((fCalDetGain) && (fCalDetGain->GetValue(detector) > 0.0)) sum += ch*fCalDetGain->GetValue(detector)/normalisation;
714 else sum += ch/normalisation;
715
716 if(fDebug > 1) {
717 fNbTimeBin->Fill(time);
718 if(tracklet->IsStandAlone()) fNbTimeBinStandalone->Fill(time);
719 else fNbTimeBinOffline->Fill(time);
720 }
721 }
722 sector = AliTRDgeometry::GetSector(detector);
723
724 if(fDebug > 1) {
725 fNbTracklets->Fill(detector);
726 if(tracklet->IsStandAlone()) fNbTrackletsStandalone->Fill(detector);
727 else fNbTrackletsOffline->Fill(detector);
728
729 fNbClusters->Fill(nbclusters);
730 if(tracklet->IsStandAlone()) fNbClustersStandalone->Fill(nbclusters);
731 else fNbClustersOffline->Fill(nbclusters);
732 }
733
734 if(fDebug > 0) {
735 if((nbclusters > fLow) && (nbclusters < fHigh)){
736 if(fRelativeScale > 0.0) sum = sum/fRelativeScale;
737 fCH2dSM->Fill(sum,sector+0.5);
738 fCH2dSum->Fill(sum,0.5);
739 Bool_t checknoise = kTRUE;
740 if(fMaxCluster > 0) {
741 if(phtb[0] > fMaxCluster) checknoise = kFALSE;
742 if(fNbTimeBins > fNbMaxCluster) {
743 for(Int_t k = (fNbTimeBins-fNbMaxCluster); k < fNbTimeBins; k++){
744 if(phtb[k] > fMaxCluster) checknoise = kFALSE;
745 }
746 }
747 }
748 if(checknoise) {
749 for(int ic=0; ic<fNbTimeBins; ic++){
750 if(fFillZero) {
751 fPH2dSum->Fill((Double_t)(ic/10.0),0.5,(Double_t)phtb[ic]);
752 fPH2dSM->Fill((Double_t)(ic/10.0),sector+0.5,(Double_t)phtb[ic]);
753 }
754 else {
755 if(phtb[ic] > 0.0) {
756 fPH2dSum->Fill((Double_t)(ic/10.0),0.0,(Double_t)phtb[ic]);
757 fPH2dSM->Fill((Double_t)(ic/10.0),sector+0.5,(Double_t)phtb[ic]);
758 }
759 }
760 }
761 }
762 }
763 }
764 } // loop on tracklets
765
766 } // debug
767
768 }// while calibration objects
769 if(nTRDtrackV1 > 0) {
770 ++nbTrdTracks;
771 if((status&(AliESDtrack::kTRDout)) && (!(status&(AliESDtrack::kTRDin)))) {
772 ++nbTrdTracksStandalone;
773 }
774 if((status&(AliESDtrack::kTRDin))) {
775 ++nbTrdTracksOffline;
776 }
777 }
778 //delete fFriendTrack;
779 } // loop ESD track
780
781 if(fDebug > 1) {
782 fNbTRDTrack->Fill(nbTrdTracks);
783 fNbTRDTrackStandalone->Fill(nbTrdTracksStandalone);
784 fNbTRDTrackOffline->Fill(nbTrdTracksOffline);
785 fNbTPCTRDtrack->Fill(nbTrdTracks,nbtrackTPC);
786 }
787
788 // Post output data
789 PostData(1, fListHist);
790 //cout << "AliTRDCalibTask::Exec() OUT" << endl;
791}
98937691 792
98937691 793//________________________________________________________________________
794void AliTRDCalibTask::Terminate(Option_t *)
795{
796 //
797 // Terminate
798 //
799
800 if(fTRDCalibraFillHisto) fTRDCalibraFillHisto->DestroyDebugStreamer();
801
802
803}
804//_______________________________________________________
805Bool_t AliTRDCalibTask::Load(const Char_t *filename)
806{
807 //
808 // Generic container loader
809 //
810
811 if(!TFile::Open(filename)){
812 //AliWarning(Form("Couldn't open file %s.", filename));
813 return kFALSE;
814 }
815 TList *o = 0x0;
816 if(!(o = (TList*)gFile->Get(GetName()))){
817 //AliWarning("Missing histogram container.");
818 return kFALSE;
819 }
820 fListHist = (TList*)o->Clone(GetName());
821 gFile->Close();
822 return kTRUE;
823}
57185ead 824//_______________________________________________________
825Bool_t AliTRDCalibTask::Load(TList *lister)
826{
827 //
828 // Generic container loader
829 //
830
831 fListHist = (TList*)lister->Clone(GetName());
832 return kTRUE;
833}
98937691 834//________________________________________________________________________
835void AliTRDCalibTask::Plot()
836{
837 //
838 // Plot the histos stored in the TList
839 //
840
841 if(!fListHist) return;
842
843 /////////////////////////////////////
844 // Take the debug stuff
845 /////////////////////////////////////
846
847 TH1I *nEvents = (TH1I *) fListHist->FindObject("NEvents");
848
849 TH2F *absoluteGain = (TH2F *) fListHist->FindObject("AbsoluteGain");
850
851 TH1F *trdTrack = (TH1F *) fListHist->FindObject("TRDTrack");
852 TH1F *trdTrackOffline = (TH1F *) fListHist->FindObject("TRDTrackOffline");
853 TH1F *trdTrackStandalone = (TH1F *) fListHist->FindObject("TRDTrackStandalone");
854
855 TH2F *tpctrdTrack = (TH2F *) fListHist->FindObject("NbTPCTRDtrack");
856
857 TH1F *nbTimeBin = (TH1F *) fListHist->FindObject("NbTimeBin");
858 TH1F *nbTimeBinOffline = (TH1F *) fListHist->FindObject("NbTimeBinOffline");
859 TH1F *nbTimeBinStandalone = (TH1F *) fListHist->FindObject("NbTimeBinStandalone");
860
861 TH1F *nbClusters = (TH1F *) fListHist->FindObject("NbClusters");
862 TH1F *nbClustersOffline = (TH1F *) fListHist->FindObject("NbClustersOffline");
863 TH1F *nbClustersStandalone = (TH1F *) fListHist->FindObject("NbClustersStandalone");
864
865 TH1F *nbTracklets = (TH1F *) fListHist->FindObject("NbTracklets");
866 TH1F *nbTrackletsOffline = (TH1F *) fListHist->FindObject("NbTrackletsOffline");
867 TH1F *nbTrackletsStandalone = (TH1F *) fListHist->FindObject("NbTrackletsStandalone");
868
869 /////////////////////////////////////
870 // Take the calibration objects
871 /////////////////////////////////////
872
873 TH2I *ch2d = (TH2I *) fListHist->FindObject("CH2d");
874 TProfile2D *ph2d = (TProfile2D *) fListHist->FindObject("PH2d");
875
876 TH2I *ch2dSum = (TH2I *) fListHist->FindObject("CH2dSum");
877 TProfile2D *ph2dSum = (TProfile2D *) fListHist->FindObject("PH2dSum");
878
879 TH2I *ch2dSM = (TH2I *) fListHist->FindObject("CH2dSM");
880 TProfile2D *ph2dSM = (TProfile2D *) fListHist->FindObject("PH2dSM");
881
882 AliTRDCalibraVdriftLinearFit *linearfit = (AliTRDCalibraVdriftLinearFit *) fListHist->FindObject("AliTRDCalibraVdriftLinearFit");
883
884 ////////////////////////////////////////////////
885 // Add the AliTRDCalibraVdriftLinearFit
886 ///////////////////////////////////////////////
887
888 Int_t first = 0;
889 TH2S *histolinearfitsum = 0x0;
890
891 if(linearfit) {
892 for(Int_t det = 0; det < 540; det++) {
893 if(linearfit->GetLinearFitterHisto(det)){
894 if(TMath::Abs(first)<0.0001){
895 histolinearfitsum = linearfit->GetLinearFitterHisto(det);
896 first += 1;
897 }
898 else {
899 histolinearfitsum ->Add(linearfit->GetLinearFitterHisto(det));
900 }
901 }
902 }
903 }
904
905 ///////////////////////////
906 // Style
907 //////////////////////////
908
909 gStyle->SetPalette(1);
910 gStyle->SetOptStat(1111);
911 gStyle->SetOptFit(1111);
912 gStyle->SetPadBorderMode(0);
913 gStyle->SetCanvasColor(10);
914 gStyle->SetPadLeftMargin(0.13);
915 gStyle->SetPadRightMargin(0.13);
916
917 /////////////////////////
918 // Plot
919 ////////////////////////
920
921 if(nEvents) {
922
923 TCanvas *debugEvents = new TCanvas("cNEvents","cNEvents",10,10,510,510);
924 debugEvents->cd(1);
925 if(nEvents) nEvents->Draw();
926
927 }
928
929 if(absoluteGain) {
930
931 TCanvas *debugAbsoluteGain = new TCanvas("cAbsoluteGain","cAbsoluteGain",10,10,510,510);
932 debugAbsoluteGain->cd(1);
933 if(absoluteGain) absoluteGain->Draw();
934
935 }
936
937 if(trdTrack || tpctrdTrack) {
938
939 TCanvas *debugtrdtpcTrack = new TCanvas("TRDtracktpctrdtrack","TRDtracktpctrdtrack",10,10,510,510);
940 debugtrdtpcTrack->Divide(2,1);
941 debugtrdtpcTrack->cd(1);
942 if(trdTrack) trdTrack->Draw();
943 if(trdTrackOffline) trdTrackOffline->Draw("same");
944 if(trdTrackStandalone) trdTrackStandalone->Draw("same");
945 TLegend *leg = new TLegend(0.4,0.6,0.89,0.89);
946 if(trdTrack) leg->AddEntry(trdTrack,"All","p");
947 if(trdTrackOffline) leg->AddEntry(trdTrackOffline,"Offline","p");
948 if(trdTrackStandalone) leg->AddEntry(trdTrackStandalone,"Standalone","p");
949 leg->Draw("same");
950 debugtrdtpcTrack->cd(2);
951 if(tpctrdTrack) tpctrdTrack->Draw();
952 TLine *line = new TLine(0.0,0.0,100.0,100.0);
953 line->Draw("same");
954
955 }
956
957 if(nbTimeBin || nbTracklets || nbClusters) {
958
959 TCanvas *debugTracklets = new TCanvas("TRDtimebintrackletcluster","TRDtimebintrackletcluster",10,10,510,510);
960 debugTracklets->Divide(3,1);
961 debugTracklets->cd(1);
962 if(nbTimeBin) nbTimeBin->Draw();
963 if(nbTimeBinOffline) nbTimeBinOffline->Draw("same");
964 if(nbTimeBinStandalone) nbTimeBinStandalone->Draw("same");
965 TLegend *lega = new TLegend(0.4,0.6,0.89,0.89);
966 if(nbTimeBin) lega->AddEntry(nbTimeBin,"All","p");
967 if(nbTimeBinOffline) lega->AddEntry(nbTimeBinOffline,"Offline","p");
968 if(nbTimeBinStandalone) lega->AddEntry(nbTimeBinStandalone,"Standalone","p");
969 lega->Draw("same");
970 debugTracklets->cd(2);
971 if(nbTracklets) nbTracklets->Draw();
972 if(nbTrackletsOffline) nbTrackletsOffline->Draw("same");
973 if(nbTrackletsStandalone) nbTrackletsStandalone->Draw("same");
974 TLegend *legb = new TLegend(0.4,0.6,0.89,0.89);
975 if(nbTracklets) legb->AddEntry(nbTracklets,"All","p");
976 if(nbTrackletsOffline) legb->AddEntry(nbTrackletsOffline,"Offline","p");
977 if(nbTrackletsStandalone) legb->AddEntry(nbTrackletsStandalone,"Standalone","p");
978 legb->Draw("same");
979 debugTracklets->cd(3);
980 if(nbClusters) nbClusters->Draw();
981 if(nbClustersOffline) nbClustersOffline->Draw("same");
982 if(nbClustersStandalone) nbClustersStandalone->Draw("same");
983 TLegend *legc = new TLegend(0.4,0.6,0.89,0.89);
984 if(nbClusters) legc->AddEntry(nbClusters,"All","p");
985 if(nbClustersOffline) legc->AddEntry(nbClustersOffline,"Offline","p");
986 if(nbClustersStandalone) legc->AddEntry(nbClustersStandalone,"Standalone","p");
987 legc->Draw("same");
988
989 }
990
991 if(ch2dSum || ph2dSum || histolinearfitsum) {
992
993 TCanvas *debugSum = new TCanvas("SumCalibrationObjects","SumCalibrationObjects",10,10,510,510);
994 debugSum->Divide(3,1);
995 debugSum->cd(1);
996 if(ch2dSum) ch2dSum->Draw("lego");
997 debugSum->cd(2);
998 if(ph2dSum) ph2dSum->Draw("lego");
999 debugSum->cd(3);
1000 if(histolinearfitsum) histolinearfitsum->Draw();
1001
1002 }
1003
1004 if(ch2dSM || ph2dSM) {
1005
1006 TCanvas *debugSM = new TCanvas("SMCalibrationObjects","SMCalibrationObjects",10,10,510,510);
1007 debugSM->Divide(2,1);
1008 debugSM->cd(1);
1009 if(ch2dSM) ch2dSM->Draw("lego");
1010 debugSM->cd(2);
1011 if(ph2dSM) ph2dSM->Draw("lego");
1012
1013 }
1014
1015 if(ch2d || ph2d) {
1016
1017 TCanvas *debug = new TCanvas("CalibrationObjects","CalibrationObjects",10,10,510,510);
1018 debug->Divide(2,1);
1019 debug->cd(1);
1020 if(ch2d) ch2d->Draw("lego");
1021 debug->cd(2);
1022 if(ph2d) ph2d->Draw("lego");
1023
1024 }
1025
21185a48 1026}
57185ead 1027//_______________________________________________________________________________________
1028void AliTRDCalibTask::AddTask(const AliTRDCalibTask * calibTask) {
1029
1030 //
1031 // Add stats
1032 //
1033
1034 TList *listcalibTask = calibTask->GetList();
1035 if(!listcalibTask) return;
1036
1037 TH1I *nEvents = (TH1I *) listcalibTask->FindObject("NEvents");
1038 TH2F *absoluteGain = (TH2F *) listcalibTask->FindObject("AbsoluteGain");
1039
1040 TH1F *trdTrack = (TH1F *) listcalibTask->FindObject("TRDTrack");
1041 TH1F *trdTrackOffline = (TH1F *) listcalibTask->FindObject("TRDTrackOffline");
1042 TH1F *trdTrackStandalone = (TH1F *) listcalibTask->FindObject("TRDTrackStandalone");
1043
1044 TH2F *tpctrdTrack = (TH2F *) listcalibTask->FindObject("NbTPCTRDtrack");
1045
1046 TH1F *nbTimeBin = (TH1F *) listcalibTask->FindObject("NbTimeBin");
1047 TH1F *nbTimeBinOffline = (TH1F *) listcalibTask->FindObject("NbTimeBinOffline");
1048 TH1F *nbTimeBinStandalone = (TH1F *) listcalibTask->FindObject("NbTimeBinStandalone");
1049
1050 TH1F *nbClusters = (TH1F *) listcalibTask->FindObject("NbClusters");
1051 TH1F *nbClustersOffline = (TH1F *) listcalibTask->FindObject("NbClustersOffline");
1052 TH1F *nbClustersStandalone = (TH1F *) listcalibTask->FindObject("NbClustersStandalone");
1053
1054 TH1F *nbTracklets = (TH1F *) listcalibTask->FindObject("NbTracklets");
1055 TH1F *nbTrackletsOffline = (TH1F *) listcalibTask->FindObject("NbTrackletsOffline");
1056 TH1F *nbTrackletsStandalone = (TH1F *) listcalibTask->FindObject("NbTrackletsStandalone");
1057
1058 TH2I *ch2d = (TH2I *) listcalibTask->FindObject("CH2d");
1059 TProfile2D *ph2d = (TProfile2D *) listcalibTask->FindObject("PH2d");
1060 TProfile2D *prf2d = (TProfile2D *) listcalibTask->FindObject("PRF2d");
1061
1062 TH2I *ch2dSum = (TH2I *) listcalibTask->FindObject("CH2dSum");
1063 TProfile2D *ph2dSum = (TProfile2D *) listcalibTask->FindObject("PH2dSum");
1064
1065 TH2I *ch2dSM = (TH2I *) listcalibTask->FindObject("CH2dSM");
1066 TProfile2D *ph2dSM = (TProfile2D *) listcalibTask->FindObject("PH2dSM");
1067
1068 AliTRDCalibraVdriftLinearFit *linearfit = (AliTRDCalibraVdriftLinearFit *) listcalibTask->FindObject("AliTRDCalibraVdriftLinearFit");
1069 AliTRDCalibraVector *calibraVector = (AliTRDCalibraVector *) listcalibTask->FindObject("AliTRDCalibraVector");
1070
1071 //
1072
1073 TH1I *inEvents = (TH1I *) fListHist->FindObject("NEvents");
1074 TH2F *iabsoluteGain = (TH2F *) fListHist->FindObject("AbsoluteGain");
1075
1076 TH1F *itrdTrack = (TH1F *) fListHist->FindObject("TRDTrack");
1077 TH1F *itrdTrackOffline = (TH1F *) fListHist->FindObject("TRDTrackOffline");
1078 TH1F *itrdTrackStandalone = (TH1F *) fListHist->FindObject("TRDTrackStandalone");
1079
1080 TH2F *itpctrdTrack = (TH2F *) fListHist->FindObject("NbTPCTRDtrack");
21185a48 1081
57185ead 1082 TH1F *inbTimeBin = (TH1F *) fListHist->FindObject("NbTimeBin");
1083 TH1F *inbTimeBinOffline = (TH1F *) fListHist->FindObject("NbTimeBinOffline");
1084 TH1F *inbTimeBinStandalone = (TH1F *) fListHist->FindObject("NbTimeBinStandalone");
1085
1086 TH1F *inbClusters = (TH1F *) fListHist->FindObject("NbClusters");
1087 TH1F *inbClustersOffline = (TH1F *) fListHist->FindObject("NbClustersOffline");
1088 TH1F *inbClustersStandalone = (TH1F *) fListHist->FindObject("NbClustersStandalone");
1089
1090 TH1F *inbTracklets = (TH1F *) fListHist->FindObject("NbTracklets");
1091 TH1F *inbTrackletsOffline = (TH1F *) fListHist->FindObject("NbTrackletsOffline");
1092 TH1F *inbTrackletsStandalone = (TH1F *) fListHist->FindObject("NbTrackletsStandalone");
1093
1094 TH2I *ich2d = (TH2I *) fListHist->FindObject("CH2d");
1095 TProfile2D *iph2d = (TProfile2D *) fListHist->FindObject("PH2d");
1096 TProfile2D *iprf2d = (TProfile2D *) fListHist->FindObject("PRF2d");
1097
1098 TH2I *ich2dSum = (TH2I *) fListHist->FindObject("CH2dSum");
1099 TProfile2D *iph2dSum = (TProfile2D *) fListHist->FindObject("PH2dSum");
1100
1101 TH2I *ich2dSM = (TH2I *) fListHist->FindObject("CH2dSM");
1102 TProfile2D *iph2dSM = (TProfile2D *) fListHist->FindObject("PH2dSM");
1103
1104 AliTRDCalibraVdriftLinearFit *ilinearfit = (AliTRDCalibraVdriftLinearFit *) fListHist->FindObject("AliTRDCalibraVdriftLinearFit");
1105 AliTRDCalibraVector *icalibraVector = (AliTRDCalibraVector *) fListHist->FindObject("AliTRDCalibraVector");
1106
1107
1108 // Add
1109
1110 if(nEvents) {
1111 if(inEvents) {
1112 inEvents->Add(nEvents);
1113 //printf("Add Events\n");
1114 }
1115 else {
1116 //printf("Create new Events\n");
1117 inEvents = new TH1I(*nEvents);
1118 fListHist->Add(inEvents);
1119 }
1120 }
1121
1122 if(absoluteGain) {
1123 if(iabsoluteGain) iabsoluteGain->Add(absoluteGain);
1124 else {
1125 iabsoluteGain = new TH2F(*absoluteGain);
1126 fListHist->Add(iabsoluteGain);
1127 }
1128 }
1129
1130 if(trdTrack) {
1131 if(itrdTrack) itrdTrack->Add(trdTrack);
1132 else {
1133 itrdTrack = new TH1F(*trdTrack);
1134 fListHist->Add(itrdTrack);
1135 }
1136 }
1137
1138 if(trdTrackOffline) {
1139 if(itrdTrackOffline) itrdTrackOffline->Add(trdTrackOffline);
1140 else {
1141 itrdTrackOffline = new TH1F(*trdTrackOffline);
1142 fListHist->Add(itrdTrackOffline);
1143 }
1144 }
1145
1146 if(trdTrackStandalone) {
1147 if(itrdTrackStandalone) itrdTrackStandalone->Add(trdTrackStandalone);
1148 else {
1149 itrdTrackStandalone = new TH1F(*trdTrackStandalone);
1150 fListHist->Add(itrdTrackStandalone);
1151 }
1152 }
1153
1154 if(tpctrdTrack) {
1155 if(itpctrdTrack) itpctrdTrack->Add(tpctrdTrack);
1156 else {
1157 itpctrdTrack = new TH2F(*tpctrdTrack);
1158 fListHist->Add(itpctrdTrack);
1159 }
1160 }
1161
1162 if(nbTimeBin) {
1163 if(inbTimeBin) inbTimeBin->Add(nbTimeBin);
1164 else {
1165 inbTimeBin = new TH1F(*inbTimeBin);
1166 fListHist->Add(inbTimeBin);
1167 }
1168 }
1169
1170 if(nbTimeBinOffline) {
1171 if(inbTimeBinOffline) inbTimeBinOffline->Add(nbTimeBinOffline);
1172 else {
1173 inbTimeBinOffline = new TH1F(*nbTimeBinOffline);
1174 fListHist->Add(inbTimeBinOffline);
1175 }
1176 }
1177
1178 if(nbTimeBinStandalone) {
1179 if(inbTimeBinStandalone) inbTimeBinStandalone->Add(nbTimeBinStandalone);
1180 else {
1181 inbTimeBinStandalone = new TH1F(*nbTimeBinStandalone);
1182 fListHist->Add(inbTimeBinStandalone);
1183 }
1184 }
1185
1186 if(nbClusters) {
1187 if(inbClusters) inbClusters->Add(nbClusters);
1188 else {
1189 inbClusters = new TH1F(*nbClusters);
1190 fListHist->Add(inbClusters);
1191 }
1192 }
1193
1194 if(nbClustersOffline) {
1195 if(inbClustersOffline) inbClustersOffline->Add(nbClustersOffline);
1196 else {
1197 inbClustersOffline = new TH1F(*nbClustersOffline);
1198 fListHist->Add(inbClustersOffline);
1199 }
1200 }
1201
1202 if(nbClustersStandalone) {
1203 if(inbClustersStandalone) inbClustersStandalone->Add(nbClustersStandalone);
1204 else {
1205 inbClustersStandalone = new TH1F(*nbClustersStandalone);
1206 fListHist->Add(inbClustersStandalone);
1207 }
1208 }
1209
1210 if(nbTracklets) {
1211 if(inbTracklets) inbTracklets->Add(nbTracklets);
1212 else {
1213 inbTracklets = new TH1F(*nbTracklets);
1214 fListHist->Add(inbTracklets);
1215 }
1216 }
1217
1218 if(nbTrackletsOffline) {
1219 if(inbTrackletsOffline) inbTrackletsOffline->Add(nbTrackletsOffline);
1220 else {
1221 inbTrackletsOffline = new TH1F(*nbTrackletsOffline);
1222 fListHist->Add(inbTrackletsOffline);
1223 }
1224 }
1225
1226 if(nbTrackletsStandalone) {
1227 if(inbTrackletsStandalone) inbTrackletsStandalone->Add(nbTrackletsStandalone);
1228 else {
1229 inbTrackletsStandalone = new TH1F(*nbTrackletsStandalone);
1230 fListHist->Add(inbTrackletsStandalone);
1231 }
1232 }
1233
1234 if(ch2d) {
1235 if(ich2d) ich2d->Add(ch2d);
1236 else {
1237 ich2d = new TH2I(*ch2d);
1238 fListHist->Add(ich2d);
1239 }
1240 }
1241
1242 if(ph2d) {
1243 if(iph2d) iph2d->Add(ph2d);
1244 else {
1245 iph2d = new TProfile2D(*ph2d);
1246 fListHist->Add(iph2d);
1247 }
1248 }
1249
1250 if(prf2d) {
1251 if(iprf2d) iprf2d->Add(prf2d);
1252 else {
1253 iprf2d = new TProfile2D(*prf2d);
1254 fListHist->Add(iprf2d);
1255 }
1256 }
1257
1258 if(ch2dSum) {
1259 if(ich2dSum) ich2dSum->Add(ch2dSum);
1260 else {
1261 ich2dSum = new TH2I(*ch2dSum);
1262 fListHist->Add(ich2dSum);
1263 }
1264 }
1265
1266 if(ph2dSum) {
1267 if(iph2dSum) iph2dSum->Add(ph2dSum);
1268 else {
1269 iph2dSum = new TProfile2D(*ph2dSum);
1270 fListHist->Add(iph2dSum);
1271 }
1272 }
1273
1274 if(ch2dSM) {
1275 if(ich2dSM) ich2dSM->Add(ch2dSM);
1276 else {
1277 ich2dSM = new TH2I(*ch2dSM);
1278 fListHist->Add(ich2dSM);
1279 }
1280 }
1281
1282 if(ph2dSM) {
1283 if(iph2dSM) iph2dSM->Add(ph2dSM);
1284 else {
1285 iph2dSM = new TProfile2D(*ph2dSM);
1286 fListHist->Add(iph2dSM);
1287 }
1288 }
1289
1290 if(linearfit) {
1291 if(ilinearfit) ilinearfit->Add(linearfit);
1292 else {
1293 ilinearfit = new AliTRDCalibraVdriftLinearFit(*linearfit);
1294 fListHist->Add(ilinearfit);
1295 }
1296 }
1297
1298 if(calibraVector) {
1299 if(icalibraVector) icalibraVector->Add(calibraVector);
1300 else {
1301 icalibraVector = new AliTRDCalibraVector(*calibraVector);
1302 fListHist->Add(icalibraVector);
1303 }
1304 }
1305
1306}
1307//________________________________________________________________________________
1308Long64_t AliTRDCalibTask::Merge(TCollection *li) {
1309
1310 //
1311 // merge component
1312 //
1313
1314 TIterator* iter = li->MakeIterator();
1315 AliTRDCalibTask* cal = 0;
1316
1317 while ((cal = (AliTRDCalibTask*)iter->Next())) {
1318 if (!cal->InheritsFrom(AliTRDCalibTask::Class())) {
1319 Error("Merge","Attempt to add object of class %s to a %s", cal->ClassName(), this->ClassName());
1320 return -1;
1321 }
1322
1323 // add histograms here...
1324 this->AddTask(cal);
1325
1326 }
1327
1328 return 0;
1329
1330}
01239968 1331