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 "AliRICHResponse.h"
38 #include "AliRICHSegmentationV1.h"
39 #include "AliRICHv3.h"
41 #include "AliRICHRawCluster.h"
42 #include "AliRICHDigit.h"
48 //______________________________________________________________
49 // Implementation of the RICH version 3 with azimuthal rotation
52 AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
53 :AliRICH(sName,sTitle)
55 // The named ctor currently creates a single copy of
56 // AliRICHGeometry AliRICHSegmentationV1 AliRICHResponse
57 // and initialises the corresponding models of all 7 chambers with these stuctures.
58 // Note: all chambers share the single copy of models. MUST be changed later (???).
59 if(GetDebug())Info("named ctor","Start.");
61 fCkovNumber=fFreonProd=0;
63 AliRICHGeometry *pRICHGeometry =new AliRICHGeometry; // ??? to be moved to AlRICHChamber::named ctor
64 AliRICHSegmentationV1 *pRICHSegmentation=new AliRICHSegmentationV1; // ??? to be moved to AlRICHChamber::named ctor
65 AliRICHResponse *pRICHResponse =new AliRICHResponse; // ??? to be moved to AlRICHChamber::named ctor
67 for (Int_t i=1; i<=kNCH; i++){
68 SetGeometryModel(i,pRICHGeometry);
69 SetSegmentationModel(i,pRICHSegmentation);
70 SetResponseModel(i,pRICHResponse);
71 C(i)->Init(i); // ??? to be removed
73 if(GetDebug())Info("named ctor","Stop.");
74 }//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
76 AliRICHv3::~AliRICHv3()
78 // Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
79 if(GetDebug()) cout<<ClassName()<<"::dtor()>\n";
82 AliRICHChamber *ch =C(1);
84 delete ch->GetGeometryModel();
85 delete ch->GetResponseModel();
86 delete ch->GetSegmentationModel();
90 //______________________________________________________________________________
91 void AliRICHv3::StepManager()
98 static Float_t hits[22];
99 static Float_t ckovData[19];
100 TLorentzVector position;
101 TLorentzVector momentum;
106 Float_t localTheta,localPhi;
108 Float_t destep, step;
111 static Float_t eloss, xhit, yhit, tlength;
112 const Float_t kBig=1.e10;
114 TClonesArray &lhits = *fHits;
115 TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
117 //if (current->Energy()>1)
120 // Only gas gap inside chamber
121 // Tag chambers and record hits when track enters
124 id=gMC->CurrentVolID(copy);
126 Float_t cherenkovLoss=0;
127 //gAlice->KeepTrack(gAlice->GetCurrentTrackNumber());
129 gMC->TrackPosition(position);
133 //bzero((char *)ckovData,sizeof(ckovData)*19);
134 ckovData[1] = pos[0]; // X-position for hit
135 ckovData[2] = pos[1]; // Y-position for hit
136 ckovData[3] = pos[2]; // Z-position for hit
137 ckovData[6] = 0; // dummy track length
138 //ckovData[11] = gAlice->GetCurrentTrackNumber();
140 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->GetCurrentTrackNumber());
142 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
144 /********************Store production parameters for Cerenkov photons************************/
145 //is it a Cerenkov photon?
146 if (gMC->TrackPid() == 50000050) {
148 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
150 Float_t ckovEnergy = current->Energy();
151 //energy interval for tracking
152 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
153 //if (ckovEnergy > 0)
155 if (gMC->IsTrackEntering()){ //is track entering?
156 //printf("Track entered (1)\n");
157 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
159 if (gMC->IsNewTrack()){ //is it the first step?
160 //printf("I'm in!\n");
161 Int_t mother = current->GetFirstMother();
163 //printf("Second Mother:%d\n",current->GetSecondMother());
165 ckovData[10] = mother;
166 ckovData[11] = gAlice->GetMCApp()->GetCurrentTrackNumber();
167 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
168 //printf("Produced in FREO\n");
171 //printf("Index: %d\n",fCkovNumber);
172 } //first step question
175 if (gMC->IsNewTrack()){ //is it first step?
176 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
179 //printf("Produced in QUAR\n");
181 } //first step question
183 //printf("Before %d\n",fFreonProd);
184 } //track entering question
186 if (ckovData[12] == 1) //was it produced in Freon?
187 //if (fFreonProd == 1)
189 if (gMC->IsTrackEntering()){ //is track entering?
190 //printf("Track entered (2)\n");
191 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
192 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
193 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
195 //printf("Got in META\n");
196 gMC->TrackMomentum(momentum);
202 gMC->Gmtod(mom,localMom,2);
203 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
204 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
205 /**************** Photons lost in second grid have to be calculated by hand************/
206 gMC->GetRandom()->RndmArray(1,ranf);
210 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
211 //printf("Added One (1)!\n");
212 //printf("Lost one in grid\n");
214 /**********************************************************************************/
217 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
218 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
219 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
221 //printf("Got in CSI\n");
222 gMC->TrackMomentum(momentum);
228 gMC->Gmtod(mom,localMom,2);
229 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
230 /***********************Cerenkov phtons (always polarised)*************************/
231 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
232 Double_t localRt = TMath::Sqrt(localTc);
233 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
234 Double_t cotheta = TMath::Abs(cos(localTheta));
235 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
236 gMC->GetRandom()->RndmArray(1,ranf);
240 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
242 //printf("Added One (2)!\n");
243 //printf("Lost by Fresnel\n");
245 /**********************************************************************************/
250 /********************Evaluation of losses************************/
251 /******************still in the old fashion**********************/
254 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
255 for (Int_t i = 0; i < i1; ++i) {
257 if (procs[i] == kPLightReflection) { //was it reflected
259 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
261 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
264 //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
265 } //reflection question
268 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
269 //printf("Got in absorption\n");
271 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
273 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
275 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
277 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
280 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
284 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
288 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
289 //printf("Added One (3)!\n");
290 //printf("Added cerenkov %d\n",fCkovNumber);
291 } //absorption question
294 // Photon goes out of tracking scope
295 else if (procs[i] == kPStop) { //is it below energy treshold?
298 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
299 //printf("Added One (4)!\n");
300 } // energy treshold question
301 } //number of mechanisms cycle
302 /**********************End of evaluation************************/
303 } //freon production question
304 } //energy interval question
305 //}//inside the proximity gap question
306 } //cerenkov photon question
308 /**************************************End of Production Parameters Storing*********************/
311 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
313 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
314 //printf("Cerenkov\n");
316 //if (gMC->TrackPid() == 50000051)
317 //printf("Tracking a feedback\n");
319 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
321 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
322 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
323 //printf("Got in CSI\n");
324 //printf("Tracking a %d\n",gMC->TrackPid());
325 if (gMC->Edep() > 0.){
326 gMC->TrackPosition(position);
327 gMC->TrackMomentum(momentum);
335 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
336 Double_t rt = TMath::Sqrt(tc);
337 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
338 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
340 gMC->CurrentVolOffID(2,copy);
345 gMC->Gmtod(pos,localPos,1);
347 //Chamber(idvol).GlobaltoLocal(pos,localPos);
349 gMC->Gmtod(mom,localMom,2);
351 //Chamber(idvol).GlobaltoLocal(mom,localMom);
353 gMC->CurrentVolOffID(2,copy);
357 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
358 //->Sector(localPos[0], localPos[2]);
359 //printf("Sector:%d\n",sector);
361 /*if (gMC->TrackPid() == 50000051){
363 printf("Feedbacks:%d\n",fFeedbacks);
366 //PH ((AliRICHChamber*) (*fChambers)[idvol])
367 ((AliRICHChamber*)fChambers->At(idvol))
368 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
370 ckovData[0] = gMC->TrackPid(); // particle type
371 ckovData[1] = pos[0]; // X-position for hit
372 ckovData[2] = pos[1]; // Y-position for hit
373 ckovData[3] = pos[2]; // Z-position for hit
374 ckovData[4] = theta; // theta angle of incidence
375 ckovData[5] = phi; // phi angle of incidence
376 ckovData[8] = (Float_t) fNsdigits; // first sdigit
377 ckovData[9] = -1; // last pad hit
378 ckovData[13] = 4; // photon was detected
379 ckovData[14] = mom[0];
380 ckovData[15] = mom[1];
381 ckovData[16] = mom[2];
383 destep = gMC->Edep();
384 gMC->SetMaxStep(kBig);
385 cherenkovLoss += destep;
386 ckovData[7]=cherenkovLoss;
388 ckovData[17] = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kPhoton);//for photons in CsI
390 if (fNsdigits > (Int_t)ckovData[8]) {
391 ckovData[8]= ckovData[8]+1;
392 ckovData[9]= (Float_t) fNsdigits;
396 //TClonesArray *Hits = RICH->Hits();
397 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
400 mom[0] = current->Px();
401 mom[1] = current->Py();
402 mom[2] = current->Pz();
403 Float_t mipPx = mipHit->MomX();
404 Float_t mipPy = mipHit->MomY();
405 Float_t mipPz = mipHit->MomZ();
407 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
408 Float_t rt = TMath::Sqrt(r);
409 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
410 Float_t mipRt = TMath::Sqrt(mipR);
413 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
419 Float_t cherenkov = TMath::ACos(coscerenkov);
420 ckovData[18]=cherenkov;
424 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
425 AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);
426 //printf("Added One (5)!\n");
433 /***********************************************End of photon hits*********************************************/
436 /**********************************************Charged particles treatment*************************************/
438 else if (gMC->TrackCharge()){
440 /*if (gMC->IsTrackEntering())
442 hits[13]=20;//is track entering?
444 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
446 gMC->TrackMomentum(momentum);
457 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {//is in GAP?
458 // Get current particle id (ipart), track position (pos) and momentum (mom)
460 gMC->CurrentVolOffID(3,copy);
464 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
465 //->Sector(localPos[0], localPos[2]);
466 //printf("Sector:%d\n",sector);
468 gMC->TrackPosition(position);
469 gMC->TrackMomentum(momentum);
478 gMC->Gmtod(pos,localPos,1);
480 //Chamber(idvol).GlobaltoLocal(pos,localPos);
482 gMC->Gmtod(mom,localMom,2);
484 //Chamber(idvol).GlobaltoLocal(mom,localMom);
486 ipart = gMC->TrackPid();
488 // momentum loss and steplength in last step
489 destep = gMC->Edep();
490 step = gMC->TrackStep();
493 // record hits when track enters ...
494 if( gMC->IsTrackEntering()) {
495 // gMC->SetMaxStep(fMaxStepGas);
496 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
497 Double_t rt = TMath::Sqrt(tc);
498 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
499 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
502 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
503 Double_t localRt = TMath::Sqrt(localTc);
504 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
505 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
507 hits[0] = Float_t(ipart); // particle type
508 hits[1] = localPos[0]; // X-position for hit
509 hits[2] = localPos[1]; // Y-position for hit
510 hits[3] = localPos[2]; // Z-position for hit
511 hits[4] = localTheta; // theta angle of incidence
512 hits[5] = localPhi; // phi angle of incidence
513 hits[8] = (Float_t) fNsdigits; // first sdigit
514 hits[9] = -1; // last pad hit
515 hits[13] = fFreonProd; // did id hit the freon?
519 hits[18] = 0; // dummy cerenkov angle
525 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
528 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
531 // Only if not trigger chamber
534 // Initialize hit position (cursor) in the segmentation model
535 //PH ((AliRICHChamber*) (*fChambers)[idvol])
536 ((AliRICHChamber*)fChambers->At(idvol))
537 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
542 // Calculate the charge induced on a pad (disintegration) in case
544 // Mip left chamber ...
545 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
546 gMC->SetMaxStep(kBig);
551 // Only if not trigger chamber
555 if(gMC->TrackPid() == kNeutron)
556 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
557 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip); //for MIP
563 if (fNsdigits > (Int_t)hits[8]) {
565 hits[9]= (Float_t) fNsdigits;
569 new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
572 // Check additional signal generation conditions
573 // defined by the segmentation
574 // model (boundary crossing conditions)
575 }else if(((AliRICHChamber*)fChambers->At(idvol))->SigGenCond(localPos[0], localPos[2], localPos[1])){
576 ((AliRICHChamber*)fChambers->At(idvol))->SigGenInit(localPos[0], localPos[2], localPos[1]);
579 if(gMC->TrackPid() == kNeutron)
580 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
581 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);//for n
588 // nothing special happened, add up energy loss
595 /*************************************************End of MIP treatment**************************************/
596 }//void AliRICHv3::StepManager()
597 //__________________________________________________________________________________________________
598 Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
599 {//calls the charge disintegration method of the current chamber and adds all generated sdigits to the list of digits
601 Float_t newclust[4][500];
606 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits,newclust, res);
608 for (Int_t i=0; i<iNdigits; i++) {
609 if (Int_t(newclust[0][i]) > 0) {
610 clhits[1] = Int_t(newclust[0][i]);// Cluster Charge
611 clhits[2] = Int_t(newclust[1][i]);// Pad: ix
612 clhits[3] = Int_t(newclust[2][i]);// Pad: iy
613 clhits[4] = Int_t(newclust[3][i]);// Pad: chamber sector
614 AddSpecialOld(clhits);
618 }//Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
619 //__________________________________________________________________________________________________
620 void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
623 Int_t NpadX = 162; // number of pads on X
624 Int_t NpadY = 162; // number of pads on Y
627 for (Int_t i=0;i<NpadX;i++) {
628 for (Int_t j=0;j<NpadY;j++) {
633 // Create some histograms
635 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
636 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
637 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
638 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
639 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
640 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
641 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
642 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
643 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
644 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
645 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
646 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
647 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
648 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
649 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
650 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
651 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
652 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
653 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
654 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
655 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
656 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
657 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
658 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
659 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
660 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
661 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
662 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
663 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
664 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
665 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
666 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
671 // Start loop over events
673 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
674 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
675 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
678 for (int nev=0; nev<= evNumber2; nev++) {
679 Int_t nparticles = gAlice->GetEvent(nev);
682 if (nev < evNumber1) continue;
683 if (nparticles <= 0) return;
685 // Get pointers to RICH detector and Hits containers
687 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
689 TTree *treeH = TreeH();
690 Int_t ntracks =(Int_t) treeH->GetEntries();
692 // Start loop on tracks in the hits containers
694 for (Int_t track=0; track<ntracks;track++) {
695 printf ("Processing Track: %d\n",track);
697 treeH->GetEvent(track);
699 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
701 mHit=(AliRICHhit*)pRICH->NextHit())
703 //Int_t nch = mHit->fChamber; // chamber number
704 //Float_t x = mHit->X(); // x-pos of hit
705 //Float_t y = mHit->Z(); // y-pos
706 //Float_t z = mHit->Y();
707 //Float_t phi = mHit->Phi(); //Phi angle of incidence
708 Float_t theta = mHit->Theta(); //Theta angle of incidence
709 Float_t px = mHit->MomX();
710 Float_t py = mHit->MomY();
711 Int_t index = mHit->Track();
712 Int_t particle = (Int_t)(mHit->Particle());
717 TParticle *current = gAlice->GetMCApp()->Particle(index);
719 //Float_t energy=current->Energy();
721 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
722 PTfinal=TMath::Sqrt(px*px + py*py);
723 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
727 if (TMath::Abs(particle) < 10000000)
729 hitsTheta->Fill(theta,(float) 1);
732 if (PTvertex>.5 && PTvertex<=1)
734 hitsTheta500MeV->Fill(theta,(float) 1);
736 if (PTvertex>1 && PTvertex<=2)
738 hitsTheta1GeV->Fill(theta,(float) 1);
740 if (PTvertex>2 && PTvertex<=3)
742 hitsTheta2GeV->Fill(theta,(float) 1);
746 hitsTheta3GeV->Fill(theta,(float) 1);
755 if (TMath::Abs(particle) < 50000051)
757 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
758 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
760 //gMC->Rndm(&random, 1);
761 if (random->Rndm() < .1)
762 production->Fill(current->Vz(),R,(float) 1);
763 if (TMath::Abs(particle) == 50000050)
764 //if (TMath::Abs(particle) > 50000000)
770 if (current->Energy()>0.001)
771 highprimaryphotons +=1;
774 if (TMath::Abs(particle) == 2112)
777 if (current->Energy()>0.0001)
781 if (TMath::Abs(particle) < 50000000)
783 production->Fill(current->Vz(),R,(float) 1);
785 //mip->Fill(x,y,(float) 1);
788 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
792 pionptspectravertex->Fill(PTvertex,(float) 1);
793 pionptspectrafinal->Fill(PTfinal,(float) 1);
797 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
798 || TMath::Abs(particle)==311)
802 kaonptspectravertex->Fill(PTvertex,(float) 1);
803 kaonptspectrafinal->Fill(PTfinal,(float) 1);
808 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
810 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
811 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
812 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
815 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
818 if (TMath::Abs(particle)==211)
824 if (current->Energy()>1)
825 highprimarypions +=1;
829 if (TMath::Abs(particle)==2212)
831 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
832 //ptspectra->Fill(Pt,(float) 1);
833 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
834 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
836 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
839 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
840 || TMath::Abs(particle)==311)
842 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
843 //ptspectra->Fill(Pt,(float) 1);
844 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
845 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
847 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
849 if (TMath::Abs(particle)==321)
855 if (current->Energy()>1)
856 highprimarykaons +=1;
860 if (TMath::Abs(particle)==11)
862 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
863 //ptspectra->Fill(Pt,(float) 1);
864 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
865 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
867 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
873 if (TMath::Abs(particle)==13)
875 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
876 //ptspectra->Fill(Pt,(float) 1);
877 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
878 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
880 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
883 if (TMath::Abs(particle)==2112)
885 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
886 //ptspectra->Fill(Pt,(float) 1);
887 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
888 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
891 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
895 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
897 if (current->Energy()-current->GetCalcMass()>1)
899 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
900 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
901 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
903 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
906 // Fill the histograms
908 //h->Fill(x,y,(float) 1);
918 TStyle *mystyle=new TStyle("Plain","mystyle");
919 mystyle->SetPalette(1,0);
922 //Create canvases, set the view range, show histograms
924 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
926 //c2->SetFillColor(42);
929 hitsTheta500MeV->SetFillColor(5);
930 hitsTheta500MeV->Draw();
932 hitsTheta1GeV->SetFillColor(5);
933 hitsTheta1GeV->Draw();
935 hitsTheta2GeV->SetFillColor(5);
936 hitsTheta2GeV->Draw();
938 hitsTheta3GeV->SetFillColor(5);
939 hitsTheta3GeV->Draw();
943 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
945 production->SetFillColor(42);
946 production->SetXTitle("z (m)");
947 production->SetYTitle("R (m)");
950 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
953 pionptspectravertex->SetFillColor(5);
954 pionptspectravertex->SetXTitle("Pt (GeV)");
955 pionptspectravertex->Draw();
957 pionptspectrafinal->SetFillColor(5);
958 pionptspectrafinal->SetXTitle("Pt (GeV)");
959 pionptspectrafinal->Draw();
961 kaonptspectravertex->SetFillColor(5);
962 kaonptspectravertex->SetXTitle("Pt (GeV)");
963 kaonptspectravertex->Draw();
965 kaonptspectrafinal->SetFillColor(5);
966 kaonptspectrafinal->SetXTitle("Pt (GeV)");
967 kaonptspectrafinal->Draw();
970 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
974 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
975 electronspectra1->SetFillColor(5);
976 electronspectra1->SetXTitle("log(GeV)");
977 electronspectra2->SetFillColor(46);
978 electronspectra2->SetXTitle("log(GeV)");
979 electronspectra3->SetFillColor(10);
980 electronspectra3->SetXTitle("log(GeV)");
982 electronspectra1->Draw();
983 electronspectra2->Draw("same");
984 electronspectra3->Draw("same");
987 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
988 muonspectra1->SetFillColor(5);
989 muonspectra1->SetXTitle("log(GeV)");
990 muonspectra2->SetFillColor(46);
991 muonspectra2->SetXTitle("log(GeV)");
992 muonspectra3->SetFillColor(10);
993 muonspectra3->SetXTitle("log(GeV)");
995 muonspectra1->Draw();
996 muonspectra2->Draw("same");
997 muonspectra3->Draw("same");
1000 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
1001 //neutronspectra1->SetFillColor(42);
1002 //neutronspectra1->SetXTitle("log(GeV)");
1003 //neutronspectra2->SetFillColor(46);
1004 //neutronspectra2->SetXTitle("log(GeV)");
1005 //neutronspectra3->SetFillColor(10);
1006 //neutronspectra3->SetXTitle("log(GeV)");
1008 //neutronspectra1->Draw();
1009 //neutronspectra2->Draw("same");
1010 //neutronspectra3->Draw("same");
1012 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
1013 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
1017 pionspectra1->SetFillColor(5);
1018 pionspectra1->SetXTitle("log(GeV)");
1019 pionspectra2->SetFillColor(46);
1020 pionspectra2->SetXTitle("log(GeV)");
1021 pionspectra3->SetFillColor(10);
1022 pionspectra3->SetXTitle("log(GeV)");
1024 pionspectra1->Draw();
1025 pionspectra2->Draw("same");
1026 pionspectra3->Draw("same");
1029 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
1030 protonspectra1->SetFillColor(5);
1031 protonspectra1->SetXTitle("log(GeV)");
1032 protonspectra2->SetFillColor(46);
1033 protonspectra2->SetXTitle("log(GeV)");
1034 protonspectra3->SetFillColor(10);
1035 protonspectra3->SetXTitle("log(GeV)");
1037 protonspectra1->Draw();
1038 protonspectra2->Draw("same");
1039 protonspectra3->Draw("same");
1042 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
1043 kaonspectra1->SetFillColor(5);
1044 kaonspectra1->SetXTitle("log(GeV)");
1045 kaonspectra2->SetFillColor(46);
1046 kaonspectra2->SetXTitle("log(GeV)");
1047 kaonspectra3->SetFillColor(10);
1048 kaonspectra3->SetXTitle("log(GeV)");
1050 kaonspectra1->Draw();
1051 kaonspectra2->Draw("same");
1052 kaonspectra3->Draw("same");
1055 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
1056 chargedspectra1->SetFillColor(5);
1057 chargedspectra1->SetXTitle("log(GeV)");
1058 chargedspectra2->SetFillColor(46);
1059 chargedspectra2->SetXTitle("log(GeV)");
1060 chargedspectra3->SetFillColor(10);
1061 chargedspectra3->SetXTitle("log(GeV)");
1063 chargedspectra1->Draw();
1064 chargedspectra2->Draw("same");
1065 chargedspectra3->Draw("same");
1069 printf("*****************************************\n");
1070 printf("* Particle * Counts *\n");
1071 printf("*****************************************\n");
1073 printf("* Pions: * %4d *\n",pion);
1074 printf("* Charged Pions: * %4d *\n",chargedpions);
1075 printf("* Primary Pions: * %4d *\n",primarypions);
1076 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
1077 printf("* Kaons: * %4d *\n",kaon);
1078 printf("* Charged Kaons: * %4d *\n",chargedkaons);
1079 printf("* Primary Kaons: * %4d *\n",primarykaons);
1080 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
1081 printf("* Muons: * %4d *\n",muon);
1082 printf("* Electrons: * %4d *\n",electron);
1083 printf("* Positrons: * %4d *\n",positron);
1084 printf("* Protons: * %4d *\n",proton);
1085 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
1086 printf("*****************************************\n");
1087 //printf("* Photons: * %3.1f *\n",photons);
1088 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
1089 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
1090 //printf("*****************************************\n");
1091 //printf("* Neutrons: * %3.1f *\n",neutron);
1092 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
1093 //printf("*****************************************\n");
1095 if (gAlice->TreeD())
1097 gAlice->TreeD()->GetEvent(0);
1102 printf("\n*****************************************\n");
1103 printf("* Chamber * Digits * Occupancy *\n");
1104 printf("*****************************************\n");
1106 for (Int_t ich=0;ich<7;ich++)
1108 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
1109 Int_t ndigits = Digits->GetEntriesFast();
1110 occ[ich] = Float_t(ndigits)/(160*144);
1111 sum += Float_t(ndigits)/(160*144);
1112 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
1115 printf("*****************************************\n");
1116 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
1117 printf("*****************************************\n");
1120 printf("\nEnd of analysis\n");
1122 }//void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1123 //__________________________________________________________________________________________________