]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHDisplFast.cxx
old digits-clusters removed
[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 <TCanvas.h>
21 #include <TParticle.h>
22 #include <TStyle.h>
23 #include <TH2.h>
24 #include <TMath.h>
25
26 ClassImp(AliRICHDisplFast)
27
28 //__________________________________________________________________________________________________
29 void AliRICHDisplFast::Exec()
30 {
31   TH2F *pHitsH2     = new TH2F("pHitsH2"  ,  "Event Display",165,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2,
32                                                              144,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2);
33   pHitsH2->SetStats(kFALSE);
34   TH2F *pDigitsH2   = new TH2F("pDigitsH2"  ,"Event Display",165,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2,
35                                                              144,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2);
36   TH2F *pClustersH2 = new TH2F("pClustersH2","Event Display",165,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2,
37                                                              144,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2);
38
39   TCanvas *Display = new TCanvas("Display","RICH Display",0,0,600,600);
40     
41   gStyle->SetPalette(1);
42
43   AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
44   pRich->GetLoader()->LoadRecPoints();
45   pRich->GetLoader()->LoadDigits();
46   pRich->GetLoader()->LoadHits();
47   for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop
48     pRich->GetLoader()->GetRunLoader()->GetEvent(iEventN);
49     pRich->GetLoader()->TreeD()->GetEntry(0);
50     pRich->GetLoader()->TreeR()->GetEntry(0);
51
52   
53     Int_t nPrimaries = (Int_t)pRich->GetLoader()->TreeH()->GetEntries();
54     TObjArray * Hits = new TObjArray[nPrimaries];
55   
56     for(Int_t i=0;i<nPrimaries;i++) {
57       pRich->GetLoader()->TreeH()->GetEntry(i);
58       Int_t nHits = pRich->Hits()->GetEntries();
59       for(Int_t k=0;k<nHits;k++)         Hits[i].Add(pRich->Hits()->At(k));
60     
61     }
62            
63     for(Int_t iChamber=1;iChamber<=7;iChamber++){//modules loop
64     
65      Int_t nDigits   = pRich->Digits(iChamber)->GetEntries();
66      Int_t nClusters = pRich->Clusters(iChamber)->GetEntries();
67    
68      pHitsH2->Reset();     pDigitsH2->Reset();     pClustersH2->Reset();
69
70      Double_t xpad,ypad;
71
72       for(Int_t i=0;i<nPrimaries;i++){//prims loop
73         pRich->GetLoader()->TreeH()->GetEntry(i);
74         Int_t nHits = pRich->Hits()->GetEntries();
75         for(Int_t j=0;j<nHits;j++){//hits loop
76           AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
77           if(pHit->C()==iChamber){
78             TVector3 xyzhit(pHit->X(),pHit->Y(),pHit->Z());
79             TVector3 hitlocal = pRich->C(iChamber)->Glob2Loc(xyzhit);
80             pHitsH2->Fill(hitlocal.X(),hitlocal.Y(),200);
81           }//if
82         }//hits loop         
83       }//prims loop
84      
85       for(Int_t j=0;j<nDigits;j++){//digits loop
86         AliRICHdigit *pDigit = (AliRICHdigit*)pRich->Digits(iChamber)->At(j);
87         AliRICHParam::Pad2Loc(pDigit->X(),pDigit->Y(),xpad,ypad);
88         pDigitsH2->Fill(xpad,ypad,100);
89       }//digits loop
90         
91       for(Int_t j=0;j<nClusters;j++){//clusters loop
92         AliRICHcluster *pCluster = (AliRICHcluster*)pRich->Clusters(iChamber)->At(j);
93         pClustersH2->Fill(pCluster->X(),pCluster->Y(),50);
94       }//clusters loop
95
96       pHitsH2->SetTitle(Form("event %i module %2i",iEventN,iChamber));
97       pHitsH2->SetMarkerColor(kRed); pHitsH2->SetMarkerStyle(29); pHitsH2->SetMarkerSize(0.4);
98       pHitsH2->Draw();
99       Display->Update();
100       Display->Modified();
101       getchar();
102              
103       pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4);
104       pDigitsH2->Draw("same");
105       Display->Update();
106       Display->Modified();       
107       getchar();
108       
109       pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29);  pClustersH2->SetMarkerSize(0.4);
110       pClustersH2->Draw("same");
111       Display->Update();
112       Display->Modified();
113       getchar();
114      }//modules loop
115     delete [] Hits;
116   }////events Loop
117   pRich->GetLoader()->UnloadRecPoints();
118   pRich->GetLoader()->UnloadDigits();
119   pRich->GetLoader()->UnloadHits();
120 }//Exec()
121 //__________________________________________________________________________________________________