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(AliQAv1::GetDetName(AliQAv1::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(AliQAv1::TASKINDEX_t task, TObjArray ** list)
83 //Detector specific actions at end of cycle
85 AliQAChecker::Instance()->Run(AliQAv1::kTPC, task, list) ;
88 //____________________________________________________________________________
89 void AliTPCQADataMakerSim::InitDigits()
91 const Bool_t expert = kTRUE ;
92 const Bool_t image = kTRUE ;
93 TH1F * histDigitsADC =
94 new TH1F("hDigitsADC", "Digit ADC distribution; ADC; Counts",
96 histDigitsADC->Sumw2();
97 Add2DigitsList(histDigitsADC, kDigitsADC, !expert, image);
100 //____________________________________________________________________________
101 void AliTPCQADataMakerSim::InitHits()
103 const Bool_t expert = kTRUE ;
104 const Bool_t image = kTRUE ;
105 TH1F * histHitsNhits =
106 new TH1F("hHitsNhits", "Interactions per track in the TPC volume; Number of interactions; Counts",
108 histHitsNhits->Sumw2();
109 Add2HitsList(histHitsNhits, kNhits, !expert, image);
111 TH1F * histHitsElectrons =
112 new TH1F("hHitsElectrons", "Electrons per interaction; Electrons; Counts",
114 histHitsElectrons->Sumw2();
115 Add2HitsList(histHitsElectrons, kElectrons, !expert, image);
117 TH1F * histHitsRadius =
118 new TH1F("hHitsRadius", "Position of interaction; Radius; Counts",
120 histHitsRadius->Sumw2();
121 Add2HitsList(histHitsRadius, kRadius, !expert, image);
123 TH1F * histHitsPrimPerCm =
124 new TH1F("hHitsPrimPerCm", "Primaries per cm; Primaries; Counts",
126 histHitsPrimPerCm->Sumw2();
127 Add2HitsList(histHitsPrimPerCm, kPrimPerCm, !expert, image);
129 TH1F * histHitsElectronsPerCm =
130 new TH1F("hHitsElectronsPerCm", "Electrons per cm; Electrons; Counts",
132 histHitsElectronsPerCm->Sumw2();
133 Add2HitsList(histHitsElectronsPerCm, kElectronsPerCm, !expert, image);
136 //____________________________________________________________________________
137 void AliTPCQADataMakerSim::MakeDigits(TTree* digitTree)
140 TBranch* branch = digitTree->GetBranch("Segment");
141 AliSimDigits* digArray = 0;
142 branch->SetAddress(&digArray);
144 Int_t nEntries = Int_t(digitTree->GetEntries());
146 for (Int_t n = 0; n < nEntries; n++) {
148 digitTree->GetEvent(n);
150 if (digArray->First())
152 Float_t dig = digArray->CurrentDigit();
154 GetDigitsData(kDigitsADC)->Fill(dig);
155 } while (digArray->Next());
159 //____________________________________________________________________________
160 void AliTPCQADataMakerSim::MakeHits(TTree * hitTree)
162 // make QA data from Hit Tree
164 const Int_t nTracks = hitTree->GetEntries();
165 TBranch* branch = hitTree->GetBranch("TPC2");
166 AliTPCv2* tpc = (AliTPCv2*)gAlice->GetDetector("TPC");
171 for(Int_t n = 0; n < nTracks; n++){
175 AliTPChit* tpcHit = (AliTPChit*)tpc->FirstHit(-1);
180 Float_t xold = tpcHit->X();
181 Float_t yold = tpcHit->Y();
182 Float_t zold = tpcHit->Z();
183 Float_t radiusOld = TMath::Sqrt(xold*xold + yold*yold);
184 Int_t trackOld = tpcHit->GetTrack();
189 Float_t x = tpcHit->X();
190 Float_t y = tpcHit->Y();
191 Float_t z = tpcHit->Z();
192 Float_t radius = TMath::Sqrt(x*x + y*y);
194 if(radius>50) { // Skip hits at interaction point
198 Int_t trackNo = tpcHit->GetTrack();
200 GetHitsData(kElectrons)->Fill(tpcHit->fQ);
201 GetHitsData(kRadius)->Fill(radius);
203 if(trackNo==trackOld) { // if the same track
205 // find the new distance
206 dist += TMath::Sqrt((x-xold)*(x-xold) + (y-yold)*(y-yold) +
208 if(dist<1.){ // add data to this 1 cm step
212 } else{ // Fill the histograms normalized to per cm
215 cout << radius << ", " << radiusOld << ", " << dist << endl;
217 GetHitsData(kPrimPerCm)->Fill((Float_t)nprim);
218 GetHitsData(kElectronsPerCm)->Fill(q);
224 } else { // reset for new track
236 trackOld = tpcHit->GetTrack();
238 tpcHit = (AliTPChit*) tpc->NextHit();
242 GetHitsData(kNhits)->Fill(nHits);