New Stepmanager function.
[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
2e5f0f7b 16
116cbefd 17#include <strings.h>
18
2e5f0f7b 19#include <TArrayF.h>
116cbefd 20#include <TBRIK.h>
237c933d 21#include <TFile.h>
94de3818 22#include <TGeometry.h>
116cbefd 23#include <TNode.h>
24#include <TObjArray.h>
25#include <TObject.h>
26#include <TParticle.h>
27#include <TPDGCode.h>
28#include <TRandom.h>
116cbefd 29#include <TTUBE.h>
30#include <TTree.h>
31#include <TVector.h>
116cbefd 32#include "AliMagF.h"
33#include "AliPoints.h"
fe4da5cc 34#include "AliRICH.h"
c021cb15 35#include "AliRICHParam.h"
116cbefd 36#include "AliRICHClusterFinder.h"
116cbefd 37#include "AliRICHDigitizer.h"
116cbefd 38#include "AliRICHHitMapA1.h"
39#include "AliRICHMerger.h"
237c933d 40#include "AliRICHRawCluster.h"
a4622d0f 41#include "AliRICHRecHit1D.h"
42#include "AliRICHRecHit3D.h"
116cbefd 43#include "AliRICHSDigit.h"
44#include "AliRICHSegmentationV0.h"
45#include "AliRICHTransientDigit.h"
fe4da5cc 46#include "AliRun.h"
fb498b56 47#include "AliRunDigitizer.h"
c021cb15 48#include "AliRICHSegmentationV1.h"
49#include "AliRICHResponseV0.h"
ddae0931 50
853634d3 51ClassImp(AliRICHhit)
52ClassImp(AliRICHdigit)
fe4da5cc 53ClassImp(AliRICH)
ddae0931 54
55//___________________________________________
15d8311d 56// RICH manager class
57//Begin_Html
58/*
59 <img src="gif/alirich.gif">
60*/
61//End_Html
62
fe4da5cc 63AliRICH::AliRICH()
dfb4e77d 64{//Default ctor should not contain any new operators
65 fIshunt = 0;
66 fHits = 0;
67 fSDigits = 0;
853634d3 68 fNsdigits = 0;
dfb4e77d 69 fNcerenkovs = 0;
70 fDchambers = 0;
71 fRecHits1D = 0;
72 fRecHits3D = 0;
73 fRawClusters = 0;
74 fChambers = 0;
75 fCerenkovs = 0;
76 for (Int_t i=0; i<kNCH; i++){
77 fNdch[i] = 0;
78 fNrawch[i] = 0;
79 fNrechits1D[i] = 0;
80 fNrechits3D[i] = 0;
81 }
3ea9cb08 82 fpParam=0;
15d8311d 83}//AliRICH::AliRICH()
c021cb15 84//__________________________________________________________________________________________________
fe4da5cc 85AliRICH::AliRICH(const char *name, const char *title)
dfb4e77d 86 :AliDetector(name,title)
87{//Named ctor
88 if(GetDebug())Info("named ctor","Start.");
3ea9cb08 89 fpParam =new AliRICHParam;
c021cb15 90 fNcerenkovs =fNsdigits =0;//fNhits and fNdigits reset in AliDetector ctor
91 fHits =new TClonesArray("AliRICHhit",1000 ); gAlice->AddHitList(fHits);//hits
92 fCerenkovs =new TClonesArray("AliRICHCerenkov",1000);gAlice->AddHitList(fCerenkovs);//cerenkovs ??? to be removed
93 fSDigits =new TClonesArray("AliRICHdigit",100000);//sdigits
94 fDigits =new TClonesArray("AliRICHdigit",100000);//digits
95
3ea9cb08 96 fIshunt =0;
c021cb15 97 fDchambers =new TObjArray(kNCH);//digits ??? to be removed
98 fRawClusters=new TObjArray(kNCH);//clusters
99 fRecHits1D =new TObjArray(kNCH);//recos Bari
100 fRecHits3D =new TObjArray(kNCH);//recos Lisbon
3ea9cb08 101 for(int i=0;i<kNCH;i++) {
c021cb15 102 fNdch[i]=fNrawch[i]=0;
103 fDchambers ->AddAt(new TClonesArray("AliRICHDigit",10000), i); //??? to be removed
dfb4e77d 104 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
c021cb15 105 fRecHits1D ->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
106 fRecHits3D ->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
dfb4e77d 107 }
108 SetMarkerColor(kRed);
3ea9cb08 109 fCkovNumber=fFreonProd=0;
2f932599 110 fChambers = 0;
c021cb15 111 CreateChambers();
dfb4e77d 112 if(GetDebug())Info("named ctor","Stop.");
113}//AliRICH::AliRICH(const char *name, const char *title)
c021cb15 114//__________________________________________________________________________________________________
fe4da5cc 115AliRICH::~AliRICH()
dfb4e77d 116{//dtor
117 if(GetDebug()) Info("dtor","Start.");
237c933d 118
ddae0931 119 fIshunt = 0;
120 delete fHits;
b251a2b5 121 delete fSDigits;
ddae0931 122 delete fCerenkovs;
ee2105a4 123
124 //PH Delete TObjArrays
125 if (fChambers) {
126 fChambers->Delete();
127 delete fChambers;
128 }
129 if (fDchambers) {
130 fDchambers->Delete();
131 delete fDchambers;
132 }
133 if (fRawClusters) {
134 fRawClusters->Delete();
135 delete fRawClusters;
136 }
137 if (fRecHits1D) {
138 fRecHits1D->Delete();
139 delete fRecHits1D;
140 }
141 if (fRecHits3D) {
142 fRecHits3D->Delete();
143 delete fRecHits3D;
144 }
dfb4e77d 145 if(GetDebug()) Info("dtor","Stop.");
146}//AliRICH::~AliRICH()
c021cb15 147//__________________________________________________________________________________________________
3ea9cb08 148void AliRICH::Hits2SDigits()
853634d3 149{//Create a list of sdigits corresponding to list of hits. Every hit generates sdigit.
3ea9cb08 150 if(GetDebug()) Info("Hit2SDigits","Start.");
853634d3 151
c021cb15 152 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events loop
3ea9cb08 153 fLoader->GetRunLoader()->GetEvent(iEventN);
853634d3 154
3ea9cb08 155 if(!fLoader->TreeH()) fLoader->LoadHits();
156 if(!fLoader->TreeS()) fLoader->MakeTree("S");
157 MakeBranch("S");
c021cb15 158
159 AliRICHSegmentationV1 *pSeg=new AliRICHSegmentationV1;
160 AliRICHResponseV0 *pRes=new AliRICHResponseV0;
161
162 Float_t dx=Param()->SigmaIntegration()*Param()->ChargeSpreadX();
163 Float_t dy=Param()->SigmaIntegration()*Param()->ChargeSpreadY();
164 Float_t charge;
165
166 for(int iPrimN=0;iPrimN<TreeH()->GetEntries();iPrimN++){//prims loop
3ea9cb08 167 fLoader->TreeH()->GetEntry(iPrimN);
c021cb15 168 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop
169 AliRICHhit *pHit=(AliRICHhit*)Hits()->At(iHitN);//get current hit
170
171 if(pHit->Y()>0)
172 charge=Param()->TotalCharge(pHit->Particle(),pHit->Eloss(),pHit->Y()-Param()->SectorSizeY());
173 else
174 charge=Param()->TotalCharge(pHit->Particle(),pHit->Eloss(),pHit->Y()+Param()->SectorSizeY());
175
176 for(pSeg->FirstPad(pHit->X(),pHit->Y(),0,dx,dy);pSeg->MorePads();pSeg->NextPad()){//pads loop
177
178 AddSDigit(pHit->Chamber(),pSeg->Ix(),pSeg->Iy(),
179 Int_t(charge*TMath::Abs(pRes->IntXY(pSeg))),
180 iPrimN);//chamber-xpad-ypad-qdc-track1-2-3
181 }//pads loop
182 }//hits loop
183 }//prims loop
184
185 delete pSeg;
186
3ea9cb08 187 fLoader->TreeS()->Fill();
188 fLoader->WriteSDigits("OVERWRITE");
c021cb15 189 }//events loop
853634d3 190
c021cb15 191 fLoader->UnloadHits();
192 fLoader->UnloadSDigits();
853634d3 193 if(GetDebug()) Info("Hit2SDigits","Stop.");
c021cb15 194}//void AliRICH::Hits2SDigits()
195//__________________________________________________________________________________________________
dfb4e77d 196void AliRICH::SDigits2Digits()
197{//Generate digits from sdigits.
198 if(GetDebug()) Info("SDigits2Digits","Start.");
c021cb15 199
200 AliRunDigitizer *pManager = new AliRunDigitizer(1,1);
201 pManager->SetInputStream(0,"galice.root");
202 pManager->Exec("deb");
dfb4e77d 203 if(GetDebug()) Info("SDigits2Digits","Stop.");
204}//void AliRICH::SDigits2Digits()
c021cb15 205//__________________________________________________________________________________________________
34ead2dd 206void AliRICH::Digits2Reco()
207{
34ead2dd 208// Generate clusters
15d8311d 209// Called from alirun, single event only.
dfb4e77d 210 if(GetDebug()) Info("Digits2Reco","Start.");
34ead2dd 211
212 int nparticles = gAlice->GetNtrack();
213 cout << "Particles (RICH):" <<nparticles<<endl;
942194a4 214 if (nparticles > 0) FindClusters(0);
34ead2dd 215
dfb4e77d 216}//void AliRICH::Digits2Reco()
c021cb15 217//__________________________________________________________________________________________________
15d8311d 218
219
ddae0931 220void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
dfb4e77d 221{// Add a RICH digit to the list
237c933d 222
15d8311d 223 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
224 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
fe4da5cc 225}
226
2e5f0f7b 227void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
dfb4e77d 228{// Add a RICH digit to the list
15d8311d 229
2682e810 230 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
2e5f0f7b 231 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
fe4da5cc 232}
2e5f0f7b 233//_____________________________________________________________________________
a4622d0f 234void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
dfb4e77d 235{// Add a RICH reconstructed hit to the list
a4622d0f 236
2682e810 237 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
a4622d0f 238 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
239}
a4622d0f 240//_____________________________________________________________________________
fb498b56 241void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
dfb4e77d 242{// Add a RICH reconstructed hit to the list
fe4da5cc 243
2682e810 244 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
fb498b56 245 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
2e5f0f7b 246}
dfb4e77d 247//______________________________________________________________________________
248void AliRICH::BuildGeometry()
3ea9cb08 249{//Builds a TNode geometry for event display
dfb4e77d 250 if(GetDebug())Info("BuildGeometry","Start.");
237c933d 251
3ea9cb08 252 TNode *node, *subnode, *top;
253 top=gAlice->GetGeometry()->GetNode("alice");
c24372d0 254
3ea9cb08 255 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
53d98323 256
c021cb15 257 Float_t wid=fpParam->SectorSizeX();
258 Float_t len=fpParam->SectorSizeY();
3ea9cb08 259 new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
260
c021cb15 261 for(int i=1;i<=kNCH;i++){
237c933d 262 top->cd();
c021cb15 263 node = new TNode(Form("RICH%i",i),Form("RICH%i",i),"S_RICH",C(i)->X(),C(i)->Y(),C(i)->Z(),C(i)->RotMatrixName());
3ea9cb08 264 node->SetLineColor(kRed);
91975aa2 265 node->cd();
3ea9cb08 266 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
91975aa2 267 subnode->SetLineColor(kGreen);
268 fNodes->Add(subnode);
3ea9cb08 269 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+fpParam->DeadZone()/2,"");
91975aa2 270 subnode->SetLineColor(kGreen);
271 fNodes->Add(subnode);
3ea9cb08 272 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
91975aa2 273 subnode->SetLineColor(kGreen);
274 fNodes->Add(subnode);
3ea9cb08 275 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,-len/2-fpParam->DeadZone()/2,"");
91975aa2 276 subnode->SetLineColor(kGreen);
277 fNodes->Add(subnode);
3ea9cb08 278 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -fpParam->DeadZone()/2,"");
91975aa2 279 subnode->SetLineColor(kGreen);
280 fNodes->Add(subnode);
3ea9cb08 281 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,-len/2 - fpParam->DeadZone()/2,"");
91975aa2 282 subnode->SetLineColor(kGreen);
283 fNodes->Add(subnode);
237c933d 284 fNodes->Add(node);
3ea9cb08 285 }
dfb4e77d 286 if(GetDebug())Info("BuildGeometry","Stop.");
287}//void AliRICH::BuildGeometry()
288//______________________________________________________________________________
452a64c6 289void AliRICH::CreateMaterials()
290{
291 //
292 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
293 // ORIGIN : NICK VAN EIJNDHOVEN
294 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
295 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
296 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
297 //
298 Int_t isxfld = gAlice->Field()->Integ();
299 Float_t sxmgmx = gAlice->Field()->Max();
300 Int_t i;
301
302 /************************************Antonnelo's Values (14-vectors)*****************************************/
303 /*
304 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,
305 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
306 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
307 1.538243,1.544223,1.550568,1.55777,
308 1.565463,1.574765,1.584831,1.597027,
309 1.611858,1.6277,1.6472,1.6724 };
310 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
311 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
312 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
313 Float_t abscoFreon[14] = { 179.0987,179.0987,
314 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
315 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
316 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
317 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
318 14.177,9.282,4.0925,1.149,.3627,.10857 };
319 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
320 1e-5,1e-5,1e-5,1e-5,1e-5 };
321 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
322 1e-4,1e-4,1e-4,1e-4 };
323 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
324 1e6,1e6,1e6 };
325 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
326 1e-4,1e-4,1e-4,1e-4 };
327 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
328 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
329 .17425,.1785,.1836,.1904,.1938,.221 };
330 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
331 */
332
333
334 /**********************************End of Antonnelo's Values**********************************/
335
336 /**********************************Values from rich_media.f (31-vectors)**********************************/
337
338
339 //Photons energy intervals
340 Float_t ppckov[26];
341 for (i=0;i<26;i++)
342 {
343 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
452a64c6 344 }
345
346
347 //Refraction index for quarz
348 Float_t rIndexQuarz[26];
349 Float_t e1= 10.666;
350 Float_t e2= 18.125;
351 Float_t f1= 46.411;
352 Float_t f2= 228.71;
353 for (i=0;i<26;i++)
354 {
355 Float_t ene=ppckov[i]*1e9;
356 Float_t a=f1/(e1*e1 - ene*ene);
357 Float_t b=f2/(e2*e2 - ene*ene);
358 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
452a64c6 359 }
360
361 //Refraction index for opaque quarz, methane and grid
362 Float_t rIndexOpaqueQuarz[26];
363 Float_t rIndexMethane[26];
364 Float_t rIndexGrid[26];
365 for (i=0;i<26;i++)
366 {
367 rIndexOpaqueQuarz[i]=1;
368 rIndexMethane[i]=1.000444;
369 rIndexGrid[i]=1;
452a64c6 370 }
371
372 //Absorption index for freon
373 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
374 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
375 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
376
377 //Absorption index for quarz
378 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
379 .906,.907,.907,.907};
380 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,
381 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
382 Float_t abscoQuarz[31];
383 for (Int_t i=0;i<31;i++)
384 {
385 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
386 if (Xlam <= 160) abscoQuarz[i] = 0;
387 if (Xlam > 250) abscoQuarz[i] = 1;
388 else
389 {
390 for (Int_t j=0;j<21;j++)
391 {
452a64c6 392 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
393 {
394 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
395 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
396 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
397 }
398 }
399 }
452a64c6 400 }*/
401
402 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
403 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
404 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
405 .675275, 0., 0., 0.};
406
407 for (Int_t i=0;i<31;i++)
408 {
409 abscoQuarz[i] = abscoQuarz[i]/10;
410 }*/
411
412 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,
413 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
414 .192, .1497, .10857};
415
416 //Absorption index for methane
417 Float_t abscoMethane[26];
418 for (i=0;i<26;i++)
419 {
420 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
452a64c6 421 }
422
423 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
424 Float_t abscoOpaqueQuarz[26];
425 Float_t abscoCsI[26];
426 Float_t abscoGrid[26];
427 Float_t efficAll[26];
428 Float_t efficGrid[26];
429 for (i=0;i<26;i++)
430 {
431 abscoOpaqueQuarz[i]=1e-5;
432 abscoCsI[i]=1e-4;
433 abscoGrid[i]=1e-4;
434 efficAll[i]=1;
435 efficGrid[i]=1;
452a64c6 436 }
437
438 //Efficiency for csi
439
440 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
441 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
442 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
443 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
444
445
446
447 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
448 //UNPOLARIZED PHOTONS
449
450 for (i=0;i<26;i++)
451 {
452 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
452a64c6 453 }
454
455 /*******************************************End of rich_media.f***************************************/
456
457
458
459
460
461
462 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
463 zmet[2], zqua[2];
464 Int_t nlmatfre;
465 Float_t densquao;
466 Int_t nlmatmet, nlmatqua;
467 Float_t wmatquao[2], rIndexFreon[26];
468 Float_t aquao[2], epsil, stmin, zquao[2];
469 Int_t nlmatquao;
470 Float_t radlal, densal, tmaxfd, deemax, stemax;
471 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
472
473 Int_t *idtmed = fIdtmed->GetArray()-999;
474
452a64c6 475 // --- Photon energy (GeV)
476 // --- Refraction indexes
477 for (i = 0; i < 26; ++i) {
478 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
479 //rIndexFreon[i] = 1;
452a64c6 480 }
481
482 // --- Detection efficiencies (quantum efficiency for CsI)
483 // --- Define parameters for honeycomb.
484 // Used carbon of equivalent rad. lenght
485
486 ahon = 12.01;
487 zhon = 6.;
9dda3582 488 denshon = 0.1;
452a64c6 489 radlhon = 18.8;
490
491 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
492
493 aqua[0] = 28.09;
494 aqua[1] = 16.;
495 zqua[0] = 14.;
496 zqua[1] = 8.;
497 densqua = 2.64;
498 nlmatqua = -2;
499 wmatqua[0] = 1.;
500 wmatqua[1] = 2.;
501
502 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
503
504 aquao[0] = 28.09;
505 aquao[1] = 16.;
506 zquao[0] = 14.;
507 zquao[1] = 8.;
508 densquao = 2.64;
509 nlmatquao = -2;
510 wmatquao[0] = 1.;
511 wmatquao[1] = 2.;
512
513 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
514
515 afre[0] = 12.;
516 afre[1] = 19.;
517 zfre[0] = 6.;
518 zfre[1] = 9.;
519 densfre = 1.7;
520 nlmatfre = -2;
521 wmatfre[0] = 6.;
522 wmatfre[1] = 14.;
523
524 // --- Parameters to include in GSMIXT, relative to methane (CH4)
525
526 amet[0] = 12.01;
527 amet[1] = 1.;
528 zmet[0] = 6.;
529 zmet[1] = 1.;
530 densmet = 7.17e-4;
531 nlmatmet = -2;
532 wmatmet[0] = 1.;
533 wmatmet[1] = 4.;
534
535 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
536
537 agri = 63.54;
538 zgri = 29.;
539 densgri = 8.96;
540 radlgri = 1.43;
541
542 // --- Parameters to include in GSMATE related to aluminium sheet
543
544 aal = 26.98;
545 zal = 13.;
546 densal = 2.7;
547 radlal = 8.9;
6197ac87 548
549 // --- Glass parameters
550
551 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
552 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
553 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
554 Float_t dglass=1.74;
555
452a64c6 556
557 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
558 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
559 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
560 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
561 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
562 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
563 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
564 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
565 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
566 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
6197ac87 567 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
568 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
452a64c6 569
570 tmaxfd = -10.;
571 stemax = -.1;
572 deemax = -.2;
573 epsil = .001;
574 stmin = -.001;
575
576 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
577 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
578 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
579 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
580 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
581 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
582 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
583 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
584 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
585 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
6197ac87 586 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
587 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 588
589
5cfcdf54 590 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
591 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
592 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
593 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
594 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
595 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
596 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
597 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
598 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
599 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
600 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
452a64c6 601}
c021cb15 602//__________________________________________________________________________________________________
452a64c6 603Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
604{
605
606 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
607
608 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,
609 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,
610 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
452a64c6 611 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
612 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
613 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
614 1.72,1.53};
452a64c6 615 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
616 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
617 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
618 1.714,1.498};
619 Float_t xe=ene;
620 Int_t j=Int_t(xe*10)-49;
621 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
622 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
623
624 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
625 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
626
627 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
628 Float_t tanin=sinin/pdoti;
629
630 Float_t c1=cn*cn-ck*ck-sinin*sinin;
631 Float_t c2=4*cn*cn*ck*ck;
632 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
633 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
634
635 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
636 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
637
638
639 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
640 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
641
642 Float_t sigraf=18.;
643 Float_t lamb=1240/ene;
644 Float_t fresn;
645
646 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
647
648 if(pola)
649 {
650 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
651 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
652 }
653 else
654 fresn=0.5*(rp+rs);
655
656 fresn = fresn*rO;
657 return(fresn);
c021cb15 658}//Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
659//__________________________________________________________________________________________________
452a64c6 660Float_t AliRICH::AbsoCH4(Float_t x)
661{
662
663 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
664 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
665 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
666 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
667 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
668 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
669 Float_t pn=kPressure/760.;
670 Float_t tn=kTemperature/273.16;
671
672
673// ------- METHANE CROSS SECTION -----------------
674// ASTROPH. J. 214, L47 (1978)
675
676 Float_t sm=0;
677 if (x<7.75)
678 sm=.06e-22;
679
680 if(x>=7.75 && x<=8.1)
681 {
682 Float_t c0=-1.655279e-1;
683 Float_t c1=6.307392e-2;
684 Float_t c2=-8.011441e-3;
685 Float_t c3=3.392126e-4;
686 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
687 }
688
689 if (x> 8.1)
690 {
691 Int_t j=0;
692 while (x<=em[j] && x>=em[j+1])
693 {
694 j++;
695 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
696 sm=(sch4[j]+a*(x-em[j]))*1e-22;
697 }
698 }
699
700 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
701 Float_t abslm=1./sm/dm;
702
703// ------- ISOBUTHANE CROSS SECTION --------------
704// i-C4H10 (ai) abs. length from curves in
705// Lu-McDonald paper for BARI RICH workshop .
706// -----------------------------------------------------------
707
708 Float_t ai;
709 Float_t absli;
710 if (kIgas2 != 0)
711 {
712 if (x<7.25)
713 ai=100000000.;
714
715 if(x>=7.25 && x<7.375)
716 ai=24.3;
717
718 if(x>=7.375)
719 ai=.0000000001;
720
721 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
722 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
723 absli =1./si/di;
724 }
725 else
726 absli=1.e18;
727// ---------------------------------------------------------
728//
729// transmission of O2
730//
731// y= path in cm, x=energy in eV
732// so= cross section for UV absorption in cm2
733// do= O2 molecular density in cm-3
734// ---------------------------------------------------------
735
736 Float_t abslo;
737 Float_t so=0;
738 if(x>=6.0)
739 {
740 if(x>=6.0 && x<6.5)
741 {
742 so=3.392709e-13 * TMath::Exp(2.864104 *x);
743 so=so*1e-18;
744 }
745
746 if(x>=6.5 && x<7.0)
747 {
748 so=2.910039e-34 * TMath::Exp(10.3337*x);
749 so=so*1e-18;
750 }
751
752
753 if (x>=7.0)
754 {
755 Float_t a0=-73770.76;
756 Float_t a1=46190.69;
757 Float_t a2=-11475.44;
758 Float_t a3=1412.611;
759 Float_t a4=-86.07027;
760 Float_t a5=2.074234;
761 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
762 so=so*1e-18;
763 }
764
765 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
766 abslo=1./so/dox;
767 }
768 else
769 abslo=1.e18;
770// ---------------------------------------------------------
771//
772// transmission of H2O
773//
774// y= path in cm, x=energy in eV
775// sw= cross section for UV absorption in cm2
776// dw= H2O molecular density in cm-3
777// ---------------------------------------------------------
778
779 Float_t abslw;
780
dfb4e77d 781 Float_t b0=29231.65;
782 Float_t b1=-15807.74;
783 Float_t b2=3192.926;
784 Float_t b3=-285.4809;
785 Float_t b4=9.533944;
452a64c6 786
dfb4e77d 787 if(x>6.75)
788 {
789 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
790 sw=sw*1e-18;
791 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
792 abslw=1./sw/dw;
793 }
794 else
795 abslw=1.e18;
796
797// ---------------------------------------------------------
452a64c6 798
dfb4e77d 799 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
800 return (alength);
801}
c021cb15 802//__________________________________________________________________________________________________
dfb4e77d 803void AliRICH::ResetDigits()
804{//Reset number of digits and the digits array for this detector
805 for ( int i=0;i<kNCH;i++ ) {
806 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
807 if (fNdch) fNdch[i]=0;
808 }
809}
c021cb15 810//__________________________________________________________________________________________________
dfb4e77d 811void AliRICH::ResetRawClusters()
812{//Reset number of raw clusters and the raw clust array for this detector
813 for ( int i=0;i<kNCH;i++ ) {
814 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
815 if (fNrawch) fNrawch[i]=0;
816 }
817}
c021cb15 818//__________________________________________________________________________________________________
dfb4e77d 819void AliRICH::ResetRecHits1D()
820{//Reset number of raw clusters and the raw clust array for this detector
821 for ( int i=0;i<kNCH;i++ ) {
822 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
823 if (fNrechits1D) fNrechits1D[i]=0;
824 }
825}
2e5f0f7b 826
c021cb15 827//__________________________________________________________________________________________________
dfb4e77d 828void AliRICH::ResetRecHits3D()
829{// Reset number of raw clusters and the raw clust array for this detector
830 for ( int i=0;i<kNCH;i++ ) {
831 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
832 if (fNrechits3D) fNrechits3D[i]=0;
833 }
834}
c021cb15 835//__________________________________________________________________________________________________
942194a4 836void AliRICH::FindClusters(Int_t nev /*kir,Int_t lastEntry*/)
3ea9cb08 837{// Loop on chambers and on cathode planes
2e5f0f7b 838 for (Int_t icat=1;icat<2;icat++) {
839 gAlice->ResetDigits();
34ead2dd 840 gAlice->TreeD()->GetEvent(0);
237c933d 841 for (Int_t ich=0;ich<kNCH;ich++) {
2682e810 842 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
237c933d 843 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
844 if (pRICHdigits == 0)
2e5f0f7b 845 continue;
846 //
847 // Get ready the current chamber stuff
848 //
849 AliRICHResponse* response = iChamber->GetResponseModel();
a2f7eaf6 850 AliSegmentation* seg = iChamber->GetSegmentationModel();
2e5f0f7b 851 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
852 if (seg) {
853 rec->SetSegmentation(seg);
854 rec->SetResponse(response);
237c933d 855 rec->SetDigits(pRICHdigits);
2e5f0f7b 856 rec->SetChamber(ich);
857 if (nev==0) rec->CalibrateCOG();
858 rec->FindRawClusters();
859 }
860 TClonesArray *fRch;
861 fRch=RawClustAddress(ich);
862 fRch->Sort();
863 } // for ich
864
865 gAlice->TreeR()->Fill();
866 TClonesArray *fRch;
237c933d 867 for (int i=0;i<kNCH;i++) {
2e5f0f7b 868 fRch=RawClustAddress(i);
3ea9cb08 869 fRch->GetEntriesFast();
2e5f0f7b 870 }
871
872 ResetRawClusters();
873
874 } // for icat
875
876 char hname[30];
877 sprintf(hname,"TreeR%d",nev);
33984590 878 gAlice->TreeR()->Write(hname,kOverwrite,0);
dfb4e77d 879 gAlice->TreeR()->Reset();
942194a4 880}//void AliRICH::FindClusters(Int_t nev)
c021cb15 881//__________________________________________________________________________________________________
b762c2f6 882void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
dfb4e77d 883{// Create TreeD branches for the RICH.
884 if(GetDebug())Info("MakeBranchInTreeD","Start.");
b762c2f6 885
886 const Int_t kBufferSize = 4000;
887 char branchname[30];
888
889 //
890 // one branch for digits per chamber
891 //
892 for (Int_t i=0; i<kNCH ;i++) {
893 sprintf(branchname,"%sDigits%d",GetName(),i+1);
894 if (fDchambers && treeD) {
dfb4e77d 895 MakeBranchInTree(treeD,branchname, &((*fDchambers)[i]), kBufferSize, file);
b762c2f6 896// printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
897 }
898 }
899}
c021cb15 900//__________________________________________________________________________________________________
dfb4e77d 901void AliRICH::MakeBranch(Option_t* option)
902{//Create Tree branches for the RICH.
903 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
904
905 const Int_t kBufferSize = 4000;
906 char branchname[20];
907
908
909 const char *cH = strstr(option,"H");
910 const char *cD = strstr(option,"D");
911 const char *cR = strstr(option,"R");
912 const char *cS = strstr(option,"S");
913
dfb4e77d 914 if(cH&&TreeH()){
853634d3 915 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
dfb4e77d 916 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
917 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
918
853634d3 919 //kir if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
dfb4e77d 920 //kir MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
921 }
922 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
923
924 if(cS&&fLoader->TreeS()){
853634d3 925 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
926 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
dfb4e77d 927 }
928
929 int i;
930 if (cD&&fLoader->TreeD()){
931 if(!fDchambers){
932 fDchambers=new TObjArray(kNCH); // one branch for digits per chamber
933 for(i=0;i<kNCH;i++){
934 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
935 }
936 }
937 for (i=0; i<kNCH ;i++)
938 {
939 sprintf(branchname,"%sDigits%d",GetName(),i+1);
940 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
941 }
942 }
943
944 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
945 Int_t i;
946 if (fRawClusters == 0x0 )
947 {
948 fRawClusters = new TObjArray(kNCH);
949 for (i=0; i<kNCH ;i++)
950 {
951 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
952 }
953 }
954
955 if (fRecHits1D == 0x0)
956 {
957 fRecHits1D = new TObjArray(kNCH);
958 for (i=0; i<kNCH ;i++)
959 {
960 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
961 }
962 }
963
964 if (fRecHits3D == 0x0)
965 {
966 fRecHits3D = new TObjArray(kNCH);
967 for (i=0; i<kNCH ;i++)
968 {
969 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
970 }
971 }
972
973 for (i=0; i<kNCH ;i++){
974 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
975 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0);
976 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
977 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0);
978 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
979 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0);
980 }
981 }//if (cR && gAlice->TreeR())
982 if(GetDebug())Info("MakeBranch","Stop.");
c021cb15 983}//void AliRICH::MakeBranch(Option_t* option)
dfb4e77d 984//______________________________________________________________________________
985void AliRICH::SetTreeAddress()
986{//Set branch address for the Hits and Digits Tree.
987 if(GetDebug())Info("SetTreeAddress","Start.");
988
989 char branchname[20];
990 Int_t i;
991
992
993 TBranch *branch;
994 TTree *treeH = fLoader->TreeH();
995 TTree *treeD = fLoader->TreeD();
996 TTree *treeR = fLoader->TreeR();
dfb4e77d 997
998 if(treeH){
853634d3 999 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
1000 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
1001
dfb4e77d 1002 branch = treeH->GetBranch("RICHCerenkov");
1003 if(branch){
1004 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
1005 branch->SetAddress(&fCerenkovs);
1006 }
1007
853634d3 1008//kir branch = treeH->GetBranch("RICHSDigits");
1009//kir if (branch)
1010//kir {
1011//kir if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
1012//kir branch->SetAddress(&fSDigits);
1013//kir }
1014 }//if(treeH)
dfb4e77d 1015
c021cb15 1016 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
1017
dfb4e77d 1018
c021cb15 1019 if(fLoader->TreeS()){
853634d3 1020 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
c021cb15 1021 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
1022 fLoader->TreeS()->GetBranch("RICH")->SetAddress(&fSDigits);
853634d3 1023 }
dfb4e77d 1024
1025
853634d3 1026 if(treeD){
1027 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
1028
dfb4e77d 1029 if (fDchambers == 0x0)
1030 {
1031 fDchambers = new TObjArray(kNCH);
1032 for (i=0; i<kNCH ;i++)
1033 {
1034 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
1035 }
1036 }
1037
1038 for (i=0; i<kNCH; i++) {
1039 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1040 if (fDchambers) {
1041 branch = treeD->GetBranch(branchname);
1042 if (branch) branch->SetAddress(&((*fDchambers)[i]));
1043 }
1044 }
1045 }
1046
853634d3 1047 if(treeR){
1048 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
1049
dfb4e77d 1050 if (fRawClusters == 0x0 )
1051 {
1052 fRawClusters = new TObjArray(kNCH);
1053 for (i=0; i<kNCH ;i++)
1054 {
1055 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
1056 }
1057 }
1058
1059 if (fRecHits1D == 0x0)
1060 {
1061 fRecHits1D = new TObjArray(kNCH);
1062 for (i=0; i<kNCH ;i++)
1063 {
1064 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
1065 }
1066 }
1067
1068 if (fRecHits3D == 0x0)
1069 {
1070 fRecHits3D = new TObjArray(kNCH);
1071 for (i=0; i<kNCH ;i++)
1072 {
1073 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
1074 }
1075 }
1076
1077 for (i=0; i<kNCH; i++) {
1078 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1079 if (fRawClusters) {
1080 branch = treeR->GetBranch(branchname);
1081 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
1082 }
1083 }
1084
1085 for (i=0; i<kNCH; i++) {
1086 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1087 if (fRecHits1D) {
1088 branch = treeR->GetBranch(branchname);
1089 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
1090 }
1091 }
1092
1093 for (i=0; i<kNCH; i++) {
1094 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1095 if (fRecHits3D) {
1096 branch = treeR->GetBranch(branchname);
1097 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
1098 }
1099 }
1100
853634d3 1101 }//if(treeR)
dfb4e77d 1102 if(GetDebug())Info("SetTreeAddress","Stop.");
1103}//void AliRICH::SetTreeAddress()
c021cb15 1104//__________________________________________________________________________________________________
dfb4e77d 1105void AliRICH::Print(Option_t *option)const
1106{
1107 TObject::Print(option);
3ea9cb08 1108 fpParam->Dump();
c021cb15 1109 fChambers->Print(option);
dfb4e77d 1110}//void AliRICH::Print(Option_t *option)const
c021cb15 1111//__________________________________________________________________________________________________
3ea9cb08 1112void AliRICH::CreateGeometry()
1113{//Creates detailed geometry simulation (currently GEANT volumes tree)
1114 if(GetDebug())Info("CreateGeometry","Start.");
1115//???????? to be removed to AliRICHParam?
1116 fpParam->RadiatorToPads(fpParam->FreonThickness()/2+fpParam->QuartzThickness()+fpParam->GapThickness());
1117
1118//Opaque quartz thickness
1119 Float_t oqua_thickness = .5;
1120//CsI dimensions
c021cb15 1121 Float_t csi_width =fpParam->Nx()*fpParam->PadSizeX()+fpParam->DeadZone();
1122 Float_t csi_length=fpParam->Ny()*fpParam->PadSizeY()+2*fpParam->DeadZone();
3ea9cb08 1123
1124 Int_t *idtmed = fIdtmed->GetArray()-999;
1125
1126 Int_t i;
1127 Float_t zs;
1128 Int_t idrotm[1099];
1129 Float_t par[3];
1130
1131//External aluminium box
a277aaca 1132 par[0]=68.8*kcm;par[1]=13*kcm;par[2]=70.86*kcm;//Original Settings
3ea9cb08 1133 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
1134//Air
1135 par[0]=66.3; par[1] = 13; par[2] = 68.35; //Original Settings
1136 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
1137//Air 2 (cutting the lower part of the box)
1138 par[0]=1.25; par[1] = 3; par[2] = 70.86; //Original Settings
1139 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
1140//Air 3 (cutting the lower part of the box)
1141 par[0]=66.3; par[1] = 3; par[2] = 1.2505; //Original Settings
1142 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
1143//Honeycomb
1144 par[0]=66.3;par[1]=0.188; par[2] = 68.35; //Original Settings
1145 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
1146//Aluminium sheet
1147 par[0]=66.3;par[1]=0.025;par[2]=68.35; //Original Settings
1148 //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
1149 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
1150//Quartz
1151 par[0]=fpParam->QuartzWidth()/2;par[1]=fpParam->QuartzThickness()/2;par[2]=fpParam->QuartzLength()/2;
1152 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
1153//Spacers (cylinders)
1154 par[0]=0.;par[1]=.5;par[2]=fpParam->FreonThickness()/2;
1155 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
1156//Feet (freon slabs supports)
1157 par[0] = .7; par[1] = .3; par[2] = 1.9;
1158 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
1159//Opaque quartz
1160 par[0]=fpParam->QuartzWidth()/2;par[1]= .2;par[2]=fpParam->QuartzLength()/2;
1161 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
1162//Frame of opaque quartz
1163 par[0]=fpParam->OuterFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->OuterFreonLength()/2;
1164 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
1165 par[0]=fpParam->InnerFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->InnerFreonLength()/2;
1166 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
1167//Freon
1168 par[0]=fpParam->OuterFreonWidth()/2 - oqua_thickness;
1169 par[1]=fpParam->FreonThickness()/2;
1170 par[2]=fpParam->OuterFreonLength()/2 - 2*oqua_thickness;
1171 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
1172
1173 par[0]=fpParam->InnerFreonWidth()/2 - oqua_thickness;
1174 par[1]=fpParam->FreonThickness()/2;
1175 par[2]=fpParam->InnerFreonLength()/2 - 2*oqua_thickness;
1176 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
1177//Methane
1178 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2;par[2]=csi_length/2;
1179 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1180//Methane gap
1181 par[0]=csi_width/2;par[1]=fpParam->ProximityGapThickness()/2;par[2] = csi_length/2;
1182 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1183//CsI photocathode
1184 par[0]=csi_width/2;par[1]=.25;par[2]=csi_length/2;
1185 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1186//Anode grid
1187 par[0] = 0.;par[1] = .001;par[2] = 20.;
1188 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1189
1190//Wire supports
1191//Bar of metal
1192 par[0]=csi_width/2;par[1]=1.05;par[2]=1.05;
1193 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1194//Ceramic pick up (base)
1195 par[0]=csi_width/2;par[1]= .25;par[2]=1.05;
1196 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1197//Ceramic pick up (head)
1198 par[0] = csi_width/2;par[1] = .1;par[2] = .1;
1199 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1200
1201//Aluminium supports for methane and CsI
1202//Short bar
1203 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2 + .25; par[2] = (68.35 - csi_length/2)/2;
1204 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
1205//Long bar
1206 par[0]=(66.3 - csi_width/2)/2;par[1]=fpParam->GapThickness()/2+.25;par[2]=csi_length/2+68.35-csi_length/2;
1207 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1208
1209//Aluminium supports for freon
1210//Short bar
1211 par[0] = fpParam->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - fpParam->QuartzLength()/2)/2;
1212 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1213//Long bar
1214 par[0] = (66.3 - fpParam->QuartzWidth()/2)/2; par[1] = .3;
1215 par[2] = fpParam->QuartzLength()/2 + 68.35 - fpParam->QuartzLength()/2;
1216 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1217//PCB backplane
1218 par[0] = csi_width/2;par[1] = .25; par[2] = csi_length/4 -.5025;
1219 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
1220
1221//Backplane supports
1222//Aluminium slab
1223 par[0] = 33.15;par[1] = 2;par[2] = 21.65;
1224 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1225//Big hole
1226 par[0] = 9.05; par[1] = 2; par[2] = 4.4625;
1227 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1228//Small hole
1229 par[0] = 5.7;par[1] = 2;par[2] = 4.4625;
1230 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1231//Place holes inside backplane support
1232 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1233 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1234 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1235 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1236 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1237 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1238 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1239 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1240 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1241 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1242 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1243 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1244 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1245 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1246 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1247 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1248//Place material inside RICH
1249 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
1250 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");
1251 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");
1252 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");
1253 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");
1254 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1255 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1256 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1257 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1258 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1259 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1260 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1261 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1262 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1263 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1264 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1265 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .2, 0., 0, "ONLY");
1266// Methane supports
1267 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1268 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1269 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1270 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1271//Freon supports
1272 Float_t supp_y = 1.276 - fpParam->GapThickness()/2- fpParam->QuartzThickness() -fpParam->FreonThickness() - .2 + .3; //y position of freon supports
1273 gMC->Gspos("SFLG", 1, "SRIC", fpParam->QuartzWidth()/2 + (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1274 gMC->Gspos("SFLG", 2, "SRIC", - fpParam->QuartzWidth()/2 - (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1275 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, fpParam->QuartzLength()/2 + (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
1276 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - fpParam->QuartzLength()/2 - (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
1277 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1278//Place spacers
1279 Int_t nspacers = 30;
1280 for (i = 0; i < nspacers/3; i++) {
1281 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1282 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1283 }
1284 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1285 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1286 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1287 }
1288 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1289 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1290 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1291 }
1292 for (i = 0; i < nspacers/3; i++) {
1293 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1294 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1295 }
1296 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1297 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1298 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1299 }
1300 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1301 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1302 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1303 }
1304 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1305 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
1306 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)
1307 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings
1308 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)
1309 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness()/2, 0., 0, "ONLY");
1310 gMC->Gspos("GAP ", 1, "META", 0., fpParam->GapThickness()/2 - fpParam->ProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1311 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1312 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + fpParam->GapThickness()/2 + .25, 0., 0, "ONLY");
1313//Wire support placing
1314 gMC->Gspos("WSG2", 1, "GAP ", 0., fpParam->ProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1315 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1316 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1317//Backplane placing
1318 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1319 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1320 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1321 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1322 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1323 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1324//PCB placing
1325 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1326 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
1327
1328//place chambers into mother volume ALIC
c021cb15 1329 for(int i=1;i<=kNCH;i++){
3ea9cb08 1330 AliMatrix(idrotm[1000+i],C(i)->ThetaXd(),C(i)->PhiXd(),
1331 C(i)->ThetaYd(),C(i)->PhiYd(),
1332 C(i)->ThetaZd(),C(i)->PhiZd());
c021cb15 1333 gMC->Gspos("RICH",i,"ALIC",C(i)->X(),C(i)->Y(),C(i)->Z(),idrotm[1000+i], "ONLY");
3ea9cb08 1334 }
1335
1336 if(GetDebug())Info("CreateGeometry","Stop.");
1337}//void AliRICH::CreateGeometry()
1338//______________________________________________________________________________
1339void AliRICH::CreateChambers()
1340{//(re)create all RICH Chambers
1341 if(GetDebug())Info("CreateChambers","Start.");
1342
1343 if(fChambers) delete fChambers;//recreate chambers
1344 fChambers=new TObjArray(kNCH);
1345 fChambers->SetOwner();
1346 for(int i=0;i<kNCH;i++){
1347 fChambers->AddAt(new AliRICHChamber(i+1,fpParam),i);
1348 }
853634d3 1349
3ea9cb08 1350 if(GetDebug())Info("CreateChambers","Stop.");
1351}//void AliRICH::CreateChambers()
c021cb15 1352//__________________________________________________________________________________________________
1353void AliRICH::GenerateFeedbacks(Float_t eloss)
1354{// Generate FeedBack photons
1355 Int_t j;
1356 Float_t cthf, phif, enfp = 0, sthf;
1357 Float_t e1[3], e2[3], e3[3];
1358 Float_t vmod, uswop;
1359 Float_t dir[3], phi;
1360 Float_t pol[3], mom[4];
1361//Determine number of feedback photons
1362 TLorentzVector x4;
1363 gMC->TrackPosition(x4);//This sould return the current track position
a277aaca 1364 Float_t charge=Param()->TotalCharge(gMC->TrackPid(),eloss,5*kcm);//??? Totsl Charge
c021cb15 1365 Int_t iNphotons=gMC->GetRandom()->Poisson(Param()->AlphaFeedback()*charge);
1366 Info("GenerateFeedbacks","N photons=%i",iNphotons);
1367//Generate photons
1368 for(Int_t i=0;i<iNphotons;i++){
1369 Double_t ranf[2];
1370 gMC->GetRandom()->RndmArray(2,ranf); //Sample direction
1371 cthf=ranf[0]*2-1.0;
1372 if(cthf<0) continue;
1373 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
1374 phif = ranf[1] * 2 * TMath::Pi();
1375
1376 if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
1377 enfp = 7.5e-9;
1378 else if(randomNumber<=0.7)
1379 enfp = 6.4e-9;
1380 else
1381 enfp = 7.9e-9;
1382
1383
1384 dir[0] = sthf * TMath::Sin(phif); dir[1] = cthf; dir[2] = sthf * TMath::Cos(phif);
1385 gMC->Gdtom(dir, mom, 2);
1386 mom[0]*=enfp; mom[1]*=enfp; mom[2]*=enfp;
1387 mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
1388
1389 // Polarisation
1390 e1[0]= 0; e1[1]=-dir[2]; e1[2]= dir[1];
1391 e2[0]=-dir[1]; e2[1]= dir[0]; e2[2]= 0;
1392 e3[0]= dir[1]; e3[1]= 0; e3[2]=-dir[0];
1393
1394 vmod=0;
1395 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1396 if (!vmod) for(j=0;j<3;j++) {
1397 uswop=e1[j];
1398 e1[j]=e3[j];
1399 e3[j]=uswop;
1400 }
1401 vmod=0;
1402 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1403 if (!vmod) for(j=0;j<3;j++) {
1404 uswop=e2[j];
1405 e2[j]=e3[j];
1406 e3[j]=uswop;
1407 }
1408
1409 vmod=0;
1410 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1411 vmod=TMath::Sqrt(1/vmod);
1412 for(j=0;j<3;j++) e1[j]*=vmod;
1413
1414 vmod=0;
1415 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1416 vmod=TMath::Sqrt(1/vmod);
1417 for(j=0;j<3;j++) e2[j]*=vmod;
1418
1419 phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
1420 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
1421 gMC->Gdtom(pol, pol, 2);
1422 Int_t outputNtracksStored;
1423 gAlice->PushTrack(1, //do not transport
1424 gAlice->GetCurrentTrackNumber(),//parent track
1425 kFeedback, //PID
1426 mom[0],mom[1],mom[2],mom[3], //track momentum
1427 x4.X(),x4.Y(),x4.Z(),x4.T(), //track origin
1428 pol[0],pol[1],pol[2], //polarization
1429 kPFeedBackPhoton,outputNtracksStored,1.0);
1430
1431 }
1432}//Int_t AliRICH::FeedBackPhotons()
1433//__________________________________________________________________________________________________
1434static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
1435static Int_t sCurIterPad=0;
1436
1437//__________________________________________________________________________________________________
1438AliRICHSDigit* AliRICH::FirstPad(AliRICHhit* hit,TClonesArray *clusters )
1439{// Initialise the pad iterator Return the address of the first sdigit for hit
1440 TClonesArray *theClusters = clusters;
1441 Int_t nclust = theClusters->GetEntriesFast();
1442 if (nclust && hit->PHlast() > 0) {
1443 sMaxIterPad=Int_t(hit->PHlast());
1444 sCurIterPad=Int_t(hit->PHfirst());
1445 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1446 } else {
1447 return 0;
1448 }
1449
1450}
1451//__________________________________________________________________________________________________
1452AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
1453{// Iterates over pads
1454
1455 sCurIterPad++;
1456 if (sCurIterPad <= sMaxIterPad) {
1457 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1458 } else {
1459 return 0;
1460 }
1461}
1462//__________________________________________________________________________________________________