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