1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 #include <Riostream.h>
20 #include <TGeometry.h>
21 #include <TLorentzVector.h>
23 #include <TParticle.h>
25 #include <TVirtualMC.h>
26 #include <TPDGCode.h> //for kNuetron
36 #include "AliRICHGeometry.h"
37 #include "AliRICHResponseV0.h"
38 #include "AliRICHSegmentationV1.h"
39 #include "AliRICHv3.h"
41 #include "AliRICHRawCluster.h"
42 #include "AliRICHDigit.h"
43 #include "AliRICHRecHit1D.h"
49 //______________________________________________________________
50 // Implementation of the RICH version 3 with azimuthal rotation
53 AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
54 :AliRICH(sName,sTitle)
56 // The named ctor currently creates a single copy of
57 // AliRICHGeometry AliRICHSegmentationV1 AliRICHResponseV0
58 // and initialises the corresponding models of all 7 chambers with these stuctures.
59 // Note: all chambers share the single copy of models. MUST be changed later (???).
60 if(GetDebug())Info("named ctor","Start.");
62 fCkovNumber=fFreonProd=0;
64 AliRICHGeometry *pRICHGeometry =new AliRICHGeometry; // ??? to be moved to AlRICHChamber::named ctor
65 AliRICHSegmentationV1 *pRICHSegmentation=new AliRICHSegmentationV1; // ??? to be moved to AlRICHChamber::named ctor
66 AliRICHResponseV0 *pRICHResponse =new AliRICHResponseV0; // ??? to be moved to AlRICHChamber::named ctor
68 for (Int_t i=1; i<=kNCH; i++){
69 SetGeometryModel(i,pRICHGeometry);
70 SetSegmentationModel(i,pRICHSegmentation);
71 SetResponseModel(i,pRICHResponse);
72 C(i)->Init(i); // ??? to be removed
74 if(GetDebug())Info("named ctor","Stop.");
75 }//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
77 AliRICHv3::~AliRICHv3()
79 // Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
80 if(GetDebug()) cout<<ClassName()<<"::dtor()>\n";
83 AliRICHChamber *ch =C(1);
85 delete ch->GetGeometryModel();
86 delete ch->GetResponseModel();
87 delete ch->GetSegmentationModel();
91 //______________________________________________________________________________
92 void AliRICHv3::StepManager()
99 static Float_t hits[22];
100 static Float_t ckovData[19];
101 TLorentzVector position;
102 TLorentzVector momentum;
107 Float_t localTheta,localPhi;
109 Float_t destep, step;
112 static Float_t eloss, xhit, yhit, tlength;
113 const Float_t kBig=1.e10;
115 TClonesArray &lhits = *fHits;
116 TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
118 //if (current->Energy()>1)
121 // Only gas gap inside chamber
122 // Tag chambers and record hits when track enters
125 id=gMC->CurrentVolID(copy);
127 Float_t cherenkovLoss=0;
128 //gAlice->KeepTrack(gAlice->GetCurrentTrackNumber());
130 gMC->TrackPosition(position);
134 //bzero((char *)ckovData,sizeof(ckovData)*19);
135 ckovData[1] = pos[0]; // X-position for hit
136 ckovData[2] = pos[1]; // Y-position for hit
137 ckovData[3] = pos[2]; // Z-position for hit
138 ckovData[6] = 0; // dummy track length
139 //ckovData[11] = gAlice->GetCurrentTrackNumber();
141 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->GetCurrentTrackNumber());
143 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
145 /********************Store production parameters for Cerenkov photons************************/
146 //is it a Cerenkov photon?
147 if (gMC->TrackPid() == 50000050) {
149 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
151 Float_t ckovEnergy = current->Energy();
152 //energy interval for tracking
153 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
154 //if (ckovEnergy > 0)
156 if (gMC->IsTrackEntering()){ //is track entering?
157 //printf("Track entered (1)\n");
158 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
160 if (gMC->IsNewTrack()){ //is it the first step?
161 //printf("I'm in!\n");
162 Int_t mother = current->GetFirstMother();
164 //printf("Second Mother:%d\n",current->GetSecondMother());
166 ckovData[10] = mother;
167 ckovData[11] = gAlice->GetMCApp()->GetCurrentTrackNumber();
168 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
169 //printf("Produced in FREO\n");
172 //printf("Index: %d\n",fCkovNumber);
173 } //first step question
176 if (gMC->IsNewTrack()){ //is it first step?
177 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
180 //printf("Produced in QUAR\n");
182 } //first step question
184 //printf("Before %d\n",fFreonProd);
185 } //track entering question
187 if (ckovData[12] == 1) //was it produced in Freon?
188 //if (fFreonProd == 1)
190 if (gMC->IsTrackEntering()){ //is track entering?
191 //printf("Track entered (2)\n");
192 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
193 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
194 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
196 //printf("Got in META\n");
197 gMC->TrackMomentum(momentum);
203 gMC->Gmtod(mom,localMom,2);
204 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
205 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
206 /**************** Photons lost in second grid have to be calculated by hand************/
207 gMC->GetRandom()->RndmArray(1,ranf);
211 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
212 //printf("Added One (1)!\n");
213 //printf("Lost one in grid\n");
215 /**********************************************************************************/
218 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
219 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
220 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
222 //printf("Got in CSI\n");
223 gMC->TrackMomentum(momentum);
229 gMC->Gmtod(mom,localMom,2);
230 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
231 /***********************Cerenkov phtons (always polarised)*************************/
232 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
233 Double_t localRt = TMath::Sqrt(localTc);
234 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
235 Double_t cotheta = TMath::Abs(cos(localTheta));
236 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
237 gMC->GetRandom()->RndmArray(1,ranf);
241 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
243 //printf("Added One (2)!\n");
244 //printf("Lost by Fresnel\n");
246 /**********************************************************************************/
251 /********************Evaluation of losses************************/
252 /******************still in the old fashion**********************/
255 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
256 for (Int_t i = 0; i < i1; ++i) {
258 if (procs[i] == kPLightReflection) { //was it reflected
260 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
262 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
265 //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
266 } //reflection question
269 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
270 //printf("Got in absorption\n");
272 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
274 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
276 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
278 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
281 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
285 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
289 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
290 //printf("Added One (3)!\n");
291 //printf("Added cerenkov %d\n",fCkovNumber);
292 } //absorption question
295 // Photon goes out of tracking scope
296 else if (procs[i] == kPStop) { //is it below energy treshold?
299 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
300 //printf("Added One (4)!\n");
301 } // energy treshold question
302 } //number of mechanisms cycle
303 /**********************End of evaluation************************/
304 } //freon production question
305 } //energy interval question
306 //}//inside the proximity gap question
307 } //cerenkov photon question
309 /**************************************End of Production Parameters Storing*********************/
312 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
314 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
315 //printf("Cerenkov\n");
317 //if (gMC->TrackPid() == 50000051)
318 //printf("Tracking a feedback\n");
320 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
322 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
323 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
324 //printf("Got in CSI\n");
325 //printf("Tracking a %d\n",gMC->TrackPid());
326 if (gMC->Edep() > 0.){
327 gMC->TrackPosition(position);
328 gMC->TrackMomentum(momentum);
336 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
337 Double_t rt = TMath::Sqrt(tc);
338 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
339 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
341 gMC->CurrentVolOffID(2,copy);
346 gMC->Gmtod(pos,localPos,1);
348 //Chamber(idvol).GlobaltoLocal(pos,localPos);
350 gMC->Gmtod(mom,localMom,2);
352 //Chamber(idvol).GlobaltoLocal(mom,localMom);
354 gMC->CurrentVolOffID(2,copy);
358 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
359 //->Sector(localPos[0], localPos[2]);
360 //printf("Sector:%d\n",sector);
362 /*if (gMC->TrackPid() == 50000051){
364 printf("Feedbacks:%d\n",fFeedbacks);
367 //PH ((AliRICHChamber*) (*fChambers)[idvol])
368 ((AliRICHChamber*)fChambers->At(idvol))
369 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
371 ckovData[0] = gMC->TrackPid(); // particle type
372 ckovData[1] = pos[0]; // X-position for hit
373 ckovData[2] = pos[1]; // Y-position for hit
374 ckovData[3] = pos[2]; // Z-position for hit
375 ckovData[4] = theta; // theta angle of incidence
376 ckovData[5] = phi; // phi angle of incidence
377 ckovData[8] = (Float_t) fNsdigits; // first sdigit
378 ckovData[9] = -1; // last pad hit
379 ckovData[13] = 4; // photon was detected
380 ckovData[14] = mom[0];
381 ckovData[15] = mom[1];
382 ckovData[16] = mom[2];
384 destep = gMC->Edep();
385 gMC->SetMaxStep(kBig);
386 cherenkovLoss += destep;
387 ckovData[7]=cherenkovLoss;
389 ckovData[17] = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kPhoton);//for photons in CsI
391 if (fNsdigits > (Int_t)ckovData[8]) {
392 ckovData[8]= ckovData[8]+1;
393 ckovData[9]= (Float_t) fNsdigits;
397 //TClonesArray *Hits = RICH->Hits();
398 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
401 mom[0] = current->Px();
402 mom[1] = current->Py();
403 mom[2] = current->Pz();
404 Float_t mipPx = mipHit->MomX();
405 Float_t mipPy = mipHit->MomY();
406 Float_t mipPz = mipHit->MomZ();
408 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
409 Float_t rt = TMath::Sqrt(r);
410 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
411 Float_t mipRt = TMath::Sqrt(mipR);
414 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
420 Float_t cherenkov = TMath::ACos(coscerenkov);
421 ckovData[18]=cherenkov;
425 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
426 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
427 //printf("Added One (5)!\n");
434 /***********************************************End of photon hits*********************************************/
437 /**********************************************Charged particles treatment*************************************/
439 else if (gMC->TrackCharge()){
441 /*if (gMC->IsTrackEntering())
443 hits[13]=20;//is track entering?
445 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
447 gMC->TrackMomentum(momentum);
458 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {//is in GAP?
459 // Get current particle id (ipart), track position (pos) and momentum (mom)
461 gMC->CurrentVolOffID(3,copy);
465 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
466 //->Sector(localPos[0], localPos[2]);
467 //printf("Sector:%d\n",sector);
469 gMC->TrackPosition(position);
470 gMC->TrackMomentum(momentum);
479 gMC->Gmtod(pos,localPos,1);
481 //Chamber(idvol).GlobaltoLocal(pos,localPos);
483 gMC->Gmtod(mom,localMom,2);
485 //Chamber(idvol).GlobaltoLocal(mom,localMom);
487 ipart = gMC->TrackPid();
489 // momentum loss and steplength in last step
490 destep = gMC->Edep();
491 step = gMC->TrackStep();
494 // record hits when track enters ...
495 if( gMC->IsTrackEntering()) {
496 // gMC->SetMaxStep(fMaxStepGas);
497 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
498 Double_t rt = TMath::Sqrt(tc);
499 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
500 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
503 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
504 Double_t localRt = TMath::Sqrt(localTc);
505 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
506 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
508 hits[0] = Float_t(ipart); // particle type
509 hits[1] = localPos[0]; // X-position for hit
510 hits[2] = localPos[1]; // Y-position for hit
511 hits[3] = localPos[2]; // Z-position for hit
512 hits[4] = localTheta; // theta angle of incidence
513 hits[5] = localPhi; // phi angle of incidence
514 hits[8] = (Float_t) fNsdigits; // first sdigit
515 hits[9] = -1; // last pad hit
516 hits[13] = fFreonProd; // did id hit the freon?
520 hits[18] = 0; // dummy cerenkov angle
526 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
529 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
532 // Only if not trigger chamber
535 // Initialize hit position (cursor) in the segmentation model
536 //PH ((AliRICHChamber*) (*fChambers)[idvol])
537 ((AliRICHChamber*)fChambers->At(idvol))
538 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
543 // Calculate the charge induced on a pad (disintegration) in case
545 // Mip left chamber ...
546 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
547 gMC->SetMaxStep(kBig);
552 // Only if not trigger chamber
556 if(gMC->TrackPid() == kNeutron)
557 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
558 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip); //for MIP
564 if (fNsdigits > (Int_t)hits[8]) {
566 hits[9]= (Float_t) fNsdigits;
570 new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
573 // Check additional signal generation conditions
574 // defined by the segmentation
575 // model (boundary crossing conditions)
576 }else if(((AliRICHChamber*)fChambers->At(idvol))->SigGenCond(localPos[0], localPos[2], localPos[1])){
577 ((AliRICHChamber*)fChambers->At(idvol))->SigGenInit(localPos[0], localPos[2], localPos[1]);
580 if(gMC->TrackPid() == kNeutron)
581 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
582 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);//for n
589 // nothing special happened, add up energy loss
596 /*************************************************End of MIP treatment**************************************/
597 }//void AliRICHv3::StepManager()
598 //__________________________________________________________________________________________________
599 Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
600 {//calls the charge disintegration method of the current chamber and adds all generated sdigits to the list of digits
602 Float_t newclust[4][500];
607 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits,newclust, res);
609 for (Int_t i=0; i<iNdigits; i++) {
610 if (Int_t(newclust[0][i]) > 0) {
611 clhits[1] = Int_t(newclust[0][i]);// Cluster Charge
612 clhits[2] = Int_t(newclust[1][i]);// Pad: ix
613 clhits[3] = Int_t(newclust[2][i]);// Pad: iy
614 clhits[4] = Int_t(newclust[3][i]);// Pad: chamber sector
615 AddSpecialOld(clhits);
619 }//Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
620 //__________________________________________________________________________________________________
621 void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
624 Int_t NpadX = 162; // number of pads on X
625 Int_t NpadY = 162; // number of pads on Y
628 for (Int_t i=0;i<NpadX;i++) {
629 for (Int_t j=0;j<NpadY;j++) {
634 // Create some histograms
636 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
637 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
638 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
639 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
640 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
641 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
642 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
643 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
644 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
645 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
646 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
647 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
648 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
649 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
650 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
651 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
652 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
653 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
654 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
655 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
656 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
657 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
658 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
659 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
660 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
661 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
662 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
663 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
664 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
665 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
666 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
667 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
672 // Start loop over events
674 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
675 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
676 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
679 for (int nev=0; nev<= evNumber2; nev++) {
680 Int_t nparticles = gAlice->GetEvent(nev);
683 if (nev < evNumber1) continue;
684 if (nparticles <= 0) return;
686 // Get pointers to RICH detector and Hits containers
688 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
690 TTree *treeH = TreeH();
691 Int_t ntracks =(Int_t) treeH->GetEntries();
693 // Start loop on tracks in the hits containers
695 for (Int_t track=0; track<ntracks;track++) {
696 printf ("Processing Track: %d\n",track);
698 treeH->GetEvent(track);
700 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
702 mHit=(AliRICHhit*)pRICH->NextHit())
704 //Int_t nch = mHit->fChamber; // chamber number
705 //Float_t x = mHit->X(); // x-pos of hit
706 //Float_t y = mHit->Z(); // y-pos
707 //Float_t z = mHit->Y();
708 //Float_t phi = mHit->Phi(); //Phi angle of incidence
709 Float_t theta = mHit->Theta(); //Theta angle of incidence
710 Float_t px = mHit->MomX();
711 Float_t py = mHit->MomY();
712 Int_t index = mHit->Track();
713 Int_t particle = (Int_t)(mHit->Particle());
718 TParticle *current = gAlice->GetMCApp()->Particle(index);
720 //Float_t energy=current->Energy();
722 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
723 PTfinal=TMath::Sqrt(px*px + py*py);
724 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
728 if (TMath::Abs(particle) < 10000000)
730 hitsTheta->Fill(theta,(float) 1);
733 if (PTvertex>.5 && PTvertex<=1)
735 hitsTheta500MeV->Fill(theta,(float) 1);
737 if (PTvertex>1 && PTvertex<=2)
739 hitsTheta1GeV->Fill(theta,(float) 1);
741 if (PTvertex>2 && PTvertex<=3)
743 hitsTheta2GeV->Fill(theta,(float) 1);
747 hitsTheta3GeV->Fill(theta,(float) 1);
756 if (TMath::Abs(particle) < 50000051)
758 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
759 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
761 //gMC->Rndm(&random, 1);
762 if (random->Rndm() < .1)
763 production->Fill(current->Vz(),R,(float) 1);
764 if (TMath::Abs(particle) == 50000050)
765 //if (TMath::Abs(particle) > 50000000)
771 if (current->Energy()>0.001)
772 highprimaryphotons +=1;
775 if (TMath::Abs(particle) == 2112)
778 if (current->Energy()>0.0001)
782 if (TMath::Abs(particle) < 50000000)
784 production->Fill(current->Vz(),R,(float) 1);
786 //mip->Fill(x,y,(float) 1);
789 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
793 pionptspectravertex->Fill(PTvertex,(float) 1);
794 pionptspectrafinal->Fill(PTfinal,(float) 1);
798 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
799 || TMath::Abs(particle)==311)
803 kaonptspectravertex->Fill(PTvertex,(float) 1);
804 kaonptspectrafinal->Fill(PTfinal,(float) 1);
809 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
811 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
812 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
813 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
816 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
819 if (TMath::Abs(particle)==211)
825 if (current->Energy()>1)
826 highprimarypions +=1;
830 if (TMath::Abs(particle)==2212)
832 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
833 //ptspectra->Fill(Pt,(float) 1);
834 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
835 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
837 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
840 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
841 || TMath::Abs(particle)==311)
843 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
844 //ptspectra->Fill(Pt,(float) 1);
845 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
846 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
848 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
850 if (TMath::Abs(particle)==321)
856 if (current->Energy()>1)
857 highprimarykaons +=1;
861 if (TMath::Abs(particle)==11)
863 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
864 //ptspectra->Fill(Pt,(float) 1);
865 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
866 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
868 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
874 if (TMath::Abs(particle)==13)
876 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
877 //ptspectra->Fill(Pt,(float) 1);
878 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
879 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
881 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
884 if (TMath::Abs(particle)==2112)
886 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
887 //ptspectra->Fill(Pt,(float) 1);
888 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
889 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
892 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
896 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
898 if (current->Energy()-current->GetCalcMass()>1)
900 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
901 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
902 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
904 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
907 // Fill the histograms
909 //h->Fill(x,y,(float) 1);
919 TStyle *mystyle=new TStyle("Plain","mystyle");
920 mystyle->SetPalette(1,0);
923 //Create canvases, set the view range, show histograms
925 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
927 //c2->SetFillColor(42);
930 hitsTheta500MeV->SetFillColor(5);
931 hitsTheta500MeV->Draw();
933 hitsTheta1GeV->SetFillColor(5);
934 hitsTheta1GeV->Draw();
936 hitsTheta2GeV->SetFillColor(5);
937 hitsTheta2GeV->Draw();
939 hitsTheta3GeV->SetFillColor(5);
940 hitsTheta3GeV->Draw();
944 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
946 production->SetFillColor(42);
947 production->SetXTitle("z (m)");
948 production->SetYTitle("R (m)");
951 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
954 pionptspectravertex->SetFillColor(5);
955 pionptspectravertex->SetXTitle("Pt (GeV)");
956 pionptspectravertex->Draw();
958 pionptspectrafinal->SetFillColor(5);
959 pionptspectrafinal->SetXTitle("Pt (GeV)");
960 pionptspectrafinal->Draw();
962 kaonptspectravertex->SetFillColor(5);
963 kaonptspectravertex->SetXTitle("Pt (GeV)");
964 kaonptspectravertex->Draw();
966 kaonptspectrafinal->SetFillColor(5);
967 kaonptspectrafinal->SetXTitle("Pt (GeV)");
968 kaonptspectrafinal->Draw();
971 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
975 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
976 electronspectra1->SetFillColor(5);
977 electronspectra1->SetXTitle("log(GeV)");
978 electronspectra2->SetFillColor(46);
979 electronspectra2->SetXTitle("log(GeV)");
980 electronspectra3->SetFillColor(10);
981 electronspectra3->SetXTitle("log(GeV)");
983 electronspectra1->Draw();
984 electronspectra2->Draw("same");
985 electronspectra3->Draw("same");
988 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
989 muonspectra1->SetFillColor(5);
990 muonspectra1->SetXTitle("log(GeV)");
991 muonspectra2->SetFillColor(46);
992 muonspectra2->SetXTitle("log(GeV)");
993 muonspectra3->SetFillColor(10);
994 muonspectra3->SetXTitle("log(GeV)");
996 muonspectra1->Draw();
997 muonspectra2->Draw("same");
998 muonspectra3->Draw("same");
1001 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
1002 //neutronspectra1->SetFillColor(42);
1003 //neutronspectra1->SetXTitle("log(GeV)");
1004 //neutronspectra2->SetFillColor(46);
1005 //neutronspectra2->SetXTitle("log(GeV)");
1006 //neutronspectra3->SetFillColor(10);
1007 //neutronspectra3->SetXTitle("log(GeV)");
1009 //neutronspectra1->Draw();
1010 //neutronspectra2->Draw("same");
1011 //neutronspectra3->Draw("same");
1013 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
1014 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
1018 pionspectra1->SetFillColor(5);
1019 pionspectra1->SetXTitle("log(GeV)");
1020 pionspectra2->SetFillColor(46);
1021 pionspectra2->SetXTitle("log(GeV)");
1022 pionspectra3->SetFillColor(10);
1023 pionspectra3->SetXTitle("log(GeV)");
1025 pionspectra1->Draw();
1026 pionspectra2->Draw("same");
1027 pionspectra3->Draw("same");
1030 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
1031 protonspectra1->SetFillColor(5);
1032 protonspectra1->SetXTitle("log(GeV)");
1033 protonspectra2->SetFillColor(46);
1034 protonspectra2->SetXTitle("log(GeV)");
1035 protonspectra3->SetFillColor(10);
1036 protonspectra3->SetXTitle("log(GeV)");
1038 protonspectra1->Draw();
1039 protonspectra2->Draw("same");
1040 protonspectra3->Draw("same");
1043 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
1044 kaonspectra1->SetFillColor(5);
1045 kaonspectra1->SetXTitle("log(GeV)");
1046 kaonspectra2->SetFillColor(46);
1047 kaonspectra2->SetXTitle("log(GeV)");
1048 kaonspectra3->SetFillColor(10);
1049 kaonspectra3->SetXTitle("log(GeV)");
1051 kaonspectra1->Draw();
1052 kaonspectra2->Draw("same");
1053 kaonspectra3->Draw("same");
1056 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
1057 chargedspectra1->SetFillColor(5);
1058 chargedspectra1->SetXTitle("log(GeV)");
1059 chargedspectra2->SetFillColor(46);
1060 chargedspectra2->SetXTitle("log(GeV)");
1061 chargedspectra3->SetFillColor(10);
1062 chargedspectra3->SetXTitle("log(GeV)");
1064 chargedspectra1->Draw();
1065 chargedspectra2->Draw("same");
1066 chargedspectra3->Draw("same");
1070 printf("*****************************************\n");
1071 printf("* Particle * Counts *\n");
1072 printf("*****************************************\n");
1074 printf("* Pions: * %4d *\n",pion);
1075 printf("* Charged Pions: * %4d *\n",chargedpions);
1076 printf("* Primary Pions: * %4d *\n",primarypions);
1077 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
1078 printf("* Kaons: * %4d *\n",kaon);
1079 printf("* Charged Kaons: * %4d *\n",chargedkaons);
1080 printf("* Primary Kaons: * %4d *\n",primarykaons);
1081 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
1082 printf("* Muons: * %4d *\n",muon);
1083 printf("* Electrons: * %4d *\n",electron);
1084 printf("* Positrons: * %4d *\n",positron);
1085 printf("* Protons: * %4d *\n",proton);
1086 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
1087 printf("*****************************************\n");
1088 //printf("* Photons: * %3.1f *\n",photons);
1089 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
1090 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
1091 //printf("*****************************************\n");
1092 //printf("* Neutrons: * %3.1f *\n",neutron);
1093 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
1094 //printf("*****************************************\n");
1096 if (gAlice->TreeD())
1098 gAlice->TreeD()->GetEvent(0);
1103 printf("\n*****************************************\n");
1104 printf("* Chamber * Digits * Occupancy *\n");
1105 printf("*****************************************\n");
1107 for (Int_t ich=0;ich<7;ich++)
1109 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
1110 Int_t ndigits = Digits->GetEntriesFast();
1111 occ[ich] = Float_t(ndigits)/(160*144);
1112 sum += Float_t(ndigits)/(160*144);
1113 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
1116 printf("*****************************************\n");
1117 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
1118 printf("*****************************************\n");
1121 printf("\nEnd of analysis\n");
1123 }//void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1124 //__________________________________________________________________________________________________