#include <GtMuoneratorTool.h>
Inheritance diagram for GtMuoneratorTool:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
GtMuoneratorTool (const std::string &type, const std::string &name, const IInterface *parent) | |
virtual | ~GtMuoneratorTool () |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | mutate (HepMC::GenEvent &event) |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | evtColSvc () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | evtSvc () const |
IIncidentSvc * | incSvc () const |
IChronoStatSvc * | chronoSvc () const |
IHistogramSvc * | histoSvc () const |
IAlgContextSvc * | contextSvc () const |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
DataObject * | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
virtual unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual unsigned long | addRef () |
virtual const std::string & | name () const |
virtual const std::string & | type () const |
virtual const IInterface * | parent () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysStart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
PropertyMgr * | getPropertyMgr () |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
IMessageSvc * | msgSvc () const |
IToolSvc * | toolSvc () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
void | declInterface (const InterfaceID &, void *) |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IAuditorSvc * | auditorSvc () const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
virtual const std::string & | type () const =0 |
virtual const IInterface * | parent () const =0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | reinitialize ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () const =0 |
virtual StatusCode | sysInitialize ()=0 |
virtual StatusCode | sysStart ()=0 |
virtual StatusCode | sysStop ()=0 |
virtual StatusCode | sysFinalize ()=0 |
virtual StatusCode | sysReinitialize ()=0 |
virtual StatusCode | sysRestart ()=0 |
virtual unsigned long | refCount () const =0 |
virtual const std::string & | name () const =0 |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)=0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
int | outputLevel () const |
virtual unsigned long | refCount () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Member Functions | |
StatusCode | ReadMuons () |
double | GetMuPlusMinusRatio (double momInGeV) |
int | GetPIDFromMomentum (double momInGeV) |
Private Attributes | |
std::string | m_whichSite |
std::string | m_muonFileName |
std::string | m_ratioFileName |
std::string | m_volume |
bool | m_rotation |
TH1F * | m_pmratio |
std::vector< double > | m_muonE |
std::vector< double > | m_muonPhi |
std::vector< double > | m_muonTheta |
double | m_Sx |
double | m_Sy |
double | m_Sz |
double | m_Smax |
CLHEP::Hep3Vector | m_detectorDim |
CLHEP::Hep3Vector | m_detectorCenter |
double | m_dphi |
IRndmGenSvc * | m_rgs |
Rndm::Numbers | m_uni |
Based on old Generators/Muon
bv@bnl.gov Wed May 5 16:39:04 2010
Definition at line 27 of file GtMuoneratorTool.h.
GtMuoneratorTool::GtMuoneratorTool | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 29 of file GtMuoneratorTool.cc.
00032 : GaudiTool(type,name,parent) 00033 , m_pmratio(0) 00034 , m_Sx(0), m_Sy(0), m_Sz(0), m_Smax(0) 00035 , m_dphi(0) 00036 { 00037 declareInterface<IHepMCEventMutator>(this); 00038 00039 declareProperty("WhichSite",m_whichSite="", 00040 "Which site (DYB, LA, Mid, Far,SAB)"); 00041 declareProperty("Rotation",m_rotation=false, 00042 "Set to true to assume rotation for the given site"); 00043 declareProperty("MuonFile",m_muonFileName="", 00044 "Name of file giving muons to sample"); 00045 declareProperty("RatioFile",m_ratioFileName="", 00046 "Name of file giving mu+/mu- ratio histogram"); 00047 declareProperty("Volume",m_volume="rock", 00048 "Volume name (rock, RPC, ADE)"); 00049 info() << "Creating GtMuoneratorTool(\"" << type << "\", \"" << name << "\")" << endreq; 00050 }
GtMuoneratorTool::~GtMuoneratorTool | ( | ) | [virtual] |
Definition at line 53 of file GtMuoneratorTool.cc.
00054 { 00055 info() << "Destroying GtMuoneratorTool site=" << m_whichSite 00056 << " MuonFile=" << m_muonFileName 00057 << " RatioFile=" << m_ratioFileName 00058 << " Volume=" << m_volume 00059 << endreq; 00060 }
StatusCode GtMuoneratorTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 62 of file GtMuoneratorTool.cc.
00063 { 00064 // Set up random numbers 00065 m_rgs = 0; 00066 if (service("RndmGenSvc",m_rgs,true).isFailure()) { 00067 fatal() << "Failed to get random service" << endreq; 00068 return StatusCode::FAILURE; 00069 } 00070 if (m_uni.initialize(m_rgs, Rndm::Flat(0,1)).isFailure()) { 00071 fatal() << "Failed to initialize uniform random numbers" << endreq; 00072 return StatusCode::FAILURE; 00073 } 00074 00075 // leak this file 00076 TFile* file = new TFile(m_ratioFileName.c_str(),"read"); 00077 if (file->IsZombie()) { 00078 warning() << "Failed to open ROOT file \"" << m_ratioFileName << "\"" 00079 << " will fall back to parametrized ratio" 00080 << endreq; 00081 } 00082 else { 00083 m_pmratio = (TH1F*)file->Get("mu_plus_minus_ratio"); 00084 00085 if (!m_pmratio) { 00086 error() << "Failed to get \"mu_plus_minus_ratio\" TH1F from ROOT file " 00087 << m_ratioFileName << endreq; 00088 return StatusCode::FAILURE; 00089 } 00090 } 00091 00092 return ReadMuons(); 00093 }
StatusCode GtMuoneratorTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 344 of file GtMuoneratorTool.cc.
00345 { 00346 return StatusCode::SUCCESS; 00347 }
StatusCode GtMuoneratorTool::mutate | ( | HepMC::GenEvent & | event | ) | [virtual] |
Implements IHepMCEventMutator.
Definition at line 349 of file GtMuoneratorTool.cc.
00350 { 00351 double pS_z=0, pS_x=0, pS_y=0; // projected area in x, y, z direction. 00352 const double PI = 3.1415926; 00353 Hep3Vector direction; // the muon direction. 00354 double muon_mass = 0.105658*CLHEP::GeV; 00355 double weight = 1.; 00356 double arandom=0; 00357 int ievent = 0; 00358 00359 do { // pick a muon 00360 ievent = (int)(m_uni() * (m_muonE.size()-1)); 00361 debug() << "Pick muon " << ievent << " out of " << m_muonE.size() << endreq; 00362 00363 // convert coordinates from MUSIC system to digimap system. 00364 double theta = PI - PI * m_muonTheta[ievent]/180; 00365 double phi = PI/2 -PI * m_muonPhi[ievent]/180; 00366 if (phi < 0) phi = phi + 2 * PI; 00367 00368 // The WC detector may be rotated an angle to better shield 00369 // neutrons, It is convenient to rotate muon direction instead 00370 // of rotating detector in Geant4 00371 phi = phi + m_dphi; 00372 if(phi > 2 * PI) phi = phi - 2 * PI; 00373 direction.setX(sin(theta) * cos(phi)); 00374 direction.setY(sin(theta) * sin(phi)); 00375 direction.setZ(cos(theta)); 00376 00377 // projected area of the WE surface to this muon. 00378 pS_z = m_Sz * abs(direction.z()); 00379 pS_x = m_Sx * abs(direction.x()); 00380 pS_y = m_Sy * abs(direction.y()); 00381 00382 weight = ( pS_z + pS_x + pS_y )/m_Smax; 00383 arandom = m_uni(); 00384 } while ( arandom > weight ); // drop this muon. 00385 00386 // calculate the muon momentum and position. 00387 00388 double eMuon = m_muonE[ievent]; 00389 double pMuon = sqrt(eMuon*eMuon - muon_mass*muon_mass); 00390 Hep3Vector momentum; 00391 momentum.setX(pMuon * direction.x()); 00392 momentum.setY(pMuon * direction.y()); 00393 momentum.setZ(pMuon * direction.z()); 00394 00395 Hep3Vector position; 00396 // muon hits the top panel. 00397 if( arandom < pS_z/m_Smax) { 00398 position.setX(m_detectorCenter.x() + 00399 (m_uni()-0.5) * m_detectorDim.x()); 00400 position.setY(m_detectorCenter.y() + 00401 (m_uni()-0.5) * m_detectorDim.y()); 00402 position.setZ(m_detectorCenter.z() + 0.5 * m_detectorDim.z()); 00403 00404 } 00405 // muon hits the X panel. 00406 else if( arandom < (pS_z + pS_x)/m_Smax) { 00407 position.setY( m_detectorCenter.y() + 00408 (m_uni()-0.5) * m_detectorDim.y() ); 00409 position.setZ( m_detectorCenter.z() + 00410 (m_uni()-0.5) * m_detectorDim.z() ); 00411 if (direction.x() > 0) 00412 position.setX( m_detectorCenter.x() - 0.5 * m_detectorDim.x() ); 00413 if (direction.x() < 0) 00414 position.setX( m_detectorCenter.x() + 0.5 * m_detectorDim.x() ); 00415 } 00416 // muon hits the Y panel. 00417 else if( arandom < weight) { 00418 position.setX( m_detectorCenter.x() + 00419 (m_uni()-0.5) * m_detectorDim.x() ); 00420 position.setZ( m_detectorCenter.z() + 00421 (m_uni()-0.5) * m_detectorDim.z() ); 00422 if (direction.y() > 0) 00423 position.setY( m_detectorCenter.y() - 0.5 * m_detectorDim.y() ); 00424 if (direction.y() < 0) 00425 position.setY( m_detectorCenter.y() + 0.5 * m_detectorDim.y() ); 00426 } 00427 00428 00429 int pid = GetPIDFromMomentum(momentum.mag()/CLHEP::GeV); 00430 00431 HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(position.x(), 00432 position.y(), 00433 position.z(), 0)); 00434 00435 HepMC::FourVector fourmom(momentum.x(), momentum.y(), momentum.z(), eMuon); 00436 00437 debug() << "momentum.mag()=" << momentum.mag()/CLHEP::GeV << " GeV/c " 00438 << "pMuon=" << pMuon/CLHEP::GeV << " GeV/c " 00439 << "eMuon=" << eMuon/CLHEP::GeV << " GeV " 00440 << "muon_mass=" << muon_mass/CLHEP::MeV << " MeV/c^2 " 00441 << "sqrt(e^2-p^2)=" << sqrt(eMuon*eMuon-pMuon*pMuon) 00442 << endreq; 00443 00444 HepMC::GenParticle* particle = new HepMC::GenParticle(fourmom,pid,1/*=status*/); 00445 particle->set_generated_mass(muon_mass); 00446 00447 vertex->add_particle_out(particle); 00448 event.set_signal_process_vertex(vertex); 00449 00450 return StatusCode::SUCCESS; 00451 }
StatusCode GtMuoneratorTool::ReadMuons | ( | ) | [private] |
Definition at line 131 of file GtMuoneratorTool.cc.
00132 { 00133 // djaffe 7mar07. (Corrected 12mar07. x-,y-dimensions were swapped.) 00134 // set dimensions and detector center based on CD1 release (doc-765,762,720) 00135 // for DYB, LA, Far and default site 00136 Double_t height_RPC = 0.50*CLHEP::m ; // RPCs are nominally 50cm above surface of shield volume (includes 20cm of air above water) 00137 Double_t thick_RPC = 0.056*CLHEP::m + 0.030*CLHEP::m ; // 1.4cm/layer*4layers + 1cm spacing*3spaces between layers 00138 Double_t overlap_RPC= 1.0*CLHEP::m ; // nominal 1m overlap of RPC with rock around pool 00139 Double_t extra = 0.05*CLHEP::m ; // 5cm extra space to make sure muons start outside of all active volumes 00140 Double_t width_near = 10.0*CLHEP::m ; // width of near pool 00141 Double_t width_far = 16.0*CLHEP::m ; // width of far pool 00142 Double_t length = 16.0*CLHEP::m ; // length of near and far pool 00143 Double_t depth = 10.0*CLHEP::m ; // depth of near and far pool 00144 Double_t air_thick = 0.2*CLHEP::m ; // 20cm of air above water 00145 Double_t height_hall= 15.0*CLHEP::m ; // 15m of air above water, from water surface to hall ceiling 00146 Double_t top_rock_extra = 2*CLHEP::m; // 2m of rock above hall ceiling 00147 Double_t side_rock_extra= 4*CLHEP::m; // this will make sure at least there is 2m rock of hall wall 00148 // for pool 4m of rock 00149 Double_t bottom_rock_extra = 2*CLHEP::m; // 2m of rock under the pool 00150 00151 Double_t yDim ; // depends on near,far 00152 Double_t xDim ; // same for near,far 00153 Double_t zDim; // box height 00154 // the origin (0,0,0) is always at the center of water pool 00155 Double_t zOffset; // center of the volume 00156 00157 // stainless steel 00158 // <!-- Radius for SST --> 00159 Double_t ADsstRadius=2500*CLHEP::mm; 00160 // <!-- Height for SST --> 00161 Double_t ADsstHeight=5000*CLHEP::mm; 00162 // AD envelop size 00163 // <!-- ADE extention beyond SST in radius --> 00164 Double_t ADadeWall=1.0*CLHEP::cm; // 0.25*m; 00165 // <!-- ADE head gap above tank --> 00166 Double_t ADadeHead=1.0*CLHEP::cm; // 1.0*m; 00167 // <!-- ADE foot gap below tank --> 00168 Double_t ADadeFoot=1.0*CLHEP::cm; 00169 // <!-- ADE radius --> 00170 Double_t ADadeRadius=ADsstRadius+ADadeWall; 00171 // <!-- ADE height --> 00172 Double_t ADadeHeight=ADadeFoot+ADsstHeight+ADadeHead; 00173 00174 if (m_volume == "rock") { 00175 //Z 00176 zDim=depth + height_hall + top_rock_extra + bottom_rock_extra; // same for near, far; 00177 // the origin (0,0,0) is always at the center of water pool 00178 zOffset=(height_hall + top_rock_extra - bottom_rock_extra)/2; // vertical offset of the certer of z 00179 //X 00180 xDim = length + 2.*overlap_RPC + 2.*side_rock_extra; // same for near,far 00181 //Y 00182 if (m_whichSite == "DYB" || m_whichSite == "LA") { 00183 yDim=width_near + 2.*overlap_RPC + 2.*side_rock_extra; 00184 } 00185 else if (m_whichSite == "Far") { 00186 yDim=width_far + 2.*overlap_RPC + 2.*side_rock_extra; 00187 } 00188 else { 00189 // fixme: error - unknown site 00190 } 00191 } 00192 else if (m_volume == "RPC") { 00193 //Z 00194 zDim=height_RPC + thick_RPC + depth + extra + air_thick; // same for near,far 00195 // the origin (0,0,0) is always at the center of water pool 00196 zOffset=(height_RPC + thick_RPC + extra + air_thick)/2. ; // vertical offset of center of 'detector' 00197 //X 00198 xDim = length + 2.*overlap_RPC + 2.*extra; 00199 //Y 00200 if (m_whichSite == "DYB" || m_whichSite == "LA") { 00201 yDim=width_near + 2.*overlap_RPC + 2.*extra; 00202 } 00203 else if (m_whichSite == "Far") { 00204 yDim=width_far + 2.*overlap_RPC + 2.*extra; 00205 } 00206 else { 00207 // fixme: error - unknown site 00208 } 00209 } 00210 else if (m_volume == "ADE") { 00211 // Z 00212 zDim=ADadeHeight; 00213 // the origin (0,0,0) is always at the center of AD 00214 zOffset=0; 00215 // X 00216 xDim= 2*ADadeRadius; 00217 // Y 00218 yDim=xDim; 00219 } 00220 else { 00221 cout<<"muon_generator: *** ERROR *** Invalid volume " << m_volume 00222 << " selected. Valid volume names are rock, RPC and ADE"<<endl; 00223 assert(0); // this will end the job 00224 } 00225 00226 Double_t dphi=0; // detector angle. 00227 00228 00229 // get the right detector setting and the right muon flux file 00230 ifstream infile; 00231 infile.open(m_muonFileName.c_str(), ios_base::in); 00232 if (!infile.is_open()) { 00233 error() << "Failed to open muon flux file \"" << m_muonFileName << "\"" 00234 << endreq; 00235 return StatusCode::FAILURE; 00236 } 00237 debug() << "Opened file \"" << m_muonFileName << "\"" << endreq; 00238 00239 if(m_whichSite == "DYB") { 00240 m_detectorDim = Hep3Vector(xDim, yDim, zDim); 00241 m_detectorCenter = Hep3Vector(0, 0, zOffset ); 00242 if(m_rotation) { 00243 dphi = 56.7*degree; 00244 } 00245 } 00246 else if(m_whichSite == "CDR") { 00247 m_detectorDim = Hep3Vector(16.06*CLHEP::m, 10.06*CLHEP::m, 10.0*CLHEP::m ); 00248 m_detectorCenter = Hep3Vector(0, 0, -5*CLHEP::m ); 00249 dphi = 0; 00250 } 00251 else if(m_whichSite == "LA") { 00252 m_detectorDim = Hep3Vector(xDim, yDim, zDim); 00253 m_detectorCenter = Hep3Vector(0, 0, zOffset ); 00254 if(m_rotation) { 00255 dphi = 79.6*degree; 00256 } 00257 } 00258 else if(m_whichSite == "Mid") { 00259 error()<<" No implemented yet. "<<endl; 00260 return StatusCode::FAILURE; 00261 } 00262 else if(m_whichSite == "Far") { 00263 m_detectorDim = Hep3Vector(xDim, yDim, zDim); 00264 m_detectorCenter = Hep3Vector(0, 0, zOffset ); 00265 if(m_rotation) { 00266 dphi = 60.5*degree; 00267 } 00268 } 00269 else if(m_whichSite == "SAB") { 00270 m_detectorDim = Hep3Vector(5.2*CLHEP::m, 5.2*CLHEP::m, 5.2*CLHEP::m ); 00271 m_detectorCenter = Hep3Vector(0, 0, 0 ); 00272 dphi = 0; 00273 } 00274 else { 00275 // 23mar07 djaffe If no valid site name, then STOP 00276 error() <<"muon_generator: *** ERROR *** Invalid site " << m_whichSite 00277 << " selected. Valid site names are Far, Mid, DYB, LA, CDR,SAB"<<endreq; 00278 return StatusCode::FAILURE; 00279 } 00280 00281 // Calculate size of sides to generate on for later. 00282 00283 // the detector geometry 00284 Double_t dimx=0, dimy=0, dimz=0; 00285 Double_t xdet=0, ydet=0, zdet=0; 00286 00287 dimx = m_detectorDim.x()/CLHEP::m; 00288 dimy = m_detectorDim.y()/CLHEP::m; 00289 dimz = m_detectorDim.z()/CLHEP::m; 00290 xdet = m_detectorCenter.x()/CLHEP::m; 00291 ydet = m_detectorCenter.y()/CLHEP::m; 00292 zdet = m_detectorCenter.z()/CLHEP::m; 00293 cout<<"The detector dimension is: " 00294 <<dimx<<"*m, "<<dimy<<"*m, "<<dimz<<"*m"<<endl; 00295 cout<<"The detector center is: " 00296 <<xdet<<"*m, "<<ydet<<"*m, "<<zdet<<"*m"<<endl; 00297 cout<<"The detector angle is: "<<dphi<<endl; 00298 cout<<"MAKE SURE the setting is consistent with Geant4 setting!!!"<<endl; 00299 00300 m_Sz = dimx * dimy; 00301 m_Sx = dimy * dimz; 00302 m_Sy = dimx * dimz; 00303 m_Smax = sqrt(m_Sx*m_Sx + m_Sy*m_Sy + m_Sz*m_Sz); 00304 m_dphi = dphi; 00305 00306 // read in muons 00307 00308 //temporary variable to hold data in flux file. 00309 Double_t energy, phi, theta, energy0, phi0, theta0; 00310 00311 Double_t flux_of_site; 00312 // line 1 to line 6 are comments 00313 char tmp[255]; 00314 for (int lineNo=0; lineNo<4; lineNo++) { 00315 infile.getline(tmp, 255); 00316 } 00317 // line 5 contains flux info of that site. 00318 infile.getline(tmp,255,':'); 00319 infile>>flux_of_site; 00320 infile.getline(tmp,255); 00321 // line 6 00322 infile.getline(tmp,255); 00323 00324 while (!infile.eof()) { 00325 infile>>energy>>theta>>phi>>energy0>>theta0>>phi0; 00326 m_muonE.push_back(energy*CLHEP::GeV); 00327 m_muonPhi.push_back(phi); 00328 m_muonTheta.push_back(theta); 00329 verbose() << "Loading muon E=" << energy*CLHEP::GeV 00330 << " phi=" << phi 00331 << " theta=" << theta 00332 << endreq; 00333 } 00334 00335 m_muonE.pop_back(); 00336 m_muonPhi.pop_back(); 00337 m_muonTheta.pop_back(); 00338 00339 return StatusCode::SUCCESS; 00340 00341 } // ReadMuons()
double GtMuoneratorTool::GetMuPlusMinusRatio | ( | double | momInGeV | ) | [private] |
Definition at line 105 of file GtMuoneratorTool.cc.
00106 { 00107 if (!m_pmratio) return GetMuPlusMinusRatioParam(momInGeV); 00108 00109 int binno = m_pmratio->FindBin(momInGeV); 00110 //return the measured value if within range. otherwise return 1.4 00111 if(binno>=1&&binno<=m_pmratio->GetNbinsX()) 00112 return m_pmratio->GetBinContent(binno); 00113 return 1.4; 00114 }
int GtMuoneratorTool::GetPIDFromMomentum | ( | double | momInGeV | ) | [private] |
Definition at line 116 of file GtMuoneratorTool.cc.
00117 { 00118 double ratio = GetMuPlusMinusRatio(momInGeV); 00119 double prob_mu_plus = ratio/(1.+ratio); 00120 //int number = gRandom->Binomial(1, prob_mu_plus); 00121 Rndm::Numbers bi; 00122 if (bi.initialize(m_rgs, Rndm::Binomial(1,prob_mu_plus)).isFailure()) { 00123 fatal() << "Failed to initialize uniform random numbers" << endreq; 00124 return StatusCode::FAILURE; 00125 } 00126 int number = bi(); 00127 if (number==0) return 13; //mu- 00128 return -13;//mu+ 00129 }
std::string GtMuoneratorTool::m_whichSite [private] |
Definition at line 46 of file GtMuoneratorTool.h.
std::string GtMuoneratorTool::m_muonFileName [private] |
Definition at line 47 of file GtMuoneratorTool.h.
std::string GtMuoneratorTool::m_ratioFileName [private] |
Definition at line 48 of file GtMuoneratorTool.h.
std::string GtMuoneratorTool::m_volume [private] |
Definition at line 49 of file GtMuoneratorTool.h.
bool GtMuoneratorTool::m_rotation [private] |
Definition at line 50 of file GtMuoneratorTool.h.
TH1F* GtMuoneratorTool::m_pmratio [private] |
Definition at line 53 of file GtMuoneratorTool.h.
std::vector<double> GtMuoneratorTool::m_muonE [private] |
Definition at line 54 of file GtMuoneratorTool.h.
std::vector<double> GtMuoneratorTool::m_muonPhi [private] |
Definition at line 54 of file GtMuoneratorTool.h.
std::vector<double> GtMuoneratorTool::m_muonTheta [private] |
Definition at line 54 of file GtMuoneratorTool.h.
double GtMuoneratorTool::m_Sx [private] |
Definition at line 55 of file GtMuoneratorTool.h.
double GtMuoneratorTool::m_Sy [private] |
Definition at line 55 of file GtMuoneratorTool.h.
double GtMuoneratorTool::m_Sz [private] |
Definition at line 55 of file GtMuoneratorTool.h.
double GtMuoneratorTool::m_Smax [private] |
Definition at line 55 of file GtMuoneratorTool.h.
CLHEP::Hep3Vector GtMuoneratorTool::m_detectorDim [private] |
Definition at line 56 of file GtMuoneratorTool.h.
CLHEP::Hep3Vector GtMuoneratorTool::m_detectorCenter [private] |
Definition at line 57 of file GtMuoneratorTool.h.
double GtMuoneratorTool::m_dphi [private] |
Definition at line 58 of file GtMuoneratorTool.h.
IRndmGenSvc* GtMuoneratorTool::m_rgs [private] |
Definition at line 60 of file GtMuoneratorTool.h.
Rndm::Numbers GtMuoneratorTool::m_uni [private] |
Definition at line 61 of file GtMuoneratorTool.h.