Esempio n. 1
0
void r3blandsim(Int_t nNeutrons = 4, Int_t nEvents = 100, Int_t beamE = 600, Int_t Erel = 500)
{
  Int_t d;
  d = 15;
  
  char str[100];
  
  // Event Generator Data
  sprintf(str, "%1dSn_%1dn_%dAMeV_%dkeV.dat",132- nNeutrons,nNeutrons,beamE,Erel);
  TString EventDataFile = TString(str);
  
  // Output files
  sprintf(str,"%1dAMeV.%1dn.%1dkeV.%1dm.root", beamE,nNeutrons, Erel, d);
  TString OutFile = "r3bsim."+ TString(str);
  TString ParFile = "r3bpar."+ TString(str);
  
  TString fMC ="TGeant3";
  TString fGene="ascii";
  Bool_t fUserPList= kTRUE;

  // Target
  TString target="LiH";
  
  TString det;
  det = "neuland_s2018.geo.root";

  TMap detGeo;
  detGeo.Add(new TObjString("TARGET"),        new TObjString("target_"+target+".geo.root"));
  detGeo.Add(new TObjString("ALADIN"),        new TObjString("aladin_v13a.geo.root"));
  detGeo.Add(new TObjString("CRYSTALBALL"),   new TObjString("cal_v13a.geo.root"));
  detGeo.Add(new TObjString("DCH"),           new TObjString("dch_v13a.geo.root"));
  detGeo.Add(new TObjString("SCINTNEULAND"),  new TObjString(det));

  Bool_t fEventDisplay = kTRUE;

  // Magnet Field definition
  Bool_t fR3BMagnet = kTRUE;

  // Main Sim function call
  r3ball(nEvents,&detGeo,target,fEventDisplay,fMC,fGene,fUserPList,fR3BMagnet,2500.,OutFile,ParFile,EventDataFile);  
}
Esempio n. 2
0
void r3blandsim(
  const Int_t n_neutrons,
  const Int_t n_events,
  const string neuland_geo_file,
  const string input_file,
  const string basename
){

  // Output files
  const TString out_file = "r3bsim." + basename + ".root";
  const TString par_file = "r3bpar." + basename + ".root";

  // Constant configuration
  const TString  target = "LiH";
  const TString  fMC   = "TGeant3";
  const TString  fGene = "ascii";
  const Bool_t   fEventDisplay = kTRUE;
  const Bool_t   fUserPList = kTRUE;
  const Bool_t   fR3BMagnet = kTRUE;
  const Double_t fMeasCurrent = 2500.; 

  // Geometry
  TMap geometry;
  geometry.Add(new TObjString("TARGET"),        new TObjString("target_" + target + ".geo.root"));
  geometry.Add(new TObjString("ALADIN"),        new TObjString("aladin_v13a.geo.root"));
  geometry.Add(new TObjString("CRYSTALBALL"),   new TObjString("cal_v13a.geo.root"));
  geometry.Add(new TObjString("DCH"),           new TObjString("dch_v13a.geo.root"));
  geometry.Add(new TObjString("SCINTNEULAND"),  new TObjString(TString(neuland_geo_file)));


  // Load the Main Simulation macro
  const TString macro_r3ball = TString(getenv("VMCWORKDIR")) + TString("/macros/r3b/r3ball.C");
  gROOT->LoadMacro(macro_r3ball.Data());

  // Main Sim function call
  r3ball( n_events, geometry, target, fEventDisplay, fMC, fGene, fUserPList, fR3BMagnet, fMeasCurrent, out_file, par_file, input_file);
}
Int_t r3b_sim_and_rclass(){

   // Load the Main Simulation macro
   gROOT->LoadMacro("r3ball.C");

   //-------------------------------------------------
   // Monte Carlo type     |    fMC        (TString)
   //-------------------------------------------------
   //   Geant3:                 "TGeant3"
   //   Geant4:                 "TGeant4"
   //   Fluka :                 "TFluka"

   TString fMC ="TGeant3";

   //-------------------------------------------------
   // Primaries generation
   // Event Generator Type |   fGene       (TString)
   //-------------------------------------------------
   // Box generator:             "box"
   // Ascii generator:           "ascii"
   // R3B spec. generator:       "r3b"

   TString fGene="box";

   //-------------------------------------------------
   // Secondaries  generation (G4 only)
   // R3B Spec. PhysicList |     fUserPList (Bool_t)
   // ----------------------------------------------
   //     VMC Standard           kFALSE
   //     R3B Special            kTRUE;

   Bool_t fUserPList= kTRUE;

   // Target type
   TString target1="LeadTarget";
   TString target2="Para";
   TString target3="Para45";
   TString target4="LiH";

   //-------------------------------------------------
   //- Geometrical Setup Definition
   //-  Non Sensitiv        |    fDetName (String)
   //-------------------------------------------------
   //   Target:                  TARGET
   //   Magnet:                  ALADIN
   //
   //-------------------------------------------------
   //-  Sensitiv            |    fDetName
   //-------------------------------------------------
   //   Calorimeter:             CALIFA
   //                            CRYSTALBALL
   //
   //   Tof:                     TOF
   //                            MTOF
   //
   //   Tracker:                 DCH
   //                            TRACKER
   //                            GFI
   //
   //   Neutron Detector
   //   Plastic                  LAND
   //   RPC                      
   //                            RPCFLAND
   //                            RPCMLAND

    TObjString det1("TARGET");
    TObjString det2("ALADIN");
    TObjString det3("CALIFA");
    TObjString det4("CRYSTALBALL");
    TObjString det5("TOF");
    TObjString det6("MTOF");
    TObjString det7("DCH");
    TObjString det8("TRACKER");
    TObjString det9("GFI");
    TObjString det10("LAND");
    TObjString det11("RPCMLAND");
    TObjString det12("RPCFLAND");
    TObjString det13("SCINTNEULAND");

    TObjArray fDetList;
//    fDetList.Add(&det1);
    fDetList.Add(&det2);
//    fDetList.Add(&det4);
//    fDetList.Add(&det5);
//    fDetList.Add(&det6);
//    fDetList.Add(&det7);
//    fDetList.Add(&det8);
//    fDetList.Add(&det9);
    fDetList.Add(&det10);
//    fDetList.Add(&det11);


   //-------------------------------------------------
   //- N# of Sim. Events   |    nEvents     (Int_t)
   //-------------------------------------------------

   Int_t nEvents = 1;

   //-------------------------------------------------
   //- EventDisplay        |    fEventDisplay (Bool_t)
   //-------------------------------------------------
   //   connected:              kTRUE
   //   not connected:          kFALSE

   Bool_t fEventDisplay=kTRUE;

    // Magnet Field definition
   Bool_t fR3BMagnet = kTRUE;

   // Main Sim function call
   r3ball(  nEvents,
            fDetList,
            target1,
	    fEventDisplay,
	    fMC,
	    fGene,
	    fUserPList,
            fR3BMagnet
          );

//------------------- Read Data from LMD-ROOT file -------------------------------------
// the ROOT files (simulated and experimental) are the same but, for testing purpose, show how to use two quantities for comparison
   R3BLandData* LandData1 = new R3BLandData("s318_172.root", "h309"); // file input and tree name
   R3BLandData* LandData2 = new R3BLandData("s318_172.root", "h309"); // file input and tree name
// Define diferent options for TCanvas
   TCanvas* c = new TCanvas("Compare quantities from ROOT files","ROOT Canvas");
   c->Divide(2,1);                                                                 // Divide a canvas in two ...or more
   int entries1 = LandData1->GetEntries();                                         // entries number of first TTree
   int entries2 = LandData2->GetEntries();                                         // entries number of first TTree
   TLeaf* leaf1;
//   TLeaf* leaf11;                                                                  // define one leaf...
   TLeaf* leaf2;
//   TLeaf* leaf22;                                                                  // define another leaf
   cout<<"Entries number in  first TTree = "<<entries1<<endl;
   cout<<"Entries number in second TTree = "<<entries2<<endl;
//  Reprezentation of 1D histogram from ROOT files
   for (int i=0; i < entries1; i++)
      {
         leaf1 = LandData1->GetLeaf("Nte",i);                                      // Accessing TLeaf informations
//         leaf11 = LandData1->GetLeaf("Nhe",i);                                   // Accessing TLeaf informations
       LandData1->FillHisto1D(leaf1);                                              // Fill 1D histogram ... automatical bin width
//         LandData1->FillHisto2D(leaf1,leaf11);                                   // Fill 2D histogram ... automatical bin width
      }
      c->cd(1);
      LandData1->Draw1D();                                                         // Plotting 1D histogram ... automatical bin width
//      LandData1->Draw2D();                                                         // Plotting 2D histogram ... automatical bin width

   for (int i=0; i < entries2; i++)
      {
         leaf2 = LandData2->GetLeaf("Nhe",i);                                      // Accessing TLeaf informations
//         leaf22 = LandData2->GetLeaf("Nte",i);                                     // Accessing TLeaf informations
         LandData2->FillHisto1D(leaf2);                                            // Fill 1D histogram ... automatical bin width
//         LandData2->FillHisto2D(leaf2,leaf22);                                     // Fill 2D histogram ... automatical bin width
      }
      c->cd(2);
      LandData2->Draw1D();                                                         // Plotting 1D histogram ... automatical bin width
//      LandData2->Draw2D();                                                        // Plotting 2D histogram ... automatical bin width
      // ... or you can plot on the same histogram by comment the precedent two line and comment out the next line
//      LandData2->Draw1Dsame();                                                        // Plotting 1D histogram ... automatical bin width
// ... The same things for 2D histograming

   //####### for diferent TLeaf analysis ###############
/*
   Int_t len = leaf1->GetLen();
   for(Int_t j=0; j<len ; j++)
      {
       leaf1->GetValue(j);                                              // TLeaf Value for different analysis
      }
*/
    
}
Esempio n. 4
0
void r3bsim_g4r3b()
{
  // Output files
  TString OutFile = "r3bsim_g4r3b.root";
  TString ParFile = "r3bpar_g4r3b.root";
  
  //-------------------------------------------------
  // Monte Carlo type     |    fMC        (TString)
  //-------------------------------------------------
  //   Geant3:                 "TGeant3"
  //   Geant4:                 "TGeant4"
  //   Fluka :                 "TFluka"
  TString fMC = "TGeant4";
  
  //-------------------------------------------------
  // Primaries generation
  // Event Generator Type |   fGene       (TString)
  //-------------------------------------------------
  // Box generator:             "box"
  // ASCII generator            "ascii"
  // R3B spec. generator:       "r3b"
  TString fGene = "box";
  
  //-------------------------------------------------
  // Secondaries  generation (G4 only)
  // R3B Spec. PhysicList |     fUserPList (Bool_t)
  // ----------------------------------------------
  //     VMC Standard           kFALSE
  //     R3B Special            kTRUE;
  Bool_t fUserPList = kTRUE;

  // Target type
  TString target1 = "LeadTarget";
  TString target2 = "Para";
  TString target3 = "Para45";
  TString target4 = "LiH";
  
  //-------------------------------------------------
  //- Geometrical Setup Definition
  //-  Non Sensitiv        |    fDetName (String)
  //-------------------------------------------------
  //   Target:                  TARGET
  //   Magnet:                  ALADIN
  //                            GLAD
  //-------------------------------------------------
  //-  Sensitiv            |    fDetName
  //-------------------------------------------------
  //   Calorimeter:             CRYSTALBALL
  //                            CALIFA
  //
  //   Tof:                     TOF
  //                            MTOF
  //
  //   Tracker:                 DCH
  //                            TRACKER
  //                            STaRTrack
  //                            GFI
  //
  //   Neutron:                 LAND
  //                            SCINTNEULAND
  TMap detGeo;
  detGeo.Add(new TObjString("TARGET"),        new TObjString("target_"+target4+".geo.root"));
  detGeo.Add(new TObjString("ALADIN"),        new TObjString("aladin_v13a.geo.root"));
//  detGeo.Add(new TObjString("GLAD"),          new TObjString("glad_v13a.geo.root"));
  detGeo.Add(new TObjString("CRYSTALBALL"),   new TObjString("cal_v13a.geo.root"));
//  detGeo.Add(new TObjString("CALIFA"),        new TObjString("califa_v14a.geo.root"));
//  detGeo.Add(new TObjString("CALIFA"),        new TObjString("califa_v13_811.geo.root"));
  detGeo.Add(new TObjString("TOF"),           new TObjString("tof_v13a.geo.root"));
  detGeo.Add(new TObjString("MTOF"),          new TObjString("mtof_v13a.geo.root"));
//  detGeo.Add(new TObjString("DTOF"),          new TObjString("dtof_v15a.geo.root"));
  detGeo.Add(new TObjString("DCH"),           new TObjString("dch_v13a.geo.root"));
  detGeo.Add(new TObjString("TRACKER"),       new TObjString("tra_v13vac.geo.root"));
//  detGeo.Add(new TObjString("STaRTrack"),     new TObjString("startra_v14a.geo.root"));
//  detGeo.Add(new TObjString("STaRTrack"),     new TObjString("startra_v13a.geo.root"));
  detGeo.Add(new TObjString("GFI"),           new TObjString("gfi_v13a.geo.root"));
  detGeo.Add(new TObjString("LAND"),          new TObjString("land_v12a_10m.geo.root"));
//  detGeo.Add(new TObjString("SCINTNEULAND"),  new TObjString("neuland_v12a_14m.geo.root"));
//  detGeo.Add(new TObjString("VACVESSELCOOL"), new TObjString("vacvessel_v14a.geo.root"));   // to be used only with the R3B tracker: "STaRTrack", not "TRACKER"
//  detGeo.Add(new TObjString("VACVESSELCOOL"), new TObjString("vacvessel_v13a.geo.root"));
//  detGeo.Add(new TObjString("MFI"),           new TObjString("mfi_v13a.geo.root"));
  detGeo.Add(new TObjString("PSP"),           new TObjString("psp_v13a.geo.root"));

  // Number of events
  Int_t nEvents = 1;
  
  // Event display (store trajectories)
  Bool_t fEventDisplay = kTRUE;
  
  // Magnet Field definition
  Bool_t fR3BMagnet = kTRUE;

  // Main Sim function call
  r3ball(nEvents, &detGeo, target4, fEventDisplay, fMC, fGene, fUserPList,
         fR3BMagnet, 1500.,
         OutFile, ParFile, "", 335566);
}
Esempio n. 5
0
void iPhos_sim(){
  
  // Input files
  TString EventFile = "doesn't matter";

  // Output files
  TString OutFile = "testsim.root";
  TString ParFile = "testpar.root";
  
  //-------------------------------------------------
  // Monte Carlo type     |    fMC        (TString)
  //-------------------------------------------------
  //   Geant3:                 "TGeant3"
  //   Geant4:                 "TGeant4"
  //   Fluka :                 "TFluka"
  TString fMC ="TGeant4";
  
  //-------------------------------------------------
  // Primaries generation
  // Event Generator Type |   fGene       (TString)
  //-------------------------------------------------
  // Box generator:             "box"
  // CALIFA generator:          "gammas"
  // R3B spec. generator:       "r3b"
  // Events from file:          "ascii"
  // p2p events from file:      "p2p"
  
  TString fGene="ascii";
  
  //-------------------------------------------------
  // Secondaries  generation (G4 only)
  // R3B Spec. PhysicList |     fUserPList (Bool_t)
  // ----------------------------------------------
  //     VMC Standard           kFALSE
  //     R3B Special            kTRUE;
  Bool_t fUserPList= kTRUE;
  
  // Target type
  TString target1="LeadTarget";
  TString target2="Para";
  TString target3="Para45";
  TString target4="LiH";
  
  //-------------------------------------------------
  //- Geometrical Setup Definition
  //-  Non Sensitiv        |    fDetName (String)
  //-------------------------------------------------
  //   Target:                  TARGET
  //   Magnet:                  ALADIN
  //                            GLAD
  //-------------------------------------------------
  //-  Sensitiv            |    fDetName
  //-------------------------------------------------
  //   Calorimeter:             CALIFA
  //                            CRYSTALBALL
  //
  //   Tof:                     TOF
  //                            MTOF
  //
  //   Tracker:                 DCH
  //                            TRACKER
  //                            GFI
  //
  //   Neutron:                 LAND
  TMap detGeo;
  //detGeo.Add(new TObjString("TARGET"),
  //	     new TObjString("target_"+target4+".geo.root"));
  //detGeo.Add(new TObjString("ALADIN"),        
  //     new TObjString("aladin_v13a.geo.root"));
  //detGeo.Add(new TObjString("GLAD"),          
  //	     new TObjString("glad_v13a.geo.root"));
  //detGeo.Add(new TObjString("CRYSTALBALL"),   
  //         new TObjString("cal_v13a.geo.root"));
  detGeo.Add(new TObjString("CALIFA"),        
	     new TObjString("califa_16_v8.11_cc0.2.geo.root"));
  //new TObjString("califa_10_v8.11.geo.root"));
  //detGeo.Add(new TObjString("TOF"),           
  //     new TObjString("tof_v13a.geo.root"));
  //detGeo.Add(new TObjString("MTOF"),          
  //     new TObjString("mtof_v13a.geo.root"));
  //detGeo.Add(new TObjString("DCH"),           
  //     new TObjString("dch_v13a.geo.root"));
  //detGeo.Add(new TObjString("TRACKER"),       
  //     new TObjString("tra_v13vac.geo.root"));
  //detGeo.Add(new TObjString("STaRTrack"),     
  //         new TObjString("startra_v13a.geo.root"));
  //detGeo.Add(new TObjString("STaRTrack"),
  // 	     new TObjString("startra_v14b.geo.root"));
  //detGeo.Add(new TObjString("GFI"),           
  //     new TObjString("gfi_v13a.geo.root"));
  //detGeo.Add(new TObjString("LAND"),          
  //     new TObjString("land_v12a_10m.geo.root"));
  //detGeo.Add(new TObjString("SCINTNEULAND"),  
  //     new TObjString("neuland_v12a_14m.geo.root"));
  //detGeo.Add(new TObjString("VACVESSELCOOL"), 
  // 	     new TObjString("vacvessel_v13b.geo.root"));
//detGeo.Add(new TObjString("MFI"),           
  //     new TObjString("mfi_v13a.geo.root"));
  //detGeo.Add(new TObjString("PSP"),           
  //     new TObjString("psp_v13a.geo.root"));


   //-------------------------------------------------
   //- N# of Sim. Events   |    nEvents     (Int_t)
   //-------------------------------------------------

   Int_t nEvents = 1000;

   //-------------------------------------------------
   //- EventDisplay        |    fEventDisplay (Bool_t)
   //-------------------------------------------------
   //   connected:              kTRUE
   //   not connected:          kFALSE
   Bool_t fEventDisplay=kTRUE;

   // Magnet Field definition
   Bool_t fR3BMagnet = kFALSE;
	
   // Including CaloHitFinder task (kFALSE by default)
   Bool_t fCaloHitFinder = kTRUE; 

   // Including StarTrackHitFinder task (kFALSE by default)
   Bool_t fStarTrackHitFinder = kFALSE;

   Double_t fMeasCurrent = 1500.;

   // Main Sim function call
   r3ball(nEvents,
	  detGeo,
	  target4,
	  fEventDisplay,
	  fMC,
	  fGene,
	  fUserPList,
	  fR3BMagnet,
	  fCaloHitFinder,
	  fStarTrackHitFinder,
	  fMeasCurrent,
	  OutFile,
	  ParFile,
	  EventFile);      

}