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 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();
   appl->GetGenerator()->SetEnergyInterval(1,1);                  // generate energy between Emin and Emax 
   appl->GetGenerator()->SetThetaInterval(179,180);               // generate Theta between ThetaMin and ThetaMax
   appl->GetGenerator()->SetPDG(13);                              // muon
   appl->GetGenerator()->SetNumberOfPrimaries(1000);              // set up the number of primary tracks
   //visualization setting

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.