]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHDisplFast.cxx
AliRICHDispFast cluster H2 reset added
[u/mrichter/AliRoot.git] / RICH / AliRICHDisplFast.cxx
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
34 static const Int_t nPadX      = AliRICHParam::NpadsY();
35 static const Int_t nPadY      = AliRICHParam::NpadsX();
36 static const Float_t PadSizeX = AliRICHParam::PadSizeY();
37 static const Float_t PadSizeY = AliRICHParam::PadSizeX();
38 static const Float_t spacer   = AliRICHParam::DeadZone();
39 static const Float_t degree = 180/3.1415926535;
40
41 static const Float_t pi = TMath::Pi();
42
43 static const Float_t RadiatorWidth = AliRICHParam::FreonThickness();
44 static const Float_t QuartzWidth   = AliRICHParam::QuartzThickness();
45 static const Float_t GapWidth      = AliRICHParam::RadiatorToPads();
46
47 static const Float_t Xmin = -AliRICHParam::PcSizeY()/2.;
48 static const Float_t Xmax =  AliRICHParam::PcSizeY()/2.;
49 static const Float_t Ymin = -AliRICHParam::PcSizeX()/2.;
50 static const Float_t Ymax =  AliRICHParam::PcSizeX()/2.;
51
52
53 AliRICHDisplFast::AliRICHDisplFast()
54 {
55 }
56
57 void AliRICHDisplFast::Display()
58 {
59
60   TText *text;
61
62   TH2F *h2_disp   = new TH2F("h2_disp"  ,"STAR-RICH Event Display",165,Xmin,Xmax,144,Ymin,Ymax);
63   TH2F *gHitsH2   = new TH2F("gHitsH2"  ,"STAR-RICH Event Display",165,Xmin,Xmax,144,Ymin,Ymax);
64   TH2F *h2_dispad = new TH2F("h2_dispad","STAR-RICH Event Display",161,0.,161.,145,0.,145.);
65   TH2F *gClustersH2 = new TH2F("gClusH2"  ,"STAR-RICH Event Display",165,Xmin,Xmax,144,Ymin,Ymax);
66
67   TCanvas *Display = new TCanvas("Display","Star Display",0,0,800,800);
68     
69   // Display event...
70
71   gStyle->SetPalette(1);
72
73   AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
74   pRich->GetLoader()->LoadRecPoints();
75   pRich->GetLoader()->LoadDigits();
76   pRich->GetLoader()->LoadHits();
77   pRich->GetLoader()->TreeD()->GetEntry(0);
78   pRich->GetLoader()->TreeR()->GetEntry(0);
79
80   cout << " start to display..." << endl;     
81   
82   Int_t nPrimaries = (Int_t)pRich->GetLoader()->TreeH()->GetEntries();
83   TObjArray Hits[nPrimaries];
84   
85   for(Int_t i=0;i<nPrimaries;i++) {
86     pRich->GetLoader()->TreeH()->GetEntry(i);
87     Int_t nHits = pRich->Hits()->GetEntries();
88     for(Int_t k=0;k<nHits;k++) {
89        Hits[i].Add(pRich->Hits()->At(k));
90     }
91   }
92            
93   for(Int_t iChamber=1;iChamber<=7;iChamber++) {
94     
95      Int_t nDigits = pRich->Digits(iChamber)->GetEntries();
96      Int_t nClusters = pRich->Clusters(iChamber)->GetEntries();
97    
98      Display->ToggleEventStatus();
99      Display->Modified();
100      
101      text = new TText(0,0,"");
102      text->SetTextFont(61);
103      text->SetTextSize(0.03);
104      text->SetTextAlign(22);                                                       
105       
106 //     Display->Resize();
107
108      h2_disp->Reset();
109      gHitsH2->Reset();
110      gClustersH2->Reset();
111 //     h2_dispad->Reset();
112
113      Double_t xpad,ypad;
114
115       for(Int_t i=0;i<nPrimaries;i++) {
116         pRich->GetLoader()->TreeH()->GetEntry(i);
117         Int_t nHits = pRich->Hits()->GetEntries();
118
119         for(Int_t j=0;j<nHits;j++) {
120         
121           AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
122           cout << " chamber " << iChamber << " hit n. " << j << " ch " << pHit->Chamber() << endl;
123           if(pHit->C()==iChamber) {
124             TVector3 xyzhit(pHit->X(),pHit->Y(),pHit->Z());
125             TVector3 hitlocal = pRich->C(iChamber)->Glob2Loc(xyzhit);
126             gHitsH2->Fill(hitlocal.X(),hitlocal.Y());
127 //            pHit->Print("");
128           }
129          }         
130        }
131      
132      for(Int_t j=0;j<nDigits;j++)
133         {
134           AliRICHdigit *pDigit = (AliRICHdigit*)pRich->Digits(iChamber)->At(j);
135           AliRICHParam::Pad2Loc(pDigit->X(),pDigit->Y(),xpad,ypad);
136           Float_t charge = (Float_t)pDigit->Q();
137           h2_disp->Fill(xpad,ypad,charge);
138           h2_dispad->Fill(pDigit->X(),pDigit->Y(),pDigit->Q());
139           pDigit->Print("");
140         }
141         
142      for(Int_t j=0;j<nClusters;j++)
143         {
144           AliRICHcluster *pCluster = (AliRICHcluster*)pRich->Clusters(iChamber)->At(j);
145 //          gClustersH2->Fill(pCluster->X(),pCluster->Y(),pCluster->Q());
146           gClustersH2->Fill(pCluster->X(),pCluster->Y(),100);
147         }
148
149         
150         
151         
152       cout << " -----------------" << endl;
153       
154              
155       // end loop
156                     
157
158       h2_disp->SetMaximum(200);
159       h2_disp->SetStats(0);
160       h2_disp->Draw("colz");
161       h2_disp->SetTitle(Form("Chamber %2i",iChamber));
162
163 /*      
164       h2_dispad->SetTitle(Form("Chamber %2i",iChamber));
165       h2_dispad->SetMaximum(200);
166       h2_dispad->SetStats(0);
167       h2_dispad->Draw("colz");
168 */
169       Display->Update();
170       Display->Modified();
171      
172       getchar();
173       gHitsH2->SetTitle(Form("Chamber %2i",iChamber));
174       gHitsH2->SetMarkerColor(kBlue);
175       gHitsH2->SetMarkerStyle(29);
176       gHitsH2->SetMarkerSize(0.4);
177       gHitsH2->Draw("same");
178       Display->Update();
179       Display->Modified();
180        
181       getchar();
182       gClustersH2->SetTitle(Form("Chamber %2i",iChamber));
183       gClustersH2->SetMarkerColor(kBlue);
184       gClustersH2->SetMarkerStyle(29);
185       gClustersH2->SetMarkerSize(0.4);
186       gClustersH2->Draw("same");
187       Display->Update();
188       Display->Modified();
189       getchar();
190      }
191 }
192