]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
Momentum dependent foil stack parameters
[u/mrichter/AliRoot.git] / RICH / AliRICH.cxx
CommitLineData
53fd478b 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// **************************************************************************
4c039060 15
53fd478b 16#include "AliRICH.h"
17#include "AliRICHParam.h"
18#include "AliRICHChamber.h"
e42a7b46 19#include "AliRICHClusterFinder.h"
2e5f0f7b 20#include <TArrayF.h>
543d5224 21#include <TGeometry.h>
116cbefd 22#include <TBRIK.h>
543d5224 23#include <TTUBE.h>
237c933d 24#include <TFile.h>
116cbefd 25#include <TNode.h>
26#include <TObjArray.h>
3582c1f9 27#include <TParticle.h>
28#include <AliStack.h>
c60862bf 29#include <AliMagF.h>
c60862bf 30#include <AliRun.h>
31#include <AliRunDigitizer.h>
53fd478b 32#include <AliMC.h>
e42a7b46 33#include <AliESD.h>
5d12ce38 34#include <TVirtualMC.h>
e42a7b46 35#include <TH1F.h>
36#include <TH2F.h>
37#include <TStopwatch.h>
ddae0931 38
853634d3 39ClassImp(AliRICHhit)
c60862bf 40//__________________________________________________________________________________________________
41void AliRICHhit::Print(Option_t*)const
42{
3582c1f9 43 ::Info("hit","Ch=%1i, TID=%6i, eloss=%9.3f eV, in-out dist=%9.4f, OUT(%7.2f,%7.2f,%7.2f)"
44 ,fChamber,fTrack,fEloss*1e9,Length(),fOutX3.X(),fOutX3.Y(),fOutX3.Z());
c1863e3c 45}
c60862bf 46//__________________________________________________________________________________________________
853634d3 47ClassImp(AliRICHdigit)
c60862bf 48//__________________________________________________________________________________________________
49void AliRICHdigit::Print(Option_t*)const
50{
e42a7b46 51 ::Info("digit","cfm=%9i, cs=%2i, x=%3i, y=%3i, q=%8.3f, TID1=%5i, TID2=%5i, TID3=%5i",
52 fCFM,fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
c1863e3c 53}
54//__________________________________________________________________________________________________
55ClassImp(AliRICHcluster)
56//__________________________________________________________________________________________________
57void AliRICHcluster::Print(Option_t*)const
58{
e42a7b46 59 char *status=0;
60 switch(fStatus){
61 case kRaw: status="raw" ;break;
62 case kResolved: status="resolved";break;
63 case kEmpty: status="empty" ;break;
64 }
65 if(fDigits)
66 ::Info("cluster","cfm=%10i, cs=%2i, SiMa=%6i, Shape=%5i, x=%7.3f, y=%7.3f, Q=%6i, %s with %i digits",
67 fCFM,fChamber,fSize,fShape,fX,fY,fQdc,status,fDigits->GetEntriesFast());
68 else
69 ::Info("cluster","cfm=%10i, cs=%2i, SiMa=%6i, Shape=%5i, x=%7.3f, y=%7.3f, Q=%6i, %s with %i digits",
70 fCFM,fChamber,fSize,fShape,fX,fY,fQdc,status,0);
71
af3d25a6 72}
73//__________________________________________________________________________________________________
c60862bf 74ClassImp(AliRICH)
75//__________________________________________________________________________________________________
15d8311d 76// RICH manager class
c60862bf 77//BEGIN_HTML
15d8311d 78/*
79 <img src="gif/alirich.gif">
80*/
c60862bf 81//END_HTML
82//__________________________________________________________________________________________________
e42a7b46 83AliRICH::AliRICH():AliDetector(),fpParam(0), fSdigits(0),fNsdigits(0),fDigitsNew(0),fClusters(0)
53fd478b 84{
85//Default ctor should not contain any new operators
543d5224 86//AliDetector ctor deals with Hits and Digits
e42a7b46 87 for(int i=0;i<kNchambers;i++) fNdigitsNew[i] =0;
88 for(int i=0;i<kNchambers;i++) fNclusters[i]=0;
89// fCounters.ResizeTo(20); fCounters.Zero();
15d8311d 90}//AliRICH::AliRICH()
c021cb15 91//__________________________________________________________________________________________________
fe4da5cc 92AliRICH::AliRICH(const char *name, const char *title)
e42a7b46 93 :AliDetector(name,title),fpParam(new AliRICHParam),fSdigits(0),fNsdigits(0),fDigitsNew(0),fClusters(0)
53fd478b 94{
95//Named ctor
dfb4e77d 96 if(GetDebug())Info("named ctor","Start.");
543d5224 97//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
e42a7b46 98 CreateHits(); gAlice->GetMCApp()->AddHitList(fHits);
99 fCounters.ResizeTo(20); fCounters.Zero();
dfb4e77d 100 if(GetDebug())Info("named ctor","Stop.");
101}//AliRICH::AliRICH(const char *name, const char *title)
c021cb15 102//__________________________________________________________________________________________________
fe4da5cc 103AliRICH::~AliRICH()
53fd478b 104{
105//dtor
dfb4e77d 106 if(GetDebug()) Info("dtor","Start.");
237c933d 107
c60862bf 108 if(fpParam) delete fpParam;
c60862bf 109
110 if(fHits) delete fHits;
111 if(fSdigits) delete fSdigits;
112 if(fDigits) delete fDigits;
113 if(fDigitsNew) {fDigitsNew->Delete(); delete fDigitsNew;}
114 if(fClusters) {fClusters->Delete(); delete fClusters;}
dfb4e77d 115 if(GetDebug()) Info("dtor","Stop.");
116}//AliRICH::~AliRICH()
c021cb15 117//__________________________________________________________________________________________________
3ea9cb08 118void AliRICH::Hits2SDigits()
53fd478b 119{
3582c1f9 120// Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
3ea9cb08 121 if(GetDebug()) Info("Hit2SDigits","Start.");
3582c1f9 122 for(Int_t iEventN=0;iEventN<GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEventN++){//events loop
e42a7b46 123 GetLoader()->GetRunLoader()->GetEvent(iEventN);//get next event
3582c1f9 124
e42a7b46 125 if(!GetLoader()->TreeH()) GetLoader()->LoadHits(); GetLoader()->GetRunLoader()->LoadHeader();
126 GetLoader()->GetRunLoader()->LoadKinematics();//from
127 if(!GetLoader()->TreeS()) GetLoader()->MakeTree("S"); MakeBranch("S");//to
3582c1f9 128
129 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
e42a7b46 130 GetLoader()->TreeH()->GetEntry(iPrimN);
3582c1f9 131 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop
e42a7b46 132 AliRICHhit *pHit=(AliRICHhit*)Hits()->At(iHitN);//get current hit
133 TVector2 x2 = C(pHit->C())->Glob2Loc(pHit->OutX3());//hit position in the chamber local system
134 Int_t iTotQdc=P()->TotQdc(x2,pHit->Eloss());//total charge produced by hit, 0 if hit in dead zone
09c52ebc 135 if(iTotQdc==0) continue;
e42a7b46 136 TVector area=P()->Loc2Area(x2);//determine affected pads, dead zones analysed inside
137 if(GetDebug()) Info("Hits2SDigits","hit(%6.2f,%6.2f)->area(%3.0f,%3.0f)-(%3.0f,%3.0f) QDC=%4i",x2.X(),x2.Y(),area[0],area[1],area[2],area[3],iTotQdc);
138 TVector pad(2);
139 for(pad[1]=area[1];pad[1]<=area[3];pad[1]++)//affected pads loop
140 for(pad[0]=area[0];pad[0]<=area[2];pad[0]++){
141 Double_t padQdc=iTotQdc*P()->FracQdc(x2,pad);
142 if(GetDebug()) Info("Hits2SDigits","current pad(%3.0f,%3.0f) with QDC =%6.2f",pad[0],pad[1],padQdc);
143 if(padQdc>0.1) AddSDigit(pHit->C(),pad,padQdc,GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack());
3582c1f9 144 }//affected pads loop
145 }//hits loop
146 }//prims loop
e42a7b46 147 GetLoader()->TreeS()->Fill();
148 GetLoader()->WriteSDigits("OVERWRITE");
2b8f978a 149 ResetSDigits();
3582c1f9 150 }//events loop
e42a7b46 151 GetLoader()->UnloadHits(); GetLoader()->GetRunLoader()->UnloadHeader(); GetLoader()->GetRunLoader()->UnloadKinematics();
3582c1f9 152 GetLoader()->UnloadSDigits();
853634d3 153 if(GetDebug()) Info("Hit2SDigits","Stop.");
3582c1f9 154}//Hits2SDigits()
c021cb15 155//__________________________________________________________________________________________________
dfb4e77d 156void AliRICH::BuildGeometry()
53fd478b 157{
158//Builds a TNode geometry for event display
dfb4e77d 159 if(GetDebug())Info("BuildGeometry","Start.");
237c933d 160
3ea9cb08 161 TNode *node, *subnode, *top;
162 top=gAlice->GetGeometry()->GetNode("alice");
c24372d0 163
3ea9cb08 164 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
53d98323 165
d4c94996 166 Float_t wid=P()->SectorSizeX();
167 Float_t len=P()->SectorSizeY();
3ea9cb08 168 new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
169
e42a7b46 170 for(int i=1;i<=kNchambers;i++){
237c933d 171 top->cd();
c021cb15 172 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 173 node->SetLineColor(kRed);
91975aa2 174 node->cd();
d4c94996 175 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+P()->DeadZone(),5,len/2+P()->DeadZone()/2,"");
91975aa2 176 subnode->SetLineColor(kGreen);
177 fNodes->Add(subnode);
d4c94996 178 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+P()->DeadZone()/2,"");
91975aa2 179 subnode->SetLineColor(kGreen);
180 fNodes->Add(subnode);
d4c94996 181 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-P()->DeadZone(),5,len/2+P()->DeadZone()/2,"");
91975aa2 182 subnode->SetLineColor(kGreen);
183 fNodes->Add(subnode);
d4c94996 184 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+P()->DeadZone(),5,-len/2-P()->DeadZone()/2,"");
91975aa2 185 subnode->SetLineColor(kGreen);
186 fNodes->Add(subnode);
d4c94996 187 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -P()->DeadZone()/2,"");
91975aa2 188 subnode->SetLineColor(kGreen);
189 fNodes->Add(subnode);
d4c94996 190 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-P()->DeadZone(),5,-len/2 - P()->DeadZone()/2,"");
91975aa2 191 subnode->SetLineColor(kGreen);
192 fNodes->Add(subnode);
237c933d 193 fNodes->Add(node);
3ea9cb08 194 }
dfb4e77d 195 if(GetDebug())Info("BuildGeometry","Stop.");
196}//void AliRICH::BuildGeometry()
c60862bf 197
dfb4e77d 198//______________________________________________________________________________
452a64c6 199void AliRICH::CreateMaterials()
200{
e42a7b46 201// Definition of available RICH materials
af3d25a6 202#include "Opticals.h"
203
c60862bf 204 Float_t a=0,z=0,den=0,radl=0,absl=0;
205 Float_t tmaxfd=-10.0, deemax=-0.2, stemax=-0.1,epsil=0.001, stmin=-0.001;
206 Int_t isxfld = gAlice->Field()->Integ();
207 Float_t sxmgmx = gAlice->Field()->Max();
e42a7b46 208 Int_t material;
452a64c6 209
e42a7b46 210 AliMaterial(material=1, "Air $",a=14.61,z=7.3, den=0.001205,radl=30420.0,absl=67500);//(Air)
211 AliMedium(1, "DEFAULT MEDIUM AIR$",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 212
c60862bf 213 AliMaterial( 6, "HON", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //(C)-equivalent radl
214 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
215
216 AliMaterial(16, "CSI", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //CsI-radl equivalent
217 AliMedium(kCSI, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
218
219 AliMaterial(11, "GRI", a=63.54,z=29.0,den=8.96, radl=1.43, absl=0); //anode grid (Cu)
af3d25a6 220 AliMedium(7, "GRID$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 221
e42a7b46 222 AliMaterial(50, "ALUM", a=26.98,z=13.0,den=2.699, radl=8.9, absl=0); //aluminium sheet (Al)
c60862bf 223 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
224
e42a7b46 225 AliMaterial(material=31, "COPPER$", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //(Cu)
226 AliMedium(12, "PCB_COPPER", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 227
228 Float_t aQuartz[2]={28.09,16.0}; Float_t zQuartz[2]={14.00, 8.0}; Float_t wmatQuartz[2]={1,2};
229 AliMixture (20, "QUA",aQuartz,zQuartz,den=2.64,-2, wmatQuartz);//Quarz (SiO2) - trasnparent
af3d25a6 230 AliMedium(3, "QUARTZ$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 231
232 AliMixture (21, "QUAO",aQuartz, zQuartz, den=2.64, -2, wmatQuartz);//Quarz (SiO2) - opaque
af3d25a6 233 AliMedium(8, "QUARTZO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 234
235 Float_t aFreon[2]={12,19}; Float_t zFreon[2]={6,9}; Float_t wmatFreon[2]={6,14};
e42a7b46 236 AliMixture (material=30, "C6F14",aFreon,zFreon,den=1.68,-2,wmatFreon);//Freon (C6F14)
237 AliMedium(4, "C6F14$",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 238
239 Float_t aMethane[2]={12.01,1}; Float_t zMethane[2]={6,1}; Float_t wmatMethane[2]={1,4};
e42a7b46 240 AliMixture (material=40, "CH4", aMethane, zMethane, den=7.17e-4,-2, wmatMethane);//methane (CH4)
241 AliMedium(kCH4, "CH4$" , material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
242 AliMedium(kGAP, "CH4GAP$", material, 1, isxfld, sxmgmx,tmaxfd, 0.1, -deemax, epsil, -stmin);
243
244 if(P()->IsRadioSrc()){
245 AliMaterial(material=45, "STEEL$", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //Steel
246 AliMedium(kSteel, "STEEL", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 247
e42a7b46 248 AliMaterial(material=46, "PERPEX$", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //Perpex
249 AliMedium(kPerpex, "PERPEX", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
250
251 AliMaterial(material=47, "STRONZIUM$", a=87.62,z=38.0,den=2.54, radl=4.24, absl=0); //Sr90
252 AliMedium(kSr90, "STRONZIUM", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
253 }
c60862bf 254
255 Float_t aGlass[5]={12.01, 28.09, 16., 10.8, 23.};
256 Float_t zGlass[5]={ 6., 14., 8., 5., 11.};
257 Float_t wGlass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
e42a7b46 258 AliMixture(material=32, "GLASS",aGlass, zGlass, den=1.74, 5, wGlass);//Glass 50%C+10.5%Si+35.5%O+3% + 1%
259 AliMedium(11, "GLASS", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 260
261 Int_t *idtmed = fIdtmed->GetArray()-999;
af3d25a6 262 gMC->SetCerenkov(idtmed[1000], kNbins, aPckov, aAbsCH4, aQeAll, aIdxCH4);
263 gMC->SetCerenkov(idtmed[1001], kNbins, aPckov, aAbsCH4, aQeAll, aIdxCH4);
264 gMC->SetCerenkov(idtmed[1002], kNbins, aPckov, aAbsSiO2, aQeAll, aIdxSiO2);
265 gMC->SetCerenkov(idtmed[1003], kNbins, aPckov, aAbsC6F14, aQeAll, aIdxC6F14);
266 gMC->SetCerenkov(idtmed[1004], kNbins, aPckov, aAbsCH4, aQeAll, aIdxCH4);
267 gMC->SetCerenkov(idtmed[1005], kNbins, aPckov, aAbsCsI, aQeCsI, aIdxCH4);
268 gMC->SetCerenkov(idtmed[1006], kNbins, aPckov, aAbsGrid, aQeAll, aIdxGrid);
269 gMC->SetCerenkov(idtmed[1007], kNbins, aPckov, aAbsOpSiO2, aQeAll, aIdxOpSiO2);
270 gMC->SetCerenkov(idtmed[1008], kNbins, aPckov, aAbsCH4, aQeAll, aIdxCH4);
271 gMC->SetCerenkov(idtmed[1009], kNbins, aPckov, aAbsGrid, aQeAll, aIdxGrid);
272 gMC->SetCerenkov(idtmed[1010], kNbins, aPckov, aAbsOpSiO2, aQeAll, aIdxOpSiO2);
273
c60862bf 274}//void AliRICH::CreateMaterials()
c021cb15 275//__________________________________________________________________________________________________
53fd478b 276Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const
452a64c6 277{
278
279 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
280
281 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,
282 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,
283 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
452a64c6 284 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
285 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
286 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
287 1.72,1.53};
452a64c6 288 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
289 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
290 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
291 1.714,1.498};
292 Float_t xe=ene;
293 Int_t j=Int_t(xe*10)-49;
294 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
295 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
296
297 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
298 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
299
300 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
301 Float_t tanin=sinin/pdoti;
302
303 Float_t c1=cn*cn-ck*ck-sinin*sinin;
304 Float_t c2=4*cn*cn*ck*ck;
305 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
306 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
307
308 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
309 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
310
311
312 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
313 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
314
315 Float_t sigraf=18.;
316 Float_t lamb=1240/ene;
317 Float_t fresn;
318
319 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
320
321 if(pola)
322 {
323 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
324 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
325 }
326 else
327 fresn=0.5*(rp+rs);
328
329 fresn = fresn*rO;
330 return(fresn);
53fd478b 331}//Fresnel()
c021cb15 332//__________________________________________________________________________________________________
53fd478b 333Float_t AliRICH::AbsoCH4(Float_t x)const
334{
335//Evaluate the absorbtion lenght of CH4
cb8189e7 336 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
cb8189e7 337 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
3d130a45 338 const Float_t kLoschmidt=2.686763e19; // LOSCHMIDT NUMBER IN CM-3
339 const Float_t kPressure=750.,kTemperature=283.;
53fd478b 340 const Float_t kPn=kPressure/760.;
341 const Float_t kTn=kTemperature/273.16;
342 const Float_t kC0=-1.655279e-1;
343 const Float_t kC1=6.307392e-2;
344 const Float_t kC2=-8.011441e-3;
345 const Float_t kC3=3.392126e-4;
3d130a45 346
347 Float_t crossSection=0;
348 if (x<7.75)
349 crossSection=.06e-22;
350 else if(x>=7.75 && x<=8.1){ //------ METHANE CROSS SECTION cm-2 ASTROPH. J. 214, L47 (1978)
53fd478b 351 crossSection=(kC0+kC1*x+kC2*x*x+kC3*x*x*x)*1.e-18;
3d130a45 352 }else if (x> 8.1){
353 Int_t j=0;
354 while (x<=em[j] || x>=em[j+1]){
355 j++;
356 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
357 crossSection=(sch4[j]+a*(x-em[j]))*1e-22;
452a64c6 358 }
3d130a45 359 }//if
452a64c6 360
53fd478b 361 Float_t density=kLoschmidt*kPn/kTn; //CH4 molecular density 1/cm-3
3d130a45 362 return 1./(density*crossSection);
cb8189e7 363}//AbsoCH4()
c021cb15 364//__________________________________________________________________________________________________
dfb4e77d 365void AliRICH::MakeBranch(Option_t* option)
53fd478b 366{
367//Create Tree branches for the RICH.
dfb4e77d 368 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
369
370 const Int_t kBufferSize = 4000;
dfb4e77d 371
dfb4e77d 372 const char *cH = strstr(option,"H");
373 const char *cD = strstr(option,"D");
374 const char *cR = strstr(option,"R");
375 const char *cS = strstr(option,"S");
376
c60862bf 377 if(cH&&TreeH()){//H
378 CreateHits(); //branch will be created in AliDetector::MakeBranch
c60862bf 379 }//H
dfb4e77d 380 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
381
c60862bf 382 if(cS&&fLoader->TreeS()){//S
c1863e3c 383 CreateSDigits(); MakeBranchInTree(fLoader->TreeS(),"RICH",&fSdigits,kBufferSize,0) ;
c60862bf 384 }//S
dfb4e77d 385
c60862bf 386 if(cD&&fLoader->TreeD()){//D
543d5224 387 CreateDigits();
e42a7b46 388 for(Int_t i=0;i<kNchambers;i++){
543d5224 389 MakeBranchInTree(fLoader->TreeD(),Form("%s%d",GetName(),i+1),&((*fDigitsNew)[i]),kBufferSize,0);
390 }
c60862bf 391 }//D
392
393 if(cR&&fLoader->TreeR()){//R
cb8189e7 394 CreateClusters();
e42a7b46 395 for(Int_t i=0;i<kNchambers;i++)
aed240d4 396 MakeBranchInTree(fLoader->TreeR(),Form("%sClusters%d",GetName(),i+1), &((*fClusters)[i]), kBufferSize, 0);
cb8189e7 397 }//R
dfb4e77d 398 if(GetDebug())Info("MakeBranch","Stop.");
c021cb15 399}//void AliRICH::MakeBranch(Option_t* option)
c60862bf 400//__________________________________________________________________________________________________
dfb4e77d 401void AliRICH::SetTreeAddress()
53fd478b 402{
403//Set branch address for the Hits and Digits Tree.
dfb4e77d 404 if(GetDebug())Info("SetTreeAddress","Start.");
c60862bf 405
dfb4e77d 406 TBranch *branch;
dfb4e77d 407
c60862bf 408 if(fLoader->TreeH()){//H
853634d3 409 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
c60862bf 410 CreateHits();//branch map will be in AliDetector::SetTreeAddress
c60862bf 411 }//H
c021cb15 412 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
413
c60862bf 414 if(fLoader->TreeS()){//S
853634d3 415 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
c1863e3c 416 branch=fLoader->TreeS()->GetBranch(GetName()); if(branch){CreateSDigits(); branch->SetAddress(&fSdigits);}
c60862bf 417 }//S
dfb4e77d 418
c60862bf 419 if(fLoader->TreeD()){//D
853634d3 420 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
e42a7b46 421 for(int i=0;i<kNchambers;i++){
c60862bf 422 branch=fLoader->TreeD()->GetBranch(Form("%s%d",GetName(),i+1));
423 if(branch){CreateDigits(); branch->SetAddress(&((*fDigitsNew)[i]));}
aed240d4 424 }
c60862bf 425 }//D
dfb4e77d 426
c60862bf 427 if(fLoader->TreeR()){//R
853634d3 428 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
e42a7b46 429 for(int i=0;i<kNchambers;i++){
c60862bf 430 branch=fLoader->TreeR()->GetBranch(Form("%sClusters%d" ,GetName(),i+1));
cb8189e7 431 if(branch){CreateClusters(); branch->SetAddress(&((*fClusters)[i]));}
dfb4e77d 432 }
c60862bf 433 }//R
dfb4e77d 434 if(GetDebug())Info("SetTreeAddress","Stop.");
435}//void AliRICH::SetTreeAddress()
c021cb15 436//__________________________________________________________________________________________________
dfb4e77d 437void AliRICH::Print(Option_t *option)const
438{
53fd478b 439//Debug printout
dfb4e77d 440 TObject::Print(option);
e42a7b46 441 P()->Print();
442 fCounters.Print();
dfb4e77d 443}//void AliRICH::Print(Option_t *option)const
c021cb15 444//__________________________________________________________________________________________________
3ea9cb08 445void AliRICH::CreateGeometry()
53fd478b 446{
447//Creates detailed geometry simulation (currently GEANT volumes tree)
e42a7b46 448 if(GetDebug())Info("CreateGeometry","Start main.");
3ea9cb08 449//Opaque quartz thickness
53fd478b 450 Float_t oquaThickness = .5;
3ea9cb08 451//CsI dimensions
d4c94996 452 Float_t pcX=P()->PcSizeX();
453 Float_t pcY=P()->PcSizeY();
3ea9cb08 454
455 Int_t *idtmed = fIdtmed->GetArray()-999;
456
457 Int_t i;
458 Float_t zs;
459 Int_t idrotm[1099];
460 Float_t par[3];
e42a7b46 461 par[0]=68.8;par[1]=13 ;par[2]=70.86; gMC->Gsvolu("RICH","BOX ",(*fIdtmed)[kAl], par,3);//External aluminium box
462 par[0]=66.3;par[1]=13 ;par[2]=68.35; gMC->Gsvolu("SRIC","BOX ",(*fIdtmed)[kAir],par,3);//Air
463 par[0]=66.3;par[1]=0.025;par[2]=68.35; gMC->Gsvolu("ALUM","BOX ",(*fIdtmed)[kAl], par,3);//Aluminium sheet
3ea9cb08 464//Air 2 (cutting the lower part of the box)
e42a7b46 465// par[0]=1.25; par[1] = 3; par[2] = 70.86; gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
3ea9cb08 466//Air 3 (cutting the lower part of the box)
e42a7b46 467// par[0]=66.3; par[1] = 3; par[2] = 1.2505; gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
3ea9cb08 468//Honeycomb
c60862bf 469 par[0]=66.3;par[1]=0.188; par[2] = 68.35; gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
e42a7b46 470
3ea9cb08 471 //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
3ea9cb08 472//Quartz
d4c94996 473 par[0]=P()->QuartzWidth()/2;par[1]=P()->QuartzThickness()/2;par[2]=P()->QuartzLength()/2;
3ea9cb08 474 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
475//Spacers (cylinders)
d4c94996 476 par[0]=0.;par[1]=.5;par[2]=P()->FreonThickness()/2; gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
3ea9cb08 477//Feet (freon slabs supports)
c60862bf 478 par[0] = .7; par[1] = .3; par[2] = 1.9; gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
3ea9cb08 479//Opaque quartz
d4c94996 480 par[0]=P()->QuartzWidth()/2;par[1]= .2;par[2]=P()->QuartzLength()/2;
3ea9cb08 481 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
482//Frame of opaque quartz
d4c94996 483 par[0]=P()->OuterFreonWidth()/2;par[1]=P()->FreonThickness()/2;par[2]=P()->OuterFreonLength()/2;
3ea9cb08 484 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
d4c94996 485 par[0]=P()->InnerFreonWidth()/2;par[1]=P()->FreonThickness()/2;par[2]=P()->InnerFreonLength()/2;
3ea9cb08 486 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
487//Freon
d4c94996 488 par[0]=P()->OuterFreonWidth()/2 - oquaThickness;
489 par[1]=P()->FreonThickness()/2;
490 par[2]=P()->OuterFreonLength()/2 - 2*oquaThickness;
3ea9cb08 491 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
492
d4c94996 493 par[0]=P()->InnerFreonWidth()/2 - oquaThickness;
494 par[1]=P()->FreonThickness()/2;
495 par[2]=P()->InnerFreonLength()/2 - 2*oquaThickness;
3ea9cb08 496 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
497//Methane
d4c94996 498 par[0]=pcX/2;par[1]=P()->GapThickness()/2;par[2]=pcY/2; gMC->Gsvolu("META","BOX ",idtmed[1004], par, 3);
3ea9cb08 499//Methane gap
e42a7b46 500 par[0]=pcX/2;par[1]=P()->GapAmp()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
c60862bf 501//CsI PC
502 par[0]=pcX/2;par[1]=.25;par[2]=pcY/2; gMC->Gsvolu("CSI ", "BOX ", (*fIdtmed)[kCSI], par, 3);
3ea9cb08 503//Anode grid
c60862bf 504 par[0] = 0.;par[1] = .001;par[2] = 20.; gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
3ea9cb08 505
506//Wire supports
507//Bar of metal
c60862bf 508 par[0]=pcX/2;par[1]=1.05;par[2]=1.05; gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
3ea9cb08 509//Ceramic pick up (base)
c60862bf 510 par[0]=pcX/2;par[1]= .25;par[2]=1.05; gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
3ea9cb08 511//Ceramic pick up (head)
c60862bf 512 par[0] = pcX/2;par[1] = .1;par[2] = .1; gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
3ea9cb08 513
514//Aluminium supports for methane and CsI
515//Short bar
d4c94996 516 par[0]=pcX/2;par[1]=P()->GapThickness()/2 + .25; par[2] = (68.35 - pcY/2)/2;
3ea9cb08 517 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
518//Long bar
d4c94996 519 par[0]=(66.3 - pcX/2)/2;par[1]=P()->GapThickness()/2+.25;par[2]=pcY/2+68.35-pcY/2;
3ea9cb08 520 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
521
522//Aluminium supports for freon
523//Short bar
d4c94996 524 par[0] = P()->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - P()->QuartzLength()/2)/2;
3ea9cb08 525 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
526//Long bar
d4c94996 527 par[0] = (66.3 - P()->QuartzWidth()/2)/2; par[1] = .3;
528 par[2] = P()->QuartzLength()/2 + 68.35 - P()->QuartzLength()/2;
3ea9cb08 529 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
530//PCB backplane
c60862bf 531 par[0] = pcX/2;par[1] = .25; par[2] = pcY/4 -.5025; gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
3ea9cb08 532
533//Backplane supports
534//Aluminium slab
c60862bf 535 par[0] = 33.15;par[1] = 2;par[2] = 21.65; gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
3ea9cb08 536//Big hole
c60862bf 537 par[0] = 9.05; par[1] = 2; par[2] = 4.4625; gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
3ea9cb08 538//Small hole
c60862bf 539 par[0] = 5.7;par[1] = 2;par[2] = 4.4625; gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
3ea9cb08 540//Place holes inside backplane support
541 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
542 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
543 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
544 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
545 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
546 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
547 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
548 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
549 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
550 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
551 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
552 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
553 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
554 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
555 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
556 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
557//Place material inside RICH
558 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
e42a7b46 559// gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-P()->GapThickness()/2-P()->QuartzThickness()-P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
560// gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-P()->GapThickness()/2-P()->QuartzThickness()-P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
561// gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
562// gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
d4c94996 563 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
564 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
565 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
566 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
567 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
568 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
569 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
570 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
571 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
572 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
573 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
574 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .2, 0., 0, "ONLY");
3ea9cb08 575// Methane supports
c60862bf 576 gMC->Gspos("SMLG", 1, "SRIC", pcX/2 + (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
577 gMC->Gspos("SMLG", 2, "SRIC", - pcX/2 - (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
578 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, pcY/2 + (68.35 - pcY/2)/2, 0, "ONLY");
579 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - pcY/2 - (68.35 - pcY/2)/2, 0, "ONLY");
3ea9cb08 580//Freon supports
d4c94996 581 Float_t suppY = 1.276 - P()->GapThickness()/2- P()->QuartzThickness() -P()->FreonThickness() - .2 + .3; //y position of freon supports
582 gMC->Gspos("SFLG", 1, "SRIC", P()->QuartzWidth()/2 + (66.3 - P()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
583 gMC->Gspos("SFLG", 2, "SRIC", - P()->QuartzWidth()/2 - (66.3 - P()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
584 gMC->Gspos("SFSH", 1, "SRIC", 0., suppY, P()->QuartzLength()/2 + (68.35 - P()->QuartzLength()/2)/2, 0, "ONLY");
585 gMC->Gspos("SFSH", 2, "SRIC", 0., suppY, - P()->QuartzLength()/2 - (68.35 - P()->QuartzLength()/2)/2, 0, "ONLY");
3ea9cb08 586 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
587//Place spacers
588 Int_t nspacers = 30;
589 for (i = 0; i < nspacers/3; i++) {
590 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
591 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
592 }
593 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
594 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
595 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
596 }
597 for (i = (nspacers*2)/3; i < nspacers; ++i) {
598 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
599 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
600 }
601 for (i = 0; i < nspacers/3; i++) {
602 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
603 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
604 }
605 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
606 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
607 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
608 }
609 for (i = (nspacers*2)/3; i < nspacers; ++i) {
610 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
611 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
612 }
613 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
614 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
d4c94996 615 gMC->Gspos("OQF1", 1, "SRIC", P()->OuterFreonWidth()/2 + P()->InnerFreonWidth()/2 + 2, 1.276 - P()->GapThickness()/2- P()->QuartzThickness() -P()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
616 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings
617 gMC->Gspos("OQF1", 3, "SRIC", - (P()->OuterFreonWidth()/2 + P()->InnerFreonWidth()/2) - 2, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
618 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness()/2, 0., 0, "ONLY");
e42a7b46 619 gMC->Gspos("GAP ", 1, "META", 0., P()->GapThickness()/2 - P()->GapAmp()/2 - 0.0001, 0., 0, "ONLY");
3ea9cb08 620 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
d4c94996 621 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + P()->GapThickness()/2 + .25, 0., 0, "ONLY");
3ea9cb08 622//Wire support placing
e42a7b46 623 gMC->Gspos("WSG2", 1, "GAP ", 0., P()->GapAmp()/2 - .1, 0., 0, "ONLY");
3ea9cb08 624 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
d4c94996 625 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + P()->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
3ea9cb08 626//Backplane placing
d4c94996 627 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
628 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
629 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
630 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
631 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
632 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
3ea9cb08 633//PCB placing
d4c94996 634 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + P()->GapThickness()/2 + .5 + 1.05, pcX/4 + .5025 + 2.5, 0, "ONLY");
635 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + P()->GapThickness()/2 + .5 + 1.05, -pcX/4 - .5025 - 2.5, 0, "ONLY");
e42a7b46 636
3ea9cb08 637//place chambers into mother volume ALIC
e42a7b46 638 for(int i=1;i<=kNchambers;i++){
3ea9cb08 639 AliMatrix(idrotm[1000+i],C(i)->ThetaXd(),C(i)->PhiXd(),
640 C(i)->ThetaYd(),C(i)->PhiYd(),
641 C(i)->ThetaZd(),C(i)->PhiZd());
c021cb15 642 gMC->Gspos("RICH",i,"ALIC",C(i)->X(),C(i)->Y(),C(i)->Z(),idrotm[1000+i], "ONLY");
3ea9cb08 643 }
644
e42a7b46 645
646 if(GetDebug())Info("CreateGeometry","Stop main.");
3ea9cb08 647}//void AliRICH::CreateGeometry()
c60862bf 648//__________________________________________________________________________________________________
e42a7b46 649void AliRICH::Reconstruct()const
53fd478b 650{
e42a7b46 651 AliRICHClusterFinder finder(const_cast<AliRICH*>(this));
652 finder.Exec();
653}
c021cb15 654//__________________________________________________________________________________________________
e42a7b46 655void AliRICH::ControlPlots()
656{
657//Creates a set of hists to control the results of simulation
658
659 TH1F *pHxD=0,*pHyD=0,*pNumClusH1=0,
660 *pQdcH1=0, *pSizeH1=0,
661 *pPureMipQdcH1=0,*pPureMipSizeH1=0,
662 *pPureCerQdcH1=0,*pPureCerSizeH1=0,
663 *pPureFeeQdcH1=0,*pPureFeeSizeH1=0,
664 *pMipQdcH1=0, *pPhotQdcH1=0;
665 TH2F *pMapH2=0,*pPureMipMapH2=0,*pPureCerMapH2=0,*pPureFeeMapH2=0;
666
667 Bool_t isDig =!GetLoader()->LoadDigits();
668 Bool_t isClus=!GetLoader()->LoadRecPoints();
669
670 if(!isDig && !isClus){Error("ControlPlots","No digits and clusters! Nothing to do.");return;}
671
672 TStopwatch sw;TDatime time;
c021cb15 673
e42a7b46 674 TFile *pFile = new TFile("$(HOME)/RCP.root","RECREATE");
675
676 if(isDig){
677 cout<<"Digits available\n";
678 pHxD=new TH1F("HitDigitDiffX","Hit-Digits diff X all chambers;diff [cm]",100,-10,10);
679 pHyD=new TH1F("HitDigitDiffY","Hit-Digits diff Y all chambers;diff [cm]",100,-10,10);
680 }//isDig
681
682 if(isClus){
683 cout<<"Clusters available\n";
684 pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49);
c021cb15 685
e42a7b46 686 pQdcH1 =new TH1F("ClusQdc", "Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
687 pSizeH1 =new TH1F("ClusSize", "Cluster size all chambers;size [number of pads in cluster]",100,0,100);
688 pMapH2 =new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,0,R()->P()->PcSizeX(),1000,0,R()->P()->PcSizeY());
689
690 pMipQdcH1 =new TH1F("QdcMip" ,"MIP Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
691 pPhotQdcH1 =new TH1F("QdcPhot" ,"Cer+Fee Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
692
693 pPureMipQdcH1 =new TH1F("QdcPureMip" ,"MIP only Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
694 pPureMipSizeH1=new TH1F("SizePureMip" ,"MIP only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
695 pPureMipMapH2 =new TH2F("MapPureMip" ,"MIP only Cluster map;x [cm];y [cm]",1000,0,R()->P()->PcSizeX(),1000,0,R()->P()->PcSizeY());
696
697 pPureCerQdcH1 =new TH1F("QdcPureCer" ,"Cerenkov only Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
698 pPureCerSizeH1=new TH1F("SizePureCer" ,"Cernekov only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
699 pPureCerMapH2 =new TH2F("MapPureCer" ,"Cerenkov only Cluster map;x [cm];y [cm]",1000,0,R()->P()->PcSizeX(),1000,0,R()->P()->PcSizeY());
c021cb15 700
e42a7b46 701 pPureFeeQdcH1 =new TH1F("QdcPureFee" ,"Feedback only Cluster Charge all chambers;q [QDC]",R()->P()->MaxQdc(),0,R()->P()->MaxQdc());
702 pPureFeeSizeH1=new TH1F("SizePureFee" ,"Feedback only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
703 pPureFeeMapH2 =new TH2F("MapPureFee" ,"Feedback only Cluster map;x [cm];y [cm]",1000,0,R()->P()->PcSizeX(),1000,0,R()->P()->PcSizeY());
704 }//isClus
705
706 for(Int_t iEvtN=0;iEvtN < GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop
707 GetLoader()->GetRunLoader()->GetEvent(iEvtN); //gets current event
c021cb15 708
e42a7b46 709 if(!GetLoader()->TreeH()) GetLoader()->LoadHits();
710 for(Int_t iPrimN=0;iPrimN < GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
711 GetLoader()->TreeH()->GetEntry(iPrimN);
c021cb15 712 }
713
e42a7b46 714 if(isClus) GetLoader()->TreeR()->GetEntry(0);
715 if(isDig) GetLoader()->TreeD()->GetEntry(0);
c021cb15 716
e42a7b46 717 for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
718 if(isClus){
719 Int_t iNclusCham=Clusters(iChamN)->GetEntries(); if(iNclusCham) pNumClusH1->Fill(iNclusCham);//number of clusters per event
720 for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop
721 AliRICHcluster *pClus=(AliRICHcluster*)Clusters(iChamN)->At(iClusN);
722 pQdcH1 ->Fill(pClus->Q());
723 pSizeH1 ->Fill(pClus->Size());
724 pMapH2 ->Fill(pClus->X(),pClus->Y()); //common
725
726 if(pClus->IsSingleMip()) {pPureMipQdcH1 ->Fill(pClus->Q());
727 pPureMipSizeH1->Fill(pClus->Size());
728 pPureMipMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Mips
729
730 if(pClus->IsSingleCerenkov()){pPureCerQdcH1 ->Fill(pClus->Q());
731 pPureCerSizeH1->Fill(pClus->Size());
732 pPureCerMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Cerenkovs
733
734 if(pClus->IsSingleFeedback()){pPureFeeQdcH1 ->Fill(pClus->Q());
735 pPureFeeSizeH1->Fill(pClus->Size());
736 pPureFeeMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
737
738 if(pClus->IsMip()) {pMipQdcH1 ->Fill(pClus->Q());} //MIP+ other contributions
739 if(!pClus->IsPureMip()) pPhotQdcH1->Fill(pClus->Q()); //not MIP
740 }//clusters loop
741 }//isClus
742 if(isDig){
743 for(Int_t iDigN=0;iDigN<R()->Digits(iChamN)->GetEntries();iDigN++){//digits loop
744 AliRICHdigit *pDig=(AliRICHdigit*)R()->Digits(iChamN)->At(iDigN);
745 AliRICHhit *pHit=Hit(pDig->GetTrack(0));
746 TVector2 hitV2=R()->C(iChamN)->Glob2Loc(pHit->OutX3()); TVector2 digV2=R()->P()->Pad2Loc(pDig->Pad());
747 pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
748 }//digits loop
749 }//isDig
750 }//chambers loop
751 Info("ControlPlots","Event %i processed.",iEvtN);
752 }//events loop
753
754 if(isDig) GetLoader()->UnloadDigits();
755 if(isClus) GetLoader()->UnloadRecPoints();
756
757 pFile->Write(); delete pFile;
758 sw.Print();time.Print();
759}//ControlPlots()
760//__________________________________________________________________________________________________
761AliRICHhit* AliRICH::Hit(Int_t tid)
762{
763//defines which hit provided by given tid for the currently loaded event
764 R()->GetLoader()->LoadHits();
765 for(Int_t iPrimN=0;iPrimN<R()->GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
766 R()->GetLoader()->TreeH()->GetEntry(iPrimN);
767 for(Int_t iHitN=0;iHitN<R()->Hits()->GetEntries();iHitN++){
768 AliRICHhit *pHit=(AliRICHhit*)R()->Hits()->At(iHitN);
769 if(tid==pHit->Track()) {R()->GetLoader()->UnloadHits();return pHit;}
770 }//hits
771 }//prims loop
772 R()->GetLoader()->UnloadHits();
773 return 0;
774}
775//__________________________________________________________________________________________________
776void AliRICH::PrintHits(Int_t iEvtN)
777{
778//Prints a list of RICH hits for a given event. Default is event number 0.
779 Info("PrintHits","List of RICH hits for event %i",iEvtN);
780 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
781 if(R()->GetLoader()->LoadHits()) return;
782
783 Int_t iTotalHits=0;
784 for(Int_t iPrimN=0;iPrimN<R()->GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
785 R()->GetLoader()->TreeH()->GetEntry(iPrimN);
786 R()->Hits()->Print();
787 iTotalHits+=R()->Hits()->GetEntries();
788 }
789 R()->GetLoader()->UnloadHits();
790 Info("PrintHits","totally %i hits",iTotalHits);
791}
792//__________________________________________________________________________________________________
793void AliRICH::PrintSDigits(Int_t iEvtN)
794{
795//prints a list of RICH sdigits for a given event
796 Info("PrintSDigits","List of RICH sdigits for event %i",iEvtN);
797 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
798 if(R()->GetLoader()->LoadSDigits()) return;
799
800 R()->GetLoader()->TreeS()->GetEntry(0);
801 R()->SDigits()->Print();
802 R()->GetLoader()->UnloadSDigits();
803 Info("PrintSDigits","totally %i sdigits",R()->SDigits()->GetEntries());
804}
805//__________________________________________________________________________________________________
806void AliRICH::PrintDigits(Int_t iEvtN)
807{
808//prints a list of RICH digits for a given event
809 Info("PrintDigits","List of RICH digits for event %i",iEvtN);
810 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
811 if(R()->GetLoader()->LoadDigits()) return;
812
813 Int_t iTotalDigits=0;
814 R()->GetLoader()->TreeD()->GetEntry(0);
815 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
816 R()->Digits(iChamber)->Print();
817 iTotalDigits+=R()->Digits(iChamber)->GetEntries();
818 }
819 R()->GetLoader()->UnloadDigits();
820 Info("PrintDigits","totally %i Digits",iTotalDigits);
821}
822//__________________________________________________________________________________________________
823void AliRICH::PrintClusters(Int_t iEvtN)
824{
825//prints a list of RICH clusters for a given event
826 Info("PrintClusters","List of RICH clusters for event %i",iEvtN);
827 R()->GetLoader()->GetRunLoader()->GetEvent(iEvtN);
828 if(R()->GetLoader()->LoadRecPoints()) return;
829
830 Int_t iTotalClusters=0;
831 R()->GetLoader()->TreeR()->GetEntry(0);
832 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
833 R()->Clusters(iChamber)->Print();
834 iTotalClusters+=R()->Clusters(iChamber)->GetEntries();
835 }
836 R()->GetLoader()->UnloadRecPoints();
837 Info("PrintClusters","totally %i clusters",iTotalClusters);
838}
839//__________________________________________________________________________________________________
840void AliRICH::FillESD(AliESD *pESD)const
841{
842//This methode fills AliESDtrack with information from RICH
843 Info("FillESD","Start with %i tracks",pESD->GetNumberOfTracks());
844 const Double_t masses[5]={0.000511,0.105658,0.139567,0.493677,0.93828};//electron,muon,pion,kaon,proton
845 const Double_t refIndex = 1.29052;
89924db8 846
e42a7b46 847 Double_t thetaExp = 0.7;
848 Double_t thetaTh[5];
849 Double_t sinThetaThNorm;
850 Double_t sigmaThetaTh[5];
851 Double_t height[5];
852 Double_t totalHeight=0;
853
854 for(Int_t iTrackN=0;iTrackN<pESD->GetNumberOfTracks();iTrackN++){//ESD tracks loop
855 AliESDtrack *pTrack = pESD->GetTrack(iTrackN);
856
857 pTrack->Print("");
858// TVector2 x2=P()->HelixCross(pTrack);//returns cross point of track with RICH PC in LRS
859 Double_t pmod = pTrack->GetP();
860
861 for(Int_t iPart=4;iPart>=0;iPart--){
862 Double_t cosThetaTh = TMath::Sqrt(masses[iPart]*masses[iPart]+pmod*pmod)/(refIndex*pmod);
a2d4ab71 863 if(cosThetaTh>=1) {break;}
e42a7b46 864 thetaTh[iPart] = TMath::ACos(cosThetaTh);
865 sinThetaThNorm = TMath::Sin(thetaTh[iPart])/TMath::Sqrt(1-1/(refIndex*refIndex));
866 sigmaThetaTh[iPart] = (0.014*(1/sinThetaThNorm-1) + 0.0043)*1.25;
867 height[iPart] = TMath::Gaus(thetaExp,thetaTh[iPart],sigmaThetaTh[iPart]);
868 totalHeight +=height[iPart];
869 }
870
871 pTrack->SetRICHsignal(thetaExp);
872 Double_t richPID[5];
873 for(Int_t iPart=0;iPart<5;iPart++) richPID[iPart] = height[iPart]/totalHeight;
874 pTrack->SetRICHpid(richPID);
875 }//ESD tracks loop
876}