1 /**************************************************************************
2 * Copyright(c) 1998-2010, 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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Wsu Cosmic Ray SetUp //
21 // This class contains the description of the Wsu Cosmic Ray SetUp //
26 <img src="picts/AliEMCALWsuCosmicRaySetUpClass.gif">
29 <font size=+2 color=red>
30 <p>The responsible person for this module is
31 <a href="mailto:pavlinov@physics.wayne.edu">Alexei Pavlino, WSU</a>.
38 ///////////////////////////////////////////////////////////////////////////////
40 #include <TVirtualMC.h>
42 #include <TDatabasePDG.h>
44 #include <TLorentzVector.h>
45 #include <TParticle.h>
51 #include "AliEMCALWsuCosmicRaySetUp.h"
52 //#include "AliMagF.h"
57 #include "AliEMCALHistoUtilities.h"
61 typedef AliEMCALHistoUtilities hist;
63 TDatabasePDG *pdg = 0;
67 ClassImp(AliEMCALWsuCosmicRaySetUp)
69 // TList *fLHists=0, *ll=0;
71 //_____________________________________________________________________________
72 AliEMCALWsuCosmicRaySetUp::AliEMCALWsuCosmicRaySetUp(): AliModule()
74 ,fLHists(0),fMasterVolume()
77 // Default constructor
81 //_____________________________________________________________________________
82 AliEMCALWsuCosmicRaySetUp::AliEMCALWsuCosmicRaySetUp(const char *name, const char *title)
83 : AliModule(name,title)
85 ,fLHists(0),fMasterVolume()
88 // Standard constructor of the Wsu Cosmic Ray SetUp external volume
90 //PH SetMarkerColor(7);
91 //PH SetMarkerStyle(2);
92 //PH SetMarkerSize(0.4);
95 //_____________________________________________________________________________
96 void AliEMCALWsuCosmicRaySetUp::CreateGeometry()
99 // Create the geometry of the Alice external body
103 <img src="picts/AliEMCALWsuCosmicRaySetUpTree.gif">
106 pdg = TDatabasePDG::Instance();
109 fMasterVolume[0] = fMasterVolume[1] = 35.0;
110 fMasterVolume[2] = 450.;
112 Int_t *idtmed = fIdtmed->GetArray()+1;
113 int idAir = idtmed[0];
114 gMC->Gsvolu(GetName(),"BOX",idAir, fMasterVolume,3); // Master volume
118 Float_t sc[3]; // tube
121 sc[2] = 1.0; // thicness of Sc is 2 cm
122 Float_t zsc[3] = {10.,330.6, 810.1};
123 int idSC = idtmed[1];
124 gMC->Gsvolu("SCOU","TUBE",idSC, sc,3); // Master volume
125 printf(" idtmed[0] %i idtmed[1] %i \n", idtmed[0] , idtmed[1]);
126 Int_t idRot=0; // no rotation
127 for(Int_t i=0; i<3; i++) {
128 Float_t zpos = zsc[i] - fMasterVolume[2];
129 gMC->Gspos("SCOU", i+1, "WSUC", 0.0, 0.0, zpos, idRot, "ONLY");
132 // Dead end : Dec 2,2010
134 Float_t zbox[3]={30., 30.0, 0.1};
135 gMC->Gsvolu("SEND","BOX",idAir, zbox,3); // Master volume
136 gMC->Gspos("SEND", 1, "WSUC", 0.0, 0.0, 448.0, idRot, "ONLY");
139 fLHists->SetName("hists");
141 //AliMC *ALIMC = dynamic_cast<AliMC *>(gMC);
142 //AliGenBox* gB = dynamic_cast<AliGenBox *>(ALIMC->Generator());
144 fLHists->Add(BookKineHists(1.,"primeKineHists"));
145 fLHists->Add(BookKineHists(1.,"endKineHists"));
146 fLHists->Add(BookKineHists(1.,"secondaryKineHists"));
147 //ll = BookKineHists(1.,"kineHists");
148 //gROOT->GetListOfBrowsables()->Add(ll);
151 //_____________________________________________________________________________
152 void AliEMCALWsuCosmicRaySetUp::CreateMaterials()
154 // Create materials and media
156 Float_t sxmgmx = 0., deemax = 0.1;
158 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
159 Float_t zAir[4]={6.,7.,8.,18.};
160 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
161 Float_t dAir = 1.20479E-3;
162 AliMixture(1,"Air $",aAir,zAir,dAir,4,wAir);
164 // --- The polysterene scintillator (CH) ---
165 Float_t aP[2] = {12.011, 1.00794} ;
166 Float_t zP[2] = {6.0, 1.0} ;
167 Float_t wP[2] = {1.0, 1.0} ;
169 AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
172 AliMedium(1,"Air $",1,0,isxfld,sxmgmx,10,-1,-0.1,0.1 ,-10);
173 AliMedium(2, "Scintillator$", 2, 1,
174 isxfld, sxmgmx, 10.0, 0.001, deemax, 0.001, 0.001, 0, 0) ;
180 void AliEMCALWsuCosmicRaySetUp::DefineCuts(const Int_t idtmed)
182 // Dec 2,2010 : it works
183 Float_t cutgam=10.e-5; // 100 kev;
184 Float_t cutele=10.e-5; // 100 kev;
185 gMC->Gstpar(idtmed,"CUTGAM", cutgam);
186 gMC->Gstpar(idtmed,"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
187 gMC->Gstpar(idtmed,"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
188 gMC->Gstpar(idtmed,"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
189 // --- Generate explicitly delta rays in Lead ---
190 gMC->Gstpar(idtmed, "LOSS", 3) ;
191 gMC->Gstpar(idtmed, "DRAY", 1) ;
192 gMC->Gstpar(idtmed, "DCUTE", cutele) ;
193 gMC->Gstpar(idtmed, "DCUTM", cutele) ;
196 void AliEMCALWsuCosmicRaySetUp::StepManager(void)
200 static TString curVolName="";
201 static TLorentzVector pos; // Lorentz vector of the track current position.
202 static TLorentzVector mom; // Lorentz vector of the track current momentum.
204 if(pri>=2) printf("<I> AliEMCALWsuCosmicRaySetUp::StepManager %s \n", gMC->CurrentVolName());
205 Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber();
208 curVolName = gMC->CurrentVolName();
209 if(curVolName.Contains("SEND")) {
210 gMC->TrackMomentum(mom);
211 gMC->TrackPosition(pos);
212 if(pri>=2) printf(" %s tracknumber %i p %f \n", curVolName.Data(), tracknumber, mom.P());
213 if(pri>=2) printf(" x %f y %f z %f \n", pos[0], pos[1], pos[2]);
214 if(gMC->IsTrackEntering()) { // primary only TList *l = GetLhists(1);
218 part=gAlice->GetMCApp()->Particle(0);
219 gid = pdg->ConvertPdgToGeant3(part->GetPdgCode());
220 hist::FillH1(l, 1, double(gid));
223 part=gAlice->GetMCApp()->Particle(tracknumber);
224 gid = pdg->ConvertPdgToGeant3(part->GetPdgCode());
225 hist::FillH1(l, 1, double(gid));
228 hist::FillH1(l, ic++, mom.P());
229 hist::FillH1(l, ic++, mom.Eta());
230 hist::FillH1(l, ic++, TVector2::Phi_0_2pi(mom.Phi())*TMath::RadToDeg() );
231 hist::FillH1(l, ic++, mom.Theta()*TMath::RadToDeg());
236 void AliEMCALWsuCosmicRaySetUp::FinishEvent()
241 TList *l = GetLhists(0);
243 AliStack* st = AliRunLoader::Instance()->Stack();
244 TParticle *p = st->Particle(0);
245 gid = pdg->ConvertPdgToGeant3(p->GetPdgCode());
248 hist::FillH1(l, ic++, double(gid));
249 hist::FillH1(l, ic++, p->P());
250 hist::FillH1(l, ic++, p->Eta());
251 hist::FillH1(l, ic++, TVector2::Phi_0_2pi(p->Phi())*TMath::RadToDeg() );
252 hist::FillH1(l, ic++, p->Theta()*TMath::RadToDeg());
255 TList* AliEMCALWsuCosmicRaySetUp::BookKineHists(const Double_t p , const Char_t *opt)
259 TH1::AddDirectory(1);
263 Int_t phimin=0.0, phimax=360.;
265 if(p>0.1) pmax = 1.1*p;
266 h = new TH1F("00_hNPrim"," number of primary particles ", 10, 0.5, 10.5);
267 hgid = new TH1F("01_hGidprim","Geant Id of primary particles", 16, 0.5, 16.5);
268 new TH1F("02_hPmomPrim","p of primary particles", 200, 0.0, pmax);
269 new TH1F("03_hEtaPrim","#eta primary particles", 80, 0.0, 8.0);
270 new TH1F("04_hPhiPrim","#phi primary particles", nphi,phimin,phimax);
271 new TH1F("05_hThetaPrim","#theta primary particles", 90, 0.0, 90.);
273 TAxis *xax=hgid->GetXaxis();
274 xax->SetBinLabel(1,"#gamma");
275 xax->SetBinLabel(2,"e^{+}");
276 xax->SetBinLabel(3,"e^{-}");
277 xax->SetBinLabel(4,"#nu");
278 xax->SetBinLabel(5,"#mu^{+}");
279 xax->SetBinLabel(6,"#mu^{-}");
280 xax->SetBinLabel(7,"#pi^{0}");
281 xax->SetBinLabel(8,"#pi^{+}");
282 xax->SetBinLabel(9,"#pi^{-}");
283 xax->SetBinLabel(10,"K_{L}");
284 xax->SetBinLabel(11,"K^{+}");
285 xax->SetBinLabel(12,"K^{-}");
286 xax->SetBinLabel(13,"n");
287 xax->SetBinLabel(14,"p");
288 xax->SetBinLabel(15,"#bar{p}");
289 xax->SetBinLabel(16,"K_{s}");
290 // hgid->SetBinLabel(,"");
293 l = hist::MoveHistsToList(opt, 1);
294 if(strlen(opt)) hist::AddToNameAndTitleToList(l, opt, opt);
296 TH1::AddDirectory(0);
301 void AliEMCALWsuCosmicRaySetUp::Browse(TBrowser* b)
303 if(fLHists) b->Add(fLHists);