-
Notifications
You must be signed in to change notification settings - Fork 5
Add code for quick check of multiplicity dependence. #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hjbossi
wants to merge
1
commit into
FHead:main
Choose a base branch
from
hjbossi:MultCheck
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+604
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
| ./ExecuteHistFillerGen --Input /home/hbossi/LEP1MC1994.root --Output "ArchivedMC_E2C_MultCut_10000.root" \ | ||
| --Gen tgen --Fraction 0.1 --MultCut 0 |
This file contains hidden or 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,125 @@ | ||
| #include <iostream> | ||
| #include <vector> | ||
| #include <map> | ||
| using namespace std; | ||
|
|
||
| #include "TTree.h" | ||
| #include "TFile.h" | ||
|
|
||
| #include "Messenger.h" | ||
| #include "CommandLine.h" | ||
| #include "Matching.h" | ||
| #include "ProgressBar.h" | ||
| #include "TauHelperFunctions3.h" | ||
| #include "alephTrkEfficiency.h" | ||
|
|
||
| #include "TCanvas.h" | ||
| #include "TH1D.h" | ||
|
|
||
| #define MAX 1000 | ||
| #define MAXPAIR 10000 | ||
|
|
||
| int main(int argc, char *argv[]); | ||
| double MetricAngle(FourVector A, FourVector B); | ||
| double MatchingMetric(FourVector A, FourVector B); | ||
| void removeOverlappingTracks(std::vector<FourVector> *reco, std::vector<FourVector> *gen, std::vector<int> genPIDs); | ||
| int FindBin(double Value, int NBins, double Bins[]); | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| CommandLine CL(argc, argv); | ||
|
|
||
| string InputFileName = CL.Get("Input"); | ||
| string GenTreeName = CL.Get("Gen", "tgen"); | ||
| string OutputFileName = CL.Get("Output"); | ||
| double Fraction = CL.GetDouble("Fraction", 1.00); | ||
| bool isSherpa = CL.GetBool("IsSherpa", false); | ||
| int multCut = CL.GetInt("MultCut", 100000); | ||
|
|
||
| TFile* InputFile = new TFile(InputFileName.c_str()); | ||
| TFile* OutputFile = new TFile(OutputFileName.c_str(), "RECREATE"); | ||
|
|
||
|
|
||
|
|
||
| // z binning | ||
| const int BinCount = 100; | ||
| double zBins[2*BinCount+1]; | ||
| double zBinMin = (1- cos(0.002))/2; | ||
| double zBinMax = 0.5; | ||
|
|
||
| for(int i = 0; i <= BinCount; i++){ | ||
| // z double log binning | ||
| zBins[i] = exp(log(zBinMin) + (log(zBinMax) - log(zBinMin)) / BinCount * i); | ||
| zBins[2*BinCount-i] = zBinMax * 2 - exp(log(zBinMin) + (log(zBinMax) - log(zBinMin)) / BinCount * i); | ||
|
|
||
| } | ||
|
|
||
| // double log binning | ||
| TH1D* genUnmatched_z = new TH1D("genUnmatched_z", "genUnmatched_z", 2 * BinCount, 0, 2 * BinCount); | ||
| ParticleTreeMessenger* MGen = new ParticleTreeMessenger(InputFile, GenTreeName); | ||
| TH1D HN("HN", ";;", 1, 0, 1); | ||
|
|
||
| int EntryCount = MGen->GetEntries() * Fraction; | ||
| ProgressBar Bar(cout, EntryCount); | ||
| Bar.SetStyle(-1); | ||
| int nAcceptedEvents = 0; | ||
| double TotalE = 91.1876; // GeV | ||
| for(int iE = 0; iE < EntryCount; iE++) | ||
| { | ||
|
|
||
| MGen->GetEntry(iE); | ||
| if(MGen->nChargedHadronsHP < multCut) continue; | ||
|
|
||
|
|
||
|
|
||
| nAcceptedEvents++; | ||
|
|
||
| vector<FourVector> PGen; | ||
| for(int i = 0; i < MGen->nParticle; i++){ | ||
| // charged particle selection | ||
| if(MGen->charge[i] == 0) continue; | ||
| if(MGen->highPurity[i] == false) continue; | ||
| PGen.push_back(MGen->P[i]); | ||
| } | ||
| //std::cout <<PGen.size() << std::endl; | ||
|
|
||
|
|
||
| for(int i = 0; i < PGen.size(); i++){ | ||
| for(int j = i+1; j < PGen.size();j++){ | ||
| FourVector Gen1 = PGen.at(i); | ||
| FourVector Gen2 = PGen.at(j); | ||
|
|
||
| // z histograms | ||
| double zGenUnmatched = (1-cos(GetAngle(Gen1, Gen2)))/2; | ||
| int BinZGen = FindBin(zGenUnmatched, 2*BinCount, zBins); | ||
| genUnmatched_z->Fill(BinZGen, Gen1[0]*Gen2[0]/(TotalE*TotalE)); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| std::cout << "The number of accepted events is " << nAcceptedEvents << std::endl; | ||
| HN.SetBinContent(1, nAcceptedEvents); | ||
| Bar.Update(EntryCount); | ||
| Bar.Print(); | ||
| Bar.PrintLine(); | ||
|
|
||
| OutputFile->cd(); | ||
| genUnmatched_z->Write(); | ||
| HN.Write(); | ||
| OutputFile->Close(); | ||
| InputFile->Close(); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| int FindBin(double Value, int NBins, double Bins[]) | ||
| { | ||
| for(int i = 0; i < NBins; i++) | ||
| if(Value < Bins[i]) | ||
| return i - 1; | ||
| return NBins; | ||
| } | ||
This file contains hidden or 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,12 @@ | ||
| Execute: plotManyZ.cpp | ||
| g++ plotManyZ.cpp -o Execute \ | ||
| `root-config --libs --cflags` \ | ||
| -I$(ProjectBase)/CommonCode/include \ | ||
| $(ProjectBase)/CommonCode/library/*.o | ||
|
|
||
|
|
||
| ExecuteHistFillerGen: HistogramFillerGen.cpp | ||
| g++ HistogramFillerGen.cpp -o ExecuteHistFillerGen \ | ||
| `root-config --libs --cflags` \ | ||
| -I$(ProjectBase)/CommonCode/include \ | ||
| $(ProjectBase)/CommonCode/library/*.o |
This file contains hidden or 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,46 @@ | ||
| # ------ Plot just the mc ---------- | ||
| # ./Execute --Input Files/MatchingTest_v5.root,Files/PYTHIA8.root,Files/PYTHIA8_DIRE.root,Files/PYTHIA8_VINCIA.root,Files/Sherpa.root,Files/HERWIG.root \ | ||
| # --Output ModelComparisons \ | ||
| # --Label "Archived MC Gen Level","PYTHIA8","PYTHIA8 DIRE","PYTHIA8 VINCIA","SHERPA","HERWIG" \ | ||
| # --Prefix "0807024" \ | ||
| # --DoRatio true \ | ||
| # --DoWeight false \ | ||
| # --DoReflection false \ | ||
|
|
||
|
|
||
| ./Execute --Input ArchivedMC_E2C_MultCut_0.root,ArchivedMC_E2C_MultCut_10.root,ArchivedMC_E2C_MultCut_20.root,ArchivedMC_E2C_MultCut_30.root,ArchivedMC_E2C_MultCut_40.root \ | ||
| --Output ModelComparisons \ | ||
| --Label "Archived MC Gen Level","nChargedHadronsHP > 10","nChargedHadronsHP > 20","nChargedHadronsHP > 30","nChargedHadronsHP > 40" \ | ||
| --Prefix "11122024" \ | ||
| --DoRatio true \ | ||
| --DoWeight false \ | ||
| --DoReflection false \ | ||
|
|
||
|
|
||
| # ------ Make the reflected plot ---------- | ||
| # ./Execute --Input Files/MatchingTest_v5.root \ | ||
| # --Output ArchivedMCGen \ | ||
| # --Label "Archived MC Gen Level" \ | ||
| # --Prefix "0807024" \ | ||
| # --DoRatio false \ | ||
| # --DoWeight false \ | ||
| # --DoReflection true \ | ||
|
|
||
| # ------ Make the mc data comparison plot --------- | ||
| # ./Execute --Input Files/MatchingTest_v5.root,Files/DataTree.root \ | ||
| # --Output DataComp2 \ | ||
| # --Label "Archived MC Gen Level","Uncorrected Data" \ | ||
| # --Prefix "0717024" \ | ||
| # --DoRatio true \ | ||
| # --DoWeight false \ | ||
|
|
||
|
|
||
|
|
||
|
|
||
| # ------ Make the multiplicity plot --------- | ||
| # ./Execute --Input Files/MatchingTest_v5.root,Files/MatchingTest_v6_nCh10.root,Files/MatchingTest_v6_nCh20.root,Files/MatchingTest_v6_nCh30.root,Files/MatchingTest_v6_nCh35.root,Files/MatchingTest_v6_nCh40.root\ | ||
| # --Output MultComp \ | ||
| # --Label "Archived MC Gen Level","nChargedHadronsHP > 10","nChargedHadronsHP > 20","nChargedHadronsHP > 30","nChargedHadronsHP > 35","nChargedHadronsHP > 40"\ | ||
| # --Prefix "0717024" \ | ||
| # --DoRatio true \ | ||
| # --DoWeight false \ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a root object, it's unclear how this interferes with TFile::Close in terms of memory. I suggest making it not pointer.