How to simulate the beam in the break?

From AstroNuWiki
Revision as of 16:34, 11 January 2014 by AstroNuAdmin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Question: if I like to simulate 1000 pions/muons in 1 brick, and reconstruct them How to tune the gun in a way to have smearing in x,y, tx,ty? (In principle was already done see class http://emulsion.na.infn.it/fedra/htmldoc/EdbBeamGen.html but probably you have already yours one)

It could be nice to have the example of script with all this definitions and with possibility to choose between saving the data after generation or continue with reconstruction immediately.

Answer Please note that this answer works properly starting from FedraVMC v1r8.

This can be done as follows. Run from the root prompt:

root[].x run_g4.C("testPromptTracks.C")

where testPromptTracks.C is a macro of the following form (can dowloaded from here):

// Example of a macro which generates 1000 muon tracks 
//  - with energy 1 GeV 
//  - on an area 1cm x 1cm (around x=y=0) 
//  - within the solid angle defined between 0 and 1 degree
// Can be run with both run_g3.C and run_g4.C
void test(const TString& setup) {
   // MC TVirtualMCApplication::Instance()ication
   EMCApplication *appl = NULL;
   if (!TVirtualMCApplication::Instance()) appl = new EMCApplication("fedra", "The FEDRA MC");
   else                                    appl = (EMCApplication*)TVirtualMCApplication::Instance();
   EdbDetector *gDetector = EdbDetector::Instance();
   gDetector->SetNumBricks(1,1,1);
   appl->SetGeneratorName("PromptTracks");
   appl->SetPrintModulo(1);
   appl->InitMC(setup);
   appl->GetGenerator()->SetEnergyInterval(1,1);                  // generate energy between Emin and Emax 
   appl->GetGenerator()->SetThetaInterval(179,180);               // generate Theta between ThetaMin and ThetaMax
   appl->GetGenerator()->SetPosInterval(TVector3(-0.5,-0.5,3),TVector3(0.5,0.5,3));
   appl->GetGenerator()->SetPDG(13);                              // muon
   appl->GetGenerator()->SetNumberOfPrimaries(1000);              // set up the number of primary tracks
   //visualization setting
   gROOT->LoadMacro("set_vis.C");
   set_vis();
   appl->RunMC(1);
}

You will find something like this: 1000 prompt tracks.gif An example of a more sophysticated macro which generates muon tracks, propagate them through the brick using geant4, reconstruct using FEDRA algorithms, does the alignment and produces a simple histo with alignment X,Y shifts can be found here.