]>
Commit | Line | Data |
---|---|---|
d3da6dc4 | 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() | |
97eadc2b | 25 | #include <TGeoPhysicalNode.h> //ctor |
ae5a42aa | 26 | #include <TGeoBBox.h> |
d3da6dc4 | 27 | ClassImp(AliHMPIDParam) |
28 | ||
ae5a42aa | 29 | |
30 | Float_t AliHMPIDParam::fgkMinPcX[]={0.,0.,0.,0.,0.,0.}; | |
31 | Float_t AliHMPIDParam::fgkMaxPcX[]={0.,0.,0.,0.,0.,0.}; | |
32 | Float_t AliHMPIDParam::fgkMinPcY[]={0.,0.,0.,0.,0.,0.}; | |
33 | Float_t AliHMPIDParam::fgkMaxPcY[]={0.,0.,0.,0.,0.,0.}; | |
34 | ||
35 | Float_t AliHMPIDParam::fgCellX=0.; | |
36 | Float_t AliHMPIDParam::fgCellY=0.; | |
37 | ||
38 | Float_t AliHMPIDParam::fgPcX=0; | |
39 | Float_t AliHMPIDParam::fgPcY=0; | |
40 | ||
41 | Float_t AliHMPIDParam::fgAllX=0; | |
42 | Float_t AliHMPIDParam::fgAllY=0; | |
43 | ||
44 | Int_t AliHMPIDParam::fgSigmas=4; | |
45 | ||
d3da6dc4 | 46 | AliHMPIDParam* AliHMPIDParam::fgInstance=0x0; //singleton pointer |
47 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
58fc9564 | 48 | AliHMPIDParam::AliHMPIDParam(Bool_t noGeo=kFALSE):TNamed("HmpidParam","default version") |
d3da6dc4 | 49 | { |
50 | // Here all the intitializition is taken place when AliHMPIDParam::Instance() is invoked for the first time. | |
58fc9564 | 51 | // In particular, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure. |
d3da6dc4 | 52 | // Note that TGeoManager should be already initialized from geometry.root file |
ae5a42aa | 53 | |
8e2a911a | 54 | Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1 |
58fc9564 | 55 | |
56 | if(noGeo==kFALSE && !gGeoManager) | |
57 | { | |
58 | TGeoManager::Import("geometry.root"); | |
59 | if(!gGeoManager) AliFatal("!!!!!!No geometry loaded!!!!!!!"); | |
60 | } | |
61 | ||
8e2a911a | 62 | fgCellX=0.8;fgCellY=0.84; |
58fc9564 | 63 | |
8e2a911a | 64 | if(!noGeo==kTRUE){ |
65 | TGeoVolume *pCellVol = gGeoManager->GetVolume("Hcel"); | |
66 | if(pCellVol) { | |
67 | TGeoBBox *bcell = (TGeoBBox *)pCellVol->GetShape(); | |
68 | fgCellX=2.*bcell->GetDX(); fgCellY = 2.*bcell->GetDY(); // overwrite the values with the read ones | |
69 | } | |
70 | } | |
58fc9564 | 71 | fgPcX=80.*fgCellX; fgPcY = 48.*fgCellY; |
72 | fgAllX=2.*fgPcX+dead; | |
73 | fgAllY=3.*fgPcY+2.*dead; | |
ae5a42aa | 74 | |
58fc9564 | 75 | fgkMinPcX[1]=fgPcX+dead; fgkMinPcX[3]=fgkMinPcX[1]; fgkMinPcX[5]=fgkMinPcX[3]; |
76 | fgkMaxPcX[0]=fgPcX; fgkMaxPcX[2]=fgkMaxPcX[0]; fgkMaxPcX[4]=fgkMaxPcX[2]; | |
77 | fgkMaxPcX[1]=fgAllX; fgkMaxPcX[3]=fgkMaxPcX[1]; fgkMaxPcX[5]=fgkMaxPcX[3]; | |
ae5a42aa | 78 | |
58fc9564 | 79 | fgkMinPcY[2]=fgPcY+dead; fgkMinPcY[3]=fgkMinPcY[2]; |
80 | fgkMinPcY[4]=2.*fgPcY+2.*dead; fgkMinPcY[5]=fgkMinPcY[4]; | |
81 | fgkMaxPcY[0]=fgPcY; fgkMaxPcY[1]=fgkMaxPcY[0]; | |
82 | fgkMaxPcY[2]=2.*fgPcY+dead; fgkMaxPcY[3]=fgkMaxPcY[2]; | |
83 | fgkMaxPcY[4]=fgAllY; fgkMaxPcY[5]=fgkMaxPcY[4]; | |
ae5a42aa | 84 | |
85 | fX=0.5*SizeAllX(); | |
86 | fY=0.5*SizeAllY(); | |
58fc9564 | 87 | |
ae5a42aa | 88 | for(Int_t i=kMinCh;i<=kMaxCh;i++) |
97eadc2b | 89 | if(gGeoManager && gGeoManager->IsClosed()) { |
2df6b16e | 90 | TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("/HMPID/Chamber%i",i)); |
97eadc2b | 91 | if (!pne) { |
92 | AliErrorClass(Form("The symbolic volume %s does not correspond to any physical entry!",Form("HMPID_%i",i))); | |
93 | fM[i]=new TGeoHMatrix; | |
94 | IdealPosition(i,fM[i]); | |
95 | } else { | |
96 | TGeoPhysicalNode *pnode = pne->GetPhysicalNode(); | |
f80e1da4 | 97 | if(pnode) fM[i]=pnode->GetMatrix(); |
98 | else { | |
99 | fM[i]=new TGeoHMatrix; | |
100 | IdealPosition(i,fM[i]); | |
101 | } | |
97eadc2b | 102 | } |
103 | } else{ | |
1d4857c5 | 104 | fM[i]=new TGeoHMatrix; |
105 | IdealPosition(i,fM[i]); | |
106 | } | |
d3da6dc4 | 107 | fgInstance=this; |
108 | }//ctor | |
109 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
110 | void AliHMPIDParam::Print(Option_t* opt) const | |
111 | { | |
112 | // print some usefull (hopefully) info on some internal guts of HMPID parametrisation | |
113 | ||
114 | for(Int_t i=0;i<7;i++) fM[i]->Print(opt); | |
115 | }//Print() | |
116 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1d4857c5 | 117 | void AliHMPIDParam::IdealPosition(Int_t iCh, TGeoHMatrix *pMatrix) |
118 | { | |
119 | // Construct ideal position matrix for a given chamber | |
120 | // Arguments: iCh- chamber ID; pMatrix- pointer to precreated unity matrix where to store the results | |
121 | // Returns: none | |
423554a3 | 122 | const Double_t kAngHor=19.5; // horizontal angle between chambers 19.5 grad |
123 | const Double_t kAngVer=20; // vertical angle between chambers 20 grad | |
124 | const Double_t kAngCom=30; // common HMPID rotation with respect to x axis 30 grad | |
125 | const Double_t kTrans[3]={490,0,0}; // center of the chamber is on window-gap surface | |
126 | pMatrix->RotateY(90); // rotate around y since initial position is in XY plane -> now in YZ plane | |
127 | pMatrix->SetTranslation(kTrans); // now plane in YZ is shifted along x | |
1d4857c5 | 128 | switch(iCh){ |
129 | case 0: pMatrix->RotateY(kAngHor); pMatrix->RotateZ(-kAngVer); break; //right and down | |
130 | case 1: pMatrix->RotateZ(-kAngVer); break; //down | |
131 | case 2: pMatrix->RotateY(kAngHor); break; //right | |
132 | case 3: break; //no rotation | |
133 | case 4: pMatrix->RotateY(-kAngHor); break; //left | |
134 | case 5: pMatrix->RotateZ(kAngVer); break; //up | |
135 | case 6: pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer); break; //left and up | |
136 | } | |
137 | pMatrix->RotateZ(kAngCom); //apply common rotation in XY plane | |
138 | ||
139 | } | |
140 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
d3da6dc4 | 141 | Int_t AliHMPIDParam::Stack(Int_t evt,Int_t tid) |
142 | { | |
d1bf51e1 | 143 | // Prints some useful info from stack |
d3da6dc4 | 144 | // Arguments: evt - event number. if not -1 print info only for that event |
145 | // tid - track id. if not -1 then print it and all it's mothers if any | |
146 | // Returns: mother tid of the given tid if any | |
147 | AliRunLoader *pAL=AliRunLoader::Open(); | |
148 | if(pAL->LoadHeader()) return -1; | |
149 | if(pAL->LoadKinematics()) return -1; | |
150 | ||
151 | Int_t mtid=-1; | |
cf7e313e | 152 | Int_t iNevt=pAL->GetNumberOfEvents(); |
d3da6dc4 | 153 | |
154 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//events loop | |
155 | if(evt!=-1 && evt!=iEvt) continue; //in case one needs to print the requested event, ignore all others | |
156 | pAL->GetEvent(iEvt); | |
157 | AliStack *pStack=pAL->Stack(); | |
158 | if(tid==-1){ //print all tids for this event | |
159 | for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print(); | |
160 | Printf("totally %i tracks including %i primaries for event %i out of %i event(s)",pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt); | |
161 | }else{ //print only this tid and it;s mothers | |
162 | if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;} | |
163 | TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother(); | |
164 | TString str=pTrack->GetName(); | |
165 | while((tid=pTrack->GetFirstMother()) >= 0){ | |
166 | pTrack=pStack->Particle(tid); | |
167 | str+=" from ";str+=pTrack->GetName(); | |
168 | } | |
d3da6dc4 | 169 | }//if(tid==-1) |
170 | }//events loop | |
171 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
172 | return mtid; | |
173 | } | |
174 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
175 | Int_t AliHMPIDParam::StackCount(Int_t pid,Int_t evt) | |
176 | { | |
177 | // Counts total number of particles of given sort (including secondary) for a given event | |
178 | AliRunLoader *pAL=AliRunLoader::Open(); | |
179 | pAL->GetEvent(evt); | |
180 | if(pAL->LoadHeader()) return 0; | |
181 | if(pAL->LoadKinematics()) return 0; | |
182 | AliStack *pStack=pAL->Stack(); | |
183 | ||
184 | Int_t iCnt=0; | |
185 | for(Int_t i=0;i<pStack->GetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++; | |
186 | ||
187 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
188 | return iCnt; | |
189 | } | |
190 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |