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")
57 //____________________________________________________________________________
58 AliTPCQADataMakerSim::AliTPCQADataMakerSim(const AliTPCQADataMakerSim& qadm) :
62 SetName((const char*)qadm.GetName()) ;
63 SetTitle((const char*)qadm.GetTitle());
66 // Associate class histogram objects to the copies in the list
67 // Could also be done with the indexes
71 //__________________________________________________________________
72 AliTPCQADataMakerSim& AliTPCQADataMakerSim::operator = (const AliTPCQADataMakerSim& qadm )
75 this->~AliTPCQADataMakerSim();
76 new(this) AliTPCQADataMakerSim(qadm);
80 //____________________________________________________________________________
81 void AliTPCQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray ** list)
83 //Detector specific actions at end of cycle
85 AliQAChecker::Instance()->Run(AliQA::kTPC, task, list) ;
88 //____________________________________________________________________________
89 void AliTPCQADataMakerSim::InitDigits()
91 TH1F * histDigitsADC =
92 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
94 histDigitsADC->Sumw2();
95 Add2DigitsList(histDigitsADC, kDigitsADC);
98 //____________________________________________________________________________
99 void AliTPCQADataMakerSim::InitHits()
101 TH1F * histHitsNhits =
102 new TH1F("hHitsNhits", "Interactions per primary track in the TPC volume; Number of primary interactions; Counts",
104 histHitsNhits->Sumw2();
105 Add2HitsList(histHitsNhits, kNhits);
107 TH1F * histHitsElectrons =
108 new TH1F("hHitsElectrons", "Electrons per interaction (primaries); Electrons; Counts",
110 histHitsElectrons->Sumw2();
111 Add2HitsList(histHitsElectrons, kElectrons);
113 TH1F * histHitsRadius =
114 new TH1F("hHitsRadius", "Position of interaction (Primary tracks only); Radius; Counts",
116 histHitsRadius->Sumw2();
117 Add2HitsList(histHitsRadius, kRadius);
119 TH1F * histHitsPrimPerCm =
120 new TH1F("hHitsPrimPerCm", "Primaries per cm (Primary tracks only); Primaries; Counts",
122 histHitsPrimPerCm->Sumw2();
123 Add2HitsList(histHitsPrimPerCm, kPrimPerCm);
125 TH1F * histHitsElectronsPerCm =
126 new TH1F("hHitsElectronsPerCm", "Electrons per cm (Primary tracks only); Electrons; Counts",
128 histHitsElectronsPerCm->Sumw2();
129 Add2HitsList(histHitsElectronsPerCm, kElectronsPerCm);
132 //____________________________________________________________________________
133 void AliTPCQADataMakerSim::MakeDigits(TTree* digitTree)
135 TBranch* branch = digitTree->GetBranch("Segment");
136 AliSimDigits* digArray = 0;
137 branch->SetAddress(&digArray);
139 Int_t nEntries = Int_t(digitTree->GetEntries());
141 for (Int_t n = 0; n < nEntries; n++) {
143 digitTree->GetEvent(n);
145 if (digArray->First())
147 Float_t dig = digArray->CurrentDigit();
149 GetDigitsData(kDigitsADC)->Fill(dig);
150 } while (digArray->Next());
154 //____________________________________________________________________________
155 void AliTPCQADataMakerSim::MakeHits(TTree * hitTree)
157 // make QA data from Hit Tree
158 const Int_t nTracks = hitTree->GetEntries();
159 TBranch* branch = hitTree->GetBranch("TPC2");
160 AliTPCv2* tpc = (AliTPCv2*)gAlice->GetDetector("TPC");
165 for(Int_t n = 0; n < nTracks; n++){
169 AliTPChit* tpcHit = (AliTPChit*)tpc->FirstHit(-1);
174 Float_t xold = tpcHit->X();
175 Float_t yold = tpcHit->Y();
176 Float_t zold = tpcHit->Z();
177 Float_t radiusOld = TMath::Sqrt(xold*xold + yold*yold);
180 Float_t x = tpcHit->X();
181 Float_t y = tpcHit->Y();
182 Float_t z = tpcHit->Z();
183 Float_t radius = TMath::Sqrt(x*x + y*y);
185 if(radius>50) { // Skip hits at interaction point
189 Int_t trackNo = tpcHit->GetTrack();
191 if(trackNo==n) { // primary track
193 GetHitsData(kElectrons)->Fill(tpcHit->fQ);
194 GetHitsData(kRadius)->Fill(radius);
196 // find the new distance
197 dist += TMath::Sqrt((x-xold)*(x-xold) + (y-yold)*(y-yold) +
200 // add data to this 1 cm step
205 // Fill the histograms normalized to per cm
208 cout << radius << ", " << radiusOld << ", " << dist << endl;
210 GetHitsData(kPrimPerCm)->Fill((Float_t)nprim);
211 GetHitsData(kElectronsPerCm)->Fill(q);
225 tpcHit = (AliTPChit*) tpc->NextHit();
228 GetHitsData(kNhits)->Fill(nHits);