]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
Cleanup of STEER coding conventions
[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
16/*
2e5f0f7b 17 $Log$
116cbefd 18 Revision 1.64 2002/11/21 22:54:07 alibrary
19 Removing AliMC and AliMCProcess
20
4c475d27 21 Revision 1.63 2002/11/04 09:02:52 morsch
22 Further corrcetions on Fresnel and Grid losses.
23
8fb37ffa 24 Revision 1.62 2002/10/31 08:44:04 morsch
25 Problems with rotated RICH solved:
26 Detector response (fresnel reflection, grid absorption ...) has to be
27 determined using local coordinates.
28
53f52132 29 Revision 1.61 2002/10/29 15:00:08 morsch
30 - Diagnostics updated.
31 - RecHits structure synchronized.
32 - Digitizer method using AliRICHDigitizer.
33 (J. Barbosa)
34
fb498b56 35
36 Revision 1.60 2002/10/22 16:28:21 alibrary
37 Introducing Riostream.h
38
7118aef0 39 Revision 1.59 2002/10/14 14:57:31 hristov
40 Merging the VirtualMC branch to the main development branch (HEAD)
41
b9d0a01d 42 Revision 1.58.6.1 2002/06/10 15:12:46 hristov
43 Merged with v3-08-02
44
45 Revision 1.58 2001/11/14 09:49:37 dibari
46 Use debug methods
47
15d8311d 48 Revision 1.57 2001/11/09 17:29:31 dibari
49 Setters fro models moved to header
50
26ce35d8 51 Revision 1.56 2001/11/02 15:37:25 hristov
52 Digitizer class created. Code cleaning and bug fixes (J.Chudoba)
53
b762c2f6 54 Revision 1.55 2001/10/23 13:03:35 hristov
55 The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
56
6e585aa2 57 Revision 1.54 2001/09/07 08:38:10 hristov
58 Pointers initialised to 0 in the default constructors
59
edf34242 60 Revision 1.53 2001/08/30 09:51:23 hristov
61 The operator[] is replaced by At() or AddAt() in case of TObjArray.
62
2682e810 63 Revision 1.52 2001/05/16 14:57:20 alibrary
64 New files for folders and Stack
65
9e1a0ddb 66 Revision 1.51 2001/05/14 10:18:55 hristov
67 Default arguments declared once
68
cc683707 69 Revision 1.50 2001/05/10 14:44:16 jbarbosa
70 Corrected some overlaps (thanks I. Hrivnacovna).
71
4591f067 72 Revision 1.49 2001/05/10 12:23:49 jbarbosa
73 Repositioned the RICH modules.
74 Eliminated magic numbers.
75 Incorporated diagnostics (from macros).
76
a3d71079 77 Revision 1.48 2001/03/15 10:35:00 jbarbosa
78 Corrected bug in MakeBranch (was using a different version of STEER)
79
c3ecfac9 80 Revision 1.47 2001/03/14 18:13:56 jbarbosa
81 Several changes to adapt to new IO.
82 Removed digitising function, using AliRICHMerger::Digitise from now on.
83
34ead2dd 84 Revision 1.46 2001/03/12 17:46:33 hristov
85 Changes needed on Sun with CC 5.0
86
5cf7bbad 87 Revision 1.45 2001/02/27 22:11:46 jbarbosa
88 Testing TreeS, removing of output.
89
633e9a38 90 Revision 1.44 2001/02/27 15:19:12 jbarbosa
91 Transition to SDigits.
92
b251a2b5 93 Revision 1.43 2001/02/23 17:19:06 jbarbosa
94 Corrected photocathode definition in BuildGeometry().
95
ca96c9ea 96 Revision 1.42 2001/02/13 20:07:23 jbarbosa
97 Parametrised definition of photcathode dimensions. New spacers. New data members in AliRICHHit to store particle momentum
98 when entering the freon. Corrected calls to particle stack.
99
c24372d0 100 Revision 1.41 2001/01/26 20:00:20 hristov
101 Major upgrade of AliRoot code
102
2ab0c725 103 Revision 1.40 2001/01/24 20:58:03 jbarbosa
104 Enhanced BuildGeometry. Now the photocathodes are drawn.
105
91975aa2 106 Revision 1.39 2001/01/22 21:40:24 jbarbosa
107 Removing magic numbers
108
ee2105a4 109 Revision 1.37 2000/12/20 14:07:25 jbarbosa
110 Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova)
111
5cfcdf54 112 Revision 1.36 2000/12/18 17:45:54 jbarbosa
113 Cleaned up PadHits object.
114
176a9917 115 Revision 1.35 2000/12/15 16:49:40 jbarbosa
116 Geometry and materials updates (wire supports, pcbs, backplane supports, frame).
117
6197ac87 118 Revision 1.34 2000/11/10 18:12:12 jbarbosa
119 Bug fix for AliRICHCerenkov (thanks to P. Hristov)
120
3cc8edee 121 Revision 1.33 2000/11/02 10:09:01 jbarbosa
122 Minor bug correction (some pointers were not initialised in the default constructor)
123
9b674b76 124 Revision 1.32 2000/11/01 15:32:55 jbarbosa
125 Updated to handle both reconstruction algorithms.
126
a4622d0f 127 Revision 1.31 2000/10/26 20:18:33 jbarbosa
128 Supports for methane and freon vessels
129
683b273b 130 Revision 1.30 2000/10/24 13:19:12 jbarbosa
131 Geometry updates.
132
e293afae 133 Revision 1.29 2000/10/19 19:39:25 jbarbosa
134 Some more changes to geometry. Further correction of digitisation "per part. type"
135
53a60579 136 Revision 1.28 2000/10/17 20:50:57 jbarbosa
137 Inversed digtise by particle type (now, only the selected particle type is not digitsed).
138 Corrected several geometry minor bugs.
139 Added new parameter (opaque quartz thickness).
140
3587e146 141 Revision 1.27 2000/10/11 10:33:55 jbarbosa
142 Corrected bug introduced by earlier revisions (CerenkovData array cannot be reset to zero on wach call of StepManager)
143
8cda28a5 144 Revision 1.26 2000/10/03 21:44:08 morsch
145 Use AliSegmentation and AliHit abstract base classes.
146
a2f7eaf6 147 Revision 1.25 2000/10/02 21:28:12 fca
148 Removal of useless dependecies via forward declarations
149
94de3818 150 Revision 1.24 2000/10/02 15:43:17 jbarbosa
151 Fixed forward declarations.
152 Fixed honeycomb density.
153 Fixed cerenkov storing.
154 New electronics.
155
9dda3582 156 Revision 1.23 2000/09/13 10:42:14 hristov
157 Minor corrections for HP, DEC and Sun; strings.h included
158
e813258a 159 Revision 1.22 2000/09/12 18:11:13 fca
160 zero hits area before using
161
e51a3fa9 162 Revision 1.21 2000/07/21 10:21:07 morsch
163 fNrawch = 0; and fNrechits = 0; in the default constructor.
164
db481a6e 165 Revision 1.20 2000/07/10 15:28:39 fca
166 Correction of the inheritance scheme
167
452a64c6 168 Revision 1.19 2000/06/30 16:29:51 dibari
169 Added kDebugLevel variable to control output size on demand
170
33984590 171 Revision 1.18 2000/06/12 15:15:46 jbarbosa
172 Cleaned up version.
173
237c933d 174 Revision 1.17 2000/06/09 14:58:37 jbarbosa
175 New digitisation per particle type
176
d28b5fc2 177 Revision 1.16 2000/04/19 12:55:43 morsch
178 Newly structured and updated version (JB, AM)
179
4c039060 180*/
181
2e5f0f7b 182
ddae0931 183////////////////////////////////////////////////
184// Manager and hits classes for set:RICH //
185////////////////////////////////////////////////
fe4da5cc 186
116cbefd 187#include <strings.h>
188
189#include <Riostream.h>
2e5f0f7b 190#include <TArrayF.h>
116cbefd 191#include <TBRIK.h>
192#include <TCanvas.h>
193#include <TF1.h>
237c933d 194#include <TFile.h>
94de3818 195#include <TGeometry.h>
a3d71079 196#include <TH1.h>
197#include <TH2.h>
116cbefd 198#include <TNode.h>
199#include <TObjArray.h>
200#include <TObject.h>
201#include <TParticle.h>
202#include <TPDGCode.h>
203#include <TRandom.h>
fb498b56 204#include <TStyle.h>
116cbefd 205#include <TTUBE.h>
206#include <TTree.h>
207#include <TVector.h>
fe4da5cc 208
116cbefd 209#include "AliConst.h"
210#include "AliMagF.h"
211#include "AliPoints.h"
fe4da5cc 212#include "AliRICH.h"
237c933d 213#include "AliRICHCerenkov.h"
116cbefd 214#include "AliRICHClusterFinder.h"
237c933d 215#include "AliRICHDigit.h"
116cbefd 216#include "AliRICHDigitizer.h"
217#include "AliRICHHit.h"
218#include "AliRICHHitMapA1.h"
219#include "AliRICHMerger.h"
237c933d 220#include "AliRICHRawCluster.h"
a4622d0f 221#include "AliRICHRecHit1D.h"
222#include "AliRICHRecHit3D.h"
116cbefd 223#include "AliRICHSDigit.h"
224#include "AliRICHSegmentationV0.h"
225#include "AliRICHTransientDigit.h"
fe4da5cc 226#include "AliRun.h"
fb498b56 227#include "AliRunDigitizer.h"
116cbefd 228#include "AliSegmentation.h"
fb498b56 229
237c933d 230
ddae0931 231
15d8311d 232
233static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
ddae0931 234static Int_t sCurIterPad=0;
ddae0931 235
fe4da5cc 236ClassImp(AliRICH)
ddae0931 237
238//___________________________________________
15d8311d 239// RICH manager class
240//Begin_Html
241/*
242 <img src="gif/alirich.gif">
243*/
244//End_Html
245
fe4da5cc 246AliRICH::AliRICH()
247{
15d8311d 248// Default ctor should not contain any new operators
249 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
237c933d 250
ddae0931 251 fIshunt = 0;
252 fHits = 0;
b251a2b5 253 fSDigits = 0;
254 fNSDigits = 0;
2e5f0f7b 255 fNcerenkovs = 0;
ddae0931 256 fDchambers = 0;
9b674b76 257 fRecHits1D = 0;
258 fRecHits3D = 0;
259 fRawClusters = 0;
260 fChambers = 0;
ddae0931 261 fCerenkovs = 0;
15d8311d 262 for (Int_t i=0; i<7; i++){
9dda3582 263 fNdch[i] = 0;
8fb37ffa 264 fNrawch[i] = 0;
a4622d0f 265 fNrechits1D[i] = 0;
266 fNrechits3D[i] = 0;
15d8311d 267 }
9b674b76 268
269 fFileName = 0;
edf34242 270 fMerger = 0;
15d8311d 271}//AliRICH::AliRICH()
ddae0931 272
fe4da5cc 273AliRICH::AliRICH(const char *name, const char *title)
ddae0931 274 : AliDetector(name,title)
fe4da5cc 275{
15d8311d 276// Named ctor
277 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
278
2e5f0f7b 279 fHits = new TClonesArray("AliRICHHit",1000 );
1cedd08a 280 gAlice->AddHitList(fHits);
b251a2b5 281 fSDigits = new TClonesArray("AliRICHSDigit",100000);
2e5f0f7b 282 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
283 gAlice->AddHitList(fCerenkovs);
b251a2b5 284 fNSDigits = 0;
2e5f0f7b 285 fNcerenkovs = 0;
286 fIshunt = 0;
ddae0931 287
9dda3582 288 //fNdch = new Int_t[kNCH];
ddae0931 289
237c933d 290 fDchambers = new TObjArray(kNCH);
2e5f0f7b 291
a4622d0f 292 fRecHits1D = new TObjArray(kNCH);
293 fRecHits3D = new TObjArray(kNCH);
ddae0931 294
295 Int_t i;
296
237c933d 297 for (i=0; i<kNCH ;i++) {
2682e810 298 //PH (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000);
299 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
ddae0931 300 fNdch[i]=0;
301 }
2e5f0f7b 302
9dda3582 303 //fNrawch = new Int_t[kNCH];
ddae0931 304
237c933d 305 fRawClusters = new TObjArray(kNCH);
d28b5fc2 306 //printf("Created fRwClusters with adress:%p",fRawClusters);
2e5f0f7b 307
237c933d 308 for (i=0; i<kNCH ;i++) {
2682e810 309 //PH (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000);
310 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
2e5f0f7b 311 fNrawch[i]=0;
312 }
313
9dda3582 314 //fNrechits = new Int_t[kNCH];
ddae0931 315
237c933d 316 for (i=0; i<kNCH ;i++) {
2682e810 317 //PH (*fRecHits1D)[i] = new TClonesArray("AliRICHRecHit1D",1000);
318 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
a4622d0f 319 }
320 for (i=0; i<kNCH ;i++) {
2682e810 321 //PH (*fRecHits3D)[i] = new TClonesArray("AliRICHRecHit3D",1000);
322 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
2e5f0f7b 323 }
d28b5fc2 324 //printf("Created fRecHits with adress:%p",fRecHits);
2e5f0f7b 325
326
ddae0931 327 SetMarkerColor(kRed);
9b674b76 328
3cc8edee 329 /*fChambers = new TObjArray(kNCH);
9b674b76 330 for (i=0; i<kNCH; i++)
3cc8edee 331 (*fChambers)[i] = new AliRICHChamber();*/
9b674b76 332
333 fFileName = 0;
b762c2f6 334 fMerger = 0;
fe4da5cc 335}
336
237c933d 337AliRICH::AliRICH(const AliRICH& RICH)
338{
15d8311d 339// Copy ctor
237c933d 340}
341
342
fe4da5cc 343AliRICH::~AliRICH()
344{
15d8311d 345// Dtor of RICH manager class
346 if(IsDebugStart()) cout<<ClassName()<<"::default dtor()>\n";
237c933d 347
ddae0931 348 fIshunt = 0;
349 delete fHits;
b251a2b5 350 delete fSDigits;
ddae0931 351 delete fCerenkovs;
ee2105a4 352
353 //PH Delete TObjArrays
354 if (fChambers) {
355 fChambers->Delete();
356 delete fChambers;
357 }
358 if (fDchambers) {
359 fDchambers->Delete();
360 delete fDchambers;
361 }
362 if (fRawClusters) {
363 fRawClusters->Delete();
364 delete fRawClusters;
365 }
366 if (fRecHits1D) {
367 fRecHits1D->Delete();
368 delete fRecHits1D;
369 }
370 if (fRecHits3D) {
371 fRecHits3D->Delete();
372 delete fRecHits3D;
373 }
374
fe4da5cc 375}
376
34ead2dd 377
378//_____________________________________________________________________________
379Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
380{
34ead2dd 381// Calls the charge disintegration method of the current chamber and adds
15d8311d 382// the simulated cluster to the root tree
383 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits(...)>\n";
384
385 Int_t clhits[5];
386 Float_t newclust[4][500];
387 Int_t nnew;
34ead2dd 388
389//
390// Integrated pulse height on chamber
391
392 clhits[0]=fNhits+1;
393
2682e810 394 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
34ead2dd 395 Int_t ic=0;
396
397//
398// Add new clusters
399 for (Int_t i=0; i<nnew; i++) {
400 if (Int_t(newclust[0][i]) > 0) {
401 ic++;
402// Cluster Charge
403 clhits[1] = Int_t(newclust[0][i]);
404// Pad: ix
405 clhits[2] = Int_t(newclust[1][i]);
406// Pad: iy
407 clhits[3] = Int_t(newclust[2][i]);
408// Pad: chamber sector
409 clhits[4] = Int_t(newclust[3][i]);
410
411 //printf(" %d %d %d %d %d\n", clhits[0], clhits[1], clhits[2], clhits[3], clhits[4]);
412
413 AddSDigit(clhits);
414 }
415 }
416
15d8311d 417 if (gAlice->TreeS()){
34ead2dd 418 gAlice->TreeS()->Fill();
419 gAlice->TreeS()->Write(0,TObject::kOverwrite);
420 //printf("Filled SDigits...\n");
15d8311d 421 }
34ead2dd 422
15d8311d 423 return nnew;
424}//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
425
34ead2dd 426void AliRICH::Hits2SDigits()
427{
34ead2dd 428// Dummy: sdigits are created during transport.
15d8311d 429// Called from alirun.
430 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits()>\n";
431
34ead2dd 432
433 int nparticles = gAlice->GetNtrack();
434 cout << "Particles (RICH):" <<nparticles<<endl;
435 if (nparticles > 0) printf("SDigits were already generated.\n");
436
437}
438
439//___________________________________________
440void AliRICH::SDigits2Digits(Int_t nev, Int_t flag)
441{
34ead2dd 442// Generate digits.
15d8311d 443// Called from macro. Multiple events, more functionality.
444 if(IsDebugDigit()) cout<<ClassName()<<"::SDigits2Digits()>\n";
34ead2dd 445
fb498b56 446 //AliRICHChamber* iChamber;
34ead2dd 447
fb498b56 448 //printf("Generating tresholds...\n");
34ead2dd 449
fb498b56 450 //for(Int_t i=0;i<7;i++) {
451 //iChamber = &(Chamber(i));
452 //iChamber->GenerateTresholds();
453 //}
34ead2dd 454
fb498b56 455 //int nparticles = gAlice->GetNtrack();
456 //cout << "Particles (RICH):" <<nparticles<<endl;
457 //if (nparticles <= 0) return;
458 //if (!fMerger) {
459 //fMerger = new AliRICHMerger();
460 //}
461
462
463 //fMerger->Init();
464 //fMerger->Digitise(nev,flag);
465
466 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
467 manager->SetInputStream(0,"galice.root");
468 //AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
469 manager->Exec("deb");
470
34ead2dd 471}
472//___________________________________________
473void AliRICH::SDigits2Digits()
474{
6e585aa2 475 SDigits2Digits(0,0);
34ead2dd 476}
477//___________________________________________
478void AliRICH::Digits2Reco()
479{
34ead2dd 480// Generate clusters
15d8311d 481// Called from alirun, single event only.
482 if(IsDebugDigit()||IsDebugReco()) cout<<ClassName()<<"::Digits2Reco()>\n";
483
34ead2dd 484
485 int nparticles = gAlice->GetNtrack();
486 cout << "Particles (RICH):" <<nparticles<<endl;
487 if (nparticles > 0) FindClusters(0,0);
488
489}
490
fe4da5cc 491void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
492{
15d8311d 493// Adds the current hit to the RICH hits list
494 if(IsDebugHit()) cout<<ClassName()<<"::AddHit(...)>\n";
237c933d 495
ddae0931 496 TClonesArray &lhits = *fHits;
2e5f0f7b 497 new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
fe4da5cc 498}
15d8311d 499
ddae0931 500void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
501{
15d8311d 502// Adds a RICH cerenkov hit to the Cerenkov Hits list
503 if(IsDebugHit()) cout<<ClassName()<<"::AddCerenkov()>\n";
237c933d 504
ddae0931 505 TClonesArray &lcerenkovs = *fCerenkovs;
506 new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
fe4da5cc 507}
237c933d 508
15d8311d 509void AliRICH::AddSDigit(Int_t *aSDigit)
510{
511// Adds the current S digit to the RICH list of S digits
512 if(IsDebugDigit()) cout<<ClassName()<<"::AddSDigit()>\n";
237c933d 513
633e9a38 514 TClonesArray &lSDigits = *fSDigits;
15d8311d 515 new(lSDigits[fNSDigits++]) AliRICHSDigit(aSDigit);
33984590 516}
15d8311d 517
518
ddae0931 519void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
520{
15d8311d 521// Add a RICH digit to the list
522 if(IsDebugDigit()) cout<<ClassName()<<"::AddDigit()>\n";
237c933d 523
15d8311d 524 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
525 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
fe4da5cc 526}
527
2e5f0f7b 528void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
fe4da5cc 529{
15d8311d 530// Add a RICH digit to the list
531
532 if(IsDebugStart())
533 cout<<ClassName()<<"::AddRawCluster()>\n";
2e5f0f7b 534
2682e810 535 //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
536 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
2e5f0f7b 537 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
fe4da5cc 538}
539
2e5f0f7b 540//_____________________________________________________________________________
a4622d0f 541void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
542{
543
544 //
545 // Add a RICH reconstructed hit to the list
546 //
547
2682e810 548 //PH TClonesArray &lrec1D = *((TClonesArray*)(*fRecHits1D)[id]);
549 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
a4622d0f 550 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
551}
552
553//_____________________________________________________________________________
fb498b56 554void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
2e5f0f7b 555{
15d8311d 556// Add a RICH reconstructed hit to the list
fe4da5cc 557
2682e810 558 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
fb498b56 559 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
2e5f0f7b 560}
fe4da5cc 561
ddae0931 562//___________________________________________
563void AliRICH::BuildGeometry()
564
fe4da5cc 565{
237c933d 566
567 //
568 // Builds a TNode geometry for event display
569 //
53d98323 570 TNode *node, *subnode, *top;
ddae0931 571
53d98323 572 const int kColorRICH = kRed;
ddae0931 573 //
237c933d 574 top=gAlice->GetGeometry()->GetNode("alice");
53d98323 575
576 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
91975aa2 577 AliRICHSegmentationV0* segmentation;
53d98323 578 AliRICHChamber* iChamber;
a3d71079 579 AliRICHGeometry* geometry;
580
53d98323 581 iChamber = &(pRICH->Chamber(0));
15d8311d 582 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
a3d71079 583 geometry=iChamber->GetGeometryModel();
ddae0931 584
585 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
53d98323 586
c24372d0 587 Float_t padplane_width = segmentation->GetPadPlaneWidth();
588 Float_t padplane_length = segmentation->GetPadPlaneLength();
589
590 //printf("\n\n\n\n\n In BuildGeometry() npx: %d, npy: %d, dpx: %f, dpy:%f\n\n\n\n\n\n",segmentation->Npx(),segmentation->Npy(),segmentation->Dpx(),segmentation->Dpy());
91975aa2 591
c24372d0 592 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
91975aa2 593
c24372d0 594 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", padplane_width/2,padplane_length/2);
595 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", segmentation->GetPadPlaneWidth(), segmentation->GetPadPlaneLength());
596
a3d71079 597 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
598 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
599 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
600 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
601 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
602 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
603 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
604
605 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
606
607 new TRotMatrix("rot993","rot993",90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
608 new TRotMatrix("rot994","rot994",90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
609 new TRotMatrix("rot995","rot995",90., 0. , 90. , 90. , 0. , 0. );
610 new TRotMatrix("rot996","rot996",90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
611 new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
612 new TRotMatrix("rot998","rot998",90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
613 new TRotMatrix("rot999","rot999",90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
614
615 Float_t pos1[3]={0. , offset*cosphi , offset*sinphi};
616 Float_t pos2[3]={offset*sintheta , offset*costheta , 0. };
617 Float_t pos3[3]={0. , offset , 0.};
618 Float_t pos4[3]={-offset*sintheta , offset*costheta , 0.};
619 Float_t pos5[3]={offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
620 Float_t pos6[3]={0. , offset*cosphi , -offset*sinphi};
621 Float_t pos7[3]={ -offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
622
91975aa2 623
237c933d 624 top->cd();
a3d71079 625 //Float_t pos1[3]={0,471.8999,165.2599};
2e5f0f7b 626 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
a3d71079 627 //new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
237c933d 628 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
237c933d 629 node->SetLineColor(kColorRICH);
91975aa2 630 node->cd();
a3d71079 631 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 632 subnode->SetLineColor(kGreen);
633 fNodes->Add(subnode);
a3d71079 634 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 635 subnode->SetLineColor(kGreen);
636 fNodes->Add(subnode);
a3d71079 637 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 638 subnode->SetLineColor(kGreen);
639 fNodes->Add(subnode);
a3d71079 640 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 641 subnode->SetLineColor(kGreen);
642 fNodes->Add(subnode);
a3d71079 643 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 644 subnode->SetLineColor(kGreen);
645 fNodes->Add(subnode);
a3d71079 646 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 647 subnode->SetLineColor(kGreen);
648 fNodes->Add(subnode);
237c933d 649 fNodes->Add(node);
53d98323 650
651
91975aa2 652 top->cd();
a3d71079 653 //Float_t pos2[3]={171,470,0};
2e5f0f7b 654 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
a3d71079 655 //new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
237c933d 656 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
237c933d 657 node->SetLineColor(kColorRICH);
91975aa2 658 node->cd();
a3d71079 659 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 660 subnode->SetLineColor(kGreen);
661 fNodes->Add(subnode);
a3d71079 662 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 663 subnode->SetLineColor(kGreen);
664 fNodes->Add(subnode);
a3d71079 665 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 666 subnode->SetLineColor(kGreen);
667 fNodes->Add(subnode);
a3d71079 668 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 669 subnode->SetLineColor(kGreen);
670 fNodes->Add(subnode);
a3d71079 671 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 672 subnode->SetLineColor(kGreen);
673 fNodes->Add(subnode);
a3d71079 674 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 675 subnode->SetLineColor(kGreen);
676 fNodes->Add(subnode);
237c933d 677 fNodes->Add(node);
53d98323 678
679
237c933d 680 top->cd();
a3d71079 681 //Float_t pos3[3]={0,500,0};
2e5f0f7b 682 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
a3d71079 683 //new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
237c933d 684 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
237c933d 685 node->SetLineColor(kColorRICH);
91975aa2 686 node->cd();
a3d71079 687 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 688 subnode->SetLineColor(kGreen);
689 fNodes->Add(subnode);
a3d71079 690 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 691 subnode->SetLineColor(kGreen);
692 fNodes->Add(subnode);
a3d71079 693 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 694 subnode->SetLineColor(kGreen);
695 fNodes->Add(subnode);
a3d71079 696 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 697 subnode->SetLineColor(kGreen);
698 fNodes->Add(subnode);
a3d71079 699 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 700 subnode->SetLineColor(kGreen);
701 fNodes->Add(subnode);
a3d71079 702 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 703 subnode->SetLineColor(kGreen);
704 fNodes->Add(subnode);
237c933d 705 fNodes->Add(node);
53d98323 706
237c933d 707 top->cd();
a3d71079 708 //Float_t pos4[3]={-171,470,0};
2e5f0f7b 709 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
a3d71079 710 //new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
237c933d 711 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
237c933d 712 node->SetLineColor(kColorRICH);
91975aa2 713 node->cd();
a3d71079 714 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 715 subnode->SetLineColor(kGreen);
716 fNodes->Add(subnode);
a3d71079 717 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 718 subnode->SetLineColor(kGreen);
719 fNodes->Add(subnode);
a3d71079 720 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 721 subnode->SetLineColor(kGreen);
722 fNodes->Add(subnode);
a3d71079 723 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 724 subnode->SetLineColor(kGreen);
725 fNodes->Add(subnode);
a3d71079 726 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 727 subnode->SetLineColor(kGreen);
728 fNodes->Add(subnode);
a3d71079 729 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 730 subnode->SetLineColor(kGreen);
731 fNodes->Add(subnode);
237c933d 732 fNodes->Add(node);
53d98323 733
734
237c933d 735 top->cd();
a3d71079 736 //Float_t pos5[3]={161.3999,443.3999,-165.3};
2e5f0f7b 737 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
a3d71079 738 //new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
237c933d 739 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
237c933d 740 node->SetLineColor(kColorRICH);
91975aa2 741 node->cd();
a3d71079 742 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 743 subnode->SetLineColor(kGreen);
744 fNodes->Add(subnode);
a3d71079 745 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 746 subnode->SetLineColor(kGreen);
747 fNodes->Add(subnode);
a3d71079 748 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 749 subnode->SetLineColor(kGreen);
750 fNodes->Add(subnode);
a3d71079 751 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 752 subnode->SetLineColor(kGreen);
753 fNodes->Add(subnode);
a3d71079 754 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 755 subnode->SetLineColor(kGreen);
756 fNodes->Add(subnode);
a3d71079 757 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 758 subnode->SetLineColor(kGreen);
759 fNodes->Add(subnode);
237c933d 760 fNodes->Add(node);
53d98323 761
762
237c933d 763 top->cd();
a3d71079 764 //Float_t pos6[3]={0., 471.9, -165.3,};
2e5f0f7b 765 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
a3d71079 766 //new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
237c933d 767 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
237c933d 768 node->SetLineColor(kColorRICH);
91975aa2 769 fNodes->Add(node);node->cd();
a3d71079 770 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 771 subnode->SetLineColor(kGreen);
772 fNodes->Add(subnode);
a3d71079 773 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 774 subnode->SetLineColor(kGreen);
775 fNodes->Add(subnode);
a3d71079 776 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 777 subnode->SetLineColor(kGreen);
778 fNodes->Add(subnode);
a3d71079 779 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 780 subnode->SetLineColor(kGreen);
781 fNodes->Add(subnode);
a3d71079 782 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 783 subnode->SetLineColor(kGreen);
784 fNodes->Add(subnode);
a3d71079 785 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 786 subnode->SetLineColor(kGreen);
787 fNodes->Add(subnode);
53d98323 788
789
237c933d 790 top->cd();
a3d71079 791 //Float_t pos7[3]={-161.399,443.3999,-165.3};
2e5f0f7b 792 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
a3d71079 793 //new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
237c933d 794 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
795 node->SetLineColor(kColorRICH);
91975aa2 796 node->cd();
a3d71079 797 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 798 subnode->SetLineColor(kGreen);
799 fNodes->Add(subnode);
a3d71079 800 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 801 subnode->SetLineColor(kGreen);
802 fNodes->Add(subnode);
a3d71079 803 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
91975aa2 804 subnode->SetLineColor(kGreen);
805 fNodes->Add(subnode);
a3d71079 806 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 807 subnode->SetLineColor(kGreen);
808 fNodes->Add(subnode);
a3d71079 809 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 810 subnode->SetLineColor(kGreen);
811 fNodes->Add(subnode);
a3d71079 812 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
91975aa2 813 subnode->SetLineColor(kGreen);
814 fNodes->Add(subnode);
237c933d 815 fNodes->Add(node);
ddae0931 816
fe4da5cc 817}
818
452a64c6 819//___________________________________________
820void AliRICH::CreateGeometry()
821{
822 //
823 // Create the geometry for RICH version 1
824 //
825 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
826 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
827 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
828 //
829 //Begin_Html
830 /*
831 <img src="picts/AliRICHv1.gif">
832 */
833 //End_Html
834 //Begin_Html
835 /*
836 <img src="picts/AliRICHv1Tree.gif">
837 */
838 //End_Html
839
840 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
c24372d0 841 AliRICHSegmentationV0* segmentation;
452a64c6 842 AliRICHGeometry* geometry;
843 AliRICHChamber* iChamber;
844
845 iChamber = &(pRICH->Chamber(0));
15d8311d 846 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
452a64c6 847 geometry=iChamber->GetGeometryModel();
848
849 Float_t distance;
850 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
851 geometry->SetRadiatorToPads(distance);
852
3587e146 853 //Opaque quartz thickness
e293afae 854 Float_t oqua_thickness = .5;
683b273b 855 //CsI dimensions
856
53d98323 857 //Float_t csi_length = 160*.8 + 2.6;
858 //Float_t csi_width = 144*.84 + 2*2.6;
859
ca96c9ea 860 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
861 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
c24372d0 862
863 //printf("\n\n\n\n\n In CreateGeometry() npx: %d, npy: %d, dpx: %f, dpy:%f deadzone: %f \n\n\n\n\n\n",segmentation->Npx(),segmentation->Npy(),segmentation->Dpx(),segmentation->Dpy(),segmentation->DeadZone());
53d98323 864
865 Int_t *idtmed = fIdtmed->GetArray()-999;
452a64c6 866
867 Int_t i;
868 Float_t zs;
869 Int_t idrotm[1099];
870 Float_t par[3];
871
872 // --- Define the RICH detector
873 // External aluminium box
e293afae 874 par[0] = 68.8;
6197ac87 875 par[1] = 13; //Original Settings
e293afae 876 par[2] = 70.86;
452a64c6 877 /*par[0] = 73.15;
878 par[1] = 11.5;
879 par[2] = 71.1;*/
880 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
881
683b273b 882 // Air
883 par[0] = 66.3;
6197ac87 884 par[1] = 13; //Original Settings
683b273b 885 par[2] = 68.35;
452a64c6 886 /*par[0] = 66.55;
887 par[1] = 11.5;
888 par[2] = 64.8;*/
889 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
890
6197ac87 891 // Air 2 (cutting the lower part of the box)
892
893 par[0] = 1.25;
894 par[1] = 3; //Original Settings
895 par[2] = 70.86;
896 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
897
898 // Air 3 (cutting the lower part of the box)
899
900 par[0] = 66.3;
901 par[1] = 3; //Original Settings
902 par[2] = 1.2505;
903 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
904
452a64c6 905 // Honeycomb
e293afae 906 par[0] = 66.3;
452a64c6 907 par[1] = .188; //Original Settings
e293afae 908 par[2] = 68.35;
452a64c6 909 /*par[0] = 66.55;
910 par[1] = .188;
911 par[2] = 63.1;*/
912 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
913
914 // Aluminium sheet
e293afae 915 par[0] = 66.3;
452a64c6 916 par[1] = .025; //Original Settings
e293afae 917 par[2] = 68.35;
452a64c6 918 /*par[0] = 66.5;
919 par[1] = .025;
920 par[2] = 63.1;*/
921 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
922
923 // Quartz
924 par[0] = geometry->GetQuartzWidth()/2;
925 par[1] = geometry->GetQuartzThickness()/2;
926 par[2] = geometry->GetQuartzLength()/2;
927 /*par[0] = 63.1;
928 par[1] = .25; //Original Settings
929 par[2] = 65.5;*/
930 /*par[0] = geometry->GetQuartzWidth()/2;
931 par[1] = geometry->GetQuartzThickness()/2;
932 par[2] = geometry->GetQuartzLength()/2;*/
933 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f %f %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[0],par[1],par[2]);
934 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
935
936 // Spacers (cylinders)
937 par[0] = 0.;
938 par[1] = .5;
939 par[2] = geometry->GetFreonThickness()/2;
940 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
941
683b273b 942 // Feet (freon slabs supports)
943
944 par[0] = .7;
945 par[1] = .3;
946 par[2] = 1.9;
947 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
948
452a64c6 949 // Opaque quartz
e293afae 950 par[0] = geometry->GetQuartzWidth()/2;
951 par[1] = .2;
952 par[2] = geometry->GetQuartzLength()/2;
953 /*par[0] = 61.95;
452a64c6 954 par[1] = .2; //Original Settings
e293afae 955 par[2] = 66.5;*/
452a64c6 956 /*par[0] = 66.5;
957 par[1] = .2;
958 par[2] = 61.95;*/
959 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
960
961 // Frame of opaque quartz
53a60579 962 par[0] = geometry->GetOuterFreonWidth()/2;
963 //+ oqua_thickness;
452a64c6 964 par[1] = geometry->GetFreonThickness()/2;
53a60579 965 par[2] = geometry->GetOuterFreonLength()/2;
966 //+ oqua_thickness;
452a64c6 967 /*par[0] = 20.65;
968 par[1] = .5; //Original Settings
969 par[2] = 66.5;*/
970 /*par[0] = 66.5;
971 par[1] = .5;
972 par[2] = 20.65;*/
973 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
974
e293afae 975 par[0] = geometry->GetInnerFreonWidth()/2;
452a64c6 976 par[1] = geometry->GetFreonThickness()/2;
e293afae 977 par[2] = geometry->GetInnerFreonLength()/2;
452a64c6 978 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
979
980 // Little bar of opaque quartz
e293afae 981 //par[0] = .275;
982 //par[1] = geometry->GetQuartzThickness()/2;
53a60579 983 //par[2] = geometry->GetInnerFreonLength()/2 - 2.4;
e293afae 984 //par[2] = geometry->GetInnerFreonLength()/2;
53a60579 985 //+ oqua_thickness;
452a64c6 986 /*par[0] = .275;
987 par[1] = .25; //Original Settings
988 par[2] = 63.1;*/
989 /*par[0] = 63.1;
990 par[1] = .25;
991 par[2] = .275;*/
e293afae 992 //gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
452a64c6 993
994 // Freon
e293afae 995 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
452a64c6 996 par[1] = geometry->GetFreonThickness()/2;
e293afae 997 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
452a64c6 998 /*par[0] = 20.15;
999 par[1] = .5; //Original Settings
1000 par[2] = 65.5;*/
1001 /*par[0] = 65.5;
1002 par[1] = .5;
1003 par[2] = 20.15;*/
1004 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
1005
e293afae 1006 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
452a64c6 1007 par[1] = geometry->GetFreonThickness()/2;
e293afae 1008 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
452a64c6 1009 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
1010
1011 // Methane
e293afae 1012 //par[0] = 64.8;
683b273b 1013 par[0] = csi_width/2;
452a64c6 1014 par[1] = geometry->GetGapThickness()/2;
1015 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]);
e293afae 1016 //par[2] = 64.8;
683b273b 1017 par[2] = csi_length/2;
452a64c6 1018 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1019
1020 // Methane gap
e293afae 1021 //par[0] = 64.8;
683b273b 1022 par[0] = csi_width/2;
452a64c6 1023 par[1] = geometry->GetProximityGapThickness()/2;
1024 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]);
e293afae 1025 //par[2] = 64.8;
683b273b 1026 par[2] = csi_length/2;
452a64c6 1027 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1028
1029 // CsI photocathode
e293afae 1030 //par[0] = 64.8;
683b273b 1031 par[0] = csi_width/2;
452a64c6 1032 par[1] = .25;
e293afae 1033 //par[2] = 64.8;
683b273b 1034 par[2] = csi_length/2;
452a64c6 1035 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1036
1037 // Anode grid
1038 par[0] = 0.;
1039 par[1] = .001;
1040 par[2] = 20.;
1041 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
683b273b 1042
6197ac87 1043 // Wire supports
1044 // Bar of metal
1045
1046 par[0] = csi_width/2;
1047 par[1] = 1.05;
1048 par[2] = 1.05;
1049 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1050
1051 // Ceramic pick up (base)
1052
1053 par[0] = csi_width/2;
1054 par[1] = .25;
1055 par[2] = 1.05;
1056 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1057
1058 // Ceramic pick up (head)
1059
1060 par[0] = csi_width/2;
1061 par[1] = .1;
1062 par[2] = .1;
1063 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1064
683b273b 1065 // Aluminium supports for methane and CsI
1066 // Short bar
1067
1068 par[0] = csi_width/2;
1069 par[1] = geometry->GetGapThickness()/2 + .25;
1070 par[2] = (68.35 - csi_length/2)/2;
1071 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
452a64c6 1072
683b273b 1073 // Long bar
1074
1075 par[0] = (66.3 - csi_width/2)/2;
1076 par[1] = geometry->GetGapThickness()/2 + .25;
1077 par[2] = csi_length/2 + 68.35 - csi_length/2;
1078 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1079
1080 // Aluminium supports for freon
1081 // Short bar
1082
1083 par[0] = geometry->GetQuartzWidth()/2;
1084 par[1] = .3;
1085 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
1086 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1087
1088 // Long bar
1089
1090 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
1091 par[1] = .3;
1092 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
1093 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1094
6197ac87 1095 // PCB backplane
683b273b 1096
6197ac87 1097 par[0] = csi_width/2;
1098 par[1] = .25;
1099 par[2] = csi_length/4 -.5025;
1100 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
683b273b 1101
6197ac87 1102
1103 // Backplane supports
1104
1105 // Aluminium slab
1106
1107 par[0] = 33.15;
1108 par[1] = 2;
1109 par[2] = 21.65;
1110 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1111
1112 // Big hole
1113
1114 par[0] = 9.05;
1115 par[1] = 2;
1116 par[2] = 4.4625;
1117 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1118
1119 // Small hole
1120
1121 par[0] = 5.7;
1122 par[1] = 2;
1123 par[2] = 4.4625;
1124 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1125
1126 // Place holes inside backplane support
1127
1128 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1129 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1130 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1131 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1132 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1133 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1134 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1135 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1136 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1137 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1138 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1139 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1140 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1141 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1142 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1143 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1144
1145
1146
452a64c6 1147 // --- Places the detectors defined with GSVOLU
1148 // Place material inside RICH
6197ac87 1149 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
4591f067 1150 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
1151 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
1152 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
1153 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
6197ac87 1154
683b273b 1155
1156 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1157 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1158 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1159 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1160 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1161 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1162 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1163 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1164 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1165 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1166 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
452a64c6 1167 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
1168
683b273b 1169 // Supports placing
1170
1171 // Methane supports
1172 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1173 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1174 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1175 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1176
1177 //Freon supports
1178
1179 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
1180
1181 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1182 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1183 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1184 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1185
452a64c6 1186 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1187
c24372d0 1188 //Placing of the spacers inside the freon slabs
1189
1190 Int_t nspacers = 30;
452a64c6 1191 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Spacers:%d\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",nspacers);
1192
1193 //printf("Nspacers: %d", nspacers);
1194
c24372d0 1195 for (i = 0; i < nspacers/3; i++) {
1196 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1197 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
452a64c6 1198 }
c24372d0 1199
1200 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1201 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1202 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1203 }
1204
1205 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1206 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1207 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
452a64c6 1208 }
1209
c24372d0 1210 for (i = 0; i < nspacers/3; i++) {
1211 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1212 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
452a64c6 1213 }
c24372d0 1214
1215 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1216 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1217 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
452a64c6 1218 }
1219
c24372d0 1220 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1221 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1222 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1223 }
452a64c6 1224
c24372d0 1225
452a64c6 1226 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1227 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
683b273b 1228 gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2 + 2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
633e9a38 1229// printf("Opaque quartz in SRIC %f\n", 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2);
452a64c6 1230 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
683b273b 1231 gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2) - 2, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
e293afae 1232 //gMC->Gspos("BARR", 1, "QUAR", - geometry->GetInnerFreonWidth()/2 - oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (-21.65)
1233 //gMC->Gspos("BARR", 2, "QUAR", geometry->GetInnerFreonWidth()/2 + oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (21.65)
452a64c6 1234 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
1235 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1236 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1237 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
a3d71079 1238 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
6197ac87 1239
1240 // Wire support placing
1241
1242 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1243 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1244 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1245
1246 // Backplane placing
1247
1248 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1249 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1250 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1251 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1252 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1253 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1254
1255 // PCB placing
1256
4591f067 1257 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1258 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
6197ac87 1259
1260
452a64c6 1261
1262 //printf("Position of the gap: %f to %f\n", 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - .2, 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 + .2);
1263
1264 // Place RICH inside ALICE apparatus
c24372d0 1265
a3d71079 1266 /* old values
1267
1268 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1269 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1270 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1271 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1272 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1273 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1274 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1275
1276 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1277 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1278 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1279 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1280 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1281 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1282 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");*/
1283
1284 // The placing of the chambers is measured from the vertex to the base of the methane vessel (490 cm)
1285
1286 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
1287 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
1288 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
1289 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
1290 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
1291 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
1292 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
1293
1294 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
1295
1296 AliMatrix(idrotm[1000], 90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
1297 AliMatrix(idrotm[1001], 90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
1298 AliMatrix(idrotm[1002], 90., 0. , 90. , 90. , 0. , 0. );
1299 AliMatrix(idrotm[1003], 90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
1300 AliMatrix(idrotm[1004], 90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
1301 AliMatrix(idrotm[1005], 90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
1302 AliMatrix(idrotm[1006], 90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
1303
1304 gMC->Gspos("RICH", 1, "ALIC", 0. , offset*cosphi , offset*sinphi ,idrotm[1000], "ONLY");
1305 gMC->Gspos("RICH", 2, "ALIC", (offset)*sintheta , offset*costheta , 0. ,idrotm[1001], "ONLY");
1306 gMC->Gspos("RICH", 3, "ALIC", 0. , offset , 0. ,idrotm[1002], "ONLY");
1307 gMC->Gspos("RICH", 4, "ALIC", -(offset)*sintheta, offset*costheta , 0. ,idrotm[1003], "ONLY");
1308 gMC->Gspos("RICH", 5, "ALIC", (offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1004], "ONLY");
1309 gMC->Gspos("RICH", 6, "ALIC", 0. , offset*cosphi , -offset*sinphi,idrotm[1005], "ONLY");
1310 gMC->Gspos("RICH", 7, "ALIC", -(offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1006], "ONLY");
452a64c6 1311
1312}
1313
1314
1315//___________________________________________
1316void AliRICH::CreateMaterials()
1317{
1318 //
1319 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1320 // ORIGIN : NICK VAN EIJNDHOVEN
1321 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1322 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1323 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1324 //
1325 Int_t isxfld = gAlice->Field()->Integ();
1326 Float_t sxmgmx = gAlice->Field()->Max();
1327 Int_t i;
1328
1329 /************************************Antonnelo's Values (14-vectors)*****************************************/
1330 /*
1331 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,
1332 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1333 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
1334 1.538243,1.544223,1.550568,1.55777,
1335 1.565463,1.574765,1.584831,1.597027,
1336 1.611858,1.6277,1.6472,1.6724 };
1337 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1338 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1339 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1340 Float_t abscoFreon[14] = { 179.0987,179.0987,
1341 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
1342 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1343 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
1344 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
1345 14.177,9.282,4.0925,1.149,.3627,.10857 };
1346 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1347 1e-5,1e-5,1e-5,1e-5,1e-5 };
1348 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1349 1e-4,1e-4,1e-4,1e-4 };
1350 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1351 1e6,1e6,1e6 };
1352 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1353 1e-4,1e-4,1e-4,1e-4 };
1354 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1355 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
1356 .17425,.1785,.1836,.1904,.1938,.221 };
1357 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1358 */
1359
1360
1361 /**********************************End of Antonnelo's Values**********************************/
1362
1363 /**********************************Values from rich_media.f (31-vectors)**********************************/
1364
1365
1366 //Photons energy intervals
1367 Float_t ppckov[26];
1368 for (i=0;i<26;i++)
1369 {
1370 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
1371 //printf ("Energy intervals: %e\n",ppckov[i]);
1372 }
1373
1374
1375 //Refraction index for quarz
1376 Float_t rIndexQuarz[26];
1377 Float_t e1= 10.666;
1378 Float_t e2= 18.125;
1379 Float_t f1= 46.411;
1380 Float_t f2= 228.71;
1381 for (i=0;i<26;i++)
1382 {
1383 Float_t ene=ppckov[i]*1e9;
1384 Float_t a=f1/(e1*e1 - ene*ene);
1385 Float_t b=f2/(e2*e2 - ene*ene);
1386 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
1387 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
1388 }
1389
1390 //Refraction index for opaque quarz, methane and grid
1391 Float_t rIndexOpaqueQuarz[26];
1392 Float_t rIndexMethane[26];
1393 Float_t rIndexGrid[26];
1394 for (i=0;i<26;i++)
1395 {
1396 rIndexOpaqueQuarz[i]=1;
1397 rIndexMethane[i]=1.000444;
1398 rIndexGrid[i]=1;
1399 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
1400 }
1401
1402 //Absorption index for freon
1403 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
1404 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
1405 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
1406
1407 //Absorption index for quarz
1408 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
1409 .906,.907,.907,.907};
1410 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,
1411 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
1412 Float_t abscoQuarz[31];
1413 for (Int_t i=0;i<31;i++)
1414 {
1415 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
1416 if (Xlam <= 160) abscoQuarz[i] = 0;
1417 if (Xlam > 250) abscoQuarz[i] = 1;
1418 else
1419 {
1420 for (Int_t j=0;j<21;j++)
1421 {
1422 //printf ("Passed\n");
1423 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
1424 {
1425 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
1426 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
1427 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
1428 }
1429 }
1430 }
1431 printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
1432 }*/
1433
1434 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
1435 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
1436 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
1437 .675275, 0., 0., 0.};
1438
1439 for (Int_t i=0;i<31;i++)
1440 {
1441 abscoQuarz[i] = abscoQuarz[i]/10;
1442 }*/
1443
1444 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,
1445 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
1446 .192, .1497, .10857};
1447
1448 //Absorption index for methane
1449 Float_t abscoMethane[26];
1450 for (i=0;i<26;i++)
1451 {
1452 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
1453 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
1454 }
1455
1456 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
1457 Float_t abscoOpaqueQuarz[26];
1458 Float_t abscoCsI[26];
1459 Float_t abscoGrid[26];
1460 Float_t efficAll[26];
1461 Float_t efficGrid[26];
1462 for (i=0;i<26;i++)
1463 {
1464 abscoOpaqueQuarz[i]=1e-5;
1465 abscoCsI[i]=1e-4;
1466 abscoGrid[i]=1e-4;
1467 efficAll[i]=1;
1468 efficGrid[i]=1;
1469 //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
1470 }
1471
1472 //Efficiency for csi
1473
1474 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
1475 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
1476 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
1477 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
1478
1479
1480
1481 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
1482 //UNPOLARIZED PHOTONS
1483
1484 for (i=0;i<26;i++)
1485 {
1486 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
1487 //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
1488 }
1489
1490 /*******************************************End of rich_media.f***************************************/
1491
1492
1493
1494
1495
1496
1497 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1498 zmet[2], zqua[2];
1499 Int_t nlmatfre;
1500 Float_t densquao;
1501 Int_t nlmatmet, nlmatqua;
1502 Float_t wmatquao[2], rIndexFreon[26];
1503 Float_t aquao[2], epsil, stmin, zquao[2];
1504 Int_t nlmatquao;
1505 Float_t radlal, densal, tmaxfd, deemax, stemax;
1506 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1507
1508 Int_t *idtmed = fIdtmed->GetArray()-999;
1509
452a64c6 1510 // --- Photon energy (GeV)
1511 // --- Refraction indexes
1512 for (i = 0; i < 26; ++i) {
1513 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
1514 //rIndexFreon[i] = 1;
1515 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
1516 }
1517
1518 // --- Detection efficiencies (quantum efficiency for CsI)
1519 // --- Define parameters for honeycomb.
1520 // Used carbon of equivalent rad. lenght
1521
1522 ahon = 12.01;
1523 zhon = 6.;
9dda3582 1524 denshon = 0.1;
452a64c6 1525 radlhon = 18.8;
1526
1527 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1528
1529 aqua[0] = 28.09;
1530 aqua[1] = 16.;
1531 zqua[0] = 14.;
1532 zqua[1] = 8.;
1533 densqua = 2.64;
1534 nlmatqua = -2;
1535 wmatqua[0] = 1.;
1536 wmatqua[1] = 2.;
1537
1538 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1539
1540 aquao[0] = 28.09;
1541 aquao[1] = 16.;
1542 zquao[0] = 14.;
1543 zquao[1] = 8.;
1544 densquao = 2.64;
1545 nlmatquao = -2;
1546 wmatquao[0] = 1.;
1547 wmatquao[1] = 2.;
1548
1549 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1550
1551 afre[0] = 12.;
1552 afre[1] = 19.;
1553 zfre[0] = 6.;
1554 zfre[1] = 9.;
1555 densfre = 1.7;
1556 nlmatfre = -2;
1557 wmatfre[0] = 6.;
1558 wmatfre[1] = 14.;
1559
1560 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1561
1562 amet[0] = 12.01;
1563 amet[1] = 1.;
1564 zmet[0] = 6.;
1565 zmet[1] = 1.;
1566 densmet = 7.17e-4;
1567 nlmatmet = -2;
1568 wmatmet[0] = 1.;
1569 wmatmet[1] = 4.;
1570
1571 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1572
1573 agri = 63.54;
1574 zgri = 29.;
1575 densgri = 8.96;
1576 radlgri = 1.43;
1577
1578 // --- Parameters to include in GSMATE related to aluminium sheet
1579
1580 aal = 26.98;
1581 zal = 13.;
1582 densal = 2.7;
1583 radlal = 8.9;
6197ac87 1584
1585 // --- Glass parameters
1586
1587 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1588 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1589 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1590 Float_t dglass=1.74;
1591
452a64c6 1592
1593 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1594 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1595 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1596 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1597 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1598 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1599 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1600 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1601 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1602 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
6197ac87 1603 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
1604 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
452a64c6 1605
1606 tmaxfd = -10.;
1607 stemax = -.1;
1608 deemax = -.2;
1609 epsil = .001;
1610 stmin = -.001;
1611
1612 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1613 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1614 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1615 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1616 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1617 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
1618 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1619 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1620 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
1621 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
6197ac87 1622 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1623 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 1624
1625
5cfcdf54 1626 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1627 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1628 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
1629 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
1630 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1631 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
1632 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1633 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1634 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1635 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1636 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
452a64c6 1637}
1638
1639//___________________________________________
1640
1641Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
1642{
1643
1644 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
1645
1646 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,
1647 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,
1648 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
1649
1650
1651 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
1652 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
1653 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
1654 1.72,1.53};
1655
1656 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
1657 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
1658 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
1659 1.714,1.498};
1660 Float_t xe=ene;
1661 Int_t j=Int_t(xe*10)-49;
1662 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
1663 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
1664
1665 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
1666 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
1667
1668 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
1669 Float_t tanin=sinin/pdoti;
1670
1671 Float_t c1=cn*cn-ck*ck-sinin*sinin;
1672 Float_t c2=4*cn*cn*ck*ck;
1673 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
1674 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
1675
1676 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
1677 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
1678
1679
1680 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
1681 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
1682
1683 Float_t sigraf=18.;
1684 Float_t lamb=1240/ene;
1685 Float_t fresn;
1686
1687 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
1688
1689 if(pola)
1690 {
1691 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
1692 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
1693 }
1694 else
1695 fresn=0.5*(rp+rs);
1696
1697 fresn = fresn*rO;
1698 return(fresn);
1699}
1700
1701//__________________________________________
1702Float_t AliRICH::AbsoCH4(Float_t x)
1703{
1704
1705 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
1706 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
1707 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
1708 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
1709 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
1710 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
1711 Float_t pn=kPressure/760.;
1712 Float_t tn=kTemperature/273.16;
1713
1714
1715// ------- METHANE CROSS SECTION -----------------
1716// ASTROPH. J. 214, L47 (1978)
1717
1718 Float_t sm=0;
1719 if (x<7.75)
1720 sm=.06e-22;
1721
1722 if(x>=7.75 && x<=8.1)
1723 {
1724 Float_t c0=-1.655279e-1;
1725 Float_t c1=6.307392e-2;
1726 Float_t c2=-8.011441e-3;
1727 Float_t c3=3.392126e-4;
1728 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
1729 }
1730
1731 if (x> 8.1)
1732 {
1733 Int_t j=0;
1734 while (x<=em[j] && x>=em[j+1])
1735 {
1736 j++;
1737 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
1738 sm=(sch4[j]+a*(x-em[j]))*1e-22;
1739 }
1740 }
1741
1742 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1743 Float_t abslm=1./sm/dm;
1744
1745// ------- ISOBUTHANE CROSS SECTION --------------
1746// i-C4H10 (ai) abs. length from curves in
1747// Lu-McDonald paper for BARI RICH workshop .
1748// -----------------------------------------------------------
1749
1750 Float_t ai;
1751 Float_t absli;
1752 if (kIgas2 != 0)
1753 {
1754 if (x<7.25)
1755 ai=100000000.;
1756
1757 if(x>=7.25 && x<7.375)
1758 ai=24.3;
1759
1760 if(x>=7.375)
1761 ai=.0000000001;
1762
1763 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
1764 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1765 absli =1./si/di;
1766 }
1767 else
1768 absli=1.e18;
1769// ---------------------------------------------------------
1770//
1771// transmission of O2
1772//
1773// y= path in cm, x=energy in eV
1774// so= cross section for UV absorption in cm2
1775// do= O2 molecular density in cm-3
1776// ---------------------------------------------------------
1777
1778 Float_t abslo;
1779 Float_t so=0;
1780 if(x>=6.0)
1781 {
1782 if(x>=6.0 && x<6.5)
1783 {
1784 so=3.392709e-13 * TMath::Exp(2.864104 *x);
1785 so=so*1e-18;
1786 }
1787
1788 if(x>=6.5 && x<7.0)
1789 {
1790 so=2.910039e-34 * TMath::Exp(10.3337*x);
1791 so=so*1e-18;
1792 }
1793
1794
1795 if (x>=7.0)
1796 {
1797 Float_t a0=-73770.76;
1798 Float_t a1=46190.69;
1799 Float_t a2=-11475.44;
1800 Float_t a3=1412.611;
1801 Float_t a4=-86.07027;
1802 Float_t a5=2.074234;
1803 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
1804 so=so*1e-18;
1805 }
1806
1807 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
1808 abslo=1./so/dox;
1809 }
1810 else
1811 abslo=1.e18;
1812// ---------------------------------------------------------
1813//
1814// transmission of H2O
1815//
1816// y= path in cm, x=energy in eV
1817// sw= cross section for UV absorption in cm2
1818// dw= H2O molecular density in cm-3
1819// ---------------------------------------------------------
1820
1821 Float_t abslw;
1822
1823 Float_t b0=29231.65;
1824 Float_t b1=-15807.74;
1825 Float_t b2=3192.926;
1826 Float_t b3=-285.4809;
1827 Float_t b4=9.533944;
1828
1829 if(x>6.75)
1830 {
1831 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
1832 sw=sw*1e-18;
1833 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
1834 abslw=1./sw/dw;
1835 }
1836 else
1837 abslw=1.e18;
1838
1839// ---------------------------------------------------------
1840
1841 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
1842 return (alength);
1843}
1844
1845
1846
ddae0931 1847//___________________________________________
1848Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
1849{
237c933d 1850
1851// Default value
1852
ddae0931 1853 return 9999;
1854}
fe4da5cc 1855
ddae0931 1856//___________________________________________
9e1a0ddb 1857void AliRICH::MakeBranch(Option_t* option, const char *file)
fe4da5cc 1858{
237c933d 1859 // Create Tree branches for the RICH.
fe4da5cc 1860
237c933d 1861 const Int_t kBufferSize = 4000;
ddae0931 1862 char branchname[20];
2ab0c725 1863
1864 AliDetector::MakeBranch(option,file);
1865
5cf7bbad 1866 const char *cH = strstr(option,"H");
1867 const char *cD = strstr(option,"D");
1868 const char *cR = strstr(option,"R");
34ead2dd 1869 const char *cS = strstr(option,"S");
1870
2ab0c725 1871
1872 if (cH) {
1873 sprintf(branchname,"%sCerenkov",GetName());
1874 if (fCerenkovs && gAlice->TreeH()) {
9e1a0ddb 1875 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1876 MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
c3ecfac9 1877 //branch->SetAutoDelete(kFALSE);
b251a2b5 1878 }
1879 sprintf(branchname,"%sSDigits",GetName());
1880 if (fSDigits && gAlice->TreeH()) {
9e1a0ddb 1881 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1882 MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
c3ecfac9 1883 //branch->SetAutoDelete(kFALSE);
34ead2dd 1884 //printf("Making branch %sSDigits in TreeH\n",GetName());
2ab0c725 1885 }
b251a2b5 1886 }
1887
34ead2dd 1888 if (cS) {
b251a2b5 1889 sprintf(branchname,"%sSDigits",GetName());
1890 if (fSDigits && gAlice->TreeS()) {
9e1a0ddb 1891 //TBranch* branch = MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1892 MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
c3ecfac9 1893 //branch->SetAutoDelete(kFALSE);
34ead2dd 1894 //printf("Making branch %sSDigits in TreeS\n",GetName());
b251a2b5 1895 }
34ead2dd 1896 }
fe4da5cc 1897
2ab0c725 1898 if (cD) {
1899 //
1900 // one branch for digits per chamber
1901 //
1902 Int_t i;
1903
1904 for (i=0; i<kNCH ;i++) {
633e9a38 1905 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1906 if (fDchambers && gAlice->TreeD()) {
9e1a0ddb 1907 //TBranch* branch = MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1908 MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
c3ecfac9 1909 //branch->SetAutoDelete(kFALSE);
633e9a38 1910 //printf("Making Branch %sDigits%d\n",GetName(),i+1);
1911 }
2ab0c725 1912 }
fe4da5cc 1913 }
2e5f0f7b 1914
2ab0c725 1915 if (cR) {
1916 //
1917 // one branch for raw clusters per chamber
1918 //
34ead2dd 1919
1920 //printf("Called MakeBranch for TreeR\n");
1921
2ab0c725 1922 Int_t i;
1923
1924 for (i=0; i<kNCH ;i++) {
1925 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1926 if (fRawClusters && gAlice->TreeR()) {
9e1a0ddb 1927 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1928 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
c3ecfac9 1929 //branch->SetAutoDelete(kFALSE);
2ab0c725 1930 }
1931 }
1932 //
1933 // one branch for rec hits per chamber
1934 //
1935 for (i=0; i<kNCH ;i++) {
1936 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1937 if (fRecHits1D && gAlice->TreeR()) {
9e1a0ddb 1938 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1939 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
c3ecfac9 1940 //branch->SetAutoDelete(kFALSE);
2ab0c725 1941 }
1942 }
1943 for (i=0; i<kNCH ;i++) {
1944 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1945 if (fRecHits3D && gAlice->TreeR()) {
9e1a0ddb 1946 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, file) ;
c3ecfac9 1947 //branch->SetAutoDelete(kFALSE);
2e5f0f7b 1948 }
2ab0c725 1949 }
1950 }
fe4da5cc 1951}
1952
ddae0931 1953//___________________________________________
1954void AliRICH::SetTreeAddress()
fe4da5cc 1955{
237c933d 1956 // Set branch address for the Hits and Digits Tree.
2e5f0f7b 1957 char branchname[20];
1958 Int_t i;
1959
ddae0931 1960 AliDetector::SetTreeAddress();
1961
1962 TBranch *branch;
1963 TTree *treeH = gAlice->TreeH();
1964 TTree *treeD = gAlice->TreeD();
2e5f0f7b 1965 TTree *treeR = gAlice->TreeR();
34ead2dd 1966 TTree *treeS = gAlice->TreeS();
ddae0931 1967
1968 if (treeH) {
b251a2b5 1969 if (fCerenkovs) {
ddae0931 1970 branch = treeH->GetBranch("RICHCerenkov");
1971 if (branch) branch->SetAddress(&fCerenkovs);
fe4da5cc 1972 }
633e9a38 1973 if (fSDigits) {
b251a2b5 1974 branch = treeH->GetBranch("RICHSDigits");
34ead2dd 1975 if (branch)
1976 {
1977 branch->SetAddress(&fSDigits);
1978 //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits);
1979 }
b251a2b5 1980 }
ddae0931 1981 }
1982
34ead2dd 1983 if (treeS) {
b251a2b5 1984 if (fSDigits) {
1985 branch = treeS->GetBranch("RICHSDigits");
34ead2dd 1986 if (branch)
1987 {
1988 branch->SetAddress(&fSDigits);
1989 //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits);
1990 }
b251a2b5 1991 }
34ead2dd 1992 }
b251a2b5 1993
1994
ddae0931 1995 if (treeD) {
237c933d 1996 for (int i=0; i<kNCH; i++) {
ddae0931 1997 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1998 if (fDchambers) {
34ead2dd 1999 branch = treeD->GetBranch(branchname);
2000 if (branch) branch->SetAddress(&((*fDchambers)[i]));
ddae0931 2001 }
fe4da5cc 2002 }
fe4da5cc 2003 }
2e5f0f7b 2004 if (treeR) {
237c933d 2005 for (i=0; i<kNCH; i++) {
2e5f0f7b 2006 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
2007 if (fRawClusters) {
2008 branch = treeR->GetBranch(branchname);
2009 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
2010 }
2011 }
2012
237c933d 2013 for (i=0; i<kNCH; i++) {
a4622d0f 2014 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
2015 if (fRecHits1D) {
2e5f0f7b 2016 branch = treeR->GetBranch(branchname);
a4622d0f 2017 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
2e5f0f7b 2018 }
2019 }
2020
a4622d0f 2021 for (i=0; i<kNCH; i++) {
2022 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
2023 if (fRecHits3D) {
2024 branch = treeR->GetBranch(branchname);
2025 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
2026 }
2027 }
2028
2e5f0f7b 2029 }
ddae0931 2030}
2031//___________________________________________
2032void AliRICH::ResetHits()
2033{
237c933d 2034 // Reset number of clusters and the cluster array for this detector
ddae0931 2035 AliDetector::ResetHits();
b251a2b5 2036 fNSDigits = 0;
2e5f0f7b 2037 fNcerenkovs = 0;
b251a2b5 2038 if (fSDigits) fSDigits->Clear();
ddae0931 2039 if (fCerenkovs) fCerenkovs->Clear();
fe4da5cc 2040}
2041
2e5f0f7b 2042
ddae0931 2043//____________________________________________
2044void AliRICH::ResetDigits()
2045{
237c933d 2046 //
2047 // Reset number of digits and the digits array for this detector
2048 //
2049 for ( int i=0;i<kNCH;i++ ) {
2682e810 2050 //PH if (fDchambers && (*fDchambers)[i]) (*fDchambers)[i]->Clear();
2051 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
ddae0931 2052 if (fNdch) fNdch[i]=0;
2053 }
2054}
2e5f0f7b 2055
ddae0931 2056//____________________________________________
2e5f0f7b 2057void AliRICH::ResetRawClusters()
fe4da5cc 2058{
237c933d 2059 //
2060 // Reset number of raw clusters and the raw clust array for this detector
2061 //
2062 for ( int i=0;i<kNCH;i++ ) {
2682e810 2063 //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
2064 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
2e5f0f7b 2065 if (fNrawch) fNrawch[i]=0;
fe4da5cc 2066 }
ddae0931 2067}
fe4da5cc 2068
2e5f0f7b 2069//____________________________________________
a4622d0f 2070void AliRICH::ResetRecHits1D()
fe4da5cc 2071{
237c933d 2072 //
2073 // Reset number of raw clusters and the raw clust array for this detector
2074 //
2e5f0f7b 2075
237c933d 2076 for ( int i=0;i<kNCH;i++ ) {
2682e810 2077 //PH if ((*fRecHits1D)[i]) ((TClonesArray*)(*fRecHits1D)[i])->Clear();
2078 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
a4622d0f 2079 if (fNrechits1D) fNrechits1D[i]=0;
2080 }
2081}
2082
2083//____________________________________________
2084void AliRICH::ResetRecHits3D()
2085{
2086 //
2087 // Reset number of raw clusters and the raw clust array for this detector
2088 //
2089
2090 for ( int i=0;i<kNCH;i++ ) {
2682e810 2091 //PH if ((*fRecHits3D)[i]) ((TClonesArray*)(*fRecHits3D)[i])->Clear();
2092 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
a4622d0f 2093 if (fNrechits3D) fNrechits3D[i]=0;
2e5f0f7b 2094 }
fe4da5cc 2095}
2096
fe4da5cc 2097
ddae0931 2098//___________________________________________
ddae0931 2099void AliRICH::StepManager()
fe4da5cc 2100{
452a64c6 2101// Full Step Manager
2102
2103 Int_t copy, id;
2104 static Int_t idvol;
2105 static Int_t vol[2];
2106 Int_t ipart;
c24372d0 2107 static Float_t hits[22];
452a64c6 2108 static Float_t ckovData[19];
2109 TLorentzVector position;
2110 TLorentzVector momentum;
2111 Float_t pos[3];
2112 Float_t mom[4];
2113 Float_t localPos[3];
2114 Float_t localMom[4];
2115 Float_t localTheta,localPhi;
2116 Float_t theta,phi;
2117 Float_t destep, step;
fb498b56 2118 Double_t ranf[2];
452a64c6 2119 Int_t nPads;
2120 Float_t coscerenkov;
2121 static Float_t eloss, xhit, yhit, tlength;
2122 const Float_t kBig=1.e10;
2123
2124 TClonesArray &lhits = *fHits;
452a64c6 2125 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
237c933d 2126
452a64c6 2127 //if (current->Energy()>1)
2128 //{
2129
2130 // Only gas gap inside chamber
2131 // Tag chambers and record hits when track enters
2132
53f52132 2133
452a64c6 2134 id=gMC->CurrentVolID(copy);
53f52132 2135 idvol = copy-1;
452a64c6 2136 Float_t cherenkovLoss=0;
2137 //gAlice->KeepTrack(gAlice->CurrentTrack());
2138
2139 gMC->TrackPosition(position);
2140 pos[0]=position(0);
2141 pos[1]=position(1);
2142 pos[2]=position(2);
8cda28a5 2143 //bzero((char *)ckovData,sizeof(ckovData)*19);
452a64c6 2144 ckovData[1] = pos[0]; // X-position for hit
2145 ckovData[2] = pos[1]; // Y-position for hit
2146 ckovData[3] = pos[2]; // Z-position for hit
3cc8edee 2147 ckovData[6] = 0; // dummy track length
452a64c6 2148 //ckovData[11] = gAlice->CurrentTrack();
8cda28a5 2149
2150 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
452a64c6 2151
2152 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
2153
2154 /********************Store production parameters for Cerenkov photons************************/
2155//is it a Cerenkov photon?
8cda28a5 2156 if (gMC->TrackPid() == 50000050) {
452a64c6 2157
2158 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
2159 //{
2160 Float_t ckovEnergy = current->Energy();
2161 //energy interval for tracking
2162 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
2163 //if (ckovEnergy > 0)
2164 {
8cda28a5 2165 if (gMC->IsTrackEntering()){ //is track entering?
2166 //printf("Track entered (1)\n");
452a64c6 2167 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2168 { //is it in freo?
5cfcdf54 2169 if (gMC->IsNewTrack()){ //is it the first step?
8cda28a5 2170 //printf("I'm in!\n");
452a64c6 2171 Int_t mother = current->GetFirstMother();
2172
2173 //printf("Second Mother:%d\n",current->GetSecondMother());
2174
2175 ckovData[10] = mother;
2176 ckovData[11] = gAlice->CurrentTrack();
2177 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
8cda28a5 2178 //printf("Produced in FREO\n");
452a64c6 2179 fCkovNumber++;
2180 fFreonProd=1;
2181 //printf("Index: %d\n",fCkovNumber);
2182 } //first step question
2183 } //freo question
2184
5cfcdf54 2185 if (gMC->IsNewTrack()){ //is it first step?
452a64c6 2186 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
2187 {
2188 ckovData[12] = 2;
8cda28a5 2189 //printf("Produced in QUAR\n");
452a64c6 2190 } //quarz question
2191 } //first step question
2192
2193 //printf("Before %d\n",fFreonProd);
2194 } //track entering question
2195
2196 if (ckovData[12] == 1) //was it produced in Freon?
2197 //if (fFreonProd == 1)
2198 {
2199 if (gMC->IsTrackEntering()){ //is track entering?
8cda28a5 2200 //printf("Track entered (2)\n");
2201 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
2202 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
452a64c6 2203 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
2204 {
8cda28a5 2205 //printf("Got in META\n");
452a64c6 2206 gMC->TrackMomentum(momentum);
2207 mom[0]=momentum(0);
2208 mom[1]=momentum(1);
2209 mom[2]=momentum(2);
2210 mom[3]=momentum(3);
452a64c6 2211
8fb37ffa 2212 gMC->Gmtod(mom,localMom,2);
53f52132 2213 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
452a64c6 2214 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
8fb37ffa 2215 /**************** Photons lost in second grid have to be calculated by hand************/
b9d0a01d 2216 gMC->GetRandom()->RndmArray(1,ranf);
452a64c6 2217 if (ranf[0] > t) {
5cfcdf54 2218 gMC->StopTrack();
452a64c6 2219 ckovData[13] = 5;
2220 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
8cda28a5 2221 //printf("Added One (1)!\n");
452a64c6 2222 //printf("Lost one in grid\n");
2223 }
2224 /**********************************************************************************/
2225 } //gap
2226
8cda28a5 2227 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
2228 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
452a64c6 2229 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
2230 {
8cda28a5 2231 //printf("Got in CSI\n");
452a64c6 2232 gMC->TrackMomentum(momentum);
2233 mom[0]=momentum(0);
2234 mom[1]=momentum(1);
2235 mom[2]=momentum(2);
2236 mom[3]=momentum(3);
8fb37ffa 2237
2238 gMC->Gmtod(mom,localMom,2);
452a64c6 2239 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
2240 /***********************Cerenkov phtons (always polarised)*************************/
8fb37ffa 2241 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2242 Double_t localRt = TMath::Sqrt(localTc);
2243 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
2244 Double_t cotheta = TMath::Abs(cos(localTheta));
2245 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
2246 gMC->GetRandom()->RndmArray(1,ranf);
2247 if (ranf[0] < t) {
2248 gMC->StopTrack();
2249 ckovData[13] = 6;
2250 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2251
2252 //printf("Added One (2)!\n");
2253 //printf("Lost by Fresnel\n");
2254 }
2255 /**********************************************************************************/
452a64c6 2256 }
2257 } //track entering?
2258
2259
2260 /********************Evaluation of losses************************/
2261 /******************still in the old fashion**********************/
2262
5cfcdf54 2263 TArrayI procs;
2264 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
452a64c6 2265 for (Int_t i = 0; i < i1; ++i) {
2266 // Reflection loss
5cfcdf54 2267 if (procs[i] == kPLightReflection) { //was it reflected
452a64c6 2268 ckovData[13]=10;
2269 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2270 ckovData[13]=1;
2271 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2272 ckovData[13]=2;
5cfcdf54 2273 //gMC->StopTrack();
9dda3582 2274 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
452a64c6 2275 } //reflection question
8cda28a5 2276
452a64c6 2277 // Absorption loss
5cfcdf54 2278 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
8cda28a5 2279 //printf("Got in absorption\n");
452a64c6 2280 ckovData[13]=20;
2281 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2282 ckovData[13]=11;
2283 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2284 ckovData[13]=12;
2285 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
2286 ckovData[13]=13;
2287 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
2288 ckovData[13]=13;
2289
2290 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
2291 ckovData[13]=15;
2292
2293 // CsI inefficiency
2294 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
2295 ckovData[13]=16;
2296 }
5cfcdf54 2297 gMC->StopTrack();
452a64c6 2298 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
8cda28a5 2299 //printf("Added One (3)!\n");
452a64c6 2300 //printf("Added cerenkov %d\n",fCkovNumber);
2301 } //absorption question
2302
2303
2304 // Photon goes out of tracking scope
5cfcdf54 2305 else if (procs[i] == kPStop) { //is it below energy treshold?
452a64c6 2306 ckovData[13]=21;
5cfcdf54 2307 gMC->StopTrack();
452a64c6 2308 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
8cda28a5 2309 //printf("Added One (4)!\n");
452a64c6 2310 } // energy treshold question
2311 } //number of mechanisms cycle
2312 /**********************End of evaluation************************/
2313 } //freon production question
2314 } //energy interval question
2315 //}//inside the proximity gap question
2316 } //cerenkov photon question
2317
2318 /**************************************End of Production Parameters Storing*********************/
2319
2320
2321 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
2322
2323 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
2324 //printf("Cerenkov\n");
a3d71079 2325
2326 //if (gMC->TrackPid() == 50000051)
2327 //printf("Tracking a feedback\n");
2328
2329 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
452a64c6 2330 {
8cda28a5 2331 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
2332 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2333 //printf("Got in CSI\n");
a3d71079 2334 //printf("Tracking a %d\n",gMC->TrackPid());
452a64c6 2335 if (gMC->Edep() > 0.){
2336 gMC->TrackPosition(position);
2337 gMC->TrackMomentum(momentum);
2338 pos[0]=position(0);
2339 pos[1]=position(1);
2340 pos[2]=position(2);
2341 mom[0]=momentum(0);
2342 mom[1]=momentum(1);
2343 mom[2]=momentum(2);
2344 mom[3]=momentum(3);
2345 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2346 Double_t rt = TMath::Sqrt(tc);
2347 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2348 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
fb498b56 2349
2350 gMC->CurrentVolOffID(2,copy);
2351 vol[0]=copy;
2352 idvol=vol[0]-1;
2353
2354
8fb37ffa 2355 gMC->Gmtod(pos,localPos,1);
fb498b56 2356
8fb37ffa 2357 //Chamber(idvol).GlobaltoLocal(pos,localPos);
fb498b56 2358
8fb37ffa 2359 gMC->Gmtod(mom,localMom,2);
fb498b56 2360
8fb37ffa 2361 //Chamber(idvol).GlobaltoLocal(mom,localMom);
452a64c6 2362
2363 gMC->CurrentVolOffID(2,copy);
2364 vol[0]=copy;
2365 idvol=vol[0]-1;
2366
2367 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2368 //->Sector(localPos[0], localPos[2]);
2369 //printf("Sector:%d\n",sector);
2370
2371 /*if (gMC->TrackPid() == 50000051){
2372 fFeedbacks++;
2373 printf("Feedbacks:%d\n",fFeedbacks);
2374 }*/
2375
2682e810 2376 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2377 ((AliRICHChamber*)fChambers->At(idvol))
452a64c6 2378 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2379 if(idvol<kNCH) {
2380 ckovData[0] = gMC->TrackPid(); // particle type
2381 ckovData[1] = pos[0]; // X-position for hit
2382 ckovData[2] = pos[1]; // Y-position for hit
2383 ckovData[3] = pos[2]; // Z-position for hit
2384 ckovData[4] = theta; // theta angle of incidence
2385 ckovData[5] = phi; // phi angle of incidence
b251a2b5 2386 ckovData[8] = (Float_t) fNSDigits; // first sdigit
452a64c6 2387 ckovData[9] = -1; // last pad hit
2388 ckovData[13] = 4; // photon was detected
2389 ckovData[14] = mom[0];
2390 ckovData[15] = mom[1];
2391 ckovData[16] = mom[2];
2392
2393 destep = gMC->Edep();
2394 gMC->SetMaxStep(kBig);
2395 cherenkovLoss += destep;
2396 ckovData[7]=cherenkovLoss;
2397
b251a2b5 2398 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
ca96c9ea 2399
b251a2b5 2400 if (fNSDigits > (Int_t)ckovData[8]) {
452a64c6 2401 ckovData[8]= ckovData[8]+1;
b251a2b5 2402 ckovData[9]= (Float_t) fNSDigits;
452a64c6 2403 }
2404
ca96c9ea 2405 //printf("Cerenkov loss: %f\n", cherenkovLoss);
2406
452a64c6 2407 ckovData[17] = nPads;
2408 //printf("nPads:%d",nPads);
2409
2410 //TClonesArray *Hits = RICH->Hits();
2411 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
2412 if (mipHit)
2413 {
2414 mom[0] = current->Px();
2415 mom[1] = current->Py();
2416 mom[2] = current->Pz();
6e585aa2 2417 Float_t mipPx = mipHit->MomX();
2418 Float_t mipPy = mipHit->MomY();
2419 Float_t mipPz = mipHit->MomZ();
452a64c6 2420
2421 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2422 Float_t rt = TMath::Sqrt(r);
2423 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
2424 Float_t mipRt = TMath::Sqrt(mipR);
2425 if ((rt*mipRt) > 0)
2426 {
2427 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
2428 }
2429 else
2430 {
2431 coscerenkov = 0;
2432 }
2433 Float_t cherenkov = TMath::ACos(coscerenkov);
2434 ckovData[18]=cherenkov;
2435 }
2436 //if (sector != -1)
2437 //{
2438 AddHit(gAlice->CurrentTrack(),vol,ckovData);
2439 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
8cda28a5 2440 //printf("Added One (5)!\n");
452a64c6 2441 //}
2442 }
2443 }
2444 }
2445 }
2446
2447 /***********************************************End of photon hits*********************************************/
2448
2449
2450 /**********************************************Charged particles treatment*************************************/
2451
2452 else if (gMC->TrackCharge())
2453 //else if (1 == 1)
2454 {
2455//If MIP
2456 /*if (gMC->IsTrackEntering())
2457 {
2458 hits[13]=20;//is track entering?
2459 }*/
2460 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2461 {
c24372d0 2462 gMC->TrackMomentum(momentum);
2463 mom[0]=momentum(0);
2464 mom[1]=momentum(1);
2465 mom[2]=momentum(2);
2466 mom[3]=momentum(3);
2467 hits [19] = mom[0];
2468 hits [20] = mom[1];
2469 hits [21] = mom[2];
452a64c6 2470 fFreonProd=1;
2471 }
2472
2473 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
2474// Get current particle id (ipart), track position (pos) and momentum (mom)
2475
2476 gMC->CurrentVolOffID(3,copy);
2477 vol[0]=copy;
2478 idvol=vol[0]-1;
2479
2480 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2481 //->Sector(localPos[0], localPos[2]);
2482 //printf("Sector:%d\n",sector);
2483
2484 gMC->TrackPosition(position);
2485 gMC->TrackMomentum(momentum);
2486 pos[0]=position(0);
2487 pos[1]=position(1);
2488 pos[2]=position(2);
2489 mom[0]=momentum(0);
2490 mom[1]=momentum(1);
2491 mom[2]=momentum(2);
2492 mom[3]=momentum(3);
fb498b56 2493
8fb37ffa 2494 gMC->Gmtod(pos,localPos,1);
fb498b56 2495
8fb37ffa 2496 //Chamber(idvol).GlobaltoLocal(pos,localPos);
fb498b56 2497
8fb37ffa 2498 gMC->Gmtod(mom,localMom,2);
fb498b56 2499
8fb37ffa 2500 //Chamber(idvol).GlobaltoLocal(mom,localMom);
452a64c6 2501
2502 ipart = gMC->TrackPid();
2503 //
2504 // momentum loss and steplength in last step
2505 destep = gMC->Edep();
2506 step = gMC->TrackStep();
2507
2508 //
2509 // record hits when track enters ...
2510 if( gMC->IsTrackEntering()) {
2511// gMC->SetMaxStep(fMaxStepGas);
2512 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2513 Double_t rt = TMath::Sqrt(tc);
2514 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2515 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2516
2517
2518 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2519 Double_t localRt = TMath::Sqrt(localTc);
2520 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
2521 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
2522
2523 hits[0] = Float_t(ipart); // particle type
2524 hits[1] = localPos[0]; // X-position for hit
2525 hits[2] = localPos[1]; // Y-position for hit
2526 hits[3] = localPos[2]; // Z-position for hit
2527 hits[4] = localTheta; // theta angle of incidence
2528 hits[5] = localPhi; // phi angle of incidence
b251a2b5 2529 hits[8] = (Float_t) fNSDigits; // first sdigit
452a64c6 2530 hits[9] = -1; // last pad hit
2531 hits[13] = fFreonProd; // did id hit the freon?
2532 hits[14] = mom[0];
2533 hits[15] = mom[1];
2534 hits[16] = mom[2];
c24372d0 2535 hits[18] = 0; // dummy cerenkov angle
452a64c6 2536
2537 tlength = 0;
2538 eloss = 0;
2539 fFreonProd = 0;
2540
2541 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
2542
2543
2544 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
2545 xhit = localPos[0];
2546 yhit = localPos[2];
2547 // Only if not trigger chamber
2548 if(idvol<kNCH) {
2549 //
2550 // Initialize hit position (cursor) in the segmentation model
2682e810 2551 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2552 ((AliRICHChamber*)fChambers->At(idvol))
452a64c6 2553 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2554 }
2555 }
2556
2557 //
2558 // Calculate the charge induced on a pad (disintegration) in case
2559 //
2560 // Mip left chamber ...
2561 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2562 gMC->SetMaxStep(kBig);
2563 eloss += destep;
2564 tlength += step;
2565
2566
2567 // Only if not trigger chamber
2568 if(idvol<kNCH) {
2569 if (eloss > 0)
2570 {
2571 if(gMC->TrackPid() == kNeutron)
2572 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
b251a2b5 2573 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
452a64c6 2574 hits[17] = nPads;
2575 //printf("nPads:%d",nPads);
2576 }
2577 }
2578
2579 hits[6]=tlength;
2580 hits[7]=eloss;
b251a2b5 2581 if (fNSDigits > (Int_t)hits[8]) {
452a64c6 2582 hits[8]= hits[8]+1;
b251a2b5 2583 hits[9]= (Float_t) fNSDigits;
452a64c6 2584 }
2585
2586 //if(sector !=-1)
2587 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
2588 eloss = 0;
2589 //
2590 // Check additional signal generation conditions
2591 // defined by the segmentation
2592 // model (boundary crossing conditions)
2593 } else if
2682e810 2594 //PH (((AliRICHChamber*) (*fChambers)[idvol])
2595 (((AliRICHChamber*)fChambers->At(idvol))
452a64c6 2596 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
2597 {
2682e810 2598 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2599 ((AliRICHChamber*)fChambers->At(idvol))
452a64c6 2600 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2601 if (eloss > 0)
2602 {
2603 if(gMC->TrackPid() == kNeutron)
2604 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
b251a2b5 2605 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
452a64c6 2606 hits[17] = nPads;
2607 //printf("Npads:%d",NPads);
2608 }
2609 xhit = localPos[0];
2610 yhit = localPos[2];
2611 eloss = destep;
2612 tlength += step ;
2613 //
2614 // nothing special happened, add up energy loss
2615 } else {
2616 eloss += destep;
2617 tlength += step ;
2618 }
2619 }
2620 }
2621 /*************************************************End of MIP treatment**************************************/
2622 //}
15d8311d 2623}//void AliRICH::StepManager()
2e5f0f7b 2624
237c933d 2625void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
ddae0931 2626{
2e5f0f7b 2627
ddae0931 2628//
2629// Loop on chambers and on cathode planes
2630//
2e5f0f7b 2631 for (Int_t icat=1;icat<2;icat++) {
2632 gAlice->ResetDigits();
34ead2dd 2633 gAlice->TreeD()->GetEvent(0);
237c933d 2634 for (Int_t ich=0;ich<kNCH;ich++) {
2682e810 2635 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
2636 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
237c933d 2637 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
2638 if (pRICHdigits == 0)
2e5f0f7b 2639 continue;
2640 //
2641 // Get ready the current chamber stuff
2642 //
2643 AliRICHResponse* response = iChamber->GetResponseModel();
a2f7eaf6 2644 AliSegmentation* seg = iChamber->GetSegmentationModel();
2e5f0f7b 2645 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
2646 if (seg) {
2647 rec->SetSegmentation(seg);
2648 rec->SetResponse(response);
237c933d 2649 rec->SetDigits(pRICHdigits);
2e5f0f7b 2650 rec->SetChamber(ich);
2651 if (nev==0) rec->CalibrateCOG();
2652 rec->FindRawClusters();
2653 }
2654 TClonesArray *fRch;
2655 fRch=RawClustAddress(ich);
2656 fRch->Sort();
2657 } // for ich
2658
2659 gAlice->TreeR()->Fill();
2660 TClonesArray *fRch;
237c933d 2661 for (int i=0;i<kNCH;i++) {
2e5f0f7b 2662 fRch=RawClustAddress(i);
2663 int nraw=fRch->GetEntriesFast();
2664 printf ("Chamber %d, raw clusters %d\n",i,nraw);
2665 }
2666
2667 ResetRawClusters();
2668
2669 } // for icat
2670
2671 char hname[30];
2672 sprintf(hname,"TreeR%d",nev);
33984590 2673 gAlice->TreeR()->Write(hname,kOverwrite,0);
2e5f0f7b 2674 gAlice->TreeR()->Reset();
2675
2676 //gObjectTable->Print();
ddae0931 2677}
2678
b251a2b5 2679AliRICHSDigit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters )
ddae0931 2680{
2681//
2682 // Initialise the pad iterator
b251a2b5 2683 // Return the address of the first sdigit for hit
ddae0931 2684 TClonesArray *theClusters = clusters;
2685 Int_t nclust = theClusters->GetEntriesFast();
6e585aa2 2686 if (nclust && hit->PHlast() > 0) {
2687 sMaxIterPad=Int_t(hit->PHlast());
2688 sCurIterPad=Int_t(hit->PHfirst());
b251a2b5 2689 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 2690 } else {
2691 return 0;
fe4da5cc 2692 }
ddae0931 2693
fe4da5cc 2694}
2695
b251a2b5 2696AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
fe4da5cc 2697{
237c933d 2698
2699 // Iterates over pads
2700
ddae0931 2701 sCurIterPad++;
2702 if (sCurIterPad <= sMaxIterPad) {
b251a2b5 2703 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
ddae0931 2704 } else {
2705 return 0;
2706 }
fe4da5cc 2707}
2708
237c933d 2709AliRICH& AliRICH::operator=(const AliRICH& rhs)
2710{
2711// Assignment operator
2712 return *this;
2713
2714}
ddae0931 2715
cc683707 2716void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
a3d71079 2717{
2718
2719 Int_t NpadX = 162; // number of pads on X
2720 Int_t NpadY = 162; // number of pads on Y
2721
2722 Int_t Pad[162][162];
2723 for (Int_t i=0;i<NpadX;i++) {
2724 for (Int_t j=0;j<NpadY;j++) {
2725 Pad[i][j]=0;
2726 }
2727 }
2728
2729 // Create some histograms
2730
2731 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
2732 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
2733 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
2734 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
2735 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
2736 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
2737 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
2738 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
2739 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
2740 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
2741 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
2742 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
2743 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
2744 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
2745 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
2746 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
2747 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2748 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2749 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
2750 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2751 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2752 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
2753 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
2754 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
2755 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
2756 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
2757 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
2758 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
2759 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
2760 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
2761 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
2762 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
2763
2764
2765
2766
2767// Start loop over events
2768
2769 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
2770 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
2771 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
2772 TRandom* random=0;
2773
2774 for (int nev=0; nev<= evNumber2; nev++) {
2775 Int_t nparticles = gAlice->GetEvent(nev);
2776
2777
2778 printf ("Event number : %d\n",nev);
2779 printf ("Number of particles: %d\n",nparticles);
2780 if (nev < evNumber1) continue;
2781 if (nparticles <= 0) return;
2782
2783// Get pointers to RICH detector and Hits containers
2784
2785 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
2786
2787 TTree *treeH = gAlice->TreeH();
2788 Int_t ntracks =(Int_t) treeH->GetEntries();
2789
2790// Start loop on tracks in the hits containers
2791
2792 for (Int_t track=0; track<ntracks;track++) {
2793 printf ("Processing Track: %d\n",track);
2794 gAlice->ResetHits();
2795 treeH->GetEvent(track);
2796
2797 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
2798 mHit;
2799 mHit=(AliRICHHit*)pRICH->NextHit())
2800 {
2801 //Int_t nch = mHit->fChamber; // chamber number
2802 //Float_t x = mHit->X(); // x-pos of hit
2803 //Float_t y = mHit->Z(); // y-pos
2804 //Float_t z = mHit->Y();
6e585aa2 2805 //Float_t phi = mHit->Phi(); //Phi angle of incidence
2806 Float_t theta = mHit->Theta(); //Theta angle of incidence
a3d71079 2807 Float_t px = mHit->MomX();
2808 Float_t py = mHit->MomY();
2809 Int_t index = mHit->Track();
6e585aa2 2810 Int_t particle = (Int_t)(mHit->Particle());
a3d71079 2811 Float_t R;
2812 Float_t PTfinal;
2813 Float_t PTvertex;
2814
2815 TParticle *current = gAlice->Particle(index);
2816
2817 //Float_t energy=current->Energy();
2818
2819 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
2820 PTfinal=TMath::Sqrt(px*px + py*py);
2821 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
2822
2823
2824
2825 if (TMath::Abs(particle) < 10000000)
2826 {
2827 hitsTheta->Fill(theta,(float) 1);
2828 if (R<5)
2829 {
2830 if (PTvertex>.5 && PTvertex<=1)
2831 {
2832 hitsTheta500MeV->Fill(theta,(float) 1);
2833 }
2834 if (PTvertex>1 && PTvertex<=2)
2835 {
2836 hitsTheta1GeV->Fill(theta,(float) 1);
2837 }
2838 if (PTvertex>2 && PTvertex<=3)
2839 {
2840 hitsTheta2GeV->Fill(theta,(float) 1);
2841 }
2842 if (PTvertex>3)
2843 {
2844 hitsTheta3GeV->Fill(theta,(float) 1);
2845 }
2846 }
2847
2848 }
2849
2850 //if (nch == 3)
2851 //{
2852
2853 //printf("Particle type: %d\n",current->GetPdgCode());
2854 if (TMath::Abs(particle) < 50000051)
2855 {
2856 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
2857 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
2858 {
2859 //gMC->Rndm(&random, 1);
2860 if (random->Rndm() < .1)
2861 production->Fill(current->Vz(),R,(float) 1);
2862 if (TMath::Abs(particle) == 50000050)
2863 //if (TMath::Abs(particle) > 50000000)
2864 {
2865 photons +=1;
2866 if (R<5)
2867 {
2868 primaryphotons +=1;
2869 if (current->Energy()>0.001)
2870 highprimaryphotons +=1;
2871 }
2872 }
2873 if (TMath::Abs(particle) == 2112)
2874 {
2875 neutron +=1;
2876 if (current->Energy()>0.0001)
2877 highneutrons +=1;
2878 }
2879 }
2880 if (TMath::Abs(particle) < 50000000)
2881 {
2882 production->Fill(current->Vz(),R,(float) 1);
2883 //printf("Adding %d at %f\n",particle,R);
2884 }
2885 //mip->Fill(x,y,(float) 1);
2886 }
2887
2888 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2889 {
2890 if (R<5)
2891 {
2892 pionptspectravertex->Fill(PTvertex,(float) 1);
2893 pionptspectrafinal->Fill(PTfinal,(float) 1);
2894 }
2895 }
2896
2897 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2898 || TMath::Abs(particle)==311)
2899 {
2900 if (R<5)
2901 {
2902 kaonptspectravertex->Fill(PTvertex,(float) 1);
2903 kaonptspectrafinal->Fill(PTfinal,(float) 1);
2904 }
2905 }
2906
2907
2908 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2909 {
2910 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2911 //printf ("fParticle: %d, PDG code:%d\n",particle,current->GetPdgCode());
2912 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2913 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2914 if (R>250 && R<450)
2915 {
2916 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2917 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\R:%f\n\n\n\n\n\n\n\n\n",R);
2918 }
2919 //printf("Pion mass: %e\n",current->GetCalcMass());
2920 pion +=1;
2921 if (TMath::Abs(particle)==211)
2922 {
2923 chargedpions +=1;
2924 if (R<5)
2925 {
2926 primarypions +=1;
2927 if (current->Energy()>1)
2928 highprimarypions +=1;
2929 }
2930 }
2931 }
2932 if (TMath::Abs(particle)==2212)
2933 {
2934 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2935 //ptspectra->Fill(Pt,(float) 1);
2936 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2937 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2938 if (R>250 && R<450)
2939 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2940 //printf("\n\n\n\n\n\n\nProton mass: %e\n\n\n\n\n\n\n\n\n",current->GetCalcMass());
2941 proton +=1;
2942 }
2943 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2944 || TMath::Abs(particle)==311)
2945 {
2946 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2947 //ptspectra->Fill(Pt,(float) 1);
2948 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2949 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2950 if (R>250 && R<450)
2951 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2952 //printf("Kaon mass: %e\n",current->GetCalcMass());
2953 kaon +=1;
2954 if (TMath::Abs(particle)==321)
2955 {
2956 chargedkaons +=1;
2957 if (R<5)
2958 {
2959 primarykaons +=1;
2960 if (current->Energy()>1)
2961 highprimarykaons +=1;
2962 }
2963 }
2964 }
2965 if (TMath::Abs(particle)==11)
2966 {
2967 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2968 //ptspectra->Fill(Pt,(float) 1);
2969 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2970 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2971 if (R>250 && R<450)
2972 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2973 //printf("Electron mass: %e\n",current->GetCalcMass());
2974 if (particle == 11)
2975 electron +=1;
2976 if (particle == -11)
2977 positron +=1;
2978 }
2979 if (TMath::Abs(particle)==13)
2980 {
2981 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2982 //ptspectra->Fill(Pt,(float) 1);
2983 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2984 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2985 if (R>250 && R<450)
2986 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2987 //printf("Muon mass: %e\n",current->GetCalcMass());
2988 muon +=1;
2989 }
2990 if (TMath::Abs(particle)==2112)
2991 {
2992 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2993 //ptspectra->Fill(Pt,(float) 1);
2994 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2995 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2996 if (R>250 && R<450)
2997 {
2998 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2999 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\R:%f\n\n\n\n\n\n\n\n\n",R);
3000 }
3001 //printf("Neutron mass: %e\n",current->GetCalcMass());
3002 neutron +=1;
3003 }
3004 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3005 {
3006 if (current->Energy()-current->GetCalcMass()>1)
3007 {
3008 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3009 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
3010 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3011 if (R>250 && R<450)
3012 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3013 }
3014 }
3015 //printf("Hits:%d\n",hit);
3016 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3017 // Fill the histograms
3018 //Nh1+=nhits;
3019 //h->Fill(x,y,(float) 1);
3020 //}
3021 //}
3022 }
3023
3024 }
3025
3026 }
3027 // }
fb498b56 3028
3029 TStyle *mystyle=new TStyle("Plain","mystyle");
3030 mystyle->SetPalette(1,0);
3031 mystyle->cd();
a3d71079 3032
3033 //Create canvases, set the view range, show histograms
3034
3035 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
3036 c2->Divide(2,2);
3037 //c2->SetFillColor(42);
3038
3039 c2->cd(1);
3040 hitsTheta500MeV->SetFillColor(5);
3041 hitsTheta500MeV->Draw();
3042 c2->cd(2);
3043 hitsTheta1GeV->SetFillColor(5);
3044 hitsTheta1GeV->Draw();
3045 c2->cd(3);
3046 hitsTheta2GeV->SetFillColor(5);
3047 hitsTheta2GeV->Draw();
3048 c2->cd(4);
3049 hitsTheta3GeV->SetFillColor(5);
3050 hitsTheta3GeV->Draw();
3051
3052
3053
3054 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
3055 c15->cd();
3056 production->SetFillColor(42);
3057 production->SetXTitle("z (m)");
3058 production->SetYTitle("R (m)");
3059 production->Draw();
3060
3061 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
3062 c10->Divide(2,2);
3063 c10->cd(1);
3064 pionptspectravertex->SetFillColor(5);
3065 pionptspectravertex->SetXTitle("Pt (GeV)");
3066 pionptspectravertex->Draw();
3067 c10->cd(2);
3068 pionptspectrafinal->SetFillColor(5);
3069 pionptspectrafinal->SetXTitle("Pt (GeV)");
3070 pionptspectrafinal->Draw();
3071 c10->cd(3);
3072 kaonptspectravertex->SetFillColor(5);
3073 kaonptspectravertex->SetXTitle("Pt (GeV)");
3074 kaonptspectravertex->Draw();
3075 c10->cd(4);
3076 kaonptspectrafinal->SetFillColor(5);
3077 kaonptspectrafinal->SetXTitle("Pt (GeV)");
3078 kaonptspectrafinal->Draw();
3079
3080
3081 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
3082 c16->Divide(2,1);
3083
3084 c16->cd(1);
3085 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
3086 electronspectra1->SetFillColor(5);
3087 electronspectra1->SetXTitle("log(GeV)");
3088 electronspectra2->SetFillColor(46);
3089 electronspectra2->SetXTitle("log(GeV)");
3090 electronspectra3->SetFillColor(10);
3091 electronspectra3->SetXTitle("log(GeV)");
3092 //c13->SetLogx();
3093 electronspectra1->Draw();
3094 electronspectra2->Draw("same");
3095 electronspectra3->Draw("same");
3096
3097 c16->cd(2);
3098 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
3099 muonspectra1->SetFillColor(5);
3100 muonspectra1->SetXTitle("log(GeV)");
3101 muonspectra2->SetFillColor(46);
3102 muonspectra2->SetXTitle("log(GeV)");
3103 muonspectra3->SetFillColor(10);
3104 muonspectra3->SetXTitle("log(GeV)");
3105 //c14->SetLogx();
3106 muonspectra1->Draw();
3107 muonspectra2->Draw("same");
3108 muonspectra3->Draw("same");
3109
3110 //c16->cd(3);
3111 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
3112 //neutronspectra1->SetFillColor(42);
3113 //neutronspectra1->SetXTitle("log(GeV)");
3114 //neutronspectra2->SetFillColor(46);
3115 //neutronspectra2->SetXTitle("log(GeV)");
3116 //neutronspectra3->SetFillColor(10);
3117 //neutronspectra3->SetXTitle("log(GeV)");
3118 //c16->SetLogx();
3119 //neutronspectra1->Draw();
3120 //neutronspectra2->Draw("same");
3121 //neutronspectra3->Draw("same");
3122
3123 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
3124 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
3125 c9->Divide(2,2);
3126
3127 c9->cd(1);
3128 pionspectra1->SetFillColor(5);
3129 pionspectra1->SetXTitle("log(GeV)");
3130 pionspectra2->SetFillColor(46);
3131 pionspectra2->SetXTitle("log(GeV)");
3132 pionspectra3->SetFillColor(10);
3133 pionspectra3->SetXTitle("log(GeV)");
3134 //c9->SetLogx();
3135 pionspectra1->Draw();
3136 pionspectra2->Draw("same");
3137 pionspectra3->Draw("same");
3138
3139 c9->cd(2);
3140 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
3141 protonspectra1->SetFillColor(5);
3142 protonspectra1->SetXTitle("log(GeV)");
3143 protonspectra2->SetFillColor(46);
3144 protonspectra2->SetXTitle("log(GeV)");
3145 protonspectra3->SetFillColor(10);
3146 protonspectra3->SetXTitle("log(GeV)");
3147 //c10->SetLogx();
3148 protonspectra1->Draw();
3149 protonspectra2->Draw("same");
3150 protonspectra3->Draw("same");
3151
3152 c9->cd(3);
3153 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
3154 kaonspectra1->SetFillColor(5);
3155 kaonspectra1->SetXTitle("log(GeV)");
3156 kaonspectra2->SetFillColor(46);
3157 kaonspectra2->SetXTitle("log(GeV)");
3158 kaonspectra3->SetFillColor(10);
3159 kaonspectra3->SetXTitle("log(GeV)");
3160 //c11->SetLogx();
3161 kaonspectra1->Draw();
3162 kaonspectra2->Draw("same");
3163 kaonspectra3->Draw("same");
3164
3165 c9->cd(4);
3166 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
3167 chargedspectra1->SetFillColor(5);
3168 chargedspectra1->SetXTitle("log(GeV)");
3169 chargedspectra2->SetFillColor(46);
3170 chargedspectra2->SetXTitle("log(GeV)");
3171 chargedspectra3->SetFillColor(10);
3172 chargedspectra3->SetXTitle("log(GeV)");
3173 //c12->SetLogx();
3174 chargedspectra1->Draw();
3175 chargedspectra2->Draw("same");
3176 chargedspectra3->Draw("same");
3177
3178
3179
3180 printf("*****************************************\n");
3181 printf("* Particle * Counts *\n");
3182 printf("*****************************************\n");
3183
3184 printf("* Pions: * %4d *\n",pion);
3185 printf("* Charged Pions: * %4d *\n",chargedpions);
3186 printf("* Primary Pions: * %4d *\n",primarypions);
3187 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
3188 printf("* Kaons: * %4d *\n",kaon);
3189 printf("* Charged Kaons: * %4d *\n",chargedkaons);
3190 printf("* Primary Kaons: * %4d *\n",primarykaons);
3191 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
3192 printf("* Muons: * %4d *\n",muon);
3193 printf("* Electrons: * %4d *\n",electron);
3194 printf("* Positrons: * %4d *\n",positron);
3195 printf("* Protons: * %4d *\n",proton);
3196 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
3197 printf("*****************************************\n");
3198 //printf("* Photons: * %3.1f *\n",photons);
3199 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
3200 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
3201 //printf("*****************************************\n");
3202 //printf("* Neutrons: * %3.1f *\n",neutron);
3203 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
3204 //printf("*****************************************\n");
3205
3206 if (gAlice->TreeD())
3207 {
3208 gAlice->TreeD()->GetEvent(0);
3209
3210 Float_t occ[7];
3211 Float_t sum=0;
3212 Float_t mean=0;
3213 printf("\n*****************************************\n");
3214 printf("* Chamber * Digits * Occupancy *\n");
3215 printf("*****************************************\n");
3216
3217 for (Int_t ich=0;ich<7;ich++)
3218 {
3219 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
3220 Int_t ndigits = Digits->GetEntriesFast();
3221 occ[ich] = Float_t(ndigits)/(160*144);
3222 sum += Float_t(ndigits)/(160*144);
3223 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
3224 }
3225 mean = sum/7;
3226 printf("*****************************************\n");
3227 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
3228 printf("*****************************************\n");
3229 }
3230
3231 printf("\nEnd of analysis\n");
3232
3233}
3234
3235//_________________________________________________________________________________________________
3236
3237
cc683707 3238void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
a3d71079 3239{
3240
3241AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
3242 AliRICHSegmentationV0* segmentation;
3243 AliRICHChamber* chamber;
3244
3245 chamber = &(pRICH->Chamber(0));
15d8311d 3246 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
a3d71079 3247
3248 Int_t NpadX = segmentation->Npx(); // number of pads on X
3249 Int_t NpadY = segmentation->Npy(); // number of pads on Y
3250
3251 //Int_t Pad[144][160];
3252 /*for (Int_t i=0;i<NpadX;i++) {
3253 for (Int_t j=0;j<NpadY;j++) {
3254 Pad[i][j]=0;
3255 }
3256 } */
3257
3258
3259 Int_t xmin= -NpadX/2;
3260 Int_t xmax= NpadX/2;
3261 Int_t ymin= -NpadY/2;
3262 Int_t ymax= NpadY/2;
fb498b56 3263
3264 Float_t PTfinal = 0;
3265 Int_t pionCount = 0;
3266 Int_t kaonCount = 0;
3267 Int_t protonCount = 0;
a3d71079 3268
3269 TH2F *feedback = 0;
3270 TH2F *mip = 0;
3271 TH2F *cerenkov = 0;
3272 TH2F *h = 0;
3273 TH1F *hitsX = 0;
3274 TH1F *hitsY = 0;
3275
fb498b56 3276 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
a3d71079 3277
3278 if (diaglevel == 1)
3279 {
3280 printf("Single Ring Hits\n");
fb498b56 3281 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
3282 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
3283 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
3284 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
3285 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
3286 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
a3d71079 3287 }
3288 else
3289 {
3290 printf("Full Event Hits\n");
3291
3292 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
3293 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
3294 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
3295 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
3296 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
3297 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
3298 }
3299
ca96c9ea 3300
ddae0931 3301
a3d71079 3302 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3303 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3304 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3305 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3306 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3307 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3308 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3309
3310 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
fb498b56 3311 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
a3d71079 3312 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
3313 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
3314 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
3315 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
3316 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
3317 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
3318 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
3319 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
3320 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
3321 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
3322 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
3323 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
3324 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
3325 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
3326 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
3327 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
3328 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
3329 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
3330 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
fb498b56 3331 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
3332 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
3333 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
3334 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
3335 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
3336 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
3337 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
a3d71079 3338 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
3339 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
fb498b56 3340 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
3341 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
3342 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
3343 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
3344 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
3345 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
3346 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
3347
a3d71079 3348
3349// Start loop over events
3350
3351 Int_t Nh=0;
3352 Int_t pads=0;
3353 Int_t Nh1=0;
3354 Int_t mothers[80000];
3355 Int_t mothers2[80000];
3356 Float_t mom[3];
3357 Int_t nraw=0;
3358 Int_t phot=0;
3359 Int_t feed=0;
3360 Int_t padmip=0;
3361 Float_t x=0,y=0;
fb498b56 3362
3363 Float_t chiSquareOmega = 0;
3364 Float_t chiSquareTheta = 0;
3365 Float_t chiSquarePhi = 0;
3366
3367 Float_t recEffEvent = 0;
3368 Float_t recEffTotal = 0;
3369
3370 Float_t trackglob[3];
3371 Float_t trackloc[3];
3372
a3d71079 3373
3374 for (Int_t i=0;i<100;i++) mothers[i]=0;
3375
3376 for (int nev=0; nev<= evNumber2; nev++) {
3377 Int_t nparticles = gAlice->GetEvent(nev);
3378
3379
3380 //cout<<"nev "<<nev<<endl;
3381 printf ("\n**********************************\nProcessing Event: %d\n",nev);
3382 //cout<<"nparticles "<<nparticles<<endl;
3383 printf ("Particles : %d\n\n",nparticles);
3384 if (nev < evNumber1) continue;
3385 if (nparticles <= 0) return;
3386
3387// Get pointers to RICH detector and Hits containers
3388
3389
3390 TTree *TH = gAlice->TreeH();
3391 Stat_t ntracks = TH->GetEntries();
3392
3393 // Start loop on tracks in the hits containers
3394 //Int_t Nc=0;
3395 for (Int_t track=0; track<ntracks;track++) {
3396
3397 printf ("\nProcessing Track: %d\n",track);
3398 gAlice->ResetHits();
3399 TH->GetEvent(track);
3400 Int_t nhits = pRICH->Hits()->GetEntriesFast();
3401 if (nhits) Nh+=nhits;
3402 printf("Hits : %d\n",nhits);
3403 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
3404 mHit;
3405 mHit=(AliRICHHit*)pRICH->NextHit())
3406 {
fb498b56 3407 Int_t nch = mHit->Chamber(); // chamber number
3408 trackglob[0] = mHit->X(); // x-pos of hit
3409 trackglob[1] = mHit->Y();
3410 trackglob[2] = mHit->Z(); // y-pos of hit
3411 //x = mHit->X(); // x-pos of hit
3412 //y = mHit->Z(); // y-pos
6e585aa2 3413 Float_t phi = mHit->Phi(); //Phi angle of incidence
3414 Float_t theta = mHit->Theta(); //Theta angle of incidence
a3d71079 3415 Int_t index = mHit->Track();
6e585aa2 3416 Int_t particle = (Int_t)(mHit->Particle());
a3d71079 3417 //Int_t freon = (Int_t)(mHit->fLoss);
fb498b56 3418 Float_t px = mHit->MomX();
3419 Float_t py = mHit->MomY();
3420
3421 if (TMath::Abs(particle) < 10000000)
3422 {
3423 PTfinal=TMath::Sqrt(px*px + py*py);
3424 //printf("PTfinal 0: %f\n",PTfinal);
3425 }
3426
3427 chamber = &(pRICH->Chamber(nch-1));
3428
3429 //printf("Nch:%d\n",nch);
3430
3431 chamber->GlobaltoLocal(trackglob,trackloc);
3432
3433 chamber->LocaltoGlobal(trackloc,trackglob);
3434
3435
3436 x=trackloc[0];
3437 y=trackloc[2];
a3d71079 3438
3439 hitsX->Fill(x,(float) 1);
3440 hitsY->Fill(y,(float) 1);
3441
3442 //printf("Particle:%9d\n",particle);
3443
3444 TParticle *current = (TParticle*)gAlice->Particle(index);
3445 //printf("Particle type: %d\n",sizeoff(Particles));
3446
3447 hitsTheta->Fill(theta,(float) 1);
3448 //hitsPhi->Fill(phi,(float) 1);
3449 //if (pRICH->GetDebugLevel() == -1)
3450 //printf("Theta:%f, Phi:%f\n",theta,phi);
3451
3452 //printf("Debug Level:%d\n",pRICH->GetDebugLevel());
3453
3454 if (current->GetPdgCode() < 10000000)
3455 {
3456 mip->Fill(x,y,(float) 1);
3457 //printf("adding mip\n");
3458 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
3459 //{
3460 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
3461 //hitsTheta->Fill(theta,(float) 1);
3462 //printf("Theta:%f, Phi:%f\n",theta,phi);
3463 //}
3464 }
3465
3466 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
3467 {
3468 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3469 }
3470 if (TMath::Abs(particle)==2212)
3471 {
3472 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3473 }
3474 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
3475 || TMath::Abs(particle)==311)
3476 {
3477 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3478 }
3479 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3480 {
3481 if (current->Energy() - current->GetCalcMass()>1)
3482 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3483 }
3484 //printf("Hits:%d\n",hit);
3485 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3486 // Fill the histograms
3487 Nh1+=nhits;
3488 h->Fill(x,y,(float) 1);
3489 //}
3490 //}
fb498b56 3491 }
a3d71079 3492
3493 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
3494 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
3495 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
3496
3497 if (ncerenkovs) {
3498 printf("Cerenkovs : %d\n",ncerenkovs);
3499 totalphotonsevent->Fill(ncerenkovs,(float) 1);
3500 for (Int_t hit=0;hit<ncerenkovs;hit++) {
3501 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
fb498b56 3502 Int_t nchamber = cHit->fChamber; // chamber number
a3d71079 3503 Int_t index = cHit->Track();
3504 //Int_t pindex = (Int_t)(cHit->fIndex);
fb498b56 3505 trackglob[0] = cHit->X(); // x-pos of hit
3506 trackglob[1] = cHit->Y();
3507 trackglob[2] = cHit->Z(); // y-pos of hit
3508 //Float_t cx = cHit->X(); // x-position
3509 //Float_t cy = cHit->Z(); // y-position
a3d71079 3510 Int_t cmother = cHit->fCMother; // Index of mother particle
3511 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
3512 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
a3d71079 3513
fb498b56 3514 chamber = &(pRICH->Chamber(nchamber-1));
3515
3516 //printf("Nch:%d\n",nch);
3517
3518 chamber->GlobaltoLocal(trackglob,trackloc);
3519
3520 chamber->LocaltoGlobal(trackloc,trackglob);
3521
3522
3523 Float_t cx=trackloc[0];
3524 Float_t cy=trackloc[2];
3525
3526 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
3527
3528
a3d71079 3529 //printf("Particle:%9d\n",index);
3530
3531 TParticle *current = (TParticle*)gAlice->Particle(index);
3532 Float_t energyckov = current->Energy();
3533
3534 if (current->GetPdgCode() == 50000051)
3535 {
3536 if (closs==4)
3537 {
3538 feedback->Fill(cx,cy,(float) 1);
3539 feed++;
3540 }
3541 }
3542 if (current->GetPdgCode() == 50000050)
3543 {
3544
3545 if (closs !=4)
3546 {
3547 phspectra2->Fill(energyckov*1e9,(float) 1);
3548 }
3549
3550 if (closs==4)
3551 {
3552 cerenkov->Fill(cx,cy,(float) 1);
3553
3554 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
3555
3556 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
3557 AliRICHHit* mipHit = (AliRICHHit*) pRICH->Hits()->UncheckedAt(0);
3558 mom[0] = current->Px();
3559 mom[1] = current->Py();
3560 mom[2] = current->Pz();
3561 //mom[0] = cHit->fMomX;
3562 // mom[1] = cHit->fMomZ;
3563 //mom[2] = cHit->fMomY;
3564 //Float_t energymip = MIP->Energy();
3565 //Float_t Mip_px = mipHit->fMomFreoX;
3566 //Float_t Mip_py = mipHit->fMomFreoY;
3567 //Float_t Mip_pz = mipHit->fMomFreoZ;
3568 //Float_t Mip_px = MIP->Px();
3569 //Float_t Mip_py = MIP->Py();
3570 //Float_t Mip_pz = MIP->Pz();
3571
3572
3573
3574 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
3575 //Float_t rt = TMath::Sqrt(r);
3576 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
3577 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
3578 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
3579 //Float_t cherenkov = TMath::ACos(coscerenkov);
3580 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
3581 //printf("Cherenkov: %f\n",cherenkov);
3582 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
3583 hckphi->Fill(ckphi,(float) 1);
3584
3585
3586 //Float_t mix = MIP->Vx();
3587 //Float_t miy = MIP->Vy();
3588 Float_t mx = mipHit->X();
3589 Float_t my = mipHit->Z();
3590 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
fb498b56 3591 Float_t dx = trackglob[0] - mx;
3592 Float_t dy = trackglob[2] - my;
a3d71079 3593 //printf("Dx:%f, Dy:%f\n",dx,dy);
3594 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
3595 //printf("Final radius:%f\n",final_radius);
3596 radius->Fill(final_radius,(float) 1);
3597
3598 phspectra1->Fill(energyckov*1e9,(float) 1);
3599 phot++;
3600 }
3601 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
3602 if (cmother == nmothers){
3603 if (closs == 4)
3604 mothers2[cmother]++;
3605 mothers[cmother]++;
3606 }
3607 }
3608 }
3609 }
3610 }
3611
3612
3613 if(gAlice->TreeR())
3614 {
3615 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
3616 gAlice->TreeR()->GetEvent(nent-1);
3617 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
3618 //printf ("Rawclusters:%p",Rawclusters);
3619 Int_t nrawclusters = Rawclusters->GetEntriesFast();
3620
3621 if (nrawclusters) {
3622 printf("Raw Clusters : %d\n",nrawclusters);
3623 for (Int_t hit=0;hit<nrawclusters;hit++) {
3624 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
3625 //Int_t nchamber = rcHit->fChamber; // chamber number
3626 //Int_t nhit = cHit->fHitNumber; // hit number
3627 Int_t qtot = rcHit->fQ; // charge
3628 Float_t fx = rcHit->fX; // x-position
3629 Float_t fy = rcHit->fY; // y-position
3630 //Int_t type = rcHit->fCtype; // cluster type ?
3631 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
3632 pads += mult;
3633 if (qtot > 0) {
3634 //printf ("fx: %d, fy: %d\n",fx,fy);
3635 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
3636 //printf("There %d \n",mult);
3637 padmip+=mult;
3638 } else {
3639 padnumber->Fill(mult,(float) 1);
3640 nraw++;
3641 if (mult<4) Clcharge->Fill(qtot,(float) 1);
3642 }
3643
3644 }
3645 }
3646 }
3647
3648
3649 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3650 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3651 //printf (" nrechits:%d\n",nrechits);
3652
3653 if(nrechits1D)
3654 {
3655 for (Int_t hit=0;hit<nrechits1D;hit++) {
3656 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
3657 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
3658 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
3659 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
3660 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
3661 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
3662
3663 Omega1D->Fill(r_omega,(float) 1);
3664
3665 for (Int_t i=0; i<goodPhotons; i++)
3666 {
3667 PhotonCer->Fill(cer_pho[i],(float) 1);
3668 PadsUsed->Fill(padsx[i],padsy[i],1);
3669 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
3670 }
3671
3672 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
3673 }
3674 }
3675
3676
3677 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3678 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3679 //printf (" nrechits:%d\n",nrechits);
3680
3681 if(nrechits3D)
3682 {
fb498b56 3683 recEffEvent = 0;
3684
3685 //for (Int_t hit=0;hit<nrechits3D;hit++) {
3686 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
3687 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
3688 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
3689 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
3690 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
3691 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
3692 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
3693 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
3694
3695
3696 //correction to track cerenkov angle
3697 originalOmega = (Float_t) ckovangle->GetMean();
3698
3699 if(diaglevel == 4)
3700 {
3701 printf("\nMean cerenkov angle: %f\n", originalOmega);
3702 printf("Reconstructed cerenkov angle: %f\n",r_omega);
3703 }
3704
3705 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
3706 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
3707 Float_t phiError = TMath::Abs(originalPhi - r_phi);
3708
3709 //chiSquareOmega += (omegaError/originalOmega)*(omegaError/originalOmega);
3710 //chiSquareTheta += (thetaError/originalTheta)*(thetaError/originalTheta);
3711 //chiSquarePhi += (phiError/originalPhi)*(phiError/originalPhi);
3712
3713 if(TMath::Abs(omegaError) < 0.015)
3714 recEffEvent += 1;
3715
3716
3717
3718 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
3719
3720 Omega3D->Fill(r_omega,(float) 1);
3721 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
3722 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
3723 MeanRadius->Fill(meanradius,(float) 1);
3724 identification->Fill(PTfinal, r_omega,1);
3725 OriginalOmega->Fill(originalOmega, (float) 1);
3726 OriginalTheta->Fill(originalTheta, (float) 1);
3727 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
3728 OmegaError->Fill(omegaError, (float) 1);
3729 ThetaError->Fill(thetaError, (float) 1);
3730 PhiError->Fill(phiError, (float) 1);
3731
3732 recEffEvent = recEffEvent;
3733 recEffTotal += recEffEvent;
3734
3735 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3736 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3737 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3738
3739 Float_t piondist = TMath::Abs(r_omega - pioncer);
3740 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
3741 Float_t protondist = TMath::Abs(r_omega - protoncer);
3742
3743 if(diaglevel == 4)
3744 {
3745 if(pioncer<r_omega)
3746 {
3747 printf("Identified as a PION!\n");
3748 pionCount += 1;
3749 }
3750 if(kaoncer<r_omega && pioncer>r_omega)
3751 {
3752 if(kaondist>piondist)
3753 {
3754 printf("Identified as a PION!\n");
3755 pionCount += 1;
3756 }
3757 else
3758 {
3759 printf("Identified as a KAON!\n");
3760 kaonCount += 1;
3761 }
3762 } }
3763 if(protoncer<r_omega && kaoncer>r_omega)
3764 {
3765 if(kaondist>protondist)
3766 {
3767 printf("Identified as a PROTON!\n");
3768 protonCount += 1;
3769 }
3770 else
3771 {
3772 printf("Identified as a KAON!\n");
3773 pionCount += 1;
3774 }
3775 }
3776 if(protoncer>r_omega)
3777 {
3778 printf("Identified as a PROTON!\n");
3779 protonCount += 1;
3780 }
3781
3782 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
a3d71079 3783 }
3784 }
3785 }
fb498b56 3786
a3d71079 3787
3788 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
fb498b56 3789 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
3790 mother->Fill(mothers2[nmothers],(float) 1);
3791 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
a3d71079 3792 }
3793
3794 clusev->Fill(nraw,(float) 1);
3795 photev->Fill(phot,(float) 1);
3796 feedev->Fill(feed,(float) 1);
3797 padsmip->Fill(padmip,(float) 1);
3798 padscl->Fill(pads,(float) 1);
3799 //printf("Photons:%d\n",phot);
3800 phot = 0;
3801 feed = 0;
3802 pads = 0;
3803 nraw=0;
3804 padmip=0;
fb498b56 3805
3806
3807
a3d71079 3808 gAlice->ResetDigits();
3809 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
3810 gAlice->TreeD()->GetEvent(0);
fb498b56 3811
a3d71079 3812 if (diaglevel < 4)
3813 {
fb498b56 3814
3815
a3d71079 3816 TClonesArray *Digits = pRICH->DigitsAddress(2);
3817 Int_t ndigits = Digits->GetEntriesFast();
3818 printf("Digits : %d\n",ndigits);
3819 padsev->Fill(ndigits,(float) 1);
3820 for (Int_t hit=0;hit<ndigits;hit++) {
3821 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
6e585aa2 3822 Int_t qtot = dHit->Signal(); // charge
3823 Int_t ipx = dHit->PadX(); // pad number on X
3824 Int_t ipy = dHit->PadY(); // pad number on Y
a3d71079 3825 //printf("%d, %d\n",ipx,ipy);
3826 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
3827 }
3828 }
fb498b56 3829
a3d71079 3830 if (diaglevel == 5)
3831 {
3832 for (Int_t ich=0;ich<7;ich++)
3833 {
3834 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
3835 Int_t ndigits = Digits->GetEntriesFast();
3836 //printf("Digits:%d\n",ndigits);
3837 padsev->Fill(ndigits,(float) 1);
3838 if (ndigits) {
3839 for (Int_t hit=0;hit<ndigits;hit++) {
3840 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
6e585aa2 3841 //Int_t nchamber = dHit->GetChamber(); // chamber number
a3d71079 3842 //Int_t nhit = dHit->fHitNumber; // hit number
6e585aa2 3843 Int_t qtot = dHit->Signal(); // charge
3844 Int_t ipx = dHit->PadX(); // pad number on X
3845 Int_t ipy = dHit->PadY(); // pad number on Y
a3d71079 3846 //Int_t iqpad = dHit->fQpad; // charge per pad
3847 //Int_t rpad = dHit->fRSec; // R-position of pad
3848 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
3849 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
3850 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
3851 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
3852 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
3853 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
3854 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
3855 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
3856 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
3857 }
3858 }
3859 }
3860 }
3861 }
fb498b56 3862
3863 if(diaglevel == 4)
3864 {
3865
3866 Stat_t omegaE;
3867 Stat_t thetaE;
3868 Stat_t phiE;
3869
3870 Stat_t omegaO;
3871 Stat_t thetaO;
3872 Stat_t phiO;
a3d71079 3873
fb498b56 3874 for(Int_t i=0;i<99;i++)
3875 {
3876 omegaE = OriginalOmega->GetBinContent(i);
3877 if(omegaE != 0)
3878 {
3879 omegaO = Omega3D->GetBinContent(i);
3880 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
3881 }
3882
3883 thetaE = OriginalTheta->GetBinContent(i);
3884 if(thetaE != 0)
3885 {
3886 thetaO = Theta->GetBinContent(i);
3887 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
3888 }
3889
3890 phiE = OriginalPhi->GetBinContent(i);
3891 if(phiE != 0)
3892 {
3893 phiO = Phi->GetBinContent(i);
3894 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
3895 }
3896
3897 //printf(" o: %f t: %f p: %f\n", OriginalOmega->GetBinContent(i), OriginalTheta->GetBinContent(i),OriginalPhi->GetBinContent(i));
3898
3899 }
3900
3901
3902
3903 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
3904 printf(" Theta - %f\n", chiSquareTheta);
3905 printf(" Phi - %f\n", chiSquarePhi);
3906
3907 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
3908 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
3909 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
3910
3911 recEffTotal = recEffTotal/evNumber2;
3912 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
3913 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
3914
3915 }
3916
a3d71079 3917
3918 //Create canvases, set the view range, show histograms
3919
3920 TCanvas *c1 = 0;
3921 TCanvas *c2 = 0;
3922 TCanvas *c3 = 0;
3923 TCanvas *c4 = 0;
3924 TCanvas *c5 = 0;
3925 TCanvas *c6 = 0;
3926 TCanvas *c7 = 0;
3927 TCanvas *c8 = 0;
3928 TCanvas *c9 = 0;
3929 TCanvas *c10 = 0;
3930 TCanvas *c11 = 0;
3931 TCanvas *c12 = 0;
fb498b56 3932 TCanvas *c13 = 0;
3933
a3d71079 3934 //TF1* expo = 0;
3935 //TF1* gaus = 0;
3936
fb498b56 3937 TStyle *mystyle=new TStyle("Plain","mystyle");
3938 mystyle->SetPalette(1,0);
3939 //mystyle->SetTitleYSize(0.2);
3940 //mystyle->SetStatW(0.19);
3941 //mystyle->SetStatH(0.1);
3942 //mystyle->SetStatFontSize(0.01);
3943 //mystyle->SetTitleYSize(0.3);
3944 mystyle->SetFuncColor(2);
3945 //mystyle->SetOptStat(0111);
3946 mystyle->SetDrawBorder(0);
3947 mystyle->SetTitleBorderSize(0);
3948 mystyle->SetOptFit(1111);
3949 mystyle->cd();
3950
a3d71079 3951
3952 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3953 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3954 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3955 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3956
3957 switch(diaglevel)
3958 {
3959 case 1:
3960
3961 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
3962 hc0->SetXTitle("ix (npads)");
fb498b56 3963 hc0->Draw("colz");
a3d71079 3964
3965//
3966 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
3967 c2->Divide(2,2);
3968 //c4->SetFillColor(42);
3969
3970 c2->cd(1);
3971 feedback->SetXTitle("x (cm)");
3972 feedback->SetYTitle("y (cm)");
fb498b56 3973 feedback->Draw("colz");
a3d71079 3974
3975 c2->cd(2);
3976 //mip->SetFillColor(5);
3977 mip->SetXTitle("x (cm)");
3978 mip->SetYTitle("y (cm)");
fb498b56 3979 mip->Draw("colz");
a3d71079 3980
3981 c2->cd(3);
3982 //cerenkov->SetFillColor(5);
3983 cerenkov->SetXTitle("x (cm)");
3984 cerenkov->SetYTitle("y (cm)");
fb498b56 3985 cerenkov->Draw("colz");
a3d71079 3986
3987 c2->cd(4);
3988 //h->SetFillColor(5);
3989 h->SetXTitle("x (cm)");
3990 h->SetYTitle("y (cm)");
fb498b56 3991 h->Draw("colz");
a3d71079 3992
3993 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
3994 c3->Divide(2,1);
3995 //c10->SetFillColor(42);
3996
3997 c3->cd(1);
3998 hitsX->SetFillColor(5);
3999 hitsX->SetXTitle("(cm)");
4000 hitsX->Draw();
4001
4002 c3->cd(2);
4003 hitsY->SetFillColor(5);
4004 hitsY->SetXTitle("(cm)");
4005 hitsY->Draw();
4006
4007
4008 break;
4009//
4010 case 2:
4011
4012 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
4013 c4->Divide(2,1);
4014 //c6->SetFillColor(42);
4015
4016 c4->cd(1);
4017 phspectra2->SetFillColor(5);
4018 phspectra2->SetXTitle("energy (eV)");
4019 phspectra2->Draw();
4020 c4->cd(2);
4021 phspectra1->SetFillColor(5);
4022 phspectra1->SetXTitle("energy (eV)");
4023 phspectra1->Draw();
4024
4025 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
4026 c5->Divide(2,2);
4027 //c9->SetFillColor(42);
4028
4029 c5->cd(1);
4030 pionspectra->SetFillColor(5);
4031 pionspectra->SetXTitle("(GeV)");
4032 pionspectra->Draw();
4033
4034 c5->cd(2);
4035 protonspectra->SetFillColor(5);
4036 protonspectra->SetXTitle("(GeV)");
4037 protonspectra->Draw();
4038
4039 c5->cd(3);
4040 kaonspectra->SetFillColor(5);
4041 kaonspectra->SetXTitle("(GeV)");
4042 kaonspectra->Draw();
4043
4044 c5->cd(4);
4045 chargedspectra->SetFillColor(5);
4046 chargedspectra->SetXTitle("(GeV)");
4047 chargedspectra->Draw();
4048
4049 break;
4050
4051 case 3:
4052
4053
4054 if(gAlice->TreeR())
4055 {
4056 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
4057 c6->Divide(2,2);
4058 //c3->SetFillColor(42);
4059
4060 c6->cd(1);
4061 //TPad* c6_1;
4062 //c6_1->SetLogy();
4063 Clcharge->SetFillColor(5);
4064 Clcharge->SetXTitle("ADC counts");
4065 if (evNumber2>10)
4066 {
4067 Clcharge->Fit("expo");
4068 //expo->SetLineColor(2);
4069 //expo->SetLineWidth(3);
4070 }
4071 Clcharge->Draw();
4072
4073 c6->cd(2);
4074 padnumber->SetFillColor(5);
4075 padnumber->SetXTitle("(counts)");
4076 padnumber->Draw();
4077
4078 c6->cd(3);
4079 clusev->SetFillColor(5);
4080 clusev->SetXTitle("(counts)");
4081 if (evNumber2>10)
4082 {
4083 clusev->Fit("gaus");
4084 //gaus->SetLineColor(2);
4085 //gaus->SetLineWidth(3);
4086 }
4087 clusev->Draw();
4088
4089 c6->cd(4);
4090 padsmip->SetFillColor(5);
4091 padsmip->SetXTitle("(counts)");
4092 padsmip->Draw();
4093 }
4094
4095 if(evNumber2<1)
4096 {
4097 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
4098 mother->SetFillColor(5);
4099 mother->SetXTitle("counts");
4100 mother->Draw();
4101 }
4102
4103 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
4104 c7->Divide(2,2);
4105 //c7->SetFillColor(42);
4106
4107 c7->cd(1);
4108 totalphotonsevent->SetFillColor(5);
4109 totalphotonsevent->SetXTitle("Photons (counts)");
4110 if (evNumber2>10)
4111 {
4112 totalphotonsevent->Fit("gaus");
4113 //gaus->SetLineColor(2);
4114 //gaus->SetLineWidth(3);
4115 }
4116 totalphotonsevent->Draw();
4117
4118 c7->cd(2);
4119 photev->SetFillColor(5);
4120 photev->SetXTitle("(counts)");
4121 if (evNumber2>10)
4122 {
4123 photev->Fit("gaus");
4124 //gaus->SetLineColor(2);
4125 //gaus->SetLineWidth(3);
4126 }
4127 photev->Draw();
4128
4129 c7->cd(3);
4130 feedev->SetFillColor(5);
4131 feedev->SetXTitle("(counts)");
4132 if (evNumber2>10)
4133 {
4134 feedev->Fit("gaus");
4135 //gaus->SetLineColor(2);
4136 //gaus->SetLineWidth(3);
4137 }
4138 feedev->Draw();
4139
4140 c7->cd(4);
4141 padsev->SetFillColor(5);
4142 padsev->SetXTitle("(counts)");
4143 if (evNumber2>10)
4144 {
4145 padsev->Fit("gaus");
4146 //gaus->SetLineColor(2);
4147 //gaus->SetLineWidth(3);
4148 }
4149 padsev->Draw();
4150
4151 break;
4152
4153 case 4:
4154
4155
4156 if(nrechits3D)
4157 {
fb498b56 4158 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
4159 c8->Divide(1,3);
a3d71079 4160 //c2->SetFillColor(42);
4161
fb498b56 4162
4163 // data per hit
a3d71079 4164 c8->cd(1);
4165 hitsPhi->SetFillColor(5);
fb498b56 4166 if (evNumber2>10)
4167 hitsPhi->Fit("gaus");
a3d71079 4168 hitsPhi->Draw();
fb498b56 4169
4170 //data per track
a3d71079 4171 c8->cd(2);
fb498b56 4172 OriginalPhi->SetFillColor(5);
4173 if (evNumber2>10)
4174 OriginalPhi->Fit("gaus");
4175 OriginalPhi->Draw();
4176
4177 //recontructed data
a3d71079 4178 c8->cd(3);
a3d71079 4179 Phi->SetFillColor(5);
fb498b56 4180 if (evNumber2>10)
4181 Phi->Fit("gaus");
a3d71079 4182 Phi->Draw();
fb498b56 4183
4184 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
4185 c9->Divide(1,3);
4186
4187 // data per hit
4188 c9->cd(1);
4189 hitsTheta->SetFillColor(5);
4190 if (evNumber2>10)
4191 hitsTheta->Fit("gaus");
4192 hitsTheta->Draw();
4193
4194 //data per track
4195 c9->cd(2);
4196 OriginalTheta->SetFillColor(5);
4197 if (evNumber2>10)
4198 OriginalTheta->Fit("gaus");
4199 OriginalTheta->Draw();
4200
4201 //recontructed data
4202 c9->cd(3);
a3d71079 4203 Theta->SetFillColor(5);
fb498b56 4204 if (evNumber2>10)
4205 Theta->Fit("gaus");
a3d71079 4206 Theta->Draw();
fb498b56 4207
4208 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
4209 c10->Divide(1,3);
4210
4211 // data per hit
4212 c10->cd(1);
4213 ckovangle->SetFillColor(5);
4214 ckovangle->SetXTitle("angle (radians)");
4215 if (evNumber2>10)
4216 ckovangle->Fit("gaus");
4217 ckovangle->Draw();
4218
4219 //data per track
4220 c10->cd(2);
4221 OriginalOmega->SetFillColor(5);
4222 OriginalOmega->SetXTitle("angle (radians)");
4223 if (evNumber2>10)
4224 OriginalOmega->Fit("gaus");
4225 OriginalOmega->Draw();
4226
4227 //recontructed data
4228 c10->cd(3);
a3d71079 4229 Omega3D->SetFillColor(5);
4230 Omega3D->SetXTitle("angle (radians)");
fb498b56 4231 if (evNumber2>10)
4232 Omega3D->Fit("gaus");
a3d71079 4233 Omega3D->Draw();
fb498b56 4234
4235
4236 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
4237 c11->Divide(1,2);
4238
4239 // data per hit
4240 c11->cd(1);
4241 radius->SetFillColor(5);
4242 radius->SetXTitle("radius (cm)");
4243 radius->Draw();
4244
4245 //recontructed data
4246 c11->cd(2);
a3d71079 4247 MeanRadius->SetFillColor(5);
4248 MeanRadius->SetXTitle("radius (cm)");
4249 MeanRadius->Draw();
fb498b56 4250
4251
4252 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
4253
4254 c12->cd(1);
4255 identification->SetFillColor(5);
4256 identification->SetXTitle("Momentum (GeV/c)");
4257 identification->SetYTitle("Cherenkov angle (radians)");
4258
4259 //Float_t pionmass=.139;
4260 //Float_t kaonmass=.493;
4261 //Float_t protonmass=.938;
4262 //Float_t n=1.295;
4263
4264 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
4265 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
4266 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
4267
4268 identification->Draw();
4269
4270 pionplot->SetLineColor(5);
4271 pionplot->Draw("same");
4272
4273 kaonplot->SetLineColor(4);
4274 kaonplot->Draw("same");
4275
4276 protonplot->SetLineColor(3);
4277 protonplot->Draw("same");
4278 //identification->Draw("same");
4279
4280
4281
4282 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
4283 c13->Divide(3,1);
4284
4285 c13->cd(1);
4286 PhiError->SetFillColor(5);
4287 if (evNumber2>10)
4288 PhiError->Fit("gaus");
4289 PhiError->Draw();
4290 c13->cd(2);
4291 ThetaError->SetFillColor(5);
4292 if (evNumber2>10)
4293 ThetaError->Fit("gaus");
4294 ThetaError->Draw();
4295 c13->cd(3);
4296 OmegaError->SetFillColor(5);
4297 OmegaError->SetXTitle("angle (radians)");
4298 if (evNumber2>10)
4299 OmegaError->Fit("gaus");
4300 OmegaError->Draw();
a3d71079 4301
4302 }
4303
4304 if(nrechits1D)
4305 {
4306 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
4307 c9->Divide(3,2);
4308 //c5->SetFillColor(42);
4309
4310 c9->cd(1);
4311 ckovangle->SetFillColor(5);
4312 ckovangle->SetXTitle("angle (radians)");
4313 ckovangle->Draw();
4314
4315 c9->cd(2);
4316 radius->SetFillColor(5);
4317 radius->SetXTitle("radius (cm)");
4318 radius->Draw();
4319
4320 c9->cd(3);
4321 hc0->SetXTitle("pads");
4322 hc0->Draw("box");
4323
4324 c9->cd(5);
4325 Omega1D->SetFillColor(5);
4326 Omega1D->SetXTitle("angle (radians)");
4327 Omega1D->Draw();
4328
4329 c9->cd(4);
4330 PhotonCer->SetFillColor(5);
4331 PhotonCer->SetXTitle("angle (radians)");
4332 PhotonCer->Draw();
4333
4334 c9->cd(6);
4335 PadsUsed->SetXTitle("pads");
4336 PadsUsed->Draw("box");
4337 }
4338
4339 break;
4340
4341 case 5:
4342
4343 printf("Drawing histograms.../n");
4344
4345 //if (ndigits)
4346 //{
4347 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
4348 c1->Divide(4,2);
4349 //c1->SetFillColor(42);
4350
4351 c10->cd(1);
4352 hc1->SetXTitle("ix (npads)");
4353 hc1->Draw("box");
4354 c10->cd(2);
4355 hc2->SetXTitle("ix (npads)");
4356 hc2->Draw("box");
4357 c10->cd(3);
4358 hc3->SetXTitle("ix (npads)");
4359 hc3->Draw("box");
4360 c10->cd(4);
4361 hc4->SetXTitle("ix (npads)");
4362 hc4->Draw("box");
4363 c10->cd(5);
4364 hc5->SetXTitle("ix (npads)");
4365 hc5->Draw("box");
4366 c10->cd(6);
4367 hc6->SetXTitle("ix (npads)");
4368 hc6->Draw("box");
4369 c10->cd(7);
4370 hc7->SetXTitle("ix (npads)");
4371 hc7->Draw("box");
4372 c10->cd(8);
4373 hc0->SetXTitle("ix (npads)");
4374 hc0->Draw("box");
4375 //}
4376//
4377 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
4378 c11->Divide(2,2);
4379 //c4->SetFillColor(42);
4380
4381 c11->cd(1);
4382 feedback->SetXTitle("x (cm)");
4383 feedback->SetYTitle("y (cm)");
4384 feedback->Draw();
4385
4386 c11->cd(2);
4387 //mip->SetFillColor(5);
4388 mip->SetXTitle("x (cm)");
4389 mip->SetYTitle("y (cm)");
4390 mip->Draw();
4391
4392 c11->cd(3);
4393 //cerenkov->SetFillColor(5);
4394 cerenkov->SetXTitle("x (cm)");
4395 cerenkov->SetYTitle("y (cm)");
4396 cerenkov->Draw();
4397
4398 c11->cd(4);
4399 //h->SetFillColor(5);
4400 h->SetXTitle("x (cm)");
4401 h->SetYTitle("y (cm)");
4402 h->Draw();
4403
4404 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
4405 c12->Divide(2,1);
4406 //c10->SetFillColor(42);
4407
4408 c12->cd(1);
4409 hitsX->SetFillColor(5);
4410 hitsX->SetXTitle("(cm)");
4411 hitsX->Draw();
4412
4413 c12->cd(2);
4414 hitsY->SetFillColor(5);
4415 hitsY->SetXTitle("(cm)");
4416 hitsY->Draw();
4417
4418 break;
4419
4420 }
4421
4422
4423 // calculate the number of pads which give a signal
4424
4425
4426 //Int_t Np=0;
4427 /*for (Int_t i=0;i< NpadX;i++) {
4428 for (Int_t j=0;j< NpadY;j++) {
4429 if (Pad[i][j]>=6){
4430 Np+=1;
4431 }
4432 }
4433 }*/
4434 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
4435 printf("\nEnd of analysis\n");
4436 printf("**********************************\n");
4437}
b762c2f6 4438
4439////////////////////////////////////////////////////////////////////////
4440void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
4441{
4442 //
4443 // Create TreeD branches for the RICH.
4444 //
4445
4446 const Int_t kBufferSize = 4000;
4447 char branchname[30];
4448
4449 //
4450 // one branch for digits per chamber
4451 //
4452 for (Int_t i=0; i<kNCH ;i++) {
4453 sprintf(branchname,"%sDigits%d",GetName(),i+1);
4454 if (fDchambers && treeD) {
4455 MakeBranchInTree(treeD,
4456 branchname, &((*fDchambers)[i]), kBufferSize, file);
4457// printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
4458 }
4459 }
4460}
4461////////////////////////////////////////////////////////////////////////