Browse Source

Small fixes 1

ParfenovPeter 7 months ago
parent
commit
38e1e193b5
5 changed files with 19 additions and 12 deletions
  1. 2 2
      CMakeLists.txt
  2. 3 4
      bin/main.cpp
  3. 2 0
      utility/Utility.h
  4. 3 4
      writers/qaWriter_analysistree2.cxx
  5. 9 2
      writers/qaWriter_analysistree2.h

+ 2 - 2
CMakeLists.txt

@@ -167,5 +167,5 @@ set_target_properties (matc
 )
 
 #---Compile main executable
-# add_executable(qaProcess "${CMAKE_CURRENT_SOURCE_DIR}/bin/main.cpp")
-# target_link_libraries(qaProcess matc)
+add_executable(convert "${CMAKE_CURRENT_SOURCE_DIR}/bin/main.cpp")
+target_link_libraries(convert matc)

+ 3 - 4
bin/main.cpp

@@ -11,7 +11,6 @@
 #include <TStopwatch.h>
 
 #include <qaParticle.h>
-#include <qaParticleLight.h>
 #include <qaEvent.h>
 #include <qaReader_manager.h>
 #include <qaReader_smash_root.h>
@@ -44,7 +43,7 @@ int main(int argc, char **argv)
 
   if (argc < 7)
   {
-    std::cerr << "./matc -i input.list -o output.root -input_format [INPUT_FORMAT] [OPTIONAL: -output_format [OUTPUT_FORMAT]]" << std::endl;
+    std::cerr << "./convert -i input.list -o output.root -input_format [INPUT_FORMAT] [OPTIONAL: -output_format [OUTPUT_FORMAT]]" << std::endl;
     std::cerr << "Available input formats:" << std::endl;
     std::cerr << "\tmcpico - simple custom ROOT format to store model data" << std::endl;
     std::cerr << "\tparticle - ROOT format that is used by the SMASH model" << std::endl;
@@ -177,7 +176,7 @@ int main(int argc, char **argv)
   for (Long64_t iev = 0; iev < Nentries; iev++)
   {
     if (iev % 1000 == 0)
-      std::cout << "Event [" << Minbias_counter << "/" << Nentries << "]" << std::endl;
+      std::cout << "Event [" << iev << "/" << Nentries << "]" << std::endl;
 
     event = (qaEvent *)readerManager->ReadEvent(iev);
     if (!event)
@@ -210,4 +209,4 @@ int main(int argc, char **argv)
   timer.Print();
 
   return 0;
-}
+}

+ 2 - 0
utility/Utility.h

@@ -49,6 +49,8 @@ public:
   Double_t GetCharge(Int_t pdg);
   Int_t GetPdgId(Int_t pdg);
 
+  Double_t GetBeamP(Double_t sqrtSnn);
+
   ClassDef(qaUtility, 0);
 }; // class qaUtility
 

+ 3 - 4
writers/qaWriter_analysistree2.cxx

@@ -12,6 +12,8 @@ qaWriter_analysistree2::qaWriter_analysistree2() : fFile(nullptr),
                                                    iB(qaUtility::GetInstance()->error_code),
                                                    iPhiRp(qaUtility::GetInstance()->error_code),
                                                    icharge(qaUtility::GetInstance()->error_code),
+                                                   str_event_branch("Event"),
+                                                   str_particles_branch("Particles")
 {
 }
 
@@ -35,9 +37,6 @@ void qaWriter_analysistree2::Init(std::string filename, std::string treename, st
   fConfig = new AnalysisTree::Configuration;
 
   // Set up AnalysisTree configuration
-  std::string str_event_branch = "Event";
-  std::string str_particles_branch = "Particles";
-
   AnalysisTree::BranchConfig event_branch(str_event_branch.c_str(), AnalysisTree::DetType::kEventHeader);
   AnalysisTree::BranchConfig particles_branch(str_particles_branch.c_str(), AnalysisTree::DetType::kParticle);
 
@@ -122,4 +121,4 @@ void qaWriter_analysistree2::WriteTree()
 void qaWriter_analysistree2::FillTree()
 {
   fTree->Fill();
-}
+}

+ 9 - 2
writers/qaWriter_analysistree2.h

@@ -5,10 +5,13 @@
 #include <TString.h>
 #include <TFile.h>
 #include <TTree.h>
+#include <TDatabasePDG.h>
+#include <TParticlePDG.h>
 
 #include <qaEvent.h>
 #include <qaParticle.h>
 #include <Utility.h>
+#include <qaWriter_manager.h>
 
 // AnalysisTree headers
 #include <AnalysisTree/Configuration.hpp>
@@ -17,7 +20,7 @@
 #include <AnalysisTree/Detector.hpp>
 #include <AnalysisTree/Matching.hpp>
 
-class qaWriter_analysistree2
+class qaWriter_analysistree2 : virtual public qaWriter_manager
 {
 private:
   /* data */
@@ -28,13 +31,17 @@ private:
   AnalysisTree::EventHeader *fEvent;
   AnalysisTree::Particles *fParticles;
 
+  std::string str_event_branch;
+  std::string str_particles_branch;
+
   int iB, iPhiRp, icharge;
 
   bool isInit;
 public:
+  qaWriter_analysistree2();
   virtual ~qaWriter_analysistree2();
 
-  virtual void Init(std::string filename, std::string treename);
+  virtual void Init(std::string filename, std::string treename, std::string system, float sqrtSnn);
   virtual void WriteEvent(qaEvent* event);
   virtual void WriteParticle(qaParticle* particle);
   virtual void WriteTree();