|
@@ -41,7 +41,7 @@ void CreateExtendedAT(TString iFileName, TString oFileName)
|
|
|
{
|
|
|
TStopwatch timer;
|
|
|
timer.Start();
|
|
|
-
|
|
|
+
|
|
|
// Read base AnalysisTree file as input
|
|
|
auto chain = new AnalysisTree::Chain(iFileName.Data(), "aTree");
|
|
|
const Long64_t nevents = (Long64_t)chain->GetEntries();
|
|
@@ -107,7 +107,7 @@ void CreateExtendedAT(TString iFileName, TString oFileName)
|
|
|
out_fhcal_mods.CloneVariables(in_fhcal_mods.GetConfig());
|
|
|
|
|
|
// Add extended variables to reco event
|
|
|
- auto ireco_evt_bcent = out_reco_event.NewVariable("bcent", "centrality based on impact parameter (0%-100%)", Analysis::Types::kFloat);
|
|
|
+ auto ireco_evt_bcent = out_reco_event.NewVariable("bcent", "centrality based on impact parameter (0%-100%)", AnalysisTree::Types::kFloat);
|
|
|
|
|
|
// Add extended variables to reco tracks
|
|
|
auto itpc_eta_sign = out_tpc_tracks.NewVariable("eta_sign", "sign of track's pseudorapidity", AnalysisTree::Types::kInteger);
|
|
@@ -134,10 +134,10 @@ void CreateExtendedAT(TString iFileName, TString oFileName)
|
|
|
out_config->AddBranchConfig(out_fhcal_mods.GetConfig());
|
|
|
|
|
|
// Create branches in the output tree
|
|
|
- outTree->Branch(str_reco_event_branch.c_str(), "AnalysisTree::EventHeader", out_reco_event.GetData(), 32000, 99);
|
|
|
- outTree->Branch(str_tpc_tracks_branch.c_str(), "AnalysisTree::TrackDetector", out_tpc_tracks.GetData(), 256000, 99);
|
|
|
- outTree->Branch(str_fhcal_branch.c_str(), "AnalysisTree::ModuleDetector", out_fhcal_mods.GetData(), 128000, 99);
|
|
|
- outTree->Branch(str_mc_tracks_branch.c_str(), "AnalysisTree::Particles", out_mc_tracks.GetData(), 256000, 99);
|
|
|
+ outTree->Branch(str_reco_event_branch.c_str(), "AnalysisTree::EventHeader", &(std::get<AnalysisTree::EventHeader *>(out_reco_event.GetData())), 32000, 99);
|
|
|
+ outTree->Branch(str_tpc_tracks_branch.c_str(), "AnalysisTree::TrackDetector", &(std::get<AnalysisTree::TrackDetector *>(out_tpc_tracks.GetData())), 256000, 99);
|
|
|
+ outTree->Branch(str_fhcal_branch.c_str(), "AnalysisTree::ModuleDetector", &(std::get<AnalysisTree::ModuleDetector *>(out_fhcal_mods.GetData())), 128000, 99);
|
|
|
+ outTree->Branch(str_mc_tracks_branch.c_str(), "AnalysisTree::Particles", &(std::get<AnalysisTree::Particles *>(out_mc_tracks.GetData())), 256000, 99);
|
|
|
// outTree->Branch(str_tpc2mc_tracks_branch.c_str(), "AnalysisTree::Matching", &tpc2mc_tracks, 32000, 99);
|
|
|
|
|
|
std::cout << std::endl;
|
|
@@ -383,102 +383,4 @@ Float_t GetRapidityPDG(Float_t p, Float_t pz, Int_t pdg)
|
|
|
Float_t E = TMath::Sqrt(p * p + mass * mass);
|
|
|
|
|
|
return 0.5 * TMath::Log((E + pz) / (E - pz));
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
-{
|
|
|
- // Read base AnalysisTree file as input
|
|
|
- auto chain = new AnalysisTree::Chain(iFileName.Data(), "aTree");
|
|
|
- const Long64_t nevents = (Long64_t)chain->GetEntries();
|
|
|
-
|
|
|
- // Initialize pointers to the branches that needed to be read
|
|
|
- chain->InitPointersToBranches({"RecoEvent", "TpcTracks", "FHCalModules", "McTracks"});
|
|
|
-
|
|
|
- // Read and print general info from DataHeader and Configuration
|
|
|
- auto *config = chain->GetConfiguration();
|
|
|
- auto *data_header = chain->GetDataHeader();
|
|
|
-
|
|
|
- // data_header->Print();
|
|
|
- // config->Print();
|
|
|
-
|
|
|
- // Get branches from the AnalysisTree
|
|
|
- auto in_reco_event = chain->GetBranch("RecoEvent");
|
|
|
- auto in_tpc_tracks = chain->GetBranch("TpcTracks");
|
|
|
- auto in_mc_tracks = chain->GetBranch("McTracks");
|
|
|
- auto in_fhcal_mods = chain->GetBranch("FHCalModules");
|
|
|
- auto in_tpcmc_match = chain->GetMatching("TpcTracks", "McTracks");
|
|
|
-
|
|
|
- // Create new branches which will store extended data for further analysis
|
|
|
- AnalysisTree::Branch out_tpc_tracks(in_tpc_tracks.GetConfig());
|
|
|
- AnalysisTree::Branch out_mc_tracks;
|
|
|
- AnalysisTree::Branch out_fhcal_mods;
|
|
|
-
|
|
|
- // Enable SetMutable so these output branches could be modified
|
|
|
- out_tpc_tracks.SetMutable();
|
|
|
- out_mc_tracks.SetMutable();
|
|
|
- out_fhcal_mods.SetMutable();
|
|
|
-
|
|
|
- // Copy variables from the input - not required for branches with even-wise information (i.e. EventHeader)
|
|
|
- out_tpc_tracks.CloneVariables(in_tpc_tracks.GetConfig());
|
|
|
- out_mc_tracks.CloneVariables(in_mc_tracks.GetConfig());
|
|
|
- out_fhcal_mods.CloneVariables(in_fhcal_mods.GetConfig());
|
|
|
-
|
|
|
- // Add extended variables to reco tracks
|
|
|
- auto itpc_eta_sign = out_tpc_tracks.NewVariable("eta_sign", "sign of track's pseudorapidity", AnalysisTree::Types::kInteger);
|
|
|
- auto itpc_mc_pdg = out_tpc_tracks.NewVariable("mc_pdg", "PDG code from associated mc track", AnalysisTree::Types::kInteger);
|
|
|
- auto itpc_mc_E = out_tpc_tracks.NewVariable("mc_E", "Energy from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_mc_pT = out_tpc_tracks.NewVariable("mc_pT", "p_{T} from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_mc_eta = out_tpc_tracks.NewVariable("mc_eta", "Pseudorapidity from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_mc_phi = out_tpc_tracks.NewVariable("mc_phi", "Azimuthal angle from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_mc_y = out_tpc_tracks.NewVariable("mc_y", "Rapidity from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_mc_mother_id = out_tpc_tracks.NewVariable("mc_mother_id", "MotherId from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
- auto itpc_rapidity = out_tpc_tracks.NewVariable("rapidity", "Rapidity with pdg-based pid from associated mc track", AnalysisTree::Types::kFloat);
|
|
|
-
|
|
|
- std::cout << (short)in_tpc_tracks.GetBranchType() << std::endl;
|
|
|
- in_tpc_tracks.GetConfig().Print();
|
|
|
- std::cout << (short)out_tpc_tracks.GetBranchType() << std::endl;
|
|
|
- out_tpc_tracks.GetConfig().Print();
|
|
|
-
|
|
|
- // Add extended variables to mc tracks
|
|
|
- auto imc_is_charged = out_mc_tracks.NewVariable("is_charged", "is particle charged", AnalysisTree::Types::kBool);
|
|
|
- auto imc_eta_sign = out_mc_tracks.NewVariable("eta_sign", "sign of particles's pseudorapidity", AnalysisTree::Types::kBool);
|
|
|
-
|
|
|
- // Add extended variables to FHCal modules
|
|
|
- auto ifhcal_phi = out_fhcal_mods.NewVariable("phi", "Azimuthal angle of the center of FHCal module", AnalysisTree::Types::kFloat);
|
|
|
- auto ifhcal_signal_eta_signed = out_fhcal_mods.NewVariable("signal_eta_signed", "Energy*sign(eta) from the FHCal module", AnalysisTree::Types::kFloat);
|
|
|
-
|
|
|
- // Get links to variables from the input reco tracks
|
|
|
- auto itpc_pt = in_tpc_tracks.GetField("pT");
|
|
|
- auto itpc_eta = in_tpc_tracks.GetField("eta");
|
|
|
-
|
|
|
- // Start loop over events
|
|
|
- Int_t ntpc_tracks, nmc_tracks;
|
|
|
- for (Long64_t ievent = 0; ievent < nevents; ievent++)
|
|
|
- {
|
|
|
- std::cout << "Event [" << ievent << "/" << nevents << "]" << std::endl;
|
|
|
- chain->GetEntry(ievent);
|
|
|
-
|
|
|
- // Start loop over reco tracks
|
|
|
- ntpc_tracks = in_tpc_tracks.size();
|
|
|
- // out_tpc_tracks.ClearChannels();
|
|
|
- for (int itrack = 0; itrack < ntpc_tracks; itrack++)
|
|
|
- {
|
|
|
- auto in_tpc_track = in_tpc_tracks[itrack];
|
|
|
- // auto out_tpc_track = out_tpc_tracks.NewChannel();
|
|
|
- // out_tpc_track.CopyContents(in_tpc_track);
|
|
|
-
|
|
|
- int tpc_eta_sign = (in_tpc_track.Value(itpc_pt) < 0) ? -1 : 1;
|
|
|
-
|
|
|
- // out_tpc_track[itpc_eta_sign] = tpc_eta_sign;
|
|
|
- } // End loop over reco tracks
|
|
|
- } // End loop over events
|
|
|
-}
|
|
|
-*/
|
|
|
+}
|