Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:16

0001 #ifndef MACRO_FUN4ALLANALYSIS_C
0002 #define MACRO_FUN4ALLANALYSIS_C
0003 #include <fun4all/Fun4AllServer.h>
0004 #include <fun4all/Fun4AllInputManager.h>
0005 #include <fun4all/Fun4AllDstInputManager.h>
0006 #include <fun4all/Fun4AllDummyInputManager.h>
0007 #include <fun4all/Fun4AllDstOutputManager.h>
0008 
0009 #include <g4jets/ClusterJetInput.h>
0010 #include <g4jets/FastJetAlgo.h>
0011 #include <g4jets/JetReco.h>
0012 #include <g4jets/TowerJetInput.h>
0013 #include <g4jets/TrackJetInput.h>
0014 #include <g4jets/TruthJetInput.h>
0015 #include <G4_HIJetReco.C>
0016 #include <G4_Jets.C>
0017 #include <analysis/analysis.h>
0018 
0019 R__LOAD_LIBRARY(libfun4all.so)
0020 R__LOAD_LIBRARY(libanalysis.so)
0021 
0022 void Fun4All_Analysis(string inputFile1 = "DST_TRUTH_JET_pythia8_Jet04_3MHz-0000000004-00000.root", string inputFile2 = "DST_CALO_CLUSTER_pythia8_Jet04_3MHz-0000000004-00000.root",string outputfilename = "test.root", const int nEvents = 100)
0023 {
0024   ///////////////////////////////////////////
0025   // Make the Server
0026   //////////////////////////////////////////
0027   Fun4AllServer *se = Fun4AllServer::instance();
0028   se->Verbosity(0);
0029 
0030   //-----------------------------------------------------------------------
0031   //Read in a file containing the truth jet information
0032   //-----------------------------------------------------------------------
0033   Fun4AllInputManager *t_in = new Fun4AllDstInputManager("DSTin");
0034   t_in->fileopen(inputFile1);
0035   se->registerInputManager(t_in);
0036 
0037   //---------------------------------------------------------------------------
0038   //Read in a file containing the calorimeter information
0039   //---------------------------------------------------------------------------
0040 
0041  Fun4AllInputManager*  in = new Fun4AllDstInputManager("DSTCALOCLUSTERS");
0042  in->fileopen(inputFile2);
0043  se->registerInputManager(in);
0044  //----------------------------------------------------------------------------------------------
0045  //Perform the jet reconstruction: by default producing 0.2-0.8 jets
0046  //----------------------------------------------------------------------------------------------
0047 
0048   JetReco *towerjetreco = new JetReco("TOWERJETRECO");
0049   towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER));
0050   towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER));
0051   towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER));
0052   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Tower_r02");
0053   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Tower_r03");
0054   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Tower_r04");
0055   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Tower_r05");
0056   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Tower_r06");
0057   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Tower_r07");
0058   towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Tower_r08");
0059   towerjetreco->set_algo_node("ANTIKT");
0060   towerjetreco->set_input_node("TOWER");
0061   se->registerSubsystem(towerjetreco);
0062 
0063 
0064   //-----------------------------------------------
0065   // register up the analysis module
0066   //-----------------------------------------------
0067 
0068   analysis *myreco = new analysis();
0069   myreco->SetOutputFileName(outputfilename);
0070   se->registerSubsystem(myreco);
0071   
0072   if (nEvents <= 0)
0073   {
0074     return;
0075   }
0076   cout << endl << "Running over " << nEvents << " Events" << endl;
0077   se->run(nEvents);
0078   cout << endl << "Calling End in Fun4All_Analysis.C" << endl;
0079   se->End();
0080   cout << endl << "All done, calling delete Fun4AllServer" << endl;
0081   delete se;
0082   cout << endl << "gSystem->Exit(0)" << endl;
0083   gSystem->Exit(0);
0084 }
0085 #endif // MACRO_FUN4ALLANALYSIS_C
0086