1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
20 Based on AliPHOSQADataMaker
21 Produces the data needed to calculate the quality assurance.
22 All data must be mergeable objects.
23 P. Christiansen, Lund, January 2008
29 We have chosen to have the histograms as non-persistent meber to
30 allow better debugging. In the copy constructor we then have to
31 assign the pointers to the existing histograms in the copied
32 list. This have been implemented but not tested.
35 #include "AliTPCQADataMakerSim.h"
37 // --- ROOT system ---
39 // --- Standard library ---
41 // --- AliRoot header files ---
42 #include "AliQAChecker.h"
45 #include "AliSimDigits.h"
47 ClassImp(AliTPCQADataMakerSim)
49 //____________________________________________________________________________
50 AliTPCQADataMakerSim::AliTPCQADataMakerSim() :
51 AliQADataMakerSim(AliQA::GetDetName(AliQA::kTPC),
52 "TPC Sim Quality Assurance Data Maker"),
55 fHistHitsElectrons(0),
57 fHistHitsPrimPerCm(0),
58 fHistHitsElectronsPerCm(0)
63 //____________________________________________________________________________
64 AliTPCQADataMakerSim::AliTPCQADataMakerSim(const AliTPCQADataMakerSim& qadm) :
68 fHistHitsElectrons(0),
70 fHistHitsPrimPerCm(0),
71 fHistHitsElectronsPerCm(0)
74 SetName((const char*)qadm.GetName()) ;
75 SetTitle((const char*)qadm.GetTitle());
78 // Associate class histogram objects to the copies in the list
79 // Could also be done with the indexes
81 fHistDigitsADC = (TH1F*)fDigitsQAList->FindObject("hDigitsADC");
83 fHistHitsNhits = (TH1F*)fHitsQAList->FindObject("hHitsNhits");
84 fHistHitsElectrons = (TH1F*)fHitsQAList->FindObject("hHitsElectrons");
85 fHistHitsRadius = (TH1F*)fHitsQAList->FindObject("hHitsRadius");
86 fHistHitsPrimPerCm = (TH1F*)fHitsQAList->FindObject("hHitsPrimPerCm");
87 fHistHitsElectronsPerCm = (TH1F*)fHitsQAList->FindObject("hHitsElectronsPerCm");
90 //__________________________________________________________________
91 AliTPCQADataMakerSim& AliTPCQADataMakerSim::operator = (const AliTPCQADataMakerSim& qadm )
94 this->~AliTPCQADataMakerSim();
95 new(this) AliTPCQADataMakerSim(qadm);
99 //____________________________________________________________________________
100 void AliTPCQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
102 //Detector specific actions at end of cycle
103 // do the QA checking
104 AliQAChecker::Instance()->Run(AliQA::kTPC, task, list) ;
107 //____________________________________________________________________________
108 void AliTPCQADataMakerSim::InitDigits()
111 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
113 fHistDigitsADC->Sumw2();
114 Add2DigitsList(fHistDigitsADC, 0);
117 //____________________________________________________________________________
118 void AliTPCQADataMakerSim::InitHits()
121 new TH1F("hHitsNhits", "Interactions per primary track in the TPC volume; Number of primary interactions; Counts",
123 fHistHitsNhits->Sumw2();
124 Add2HitsList(fHistHitsNhits, 0);
127 new TH1F("hHitsElectrons", "Electrons per interaction (primaries); Electrons; Counts",
129 fHistHitsElectrons->Sumw2();
130 Add2HitsList(fHistHitsElectrons, 1);
133 new TH1F("hHitsRadius", "Position of interaction (Primary tracks only); Radius; Counts",
135 fHistHitsRadius->Sumw2();
136 Add2HitsList(fHistHitsRadius, 2);
139 new TH1F("hHitsPrimPerCm", "Primaries per cm (Primary tracks only); Primaries; Counts",
141 fHistHitsPrimPerCm->Sumw2();
142 Add2HitsList(fHistHitsPrimPerCm, 3);
144 fHistHitsElectronsPerCm =
145 new TH1F("hHitsElectronsPerCm", "Electrons per cm (Primary tracks only); Electrons; Counts",
147 fHistHitsElectronsPerCm->Sumw2();
148 Add2HitsList(fHistHitsElectronsPerCm, 4);
151 //____________________________________________________________________________
152 void AliTPCQADataMakerSim::MakeDigits(TTree* digitTree)
154 TBranch* branch = digitTree->GetBranch("Segment");
155 AliSimDigits* digArray = 0;
156 branch->SetAddress(&digArray);
158 Int_t nEntries = Int_t(digitTree->GetEntries());
160 for (Int_t n = 0; n < nEntries; n++) {
162 digitTree->GetEvent(n);
164 if (digArray->First())
167 Float_t dig = digArray->CurrentDigit();
169 fHistDigitsADC->Fill(dig);
170 } while (digArray->Next());
174 //____________________________________________________________________________
175 void AliTPCQADataMakerSim::MakeHits(TTree * hitTree)
177 // make QA data from Hit Tree
178 const Int_t nTracks = hitTree->GetEntries();
179 TBranch* branch = hitTree->GetBranch("TPC2");
180 AliTPCv2* tpc = (AliTPCv2*)gAlice->GetDetector("TPC");
185 for(Int_t n = 0; n < nTracks; n++){
189 AliTPChit* tpcHit = (AliTPChit*)tpc->FirstHit(-1);
194 Float_t xold = tpcHit->X();
195 Float_t yold = tpcHit->Y();
196 Float_t zold = tpcHit->Z();
197 Float_t radiusOld = TMath::Sqrt(xold*xold + yold*yold);
200 Float_t x = tpcHit->X();
201 Float_t y = tpcHit->Y();
202 Float_t z = tpcHit->Z();
203 Float_t radius = TMath::Sqrt(x*x + y*y);
205 if(radius>50) { // Skip hits at interaction point
209 Int_t trackNo = tpcHit->GetTrack();
211 if(trackNo==n) { // primary track
213 fHistHitsElectrons->Fill(tpcHit->fQ);
214 fHistHitsRadius->Fill(radius);
216 // find the new distance
217 dist += TMath::Sqrt((x-xold)*(x-xold) + (y-yold)*(y-yold) +
220 // add data to this 1 cm step
225 // Fill the histograms normalized to per cm
228 cout << radius << ", " << radiusOld << ", " << dist << endl;
230 fHistHitsPrimPerCm->Fill((Float_t)nprim);
231 fHistHitsElectronsPerCm->Fill(q);
245 tpcHit = (AliTPChit*) tpc->NextHit();
248 fHistHitsNhits->Fill(nHits);