Example #1
0
Long_t Plugin::copyBranch(const char *name)
{
  debug(10,"Plugin: Copying branch %s\n",name);
  TObject **p = new (TObject *);
  getBranchObject(name,p);
  makeBranch(name,p);
  return 0;
}
Example #2
0
Long_t Plugin::copyBranch_gracefully(const char *name)
{
  debug(10,"Plugin: Copying branch %s 'gracefully'\n",name);
  TObject **p = new (TObject *);
  getBranchObject(name,p);
  if (*p)
    makeBranch(name,p);
  else
    debug(0, "Plugin: branch %s wasn't found - skipping it!\n", name);
  return 0;
}
Example #3
0
Long_t MCPropGeant4::startup()
{

	 // set the seed from global seed
	 int seed=* ( (int*) getMemoryObject("GlobalSeed") );
	 debug(1,"Propagation seed set to %i\n",seed);
	 CLHEP::HepRandom::setTheSeed(seed);
  
	// construct geant 4 and geometry
	debug(100,"Reading GDML to construct geometry\n");

	// Print the file names into the appropriate places
	char buffer[1024];
	snprintf(buffer,1000,"%s/.cooker/shared/gdml/%s",getenv("COOKERHOME"),gdmlFileName.c_str());
	char fieldbuf[1024];
	snprintf(fieldbuf,1000,"%s",fieldfile.c_str());

	//std::cout<<"\n\nField: "<<fieldfile<<"   Geo: "<<gdmlFileName<<"\n\n";

	runmanager=new cookerRM();



	cD = new cookerDetector(buffer,fieldbuf,this);

	runmanager->SetUserInitialization(cD);

	runmanager->SetUserInitialization( new Physics("",fullBrem,supBrem));

	// If visualization is requested, add the step action
	if (vism)
	{
		visStepAct = new MCPropVis();
		runmanager->SetUserAction(visStepAct);
	}

	// If field integration is requested, add the step action
	if (fint)
	{
		fieldIntAct = new MCFieldIntegrator();
		runmanager->SetUserAction(fieldIntAct);
	}


	GeneratorEvent * ge=NULL;
	getOutBranchObject("Generator",(TObject **) &ge);
	debug(0,"Out gen %p\n",ge);
	if (!ge)
	 {
		copyBranch("Generator");
		getBranchObject("Generator",(TObject **) &ge);
	 }
	if (!ge)
	 {
		debug(0,"Failed to find Generator Branch.\n");
		exit(-1);
	 }
	runmanager->SetUserAction(new cookerGen(ge));
	// runaction, eventaction?

	runmanager->Initialize();
	if (!runmanager->startRun())
	 {
		debug(0,"Error starting Geant4 run\n");
		exit(-1);
	 }

	// Need GD ROOT TObjStrings to put them in a tree
	fieldFile = new TObjString(cD->fieldFile.data());
	fieldHash = new TObjString(cD->fieldHash.data());

	// std::cout<<"\n\n"<<fieldFile->String()<<" "<<fieldHash->String()<<"\n\n";

	copyFileObject("ConfigData/trigger");

	return 0;
}