]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHParam.cxx
MAJOR UPGRADE: 1. all objects are counted from 0 2. new AliRICHRecon 3. calib off...
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
CommitLineData
53fd478b 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// **************************************************************************
e30ca504 15#include "AliRICHParam.h" //class header
16#include "AliRICHDigit.h" //ctor
17#include <TCanvas.h> //TestXXX()
18#include <TLatex.h> //TestTrans()
19#include <TView.h> //TestTrans()
20#include <TPolyMarker3D.h> //TestTrans()
d0831219 21#include <TRotation.h>
db910db9 22#include <AliRunLoader.h> //Stack()
23#include <AliStack.h> //Stack()
24#include <TParticle.h> //Stack()
25#include "AliRICHHelix.h" //TestTrans()
56148d0e 26
ed3ceb24 27ClassImp(AliRICHParam)
e30ca504 28
29AliRICHParam* AliRICHParam::fgInstance=0x0; //singleton pointer
db910db9 30//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31AliRICHParam::AliRICHParam():TNamed("RichParam","default version")
e42a7b46 32{
db910db9 33// Here all the intitializition is taken place when AliRICHParam::Instance() is invoked for the first time.
34// In particulare, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure.
35// Note that TGeoManager should be already initialized from geometry.root file
e30ca504 36 fX=0.5*AliRICHDigit::SizeAllX();
37 fY=0.5*AliRICHDigit::SizeAllY();
38 for(Int_t i=0;i<7;i++) fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("RICH_%i",i))->GetMatrix();
db910db9 39 fgInstance=this;
40}//ctor
41//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 42void AliRICHParam::Print(Option_t* opt) const
43{
44// print some usefull (hopefully) info on some internal guts of RICH parametrisation
db910db9 45
e30ca504 46 for(Int_t i=0;i<7;i++) fM[i]->Print(opt);
db910db9 47}//Print()
48//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 49Int_t AliRICHParam::Stack(Int_t evt,Int_t tid)
50{
51// Prints some usefull info from stack
52// Arguments: evt - event number. if not -1 print info only for that event
53// tid - track id. if not -1 then print it and all it's mothers if any
54// Returns: mother tid of the given tid if any
55 AliRunLoader *pAL=AliRunLoader::Open();
56 if(pAL->LoadHeader()) return -1;
57 if(pAL->LoadKinematics()) return -1;
58
59 Int_t mtid=-1;
60 Int_t iNevt=pAL->GetNumberOfEvents(); Printf("This session contains %i event(s)",iNevt);
61
62 for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//events loop
63 if(evt!=-1 && evt!=iEvt) continue; //in case one needs to print the requested event, ignore all others
64 pAL->GetEvent(iEvt);
65 AliStack *pStack=pAL->Stack();
66 if(tid==-1){ //print all tids for this event
67 for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print();
68 Printf("totally %i tracks including %i primaries for event %i out of %i event(s)",pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt);
69 }else{ //print only this tid and it;s mothers
70 if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;}
71 TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother();
72 TString str=pTrack->GetName();
73 while((tid=pTrack->GetFirstMother()) >= 0){
74 pTrack=pStack->Particle(tid);
75 str+=" from ";str+=pTrack->GetName();
76 }
77 Printf("%s",str.Data());
78 }//if(tid==-1)
79 }//events loop
80 pAL->UnloadHeader(); pAL->UnloadKinematics();
81 return mtid;
82}
83//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
84Int_t AliRICHParam::StackCount(Int_t pid,Int_t evt)
85{
86// Counts total number of particles of given sort (including secondary) for a given event
87 AliRunLoader *pAL=AliRunLoader::Open();
88 pAL->GetEvent(evt);
89 if(pAL->LoadHeader()) return 0;
90 if(pAL->LoadKinematics()) return 0;
91 AliStack *pStack=pAL->Stack();
92
93 Int_t iCnt=0;
94 for(Int_t i=0;i<pStack->GetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++;
95
96 pAL->UnloadHeader(); pAL->UnloadKinematics();
97 return iCnt;
98}
99//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++