]>
Commit | Line | Data |
---|---|---|
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 | // ************************************************************************** | |
4c039060 | 15 | |
53fd478b | 16 | #include "AliRICH.h" |
17 | #include "AliRICHParam.h" | |
18 | #include "AliRICHChamber.h" | |
d3eb6079 | 19 | #include "AliRICHTracker.h" |
56030c8d | 20 | #include "AliRICHHelix.h" |
d3eb6079 | 21 | //#include <TArrayF.h> |
543d5224 | 22 | #include <TGeometry.h> |
116cbefd | 23 | #include <TBRIK.h> |
543d5224 | 24 | #include <TTUBE.h> |
237c933d | 25 | #include <TFile.h> |
116cbefd | 26 | #include <TNode.h> |
27 | #include <TObjArray.h> | |
3582c1f9 | 28 | #include <TParticle.h> |
29 | #include <AliStack.h> | |
c60862bf | 30 | #include <AliMagF.h> |
c60862bf | 31 | #include <AliRun.h> |
32 | #include <AliRunDigitizer.h> | |
53fd478b | 33 | #include <AliMC.h> |
e42a7b46 | 34 | #include <AliESD.h> |
5d12ce38 | 35 | #include <TVirtualMC.h> |
e42a7b46 | 36 | #include <TH1F.h> |
37 | #include <TH2F.h> | |
d3eb6079 | 38 | #include <TBenchmark.h> |
998b831f | 39 | #include <AliLog.h> |
d3eb6079 | 40 | #include <TNtupleD.h> |
41 | #include <AliTracker.h> | |
42 | #include <AliRawDataHeader.h> | |
0fe8fa07 | 43 | #include <TLatex.h> //Display() |
44 | #include <TCanvas.h> //Display() | |
56030c8d | 45 | #include <TGraph.h> //Display() |
f770edb5 | 46 | #include <TStyle.h> //Display() |
47 | #include <TMarker.h> //Display() | |
ddae0931 | 48 | |
c60862bf | 49 | ClassImp(AliRICH) |
50 | //__________________________________________________________________________________________________ | |
15d8311d | 51 | // RICH manager class |
c60862bf | 52 | //BEGIN_HTML |
15d8311d | 53 | /* |
54 | <img src="gif/alirich.gif"> | |
55 | */ | |
c60862bf | 56 | //END_HTML |
57 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 58 | AliRICH::AliRICH():AliDetector(),fParam(0), fSdigits(0),fNsdigits(0),fDigs(0),fClus(0) |
53fd478b | 59 | { |
60 | //Default ctor should not contain any new operators | |
543d5224 | 61 | //AliDetector ctor deals with Hits and Digits |
0fe8fa07 | 62 | for(int i=0;i<kNchambers;i++) fNdigs[i] =0; |
63 | for(int i=0;i<kNchambers;i++) fNclus[i]=0; | |
e42a7b46 | 64 | // fCounters.ResizeTo(20); fCounters.Zero(); |
15d8311d | 65 | }//AliRICH::AliRICH() |
c021cb15 | 66 | //__________________________________________________________________________________________________ |
fe4da5cc | 67 | AliRICH::AliRICH(const char *name, const char *title) |
0fe8fa07 | 68 | :AliDetector(name,title),fParam(new AliRICHParam),fSdigits(0),fNsdigits(0),fDigs(0),fClus(0) |
53fd478b | 69 | { |
70 | //Named ctor | |
998b831f | 71 | AliDebug(1,"Start."); |
543d5224 | 72 | //AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them) |
0fe8fa07 | 73 | HitsCreate(); gAlice->GetMCApp()->AddHitList(fHits); |
e42a7b46 | 74 | fCounters.ResizeTo(20); fCounters.Zero(); |
998b831f | 75 | AliDebug(1,"Stop."); |
dfb4e77d | 76 | }//AliRICH::AliRICH(const char *name, const char *title) |
c021cb15 | 77 | //__________________________________________________________________________________________________ |
fe4da5cc | 78 | AliRICH::~AliRICH() |
53fd478b | 79 | { |
80 | //dtor | |
998b831f | 81 | AliDebug(1,"Start."); |
237c933d | 82 | |
0fe8fa07 | 83 | if(fParam) delete fParam; |
c60862bf | 84 | |
85 | if(fHits) delete fHits; | |
86 | if(fSdigits) delete fSdigits; | |
87 | if(fDigits) delete fDigits; | |
0fe8fa07 | 88 | if(fDigs) {fDigs->Delete(); delete fDigs;} |
89 | if(fClus) {fClus->Delete(); delete fClus;} | |
998b831f | 90 | AliDebug(1,"Stop."); |
dfb4e77d | 91 | }//AliRICH::~AliRICH() |
c021cb15 | 92 | //__________________________________________________________________________________________________ |
3ea9cb08 | 93 | void AliRICH::Hits2SDigits() |
53fd478b | 94 | { |
3582c1f9 | 95 | // Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits. |
998b831f | 96 | AliDebug(1,"Start."); |
3582c1f9 | 97 | for(Int_t iEventN=0;iEventN<GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEventN++){//events loop |
e42a7b46 | 98 | GetLoader()->GetRunLoader()->GetEvent(iEventN);//get next event |
3582c1f9 | 99 | |
e42a7b46 | 100 | if(!GetLoader()->TreeH()) GetLoader()->LoadHits(); GetLoader()->GetRunLoader()->LoadHeader(); |
d0831219 | 101 | if(!GetLoader()->GetRunLoader()->TreeK()) GetLoader()->GetRunLoader()->LoadKinematics();//from |
e42a7b46 | 102 | if(!GetLoader()->TreeS()) GetLoader()->MakeTree("S"); MakeBranch("S");//to |
3582c1f9 | 103 | |
104 | for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop | |
e42a7b46 | 105 | GetLoader()->TreeH()->GetEntry(iPrimN); |
3582c1f9 | 106 | for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop |
0fe8fa07 | 107 | AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN);//get current hit |
d3eb6079 | 108 | TVector2 x2 = C(pHit->C())->Mrs2Anod(0.5*(pHit->InX3()+pHit->OutX3()));//hit position in the anod plane |
e42a7b46 | 109 | Int_t iTotQdc=P()->TotQdc(x2,pHit->Eloss());//total charge produced by hit, 0 if hit in dead zone |
09c52ebc | 110 | if(iTotQdc==0) continue; |
1cb5a97c | 111 | // |
112 | //need to quantize the anod.... | |
113 | TVector padHit=AliRICHParam::Loc2Pad(x2); | |
114 | TVector2 padHitXY=AliRICHParam::Pad2Loc(padHit); | |
115 | TVector2 anod; | |
116 | if((x2.Y()-padHitXY.Y())>0) anod.Set(x2.X(),padHitXY.Y()+AliRICHParam::PitchAnod()/2); | |
117 | else anod.Set(x2.X(),padHitXY.Y()-AliRICHParam::PitchAnod()/2); | |
118 | //end to quantize anod | |
119 | // | |
120 | TVector area=P()->Loc2Area(anod);//determine affected pads, dead zones analysed inside | |
121 | AliDebug(1,Form("hitanod(%6.2f,%6.2f)->area(%3.0f,%3.0f)-(%3.0f,%3.0f) QDC=%4i",anod.X(),anod.Y(),area[0],area[1],area[2],area[3],iTotQdc)); | |
e42a7b46 | 122 | TVector pad(2); |
123 | for(pad[1]=area[1];pad[1]<=area[3];pad[1]++)//affected pads loop | |
124 | for(pad[0]=area[0];pad[0]<=area[2];pad[0]++){ | |
1cb5a97c | 125 | Double_t padQdc=iTotQdc*P()->FracQdc(anod,pad); |
998b831f | 126 | AliDebug(1,Form("current pad(%3.0f,%3.0f) with QDC =%6.2f",pad[0],pad[1],padQdc)); |
0fe8fa07 | 127 | if(padQdc>0.1) SDigitAdd(pHit->C(),pad,padQdc,GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack()); |
3582c1f9 | 128 | }//affected pads loop |
129 | }//hits loop | |
130 | }//prims loop | |
e42a7b46 | 131 | GetLoader()->TreeS()->Fill(); |
132 | GetLoader()->WriteSDigits("OVERWRITE"); | |
d0831219 | 133 | SDigitsReset(); |
3582c1f9 | 134 | }//events loop |
e42a7b46 | 135 | GetLoader()->UnloadHits(); GetLoader()->GetRunLoader()->UnloadHeader(); GetLoader()->GetRunLoader()->UnloadKinematics(); |
3582c1f9 | 136 | GetLoader()->UnloadSDigits(); |
998b831f | 137 | AliDebug(1,"Stop."); |
3582c1f9 | 138 | }//Hits2SDigits() |
c021cb15 | 139 | //__________________________________________________________________________________________________ |
d3eb6079 | 140 | void AliRICH::Digits2Raw() |
141 | { | |
142 | //Loops over all digits and creates raw data files in DDL format. GetEvent() is done outside (AliSimulation) | |
0fe8fa07 | 143 | //RICH has 2 DDL per chamber, even number for right part(2-4-6) odd number for left part(1-3-5) |
144 | //RICH has no any propriate header just uses the common one | |
145 | //Each PC is divided by 8 rows counted from 1 to 8 from top to bottom for left PCs(1-3-5) and from bottom to top for right PCc(2-4-6) (denoted rrrrr 5 bits 32 values) | |
146 | //Each raw is composed from 10 DILOGIC chips counted from left to right from 1 to 10 (denoted dddd 4 bits 16 values) | |
147 | //Each DILOGIC chip serves 48 channels counted from 0 to 47 (denoted aaaaaa 6 bits 64 values) | |
148 | //So RICH info word is 32 bits word with structure: 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq (five 0 five r six a twelve q) with QDC (denoted q...q 12 bits 4096 values) | |
d3eb6079 | 149 | AliDebug(1,"Start."); |
150 | GetLoader()->LoadDigits(); | |
151 | GetLoader()->TreeD()->GetEntry(0); | |
152 | ||
153 | Int_t kRichOffset=0x700; //currently one DDL per 3 sectors | |
154 | ||
155 | ofstream file135,file246;//output streams 2 DDL per chamber | |
156 | AliRawDataHeader header;//empty DDL miniheader | |
157 | UInt_t word32=1; //32 bits data word | |
158 | ||
159 | for(Int_t iChN=1;iChN<=kNchambers;iChN++){ //2 DDL per chamber open both in parallel | |
0fe8fa07 | 160 | file135.open(Form("RICH_%4i.ddl",kRichOffset+2*iChN-1)); //left part of chamber; sectors 1-3-5 odd DDL number |
161 | file246.open(Form("RICH_%4i.ddl",kRichOffset+2*iChN)); //right part of chamber; sectors 2-4-6 even DDL number | |
d3eb6079 | 162 | //common DDL header defined by standart, now dummy as the total number of bytes is not yet known |
163 | file135.write((char*)&header,sizeof(header)); //dummy header just place holder | |
164 | file246.write((char*)&header,sizeof(header)); //actual will be written later | |
d3eb6079 | 165 | |
166 | Int_t counter135=0,counter246=0;//counts total number of records per DDL | |
167 | ||
168 | for(Int_t iDigN=0;iDigN<Digits(iChN)->GetEntriesFast();iDigN++){//digits loop for a given chamber | |
0fe8fa07 | 169 | AliRICHDigit *pDig=(AliRICHDigit*)Digits(iChN)->At(iDigN); |
170 | word32=UInt_t (pDig->Q()+0x400*pDig->X()+0x4000*pDig->Y()); //arbitrary structure | |
d3eb6079 | 171 | switch(pDig->S()){//readout by vertical sectors: 1,3,5-left DDL 2,4,6-right DDL |
172 | case 1: case 3: case 5: file135.write((char*)&word32,sizeof(word32)); counter135++; break; | |
173 | case 2: case 4: case 6: file246.write((char*)&word32,sizeof(word32)); counter246++; break; | |
174 | }//switch sector | |
175 | }//digits loop for a given chamber | |
176 | //now count total byte number for each DDL file and rewrite actual header | |
177 | header.fSize=sizeof(header)+counter135*sizeof(word32); header.SetAttribute(0); file135.seekp(0); file135.write((char*)&header,sizeof(header)); | |
178 | header.fSize=sizeof(header)+counter246*sizeof(word32); header.SetAttribute(0); file246.seekp(0); file246.write((char*)&header,sizeof(header)); | |
179 | file135.close(); file246.close(); | |
180 | }//chambers loop | |
181 | GetLoader()->UnloadDigits(); | |
182 | AliDebug(1,"Stop."); | |
183 | }//Digits2Raw() | |
184 | //__________________________________________________________________________________________________ | |
dfb4e77d | 185 | void AliRICH::BuildGeometry() |
53fd478b | 186 | { |
187 | //Builds a TNode geometry for event display | |
998b831f | 188 | AliInfo("Start."); |
237c933d | 189 | |
3ea9cb08 | 190 | TNode *node, *subnode, *top; |
191 | top=gAlice->GetGeometry()->GetNode("alice"); | |
53d98323 | 192 | |
a25b3368 | 193 | Float_t widx =P()->SectorSizeX(); |
194 | Float_t leny =P()->SectorSizeY(); | |
195 | Float_t dz =P()->Zfreon()+P()->Zwin()+P()->Pc2Win(); | |
196 | Float_t dead =P()->DeadZone(); | |
998b831f | 197 | |
198 | new TBRIK("RICH","RICH","void",widx+dead/2,leny+leny/2+dead,dz+0.1); //RICH chamber | |
199 | new TBRIK("RPC" ,"RPC" ,"void",widx/2,leny/2,0.01); //RICH sector | |
200 | ||
a25b3368 | 201 | for(int i=1;i<=P()->Nchambers();i++){ |
237c933d | 202 | top->cd(); |
998b831f | 203 | node = new TNode(Form("RICH%i",i),Form("RICH%i",i),"RICH",C(i)->Center().X(),C(i)->Center().Y(),C(i)->Center().Z(),C(i)->RotMatrixName()); |
3ea9cb08 | 204 | node->SetLineColor(kRed); |
91975aa2 | 205 | node->cd(); |
998b831f | 206 | subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2,-leny-dead/2,dz,""); |
91975aa2 | 207 | subnode->SetLineColor(kGreen); |
208 | fNodes->Add(subnode); | |
998b831f | 209 | subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2,-leny-dead/2,dz,""); |
91975aa2 | 210 | subnode->SetLineColor(kGreen); |
211 | fNodes->Add(subnode); | |
998b831f | 212 | subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, 0,dz,""); |
91975aa2 | 213 | subnode->SetLineColor(kGreen); |
214 | fNodes->Add(subnode); | |
998b831f | 215 | subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, 0,dz,""); |
91975aa2 | 216 | subnode->SetLineColor(kGreen); |
217 | fNodes->Add(subnode); | |
998b831f | 218 | subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, leny+dead/2,dz,""); |
91975aa2 | 219 | subnode->SetLineColor(kGreen); |
220 | fNodes->Add(subnode); | |
998b831f | 221 | subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, leny+dead/2,dz,""); |
91975aa2 | 222 | subnode->SetLineColor(kGreen); |
223 | fNodes->Add(subnode); | |
237c933d | 224 | fNodes->Add(node); |
998b831f | 225 | } |
226 | ||
227 | AliDebug(1,"Stop."); | |
dfb4e77d | 228 | }//void AliRICH::BuildGeometry() |
a25b3368 | 229 | //__________________________________________________________________________________________________ |
452a64c6 | 230 | void AliRICH::CreateMaterials() |
231 | { | |
e42a7b46 | 232 | // Definition of available RICH materials |
af3d25a6 | 233 | |
998b831f | 234 | Int_t material=0; //tmp material id number |
235 | Float_t a=0,z=0,den=0,radl=0,absl=0; //tmp material parameters | |
a25b3368 | 236 | |
c60862bf | 237 | Float_t tmaxfd=-10.0, deemax=-0.2, stemax=-0.1,epsil=0.001, stmin=-0.001; |
238 | Int_t isxfld = gAlice->Field()->Integ(); | |
239 | Float_t sxmgmx = gAlice->Field()->Max(); | |
452a64c6 | 240 | |
a25b3368 | 241 | Float_t aAir[4]={12,14,16,36}; Float_t zAir[4]={6,7,8,18}; Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};//total 0.9999999 |
998b831f | 242 | AliMixture(++material, "RichAir",aAir,zAir,den=0.00120479,4,wAir); //1 (Air) 0.01% C 75% N 23% O 1% Ar |
243 | AliMedium(kAir, "RichAir",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
452a64c6 | 244 | |
a25b3368 | 245 | AliMixture(++material, "RichAerogel",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel represented by Air |
246 | AliMedium(kGel, "RichAerogel",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
247 | ||
248 | AliMixture(++material, "RichAerogelReflector",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel reflector represented by Air | |
249 | AliMedium(kReflector, "RichAerogelReflector",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
250 | ||
998b831f | 251 | AliMaterial(++material, "RichRohacell", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //2 Rohacell 51 C-equiv radl rad cover |
252 | AliMedium(kRoha, "RichRohacell", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 253 | |
998b831f | 254 | Float_t aQuartz[2]={28.09,16.0}; Float_t zQuartz[2]={14.00, 8.0}; Float_t wQuartz[2]={1,2}; |
255 | AliMixture(++material, "RichSiO2",aQuartz,zQuartz,den=2.64,-2, wQuartz); //3 Quarz (SiO2) -trasparent rad window | |
256 | AliMedium(kSiO2, "RichSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 257 | |
a25b3368 | 258 | Float_t aFreon[2]={12,19}; Float_t zFreon[2]={6,9}; Float_t wmatFreon[2]={6,14}; // C12-6 F19-9 |
998b831f | 259 | AliMixture(++material, "RichC6F14",aFreon,zFreon,den=1.68,-2,wmatFreon); //4 Freon (C6F14) |
260 | AliMedium(kC6F14, "RichC6F14",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
261 | ||
262 | Float_t aMethane[2]={12.01,1}; Float_t zMethane[2]={6,1}; Float_t wMethane[2]={1,4}; | |
263 | AliMixture (++material, "RichCH4", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap | |
264 | AliMedium(kCH4, "RichCH4" , material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
a25b3368 | 265 | AliMixture (++material, "RichCH4gap", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap |
266 | AliMedium(kGap, "RichCH4gap", material, 1, isxfld, sxmgmx, tmaxfd, 0.1 , -deemax, epsil, -stmin); | |
998b831f | 267 | |
268 | AliMaterial(++material, "RichCsI", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //6 CsI-radl equivalent | |
a25b3368 | 269 | AliMedium(kCsI, "RichCsI", material, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin); |
c60862bf | 270 | |
a25b3368 | 271 | AliMaterial(++material, "RichGridCu", a=63.54,z=29.0,den=8.96, radl=1.43, absl=0); //7 anode grid (Cu) |
272 | AliMedium(kGridCu, "RichGridCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
273 | ||
274 | AliMaterial(++material, "RichPcbCu", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //12 Cu | |
275 | AliMedium(kCu, "RichPcbCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 276 | |
a25b3368 | 277 | AliMixture (++material, "RichOpSiO2",aQuartz, zQuartz, den=2.64, -2, wQuartz); //8 Quarz (SiO2) - opaque |
278 | AliMedium(kOpSiO2, "RichOpSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 279 | |
a25b3368 | 280 | AliMaterial(++material, "RichAl", a=26.98,z=13.0,den=2.699, radl=8.9, absl=0); //10 aluminium sheet (Al) |
281 | AliMedium(kAl, "RichAl", material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 282 | |
998b831f | 283 | Float_t aGlass[5]={12.01,28.09,16,10.8,23}; Float_t zGlass[5]={6,14,8,5,11}; Float_t wGlass[5]={0.5,0.105,0.355,0.03,0.01}; |
a25b3368 | 284 | AliMixture(++material,"RichGlass",aGlass, zGlass, den=1.74, 5, wGlass); //11 Glass 50%-C 10.5%-Si 35.5%-O 3%-B 1%-Na |
285 | AliMedium(kGlass, "RichGlass", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
998b831f | 286 | |
a25b3368 | 287 | AliMaterial(++material, "RichW", a=183.84,z=74.0,den=19.3, radl=0.35, absl=185.0/den); //13 W - anod wires |
288 | AliMedium(kW, "RichW", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 289 | |
e42a7b46 | 290 | |
291 | if(P()->IsRadioSrc()){ | |
998b831f | 292 | AliInfo("Special radioactive source materials"); |
a25b3368 | 293 | AliMaterial(++material, "RichSteel", a=55.845,z=26.0,den=7.87, radl=1.76, absl=131.9/den); //14 Steel (Fe) |
294 | AliMedium(kSteel, "RichSteel", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
c60862bf | 295 | |
a25b3368 | 296 | AliMaterial(++material, "RichPerpex", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //15 Perpex |
297 | AliMedium(kPerpex, "RichPerpex", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
e42a7b46 | 298 | |
a25b3368 | 299 | AliMaterial(++material, "RichSr90", a=87.62,z=38.0,den=2.54, radl=4.24, absl=0); //16 Sr90 |
300 | AliMedium(kSr90, "RichSr90", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
301 | ||
302 | Float_t aMylar[5]={12.01,1,16}; Float_t zMylar[5]={6,1,8}; Float_t wMylar[5]={5,4,5}; //17 Mylar C5H4O5 | |
303 | AliMixture(++material,"RichMylar",aMylar, zMylar, den=1.39, -3, wMylar); | |
304 | AliMedium(kMylar, "RichMylar", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
e42a7b46 | 305 | } |
c60862bf | 306 | |
998b831f | 307 | //Optical properties: |
308 | #include "Opticals.h" | |
a25b3368 | 309 | gMC->SetCerenkov((*fIdtmed)[kAir] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //1 Air |
310 | gMC->SetCerenkov((*fIdtmed)[kRoha] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //2 Honeycomb | |
311 | gMC->SetCerenkov((*fIdtmed)[kSiO2] , kNbins, aPckov, aAbsSiO2 , aQeAll, aIdxSiO2); //3 Quartz SiO2 | |
312 | gMC->SetCerenkov((*fIdtmed)[kC6F14] , kNbins, aPckov, aAbsC6F14 , aQeAll, aIdxC6F14); //4 Freon C6F14 | |
313 | gMC->SetCerenkov((*fIdtmed)[kCH4] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //5 Methane CH4 | |
314 | gMC->SetCerenkov((*fIdtmed)[kCsI] , kNbins, aPckov, aAbsCsI , aQeCsI, aIdxCH4); //6 CsI | |
315 | gMC->SetCerenkov((*fIdtmed)[kGridCu] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //7 grid Cu | |
316 | gMC->SetCerenkov((*fIdtmed)[kOpSiO2] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //8 Opaque quartz SiO2 | |
317 | gMC->SetCerenkov((*fIdtmed)[kGap] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //9 Special methane gap | |
318 | gMC->SetCerenkov((*fIdtmed)[kAl] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //10 Aluminium | |
319 | gMC->SetCerenkov((*fIdtmed)[kGlass] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //11 Glass | |
320 | gMC->SetCerenkov((*fIdtmed)[kGel] , kNbins, aPckov, aAbsGel , aQeAll, aIdxGel); //12 Aerogel | |
321 | gMC->SetCerenkov((*fIdtmed)[kReflector], kNbins, aPckov, aAbsRef , aQeAll, aIdxMetal); //13 Aerogel reflector | |
c60862bf | 322 | }//void AliRICH::CreateMaterials() |
c021cb15 | 323 | //__________________________________________________________________________________________________ |
a25b3368 | 324 | Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola) |
452a64c6 | 325 | { |
326 | ||
327 | //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.) | |
328 | ||
329 | Float_t en[36] = {5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6.0,6.1,6.2, | |
330 | 6.3,6.4,6.5,6.6,6.7,6.8,6.9,7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7, | |
331 | 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5}; | |
452a64c6 | 332 | Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05, |
333 | 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11, | |
334 | 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95, | |
335 | 1.72,1.53}; | |
452a64c6 | 336 | Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543, |
337 | 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878, | |
338 | 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824, | |
339 | 1.714,1.498}; | |
340 | Float_t xe=ene; | |
341 | Int_t j=Int_t(xe*10)-49; | |
342 | Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]); | |
343 | Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]); | |
344 | ||
345 | //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR | |
346 | //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197 | |
347 | ||
348 | Float_t sinin=TMath::Sqrt(1-pdoti*pdoti); | |
349 | Float_t tanin=sinin/pdoti; | |
350 | ||
351 | Float_t c1=cn*cn-ck*ck-sinin*sinin; | |
352 | Float_t c2=4*cn*cn*ck*ck; | |
353 | Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1)); | |
354 | Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1); | |
355 | ||
356 | Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2); | |
357 | Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2); | |
358 | ||
359 | ||
360 | //CORRECTION FACTOR FOR SURFACE ROUGHNESS | |
361 | //B.J. STAGG APPLIED OPTICS, 30(1991),4113 | |
362 | ||
363 | Float_t sigraf=18.; | |
364 | Float_t lamb=1240/ene; | |
365 | Float_t fresn; | |
366 | ||
367 | Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb)); | |
368 | ||
369 | if(pola) | |
370 | { | |
371 | Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S | |
372 | fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr)); | |
373 | } | |
374 | else | |
375 | fresn=0.5*(rp+rs); | |
376 | ||
377 | fresn = fresn*rO; | |
378 | return(fresn); | |
53fd478b | 379 | }//Fresnel() |
c021cb15 | 380 | //__________________________________________________________________________________________________ |
dfb4e77d | 381 | void AliRICH::MakeBranch(Option_t* option) |
53fd478b | 382 | { |
383 | //Create Tree branches for the RICH. | |
998b831f | 384 | AliDebug(1,Form("Start with option= %s.",option)); |
dfb4e77d | 385 | |
386 | const Int_t kBufferSize = 4000; | |
dfb4e77d | 387 | |
dfb4e77d | 388 | const char *cH = strstr(option,"H"); |
389 | const char *cD = strstr(option,"D"); | |
390 | const char *cR = strstr(option,"R"); | |
391 | const char *cS = strstr(option,"S"); | |
392 | ||
c60862bf | 393 | if(cH&&TreeH()){//H |
0fe8fa07 | 394 | HitsCreate(); //branch will be created in AliDetector::MakeBranch |
c60862bf | 395 | }//H |
dfb4e77d | 396 | AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created |
397 | ||
c60862bf | 398 | if(cS&&fLoader->TreeS()){//S |
0fe8fa07 | 399 | SDigitsCreate(); MakeBranchInTree(fLoader->TreeS(),"RICH",&fSdigits,kBufferSize,0) ; |
c60862bf | 400 | }//S |
dfb4e77d | 401 | |
c60862bf | 402 | if(cD&&fLoader->TreeD()){//D |
0fe8fa07 | 403 | DigitsCreate(); |
e42a7b46 | 404 | for(Int_t i=0;i<kNchambers;i++){ |
0fe8fa07 | 405 | MakeBranchInTree(fLoader->TreeD(),Form("%s%d",GetName(),i+1),&((*fDigs)[i]),kBufferSize,0); |
543d5224 | 406 | } |
c60862bf | 407 | }//D |
408 | ||
409 | if(cR&&fLoader->TreeR()){//R | |
0fe8fa07 | 410 | ClustersCreate(); |
e42a7b46 | 411 | for(Int_t i=0;i<kNchambers;i++) |
0fe8fa07 | 412 | MakeBranchInTree(fLoader->TreeR(),Form("%sClusters%d",GetName(),i+1), &((*fClus)[i]), kBufferSize, 0); |
cb8189e7 | 413 | }//R |
998b831f | 414 | AliDebug(1,"Stop."); |
c021cb15 | 415 | }//void AliRICH::MakeBranch(Option_t* option) |
c60862bf | 416 | //__________________________________________________________________________________________________ |
dfb4e77d | 417 | void AliRICH::SetTreeAddress() |
53fd478b | 418 | { |
419 | //Set branch address for the Hits and Digits Tree. | |
998b831f | 420 | AliDebug(1,"Start."); |
c60862bf | 421 | |
dfb4e77d | 422 | TBranch *branch; |
dfb4e77d | 423 | |
c60862bf | 424 | if(fLoader->TreeH()){//H |
998b831f | 425 | AliDebug(1,"tree H is requested."); |
0fe8fa07 | 426 | HitsCreate();//branch map will be in AliDetector::SetTreeAddress |
c60862bf | 427 | }//H |
c021cb15 | 428 | AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created |
429 | ||
c60862bf | 430 | if(fLoader->TreeS()){//S |
998b831f | 431 | AliDebug(1,"tree S is requested."); |
0fe8fa07 | 432 | branch=fLoader->TreeS()->GetBranch(GetName()); if(branch){SDigitsCreate(); branch->SetAddress(&fSdigits);} |
c60862bf | 433 | }//S |
dfb4e77d | 434 | |
c60862bf | 435 | if(fLoader->TreeD()){//D |
998b831f | 436 | AliDebug(1,"tree D is requested."); |
e42a7b46 | 437 | for(int i=0;i<kNchambers;i++){ |
c60862bf | 438 | branch=fLoader->TreeD()->GetBranch(Form("%s%d",GetName(),i+1)); |
0fe8fa07 | 439 | if(branch){DigitsCreate(); branch->SetAddress(&((*fDigs)[i]));} |
aed240d4 | 440 | } |
c60862bf | 441 | }//D |
dfb4e77d | 442 | |
c60862bf | 443 | if(fLoader->TreeR()){//R |
998b831f | 444 | AliDebug(1,"tree R is requested."); |
e42a7b46 | 445 | for(int i=0;i<kNchambers;i++){ |
c60862bf | 446 | branch=fLoader->TreeR()->GetBranch(Form("%sClusters%d" ,GetName(),i+1)); |
0fe8fa07 | 447 | if(branch){ClustersCreate(); branch->SetAddress(&((*fClus)[i]));} |
dfb4e77d | 448 | } |
c60862bf | 449 | }//R |
998b831f | 450 | AliDebug(1,"Stop."); |
dfb4e77d | 451 | }//void AliRICH::SetTreeAddress() |
c021cb15 | 452 | //__________________________________________________________________________________________________ |
dfb4e77d | 453 | void AliRICH::Print(Option_t *option)const |
454 | { | |
53fd478b | 455 | //Debug printout |
dfb4e77d | 456 | TObject::Print(option); |
e42a7b46 | 457 | P()->Print(); |
458 | fCounters.Print(); | |
dfb4e77d | 459 | }//void AliRICH::Print(Option_t *option)const |
c021cb15 | 460 | //__________________________________________________________________________________________________ |
e42a7b46 | 461 | void AliRICH::ControlPlots() |
462 | { | |
d3eb6079 | 463 | //Creates a set of QA hists to control the results of simulation. Hists are in file $HOME/RCP.root |
a25b3368 | 464 | TH1F *pElecP=0 ,*pMuonP=0 ,*pPionP=0 ,*pKaonP=0 ,*pProtP=0, //stack particles |
d3eb6079 | 465 | *pHxD=0,*pHyD=0,*pHxSd=0,*pHySd=0, //diff hit position - digit sdigit position |
466 | *pNumClusH1=0, | |
e42a7b46 | 467 | *pQdcH1=0, *pSizeH1=0, |
468 | *pPureMipQdcH1=0,*pPureMipSizeH1=0, | |
469 | *pPureCerQdcH1=0,*pPureCerSizeH1=0, | |
470 | *pPureFeeQdcH1=0,*pPureFeeSizeH1=0, | |
471 | *pMipQdcH1=0, *pPhotQdcH1=0; | |
472 | TH2F *pMapH2=0,*pPureMipMapH2=0,*pPureCerMapH2=0,*pPureFeeMapH2=0; | |
d3eb6079 | 473 | TH1F *pelecRadius=0,*pprotRadius=0,*pprotbarRadius=0; |
474 | //load all information | |
475 | GetLoader()->GetRunLoader()->LoadHeader(); | |
476 | GetLoader()->GetRunLoader()->LoadKinematics(); | |
477 | GetLoader()->LoadHits(); | |
478 | Bool_t isSdig=0;//!GetLoader()->LoadSDigits(); | |
479 | Bool_t isDig =0;//!GetLoader()->LoadDigits(); | |
e42a7b46 | 480 | Bool_t isClus=!GetLoader()->LoadRecPoints(); |
481 | ||
d3eb6079 | 482 | gBenchmark->Start("ControlPlots"); |
c021cb15 | 483 | |
e42a7b46 | 484 | TFile *pFile = new TFile("$(HOME)/RCP.root","RECREATE"); |
d3eb6079 | 485 | |
486 | pElecP=new TH1F("Pelec","Electrons made hit in RICH;p [GeV]",1000,-30,30); | |
487 | pMuonP=new TH1F("Pmuon","Muons made hit in RICH;p [GeV]",1000,-30,30); | |
488 | pPionP=new TH1F("Ppion","Pions made hit in RICH;p [GeV]",1000,-30,30); | |
489 | pKaonP=new TH1F("Pkaon","Kaon made hit in RICH;p [GeV]",1000,-30,30); | |
490 | pProtP=new TH1F("Pprot","Protons made hit in RICH;p [GeV]",1000,-30,30); | |
491 | pelecRadius=new TH1F("elecRadius","elec",600,0.,600.); | |
492 | pprotRadius=new TH1F("protRadius","elec",600,0.,600.); | |
493 | pprotbarRadius=new TH1F("protbarRadius","elec",600,0.,600.); | |
494 | ||
495 | if(isSdig){ | |
496 | AliInfo("SDigits available"); | |
497 | pHxSd=new TH1F("DiffHitSDigitX","Hit-SDigit diff X all chambers;diff [cm]",300,-10,10); | |
498 | pHySd=new TH1F("DiffHitSDigitY","Hit-SDigit diff Y all chambers;diff [cm]",300,-10,10); | |
499 | }//isSdig | |
e42a7b46 | 500 | |
501 | if(isDig){ | |
998b831f | 502 | AliInfo("Digits available"); |
d3eb6079 | 503 | pHxD=new TH1F("DiffHitDigitX","Hit-Digit diff X all chambers;diff [cm]",300,-10,10); |
504 | pHyD=new TH1F("DiffHitDigitY","Hit-Digit diff Y all chambers;diff [cm]",300,-10,10); | |
e42a7b46 | 505 | }//isDig |
506 | ||
507 | if(isClus){ | |
a25b3368 | 508 | AliInfo("Clusters available"); |
e42a7b46 | 509 | pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49); |
c021cb15 | 510 | |
a25b3368 | 511 | pQdcH1 =new TH1F("ClusQdc", "Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); |
e42a7b46 | 512 | pSizeH1 =new TH1F("ClusSize", "Cluster size all chambers;size [number of pads in cluster]",100,0,100); |
a25b3368 | 513 | pMapH2 =new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY()); |
e42a7b46 | 514 | |
a25b3368 | 515 | pMipQdcH1 =new TH1F("QdcMip" ,"MIP Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); |
516 | pPhotQdcH1 =new TH1F("QdcPhot" ,"Cer+Fee Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); | |
e42a7b46 | 517 | |
a25b3368 | 518 | pPureMipQdcH1 =new TH1F("QdcPureMip" ,"MIP only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); |
e42a7b46 | 519 | pPureMipSizeH1=new TH1F("SizePureMip" ,"MIP only Cluster size all chambers;size [number of pads in cluster]",100,0,100); |
a25b3368 | 520 | pPureMipMapH2 =new TH2F("MapPureMip" ,"MIP only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY()); |
e42a7b46 | 521 | |
a25b3368 | 522 | pPureCerQdcH1 =new TH1F("QdcPureCer" ,"Cerenkov only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); |
e42a7b46 | 523 | pPureCerSizeH1=new TH1F("SizePureCer" ,"Cernekov only Cluster size all chambers;size [number of pads in cluster]",100,0,100); |
a25b3368 | 524 | pPureCerMapH2 =new TH2F("MapPureCer" ,"Cerenkov only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY()); |
c021cb15 | 525 | |
a25b3368 | 526 | pPureFeeQdcH1 =new TH1F("QdcPureFee" ,"Feedback only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc()); |
e42a7b46 | 527 | pPureFeeSizeH1=new TH1F("SizePureFee" ,"Feedback only Cluster size all chambers;size [number of pads in cluster]",100,0,100); |
a25b3368 | 528 | pPureFeeMapH2 =new TH2F("MapPureFee" ,"Feedback only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY()); |
d3eb6079 | 529 | |
e42a7b46 | 530 | }//isClus |
d3eb6079 | 531 | //end of hists booking |
e42a7b46 | 532 | for(Int_t iEvtN=0;iEvtN < GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop |
d3eb6079 | 533 | GetLoader()->GetRunLoader()->GetEvent(iEvtN); //get current event |
c021cb15 | 534 | |
a25b3368 | 535 | for(Int_t iPrimN=0;iPrimN < GetLoader()->TreeH()->GetEntries();iPrimN++){//hit tree loop |
536 | GetLoader()->TreeH()->GetEntry(iPrimN); | |
d3eb6079 | 537 | for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop |
0fe8fa07 | 538 | AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j); |
d3eb6079 | 539 | TParticle *pParticle = GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack());//get particle produced this hit |
0fe8fa07 | 540 | Double_t dRadius = TMath::Sqrt(pParticle->Vx()*pParticle->Vx()+pParticle->Vy()*pParticle->Vy()+pParticle->Vz()*pParticle->Vz()); |
a25b3368 | 541 | switch(pParticle->GetPdgCode()){ |
0fe8fa07 | 542 | case kPositron : pElecP->Fill( pParticle->P());pelecRadius->Fill(dRadius); break; |
543 | case kElectron : pElecP->Fill(-pParticle->P());pelecRadius->Fill(dRadius); break; | |
a25b3368 | 544 | |
545 | case kMuonPlus : pMuonP->Fill( pParticle->P()); break; | |
546 | case kMuonMinus: pMuonP->Fill(-pParticle->P()); break; | |
547 | ||
548 | case kPiPlus : pPionP->Fill( pParticle->P()); break; | |
549 | case kPiMinus : pPionP->Fill(-pParticle->P()); break; | |
550 | ||
551 | case kKPlus : pKaonP->Fill( pParticle->P()); break; | |
552 | case kKMinus : pKaonP->Fill(-pParticle->P()); break; | |
553 | ||
0fe8fa07 | 554 | case kProton : pProtP->Fill( pParticle->P()); pprotRadius->Fill(dRadius); break; |
555 | case kProtonBar: pProtP->Fill(-pParticle->P()); pprotbarRadius->Fill(dRadius); break; | |
a25b3368 | 556 | |
557 | }//switch PdgCode | |
558 | ||
559 | }//hits loop | |
560 | }//hit tree loop | |
c021cb15 | 561 | |
d3eb6079 | 562 | if(isSdig){ |
563 | GetLoader()->TreeS()->GetEntry(0); | |
564 | for(Int_t iSdigN=0;iSdigN<SDigits()->GetEntries();iSdigN++){//sdigits loop | |
0fe8fa07 | 565 | AliRICHDigit *pSdig=(AliRICHDigit*)SDigits()->At(iSdigN); //get current sdigit pointer |
566 | AliRICHHit *pHit=Hit(pSdig->GetTrack(0)); //get hit of this sdigit (always one) | |
d3eb6079 | 567 | TVector2 hit2 =C(pHit->C())->Mrs2Pc(pHit->OutX3()); //this hit position in local system |
568 | TVector2 sdig2=P()->Pad2Loc(pSdig->Pad()); //center of pad for this sdigit | |
569 | pHxSd->Fill(hit2.X()-sdig2.X()); | |
570 | pHySd->Fill(hit2.Y()-sdig2.Y()); | |
571 | }//sdigits loop | |
572 | }//if(isSdig) | |
573 | ||
e42a7b46 | 574 | if(isDig) GetLoader()->TreeD()->GetEntry(0); |
d3eb6079 | 575 | if(isClus) GetLoader()->TreeR()->GetEntry(0); |
c021cb15 | 576 | |
e42a7b46 | 577 | for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop |
d3eb6079 | 578 | if(isDig){ |
579 | for(Int_t iDigN=0;iDigN<Digits(iChamN)->GetEntries();iDigN++){//digits loop | |
0fe8fa07 | 580 | AliRICHDigit *pDig=(AliRICHDigit*)Digits(iChamN)->At(iDigN); |
581 | AliRICHHit *pHit=Hit(pDig->GetTrack(0)); //get first hit of this digit | |
d3eb6079 | 582 | TVector2 hitV2=C(iChamN)->Mrs2Pc(pHit->OutX3()); |
583 | TVector2 digV2=P()->Pad2Loc(pDig->Pad()); //center of pad for this digit | |
584 | pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y()); | |
585 | }//digits loop | |
586 | }//isDig | |
e42a7b46 | 587 | if(isClus){ |
588 | Int_t iNclusCham=Clusters(iChamN)->GetEntries(); if(iNclusCham) pNumClusH1->Fill(iNclusCham);//number of clusters per event | |
589 | for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop | |
0fe8fa07 | 590 | AliRICHCluster *pClus=(AliRICHCluster*)Clusters(iChamN)->At(iClusN); |
e42a7b46 | 591 | pQdcH1 ->Fill(pClus->Q()); |
592 | pSizeH1 ->Fill(pClus->Size()); | |
593 | pMapH2 ->Fill(pClus->X(),pClus->Y()); //common | |
594 | ||
595 | if(pClus->IsSingleMip()) {pPureMipQdcH1 ->Fill(pClus->Q()); | |
596 | pPureMipSizeH1->Fill(pClus->Size()); | |
597 | pPureMipMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Mips | |
598 | ||
599 | if(pClus->IsSingleCerenkov()){pPureCerQdcH1 ->Fill(pClus->Q()); | |
600 | pPureCerSizeH1->Fill(pClus->Size()); | |
601 | pPureCerMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Cerenkovs | |
602 | ||
603 | if(pClus->IsSingleFeedback()){pPureFeeQdcH1 ->Fill(pClus->Q()); | |
604 | pPureFeeSizeH1->Fill(pClus->Size()); | |
605 | pPureFeeMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks | |
606 | ||
607 | if(pClus->IsMip()) {pMipQdcH1 ->Fill(pClus->Q());} //MIP+ other contributions | |
608 | if(!pClus->IsPureMip()) pPhotQdcH1->Fill(pClus->Q()); //not MIP | |
609 | }//clusters loop | |
610 | }//isClus | |
e42a7b46 | 611 | }//chambers loop |
612 | Info("ControlPlots","Event %i processed.",iEvtN); | |
613 | }//events loop | |
d3eb6079 | 614 | GetLoader()->UnloadHits(); |
615 | if(isSdig) GetLoader()->UnloadSDigits(); | |
e42a7b46 | 616 | if(isDig) GetLoader()->UnloadDigits(); |
617 | if(isClus) GetLoader()->UnloadRecPoints(); | |
618 | ||
a25b3368 | 619 | GetLoader()->GetRunLoader()->UnloadHeader(); |
620 | GetLoader()->GetRunLoader()->UnloadKinematics(); | |
621 | ||
e42a7b46 | 622 | pFile->Write(); delete pFile; |
d3eb6079 | 623 | |
624 | gBenchmark->Show("ControlPlots"); | |
e42a7b46 | 625 | }//ControlPlots() |
626 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 627 | AliRICHHit* AliRICH::Hit(Int_t tid)const |
e42a7b46 | 628 | { |
629 | //defines which hit provided by given tid for the currently loaded event | |
a25b3368 | 630 | GetLoader()->LoadHits(); |
631 | for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop | |
632 | GetLoader()->TreeH()->GetEntry(iPrimN); | |
633 | for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){ | |
0fe8fa07 | 634 | AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN); |
a25b3368 | 635 | if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;} |
e42a7b46 | 636 | }//hits |
637 | }//prims loop | |
a25b3368 | 638 | GetLoader()->UnloadHits(); |
e42a7b46 | 639 | return 0; |
640 | } | |
641 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 642 | void AliRICH::HitsPrint(Int_t iEvtN)const |
e42a7b46 | 643 | { |
644 | //Prints a list of RICH hits for a given event. Default is event number 0. | |
d3eb6079 | 645 | if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return; |
998b831f | 646 | AliInfo(Form("List of RICH hits for event %i",iEvtN)); |
a25b3368 | 647 | if(GetLoader()->LoadHits()) return; |
e42a7b46 | 648 | |
649 | Int_t iTotalHits=0; | |
a25b3368 | 650 | for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop |
651 | GetLoader()->TreeH()->GetEntry(iPrimN); | |
652 | Hits()->Print(); | |
653 | iTotalHits+=Hits()->GetEntries(); | |
e42a7b46 | 654 | } |
a25b3368 | 655 | GetLoader()->UnloadHits(); |
998b831f | 656 | AliInfo(Form("totally %i hits",iTotalHits)); |
e42a7b46 | 657 | } |
658 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 659 | void AliRICH::SDigitsPrint(Int_t iEvtN)const |
e42a7b46 | 660 | { |
661 | //prints a list of RICH sdigits for a given event | |
d3eb6079 | 662 | if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return; |
e42a7b46 | 663 | Info("PrintSDigits","List of RICH sdigits for event %i",iEvtN); |
a25b3368 | 664 | if(GetLoader()->LoadSDigits()) return; |
e42a7b46 | 665 | |
a25b3368 | 666 | GetLoader()->TreeS()->GetEntry(0); |
667 | SDigits()->Print(); | |
668 | GetLoader()->UnloadSDigits(); | |
669 | Info("PrintSDigits","totally %i sdigits",SDigits()->GetEntries()); | |
e42a7b46 | 670 | } |
671 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 672 | void AliRICH::DigitsPrint(Int_t iEvtN)const |
e42a7b46 | 673 | { |
674 | //prints a list of RICH digits for a given event | |
d3eb6079 | 675 | if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return; |
e42a7b46 | 676 | Info("PrintDigits","List of RICH digits for event %i",iEvtN); |
a25b3368 | 677 | if(GetLoader()->LoadDigits()) return; |
e42a7b46 | 678 | |
679 | Int_t iTotalDigits=0; | |
a25b3368 | 680 | GetLoader()->TreeD()->GetEntry(0); |
e42a7b46 | 681 | for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){ |
a25b3368 | 682 | Digits(iChamber)->Print(); |
683 | iTotalDigits+=Digits(iChamber)->GetEntries(); | |
e42a7b46 | 684 | } |
a25b3368 | 685 | GetLoader()->UnloadDigits(); |
e42a7b46 | 686 | Info("PrintDigits","totally %i Digits",iTotalDigits); |
687 | } | |
688 | //__________________________________________________________________________________________________ | |
c23b3bc0 | 689 | void AliRICH::OccupancyPrint(Int_t iEvtN)const |
690 | { | |
691 | //prints occupancy for each chamber in a given event | |
692 | if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return; | |
693 | Info("Occupancy","for event %i",iEvtN); | |
694 | if(GetLoader()->LoadDigits()) return; | |
695 | ||
696 | Int_t totPadsPerChamber = AliRICHParam::NpadsX()*AliRICHParam::NpadsY(); | |
697 | GetLoader()->TreeD()->GetEntry(0); | |
698 | for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){ | |
699 | Double_t occupancy = (Double_t)Digits(iChamber)->GetEntries()/(Double_t)totPadsPerChamber; | |
700 | Info("Occupancy","for chamber %i = %4.2f per cent",iChamber,occupancy*100.); | |
701 | } | |
702 | GetLoader()->UnloadDigits(); | |
703 | } | |
704 | //__________________________________________________________________________________________________ | |
0fe8fa07 | 705 | void AliRICH::ClustersPrint(Int_t iEvtN)const |
e42a7b46 | 706 | { |
707 | //prints a list of RICH clusters for a given event | |
d3eb6079 | 708 | AliInfo(Form("List of RICH clusters for event %i",iEvtN)); |
a25b3368 | 709 | GetLoader()->GetRunLoader()->GetEvent(iEvtN); |
710 | if(GetLoader()->LoadRecPoints()) return; | |
e42a7b46 | 711 | |
712 | Int_t iTotalClusters=0; | |
a25b3368 | 713 | GetLoader()->TreeR()->GetEntry(0); |
e42a7b46 | 714 | for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){ |
a25b3368 | 715 | Clusters(iChamber)->Print(); |
716 | iTotalClusters+=Clusters(iChamber)->GetEntries(); | |
e42a7b46 | 717 | } |
a25b3368 | 718 | GetLoader()->UnloadRecPoints(); |
d3eb6079 | 719 | AliInfo(Form("totally %i clusters for event %i",iTotalClusters,iEvtN)); |
e42a7b46 | 720 | } |
721 | //__________________________________________________________________________________________________ | |
998b831f | 722 | void AliRICH::PrintTracks(Int_t iEvtN) |
e42a7b46 | 723 | { |
a25b3368 | 724 | //prints a list of tracks (including secondary) for a given event |
725 | AliInfo(Form("List of all tracks for event %i",iEvtN)); | |
726 | GetLoader()->GetRunLoader()->GetEvent(iEvtN); | |
727 | if(GetLoader()->GetRunLoader()->LoadHeader()) return; | |
728 | if(GetLoader()->GetRunLoader()->LoadKinematics()) return; | |
729 | AliStack *pStack=GetLoader()->GetRunLoader()->Stack(); | |
730 | ||
d3eb6079 | 731 | for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print(); |
a25b3368 | 732 | |
d3eb6079 | 733 | AliInfo(Form("totally %i tracks including %i primaries for event %i",pStack->GetNtrack(),pStack->GetNprimary(),iEvtN)); |
a25b3368 | 734 | GetLoader()->GetRunLoader()->UnloadHeader(); |
735 | GetLoader()->GetRunLoader()->UnloadKinematics(); | |
e42a7b46 | 736 | } |
a25b3368 | 737 | //__________________________________________________________________________________________________ |
d3eb6079 | 738 | void AliRICH::GeomPadPanelFrame()const |
a25b3368 | 739 | { |
740 | //Pad Panel frame 6 sectors | |
741 | Double_t cm=1,mm=0.1*cm;//default is cm | |
742 | Float_t par[3]; | |
743 | ||
744 | par[0]=648*mm/2;par[1]= 411*mm/2;par[2]=40 *mm/2;gMC->Gsvolu("RPPF","BOX ",(*fIdtmed)[kAl] ,par,3);//PPF 2001P2 inner size of the slab by 1mm more | |
745 | par[0]=181*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("PPFL","BOX ",(*fIdtmed)[kAir] ,par,3);//large whole | |
746 | par[0]=114*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("PPFS","BOX ",(*fIdtmed)[kAir] ,par,3);//small whole | |
747 | par[0]=644*mm/2;par[1]= 407*mm/2;par[2]= 1.7*mm/2;gMC->Gsvolu("RPC ","BOX ",(*fIdtmed)[kCsI] ,par,3);//by 0.2 mm more then actual size (PCB 2006P1) | |
748 | ||
749 | gMC->Gspos("RPPF",1,"RICH", -335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY");//F1 2040P1 z p.84 TDR | |
750 | gMC->Gspos("RPPF",2,"RICH", +335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY"); | |
751 | gMC->Gspos("RPPF",3,"RICH", -335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY"); | |
752 | gMC->Gspos("RPPF",4,"RICH", +335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY"); | |
753 | gMC->Gspos("RPPF",5,"RICH", -335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY"); | |
754 | gMC->Gspos("RPPF",6,"RICH", +335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY"); | |
755 | gMC->Gspos("RPC ",1,"RPPF", 0*mm, 0*mm, -19.15*mm, 0,"ONLY");//PPF 2001P2 | |
756 | gMC->Gspos("PPFL",1,"RPPF", -224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY"); | |
757 | gMC->Gspos("PPFL",2,"RPPF", -224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY"); | |
758 | gMC->Gspos("PPFL",3,"RPPF", -224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY"); | |
759 | gMC->Gspos("PPFL",4,"RPPF", -224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY"); | |
760 | gMC->Gspos("PPFS",1,"RPPF", - 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY"); | |
761 | gMC->Gspos("PPFS",2,"RPPF", - 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY"); | |
762 | gMC->Gspos("PPFS",3,"RPPF", - 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY"); | |
763 | gMC->Gspos("PPFS",4,"RPPF", - 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY"); | |
764 | gMC->Gspos("PPFS",5,"RPPF", + 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY"); | |
765 | gMC->Gspos("PPFS",6,"RPPF", + 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY"); | |
766 | gMC->Gspos("PPFS",7,"RPPF", + 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY"); | |
767 | gMC->Gspos("PPFS",8,"RPPF", + 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY"); | |
768 | gMC->Gspos("PPFL",5,"RPPF", +224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY"); | |
769 | gMC->Gspos("PPFL",6,"RPPF", +224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY"); | |
770 | gMC->Gspos("PPFL",7,"RPPF", +224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY"); | |
771 | gMC->Gspos("PPFL",8,"RPPF", +224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY"); | |
772 | }//GeomPadPanelFrame() | |
773 | //__________________________________________________________________________________________________ | |
d3eb6079 | 774 | void AliRICH::GeomAmpGap()const |
a25b3368 | 775 | { |
776 | //Gap - anod wires 6 copies to RICH | |
777 | Double_t cm=1,mm=0.1*cm,mkm=0.001*mm;//default is cm | |
778 | Int_t matrixIdReturn=0; //matrix id returned by AliMatrix | |
779 | Float_t par[3]; | |
780 | ||
781 | par[0]=648*mm/2;par[1]= 411*mm/2 ;par[2]=4.45*mm/2;gMC->Gsvolu("RGAP ","BOX ",(*fIdtmed)[kCH4] ,par,3);//xy as PPF 2001P2 z WP 2099P1 | |
782 | par[0]= 0*mm ;par[1]= 20*mkm/2 ;par[2]= 648*mm/2;gMC->Gsvolu("RANO","TUBE",(*fIdtmed)[kW] ,par,3);//WP 2099P1 z = gap x PPF 2001P2 | |
783 | AliMatrix(matrixIdReturn,180,0, 90,90, 90,0); //wires along x | |
784 | ||
785 | gMC->Gspos("RGAP",1,"RICH", -335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY"); //F1 2040P1 z WP 2099P1 | |
786 | gMC->Gspos("RGAP",2,"RICH", +335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY"); | |
787 | gMC->Gspos("RGAP",3,"RICH", -335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY"); | |
788 | gMC->Gspos("RGAP",4,"RICH", +335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY"); | |
789 | gMC->Gspos("RGAP",5,"RICH", -335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY"); | |
790 | gMC->Gspos("RGAP",6,"RICH", +335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY"); | |
791 | for(int i=1;i<=96;i++) | |
792 | gMC->Gspos("RANO",i,"RGAP", 0*mm, -411/2*mm+i*4*mm, 0.185*mm, matrixIdReturn,"ONLY"); //WP 2099P1 | |
793 | }//GeomAmpGap() | |
794 | //__________________________________________________________________________________________________ | |
d3eb6079 | 795 | void AliRICH::GeomRadiators()const |
a25b3368 | 796 | { |
797 | //Defines radiators geometry | |
798 | Double_t mm=0.1;//default is cm | |
799 | Float_t par[3]; | |
800 | par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 24*mm/2; gMC->Gsvolu("RRAD","BOX ",(*fIdtmed)[kC6F14] ,par,3); // Rad 2011P1 | |
801 | par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 4*mm/2; gMC->Gsvolu("RRFR","BOX ",(*fIdtmed)[kRoha] ,par,3); //front | |
802 | par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 5*mm/2; gMC->Gsvolu("RRWI","BOX ",(*fIdtmed)[kSiO2] ,par,3); //window | |
803 | par[0]=1330*mm/2 ;par[1]= 5*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRLO","BOX ",(*fIdtmed)[kRoha] ,par,3); //long side | |
804 | par[0]= 10*mm/2 ;par[1]= 403*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRSH","BOX ",(*fIdtmed)[kRoha] ,par,3); //short side | |
805 | par[0]= 0 ;par[1]= 10*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRSP","TUBE",(*fIdtmed)[kSiO2] ,par,3); //spacer | |
806 | ||
807 | gMC->Gspos("RRAD",1,"RICH", 0*mm,-434*mm, -12*mm, 0,"ONLY"); //3 radiators to RICH | |
808 | gMC->Gspos("RRAD",2,"RICH", 0*mm, 0*mm, -12*mm, 0,"ONLY"); | |
809 | gMC->Gspos("RRAD",3,"RICH", 0*mm,+434*mm, -12*mm, 0,"ONLY"); | |
810 | gMC->Gspos("RRFR",1,"RRAD", 0*mm, 0*mm, -10.0*mm, 0,"ONLY"); //front cover | |
811 | gMC->Gspos("RRWI",1,"RRAD", 0*mm, 0*mm, 9.5*mm, 0,"ONLY"); //quartz window (back cover) | |
812 | gMC->Gspos("RRLO",1,"RRAD", 0*mm,-204*mm, -0.5*mm, 0,"ONLY"); //long side | |
813 | gMC->Gspos("RRLO",2,"RRAD", 0*mm,+204*mm, -0.5*mm, 0,"ONLY"); //long side | |
814 | gMC->Gspos("RRSH",1,"RRAD",-660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side | |
815 | gMC->Gspos("RRSH",2,"RRAD",+660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side | |
816 | for(int i=0;i<3;i++) | |
817 | for(int j=0;j<10;j++) | |
818 | gMC->Gspos("RRSP",10*i+j,"RRAD",-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm,0,"ONLY");//spacers | |
819 | }//GeomRadiators() | |
820 | //__________________________________________________________________________________________________ | |
d3eb6079 | 821 | void AliRICH::GeomSandBox()const |
a25b3368 | 822 | { |
823 | //Defines SandBox geometry | |
824 | Double_t mm=0.1;//default is cm | |
825 | Float_t par[3]; | |
826 | par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]=50.5*mm/2; gMC->Gsvolu("RSNB","BOX ",(*fIdtmed)[kAir] ,par,3); //2072P1 | |
827 | par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]= 0.5*mm/2; gMC->Gsvolu("RSCO","BOX ",(*fIdtmed)[kAl] ,par,3); //cover | |
828 | par[0]=1359*mm/2 ;par[1]=1318*mm/2;par[2]=49.5*mm/2; gMC->Gsvolu("RSHO","BOX ",(*fIdtmed)[kRoha] ,par,3); //honeycomb structure | |
829 | ||
830 | gMC->Gspos("RSNB",1,"RICH", 0*mm, 0*mm, -73.75*mm, 0,"ONLY"); //p.84 TDR sandbox to rich | |
831 | gMC->Gspos("RSHO",1,"RSNB", 0*mm, 0*mm, 0*mm, 0,"ONLY"); //2072P1 honeycomv to sandbox | |
832 | gMC->Gspos("RSCO",1,"RSNB", 0*mm, 0*mm, +25*mm, 0,"ONLY"); //cover to sandbox | |
833 | gMC->Gspos("RSCO",2,"RSNB", 0*mm, 0*mm, -25*mm, 0,"ONLY"); //cover to sandbox | |
834 | }//GeomSandBox() | |
835 | //__________________________________________________________________________________________________ | |
d3eb6079 | 836 | void AliRICH::GeomRadioSrc()const |
a25b3368 | 837 | { |
838 | // Defines geometry for radioactive source | |
839 | Double_t cm=1,mm=0.1*cm,mkm=0.001*cm; | |
840 | Float_t par[3]; | |
841 | ||
842 | par[0]=0 ;par[1]= 70*mm/2 ;par[2]= 30*mm/2; gMC->Gsvolu("RSRC","TUBE",(*fIdtmed)[kCH4] ,par,3); //top src container | |
843 | par[0]=0 ;par[1]= 38*mm/2 ;par[2]= 21.8*mm/2; gMC->Gsvolu("RSAG","TUBE",(*fIdtmed)[kAl] ,par,3); //Al glass | |
844 | par[0]=0 ;par[1]= 34*mm/2 ;par[2]= 20*mm/2; gMC->Gsvolu("RSPP","TUBE",(*fIdtmed)[kPerpex] ,par,3); //perpex plug | |
845 | par[0]=0 ;par[1]= 5*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RSSC","TUBE",(*fIdtmed)[kSteel] ,par,3); //steel screw in center of perpex | |
846 | par[0]=0 ;par[1]= 2*mm/2 ;par[2]= 10*mm/2; gMC->Gsvolu("RSSS","TUBE",(*fIdtmed)[kSteel] ,par,3); //Steel screw to support Sr90 | |
847 | par[0]=0 ;par[1]= 1*mm/2 ;par[2]= 1*mm/2; gMC->Gsvolu("RSSR","TUBE",(*fIdtmed)[kSr90] ,par,3); //Sr90 source | |
848 | par[0]=0 ;par[1]= 4*mm/2 ;par[2]= 10*mm/2; gMC->Gsvolu("RSWP","TUBE",(*fIdtmed)[kAir] ,par,3); //Air hole in perpex plug | |
849 | par[0]=0 ;par[1]= 5*mm/2 ;par[2]= 1.8*mm/2; gMC->Gsvolu("RSWA","TUBE",(*fIdtmed)[kAir] ,par,3); //Air hole in Al glass bottom | |
850 | par[0]=0 ;par[1]= 30*mm/2 ;par[2]= 50*mkm/2; gMC->Gsvolu("RSMF","TUBE",(*fIdtmed)[kMylar] ,par,3); //Mylar foil | |
851 | ||
852 | gMC->Gspos("RSRC",1,"RICH", 30*cm, 0, 1*cm, 0,"ONLY"); //source to RICH | |
853 | gMC->Gspos("RSMF",1,"RSRC", 0, 0,21.8*mm/2+50*mkm/2, 0,"ONLY");//mylar foil to top src volume | |
854 | gMC->Gspos("RSAG",1,"RSRC", 0, 0, 0, 0,"ONLY");//Al glass to fake Src volume | |
855 | gMC->Gspos("RSWA",1,"RSAG", 6*mm, 0, -10*mm, 0,"ONLY");//air whole in al glass bottom | |
856 | gMC->Gspos("RSPP",1,"RSAG", 0, 0, 0.9*mm, 0,"ONLY");//perpex plug to Al glass | |
857 | gMC->Gspos("RSWP",1,"RSPP", 6*mm, 0, -5*mm, 0,"ONLY");//air whole in perpex plug | |
858 | gMC->Gspos("RSSC",1,"RSPP", 0, 0, 2.5*mm, 0,"ONLY");//steel screw in center of perpex plug | |
859 | gMC->Gspos("RSSS",1,"RSPP", 6*mm, 0, 5*mm, 0,"ONLY");//steel screw to support Sr90 in perpex plug | |
860 | gMC->Gspos("RSSR",1,"RSSS", 0, 0, -4.5*mm, 0,"ONLY");//Sr90 in support steel screw | |
861 | }//GeomSr90() | |
862 | //__________________________________________________________________________________________________ | |
d3eb6079 | 863 | void AliRICH::GeomAerogel()const |
a25b3368 | 864 | { |
865 | //Creates detailed geometry for aerogel study. | |
866 | AliDebug(1,"Start."); | |
867 | Double_t cm=1; | |
868 | Float_t par[3]; //tmp array for volume dimentions | |
869 | ||
870 | par[0]=10.1*cm/2;par[1]=10.1*cm/2;par[2]=10.1*cm/2; | |
871 | gMC->Gsvolu("RREF","BOX ",(*fIdtmed)[kReflector],par,3);//reflector box | |
872 | gMC->Gspos("RREF",1,"RICH",0,0,0,0, "ONLY"); //put it to RICH volume | |
873 | ||
874 | par[0]=10*cm/2;par[1]=10*cm/2;par[2]=10*cm/2; | |
875 | gMC->Gsvolu("RGEL","BOX ",(*fIdtmed)[kGel],par,3);//10x10x10 cm^3 cubic of aerogel | |
876 | gMC->Gspos("RGEL",1,"RREF",0,0,0,0,"ONLY");//put gel cell to reflector | |
877 | AliDebug(1,"Stop."); | |
878 | }//GeomAerogel() | |
879 | //__________________________________________________________________________________________________ | |
880 | void AliRICH::CreateGeometry() | |
881 | { | |
882 | //Creates detailed geometry simulation (currently GEANT volumes tree) | |
883 | AliDebug(1,"Start main."); | |
884 | Double_t mm=0.1;//default is cm | |
885 | Float_t par[3]; | |
886 | Int_t matrixIdReturn=0; //matrix id returned by AliMatrix | |
887 | ||
888 | //place chambers into mother volume ALIC | |
889 | par[0]=(6*mm+1681*mm+6*mm)/2;par[1]=(6*mm+1466*mm+6*mm)/2;par[2]=(80*mm+40*mm)*2/2; | |
890 | gMC->Gsvolu("RICH","BOX ",(*fIdtmed)[kCH4],par,3);//2033P1 z p84 TDR | |
891 | for(int i=1;i<=P()->Nchambers();i++){ //test configuration with single chamber is taken into account automaticaly in AliRICHParam | |
892 | AliMatrix(matrixIdReturn, | |
893 | C(i)->ThetaXd(),C(i)->PhiXd(), | |
894 | C(i)->ThetaYd(),C(i)->PhiYd(), | |
895 | C(i)->ThetaZd(),C(i)->PhiZd()); | |
896 | gMC->Gspos("RICH",i,"ALIC",C(i)->Center().X(), | |
897 | C(i)->Center().Y(), | |
898 | C(i)->Center().Z(),matrixIdReturn, "ONLY"); | |
899 | } | |
900 | ||
901 | if(P()->IsAerogel()) | |
902 | GeomAerogel(); | |
903 | else{ | |
904 | GeomPadPanelFrame(); | |
905 | GeomAmpGap(); | |
906 | if(P()->IsRadioSrc()) GeomRadioSrc(); else GeomRadiators(); | |
907 | GeomSandBox(); | |
908 | } | |
909 | AliDebug(1,"Stop main."); | |
910 | }//CreateGeometry() | |
911 | //__________________________________________________________________________________________________ | |
d3eb6079 | 912 | void AliRICH::CheckPR()const |
913 | { | |
914 | //Pattern recognition with stack particles | |
915 | TFile *pFile = new TFile("$(HOME)/RPR.root","RECREATE","RICH Pattern Recognition"); | |
916 | TNtupleD *hn = new TNtupleD("hn","ntuple","Pmod:Charge:TrackTheta:TrackPhi:TrackX:TrackY:MinX:MinY:ChargeMIP:ThetaCerenkov:NPhotons:MipIndex:Chamber:Particle"); | |
ef210ba6 | 917 | // printf("\n\n"); |
918 | // printf("Pattern Recognition done for event %5i",0); | |
d3eb6079 | 919 | AliMagF * magf = gAlice->Field(); |
920 | AliTracker::SetFieldMap(magf); | |
921 | for(Int_t iEvtN=0;iEvtN<GetLoader()->GetRunLoader()->GetNumberOfEvents();iEvtN++) { | |
922 | GetLoader()->GetRunLoader()->GetEvent(iEvtN); | |
923 | AliRICHTracker *tr = new AliRICHTracker(); | |
924 | tr->RecWithStack(hn); | |
ef210ba6 | 925 | Info("CheckPR","Pattern Recognition done for event %i \b",iEvtN); |
926 | // printf("\b\b\b\b\b%5i",iEvtN+1); | |
d3eb6079 | 927 | } |
928 | printf("\n\n"); | |
929 | pFile->Write();pFile->Close(); | |
930 | } | |
0fe8fa07 | 931 | //__________________________________________________________________________________________________ |
932 | void AliRICH::DisplayEvent(Int_t iEvtNmin,Int_t iEvtNmax)const | |
933 | { | |
934 | TH2F *pDigitsH2[8]; | |
935 | ||
936 | Bool_t isDigits =!GetLoader()->LoadDigits(); | |
937 | if(!isDigits){Error("ShoEvent","No digits. Nothing to display.");return;} | |
938 | ||
f770edb5 | 939 | TCanvas *canvas = new TCanvas("RICHDisplay","RICH Display",0,0,1226,900); |
940 | gStyle->SetPalette(1); | |
0fe8fa07 | 941 | |
942 | ||
943 | for(Int_t iChamber=1;iChamber<=7;iChamber++) { | |
944 | pDigitsH2[iChamber] = new TH2F(Form("pDigitsH2_%i",iChamber),Form("Chamber %i",iChamber),165,0,P()->PcSizeX(),144,0,P()->PcSizeY()); | |
945 | pDigitsH2[iChamber]->SetMarkerColor(kGreen); | |
946 | pDigitsH2[iChamber]->SetMarkerStyle(29); | |
947 | pDigitsH2[iChamber]->SetMarkerSize(0.4); | |
948 | pDigitsH2[iChamber]->SetStats(kFALSE); | |
f770edb5 | 949 | pDigitsH2[iChamber]->SetMaximum(300); |
0fe8fa07 | 950 | } |
951 | ||
f770edb5 | 952 | if(iEvtNmax>gAlice->GetEventsPerRun()||iEvtNmax==0) iEvtNmax=gAlice->GetEventsPerRun()-1; |
0fe8fa07 | 953 | |
d0831219 | 954 | TLatex t; t.SetTextSize(0.1); |
0fe8fa07 | 955 | for(Int_t iEventN=iEvtNmin;iEventN<=iEvtNmax;iEventN++) {//events loop |
f770edb5 | 956 | canvas->Divide(3,3); |
0fe8fa07 | 957 | canvas->cd(1); |
958 | t.DrawText(0.2,0.4,Form("Event Number %i",iEventN)); | |
959 | ||
960 | GetLoader()->GetRunLoader()->GetEvent(iEventN); //get event | |
961 | GetLoader()->TreeD()->GetEntry(0); //get list of digits | |
962 | for(Int_t iChamber=1;iChamber<=7;iChamber++) {//chambers loop | |
963 | pDigitsH2[iChamber]->Reset(); | |
964 | for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++) {//digits loop | |
965 | AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j); | |
966 | TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad()); | |
f770edb5 | 967 | pDigitsH2[iChamber]->Fill(x2.X(),x2.Y(),pDig->Q()); |
0fe8fa07 | 968 | }//digits loop |
969 | if(iChamber==1) canvas->cd(7); | |
970 | if(iChamber==2) canvas->cd(8); | |
971 | if(iChamber==3) canvas->cd(4); | |
972 | if(iChamber==4) canvas->cd(5); | |
973 | if(iChamber==5) canvas->cd(6); | |
974 | if(iChamber==6) canvas->cd(2); | |
975 | if(iChamber==7) canvas->cd(3); | |
f770edb5 | 976 | pDigitsH2[iChamber]->Draw("col"); |
977 | ReadESD(iEventN,iChamber); | |
978 | AliRICHParam::DrawSectors(); | |
0fe8fa07 | 979 | }//chambers loop |
980 | canvas->Update(); | |
981 | canvas->Modified(); | |
f770edb5 | 982 | |
983 | if(iEventN<iEvtNmax) {gPad->WaitPrimitive();canvas->Clear();} | |
0fe8fa07 | 984 | }//events loop |
985 | }//ShowEvent() | |
986 | //__________________________________________________________________________________________________ | |
987 | void AliRICH::Display()const | |
988 | { | |
989 | //Provides fast event display | |
990 | //For RICH only, full display is .x Display.C | |
991 | Bool_t isHits =!GetLoader()->LoadHits(); | |
992 | Bool_t isDigits =!GetLoader()->LoadDigits(); | |
993 | Bool_t isClusters=!GetLoader()->LoadRecPoints(); | |
994 | ||
995 | if(!isHits && !isDigits && !isClusters){Error("Exec","No hits digits and clusters. Nothing to display.");return;} | |
996 | ||
997 | TCanvas *pCanvas = new TCanvas("Display","RICH Display",0,0,600,600); | |
998 | ||
999 | TH2F *pHitsH2=0,*pDigitsH2=0,*pClustersH2=0; | |
1000 | ||
1001 | if(isHits) pHitsH2 = new TH2F("pHitsH2" , "Event Display;x,cm;y,cm",165,0,AliRICHParam::PcSizeX(), | |
1002 | 144,0,AliRICHParam::PcSizeY()); | |
1003 | if(pHitsH2) pHitsH2->SetStats(kFALSE); | |
1004 | ||
1005 | if(isDigits) pDigitsH2 = new TH2F("pDigitsH2" ,"Event Display",165,0,AliRICHParam::PcSizeX(), | |
1006 | 144,0,AliRICHParam::PcSizeY()); | |
1007 | if(isClusters) pClustersH2 = new TH2F("pClustersH2","Event Display",165,0,AliRICHParam::PcSizeX(), | |
1008 | 144,0,AliRICHParam::PcSizeY()); | |
1009 | ||
1010 | for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop | |
1011 | GetLoader()->GetRunLoader()->GetEvent(iEventN); | |
1012 | //display all the staff on chamber by chamber basis | |
1013 | for(Int_t iChamber=1;iChamber<=7;iChamber++){//chambers loop | |
1014 | if(isHits) pHitsH2 ->Reset(); | |
1015 | if(isDigits) pDigitsH2 ->Reset(); | |
1016 | if(isClusters) pClustersH2->Reset(); | |
1017 | //deals with hits | |
1018 | for(Int_t i=0;i<GetLoader()->TreeH()->GetEntries();i++){//TreeH loop | |
1019 | GetLoader()->TreeH()->GetEntry(i); | |
1020 | for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop | |
1021 | AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j); | |
1022 | if(pHit->C()==iChamber){ | |
1023 | TVector3 hitGlobX3= pHit->OutX3(); | |
1024 | TVector2 hitLocX2 = C(iChamber)->Mrs2Pc(hitGlobX3); | |
1025 | pHitsH2->Fill(hitLocX2.X(),hitLocX2.Y(),200); | |
1026 | }//if | |
1027 | }//hits loop | |
1028 | }//TreeH loop | |
1029 | pHitsH2->SetTitle(Form("event %i chamber %2i",iEventN,iChamber)); | |
1030 | pHitsH2->SetMarkerColor(kRed); pHitsH2->SetMarkerStyle(29); pHitsH2->SetMarkerSize(0.4); | |
f770edb5 | 1031 | ReadESD(iEventN,iChamber); |
0fe8fa07 | 1032 | pHitsH2->Draw(); |
56030c8d | 1033 | ReadESD(iEventN,iChamber); |
0fe8fa07 | 1034 | AliRICHParam::DrawSectors(); |
1035 | TLatex l; l.SetNDC(); l.SetTextSize(0.02); | |
1036 | if(!isHits) {l.SetTextColor(kRed) ;l.DrawLatex(0.1,0.01,"No Hits" );} | |
1037 | if(!isDigits) {l.SetTextColor(kGreen);l.DrawLatex(0.4,0.01,"No DIGITS" );} | |
1038 | if(!isClusters) {l.SetTextColor(kBlue) ;l.DrawLatex(0.8,0.01,"No CLUSTERS");} | |
1039 | pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive(); | |
1040 | //deals with digits | |
1041 | if(isDigits){ | |
1042 | GetLoader()->TreeD()->GetEntry(0); | |
1043 | for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++){//digits loop | |
1044 | AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j); | |
1045 | TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad()); | |
1046 | pDigitsH2->Fill(x2.X(),x2.Y(),100); | |
1047 | }//digits loop | |
1048 | pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4); | |
1049 | pDigitsH2->Draw("same"); | |
1050 | pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive(); | |
1051 | }//if(isDigits) | |
1052 | //deals with clusters | |
1053 | if(isClusters){ | |
1054 | GetLoader()->TreeR()->GetEntry(0); | |
1055 | for(Int_t j=0;j<Clusters(iChamber)->GetEntries();j++){//clusters loop | |
1056 | AliRICHCluster *pClus = (AliRICHCluster*)Clusters(iChamber)->At(j); | |
1057 | pClustersH2->Fill(pClus->X(),pClus->Y(),50); | |
1058 | }//clusters loop | |
1059 | pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29); pClustersH2->SetMarkerSize(0.4); | |
1060 | pClustersH2->Draw("same"); | |
1061 | pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive(); | |
1062 | }//if(isClusters) | |
1063 | }//chambers loop | |
1064 | }//events Loop | |
1065 | ||
1066 | delete pCanvas; | |
1067 | GetLoader()->UnloadHits(); | |
1068 | if(isDigits) GetLoader()->UnloadDigits(); | |
1069 | if(isClusters) GetLoader()->UnloadRecPoints(); | |
1070 | }//Display() | |
1071 | //__________________________________________________________________________________________________ | |
1072 | Int_t AliRICH::Nparticles(Int_t iPartID,Int_t iEvtN,AliRunLoader *pRL) | |
1073 | { | |
1074 | //counts total number of particles of given type (including secondary) for a given event | |
1075 | pRL->GetEvent(iEvtN); | |
1076 | if(pRL->LoadHeader()) return 0; | |
1077 | if(pRL->LoadKinematics()) return 0; | |
1078 | AliStack *pStack=pRL->Stack(); | |
1079 | ||
1080 | Int_t iCounter=0; | |
1081 | for(Int_t i=0;i<pStack->GetNtrack();i++){ | |
1082 | if(pStack->Particle(i)->GetPdgCode()==iPartID) iCounter++; | |
1083 | } | |
1084 | ||
1085 | pRL->UnloadHeader(); | |
1086 | pRL->UnloadKinematics(); | |
1087 | return iCounter; | |
1088 | } | |
56030c8d | 1089 | //__________________________________________________________________________________________________ |
1090 | void AliRICH::ReadESD(Int_t iEventN, Int_t iChamber)const | |
1091 | { | |
1092 | // | |
f770edb5 | 1093 | AliInfo("Start."); |
56030c8d | 1094 | TFile *pFile=TFile::Open("AliESDs.root","read"); |
1095 | if(!pFile || !pFile->IsOpen()) {AliInfo("ESD file not open.");return;} //open AliESDs.root | |
1096 | TTree *pTree = (TTree*) pFile->Get("esdTree"); | |
1097 | if(!pTree){AliInfo("ESD not found.");return;} //get ESD tree | |
1098 | ||
f770edb5 | 1099 | AliInfo("ESD found. Try to draw ring"); |
56030c8d | 1100 | |
1101 | AliESD *pESD=new AliESD; pTree->SetBranchAddress("ESD", &pESD); | |
1102 | ||
1103 | pTree->GetEvent(iEventN); | |
1104 | ||
1105 | Double_t b = pESD->GetMagneticField()/10.; | |
1106 | ||
1107 | Int_t iNtracks=pESD->GetNumberOfTracks(); | |
1108 | ||
1109 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop | |
1110 | AliESDtrack *pTrack = pESD->GetTrack(iTrackN);// get next reconstructed track | |
cc764ba7 | 1111 | Int_t charge = (Int_t)(-TMath::Sign(1.,pTrack->GetSign()*b)); |
1112 | AliRICHHelix helix(pTrack->X3(),pTrack->P3(),charge,b); | |
1113 | Int_t iChamberOnRICH=helix.RichIntersect(P()); | |
1114 | if(iChamberOnRICH==iChamber) { | |
1115 | // | |
f770edb5 | 1116 | TMarker *trackImpact = new TMarker(helix.PosPc().X(),helix.PosPc().Y(),kStar); |
1117 | trackImpact->SetMarkerColor(kRed); | |
1118 | trackImpact->Draw(); | |
cc764ba7 | 1119 | // |
1120 | Int_t iChamberRecon = pTrack->GetRICHcluster()/100000; | |
1121 | if(iChamberRecon==iChamber) { | |
1122 | Double_t thetaCer = pTrack->GetRICHsignal(); | |
1123 | if(thetaCer<0) continue; | |
1124 | TVector3 entrance(helix.PosRad().X(),helix.PosRad().Y(),0); | |
1125 | Double_t thetaTrack,phiTrack; | |
1126 | pTrack->GetRICHthetaPhi(thetaTrack,phiTrack); | |
1127 | TVector3 vectorTrack; | |
1128 | vectorTrack.SetMagThetaPhi(pTrack->GetP(),thetaTrack,phiTrack); | |
1129 | AliInfo(Form("Draw ring started for track %i on chamber %i",iTrackN,iChamber)); | |
1130 | AliInfo(Form("ThetaCer %f TrackTheta %f TrackPhi %f Momentum %f",thetaCer,thetaTrack,phiTrack,pTrack->GetP())); | |
1131 | Double_t dx,dy; | |
1132 | pTrack->GetRICHdxdy(dx,dy); | |
1133 | AliInfo(Form("dx %f dy %f ",dx,dy)); | |
1134 | DrawRing(entrance,vectorTrack,thetaCer); | |
1135 | } | |
56030c8d | 1136 | } |
1137 | } | |
1138 | delete pESD; pFile->Close();//close AliESDs.root | |
f770edb5 | 1139 | AliInfo("Stop."); |
56030c8d | 1140 | } |
1141 | //__________________________________________________________________________________________________ | |
1142 | void AliRICH::DrawRing(TVector3 entrance,TVector3 vectorTrack,Double_t thetaCer)const | |
1143 | { | |
1144 | Double_t xGraph[100],yGraph[100]; | |
1145 | Int_t nPointsToDraw = 0; | |
1146 | for(Int_t i=0;i<100;i++) { | |
1147 | Double_t phiCer = 2*TMath::Pi()*i/100; | |
1148 | TVector3 pos = AliRICHParam::ForwardTracing(entrance,vectorTrack,thetaCer,phiCer); | |
f770edb5 | 1149 | if(pos.X()==-999) continue; |
56030c8d | 1150 | xGraph[nPointsToDraw] = pos.X();yGraph[nPointsToDraw] = pos.Y();nPointsToDraw++; |
1151 | } | |
cc764ba7 | 1152 | // AliInfo(Form("Npoints per ring %i",nPointsToDraw)); |
56030c8d | 1153 | TGraph *gra = new TGraph(nPointsToDraw,xGraph,yGraph); |
f770edb5 | 1154 | gra->Draw("C"); |
56030c8d | 1155 | } |