Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:19

0001 // c++ includes --
0002 #include <string>
0003 #include <iostream>
0004 
0005 // Fun4All includes --
0006 #include <fun4all/SubsysReco.h>
0007 #include <fun4all/Fun4AllServer.h>
0008 #include <fun4all/Fun4AllInputManager.h>
0009 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0010 #include <fun4all/Fun4AllDstInputManager.h>
0011 #include <fun4all/Fun4AllDstOutputManager.h>
0012 
0013 // my includes --
0014 #include "ledtowerbuilder/LEDTowerBuilder.h"
0015 
0016 R__LOAD_LIBRARY(libfun4all.so)
0017 R__LOAD_LIBRARY(libfun4allraw.so)
0018 R__LOAD_LIBRARY(libcalo_reco.so)
0019 R__LOAD_LIBRARY(libg4dst.so)
0020 R__LOAD_LIBRARY(libledtowerbuilder.so)
0021 
0022 using std::cout;
0023 using std::endl;
0024 using std::string;
0025 
0026 void Fun4All_LEDTowerBuilder(const int events, const string &input, const string &outDir, const string &outName) {
0027   // gSystem->Load("libg4dst");
0028   Fun4AllServer *se = Fun4AllServer::instance();
0029   se->Verbosity(0);
0030 
0031   LEDTowerBuilder *ca = new LEDTowerBuilder((outDir + "/" + outName + "-CEMC.root").c_str());
0032   ca->set_detector_type(LEDTowerBuilder::CEMC);
0033   se->registerSubsystem(ca);
0034 
0035   LEDTowerBuilder *ca_hcal_in = new LEDTowerBuilder((outDir + "/" + outName + "-HCALIN.root").c_str());
0036   ca_hcal_in->set_detector_type(LEDTowerBuilder::HCALIN);
0037   se->registerSubsystem(ca_hcal_in);
0038 
0039   LEDTowerBuilder *ca_hcal_out = new LEDTowerBuilder((outDir + "/" + outName + "-HCALOUT.root").c_str());
0040   ca_hcal_out->set_detector_type(LEDTowerBuilder::HCALOUT);
0041   se->registerSubsystem(ca_hcal_out);
0042 
0043   //CaloAna *caloana = new CaloAna("CALOANA",outfile);
0044   //caloana->Detector("HCALOUT");
0045   //se->registerSubsystem(caloana);
0046 
0047   Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
0048   in->AddListFile(input.c_str());
0049   se->registerInputManager(in);
0050 
0051   se->run(events);
0052   se->End();
0053   se->PrintTimer();
0054   std::cout << "All done!" << std::endl;
0055 }
0056 
0057 # ifndef __CINT__
0058 int main(int argc, char* argv[]) {
0059     if(argc < 1 || argc > 5){
0060         cout << "usage: ./bin/Fun4All_LEDTowerBuilder events input outDir outName" << endl;
0061         cout << "events: Number of events to analyze." << endl;
0062         cout << "inputFile: Location of fileList containing prdfs." << endl;
0063         cout << "outputFile: output root file." << endl;
0064         return 1;
0065     }
0066 
0067     UInt_t events;
0068     string input;
0069     string outDir;
0070     string outName;
0071 
0072     if(argc >= 2) {
0073         events = atoi(argv[1]);
0074     }
0075     if(argc >= 3) {
0076         input = argv[2];
0077     }
0078     if(argc >= 4) {
0079         outDir = argv[3];
0080     }
0081     if(argc >= 5) {
0082         outName = argv[4];
0083     }
0084 
0085     Fun4All_LEDTowerBuilder(events, input, outDir, outName);
0086 
0087     cout << "done" << endl;
0088     return 0;
0089 }
0090 # endif