GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AgataTrackDisplay.C
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004-2006 by Olivier Stezowski & Christian Finck *
3  * stezow(AT)ipnl.in2p3.fr, cfinck(AT)ires.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 
22 #if !defined(__CINT__) || defined(__MAKECINT__)
23 
24 #include "Riostream.h"
25 
26 #include "TMath.h"
27 #include "TRandom.h"
28 #include "TEveManager.h"
29 
31 #include "AgataEventDisplay.h"
32 #include "AgataEventContainer.h"
33 
34 #include "GeantLMOF.h"
35 #include "GEM.h"
36 #include "GammaLink.h"
37 
38 #endif
39 
46 void AgataTrackDisplay(Int_t nEvents = 100)
47 {
48  Float_t metricConv = 10.;
49 
51  Gw::AgataEventContainer* agataContainer = dis->GetEventContainer();
52  dis->SetTrackStyle("Cone");
53 
54  // GEM part
55  Gw::GEM gem;
56 
57  Gw::BaseGEM *random = 0x0;
58  random = new Gw::BaseGEM();
59  // needs ags file
60  random->Import("../../ndb/198Pb.ags");
61 
62  TList cas; Gw::GammaLink *gam;
63 
64  // loop over events
65  for (Int_t i = 0; i < nEvents; ++i) {
66 
67  // to get the next cascade
68  random->DoCascade(cas,"");
69 
70  for (Int_t j = 0; j < cas.GetSize(); j++ ) {
71 
72  gam = (Gw::GammaLink *)cas.At(j);
73  Double_t e = gRandom->Gaus(gam->GetEnergy().Get(),1);
74 
75  Double_t x,y,z;
76  Double_t theta, phi, rho, drho;
77  theta = gRandom->Uniform(TMath::Pi()/4.);
78  phi = gRandom->Uniform(2*TMath::Pi());
79  rho = gRandom->Uniform(235, 329);
80  drho = gRandom->Uniform(94);
81  x = rho*TMath::Sin(theta)*TMath::Cos(phi);
82  y = rho*TMath::Sin(theta)*TMath::Sin(phi);
83  z = drho*TMath::Cos(theta) + 235;
84 
85  // new track hit belonging to list
86  Gw::TrackHit* hit = agataContainer->NewTrackHit();
87  hit->SetX(x/metricConv);
88  hit->SetY(y/metricConv);
89  hit->SetZ(z/metricConv);
90  hit->SetE(e);
91 
92  // new hits inside track
93  Gw::StdHit* shit = hit->NewHit();
94  shit->SetX(x/metricConv);
95  shit->SetY(y/metricConv);
96  shit->SetZ(z/metricConv);
97  shit->SetE(e*0.6);
98 
99  Int_t ndiff = Int_t(gRandom->Uniform(0, 1) + 0.5);
100  for (Int_t k = 0; k < ndiff; ++k) {
101  shit = hit->NewHit();
102  theta = gRandom->Uniform(TMath::Pi()/2.);
103  phi = gRandom->Uniform(2*TMath::Pi());
104  rho = gRandom->Uniform(-30, 30);
105  x += rho*TMath::Sin(theta)*TMath::Cos(phi);
106  y += rho*TMath::Sin(theta)*TMath::Sin(phi);
107  z += rho*TMath::Cos(theta);
108  shit->SetXYZ(x/metricConv,y/metricConv,z/metricConv);
109  shit->SetE(e*0.4/(ndiff+1) );
110  }
111  }
112  // fill tracks for Agata
113  agataContainer->FillTracks("Agata");
114  }
115 
116  //--------------------- display ---------------------
117 
118  // add geometry of Agata via AgataGeometryTransformer
119  // need aclust, aeuler, asolid files
120  dis->AddGeometry(Gw::AgataGeometryTransformer::ImportAgata("../gem/asolid", "../gem/aclust", "../gem/aeuler"));
121  dis->ShowDisplay();
122 }
123 
124 
125 
126 
AgataEventContainer class that contains agata event to be displayed.
virtual void SetE(Float_t e)
void AgataTrackDisplay(Int_t nEvents=100)
Macro that generates gamma rays from a given level scheme and generated randomly associated positions...
StdHit * NewHit()
Add a new hit to the track (filling mode). The Stack is emptied by calling Reset. ...
AgataEventDisplay a class to work on a specific event display.
Class to get randomly cascades (with lateral feeding) of gammas on the basis of a level scheme...
Definition: GEM.h:55
virtual void SetZ(Float_t z)
Class to get randomly cascades of gammas on the basis of a level scheme.
Definition: BaseGEM.h:107
void FillTracks(Option_t *type="Agata")
AgataEventContainer * GetEventContainer() const
virtual void SetY(Float_t y)
virtual void SetX(Float_t x)
Setter position & energy.
virtual Data_T Get() const
get the value, can be overloaded
Definition: Data.h:70
virtual void SetE(Float_t e)
virtual void SetY(Float_t y)
header file for a GEM (gamma-rays generator)
virtual void SetZ(Float_t z)
virtual void SetX(Float_t x)
Setter position & energy.
TrackHit * NewTrackHit(Option_t *type="Agata")
add current track hit (added to current track hit list)
virtual void AddGeometry(TGeoVolume *volume, TGeoMatrix *matrix=gGeoIdentity)
virtual Int_t DoCascade(TSeqCollection &cascade, Option_t *opt="")
cascade simulation
Definition: BaseGEM.cpp:523
void SetTrackStyle(const Char_t *s, Option_t *type="Agata")
Set track style (rec/cone)
static TGeoVolume * ImportAgata(const char *asolid="asolid", const char *aclust="aclust", const char *aeuler="aeuler", const char *baseclusname="agataCluster", const char *agataName="Agata")
to import the agata geometry from the Agata world
virtual void SetXYZ(Float_t x, Float_t y, Float_t z)
virtual Int_t Import(const Char_t *, Option_t *opt="152DY")
Load the level scheme and init the Monte-Carlo.
Definition: BaseGEM.cpp:194
static AgataEventDisplay * Instance()