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