]>
Commit | Line | Data |
---|---|---|
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 | #include "AliHMPIDParam.h" //class header | |
16 | #include "AliHMPIDDigit.h" //ctor | |
17 | #include <TCanvas.h> //TestXXX() | |
18 | #include <TLatex.h> //TestTrans() | |
19 | #include <TView.h> //TestTrans() | |
20 | #include <TPolyMarker3D.h> //TestTrans() | |
21 | #include <TRotation.h> | |
22 | #include <AliRunLoader.h> //Stack() | |
23 | #include <AliStack.h> //Stack() | |
24 | #include <TParticle.h> //Stack() | |
25 | #include <TGeoPhysicalNode.h> //ctor | |
26 | ||
27 | ClassImp(AliHMPIDParam) | |
28 | ||
29 | AliHMPIDParam* AliHMPIDParam::fgInstance=0x0; //singleton pointer | |
30 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
31 | AliHMPIDParam::AliHMPIDParam():TNamed("HmpidParam","default version") | |
32 | { | |
33 | // Here all the intitializition is taken place when AliHMPIDParam::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 | |
36 | fX=0.5*AliHMPIDDigit::SizeAllX(); | |
37 | fY=0.5*AliHMPIDDigit::SizeAllY(); | |
38 | for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) | |
39 | if(gGeoManager && gGeoManager->IsClosed()) { | |
40 | // fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("HMPID_%i",i))->GetMatrix(); // previous style | |
41 | TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("/HMPID/Chamber%i",i)); | |
42 | if (!pne) { | |
43 | AliErrorClass(Form("The symbolic volume %s does not correspond to any physical entry!",Form("HMPID_%i",i))); | |
44 | fM[i]=new TGeoHMatrix; | |
45 | IdealPosition(i,fM[i]); | |
46 | } else { | |
47 | TGeoPhysicalNode *pnode = pne->GetPhysicalNode(); | |
48 | if(pnode) fM[i]=pnode->GetMatrix(); | |
49 | else { | |
50 | fM[i]=new TGeoHMatrix; | |
51 | IdealPosition(i,fM[i]); | |
52 | } | |
53 | } | |
54 | } else{ | |
55 | fM[i]=new TGeoHMatrix; | |
56 | IdealPosition(i,fM[i]); | |
57 | } | |
58 | fgInstance=this; | |
59 | }//ctor | |
60 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
61 | void AliHMPIDParam::Print(Option_t* opt) const | |
62 | { | |
63 | // print some usefull (hopefully) info on some internal guts of HMPID parametrisation | |
64 | ||
65 | for(Int_t i=0;i<7;i++) fM[i]->Print(opt); | |
66 | }//Print() | |
67 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
68 | void AliHMPIDParam::IdealPosition(Int_t iCh, TGeoHMatrix *pMatrix) | |
69 | { | |
70 | // Construct ideal position matrix for a given chamber | |
71 | // Arguments: iCh- chamber ID; pMatrix- pointer to precreated unity matrix where to store the results | |
72 | // Returns: none | |
73 | const Double_t kAngHor=19.5; // horizontal angle between chambers 19.5 grad | |
74 | const Double_t kAngVer=20; // vertical angle between chambers 20 grad | |
75 | const Double_t kAngCom=30; // common HMPID rotation with respect to x axis 30 grad | |
76 | const Double_t kTrans[3]={490,0,0}; // center of the chamber is on window-gap surface | |
77 | pMatrix->RotateY(90); // rotate around y since initial position is in XY plane -> now in YZ plane | |
78 | pMatrix->SetTranslation(kTrans); // now plane in YZ is shifted along x | |
79 | switch(iCh){ | |
80 | case 0: pMatrix->RotateY(kAngHor); pMatrix->RotateZ(-kAngVer); break; //right and down | |
81 | case 1: pMatrix->RotateZ(-kAngVer); break; //down | |
82 | case 2: pMatrix->RotateY(kAngHor); break; //right | |
83 | case 3: break; //no rotation | |
84 | case 4: pMatrix->RotateY(-kAngHor); break; //left | |
85 | case 5: pMatrix->RotateZ(kAngVer); break; //up | |
86 | case 6: pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer); break; //left and up | |
87 | } | |
88 | pMatrix->RotateZ(kAngCom); //apply common rotation in XY plane | |
89 | ||
90 | } | |
91 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
92 | Int_t AliHMPIDParam::Stack(Int_t evt,Int_t tid) | |
93 | { | |
94 | // Prints some useful info from stack | |
95 | // Arguments: evt - event number. if not -1 print info only for that event | |
96 | // tid - track id. if not -1 then print it and all it's mothers if any | |
97 | // Returns: mother tid of the given tid if any | |
98 | AliRunLoader *pAL=AliRunLoader::Open(); | |
99 | if(pAL->LoadHeader()) return -1; | |
100 | if(pAL->LoadKinematics()) return -1; | |
101 | ||
102 | Int_t mtid=-1; | |
103 | Int_t iNevt=pAL->GetNumberOfEvents(); | |
104 | ||
105 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//events loop | |
106 | if(evt!=-1 && evt!=iEvt) continue; //in case one needs to print the requested event, ignore all others | |
107 | pAL->GetEvent(iEvt); | |
108 | AliStack *pStack=pAL->Stack(); | |
109 | if(tid==-1){ //print all tids for this event | |
110 | for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print(); | |
111 | Printf("totally %i tracks including %i primaries for event %i out of %i event(s)",pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt); | |
112 | }else{ //print only this tid and it;s mothers | |
113 | if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;} | |
114 | TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother(); | |
115 | TString str=pTrack->GetName(); | |
116 | while((tid=pTrack->GetFirstMother()) >= 0){ | |
117 | pTrack=pStack->Particle(tid); | |
118 | str+=" from ";str+=pTrack->GetName(); | |
119 | } | |
120 | }//if(tid==-1) | |
121 | }//events loop | |
122 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
123 | return mtid; | |
124 | } | |
125 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
126 | Int_t AliHMPIDParam::StackCount(Int_t pid,Int_t evt) | |
127 | { | |
128 | // Counts total number of particles of given sort (including secondary) for a given event | |
129 | AliRunLoader *pAL=AliRunLoader::Open(); | |
130 | pAL->GetEvent(evt); | |
131 | if(pAL->LoadHeader()) return 0; | |
132 | if(pAL->LoadKinematics()) return 0; | |
133 | AliStack *pStack=pAL->Stack(); | |
134 | ||
135 | Int_t iCnt=0; | |
136 | for(Int_t i=0;i<pStack->GetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++; | |
137 | ||
138 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
139 | return iCnt; | |
140 | } | |
141 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |