-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
''' | ||
Standalone test of EDM4hep RDataSource in Python. | ||
''' | ||
|
||
import ROOT | ||
ROOT.gROOT.SetBatch(True) | ||
|
||
def main(): | ||
input_list = ['/eos/experiment/fcc/ee/generation/DelphesEvents/winter2023/' \ | ||
'IDEA/p8_ee_WW_ecm240/events_192112516.root'] | ||
|
||
print ("----> Info: Loading analyzers from libFCCAnalyses... ",) | ||
ROOT.gSystem.Load("libFCCAnalyses") | ||
_fcc = ROOT.dummyLoader | ||
|
||
print('----> Info: Loading events through EDM4hep RDataSource...') | ||
ROOT.gSystem.Load("libe4hsource") | ||
if ROOT.loadEDM4hepDataSource(): | ||
print('----> Debug: EDM4hep RDataSource loaded') | ||
try: | ||
dframe = ROOT.FCCAnalyses.FromEDM4hep(input_list) | ||
except TypeError as excp: | ||
print('----> Error: Unable to build dataframe!') | ||
print(excp) | ||
|
||
dframe2 = dframe.Define( | ||
"electron_truth", | ||
"FCCAnalyses::ReconstructedParticle::selPDG(11)(MCRecoAssociations)") | ||
|
||
dframe3 = dframe2.Define( | ||
"electron_truth_pt", | ||
"FCCAnalyses::ReconstructedParticle::getPt(electron_truth)") | ||
|
||
dframe4 = dframe3.Filter("electron_truth_pt.size() < 3") | ||
|
||
count = dframe4.Count() | ||
dframe4.Snapshot("events", "output.root", {"electron_truth_pt"}) | ||
# dframe4.Snapshot("events", "output.root", {"electron_truth", "electron_truth_pt"}) | ||
|
||
print("---------------------") | ||
print("Nuber of events: ", count.GetValue()) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
''' | ||
Standalone test of legacy EDM4hep RDataSource in Python. | ||
''' | ||
|
||
import ROOT | ||
ROOT.gROOT.SetBatch(True) | ||
|
||
def main(): | ||
input_list = [ | ||
'/eos/user/g/gasadows/Output/TrackingPerformance/' | ||
'LCIO/FCCee_o1_v04/REC/resVXD_3mic/' | ||
'RECTest_FCCee_o1_v04_resVXD_3mic_mu_89_deg_100_GeV_10000_evts_edm4hep' | ||
'.root' | ||
] | ||
|
||
print ("----> Info: Loading analyzers from libFCCAnalyses... ",) | ||
ROOT.gSystem.Load("libFCCAnalyses") | ||
_fcc = ROOT.dummyLoader | ||
|
||
print('----> Info: Loading events through legacy EDM4hep RDataSource...') | ||
ROOT.gSystem.Load("libe4hlegacysource") | ||
if ROOT.loadEDM4hepLegacySource(): | ||
print('----> Debug: Legacy EDM4hep RDataSource loaded') | ||
try: | ||
dframe = ROOT.FCCAnalyses.FromEDM4hepLegacy(input_list) | ||
except TypeError as excp: | ||
print('----> Error: Unable to build dataframe!') | ||
print(excp) | ||
|
||
dframe2 = dframe.Define( | ||
"electron_truth", | ||
"FCCAnalyses::ReconstructedParticle::selPDG(11, false)(RecoMCTruthLink)" | ||
) | ||
|
||
dframe3 = dframe2.Define( | ||
"electron_truth_pt", | ||
"FCCAnalyses::ReconstructedParticle::getPt(electron_truth)") | ||
|
||
dframe4 = dframe3.Filter("electron_truth_pt.size() > 0") | ||
|
||
count = dframe4.Count() | ||
dframe4.Snapshot("events", "output.root", {"electron_truth_pt"}) | ||
# dframe4.Snapshot("events", "output.root", {"electron_truth", | ||
# "electron_truth_pt"}) | ||
|
||
print("---------------------") | ||
print("Nuber of events: ", count.GetValue()) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters