Exemplo n.º 1
0
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
      }
*/
    
}
Exemplo n.º 2
0
Int_t r3bsim_batch(Double_t fEnergyP, Int_t fMult, Int_t nEvents, Int_t fGeoVer, Double_t fNonUni){
	
	cout << "Running r3bsim_batch with arguments:" <<endl;
	cout << "Primary energy: " << fEnergyP << " MeV" <<endl;
	cout << "Multiplicity: " << fEnergyP <<endl;
	cout << "Number of events: " << nEvents <<endl;
	cout << "CALIFA geo version: " << fGeoVer <<endl;
	cout << "Non uniformity: " << fNonUni <<endl<<endl;

	// Load the Main Simulation macro
	gROOT->LoadMacro("r3ball_batch.C");
	
	//-------------------------------------------------
	// 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"
	
	TString fGene="gammas";
	
	//-------------------------------------------------
	// 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
	
    TObjString det0("TARGET");
    TObjString det1("ALADIN");
    TObjString det2("GLAD");
    TObjString det3("CALIFA");
    TObjString det4("CRYSTALBALL");
    TObjString det5("TOF");
    TObjString det6("MTOF");
    TObjString det7("DCH");
    TObjString det8("TRACKER");
    TObjString det9("GFI");
    TObjString det10("LAND");
	
    TObjArray fDetList;
    fDetList.Add(&det0);
    //fDetList.Add(&det2);
    fDetList.Add(&det3);
    //fDetList.Add(&det5);
    //fDetList.Add(&det6);
    //fDetList.Add(&det7);
    fDetList.Add(&det8);
    //fDetList.Add(&det9);
    //fDetList.Add(&det10);
	
	
	//-------------------------------------------------
	//- N# of Sim. Events   |    nEvents     (Int_t)
	//-------------------------------------------------
	
	//NOW GIVEN AS AN ARGUMENT!
	//Int_t nEvents = 100;
	
	//-------------------------------------------------
	//- EventDisplay        |    fEventDisplay (Bool_t)
	//-------------------------------------------------
	//   connected:              kTRUE
	//   not connected:          kFALSE
	
	Bool_t fEventDisplay=kFALSE;
	
    // Magnet Field definition
	//Bool_t fR3BMagnet = kTRUE;
	Bool_t fR3BMagnet = kFALSE;
	
	
	// Main Sim function call
	r3ball_batch(  nEvents,
		   fDetList,
		   target2,
		   fEventDisplay,
		   fMC,
		   fGene,
		   fUserPList,
		   fR3BMagnet,
		   fEnergyP,
		   fMult,
		   fGeoVer, 
		   fNonUni
		   );     
	cout << "... Work done! " <<endl;
	
}