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