]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHDisplFast.cxx
More improvements
[u/mrichter/AliRoot.git] / RICH / AliRICHDisplFast.cxx
CommitLineData
6b17b320 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16#include "AliRICH.h"
17#include "AliRICHDisplFast.h"
18#include "AliRICHParam.h"
19#include <AliLoader.h>
20#include <Riostream.h>
21#include <TCanvas.h>
22#include <TParticle.h>
23#include <TStyle.h>
24#include <TF1.h>
25#include <TH2.h>
26#include <TMath.h>
27#include <TRandom.h>
28#include <TText.h>
29
30#define NPointsOfRing 201
31
32// Geometry of the RICH at Star...
33
34static const Int_t nPadX = AliRICHParam::NpadsY();
35static const Int_t nPadY = AliRICHParam::NpadsX();
36static const Float_t PadSizeX = AliRICHParam::PadSizeY();
37static const Float_t PadSizeY = AliRICHParam::PadSizeX();
38static const Float_t spacer = AliRICHParam::DeadZone();
39static const Float_t degree = 180/3.1415926535;
40
41static const Float_t pi = TMath::Pi();
42
43static const Float_t RadiatorWidth = AliRICHParam::FreonThickness();
44static const Float_t QuartzWidth = AliRICHParam::QuartzThickness();
45static const Float_t GapWidth = AliRICHParam::RadiatorToPads();
46
47static const Float_t Xmin = -AliRICHParam::PcSizeY()/2.;
48static const Float_t Xmax = AliRICHParam::PcSizeY()/2.;
49static const Float_t Ymin = -AliRICHParam::PcSizeX()/2.;
50static const Float_t Ymax = AliRICHParam::PcSizeX()/2.;
51
52
53AliRICHDisplFast::AliRICHDisplFast()
54{
55}
56
57void AliRICHDisplFast::Display()
58{
59
60 TText *text;
61
62 TH2F *h2_disp = new TH2F("h2_disp" ,"STAR-RICH Event Display",165,Xmin,Xmax,100,Ymin,Ymax);
63 TH2F *gHitsH2 = new TH2F("gHitsH2" ,"STAR-RICH Event Display",165,Xmin,Xmax,100,Ymin,Ymax);
64 TH2F *h2_dispad = new TH2F("h2_dispad","STAR-RICH Event Display",161,0.,161.,145,0.,145.);
65
66 TCanvas *Display = new TCanvas("Display","Star Display",0,0,800,800);
67
68 // Display event...
69
70 gStyle->SetPalette(1,0);
71
72 AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
73 pRich->GetLoader()->LoadDigits();
74 pRich->GetLoader()->TreeD()->GetEntry(0);
75 pRich->GetLoader()->LoadHits();
76
77 Int_t nPrimaries = (Int_t)pRich->GetLoader()->TreeH()->GetEntries();
78 TObjArray Hits[nPrimaries];
79
80 for(Int_t i=0;i<nPrimaries;i++) {
81 pRich->GetLoader()->TreeH()->GetEntry(i);
82 Int_t nHits = pRich->Hits()->GetEntries();
83 for(Int_t k=0;k<nHits;k++) {
84 Hits[i].Add(pRich->Hits()->At(k));
85 }
86 }
87
88 for(Int_t iChamber=1;iChamber<=7;iChamber++) {
89
90 Int_t nDigits = pRich->DigitsOld(iChamber)->GetEntries();
91
92 Display->ToggleEventStatus();
93 Display->Modified();
94
95 text = new TText(0,0,"");
96 text->SetTextFont(61);
97 text->SetTextSize(0.03);
98 text->SetTextAlign(22);
99
100// Display->Resize();
101
102 h2_disp->Reset();
103 gHitsH2->Reset();
104// h2_dispad->Reset();
105
106 Float_t xpad,ypad;
107
108// loop for Digits...
109
110 for(Int_t j=0;j<nDigits;j++)
111 {
112 AliRICHDigit *pDigit = (AliRICHDigit*)pRich->DigitsOld(iChamber)->At(j);
113 AliRICHParam::Pad2Local(pDigit->PadX(),pDigit->PadY(),xpad,ypad);
114 Float_t charge = (Float_t)pDigit->Signal();
115 h2_disp->Fill(xpad,ypad,charge);
116 h2_dispad->Fill(pDigit->PadX(),pDigit->PadY(),pDigit->Signal());
117 pDigit->Print();
118 }
119
120 cout << " -----------------" << endl;
121
122 for(Int_t i=0;i<nPrimaries;i++) {
123 pRich->GetLoader()->TreeH()->GetEntry(i);
124 Int_t nHits = pRich->Hits()->GetEntries();
125
126 for(Int_t j=0;j<nHits;j++) {
127
128 AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
129 cout << " chamber " << iChamber << " hit n. " << j << " ch " << pHit->Chamber() << endl;
130 if(pHit->C()==iChamber) {
131 TVector3 xyzhit(pHit->X(),pHit->Y(),pHit->Z());
132 TVector3 hitlocal = pRich->C(iChamber)->Global2Local(xyzhit);
133 gHitsH2->Fill(hitlocal.X(),hitlocal.Y());
134// pHit->Print();
135 }
136 }
137 }
138
139 // end loop
140
141
142 h2_disp->SetMaximum(200);
143 h2_disp->SetStats(0);
144 h2_disp->Draw("colz");
145 h2_disp->SetTitle(Form("Chamber %2i",iChamber));
146
147/*
148 h2_dispad->SetTitle(Form("Chamber %2i",iChamber));
149 h2_dispad->SetMaximum(200);
150 h2_dispad->SetStats(0);
151 h2_dispad->Draw("colz");
152*/
153 Display->Update();
154 Display->Modified();
155
156 getchar();
157 gHitsH2->SetTitle(Form("Chamber %2i",iChamber));
158 gHitsH2->SetMarkerColor(kBlue);
159 gHitsH2->SetMarkerStyle(29);
160 gHitsH2->SetMarkerSize(0.4);
161 gHitsH2->Draw("same");
162// gHitsH2->Draw();
163 Display->Update();
164 Display->Modified();
165
166 getchar();
167 }
168}
169