new L2G and G2L
[u/mrichter/AliRoot.git] / RICH / AliRICH.cxx
CommitLineData
4c039060 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
88cb7938 16/* $Id$ */
2e5f0f7b 17
ddae0931 18////////////////////////////////////////////////
19// Manager and hits classes for set:RICH //
20////////////////////////////////////////////////
fe4da5cc 21
88cb7938 22#include <Riostream.h>
116cbefd 23#include <strings.h>
24
2e5f0f7b 25#include <TArrayF.h>
116cbefd 26#include <TBRIK.h>
27#include <TCanvas.h>
28#include <TF1.h>
237c933d 29#include <TFile.h>
94de3818 30#include <TGeometry.h>
a3d71079 31#include <TH1.h>
32#include <TH2.h>
116cbefd 33#include <TNode.h>
34#include <TObjArray.h>
35#include <TObject.h>
36#include <TParticle.h>
37#include <TPDGCode.h>
38#include <TRandom.h>
fb498b56 39#include <TStyle.h>
116cbefd 40#include <TTUBE.h>
41#include <TTree.h>
42#include <TVector.h>
116cbefd 43#include "AliConst.h"
44#include "AliMagF.h"
45#include "AliPoints.h"
fe4da5cc 46#include "AliRICH.h"
116cbefd 47#include "AliRICHClusterFinder.h"
237c933d 48#include "AliRICHDigit.h"
116cbefd 49#include "AliRICHDigitizer.h"
116cbefd 50#include "AliRICHHitMapA1.h"
51#include "AliRICHMerger.h"
237c933d 52#include "AliRICHRawCluster.h"
a4622d0f 53#include "AliRICHRecHit1D.h"
54#include "AliRICHRecHit3D.h"
116cbefd 55#include "AliRICHSDigit.h"
56#include "AliRICHSegmentationV0.h"
57#include "AliRICHTransientDigit.h"
fe4da5cc 58#include "AliRun.h"
fb498b56 59#include "AliRunDigitizer.h"
116cbefd 60#include "AliSegmentation.h"
3ea9cb08 61#include "AliRICHParam.h"
237c933d 62
15d8311d 63static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
ddae0931 64static Int_t sCurIterPad=0;
ddae0931 65
853634d3 66ClassImp(AliRICHhit)
67ClassImp(AliRICHdigit)
fe4da5cc 68ClassImp(AliRICH)
ddae0931 69
70//___________________________________________
15d8311d 71// RICH manager class
72//Begin_Html
73/*
74 <img src="gif/alirich.gif">
75*/
76//End_Html
77
fe4da5cc 78AliRICH::AliRICH()
dfb4e77d 79{//Default ctor should not contain any new operators
80 fIshunt = 0;
81 fHits = 0;
82 fSDigits = 0;
853634d3 83 fNsdigits = 0;
dfb4e77d 84 fNcerenkovs = 0;
85 fDchambers = 0;
86 fRecHits1D = 0;
87 fRecHits3D = 0;
88 fRawClusters = 0;
89 fChambers = 0;
90 fCerenkovs = 0;
91 for (Int_t i=0; i<kNCH; i++){
92 fNdch[i] = 0;
93 fNrawch[i] = 0;
94 fNrechits1D[i] = 0;
95 fNrechits3D[i] = 0;
96 }
3ea9cb08 97 fpParam=0;
853634d3 98//kir fFileName = 0;
99//kir fMerger = 0;
15d8311d 100}//AliRICH::AliRICH()
dfb4e77d 101//______________________________________________________________________________
fe4da5cc 102AliRICH::AliRICH(const char *name, const char *title)
dfb4e77d 103 :AliDetector(name,title)
104{//Named ctor
105 if(GetDebug())Info("named ctor","Start.");
3ea9cb08 106 fpParam =new AliRICHParam;
107 fHits =new TClonesArray("AliRICHhit",1000 );
108 fCerenkovs =new TClonesArray("AliRICHCerenkov",1000);
109 fSDigits =new TClonesArray("AliRICHdigit",100000);
dfb4e77d 110 gAlice->AddHitList(fHits);
111 gAlice->AddHitList(fCerenkovs);
3ea9cb08 112 fNsdigits =0;
113 fNcerenkovs =0;
114 fIshunt =0;
dfb4e77d 115 fDchambers =new TObjArray(kNCH);
116 fRawClusters=new TObjArray(kNCH);
117 fRecHits1D =new TObjArray(kNCH);
118 fRecHits3D =new TObjArray(kNCH);
3ea9cb08 119 for(int i=0;i<kNCH;i++) {
dfb4e77d 120 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
121 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
122 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
123 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
124 fNdch[i]=0;
125 fNrawch[i]=0;
126 }
127 SetMarkerColor(kRed);
3ea9cb08 128 fCkovNumber=fFreonProd=0;
853634d3 129//kir fFileName = 0;
130//kir fMerger = 0;
dfb4e77d 131 if(GetDebug())Info("named ctor","Stop.");
132}//AliRICH::AliRICH(const char *name, const char *title)
133//______________________________________________________________________________
fe4da5cc 134AliRICH::~AliRICH()
dfb4e77d 135{//dtor
136 if(GetDebug()) Info("dtor","Start.");
237c933d 137
ddae0931 138 fIshunt = 0;
139 delete fHits;
b251a2b5 140 delete fSDigits;
ddae0931 141 delete fCerenkovs;
ee2105a4 142
143 //PH Delete TObjArrays
144 if (fChambers) {
145 fChambers->Delete();
146 delete fChambers;
147 }
148 if (fDchambers) {
149 fDchambers->Delete();
150 delete fDchambers;
151 }
152 if (fRawClusters) {
153 fRawClusters->Delete();
154 delete fRawClusters;
155 }
156 if (fRecHits1D) {
157 fRecHits1D->Delete();
158 delete fRecHits1D;
159 }
160 if (fRecHits3D) {
161 fRecHits3D->Delete();
162 delete fRecHits3D;
163 }
dfb4e77d 164 if(GetDebug()) Info("dtor","Stop.");
165}//AliRICH::~AliRICH()
853634d3 166//______________________________________________________________________________
3ea9cb08 167Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
853634d3 168{//calls the charge disintegration method of the current chamber and adds all generated sdigits to the list of digits
15d8311d 169
853634d3 170 Int_t iChamber,iPadX,iPadY,iAdc,iTrack;
171 Float_t list[4][500];
172 Int_t iNdigits;
173
34ead2dd 174
853634d3 175 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits, list, res);
34ead2dd 176 Int_t ic=0;
177
853634d3 178 for(Int_t i=0; i<iNdigits; i++) {
179 if(Int_t(list[0][i]) > 0) {
34ead2dd 180 ic++;
853634d3 181 iAdc = Int_t(list[0][i]);
182 iPadX = Int_t(list[1][i]);
183 iPadY = Int_t(list[2][i]);
184 iChamber = Int_t(list[3][i]);
185
34ead2dd 186
853634d3 187 AddSDigit(iChamber,iPadX,iPadY,iAdc,iTrack);
34ead2dd 188 }
189 }
190
dfb4e77d 191 if(gAlice->TreeS()){
34ead2dd 192 gAlice->TreeS()->Fill();
193 gAlice->TreeS()->Write(0,TObject::kOverwrite);
15d8311d 194 }
3ea9cb08 195 return iNdigits;
15d8311d 196}//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
3ea9cb08 197//______________________________________________________________________________
198void AliRICH::Hits2SDigits()
853634d3 199{//Create a list of sdigits corresponding to list of hits. Every hit generates sdigit.
3ea9cb08 200 if(GetDebug()) Info("Hit2SDigits","Start.");
853634d3 201
3ea9cb08 202 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//loop on events
203 fLoader->GetRunLoader()->GetEvent(iEventN);
853634d3 204
3ea9cb08 205 if(!fLoader->TreeH()) fLoader->LoadHits();
206 if(!fLoader->TreeS()) fLoader->MakeTree("S");
207 MakeBranch("S");
853634d3 208
3ea9cb08 209 for(int iPrimN=0;iPrimN<TreeH()->GetEntries();iPrimN++){//loop on primary tracks
210 fLoader->TreeH()->GetEntry(iPrimN);
211 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//loop on hits for given primary track
212 AddSDigit(4,13,24,55,4);//chamber-xpad-ypad-qdc-track1-2-3
213 }//loop on hits for given primary track
214 }//loop on primary tracks
853634d3 215
3ea9cb08 216 fLoader->TreeS()->Fill();
217 fLoader->WriteSDigits("OVERWRITE");
218 }//loop on events
853634d3 219
853634d3 220 if(GetDebug()) Info("Hit2SDigits","Stop.");
34ead2dd 221}
dfb4e77d 222//______________________________________________________________________________
223void AliRICH::SDigits2Digits()
224{//Generate digits from sdigits.
225 if(GetDebug()) Info("SDigits2Digits","Start.");
fb498b56 226 //AliRICHChamber* iChamber;
34ead2dd 227
34ead2dd 228
fb498b56 229 //for(Int_t i=0;i<7;i++) {
230 //iChamber = &(Chamber(i));
231 //iChamber->GenerateTresholds();
232 //}
34ead2dd 233
fb498b56 234 //int nparticles = gAlice->GetNtrack();
235 //cout << "Particles (RICH):" <<nparticles<<endl;
236 //if (nparticles <= 0) return;
237 //if (!fMerger) {
238 //fMerger = new AliRICHMerger();
239 //}
240
241
242 //fMerger->Init();
243 //fMerger->Digitise(nev,flag);
244
245 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
246 manager->SetInputStream(0,"galice.root");
247 //AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
248 manager->Exec("deb");
dfb4e77d 249 if(GetDebug()) Info("SDigits2Digits","Stop.");
250}//void AliRICH::SDigits2Digits()
251//______________________________________________________________________________
34ead2dd 252void AliRICH::Digits2Reco()
253{
34ead2dd 254// Generate clusters
15d8311d 255// Called from alirun, single event only.
dfb4e77d 256 if(GetDebug()) Info("Digits2Reco","Start.");
34ead2dd 257
258 int nparticles = gAlice->GetNtrack();
259 cout << "Particles (RICH):" <<nparticles<<endl;
942194a4 260 if (nparticles > 0) FindClusters(0);
34ead2dd 261
dfb4e77d 262}//void AliRICH::Digits2Reco()
15d8311d 263
264
ddae0931 265void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
dfb4e77d 266{// Add a RICH digit to the list
237c933d 267
15d8311d 268 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
269 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
fe4da5cc 270}
271
2e5f0f7b 272void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
dfb4e77d 273{// Add a RICH digit to the list
15d8311d 274
2682e810 275 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
2e5f0f7b 276 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
fe4da5cc 277}
2e5f0f7b 278//_____________________________________________________________________________
a4622d0f 279void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
dfb4e77d 280{// Add a RICH reconstructed hit to the list
a4622d0f 281
2682e810 282 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
a4622d0f 283 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
284}
a4622d0f 285//_____________________________________________________________________________
fb498b56 286void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
dfb4e77d 287{// Add a RICH reconstructed hit to the list
fe4da5cc 288
2682e810 289 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
fb498b56 290 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
2e5f0f7b 291}
dfb4e77d 292//______________________________________________________________________________
293void AliRICH::BuildGeometry()
3ea9cb08 294{//Builds a TNode geometry for event display
dfb4e77d 295 if(GetDebug())Info("BuildGeometry","Start.");
237c933d 296
3ea9cb08 297 TNode *node, *subnode, *top;
298 top=gAlice->GetGeometry()->GetNode("alice");
c24372d0 299
3ea9cb08 300 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
53d98323 301
3ea9cb08 302 Float_t wid=fpParam->PadPlaneWidth();
303 Float_t len=fpParam->PadPlaneLength();
304 new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
305
306 for(int i=0;i<kNCH;i++){
237c933d 307 top->cd();
3ea9cb08 308 node = new TNode(Form("RICH%i",i+1),Form("RICH%i",i+1),"S_RICH",C(i)->X(),C(i)->Y(),C(i)->Z(),C(i)->RotMatrixName());
309 node->SetLineColor(kRed);
91975aa2 310 node->cd();
3ea9cb08 311 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
91975aa2 312 subnode->SetLineColor(kGreen);
313 fNodes->Add(subnode);
3ea9cb08 314 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+fpParam->DeadZone()/2,"");
91975aa2 315 subnode->SetLineColor(kGreen);
316 fNodes->Add(subnode);
3ea9cb08 317 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
91975aa2 318 subnode->SetLineColor(kGreen);
319 fNodes->Add(subnode);
3ea9cb08 320 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,-len/2-fpParam->DeadZone()/2,"");
91975aa2 321 subnode->SetLineColor(kGreen);
322 fNodes->Add(subnode);
3ea9cb08 323 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -fpParam->DeadZone()/2,"");
91975aa2 324 subnode->SetLineColor(kGreen);
325 fNodes->Add(subnode);
3ea9cb08 326 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,-len/2 - fpParam->DeadZone()/2,"");
91975aa2 327 subnode->SetLineColor(kGreen);
328 fNodes->Add(subnode);
237c933d 329 fNodes->Add(node);
3ea9cb08 330 }
dfb4e77d 331 if(GetDebug())Info("BuildGeometry","Stop.");
332}//void AliRICH::BuildGeometry()
333//______________________________________________________________________________
452a64c6 334void AliRICH::CreateMaterials()
335{
336 //
337 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
338 // ORIGIN : NICK VAN EIJNDHOVEN
339 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
340 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
341 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
342 //
343 Int_t isxfld = gAlice->Field()->Integ();
344 Float_t sxmgmx = gAlice->Field()->Max();
345 Int_t i;
346
347 /************************************Antonnelo's Values (14-vectors)*****************************************/
348 /*
349 Float_t ppckov[14] = { 5.63e-9,5.77e-9,5.9e-9,6.05e-9,6.2e-9,6.36e-9,6.52e-9,
350 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
351 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
352 1.538243,1.544223,1.550568,1.55777,
353 1.565463,1.574765,1.584831,1.597027,
354 1.611858,1.6277,1.6472,1.6724 };
355 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
356 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
357 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
358 Float_t abscoFreon[14] = { 179.0987,179.0987,
359 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
360 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
361 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
362 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
363 14.177,9.282,4.0925,1.149,.3627,.10857 };
364 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
365 1e-5,1e-5,1e-5,1e-5,1e-5 };
366 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
367 1e-4,1e-4,1e-4,1e-4 };
368 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
369 1e6,1e6,1e6 };
370 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
371 1e-4,1e-4,1e-4,1e-4 };
372 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
373 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
374 .17425,.1785,.1836,.1904,.1938,.221 };
375 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
376 */
377
378
379 /**********************************End of Antonnelo's Values**********************************/
380
381 /**********************************Values from rich_media.f (31-vectors)**********************************/
382
383
384 //Photons energy intervals
385 Float_t ppckov[26];
386 for (i=0;i<26;i++)
387 {
388 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
452a64c6 389 }
390
391
392 //Refraction index for quarz
393 Float_t rIndexQuarz[26];
394 Float_t e1= 10.666;
395 Float_t e2= 18.125;
396 Float_t f1= 46.411;
397 Float_t f2= 228.71;
398 for (i=0;i<26;i++)
399 {
400 Float_t ene=ppckov[i]*1e9;
401 Float_t a=f1/(e1*e1 - ene*ene);
402 Float_t b=f2/(e2*e2 - ene*ene);
403 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
452a64c6 404 }
405
406 //Refraction index for opaque quarz, methane and grid
407 Float_t rIndexOpaqueQuarz[26];
408 Float_t rIndexMethane[26];
409 Float_t rIndexGrid[26];
410 for (i=0;i<26;i++)
411 {
412 rIndexOpaqueQuarz[i]=1;
413 rIndexMethane[i]=1.000444;
414 rIndexGrid[i]=1;
452a64c6 415 }
416
417 //Absorption index for freon
418 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
419 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
420 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
421
422 //Absorption index for quarz
423 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
424 .906,.907,.907,.907};
425 Float_t Wavl2[] = {150.,155.,160.0,165.0,170.0,175.0,180.0,185.0,190.0,195.0,200.0,205.0,210.0,
426 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
427 Float_t abscoQuarz[31];
428 for (Int_t i=0;i<31;i++)
429 {
430 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
431 if (Xlam <= 160) abscoQuarz[i] = 0;
432 if (Xlam > 250) abscoQuarz[i] = 1;
433 else
434 {
435 for (Int_t j=0;j<21;j++)
436 {
452a64c6 437 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
438 {
439 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
440 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
441 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
442 }
443 }
444 }
452a64c6 445 }*/
446
447 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
448 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
449 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
450 .675275, 0., 0., 0.};
451
452 for (Int_t i=0;i<31;i++)
453 {
454 abscoQuarz[i] = abscoQuarz[i]/10;
455 }*/
456
457 Float_t abscoQuarz [26] = {105.8, 65.52, 48.58, 42.85, 35.79, 31.262, 28.598, 27.527, 25.007, 22.815, 21.004,
458 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
459 .192, .1497, .10857};
460
461 //Absorption index for methane
462 Float_t abscoMethane[26];
463 for (i=0;i<26;i++)
464 {
465 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
452a64c6 466 }
467
468 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
469 Float_t abscoOpaqueQuarz[26];
470 Float_t abscoCsI[26];
471 Float_t abscoGrid[26];
472 Float_t efficAll[26];
473 Float_t efficGrid[26];
474 for (i=0;i<26;i++)
475 {
476 abscoOpaqueQuarz[i]=1e-5;
477 abscoCsI[i]=1e-4;
478 abscoGrid[i]=1e-4;
479 efficAll[i]=1;
480 efficGrid[i]=1;
452a64c6 481 }
482
483 //Efficiency for csi
484
485 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
486 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
487 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
488 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
489
490
491
492 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
493 //UNPOLARIZED PHOTONS
494
495 for (i=0;i<26;i++)
496 {
497 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
452a64c6 498 }
499
500 /*******************************************End of rich_media.f***************************************/
501
502
503
504
505
506
507 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
508 zmet[2], zqua[2];
509 Int_t nlmatfre;
510 Float_t densquao;
511 Int_t nlmatmet, nlmatqua;
512 Float_t wmatquao[2], rIndexFreon[26];
513 Float_t aquao[2], epsil, stmin, zquao[2];
514 Int_t nlmatquao;
515 Float_t radlal, densal, tmaxfd, deemax, stemax;
516 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
517
518 Int_t *idtmed = fIdtmed->GetArray()-999;
519
452a64c6 520 // --- Photon energy (GeV)
521 // --- Refraction indexes
522 for (i = 0; i < 26; ++i) {
523 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
524 //rIndexFreon[i] = 1;
452a64c6 525 }
526
527 // --- Detection efficiencies (quantum efficiency for CsI)
528 // --- Define parameters for honeycomb.
529 // Used carbon of equivalent rad. lenght
530
531 ahon = 12.01;
532 zhon = 6.;
9dda3582 533 denshon = 0.1;
452a64c6 534 radlhon = 18.8;
535
536 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
537
538 aqua[0] = 28.09;
539 aqua[1] = 16.;
540 zqua[0] = 14.;
541 zqua[1] = 8.;
542 densqua = 2.64;
543 nlmatqua = -2;
544 wmatqua[0] = 1.;
545 wmatqua[1] = 2.;
546
547 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
548
549 aquao[0] = 28.09;
550 aquao[1] = 16.;
551 zquao[0] = 14.;
552 zquao[1] = 8.;
553 densquao = 2.64;
554 nlmatquao = -2;
555 wmatquao[0] = 1.;
556 wmatquao[1] = 2.;
557
558 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
559
560 afre[0] = 12.;
561 afre[1] = 19.;
562 zfre[0] = 6.;
563 zfre[1] = 9.;
564 densfre = 1.7;
565 nlmatfre = -2;
566 wmatfre[0] = 6.;
567 wmatfre[1] = 14.;
568
569 // --- Parameters to include in GSMIXT, relative to methane (CH4)
570
571 amet[0] = 12.01;
572 amet[1] = 1.;
573 zmet[0] = 6.;
574 zmet[1] = 1.;
575 densmet = 7.17e-4;
576 nlmatmet = -2;
577 wmatmet[0] = 1.;
578 wmatmet[1] = 4.;
579
580 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
581
582 agri = 63.54;
583 zgri = 29.;
584 densgri = 8.96;
585 radlgri = 1.43;
586
587 // --- Parameters to include in GSMATE related to aluminium sheet
588
589 aal = 26.98;
590 zal = 13.;
591 densal = 2.7;
592 radlal = 8.9;
6197ac87 593
594 // --- Glass parameters
595
596 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
597 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
598 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
599 Float_t dglass=1.74;
600
452a64c6 601
602 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
603 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
604 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
605 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
606 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
607 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
608 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
609 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
610 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
611 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
6197ac87 612 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
613 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
452a64c6 614
615 tmaxfd = -10.;
616 stemax = -.1;
617 deemax = -.2;
618 epsil = .001;
619 stmin = -.001;
620
621 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
622 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
623 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
624 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
625 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
626 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
627 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
628 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
629 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
630 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
6197ac87 631 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
632 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 633
634
5cfcdf54 635 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
636 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
637 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
638 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
639 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
640 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
641 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
642 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
643 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
644 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
645 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
452a64c6 646}
dfb4e77d 647//______________________________________________________________________________
452a64c6 648Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
649{
650
651 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
652
653 Float_t en[36] = {5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6.0,6.1,6.2,
654 6.3,6.4,6.5,6.6,6.7,6.8,6.9,7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7,
655 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
656
657
658 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
659 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
660 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
661 1.72,1.53};
662
663 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
664 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
665 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
666 1.714,1.498};
667 Float_t xe=ene;
668 Int_t j=Int_t(xe*10)-49;
669 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
670 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
671
672 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
673 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
674
675 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
676 Float_t tanin=sinin/pdoti;
677
678 Float_t c1=cn*cn-ck*ck-sinin*sinin;
679 Float_t c2=4*cn*cn*ck*ck;
680 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
681 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
682
683 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
684 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
685
686
687 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
688 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
689
690 Float_t sigraf=18.;
691 Float_t lamb=1240/ene;
692 Float_t fresn;
693
694 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
695
696 if(pola)
697 {
698 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
699 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
700 }
701 else
702 fresn=0.5*(rp+rs);
703
704 fresn = fresn*rO;
705 return(fresn);
706}
707
708//__________________________________________
709Float_t AliRICH::AbsoCH4(Float_t x)
710{
711
712 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
713 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
714 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
715 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
716 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
717 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
718 Float_t pn=kPressure/760.;
719 Float_t tn=kTemperature/273.16;
720
721
722// ------- METHANE CROSS SECTION -----------------
723// ASTROPH. J. 214, L47 (1978)
724
725 Float_t sm=0;
726 if (x<7.75)
727 sm=.06e-22;
728
729 if(x>=7.75 && x<=8.1)
730 {
731 Float_t c0=-1.655279e-1;
732 Float_t c1=6.307392e-2;
733 Float_t c2=-8.011441e-3;
734 Float_t c3=3.392126e-4;
735 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
736 }
737
738 if (x> 8.1)
739 {
740 Int_t j=0;
741 while (x<=em[j] && x>=em[j+1])
742 {
743 j++;
744 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
745 sm=(sch4[j]+a*(x-em[j]))*1e-22;
746 }
747 }
748
749 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
750 Float_t abslm=1./sm/dm;
751
752// ------- ISOBUTHANE CROSS SECTION --------------
753// i-C4H10 (ai) abs. length from curves in
754// Lu-McDonald paper for BARI RICH workshop .
755// -----------------------------------------------------------
756
757 Float_t ai;
758 Float_t absli;
759 if (kIgas2 != 0)
760 {
761 if (x<7.25)
762 ai=100000000.;
763
764 if(x>=7.25 && x<7.375)
765 ai=24.3;
766
767 if(x>=7.375)
768 ai=.0000000001;
769
770 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
771 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
772 absli =1./si/di;
773 }
774 else
775 absli=1.e18;
776// ---------------------------------------------------------
777//
778// transmission of O2
779//
780// y= path in cm, x=energy in eV
781// so= cross section for UV absorption in cm2
782// do= O2 molecular density in cm-3
783// ---------------------------------------------------------
784
785 Float_t abslo;
786 Float_t so=0;
787 if(x>=6.0)
788 {
789 if(x>=6.0 && x<6.5)
790 {
791 so=3.392709e-13 * TMath::Exp(2.864104 *x);
792 so=so*1e-18;
793 }
794
795 if(x>=6.5 && x<7.0)
796 {
797 so=2.910039e-34 * TMath::Exp(10.3337*x);
798 so=so*1e-18;
799 }
800
801
802 if (x>=7.0)
803 {
804 Float_t a0=-73770.76;
805 Float_t a1=46190.69;
806 Float_t a2=-11475.44;
807 Float_t a3=1412.611;
808 Float_t a4=-86.07027;
809 Float_t a5=2.074234;
810 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
811 so=so*1e-18;
812 }
813
814 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
815 abslo=1./so/dox;
816 }
817 else
818 abslo=1.e18;
819// ---------------------------------------------------------
820//
821// transmission of H2O
822//
823// y= path in cm, x=energy in eV
824// sw= cross section for UV absorption in cm2
825// dw= H2O molecular density in cm-3
826// ---------------------------------------------------------
827
828 Float_t abslw;
829
dfb4e77d 830 Float_t b0=29231.65;
831 Float_t b1=-15807.74;
832 Float_t b2=3192.926;
833 Float_t b3=-285.4809;
834 Float_t b4=9.533944;
452a64c6 835
dfb4e77d 836 if(x>6.75)
837 {
838 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
839 sw=sw*1e-18;
840 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
841 abslw=1./sw/dw;
842 }
843 else
844 abslw=1.e18;
845
846// ---------------------------------------------------------
452a64c6 847
dfb4e77d 848 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
849 return (alength);
850}
452a64c6 851
452a64c6 852
fb498b56 853
dfb4e77d 854//___________________________________________
dfb4e77d 855//____________________________________________
856void AliRICH::ResetDigits()
857{//Reset number of digits and the digits array for this detector
858 for ( int i=0;i<kNCH;i++ ) {
859 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
860 if (fNdch) fNdch[i]=0;
861 }
862}
863//____________________________________________
864void AliRICH::ResetRawClusters()
865{//Reset number of raw clusters and the raw clust array for this detector
866 for ( int i=0;i<kNCH;i++ ) {
867 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
868 if (fNrawch) fNrawch[i]=0;
869 }
870}
871//____________________________________________
872void AliRICH::ResetRecHits1D()
873{//Reset number of raw clusters and the raw clust array for this detector
874 for ( int i=0;i<kNCH;i++ ) {
875 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
876 if (fNrechits1D) fNrechits1D[i]=0;
877 }
878}
2e5f0f7b 879
dfb4e77d 880//____________________________________________
881void AliRICH::ResetRecHits3D()
882{// Reset number of raw clusters and the raw clust array for this detector
883 for ( int i=0;i<kNCH;i++ ) {
884 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
885 if (fNrechits3D) fNrechits3D[i]=0;
886 }
887}
888//______________________________________________________________________________
942194a4 889void AliRICH::FindClusters(Int_t nev /*kir,Int_t lastEntry*/)
3ea9cb08 890{// Loop on chambers and on cathode planes
2e5f0f7b 891 for (Int_t icat=1;icat<2;icat++) {
892 gAlice->ResetDigits();
34ead2dd 893 gAlice->TreeD()->GetEvent(0);
237c933d 894 for (Int_t ich=0;ich<kNCH;ich++) {
2682e810 895 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
896 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
237c933d 897 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
898 if (pRICHdigits == 0)
2e5f0f7b 899 continue;
900 //
901 // Get ready the current chamber stuff
902 //
903 AliRICHResponse* response = iChamber->GetResponseModel();
a2f7eaf6 904 AliSegmentation* seg = iChamber->GetSegmentationModel();
2e5f0f7b 905 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
906 if (seg) {
907 rec->SetSegmentation(seg);
908 rec->SetResponse(response);
237c933d 909 rec->SetDigits(pRICHdigits);
2e5f0f7b 910 rec->SetChamber(ich);
911 if (nev==0) rec->CalibrateCOG();
912 rec->FindRawClusters();
913 }
914 TClonesArray *fRch;
915 fRch=RawClustAddress(ich);
916 fRch->Sort();
917 } // for ich
918
919 gAlice->TreeR()->Fill();
920 TClonesArray *fRch;
237c933d 921 for (int i=0;i<kNCH;i++) {
2e5f0f7b 922 fRch=RawClustAddress(i);
3ea9cb08 923 fRch->GetEntriesFast();
2e5f0f7b 924 }
925
926 ResetRawClusters();
927
928 } // for icat
929
930 char hname[30];
931 sprintf(hname,"TreeR%d",nev);
33984590 932 gAlice->TreeR()->Write(hname,kOverwrite,0);
dfb4e77d 933 gAlice->TreeR()->Reset();
942194a4 934}//void AliRICH::FindClusters(Int_t nev)
dfb4e77d 935//______________________________________________________________________________
853634d3 936AliRICHSDigit* AliRICH::FirstPad(AliRICHhit* hit,TClonesArray *clusters )
dfb4e77d 937{// Initialise the pad iterator Return the address of the first sdigit for hit
ddae0931 938 TClonesArray *theClusters = clusters;
939 Int_t nclust = theClusters->GetEntriesFast();
6e585aa2 940 if (nclust && hit->PHlast() > 0) {
941 sMaxIterPad=Int_t(hit->PHlast());
942 sCurIterPad=Int_t(hit->PHfirst());
b251a2b5 943 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 944 } else {
945 return 0;
fe4da5cc 946 }
ddae0931 947
fe4da5cc 948}
dfb4e77d 949//______________________________________________________________________________
b251a2b5 950AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
dfb4e77d 951{// Iterates over pads
237c933d 952
ddae0931 953 sCurIterPad++;
954 if (sCurIterPad <= sMaxIterPad) {
b251a2b5 955 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 956 } else {
957 return 0;
958 }
fe4da5cc 959}
960
ddae0931 961
cc683707 962void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
a3d71079 963{
964
965 Int_t NpadX = 162; // number of pads on X
966 Int_t NpadY = 162; // number of pads on Y
967
968 Int_t Pad[162][162];
969 for (Int_t i=0;i<NpadX;i++) {
970 for (Int_t j=0;j<NpadY;j++) {
971 Pad[i][j]=0;
972 }
973 }
974
975 // Create some histograms
976
977 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
978 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
979 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
980 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
981 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
982 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
983 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
984 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
985 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
986 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
987 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
988 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
989 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
990 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
991 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
992 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
993 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
994 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
995 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
996 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
997 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
998 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
999 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
1000 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
1001 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
1002 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
1003 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
1004 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
1005 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
1006 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
1007 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
1008 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
1009
1010
1011
1012
1013// Start loop over events
1014
1015 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
1016 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
1017 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
1018 TRandom* random=0;
1019
1020 for (int nev=0; nev<= evNumber2; nev++) {
1021 Int_t nparticles = gAlice->GetEvent(nev);
1022
1023
a3d71079 1024 if (nev < evNumber1) continue;
1025 if (nparticles <= 0) return;
1026
1027// Get pointers to RICH detector and Hits containers
1028
1029 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
1030
88cb7938 1031 TTree *treeH = TreeH();
a3d71079 1032 Int_t ntracks =(Int_t) treeH->GetEntries();
1033
1034// Start loop on tracks in the hits containers
1035
1036 for (Int_t track=0; track<ntracks;track++) {
1037 printf ("Processing Track: %d\n",track);
1038 gAlice->ResetHits();
1039 treeH->GetEvent(track);
1040
853634d3 1041 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
a3d71079 1042 mHit;
853634d3 1043 mHit=(AliRICHhit*)pRICH->NextHit())
a3d71079 1044 {
1045 //Int_t nch = mHit->fChamber; // chamber number
1046 //Float_t x = mHit->X(); // x-pos of hit
1047 //Float_t y = mHit->Z(); // y-pos
1048 //Float_t z = mHit->Y();
6e585aa2 1049 //Float_t phi = mHit->Phi(); //Phi angle of incidence
1050 Float_t theta = mHit->Theta(); //Theta angle of incidence
a3d71079 1051 Float_t px = mHit->MomX();
1052 Float_t py = mHit->MomY();
1053 Int_t index = mHit->Track();
6e585aa2 1054 Int_t particle = (Int_t)(mHit->Particle());
a3d71079 1055 Float_t R;
1056 Float_t PTfinal;
1057 Float_t PTvertex;
1058
1059 TParticle *current = gAlice->Particle(index);
1060
1061 //Float_t energy=current->Energy();
1062
1063 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
1064 PTfinal=TMath::Sqrt(px*px + py*py);
1065 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
1066
1067
1068
1069 if (TMath::Abs(particle) < 10000000)
1070 {
1071 hitsTheta->Fill(theta,(float) 1);
1072 if (R<5)
1073 {
1074 if (PTvertex>.5 && PTvertex<=1)
1075 {
1076 hitsTheta500MeV->Fill(theta,(float) 1);
1077 }
1078 if (PTvertex>1 && PTvertex<=2)
1079 {
1080 hitsTheta1GeV->Fill(theta,(float) 1);
1081 }
1082 if (PTvertex>2 && PTvertex<=3)
1083 {
1084 hitsTheta2GeV->Fill(theta,(float) 1);
1085 }
1086 if (PTvertex>3)
1087 {
1088 hitsTheta3GeV->Fill(theta,(float) 1);
1089 }
1090 }
1091
1092 }
1093
1094 //if (nch == 3)
1095 //{
1096
a3d71079 1097 if (TMath::Abs(particle) < 50000051)
1098 {
1099 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
1100 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
1101 {
1102 //gMC->Rndm(&random, 1);
1103 if (random->Rndm() < .1)
1104 production->Fill(current->Vz(),R,(float) 1);
1105 if (TMath::Abs(particle) == 50000050)
1106 //if (TMath::Abs(particle) > 50000000)
1107 {
1108 photons +=1;
1109 if (R<5)
1110 {
1111 primaryphotons +=1;
1112 if (current->Energy()>0.001)
1113 highprimaryphotons +=1;
1114 }
1115 }
1116 if (TMath::Abs(particle) == 2112)
1117 {
1118 neutron +=1;
1119 if (current->Energy()>0.0001)
1120 highneutrons +=1;
1121 }
1122 }
1123 if (TMath::Abs(particle) < 50000000)
1124 {
1125 production->Fill(current->Vz(),R,(float) 1);
a3d71079 1126 }
1127 //mip->Fill(x,y,(float) 1);
1128 }
1129
1130 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1131 {
1132 if (R<5)
1133 {
1134 pionptspectravertex->Fill(PTvertex,(float) 1);
1135 pionptspectrafinal->Fill(PTfinal,(float) 1);
1136 }
1137 }
1138
1139 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1140 || TMath::Abs(particle)==311)
1141 {
1142 if (R<5)
1143 {
1144 kaonptspectravertex->Fill(PTvertex,(float) 1);
1145 kaonptspectrafinal->Fill(PTfinal,(float) 1);
1146 }
1147 }
1148
1149
1150 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1151 {
1152 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1153 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1154 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1155 if (R>250 && R<450)
1156 {
1157 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1158 }
a3d71079 1159 pion +=1;
1160 if (TMath::Abs(particle)==211)
1161 {
1162 chargedpions +=1;
1163 if (R<5)
1164 {
1165 primarypions +=1;
1166 if (current->Energy()>1)
1167 highprimarypions +=1;
1168 }
1169 }
1170 }
1171 if (TMath::Abs(particle)==2212)
1172 {
1173 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1174 //ptspectra->Fill(Pt,(float) 1);
1175 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1176 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1177 if (R>250 && R<450)
1178 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1179 proton +=1;
1180 }
1181 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1182 || TMath::Abs(particle)==311)
1183 {
1184 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1185 //ptspectra->Fill(Pt,(float) 1);
1186 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1187 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1188 if (R>250 && R<450)
1189 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1190 kaon +=1;
1191 if (TMath::Abs(particle)==321)
1192 {
1193 chargedkaons +=1;
1194 if (R<5)
1195 {
1196 primarykaons +=1;
1197 if (current->Energy()>1)
1198 highprimarykaons +=1;
1199 }
1200 }
1201 }
1202 if (TMath::Abs(particle)==11)
1203 {
1204 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1205 //ptspectra->Fill(Pt,(float) 1);
1206 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1207 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1208 if (R>250 && R<450)
1209 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1210 if (particle == 11)
1211 electron +=1;
1212 if (particle == -11)
1213 positron +=1;
1214 }
1215 if (TMath::Abs(particle)==13)
1216 {
1217 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1218 //ptspectra->Fill(Pt,(float) 1);
1219 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1220 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1221 if (R>250 && R<450)
1222 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1223 muon +=1;
1224 }
1225 if (TMath::Abs(particle)==2112)
1226 {
1227 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1228 //ptspectra->Fill(Pt,(float) 1);
1229 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1230 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1231 if (R>250 && R<450)
1232 {
1233 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
a3d71079 1234 }
a3d71079 1235 neutron +=1;
1236 }
1237 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
1238 {
1239 if (current->Energy()-current->GetCalcMass()>1)
1240 {
1241 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1242 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1243 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1244 if (R>250 && R<450)
1245 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1246 }
1247 }
a3d71079 1248 // Fill the histograms
1249 //Nh1+=nhits;
1250 //h->Fill(x,y,(float) 1);
1251 //}
1252 //}
1253 }
1254
1255 }
1256
1257 }
1258 // }
fb498b56 1259
1260 TStyle *mystyle=new TStyle("Plain","mystyle");
1261 mystyle->SetPalette(1,0);
1262 mystyle->cd();
a3d71079 1263
1264 //Create canvases, set the view range, show histograms
1265
1266 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
1267 c2->Divide(2,2);
1268 //c2->SetFillColor(42);
1269
1270 c2->cd(1);
1271 hitsTheta500MeV->SetFillColor(5);
1272 hitsTheta500MeV->Draw();
1273 c2->cd(2);
1274 hitsTheta1GeV->SetFillColor(5);
1275 hitsTheta1GeV->Draw();
1276 c2->cd(3);
1277 hitsTheta2GeV->SetFillColor(5);
1278 hitsTheta2GeV->Draw();
1279 c2->cd(4);
1280 hitsTheta3GeV->SetFillColor(5);
1281 hitsTheta3GeV->Draw();
1282
1283
1284
1285 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
1286 c15->cd();
1287 production->SetFillColor(42);
1288 production->SetXTitle("z (m)");
1289 production->SetYTitle("R (m)");
1290 production->Draw();
1291
1292 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
1293 c10->Divide(2,2);
1294 c10->cd(1);
1295 pionptspectravertex->SetFillColor(5);
1296 pionptspectravertex->SetXTitle("Pt (GeV)");
1297 pionptspectravertex->Draw();
1298 c10->cd(2);
1299 pionptspectrafinal->SetFillColor(5);
1300 pionptspectrafinal->SetXTitle("Pt (GeV)");
1301 pionptspectrafinal->Draw();
1302 c10->cd(3);
1303 kaonptspectravertex->SetFillColor(5);
1304 kaonptspectravertex->SetXTitle("Pt (GeV)");
1305 kaonptspectravertex->Draw();
1306 c10->cd(4);
1307 kaonptspectrafinal->SetFillColor(5);
1308 kaonptspectrafinal->SetXTitle("Pt (GeV)");
1309 kaonptspectrafinal->Draw();
1310
1311
1312 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
1313 c16->Divide(2,1);
1314
1315 c16->cd(1);
1316 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
1317 electronspectra1->SetFillColor(5);
1318 electronspectra1->SetXTitle("log(GeV)");
1319 electronspectra2->SetFillColor(46);
1320 electronspectra2->SetXTitle("log(GeV)");
1321 electronspectra3->SetFillColor(10);
1322 electronspectra3->SetXTitle("log(GeV)");
1323 //c13->SetLogx();
1324 electronspectra1->Draw();
1325 electronspectra2->Draw("same");
1326 electronspectra3->Draw("same");
1327
1328 c16->cd(2);
1329 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
1330 muonspectra1->SetFillColor(5);
1331 muonspectra1->SetXTitle("log(GeV)");
1332 muonspectra2->SetFillColor(46);
1333 muonspectra2->SetXTitle("log(GeV)");
1334 muonspectra3->SetFillColor(10);
1335 muonspectra3->SetXTitle("log(GeV)");
1336 //c14->SetLogx();
1337 muonspectra1->Draw();
1338 muonspectra2->Draw("same");
1339 muonspectra3->Draw("same");
1340
1341 //c16->cd(3);
1342 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
1343 //neutronspectra1->SetFillColor(42);
1344 //neutronspectra1->SetXTitle("log(GeV)");
1345 //neutronspectra2->SetFillColor(46);
1346 //neutronspectra2->SetXTitle("log(GeV)");
1347 //neutronspectra3->SetFillColor(10);
1348 //neutronspectra3->SetXTitle("log(GeV)");
1349 //c16->SetLogx();
1350 //neutronspectra1->Draw();
1351 //neutronspectra2->Draw("same");
1352 //neutronspectra3->Draw("same");
1353
1354 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
1355 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
1356 c9->Divide(2,2);
1357
1358 c9->cd(1);
1359 pionspectra1->SetFillColor(5);
1360 pionspectra1->SetXTitle("log(GeV)");
1361 pionspectra2->SetFillColor(46);
1362 pionspectra2->SetXTitle("log(GeV)");
1363 pionspectra3->SetFillColor(10);
1364 pionspectra3->SetXTitle("log(GeV)");
1365 //c9->SetLogx();
1366 pionspectra1->Draw();
1367 pionspectra2->Draw("same");
1368 pionspectra3->Draw("same");
1369
1370 c9->cd(2);
1371 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
1372 protonspectra1->SetFillColor(5);
1373 protonspectra1->SetXTitle("log(GeV)");
1374 protonspectra2->SetFillColor(46);
1375 protonspectra2->SetXTitle("log(GeV)");
1376 protonspectra3->SetFillColor(10);
1377 protonspectra3->SetXTitle("log(GeV)");
1378 //c10->SetLogx();
1379 protonspectra1->Draw();
1380 protonspectra2->Draw("same");
1381 protonspectra3->Draw("same");
1382
1383 c9->cd(3);
1384 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
1385 kaonspectra1->SetFillColor(5);
1386 kaonspectra1->SetXTitle("log(GeV)");
1387 kaonspectra2->SetFillColor(46);
1388 kaonspectra2->SetXTitle("log(GeV)");
1389 kaonspectra3->SetFillColor(10);
1390 kaonspectra3->SetXTitle("log(GeV)");
1391 //c11->SetLogx();
1392 kaonspectra1->Draw();
1393 kaonspectra2->Draw("same");
1394 kaonspectra3->Draw("same");
1395
1396 c9->cd(4);
1397 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
1398 chargedspectra1->SetFillColor(5);
1399 chargedspectra1->SetXTitle("log(GeV)");
1400 chargedspectra2->SetFillColor(46);
1401 chargedspectra2->SetXTitle("log(GeV)");
1402 chargedspectra3->SetFillColor(10);
1403 chargedspectra3->SetXTitle("log(GeV)");
1404 //c12->SetLogx();
1405 chargedspectra1->Draw();
1406 chargedspectra2->Draw("same");
1407 chargedspectra3->Draw("same");
1408
1409
1410
1411 printf("*****************************************\n");
1412 printf("* Particle * Counts *\n");
1413 printf("*****************************************\n");
1414
1415 printf("* Pions: * %4d *\n",pion);
1416 printf("* Charged Pions: * %4d *\n",chargedpions);
1417 printf("* Primary Pions: * %4d *\n",primarypions);
1418 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
1419 printf("* Kaons: * %4d *\n",kaon);
1420 printf("* Charged Kaons: * %4d *\n",chargedkaons);
1421 printf("* Primary Kaons: * %4d *\n",primarykaons);
1422 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
1423 printf("* Muons: * %4d *\n",muon);
1424 printf("* Electrons: * %4d *\n",electron);
1425 printf("* Positrons: * %4d *\n",positron);
1426 printf("* Protons: * %4d *\n",proton);
1427 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
1428 printf("*****************************************\n");
1429 //printf("* Photons: * %3.1f *\n",photons);
1430 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
1431 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
1432 //printf("*****************************************\n");
1433 //printf("* Neutrons: * %3.1f *\n",neutron);
1434 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
1435 //printf("*****************************************\n");
1436
1437 if (gAlice->TreeD())
1438 {
1439 gAlice->TreeD()->GetEvent(0);
1440
1441 Float_t occ[7];
1442 Float_t sum=0;
1443 Float_t mean=0;
1444 printf("\n*****************************************\n");
1445 printf("* Chamber * Digits * Occupancy *\n");
1446 printf("*****************************************\n");
1447
1448 for (Int_t ich=0;ich<7;ich++)
1449 {
1450 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
1451 Int_t ndigits = Digits->GetEntriesFast();
1452 occ[ich] = Float_t(ndigits)/(160*144);
1453 sum += Float_t(ndigits)/(160*144);
1454 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
1455 }
1456 mean = sum/7;
1457 printf("*****************************************\n");
1458 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
1459 printf("*****************************************\n");
1460 }
1461
1462 printf("\nEnd of analysis\n");
1463
dfb4e77d 1464}//void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1465//______________________________________________________________________________
cc683707 1466void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
a3d71079 1467{
1468
1469AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1470 AliRICHSegmentationV0* segmentation;
1471 AliRICHChamber* chamber;
1472
1473 chamber = &(pRICH->Chamber(0));
15d8311d 1474 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
a3d71079 1475
1476 Int_t NpadX = segmentation->Npx(); // number of pads on X
1477 Int_t NpadY = segmentation->Npy(); // number of pads on Y
1478
1479 //Int_t Pad[144][160];
1480 /*for (Int_t i=0;i<NpadX;i++) {
1481 for (Int_t j=0;j<NpadY;j++) {
1482 Pad[i][j]=0;
1483 }
1484 } */
1485
1486
1487 Int_t xmin= -NpadX/2;
1488 Int_t xmax= NpadX/2;
1489 Int_t ymin= -NpadY/2;
1490 Int_t ymax= NpadY/2;
fb498b56 1491
1492 Float_t PTfinal = 0;
1493 Int_t pionCount = 0;
1494 Int_t kaonCount = 0;
1495 Int_t protonCount = 0;
a3d71079 1496
1497 TH2F *feedback = 0;
1498 TH2F *mip = 0;
1499 TH2F *cerenkov = 0;
1500 TH2F *h = 0;
1501 TH1F *hitsX = 0;
1502 TH1F *hitsY = 0;
1503
fb498b56 1504 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
a3d71079 1505
1506 if (diaglevel == 1)
1507 {
1508 printf("Single Ring Hits\n");
fb498b56 1509 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
1510 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
1511 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
1512 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
1513 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
1514 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
a3d71079 1515 }
1516 else
1517 {
1518 printf("Full Event Hits\n");
1519
1520 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
1521 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
1522 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
1523 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
1524 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
1525 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
1526 }
1527
ca96c9ea 1528
ddae0931 1529
a3d71079 1530 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1531 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1532 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1533 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1534 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1535 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1536 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1537
1538 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
fb498b56 1539 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
a3d71079 1540 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
1541 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
1542 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
1543 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
1544 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
1545 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
1546 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
1547 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
1548 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
1549 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
1550 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
1551 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
1552 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
1553 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
1554 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
1555 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
1556 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
1557 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
1558 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
fb498b56 1559 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
1560 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
1561 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
1562 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
1563 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
1564 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
1565 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
a3d71079 1566 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
1567 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
fb498b56 1568 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
1569 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
1570 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
1571 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
1572 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
1573 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
1574 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
1575
a3d71079 1576
1577// Start loop over events
1578
1579 Int_t Nh=0;
1580 Int_t pads=0;
1581 Int_t Nh1=0;
1582 Int_t mothers[80000];
1583 Int_t mothers2[80000];
1584 Float_t mom[3];
1585 Int_t nraw=0;
1586 Int_t phot=0;
1587 Int_t feed=0;
1588 Int_t padmip=0;
1589 Float_t x=0,y=0;
fb498b56 1590
1591 Float_t chiSquareOmega = 0;
1592 Float_t chiSquareTheta = 0;
1593 Float_t chiSquarePhi = 0;
1594
1595 Float_t recEffEvent = 0;
1596 Float_t recEffTotal = 0;
1597
1598 Float_t trackglob[3];
1599 Float_t trackloc[3];
1600
a3d71079 1601
1602 for (Int_t i=0;i<100;i++) mothers[i]=0;
1603
1604 for (int nev=0; nev<= evNumber2; nev++) {
1605 Int_t nparticles = gAlice->GetEvent(nev);
1606
1607
1608 //cout<<"nev "<<nev<<endl;
1609 printf ("\n**********************************\nProcessing Event: %d\n",nev);
1610 //cout<<"nparticles "<<nparticles<<endl;
1611 printf ("Particles : %d\n\n",nparticles);
1612 if (nev < evNumber1) continue;
1613 if (nparticles <= 0) return;
1614
1615// Get pointers to RICH detector and Hits containers
1616
1617
88cb7938 1618 TTree *TH = TreeH();
a3d71079 1619 Stat_t ntracks = TH->GetEntries();
1620
1621 // Start loop on tracks in the hits containers
1622 //Int_t Nc=0;
1623 for (Int_t track=0; track<ntracks;track++) {
1624
1625 printf ("\nProcessing Track: %d\n",track);
1626 gAlice->ResetHits();
1627 TH->GetEvent(track);
1628 Int_t nhits = pRICH->Hits()->GetEntriesFast();
1629 if (nhits) Nh+=nhits;
1630 printf("Hits : %d\n",nhits);
853634d3 1631 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
a3d71079 1632 mHit;
853634d3 1633 mHit=(AliRICHhit*)pRICH->NextHit())
a3d71079 1634 {
fb498b56 1635 Int_t nch = mHit->Chamber(); // chamber number
1636 trackglob[0] = mHit->X(); // x-pos of hit
1637 trackglob[1] = mHit->Y();
1638 trackglob[2] = mHit->Z(); // y-pos of hit
1639 //x = mHit->X(); // x-pos of hit
1640 //y = mHit->Z(); // y-pos
6e585aa2 1641 Float_t phi = mHit->Phi(); //Phi angle of incidence
1642 Float_t theta = mHit->Theta(); //Theta angle of incidence
a3d71079 1643 Int_t index = mHit->Track();
6e585aa2 1644 Int_t particle = (Int_t)(mHit->Particle());
a3d71079 1645 //Int_t freon = (Int_t)(mHit->fLoss);
fb498b56 1646 Float_t px = mHit->MomX();
1647 Float_t py = mHit->MomY();
1648
1649 if (TMath::Abs(particle) < 10000000)
1650 {
1651 PTfinal=TMath::Sqrt(px*px + py*py);
fb498b56 1652 }
1653
1654 chamber = &(pRICH->Chamber(nch-1));
1655
fb498b56 1656
1657 chamber->GlobaltoLocal(trackglob,trackloc);
1658
1659 chamber->LocaltoGlobal(trackloc,trackglob);
1660
1661
1662 x=trackloc[0];
1663 y=trackloc[2];
a3d71079 1664
1665 hitsX->Fill(x,(float) 1);
1666 hitsY->Fill(y,(float) 1);
1667
a3d71079 1668
1669 TParticle *current = (TParticle*)gAlice->Particle(index);
1670 //printf("Particle type: %d\n",sizeoff(Particles));
1671
1672 hitsTheta->Fill(theta,(float) 1);
1673 //hitsPhi->Fill(phi,(float) 1);
1674 //if (pRICH->GetDebugLevel() == -1)
a3d71079 1675
1676 if (current->GetPdgCode() < 10000000)
1677 {
1678 mip->Fill(x,y,(float) 1);
1679 //printf("adding mip\n");
1680 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
1681 //{
1682 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
1683 //hitsTheta->Fill(theta,(float) 1);
1684 //printf("Theta:%f, Phi:%f\n",theta,phi);
1685 //}
1686 }
1687
1688 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1689 {
1690 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
1691 }
1692 if (TMath::Abs(particle)==2212)
1693 {
1694 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
1695 }
1696 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1697 || TMath::Abs(particle)==311)
1698 {
1699 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
1700 }
1701 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
1702 {
1703 if (current->Energy() - current->GetCalcMass()>1)
1704 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
1705 }
1706 //printf("Hits:%d\n",hit);
1707 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
1708 // Fill the histograms
1709 Nh1+=nhits;
1710 h->Fill(x,y,(float) 1);
1711 //}
1712 //}
fb498b56 1713 }
a3d71079 1714
1715 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
1716 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
1717 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
1718
1719 if (ncerenkovs) {
1720 printf("Cerenkovs : %d\n",ncerenkovs);
1721 totalphotonsevent->Fill(ncerenkovs,(float) 1);
1722 for (Int_t hit=0;hit<ncerenkovs;hit++) {
1723 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
fb498b56 1724 Int_t nchamber = cHit->fChamber; // chamber number
a3d71079 1725 Int_t index = cHit->Track();
1726 //Int_t pindex = (Int_t)(cHit->fIndex);
fb498b56 1727 trackglob[0] = cHit->X(); // x-pos of hit
1728 trackglob[1] = cHit->Y();
1729 trackglob[2] = cHit->Z(); // y-pos of hit
1730 //Float_t cx = cHit->X(); // x-position
1731 //Float_t cy = cHit->Z(); // y-position
a3d71079 1732 Int_t cmother = cHit->fCMother; // Index of mother particle
1733 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
1734 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
a3d71079 1735
fb498b56 1736 chamber = &(pRICH->Chamber(nchamber-1));
1737
1738 //printf("Nch:%d\n",nch);
1739
1740 chamber->GlobaltoLocal(trackglob,trackloc);
1741
1742 chamber->LocaltoGlobal(trackloc,trackglob);
1743
1744
1745 Float_t cx=trackloc[0];
1746 Float_t cy=trackloc[2];
1747
1748 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
1749
1750
a3d71079 1751 //printf("Particle:%9d\n",index);
1752
1753 TParticle *current = (TParticle*)gAlice->Particle(index);
1754 Float_t energyckov = current->Energy();
1755
1756 if (current->GetPdgCode() == 50000051)
1757 {
1758 if (closs==4)
1759 {
1760 feedback->Fill(cx,cy,(float) 1);
1761 feed++;
1762 }
1763 }
1764 if (current->GetPdgCode() == 50000050)
1765 {
1766
1767 if (closs !=4)
1768 {
1769 phspectra2->Fill(energyckov*1e9,(float) 1);
1770 }
1771
1772 if (closs==4)
1773 {
1774 cerenkov->Fill(cx,cy,(float) 1);
1775
1776 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
1777
1778 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
853634d3 1779 AliRICHhit* mipHit = (AliRICHhit*) pRICH->Hits()->UncheckedAt(0);
a3d71079 1780 mom[0] = current->Px();
1781 mom[1] = current->Py();
1782 mom[2] = current->Pz();
1783 //mom[0] = cHit->fMomX;
1784 // mom[1] = cHit->fMomZ;
1785 //mom[2] = cHit->fMomY;
1786 //Float_t energymip = MIP->Energy();
1787 //Float_t Mip_px = mipHit->fMomFreoX;
1788 //Float_t Mip_py = mipHit->fMomFreoY;
1789 //Float_t Mip_pz = mipHit->fMomFreoZ;
1790 //Float_t Mip_px = MIP->Px();
1791 //Float_t Mip_py = MIP->Py();
1792 //Float_t Mip_pz = MIP->Pz();
1793
1794
1795
1796 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1797 //Float_t rt = TMath::Sqrt(r);
1798 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
1799 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
1800 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
1801 //Float_t cherenkov = TMath::ACos(coscerenkov);
1802 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
1803 //printf("Cherenkov: %f\n",cherenkov);
1804 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
1805 hckphi->Fill(ckphi,(float) 1);
1806
1807
1808 //Float_t mix = MIP->Vx();
1809 //Float_t miy = MIP->Vy();
1810 Float_t mx = mipHit->X();
1811 Float_t my = mipHit->Z();
1812 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
fb498b56 1813 Float_t dx = trackglob[0] - mx;
1814 Float_t dy = trackglob[2] - my;
a3d71079 1815 //printf("Dx:%f, Dy:%f\n",dx,dy);
1816 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
1817 //printf("Final radius:%f\n",final_radius);
1818 radius->Fill(final_radius,(float) 1);
1819
1820 phspectra1->Fill(energyckov*1e9,(float) 1);
1821 phot++;
1822 }
1823 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
1824 if (cmother == nmothers){
1825 if (closs == 4)
1826 mothers2[cmother]++;
1827 mothers[cmother]++;
1828 }
1829 }
1830 }
1831 }
1832 }
1833
1834
1835 if(gAlice->TreeR())
1836 {
1837 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1838 gAlice->TreeR()->GetEvent(nent-1);
1839 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
1840 //printf ("Rawclusters:%p",Rawclusters);
1841 Int_t nrawclusters = Rawclusters->GetEntriesFast();
1842
1843 if (nrawclusters) {
1844 printf("Raw Clusters : %d\n",nrawclusters);
1845 for (Int_t hit=0;hit<nrawclusters;hit++) {
1846 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
1847 //Int_t nchamber = rcHit->fChamber; // chamber number
1848 //Int_t nhit = cHit->fHitNumber; // hit number
1849 Int_t qtot = rcHit->fQ; // charge
1850 Float_t fx = rcHit->fX; // x-position
1851 Float_t fy = rcHit->fY; // y-position
1852 //Int_t type = rcHit->fCtype; // cluster type ?
1853 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
1854 pads += mult;
1855 if (qtot > 0) {
1856 //printf ("fx: %d, fy: %d\n",fx,fy);
1857 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
1858 //printf("There %d \n",mult);
1859 padmip+=mult;
1860 } else {
1861 padnumber->Fill(mult,(float) 1);
1862 nraw++;
1863 if (mult<4) Clcharge->Fill(qtot,(float) 1);
1864 }
1865
1866 }
1867 }
1868 }
1869
1870
1871 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
1872 Int_t nrechits1D = RecHits1D->GetEntriesFast();
1873 //printf (" nrechits:%d\n",nrechits);
1874
1875 if(nrechits1D)
1876 {
1877 for (Int_t hit=0;hit<nrechits1D;hit++) {
1878 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
1879 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
1880 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
1881 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
1882 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
1883 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
1884
1885 Omega1D->Fill(r_omega,(float) 1);
1886
1887 for (Int_t i=0; i<goodPhotons; i++)
1888 {
1889 PhotonCer->Fill(cer_pho[i],(float) 1);
1890 PadsUsed->Fill(padsx[i],padsy[i],1);
1891 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
1892 }
1893
1894 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
1895 }
1896 }
1897
1898
1899 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
1900 Int_t nrechits3D = RecHits3D->GetEntriesFast();
1901 //printf (" nrechits:%d\n",nrechits);
1902
1903 if(nrechits3D)
1904 {
fb498b56 1905 recEffEvent = 0;
1906
1907 //for (Int_t hit=0;hit<nrechits3D;hit++) {
1908 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
1909 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
1910 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
1911 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
1912 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
1913 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
1914 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
1915 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
1916
1917
1918 //correction to track cerenkov angle
1919 originalOmega = (Float_t) ckovangle->GetMean();
1920
1921 if(diaglevel == 4)
1922 {
1923 printf("\nMean cerenkov angle: %f\n", originalOmega);
1924 printf("Reconstructed cerenkov angle: %f\n",r_omega);
1925 }
1926
1927 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
1928 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
1929 Float_t phiError = TMath::Abs(originalPhi - r_phi);
1930
1931 //chiSquareOmega += (omegaError/originalOmega)*(omegaError/originalOmega);
1932 //chiSquareTheta += (thetaError/originalTheta)*(thetaError/originalTheta);
1933 //chiSquarePhi += (phiError/originalPhi)*(phiError/originalPhi);
1934
1935 if(TMath::Abs(omegaError) < 0.015)
1936 recEffEvent += 1;
1937
1938
1939
1940 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
1941
1942 Omega3D->Fill(r_omega,(float) 1);
1943 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
1944 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
1945 MeanRadius->Fill(meanradius,(float) 1);
1946 identification->Fill(PTfinal, r_omega,1);
1947 OriginalOmega->Fill(originalOmega, (float) 1);
1948 OriginalTheta->Fill(originalTheta, (float) 1);
1949 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
1950 OmegaError->Fill(omegaError, (float) 1);
1951 ThetaError->Fill(thetaError, (float) 1);
1952 PhiError->Fill(phiError, (float) 1);
1953
1954 recEffEvent = recEffEvent;
1955 recEffTotal += recEffEvent;
1956
1957 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
1958 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
1959 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
1960
1961 Float_t piondist = TMath::Abs(r_omega - pioncer);
1962 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
1963 Float_t protondist = TMath::Abs(r_omega - protoncer);
1964
1965 if(diaglevel == 4)
1966 {
1967 if(pioncer<r_omega)
1968 {
1969 printf("Identified as a PION!\n");
1970 pionCount += 1;
1971 }
1972 if(kaoncer<r_omega && pioncer>r_omega)
1973 {
1974 if(kaondist>piondist)
1975 {
1976 printf("Identified as a PION!\n");
1977 pionCount += 1;
1978 }
1979 else
1980 {
1981 printf("Identified as a KAON!\n");
1982 kaonCount += 1;
1983 }
1984 } }
1985 if(protoncer<r_omega && kaoncer>r_omega)
1986 {
1987 if(kaondist>protondist)
1988 {
1989 printf("Identified as a PROTON!\n");
1990 protonCount += 1;
1991 }
1992 else
1993 {
1994 printf("Identified as a KAON!\n");
1995 pionCount += 1;
1996 }
1997 }
1998 if(protoncer>r_omega)
1999 {
2000 printf("Identified as a PROTON!\n");
2001 protonCount += 1;
2002 }
2003
2004 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
a3d71079 2005 }
2006 }
2007 }
fb498b56 2008
a3d71079 2009
2010 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
fb498b56 2011 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
2012 mother->Fill(mothers2[nmothers],(float) 1);
2013 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
a3d71079 2014 }
2015
2016 clusev->Fill(nraw,(float) 1);
2017 photev->Fill(phot,(float) 1);
2018 feedev->Fill(feed,(float) 1);
2019 padsmip->Fill(padmip,(float) 1);
2020 padscl->Fill(pads,(float) 1);
2021 //printf("Photons:%d\n",phot);
2022 phot = 0;
2023 feed = 0;
2024 pads = 0;
2025 nraw=0;
2026 padmip=0;
fb498b56 2027
2028
2029
a3d71079 2030 gAlice->ResetDigits();
2031 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
2032 gAlice->TreeD()->GetEvent(0);
fb498b56 2033
a3d71079 2034 if (diaglevel < 4)
2035 {
fb498b56 2036
2037
a3d71079 2038 TClonesArray *Digits = pRICH->DigitsAddress(2);
2039 Int_t ndigits = Digits->GetEntriesFast();
2040 printf("Digits : %d\n",ndigits);
2041 padsev->Fill(ndigits,(float) 1);
2042 for (Int_t hit=0;hit<ndigits;hit++) {
2043 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
6e585aa2 2044 Int_t qtot = dHit->Signal(); // charge
2045 Int_t ipx = dHit->PadX(); // pad number on X
2046 Int_t ipy = dHit->PadY(); // pad number on Y
a3d71079 2047 //printf("%d, %d\n",ipx,ipy);
2048 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
2049 }
2050 }
fb498b56 2051
a3d71079 2052 if (diaglevel == 5)
2053 {
2054 for (Int_t ich=0;ich<7;ich++)
2055 {
2056 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
2057 Int_t ndigits = Digits->GetEntriesFast();
2058 //printf("Digits:%d\n",ndigits);
2059 padsev->Fill(ndigits,(float) 1);
2060 if (ndigits) {
2061 for (Int_t hit=0;hit<ndigits;hit++) {
2062 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
6e585aa2 2063 //Int_t nchamber = dHit->GetChamber(); // chamber number
a3d71079 2064 //Int_t nhit = dHit->fHitNumber; // hit number
6e585aa2 2065 Int_t qtot = dHit->Signal(); // charge
2066 Int_t ipx = dHit->PadX(); // pad number on X
2067 Int_t ipy = dHit->PadY(); // pad number on Y
a3d71079 2068 //Int_t iqpad = dHit->fQpad; // charge per pad
2069 //Int_t rpad = dHit->fRSec; // R-position of pad
2070 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
2071 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
2072 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
2073 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
2074 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
2075 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
2076 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
2077 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
2078 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
2079 }
2080 }
2081 }
2082 }
2083 }
fb498b56 2084
2085 if(diaglevel == 4)
2086 {
2087
2088 Stat_t omegaE;
2089 Stat_t thetaE;
2090 Stat_t phiE;
2091
2092 Stat_t omegaO;
2093 Stat_t thetaO;
2094 Stat_t phiO;
a3d71079 2095
fb498b56 2096 for(Int_t i=0;i<99;i++)
2097 {
2098 omegaE = OriginalOmega->GetBinContent(i);
2099 if(omegaE != 0)
2100 {
2101 omegaO = Omega3D->GetBinContent(i);
2102 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
2103 }
2104
2105 thetaE = OriginalTheta->GetBinContent(i);
2106 if(thetaE != 0)
2107 {
2108 thetaO = Theta->GetBinContent(i);
2109 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
2110 }
2111
2112 phiE = OriginalPhi->GetBinContent(i);
2113 if(phiE != 0)
2114 {
2115 phiO = Phi->GetBinContent(i);
2116 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
2117 }
2118
2119 //printf(" o: %f t: %f p: %f\n", OriginalOmega->GetBinContent(i), OriginalTheta->GetBinContent(i),OriginalPhi->GetBinContent(i));
2120
2121 }
2122
2123
2124
2125 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
2126 printf(" Theta - %f\n", chiSquareTheta);
2127 printf(" Phi - %f\n", chiSquarePhi);
2128
2129 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
2130 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
2131 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
2132
2133 recEffTotal = recEffTotal/evNumber2;
2134 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
2135 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
2136
2137 }
2138
a3d71079 2139
2140 //Create canvases, set the view range, show histograms
2141
2142 TCanvas *c1 = 0;
2143 TCanvas *c2 = 0;
2144 TCanvas *c3 = 0;
2145 TCanvas *c4 = 0;
2146 TCanvas *c5 = 0;
2147 TCanvas *c6 = 0;
2148 TCanvas *c7 = 0;
2149 TCanvas *c8 = 0;
2150 TCanvas *c9 = 0;
2151 TCanvas *c10 = 0;
2152 TCanvas *c11 = 0;
2153 TCanvas *c12 = 0;
fb498b56 2154 TCanvas *c13 = 0;
2155
a3d71079 2156 //TF1* expo = 0;
2157 //TF1* gaus = 0;
2158
fb498b56 2159 TStyle *mystyle=new TStyle("Plain","mystyle");
2160 mystyle->SetPalette(1,0);
2161 //mystyle->SetTitleYSize(0.2);
2162 //mystyle->SetStatW(0.19);
2163 //mystyle->SetStatH(0.1);
2164 //mystyle->SetStatFontSize(0.01);
2165 //mystyle->SetTitleYSize(0.3);
2166 mystyle->SetFuncColor(2);
2167 //mystyle->SetOptStat(0111);
2168 mystyle->SetDrawBorder(0);
2169 mystyle->SetTitleBorderSize(0);
2170 mystyle->SetOptFit(1111);
2171 mystyle->cd();
2172
a3d71079 2173
2174 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2175 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2176 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2177 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2178
2179 switch(diaglevel)
2180 {
2181 case 1:
2182
2183 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
2184 hc0->SetXTitle("ix (npads)");
fb498b56 2185 hc0->Draw("colz");
a3d71079 2186
2187//
2188 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
2189 c2->Divide(2,2);
2190 //c4->SetFillColor(42);
2191
2192 c2->cd(1);
2193 feedback->SetXTitle("x (cm)");
2194 feedback->SetYTitle("y (cm)");
fb498b56 2195 feedback->Draw("colz");
a3d71079 2196
2197 c2->cd(2);
2198 //mip->SetFillColor(5);
2199 mip->SetXTitle("x (cm)");
2200 mip->SetYTitle("y (cm)");
fb498b56 2201 mip->Draw("colz");
a3d71079 2202
2203 c2->cd(3);
2204 //cerenkov->SetFillColor(5);
2205 cerenkov->SetXTitle("x (cm)");
2206 cerenkov->SetYTitle("y (cm)");
fb498b56 2207 cerenkov->Draw("colz");
a3d71079 2208
2209 c2->cd(4);
2210 //h->SetFillColor(5);
2211 h->SetXTitle("x (cm)");
2212 h->SetYTitle("y (cm)");
fb498b56 2213 h->Draw("colz");
a3d71079 2214
2215 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
2216 c3->Divide(2,1);
2217 //c10->SetFillColor(42);
2218
2219 c3->cd(1);
2220 hitsX->SetFillColor(5);
2221 hitsX->SetXTitle("(cm)");
2222 hitsX->Draw();
2223
2224 c3->cd(2);
2225 hitsY->SetFillColor(5);
2226 hitsY->SetXTitle("(cm)");
2227 hitsY->Draw();
2228
2229
2230 break;
2231//
2232 case 2:
2233
2234 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
2235 c4->Divide(2,1);
2236 //c6->SetFillColor(42);
2237
2238 c4->cd(1);
2239 phspectra2->SetFillColor(5);
2240 phspectra2->SetXTitle("energy (eV)");
2241 phspectra2->Draw();
2242 c4->cd(2);
2243 phspectra1->SetFillColor(5);
2244 phspectra1->SetXTitle("energy (eV)");
2245 phspectra1->Draw();
2246
2247 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
2248 c5->Divide(2,2);
2249 //c9->SetFillColor(42);
2250
2251 c5->cd(1);
2252 pionspectra->SetFillColor(5);
2253 pionspectra->SetXTitle("(GeV)");
2254 pionspectra->Draw();
2255
2256 c5->cd(2);
2257 protonspectra->SetFillColor(5);
2258 protonspectra->SetXTitle("(GeV)");
2259 protonspectra->Draw();
2260
2261 c5->cd(3);
2262 kaonspectra->SetFillColor(5);
2263 kaonspectra->SetXTitle("(GeV)");
2264 kaonspectra->Draw();
2265
2266 c5->cd(4);
2267 chargedspectra->SetFillColor(5);
2268 chargedspectra->SetXTitle("(GeV)");
2269 chargedspectra->Draw();
2270
2271 break;
2272
2273 case 3:
2274
2275
2276 if(gAlice->TreeR())
2277 {
2278 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
2279 c6->Divide(2,2);
2280 //c3->SetFillColor(42);
2281
2282 c6->cd(1);
2283 //TPad* c6_1;
2284 //c6_1->SetLogy();
2285 Clcharge->SetFillColor(5);
2286 Clcharge->SetXTitle("ADC counts");
2287 if (evNumber2>10)
2288 {
2289 Clcharge->Fit("expo");
2290 //expo->SetLineColor(2);
2291 //expo->SetLineWidth(3);
2292 }
2293 Clcharge->Draw();
2294
2295 c6->cd(2);
2296 padnumber->SetFillColor(5);
2297 padnumber->SetXTitle("(counts)");
2298 padnumber->Draw();
2299
2300 c6->cd(3);
2301 clusev->SetFillColor(5);
2302 clusev->SetXTitle("(counts)");
2303 if (evNumber2>10)
2304 {
2305 clusev->Fit("gaus");
2306 //gaus->SetLineColor(2);
2307 //gaus->SetLineWidth(3);
2308 }
2309 clusev->Draw();
2310
2311 c6->cd(4);
2312 padsmip->SetFillColor(5);
2313 padsmip->SetXTitle("(counts)");
2314 padsmip->Draw();
2315 }
2316
2317 if(evNumber2<1)
2318 {
2319 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
2320 mother->SetFillColor(5);
2321 mother->SetXTitle("counts");
2322 mother->Draw();
2323 }
2324
2325 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
2326 c7->Divide(2,2);
2327 //c7->SetFillColor(42);
2328
2329 c7->cd(1);
2330 totalphotonsevent->SetFillColor(5);
2331 totalphotonsevent->SetXTitle("Photons (counts)");
2332 if (evNumber2>10)
2333 {
2334 totalphotonsevent->Fit("gaus");
2335 //gaus->SetLineColor(2);
2336 //gaus->SetLineWidth(3);
2337 }
2338 totalphotonsevent->Draw();
2339
2340 c7->cd(2);
2341 photev->SetFillColor(5);
2342 photev->SetXTitle("(counts)");
2343 if (evNumber2>10)
2344 {
2345 photev->Fit("gaus");
2346 //gaus->SetLineColor(2);
2347 //gaus->SetLineWidth(3);
2348 }
2349 photev->Draw();
2350
2351 c7->cd(3);
2352 feedev->SetFillColor(5);
2353 feedev->SetXTitle("(counts)");
2354 if (evNumber2>10)
2355 {
2356 feedev->Fit("gaus");
2357 //gaus->SetLineColor(2);
2358 //gaus->SetLineWidth(3);
2359 }
2360 feedev->Draw();
2361
2362 c7->cd(4);
2363 padsev->SetFillColor(5);
2364 padsev->SetXTitle("(counts)");
2365 if (evNumber2>10)
2366 {
2367 padsev->Fit("gaus");
2368 //gaus->SetLineColor(2);
2369 //gaus->SetLineWidth(3);
2370 }
2371 padsev->Draw();
2372
2373 break;
2374
2375 case 4:
2376
2377
2378 if(nrechits3D)
2379 {
fb498b56 2380 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
2381 c8->Divide(1,3);
a3d71079 2382 //c2->SetFillColor(42);
2383
fb498b56 2384
2385 // data per hit
a3d71079 2386 c8->cd(1);
2387 hitsPhi->SetFillColor(5);
fb498b56 2388 if (evNumber2>10)
2389 hitsPhi->Fit("gaus");
a3d71079 2390 hitsPhi->Draw();
fb498b56 2391
2392 //data per track
a3d71079 2393 c8->cd(2);
fb498b56 2394 OriginalPhi->SetFillColor(5);
2395 if (evNumber2>10)
2396 OriginalPhi->Fit("gaus");
2397 OriginalPhi->Draw();
2398
2399 //recontructed data
a3d71079 2400 c8->cd(3);
a3d71079 2401 Phi->SetFillColor(5);
fb498b56 2402 if (evNumber2>10)
2403 Phi->Fit("gaus");
a3d71079 2404 Phi->Draw();
fb498b56 2405
2406 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
2407 c9->Divide(1,3);
2408
2409 // data per hit
2410 c9->cd(1);
2411 hitsTheta->SetFillColor(5);
2412 if (evNumber2>10)
2413 hitsTheta->Fit("gaus");
2414 hitsTheta->Draw();
2415
2416 //data per track
2417 c9->cd(2);
2418 OriginalTheta->SetFillColor(5);
2419 if (evNumber2>10)
2420 OriginalTheta->Fit("gaus");
2421 OriginalTheta->Draw();
2422
2423 //recontructed data
2424 c9->cd(3);
a3d71079 2425 Theta->SetFillColor(5);
fb498b56 2426 if (evNumber2>10)
2427 Theta->Fit("gaus");
a3d71079 2428 Theta->Draw();
fb498b56 2429
2430 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
2431 c10->Divide(1,3);
2432
2433 // data per hit
2434 c10->cd(1);
2435 ckovangle->SetFillColor(5);
2436 ckovangle->SetXTitle("angle (radians)");
2437 if (evNumber2>10)
2438 ckovangle->Fit("gaus");
2439 ckovangle->Draw();
2440
2441 //data per track
2442 c10->cd(2);
2443 OriginalOmega->SetFillColor(5);
2444 OriginalOmega->SetXTitle("angle (radians)");
2445 if (evNumber2>10)
2446 OriginalOmega->Fit("gaus");
2447 OriginalOmega->Draw();
2448
2449 //recontructed data
2450 c10->cd(3);
a3d71079 2451 Omega3D->SetFillColor(5);
2452 Omega3D->SetXTitle("angle (radians)");
fb498b56 2453 if (evNumber2>10)
2454 Omega3D->Fit("gaus");
a3d71079 2455 Omega3D->Draw();
fb498b56 2456
2457
2458 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
2459 c11->Divide(1,2);
2460
2461 // data per hit
2462 c11->cd(1);
2463 radius->SetFillColor(5);
2464 radius->SetXTitle("radius (cm)");
2465 radius->Draw();
2466
2467 //recontructed data
2468 c11->cd(2);
a3d71079 2469 MeanRadius->SetFillColor(5);
2470 MeanRadius->SetXTitle("radius (cm)");
2471 MeanRadius->Draw();
fb498b56 2472
2473
2474 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
2475
2476 c12->cd(1);
2477 identification->SetFillColor(5);
2478 identification->SetXTitle("Momentum (GeV/c)");
2479 identification->SetYTitle("Cherenkov angle (radians)");
2480
2481 //Float_t pionmass=.139;
2482 //Float_t kaonmass=.493;
2483 //Float_t protonmass=.938;
2484 //Float_t n=1.295;
2485
2486 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
2487 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
2488 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
2489
2490 identification->Draw();
2491
2492 pionplot->SetLineColor(5);
2493 pionplot->Draw("same");
2494
2495 kaonplot->SetLineColor(4);
2496 kaonplot->Draw("same");
2497
2498 protonplot->SetLineColor(3);
2499 protonplot->Draw("same");
2500 //identification->Draw("same");
2501
2502
2503
2504 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
2505 c13->Divide(3,1);
2506
2507 c13->cd(1);
2508 PhiError->SetFillColor(5);
2509 if (evNumber2>10)
2510 PhiError->Fit("gaus");
2511 PhiError->Draw();
2512 c13->cd(2);
2513 ThetaError->SetFillColor(5);
2514 if (evNumber2>10)
2515 ThetaError->Fit("gaus");
2516 ThetaError->Draw();
2517 c13->cd(3);
2518 OmegaError->SetFillColor(5);
2519 OmegaError->SetXTitle("angle (radians)");
2520 if (evNumber2>10)
2521 OmegaError->Fit("gaus");
2522 OmegaError->Draw();
a3d71079 2523
2524 }
2525
2526 if(nrechits1D)
2527 {
2528 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
2529 c9->Divide(3,2);
2530 //c5->SetFillColor(42);
2531
2532 c9->cd(1);
2533 ckovangle->SetFillColor(5);
2534 ckovangle->SetXTitle("angle (radians)");
2535 ckovangle->Draw();
2536
2537 c9->cd(2);
2538 radius->SetFillColor(5);
2539 radius->SetXTitle("radius (cm)");
2540 radius->Draw();
2541
2542 c9->cd(3);
2543 hc0->SetXTitle("pads");
2544 hc0->Draw("box");
2545
2546 c9->cd(5);
2547 Omega1D->SetFillColor(5);
2548 Omega1D->SetXTitle("angle (radians)");
2549 Omega1D->Draw();
2550
2551 c9->cd(4);
2552 PhotonCer->SetFillColor(5);
2553 PhotonCer->SetXTitle("angle (radians)");
2554 PhotonCer->Draw();
2555
2556 c9->cd(6);
2557 PadsUsed->SetXTitle("pads");
2558 PadsUsed->Draw("box");
2559 }
2560
2561 break;
2562
2563 case 5:
2564
2565 printf("Drawing histograms.../n");
2566
2567 //if (ndigits)
2568 //{
2569 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
2570 c1->Divide(4,2);
2571 //c1->SetFillColor(42);
2572
2573 c10->cd(1);
2574 hc1->SetXTitle("ix (npads)");
2575 hc1->Draw("box");
2576 c10->cd(2);
2577 hc2->SetXTitle("ix (npads)");
2578 hc2->Draw("box");
2579 c10->cd(3);
2580 hc3->SetXTitle("ix (npads)");
2581 hc3->Draw("box");
2582 c10->cd(4);
2583 hc4->SetXTitle("ix (npads)");
2584 hc4->Draw("box");
2585 c10->cd(5);
2586 hc5->SetXTitle("ix (npads)");
2587 hc5->Draw("box");
2588 c10->cd(6);
2589 hc6->SetXTitle("ix (npads)");
2590 hc6->Draw("box");
2591 c10->cd(7);
2592 hc7->SetXTitle("ix (npads)");
2593 hc7->Draw("box");
2594 c10->cd(8);
2595 hc0->SetXTitle("ix (npads)");
2596 hc0->Draw("box");
2597 //}
2598//
2599 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
2600 c11->Divide(2,2);
2601 //c4->SetFillColor(42);
2602
2603 c11->cd(1);
2604 feedback->SetXTitle("x (cm)");
2605 feedback->SetYTitle("y (cm)");
2606 feedback->Draw();
2607
2608 c11->cd(2);
2609 //mip->SetFillColor(5);
2610 mip->SetXTitle("x (cm)");
2611 mip->SetYTitle("y (cm)");
2612 mip->Draw();
2613
2614 c11->cd(3);
2615 //cerenkov->SetFillColor(5);
2616 cerenkov->SetXTitle("x (cm)");
2617 cerenkov->SetYTitle("y (cm)");
2618 cerenkov->Draw();
2619
2620 c11->cd(4);
2621 //h->SetFillColor(5);
2622 h->SetXTitle("x (cm)");
2623 h->SetYTitle("y (cm)");
2624 h->Draw();
2625
2626 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
2627 c12->Divide(2,1);
2628 //c10->SetFillColor(42);
2629
2630 c12->cd(1);
2631 hitsX->SetFillColor(5);
2632 hitsX->SetXTitle("(cm)");
2633 hitsX->Draw();
2634
2635 c12->cd(2);
2636 hitsY->SetFillColor(5);
2637 hitsY->SetXTitle("(cm)");
2638 hitsY->Draw();
2639
2640 break;
2641
2642 }
2643
2644
2645 // calculate the number of pads which give a signal
2646
2647
2648 //Int_t Np=0;
2649 /*for (Int_t i=0;i< NpadX;i++) {
2650 for (Int_t j=0;j< NpadY;j++) {
2651 if (Pad[i][j]>=6){
2652 Np+=1;
2653 }
2654 }
2655 }*/
2656 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
2657 printf("\nEnd of analysis\n");
2658 printf("**********************************\n");
dfb4e77d 2659}//void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
2660//______________________________________________________________________________
b762c2f6 2661void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
dfb4e77d 2662{// Create TreeD branches for the RICH.
2663 if(GetDebug())Info("MakeBranchInTreeD","Start.");
b762c2f6 2664
2665 const Int_t kBufferSize = 4000;
2666 char branchname[30];
2667
2668 //
2669 // one branch for digits per chamber
2670 //
2671 for (Int_t i=0; i<kNCH ;i++) {
2672 sprintf(branchname,"%sDigits%d",GetName(),i+1);
2673 if (fDchambers && treeD) {
dfb4e77d 2674 MakeBranchInTree(treeD,branchname, &((*fDchambers)[i]), kBufferSize, file);
b762c2f6 2675// printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
2676 }
2677 }
2678}
dfb4e77d 2679//______________________________________________________________________________
2680void AliRICH::MakeBranch(Option_t* option)
2681{//Create Tree branches for the RICH.
2682 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
2683
2684 const Int_t kBufferSize = 4000;
2685 char branchname[20];
2686
2687
2688 const char *cH = strstr(option,"H");
2689 const char *cD = strstr(option,"D");
2690 const char *cR = strstr(option,"R");
2691 const char *cS = strstr(option,"S");
2692
2693
2694 if(cH&&TreeH()){
853634d3 2695 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
dfb4e77d 2696 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
2697 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
2698
853634d3 2699 //kir if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
dfb4e77d 2700 //kir MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
2701 }
2702 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
2703
2704 if(cS&&fLoader->TreeS()){
853634d3 2705 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
2706 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
dfb4e77d 2707 }
2708
2709 int i;
2710 if (cD&&fLoader->TreeD()){
2711 if(!fDchambers){
2712 fDchambers=new TObjArray(kNCH); // one branch for digits per chamber
2713 for(i=0;i<kNCH;i++){
2714 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
2715 }
2716 }
2717 for (i=0; i<kNCH ;i++)
2718 {
2719 sprintf(branchname,"%sDigits%d",GetName(),i+1);
2720 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
2721 }
2722 }
2723
2724 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
2725 Int_t i;
2726 if (fRawClusters == 0x0 )
2727 {
2728 fRawClusters = new TObjArray(kNCH);
2729 for (i=0; i<kNCH ;i++)
2730 {
2731 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
2732 }
2733 }
2734
2735 if (fRecHits1D == 0x0)
2736 {
2737 fRecHits1D = new TObjArray(kNCH);
2738 for (i=0; i<kNCH ;i++)
2739 {
2740 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
2741 }
2742 }
2743
2744 if (fRecHits3D == 0x0)
2745 {
2746 fRecHits3D = new TObjArray(kNCH);
2747 for (i=0; i<kNCH ;i++)
2748 {
2749 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
2750 }
2751 }
2752
2753 for (i=0; i<kNCH ;i++){
2754 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
2755 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0);
2756 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
2757 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0);
2758 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
2759 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0);
2760 }
2761 }//if (cR && gAlice->TreeR())
2762 if(GetDebug())Info("MakeBranch","Stop.");
2763}
2764//______________________________________________________________________________
2765void AliRICH::SetTreeAddress()
2766{//Set branch address for the Hits and Digits Tree.
2767 if(GetDebug())Info("SetTreeAddress","Start.");
2768
2769 char branchname[20];
2770 Int_t i;
2771
2772
2773 TBranch *branch;
2774 TTree *treeH = fLoader->TreeH();
2775 TTree *treeD = fLoader->TreeD();
2776 TTree *treeR = fLoader->TreeR();
2777 TTree *treeS = fLoader->TreeS();
2778
2779 if(treeH){
853634d3 2780 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
2781 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
2782
dfb4e77d 2783 branch = treeH->GetBranch("RICHCerenkov");
2784 if(branch){
2785 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
2786 branch->SetAddress(&fCerenkovs);
2787 }
2788
853634d3 2789//kir branch = treeH->GetBranch("RICHSDigits");
2790//kir if (branch)
2791//kir {
2792//kir if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
2793//kir branch->SetAddress(&fSDigits);
2794//kir }
2795 }//if(treeH)
dfb4e77d 2796
2797 //this is after TreeH because we need to guarantee that fHits array is created
853634d3 2798 AliDetector::SetTreeAddress();
dfb4e77d 2799
853634d3 2800 if(treeS){
2801 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
2802 branch = treeS->GetBranch("RICH");
2803 if(branch){
2804 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
2805 branch->SetAddress(&fSDigits);
dfb4e77d 2806 }
853634d3 2807 }
dfb4e77d 2808
2809
853634d3 2810 if(treeD){
2811 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
2812
dfb4e77d 2813 if (fDchambers == 0x0)
2814 {
2815 fDchambers = new TObjArray(kNCH);
2816 for (i=0; i<kNCH ;i++)
2817 {
2818 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
2819 }
2820 }
2821
2822 for (i=0; i<kNCH; i++) {
2823 sprintf(branchname,"%sDigits%d",GetName(),i+1);
2824 if (fDchambers) {
2825 branch = treeD->GetBranch(branchname);
2826 if (branch) branch->SetAddress(&((*fDchambers)[i]));
2827 }
2828 }
2829 }
2830
853634d3 2831 if(treeR){
2832 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
2833
dfb4e77d 2834 if (fRawClusters == 0x0 )
2835 {
2836 fRawClusters = new TObjArray(kNCH);
2837 for (i=0; i<kNCH ;i++)
2838 {
2839 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
2840 }
2841 }
2842
2843 if (fRecHits1D == 0x0)
2844 {
2845 fRecHits1D = new TObjArray(kNCH);
2846 for (i=0; i<kNCH ;i++)
2847 {
2848 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
2849 }
2850 }
2851
2852 if (fRecHits3D == 0x0)
2853 {
2854 fRecHits3D = new TObjArray(kNCH);
2855 for (i=0; i<kNCH ;i++)
2856 {
2857 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
2858 }
2859 }
2860
2861 for (i=0; i<kNCH; i++) {
2862 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
2863 if (fRawClusters) {
2864 branch = treeR->GetBranch(branchname);
2865 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
2866 }
2867 }
2868
2869 for (i=0; i<kNCH; i++) {
2870 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
2871 if (fRecHits1D) {
2872 branch = treeR->GetBranch(branchname);
2873 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
2874 }
2875 }
2876
2877 for (i=0; i<kNCH; i++) {
2878 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
2879 if (fRecHits3D) {
2880 branch = treeR->GetBranch(branchname);
2881 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
2882 }
2883 }
2884
853634d3 2885 }//if(treeR)
dfb4e77d 2886 if(GetDebug())Info("SetTreeAddress","Stop.");
2887}//void AliRICH::SetTreeAddress()
2888//______________________________________________________________________________
2889void AliRICH::Print(Option_t *option)const
2890{
2891 TObject::Print(option);
3ea9cb08 2892 fpParam->Dump();
2893 Chambers()->Print(option);
dfb4e77d 2894}//void AliRICH::Print(Option_t *option)const
3ea9cb08 2895//______________________________________________________________________________
2896void AliRICH::CreateGeometry()
2897{//Creates detailed geometry simulation (currently GEANT volumes tree)
2898 if(GetDebug())Info("CreateGeometry","Start.");
2899//???????? to be removed to AliRICHParam?
2900 fpParam->RadiatorToPads(fpParam->FreonThickness()/2+fpParam->QuartzThickness()+fpParam->GapThickness());
2901
2902//Opaque quartz thickness
2903 Float_t oqua_thickness = .5;
2904//CsI dimensions
2905 Float_t csi_width =fpParam->Nx()*fpParam->PadX()+fpParam->DeadZone();
2906 Float_t csi_length=fpParam->Ny()*fpParam->PadY()+2*fpParam->DeadZone();
2907
2908 Int_t *idtmed = fIdtmed->GetArray()-999;
2909
2910 Int_t i;
2911 Float_t zs;
2912 Int_t idrotm[1099];
2913 Float_t par[3];
2914
2915//External aluminium box
2916 par[0]=68.8;par[1]=13;par[2]=70.86;//Original Settings
2917 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
2918//Air
2919 par[0]=66.3; par[1] = 13; par[2] = 68.35; //Original Settings
2920 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
2921//Air 2 (cutting the lower part of the box)
2922 par[0]=1.25; par[1] = 3; par[2] = 70.86; //Original Settings
2923 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
2924//Air 3 (cutting the lower part of the box)
2925 par[0]=66.3; par[1] = 3; par[2] = 1.2505; //Original Settings
2926 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
2927//Honeycomb
2928 par[0]=66.3;par[1]=0.188; par[2] = 68.35; //Original Settings
2929 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
2930//Aluminium sheet
2931 par[0]=66.3;par[1]=0.025;par[2]=68.35; //Original Settings
2932 //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
2933 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
2934//Quartz
2935 par[0]=fpParam->QuartzWidth()/2;par[1]=fpParam->QuartzThickness()/2;par[2]=fpParam->QuartzLength()/2;
2936 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
2937//Spacers (cylinders)
2938 par[0]=0.;par[1]=.5;par[2]=fpParam->FreonThickness()/2;
2939 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
2940//Feet (freon slabs supports)
2941 par[0] = .7; par[1] = .3; par[2] = 1.9;
2942 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
2943//Opaque quartz
2944 par[0]=fpParam->QuartzWidth()/2;par[1]= .2;par[2]=fpParam->QuartzLength()/2;
2945 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
2946//Frame of opaque quartz
2947 par[0]=fpParam->OuterFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->OuterFreonLength()/2;
2948 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
2949 par[0]=fpParam->InnerFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->InnerFreonLength()/2;
2950 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
2951//Freon
2952 par[0]=fpParam->OuterFreonWidth()/2 - oqua_thickness;
2953 par[1]=fpParam->FreonThickness()/2;
2954 par[2]=fpParam->OuterFreonLength()/2 - 2*oqua_thickness;
2955 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
2956
2957 par[0]=fpParam->InnerFreonWidth()/2 - oqua_thickness;
2958 par[1]=fpParam->FreonThickness()/2;
2959 par[2]=fpParam->InnerFreonLength()/2 - 2*oqua_thickness;
2960 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
2961//Methane
2962 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2;par[2]=csi_length/2;
2963 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
2964//Methane gap
2965 par[0]=csi_width/2;par[1]=fpParam->ProximityGapThickness()/2;par[2] = csi_length/2;
2966 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
2967//CsI photocathode
2968 par[0]=csi_width/2;par[1]=.25;par[2]=csi_length/2;
2969 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
2970//Anode grid
2971 par[0] = 0.;par[1] = .001;par[2] = 20.;
2972 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
2973
2974//Wire supports
2975//Bar of metal
2976 par[0]=csi_width/2;par[1]=1.05;par[2]=1.05;
2977 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
2978//Ceramic pick up (base)
2979 par[0]=csi_width/2;par[1]= .25;par[2]=1.05;
2980 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
2981//Ceramic pick up (head)
2982 par[0] = csi_width/2;par[1] = .1;par[2] = .1;
2983 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
2984
2985//Aluminium supports for methane and CsI
2986//Short bar
2987 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2 + .25; par[2] = (68.35 - csi_length/2)/2;
2988 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
2989//Long bar
2990 par[0]=(66.3 - csi_width/2)/2;par[1]=fpParam->GapThickness()/2+.25;par[2]=csi_length/2+68.35-csi_length/2;
2991 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
2992
2993//Aluminium supports for freon
2994//Short bar
2995 par[0] = fpParam->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - fpParam->QuartzLength()/2)/2;
2996 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
2997//Long bar
2998 par[0] = (66.3 - fpParam->QuartzWidth()/2)/2; par[1] = .3;
2999 par[2] = fpParam->QuartzLength()/2 + 68.35 - fpParam->QuartzLength()/2;
3000 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
3001//PCB backplane
3002 par[0] = csi_width/2;par[1] = .25; par[2] = csi_length/4 -.5025;
3003 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
3004
3005//Backplane supports
3006//Aluminium slab
3007 par[0] = 33.15;par[1] = 2;par[2] = 21.65;
3008 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
3009//Big hole
3010 par[0] = 9.05; par[1] = 2; par[2] = 4.4625;
3011 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
3012//Small hole
3013 par[0] = 5.7;par[1] = 2;par[2] = 4.4625;
3014 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
3015//Place holes inside backplane support
3016 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
3017 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
3018 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
3019 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
3020 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
3021 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
3022 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
3023 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
3024 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
3025 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
3026 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
3027 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
3028 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
3029 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
3030 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
3031 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
3032//Place material inside RICH
3033 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
3034 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-fpParam->GapThickness()/2-fpParam->QuartzThickness()-fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
3035 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-fpParam->GapThickness()/2-fpParam->QuartzThickness()-fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
3036 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
3037 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
3038 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
3039 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
3040 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
3041 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
3042 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
3043 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
3044 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
3045 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
3046 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
3047 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
3048 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
3049 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .2, 0., 0, "ONLY");
3050// Methane supports
3051 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
3052 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
3053 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
3054 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
3055//Freon supports
3056 Float_t supp_y = 1.276 - fpParam->GapThickness()/2- fpParam->QuartzThickness() -fpParam->FreonThickness() - .2 + .3; //y position of freon supports
3057 gMC->Gspos("SFLG", 1, "SRIC", fpParam->QuartzWidth()/2 + (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
3058 gMC->Gspos("SFLG", 2, "SRIC", - fpParam->QuartzWidth()/2 - (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
3059 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, fpParam->QuartzLength()/2 + (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
3060 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - fpParam->QuartzLength()/2 - (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
3061 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
3062//Place spacers
3063 Int_t nspacers = 30;
3064 for (i = 0; i < nspacers/3; i++) {
3065 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
3066 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
3067 }
3068 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
3069 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
3070 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
3071 }
3072 for (i = (nspacers*2)/3; i < nspacers; ++i) {
3073 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
3074 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
3075 }
3076 for (i = 0; i < nspacers/3; i++) {
3077 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
3078 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
3079 }
3080 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
3081 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
3082 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
3083 }
3084 for (i = (nspacers*2)/3; i < nspacers; ++i) {
3085 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
3086 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
3087 }
3088 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
3089 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
3090 gMC->Gspos("OQF1", 1, "SRIC", fpParam->OuterFreonWidth()/2 + fpParam->InnerFreonWidth()/2 + 2, 1.276 - fpParam->GapThickness()/2- fpParam->QuartzThickness() -fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
3091 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings
3092 gMC->Gspos("OQF1", 3, "SRIC", - (fpParam->OuterFreonWidth()/2 + fpParam->InnerFreonWidth()/2) - 2, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
3093 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness()/2, 0., 0, "ONLY");
3094 gMC->Gspos("GAP ", 1, "META", 0., fpParam->GapThickness()/2 - fpParam->ProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
3095 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
3096 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + fpParam->GapThickness()/2 + .25, 0., 0, "ONLY");
3097//Wire support placing
3098 gMC->Gspos("WSG2", 1, "GAP ", 0., fpParam->ProximityGapThickness()/2 - .1, 0., 0, "ONLY");
3099 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
3100 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
3101//Backplane placing
3102 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
3103 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
3104 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
3105 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
3106 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
3107 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
3108//PCB placing
3109 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
3110 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
3111
3112//place chambers into mother volume ALIC
3113 CreateChambers();
3114
3115 for(int i=0;i<kNCH;i++){
3116 AliMatrix(idrotm[1000+i],C(i)->ThetaXd(),C(i)->PhiXd(),
3117 C(i)->ThetaYd(),C(i)->PhiYd(),
3118 C(i)->ThetaZd(),C(i)->PhiZd());
3119 gMC->Gspos("RICH",i+1,"ALIC",C(i)->X(),C(i)->Y(),C(i)->Z(),idrotm[1000+i], "ONLY");
3120 }
3121
3122 if(GetDebug())Info("CreateGeometry","Stop.");
3123}//void AliRICH::CreateGeometry()
3124//______________________________________________________________________________
3125void AliRICH::CreateChambers()
3126{//(re)create all RICH Chambers
3127 if(GetDebug())Info("CreateChambers","Start.");
3128
3129 if(fChambers) delete fChambers;//recreate chambers
3130 fChambers=new TObjArray(kNCH);
3131 fChambers->SetOwner();
3132 for(int i=0;i<kNCH;i++){
3133 fChambers->AddAt(new AliRICHChamber(i+1,fpParam),i);
3134 }
853634d3 3135
3ea9cb08 3136 if(GetDebug())Info("CreateChambers","Stop.");
3137}//void AliRICH::CreateChambers()