Changes in / [0e7d64a:e39abb4] in git
- Files:
-
- 7 deleted
- 217 edited
Legend:
- Unmodified
- Added
- Removed
-
.circleci/config.yml
r0e7d64a re39abb4 8 8 command: | 9 9 make distclean 10 make -j 8HAS_PYTHIA8=true10 make -j `nproc` HAS_PYTHIA8=true 11 11 - run: 12 12 name: Build Delphes using cmake … … 16 16 cd build 17 17 cmake .. 18 make -j 818 make -j `nproc` 19 19 20 20 jobs: … … 27 27 docker: 28 28 - image: delphes/ubuntu:18.04 29 fedora- 30:29 fedora-28: 30 30 <<: *shared 31 31 docker: 32 - image: delphes/fedora: 3032 - image: delphes/fedora:28 33 33 34 34 workflows: … … 38 38 - ubuntu-1404 39 39 - ubuntu-1804 40 - fedora- 3040 - fedora-28 -
.clang-format
r0e7d64a re39abb4 1 1 BasedOnStyle: LLVM 2 2 Language: Cpp 3 Standard: Cpp034 3 IndentWidth: 2 5 4 ConstructorInitializerIndentWidth: 2 -
CHANGELOG
r0e7d64a re39abb4 1 3.4.2:2 - added DenseTrackFilter for modelling tracking inefficiencies in boosted, dense environments3 - added detector cards for CLIC and HL-LHC detectors4 - added muons to Tower collection used for jets reconstruction and MET calculation in the ATLAS card (#1118)5 - added Weight branch to HepMC6 - added Jet constituent output to FastJetFinder (allows more complex schemes of MET calculation) (#1349)7 - added Valencia jet algorithm from FastJet Contrib library and exclusive jet clustering for e+e- collisions (thanks to Ulrike Schnoor)8 - added possibility to read cross section from LHE files produced with Wizard event generator9 - added NeutralOutputArray in ParticlePropagator10 - added various information in StatusPidFilter (B and tau decay products, photons, SUSY particles, W daughters)11 - added DelphesProIO reader for ProIO data format (thanks to Sergei Chekanov)12 - improved TrackSmearing and updated TrackCountingBTagging (thanks to Kevin Pedro)13 - adapted Efficiency and DelphesFormula to long-lived particles14 - adapted Python analysis code to recent ROOT versions (thanks to Kerim Suruliz)15 - updated class version of LHEFEvent, HepMCEvent, Photon, Electron, Muon, Jet and Candidate (#1363)16 - updated FastJet library to 3.3.2 and FastJet Contrib library to 1.04117 - updated copyright and licensing information18 - removed dependency on the RPC and XDR libraries from STDHEP reader (#1310)19 - fixed Delphes class destructor (TList::Clear error) (#1320)20 21 1 3.4.1: 22 2 - added RadiusMax and HalfLengthMax to ParticlePropagator to keep decay products of the long-lived particles (#1084) … … 24 4 - improved CMake configuration 25 5 - fixed weights in LHEFReader 26 - fixed bug in Charged Hadron Subtraction (CHS) 6 - fixed bug in Charged Hadron Subtraction (CHS) 27 7 - promoted z vertex resolution to TFormula 28 8 - fixed bugs in DelphesDisplay -
Makefile
r0e7d64a re39abb4 105 105 classes/DelphesHepMCReader.h \ 106 106 classes/DelphesPileUpWriter.h \ 107 external/ExRootAnalysis/ExRoot ProgressBar.h \107 external/ExRootAnalysis/ExRootTreeWriter.h \ 108 108 external/ExRootAnalysis/ExRootTreeBranch.h \ 109 external/ExRootAnalysis/ExRoot TreeWriter.h109 external/ExRootAnalysis/ExRootProgressBar.h 110 110 lhco2root$(ExeSuf): \ 111 111 tmp/converters/lhco2root.$(ObjSuf) … … 113 113 tmp/converters/lhco2root.$(ObjSuf): \ 114 114 converters/lhco2root.cpp \ 115 classes/DelphesClasses.h \ 116 classes/DelphesFactory.h \ 115 modules/Delphes.h \ 117 116 classes/DelphesStream.h \ 118 modules/Delphes.h \ 119 external/ExRootAnalysis/ExRootProgressBar.h \ 117 classes/DelphesClasses.h \ 118 classes/DelphesFactory.h \ 119 external/ExRootAnalysis/ExRootTreeWriter.h \ 120 120 external/ExRootAnalysis/ExRootTreeBranch.h \ 121 external/ExRootAnalysis/ExRoot TreeWriter.h121 external/ExRootAnalysis/ExRootProgressBar.h 122 122 pileup2root$(ExeSuf): \ 123 123 tmp/converters/pileup2root.$(ObjSuf) … … 125 125 tmp/converters/pileup2root.$(ObjSuf): \ 126 126 converters/pileup2root.cpp \ 127 classes/DelphesStream.h \ 127 128 classes/DelphesClasses.h \ 128 129 classes/DelphesFactory.h \ 129 130 classes/DelphesPileUpReader.h \ 130 classes/DelphesStream.h \ 131 external/ExRootAnalysis/ExRootProgressBar.h \ 131 external/ExRootAnalysis/ExRootTreeWriter.h \ 132 132 external/ExRootAnalysis/ExRootTreeBranch.h \ 133 external/ExRootAnalysis/ExRoot TreeWriter.h133 external/ExRootAnalysis/ExRootProgressBar.h 134 134 root2lhco$(ExeSuf): \ 135 135 tmp/converters/root2lhco.$(ObjSuf) … … 138 138 converters/root2lhco.cpp \ 139 139 classes/DelphesClasses.h \ 140 external/ExRootAnalysis/ExRoot ProgressBar.h \141 external/ExRootAnalysis/ExRoot TreeReader.h140 external/ExRootAnalysis/ExRootTreeReader.h \ 141 external/ExRootAnalysis/ExRootProgressBar.h 142 142 root2pileup$(ExeSuf): \ 143 143 tmp/converters/root2pileup.$(ObjSuf) … … 147 147 classes/DelphesClasses.h \ 148 148 classes/DelphesPileUpWriter.h \ 149 external/ExRootAnalysis/ExRoot ProgressBar.h \150 external/ExRootAnalysis/ExRoot TreeReader.h149 external/ExRootAnalysis/ExRootTreeReader.h \ 150 external/ExRootAnalysis/ExRootProgressBar.h 151 151 stdhep2pileup$(ExeSuf): \ 152 152 tmp/converters/stdhep2pileup.$(ObjSuf) … … 156 156 classes/DelphesClasses.h \ 157 157 classes/DelphesFactory.h \ 158 classes/DelphesSTDHEPReader.h \ 158 159 classes/DelphesPileUpWriter.h \ 159 classes/DelphesSTDHEPReader.h \ 160 external/ExRootAnalysis/ExRootProgressBar.h \ 160 external/ExRootAnalysis/ExRootTreeWriter.h \ 161 161 external/ExRootAnalysis/ExRootTreeBranch.h \ 162 external/ExRootAnalysis/ExRoot TreeWriter.h162 external/ExRootAnalysis/ExRootProgressBar.h 163 163 CaloGrid$(ExeSuf): \ 164 164 tmp/examples/CaloGrid.$(ObjSuf) … … 166 166 tmp/examples/CaloGrid.$(ObjSuf): \ 167 167 examples/CaloGrid.cpp \ 168 external/ExRootAnalysis/ExRootConfReader.h \169 classes/DelphesClasses.h \ 170 display/Delphes3DGeometry.h168 display/Delphes3DGeometry.h \ 169 classes/DelphesClasses.h \ 170 external/ExRootAnalysis/ExRootConfReader.h 171 171 Example1$(ExeSuf): \ 172 172 tmp/examples/Example1.$(ObjSuf) … … 175 175 examples/Example1.cpp \ 176 176 classes/DelphesClasses.h \ 177 external/ExRootAnalysis/ExRootResult.h \178 external/ExRootAnalysis/ExRootTreeBranch.h \179 177 external/ExRootAnalysis/ExRootTreeReader.h \ 180 178 external/ExRootAnalysis/ExRootTreeWriter.h \ 179 external/ExRootAnalysis/ExRootTreeBranch.h \ 180 external/ExRootAnalysis/ExRootResult.h \ 181 181 external/ExRootAnalysis/ExRootUtilities.h 182 182 DelphesValidation$(ExeSuf): \ … … 186 186 validation/DelphesValidation.cpp \ 187 187 classes/DelphesClasses.h \ 188 external/ExRootAnalysis/ExRootResult.h \189 external/ExRootAnalysis/ExRootTreeBranch.h \190 188 external/ExRootAnalysis/ExRootTreeReader.h \ 191 189 external/ExRootAnalysis/ExRootTreeWriter.h \ 190 external/ExRootAnalysis/ExRootTreeBranch.h \ 191 external/ExRootAnalysis/ExRootResult.h \ 192 192 external/ExRootAnalysis/ExRootUtilities.h 193 193 EXECUTABLE += \ … … 218 218 tmp/readers/DelphesHepMC.$(ObjSuf): \ 219 219 readers/DelphesHepMC.cpp \ 220 modules/Delphes.h \ 220 221 classes/DelphesClasses.h \ 221 222 classes/DelphesFactory.h \ 222 223 classes/DelphesHepMCReader.h \ 223 modules/Delphes.h \ 224 external/ExRootAnalysis/ExRootProgressBar.h \ 224 external/ExRootAnalysis/ExRootTreeWriter.h \ 225 225 external/ExRootAnalysis/ExRootTreeBranch.h \ 226 external/ExRootAnalysis/ExRoot TreeWriter.h226 external/ExRootAnalysis/ExRootProgressBar.h 227 227 DelphesLHEF$(ExeSuf): \ 228 228 tmp/readers/DelphesLHEF.$(ObjSuf) … … 230 230 tmp/readers/DelphesLHEF.$(ObjSuf): \ 231 231 readers/DelphesLHEF.cpp \ 232 modules/Delphes.h \ 232 233 classes/DelphesClasses.h \ 233 234 classes/DelphesFactory.h \ 234 235 classes/DelphesLHEFReader.h \ 235 modules/Delphes.h \ 236 external/ExRootAnalysis/ExRootProgressBar.h \ 236 external/ExRootAnalysis/ExRootTreeWriter.h \ 237 237 external/ExRootAnalysis/ExRootTreeBranch.h \ 238 external/ExRootAnalysis/ExRoot TreeWriter.h238 external/ExRootAnalysis/ExRootProgressBar.h 239 239 DelphesROOT$(ExeSuf): \ 240 240 tmp/readers/DelphesROOT.$(ObjSuf) … … 242 242 tmp/readers/DelphesROOT.$(ObjSuf): \ 243 243 readers/DelphesROOT.cpp \ 244 classes/DelphesClasses.h \ 245 classes/DelphesFactory.h \ 244 modules/Delphes.h \ 246 245 classes/DelphesStream.h \ 247 modules/Delphes.h \ 248 external/ExRootAnalysis/ExRootProgressBar.h \ 246 classes/DelphesClasses.h \ 247 classes/DelphesFactory.h \ 248 external/ExRootAnalysis/ExRootTreeWriter.h \ 249 external/ExRootAnalysis/ExRootTreeReader.h \ 249 250 external/ExRootAnalysis/ExRootTreeBranch.h \ 250 external/ExRootAnalysis/ExRootTreeReader.h \ 251 external/ExRootAnalysis/ExRootTreeWriter.h 251 external/ExRootAnalysis/ExRootProgressBar.h 252 252 DelphesSTDHEP$(ExeSuf): \ 253 253 tmp/readers/DelphesSTDHEP.$(ObjSuf) … … 255 255 tmp/readers/DelphesSTDHEP.$(ObjSuf): \ 256 256 readers/DelphesSTDHEP.cpp \ 257 modules/Delphes.h \ 257 258 classes/DelphesClasses.h \ 258 259 classes/DelphesFactory.h \ 259 260 classes/DelphesSTDHEPReader.h \ 260 modules/Delphes.h \ 261 external/ExRootAnalysis/ExRootProgressBar.h \ 261 external/ExRootAnalysis/ExRootTreeWriter.h \ 262 262 external/ExRootAnalysis/ExRootTreeBranch.h \ 263 external/ExRootAnalysis/ExRoot TreeWriter.h263 external/ExRootAnalysis/ExRootProgressBar.h 264 264 EXECUTABLE += \ 265 265 DelphesHepMC$(ExeSuf) \ … … 280 280 tmp/readers/DelphesCMSFWLite.$(ObjSuf): \ 281 281 readers/DelphesCMSFWLite.cpp \ 282 classes/DelphesClasses.h \ 283 classes/DelphesFactory.h \ 282 modules/Delphes.h \ 284 283 classes/DelphesStream.h \ 285 modules/Delphes.h \ 286 external/ExRootAnalysis/ExRootProgressBar.h \ 284 classes/DelphesClasses.h \ 285 classes/DelphesFactory.h \ 286 external/ExRootAnalysis/ExRootTreeWriter.h \ 287 287 external/ExRootAnalysis/ExRootTreeBranch.h \ 288 external/ExRootAnalysis/ExRoot TreeWriter.h288 external/ExRootAnalysis/ExRootProgressBar.h 289 289 EXECUTABLE += \ 290 290 DelphesCMSFWLite$(ExeSuf) … … 301 301 tmp/readers/DelphesProMC.$(ObjSuf): \ 302 302 readers/DelphesProMC.cpp \ 303 classes/DelphesClasses.h \ 304 classes/DelphesFactory.h \ 303 modules/Delphes.h \ 305 304 classes/DelphesStream.h \ 306 modules/Delphes.h \ 307 external/ExRootAnalysis/ExRootProgressBar.h \ 305 classes/DelphesClasses.h \ 306 classes/DelphesFactory.h \ 307 external/ExRootAnalysis/ExRootTreeWriter.h \ 308 308 external/ExRootAnalysis/ExRootTreeBranch.h \ 309 external/ExRootAnalysis/ExRoot TreeWriter.h309 external/ExRootAnalysis/ExRootProgressBar.h 310 310 EXECUTABLE += \ 311 311 DelphesProMC$(ExeSuf) … … 322 322 tmp/readers/DelphesProIO.$(ObjSuf): \ 323 323 readers/DelphesProIO.cpp \ 324 classes/DelphesClasses.h \ 325 classes/DelphesFactory.h \ 324 modules/Delphes.h \ 326 325 classes/DelphesStream.h \ 327 modules/Delphes.h \ 328 external/ExRootAnalysis/ExRootProgressBar.h \ 326 classes/DelphesClasses.h \ 327 classes/DelphesFactory.h \ 328 external/ExRootAnalysis/ExRootTreeWriter.h \ 329 329 external/ExRootAnalysis/ExRootTreeBranch.h \ 330 external/ExRootAnalysis/ExRoot TreeWriter.h330 external/ExRootAnalysis/ExRootProgressBar.h 331 331 EXECUTABLE += \ 332 332 DelphesProIO$(ExeSuf) … … 343 343 tmp/readers/DelphesPythia8.$(ObjSuf): \ 344 344 readers/DelphesPythia8.cpp \ 345 modules/Delphes.h \ 345 346 classes/DelphesClasses.h \ 346 347 classes/DelphesFactory.h \ 347 348 classes/DelphesLHEFReader.h \ 348 modules/Delphes.h \ 349 external/ExRootAnalysis/ExRootProgressBar.h \ 349 external/ExRootAnalysis/ExRootTreeWriter.h \ 350 350 external/ExRootAnalysis/ExRootTreeBranch.h \ 351 external/ExRootAnalysis/ExRoot TreeWriter.h351 external/ExRootAnalysis/ExRootProgressBar.h 352 352 EXECUTABLE += \ 353 353 DelphesPythia8$(ExeSuf) … … 527 527 classes/DelphesModule.h \ 528 528 classes/DelphesFactory.h \ 529 external/ExRootAnalysis/ExRoot Result.h \529 external/ExRootAnalysis/ExRootTreeReader.h \ 530 530 external/ExRootAnalysis/ExRootTreeBranch.h \ 531 external/ExRootAnalysis/ExRootTree Reader.h \532 external/ExRootAnalysis/ExRoot TreeWriter.h531 external/ExRootAnalysis/ExRootTreeWriter.h \ 532 external/ExRootAnalysis/ExRootResult.h 533 533 tmp/classes/DelphesPileUpReader.$(ObjSuf): \ 534 534 classes/DelphesPileUpReader.$(SrcSuf) \ … … 650 650 classes/DelphesFactory.h \ 651 651 classes/DelphesFormula.h \ 652 external/ExRootAnalysis/ExRoot Classifier.h \653 external/ExRootAnalysis/ExRootFilter.h \ 654 external/ExRootAnalysis/ExRoot Result.h652 external/ExRootAnalysis/ExRootResult.h \ 653 external/ExRootAnalysis/ExRootFilter.h \ 654 external/ExRootAnalysis/ExRootClassifier.h 655 655 tmp/modules/BTagging.$(ObjSuf): \ 656 656 modules/BTagging.$(SrcSuf) \ … … 665 665 classes/DelphesFactory.h \ 666 666 classes/DelphesFormula.h \ 667 external/ExRootAnalysis/ExRoot Classifier.h \668 external/ExRootAnalysis/ExRootFilter.h \ 669 external/ExRootAnalysis/ExRoot Result.h667 external/ExRootAnalysis/ExRootResult.h \ 668 external/ExRootAnalysis/ExRootFilter.h \ 669 external/ExRootAnalysis/ExRootClassifier.h 670 670 tmp/modules/Calorimeter.$(ObjSuf): \ 671 671 modules/Calorimeter.$(SrcSuf) \ … … 674 674 classes/DelphesFactory.h \ 675 675 classes/DelphesFormula.h \ 676 external/ExRootAnalysis/ExRoot Classifier.h \677 external/ExRootAnalysis/ExRootFilter.h \ 678 external/ExRootAnalysis/ExRoot Result.h676 external/ExRootAnalysis/ExRootResult.h \ 677 external/ExRootAnalysis/ExRootFilter.h \ 678 external/ExRootAnalysis/ExRootClassifier.h 679 679 tmp/modules/Cloner.$(ObjSuf): \ 680 680 modules/Cloner.$(SrcSuf) \ … … 683 683 classes/DelphesFactory.h \ 684 684 classes/DelphesFormula.h \ 685 external/ExRootAnalysis/ExRoot Classifier.h \686 external/ExRootAnalysis/ExRootFilter.h \ 687 external/ExRootAnalysis/ExRoot Result.h685 external/ExRootAnalysis/ExRootResult.h \ 686 external/ExRootAnalysis/ExRootFilter.h \ 687 external/ExRootAnalysis/ExRootClassifier.h 688 688 tmp/modules/ConstituentFilter.$(ObjSuf): \ 689 689 modules/ConstituentFilter.$(SrcSuf) \ … … 692 692 classes/DelphesFactory.h \ 693 693 classes/DelphesFormula.h \ 694 external/ExRootAnalysis/ExRoot Classifier.h \695 external/ExRootAnalysis/ExRootFilter.h \ 696 external/ExRootAnalysis/ExRoot Result.h694 external/ExRootAnalysis/ExRootResult.h \ 695 external/ExRootAnalysis/ExRootFilter.h \ 696 external/ExRootAnalysis/ExRootClassifier.h 697 697 tmp/modules/Delphes.$(ObjSuf): \ 698 698 modules/Delphes.$(SrcSuf) \ … … 701 701 classes/DelphesFactory.h \ 702 702 classes/DelphesFormula.h \ 703 external/ExRootAnalysis/ExRootResult.h \ 704 external/ExRootAnalysis/ExRootFilter.h \ 703 705 external/ExRootAnalysis/ExRootClassifier.h \ 704 706 external/ExRootAnalysis/ExRootConfReader.h \ 705 external/ExRootAnalysis/ExRootFilter.h \706 external/ExRootAnalysis/ExRootResult.h \707 707 external/ExRootAnalysis/ExRootTreeWriter.h 708 708 tmp/modules/DenseTrackFilter.$(ObjSuf): \ … … 712 712 classes/DelphesFactory.h \ 713 713 classes/DelphesFormula.h \ 714 external/ExRootAnalysis/ExRoot Classifier.h \715 external/ExRootAnalysis/ExRootFilter.h \ 716 external/ExRootAnalysis/ExRoot Result.h714 external/ExRootAnalysis/ExRootResult.h \ 715 external/ExRootAnalysis/ExRootFilter.h \ 716 external/ExRootAnalysis/ExRootClassifier.h 717 717 tmp/modules/DualReadoutCalorimeter.$(ObjSuf): \ 718 718 modules/DualReadoutCalorimeter.$(SrcSuf) \ … … 730 730 classes/DelphesFactory.h \ 731 731 classes/DelphesFormula.h \ 732 external/ExRootAnalysis/ExRoot Classifier.h \733 external/ExRootAnalysis/ExRootFilter.h \ 734 external/ExRootAnalysis/ExRoot Result.h732 external/ExRootAnalysis/ExRootResult.h \ 733 external/ExRootAnalysis/ExRootFilter.h \ 734 external/ExRootAnalysis/ExRootClassifier.h 735 735 tmp/modules/EnergyScale.$(ObjSuf): \ 736 736 modules/EnergyScale.$(SrcSuf) \ … … 739 739 classes/DelphesFactory.h \ 740 740 classes/DelphesFormula.h \ 741 external/ExRootAnalysis/ExRoot Classifier.h \742 external/ExRootAnalysis/ExRootFilter.h \ 743 external/ExRootAnalysis/ExRoot Result.h741 external/ExRootAnalysis/ExRootResult.h \ 742 external/ExRootAnalysis/ExRootFilter.h \ 743 external/ExRootAnalysis/ExRootClassifier.h 744 744 tmp/modules/EnergySmearing.$(ObjSuf): \ 745 745 modules/EnergySmearing.$(SrcSuf) \ … … 748 748 classes/DelphesFactory.h \ 749 749 classes/DelphesFormula.h \ 750 external/ExRootAnalysis/ExRoot Classifier.h \751 external/ExRootAnalysis/ExRootFilter.h \ 752 external/ExRootAnalysis/ExRoot Result.h750 external/ExRootAnalysis/ExRootResult.h \ 751 external/ExRootAnalysis/ExRootFilter.h \ 752 external/ExRootAnalysis/ExRootClassifier.h 753 753 tmp/modules/ExampleModule.$(ObjSuf): \ 754 754 modules/ExampleModule.$(SrcSuf) \ … … 757 757 classes/DelphesFactory.h \ 758 758 classes/DelphesFormula.h \ 759 external/ExRootAnalysis/ExRoot Classifier.h \760 external/ExRootAnalysis/ExRootFilter.h \ 761 external/ExRootAnalysis/ExRoot Result.h759 external/ExRootAnalysis/ExRootResult.h \ 760 external/ExRootAnalysis/ExRootFilter.h \ 761 external/ExRootAnalysis/ExRootClassifier.h 762 762 tmp/modules/Hector.$(ObjSuf): \ 763 763 modules/Hector.$(SrcSuf) \ … … 766 766 classes/DelphesFactory.h \ 767 767 classes/DelphesFormula.h \ 768 external/ExRootAnalysis/ExRootResult.h \ 769 external/ExRootAnalysis/ExRootFilter.h \ 768 770 external/ExRootAnalysis/ExRootClassifier.h \ 769 external/ExRootAnalysis/ExRootFilter.h \770 external/ExRootAnalysis/ExRootResult.h \771 771 external/Hector/H_BeamLine.h \ 772 external/Hector/H_ BeamParticle.h \773 external/Hector/H_ RecRPObject.h772 external/Hector/H_RecRPObject.h \ 773 external/Hector/H_BeamParticle.h 774 774 tmp/modules/IdentificationMap.$(ObjSuf): \ 775 775 modules/IdentificationMap.$(SrcSuf) \ … … 778 778 classes/DelphesFactory.h \ 779 779 classes/DelphesFormula.h \ 780 external/ExRootAnalysis/ExRoot Classifier.h \781 external/ExRootAnalysis/ExRootFilter.h \ 782 external/ExRootAnalysis/ExRoot Result.h780 external/ExRootAnalysis/ExRootResult.h \ 781 external/ExRootAnalysis/ExRootFilter.h \ 782 external/ExRootAnalysis/ExRootClassifier.h 783 783 tmp/modules/ImpactParameterSmearing.$(ObjSuf): \ 784 784 modules/ImpactParameterSmearing.$(SrcSuf) \ … … 787 787 classes/DelphesFactory.h \ 788 788 classes/DelphesFormula.h \ 789 external/ExRootAnalysis/ExRoot Classifier.h \790 external/ExRootAnalysis/ExRootFilter.h \ 791 external/ExRootAnalysis/ExRoot Result.h789 external/ExRootAnalysis/ExRootResult.h \ 790 external/ExRootAnalysis/ExRootFilter.h \ 791 external/ExRootAnalysis/ExRootClassifier.h 792 792 tmp/modules/Isolation.$(ObjSuf): \ 793 793 modules/Isolation.$(SrcSuf) \ … … 796 796 classes/DelphesFactory.h \ 797 797 classes/DelphesFormula.h \ 798 external/ExRootAnalysis/ExRoot Classifier.h \799 external/ExRootAnalysis/ExRootFilter.h \ 800 external/ExRootAnalysis/ExRoot Result.h798 external/ExRootAnalysis/ExRootResult.h \ 799 external/ExRootAnalysis/ExRootFilter.h \ 800 external/ExRootAnalysis/ExRootClassifier.h 801 801 tmp/modules/JetFakeParticle.$(ObjSuf): \ 802 802 modules/JetFakeParticle.$(SrcSuf) \ … … 805 805 classes/DelphesFactory.h \ 806 806 classes/DelphesFormula.h \ 807 external/ExRootAnalysis/ExRoot Classifier.h \808 external/ExRootAnalysis/ExRootFilter.h \ 809 external/ExRootAnalysis/ExRoot Result.h807 external/ExRootAnalysis/ExRootResult.h \ 808 external/ExRootAnalysis/ExRootFilter.h \ 809 external/ExRootAnalysis/ExRootClassifier.h 810 810 tmp/modules/JetFlavorAssociation.$(ObjSuf): \ 811 811 modules/JetFlavorAssociation.$(SrcSuf) \ … … 814 814 classes/DelphesFactory.h \ 815 815 classes/DelphesFormula.h \ 816 external/ExRootAnalysis/ExRoot Classifier.h \817 external/ExRootAnalysis/ExRootFilter.h \ 818 external/ExRootAnalysis/ExRoot Result.h816 external/ExRootAnalysis/ExRootResult.h \ 817 external/ExRootAnalysis/ExRootFilter.h \ 818 external/ExRootAnalysis/ExRootClassifier.h 819 819 tmp/modules/JetPileUpSubtractor.$(ObjSuf): \ 820 820 modules/JetPileUpSubtractor.$(SrcSuf) \ … … 823 823 classes/DelphesFactory.h \ 824 824 classes/DelphesFormula.h \ 825 external/ExRootAnalysis/ExRoot Classifier.h \826 external/ExRootAnalysis/ExRootFilter.h \ 827 external/ExRootAnalysis/ExRoot Result.h825 external/ExRootAnalysis/ExRootResult.h \ 826 external/ExRootAnalysis/ExRootFilter.h \ 827 external/ExRootAnalysis/ExRootClassifier.h 828 828 tmp/modules/LeptonDressing.$(ObjSuf): \ 829 829 modules/LeptonDressing.$(SrcSuf) \ … … 832 832 classes/DelphesFactory.h \ 833 833 classes/DelphesFormula.h \ 834 external/ExRootAnalysis/ExRoot Classifier.h \835 external/ExRootAnalysis/ExRootFilter.h \ 836 external/ExRootAnalysis/ExRoot Result.h834 external/ExRootAnalysis/ExRootResult.h \ 835 external/ExRootAnalysis/ExRootFilter.h \ 836 external/ExRootAnalysis/ExRootClassifier.h 837 837 tmp/modules/Merger.$(ObjSuf): \ 838 838 modules/Merger.$(SrcSuf) \ … … 841 841 classes/DelphesFactory.h \ 842 842 classes/DelphesFormula.h \ 843 external/ExRootAnalysis/ExRoot Classifier.h \844 external/ExRootAnalysis/ExRootFilter.h \ 845 external/ExRootAnalysis/ExRoot Result.h843 external/ExRootAnalysis/ExRootResult.h \ 844 external/ExRootAnalysis/ExRootFilter.h \ 845 external/ExRootAnalysis/ExRootClassifier.h 846 846 tmp/modules/MomentumSmearing.$(ObjSuf): \ 847 847 modules/MomentumSmearing.$(SrcSuf) \ … … 850 850 classes/DelphesFactory.h \ 851 851 classes/DelphesFormula.h \ 852 external/ExRootAnalysis/ExRoot Classifier.h \853 external/ExRootAnalysis/ExRootFilter.h \ 854 external/ExRootAnalysis/ExRoot Result.h852 external/ExRootAnalysis/ExRootResult.h \ 853 external/ExRootAnalysis/ExRootFilter.h \ 854 external/ExRootAnalysis/ExRootClassifier.h 855 855 tmp/modules/OldCalorimeter.$(ObjSuf): \ 856 856 modules/OldCalorimeter.$(SrcSuf) \ … … 859 859 classes/DelphesFactory.h \ 860 860 classes/DelphesFormula.h \ 861 external/ExRootAnalysis/ExRoot Classifier.h \862 external/ExRootAnalysis/ExRootFilter.h \ 863 external/ExRootAnalysis/ExRoot Result.h861 external/ExRootAnalysis/ExRootResult.h \ 862 external/ExRootAnalysis/ExRootFilter.h \ 863 external/ExRootAnalysis/ExRootClassifier.h 864 864 tmp/modules/ParticlePropagator.$(ObjSuf): \ 865 865 modules/ParticlePropagator.$(SrcSuf) \ … … 868 868 classes/DelphesFactory.h \ 869 869 classes/DelphesFormula.h \ 870 external/ExRootAnalysis/ExRoot Classifier.h \871 external/ExRootAnalysis/ExRootFilter.h \ 872 external/ExRootAnalysis/ExRoot Result.h870 external/ExRootAnalysis/ExRootResult.h \ 871 external/ExRootAnalysis/ExRootFilter.h \ 872 external/ExRootAnalysis/ExRootClassifier.h 873 873 tmp/modules/PdgCodeFilter.$(ObjSuf): \ 874 874 modules/PdgCodeFilter.$(SrcSuf) \ … … 877 877 classes/DelphesFactory.h \ 878 878 classes/DelphesFormula.h \ 879 external/ExRootAnalysis/ExRoot Classifier.h \880 external/ExRootAnalysis/ExRootFilter.h \ 881 external/ExRootAnalysis/ExRoot Result.h879 external/ExRootAnalysis/ExRootResult.h \ 880 external/ExRootAnalysis/ExRootFilter.h \ 881 external/ExRootAnalysis/ExRootClassifier.h 882 882 tmp/modules/PhotonConversions.$(ObjSuf): \ 883 883 modules/PhotonConversions.$(SrcSuf) \ 884 884 modules/PhotonConversions.h \ 885 885 classes/DelphesClasses.h \ 886 classes/DelphesFactory.h \ 886 887 classes/DelphesCylindricalFormula.h \ 887 classes/DelphesFactory.h \ 888 external/ExRootAnalysis/ExRootClassifier.h \ 889 external/ExRootAnalysis/ExRootFilter.h \ 890 external/ExRootAnalysis/ExRootResult.h 888 external/ExRootAnalysis/ExRootResult.h \ 889 external/ExRootAnalysis/ExRootFilter.h \ 890 external/ExRootAnalysis/ExRootClassifier.h 891 891 tmp/modules/PhotonID.$(ObjSuf): \ 892 892 modules/PhotonID.$(SrcSuf) \ … … 895 895 classes/DelphesFactory.h \ 896 896 classes/DelphesFormula.h \ 897 external/ExRootAnalysis/ExRoot Classifier.h \898 external/ExRootAnalysis/ExRootFilter.h \ 899 external/ExRootAnalysis/ExRoot Result.h897 external/ExRootAnalysis/ExRootResult.h \ 898 external/ExRootAnalysis/ExRootFilter.h \ 899 external/ExRootAnalysis/ExRootClassifier.h 900 900 tmp/modules/PileUpJetID.$(ObjSuf): \ 901 901 modules/PileUpJetID.$(SrcSuf) \ … … 904 904 classes/DelphesFactory.h \ 905 905 classes/DelphesFormula.h \ 906 external/ExRootAnalysis/ExRoot Classifier.h \907 external/ExRootAnalysis/ExRootFilter.h \ 908 external/ExRootAnalysis/ExRoot Result.h906 external/ExRootAnalysis/ExRootResult.h \ 907 external/ExRootAnalysis/ExRootFilter.h \ 908 external/ExRootAnalysis/ExRootClassifier.h 909 909 tmp/modules/PileUpMerger.$(ObjSuf): \ 910 910 modules/PileUpMerger.$(SrcSuf) \ … … 912 912 classes/DelphesClasses.h \ 913 913 classes/DelphesFactory.h \ 914 classes/DelphesTF2.h \ 914 915 classes/DelphesPileUpReader.h \ 915 classes/DelphesTF2.h \ 916 external/ExRootAnalysis/ExRootClassifier.h \ 917 external/ExRootAnalysis/ExRootFilter.h \ 918 external/ExRootAnalysis/ExRootResult.h 916 external/ExRootAnalysis/ExRootResult.h \ 917 external/ExRootAnalysis/ExRootFilter.h \ 918 external/ExRootAnalysis/ExRootClassifier.h 919 919 tmp/modules/PileUpMergerPythia8.$(ObjSuf): \ 920 920 modules/PileUpMergerPythia8.$(SrcSuf) \ … … 922 922 classes/DelphesClasses.h \ 923 923 classes/DelphesFactory.h \ 924 classes/DelphesTF2.h \ 924 925 classes/DelphesPileUpReader.h \ 925 classes/DelphesTF2.h \ 926 external/ExRootAnalysis/ExRootClassifier.h \ 927 external/ExRootAnalysis/ExRootFilter.h \ 928 external/ExRootAnalysis/ExRootResult.h 926 external/ExRootAnalysis/ExRootResult.h \ 927 external/ExRootAnalysis/ExRootFilter.h \ 928 external/ExRootAnalysis/ExRootClassifier.h 929 929 tmp/modules/RecoPuFilter.$(ObjSuf): \ 930 930 modules/RecoPuFilter.$(SrcSuf) \ … … 933 933 classes/DelphesFactory.h \ 934 934 classes/DelphesFormula.h \ 935 external/ExRootAnalysis/ExRoot Classifier.h \936 external/ExRootAnalysis/ExRootFilter.h \ 937 external/ExRootAnalysis/ExRoot Result.h935 external/ExRootAnalysis/ExRootResult.h \ 936 external/ExRootAnalysis/ExRootFilter.h \ 937 external/ExRootAnalysis/ExRootClassifier.h 938 938 tmp/modules/SimpleCalorimeter.$(ObjSuf): \ 939 939 modules/SimpleCalorimeter.$(SrcSuf) \ … … 942 942 classes/DelphesFactory.h \ 943 943 classes/DelphesFormula.h \ 944 external/ExRootAnalysis/ExRoot Classifier.h \945 external/ExRootAnalysis/ExRootFilter.h \ 946 external/ExRootAnalysis/ExRoot Result.h944 external/ExRootAnalysis/ExRootResult.h \ 945 external/ExRootAnalysis/ExRootFilter.h \ 946 external/ExRootAnalysis/ExRootClassifier.h 947 947 tmp/modules/StatusPidFilter.$(ObjSuf): \ 948 948 modules/StatusPidFilter.$(SrcSuf) \ … … 951 951 classes/DelphesFactory.h \ 952 952 classes/DelphesFormula.h \ 953 external/ExRootAnalysis/ExRoot Classifier.h \954 external/ExRootAnalysis/ExRootFilter.h \ 955 external/ExRootAnalysis/ExRoot Result.h953 external/ExRootAnalysis/ExRootResult.h \ 954 external/ExRootAnalysis/ExRootFilter.h \ 955 external/ExRootAnalysis/ExRootClassifier.h 956 956 tmp/modules/TaggingParticlesSkimmer.$(ObjSuf): \ 957 957 modules/TaggingParticlesSkimmer.$(SrcSuf) \ … … 961 961 classes/DelphesFactory.h \ 962 962 classes/DelphesFormula.h \ 963 external/ExRootAnalysis/ExRoot Classifier.h \964 external/ExRootAnalysis/ExRootFilter.h \ 965 external/ExRootAnalysis/ExRoot Result.h963 external/ExRootAnalysis/ExRootResult.h \ 964 external/ExRootAnalysis/ExRootFilter.h \ 965 external/ExRootAnalysis/ExRootClassifier.h 966 966 tmp/modules/TauTagging.$(ObjSuf): \ 967 967 modules/TauTagging.$(SrcSuf) \ … … 976 976 classes/DelphesFactory.h \ 977 977 classes/DelphesFormula.h \ 978 external/ExRootAnalysis/ExRoot Classifier.h \979 external/ExRootAnalysis/ExRootFilter.h \ 980 external/ExRootAnalysis/ExRoot Result.h978 external/ExRootAnalysis/ExRootResult.h \ 979 external/ExRootAnalysis/ExRootFilter.h \ 980 external/ExRootAnalysis/ExRootClassifier.h 981 981 tmp/modules/TrackCountingBTagging.$(ObjSuf): \ 982 982 modules/TrackCountingBTagging.$(SrcSuf) \ … … 991 991 classes/DelphesFactory.h \ 992 992 classes/DelphesFormula.h \ 993 external/ExRootAnalysis/ExRoot Classifier.h \994 external/ExRootAnalysis/ExRootFilter.h \ 995 external/ExRootAnalysis/ExRoot Result.h993 external/ExRootAnalysis/ExRootResult.h \ 994 external/ExRootAnalysis/ExRootFilter.h \ 995 external/ExRootAnalysis/ExRootClassifier.h 996 996 tmp/modules/TrackPileUpSubtractor.$(ObjSuf): \ 997 997 modules/TrackPileUpSubtractor.$(SrcSuf) \ … … 1000 1000 classes/DelphesFactory.h \ 1001 1001 classes/DelphesFormula.h \ 1002 external/ExRootAnalysis/ExRoot Classifier.h \1003 external/ExRootAnalysis/ExRootFilter.h \ 1004 external/ExRootAnalysis/ExRoot Result.h1002 external/ExRootAnalysis/ExRootResult.h \ 1003 external/ExRootAnalysis/ExRootFilter.h \ 1004 external/ExRootAnalysis/ExRootClassifier.h 1005 1005 tmp/modules/TrackSmearing.$(ObjSuf): \ 1006 1006 modules/TrackSmearing.$(SrcSuf) \ … … 1009 1009 classes/DelphesFactory.h \ 1010 1010 classes/DelphesFormula.h \ 1011 external/ExRootAnalysis/ExRoot Classifier.h \1012 external/ExRootAnalysis/ExRootFilter.h \ 1013 external/ExRootAnalysis/ExRoot Result.h1011 external/ExRootAnalysis/ExRootResult.h \ 1012 external/ExRootAnalysis/ExRootFilter.h \ 1013 external/ExRootAnalysis/ExRootClassifier.h 1014 1014 tmp/modules/TreeWriter.$(ObjSuf): \ 1015 1015 modules/TreeWriter.$(SrcSuf) \ … … 1018 1018 classes/DelphesFactory.h \ 1019 1019 classes/DelphesFormula.h \ 1020 external/ExRootAnalysis/ExRootResult.h \ 1021 external/ExRootAnalysis/ExRootFilter.h \ 1020 1022 external/ExRootAnalysis/ExRootClassifier.h \ 1021 external/ExRootAnalysis/ExRootFilter.h \1022 external/ExRootAnalysis/ExRootResult.h \1023 1023 external/ExRootAnalysis/ExRootTreeBranch.h 1024 1024 tmp/modules/UniqueObjectFinder.$(ObjSuf): \ … … 1028 1028 classes/DelphesFactory.h \ 1029 1029 classes/DelphesFormula.h \ 1030 external/ExRootAnalysis/ExRoot Classifier.h \1031 external/ExRootAnalysis/ExRootFilter.h \ 1032 external/ExRootAnalysis/ExRoot Result.h1030 external/ExRootAnalysis/ExRootResult.h \ 1031 external/ExRootAnalysis/ExRootFilter.h \ 1032 external/ExRootAnalysis/ExRootClassifier.h 1033 1033 tmp/modules/VertexFinder.$(ObjSuf): \ 1034 1034 modules/VertexFinder.$(SrcSuf) \ … … 1038 1038 classes/DelphesFormula.h \ 1039 1039 classes/DelphesPileUpReader.h \ 1040 external/ExRootAnalysis/ExRoot Classifier.h \1041 external/ExRootAnalysis/ExRootFilter.h \ 1042 external/ExRootAnalysis/ExRoot Result.h1040 external/ExRootAnalysis/ExRootResult.h \ 1041 external/ExRootAnalysis/ExRootFilter.h \ 1042 external/ExRootAnalysis/ExRootClassifier.h 1043 1043 tmp/modules/VertexFinderDA4D.$(ObjSuf): \ 1044 1044 modules/VertexFinderDA4D.$(SrcSuf) \ … … 1048 1048 classes/DelphesFormula.h \ 1049 1049 classes/DelphesPileUpReader.h \ 1050 external/ExRootAnalysis/ExRoot Classifier.h \1051 external/ExRootAnalysis/ExRootFilter.h \ 1052 external/ExRootAnalysis/ExRoot Result.h1050 external/ExRootAnalysis/ExRootResult.h \ 1051 external/ExRootAnalysis/ExRootFilter.h \ 1052 external/ExRootAnalysis/ExRootClassifier.h 1053 1053 tmp/modules/VertexSorter.$(ObjSuf): \ 1054 1054 modules/VertexSorter.$(SrcSuf) \ … … 1058 1058 classes/DelphesFormula.h \ 1059 1059 classes/DelphesPileUpReader.h \ 1060 external/ExRootAnalysis/ExRoot Classifier.h \1061 external/ExRootAnalysis/ExRootFilter.h \ 1062 external/ExRootAnalysis/ExRoot Result.h1060 external/ExRootAnalysis/ExRootResult.h \ 1061 external/ExRootAnalysis/ExRootFilter.h \ 1062 external/ExRootAnalysis/ExRootClassifier.h 1063 1063 tmp/modules/Weighter.$(ObjSuf): \ 1064 1064 modules/Weighter.$(SrcSuf) \ … … 1067 1067 classes/DelphesFactory.h \ 1068 1068 classes/DelphesFormula.h \ 1069 external/ExRootAnalysis/ExRoot Classifier.h \1070 external/ExRootAnalysis/ExRootFilter.h \ 1071 external/ExRootAnalysis/ExRoot Result.h1069 external/ExRootAnalysis/ExRootResult.h \ 1070 external/ExRootAnalysis/ExRootFilter.h \ 1071 external/ExRootAnalysis/ExRootClassifier.h 1072 1072 DELPHES_OBJ += \ 1073 1073 tmp/classes/DelphesClasses.$(ObjSuf) \ … … 1501 1501 classes/DelphesFactory.h \ 1502 1502 classes/DelphesFormula.h \ 1503 external/ExRootAnalysis/ExRootResult.h \ 1504 external/ExRootAnalysis/ExRootFilter.h \ 1503 1505 external/ExRootAnalysis/ExRootClassifier.h \ 1504 external/ ExRootAnalysis/ExRootFilter.h \1505 external/ ExRootAnalysis/ExRootResult.h \1506 external/fastjet/PseudoJet.hh \ 1507 external/fastjet/JetDefinition.hh \ 1506 1508 external/fastjet/ClusterSequence.hh \ 1509 external/fastjet/Selector.hh \ 1507 1510 external/fastjet/ClusterSequenceArea.hh \ 1508 external/fastjet/JetDefinition.hh \1509 external/fastjet/PseudoJet.hh \1510 external/fastjet/Selector.hh \1511 1511 external/fastjet/tools/JetMedianBackgroundEstimator.hh \ 1512 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1513 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1512 1514 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1513 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1514 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1515 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh \ 1515 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh \ 1516 1516 external/fastjet/contribs/Nsubjettiness/Njettiness.hh \ 1517 1517 external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh \ 1518 external/fastjet/contribs/Nsubjettiness/ Nsubjettiness.hh \1518 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh \ 1519 1519 external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh \ 1520 external/fastjet/contribs/RecursiveTools/SoftDrop.hh \1521 1520 external/fastjet/tools/Filter.hh \ 1522 external/fastjet/tools/Pruner.hh 1521 external/fastjet/tools/Pruner.hh \ 1522 external/fastjet/contribs/RecursiveTools/SoftDrop.hh 1523 1523 tmp/modules/FastJetGridMedianEstimator.$(ObjSuf): \ 1524 1524 modules/FastJetGridMedianEstimator.$(SrcSuf) \ … … 1527 1527 classes/DelphesFactory.h \ 1528 1528 classes/DelphesFormula.h \ 1529 external/ExRootAnalysis/ExRootResult.h \ 1530 external/ExRootAnalysis/ExRootFilter.h \ 1529 1531 external/ExRootAnalysis/ExRootClassifier.h \ 1530 external/ ExRootAnalysis/ExRootFilter.h \1531 external/ ExRootAnalysis/ExRootResult.h \1532 external/fastjet/PseudoJet.hh \ 1533 external/fastjet/JetDefinition.hh \ 1532 1534 external/fastjet/ClusterSequence.hh \ 1535 external/fastjet/Selector.hh \ 1536 external/fastjet/RectangularGrid.hh \ 1533 1537 external/fastjet/ClusterSequenceArea.hh \ 1534 external/fastjet/JetDefinition.hh \1535 external/fastjet/PseudoJet.hh \1536 external/fastjet/RectangularGrid.hh \1537 external/fastjet/Selector.hh \1538 1538 external/fastjet/tools/JetMedianBackgroundEstimator.hh \ 1539 1539 external/fastjet/tools/GridMedianBackgroundEstimator.hh \ 1540 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1541 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1540 1542 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1541 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1542 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1543 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh \ 1543 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh \ 1544 1544 external/fastjet/contribs/Nsubjettiness/Njettiness.hh \ 1545 1545 external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh \ 1546 external/fastjet/contribs/Nsubjettiness/ Nsubjettiness.hh1546 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh 1547 1547 tmp/modules/RunPUPPI.$(ObjSuf): \ 1548 1548 modules/RunPUPPI.$(SrcSuf) \ 1549 1549 modules/RunPUPPI.h \ 1550 external/PUPPI/RecoObj2.hh \ 1550 1551 external/PUPPI/AlgoObj.hh \ 1551 1552 external/PUPPI/PuppiContainer.hh \ 1552 external/PUPPI/RecoObj2.hh \1553 1553 external/fastjet/PseudoJet.hh \ 1554 1554 classes/DelphesClasses.h \ … … 1682 1682 tmp/display/DelphesEventDisplay.$(ObjSuf): \ 1683 1683 display/DelphesEventDisplay.$(SrcSuf) \ 1684 display/DelphesCaloData.h \ 1685 display/DelphesBranchElement.h \ 1684 1686 display/Delphes3DGeometry.h \ 1685 display/DelphesBranchElement.h \ 1686 display/DelphesCaloData.h \ 1687 display/DelphesEventDisplay.h \ 1687 1688 display/DelphesDisplay.h \ 1688 display/Delphes EventDisplay.h \1689 display/Delphes3DGeometry.h \ 1689 1690 display/DelphesHtmlSummary.h \ 1690 1691 display/DelphesPlotSummary.h \ … … 2054 2055 2055 2056 modules/TauTagging.h: \ 2056 external/ExRootAnalysis/ExRootClassifier.h \2057 external/ExRootAnalysis/ExRoot Filter.h \2058 external/ExRootAnalysis/ExRoot Result.h \2059 classes/DelphesModule.h2057 classes/DelphesModule.h \ 2058 external/ExRootAnalysis/ExRootResult.h \ 2059 external/ExRootAnalysis/ExRootFilter.h \ 2060 external/ExRootAnalysis/ExRootClassifier.h 2060 2061 @touch $@ 2061 2062 … … 2105 2106 2106 2107 modules/JetFlavorAssociation.h: \ 2107 classes/Delphes Classes.h \2108 classes/Delphes Module.h2108 classes/DelphesModule.h \ 2109 classes/DelphesClasses.h 2109 2110 @touch $@ 2110 2111 -
README
r0e7d64a re39abb4 4 4 Commands to get the code: 5 5 6 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4. 2.tar.gz6 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.1.tar.gz 7 7 8 tar -zxf Delphes-3.4. 2.tar.gz8 tar -zxf Delphes-3.4.1.tar.gz 9 9 10 10 Commands to compile the code: 11 11 12 cd Delphes-3.4. 212 cd Delphes-3.4.1 13 13 14 14 make -
README.md
r0e7d64a re39abb4 14 14 15 15 ``` 16 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4. 2.tar.gz16 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.1.tar.gz 17 17 18 tar -zxf Delphes-3.4. 2.tar.gz18 tar -zxf Delphes-3.4.1.tar.gz 19 19 ``` 20 20 … … 22 22 23 23 ``` 24 cd Delphes-3.4. 224 cd Delphes-3.4.1 25 25 26 26 make -
VERSION
r0e7d64a re39abb4 1 3.4. 21 3.4.1 -
cards/FCC/FCChh.tcl
r0e7d64a re39abb4 1239 1239 1240 1240 (pt <= 10.0) * (0.00) + 1241 (abs(eta) < 2.5) * (pt > 10.0 && pt < 5000.0) * (0. 8) + \1242 (abs(eta) < 2.5) * (pt > 5000.0 && pt < 34000.0) * (0. 8) *(8./9. - pt/30000.) + \1241 (abs(eta) < 2.5) * (pt > 10.0 && pt < 5000.0) * (0.6) + \ 1242 (abs(eta) < 2.5) * (pt > 5000.0 && pt < 34000.0) * (0.6) *(8./9. - pt/30000.) + \ 1243 1243 (abs(eta) < 2.5) * (pt > 34000.0) * (0.000) + \ 1244 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 10.0 && pt < 5000.0) * (0. 65) + \1245 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 5000.0 && pt < 34000.0) * (0. 65)*(8./9. - pt/30000.) + \1244 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 10.0 && pt < 5000.0) * (0.45) + \ 1245 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 5000.0 && pt < 34000.0) * (0.45)*(8./9. - pt/30000.) + \ 1246 1246 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 34000.0) * (0.00) + \ 1247 1247 (abs(eta) > 4.0) * (0.00)} -
cards/delphes_card_CLICdet_Stage1.tcl
r0e7d64a re39abb4 1 1 ####################################### 2 2 # CLICdet model 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 3 # based on CLICdp-Note-2017-001 6 4 # Ulrike Schnoor ulrike.schnoor@cern.ch 7 5 # … … 13 11 # according to final state 14 12 # 15 # c-tagging capabilities of CLICdet are16 # not yet implemented here. Please17 # contact us if you want to use it.18 #######################################19 20 13 ####################################### 21 14 # Order of execution of various modules … … 714 707 set OutputArray photons 715 708 716 set DeltaRMax 0. 1709 set DeltaRMax 0.5 717 710 718 711 set PTMin 0.5 719 712 720 set PTRatioMax 0. 2713 set PTRatioMax 0.12 721 714 } 722 715 … … 812 805 set OutputArray electrons 813 806 814 set DeltaRMax 0. 1807 set DeltaRMax 0.5 815 808 816 809 set PTMin 0.5 817 810 818 set PTRatioMax 0. 2811 set PTRatioMax 0.12 819 812 } 820 813 … … 851 844 set OutputArray muons 852 845 853 set DeltaRMax 0. 1846 set DeltaRMax 0.5 854 847 855 848 set PTMin 0.5 856 849 857 set PTRatioMax 0.2 850 set PTRatioMax 0.25 858 851 } 859 852 -
cards/delphes_card_CLICdet_Stage2.tcl
r0e7d64a re39abb4 1 1 ####################################### 2 2 # CLICdet model 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 3 # based on CLICdp-Note-2017-001 6 4 # Ulrike Schnoor ulrike.schnoor@cern.ch 7 5 # … … 13 11 # according to final state 14 12 # 15 # c-tagging capabilities of CLICdet are16 # not yet implemented here. Please17 # contact us if you want to use it.18 #######################################19 20 13 ####################################### 21 14 # Order of execution of various modules … … 131 124 132 125 JetFlavorAssociation_R05N2 133 JetFlavorAssociation_R05N3 134 JetFlavorAssociation_R05N4 135 JetFlavorAssociation_R05N5 136 JetFlavorAssociation_R05N6 137 138 JetFlavorAssociation_R07N2 139 JetFlavorAssociation_R07N3 140 JetFlavorAssociation_R07N4 141 JetFlavorAssociation_R07N5 142 JetFlavorAssociation_R07N6 143 144 JetFlavorAssociation_R10N2 145 JetFlavorAssociation_R10N3 146 JetFlavorAssociation_R10N4 147 JetFlavorAssociation_R10N5 148 JetFlavorAssociation_R10N6 149 150 JetFlavorAssociation_R12N2 151 JetFlavorAssociation_R12N3 152 JetFlavorAssociation_R12N4 153 JetFlavorAssociation_R12N5 154 JetFlavorAssociation_R12N6 155 156 JetFlavorAssociation_R15N2 157 JetFlavorAssociation_R15N3 158 JetFlavorAssociation_R15N4 159 JetFlavorAssociation_R15N5 160 JetFlavorAssociation_R15N6 161 162 JetFlavorAssociation_R05_inclusive 163 JetFlavorAssociation_R07_inclusive 164 JetFlavorAssociation_R10_inclusive 165 JetFlavorAssociation_R12_inclusive 166 JetFlavorAssociation_R15_inclusive 167 168 169 JetFlavorAssociation_JER_R05N2 170 JetFlavorAssociation_JER_R05N3 171 JetFlavorAssociation_JER_R05N4 172 JetFlavorAssociation_JER_R05N5 173 JetFlavorAssociation_JER_R05N6 174 175 JetFlavorAssociation_JER_R07N2 176 JetFlavorAssociation_JER_R07N3 177 JetFlavorAssociation_JER_R07N4 178 JetFlavorAssociation_JER_R07N5 179 JetFlavorAssociation_JER_R07N6 180 181 JetFlavorAssociation_JER_R10N2 182 JetFlavorAssociation_JER_R10N3 183 JetFlavorAssociation_JER_R10N4 184 JetFlavorAssociation_JER_R10N5 185 JetFlavorAssociation_JER_R10N6 186 187 JetFlavorAssociation_JER_R12N2 188 JetFlavorAssociation_JER_R12N3 189 JetFlavorAssociation_JER_R12N4 190 JetFlavorAssociation_JER_R12N5 191 JetFlavorAssociation_JER_R12N6 192 193 JetFlavorAssociation_JER_R15N2 194 JetFlavorAssociation_JER_R15N3 195 JetFlavorAssociation_JER_R15N4 196 JetFlavorAssociation_JER_R15N5 197 JetFlavorAssociation_JER_R15N6 198 199 JetFlavorAssociation_JER_R05_inclusive 200 JetFlavorAssociation_JER_R07_inclusive 201 JetFlavorAssociation_JER_R10_inclusive 202 JetFlavorAssociation_JER_R12_inclusive 203 JetFlavorAssociation_JER_R15_inclusive 204 205 206 BTaggingWP50_R05N2 207 BTaggingWP70_R05N2 208 BTaggingWP90_R05N2 209 BTaggingWP50_R05N3 210 BTaggingWP70_R05N3 211 BTaggingWP90_R05N3 212 BTaggingWP50_R05N4 213 BTaggingWP70_R05N4 214 BTaggingWP90_R05N4 215 BTaggingWP50_R05N5 216 BTaggingWP70_R05N5 217 BTaggingWP90_R05N5 218 BTaggingWP50_R05N6 219 BTaggingWP70_R05N6 220 BTaggingWP90_R05N6 221 BTaggingWP50_R07N2 222 BTaggingWP70_R07N2 223 BTaggingWP90_R07N2 224 BTaggingWP50_R07N3 225 BTaggingWP70_R07N3 226 BTaggingWP90_R07N3 227 BTaggingWP50_R07N4 228 BTaggingWP70_R07N4 229 BTaggingWP90_R07N4 230 BTaggingWP50_R07N5 231 BTaggingWP70_R07N5 232 BTaggingWP90_R07N5 233 BTaggingWP50_R07N6 234 BTaggingWP70_R07N6 235 BTaggingWP90_R07N6 236 BTaggingWP50_R10N2 237 BTaggingWP70_R10N2 238 BTaggingWP90_R10N2 239 BTaggingWP50_R10N3 240 BTaggingWP70_R10N3 241 BTaggingWP90_R10N3 242 BTaggingWP50_R10N4 243 BTaggingWP70_R10N4 244 BTaggingWP90_R10N4 245 BTaggingWP50_R10N5 246 BTaggingWP70_R10N5 247 BTaggingWP90_R10N5 248 BTaggingWP50_R10N6 249 BTaggingWP70_R10N6 250 BTaggingWP90_R10N6 251 BTaggingWP50_R12N2 252 BTaggingWP70_R12N2 253 BTaggingWP90_R12N2 254 BTaggingWP50_R12N3 255 BTaggingWP70_R12N3 256 BTaggingWP90_R12N3 257 BTaggingWP50_R12N4 258 BTaggingWP70_R12N4 259 BTaggingWP90_R12N4 260 BTaggingWP50_R12N5 261 BTaggingWP70_R12N5 262 BTaggingWP90_R12N5 263 BTaggingWP50_R12N6 264 BTaggingWP70_R12N6 265 BTaggingWP90_R12N6 266 BTaggingWP50_R15N2 267 BTaggingWP70_R15N2 268 BTaggingWP90_R15N2 269 BTaggingWP50_R15N3 270 BTaggingWP70_R15N3 271 BTaggingWP90_R15N3 272 BTaggingWP50_R15N4 273 BTaggingWP70_R15N4 274 BTaggingWP90_R15N4 275 BTaggingWP50_R15N5 276 BTaggingWP70_R15N5 277 BTaggingWP90_R15N5 278 BTaggingWP50_R15N6 279 BTaggingWP70_R15N6 280 BTaggingWP90_R15N6 126 JetFlavorAssociation_R05N3 127 JetFlavorAssociation_R05N4 128 JetFlavorAssociation_R05N5 129 JetFlavorAssociation_R05N6 130 131 JetFlavorAssociation_R07N2 132 JetFlavorAssociation_R07N3 133 JetFlavorAssociation_R07N4 134 JetFlavorAssociation_R07N5 135 JetFlavorAssociation_R07N6 136 137 JetFlavorAssociation_R10N2 138 JetFlavorAssociation_R10N3 139 JetFlavorAssociation_R10N4 140 JetFlavorAssociation_R10N5 141 JetFlavorAssociation_R10N6 142 143 JetFlavorAssociation_R12N2 144 JetFlavorAssociation_R12N3 145 JetFlavorAssociation_R12N4 146 JetFlavorAssociation_R12N5 147 JetFlavorAssociation_R12N6 148 149 JetFlavorAssociation_R15N2 150 JetFlavorAssociation_R15N3 151 JetFlavorAssociation_R15N4 152 JetFlavorAssociation_R15N5 153 JetFlavorAssociation_R15N6 154 155 JetFlavorAssociation_R05_inclusive 156 JetFlavorAssociation_R07_inclusive 157 JetFlavorAssociation_R10_inclusive 158 JetFlavorAssociation_R12_inclusive 159 JetFlavorAssociation_R15_inclusive 160 161 162 BTaggingWP50_R05N2 163 BTaggingWP70_R05N2 164 BTaggingWP90_R05N2 165 BTaggingWP50_R05N3 166 BTaggingWP70_R05N3 167 BTaggingWP90_R05N3 168 BTaggingWP50_R05N4 169 BTaggingWP70_R05N4 170 BTaggingWP90_R05N4 171 BTaggingWP50_R05N5 172 BTaggingWP70_R05N5 173 BTaggingWP90_R05N5 174 BTaggingWP50_R05N6 175 BTaggingWP70_R05N6 176 BTaggingWP90_R05N6 177 BTaggingWP50_R07N2 178 BTaggingWP70_R07N2 179 BTaggingWP90_R07N2 180 BTaggingWP50_R07N3 181 BTaggingWP70_R07N3 182 BTaggingWP90_R07N3 183 BTaggingWP50_R07N4 184 BTaggingWP70_R07N4 185 BTaggingWP90_R07N4 186 BTaggingWP50_R07N5 187 BTaggingWP70_R07N5 188 BTaggingWP90_R07N5 189 BTaggingWP50_R07N6 190 BTaggingWP70_R07N6 191 BTaggingWP90_R07N6 192 BTaggingWP50_R10N2 193 BTaggingWP70_R10N2 194 BTaggingWP90_R10N2 195 BTaggingWP50_R10N3 196 BTaggingWP70_R10N3 197 BTaggingWP90_R10N3 198 BTaggingWP50_R10N4 199 BTaggingWP70_R10N4 200 BTaggingWP90_R10N4 201 BTaggingWP50_R10N5 202 BTaggingWP70_R10N5 203 BTaggingWP90_R10N5 204 BTaggingWP50_R10N6 205 BTaggingWP70_R10N6 206 BTaggingWP90_R10N6 207 BTaggingWP50_R12N2 208 BTaggingWP70_R12N2 209 BTaggingWP90_R12N2 210 BTaggingWP50_R12N3 211 BTaggingWP70_R12N3 212 BTaggingWP90_R12N3 213 BTaggingWP50_R12N4 214 BTaggingWP70_R12N4 215 BTaggingWP90_R12N4 216 BTaggingWP50_R12N5 217 BTaggingWP70_R12N5 218 BTaggingWP90_R12N5 219 BTaggingWP50_R12N6 220 BTaggingWP70_R12N6 221 BTaggingWP90_R12N6 222 BTaggingWP50_R15N2 223 BTaggingWP70_R15N2 224 BTaggingWP90_R15N2 225 BTaggingWP50_R15N3 226 BTaggingWP70_R15N3 227 BTaggingWP90_R15N3 228 BTaggingWP50_R15N4 229 BTaggingWP70_R15N4 230 BTaggingWP90_R15N4 231 BTaggingWP50_R15N5 232 BTaggingWP70_R15N5 233 BTaggingWP90_R15N5 234 BTaggingWP50_R15N6 235 BTaggingWP70_R15N6 236 BTaggingWP90_R15N6 281 237 BTaggingWP50_R05_inclusive 282 238 BTaggingWP70_R05_inclusive … … 295 251 BTaggingWP90_R15_inclusive 296 252 297 298 299 BTagging_JER_WP50_R05N2300 BTagging_JER_WP70_R05N2301 BTagging_JER_WP90_R05N2302 BTagging_JER_WP50_R05N3303 BTagging_JER_WP70_R05N3304 BTagging_JER_WP90_R05N3305 BTagging_JER_WP50_R05N4306 BTagging_JER_WP70_R05N4307 BTagging_JER_WP90_R05N4308 BTagging_JER_WP50_R05N5309 BTagging_JER_WP70_R05N5310 BTagging_JER_WP90_R05N5311 BTagging_JER_WP50_R05N6312 BTagging_JER_WP70_R05N6313 BTagging_JER_WP90_R05N6314 BTagging_JER_WP50_R07N2315 BTagging_JER_WP70_R07N2316 BTagging_JER_WP90_R07N2317 BTagging_JER_WP50_R07N3318 BTagging_JER_WP70_R07N3319 BTagging_JER_WP90_R07N3320 BTagging_JER_WP50_R07N4321 BTagging_JER_WP70_R07N4322 BTagging_JER_WP90_R07N4323 BTagging_JER_WP50_R07N5324 BTagging_JER_WP70_R07N5325 BTagging_JER_WP90_R07N5326 BTagging_JER_WP50_R07N6327 BTagging_JER_WP70_R07N6328 BTagging_JER_WP90_R07N6329 BTagging_JER_WP50_R10N2330 BTagging_JER_WP70_R10N2331 BTagging_JER_WP90_R10N2332 BTagging_JER_WP50_R10N3333 BTagging_JER_WP70_R10N3334 BTagging_JER_WP90_R10N3335 BTagging_JER_WP50_R10N4336 BTagging_JER_WP70_R10N4337 BTagging_JER_WP90_R10N4338 BTagging_JER_WP50_R10N5339 BTagging_JER_WP70_R10N5340 BTagging_JER_WP90_R10N5341 BTagging_JER_WP50_R10N6342 BTagging_JER_WP70_R10N6343 BTagging_JER_WP90_R10N6344 BTagging_JER_WP50_R12N2345 BTagging_JER_WP70_R12N2346 BTagging_JER_WP90_R12N2347 BTagging_JER_WP50_R12N3348 BTagging_JER_WP70_R12N3349 BTagging_JER_WP90_R12N3350 BTagging_JER_WP50_R12N4351 BTagging_JER_WP70_R12N4352 BTagging_JER_WP90_R12N4353 BTagging_JER_WP50_R12N5354 BTagging_JER_WP70_R12N5355 BTagging_JER_WP90_R12N5356 BTagging_JER_WP50_R12N6357 BTagging_JER_WP70_R12N6358 BTagging_JER_WP90_R12N6359 BTagging_JER_WP50_R15N2360 BTagging_JER_WP70_R15N2361 BTagging_JER_WP90_R15N2362 BTagging_JER_WP50_R15N3363 BTagging_JER_WP70_R15N3364 BTagging_JER_WP90_R15N3365 BTagging_JER_WP50_R15N4366 BTagging_JER_WP70_R15N4367 BTagging_JER_WP90_R15N4368 BTagging_JER_WP50_R15N5369 BTagging_JER_WP70_R15N5370 BTagging_JER_WP90_R15N5371 BTagging_JER_WP50_R15N6372 BTagging_JER_WP70_R15N6373 BTagging_JER_WP90_R15N6374 BTagging_JER_WP50_R05_inclusive375 BTagging_JER_WP70_R05_inclusive376 BTagging_JER_WP90_R05_inclusive377 BTagging_JER_WP50_R07_inclusive378 BTagging_JER_WP70_R07_inclusive379 BTagging_JER_WP90_R07_inclusive380 BTagging_JER_WP50_R10_inclusive381 BTagging_JER_WP70_R10_inclusive382 BTagging_JER_WP90_R10_inclusive383 BTagging_JER_WP50_R12_inclusive384 BTagging_JER_WP70_R12_inclusive385 BTagging_JER_WP90_R12_inclusive386 BTagging_JER_WP50_R15_inclusive387 BTagging_JER_WP70_R15_inclusive388 BTagging_JER_WP90_R15_inclusive389 390 253 391 254 TauTagging_R05N2 … … 414 277 TauTagging_R15N5 415 278 TauTagging_R15N6 279 416 280 TauTagging_R05_inclusive 417 281 TauTagging_R07_inclusive … … 419 283 TauTagging_R12_inclusive 420 284 TauTagging_R15_inclusive 421 422 TauTagging_JER_R05N2423 TauTagging_JER_R05N3424 TauTagging_JER_R05N4425 TauTagging_JER_R05N5426 TauTagging_JER_R05N6427 TauTagging_JER_R07N2428 TauTagging_JER_R07N3429 TauTagging_JER_R07N4430 TauTagging_JER_R07N5431 TauTagging_JER_R07N6432 TauTagging_JER_R10N2433 TauTagging_JER_R10N3434 TauTagging_JER_R10N4435 TauTagging_JER_R10N5436 TauTagging_JER_R10N6437 TauTagging_JER_R12N2438 TauTagging_JER_R12N3439 TauTagging_JER_R12N4440 TauTagging_JER_R12N5441 TauTagging_JER_R12N6442 TauTagging_JER_R15N2443 TauTagging_JER_R15N3444 TauTagging_JER_R15N4445 TauTagging_JER_R15N5446 TauTagging_JER_R15N6447 TauTagging_JER_R05_inclusive448 TauTagging_JER_R07_inclusive449 TauTagging_JER_R10_inclusive450 TauTagging_JER_R12_inclusive451 TauTagging_JER_R15_inclusive452 285 453 286 … … 906 739 set OutputArray photons 907 740 908 set DeltaRMax 0. 1741 set DeltaRMax 0.5 909 742 910 743 set PTMin 0.5 911 744 912 set PTRatioMax 0. 2745 set PTRatioMax 0.12 913 746 } 914 747 … … 1004 837 set OutputArray electrons 1005 838 1006 set DeltaRMax 0. 1839 set DeltaRMax 0.5 1007 840 1008 841 set PTMin 0.5 1009 842 1010 set PTRatioMax 0. 2843 set PTRatioMax 0.12 1011 844 } 1012 845 … … 1042 875 set OutputArray muons 1043 876 1044 set DeltaRMax 0. 1877 set DeltaRMax 0.5 1045 878 1046 879 set PTMin 0.5 1047 880 1048 set PTRatioMax 0.2 881 set PTRatioMax 0.25 1049 882 } 1050 883 … … 1167 1000 1168 1001 source CLIC/CLICdet_JetFlavorAssociation.tcl 1169 source CLIC/CLICdet_JetFlavorAssociation_JER.tcl1170 1002 1171 1003 ########### … … 1175 1007 1176 1008 source CLIC/CLICdet_BTagging.tcl 1177 source CLIC/CLICdet_BTagging_JER.tcl1178 1009 1179 1010 … … 1184 1015 1185 1016 source CLIC/CLICdet_TauTagging.tcl 1186 source CLIC/CLICdet_TauTagging_JER.tcl1187 1017 1188 1018 -
cards/delphes_card_CLICdet_Stage3.tcl
r0e7d64a re39abb4 1 1 ####################################### 2 2 # CLICdet model 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 3 # based on CLICdp-Note-2017-001 6 4 # Ulrike Schnoor ulrike.schnoor@cern.ch 5 # 7 6 # 8 7 # For the high energy stage of … … 12 11 # use exclusive clustering with njets 13 12 # according to final state 14 # 15 # c-tagging capabilities of CLICdet are 16 # not yet implemented here. Please 17 # contact us if you want to use it. 18 ####################################### 19 13 # 20 14 ####################################### 21 15 # Order of execution of various modules … … 131 125 132 126 JetFlavorAssociation_R05N2 133 JetFlavorAssociation_R05N3 134 JetFlavorAssociation_R05N4 135 JetFlavorAssociation_R05N5 136 JetFlavorAssociation_R05N6 137 138 JetFlavorAssociation_R07N2 139 JetFlavorAssociation_R07N3 140 JetFlavorAssociation_R07N4 141 JetFlavorAssociation_R07N5 142 JetFlavorAssociation_R07N6 143 144 JetFlavorAssociation_R10N2 145 JetFlavorAssociation_R10N3 146 JetFlavorAssociation_R10N4 147 JetFlavorAssociation_R10N5 148 JetFlavorAssociation_R10N6 149 150 JetFlavorAssociation_R12N2 151 JetFlavorAssociation_R12N3 152 JetFlavorAssociation_R12N4 153 JetFlavorAssociation_R12N5 154 JetFlavorAssociation_R12N6 155 156 JetFlavorAssociation_R15N2 157 JetFlavorAssociation_R15N3 158 JetFlavorAssociation_R15N4 159 JetFlavorAssociation_R15N5 160 JetFlavorAssociation_R15N6 161 162 JetFlavorAssociation_R05_inclusive 163 JetFlavorAssociation_R07_inclusive 164 JetFlavorAssociation_R10_inclusive 165 JetFlavorAssociation_R12_inclusive 166 JetFlavorAssociation_R15_inclusive 167 168 JetFlavorAssociation_JER_R05N2 169 JetFlavorAssociation_JER_R05N3 170 JetFlavorAssociation_JER_R05N4 171 JetFlavorAssociation_JER_R05N5 172 JetFlavorAssociation_JER_R05N6 173 174 JetFlavorAssociation_JER_R07N2 175 JetFlavorAssociation_JER_R07N3 176 JetFlavorAssociation_JER_R07N4 177 JetFlavorAssociation_JER_R07N5 178 JetFlavorAssociation_JER_R07N6 179 180 JetFlavorAssociation_JER_R10N2 181 JetFlavorAssociation_JER_R10N3 182 JetFlavorAssociation_JER_R10N4 183 JetFlavorAssociation_JER_R10N5 184 JetFlavorAssociation_JER_R10N6 185 186 JetFlavorAssociation_JER_R12N2 187 JetFlavorAssociation_JER_R12N3 188 JetFlavorAssociation_JER_R12N4 189 JetFlavorAssociation_JER_R12N5 190 JetFlavorAssociation_JER_R12N6 191 192 JetFlavorAssociation_JER_R15N2 193 JetFlavorAssociation_JER_R15N3 194 JetFlavorAssociation_JER_R15N4 195 JetFlavorAssociation_JER_R15N5 196 JetFlavorAssociation_JER_R15N6 197 198 JetFlavorAssociation_JER_R05_inclusive 199 JetFlavorAssociation_JER_R07_inclusive 200 JetFlavorAssociation_JER_R10_inclusive 201 JetFlavorAssociation_JER_R12_inclusive 202 JetFlavorAssociation_JER_R15_inclusive 203 204 BTaggingWP50_R05N2 205 BTaggingWP70_R05N2 206 BTaggingWP90_R05N2 207 BTaggingWP50_R05N3 208 BTaggingWP70_R05N3 209 BTaggingWP90_R05N3 210 BTaggingWP50_R05N4 211 BTaggingWP70_R05N4 212 BTaggingWP90_R05N4 213 BTaggingWP50_R05N5 214 BTaggingWP70_R05N5 215 BTaggingWP90_R05N5 216 BTaggingWP50_R05N6 217 BTaggingWP70_R05N6 218 BTaggingWP90_R05N6 219 BTaggingWP50_R07N2 220 BTaggingWP70_R07N2 221 BTaggingWP90_R07N2 222 BTaggingWP50_R07N3 223 BTaggingWP70_R07N3 224 BTaggingWP90_R07N3 225 BTaggingWP50_R07N4 226 BTaggingWP70_R07N4 227 BTaggingWP90_R07N4 228 BTaggingWP50_R07N5 229 BTaggingWP70_R07N5 230 BTaggingWP90_R07N5 231 BTaggingWP50_R07N6 232 BTaggingWP70_R07N6 233 BTaggingWP90_R07N6 234 BTaggingWP50_R10N2 235 BTaggingWP70_R10N2 236 BTaggingWP90_R10N2 237 BTaggingWP50_R10N3 238 BTaggingWP70_R10N3 239 BTaggingWP90_R10N3 240 BTaggingWP50_R10N4 241 BTaggingWP70_R10N4 242 BTaggingWP90_R10N4 243 BTaggingWP50_R10N5 244 BTaggingWP70_R10N5 245 BTaggingWP90_R10N5 246 BTaggingWP50_R10N6 247 BTaggingWP70_R10N6 248 BTaggingWP90_R10N6 249 BTaggingWP50_R12N2 250 BTaggingWP70_R12N2 251 BTaggingWP90_R12N2 252 BTaggingWP50_R12N3 253 BTaggingWP70_R12N3 254 BTaggingWP90_R12N3 255 BTaggingWP50_R12N4 256 BTaggingWP70_R12N4 257 BTaggingWP90_R12N4 258 BTaggingWP50_R12N5 259 BTaggingWP70_R12N5 260 BTaggingWP90_R12N5 261 BTaggingWP50_R12N6 262 BTaggingWP70_R12N6 263 BTaggingWP90_R12N6 264 BTaggingWP50_R15N2 265 BTaggingWP70_R15N2 266 BTaggingWP90_R15N2 267 BTaggingWP50_R15N3 268 BTaggingWP70_R15N3 269 BTaggingWP90_R15N3 270 BTaggingWP50_R15N4 271 BTaggingWP70_R15N4 272 BTaggingWP90_R15N4 273 BTaggingWP50_R15N5 274 BTaggingWP70_R15N5 275 BTaggingWP90_R15N5 276 BTaggingWP50_R15N6 277 BTaggingWP70_R15N6 278 BTaggingWP90_R15N6 127 JetFlavorAssociation_R05N3 128 JetFlavorAssociation_R05N4 129 JetFlavorAssociation_R05N5 130 JetFlavorAssociation_R05N6 131 132 JetFlavorAssociation_R07N2 133 JetFlavorAssociation_R07N3 134 JetFlavorAssociation_R07N4 135 JetFlavorAssociation_R07N5 136 JetFlavorAssociation_R07N6 137 138 JetFlavorAssociation_R10N2 139 JetFlavorAssociation_R10N3 140 JetFlavorAssociation_R10N4 141 JetFlavorAssociation_R10N5 142 JetFlavorAssociation_R10N6 143 144 JetFlavorAssociation_R12N2 145 JetFlavorAssociation_R12N3 146 JetFlavorAssociation_R12N4 147 JetFlavorAssociation_R12N5 148 JetFlavorAssociation_R12N6 149 150 JetFlavorAssociation_R15N2 151 JetFlavorAssociation_R15N3 152 JetFlavorAssociation_R15N4 153 JetFlavorAssociation_R15N5 154 JetFlavorAssociation_R15N6 155 156 JetFlavorAssociation_R05_inclusive 157 JetFlavorAssociation_R07_inclusive 158 JetFlavorAssociation_R10_inclusive 159 JetFlavorAssociation_R12_inclusive 160 JetFlavorAssociation_R15_inclusive 161 162 163 BTaggingWP50_R05N2 164 BTaggingWP70_R05N2 165 BTaggingWP90_R05N2 166 BTaggingWP50_R05N3 167 BTaggingWP70_R05N3 168 BTaggingWP90_R05N3 169 BTaggingWP50_R05N4 170 BTaggingWP70_R05N4 171 BTaggingWP90_R05N4 172 BTaggingWP50_R05N5 173 BTaggingWP70_R05N5 174 BTaggingWP90_R05N5 175 BTaggingWP50_R05N6 176 BTaggingWP70_R05N6 177 BTaggingWP90_R05N6 178 BTaggingWP50_R07N2 179 BTaggingWP70_R07N2 180 BTaggingWP90_R07N2 181 BTaggingWP50_R07N3 182 BTaggingWP70_R07N3 183 BTaggingWP90_R07N3 184 BTaggingWP50_R07N4 185 BTaggingWP70_R07N4 186 BTaggingWP90_R07N4 187 BTaggingWP50_R07N5 188 BTaggingWP70_R07N5 189 BTaggingWP90_R07N5 190 BTaggingWP50_R07N6 191 BTaggingWP70_R07N6 192 BTaggingWP90_R07N6 193 BTaggingWP50_R10N2 194 BTaggingWP70_R10N2 195 BTaggingWP90_R10N2 196 BTaggingWP50_R10N3 197 BTaggingWP70_R10N3 198 BTaggingWP90_R10N3 199 BTaggingWP50_R10N4 200 BTaggingWP70_R10N4 201 BTaggingWP90_R10N4 202 BTaggingWP50_R10N5 203 BTaggingWP70_R10N5 204 BTaggingWP90_R10N5 205 BTaggingWP50_R10N6 206 BTaggingWP70_R10N6 207 BTaggingWP90_R10N6 208 BTaggingWP50_R12N2 209 BTaggingWP70_R12N2 210 BTaggingWP90_R12N2 211 BTaggingWP50_R12N3 212 BTaggingWP70_R12N3 213 BTaggingWP90_R12N3 214 BTaggingWP50_R12N4 215 BTaggingWP70_R12N4 216 BTaggingWP90_R12N4 217 BTaggingWP50_R12N5 218 BTaggingWP70_R12N5 219 BTaggingWP90_R12N5 220 BTaggingWP50_R12N6 221 BTaggingWP70_R12N6 222 BTaggingWP90_R12N6 223 BTaggingWP50_R15N2 224 BTaggingWP70_R15N2 225 BTaggingWP90_R15N2 226 BTaggingWP50_R15N3 227 BTaggingWP70_R15N3 228 BTaggingWP90_R15N3 229 BTaggingWP50_R15N4 230 BTaggingWP70_R15N4 231 BTaggingWP90_R15N4 232 BTaggingWP50_R15N5 233 BTaggingWP70_R15N5 234 BTaggingWP90_R15N5 235 BTaggingWP50_R15N6 236 BTaggingWP70_R15N6 237 BTaggingWP90_R15N6 279 238 BTaggingWP50_R05_inclusive 280 239 BTaggingWP70_R05_inclusive … … 293 252 BTaggingWP90_R15_inclusive 294 253 295 BTagging_JER_WP50_R05N2 296 BTagging_JER_WP70_R05N2 297 BTagging_JER_WP90_R05N2 298 BTagging_JER_WP50_R05N3 299 BTagging_JER_WP70_R05N3 300 BTagging_JER_WP90_R05N3 301 BTagging_JER_WP50_R05N4 302 BTagging_JER_WP70_R05N4 303 BTagging_JER_WP90_R05N4 304 BTagging_JER_WP50_R05N5 305 BTagging_JER_WP70_R05N5 306 BTagging_JER_WP90_R05N5 307 BTagging_JER_WP50_R05N6 308 BTagging_JER_WP70_R05N6 309 BTagging_JER_WP90_R05N6 310 BTagging_JER_WP50_R07N2 311 BTagging_JER_WP70_R07N2 312 BTagging_JER_WP90_R07N2 313 BTagging_JER_WP50_R07N3 314 BTagging_JER_WP70_R07N3 315 BTagging_JER_WP90_R07N3 316 BTagging_JER_WP50_R07N4 317 BTagging_JER_WP70_R07N4 318 BTagging_JER_WP90_R07N4 319 BTagging_JER_WP50_R07N5 320 BTagging_JER_WP70_R07N5 321 BTagging_JER_WP90_R07N5 322 BTagging_JER_WP50_R07N6 323 BTagging_JER_WP70_R07N6 324 BTagging_JER_WP90_R07N6 325 BTagging_JER_WP50_R10N2 326 BTagging_JER_WP70_R10N2 327 BTagging_JER_WP90_R10N2 328 BTagging_JER_WP50_R10N3 329 BTagging_JER_WP70_R10N3 330 BTagging_JER_WP90_R10N3 331 BTagging_JER_WP50_R10N4 332 BTagging_JER_WP70_R10N4 333 BTagging_JER_WP90_R10N4 334 BTagging_JER_WP50_R10N5 335 BTagging_JER_WP70_R10N5 336 BTagging_JER_WP90_R10N5 337 BTagging_JER_WP50_R10N6 338 BTagging_JER_WP70_R10N6 339 BTagging_JER_WP90_R10N6 340 BTagging_JER_WP50_R12N2 341 BTagging_JER_WP70_R12N2 342 BTagging_JER_WP90_R12N2 343 BTagging_JER_WP50_R12N3 344 BTagging_JER_WP70_R12N3 345 BTagging_JER_WP90_R12N3 346 BTagging_JER_WP50_R12N4 347 BTagging_JER_WP70_R12N4 348 BTagging_JER_WP90_R12N4 349 BTagging_JER_WP50_R12N5 350 BTagging_JER_WP70_R12N5 351 BTagging_JER_WP90_R12N5 352 BTagging_JER_WP50_R12N6 353 BTagging_JER_WP70_R12N6 354 BTagging_JER_WP90_R12N6 355 BTagging_JER_WP50_R15N2 356 BTagging_JER_WP70_R15N2 357 BTagging_JER_WP90_R15N2 358 BTagging_JER_WP50_R15N3 359 BTagging_JER_WP70_R15N3 360 BTagging_JER_WP90_R15N3 361 BTagging_JER_WP50_R15N4 362 BTagging_JER_WP70_R15N4 363 BTagging_JER_WP90_R15N4 364 BTagging_JER_WP50_R15N5 365 BTagging_JER_WP70_R15N5 366 BTagging_JER_WP90_R15N5 367 BTagging_JER_WP50_R15N6 368 BTagging_JER_WP70_R15N6 369 BTagging_JER_WP90_R15N6 370 BTagging_JER_WP50_R05_inclusive 371 BTagging_JER_WP70_R05_inclusive 372 BTagging_JER_WP90_R05_inclusive 373 BTagging_JER_WP50_R07_inclusive 374 BTagging_JER_WP70_R07_inclusive 375 BTagging_JER_WP90_R07_inclusive 376 BTagging_JER_WP50_R10_inclusive 377 BTagging_JER_WP70_R10_inclusive 378 BTagging_JER_WP90_R10_inclusive 379 BTagging_JER_WP50_R12_inclusive 380 BTagging_JER_WP70_R12_inclusive 381 BTagging_JER_WP90_R12_inclusive 382 BTagging_JER_WP50_R15_inclusive 383 BTagging_JER_WP70_R15_inclusive 384 BTagging_JER_WP90_R15_inclusive 385 254 386 255 TauTagging_R05N2 387 256 TauTagging_R05N3 … … 409 278 TauTagging_R15N5 410 279 TauTagging_R15N6 280 411 281 TauTagging_R05_inclusive 412 282 TauTagging_R07_inclusive … … 415 285 TauTagging_R15_inclusive 416 286 417 TauTagging_JER_R05N2418 TauTagging_JER_R05N3419 TauTagging_JER_R05N4420 TauTagging_JER_R05N5421 TauTagging_JER_R05N6422 TauTagging_JER_R07N2423 TauTagging_JER_R07N3424 TauTagging_JER_R07N4425 TauTagging_JER_R07N5426 TauTagging_JER_R07N6427 TauTagging_JER_R10N2428 TauTagging_JER_R10N3429 TauTagging_JER_R10N4430 TauTagging_JER_R10N5431 TauTagging_JER_R10N6432 TauTagging_JER_R12N2433 TauTagging_JER_R12N3434 TauTagging_JER_R12N4435 TauTagging_JER_R12N5436 TauTagging_JER_R12N6437 TauTagging_JER_R15N2438 TauTagging_JER_R15N3439 TauTagging_JER_R15N4440 TauTagging_JER_R15N5441 TauTagging_JER_R15N6442 TauTagging_JER_R05_inclusive443 TauTagging_JER_R07_inclusive444 TauTagging_JER_R10_inclusive445 TauTagging_JER_R12_inclusive446 TauTagging_JER_R15_inclusive447 287 448 288 … … 890 730 } 891 731 892 893 732 ################## 894 733 # Photon isolation … … 901 740 set OutputArray photons 902 741 903 set DeltaRMax 0. 1742 set DeltaRMax 0.5 904 743 905 744 set PTMin 0.5 906 745 907 set PTRatioMax 0.2 908 } 909 746 set PTRatioMax 0.12 747 } 910 748 911 749 ##################### … … 1000 838 set OutputArray electrons 1001 839 1002 set DeltaRMax 0. 1840 set DeltaRMax 0.5 1003 841 1004 842 set PTMin 0.5 1005 843 1006 set PTRatioMax 0. 2844 set PTRatioMax 0.12 1007 845 } 1008 846 … … 1038 876 set OutputArray muons 1039 877 1040 set DeltaRMax 0. 1878 set DeltaRMax 0.5 1041 879 1042 880 set PTMin 0.5 1043 881 1044 set PTRatioMax 0.2 882 set PTRatioMax 0.25 1045 883 } 1046 884 … … 1165 1003 1166 1004 source CLIC/CLICdet_JetFlavorAssociation.tcl 1167 source CLIC/CLICdet_JetFlavorAssociation_JER.tcl1168 1005 1169 1006 ########### … … 1173 1010 1174 1011 source CLIC/CLICdet_BTagging.tcl 1175 source CLIC/CLICdet_BTagging_JER.tcl1176 1012 1177 1013 … … 1182 1018 1183 1019 source CLIC/CLICdet_TauTagging.tcl 1184 source CLIC/CLICdet_TauTagging_JER.tcl1185 1020 1186 1021 -
classes/DelphesClasses.cc
r0e7d64a re39abb4 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 19 20 /** … … 121 122 Charge(0), Mass(0.0), 122 123 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0), 124 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0), 123 125 Flavor(0), FlavorAlgo(0), FlavorPhys(0), 124 126 BTag(0), BTagAlgo(0), BTagPhys(0), … … 127 129 Momentum(0.0, 0.0, 0.0, 0.0), 128 130 Position(0.0, 0.0, 0.0, 0.0), 131 PositionError(0.0, 0.0, 0.0, 0.0), 129 132 InitialPosition(0.0, 0.0, 0.0, 0.0), 130 PositionError(0.0, 0.0, 0.0, 0.0),131 133 Area(0.0, 0.0, 0.0, 0.0), 132 134 L(0), 133 D0(0), ErrorD0(0), 134 DZ(0), ErrorDZ(0), 135 P(0), ErrorP(0),136 PT(0), ErrorPT(0), 137 CtgTheta(0), ErrorCtgTheta(0), 138 Phi(0), ErrorPhi(0), 139 Xd(0), Yd(0), Zd(0), 135 D0(0), ErrorD0(0), 136 DZ(0), ErrorDZ(0), 137 P(0), ErrorP(0), 138 PT(0), ErrorPT(0), 139 CtgTheta(0), ErrorCtgTheta(0), 140 Phi(0), ErrorPhi(0), 141 Xd(0), Yd(0), Zd(0), 140 142 TrackResolution(0), 141 143 NCharged(0), … … 152 154 SumPtChargedPU(-999), 153 155 SumPt(-999), 154 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),155 156 NSubJetsTrimmed(0), 156 157 NSubJetsPruned(0), … … 235 236 return kFALSE; 236 237 } 238 237 239 238 240 //------------------------------------------------------------------------------ … … 302 304 object.PT = PT; 303 305 object.ErrorPT = ErrorPT; 304 object.CtgTheta = CtgTheta ;306 object.CtgTheta = CtgTheta ; 305 307 object.ErrorCtgTheta = ErrorCtgTheta; 306 308 object.Phi = Phi; 307 object.ErrorPhi = ErrorPhi; 309 object.ErrorPhi = ErrorPhi; 308 310 object.Xd = Xd; 309 311 object.Yd = Yd; … … 325 327 object.ClusterIndex = ClusterIndex; 326 328 object.ClusterNDF = ClusterNDF; 327 object.ClusterSigma = ClusterSigma; 329 object.ClusterSigma = ClusterSigma; 328 330 object.SumPT2 = SumPT2; 329 331 330 332 object.FracPt[0] = FracPt[0]; 331 333 object.FracPt[1] = FracPt[1]; … … 359 361 object.NSubJetsSoftDropped = NSubJetsSoftDropped; 360 362 361 object.SoftDroppedJet = 363 object.SoftDroppedJet =SoftDroppedJet; 362 364 object.SoftDroppedSubJet1 = SoftDroppedSubJet1; 363 365 object.SoftDroppedSubJet2 = SoftDroppedSubJet2; … … 382 384 //------------------------------------------------------------------------------ 383 385 384 void Candidate::Clear(Option_t *option)386 void Candidate::Clear(Option_t* option) 385 387 { 386 388 int i; … … 389 391 PID = 0; 390 392 Status = 0; 391 M1 = -1; 392 M2 = -1; 393 D1 = -1; 394 D2 = -1; 393 M1 = -1; M2 = -1; D1 = -1; D2 = -1; 395 394 Charge = 0; 396 395 Mass = 0.0; … … 421 420 L = 0.0; 422 421 ErrorT = 0.0; 423 D0 = 0.0; 422 D0 = 0.0; 424 423 ErrorD0 = 0.0; 425 424 DZ = 0.0; 426 425 ErrorDZ = 0.0; 427 P = 428 ErrorP = 426 P =0.0; 427 ErrorP =0.0; 429 428 PT = 0.0; 430 429 ErrorPT = 0.0; … … 456 455 ClusterIndex = -1; 457 456 ClusterNDF = -99; 458 ClusterSigma = 0.0; 457 ClusterSigma = 0.0; 459 458 SumPT2 = 0.0; 460 459 BTVSumPT2 = 0.0; 461 460 GenDeltaZ = 0.0; 462 GenSumPT2 = 0.0; 463 461 GenSumPT2 = 0.0; 462 464 463 FracPt[0] = 0.0; 465 464 FracPt[1] = 0.0; … … 477 476 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0); 478 477 478 479 479 for(i = 0; i < 5; ++i) 480 480 { -
classes/DelphesClasses.h
r0e7d64a re39abb4 32 32 // Dependencies (#includes) 33 33 34 #include "TRef.h" 35 #include "TObject.h" 36 #include "TRefArray.h" 34 37 #include "TLorentzVector.h" 35 #include "TObject.h"36 #include "TRef.h"37 #include "TRefArray.h"38 38 39 39 #include "classes/SortableObject.h" … … 46 46 { 47 47 public: 48 48 49 Long64_t Number; // event number 49 50 … … 59 60 { 60 61 public: 62 61 63 Int_t Trigger; // trigger word 62 64 … … 69 71 { 70 72 public: 73 71 74 Int_t ProcessID; // subprocess code for the event | hepup.IDPRUP 72 75 … … 77 80 Float_t AlphaQCD; // value of the QCD coupling used in the event | hepup.AQCDUP 78 81 79 ClassDef(LHEFEvent, 3)82 ClassDef(LHEFEvent, 2) 80 83 }; 81 84 … … 96 99 { 97 100 public: 101 98 102 Int_t ProcessID; // unique signal process id | signal_process_id() 99 103 Int_t MPI; // number of multi parton interactions | mpi () … … 118 122 Float_t PDF2; // PDF (id2, x2, Q) | pdf_info()->pdf2() 119 123 120 ClassDef(HepMCEvent, 3) 124 125 126 ClassDef(HepMCEvent, 2) 121 127 }; 122 128 … … 175 181 { 176 182 public: 183 177 184 Float_t T; // vertex position (t component) 178 185 Float_t X; // vertex position (x component) … … 253 260 { 254 261 public: 262 255 263 Float_t PT; // photon transverse momentum 256 264 Float_t Eta; // photon pseudorapidity … … 279 287 TLorentzVector P4() const; 280 288 281 ClassDef(Photon, 4)289 ClassDef(Photon, 3) 282 290 }; 283 291 … … 287 295 { 288 296 public: 297 289 298 Float_t PT; // electron transverse momentum 290 299 Float_t Eta; // electron pseudorapidity … … 306 315 Float_t SumPt; // isolation variable 307 316 308 Float_t D0; // track transverse impact parameter 309 Float_t DZ; // track longitudinal impact parameter 310 Float_t ErrorD0; // track transverse impact parameter error 311 Float_t ErrorDZ; // track longitudinal impact parameter error 312 313 static CompBase *fgCompare; //! 314 const CompBase *GetCompare() const { return fgCompare; } 315 316 TLorentzVector P4() const; 317 318 ClassDef(Electron, 4) 317 static CompBase *fgCompare; //! 318 const CompBase *GetCompare() const { return fgCompare; } 319 320 TLorentzVector P4() const; 321 322 ClassDef(Electron, 3) 319 323 }; 320 324 … … 324 328 { 325 329 public: 330 326 331 Float_t PT; // muon transverse momentum 327 332 Float_t Eta; // muon pseudorapidity … … 341 346 Float_t SumPt; // isolation variable 342 347 343 Float_t D0; // track transverse impact parameter 344 Float_t DZ; // track longitudinal impact parameter 345 Float_t ErrorD0; // track transverse impact parameter error 346 Float_t ErrorDZ; // track longitudinal impact parameter error 347 348 static CompBase *fgCompare; //! 349 const CompBase *GetCompare() const { return fgCompare; } 350 351 TLorentzVector P4() const; 352 353 ClassDef(Muon, 4) 348 static CompBase *fgCompare; //! 349 const CompBase *GetCompare() const { return fgCompare; } 350 351 TLorentzVector P4() const; 352 353 ClassDef(Muon, 3) 354 354 }; 355 355 … … 359 359 { 360 360 public: 361 361 362 Float_t PT; // jet transverse momentum 362 363 Float_t Eta; // jet pseudorapidity … … 367 368 Float_t Mass; // jet invariant mass 368 369 369 Float_t DeltaEta; // jet radius in pseudorapidity370 Float_t DeltaPhi; // jet radius in azimuthal angle370 Float_t DeltaEta; // jet radius in pseudorapidity 371 Float_t DeltaPhi; // jet radius in azimuthal angle 371 372 372 373 UInt_t Flavor; // jet flavor … … 403 404 TLorentzVector SoftDroppedP4[5]; // first entry (i = 0) is the total SoftDropped Jet 4-momenta and from i = 1 to 4 are the pruned subjets 4-momenta 404 405 406 405 407 Int_t NSubJetsTrimmed; // number of subjets trimmed 406 408 Int_t NSubJetsPruned; // number of subjets pruned … … 411 413 Double_t ExclYmerge45; 412 414 Double_t ExclYmerge56; 413 415 414 416 TRefArray Constituents; // references to constituents 415 417 TRefArray Particles; // references to generated particles … … 421 423 TLorentzVector Area; 422 424 423 ClassDef(Jet, 4)425 ClassDef(Jet, 3) 424 426 }; 425 427 … … 614 616 615 617 Int_t NTimeHits; 616 std::vector< std::pair<Float_t, Float_t> > ECalEnergyTimePairs;618 std::vector< std::pair< Float_t, Float_t > > ECalEnergyTimePairs; 617 619 618 620 // Isolation variables … … 658 660 Double_t ExclYmerge45; 659 661 Double_t ExclYmerge56; 660 662 661 663 static CompBase *fgCompare; //! 662 664 const CompBase *GetCompare() const { return fgCompare; } … … 669 671 virtual void Copy(TObject &object) const; 670 672 virtual TObject *Clone(const char *newname = "") const; 671 virtual void Clear(Option_t *option = "");673 virtual void Clear(Option_t* option = ""); 672 674 673 675 private: … … 677 679 void SetFactory(DelphesFactory *factory) { fFactory = factory; } 678 680 679 ClassDef(Candidate, 6)681 ClassDef(Candidate, 5) 680 682 }; 681 683 682 684 #endif // DelphesClasses_h 685 686 -
classes/DelphesCylindricalFormula.cc
r0e7d64a re39abb4 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 19 20 #include "classes/DelphesCylindricalFormula.h" … … 53 54 for(it = expression; *it; ++it) 54 55 { 55 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 56 57 buffer.Append(*it); 57 58 } -
classes/DelphesCylindricalFormula.h
r0e7d64a re39abb4 25 25 { 26 26 public: 27 27 28 DelphesCylindricalFormula(); 28 29 … … 37 38 38 39 #endif /* DelphesCylindricalFormula_h */ 40 -
classes/DelphesFactory.cc
r0e7d64a re39abb4 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 19 20 /** \class DelphesFactory … … 50 51 if(fObjArrays) delete fObjArrays; 51 52 52 map< const TClass *, ExRootTreeBranch *>::iterator itBranches;53 map< const TClass*, ExRootTreeBranch* >::iterator itBranches; 53 54 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 54 55 { 55 delete (itBranches->second);56 delete (itBranches->second); 56 57 } 57 58 } … … 59 60 //------------------------------------------------------------------------------ 60 61 61 void DelphesFactory::Clear(Option_t *option)62 void DelphesFactory::Clear(Option_t* option) 62 63 { 63 64 set<TObject *>::iterator itPool; … … 69 70 TProcessID::SetObjectCount(0); 70 71 71 map< const TClass *, ExRootTreeBranch *>::iterator itBranches;72 map< const TClass*, ExRootTreeBranch* >::iterator itBranches; 72 73 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 73 74 { … … 119 120 120 121 //------------------------------------------------------------------------------ 122 -
classes/DelphesFactory.h
r0e7d64a re39abb4 42 42 { 43 43 public: 44 44 45 DelphesFactory(const char *name = "ObjectFactory"); 45 46 ~DelphesFactory(); 46 47 47 virtual void Clear(Option_t *option = "");48 48 virtual void Clear(Option_t* option = ""); 49 49 50 TObjArray *NewPermanentArray(); 50 51 … … 55 56 TObject *New(TClass *cl); 56 57 57 template 58 template<typename T> 58 59 T *New() { return static_cast<T *>(New(T::Class())); } 59 60 60 61 private: 62 61 63 ExRootTreeBranch *fObjArrays; //! 62 64 63 65 #if !defined(__CINT__) && !defined(__CLING__) 64 std::map< const TClass *, ExRootTreeBranch *> fBranches; //!66 std::map< const TClass*, ExRootTreeBranch* > fBranches; //! 65 67 #endif 66 68 67 std::set< TObject *> fPool; //!68 69 std::set< TObject* > fPool; //! 70 69 71 ClassDef(DelphesFactory, 1) 70 72 }; 71 73 72 74 #endif /* DelphesFactory */ 75 -
classes/DelphesFormula.cc
r0e7d64a re39abb4 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 19 20 #include "classes/DelphesFormula.h" … … 53 54 for(it = expression; *it; ++it) 54 55 { 55 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 56 57 buffer.Append(*it); 57 58 } … … 60 61 buffer.ReplaceAll("phi", "z"); 61 62 buffer.ReplaceAll("energy", "t"); 62 buffer.ReplaceAll("d0", "[0]");63 buffer.ReplaceAll("dz", "[1]");64 buffer.ReplaceAll("ctgTheta", "[2]");65 63 66 #if ROOT_VERSION_CODE < ROOT_VERSION(6, 3, 0)67 TFormula::SetMaxima(100000, 1000, 1000000);68 #endif69 64 65 66 #if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) 67 TFormula::SetMaxima(100000,1000,1000000); 68 #endif 69 70 70 if(TFormula::Compile(buffer) != 0) 71 71 { … … 77 77 //------------------------------------------------------------------------------ 78 78 79 Double_t DelphesFormula::Eval(Double_t pt, Double_t eta, Double_t phi, 80 Double_t energy, Double_t d0, Double_t dz, 81 Double_t ctgTheta) 79 Double_t DelphesFormula::Eval(Double_t pt, Double_t eta, Double_t phi, Double_t energy) 82 80 { 83 Double_t x[4] = {pt, eta, phi, energy}; 84 Double_t params[3] = {d0, dz, ctgTheta}; 85 return EvalPar(x, params); 81 Double_t x[4] = {pt, eta, phi, energy}; 82 return EvalPar(x); 86 83 } 87 84 -
classes/DelphesFormula.h
r0e7d64a re39abb4 25 25 { 26 26 public: 27 27 28 DelphesFormula(); 28 29 … … 33 34 Int_t Compile(const char *expression); 34 35 35 Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0, 36 Double_t energy = 0, Double_t d0 = 0, Double_t dz = 0, 37 Double_t ctgTheta = 0); 36 Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0, Double_t energy = 0); 38 37 }; 39 38 40 39 #endif /* DelphesFormula_h */ 40 -
classes/DelphesHepMCReader.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesHepMCReader 20 21 * … … 27 28 #include "classes/DelphesHepMCReader.h" 28 29 30 #include <stdexcept> 29 31 #include <iostream> 30 32 #include <sstream> 31 #include <stdexcept>32 33 33 34 #include <map> … … 36 37 #include <stdio.h> 37 38 39 #include "TObjArray.h" 40 #include "TStopwatch.h" 38 41 #include "TDatabasePDG.h" 42 #include "TParticlePDG.h" 39 43 #include "TLorentzVector.h" 40 #include "TObjArray.h"41 #include "TParticlePDG.h"42 #include "TStopwatch.h"43 44 44 45 #include "classes/DelphesClasses.h" … … 110 111 TObjArray *partonOutputArray) 111 112 { 112 map< int, pair<int, int> >::iterator itMotherMap;113 map< int, pair<int, int> >::iterator itDaughterMap;113 map< int, pair< int, int > >::iterator itMotherMap; 114 map< int, pair< int, int > >::iterator itDaughterMap; 114 115 char key, momentumUnit[4], positionUnit[3]; 115 116 int i, rc, state; … … 140 141 if(!rc) 141 142 { 142 cerr << "** ERROR: " 143 << "invalid event format" << endl; 143 cerr << "** ERROR: " << "invalid event format" << endl; 144 144 return kFALSE; 145 145 } … … 155 155 if(!rc) 156 156 { 157 cerr << "** ERROR: " 158 << "invalid event format" << endl; 157 cerr << "** ERROR: " << "invalid event format" << endl; 159 158 return kFALSE; 160 159 } … … 168 167 if(!rc) 169 168 { 170 cerr << "** ERROR: " 171 << "invalid event format" << endl; 169 cerr << "** ERROR: " << "invalid event format" << endl; 172 170 return kFALSE; 173 171 } … … 179 177 if(rc != 2) 180 178 { 181 cerr << "** ERROR: " 182 << "invalid units format" << endl; 179 cerr << "** ERROR: " << "invalid units format" << endl; 183 180 return kFALSE; 184 181 } … … 192 189 fMomentumCoefficient = 0.001; 193 190 } 194 191 195 192 if(strncmp(positionUnit, "MM", 3) == 0) 196 193 { … … 202 199 } 203 200 } 204 201 205 202 else if(key == 'C') 206 203 { … … 208 205 && bufferStream.ReadDbl(fCrossSectionError); 209 206 } 210 207 211 208 else if(key == 'F') 212 209 { … … 221 218 if(!rc) 222 219 { 223 cerr << "** ERROR: " 224 << "invalid PDF format" << endl; 220 cerr << "** ERROR: " << "invalid PDF format" << endl; 225 221 return kFALSE; 226 222 } … … 239 235 if(!rc) 240 236 { 241 cerr << "** ERROR: " 242 << "invalid vertex format" << endl; 237 cerr << "** ERROR: " << "invalid vertex format" << endl; 243 238 return kFALSE; 244 239 } … … 261 256 if(!rc) 262 257 { 263 cerr << "** ERROR: " 264 << "invalid particle format" << endl; 258 cerr << "** ERROR: " << "invalid particle format" << endl; 265 259 return kFALSE; 266 260 } … … 351 345 { 352 346 Weight *element; 353 vector< double>::const_iterator itWeight;347 vector< double >::const_iterator itWeight; 354 348 355 349 for(itWeight = fWeight.begin(); itWeight != fWeight.end(); ++itWeight) … … 380 374 381 375 pdgParticle = fPDG->GetParticle(fPID); 382 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;376 candidate->Charge = pdgParticle ? int(pdgParticle->Charge()/3.0) : -999; 383 377 candidate->Mass = fMass; 384 378 … … 433 427 { 434 428 Candidate *candidate; 435 map< int, pair<int, int> >::iterator itMotherMap;436 map< int, pair<int, int> >::iterator itDaughterMap;429 map< int, pair< int, int > >::iterator itMotherMap; 430 map< int, pair< int, int > >::iterator itDaughterMap; 437 431 int i; 438 432 -
classes/DelphesHepMCReader.h
r0e7d64a re39abb4 42 42 { 43 43 public: 44 44 45 DelphesHepMCReader(); 45 46 ~DelphesHepMCReader(); … … 61 62 62 63 private: 64 63 65 void AnalyzeParticle(DelphesFactory *factory, 64 66 TObjArray *allParticleOutputArray, … … 80 82 81 83 int fStateSize; 82 std::vector< int> fState;84 std::vector< int > fState; 83 85 84 86 int fWeightSize; 85 std::vector< double> fWeight;87 std::vector< double > fWeight; 86 88 87 89 double fCrossSection, fCrossSectionError; … … 98 100 int fParticleCounter; 99 101 100 std::map< int, std::pair<int, int> > fMotherMap;101 std::map< int, std::pair<int, int> > fDaughterMap;102 std::map< int, std::pair < int, int > > fMotherMap; 103 std::map< int, std::pair < int, int > > fDaughterMap; 102 104 }; 103 105 104 106 #endif // DelphesHepMCReader_h 107 108 -
classes/DelphesLHEFReader.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesLHEFReader 20 21 * … … 27 28 #include "classes/DelphesLHEFReader.h" 28 29 30 #include <stdexcept> 29 31 #include <iostream> 30 32 #include <sstream> 31 #include <stdexcept>32 33 33 34 #include <stdio.h> 34 35 36 #include "TObjArray.h" 37 #include "TStopwatch.h" 35 38 #include "TDatabasePDG.h" 39 #include "TParticlePDG.h" 36 40 #include "TLorentzVector.h" 37 #include "TObjArray.h"38 #include "TParticlePDG.h"39 #include "TStopwatch.h"40 41 41 42 #include "classes/DelphesClasses.h" … … 53 54 DelphesLHEFReader::DelphesLHEFReader() : 54 55 fInputFile(0), fBuffer(0), fPDG(0), 55 fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1), fCrossSection(1)56 fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1), fCrossSection(1) 56 57 57 58 { … … 123 124 if(!rc) 124 125 { 125 cerr << "** ERROR: " 126 << "invalid event format" << endl; 126 cerr << "** ERROR: " << "invalid event format" << endl; 127 127 return kFALSE; 128 128 } … … 148 148 if(!rc) 149 149 { 150 cerr << "** ERROR: " 151 << "invalid particle format" << endl; 150 cerr << "** ERROR: " << "invalid particle format" << endl; 152 151 return kFALSE; 153 152 } … … 163 162 if(!pch) 164 163 { 165 cerr << "** ERROR: " 166 << "invalid weight format" << endl; 164 cerr << "** ERROR: " << "invalid weight format" << endl; 167 165 return kFALSE; 168 166 } … … 174 172 if(!pch) 175 173 { 176 cerr << "** ERROR: " 177 << "invalid weight format" << endl; 174 cerr << "** ERROR: " << "invalid weight format" << endl; 178 175 return kFALSE; 179 176 } … … 184 181 if(!rc) 185 182 { 186 cerr << "** ERROR: " 187 << "invalid weight format" << endl; 183 cerr << "** ERROR: " << "invalid weight format" << endl; 188 184 return kFALSE; 189 185 } … … 196 192 if(!pch) 197 193 { 198 cerr << "** ERROR: " 199 << "invalid cross section format" << endl; 194 cerr << "** ERROR: " << "invalid cross section format" << endl; 200 195 return kFALSE; 201 196 } … … 204 199 if(!pch) 205 200 { 206 cerr << "** ERROR: " 207 << "invalid cross section format" << endl; 201 cerr << "** ERROR: " << "invalid cross section format" << endl; 208 202 return kFALSE; 209 203 } … … 214 208 if(!rc) 215 209 { 216 cerr << "** ERROR: " 217 << "invalid cross section format" << endl; 210 cerr << "** ERROR: " << "invalid cross section format" << endl; 218 211 return kFALSE; 219 212 } … … 256 249 { 257 250 LHEFWeight *element; 258 vector< pair<int, double> >::const_iterator itWeightList;251 vector< pair< int, double > >::const_iterator itWeightList; 259 252 260 253 for(itWeightList = fWeightList.begin(); itWeightList != fWeightList.end(); ++itWeightList) … … 286 279 287 280 pdgParticle = fPDG->GetParticle(fPID); 288 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;281 candidate->Charge = pdgParticle ? int(pdgParticle->Charge()/3.0) : -999; 289 282 candidate->Mass = fMass; 290 283 -
classes/DelphesLHEFReader.h
r0e7d64a re39abb4 30 30 #include <stdio.h> 31 31 32 #include <vector> 32 33 #include <utility> 33 #include <vector>34 34 35 35 class TObjArray; … … 42 42 { 43 43 public: 44 44 45 DelphesLHEFReader(); 45 46 ~DelphesLHEFReader(); … … 61 62 62 63 private: 64 63 65 void AnalyzeParticle(DelphesFactory *factory, 64 66 TObjArray *allParticleOutputArray, … … 81 83 int fPID, fStatus, fM1, fM2, fC1, fC2; 82 84 double fPx, fPy, fPz, fE, fMass; 83 84 std::vector< std::pair<int, double> > fWeightList;85 86 std::vector< std::pair< int, double > > fWeightList; 85 87 }; 86 88 87 89 #endif // DelphesLHEFReader_h 90 91 -
classes/DelphesModule.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesModule 20 21 * … … 29 30 #include "classes/DelphesFactory.h" 30 31 32 #include "ExRootAnalysis/ExRootTreeReader.h" 33 #include "ExRootAnalysis/ExRootTreeBranch.h" 34 #include "ExRootAnalysis/ExRootTreeWriter.h" 31 35 #include "ExRootAnalysis/ExRootResult.h" 32 #include "ExRootAnalysis/ExRootTreeBranch.h"33 #include "ExRootAnalysis/ExRootTreeReader.h"34 #include "ExRootAnalysis/ExRootTreeWriter.h"35 36 37 #include "TROOT.h" 36 38 #include "TClass.h" 37 39 #include "TFolder.h" 38 40 #include "TObjArray.h" 39 #include "TROOT.h"40 41 41 42 #include <iostream> 43 #include <stdexcept> 42 44 #include <sstream> 43 #include <stdexcept>44 45 45 46 using namespace std; … … 156 157 return fFactory; 157 158 } 159 160 -
classes/DelphesModule.h
r0e7d64a re39abb4 41 41 class DelphesFactory; 42 42 43 class DelphesModule: public ExRootTask 43 class DelphesModule: public ExRootTask 44 44 { 45 45 public: 46 46 47 DelphesModule(); 47 48 ~DelphesModule(); … … 60 61 61 62 protected: 63 62 64 ExRootTreeWriter *fTreeWriter; 63 65 DelphesFactory *fFactory; 64 66 65 67 private: 68 66 69 ExRootResult *fPlots; 67 70 … … 72 75 73 76 #endif /* DelphesModule_h */ 77 -
classes/DelphesPileUpReader.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesPileUpReader 20 21 * … … 27 28 #include "classes/DelphesPileUpReader.h" 28 29 30 #include <stdexcept> 29 31 #include <iostream> 30 32 #include <sstream> 31 #include <stdexcept>32 33 34 #include <stdio.h> 33 35 #include <stdint.h> 34 #include <stdio.h>35 36 36 37 #include "classes/DelphesXDRReader.h" … … 51 52 stringstream message; 52 53 53 fIndex = new uint8_t[kIndexSize *8];54 fBuffer = new uint8_t[kBufferSize * kRecordSize *4];54 fIndex = new uint8_t[kIndexSize*8]; 55 fBuffer = new uint8_t[kBufferSize*kRecordSize*4]; 55 56 fInputReader = new DelphesXDRReader; 56 57 fIndexReader = new DelphesXDRReader; … … 81 82 82 83 // read index of events 83 fseeko(fPileUpFile, -8 - 8 *fEntries, SEEK_END);84 fInputReader->ReadRaw(fIndex, fEntries *8);84 fseeko(fPileUpFile, -8 - 8*fEntries, SEEK_END); 85 fInputReader->ReadRaw(fIndex, fEntries*8); 85 86 } 86 87 … … 129 130 130 131 // read event position 131 fIndexReader->SetOffset(8 *entry);132 fIndexReader->SetOffset(8*entry); 132 133 fIndexReader->ReadValue(&offset, 8); 133 134 … … 141 142 } 142 143 143 fInputReader->ReadRaw(fBuffer, fEntrySize * kRecordSize *4);144 fInputReader->ReadRaw(fBuffer, fEntrySize*kRecordSize*4); 144 145 fBufferReader->SetOffset(0); 145 146 fCounter = 0; -
classes/DelphesPileUpReader.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include <stdio.h> 30 31 #include <stdint.h> 31 #include <stdio.h>32 32 33 33 class DelphesXDRReader; … … 36 36 { 37 37 public: 38 38 39 DelphesPileUpReader(const char *fileName); 39 40 … … 49 50 50 51 private: 52 51 53 int64_t fEntries; 52 54 -
classes/DelphesPileUpWriter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesPileUpWriter 20 21 * … … 27 28 #include "classes/DelphesPileUpWriter.h" 28 29 30 #include <stdexcept> 29 31 #include <iostream> 30 32 #include <sstream> 31 #include <stdexcept>32 33 34 #include <stdio.h> 33 35 #include <stdint.h> 34 #include <stdio.h>35 36 36 37 #include "classes/DelphesXDRWriter.h" … … 51 52 stringstream message; 52 53 53 fIndex = new uint8_t[kIndexSize *8];54 fBuffer = new uint8_t[kBufferSize * kRecordSize *4];54 fIndex = new uint8_t[kIndexSize*8]; 55 fBuffer = new uint8_t[kBufferSize*kRecordSize*4]; 55 56 fOutputWriter = new DelphesXDRWriter; 56 57 fIndexWriter = new DelphesXDRWriter; … … 117 118 118 119 fOutputWriter->WriteValue(&fEntrySize, 4); 119 fOutputWriter->WriteRaw(fBuffer, fEntrySize * kRecordSize *4);120 fOutputWriter->WriteRaw(fBuffer, fEntrySize*kRecordSize*4); 120 121 121 122 fIndexWriter->WriteValue(&fOffset, 8); 122 fOffset += fEntrySize * kRecordSize *4 + 4;123 fOffset += fEntrySize*kRecordSize*4 + 4; 123 124 124 125 fBufferWriter->SetOffset(0); … … 132 133 void DelphesPileUpWriter::WriteIndex() 133 134 { 134 fOutputWriter->WriteRaw(fIndex, fEntries *8);135 fOutputWriter->WriteRaw(fIndex, fEntries*8); 135 136 fOutputWriter->WriteValue(&fEntries, 8); 136 137 } -
classes/DelphesPileUpWriter.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include <stdio.h> 30 31 #include <stdint.h> 31 #include <stdio.h>32 32 33 33 class DelphesXDRWriter; … … 36 36 { 37 37 public: 38 38 39 DelphesPileUpWriter(const char *fileName); 39 40 … … 49 50 50 51 private: 52 51 53 int64_t fEntries; 52 54 int32_t fEntrySize; -
classes/DelphesSTDHEPReader.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesSTDHEPReader 20 21 * … … 27 28 #include "classes/DelphesSTDHEPReader.h" 28 29 30 #include <stdexcept> 29 31 #include <iostream> 30 32 #include <sstream> 31 #include <stdexcept> 32 33 34 #include <stdio.h> 33 35 #include <errno.h> 34 36 #include <stdint.h> 35 #include <stdio.h>36 37 #include <string.h> 37 38 39 #include "TObjArray.h" 40 #include "TStopwatch.h" 38 41 #include "TDatabasePDG.h" 42 #include "TParticlePDG.h" 39 43 #include "TLorentzVector.h" 40 #include "TObjArray.h"41 #include "TParticlePDG.h"42 #include "TStopwatch.h"43 44 44 45 #include "classes/DelphesClasses.h" … … 50 51 using namespace std; 51 52 52 static const int kBufferSize = 1000000;53 static const int kBufferSize = 1000000; 53 54 54 55 //--------------------------------------------------------------------------- … … 57 58 fInputFile(0), fBuffer(0), fPDG(0), fBlockType(-1) 58 59 { 59 fBuffer = new uint8_t[kBufferSize *96 + 24];60 fBuffer = new uint8_t[kBufferSize*96 + 24]; 60 61 61 62 fPDG = TDatabasePDG::Instance(); … … 116 117 ReadEventHeader(); 117 118 } 118 else if(fBlockType == MCFIO_STDHEPBEG || fBlockType == MCFIO_STDHEPEND) 119 else if(fBlockType == MCFIO_STDHEPBEG || 120 fBlockType == MCFIO_STDHEPEND) 119 121 { 120 122 ReadSTDCM1(); … … 168 170 uint32_t size; 169 171 fReader[0].ReadValue(&size, 4); 170 SkipBytes(size *elsize);172 SkipBytes(size*elsize); 171 173 } 172 174 … … 176 178 { 177 179 uint32_t i; 178 enum STDHEPVersion 179 { 180 UNKNOWN, 181 V1, 182 V2, 183 V21 184 } version; 180 enum STDHEPVersion {UNKNOWN, V1, V2, V21} version; 185 181 186 182 // version 187 183 fReader[0].ReadString(fBuffer, 100); 188 if(fBuffer[0] == '\0' || fBuffer[1] == '\0') 189 version = UNKNOWN; 190 else if(fBuffer[0] == '1') 191 version = V1; 192 else if(strncmp((char *)fBuffer, "2.01", 4) == 0) 193 version = V21; 194 else if(fBuffer[0] == '2') 195 version = V2; 196 else 197 version = UNKNOWN; 184 if(fBuffer[0] == '\0' || fBuffer[1] == '\0') version = UNKNOWN; 185 else if(fBuffer[0] == '1') version = V1; 186 else if(strncmp((char *)fBuffer, "2.01", 4) == 0) version = V21; 187 else if(fBuffer[0] == '2') version = V2; 188 else version = UNKNOWN; 198 189 199 190 if(version == UNKNOWN) … … 372 363 // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24 373 364 374 fReader[0].ReadRaw(fBuffer, 96 *fEventSize + 24);365 fReader[0].ReadRaw(fBuffer, 96*fEventSize + 24); 375 366 376 367 fReader[1].SetBuffer(fBuffer); 377 fReader[2].SetBuffer(fBuffer + 4 * 1 + 4 * 1 *fEventSize);378 fReader[3].SetBuffer(fBuffer + 4 * 2 + 4 * 2 *fEventSize);379 fReader[4].SetBuffer(fBuffer + 4 * 3 + 4 * 4 *fEventSize);380 fReader[5].SetBuffer(fBuffer + 4 * 4 + 4 * 6 *fEventSize);381 fReader[6].SetBuffer(fBuffer + 4 * 5 + 4 * 16 *fEventSize);368 fReader[2].SetBuffer(fBuffer + 4*1 + 4*1*fEventSize); 369 fReader[3].SetBuffer(fBuffer + 4*2 + 4*2*fEventSize); 370 fReader[4].SetBuffer(fBuffer + 4*3 + 4*4*fEventSize); 371 fReader[5].SetBuffer(fBuffer + 4*4 + 4*6*fEventSize); 372 fReader[6].SetBuffer(fBuffer + 4*5 + 4*16*fEventSize); 382 373 383 374 fReader[1].ReadValue(&idhepSize, 4); … … 400 391 fAlphaQCD = 0.0; 401 392 fScaleSize = 0; 402 memset(fScale, 0, 10 *sizeof(double));393 memset(fScale, 0, 10*sizeof(double)); 403 394 } 404 395 … … 503 494 504 495 pdgParticle = fPDG->GetParticle(pid); 505 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;496 candidate->Charge = pdgParticle ? int(pdgParticle->Charge()/3.0) : -999; 506 497 candidate->Mass = mass; 507 498 -
classes/DelphesSTDHEPReader.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include <stdio.h> 30 31 #include <stdint.h> 31 #include <stdio.h>32 32 33 33 #include "classes/DelphesXDRReader.h" … … 72 72 73 73 private: 74 74 75 void AnalyzeParticles(DelphesFactory *factory, 75 76 TObjArray *allParticleOutputArray, -
classes/DelphesStream.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesStream 20 21 * … … 27 28 #include "classes/DelphesStream.h" 28 29 30 #include <stdlib.h> 31 #include <limits.h> 32 #include <string.h> 33 #include <stdio.h> 29 34 #include <errno.h> 30 #include <limits.h>31 35 #include <math.h> 32 #include <stdio.h>33 #include <stdlib.h>34 #include <string.h>35 36 36 37 #include <iostream> … … 64 65 if(fFirstHugePos && value == HUGE_VAL) 65 66 { 66 fFirstHugePos = false; 67 fFirstHugePos = false; 67 68 cout << "** WARNING: too large positive value, return " << value << endl; 68 69 } 69 70 else if(fFirstHugeNeg && value == -HUGE_VAL) 70 71 { 71 fFirstHugeNeg = false; 72 fFirstHugeNeg = false; 72 73 cout << "** WARNING: too large negative value, return " << value << endl; 73 74 } 74 75 else if(fFirstZero) 75 76 { 76 fFirstZero = false; 77 fFirstZero = false; 77 78 value = 0.0; 78 79 cout << "** WARNING: too small value, return " << value << endl; … … 93 94 if(fFirstLongMin && value == LONG_MIN) 94 95 { 95 fFirstLongMin = false; 96 fFirstLongMin = false; 96 97 cout << "** WARNING: too large positive value, return " << value << endl; 97 98 } 98 99 else if(fFirstLongMax && value == LONG_MAX) 99 100 { 100 fFirstLongMax = false; 101 fFirstLongMax = false; 101 102 cout << "** WARNING: too large negative value, return " << value << endl; 102 103 } -
classes/DelphesStream.h
r0e7d64a re39abb4 31 31 { 32 32 public: 33 33 34 DelphesStream(char *buffer); 34 35 … … 37 38 38 39 private: 40 39 41 char *fBuffer; 40 42 41 43 static bool fFirstLongMin; 42 44 static bool fFirstLongMax; … … 47 49 48 50 #endif // DelphesStream_h 51 52 -
classes/DelphesTF2.cc
r0e7d64a re39abb4 32 32 { 33 33 34 #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 3,0)34 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,04,00) 35 35 fFormula = new TFormula(); 36 36 #endif 37 38 37 39 } 38 40 … … 58 60 for(it = expression; *it; ++it) 59 61 { 60 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;62 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 61 63 buffer.Append(*it); 62 64 } 63 65 buffer.ReplaceAll("z", "x"); 64 66 buffer.ReplaceAll("t", "y"); 65 #if ROOT_VERSION_CODE < ROOT_VERSION(6, 3,0)67 #if ROOT_VERSION_CODE < ROOT_VERSION(6,04,00) 66 68 if(TF2::Compile(buffer) != 0) 67 69 #else -
classes/DelphesTF2.h
r0e7d64a re39abb4 25 25 { 26 26 public: 27 27 28 DelphesTF2(); 28 29 -
classes/DelphesXDRReader.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesXDRReader 20 21 * … … 27 28 #include "classes/DelphesXDRReader.h" 28 29 30 #include <stdio.h> 29 31 #include <stdint.h> 30 #include <stdio.h>31 32 #include <string.h> 32 33 … … 108 109 109 110 if(size > maxSize) size = maxSize; 110 111 111 112 if(fBuffer) 112 113 { -
classes/DelphesXDRReader.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include <stdio.h> 30 31 #include <stdint.h> 31 #include <stdio.h>32 32 33 33 class DelphesXDRReader 34 34 { 35 35 public: 36 36 37 DelphesXDRReader(); 37 38 … … 45 46 46 47 private: 48 47 49 FILE *fFile; 48 50 uint8_t *fBuffer; -
classes/DelphesXDRWriter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DelphesXDRWriter 20 21 * … … 27 28 #include "classes/DelphesXDRWriter.h" 28 29 30 #include <stdio.h> 29 31 #include <stdint.h> 30 #include <stdio.h>31 32 #include <string.h> 32 33 -
classes/DelphesXDRWriter.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include <stdio.h> 30 31 #include <stdint.h> 31 #include <stdio.h>32 32 33 33 class DelphesXDRWriter 34 34 { 35 35 public: 36 36 37 DelphesXDRWriter(); 37 38 … … 44 45 45 46 private: 47 46 48 FILE *fFile; 47 49 uint8_t *fBuffer; -
classes/SortableObject.h
r0e7d64a re39abb4 26 26 */ 27 27 28 #include "TRef.h" 28 29 #include "TObject.h" 29 #include "TRef.h"30 30 #include "TRefArray.h" 31 31 … … 37 37 { 38 38 public: 39 virtual ~CompBase() { }39 virtual ~CompBase() { } 40 40 virtual Bool_t IsSortable(const TObject *) const { return kTRUE; } 41 41 virtual Int_t Compare(const TObject *obj1, const TObject *obj2) const = 0; … … 47 47 { 48 48 public: 49 49 50 Bool_t IsSortable() const { return GetCompare() ? GetCompare()->IsSortable(this) : kFALSE; } 50 51 Int_t Compare(const TObject *obj) const { return GetCompare()->Compare(this, obj); } … … 63 64 { 64 65 CompE() {} 65 66 66 public: 67 67 static CompE *Instance() … … 73 73 Int_t Compare(const TObject *obj1, const TObject *obj2) const 74 74 { 75 const T *t1 = static_cast<const T 76 const T *t2 = static_cast<const T 75 const T *t1 = static_cast<const T*>(obj1); 76 const T *t2 = static_cast<const T*>(obj2); 77 77 if(t1->E > t2->E) 78 78 return -1; … … 90 90 { 91 91 CompPT() {} 92 93 92 public: 94 93 static CompPT *Instance() … … 100 99 Int_t Compare(const TObject *obj1, const TObject *obj2) const 101 100 { 102 const T *t1 = static_cast<const T 103 const T *t2 = static_cast<const T 101 const T *t1 = static_cast<const T*>(obj1); 102 const T *t2 = static_cast<const T*>(obj2); 104 103 if(t1->PT > t2->PT) 105 104 return -1; … … 117 116 { 118 117 CompMomentumPt() {} 119 120 118 public: 121 119 static CompMomentumPt *Instance() … … 127 125 Int_t Compare(const TObject *obj1, const TObject *obj2) const 128 126 { 129 const T *t1 = static_cast<const T 130 const T *t2 = static_cast<const T 127 const T *t1 = static_cast<const T*>(obj1); 128 const T *t2 = static_cast<const T*>(obj2); 131 129 if(t1->Momentum.Pt() > t2->Momentum.Pt()) 132 130 return -1; … … 144 142 { 145 143 CompET() {} 146 147 144 public: 148 145 static CompET *Instance() … … 154 151 Int_t Compare(const TObject *obj1, const TObject *obj2) const 155 152 { 156 const T *t1 = static_cast<const T 157 const T *t2 = static_cast<const T 153 const T *t1 = static_cast<const T*>(obj1); 154 const T *t2 = static_cast<const T*>(obj2); 158 155 if(t1->ET > t2->ET) 159 156 return -1; … … 171 168 { 172 169 CompSumPT2() {} 173 174 170 public: 175 171 static CompSumPT2 *Instance() … … 181 177 Int_t Compare(const TObject *obj1, const TObject *obj2) const 182 178 { 183 const T *t1 = static_cast<const T 184 const T *t2 = static_cast<const T 179 const T *t1 = static_cast<const T*>(obj1); 180 const T *t2 = static_cast<const T*>(obj2); 185 181 if(t1->SumPT2 > t2->SumPT2) 186 182 return -1; … … 197 193 class CompDeltaR: public CompBase 198 194 { 199 CompDeltaR(const T2 *obj = 0) : 200 fObj(obj) {} 195 CompDeltaR(const T2 *obj = 0) : fObj(obj) {} 201 196 202 197 Double_t DeltaPhi(Double_t phi1, Double_t phi2) 203 198 { 204 199 Double_t phi = TMath::Abs(phi1 - phi2); 205 return (phi <= TMath::Pi()) ? phi : (2.0 *TMath::Pi()) - phi;206 } 207 208 Double_t Sqr(Double_t x) { return x *x; }200 return (phi <= TMath::Pi()) ? phi : (2.0*TMath::Pi()) - phi; 201 } 202 203 Double_t Sqr(Double_t x) { return x*x; } 209 204 210 205 Double_t SumSqr(Double_t a, Double_t b) … … 212 207 Double_t aAbs = TMath::Abs(a); 213 208 Double_t bAbs = TMath::Abs(b); 214 if(aAbs > bAbs) 215 return aAbs * TMath::Sqrt(1.0 + Sqr(bAbs / aAbs)); 216 else 217 return (bAbs == 0) ? 0.0 : bAbs * TMath::Sqrt(1.0 + Sqr(aAbs / bAbs)); 209 if(aAbs > bAbs) return aAbs * TMath::Sqrt(1.0 + Sqr(bAbs / aAbs)); 210 else return (bAbs == 0) ? 0.0 : bAbs * TMath::Sqrt(1.0 + Sqr(aAbs / bAbs)); 218 211 }; 219 212 … … 221 214 222 215 public: 223 static CompDeltaR *Instance(const T2 *obj = 0)224 { 225 static CompDeltaR single(obj);226 return &single;216 static CompDeltaR *Instance(const T2 *obj = 0) 217 { 218 static CompDeltaR single(obj); 219 return &single; 227 220 } 228 221 … … 232 225 { 233 226 Double_t eta[3], phi[3], deltaR[2]; 234 const T1 *t1 = static_cast<const T1 235 const T1 *t2 = static_cast<const T1 227 const T1 *t1 = static_cast<const T1*>(obj1); 228 const T1 *t2 = static_cast<const T1*>(obj2); 236 229 237 230 eta[0] = fObj->Eta; … … 257 250 258 251 #endif // SortableObject_h 252 253 -
converters/hepmc2pileup.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 #include <signal.h> 24 24 25 #include "TROOT.h" 25 26 #include "TApplication.h" 26 #include "TROOT.h"27 27 28 #include "TFile.h" 29 #include "TObjArray.h" 30 #include "TStopwatch.h" 28 31 #include "TDatabasePDG.h" 29 #include "T File.h"32 #include "TParticlePDG.h" 30 33 #include "TLorentzVector.h" 31 #include "TObjArray.h"32 #include "TParticlePDG.h"33 #include "TStopwatch.h"34 34 35 35 #include "classes/DelphesClasses.h" … … 38 38 #include "classes/DelphesPileUpWriter.h" 39 39 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootTreeWriter.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 75 74 cout << " output_file - output binary pile-up file," << endl; 76 75 cout << " input_file(s) - input file(s) in HepMC format," << endl; … … 143 142 reader->Clear(); 144 143 while(reader->ReadBlock(factory, allParticleOutputArray, 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 147 145 { 148 146 if(reader->EventReady()) … … 151 149 152 150 itParticle->Reset(); 153 while((candidate = static_cast<Candidate 151 while((candidate = static_cast<Candidate*>(itParticle->Next()))) 154 152 { 155 153 const TLorentzVector &position = candidate->Position; … … 175 173 176 174 ++i; 177 } while(i < argc); 175 } 176 while(i < argc); 178 177 179 178 writer->WriteIndex(); -
converters/lhco2root.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept> 22 22 23 #include <stdlib.h> 23 24 #include <signal.h> 24 25 #include <stdio.h> 25 #include <stdlib.h> 26 26 27 #include "TROOT.h" 27 28 #include "TApplication.h" 28 #include "TROOT.h" 29 29 30 #include "TFile.h" 31 #include "TObjArray.h" 32 #include "TStopwatch.h" 30 33 #include "TDatabasePDG.h" 31 #include "T File.h"34 #include "TParticlePDG.h" 32 35 #include "TLorentzVector.h" 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 35 #include "TStopwatch.h" 36 36 37 #include "modules/Delphes.h" 38 #include "classes/DelphesStream.h" 37 39 #include "classes/DelphesClasses.h" 38 40 #include "classes/DelphesFactory.h" 39 #include "classes/DelphesStream.h" 40 #include " modules/Delphes.h"41 41 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h" 42 44 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h"44 #include "ExRootAnalysis/ExRootTreeWriter.h"45 45 46 46 using namespace std; 47 47 48 static const int kBufferSize = 1024;48 static const int kBufferSize = 1024; 49 49 50 50 /* … … 74 74 75 75 private: 76 76 77 void AddMissingEvents(); 77 78 … … 85 86 void AnalyseMissingET(ExRootTreeBranch *branch); 86 87 87 enum 88 { 89 kIntParamSize = 2, 90 kDblParamSize = 7 91 }; 88 enum {kIntParamSize = 2, kDblParamSize = 7}; 92 89 Int_t fIntParam[kIntParamSize]; 93 90 Double_t fDblParam[kDblParamSize]; … … 109 106 ExRootTreeBranch *fBranchJet; 110 107 ExRootTreeBranch *fBranchMissingET; 108 111 109 }; 112 110 … … 171 169 if(!rc) 172 170 { 173 cerr << "** ERROR: " 174 << "invalid event format" << endl; 171 cerr << "** ERROR: " << "invalid event format" << endl; 175 172 return kFALSE; 176 173 } … … 198 195 if(!rc) 199 196 { 200 cerr << "** ERROR: " 201 << "invalid object format" << endl; 197 cerr << "** ERROR: " << "invalid object format" << endl; 202 198 return kFALSE; 203 199 } … … 205 201 switch(fIntParam[1]) 206 202 { 207 case 0: AnalysePhoton(fBranchPhoton); break;208 case 1: AnalyseElectron(fBranchElectron); break;209 case 2: AnalyseMuon(fBranchMuon); break;210 case 3: AnalyseTau(fBranchJet); break;211 case 4: AnalyseJet(fBranchJet); break;212 case 6: AnalyseMissingET(fBranchMissingET); break;203 case 0: AnalysePhoton(fBranchPhoton); break; 204 case 1: AnalyseElectron(fBranchElectron); break; 205 case 2: AnalyseMuon(fBranchMuon); break; 206 case 3: AnalyseTau(fBranchJet); break; 207 case 4: AnalyseJet(fBranchJet); break; 208 case 6: AnalyseMissingET(fBranchMissingET); break; 213 209 } 214 210 } … … 232 228 LHCOEvent *element; 233 229 234 element = static_cast<LHCOEvent 230 element = static_cast<LHCOEvent*>(branch->NewEntry()); 235 231 236 232 element->Number = fEventNumber; … … 244 240 Photon *element; 245 241 246 element = static_cast<Photon 242 element = static_cast<Photon*>(branch->NewEntry()); 247 243 248 244 element->Eta = fDblParam[0]; … … 258 254 Electron *element; 259 255 260 element = static_cast<Electron 256 element = static_cast<Electron*>(branch->NewEntry()); 261 257 262 258 element->Eta = fDblParam[0]; … … 265 261 266 262 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 267 263 /* 268 264 element->Ntrk = TMath::Abs(fDblParam[4]); 269 265 */ … … 277 273 Muon *element; 278 274 279 element = static_cast<Muon 275 element = static_cast<Muon*>(branch->NewEntry()); 280 276 281 277 element->Eta = fDblParam[0]; … … 284 280 285 281 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 286 282 /* 287 283 element->Ntrk = TMath::Abs(fDblParam[4]); 288 284 … … 300 296 Jet *element; 301 297 302 element = static_cast<Jet 298 element = static_cast<Jet*>(branch->NewEntry()); 303 299 304 300 element->Eta = fDblParam[0]; … … 312 308 313 309 element->Charge = fDblParam[4] < 0 ? -1 : 1; 314 310 /* 315 311 element->Ntrk = TMath::Abs(fDblParam[4]); 316 312 */ … … 324 320 Jet *element; 325 321 326 element = static_cast<Jet 322 element = static_cast<Jet*>(branch->NewEntry()); 327 323 328 324 element->Eta = fDblParam[0]; … … 331 327 332 328 element->Mass = fDblParam[3]; 333 329 /* 334 330 element->Ntrk = TMath::Abs(Int_t(fDblParam[4])); 335 331 */ … … 340 336 341 337 element->EhadOverEem = fDblParam[6]; 342 338 /* 343 339 element->Index = fIntParam[0]; 344 340 */ … … 351 347 MissingET *element; 352 348 353 element = static_cast<MissingET 349 element = static_cast<MissingET*>(branch->NewEntry()); 354 350 355 351 element->Phi = fDblParam[1]; … … 380 376 if(argc < 2) 381 377 { 382 cout << " Usage: " << appName << " output_file" 383 << " [input_file(s)]" << endl; 378 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 384 379 cout << " output_file - output file in ROOT format," << endl; 385 380 cout << " input_file(s) - input file(s) in LHCO format," << endl; … … 461 456 462 457 ++i; 463 } while(i < argc); 458 } 459 while(i < argc); 464 460 465 461 cout << "** Exiting..." << endl; … … 478 474 } 479 475 } 476 477 -
converters/pileup2root.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 20 #include <stdexcept> 19 21 #include <iostream> 20 22 #include <sstream> 21 #include <stdexcept> 22 23 24 #include <stdlib.h> 23 25 #include <signal.h> 24 26 #include <stdio.h> 25 #include <stdlib.h> 26 27 28 #include "TROOT.h" 27 29 #include "TApplication.h" 28 #include "TROOT.h" 29 30 31 #include "TFile.h" 32 #include "TObjArray.h" 33 #include "TStopwatch.h" 30 34 #include "TDatabasePDG.h" 31 #include "T File.h"35 #include "TParticlePDG.h" 32 36 #include "TLorentzVector.h" 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 35 #include "TStopwatch.h" 36 37 38 #include "classes/DelphesStream.h" 37 39 #include "classes/DelphesClasses.h" 38 40 #include "classes/DelphesFactory.h" 39 41 #include "classes/DelphesPileUpReader.h" 40 #include "classes/DelphesStream.h" 41 42 43 #include "ExRootAnalysis/ExRootTreeWriter.h" 44 #include "ExRootAnalysis/ExRootTreeBranch.h" 42 45 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h"44 #include "ExRootAnalysis/ExRootTreeWriter.h"45 46 46 47 using namespace std; … … 61 62 while(reader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 62 63 { 63 particle = static_cast<GenParticle 64 particle = static_cast<GenParticle*>(branch->NewEntry()); 64 65 65 66 particle->PID = pid; … … 83 84 84 85 pdgParticle = pdg->GetParticle(pid); 85 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;86 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 86 87 87 88 particle->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; … … 91 92 cosTheta = TMath::Abs(momentum.CosTheta()); 92 93 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 93 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());94 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());94 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 95 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 95 96 96 97 particle->Eta = eta; … … 125 126 if(argc != 3) 126 127 { 127 cout << " Usage: " << appName << " output_file" 128 << " input_file" << endl; 128 cout << " Usage: " << appName << " output_file" << " input_file" << endl; 129 129 cout << " output_file - output file in ROOT format," << endl; 130 130 cout << " input_file - input binary pile-up file." << endl; … … 199 199 } 200 200 } 201 202 -
converters/root2lhco.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 20 #include <iostream> 19 21 #include <fstream> 20 #include <iostream>21 22 #include <sstream> 22 #include <stdexcept>23 23 #include <string> 24 24 25 #include <stdlib.h> 25 26 #include <signal.h> 26 27 #include <stdio.h> 27 #include <stdlib.h> 28 28 29 #include "TROOT.h" 29 30 #include "TApplication.h" 30 #include "TROOT.h" 31 31 32 #include "TFile.h" 32 33 #include "TClonesArray.h" 33 #include "TFile.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 37 #include "ExRootAnalysis/ExRootTreeReader.h" 37 38 #include "ExRootAnalysis/ExRootProgressBar.h" 38 #include "ExRootAnalysis/ExRootTreeReader.h"39 39 40 40 using namespace std; … … 62 62 63 63 private: 64 64 65 void Reset(); 65 66 void Write(); … … 75 76 void AnalyseMissingET(); 76 77 77 enum 78 { 79 kIntParamSize = 2, 80 kDblParamSize = 9 81 }; 78 enum {kIntParamSize = 2, kDblParamSize = 9}; 82 79 Int_t fIntParam[kIntParamSize]; 83 80 Double_t fDblParam[kDblParamSize]; … … 135 132 fBranchMissingET = fTreeReader->UseBranch("MissingET"); 136 133 137 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 134 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || 135 !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 138 136 { 139 137 throw runtime_error("ROOT file doesn't contain all required branches"); … … 204 202 Event *element; 205 203 206 element = static_cast<Event 204 element = static_cast<Event*>(fBranchEvent->At(0)); 207 205 208 206 fprintf(fOutputFile, "%4d %13lld %8d\n", 0, element->Number, 0); … … 218 216 219 217 fItPhoton->Reset(); 220 while((element = static_cast<Photon 218 while((element = static_cast<Photon*>(fItPhoton->Next()))) 221 219 { 222 220 Reset(); … … 241 239 242 240 fItElectron->Reset(); 243 while((element = static_cast<Electron 241 while((element = static_cast<Electron*>(fItElectron->Next()))) 244 242 { 245 243 Reset(); … … 272 270 muonCounter = 0; 273 271 fItMuon->Reset(); 274 while((element = static_cast<Muon 272 while((element = static_cast<Muon*>(fItMuon->Next()))) 275 273 { 276 274 Reset(); … … 278 276 sumPT = 0.0; 279 277 fItTrack->Reset(); 280 while((track = static_cast<Track 278 while((track = static_cast<Track*>(fItTrack->Next()))) 281 279 { 282 280 if(element->P4().DeltaR(track->P4()) < 0.5) sumPT += track->PT; … … 285 283 sumET = 0.0; 286 284 fItTower->Reset(); 287 while((tower = static_cast<Tower 285 while((tower = static_cast<Tower*>(fItTower->Next()))) 288 286 { 289 287 if(element->P4().DeltaR(tower->P4()) < 0.5) sumET += tower->ET; … … 295 293 minDR = 1.0E9; 296 294 fItJet->Reset(); 297 while((jet = static_cast<Jet 295 while((jet = static_cast<Jet*>(fItJet->Next()))) 298 296 { 299 297 if(jet->TauTag != 0) … … 327 325 } 328 326 329 ratET = sumET /element->PT;327 ratET = sumET/element->PT; 330 328 fDblParam[6] = Float_t(TMath::Nint(sumPT)) + (ratET < 1.0 ? ratET : 0.99); 331 329 … … 344 342 345 343 fItJet->Reset(); 346 while((element = static_cast<Jet 344 while((element = static_cast<Jet*>(fItJet->Next()))) 347 345 { 348 346 if(element->TauTag == 0) continue; … … 352 350 counter = 1; 353 351 354 352 /* 355 353 fItTrack->Reset(); 356 354 while((track = static_cast<Track*>(fItTrack->Next()))) … … 382 380 383 381 fItJet->Reset(); 384 while((element = static_cast<Jet 382 while((element = static_cast<Jet*>(fItJet->Next()))) 385 383 { 386 384 if(element->TauTag != 0) continue; … … 390 388 counter = 0; 391 389 fItTrack->Reset(); 392 while((track = static_cast<Track 390 while((track = static_cast<Track*>(fItTrack->Next()))) 393 391 { 394 392 if(element->P4().DeltaR(track->P4()) < 0.5) ++counter; … … 415 413 MissingET *element; 416 414 417 element = static_cast<MissingET 415 element = static_cast<MissingET*>(fBranchMissingET->At(0)); 418 416 419 417 Reset(); … … 473 471 if(argc < 2 || argc > 4) 474 472 { 475 cerr << " Usage: " << appName << " input_file" 476 << " [output_file] [--jet-branch=Jet]" << endl; 473 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl; 477 474 cerr << " input_file - input file in ROOT format," << endl; 478 475 cerr << " output_file - output file in LHCO format," << endl; -
converters/root2pileup.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 #include <string> 23 23 24 24 #include <signal.h> 25 25 26 #include "TROOT.h" 26 27 #include "TApplication.h" 27 #include "TROOT.h"28 28 29 #include "TFile.h" 29 30 #include "TClonesArray.h" 30 #include "TFile.h"31 31 32 32 #include "classes/DelphesClasses.h" 33 33 #include "classes/DelphesPileUpWriter.h" 34 34 35 #include "ExRootAnalysis/ExRootTreeReader.h" 35 36 #include "ExRootAnalysis/ExRootProgressBar.h" 36 #include "ExRootAnalysis/ExRootTreeReader.h"37 37 38 38 using namespace std; … … 64 64 if(argc < 3) 65 65 { 66 cout << " Usage: " << appName << " output_file" 67 << " input_file(s)" << endl; 66 cout << " Usage: " << appName << " output_file" << " input_file(s)" << endl; 68 67 cout << " output_file - output binary pile-up file," << endl; 69 68 cout << " input_file(s) - input file(s) in ROOT format." << endl; … … 109 108 110 109 itParticle->Reset(); 111 while((particle = static_cast<GenParticle 110 while((particle = static_cast<GenParticle*>(itParticle->Next()))) 112 111 { 113 112 writer->WriteParticle(particle->PID, … … 115 114 particle->Px, particle->Py, particle->Pz, particle->E); 116 115 } 117 116 118 117 writer->WriteEntry(); 119 118 -
converters/stdhep2pileup.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 #include <signal.h> 24 24 25 #include "TROOT.h" 25 26 #include "TApplication.h" 26 #include "TROOT.h"27 27 28 #include "TFile.h" 29 #include "TObjArray.h" 30 #include "TStopwatch.h" 28 31 #include "TDatabasePDG.h" 29 #include "T File.h"32 #include "TParticlePDG.h" 30 33 #include "TLorentzVector.h" 31 #include "TObjArray.h"32 #include "TParticlePDG.h"33 #include "TStopwatch.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 #include "classes/DelphesFactory.h" 37 #include "classes/DelphesSTDHEPReader.h" 37 38 #include "classes/DelphesPileUpWriter.h" 38 #include "classes/DelphesSTDHEPReader.h"39 39 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootTreeWriter.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 75 74 cout << " output_file - output binary pile-up file," << endl; 76 75 cout << " input_file(s) - input file(s) in STDHEP format," << endl; … … 143 142 reader->Clear(); 144 143 while(reader->ReadBlock(factory, allParticleOutputArray, 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 147 145 { 148 146 if(reader->EventReady()) … … 151 149 152 150 itParticle->Reset(); 153 while((candidate = static_cast<Candidate 151 while((candidate = static_cast<Candidate*>(itParticle->Next()))) 154 152 { 155 153 const TLorentzVector &position = candidate->Position; … … 175 173 176 174 ++i; 177 } while(i < argc); 175 } 176 while(i < argc); 178 177 179 178 writer->WriteIndex(); -
display/Delphes3DGeometry.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <algorithm> 20 #include <cassert> 19 #include <set> 21 20 #include <map> 22 #include <set>23 #include <sstream>24 21 #include <utility> 25 22 #include <vector> 23 #include <algorithm> 24 #include <sstream> 25 #include <cassert> 26 26 27 27 #include "TAxis.h" 28 #include "TGeoManager.h" 29 #include "TGeoVolume.h" 30 #include "TGeoMedium.h" 31 #include "TGeoNode.h" 32 #include "TGeoCompositeShape.h" 33 #include "TGeoMatrix.h" 34 #include "TGeoTube.h" 35 #include "TGeoCone.h" 36 #include "TGeoArb8.h" 28 37 #include "TF2.h" 29 38 #include "TFormula.h" 30 #include "TGeoArb8.h"31 #include "TGeoCompositeShape.h"32 #include "TGeoCone.h"33 #include "TGeoManager.h"34 #include "TGeoMatrix.h"35 #include "TGeoMedium.h"36 #include "TGeoNode.h"37 #include "TGeoTube.h"38 #include "TGeoVolume.h"39 39 #include "TH1F.h" 40 40 #include "TMath.h" … … 48 48 using namespace std; 49 49 50 Delphes3DGeometry::Delphes3DGeometry(TGeoManager *geom, bool transp) 51 { 52 53 //--- the geometry manager 54 geom_ = geom == NULL ? gGeoManager : geom; 55 //gGeoManager->DefaultColors(); 56 57 //--- define some materials 58 TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0); 59 TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98, 13, 2.7); // placeholder 60 if(transp) 61 { 62 matVacuum->SetTransparency(85); 63 matAl->SetTransparency(85); 64 } 65 66 //--- define some media 67 TGeoMedium *Vacuum = new TGeoMedium("Vacuum", 1, matVacuum); 68 TGeoMedium *Al = new TGeoMedium("Root Material", 2, matAl); 69 vacuum_ = Vacuum; 70 tkmed_ = Vacuum; // placeholder 71 calomed_ = Al; // placeholder 72 mudetmed_ = Al; // placeholder 73 74 // custom parameters 75 contingency_ = 10.; 76 calo_barrel_thickness_ = 50.; 77 calo_endcap_thickness_ = 75.; 78 muonSystem_thickn_ = 10.; 79 80 // read these parameters from the Delphes Card (with default values) 81 etaAxis_ = NULL; 82 phiAxis_ = NULL; 83 tk_radius_ = 120.; 84 tk_length_ = 150.; 85 tk_etamax_ = 3.0; 86 tk_Bz_ = 1.; 87 muonSystem_radius_ = 200.; 50 Delphes3DGeometry::Delphes3DGeometry(TGeoManager *geom, bool transp) { 51 52 //--- the geometry manager 53 geom_ = geom==NULL? gGeoManager : geom; 54 //gGeoManager->DefaultColors(); 55 56 //--- define some materials 57 TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0); 58 TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); // placeholder 59 if(transp) { 60 matVacuum->SetTransparency(85); 61 matAl->SetTransparency(85); 62 } 63 64 //--- define some media 65 TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum); 66 TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl); 67 vacuum_ = Vacuum; 68 tkmed_ = Vacuum; // placeholder 69 calomed_ = Al; // placeholder 70 mudetmed_ = Al; // placeholder 71 72 // custom parameters 73 contingency_ = 10.; 74 calo_barrel_thickness_ = 50.; 75 calo_endcap_thickness_ = 75.; 76 muonSystem_thickn_ = 10.; 77 78 // read these parameters from the Delphes Card (with default values) 79 etaAxis_ = NULL; 80 phiAxis_ = NULL; 81 tk_radius_ = 120.; 82 tk_length_ = 150.; 83 tk_etamax_ = 3.0; 84 tk_Bz_ = 1.; 85 muonSystem_radius_ = 200.; 88 86 } 89 87 90 88 void Delphes3DGeometry::readFile(const char *configFile, 91 const char *ParticlePropagator, const char *TrackingEfficiency, 92 const char *MuonEfficiency, const char *Calorimeters) 93 { 94 95 ExRootConfReader *confReader = new ExRootConfReader; 96 confReader->ReadFile(configFile); 97 98 tk_radius_ = confReader->GetDouble(Form("%s::Radius", ParticlePropagator), 1.0) * 100.; // tk_radius 99 tk_length_ = confReader->GetDouble(Form("%s::HalfLength", ParticlePropagator), 3.0) * 100.; // tk_length 100 tk_Bz_ = confReader->GetDouble("ParticlePropagator::Bz", 0.0); // tk_Bz 101 102 TString buffer; 103 const char *it; 104 105 { 106 TString tkEffFormula = confReader->GetString(Form("%s::EfficiencyFormula", TrackingEfficiency), "abs(eta)<3.0"); 107 tkEffFormula.ReplaceAll("pt", "x"); 108 tkEffFormula.ReplaceAll("eta", "y"); 109 tkEffFormula.ReplaceAll("phi", "0."); 110 111 buffer.Clear(); 112 for(it = tkEffFormula.Data(); *it; ++it) 113 { 114 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\') continue; 115 buffer.Append(*it); 116 } 117 118 TF2 *tkEffFunction = new TF2("tkEff", buffer, 0, 1000, -10, 10); 119 TH1F etaHisto("eta", "eta", 100, 5., -5.); 120 Double_t pt, eta; 121 for(int i = 0; i < 1000; ++i) 122 { 123 tkEffFunction->GetRandom2(pt, eta); 124 etaHisto.Fill(eta); 125 } 126 Int_t bin = -1; 127 bin = etaHisto.FindFirstBinAbove(0.5); 128 Double_t etamin = (bin > -1) ? etaHisto.GetBinLowEdge(bin) : -10.; 129 bin = etaHisto.FindLastBinAbove(0.5); 130 Double_t etamax = (bin > -1) ? etaHisto.GetBinLowEdge(bin + 1) : -10.; 131 tk_etamax_ = TMath::Max(fabs(etamin), fabs(etamax)); // tk_etamax 132 delete tkEffFunction; 133 } 134 135 { 136 muondets_.push_back("muons"); 137 TString muonEffFormula = confReader->GetString(Form("%s::EfficiencyFormula", MuonEfficiency), "abs(eta)<2.0"); 138 muonEffFormula.ReplaceAll("pt", "x"); 139 muonEffFormula.ReplaceAll("eta", "y"); 140 muonEffFormula.ReplaceAll("phi", "0."); 141 142 buffer.Clear(); 143 for(it = muonEffFormula.Data(); *it; ++it) 144 { 145 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\') continue; 146 buffer.Append(*it); 147 } 148 149 TF2 *muEffFunction = new TF2("muEff", buffer, 0, 1000, -10, 10); 150 TH1F etaHisto("eta2", "eta2", 100, 5., -5.); 151 Double_t pt, eta; 152 for(int i = 0; i < 1000; ++i) 153 { 154 muEffFunction->GetRandom2(pt, eta); 155 etaHisto.Fill(eta); 156 } 157 Int_t bin = -1; 158 bin = etaHisto.FindFirstBinAbove(0.5); 159 Double_t etamin = (bin > -1) ? etaHisto.GetBinLowEdge(bin) : -10.; 160 bin = etaHisto.FindLastBinAbove(0.5); 161 Double_t etamax = (bin > -1) ? etaHisto.GetBinLowEdge(bin + 1) : -10.; 162 muonSystem_etamax_["muons"] = TMath::Max(fabs(etamin), fabs(etamax)); // muonSystem_etamax 163 delete muEffFunction; 164 } 165 166 std::string s(Calorimeters); 167 std::replace(s.begin(), s.end(), ',', ' '); 168 std::istringstream stream(s); 169 std::string word; 170 while(stream >> word) calorimeters_.push_back(word); 171 172 caloBinning_.clear(); // calo binning 173 for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) 174 { 175 set<pair<Double_t, Int_t> > caloBinning; 176 ExRootConfParam paramEtaBins, paramPhiBins; 177 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins", calo->c_str())); 178 Int_t size = param.GetSize(); 179 for(int i = 0; i < size / 2; ++i) 180 { 181 paramEtaBins = param[i * 2]; 182 paramPhiBins = param[i * 2 + 1]; 183 assert(paramEtaBins.GetSize() == 1); 184 caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(), paramPhiBins.GetSize() - 1)); 185 } 186 caloBinning_[*calo] = caloBinning; 187 } 188 189 set<pair<Double_t, Int_t> > caloBinning = caloBinning_[*calorimeters_.begin()]; 190 Double_t *etaBins = new Double_t[caloBinning.size()]; // note that this is the eta binning of the first calo 191 unsigned int ii = 0; 192 for(set<pair<Double_t, Int_t> >::const_iterator itEtaSet = caloBinning.begin(); itEtaSet != caloBinning.end(); ++itEtaSet) 193 { 194 etaBins[ii++] = itEtaSet->first; 195 } 196 etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins); 197 phiAxis_ = new TAxis(72, -TMath::Pi(), TMath::Pi()); // note that this is fixed while #phibins could vary, also with eta, which doesn't seem possible in ROOT 198 199 muonSystem_radius_ = tk_radius_ + contingency_ + (contingency_ + calo_barrel_thickness_) * calorimeters_.size() + muonSystem_thickn_; 200 muonSystem_length_ = tk_length_ + contingency_ + (contingency_ + calo_endcap_thickness_) * calorimeters_.size() + muonSystem_thickn_; 201 202 delete confReader; 203 } 204 205 TGeoVolume *Delphes3DGeometry::getDetector(bool withTowers) 206 { 207 // compute the envelope 208 Double_t system_radius = tk_radius_ + calo_barrel_thickness_ + 3 * contingency_; 209 Double_t system_length = tk_length_ + contingency_ + (contingency_ + calo_endcap_thickness_) * calorimeters_.size() + contingency_; 210 // the detector volume 211 TGeoVolume *top = geom_->MakeBox("Delphes3DGeometry", vacuum_, system_radius, system_radius, system_length); 212 // build the detector 213 std::pair<Double_t, Double_t> limits = addTracker(top); 214 Double_t radius = limits.first; 215 Double_t length = limits.second; 216 for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) 217 { 218 limits = addCalorimeter(top, calo->c_str(), radius, length, caloBinning_[*calo]); 219 if(withTowers) 220 { 221 addCaloTowers(top, calo->c_str(), radius, length, caloBinning_[*calo]); 222 } 223 radius = limits.first; 224 length = limits.second; 225 } 226 for(std::vector<std::string>::const_iterator muon = muondets_.begin(); muon != muondets_.end(); ++muon) 227 { 228 limits = addMuonDets(top, muon->c_str(), radius, length); 229 radius = limits.first; 230 length = limits.second; 231 } 232 // return the result 233 return top; 234 } 235 236 std::pair<Double_t, Double_t> Delphes3DGeometry::addTracker(TGeoVolume *top) 237 { 238 // tracker: a cylinder with two cones substracted 239 new TGeoCone("forwardTkAcceptance", (tk_length_ / 2. + 0.05), 0., tk_radius_, (tk_length_)*2. * exp(-tk_etamax_) / (1 - exp(-2. * tk_etamax_)), tk_radius_); 240 TGeoTranslation *tr1 = new TGeoTranslation("tkacc1", 0., 0., tk_length_ / 2.); 241 tr1->RegisterYourself(); 242 TGeoRotation *negz = new TGeoRotation("tknegz", 0, 180, 0); 243 negz->RegisterYourself(); 244 TGeoCombiTrans *tr2 = new TGeoCombiTrans("tkacc2", 0., 0., -tk_length_ / 2., negz); 245 tr2->RegisterYourself(); 246 TGeoCompositeShape *tracker_cs = new TGeoCompositeShape("tracker_cs", "forwardTkAcceptance:tkacc1+forwardTkAcceptance:tkacc2"); 247 TGeoVolume *tracker = new TGeoVolume("tracker", tracker_cs, tkmed_); 248 tracker->SetLineColor(kYellow); 249 top->AddNode(tracker, 1); 250 return std::make_pair(tk_radius_, tk_length_); 251 } 252 253 std::pair<Double_t, Double_t> Delphes3DGeometry::addCalorimeter(TGeoVolume *top, const char *name, 254 Double_t innerBarrelRadius, Double_t innerBarrelLength, set<pair<Double_t, Int_t> > &caloBinning) 255 { 256 // parameters derived from the inputs 257 Double_t calo_endcap_etamax = TMath::Max(fabs(caloBinning.begin()->first), fabs(caloBinning.rbegin()->first)); 258 Double_t calo_barrel_innerRadius = innerBarrelRadius + contingency_; 259 Double_t calo_barrel_length = innerBarrelLength + calo_barrel_thickness_; 260 Double_t calo_endcap_etamin = -log(innerBarrelRadius / (2 * innerBarrelLength)); 261 Double_t calo_endcap_innerRadius1 = innerBarrelLength * 2. * exp(-calo_endcap_etamax) / (1 - exp(-2. * calo_endcap_etamax)); 262 Double_t calo_endcap_innerRadius2 = (innerBarrelLength + calo_endcap_thickness_) * 2. * exp(-calo_endcap_etamax) / (1 - exp(-2. * calo_endcap_etamax)); 263 Double_t calo_endcap_outerRadius1 = innerBarrelRadius; 264 Double_t calo_endcap_outerRadius2 = innerBarrelRadius + calo_barrel_thickness_; 265 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1 - exp(-2. * calo_endcap_etamin)) / (2. * exp(-calo_endcap_etamin)), calo_endcap_thickness_); 266 Double_t calo_endcap_diskThickness = TMath::Max(0., calo_endcap_thickness_ - calo_endcap_coneThickness); 267 268 // calorimeters: tube truncated in eta + cones 269 new TGeoTube(Form("%s_barrel_cylinder", name), calo_barrel_innerRadius, calo_barrel_innerRadius + calo_barrel_thickness_, calo_barrel_length); 270 new TGeoCone(Form("%s_endcap_cone", name), calo_endcap_coneThickness / 2., calo_endcap_innerRadius1, calo_endcap_outerRadius1, calo_endcap_innerRadius2, calo_endcap_outerRadius2); 271 new TGeoTube(Form("%s_endcap_disk", name), calo_endcap_innerRadius2, tk_radius_ + calo_barrel_thickness_, calo_endcap_diskThickness / 2.); 272 TGeoTranslation *tr1 = new TGeoTranslation(Form("%s_tr1", name), 0., 0., (calo_endcap_coneThickness + calo_endcap_diskThickness) / 2.); 273 tr1->RegisterYourself(); 274 TGeoCompositeShape *calo_endcap_cs = new TGeoCompositeShape(Form("%s_endcap_cs", name), Form("%s_endcap_cone+%s_endcap_disk:%s_tr1", name, name, name)); 275 TGeoTranslation *trc1 = new TGeoTranslation(Form("%s_endcap1_position", name), 0., 0., innerBarrelLength + calo_endcap_coneThickness / 2.); 276 trc1->RegisterYourself(); 277 TGeoRotation *negz = new TGeoRotation(Form("%s_negz", name), 0, 180, 0); 278 TGeoCombiTrans *trc2 = new TGeoCombiTrans(Form("%s_endcap2_position", name), 0., 0., -(innerBarrelLength + calo_endcap_coneThickness / 2.), negz); 279 trc2->RegisterYourself(); 280 TGeoTranslation *trc1c = new TGeoTranslation(Form("%s_endcap1_position_cont", name), 0., 0., innerBarrelLength + calo_endcap_coneThickness / 2. + contingency_); 281 trc1c->RegisterYourself(); 282 TGeoCombiTrans *trc2c = new TGeoCombiTrans(Form("%s_endcap2_position_cont", name), 0., 0., -(innerBarrelLength + calo_endcap_coneThickness / 2.) - contingency_, negz); 283 trc2c->RegisterYourself(); 284 TGeoVolume *calo_endcap = new TGeoVolume(Form("%s_endcap", name), calo_endcap_cs, calomed_); 285 TGeoCompositeShape *calo_barrel_cs = new TGeoCompositeShape(Form("%s_barrel_cs", name), 286 Form("%s_barrel_cylinder-%s_endcap_cs:%s_endcap1_position-%s_endcap_cs:%s_endcap2_position", name, name, name, name, name)); 287 TGeoVolume *calo_barrel = new TGeoVolume(Form("%s_barrel", name), calo_barrel_cs, calomed_); 288 calo_endcap->SetLineColor(kViolet); 289 calo_endcap->SetFillColor(kViolet); 290 calo_barrel->SetLineColor(kRed); 291 top->AddNode(calo_endcap, 1, trc1c); 292 top->AddNode(calo_endcap, 2, trc2c); 293 top->AddNode(calo_barrel, 1); 294 return std::make_pair(calo_barrel_innerRadius + calo_barrel_thickness_, innerBarrelLength + calo_endcap_thickness_ + contingency_); 295 } 296 297 std::pair<Double_t, Double_t> Delphes3DGeometry::addMuonDets(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength) 298 { 299 // muon system: tube + disks 300 Double_t muonSystem_radius = innerBarrelRadius + contingency_; 301 Double_t muonSystem_length = innerBarrelLength + contingency_; 302 Double_t muonSystem_rmin = muonSystem_length * 2. * exp(-muonSystem_etamax_[name]) / (1 - exp(-2. * muonSystem_etamax_[name])); 303 TGeoVolume *muon_barrel = geom_->MakeTube(Form("%s_barrel", name), mudetmed_, muonSystem_radius, muonSystem_radius + muonSystem_thickn_, muonSystem_length); 304 muon_barrel->SetLineColor(kBlue); 305 top->AddNode(muon_barrel, 1); 306 TGeoVolume *muon_endcap = geom_->MakeTube(Form("%s_endcap", name), mudetmed_, muonSystem_rmin, muonSystem_radius + muonSystem_thickn_, muonSystem_thickn_ / 2.); 307 muon_endcap->SetLineColor(kBlue); 308 TGeoTranslation *trm1 = new TGeoTranslation(Form("%sEndcap1_position", name), 0., 0., muonSystem_length); 309 trm1->RegisterYourself(); 310 TGeoTranslation *trm2 = new TGeoTranslation(Form("%sEndcap2_position", name), 0., 0., -muonSystem_length); 311 trm1->RegisterYourself(); 312 top->AddNode(muon_endcap, 1, trm1); 313 top->AddNode(muon_endcap, 2, trm2); 314 return std::make_pair(muonSystem_radius, muonSystem_length); 315 } 316 317 void Delphes3DGeometry::addCaloTowers(TGeoVolume *top, const char *name, 318 Double_t innerBarrelRadius, Double_t innerBarrelLength, set<pair<Double_t, Int_t> > &caloBinning) 319 { 320 321 TGeoVolume *calo_endcap = top->GetNode(Form("%s_endcap_1", name))->GetVolume(); 322 TGeoVolume *calo_barrel = top->GetNode(Form("%s_barrel_1", name))->GetVolume(); 323 Double_t calo_endcap_etamin = -log(innerBarrelRadius / (2 * innerBarrelLength)); 324 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1 - exp(-2. * calo_endcap_etamin)) / (2. * exp(-calo_endcap_etamin)), calo_endcap_thickness_); 325 326 // calo towers in the barrel 327 Double_t vertices[16] = {0., 0., 0., 0., 0., 0., 0., 0.}; // summit of the pyramid 328 Double_t R = tk_radius_ + contingency_ + (contingency_ + calo_barrel_thickness_) * calorimeters_.size(); // radius of the muons system = height of the pyramid 329 Int_t nEtaBins = caloBinning.size(); 330 // this rotation is to make the tower point "up" 331 TGeoRotation *initTowerRot = new TGeoRotation(Form("%s_initTowerRot", name), 0., 90., 0.); 332 TGeoCombiTrans *initTower = new TGeoCombiTrans(Form("%s_initTower", name), 0., -R / 2., 0., initTowerRot); 333 initTower->RegisterYourself(); 334 // eta bins... we build one pyramid per eta slice and then translate it nphi times. 335 // phi bins represented by rotations around z 336 Double_t *y = new Double_t[nEtaBins]; 337 Double_t *dx = new Double_t[nEtaBins]; 338 Int_t *nphi = new Int_t[nEtaBins]; 339 Int_t etaslice = 0; 340 std::map<std::pair<int, int>, TGeoRotation *> phirotations; 341 for(set<pair<Double_t, Int_t> >::const_iterator bin = caloBinning.begin(); bin != caloBinning.end(); ++bin) 342 { 343 if(abs(bin->first) > calo_endcap_etamin) continue; // only in the barrel 344 nphi[etaslice] = bin->second; 345 y[etaslice] = 0.5 * R * (1 - exp(-2 * bin->first)) / exp(-bin->first); 346 Double_t phiRotationAngle = 360. / nphi[etaslice]; 347 dx[etaslice] = R * tan(TMath::Pi() * phiRotationAngle / 360.); 348 for(int phislice = 0; phislice < nphi[etaslice]; ++phislice) 349 { 350 phirotations[make_pair(etaslice, phislice)] = new TGeoRotation(Form("%s_phi%d_%d", name, etaslice, phislice), phiRotationAngle * phislice, 0., 0.); 351 phirotations[make_pair(etaslice, phislice)]->RegisterYourself(); 352 } 353 ++etaslice; 354 } 355 nEtaBins = etaslice; 356 for(int i = 0; i < nEtaBins - 1; ++i) 357 { // loop on the eta slices 358 vertices[8] = -dx[i]; 359 vertices[9] = y[i]; 360 vertices[10] = -dx[i]; 361 vertices[11] = y[i + 1]; 362 vertices[12] = dx[i]; 363 vertices[13] = y[i + 1]; 364 vertices[14] = dx[i]; 365 vertices[15] = y[i]; 366 new TGeoArb8(Form("%s_tower%d", name, i), R / 2., vertices); // tower in the proper eta slice, at phi=0 367 // intersection between the tower and the calo_barrel 368 TGeoCompositeShape *finaltower_cs = new TGeoCompositeShape(Form("%s_ftower%d_cs", name, i), Form("%s_tower%d:%s_initTower*%s_barrel_cs", name, i, name, name)); 369 TGeoVolume *finaltower = new TGeoVolume(Form("%s_ftower%d", name, i), finaltower_cs, calomed_); 370 finaltower->SetLineColor(kRed); 371 for(int j = 0; j < nphi[i]; ++j) 372 { // loop on the phi slices 373 calo_barrel->AddNode(finaltower, j, phirotations[make_pair(i, j)]); 374 } 375 } 376 delete[] y; 377 delete[] dx; 378 delete[] nphi; 379 //the towers in the forward region 380 R = tk_length_ + contingency_ + (contingency_ + calo_endcap_thickness_) * calorimeters_.size(); // Z of the muons system = height of the pyramid 381 nEtaBins = caloBinning.size(); 382 // translation to bring the origin of the tower to (0,0,0) (well, not really as the endcap is not yet in place) 383 TGeoTranslation *towerdz = new TGeoTranslation(Form("%s_towerdz", name), 0., 0., R / 2. - (innerBarrelLength + calo_endcap_coneThickness / 2.)); 384 towerdz->RegisterYourself(); 385 // eta bins... we build one pyramid per eta slice and then translate it nphi times. 386 Double_t *r = new Double_t[nEtaBins]; 387 nphi = new Int_t[nEtaBins]; 388 etaslice = 0; 389 phirotations.clear(); 390 for(set<pair<Double_t, Int_t> >::const_iterator bin = caloBinning.begin(); bin != caloBinning.end(); ++bin) 391 { 392 if(bin->first < calo_endcap_etamin) continue; // only in the + endcap 393 r[etaslice] = R * 2 * exp(-bin->first) / (1 - exp(-2 * bin->first)); 394 nphi[etaslice] = bin->second; 395 Double_t phiRotationAngle = 360. / nphi[etaslice]; 396 for(int phislice = 0; phislice < nphi[etaslice]; ++phislice) 397 { 398 phirotations[make_pair(etaslice, phislice)] = new TGeoRotation(Form("%s_forward_phi%d_%d", name, etaslice, phislice), phiRotationAngle * phislice, 0., 0.); 399 phirotations[make_pair(etaslice, phislice)]->RegisterYourself(); 400 } 401 ++etaslice; 402 } 403 nEtaBins = etaslice; 404 for(int i = 0; i < nEtaBins - 1; ++i) 405 { // loop on the eta slices 406 vertices[8] = -r[i + 1] * sin(TMath::Pi() / nphi[i]); 407 vertices[9] = r[i + 1] * cos(TMath::Pi() / nphi[i]); 408 vertices[10] = -r[i] * sin(TMath::Pi() / nphi[i]); 409 vertices[11] = r[i] * cos(TMath::Pi() / nphi[i]); 410 vertices[12] = r[i] * sin(TMath::Pi() / nphi[i]); 411 vertices[13] = r[i] * cos(TMath::Pi() / nphi[i]); 412 vertices[14] = r[i + 1] * sin(TMath::Pi() / nphi[i]); 413 vertices[15] = r[i + 1] * cos(TMath::Pi() / nphi[i]); 414 new TGeoArb8(Form("%sfwdtower%d", name, i), R / 2., vertices); // tower in the proper eta slice, at phi=0 415 // intersection between the tower and the calo_endcap 416 TGeoCompositeShape *finalfwdtower_cs = new TGeoCompositeShape(Form("%sffwdtower%d_cs", name, i), Form("%sfwdtower%d:%s_towerdz*%s_endcap_cs", name, i, name, name)); 417 TGeoVolume *finalfwdtower = new TGeoVolume(Form("%sffwdtower%d", name, i), finalfwdtower_cs, calomed_); 418 finalfwdtower->SetLineColor(kViolet); 419 for(int j = 0; j < nphi[i]; ++j) 420 { // loop on the phi slices 421 calo_endcap->AddNode(finalfwdtower, j, phirotations[make_pair(i, j)]); 422 } 423 } 424 delete[] r; 425 delete[] nphi; 426 } 89 const char* ParticlePropagator, const char* TrackingEfficiency, 90 const char* MuonEfficiency, const char* Calorimeters) { 91 92 ExRootConfReader *confReader = new ExRootConfReader; 93 confReader->ReadFile(configFile); 94 95 tk_radius_ = confReader->GetDouble(Form("%s::Radius",ParticlePropagator), 1.0)*100.; // tk_radius 96 tk_length_ = confReader->GetDouble(Form("%s::HalfLength",ParticlePropagator), 3.0)*100.; // tk_length 97 tk_Bz_ = confReader->GetDouble("ParticlePropagator::Bz", 0.0); // tk_Bz 98 99 TString buffer; 100 const char *it; 101 102 103 { 104 TString tkEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",TrackingEfficiency),"abs(eta)<3.0"); 105 tkEffFormula.ReplaceAll("pt","x"); 106 tkEffFormula.ReplaceAll("eta","y"); 107 tkEffFormula.ReplaceAll("phi","0."); 108 109 buffer.Clear(); 110 for(it = tkEffFormula.Data(); *it; ++it) 111 { 112 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 113 buffer.Append(*it); 114 } 115 116 TF2* tkEffFunction = new TF2("tkEff",buffer,0,1000,-10,10); 117 TH1F etaHisto("eta","eta",100,5.,-5.); 118 Double_t pt,eta; 119 for(int i=0;i<1000;++i) { 120 tkEffFunction->GetRandom2(pt,eta); 121 etaHisto.Fill(eta); 122 } 123 Int_t bin = -1; 124 bin = etaHisto.FindFirstBinAbove(0.5); 125 Double_t etamin = (bin>-1) ? etaHisto.GetBinLowEdge(bin) : -10.; 126 bin = etaHisto.FindLastBinAbove(0.5); 127 Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.; 128 tk_etamax_ = TMath::Max(fabs(etamin),fabs(etamax)); // tk_etamax 129 delete tkEffFunction; 130 } 131 132 { 133 muondets_.push_back("muons"); 134 TString muonEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",MuonEfficiency),"abs(eta)<2.0"); 135 muonEffFormula.ReplaceAll("pt","x"); 136 muonEffFormula.ReplaceAll("eta","y"); 137 muonEffFormula.ReplaceAll("phi","0."); 138 139 buffer.Clear(); 140 for(it = muonEffFormula.Data(); *it; ++it) 141 { 142 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 143 buffer.Append(*it); 144 } 145 146 TF2* muEffFunction = new TF2("muEff",buffer,0,1000,-10,10); 147 TH1F etaHisto("eta2","eta2",100,5.,-5.); 148 Double_t pt,eta; 149 for(int i=0;i<1000;++i) { 150 muEffFunction->GetRandom2(pt,eta); 151 etaHisto.Fill(eta); 152 } 153 Int_t bin = -1; 154 bin = etaHisto.FindFirstBinAbove(0.5); 155 Double_t etamin = (bin>-1) ? etaHisto.GetBinLowEdge(bin) : -10.; 156 bin = etaHisto.FindLastBinAbove(0.5); 157 Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.; 158 muonSystem_etamax_["muons"] = TMath::Max(fabs(etamin),fabs(etamax)); // muonSystem_etamax 159 delete muEffFunction; 160 } 161 162 std::string s(Calorimeters); 163 std::replace( s.begin(), s.end(), ',', ' ' ); 164 std::istringstream stream( s ); 165 std::string word; 166 while (stream >> word) calorimeters_.push_back(word); 167 168 caloBinning_.clear(); // calo binning 169 for(std::vector<std::string>::const_iterator calo=calorimeters_.begin();calo!=calorimeters_.end(); ++calo) { 170 set< pair<Double_t, Int_t> > caloBinning; 171 ExRootConfParam paramEtaBins, paramPhiBins; 172 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",calo->c_str())); 173 Int_t size = param.GetSize(); 174 for(int i = 0; i < size/2; ++i) { 175 paramEtaBins = param[i*2]; 176 paramPhiBins = param[i*2+1]; 177 assert(paramEtaBins.GetSize()==1); 178 caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(),paramPhiBins.GetSize()-1)); 179 } 180 caloBinning_[*calo] = caloBinning; 181 } 182 183 set< pair<Double_t, Int_t> > caloBinning = caloBinning_[*calorimeters_.begin()]; 184 Double_t *etaBins = new Double_t[caloBinning.size()]; // note that this is the eta binning of the first calo 185 unsigned int ii = 0; 186 for(set< pair<Double_t, Int_t> >::const_iterator itEtaSet = caloBinning.begin(); itEtaSet != caloBinning.end(); ++itEtaSet) { 187 etaBins[ii++] = itEtaSet->first; 188 } 189 etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins); 190 phiAxis_ = new TAxis(72, -TMath::Pi(), TMath::Pi()); // note that this is fixed while #phibins could vary, also with eta, which doesn't seem possible in ROOT 191 192 muonSystem_radius_ = tk_radius_ + contingency_ + (contingency_+calo_barrel_thickness_)*calorimeters_.size() + muonSystem_thickn_; 193 muonSystem_length_ = tk_length_ + contingency_ + (contingency_+calo_endcap_thickness_)*calorimeters_.size() + muonSystem_thickn_; 194 195 delete confReader; 196 197 } 198 199 TGeoVolume* Delphes3DGeometry::getDetector(bool withTowers) { 200 // compute the envelope 201 Double_t system_radius = tk_radius_+calo_barrel_thickness_+3*contingency_; 202 Double_t system_length = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size()+contingency_; 203 // the detector volume 204 TGeoVolume *top = geom_->MakeBox("Delphes3DGeometry", vacuum_, system_radius, system_radius, system_length); 205 // build the detector 206 std::pair<Double_t, Double_t> limits = addTracker(top); 207 Double_t radius = limits.first; 208 Double_t length = limits.second; 209 for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) { 210 limits = addCalorimeter(top,calo->c_str(),radius,length,caloBinning_[*calo]); 211 if (withTowers) { 212 addCaloTowers(top,calo->c_str(),radius,length,caloBinning_[*calo]); 213 } 214 radius = limits.first; 215 length = limits.second; 216 } 217 for(std::vector<std::string>::const_iterator muon = muondets_.begin(); muon != muondets_.end(); ++muon) { 218 limits = addMuonDets(top, muon->c_str(), radius, length); 219 radius = limits.first; 220 length = limits.second; 221 } 222 // return the result 223 return top; 224 } 225 226 std::pair<Double_t, Double_t> Delphes3DGeometry::addTracker(TGeoVolume *top) { 227 // tracker: a cylinder with two cones substracted 228 new TGeoCone("forwardTkAcceptance",(tk_length_/2.+0.05),0.,tk_radius_,(tk_length_)*2.*exp(-tk_etamax_)/(1-exp(-2.*tk_etamax_)),tk_radius_); 229 TGeoTranslation *tr1 = new TGeoTranslation("tkacc1",0., 0., tk_length_/2.); 230 tr1->RegisterYourself(); 231 TGeoRotation *negz = new TGeoRotation("tknegz",0,180,0); 232 negz->RegisterYourself(); 233 TGeoCombiTrans *tr2 = new TGeoCombiTrans("tkacc2",0.,0.,-tk_length_/2.,negz); 234 tr2->RegisterYourself(); 235 TGeoCompositeShape* tracker_cs = new TGeoCompositeShape("tracker_cs","forwardTkAcceptance:tkacc1+forwardTkAcceptance:tkacc2"); 236 TGeoVolume *tracker = new TGeoVolume("tracker",tracker_cs,tkmed_); 237 tracker->SetLineColor(kYellow); 238 top->AddNode(tracker,1); 239 return std::make_pair(tk_radius_,tk_length_); 240 } 241 242 std::pair<Double_t, Double_t> Delphes3DGeometry::addCalorimeter(TGeoVolume *top, const char* name, 243 Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) { 244 // parameters derived from the inputs 245 Double_t calo_endcap_etamax = TMath::Max(fabs(caloBinning.begin()->first),fabs(caloBinning.rbegin()->first)); 246 Double_t calo_barrel_innerRadius = innerBarrelRadius+contingency_; 247 Double_t calo_barrel_length = innerBarrelLength + calo_barrel_thickness_; 248 Double_t calo_endcap_etamin = -log(innerBarrelRadius/(2*innerBarrelLength)); 249 Double_t calo_endcap_innerRadius1 = innerBarrelLength*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax)); 250 Double_t calo_endcap_innerRadius2 = (innerBarrelLength+calo_endcap_thickness_)*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax)); 251 Double_t calo_endcap_outerRadius1 = innerBarrelRadius; 252 Double_t calo_endcap_outerRadius2 = innerBarrelRadius+calo_barrel_thickness_; 253 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_); 254 Double_t calo_endcap_diskThickness = TMath::Max(0.,calo_endcap_thickness_-calo_endcap_coneThickness); 255 256 // calorimeters: tube truncated in eta + cones 257 new TGeoTube(Form("%s_barrel_cylinder",name),calo_barrel_innerRadius,calo_barrel_innerRadius+calo_barrel_thickness_,calo_barrel_length); 258 new TGeoCone(Form("%s_endcap_cone",name),calo_endcap_coneThickness/2.,calo_endcap_innerRadius1,calo_endcap_outerRadius1,calo_endcap_innerRadius2,calo_endcap_outerRadius2); 259 new TGeoTube(Form("%s_endcap_disk",name),calo_endcap_innerRadius2,tk_radius_+calo_barrel_thickness_,calo_endcap_diskThickness/2.); 260 TGeoTranslation *tr1 = new TGeoTranslation(Form("%s_tr1",name),0., 0., (calo_endcap_coneThickness+calo_endcap_diskThickness)/2.); 261 tr1->RegisterYourself(); 262 TGeoCompositeShape *calo_endcap_cs = new TGeoCompositeShape(Form("%s_endcap_cs",name),Form("%s_endcap_cone+%s_endcap_disk:%s_tr1",name,name,name)); 263 TGeoTranslation *trc1 = new TGeoTranslation(Form("%s_endcap1_position",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.); 264 trc1->RegisterYourself(); 265 TGeoRotation *negz = new TGeoRotation(Form("%s_negz",name),0,180,0); 266 TGeoCombiTrans *trc2 = new TGeoCombiTrans(Form("%s_endcap2_position",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.),negz); 267 trc2->RegisterYourself(); 268 TGeoTranslation *trc1c = new TGeoTranslation(Form("%s_endcap1_position_cont",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.+contingency_); 269 trc1c->RegisterYourself(); 270 TGeoCombiTrans *trc2c = new TGeoCombiTrans(Form("%s_endcap2_position_cont",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.)-contingency_,negz); 271 trc2c->RegisterYourself(); 272 TGeoVolume *calo_endcap = new TGeoVolume(Form("%s_endcap",name),calo_endcap_cs,calomed_); 273 TGeoCompositeShape *calo_barrel_cs = new TGeoCompositeShape(Form("%s_barrel_cs",name), 274 Form("%s_barrel_cylinder-%s_endcap_cs:%s_endcap1_position-%s_endcap_cs:%s_endcap2_position",name,name,name,name,name)); 275 TGeoVolume *calo_barrel = new TGeoVolume(Form("%s_barrel",name),calo_barrel_cs,calomed_); 276 calo_endcap->SetLineColor(kViolet); 277 calo_endcap->SetFillColor(kViolet); 278 calo_barrel->SetLineColor(kRed); 279 top->AddNode(calo_endcap,1,trc1c); 280 top->AddNode(calo_endcap,2,trc2c); 281 top->AddNode(calo_barrel,1); 282 return std::make_pair(calo_barrel_innerRadius+calo_barrel_thickness_,innerBarrelLength+calo_endcap_thickness_+contingency_); 283 } 284 285 std::pair<Double_t, Double_t> Delphes3DGeometry::addMuonDets(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength) { 286 // muon system: tube + disks 287 Double_t muonSystem_radius = innerBarrelRadius + contingency_; 288 Double_t muonSystem_length = innerBarrelLength + contingency_; 289 Double_t muonSystem_rmin = muonSystem_length*2.*exp(-muonSystem_etamax_[name])/(1-exp(-2.*muonSystem_etamax_[name])); 290 TGeoVolume *muon_barrel = geom_->MakeTube(Form("%s_barrel",name),mudetmed_,muonSystem_radius,muonSystem_radius+muonSystem_thickn_,muonSystem_length); 291 muon_barrel->SetLineColor(kBlue); 292 top->AddNode(muon_barrel,1); 293 TGeoVolume *muon_endcap = geom_->MakeTube(Form("%s_endcap",name),mudetmed_,muonSystem_rmin,muonSystem_radius+muonSystem_thickn_,muonSystem_thickn_/2.); 294 muon_endcap->SetLineColor(kBlue); 295 TGeoTranslation *trm1 = new TGeoTranslation(Form("%sEndcap1_position",name),0.,0.,muonSystem_length); 296 trm1->RegisterYourself(); 297 TGeoTranslation *trm2 = new TGeoTranslation(Form("%sEndcap2_position",name),0.,0.,-muonSystem_length); 298 trm1->RegisterYourself(); 299 top->AddNode(muon_endcap,1,trm1); 300 top->AddNode(muon_endcap,2,trm2); 301 return std::make_pair(muonSystem_radius,muonSystem_length); 302 } 303 304 void Delphes3DGeometry::addCaloTowers(TGeoVolume *top, const char* name, 305 Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) { 306 307 TGeoVolume* calo_endcap = top->GetNode(Form("%s_endcap_1",name))->GetVolume(); 308 TGeoVolume* calo_barrel = top->GetNode(Form("%s_barrel_1",name))->GetVolume(); 309 Double_t calo_endcap_etamin = -log(innerBarrelRadius/(2*innerBarrelLength)); 310 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_); 311 312 // calo towers in the barrel 313 Double_t vertices[16] = {0.,0.,0.,0.,0.,0.,0.,0.}; // summit of the pyramid 314 Double_t R = tk_radius_ + contingency_+(contingency_+calo_barrel_thickness_)*calorimeters_.size(); // radius of the muons system = height of the pyramid 315 Int_t nEtaBins = caloBinning.size(); 316 // this rotation is to make the tower point "up" 317 TGeoRotation* initTowerRot = new TGeoRotation(Form("%s_initTowerRot",name),0.,90.,0.); 318 TGeoCombiTrans* initTower = new TGeoCombiTrans(Form("%s_initTower",name),0.,-R/2.,0.,initTowerRot); 319 initTower->RegisterYourself(); 320 // eta bins... we build one pyramid per eta slice and then translate it nphi times. 321 // phi bins represented by rotations around z 322 Double_t *y = new Double_t[nEtaBins]; 323 Double_t *dx = new Double_t[nEtaBins]; 324 Int_t *nphi = new Int_t[nEtaBins]; 325 Int_t etaslice = 0; 326 std::map<std::pair<int,int>, TGeoRotation*> phirotations; 327 for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) { 328 if(abs(bin->first)>calo_endcap_etamin) continue; // only in the barrel 329 nphi[etaslice] = bin->second; 330 y[etaslice] = 0.5*R*(1-exp(-2*bin->first))/exp(-bin->first); 331 Double_t phiRotationAngle = 360./nphi[etaslice]; 332 dx[etaslice] = R*tan(TMath::Pi()*phiRotationAngle/360.); 333 for(int phislice=0;phislice<nphi[etaslice];++phislice) { 334 phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.); 335 phirotations[make_pair(etaslice,phislice)]->RegisterYourself(); 336 } 337 ++etaslice; 338 } 339 nEtaBins = etaslice; 340 for(int i=0;i<nEtaBins-1;++i) { // loop on the eta slices 341 vertices[8] = -dx[i]; vertices[9] = y[i]; 342 vertices[10] = -dx[i]; vertices[11] = y[i+1]; 343 vertices[12] = dx[i]; vertices[13] = y[i+1]; 344 vertices[14] = dx[i]; vertices[15] = y[i]; 345 new TGeoArb8(Form("%s_tower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0 346 // intersection between the tower and the calo_barrel 347 TGeoCompositeShape *finaltower_cs = new TGeoCompositeShape(Form("%s_ftower%d_cs",name,i),Form("%s_tower%d:%s_initTower*%s_barrel_cs",name,i,name,name)); 348 TGeoVolume *finaltower = new TGeoVolume(Form("%s_ftower%d",name,i),finaltower_cs,calomed_); 349 finaltower->SetLineColor(kRed); 350 for(int j=0;j<nphi[i];++j) { // loop on the phi slices 351 calo_barrel->AddNode(finaltower,j,phirotations[make_pair(i,j)]); 352 } 353 } 354 delete[] y; 355 delete[] dx; 356 delete[] nphi; 357 //the towers in the forward region 358 R = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size(); // Z of the muons system = height of the pyramid 359 nEtaBins = caloBinning.size(); 360 // translation to bring the origin of the tower to (0,0,0) (well, not really as the endcap is not yet in place) 361 TGeoTranslation* towerdz = new TGeoTranslation(Form("%s_towerdz",name),0.,0.,R/2.-(innerBarrelLength+calo_endcap_coneThickness/2.)); 362 towerdz->RegisterYourself(); 363 // eta bins... we build one pyramid per eta slice and then translate it nphi times. 364 Double_t *r = new Double_t[nEtaBins]; 365 nphi = new Int_t[nEtaBins]; 366 etaslice = 0; 367 phirotations.clear(); 368 for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) { 369 if(bin->first<calo_endcap_etamin) continue; // only in the + endcap 370 r[etaslice] = R*2*exp(-bin->first)/(1-exp(-2*bin->first)); 371 nphi[etaslice] = bin->second; 372 Double_t phiRotationAngle = 360./nphi[etaslice]; 373 for(int phislice=0;phislice<nphi[etaslice];++phislice) { 374 phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_forward_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.); 375 phirotations[make_pair(etaslice,phislice)]->RegisterYourself(); 376 } 377 ++etaslice; 378 } 379 nEtaBins = etaslice; 380 for(int i=0;i<nEtaBins-1;++i) { // loop on the eta slices 381 vertices[8] = -r[i+1]*sin(TMath::Pi()/nphi[i]); vertices[9] = r[i+1]*cos(TMath::Pi()/nphi[i]); 382 vertices[10] = -r[i]*sin(TMath::Pi()/nphi[i]); vertices[11] = r[i]*cos(TMath::Pi()/nphi[i]); 383 vertices[12] = r[i]*sin(TMath::Pi()/nphi[i]); vertices[13] = r[i]*cos(TMath::Pi()/nphi[i]); 384 vertices[14] = r[i+1]*sin(TMath::Pi()/nphi[i]); vertices[15] = r[i+1]*cos(TMath::Pi()/nphi[i]); 385 new TGeoArb8(Form("%sfwdtower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0 386 // intersection between the tower and the calo_endcap 387 TGeoCompositeShape *finalfwdtower_cs = new TGeoCompositeShape(Form("%sffwdtower%d_cs",name,i),Form("%sfwdtower%d:%s_towerdz*%s_endcap_cs",name,i,name,name)); 388 TGeoVolume *finalfwdtower = new TGeoVolume(Form("%sffwdtower%d",name,i),finalfwdtower_cs,calomed_); 389 finalfwdtower->SetLineColor(kViolet); 390 for(int j=0;j<nphi[i];++j) { // loop on the phi slices 391 calo_endcap->AddNode(finalfwdtower,j,phirotations[make_pair(i,j)]); 392 } 393 } 394 delete[] r; 395 delete[] nphi; 396 } 397 -
display/Delphes3DGeometry.h
r0e7d64a re39abb4 20 20 #define Delphes3DGeometry_h 21 21 22 #include <set> 22 23 #include <map> 23 #include <set>24 24 #include <vector> 25 25 … … 33 33 // TODO: asymmetric detector 34 34 35 class Delphes3DGeometry 36 { 37 public: 38 Delphes3DGeometry(TGeoManager *geom = NULL, bool transp = false); 39 ~Delphes3DGeometry() {} 35 class Delphes3DGeometry { 36 public: 37 Delphes3DGeometry(TGeoManager *geom = NULL, bool transp = false); 38 ~Delphes3DGeometry() {} 40 39 41 void readFile(const char *filename, const char *ParticlePropagator ="ParticlePropagator",42 const char *TrackingEfficiency ="ChargedHadronTrackingEfficiency",43 const char *MuonEfficiency ="MuonEfficiency",44 const char *Calorimeters ="Calorimeter");40 void readFile(const char *filename, const char *ParticlePropagator="ParticlePropagator", 41 const char *TrackingEfficiency="ChargedHadronTrackingEfficiency", 42 const char *MuonEfficiency="MuonEfficiency", 43 const char *Calorimeters="Calorimeter"); 45 44 46 void setContingency(Double_t contingency) { contingency_ = contingency; }47 void setCaloBarrelThickness(Double_t thickness) { calo_barrel_thickness_ = thickness; }48 void setCaloEndcapThickness(Double_t thickness) { calo_endcap_thickness_ = thickness; }49 void setMuonSystemThickness(Double_t thickness) { muonSystem_thickn_ = thickness; }45 void setContingency(Double_t contingency) { contingency_ = contingency; } 46 void setCaloBarrelThickness(Double_t thickness) { calo_barrel_thickness_ = thickness; } 47 void setCaloEndcapThickness(Double_t thickness) { calo_endcap_thickness_ = thickness; } 48 void setMuonSystemThickness(Double_t thickness) { muonSystem_thickn_ = thickness; } 50 49 51 TGeoVolume *getDetector(bool withTowers = true);50 TGeoVolume *getDetector(bool withTowers = true); 52 51 53 Double_t getTrackerRadius() const { return tk_radius_; }54 Double_t getDetectorRadius() const { return muonSystem_radius_; }55 Double_t getTrackerHalfLength() const { return tk_length_; }56 Double_t getDetectorHalfLength() const { return muonSystem_length_; }57 Double_t getBField() const { return tk_Bz_; }58 std::pair<TAxis *, TAxis *> getCaloAxes() { return std::make_pair(etaAxis_,phiAxis_); }52 Double_t getTrackerRadius() const { return tk_radius_; } 53 Double_t getDetectorRadius() const { return muonSystem_radius_; } 54 Double_t getTrackerHalfLength() const { return tk_length_; } 55 Double_t getDetectorHalfLength() const { return muonSystem_length_; } 56 Double_t getBField() const { return tk_Bz_; } 57 std::pair<TAxis*, TAxis*> getCaloAxes() { return std::make_pair(etaAxis_,phiAxis_); } 59 58 60 private:61 std::pair<Double_t, Double_t> addTracker(TGeoVolume *top);62 std::pair<Double_t, Double_t> addCalorimeter(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set<std::pair<Double_t, Int_t> > &caloBinning);63 std::pair<Double_t, Double_t> addMuonDets(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength);64 void addCaloTowers(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set<std::pair<Double_t, Int_t> > &caloBinning);59 private: 60 std::pair<Double_t, Double_t> addTracker(TGeoVolume *top); 61 std::pair<Double_t, Double_t> addCalorimeter(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning); 62 std::pair<Double_t, Double_t> addMuonDets(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength); 63 void addCaloTowers(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning); 65 64 66 private: 67 TGeoManager *geom_; 65 private: 68 66 69 TGeoMedium *vacuum_; 70 TGeoMedium *tkmed_; 71 TGeoMedium *calomed_; 72 TGeoMedium *mudetmed_; 67 TGeoManager *geom_; 73 68 74 TAxis *etaAxis_; 75 TAxis *phiAxis_; 69 TGeoMedium *vacuum_; 70 TGeoMedium *tkmed_; 71 TGeoMedium *calomed_; 72 TGeoMedium *mudetmed_; 76 73 77 Double_t contingency_; 78 Double_t calo_barrel_thickness_; 79 Double_t calo_endcap_thickness_; 80 Double_t muonSystem_thickn_; 81 Double_t muonSystem_radius_; 82 Double_t muonSystem_length_; 83 Double_t tk_radius_; 84 Double_t tk_length_; 85 Double_t tk_etamax_; 86 Double_t tk_Bz_; 74 TAxis *etaAxis_; 75 TAxis *phiAxis_; 87 76 88 std::vector<std::string> calorimeters_; 89 std::vector<std::string> muondets_; 77 Double_t contingency_; 78 Double_t calo_barrel_thickness_; 79 Double_t calo_endcap_thickness_; 80 Double_t muonSystem_thickn_; 81 Double_t muonSystem_radius_; 82 Double_t muonSystem_length_; 83 Double_t tk_radius_; 84 Double_t tk_length_; 85 Double_t tk_etamax_; 86 Double_t tk_Bz_; 90 87 91 std::map<std::string, Double_t> muonSystem_etamax_; 92 std::map<std::string, std::set<std::pair<Double_t, Int_t> > > caloBinning_; 88 std::vector<std::string> calorimeters_; 89 std::vector<std::string> muondets_; 90 91 std::map<std::string, Double_t> muonSystem_etamax_; 92 std::map<std::string, std::set< std::pair<Double_t, Int_t> > > caloBinning_; 93 93 94 }; 94 95 -
display/DelphesBranchElement.cc
r0e7d64a re39abb4 18 18 19 19 #include "display/DelphesBranchElement.h" 20 #include " TEveArrow.h"20 #include "classes/DelphesClasses.h" 21 21 #include "TEveJetCone.h" 22 22 #include "TEveTrack.h" 23 23 #include "TEveTrackPropagator.h" 24 #include "TEveArrow.h" 24 25 #include "TEveVector.h" 25 #include "classes/DelphesClasses.h"26 26 #include <iostream> 27 27 28 28 // special case for calo towers 29 template <> 30 DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt) : 31 DelphesBranchBase(name, branch, color, maxPt) 32 { 33 data_ = new DelphesCaloData(2); 34 data_->RefSliceInfo(0).Setup("ECAL", 0.1, kRed); 35 data_->RefSliceInfo(1).Setup("HCAL", 0.1, kBlue); 36 data_->IncDenyDestroy(); 37 } 38 template <> 39 void DelphesBranchElement<DelphesCaloData>::Reset() { data_->ClearTowers(); } 40 template <> 41 void DelphesBranchElement<DelphesCaloData>::ReadBranch() 42 { 43 if(TString(GetType()) == "Tower") 44 { 29 template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt):DelphesBranchBase(name, branch, color, maxPt) { 30 data_ = new DelphesCaloData(2); 31 data_->RefSliceInfo(0).Setup("ECAL", 0.1, kRed); 32 data_->RefSliceInfo(1).Setup("HCAL", 0.1, kBlue); 33 data_->IncDenyDestroy(); 34 } 35 template<> void DelphesBranchElement<DelphesCaloData>::Reset() { data_->ClearTowers(); } 36 template<> void DelphesBranchElement<DelphesCaloData>::ReadBranch() { 37 if(TString(GetType())=="Tower") { 45 38 // Loop over all towers 46 39 TIter itTower(branch_); 47 40 Tower *tower; 48 while((tower = (Tower *)itTower.Next())) 49 { 41 while((tower = (Tower *) itTower.Next())) { 50 42 data_->AddTower(tower->Edges[0], tower->Edges[1], tower->Edges[2], tower->Edges[3]); 51 43 data_->FillSlice(0, tower->Eem); … … 55 47 } 56 48 } 57 template <> 58 std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors() 59 { 49 template<> std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors() { 60 50 std::vector<TLorentzVector> output; 61 if(TString(GetType()) == "Tower") 62 { 51 if(TString(GetType())=="Tower") { 63 52 TIter itTower(branch_); 64 53 Tower *tower; 65 while((tower = (Tower *)itTower.Next())) 66 { 54 while((tower = (Tower *) itTower.Next())) { 67 55 TLorentzVector v; 68 v.SetPtEtaPhiM(tower->Eem + tower->Ehad, (tower->Edges[0] + tower->Edges[1]) / 2., (tower->Edges[2] + tower->Edges[3]) / 2.,0.);56 v.SetPtEtaPhiM(tower->Eem+tower->Ehad,(tower->Edges[0]+tower->Edges[1])/2.,(tower->Edges[2]+tower->Edges[3])/2.,0.); 69 57 output.push_back(v); 70 58 } … … 74 62 75 63 // special case for element lists 76 template <> 77 DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt) : 78 DelphesBranchBase(name, branch, color, maxPt) 79 { 80 data_ = new TEveElementList(name); 81 data_->SetMainColor(color_); 82 } 83 template <> 84 void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); } 85 template <> 86 void DelphesBranchElement<TEveElementList>::ReadBranch() 87 { 88 if(TString(GetType()) == "Jet") 89 { 64 template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt):DelphesBranchBase(name, branch, color, maxPt) { 65 data_ = new TEveElementList(name); 66 data_->SetMainColor(color_); 67 } 68 template<> void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); } 69 template<> void DelphesBranchElement<TEveElementList>::ReadBranch() { 70 if(TString(GetType())=="Jet") { 90 71 TIter itJet(branch_); 91 72 Jet *jet; … … 93 74 // Loop over all jets 94 75 Int_t counter = 0; 95 while((jet = (Jet *)itJet.Next())) 96 { 76 while((jet = (Jet *) itJet.Next())) { 97 77 eveJetCone = new TEveJetCone(); 98 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f", counter,jet->PT, jet->Eta, jet->Phi, jet->Mass));78 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f",counter,jet->PT, jet->Eta, jet->Phi, jet->Mass)); 99 79 eveJetCone->SetName(Form("jet [%d]", counter++)); 100 80 eveJetCone->SetMainTransparency(60); … … 106 86 data_->AddElement(eveJetCone); 107 87 } 108 } 109 else if(TString(GetType()) == "MissingET") 110 { 88 } else if(TString(GetType())=="MissingET") { 111 89 // MissingET as invisible track (like a photon) 112 90 MissingET *MET; … … 116 94 trkProp->SetMaxR(tkRadius_); 117 95 trkProp->SetMaxZ(tkHalfLength_); 118 if(branch_->GetEntriesFast() > 0) 119 { 120 MET = (MissingET *)branch_->At(0); 96 if(branch_->GetEntriesFast() > 0) { 97 MET = (MissingET*) branch_->At(0); 121 98 TParticle pb(13, 1, 0, 0, 0, 0, 122 (tkRadius_ * MET->MET / maxPt_) *cos(MET->Phi),123 (tkRadius_ * MET->MET / maxPt_) *sin(MET->Phi),124 0., MET->MET, 0.0, 0.0, 0.0, 0.0);99 (tkRadius_ * MET->MET/maxPt_)*cos(MET->Phi), 100 (tkRadius_ * MET->MET/maxPt_)*sin(MET->Phi), 101 0., MET->MET, 0.0, 0.0, 0.0, 0.0); 125 102 eveMet = new TEveTrack(&pb, 0, trkProp); 126 103 eveMet->SetName("Missing Et"); … … 138 115 } 139 116 } 140 template <> 141 std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors() 142 { 117 template<> std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors() { 143 118 std::vector<TLorentzVector> output; 144 if(TString(GetType()) == "Jet") 145 { 119 if(TString(GetType())=="Jet") { 146 120 TIter itJet(branch_); 147 121 Jet *jet; 148 122 // Loop over all jets 149 while((jet = (Jet *)itJet.Next())) 150 { 123 while((jet = (Jet *) itJet.Next())) { 151 124 TLorentzVector v; 152 125 v.SetPtEtaPhiM(jet->PT, jet->Eta, jet->Phi, jet->Mass); 153 126 output.push_back(v); 154 127 } 155 } 156 else if(TString(GetType()) == "MissingET") 157 { 128 } else if(TString(GetType())=="MissingET") { 158 129 TIter itMet(branch_); 159 130 MissingET *MET; 160 131 // Missing Et 161 while((MET = (MissingET *)itMet.Next())) 162 { 132 while((MET = (MissingET*) itMet.Next())) { 163 133 TLorentzVector v; 164 v.SetPtEtaPhiM(MET->MET, MET->Eta, MET->Phi,0.);134 v.SetPtEtaPhiM(MET->MET,MET->Eta,MET->Phi,0.); 165 135 output.push_back(v); 166 136 } … … 170 140 171 141 // special case for track lists 172 template <> 173 DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt) : 174 DelphesBranchBase(name, branch, color, maxPt) 175 { 142 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt):DelphesBranchBase(name, branch, color, maxPt) { 176 143 data_ = new TEveTrackList(name); 177 144 data_->SetMainColor(color_); … … 180 147 data_->SetMarkerSize(0.5); 181 148 } 182 template <> 183 void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz) 184 { 185 tkRadius_ = r; 149 template<> void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz) { 150 tkRadius_ = r; 186 151 tkHalfLength_ = l; 187 152 tk_Bz_ = Bz; … … 191 156 trkProp->SetMaxZ(tkHalfLength_); 192 157 } 193 template <> 194 void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); } 195 template <> 196 void DelphesBranchElement<TEveTrackList>::ReadBranch() 197 { 158 template<> void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); } 159 template<> void DelphesBranchElement<TEveTrackList>::ReadBranch() { 198 160 TString type = GetType(); 199 161 TIter itTrack(branch_); … … 205 167 trkProp->SetMaxZ(tkHalfLength_); 206 168 GenParticle *particle; 207 if(type == "Track") 208 { // CASE 1: TRACKS 169 if(type=="Track") { // CASE 1: TRACKS 209 170 Track *track; 210 while((track = (Track *)itTrack.Next())) 211 { 171 while((track = (Track *) itTrack.Next())) { 212 172 TParticle pb(track->PID, 1, 0, 0, 0, 0, 213 track->P4().Px(), track->P4().Py(), 214 track->P4().Pz(), track->P4().E(), 215 track->X / 10.0, track->Y / 10.0, track->Z / 10.0, track->T / 10.0); 216 eveTrack = new TEveTrack(&pb, counter, trkProp); 217 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 218 eveTrack->SetStdTitle(); 219 eveTrack->SetAttLineAttMarker(data_); 220 data_->AddElement(eveTrack); 221 eveTrack->SetLineColor(GetColor()); 222 eveTrack->MakeTrack(); 223 } 224 } 225 else if(type == "Electron") 226 { // CASE 2: ELECTRONS 173 track->P4().Px(), track->P4().Py(), 174 track->P4().Pz(), track->P4().E(), 175 track->X/10.0, track->Y/10.0, track->Z/10.0, track->T/10.0); 176 eveTrack = new TEveTrack(&pb, counter, trkProp); 177 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 178 eveTrack->SetStdTitle(); 179 eveTrack->SetAttLineAttMarker(data_); 180 data_->AddElement(eveTrack); 181 eveTrack->SetLineColor(GetColor()); 182 eveTrack->MakeTrack(); 183 } 184 } else if(type=="Electron") { // CASE 2: ELECTRONS 227 185 Electron *electron; 228 while((electron = (Electron *)itTrack.Next())) 229 { 230 particle = (GenParticle *)electron->Particle.GetObject(); 231 TParticle pb(electron->Charge < 0 ? 11 : -11, 1, 0, 0, 0, 0, 232 electron->P4().Px(), electron->P4().Py(), 233 electron->P4().Pz(), electron->P4().E(), 234 particle->X / 10.0, particle->Y / 10.0, particle->Z / 10.0, particle->T / 10.0); 235 eveTrack = new TEveTrack(&pb, counter, trkProp); 236 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 237 eveTrack->SetStdTitle(); 238 eveTrack->SetAttLineAttMarker(data_); 239 data_->AddElement(eveTrack); 240 eveTrack->SetLineColor(GetColor()); 241 eveTrack->MakeTrack(); 242 } 243 } 244 else if(type == "Muon") 245 { // CASE 3: MUONS 186 while((electron = (Electron *) itTrack.Next())) { 187 particle = (GenParticle*) electron->Particle.GetObject(); 188 TParticle pb(electron->Charge<0?11:-11, 1, 0, 0, 0, 0, 189 electron->P4().Px(), electron->P4().Py(), 190 electron->P4().Pz(), electron->P4().E(), 191 particle->X/10.0, particle->Y/10.0, particle->Z/10.0, particle->T/10.0); 192 eveTrack = new TEveTrack(&pb, counter, trkProp); 193 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 194 eveTrack->SetStdTitle(); 195 eveTrack->SetAttLineAttMarker(data_); 196 data_->AddElement(eveTrack); 197 eveTrack->SetLineColor(GetColor()); 198 eveTrack->MakeTrack(); 199 } 200 } else if(type=="Muon") { // CASE 3: MUONS 246 201 Muon *muon; 247 while((muon = (Muon *)itTrack.Next())) 248 { 249 particle = (GenParticle *)muon->Particle.GetObject(); 250 TParticle pb(muon->Charge < 0 ? 13 : -13, 1, 0, 0, 0, 0, 251 muon->P4().Px(), muon->P4().Py(), 252 muon->P4().Pz(), muon->P4().E(), 253 particle->X / 10.0, particle->Y / 10.0, particle->Z / 10.0, particle->T / 10.0); 254 eveTrack = new TEveTrack(&pb, counter, trkProp); 255 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 256 eveTrack->SetStdTitle(); 257 eveTrack->SetAttLineAttMarker(data_); 258 data_->AddElement(eveTrack); 259 eveTrack->SetLineColor(GetColor()); 260 eveTrack->MakeTrack(); 261 } 262 } 263 else if(type == "Photon") 264 { // CASE 4: PHOTONS 202 while((muon = (Muon *) itTrack.Next())) { 203 particle = (GenParticle*) muon->Particle.GetObject(); 204 TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0, 205 muon->P4().Px(), muon->P4().Py(), 206 muon->P4().Pz(), muon->P4().E(), 207 particle->X/10.0, particle->Y/10.0, particle->Z/10.0, particle->T/10.0); 208 eveTrack = new TEveTrack(&pb, counter, trkProp); 209 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 210 eveTrack->SetStdTitle(); 211 eveTrack->SetAttLineAttMarker(data_); 212 data_->AddElement(eveTrack); 213 eveTrack->SetLineColor(GetColor()); 214 eveTrack->MakeTrack(); 215 } 216 } else if(type=="Photon") { // CASE 4: PHOTONS 265 217 Photon *photon; 266 while((photon = (Photon *)itTrack.Next())) 267 { 218 while((photon = (Photon *) itTrack.Next())) { 268 219 TParticle pb(22, 1, 0, 0, 0, 0, 269 photon->P4().Px(), photon->P4().Py(),270 photon->P4().Pz(), photon->P4().E(),271 0.0, 0.0, 0.0, 0.0);220 photon->P4().Px(), photon->P4().Py(), 221 photon->P4().Pz(), photon->P4().E(), 222 0.0, 0.0, 0.0, 0.0); 272 223 eveTrack = new TEveTrack(&pb, counter, trkProp); 273 224 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); … … 279 230 eveTrack->MakeTrack(); 280 231 } 281 } 282 else if(type == "GenParticle") 283 { // CASE 5: GENPARTICLES 232 } else if(type=="GenParticle") { // CASE 5: GENPARTICLES 284 233 GenParticle *particle; 285 while((particle = (GenParticle *)itTrack.Next())) 286 { 234 while((particle = (GenParticle *) itTrack.Next())) { 287 235 if(particle->Status != 1) continue; 288 236 TParticle pb(particle->PID, particle->Status, particle->M1, particle->M2, particle->D1, particle->D2, 289 particle->P4().Px(), particle->P4().Py(), 290 particle->P4().Pz(), particle->P4().E(), 291 particle->X / 10.0, particle->Y / 10.0, particle->Z / 10.0, particle->T / 10.0); 292 eveTrack = new TEveTrack(&pb, counter, trkProp); 293 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 294 eveTrack->SetStdTitle(); 295 eveTrack->SetAttLineAttMarker(data_); 296 data_->AddElement(eveTrack); 297 eveTrack->SetLineColor(GetColor()); 298 if(particle->Charge == 0) eveTrack->SetLineStyle(7); 299 eveTrack->MakeTrack(); 300 } 301 } 302 } 303 template <> 304 std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors() 305 { 237 particle->P4().Px(), particle->P4().Py(), 238 particle->P4().Pz(), particle->P4().E(), 239 particle->X/10.0, particle->Y/10.0, particle->Z/10.0, particle->T/10.0); 240 eveTrack = new TEveTrack(&pb, counter, trkProp); 241 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 242 eveTrack->SetStdTitle(); 243 eveTrack->SetAttLineAttMarker(data_); 244 data_->AddElement(eveTrack); 245 eveTrack->SetLineColor(GetColor()); 246 if(particle->Charge==0) eveTrack->SetLineStyle(7); 247 eveTrack->MakeTrack(); 248 } 249 } 250 } 251 template<> std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors() { 306 252 std::vector<TLorentzVector> output; 307 253 TString type = GetType(); 308 254 TIter itTrack(branch_); 309 if(type == "Track") 310 { // CASE 1: TRACKS 255 if(type=="Track") { // CASE 1: TRACKS 311 256 Track *track; 312 while((track = (Track *)itTrack.Next())) 313 { 257 while((track = (Track *) itTrack.Next())) { 314 258 output.push_back(track->P4()); 315 259 } 316 } 317 else if(type == "Electron") 318 { // CASE 2: ELECTRONS 260 } else if(type=="Electron") { // CASE 2: ELECTRONS 319 261 Electron *electron; 320 while((electron = (Electron *)itTrack.Next())) 321 { 262 while((electron = (Electron *) itTrack.Next())) { 322 263 output.push_back(electron->P4()); 323 264 } 324 } 325 else if(type == "Muon") 326 { // CASE 3: MUONS 265 } else if(type=="Muon") { // CASE 3: MUONS 327 266 Muon *muon; 328 while((muon = (Muon *)itTrack.Next())) 329 { 267 while((muon = (Muon *) itTrack.Next())) { 330 268 output.push_back(muon->P4()); 331 269 } 332 } 333 else if(type == "Photon") 334 { // CASE 4: PHOTONS 270 } else if(type=="Photon") { // CASE 4: PHOTONS 335 271 Photon *photon; 336 while((photon = (Photon *)itTrack.Next())) 337 { 272 while((photon = (Photon *) itTrack.Next())) { 338 273 output.push_back(photon->P4()); 339 274 } 340 } 341 else if(type == "GenParticle") 342 { // CASE 5: GENPARTICLES 275 } else if(type=="GenParticle") { // CASE 5: GENPARTICLES 343 276 GenParticle *particle; 344 while((particle = (GenParticle *)itTrack.Next())) 345 { 277 while((particle = (GenParticle *) itTrack.Next())) { 346 278 if(particle->Status != 1) continue; 347 output.push_back(particle->P4());279 output.push_back(particle->P4()); 348 280 } 349 281 } -
display/DelphesBranchElement.h
r0e7d64a re39abb4 20 20 #define DelphesBranchElement_h 21 21 22 #include "TColor.h" 23 #include "TString.h" 24 #include "TClonesArray.h" 22 25 #include "TClass.h" 23 #include "TClonesArray.h" 24 #include "TColor.h" 26 #include <exception> 27 #include <iostream> 28 #include "display/DelphesCaloData.h" 25 29 #include "TEveElement.h" 26 30 #include "TEveTrack.h" 27 #include "TString.h"28 #include "display/DelphesCaloData.h"29 #include <exception>30 #include <iostream>31 31 32 32 // virtual class to represent objects from a Delphes-tree branch 33 33 class DelphesBranchBase 34 34 { 35 public: 36 DelphesBranchBase(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) : 37 name_(name), maxPt_(maxPt), branch_(branch), color_(color) {} 38 virtual ~DelphesBranchBase() {} 39 const char *GetName() const { return (const char *)name_; } 40 const char *GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; } 41 virtual const char *GetClassName() = 0; 42 enum EColor GetColor() const { return color_; } 43 virtual void Reset() = 0; 44 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.) 45 { 46 tkRadius_ = r; 47 tkHalfLength_ = l; 48 tk_Bz_ = Bz; 49 } 50 virtual void ReadBranch() = 0; 51 virtual std::vector<TLorentzVector> GetVectors() = 0; 35 public: 36 DelphesBranchBase(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack, Float_t maxPt=50.):name_(name),maxPt_(maxPt),branch_(branch),color_(color) {} 37 virtual ~DelphesBranchBase() {} 38 const char* GetName() const { return (const char*)name_; } 39 const char* GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; } 40 virtual const char* GetClassName() = 0; 41 enum EColor GetColor() const { return color_; } 42 virtual void Reset() = 0; 43 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; } 44 virtual void ReadBranch() = 0; 45 virtual std::vector<TLorentzVector> GetVectors() = 0; 52 46 53 protected:54 TString name_;55 Float_t maxPt_;56 TClonesArray *branch_;57 const enum EColor color_;58 Float_t tkRadius_,tkHalfLength_, tk_Bz_;47 protected: 48 TString name_; 49 Float_t maxPt_; 50 TClonesArray* branch_; 51 const enum EColor color_; 52 Float_t tkRadius_,tkHalfLength_, tk_Bz_; 59 53 }; 60 54 61 55 // concrete implementations. EveContainer can be a TrackList, ElementList or CaloData. 62 template <typename EveContainer> 63 class DelphesBranchElement: public DelphesBranchBase 56 template<typename EveContainer> class DelphesBranchElement: public DelphesBranchBase 64 57 { 65 public: 66 // constructor 67 DelphesBranchElement(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) : 68 DelphesBranchBase(name, branch, color, maxPt) 69 { 70 throw std::exception(); 71 } 58 public: 59 // constructor 60 DelphesBranchElement(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack, Float_t maxPt=50.):DelphesBranchBase(name, branch, color, maxPt) { 61 throw std::exception(); 62 } 72 63 73 // destructor74 virtual ~DelphesBranchElement() { delete data_; }64 // destructor 65 virtual ~DelphesBranchElement() { delete data_; } 75 66 76 // get the container (ElementList, TrackList, or CaloData)77 EveContainer *GetContainer() { return data_; }67 // get the container (ElementList, TrackList, or CaloData) 68 EveContainer* GetContainer() { return data_; } 78 69 79 // tracking volume 80 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.) 81 { 82 tkRadius_ = r; 83 tkHalfLength_ = l; 84 tk_Bz_ = Bz; 85 } 70 // tracking volume 71 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; } 86 72 87 // resets the collection (before moving to the next event)88 virtual void Reset(){};73 // resets the collection (before moving to the next event) 74 virtual void Reset() {}; 89 75 90 // template class name91 virtual const char *GetClassName() { return data_->ClassName(); }76 // template class name 77 virtual const char* GetClassName() { return data_->ClassName(); } 92 78 93 // read the branch and fill elements for display94 virtual void ReadBranch() {}79 // read the branch and fill elements for display 80 virtual void ReadBranch() {} 95 81 96 // return the vector for all elements 97 virtual std::vector<TLorentzVector> GetVectors() 98 { 99 std::vector<TLorentzVector> v; 100 return v; 101 } 82 // return the vector for all elements 83 virtual std::vector<TLorentzVector> GetVectors() { std::vector<TLorentzVector> v; return v; } 102 84 103 private:104 EveContainer *data_;85 private: 86 EveContainer* data_; 105 87 }; 106 88 … … 108 90 109 91 // special case for calo towers 110 template <> 111 DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt); 112 template <> 113 void DelphesBranchElement<DelphesCaloData>::Reset(); 114 template <> 115 void DelphesBranchElement<DelphesCaloData>::ReadBranch(); 116 template <> 117 std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors(); 92 template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt); 93 template<> void DelphesBranchElement<DelphesCaloData>::Reset(); 94 template<> void DelphesBranchElement<DelphesCaloData>::ReadBranch(); 95 template<> std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors(); 118 96 119 97 // special case for element lists 120 template <> 121 DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt); 122 template <> 123 void DelphesBranchElement<TEveElementList>::Reset(); 124 template <> 125 void DelphesBranchElement<TEveElementList>::ReadBranch(); 126 template <> 127 std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors(); 98 template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt); 99 template<> void DelphesBranchElement<TEveElementList>::Reset(); 100 template<> void DelphesBranchElement<TEveElementList>::ReadBranch(); 101 template<> std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors(); 128 102 129 103 // special case for track lists 130 template <> 131 DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt); 132 template <> 133 void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz); 134 template <> 135 void DelphesBranchElement<TEveTrackList>::Reset(); 136 template <> 137 void DelphesBranchElement<TEveTrackList>::ReadBranch(); 138 template <> 139 std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors(); 104 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt); 105 template<> void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz); 106 template<> void DelphesBranchElement<TEveTrackList>::Reset(); 107 template<> void DelphesBranchElement<TEveTrackList>::ReadBranch(); 108 template<> std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors(); 140 109 141 110 #endif // CINT, CLING -
display/DelphesCaloData.cc
r0e7d64a re39abb4 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 19 20 #include "display/DelphesCaloData.h" … … 36 37 void DelphesCaloData::ClearTowers() 37 38 { 38 fGeomVec.clear();39 fGeomVec.clear(); 39 40 } 40 41 -
display/DelphesCaloData.h
r0e7d64a re39abb4 22 22 #include "TEveCaloData.h" 23 23 24 class DelphesCaloData: public TEveCaloDataVec 24 class DelphesCaloData: public TEveCaloDataVec 25 25 { 26 26 public: 27 27 28 DelphesCaloData(Int_t nslices); 28 29 … … 35 36 36 37 #endif /* DelphesCaloData_h */ 38 -
display/DelphesDisplay.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 #include "TEveBrowser.h" 19 20 20 #include "TEveManager.h" 21 #include "TEveProjectionAxes.h"22 #include "TEveProjectionManager.h"23 #include "TEveScene.h"24 21 #include "TEveViewer.h" 25 #include "TEveWindow.h"26 22 #include "TGLViewer.h" 27 23 #include "TGLWidget.h" 24 #include "TEveScene.h" 25 #include "TEveProjectionManager.h" 26 #include "TEveProjectionAxes.h" 27 #include "TEveBrowser.h" 28 #include "TEveWindow.h" 28 29 #include "TGTab.h" 29 30 30 31 #include "TEveCalo2DGL.h" 31 #include "TEveCalo3DGL.h" 32 #include "TEveCalo3DGL.h" 32 33 #include "TEveCaloLegoGL.h" 33 34 #include "TEveCaloLegoOverlay.h" … … 47 48 fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ); 48 49 49 50 50 fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry"); 51 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry"); 51 52 52 53 54 53 fRPhiCaloScene = gEve->SpawnNewScene("RPhi Calorimeter"); 54 fRhoZCaloScene = gEve->SpawnNewScene("RhoZ Calorimeter"); 55 fLegoCaloScene = gEve->SpawnNewScene("Lego Calorimeter"); 55 56 56 57 58 57 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data"); 58 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data"); 59 59 60 axes = new TEveProjectionAxes(fRPhiMgr); 60 61 fRPhiGeomScene->AddElement(axes); … … 84 85 f3DimView->AddScene(gEve->GetGlobalScene()); 85 86 f3DimView->AddScene(gEve->GetEventScene()); 86 87 87 88 pack1->NewSlot()->MakeCurrent(); 88 89 fLegoView = gEve->SpawnNewViewer("Lego View", ""); 89 90 fLegoView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); 90 91 fLegoView->AddScene(fLegoCaloScene); 91 92 92 93 pack0->NewSlot()->MakeCurrent(); 93 94 fRPhiView = gEve->SpawnNewViewer("RPhi View", ""); … … 96 97 fRPhiView->AddScene(fRPhiCaloScene); 97 98 fRPhiView->AddScene(fRPhiEventScene); 98 99 99 100 pack0->NewSlot()->MakeCurrent(); 100 101 fRhoZView = gEve->SpawnNewViewer("RhoZ View", ""); … … 113 114 //------------------------------------------------------------------------------ 114 115 115 void DelphesDisplay::ImportGeomRPhi(TEveElement *el)116 { 116 void DelphesDisplay::ImportGeomRPhi(TEveElement* el) 117 { 117 118 fRPhiMgr->ImportElements(el, fRPhiGeomScene); 118 119 } 119 120 120 void DelphesDisplay::ImportGeomRhoZ(TEveElement *el)121 { 121 void DelphesDisplay::ImportGeomRhoZ(TEveElement* el) 122 { 122 123 fRhoZMgr->ImportElements(el, fRhoZGeomScene); 123 124 } … … 136 137 { 137 138 TEveCaloLegoOverlay *overlay = new TEveCaloLegoOverlay(); 138 139 139 140 overlay->SetCaloLego(calo); 140 141 fLegoView->GetGLViewer()->AddOverlayElement(overlay); … … 143 144 } 144 145 145 void DelphesDisplay::ImportEventRPhi(TEveElement *el)146 { 146 void DelphesDisplay::ImportEventRPhi(TEveElement* el) 147 { 147 148 fRPhiMgr->ImportElements(el, fRPhiEventScene); 148 149 } 149 150 150 void DelphesDisplay::ImportEventRhoZ(TEveElement *el)151 { 151 void DelphesDisplay::ImportEventRhoZ(TEveElement* el) 152 { 152 153 fRhoZMgr->ImportElements(el, fRhoZEventScene); 153 154 } … … 165 166 } 166 167 //------------------------------------------------------------------------------ 168 -
display/DelphesDisplay.h
r0e7d64a re39abb4 30 30 { 31 31 public: 32 32 33 DelphesDisplay(); 33 34 34 35 virtual ~DelphesDisplay(); 35 36 36 void ImportGeomRPhi(TEveElement *el);37 void ImportGeomRhoZ(TEveElement *el);37 void ImportGeomRPhi(TEveElement* el); 38 void ImportGeomRhoZ(TEveElement* el); 38 39 39 40 void ImportCaloRPhi(TEveCalo3D *calo); … … 41 42 void ImportCaloLego(TEveCaloLego *calo); 42 43 43 void ImportEventRPhi(TEveElement *el);44 void ImportEventRhoZ(TEveElement *el);44 void ImportEventRPhi(TEveElement* el); 45 void ImportEventRhoZ(TEveElement* el); 45 46 46 47 void DestroyEventRPhi(); … … 48 49 49 50 private: 51 50 52 TEveProjectionManager *fRPhiMgr; 51 53 TEveProjectionManager *fRhoZMgr; … … 68 70 69 71 #endif /* DelphesDisplay_h */ 72 -
display/DelphesEventDisplay.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <algorithm>20 19 #include <cassert> 21 20 #include <iostream> 22 21 #include <utility> 23 24 #include "TAxis.h" 25 #include "TCanvas.h" 26 #include "TChain.h" 27 #include "TClonesArray.h" 28 #include "TEveArrow.h" 29 #include "TEveBrowser.h" 30 #include "TEveCalo.h" 22 #include <algorithm> 23 24 #include "TGeoManager.h" 25 #include "TGeoVolume.h" 31 26 #include "TEveElement.h" 32 #include "TEveEventManager.h"33 #include "TEveGeoNode.h"34 27 #include "TEveJetCone.h" 35 #include "TEveManager.h"36 28 #include "TEveTrack.h" 37 29 #include "TEveTrackPropagator.h" 30 #include "TEveCalo.h" 31 #include "TEveManager.h" 32 #include "TEveGeoNode.h" 38 33 #include "TEveTrans.h" 39 34 #include "TEveViewer.h" 35 #include "TEveBrowser.h" 36 #include "TEveArrow.h" 37 #include "TMath.h" 38 #include "TSystem.h" 39 #include "TRootBrowser.h" 40 40 #include "TGButton.h" 41 #include "TGTextEntry.h" 42 #include "TGProgressBar.h" 43 #include "TGNumberEntry.h" 44 #include "TRootEmbeddedCanvas.h" 45 #include "TClonesArray.h" 46 #include "TEveEventManager.h" 47 #include "TCanvas.h" 48 #include "TH1F.h" 49 #include "TAxis.h" 50 #include "TChain.h" 41 51 #include "TGHtml.h" 42 #include "TGNumberEntry.h"43 #include "TGProgressBar.h"44 52 #include "TGStatusBar.h" 45 #include "TGTextEntry.h" 46 #include "TGeoManager.h" 47 #include "TGeoVolume.h" 48 #include "TH1F.h" 49 #include "TMath.h" 50 #include "TRootBrowser.h" 51 #include "TRootEmbeddedCanvas.h" 52 #include "TSystem.h" 53 53 54 #include "display/DelphesCaloData.h" 55 #include "display/DelphesBranchElement.h" 54 56 #include "display/Delphes3DGeometry.h" 55 #include "display/DelphesBranchElement.h" 56 #include "display/DelphesCaloData.h" 57 #include "display/DelphesEventDisplay.h" 57 58 #include "display/DelphesDisplay.h" 58 #include "display/Delphes EventDisplay.h"59 #include "display/Delphes3DGeometry.h" 59 60 #include "display/DelphesHtmlSummary.h" 60 61 #include "display/DelphesPlotSummary.h" … … 66 67 DelphesEventDisplay::DelphesEventDisplay() 67 68 { 68 event_id_ = 0;69 tkRadius_ = 1.29;70 totRadius_ = 2.0;71 tkHalfLength_ = 3.0;72 muHalfLength_ = 6.0;73 bz_ = 3.8;74 chain_ = new TChain("Delphes");75 treeReader_ = 0;76 delphesDisplay_ = 0;77 etaAxis_ = 0;78 phiAxis_ = 0;69 event_id_ = 0; 70 tkRadius_ = 1.29; 71 totRadius_ = 2.0; 72 tkHalfLength_ = 3.0; 73 muHalfLength_ = 6.0; 74 bz_ = 3.8; 75 chain_ = new TChain("Delphes"); 76 treeReader_ = 0; 77 delphesDisplay_ = 0; 78 etaAxis_ = 0; 79 phiAxis_ = 0; 79 80 } 80 81 81 82 DelphesEventDisplay::~DelphesEventDisplay() 82 83 { 83 delete chain_;84 delete chain_; 84 85 } 85 86 86 87 void DelphesEventDisplay::EventChanged(Int_t e) 87 88 { 88 if(e != event_id_) 89 { 89 if( e!= event_id_ ) { 90 90 event_id_ = e; 91 Emit("EventChanged(Int_t)", 91 Emit("EventChanged(Int_t)",e); 92 92 load_event(); 93 93 } 94 94 } 95 95 96 DelphesEventDisplay::DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry &det3D) 97 { 98 event_id_ = 0; 99 tkRadius_ = 1.29; 100 totRadius_ = 2.0; 101 tkHalfLength_ = 3.0; 102 bz_ = 3.8; 103 chain_ = new TChain("Delphes"); 104 treeReader_ = 0; 105 delphesDisplay_ = 0; 106 107 // initialize the application 108 TEveManager::Create(kTRUE, "IV"); 109 fStatusBar_ = gEve->GetBrowser()->GetStatusBar(); 110 TGeoManager *geom = gGeoManager; 111 112 // build the detector 113 tkRadius_ = det3D.getTrackerRadius(); 114 totRadius_ = det3D.getDetectorRadius(); 115 tkHalfLength_ = det3D.getTrackerHalfLength(); 116 muHalfLength_ = det3D.getDetectorHalfLength(); 117 bz_ = det3D.getBField(); 118 etaAxis_ = det3D.getCaloAxes().first; 119 phiAxis_ = det3D.getCaloAxes().second; 120 TGeoVolume *top = det3D.getDetector(false); 121 geom->SetTopVolume(top); 122 TEveElementList *geometry = new TEveElementList("Geometry"); 123 TObjArray *nodes = top->GetNodes(); 124 TIter itNodes(nodes); 125 TGeoNode *nodeobj; 126 TEveGeoTopNode *node; 127 while((nodeobj = (TGeoNode *)itNodes.Next())) 128 { 129 node = new TEveGeoTopNode(gGeoManager, nodeobj); 130 node->UseNodeTrans(); 131 geometry->AddElement(node); 132 } 133 134 // Create chain of root trees 135 chain_->Add(inputFile); 136 137 // Create object of class ExRootTreeReader 138 fStatusBar_->SetText("Opening Delphes data file", 1); 139 gSystem->ProcessEvents(); 140 treeReader_ = new ExRootTreeReader(chain_); 141 142 // prepare data collections 143 readConfig(configFile, elements_); 144 for(std::vector<DelphesBranchBase *>::iterator element = elements_.begin(); element < elements_.end(); ++element) 145 { 146 DelphesBranchElement<TEveTrackList> *item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList> *>(*element); 147 DelphesBranchElement<TEveElementList> *item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList> *>(*element); 148 if(item_v1) gEve->AddElement(item_v1->GetContainer()); 149 if(item_v2) gEve->AddElement(item_v2->GetContainer()); 150 } 151 152 // viewers and scenes 153 delphesDisplay_ = new DelphesDisplay; 154 gEve->AddGlobalElement(geometry); 155 delphesDisplay_->ImportGeomRPhi(geometry); 156 delphesDisplay_->ImportGeomRhoZ(geometry); 157 // find the first calo data and use that to initialize the calo display 158 for(std::vector<DelphesBranchBase *>::iterator data = elements_.begin(); data < elements_.end(); ++data) 159 { 160 if(TString((*data)->GetType()) == "Tower") 161 { // we could also use GetClassName()=="DelphesCaloData" 162 DelphesCaloData *container = dynamic_cast<DelphesBranchElement<DelphesCaloData> *>((*data))->GetContainer(); 163 assert(container); 164 TEveCalo3D *calo3d = new TEveCalo3D(container); 165 calo3d->SetBarrelRadius(tkRadius_); 166 calo3d->SetEndCapPos(tkHalfLength_); 167 gEve->AddGlobalElement(calo3d); 168 delphesDisplay_->ImportCaloRPhi(calo3d); 169 delphesDisplay_->ImportCaloRhoZ(calo3d); 170 TEveCaloLego *lego = new TEveCaloLego(container); 171 lego->InitMainTrans(); 172 // lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi()); 173 lego->RefMainTrans().SetScale(100, 100, TMath::Pi()); 174 lego->SetAutoRebin(kFALSE); 175 lego->Set2DMode(TEveCaloLego::kValSizeOutline); 176 delphesDisplay_->ImportCaloLego(lego); 177 break; 178 } 179 } 180 181 // the GUI: control panel, summary tab 182 make_gui(); 183 184 //ready... 185 fStatusBar_->SetText("Ready.", 1); 186 gSystem->ProcessEvents(); 187 load_event(); 188 gEve->Redraw3D(kTRUE); 96 97 DelphesEventDisplay::DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D) 98 { 99 event_id_ = 0; 100 tkRadius_ = 1.29; 101 totRadius_ = 2.0; 102 tkHalfLength_ = 3.0; 103 bz_ = 3.8; 104 chain_ = new TChain("Delphes"); 105 treeReader_ = 0; 106 delphesDisplay_ = 0; 107 108 // initialize the application 109 TEveManager::Create(kTRUE, "IV"); 110 fStatusBar_ = gEve->GetBrowser()->GetStatusBar(); 111 TGeoManager *geom = gGeoManager; 112 113 // build the detector 114 tkRadius_ = det3D.getTrackerRadius(); 115 totRadius_ = det3D.getDetectorRadius(); 116 tkHalfLength_ = det3D.getTrackerHalfLength(); 117 muHalfLength_ = det3D.getDetectorHalfLength(); 118 bz_ = det3D.getBField(); 119 etaAxis_ = det3D.getCaloAxes().first; 120 phiAxis_ = det3D.getCaloAxes().second; 121 TGeoVolume *top = det3D.getDetector(false); 122 geom->SetTopVolume(top); 123 TEveElementList *geometry = new TEveElementList("Geometry"); 124 TObjArray *nodes = top->GetNodes(); 125 TIter itNodes(nodes); 126 TGeoNode *nodeobj; 127 TEveGeoTopNode *node; 128 while((nodeobj = (TGeoNode*)itNodes.Next())) { 129 node = new TEveGeoTopNode(gGeoManager,nodeobj); 130 node->UseNodeTrans(); 131 geometry->AddElement(node); 132 } 133 134 // Create chain of root trees 135 chain_->Add(inputFile); 136 137 // Create object of class ExRootTreeReader 138 fStatusBar_->SetText("Opening Delphes data file", 1); 139 gSystem->ProcessEvents(); 140 treeReader_ = new ExRootTreeReader(chain_); 141 142 // prepare data collections 143 readConfig(configFile, elements_); 144 for(std::vector<DelphesBranchBase *>::iterator element = elements_.begin(); element<elements_.end(); ++element) { 145 DelphesBranchElement<TEveTrackList> *item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element); 146 DelphesBranchElement<TEveElementList> *item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element); 147 if(item_v1) gEve->AddElement(item_v1->GetContainer()); 148 if(item_v2) gEve->AddElement(item_v2->GetContainer()); 149 } 150 151 // viewers and scenes 152 delphesDisplay_ = new DelphesDisplay; 153 gEve->AddGlobalElement(geometry); 154 delphesDisplay_->ImportGeomRPhi(geometry); 155 delphesDisplay_->ImportGeomRhoZ(geometry); 156 // find the first calo data and use that to initialize the calo display 157 for(std::vector<DelphesBranchBase *>::iterator data=elements_.begin();data<elements_.end();++data) { 158 if(TString((*data)->GetType())=="Tower") { // we could also use GetClassName()=="DelphesCaloData" 159 DelphesCaloData *container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer(); 160 assert(container); 161 TEveCalo3D *calo3d = new TEveCalo3D(container); 162 calo3d->SetBarrelRadius(tkRadius_); 163 calo3d->SetEndCapPos(tkHalfLength_); 164 gEve->AddGlobalElement(calo3d); 165 delphesDisplay_->ImportCaloRPhi(calo3d); 166 delphesDisplay_->ImportCaloRhoZ(calo3d); 167 TEveCaloLego *lego = new TEveCaloLego(container); 168 lego->InitMainTrans(); 169 // lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi()); 170 lego->RefMainTrans().SetScale(100, 100, TMath::Pi()); 171 lego->SetAutoRebin(kFALSE); 172 lego->Set2DMode(TEveCaloLego::kValSizeOutline); 173 delphesDisplay_->ImportCaloLego(lego); 174 break; 175 } 176 } 177 178 // the GUI: control panel, summary tab 179 make_gui(); 180 181 //ready... 182 fStatusBar_->SetText("Ready.", 1); 183 gSystem->ProcessEvents(); 184 load_event(); 185 gEve->Redraw3D(kTRUE); 186 189 187 } 190 188 191 189 // function that parses the config to extract the branches of interest and prepare containers 192 void DelphesEventDisplay::readConfig(const char *configFile, std::vector<DelphesBranchBase *> &elements) 193 { 194 ExRootConfReader *confReader = new ExRootConfReader; 195 confReader->ReadFile(configFile); 196 ExRootConfParam branches = confReader->GetParam("TreeWriter::Branch"); 197 Int_t nBranches = branches.GetSize() / 3; 198 DelphesBranchElement<TEveTrackList> *tlist; 199 DelphesBranchElement<DelphesCaloData> *clist; 200 DelphesBranchElement<TEveElementList> *elist; 201 // first loop with all but tracks 202 for(Int_t b = 0; b < nBranches; ++b) 203 { 204 TString input = branches[b * 3].GetString(); 205 TString name = branches[b * 3 + 1].GetString(); 206 TString className = branches[b * 3 + 2].GetString(); 207 if(className == "Tower") 208 { 209 if(input.Contains("eflow", TString::kIgnoreCase) || name.Contains("eflow", TString::kIgnoreCase)) continue; //no eflow 210 clist = new DelphesBranchElement<DelphesCaloData>(name, treeReader_->UseBranch(name), kBlack); 211 clist->GetContainer()->SetEtaBins(etaAxis_); 212 clist->GetContainer()->SetPhiBins(phiAxis_); 213 elements.push_back(clist); 214 } 215 else if(className == "Jet") 216 { 217 if(input.Contains("GenJetFinder")) 218 { 219 elist = new DelphesBranchElement<TEveElementList>(name, treeReader_->UseBranch(name), kCyan); 220 elist->GetContainer()->SetRnrSelf(false); 221 elist->GetContainer()->SetRnrChildren(false); 222 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 223 elements.push_back(elist); 190 void DelphesEventDisplay::readConfig(const char *configFile, std::vector<DelphesBranchBase*>& elements) { 191 ExRootConfReader *confReader = new ExRootConfReader; 192 confReader->ReadFile(configFile); 193 ExRootConfParam branches = confReader->GetParam("TreeWriter::Branch"); 194 Int_t nBranches = branches.GetSize()/3; 195 DelphesBranchElement<TEveTrackList> *tlist; 196 DelphesBranchElement<DelphesCaloData> *clist; 197 DelphesBranchElement<TEveElementList> *elist; 198 // first loop with all but tracks 199 for(Int_t b = 0; b<nBranches; ++b) { 200 TString input = branches[b*3].GetString(); 201 TString name = branches[b*3+1].GetString(); 202 TString className = branches[b*3+2].GetString(); 203 if(className=="Tower") { 204 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 205 clist = new DelphesBranchElement<DelphesCaloData>(name,treeReader_->UseBranch(name),kBlack); 206 clist->GetContainer()->SetEtaBins(etaAxis_); 207 clist->GetContainer()->SetPhiBins(phiAxis_); 208 elements.push_back(clist); 209 } else if(className=="Jet") { 210 if(input.Contains("GenJetFinder")) { 211 elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kCyan); 212 elist->GetContainer()->SetRnrSelf(false); 213 elist->GetContainer()->SetRnrChildren(false); 214 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 215 elements.push_back(elist); 216 } else { 217 elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kYellow); 218 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 219 elements.push_back(elist); 220 } 221 } else if(className=="Electron") { 222 tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kRed); 223 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 224 elements.push_back(tlist); 225 } else if(className=="Photon") { 226 tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kYellow); 227 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 228 elements.push_back(tlist); 229 } else if(className=="Muon") { 230 tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kGreen); 231 tlist->SetTrackingVolume(totRadius_, muHalfLength_, bz_); 232 elements.push_back(tlist); 233 } else if(className=="MissingET") { 234 elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kViolet); 235 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 236 elements.push_back(elist); 237 } else if(className=="GenParticle") { 238 tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kCyan); 239 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 240 tlist->GetContainer()->SetRnrSelf(false); 241 tlist->GetContainer()->SetRnrChildren(false); 242 elements.push_back(tlist); 243 } else { 244 continue; 245 } 246 } 247 // second loop for tracks 248 for(Int_t b = 0; b<nBranches; ++b) { 249 TString input = branches[b*3].GetString(); 250 TString name = branches[b*3+1].GetString(); 251 TString className = branches[b*3+2].GetString(); 252 if(className=="Track") { 253 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 254 tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kBlue); 255 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 256 elements.push_back(tlist); 257 } 258 } 259 } 260 261 void DelphesEventDisplay::load_event() 262 { 263 // Load event specified in global event_id_. 264 // The contents of previous event are removed. 265 266 // safety 267 if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return; 268 269 // message 270 fStatusBar_->SetText(Form("Loading event %d.", event_id_), 1); 271 gSystem->ProcessEvents(); 272 273 // clear the previous event 274 gEve->GetViewers()->DeleteAnnotations(); 275 for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) { 276 (*data)->Reset(); 277 } 278 279 // Load selected branches with data from specified event 280 treeReader_->ReadEntry(event_id_); 281 for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) { 282 (*data)->ReadBranch(); 283 } 284 285 // update display 286 TEveElement *top = (TEveElement*)gEve->GetCurrentEvent(); 287 delphesDisplay_->DestroyEventRPhi(); 288 delphesDisplay_->ImportEventRPhi(top); 289 delphesDisplay_->DestroyEventRhoZ(); 290 delphesDisplay_->ImportEventRhoZ(top); 291 update_html_summary(); 292 plotSummary_->FillEvent(); 293 plotSummary_->Draw(); 294 295 gEve->Redraw3D(kFALSE, kTRUE); 296 fStatusBar_->SetText(Form("Loaded event %d.", event_id_), 1); 297 gSystem->ProcessEvents(); 298 } 299 300 void DelphesEventDisplay::update_html_summary() 301 { 302 // Update summary of current event. 303 304 TEveElement::List_i i; 305 TEveElement::List_i j; 306 Int_t k; 307 TEveElement *el; 308 DelphesHtmlObjTable *table; 309 TEveEventManager *mgr = gEve ? gEve->GetCurrentEvent() : 0; 310 if (mgr) { 311 htmlSummary_->Clear("D"); 312 for (i=mgr->BeginChildren(); i!=mgr->EndChildren(); ++i) { 313 el = ((TEveElement*)(*i)); 314 if (el->IsA() == TEvePointSet::Class()) { 315 TEvePointSet *ps = (TEvePointSet *)el; 316 TString ename = ps->GetElementName(); 317 TString etitle = ps->GetElementTitle(); 318 if (ename.First('\'') != kNPOS) 319 ename.Remove(ename.First('\'')); 320 etitle.Remove(0, 2); 321 Int_t nel = atoi(etitle.Data()); 322 table = htmlSummary_->AddTable(ename, 0, nel); 323 } 324 else if (el->IsA() == TEveTrackList::Class()) { 325 TEveTrackList *tracks = (TEveTrackList *)el; 326 TString ename = tracks->GetElementName(); 327 if (ename.First('\'') != kNPOS) 328 ename.Remove(ename.First('\'')); 329 table = htmlSummary_->AddTable(ename.Data(), 5, 330 tracks->NumChildren(), kTRUE, "first"); 331 table->SetLabel(0, "Momentum"); 332 table->SetLabel(1, "P_t"); 333 table->SetLabel(2, "Phi"); 334 table->SetLabel(3, "Theta"); 335 table->SetLabel(4, "Eta"); 336 k=0; 337 for (j=tracks->BeginChildren(); j!=tracks->EndChildren(); ++j) { 338 Float_t p = ((TEveTrack*)(*j))->GetMomentum().Mag(); 339 table->SetValue(0, k, p); 340 Float_t pt = ((TEveTrack*)(*j))->GetMomentum().Perp(); 341 table->SetValue(1, k, pt); 342 Float_t phi = ((TEveTrack*)(*j))->GetMomentum().Phi(); 343 table->SetValue(2, k, phi); 344 Float_t theta = ((TEveTrack*)(*j))->GetMomentum().Theta(); 345 table->SetValue(3, k, theta); 346 Float_t eta = theta>0.0005 && theta<3.1413 ? ((TEveTrack*)(*j))->GetMomentum().Eta() : 1e10; 347 table->SetValue(4, k, eta); 348 ++k; 349 } 350 } 224 351 } 225 else 226 { 227 elist = new DelphesBranchElement<TEveElementList>(name, treeReader_->UseBranch(name), kYellow); 228 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 229 elements.push_back(elist); 230 } 231 } 232 else if(className == "Electron") 233 { 234 tlist = new DelphesBranchElement<TEveTrackList>(name, treeReader_->UseBranch(name), kRed); 235 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 236 elements.push_back(tlist); 237 } 238 else if(className == "Photon") 239 { 240 tlist = new DelphesBranchElement<TEveTrackList>(name, treeReader_->UseBranch(name), kYellow); 241 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 242 elements.push_back(tlist); 243 } 244 else if(className == "Muon") 245 { 246 tlist = new DelphesBranchElement<TEveTrackList>(name, treeReader_->UseBranch(name), kGreen); 247 tlist->SetTrackingVolume(totRadius_, muHalfLength_, bz_); 248 elements.push_back(tlist); 249 } 250 else if(className == "MissingET") 251 { 252 elist = new DelphesBranchElement<TEveElementList>(name, treeReader_->UseBranch(name), kViolet); 253 elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 254 elements.push_back(elist); 255 } 256 else if(className == "GenParticle") 257 { 258 tlist = new DelphesBranchElement<TEveTrackList>(name, treeReader_->UseBranch(name), kCyan); 259 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 260 tlist->GetContainer()->SetRnrSelf(false); 261 tlist->GetContainer()->SetRnrChildren(false); 262 elements.push_back(tlist); 263 } 264 else 265 { 266 continue; 267 } 268 } 269 // second loop for tracks 270 for(Int_t b = 0; b < nBranches; ++b) 271 { 272 TString input = branches[b * 3].GetString(); 273 TString name = branches[b * 3 + 1].GetString(); 274 TString className = branches[b * 3 + 2].GetString(); 275 if(className == "Track") 276 { 277 if(input.Contains("eflow", TString::kIgnoreCase) || name.Contains("eflow", TString::kIgnoreCase)) continue; //no eflow 278 tlist = new DelphesBranchElement<TEveTrackList>(name, treeReader_->UseBranch(name), kBlue); 279 tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_); 280 elements.push_back(tlist); 281 } 282 } 283 } 284 285 void DelphesEventDisplay::load_event() 286 { 287 // Load event specified in global event_id_. 288 // The contents of previous event are removed. 289 290 // safety 291 if(event_id_ >= treeReader_->GetEntries() || event_id_ < 0) return; 292 293 // message 294 fStatusBar_->SetText(Form("Loading event %d.", event_id_), 1); 295 gSystem->ProcessEvents(); 296 297 // clear the previous event 298 gEve->GetViewers()->DeleteAnnotations(); 299 for(std::vector<DelphesBranchBase *>::iterator data = elements_.begin(); data < elements_.end(); ++data) 300 { 301 (*data)->Reset(); 302 } 303 304 // Load selected branches with data from specified event 305 treeReader_->ReadEntry(event_id_); 306 for(std::vector<DelphesBranchBase *>::iterator data = elements_.begin(); data < elements_.end(); ++data) 307 { 308 (*data)->ReadBranch(); 309 } 310 311 // update display 312 TEveElement *top = (TEveElement *)gEve->GetCurrentEvent(); 313 delphesDisplay_->DestroyEventRPhi(); 314 delphesDisplay_->ImportEventRPhi(top); 315 delphesDisplay_->DestroyEventRhoZ(); 316 delphesDisplay_->ImportEventRhoZ(top); 317 update_html_summary(); 318 plotSummary_->FillEvent(); 319 plotSummary_->Draw(); 320 321 gEve->Redraw3D(kFALSE, kTRUE); 322 fStatusBar_->SetText(Form("Loaded event %d.", event_id_), 1); 323 gSystem->ProcessEvents(); 324 } 325 326 void DelphesEventDisplay::update_html_summary() 327 { 328 // Update summary of current event. 329 330 TEveElement::List_i i; 331 TEveElement::List_i j; 332 Int_t k; 333 TEveElement *el; 334 DelphesHtmlObjTable *table; 335 TEveEventManager *mgr = gEve ? gEve->GetCurrentEvent() : 0; 336 if(mgr) 337 { 338 htmlSummary_->Clear("D"); 339 for(i = mgr->BeginChildren(); i != mgr->EndChildren(); ++i) 340 { 341 el = ((TEveElement *)(*i)); 342 if(el->IsA() == TEvePointSet::Class()) 343 { 344 TEvePointSet *ps = (TEvePointSet *)el; 345 TString ename = ps->GetElementName(); 346 TString etitle = ps->GetElementTitle(); 347 if(ename.First('\'') != kNPOS) 348 ename.Remove(ename.First('\'')); 349 etitle.Remove(0, 2); 350 Int_t nel = atoi(etitle.Data()); 351 table = htmlSummary_->AddTable(ename, 0, nel); 352 } 353 else if(el->IsA() == TEveTrackList::Class()) 354 { 355 TEveTrackList *tracks = (TEveTrackList *)el; 356 TString ename = tracks->GetElementName(); 357 if(ename.First('\'') != kNPOS) 358 ename.Remove(ename.First('\'')); 359 table = htmlSummary_->AddTable(ename.Data(), 5, 360 tracks->NumChildren(), kTRUE, "first"); 361 table->SetLabel(0, "Momentum"); 362 table->SetLabel(1, "P_t"); 363 table->SetLabel(2, "Phi"); 364 table->SetLabel(3, "Theta"); 365 table->SetLabel(4, "Eta"); 366 k = 0; 367 for(j = tracks->BeginChildren(); j != tracks->EndChildren(); ++j) 368 { 369 Float_t p = ((TEveTrack *)(*j))->GetMomentum().Mag(); 370 table->SetValue(0, k, p); 371 Float_t pt = ((TEveTrack *)(*j))->GetMomentum().Perp(); 372 table->SetValue(1, k, pt); 373 Float_t phi = ((TEveTrack *)(*j))->GetMomentum().Phi(); 374 table->SetValue(2, k, phi); 375 Float_t theta = ((TEveTrack *)(*j))->GetMomentum().Theta(); 376 table->SetValue(3, k, theta); 377 Float_t eta = theta > 0.0005 && theta < 3.1413 ? ((TEveTrack *)(*j))->GetMomentum().Eta() : 1e10; 378 table->SetValue(4, k, eta); 379 ++k; 380 } 381 } 382 } 383 htmlSummary_->Build(); 384 gHtml_->Clear(); 385 gHtml_->ParseText((char *)htmlSummary_->Html().Data()); 386 gHtml_->Layout(); 387 } 352 htmlSummary_->Build(); 353 gHtml_->Clear(); 354 gHtml_->ParseText((char*)htmlSummary_->Html().Data()); 355 gHtml_->Layout(); 356 } 357 388 358 } 389 359 … … 394 364 void DelphesEventDisplay::make_gui() 395 365 { 396 // Create minimal GUI for event navigation. 397 398 // add a tab on the left 399 TEveBrowser *browser = gEve->GetBrowser(); 400 browser->SetWindowName("Delphes Event Display"); 401 browser->StartEmbedding(TRootBrowser::kLeft); 402 403 // set the main title 404 TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); 405 frmMain->SetWindowName("Delphes Event Display"); 406 frmMain->SetCleanup(kDeepCleanup); 407 408 // build the navigation menu 409 TString icondir; 410 if(gSystem->Getenv("ROOTSYS")) 411 icondir = Form("%s/icons/", gSystem->Getenv("ROOTSYS")); 412 if(!gSystem->OpenDirectory(icondir)) 413 icondir = Form("%s/icons/", (const char *)gSystem->GetFromPipe("root-config --etcdir")); 414 TGGroupFrame *vf = new TGGroupFrame(frmMain, "Event navigation", kVerticalFrame | kFitWidth); 415 { 416 TGHorizontalFrame *hf = new TGHorizontalFrame(frmMain); 417 { 418 TGPictureButton *b = 0; 419 420 b = new TGPictureButton(hf, gClient->GetPicture(icondir + "GoBack.gif")); 421 hf->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 2, 10, 10)); 422 b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()"); 423 424 TGNumberEntry *numberEntry = new TGNumberEntry(hf, 0, 9, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries()); 425 hf->AddFrame(numberEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 0, 10, 10)); 426 this->Connect("EventChanged(Int_t)", "TGNumberEntry", numberEntry, "SetIntNumber(Long_t)"); 427 numberEntry->GetNumberEntry()->Connect("TextChanged(char*)", "DelphesEventDisplay", this, "PreSetEv(char*)"); 428 numberEntry->GetNumberEntry()->Connect("ReturnPressed()", "DelphesEventDisplay", this, "GoTo()"); 429 430 b = new TGPictureButton(hf, gClient->GetPicture(icondir + "GoForward.gif")); 431 hf->AddFrame(b, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 10, 10, 10)); 432 b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()"); 433 } 434 vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2)); 435 436 TGHProgressBar *progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100); 437 progress->SetMax(treeReader_->GetEntries()); 438 progress->ShowPosition(kTRUE, kFALSE, "Event %.0f"); 439 progress->SetBarColor("green"); 440 vf->AddFrame(progress, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5)); 441 this->Connect("EventChanged(Int_t)", "TGHProgressBar", progress, "SetPosition(Float_t)"); 366 // Create minimal GUI for event navigation. 367 368 // add a tab on the left 369 TEveBrowser *browser = gEve->GetBrowser(); 370 browser->SetWindowName("Delphes Event Display"); 371 browser->StartEmbedding(TRootBrowser::kLeft); 372 373 // set the main title 374 TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); 375 frmMain->SetWindowName("Delphes Event Display"); 376 frmMain->SetCleanup(kDeepCleanup); 377 378 // build the navigation menu 379 TString icondir; 380 if(gSystem->Getenv("ROOTSYS")) 381 icondir = Form("%s/icons/", gSystem->Getenv("ROOTSYS")); 382 if(!gSystem->OpenDirectory(icondir)) 383 icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") ); 384 TGGroupFrame *vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth ); 385 { 386 TGHorizontalFrame *hf = new TGHorizontalFrame(frmMain); 387 { 388 TGPictureButton *b = 0; 389 390 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif")); 391 hf->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 10, 2, 10, 10)); 392 b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()"); 393 394 TGNumberEntry *numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries()); 395 hf->AddFrame(numberEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10)); 396 this->Connect("EventChanged(Int_t)","TGNumberEntry",numberEntry,"SetIntNumber(Long_t)"); 397 numberEntry->GetNumberEntry()->Connect("TextChanged(char*)", "DelphesEventDisplay", this, "PreSetEv(char*)"); 398 numberEntry->GetNumberEntry()->Connect("ReturnPressed()", "DelphesEventDisplay", this, "GoTo()"); 399 400 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif")); 401 hf->AddFrame(b, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 2, 10, 10, 10)); 402 b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()"); 403 404 } 405 vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2)); 406 407 TGHProgressBar *progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100); 408 progress->SetMax( treeReader_->GetEntries()); 409 progress->ShowPosition(kTRUE, kFALSE, "Event %.0f"); 410 progress->SetBarColor("green"); 411 vf->AddFrame(progress, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5)); 412 this->Connect("EventChanged(Int_t)","TGHProgressBar",progress,"SetPosition(Float_t)"); 413 } 414 frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5)); 415 vf = new TGGroupFrame(frmMain,"Batch operations",kVerticalFrame | kFitWidth ); 416 { 417 TGTextButton *b = new TGTextButton(vf, "Initialize Summary Plots"); 418 vf->AddFrame(b, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX, 10, 10, 10, 10)); 419 b->Connect("Clicked()", "DelphesEventDisplay", this, "InitSummaryPlots()"); 420 } 421 frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5)); 422 423 frmMain->MapSubwindows(); 424 frmMain->Resize(); 425 frmMain->MapWindow(); 426 browser->StopEmbedding(); 427 browser->SetTabTitle("Event Control", 0); 428 429 // the summary tab 430 htmlSummary_ = new DelphesHtmlSummary("Delphes Event Display Summary Table"); 431 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 432 gHtml_ = new TGHtml(0, 100, 100); 433 TEveWindowFrame *wf = slot->MakeFrame(gHtml_); 434 gHtml_->MapSubwindows(); 435 wf->SetElementName("Summary tables"); 436 437 // plot tab 438 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 439 TEveWindowTab *tab = slot->MakeTab(); 440 tab->SetElementName("Summary plots"); 441 tab->SetShowTitleBar(kFALSE); 442 plotSummary_ = new DelphesPlotSummary(tab); 443 plotSummary_->Init(elements_); 444 plotSummary_->Connect("Progress(Int_t)", "DelphesEventDisplay", this, "DisplayProgress(Int_t)"); 445 446 } 447 448 void DelphesEventDisplay::Fwd() { 449 if (event_id_ < treeReader_->GetEntries() - 2) { 450 EventChanged(event_id_+1); 451 } else { 452 printf("Already at last event.\n"); 442 453 } 443 frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5)); 444 vf = new TGGroupFrame(frmMain, "Batch operations", kVerticalFrame | kFitWidth); 445 { 446 TGTextButton *b = new TGTextButton(vf, "Initialize Summary Plots"); 447 vf->AddFrame(b, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX, 10, 10, 10, 10)); 448 b->Connect("Clicked()", "DelphesEventDisplay", this, "InitSummaryPlots()"); 454 } 455 456 void DelphesEventDisplay::Bck() { 457 if (event_id_ > 0) { 458 EventChanged(event_id_-1); 459 } else { 460 printf("Already at first event.\n"); 449 461 } 450 frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5)); 451 452 frmMain->MapSubwindows(); 453 frmMain->Resize(); 454 frmMain->MapWindow(); 455 browser->StopEmbedding(); 456 browser->SetTabTitle("Event Control", 0); 457 458 // the summary tab 459 htmlSummary_ = new DelphesHtmlSummary("Delphes Event Display Summary Table"); 460 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 461 gHtml_ = new TGHtml(0, 100, 100); 462 TEveWindowFrame *wf = slot->MakeFrame(gHtml_); 463 gHtml_->MapSubwindows(); 464 wf->SetElementName("Summary tables"); 465 466 // plot tab 467 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 468 TEveWindowTab *tab = slot->MakeTab(); 469 tab->SetElementName("Summary plots"); 470 tab->SetShowTitleBar(kFALSE); 471 plotSummary_ = new DelphesPlotSummary(tab); 472 plotSummary_->Init(elements_); 473 plotSummary_->Connect("Progress(Int_t)", "DelphesEventDisplay", this, "DisplayProgress(Int_t)"); 474 } 475 476 void DelphesEventDisplay::Fwd() 477 { 478 if(event_id_ < treeReader_->GetEntries() - 2) 479 { 480 EventChanged(event_id_ + 1); 481 } 482 else 483 { 484 printf("Already at last event.\n"); 485 } 486 } 487 488 void DelphesEventDisplay::Bck() 489 { 490 if(event_id_ > 0) 491 { 492 EventChanged(event_id_ - 1); 493 } 494 else 495 { 496 printf("Already at first event.\n"); 497 } 498 } 499 500 void DelphesEventDisplay::PreSetEv(char *ev) 501 { 462 } 463 464 void DelphesEventDisplay::PreSetEv(char *ev) { 502 465 event_id_tmp_ = Int_t(atoi(ev)); 503 466 } 504 467 505 void DelphesEventDisplay::GoTo() 506 { 507 if(event_id_tmp_ >= 0 && event_id_tmp_ < treeReader_->GetEntries() - 1) 508 { 468 void DelphesEventDisplay::GoTo() { 469 if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) { 509 470 EventChanged(event_id_tmp_); 510 } 511 else 512 { 471 } else { 513 472 printf("Error: no such event.\n"); 514 473 } 515 474 } 516 475 517 void DelphesEventDisplay::InitSummaryPlots() 518 { 476 void DelphesEventDisplay::InitSummaryPlots() { 519 477 plotSummary_->FillSample(treeReader_, event_id_); 520 478 plotSummary_->FillEvent(); … … 522 480 } 523 481 524 void DelphesEventDisplay::DisplayProgress(Int_t p) 525 { 526 fStatusBar_->SetText(Form("Processing... %d %%", p), 1); 482 void DelphesEventDisplay::DisplayProgress(Int_t p) { 483 fStatusBar_->SetText(Form("Processing... %d %%",p), 1); 527 484 gSystem->ProcessEvents(); 528 485 } -
display/DelphesEventDisplay.h
r0e7d64a re39abb4 22 22 #include <vector> 23 23 24 #include "Rtypes.h" 24 25 #include "RQ_OBJECT.h" 25 #include "Rtypes.h"26 26 27 27 class TAxis; … … 45 45 class DelphesEventDisplay 46 46 { 47 RQ_OBJECT("DelphesEventDisplay")48 public:49 DelphesEventDisplay();50 DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry &det3D);51 ~DelphesEventDisplay();52 void EventChanged(Int_t); // *SIGNAL*47 RQ_OBJECT("DelphesEventDisplay") 48 public: 49 DelphesEventDisplay(); 50 DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D); 51 ~DelphesEventDisplay(); 52 void EventChanged(Int_t); // *SIGNAL* 53 53 54 private:55 void update_html_summary();56 void make_gui();57 void load_event();58 void readConfig(const char *configFile, std::vector<DelphesBranchBase *> &elements);54 private: 55 void update_html_summary(); 56 void make_gui(); 57 void load_event(); 58 void readConfig(const char *configFile, std::vector<DelphesBranchBase *>& elements); 59 59 60 // Configuration and global variables. 61 Int_t event_id_; 62 Int_t event_id_tmp_; 63 ExRootTreeReader *treeReader_; 64 Double_t tkRadius_, totRadius_, tkHalfLength_, muHalfLength_, bz_; 65 TAxis *etaAxis_, *phiAxis_; 66 TChain *chain_; 67 std::vector<DelphesBranchBase *> elements_; 68 DelphesDisplay *delphesDisplay_; 69 DelphesHtmlSummary *htmlSummary_; 70 TGHtml *gHtml_; 71 DelphesPlotSummary *plotSummary_; 72 TGStatusBar *fStatusBar_; 60 // Configuration and global variables. 61 Int_t event_id_; 62 Int_t event_id_tmp_; 63 ExRootTreeReader *treeReader_; 64 Double_t tkRadius_, totRadius_, tkHalfLength_, muHalfLength_, bz_; 65 TAxis *etaAxis_, *phiAxis_; 66 TChain *chain_; 67 std::vector<DelphesBranchBase *> elements_; 68 DelphesDisplay *delphesDisplay_; 69 DelphesHtmlSummary *htmlSummary_; 70 TGHtml *gHtml_; 71 DelphesPlotSummary *plotSummary_; 72 TGStatusBar *fStatusBar_; 73 74 // gui controls 75 public: 76 void Fwd(); 73 77 74 // gui controls 75 public: 76 void Fwd(); 78 void Bck(); 77 79 78 void Bck();80 void PreSetEv(char *ev); 79 81 80 void PreSetEv(char *ev);82 void GoTo(); 81 83 82 void GoTo();84 void InitSummaryPlots(); 83 85 84 void InitSummaryPlots(); 85 86 void DisplayProgress(Int_t p); 86 void DisplayProgress(Int_t p); 87 87 }; 88 88 -
display/DelphesHtmlSummary.cc
r0e7d64a re39abb4 18 18 19 19 #include "display/DelphesHtmlSummary.h" 20 #include "TGHtml.h" 20 21 #include "TEveElement.h" 22 #include "TEveManager.h" 21 23 #include "TEveEventManager.h" 22 #include "TEveManager.h"23 24 #include "TEvePointSet.h" 24 25 #include "TEveTrack.h" 25 #include "TGHtml.h"26 26 27 27 //============================================================================== 28 28 29 29 DelphesHtmlSummary *fgDelphesHtmlSummary = 0; 30 TGHtml *fgHtml= 0;30 TGHtml *fgHtml = 0; 31 31 32 32 //============================================================================== 33 33 34 34 //______________________________________________________________________________ 35 DelphesHtmlObjTable::DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp) : 36 fName(name), fNValues(nvals), fNFields(nfields), fExpand(exp)37 { 38 // Constructor.39 40 fValues = new TArrayF[fNFields];41 for(int i = 0; i < fNFields;i++)42 fValues[i].Set(nvals);43 fLabels = new TString[fNFields];35 DelphesHtmlObjTable::DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp) : 36 fName(name), fNValues(nvals), fNFields(nfields), fExpand(exp) 37 { 38 // Constructor. 39 40 fValues = new TArrayF[fNFields]; 41 for (int i=0;i<fNFields;i++) 42 fValues[i].Set(nvals); 43 fLabels = new TString[fNFields]; 44 44 } 45 45 … … 47 47 DelphesHtmlObjTable::~DelphesHtmlObjTable() 48 48 { 49 // Destructor.50 51 delete[] fValues;52 delete[] fLabels;49 // Destructor. 50 51 delete [] fValues; 52 delete [] fLabels; 53 53 } 54 54 … … 56 56 void DelphesHtmlObjTable::Build() 57 57 { 58 // Build HTML code. 59 60 fHtml = "<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ", 61 62 BuildTitle(); 63 if(fExpand && (fNFields > 0) && (fNValues > 0)) 64 { 65 BuildLabels(); 66 BuildTable(); 67 } 68 69 fHtml += "</table>"; 58 // Build HTML code. 59 60 fHtml = "<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ", 61 62 BuildTitle(); 63 if (fExpand && (fNFields > 0) && (fNValues > 0)) { 64 BuildLabels(); 65 BuildTable(); 66 } 67 68 fHtml += "</table>"; 70 69 } 71 70 … … 73 72 void DelphesHtmlObjTable::BuildTitle() 74 73 { 75 // Build table title.76 77 fHtml += "<tr><td colspan=";78 fHtml += Form("%d>", fNFields +1);79 fHtml += "<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=6e6ea0>";80 fHtml += "<tr><td align=left>";81 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>";82 fHtml += fName;83 fHtml += "</i></b></font></td>";84 fHtml += "<td>";85 fHtml += "<td align=right> ";86 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>";87 fHtml += Form("Size = %d", fNValues);88 fHtml += "</i></b></font></td></tr>";89 fHtml += "</table>";90 fHtml += "</td></tr>";74 // Build table title. 75 76 fHtml += "<tr><td colspan="; 77 fHtml += Form("%d>", fNFields+1); 78 fHtml += "<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=6e6ea0>"; 79 fHtml += "<tr><td align=left>"; 80 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>"; 81 fHtml += fName; 82 fHtml += "</i></b></font></td>"; 83 fHtml += "<td>"; 84 fHtml += "<td align=right> "; 85 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>"; 86 fHtml += Form("Size = %d", fNValues); 87 fHtml += "</i></b></font></td></tr>"; 88 fHtml += "</table>"; 89 fHtml += "</td></tr>"; 91 90 } 92 91 … … 94 93 void DelphesHtmlObjTable::BuildLabels() 95 94 { 96 // Build table labels. 97 98 Int_t i; 99 fHtml += "<tr bgcolor=c0c0ff>"; 100 fHtml += "<th> </th>"; // for the check boxes 101 for(i = 0; i < fNFields; i++) 102 { 103 fHtml += "<th> "; 104 fHtml += fLabels[i]; 105 fHtml += " </th>"; // for the check boxes 106 } 107 fHtml += "</tr>"; 95 // Build table labels. 96 97 Int_t i; 98 fHtml += "<tr bgcolor=c0c0ff>"; 99 fHtml += "<th> </th>"; // for the check boxes 100 for (i=0;i<fNFields;i++) { 101 fHtml += "<th> "; 102 fHtml += fLabels[i]; 103 fHtml += " </th>"; // for the check boxes 104 } 105 fHtml += "</tr>"; 108 106 } 109 107 … … 111 109 void DelphesHtmlObjTable::BuildTable() 112 110 { 113 // Build part of table with values. 114 115 for(int i = 0; i < fNValues; i++) 116 { 117 if(i % 2) 118 fHtml += "<tr bgcolor=e0e0ff>"; 119 else 120 fHtml += "<tr bgcolor=ffffff>"; 121 122 TString name = fName; 123 name.ReplaceAll(" ", "_"); 124 // checkboxes 125 fHtml += "<td bgcolor=d0d0ff align=\"center\">"; 126 fHtml += "<input type=\"checkbox\" name=\""; 127 fHtml += name; 128 fHtml += Form("[%d]\">", i); 129 fHtml += "</td>"; 130 131 for(int j = 0; j < fNFields; j++) 132 { 133 fHtml += "<td width="; 134 fHtml += Form("%d%%", 100 / fNFields); 135 fHtml += " align=\"center\""; 136 fHtml += ">"; 137 fHtml += Form("%1.4f", fValues[j][i]); 111 // Build part of table with values. 112 113 for (int i = 0; i < fNValues; i++) { 114 if (i%2) 115 fHtml += "<tr bgcolor=e0e0ff>"; 116 else 117 fHtml += "<tr bgcolor=ffffff>"; 118 119 TString name = fName; 120 name.ReplaceAll(" ", "_"); 121 // checkboxes 122 fHtml += "<td bgcolor=d0d0ff align=\"center\">"; 123 fHtml += "<input type=\"checkbox\" name=\""; 124 fHtml += name; 125 fHtml += Form("[%d]\">",i); 138 126 fHtml += "</td>"; 139 } 140 fHtml += "</tr> "; 141 } 142 } 143 144 //______________________________________________________________________________ 145 DelphesHtmlSummary::DelphesHtmlSummary(const char *title) : 146 fNTables(0), fTitle(title) 147 { 148 // Constructor. 149 150 fObjTables = new TOrdCollection(); 127 128 for (int j = 0; j < fNFields; j++) { 129 fHtml += "<td width="; 130 fHtml += Form("%d%%", 100/fNFields); 131 fHtml += " align=\"center\""; 132 fHtml += ">"; 133 fHtml += Form("%1.4f", fValues[j][i]); 134 fHtml += "</td>"; 135 } 136 fHtml += "</tr> "; 137 } 138 } 139 140 //______________________________________________________________________________ 141 DelphesHtmlSummary::DelphesHtmlSummary(const char *title) : fNTables(0), fTitle(title) 142 { 143 // Constructor. 144 145 fObjTables = new TOrdCollection(); 151 146 } 152 147 … … 154 149 DelphesHtmlSummary::~DelphesHtmlSummary() 155 150 { 156 // Destructor.157 158 Reset();151 // Destructor. 152 153 Reset(); 159 154 } 160 155 161 156 //______________________________________________________________________________ 162 157 DelphesHtmlObjTable *DelphesHtmlSummary::AddTable(const char *name, Int_t nfields, Int_t nvals, 163 Bool_t exp, Option_t *option)164 { 165 // Add a new table in our list of tables.166 167 TString opt = option;168 opt.ToLower();169 DelphesHtmlObjTable *table = new DelphesHtmlObjTable(name, nfields, nvals, exp);170 fNTables++;171 if(opt.Contains("first"))172 fObjTables->AddFirst(table);173 else174 fObjTables->Add(table);175 return table;158 Bool_t exp, Option_t *option) 159 { 160 // Add a new table in our list of tables. 161 162 TString opt = option; 163 opt.ToLower(); 164 DelphesHtmlObjTable *table = new DelphesHtmlObjTable(name, nfields, nvals, exp); 165 fNTables++; 166 if (opt.Contains("first")) 167 fObjTables->AddFirst(table); 168 else 169 fObjTables->Add(table); 170 return table; 176 171 } 177 172 … … 179 174 void DelphesHtmlSummary::Clear(Option_t *option) 180 175 { 181 // Clear the table list.182 183 if(option && option[0] == 'D')184 fObjTables->Delete(option);185 else186 fObjTables->Clear(option);187 fNTables = 0;176 // Clear the table list. 177 178 if (option && option[0] == 'D') 179 fObjTables->Delete(option); 180 else 181 fObjTables->Clear(option); 182 fNTables = 0; 188 183 } 189 184 … … 191 186 void DelphesHtmlSummary::Reset(Option_t *) 192 187 { 193 // Reset (delete) the table list; 194 195 delete fObjTables; 196 fObjTables = 0; 197 fNTables = 0; 188 // Reset (delete) the table list; 189 190 delete fObjTables; fObjTables = 0; 191 fNTables = 0; 198 192 } 199 193 … … 201 195 void DelphesHtmlSummary::Build() 202 196 { 203 // Build the summary. 204 205 MakeHeader(); 206 for(int i = 0; i < fNTables; i++) 207 { 208 GetTable(i)->Build(); 209 fHtml += GetTable(i)->Html(); 210 } 211 MakeFooter(); 197 // Build the summary. 198 199 MakeHeader(); 200 for (int i=0;i<fNTables;i++) { 201 GetTable(i)->Build(); 202 fHtml += GetTable(i)->Html(); 203 } 204 MakeFooter(); 212 205 } 213 206 … … 215 208 void DelphesHtmlSummary::MakeHeader() 216 209 { 217 // Make HTML header.218 219 fHeader= "<html><head><title>";220 fHeader += fTitle;221 fHeader += "</title></head><body>";222 fHeader += "<center><h2><font color=#2222ee><i>";223 fHeader += fTitle;224 fHeader += "</i></font></h2></center>";225 fHtml= fHeader;210 // Make HTML header. 211 212 fHeader = "<html><head><title>"; 213 fHeader += fTitle; 214 fHeader += "</title></head><body>"; 215 fHeader += "<center><h2><font color=#2222ee><i>"; 216 fHeader += fTitle; 217 fHeader += "</i></font></h2></center>"; 218 fHtml = fHeader; 226 219 } 227 220 … … 229 222 void DelphesHtmlSummary::MakeFooter() 230 223 { 231 // Make HTML footer. 232 233 fFooter = "<br><p><br><center><strong><font size=2 color=#2222ee>"; 234 fFooter += "Example of using Html widget to display tabular data"; 235 fFooter += "<br>"; 236 fFooter += "(c) 2007-2010 Bertrand Bellenot"; 237 fFooter += "</font></strong></center></body></html>"; 238 fHtml += fFooter; 239 } 224 // Make HTML footer. 225 226 fFooter = "<br><p><br><center><strong><font size=2 color=#2222ee>"; 227 fFooter += "Example of using Html widget to display tabular data"; 228 fFooter += "<br>"; 229 fFooter += "(c) 2007-2010 Bertrand Bellenot"; 230 fFooter += "</font></strong></center></body></html>"; 231 fHtml += fFooter; 232 } 233 -
display/DelphesHtmlSummary.h
r0e7d64a re39abb4 17 17 */ 18 18 19 // Delphes HTML table for the event display. 19 // Delphes HTML table for the event display. 20 20 // Based on the ROOT example "alice_esd_html_summary.C" 21 21 22 22 #ifndef DelphesHtmlSummary_h 23 #define DelphesHtmlSummary_h 23 #define DelphesHtmlSummary_h 24 24 25 25 #include "TArrayF.h" 26 26 #include "TOrdCollection.h" 27 27 28 class DelphesHtmlObjTable: public TObject 28 29 class DelphesHtmlObjTable : public TObject 29 30 { 30 public: // make them public for shorter code 31 TString fName; 32 Int_t fNValues; // number of values 33 Int_t fNFields; // number of fields 34 TArrayF *fValues; 35 TString *fLabels; 36 Bool_t fExpand; 31 public: // make them public for shorter code 37 32 38 TString fHtml; // HTML output code 33 TString fName; 34 Int_t fNValues; // number of values 35 Int_t fNFields; // number of fields 36 TArrayF *fValues; 37 TString *fLabels; 38 Bool_t fExpand; 39 39 40 void Build(); 41 void BuildTitle(); 42 void BuildLabels(); 43 void BuildTable(); 40 TString fHtml; // HTML output code 41 42 void Build(); 43 void BuildTitle(); 44 void BuildLabels(); 45 void BuildTable(); 44 46 45 47 public: 46 DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp =kTRUE);47 virtual ~DelphesHtmlObjTable();48 DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp=kTRUE); 49 virtual ~DelphesHtmlObjTable(); 48 50 49 voidSetLabel(Int_t col, const char *label) { fLabels[col] = label; }50 voidSetValue(Int_t col, Int_t row, Float_t val) { fValues[col].SetAt(val, row); }51 TStringHtml() const { return fHtml; }51 void SetLabel(Int_t col, const char *label) { fLabels[col] = label; } 52 void SetValue(Int_t col, Int_t row, Float_t val) { fValues[col].SetAt(val, row); } 53 TString Html() const { return fHtml; } 52 54 53 ClassDef(DelphesHtmlObjTable, 0);55 ClassDef(DelphesHtmlObjTable, 0); 54 56 }; 55 57 … … 58 60 class DelphesHtmlSummary 59 61 { 60 public: // make them public for shorter code61 Int_tfNTables;62 TOrdCollection *fObjTables;// ->array of object tables63 TString fHtml;// output HTML string64 TString fTitle;// page title65 TString fHeader;// HTML header66 TString fFooter;// HTML footer62 public: // make them public for shorter code 63 Int_t fNTables; 64 TOrdCollection *fObjTables; // ->array of object tables 65 TString fHtml; // output HTML string 66 TString fTitle; // page title 67 TString fHeader; // HTML header 68 TString fFooter; // HTML footer 67 69 68 voidMakeHeader();69 voidMakeFooter();70 void MakeHeader(); 71 void MakeFooter(); 70 72 71 73 public: 72 DelphesHtmlSummary(const char *title);73 virtual ~DelphesHtmlSummary();74 DelphesHtmlSummary(const char *title); 75 virtual ~DelphesHtmlSummary(); 74 76 75 DelphesHtmlObjTable *AddTable(const char *name, Int_t nfields, Int_t nvals,76 Bool_t exp = kTRUE, Option_t *opt ="");77 DelphesHtmlObjTable*GetTable(Int_t at) const { return (DelphesHtmlObjTable *)fObjTables->At(at); }78 voidBuild();79 void Clear(Option_t *option ="");80 void Reset(Option_t *option ="");81 TStringHtml() const { return fHtml; }77 DelphesHtmlObjTable *AddTable(const char *name, Int_t nfields, Int_t nvals, 78 Bool_t exp=kTRUE, Option_t *opt=""); 79 DelphesHtmlObjTable *GetTable(Int_t at) const { return (DelphesHtmlObjTable *)fObjTables->At(at); } 80 void Build(); 81 void Clear(Option_t *option=""); 82 void Reset(Option_t *option=""); 83 TString Html() const { return fHtml; } 82 84 83 ClassDef(DelphesHtmlSummary, 0);85 ClassDef(DelphesHtmlSummary, 0); 84 86 }; 85 87 -
display/DelphesPlotSummary.cc
r0e7d64a re39abb4 21 21 #include <algorithm> 22 22 23 bool vecsorter (TLorentzVector i, TLorentzVector j) { return (i.Pt() >j.Pt()); }23 bool vecsorter (TLorentzVector i,TLorentzVector j) { return (i.Pt()>j.Pt()); } 24 24 25 DelphesPlotSummary::DelphesPlotSummary(TEveWindowTab *tab) : 26 tab_(tab) {} 25 DelphesPlotSummary::DelphesPlotSummary(TEveWindowTab* tab):tab_(tab) {} 27 26 28 27 DelphesPlotSummary::~DelphesPlotSummary() {} … … 30 29 void DelphesPlotSummary::Progress(Int_t p) 31 30 { 32 Emit("Progress(Int_t)", 31 Emit("Progress(Int_t)",p); 33 32 } 34 33 35 void DelphesPlotSummary::Init(std::vector<DelphesBranchBase *> &elements) 36 { 34 void DelphesPlotSummary::Init(std::vector<DelphesBranchBase*>& elements) { 37 35 elements_ = &elements; 38 36 // loop on the elements, and create tabs 39 for(std::vector<DelphesBranchBase *>::iterator data = elements.begin(); data < elements.end(); ++data) 40 { 37 for(std::vector<DelphesBranchBase*>::iterator data=elements.begin();data<elements.end();++data) { 41 38 // the canvas 42 TEveWindowSlot *slot = tab_->NewSlot();43 TRootEmbeddedCanvas *trec = new TRootEmbeddedCanvas();44 TCanvas *canvas = trec->GetCanvas();45 TEveWindowFrame * wf = slot->MakeFrame(trec);39 TEveWindowSlot* slot = tab_->NewSlot(); 40 TRootEmbeddedCanvas* trec = new TRootEmbeddedCanvas(); 41 TCanvas* canvas = trec->GetCanvas(); 42 TEveWindowFrame * wf = slot->MakeFrame(trec); 46 43 wf->SetElementName((*data)->GetName()); 47 canvas->Divide(3, 44 canvas->Divide(3,3); 48 45 canvases_[(*data)->GetName()] = canvas; 49 46 // the histograms 50 TH1F *h;51 std::vector<TH1F 47 TH1F* h; 48 std::vector<TH1F*> histograms; 52 49 histograms.reserve(9); 53 h = new TH1F(Form("%sPt", (*data)->GetName()), Form("%s Pt", (*data)->GetName()), 100, 0,-1);50 h = new TH1F(Form("%sPt",(*data)->GetName()),Form("%s Pt",(*data)->GetName()),100,0,-1); 54 51 histograms.push_back(h); 55 h = new TH1F(Form("%sEta", (*data)->GetName()), Form("%s Eta", (*data)->GetName()), 100, 0,-1);52 h = new TH1F(Form("%sEta",(*data)->GetName()),Form("%s Eta",(*data)->GetName()),100,0,-1); 56 53 histograms.push_back(h); 57 h = new TH1F(Form("%sPhi", (*data)->GetName()), Form("%s Phi", (*data)->GetName()), 100, 0,-1);54 h = new TH1F(Form("%sPhi",(*data)->GetName()),Form("%s Phi",(*data)->GetName()),100,0,-1); 58 55 histograms.push_back(h); 59 h = new TH1F(Form("l%sPt", (*data)->GetName()), Form("leading %s Pt", (*data)->GetName()), 100, 0,-1);56 h = new TH1F(Form("l%sPt",(*data)->GetName()),Form("leading %s Pt",(*data)->GetName()),100,0,-1); 60 57 histograms.push_back(h); 61 h = new TH1F(Form("l%sEta", (*data)->GetName()), Form("leading %s Eta", (*data)->GetName()), 100, 0,-1);58 h = new TH1F(Form("l%sEta",(*data)->GetName()),Form("leading %s Eta",(*data)->GetName()),100,0,-1); 62 59 histograms.push_back(h); 63 h = new TH1F(Form("l%sPhi", (*data)->GetName()), Form("leading %s Phi", (*data)->GetName()), 100, 0,-1);60 h = new TH1F(Form("l%sPhi",(*data)->GetName()),Form("leading %s Phi",(*data)->GetName()),100,0,-1); 64 61 histograms.push_back(h); 65 h = new TH1F(Form("sl%sPt", (*data)->GetName()), Form("subleading %s Pt", (*data)->GetName()), 100, 0,-1);62 h = new TH1F(Form("sl%sPt",(*data)->GetName()),Form("subleading %s Pt",(*data)->GetName()),100,0,-1); 66 63 histograms.push_back(h); 67 h = new TH1F(Form("sl%sEta", (*data)->GetName()), Form("subleading %s Eta", (*data)->GetName()), 100, 0,-1);64 h = new TH1F(Form("sl%sEta",(*data)->GetName()),Form("subleading %s Eta",(*data)->GetName()),100,0,-1); 68 65 histograms.push_back(h); 69 h = new TH1F(Form("sl%sPhi", (*data)->GetName()), Form("subleading %s Phi", (*data)->GetName()), 100, 0,-1);66 h = new TH1F(Form("sl%sPhi",(*data)->GetName()),Form("subleading %s Phi",(*data)->GetName()),100,0,-1); 70 67 histograms.push_back(h); 71 68 histograms_[(*data)->GetName()] = histograms; 72 69 // the event histograms 73 TH1F *h1 = (TH1F *)histograms[0]->Clone(); 74 h1->Reset(); 75 h1->SetLineColor(kBlue); 76 TH1F *h2 = (TH1F *)histograms[1]->Clone(); 77 h2->Reset(); 78 h2->SetLineColor(kBlue); 79 TH1F *h3 = (TH1F *)histograms[2]->Clone(); 80 h3->Reset(); 81 h3->SetLineColor(kBlue); 82 std::vector<TH1F *> hv; 70 TH1F* h1 = (TH1F*)histograms[0]->Clone(); h1->Reset(); h1->SetLineColor(kBlue); 71 TH1F* h2 = (TH1F*)histograms[1]->Clone(); h2->Reset(); h2->SetLineColor(kBlue); 72 TH1F* h3 = (TH1F*)histograms[2]->Clone(); h3->Reset(); h3->SetLineColor(kBlue); 73 std::vector<TH1F*> hv; 83 74 hv.push_back(h1); 84 75 hv.push_back(h2); … … 87 78 // the event markers 88 79 TMarker *m; 89 std::vector<TMarker *> mv; 90 m = new TMarker(0, 0, 29); 91 m->SetMarkerColor(kBlue); 92 m->SetMarkerSize(3); 80 std::vector<TMarker*> mv; 81 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 93 82 mv.push_back(m); 94 m = new TMarker(0, 0, 29); 95 m->SetMarkerColor(kBlue); 96 m->SetMarkerSize(3); 83 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 97 84 mv.push_back(m); 98 m = new TMarker(0, 0, 29); 99 m->SetMarkerColor(kBlue); 100 m->SetMarkerSize(3); 85 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 101 86 mv.push_back(m); 102 m = new TMarker(0, 0, 29); 103 m->SetMarkerColor(kBlue); 104 m->SetMarkerSize(3); 87 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 105 88 mv.push_back(m); 106 m = new TMarker(0, 0, 29); 107 m->SetMarkerColor(kBlue); 108 m->SetMarkerSize(3); 89 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 109 90 mv.push_back(m); 110 m = new TMarker(0, 0, 29); 111 m->SetMarkerColor(kBlue); 112 m->SetMarkerSize(3); 91 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 113 92 mv.push_back(m); 114 93 eventMarkers_[(*data)->GetName()] = mv; … … 116 95 } 117 96 118 void DelphesPlotSummary::FillSample(ExRootTreeReader *treeReader, Int_t event_id) 119 { 97 void DelphesPlotSummary::FillSample(ExRootTreeReader* treeReader, Int_t event_id) { 120 98 Int_t entries = treeReader->GetEntries(); 121 for(Int_t i = 0; i < entries; ++i) 122 { 99 for(Int_t i=0;i<entries;++i) { 123 100 treeReader->ReadEntry(i); 124 for(std::vector<DelphesBranchBase *>::iterator element = elements_->begin(); element < elements_->end(); ++element) 125 { 101 for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) { 126 102 std::vector<TLorentzVector> vectors = (*element)->GetVectors(); 127 std::sort(vectors.begin(), vectors.end(), vecsorter); 128 std::vector<TH1F *> histograms = histograms_[(*element)->GetName()]; 129 for(std::vector<TLorentzVector>::iterator it = vectors.begin(); it < vectors.end(); ++it) 130 { 103 std::sort(vectors.begin(), vectors.end(), vecsorter); 104 std::vector<TH1F*> histograms = histograms_[(*element)->GetName()]; 105 for(std::vector<TLorentzVector>::iterator it=vectors.begin(); it<vectors.end();++it) { 131 106 histograms[0]->Fill(it->Pt()); 132 107 histograms[1]->Fill(it->Eta()); 133 108 histograms[2]->Fill(it->Phi()); 134 if(it == vectors.begin()) 135 { 109 if(it==vectors.begin()) { 136 110 histograms[3]->Fill(it->Pt()); 137 111 histograms[4]->Fill(it->Eta()); 138 112 histograms[5]->Fill(it->Phi()); 139 113 } 140 if(it == vectors.begin() + 1) 141 { 114 if(it==vectors.begin()+1) { 142 115 histograms[6]->Fill(it->Pt()); 143 116 histograms[7]->Fill(it->Eta()); … … 146 119 } 147 120 } 148 Progress(int(100 * i /entries));121 Progress(int(100*i/entries)); 149 122 } 150 123 treeReader->ReadEntry(event_id); … … 152 125 } 153 126 154 void DelphesPlotSummary::Draw() 155 { 156 for(std::map<TString, TCanvas *>::iterator it = canvases_.begin(); it != canvases_.end(); ++it) 157 { 158 TCanvas *c = it->second; 159 std::vector<TH1F *> histograms = histograms_[it->first]; 160 std::vector<TH1F *> eventProfiles = eventProfiles_[it->first]; 161 std::vector<TMarker *> eventMarkers = eventMarkers_[it->first]; 162 for(Int_t i = 0; i < 9; ++i) 163 { 164 c->cd(i + 1); 165 if(histograms[i]->GetEntries() == 0) continue; 127 void DelphesPlotSummary::Draw() { 128 for(std::map< TString, TCanvas* >::iterator it=canvases_.begin(); it!=canvases_.end(); ++it) { 129 TCanvas* c = it->second; 130 std::vector<TH1F*> histograms = histograms_[it->first]; 131 std::vector<TH1F*> eventProfiles = eventProfiles_[it->first]; 132 std::vector<TMarker*> eventMarkers = eventMarkers_[it->first]; 133 for(Int_t i=0;i<9;++i) { 134 c->cd(i+1); 135 if(histograms[i]->GetEntries()==0) continue; 166 136 histograms[i]->Draw(); 167 if(i < 3) 168 { 137 if(i<3) { 169 138 eventProfiles[i]->Draw("same"); 170 } 171 else 172 { 173 eventMarkers[i - 3]->Draw("same"); 139 } else { 140 eventMarkers[i-3]->Draw("same"); 174 141 } 175 142 } 176 143 c->Update(); 177 } 144 } 178 145 } 179 146 180 void DelphesPlotSummary::FillEvent() 181 { 147 void DelphesPlotSummary::FillEvent() { 182 148 // clear event histograms and markers 183 for(std::map<TString, std::vector<TH1F *> >::iterator hv = eventProfiles_.begin(); hv != eventProfiles_.end(); ++hv) 184 { 185 for(std::vector<TH1F *>::iterator h = hv->second.begin(); h < hv->second.end(); ++h) 186 { 149 for(std::map< TString, std::vector<TH1F*> >::iterator hv = eventProfiles_.begin(); hv!=eventProfiles_.end();++hv) { 150 for(std::vector<TH1F*>::iterator h = hv->second.begin(); h<hv->second.end();++h) { 187 151 (*h)->Reset(); 188 152 } 189 153 } 190 for(std::map<TString, std::vector<TMarker *> >::iterator mv = eventMarkers_.begin(); mv != eventMarkers_.end(); ++mv) 191 { 192 for(std::vector<TMarker *>::iterator m = mv->second.begin(); m < mv->second.end(); ++m) 193 { 154 for(std::map< TString, std::vector<TMarker*> >::iterator mv = eventMarkers_.begin(); mv!=eventMarkers_.end();++mv) { 155 for(std::vector<TMarker*>::iterator m = mv->second.begin(); m<mv->second.end();++m) { 194 156 (*m)->SetMarkerSize(0); 195 157 } 196 158 } 197 159 // loop over the elements and fill markers with event data 198 for(std::vector<DelphesBranchBase *>::iterator element = elements_->begin(); element < elements_->end(); ++element) 199 { 160 for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) { 200 161 std::vector<TLorentzVector> vectors = (*element)->GetVectors(); 201 std::sort(vectors.begin(), vectors.end(), vecsorter); 202 std::vector<TH1F *> hv = eventProfiles_[(*element)->GetName()]; 203 TH1F *h1 = hv[0]; 204 h1->Reset(); 205 TH1F *h2 = hv[1]; 206 h1->Reset(); 207 TH1F *h3 = hv[2]; 208 h1->Reset(); 209 std::vector<TMarker *> mv = eventMarkers_[(*element)->GetName()]; 210 for(std::vector<TLorentzVector>::iterator it = vectors.begin(); it < vectors.end(); ++it) 211 { 162 std::sort(vectors.begin(), vectors.end(), vecsorter); 163 std::vector<TH1F*> hv = eventProfiles_[(*element)->GetName()]; 164 TH1F* h1 = hv[0]; h1->Reset(); 165 TH1F* h2 = hv[1]; h1->Reset(); 166 TH1F* h3 = hv[2]; h1->Reset(); 167 std::vector<TMarker*> mv = eventMarkers_[(*element)->GetName()]; 168 for(std::vector<TLorentzVector>::iterator it=vectors.begin(); it<vectors.end();++it) { 212 169 h1->Fill(it->Pt()); 213 170 h2->Fill(it->Eta()); 214 171 h3->Fill(it->Phi()); 215 if(it == vectors.begin()) 216 { 217 mv[0]->SetX(it->Pt()); 218 mv[0]->SetMarkerSize(3); 219 mv[1]->SetX(it->Eta()); 220 mv[1]->SetMarkerSize(3); 221 mv[2]->SetX(it->Phi()); 222 mv[2]->SetMarkerSize(3); 172 if(it==vectors.begin()) { 173 mv[0]->SetX(it->Pt()); mv[0]->SetMarkerSize(3); 174 mv[1]->SetX(it->Eta()); mv[1]->SetMarkerSize(3); 175 mv[2]->SetX(it->Phi()); mv[2]->SetMarkerSize(3); 223 176 } 224 if(it == vectors.begin() + 1) 225 { 226 mv[3]->SetX(it->Pt()); 227 mv[3]->SetMarkerSize(3); 228 mv[4]->SetX(it->Eta()); 229 mv[4]->SetMarkerSize(3); 230 mv[5]->SetX(it->Phi()); 231 mv[5]->SetMarkerSize(3); 177 if(it==vectors.begin()+1) { 178 mv[3]->SetX(it->Pt()); mv[3]->SetMarkerSize(3); 179 mv[4]->SetX(it->Eta()); mv[4]->SetMarkerSize(3); 180 mv[5]->SetX(it->Phi()); mv[5]->SetMarkerSize(3); 232 181 } 233 182 } -
display/DelphesPlotSummary.h
r0e7d64a re39abb4 20 20 #define DelphesPlotSummary_h 21 21 22 #include "DelphesBranchElement.h" 22 #include <vector> 23 #include <map> 24 #include "TString.h" 25 #include "TH1F.h" 23 26 #include "TCanvas.h" 24 27 #include "TEveWindow.h" 25 #include "TH1F.h" 26 #include "TString.h" 28 #include "DelphesBranchElement.h" 27 29 #include "external/ExRootAnalysis/ExRootTreeReader.h" 28 30 #include <RQ_OBJECT.h> 29 #include <map> 30 #include <vector> 31 31 32 32 33 class DelphesPlotSummary 33 34 { 34 RQ_OBJECT("DelphesPlotSummary")35 public:36 DelphesPlotSummary(TEveWindowTab *tab);37 virtual ~DelphesPlotSummary();38 void Init(std::vector<DelphesBranchBase *> &elements);39 void FillSample(ExRootTreeReader *treeReader, Int_t event_id);40 void FillEvent();41 void Draw();42 void Progress(Int_t); // *SIGNAL*35 RQ_OBJECT("DelphesPlotSummary") 36 public: 37 DelphesPlotSummary(TEveWindowTab* tab); 38 virtual ~DelphesPlotSummary(); 39 void Init(std::vector<DelphesBranchBase*>& elements); 40 void FillSample(ExRootTreeReader* treeReader, Int_t event_id); 41 void FillEvent(); 42 void Draw(); 43 void Progress(Int_t); // *SIGNAL* 43 44 44 private: 45 TEveWindowTab *tab_; 46 std::map<TString, TCanvas *> canvases_; 47 std::map<TString, std::vector<TH1F *> > histograms_; 48 std::vector<DelphesBranchBase *> *elements_; 49 std::map<TString, std::vector<TMarker *> > eventMarkers_; 50 std::map<TString, std::vector<TH1F *> > eventProfiles_; 45 private: 46 TEveWindowTab* tab_; 47 std::map< TString, TCanvas* > canvases_; 48 std::map< TString, std::vector<TH1F*> > histograms_; 49 std::vector<DelphesBranchBase*>* elements_; 50 std::map< TString, std::vector<TMarker*> > eventMarkers_; 51 std::map< TString, std::vector<TH1F*> > eventProfiles_; 52 51 53 }; 52 54 53 55 #endif // DelphesPlotSummary_h 56 -
doc/update_fastjet.sh
r0e7d64a re39abb4 1 version=3.3. 21 version=3.3.1 2 2 3 3 wget http://fastjet.fr/repo/fastjet-${version}.tar.gz … … 9 9 10 10 cd fastjet-${version} 11 ./configure --enable-allcxxplugins --disable-auto-ptr11 ./configure --enable-allcxxplugins 12 12 cd - 13 13 -
examples/CMakeLists.txt
r0e7d64a re39abb4 1 1 include_directories( 2 2 ${CMAKE_SOURCE_DIR} 3 ${DelphesExternals_INCLUDE_DIR} 3 ${DelphesExternals_INCLUDE_DIR} 4 4 ) 5 5 … … 17 17 # take all other relevant files and put them into examples/ 18 18 install(FILES ${macros} DESTINATION examples) 19 install(DIRECTORY ExternalFastJet DESTINATION examples)20 if(PYTHIA8_FOUND)21 install(DIRECTORY Pythia8 DESTINATION examples)22 endif() -
examples/CaloGrid.cpp
r0e7d64a re39abb4 1 1 //calorimeter grid 2 #include <algorithm> 3 #include <cassert> 4 #include <iostream> 2 #include <set> 5 3 #include <map> 6 #include <set>7 #include <sstream>8 4 #include <utility> 9 5 #include <vector> 6 #include <algorithm> 7 #include <sstream> 8 #include <iostream> 9 #include <cassert> 10 10 11 #include "display/Delphes3DGeometry.h" 12 #include "classes/DelphesClasses.h" 11 13 #include "ExRootAnalysis/ExRootConfReader.h" 12 #include "classes/DelphesClasses.h"13 #include "display/Delphes3DGeometry.h"14 14 15 15 #include "TCanvas.h" 16 #include "TStyle.h" 17 #include "TString.h" 18 #include "TText.h" 16 19 #include "TH2F.h" 17 20 #include "TLine.h" 18 #include "TString.h"19 #include "TStyle.h"20 #include "TText.h"21 21 22 22 using namespace std; … … 28 28 { 29 29 30 if(argc !=3)31 32 cout << " Usage: ./CaloGrid [detector card] [calo name]" <<endl;33 cout << "Example: ./CaloGrid cards/delphes_card_CMS.tcl ECal" <<endl;34 35 30 if(argc !=3) 31 { 32 cout << " Usage: ./CaloGrid [detector card] [calo name]"<<endl; 33 cout<< "Example: ./CaloGrid cards/delphes_card_CMS.tcl ECal" <<endl; 34 return 0; 35 } 36 36 37 37 TString card(argv[1]); … … 39 39 ExRootConfReader *confReader = new ExRootConfReader; 40 40 confReader->ReadFile(card); 41 42 std::vector<std::string> calorimeters_; 43 std::map<std::string, std::set< std::pair<Double_t, Int_t> > > caloBinning_; 44 45 std::string s(argv[2]); 46 std::replace( s.begin(), s.end(), ',', ' ' ); 47 std::istringstream stream( s ); 48 std::string word; 49 while (stream >> word) calorimeters_.push_back(word); 41 50 42 std::vector<std::string> calorimeters_; 43 std::map<std::string, std::set<std::pair<Double_t, Int_t> > > caloBinning_; 51 caloBinning_.clear(); // calo binning 44 52 45 std::string s(argv[2]); 46 std::replace(s.begin(), s.end(), ',', ' '); 47 std::istringstream stream(s); 48 std::string word; 49 while(stream >> word) calorimeters_.push_back(word); 50 51 caloBinning_.clear(); // calo binning 52 53 TCanvas c("", "", 1600, 838); 54 55 gPad->SetLeftMargin(0.16); 56 gPad->SetTopMargin(0.16); 57 gPad->SetBottomMargin(0.20); 53 TCanvas c("","",1600,838); 54 55 gPad->SetLeftMargin(0.16) ; 56 gPad->SetTopMargin(0.16) ; 57 gPad->SetBottomMargin(0.20) ; 58 58 gStyle->SetOptStat(0000000); 59 59 60 60 gStyle->SetTextFont(132); 61 61 62 62 TH2F h2("h2", "", 1, -6, 6, 1, 0, 6.28); 63 63 … … 71 71 h2.GetYaxis()->SetLabelFont(132); 72 72 73 h2.GetXaxis()->SetTitleOffset(1.4); 74 h2.GetYaxis()->SetTitleOffset(1.1); 75 h2.GetXaxis()->SetLabelOffset(0.02); 76 h2.GetYaxis()->SetLabelOffset(0.02); 77 h2.GetXaxis()->SetTitleSize(0.06); 78 h2.GetYaxis()->SetTitleSize(0.06); 79 h2.GetXaxis()->SetLabelSize(0.06); 80 h2.GetYaxis()->SetLabelSize(0.06); 73 h2.GetXaxis()->SetTitleOffset(1.4) ; 74 h2.GetYaxis()->SetTitleOffset(1.1) ; 75 h2.GetXaxis()->SetLabelOffset(0.02) ; 76 h2.GetYaxis()->SetLabelOffset(0.02) ; 77 h2.GetXaxis()->SetTitleSize(0.06) ; 78 h2.GetYaxis()->SetTitleSize(0.06) ; 79 h2.GetXaxis()->SetLabelSize(0.06) ; 80 h2.GetYaxis()->SetLabelSize(0.06) ; 81 82 h2.GetXaxis()->SetTickLength(0.0) ; 83 h2.GetYaxis()->SetTickLength(0.0) ; 81 84 82 h2.GetXaxis()->SetTickLength(0.0); 83 h2.GetYaxis()->SetTickLength(0.0); 84 85 h2.Draw(); 86 87 // fake loop just keeping it for convenience right now 88 for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) 89 { 90 85 86 h2.Draw(); 87 88 // fake loop just keeping it for convenience right now 89 for(std::vector<std::string>::const_iterator calo=calorimeters_.begin();calo!=calorimeters_.end(); ++calo) { 90 91 91 //first entry is eta bin, second is number of phi bins 92 set< pair<Double_t, Int_t> > caloBinning;92 set< pair<Double_t, Int_t> > caloBinning; 93 93 ExRootConfParam paramEtaBins, paramPhiBins; 94 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins", 94 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",calo->c_str())); 95 95 Int_t size = param.GetSize(); 96 97 for(int i = 0; i < size / 2; ++i) 98 { 99 paramEtaBins = param[i * 2]; 100 paramPhiBins = param[i * 2 + 1]; 101 assert(paramEtaBins.GetSize() == 1); 102 103 caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(), paramPhiBins.GetSize() - 1)); 96 97 for(int i = 0; i < size/2; ++i) { 98 paramEtaBins = param[i*2]; 99 paramPhiBins = param[i*2+1]; 100 assert(paramEtaBins.GetSize()==1); 101 102 caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(),paramPhiBins.GetSize()-1)); 104 103 } 105 104 caloBinning_[*calo] = caloBinning; 106 107 TLine *liney; 108 TLine *linex; 109 110 //loop over calo binning 111 std::set<std::pair<Double_t, Int_t> >::iterator it; 112 113 Int_t n = -1; 114 for(it = caloBinning.begin(); it != caloBinning.end(); ++it) 105 106 TLine *liney; 107 TLine *linex; 108 109 //loop over calo binning 110 std::set<std::pair<Double_t, Int_t> >::iterator it; 111 112 Int_t n = -1; 113 for (it = caloBinning.begin(); it != caloBinning.end(); ++it) 114 { 115 n++; 116 117 if(debug)cout<<"-----------------------"<<endl; 118 if(debug)cout<<it->first<<","<<it->second<<endl; 119 liney = new TLine(it->first,0,it->first,6.28); 120 liney->SetLineColor(kRed+3); 121 liney->Draw(); 122 123 set<std::pair<Double_t, Int_t> >::iterator it2 = it; 124 it2--; 125 126 for(int j = 0; j <= it->second; j++) 115 127 { 116 n++; 117 118 if(debug) cout << "-----------------------" << endl; 119 if(debug) cout << it->first << "," << it->second << endl; 120 liney = new TLine(it->first, 0, it->first, 6.28); 121 liney->SetLineColor(kRed + 3); 122 liney->Draw(); 123 124 set<std::pair<Double_t, Int_t> >::iterator it2 = it; 125 it2--; 126 127 for(int j = 0; j <= it->second; j++) 128 { 129 130 Double_t yval0 = 0 + 6.28 * j / it->second; 131 132 if(debug) cout << it2->first << "," << yval0 << "," << it->first << "," << yval0 << endl; 133 134 linex = new TLine(it->first, yval0, it2->first, yval0); 135 linex->SetLineColor(kRed + 3); 136 linex->Draw(); 137 } 138 } 128 129 Double_t yval0 = 0 + 6.28 * j / it->second; 130 131 if(debug) cout<<it2->first<<","<<yval0<<","<<it->first<<","<<yval0<<endl; 132 133 linex = new TLine(it->first,yval0,it2->first,yval0); 134 linex->SetLineColor(kRed+3); 135 linex->Draw(); 136 137 } 138 139 140 } 141 142 139 143 } 140 144 141 145 TString text = TString(s); 142 TText *th1 = new TText(5.00, 6.45,text);143 th1->SetTextAlign(31); 144 th1->SetTextFont(132); 146 TText *th1 = new TText(5.00,6.45,text); 147 th1->SetTextAlign(31); 148 th1->SetTextFont(132); 145 149 th1->SetTextSize(0.075); 146 150 th1->Draw(); 147 151 152 148 153 TString output = TString(s); 149 c.Print(output + ".png", "png"); 150 c.Print(output + ".pdf", "pdf"); 154 c.Print(output+".png","png"); 155 c.Print(output+".pdf","pdf"); 156 151 157 } -
examples/Example1.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 #include <iostream> 20 21 #include <utility> 21 22 #include <vector> 22 23 23 #include "TApplication.h"24 24 #include "TROOT.h" 25 25 #include "TSystem.h" 26 #include "TApplication.h" 26 27 27 28 #include "TString.h" 28 29 29 #include "TClonesArray.h"30 30 #include "TH2.h" 31 31 #include "THStack.h" 32 32 #include "TLegend.h" 33 #include "TPaveText.h" 34 #include "TClonesArray.h" 33 35 #include "TLorentzVector.h" 34 #include "TPaveText.h"35 36 36 37 #include "classes/DelphesClasses.h" 37 38 38 #include "ExRootAnalysis/ExRootResult.h"39 #include "ExRootAnalysis/ExRootTreeBranch.h"40 39 #include "ExRootAnalysis/ExRootTreeReader.h" 41 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 42 #include "ExRootAnalysis/ExRootResult.h" 42 43 #include "ExRootAnalysis/ExRootUtilities.h" 43 44 … … 71 72 TString inputFile(argv[1]); 72 73 73 74 //------------------------------------------------------------------------------ 74 75 75 76 // Here you call your macro's main function 76 77 77 78 Example1(inputFile); 78 79 79 //------------------------------------------------------------------------------ 80 //------------------------------------------------------------------------------ 81 80 82 } 83 84 -
external/ExRootAnalysis/ExRootClassifier.h
r0e7d64a re39abb4 11 11 virtual ~ExRootClassifier() {} 12 12 virtual Int_t GetCategory(TObject *object) = 0; 13 13 14 }; 14 15 15 16 #endif /* ExRootClassifier */ 17 -
external/ExRootAnalysis/ExRootConfReader.cc
r0e7d64a re39abb4 14 14 #include "TSystem.h" 15 15 16 #include <iostream> 17 #include <iomanip> 16 18 #include <fstream> 17 #include < iomanip>18 #include < iostream>19 #include <string> 20 #include <stdexcept> 19 21 #include <sstream> 20 #include <stdexcept>21 #include <string>22 22 23 23 using namespace std; … … 186 186 int ModuleObjCmdProc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 187 187 { 188 ExRootConfReader *reader = static_cast<ExRootConfReader 188 ExRootConfReader *reader = static_cast<ExRootConfReader*>(clientData); 189 189 190 190 if(objc < 3) … … 203 203 Tcl_ListObjAppendElement(interp, object, Tcl_NewStringObj("namespace", -1)); 204 204 Tcl_ListObjAppendElement(interp, object, Tcl_NewStringObj("eval", -1)); 205 Tcl_ListObjAppendList(interp, object, Tcl_NewListObj(objc - 2, objv +2));205 Tcl_ListObjAppendList(interp, object, Tcl_NewListObj(objc-2, objv+2)); 206 206 207 207 return Tcl_GlobalEvalObj(interp, object); … … 215 215 int SourceObjCmdProc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) 216 216 { 217 ExRootConfReader *reader = static_cast<ExRootConfReader 217 ExRootConfReader *reader = static_cast<ExRootConfReader*>(clientData); 218 218 stringstream fileName; 219 219 … … 245 245 if(fObject && TCL_OK != Tcl_GetIntFromObj(fTclInterp, fObject, &result)) 246 246 { 247 message << "parameter '" 247 message << "parameter '"<< fName << "' is not an integer." << endl; 248 248 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 249 249 throw runtime_error(message.str()); … … 260 260 if(fObject && TCL_OK != Tcl_GetLongFromObj(fTclInterp, fObject, &result)) 261 261 { 262 message << "parameter '" 262 message << "parameter '"<< fName << "' is not an long integer." << endl; 263 263 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 264 264 throw runtime_error(message.str()); … … 275 275 if(fObject && TCL_OK != Tcl_GetDoubleFromObj(fTclInterp, fObject, &result)) 276 276 { 277 message << "parameter '" 277 message << "parameter '"<< fName << "' is not a number." << endl; 278 278 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 279 279 throw runtime_error(message.str()); … … 290 290 if(fObject && TCL_OK != Tcl_GetBooleanFromObj(fTclInterp, fObject, &result)) 291 291 { 292 message << "parameter '" 292 message << "parameter '"<< fName << "' is not a boolean." << endl; 293 293 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 294 294 throw runtime_error(message.str()); … … 314 314 if(fObject && TCL_OK != Tcl_ListObjLength(fTclInterp, fObject, &length)) 315 315 { 316 message << "parameter '" 316 message << "parameter '"<< fName << "' is not a list." << endl; 317 317 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 318 318 throw runtime_error(message.str()); … … 329 329 if(fObject && TCL_OK != Tcl_ListObjIndex(fTclInterp, fObject, index, &object)) 330 330 { 331 message << "parameter '" 331 message << "parameter '"<< fName << "' is not a list." << endl; 332 332 message << fName << " = " << Tcl_GetStringFromObj(fObject, 0); 333 333 throw runtime_error(message.str()); -
external/ExRootAnalysis/ExRootConfReader.h
r0e7d64a re39abb4 21 21 { 22 22 public: 23 23 24 ExRootConfParam(const char *name = 0, Tcl_Obj *object = 0, Tcl_Interp *interp = 0); 24 25 … … 33 34 34 35 private: 36 35 37 const char *fName; //! 36 38 Tcl_Obj *fObject; //! … … 40 42 //------------------------------------------------------------------------------ 41 43 42 class ExRootConfReader : public TNamed44 class ExRootConfReader : public TNamed 43 45 { 44 46 public: … … 64 66 65 67 private: 68 66 69 const char *fTopDir; //! 67 70 … … 74 77 75 78 #endif 79 -
external/ExRootAnalysis/ExRootFilter.cc
r0e7d64a re39abb4 11 11 #include "ExRootAnalysis/ExRootClassifier.h" 12 12 13 #include "TSeqCollection.h" 13 14 #include "TObjArray.h" 14 #include "TSeqCollection.h"15 15 16 16 #include <iostream> 17 #include <stdexcept> 17 18 #include <sstream> 18 #include <stdexcept>19 19 20 20 using namespace std; 21 21 22 typedef map<Int_t, TObjArray 23 typedef map<ExRootClassifier 22 typedef map<Int_t, TObjArray*> TCategoryMap; 23 typedef map<ExRootClassifier*, pair<Bool_t, TCategoryMap> > TClassifierMap; 24 24 25 25 ExRootFilter::ExRootFilter(const TSeqCollection *collection) : … … 40 40 itSubMap != itMap->second.second.end(); ++itSubMap) 41 41 { 42 delete (itSubMap->second);42 delete (itSubMap->second); 43 43 } 44 44 } … … 132 132 133 133 //------------------------------------------------------------------------------ 134 -
external/ExRootAnalysis/ExRootFilter.h
r0e7d64a re39abb4 14 14 { 15 15 public: 16 16 17 ExRootFilter(const TSeqCollection *collection); 17 18 ~ExRootFilter(); … … 22 23 23 24 private: 25 24 26 const TSeqCollection *fCollection; //! 25 27 TIterator *fIter; //! 26 28 27 std::map<ExRootClassifier *, std::pair<Bool_t, std::map<Int_t, TObjArray *> > > fMap; //! 29 std::map<ExRootClassifier*, std::pair<Bool_t, std::map<Int_t, TObjArray*> > > fMap; //! 30 28 31 }; 29 32 30 33 #endif /* ExRootFilter */ 34 -
external/ExRootAnalysis/ExRootProgressBar.cc
r0e7d64a re39abb4 14 14 #include <iostream> 15 15 16 #include <string.h> 16 17 #include <stdio.h> 17 #include <string.h>18 18 19 19 using namespace std; … … 46 46 if(fEntries > 0) 47 47 { 48 Int_t hashes = Int_t(Double_t(entry) / fEntries *fWidth);48 Int_t hashes = Int_t(Double_t(entry)/fEntries*fWidth); 49 49 if(hashes > fWidth) hashes = fWidth; 50 50 if(hashes != fHashes) … … 53 53 memset(fBar + hashes, '-', fWidth - hashes); 54 54 fHashes = hashes; 55 fprintf(stderr, "** [%s] (%.2f%%)\r", fBar, Float_t(entry) / fEntries *100.0);55 fprintf(stderr, "** [%s] (%.2f%%)\r", fBar, Float_t(entry)/fEntries*100.0); 56 56 } 57 57 } … … 77 77 78 78 //------------------------------------------------------------------------------ 79 -
external/ExRootAnalysis/ExRootProgressBar.h
r0e7d64a re39abb4 7 7 { 8 8 public: 9 9 10 ExRootProgressBar(Long64_t entries, Int_t width = 64); 10 11 ~ExRootProgressBar(); … … 14 15 15 16 private: 17 16 18 Long64_t fEntries, fEventCounter; 17 19 Int_t fWidth; … … 21 23 22 24 char *fBar; //! 25 23 26 }; 24 27 25 28 #endif /* ExRootProgressBar */ 29 -
external/ExRootAnalysis/ExRootResult.cc
r0e7d64a re39abb4 12 12 #include "ExRootAnalysis/ExRootUtilities.h" 13 13 14 #include "TROOT.h" 15 #include "TFile.h" 16 #include "TClass.h" 17 #include "TStyle.h" 14 18 #include "TCanvas.h" 15 #include "TClass.h" 16 #include "TFile.h" 17 #include "TFolder.h" 19 #include "TLegend.h" 20 #include "TPaveText.h" 21 #include "TPaveStats.h" 22 #include "TList.h" 18 23 #include "TH2.h" 19 24 #include "THStack.h" 20 #include "TLegend.h" 21 #include "TList.h" 25 #include "TProfile.h" 22 26 #include "TObjArray.h" 23 #include "TPaveStats.h" 24 #include "TPaveText.h" 25 #include "TProfile.h" 26 #include "TROOT.h" 27 #include "TStyle.h" 27 #include "TFolder.h" 28 28 29 29 #include <iostream> … … 37 37 //------------------------------------------------------------------------------ 38 38 39 ExRootResult::ExRootResult() : 40 fCanvas(0), fFolder(0) 39 ExRootResult::ExRootResult() : fCanvas(0), fFolder(0) 41 40 { 42 41 } … … 46 45 ExRootResult::~ExRootResult() 47 46 { 48 set<TObject 47 set<TObject*>::iterator itPool; 49 48 for(itPool = fPool.begin(); itPool != fPool.end(); ++itPool) 50 49 { … … 69 68 TFile *file = new TFile(fileName, "RECREATE"); 70 69 file->cd(); 71 std::map<TObject 70 std::map<TObject*, PlotSettings>::iterator itPlotMap; 72 71 for(itPlotMap = fPlotMap.begin(); itPlotMap != fPlotMap.end(); ++itPlotMap) 73 72 { … … 124 123 // gStyle->SetOptFit(101); 125 124 126 fCanvas = static_cast<TCanvas 125 fCanvas = static_cast<TCanvas*>(gROOT->FindObject("c1")); 127 126 if(fCanvas) 128 127 { … … 155 154 if(!plot) return; 156 155 157 std::map<TObject 156 std::map<TObject*, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot); 158 157 if(itPlotMap != fPlotMap.end()) 159 158 { … … 179 178 if(plot->IsA()->InheritsFrom(TH1::Class())) 180 179 { 181 histogram = static_cast<TH1 182 } 183 184 map<TObject 180 histogram = static_cast<TH1*>(plot); 181 } 182 183 map<TObject*, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot); 185 184 if(itPlotMap != fPlotMap.end()) 186 185 { … … 225 224 TCanvas *canvas = GetCanvas(); 226 225 227 map<TObject 226 map<TObject*, PlotSettings>::iterator itPlotMap; 228 227 229 228 for(itPlotMap = fPlotMap.begin(); itPlotMap != fPlotMap.end(); ++itPlotMap) … … 237 236 if(object->IsA()->InheritsFrom(TH1::Class())) 238 237 { 239 histogram = static_cast<TH1 238 histogram = static_cast<TH1*>(object); 240 239 } 241 240 else if(object->IsA()->InheritsFrom(THStack::Class())) 242 241 { 243 stack = static_cast<THStack 244 histogram = static_cast<TH1 242 stack = static_cast<THStack*>(object); 243 histogram = static_cast<TH1*>(stack->GetHists()->First()); 245 244 } 246 245 … … 272 271 if(histogram) 273 272 { 274 stats = static_cast<TPaveStats 273 stats = static_cast<TPaveStats*>(histogram->FindObject("stats")); 275 274 if(stats) 276 275 { … … 301 300 302 301 TH1 *ExRootResult::AddHist1D(const char *name, const char *title, 303 const char *xlabel, const char *ylabel,304 Int_t nxbins, Axis_t xmin, Axis_t xmax,305 Int_t logx, Int_t logy)302 const char *xlabel, const char *ylabel, 303 Int_t nxbins, Axis_t xmin, Axis_t xmax, 304 Int_t logx, Int_t logy) 306 305 { 307 306 TH1F *hist = new TH1F(name, title, nxbins, xmin, xmax); … … 325 324 326 325 TH1 *ExRootResult::AddHist1D(const char *name, const char *title, 327 const char *xlabel, const char *ylabel,328 Int_t nxbins, const Float_t *bins,329 Int_t logx, Int_t logy)326 const char *xlabel, const char *ylabel, 327 Int_t nxbins, const Float_t *bins, 328 Int_t logx, Int_t logy) 330 329 { 331 330 TH1F *hist = new TH1F(name, title, nxbins, bins); … … 349 348 350 349 TProfile *ExRootResult::AddProfile(const char *name, const char *title, 351 const char *xlabel, const char *ylabel,352 Int_t nxbins, Axis_t xmin, Axis_t xmax,353 Int_t logx, Int_t logy)350 const char *xlabel, const char *ylabel, 351 Int_t nxbins, Axis_t xmin, Axis_t xmax, 352 Int_t logx, Int_t logy) 354 353 { 355 354 TProfile *profile = new TProfile(name, title, nxbins, xmin, xmax); … … 373 372 374 373 TH2 *ExRootResult::AddHist2D(const char *name, const char *title, 375 const char *xlabel, const char *ylabel,376 Int_t nxbins, Axis_t xmin, Axis_t xmax,377 Int_t nybins, Axis_t ymin, Axis_t ymax,378 Int_t logx, Int_t logy)374 const char *xlabel, const char *ylabel, 375 Int_t nxbins, Axis_t xmin, Axis_t xmax, 376 Int_t nybins, Axis_t ymin, Axis_t ymax, 377 Int_t logx, Int_t logy) 379 378 { 380 379 TH2F *hist = new TH2F(name, title, nxbins, xmin, xmax, nybins, ymin, ymax); -
external/ExRootAnalysis/ExRootResult.h
r0e7d64a re39abb4 2 2 #define ExRootResult_h 3 3 4 #include "Rtypes.h" 4 5 #include "Gtypes.h" 5 #include "Rtypes.h"6 6 #include "TMath.h" 7 7 8 #include <set> 8 9 #include <map> 9 #include <set>10 10 11 11 class TH1; … … 23 23 24 24 public: 25 25 26 ExRootResult(); 26 27 ~ExRootResult(); … … 31 32 32 33 TH1 *AddHist1D(const char *name, const char *title, 33 const char *xlabel, const char *ylabel,34 Int_t nxbins, Axis_t xmin, Axis_t xmax,35 Int_t logx = 0, Int_t logy = 0);34 const char *xlabel, const char *ylabel, 35 Int_t nxbins, Axis_t xmin, Axis_t xmax, 36 Int_t logx = 0, Int_t logy = 0); 36 37 37 38 TH1 *AddHist1D(const char *name, const char *title, 38 const char *xlabel, const char *ylabel,39 Int_t nxbins, const Float_t *bins,40 Int_t logx = 0, Int_t logy = 0);39 const char *xlabel, const char *ylabel, 40 Int_t nxbins, const Float_t *bins, 41 Int_t logx = 0, Int_t logy = 0); 41 42 42 43 TProfile *AddProfile(const char *name, const char *title, 43 const char *xlabel, const char *ylabel,44 Int_t nxbins, Axis_t xmin, Axis_t xmax,45 Int_t logx = 0, Int_t logy = 0);44 const char *xlabel, const char *ylabel, 45 Int_t nxbins, Axis_t xmin, Axis_t xmax, 46 Int_t logx = 0, Int_t logy = 0); 46 47 47 48 TH2 *AddHist2D(const char *name, const char *title, 48 const char *xlabel, const char *ylabel,49 Int_t nxbins, Axis_t xmin, Axis_t xmax,50 Int_t nybins, Axis_t ymin, Axis_t ymax,51 Int_t logx = 0, Int_t logy = 0);49 const char *xlabel, const char *ylabel, 50 Int_t nxbins, Axis_t xmin, Axis_t xmax, 51 Int_t nybins, Axis_t ymin, Axis_t ymax, 52 Int_t logx = 0, Int_t logy = 0); 52 53 53 54 THStack *AddHistStack(const char *name, const char *title); … … 61 62 TCanvas *GetCanvas(); 62 63 63 void PrintPlot(TObject *plot, const char *sufix = "", const char *format = "eps");64 void PrintPlot(TObject *plot, const char *sufix = "", const char *format = "eps"); 64 65 65 66 void SetFolder(TFolder *folder) { fFolder = folder; } 66 67 67 68 private: 69 68 70 struct PlotSettings 69 71 { … … 77 79 TCanvas *fCanvas; //! 78 80 79 std::set<TObject 81 std::set<TObject*> fPool; //! 80 82 81 std::map<TObject 83 std::map<TObject*, PlotSettings> fPlotMap; //! 82 84 83 85 TFolder *fFolder; //! 86 84 87 }; 85 88 86 89 #endif /* ExRootResult_h */ 90 -
external/ExRootAnalysis/ExRootTask.cc
r0e7d64a re39abb4 11 11 #include "ExRootAnalysis/ExRootConfReader.h" 12 12 13 #include "TROOT.h" 13 14 #include "TClass.h" 14 15 #include "TFolder.h" 15 #include "TROOT.h"16 16 #include "TString.h" 17 17 18 #include <iostream> 18 19 #include <iomanip> 19 #include < iostream>20 #include <stdexcept> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 static const char *const kINIT = "0"; … … 144 144 145 145 if(!cl) return 0; 146 146 147 147 if(!cl->InheritsFrom(ExRootTask::Class())) 148 148 { … … 310 310 return object; 311 311 } 312 -
external/ExRootAnalysis/ExRootTask.h
r0e7d64a re39abb4 17 17 class TFolder; 18 18 19 class ExRootTask : public TTask19 class ExRootTask : public TTask 20 20 { 21 21 public: 22 22 23 ExRootTask(); 23 24 virtual ~ExRootTask(); … … 40 41 ExRootTask *NewTask(const char *className, const char *taskName); 41 42 42 void Exec(Option_t *option);43 void Exec(Option_t* option); 43 44 44 45 int GetInt(const char *name, int defaultValue, int index = -1); … … 54 55 55 56 protected: 57 56 58 TFolder *GetFolder() const { return fFolder; } 57 59 ExRootConfReader *GetConfReader() const { return fConfReader; } … … 61 63 62 64 private: 65 63 66 TFolder *fFolder; //! 64 67 ExRootConfReader *fConfReader; //! … … 68 71 69 72 #endif /* ExRootTask */ 73 -
external/ExRootAnalysis/ExRootTreeBranch.cc
r0e7d64a re39abb4 11 11 #include "ExRootAnalysis/ExRootTreeBranch.h" 12 12 13 #include "TFile.h" 14 #include "TTree.h" 15 #include "TString.h" 13 16 #include "TClonesArray.h" 14 #include "TFile.h"15 #include "TString.h"16 #include "TTree.h"17 17 18 18 #include <iostream> 19 #include <stdexcept> 19 20 #include <sstream> 20 #include <stdexcept>21 21 22 22 using namespace std; … … 28 28 { 29 29 stringstream message; 30 31 30 // cl->IgnoreTObjectStreamer(); 31 // cl->BypassStreamer(); 32 32 fData = new TClonesArray(cl, fCapacity); 33 33 … … 65 65 if(fSize >= fCapacity) 66 66 { 67 if(fCapacity < 10) 68 fCapacity = 10; 69 else if(fCapacity < 30) 70 fCapacity = 30; 71 else if(fCapacity < 100) 72 fCapacity = 100; 73 else if(fCapacity < 250) 74 fCapacity = 250; 75 else 76 fCapacity *= 2; 67 if(fCapacity < 10) fCapacity = 10; 68 else if(fCapacity < 30) fCapacity = 30; 69 else if(fCapacity < 100) fCapacity = 100; 70 else if(fCapacity < 250) fCapacity = 250; 71 else fCapacity *= 2; 77 72 78 73 fData->ExpandCreateFast(fCapacity); … … 81 76 fData->ExpandCreateFast(fSize); 82 77 } 83 78 84 79 return fData->AddrAt(fSize++); 85 80 } … … 94 89 95 90 //------------------------------------------------------------------------------ 91 -
external/ExRootAnalysis/ExRootTreeBranch.h
r0e7d64a re39abb4 19 19 { 20 20 public: 21 21 22 ExRootTreeBranch(const char *name, TClass *cl, TTree *tree = 0); 22 23 ~ExRootTreeBranch(); … … 26 27 27 28 private: 29 28 30 Int_t fSize, fCapacity; //! 29 31 TClonesArray *fData; //! … … 31 33 32 34 #endif /* ExRootTreeBranch */ 35 -
external/ExRootAnalysis/ExRootTreeReader.cc
r0e7d64a re39abb4 10 10 #include "ExRootAnalysis/ExRootTreeReader.h" 11 11 12 #include "TBranchElement.h" 12 #include "TH2.h" 13 #include "TStyle.h" 13 14 #include "TCanvas.h" 14 15 #include "TClonesArray.h" 15 #include "TH2.h" 16 #include "TStyle.h" 16 #include "TBranchElement.h" 17 17 18 18 #include <iostream> … … 51 51 if(fChain->IsA() == TChain::Class()) 52 52 { 53 TChain *chain = static_cast<TChain 53 TChain *chain = static_cast<TChain*>(fChain); 54 54 if(chain->GetTreeNumber() != fCurrentTree) 55 55 { … … 94 94 if(branch->IsA() == TBranchElement::Class()) 95 95 { 96 TBranchElement *element = static_cast<TBranchElement 96 TBranchElement *element = static_cast<TBranchElement*>(branch); 97 97 const char *className = element->GetClonesName(); 98 98 Int_t size = element->GetMaximum(); … … 145 145 146 146 //------------------------------------------------------------------------------ 147 -
external/ExRootAnalysis/ExRootTreeReader.h
r0e7d64a re39abb4 10 10 */ 11 11 12 #include "TROOT.h" 13 #include "TNamed.h" 12 14 #include "TChain.h" 13 15 #include "TFile.h" 14 #include "TNamed.h"15 #include "TROOT.h"16 16 17 17 #include <map> 18 18 19 class ExRootTreeReader : public TNamed19 class ExRootTreeReader : public TNamed 20 20 { 21 public: 21 public : 22 22 23 ExRootTreeReader(TTree *tree = 0); 23 24 ~ExRootTreeReader(); … … 31 32 32 33 private: 34 33 35 Bool_t Notify(); 34 36 … … 36 38 Int_t fCurrentTree; //! current Tree number in a TChain 37 39 38 typedef std::map<TString, std::pair<TBranch *, TClonesArray*> > TBranchMap;40 typedef std::map<TString, std::pair<TBranch*, TClonesArray*> > TBranchMap; 39 41 40 42 TBranchMap fBranchMap; //! -
external/ExRootAnalysis/ExRootTreeWriter.cc
r0e7d64a re39abb4 11 11 #include "ExRootAnalysis/ExRootTreeBranch.h" 12 12 13 #include "TROOT.h" 14 #include "TFile.h" 15 #include "TTree.h" 13 16 #include "TClonesArray.h" 14 #include "TFile.h"15 #include "TROOT.h"16 #include "TTree.h"17 17 18 18 #include <iostream> 19 #include <stdexcept> 19 20 #include <sstream> 20 #include <stdexcept>21 21 22 22 using namespace std; … … 31 31 ExRootTreeWriter::~ExRootTreeWriter() 32 32 { 33 set<ExRootTreeBranch 33 set<ExRootTreeBranch*>::iterator itBranches; 34 34 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 35 35 { 36 delete (*itBranches);36 delete (*itBranches); 37 37 } 38 38 … … 69 69 void ExRootTreeWriter::Clear() 70 70 { 71 set<ExRootTreeBranch 71 set<ExRootTreeBranch*>::iterator itBranches; 72 72 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 73 73 { … … 95 95 96 96 tree->SetDirectory(fFile); 97 tree->SetAutoSave(10000000); // autosave when 10 MB written97 tree->SetAutoSave(10000000); // autosave when 10 MB written 98 98 99 99 return tree; -
external/ExRootAnalysis/ExRootTreeWriter.h
r0e7d64a re39abb4 19 19 class ExRootTreeBranch; 20 20 21 class ExRootTreeWriter : public TNamed21 class ExRootTreeWriter : public TNamed 22 22 { 23 23 public: 24 24 25 ExRootTreeWriter(TFile *file = 0, const char *treeName = "Analysis"); 25 26 ~ExRootTreeWriter(); … … 35 36 36 37 private: 38 37 39 TTree *NewTree(); 38 40 … … 42 44 TString fTreeName; //! 43 45 44 std::set<ExRootTreeBranch 46 std::set<ExRootTreeBranch*> fBranches; //! 45 47 46 48 ClassDef(ExRootTreeWriter, 1) … … 48 50 49 51 #endif /* ExRootTreeWriter */ 52 -
external/ExRootAnalysis/ExRootUtilities.cc
r0e7d64a re39abb4 10 10 #include "ExRootAnalysis/ExRootUtilities.h" 11 11 12 #include "TROOT.h" 13 #include "TH1.h" 12 14 #include "TChain.h" 13 #include "TH1.h"14 #include "TROOT.h"15 15 16 #include <iostream> 16 17 #include <fstream> 17 #include <iostream>18 18 19 19 using namespace std; … … 74 74 75 75 //------------------------------------------------------------------------------ 76 -
external/Hector/H_Beam.h
r0e7d64a re39abb4 107 107 //@{ 108 108 inline const float getEmittanceX() const { 109 if( x_disp * tx_disp == 0) cout<<"Warning : Degenerate Beam : x-emittance = 0"<<endl;109 if(!x_disp*tx_disp) cout<<"Warning : Degenerate Beam : x-emittance = 0"<<endl; 110 110 return x_disp * tan(tx_disp/URAD)/URAD; 111 111 } 112 112 inline const float getEmittanceY() const { 113 if(y_disp * ty_disp == 0) cout<<"Warning : Degenerate Beam : y-emittance = 0"<<endl;113 if(!y_disp*ty_disp) cout<<"Warning : Degenerate Beam : y-emittance = 0"<<endl; 114 114 return y_disp * tan(ty_disp/URAD)/URAD; 115 115 } -
external/fastjet/VERSION
r0e7d64a re39abb4 1 3.3. 21 3.3.1 -
external/fastjet/config_auto.h
r0e7d64a re39abb4 65 65 66 66 /* compile the deprecated parts of the interface using auto-ptr */ 67 /* #undef HAVE_AUTO_PTR_INTERFACE */ 67 #ifndef FASTJET_HAVE_AUTO_PTR_INTERFACE 68 #define FASTJET_HAVE_AUTO_PTR_INTERFACE /**/ 69 #endif 68 70 69 71 /* compiler supports c++14 deprecated keyword */ … … 167 169 /* Define to the full name and version of this package. */ 168 170 #ifndef FASTJET_PACKAGE_STRING 169 #define FASTJET_PACKAGE_STRING "FastJet 3.3. 2"171 #define FASTJET_PACKAGE_STRING "FastJet 3.3.1" 170 172 #endif 171 173 … … 182 184 /* Define to the version of this package. */ 183 185 #ifndef FASTJET_PACKAGE_VERSION 184 #define FASTJET_PACKAGE_VERSION "3.3. 2"186 #define FASTJET_PACKAGE_VERSION "3.3.1" 185 187 #endif 186 188 … … 192 194 /* Version number of package */ 193 195 #ifndef FASTJET_VERSION 194 #define FASTJET_VERSION "3.3. 2"196 #define FASTJET_VERSION "3.3.1" 195 197 #endif 196 198 … … 207 209 /* Version of the package under the form XYYZZ (instead of X.Y.Z) */ 208 210 #ifndef FASTJET_VERSION_NUMBER 209 #define FASTJET_VERSION_NUMBER 3030 2211 #define FASTJET_VERSION_NUMBER 30301 210 212 #endif 211 213 212 214 /* Patch version of this package */ 213 215 #ifndef FASTJET_VERSION_PATCHLEVEL 214 #define FASTJET_VERSION_PATCHLEVEL 2216 #define FASTJET_VERSION_PATCHLEVEL 1 215 217 #endif 216 218 -
external/fastjet/config_raw.h
r0e7d64a re39abb4 39 39 40 40 /* compile the deprecated parts of the interface using auto-ptr */ 41 /* #undef HAVE_AUTO_PTR_INTERFACE*/41 #define HAVE_AUTO_PTR_INTERFACE /**/ 42 42 43 43 /* compiler supports c++14 deprecated keyword */ … … 106 106 107 107 /* Define to the full name and version of this package. */ 108 #define PACKAGE_STRING "FastJet 3.3. 2"108 #define PACKAGE_STRING "FastJet 3.3.1" 109 109 110 110 /* Define to the one symbol short name of this package. */ … … 115 115 116 116 /* Define to the version of this package. */ 117 #define PACKAGE_VERSION "3.3. 2"117 #define PACKAGE_VERSION "3.3.1" 118 118 119 119 /* Define to 1 if you have the ANSI C header files. */ … … 121 121 122 122 /* Version number of package */ 123 #define VERSION "3.3. 2"123 #define VERSION "3.3.1" 124 124 125 125 /* Major version of this package */ … … 130 130 131 131 /* Version of the package under the form XYYZZ (instead of X.Y.Z) */ 132 #define VERSION_NUMBER 3030 2132 #define VERSION_NUMBER 30301 133 133 134 134 /* Patch version of this package */ 135 #define VERSION_PATCHLEVEL 2135 #define VERSION_PATCHLEVEL 1 136 136 137 137 /* Pre-release version of this package */ -
external/fastjet/config_win.h
r0e7d64a re39abb4 1 #define FASTJET_PACKAGE_STRING "FastJet 3.3. 2"2 #define FASTJET_PACKAGE_VERSION "3.3. 2"3 #define FASTJET_VERSION "3.3. 2"1 #define FASTJET_PACKAGE_STRING "FastJet 3.3.1" 2 #define FASTJET_PACKAGE_VERSION "3.3.1" 3 #define FASTJET_VERSION "3.3.1" 4 4 #define FASTJET_VERSION_MAJOR 3 5 5 #define FASTJET_VERSION_MINOR 3 6 #define FASTJET_VERSION_PATCHLEVEL 27 #define FASTJET_VERSION_NUMBER 3030 26 #define FASTJET_VERSION_PATCHLEVEL 1 7 #define FASTJET_VERSION_NUMBER 30301 8 8 9 9 /* The ATLASCone plugin is disabled by default*/ -
external/fastjet/contribs/ValenciaPlugin/AUTHORS
r0e7d64a re39abb4 1 The Valencia PluginFastJet contrib was written and is maintained and developed by: Ignacio Garcia Garcia, Marcel Vos, IFIC (UVEG/CSIC) Valencia, Spain1 The ValenciaJetAlgorithm FastJet contrib was written and is maintained and developed by: Ignacio Garcia Garcia, Marcel Vos, IFIC (UVEG/CSIC) Valencia, Spain 2 2 3 The first incarnation of the Valencia algorithm (with two parameters R and beta) was proposed "A robust jet reconstruction algorithm for high-energy lepton colliders", PLB 750 (2015) 95-99, arXiv:1404.4294 4 The authors acknowledge suggestions by Gavin P. Salam (CERN) and his help in assessing the IR safety of the algorithm 3 Acknowledging suggestions by Gavin P. Salam (CERN) and J. Thaler (MIT) 5 4 6 The VLC algorithm (with three parameters R, beta and gamma) is described in "Jet reconstruction at high-energy electron-positron colliders", EPJC 78 (2018) no. 2, 144. The addition of the gamma parameter was suggested by J. Thaler (MIT). The performance of the algorithm is evaluated in detail in this paper, in collaboration with Ph. Roloff, R. Simoniello (CERN) and M. Boronat, J. Fuster (IFIC)5 A preprint motivating the algorithm and describing its performance is available on: "A new jet algorithm for lepton colliders", arXiv:1404.4294 (submitted to PLB) 7 6 8 7 Please contact: marcel.vos@ific.uv.es for questions, queries and comments -
external/fastjet/contribs/ValenciaPlugin/ChangeLog
r0e7d64a re39abb4 1 22-12-2018: Gavin Salam <gavin.salam@cern.ch>2 * VERSION:3 * NEWS:4 updated version to 2.0.25 6 2018-12-18: Marcel Vos <marcel.vos@ific.uv.es>a7 * ValenciaPlugin.cc:8 Incorporates a modification suggested by9 Filip Zarnecki (Warsaw) to make sure the behaviour for negative10 beta is correct (added to trunk in june 2017 but left out of11 2.0.1)12 13 2018-12-04: Marcel Vos <marcel.vos@ific.uv.es>14 * VERSION15 * NEWS16 updated version to 2.0.117 18 * ValenciaPlugin.cc:19 Bug fix: a bug was discovered in the plugin by Matthias Weber (CERN)20 the calculation of the distance diB assumed massless constituents.21 The impact on the results - jet energy and mass - is typically small,22 but can be non-negligible23 24 1 24-02-2015 Marcel Vos <marcel.vos@ific.uv.es> 25 2 -
external/fastjet/contribs/ValenciaPlugin/NEWS
r0e7d64a re39abb4 1 22 December 2018: bug-fix release 2.0.2, for negative beta2 04 December 2018: bug-fix release 2.0.1, for massive constituents3 1 24 February 2015: version 2.0.0 4 2 21 February 2015: released 2.0-devel -
external/fastjet/contribs/ValenciaPlugin/VERSION
r0e7d64a re39abb4 1 2.0. 21 2.0.0 -
external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.cc
r0e7d64a re39abb4 1 // $Id: ValenciaPlugin.cc 1209 2018-12-05 16:18:01Z vos $1 // $Id: ValenciaPlugin.cc 776 2015-02-24 17:53:27Z vos $ 2 2 // 3 3 // Copyright (c) 2014, Marcel Vos and Ignacio Garcia … … 66 66 // E-to-the-2*beta times sin(polar angle)-to-the-2*gamma 67 67 if (E==0. || jet.perp()==0.) diB=0.; 68 // modified diB in release 2.0.1 69 diB = pow(E,2*beta) * pow(jet.perp()/sqrt(jet.perp2()+jet.pz()*jet.pz()),2*info->gamma()); 68 diB = pow(E,2*beta) * pow(jet.perp()/E,2*info->gamma()); 70 69 } 71 70 … … 79 78 - nz*jet->nz; 80 79 81 if ( pow(jet->E,2*beta) < pow(E,2*beta))80 if (jet->E < E) 82 81 dij *= 2 * pow(jet->E,2*beta); 83 82 else -
external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh
r0e7d64a re39abb4 1 // $Id: ValenciaPlugin.hh 77 1 2015-02-21 16:40:07Z vos $1 // $Id: ValenciaPlugin.hh 776 2015-02-24 17:53:27Z vos $ 2 2 // 3 3 // Copyright (c) 2014, Marcel Vos and Ignacio Garcia -
external/fastjet/plugins/SISCone/config.h
r0e7d64a re39abb4 83 83 /* Define to the full name and version of this package. */ 84 84 #ifndef SISCONE_PACKAGE_STRING 85 #define SISCONE_PACKAGE_STRING "SISCone 3.0. 4"85 #define SISCONE_PACKAGE_STRING "SISCone 3.0.3" 86 86 #endif 87 87 … … 98 98 /* Define to the version of this package. */ 99 99 #ifndef SISCONE_PACKAGE_VERSION 100 #define SISCONE_PACKAGE_VERSION "3.0. 4"100 #define SISCONE_PACKAGE_VERSION "3.0.3" 101 101 #endif 102 102 … … 111 111 /* Version number of package */ 112 112 #ifndef SISCONE_VERSION 113 #define SISCONE_VERSION "3.0. 4"113 #define SISCONE_VERSION "3.0.3" 114 114 #endif 115 115 -
external/fastjet/plugins/SISCone/config_raw.h
r0e7d64a re39abb4 48 48 49 49 /* Define to the full name and version of this package. */ 50 #define PACKAGE_STRING "SISCone 3.0. 4"50 #define PACKAGE_STRING "SISCone 3.0.3" 51 51 52 52 /* Define to the one symbol short name of this package. */ … … 57 57 58 58 /* Define to the version of this package. */ 59 #define PACKAGE_VERSION "3.0. 4"59 #define PACKAGE_VERSION "3.0.3" 60 60 61 61 /* Define to 1 if you have the ANSI C header files. */ … … 66 66 67 67 /* Version number of package */ 68 #define VERSION "3.0. 4"68 #define VERSION "3.0.3" -
external/fastjet/plugins/SISCone/split_merge.h
r0e7d64a re39abb4 446 446 // jet information 447 447 /// list of jet candidates 448 #if __cplusplus < 201103L 448 #ifdef SISCONE_USES_UNIQUE_PTR_AS_AUTO_PTR 449 std::unique_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates; 450 #else 449 451 std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates; 450 #else451 std::unique_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates;452 452 #endif 453 453 -
external/tcl/tcl.h
r0e7d64a re39abb4 488 488 EXTERN int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr)); 489 489 490 #ifdef TCL_MEM_DEBUG 491 # define Tcl_IncrRefCount(objPtr) \ 492 Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) 493 # define Tcl_DecrRefCount(objPtr) \ 494 Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) 495 # define Tcl_IsShared(objPtr) \ 496 Tcl_DbIsShared(objPtr, __FILE__, __LINE__) 497 #else 490 498 # define Tcl_IncrRefCount(objPtr) \ 491 499 ++(objPtr)->refCount … … 494 502 # define Tcl_IsShared(objPtr) \ 495 503 ((objPtr)->refCount > 1) 504 #endif 496 505 497 506 /* 498 507 * Macros and definitions that help to debug the use of Tcl objects. 508 * When TCL_MEM_DEBUG is defined, the Tcl_New* declarations are 509 * overridden to call debugging versions of the object creation procedures. 499 510 */ 500 511 … … 508 519 EXTERN Tcl_Obj * Tcl_NewStringObj _ANSI_ARGS_((char *bytes, 509 520 int length)); 521 522 #ifdef TCL_MEM_DEBUG 523 # define Tcl_NewBooleanObj(val) \ 524 Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) 525 # define Tcl_NewDoubleObj(val) \ 526 Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) 527 # define Tcl_NewIntObj(val) \ 528 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 529 # define Tcl_NewListObj(objc, objv) \ 530 Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) 531 # define Tcl_NewLongObj(val) \ 532 Tcl_DbNewLongObj(val, __FILE__, __LINE__) 533 # define Tcl_NewObj() \ 534 Tcl_DbNewObj(__FILE__, __LINE__) 535 # define Tcl_NewStringObj(bytes, len) \ 536 Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) 537 #endif /* TCL_MEM_DEBUG */ 510 538 511 539 /* … … 698 726 unsigned int size)); 699 727 728 #ifdef TCL_MEM_DEBUG 729 730 # define Tcl_Alloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) 731 # define Tcl_Free(x) Tcl_DbCkfree(x, __FILE__, __LINE__) 732 # define Tcl_Realloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) 733 # define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) 734 # define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__) 735 # define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) 736 737 EXTERN int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName)); 738 EXTERN void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file, 739 int line)); 740 741 #else 742 700 743 /* 701 744 * If USE_TCLALLOC is true, then we need to call Tcl_Alloc instead of … … 717 760 # define Tcl_DumpActiveMemory(x) 718 761 # define Tcl_ValidateAllMemory(x,y) 762 763 #endif /* TCL_MEM_DEBUG */ 719 764 720 765 /* -
external/tcl/tclBasic.c
r0e7d64a re39abb4 3287 3287 TclInitByteCodeObj(objPtr, &compEnv); 3288 3288 codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr; 3289 if (tclTraceCompile == 2) { 3290 TclPrintByteCodeObj(interp, objPtr); 3291 } 3289 3292 TclFreeCompileEnv(&compEnv); 3290 3293 } else { -
external/tcl/tclCkalloc.c
r0e7d64a re39abb4 22 22 #define TRUE 1 23 23 24 /* 25 *---------------------------------------------------------------------- 26 * 27 * Tcl_Alloc -- 28 * Interface to TclpAlloc. 29 * It does check that memory was actually allocated. 30 * 31 *---------------------------------------------------------------------- 32 */ 33 34 char * 35 Tcl_Alloc (size) 36 unsigned int size; 37 { 38 char *result; 39 40 result = TclpAlloc(size); 41 if (result == NULL) 42 panic("unable to alloc %d bytes", size); 43 return result; 44 } 45 24 #ifdef TCL_MEM_DEBUG 25 26 /* 27 * One of the following structures is allocated each time the 28 * "memory tag" command is invoked, to hold the current tag. 29 */ 30 31 typedef struct MemTag { 32 int refCount; /* Number of mem_headers referencing 33 * this tag. */ 34 char string[4]; /* Actual size of string will be as 35 * large as needed for actual tag. This 36 * must be the last field in the structure. */ 37 } MemTag; 38 39 #define TAG_SIZE(bytesInString) ((unsigned) sizeof(MemTag) + bytesInString - 3) 40 41 static MemTag *curTagPtr = NULL;/* Tag to use in all future mem_headers 42 * (set by "memory tag" command). */ 43 44 /* 45 * One of the following structures is allocated just before each 46 * dynamically allocated chunk of memory, both to record information 47 * about the chunk and to help detect chunk under-runs. 48 */ 49 50 #define LOW_GUARD_SIZE (8 + (32 - (sizeof(long) + sizeof(int)))%8) 51 struct mem_header { 52 struct mem_header *flink; 53 struct mem_header *blink; 54 MemTag *tagPtr; /* Tag from "memory tag" command; may be 55 * NULL. */ 56 char *file; 57 long length; 58 int line; 59 unsigned char low_guard[LOW_GUARD_SIZE]; 60 /* Aligns body on 8-byte boundary, plus 61 * provides at least 8 additional guard bytes 62 * to detect underruns. */ 63 char body[1]; /* First byte of client's space. Actual 64 * size of this field will be larger than 65 * one. */ 66 }; 67 68 static struct mem_header *allocHead = NULL; /* List of allocated structures */ 69 70 #define GUARD_VALUE 0141 71 72 /* 73 * The following macro determines the amount of guard space *above* each 74 * chunk of memory. 75 */ 76 77 #define HIGH_GUARD_SIZE 8 78 79 /* 80 * The following macro computes the offset of the "body" field within 81 * mem_header. It is used to get back to the header pointer from the 82 * body pointer that's used by clients. 83 */ 84 85 #define BODY_OFFSET \ 86 ((unsigned long) (&((struct mem_header *) 0)->body)) 87 88 static int total_mallocs = 0; 89 static int total_frees = 0; 90 static int current_bytes_malloced = 0; 91 static int maximum_bytes_malloced = 0; 92 static int current_malloc_packets = 0; 93 static int maximum_malloc_packets = 0; 94 static int break_on_malloc = 0; 95 static int trace_on_at_malloc = 0; 96 static int alloc_tracing = FALSE; 97 static int init_malloced_bodies = TRUE; 98 #ifdef MEM_VALIDATE 99 static int validate_memory = TRUE; 100 #else 101 static int validate_memory = FALSE; 102 #endif 103 104 /* 105 * Prototypes for procedures defined in this file: 106 */ 107 108 static int MemoryCmd _ANSI_ARGS_((ClientData clientData, 109 Tcl_Interp *interp, int argc, char **argv)); 110 static void ValidateMemory _ANSI_ARGS_(( 111 struct mem_header *memHeaderP, char *file, 112 int line, int nukeGuards)); 113 114 115 /* 116 *---------------------------------------------------------------------- 117 * 118 * TclDumpMemoryInfo -- 119 * Display the global memory management statistics. 120 * 121 *---------------------------------------------------------------------- 122 */ 123 void 124 TclDumpMemoryInfo(outFile) 125 FILE *outFile; 126 { 127 fprintf(outFile,"total mallocs %10d\n", 128 total_mallocs); 129 fprintf(outFile,"total frees %10d\n", 130 total_frees); 131 fprintf(outFile,"current packets allocated %10d\n", 132 current_malloc_packets); 133 fprintf(outFile,"current bytes allocated %10d\n", 134 current_bytes_malloced); 135 fprintf(outFile,"maximum packets allocated %10d\n", 136 maximum_malloc_packets); 137 fprintf(outFile,"maximum bytes allocated %10d\n", 138 maximum_bytes_malloced); 139 } 140 141 142 /* 143 *---------------------------------------------------------------------- 144 * 145 * ValidateMemory -- 146 * Procedure to validate allocted memory guard zones. 147 * 148 *---------------------------------------------------------------------- 149 */ 150 static void 151 ValidateMemory(memHeaderP, file, line, nukeGuards) 152 struct mem_header *memHeaderP; 153 char *file; 154 int line; 155 int nukeGuards; 156 { 157 unsigned char *hiPtr; 158 int idx; 159 int guard_failed = FALSE; 160 int byte; 161 162 for (idx = 0; idx < LOW_GUARD_SIZE; idx++) { 163 byte = *(memHeaderP->low_guard + idx); 164 if (byte != GUARD_VALUE) { 165 guard_failed = TRUE; 166 fflush(stdout); 167 byte &= 0xff; 168 fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", idx, byte, 169 (isprint(UCHAR(byte)) ? byte : ' ')); 170 } 171 } 172 if (guard_failed) { 173 TclDumpMemoryInfo (stderr); 174 fprintf(stderr, "low guard failed at %lx, %s %d\n", 175 (long unsigned int) memHeaderP->body, file, line); 176 fflush(stderr); /* In case name pointer is bad. */ 177 fprintf(stderr, "%ld bytes allocated at (%s %d)\n", memHeaderP->length, 178 memHeaderP->file, memHeaderP->line); 179 panic ("Memory validation failure"); 180 } 181 182 hiPtr = (unsigned char *)memHeaderP->body + memHeaderP->length; 183 for (idx = 0; idx < HIGH_GUARD_SIZE; idx++) { 184 byte = *(hiPtr + idx); 185 if (byte != GUARD_VALUE) { 186 guard_failed = TRUE; 187 fflush (stdout); 188 byte &= 0xff; 189 fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", idx, byte, 190 (isprint(UCHAR(byte)) ? byte : ' ')); 191 } 192 } 193 194 if (guard_failed) { 195 TclDumpMemoryInfo (stderr); 196 fprintf(stderr, "high guard failed at %lx, %s %d\n", 197 (long unsigned int) memHeaderP->body, file, line); 198 fflush(stderr); /* In case name pointer is bad. */ 199 fprintf(stderr, "%ld bytes allocated at (%s %d)\n", 200 memHeaderP->length, memHeaderP->file, 201 memHeaderP->line); 202 panic("Memory validation failure"); 203 } 204 205 if (nukeGuards) { 206 memset ((char *) memHeaderP->low_guard, 0, LOW_GUARD_SIZE); 207 memset ((char *) hiPtr, 0, HIGH_GUARD_SIZE); 208 } 209 210 } 211 212 213 /* 214 *---------------------------------------------------------------------- 215 * 216 * Tcl_ValidateAllMemory -- 217 * Validates guard regions for all allocated memory. 218 * 219 *---------------------------------------------------------------------- 220 */ 221 void 222 Tcl_ValidateAllMemory (file, line) 223 char *file; 224 int line; 225 { 226 struct mem_header *memScanP; 227 228 for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) 229 ValidateMemory(memScanP, file, line, FALSE); 230 231 } 232 233 234 /* 235 *---------------------------------------------------------------------- 236 * 237 * Tcl_DumpActiveMemory -- 238 * Displays all allocated memory to stderr. 239 * 240 * Results: 241 * Return TCL_ERROR if an error accessing the file occures, `errno' 242 * will have the file error number left in it. 243 *---------------------------------------------------------------------- 244 */ 245 int 246 Tcl_DumpActiveMemory (fileName) 247 char *fileName; 248 { 249 FILE *fileP; 250 struct mem_header *memScanP; 251 char *address; 252 253 fileP = fopen(fileName, "w"); 254 if (fileP == NULL) 255 return TCL_ERROR; 256 257 for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) { 258 address = &memScanP->body [0]; 259 fprintf(fileP, "%8lx - %8lx %7ld @ %s %d %s", 260 (long unsigned int) address, 261 (long unsigned int) address + memScanP->length - 1, 262 memScanP->length, memScanP->file, memScanP->line, 263 (memScanP->tagPtr == NULL) ? "" : memScanP->tagPtr->string); 264 (void) fputc('\n', fileP); 265 } 266 fclose (fileP); 267 return TCL_OK; 268 } 269 270 271 /* 272 *---------------------------------------------------------------------- 273 * 274 * Tcl_DbCkalloc - debugging ckalloc 275 * 276 * Allocate the requested amount of space plus some extra for 277 * guard bands at both ends of the request, plus a size, panicing 278 * if there isn't enough space, then write in the guard bands 279 * and return the address of the space in the middle that the 280 * user asked for. 281 * 282 * The second and third arguments are file and line, these contain 283 * the filename and line number corresponding to the caller. 284 * These are sent by the ckalloc macro; it uses the preprocessor 285 * autodefines __FILE__ and __LINE__. 286 * 287 *---------------------------------------------------------------------- 288 */ 46 289 char * 47 290 Tcl_DbCkalloc(size, file, line) … … 50 293 int line; 51 294 { 52 char *result; 53 54 result = (char *) TclpAlloc(size); 55 295 struct mem_header *result; 296 297 if (validate_memory) 298 Tcl_ValidateAllMemory (file, line); 299 300 result = (struct mem_header *) TclpAlloc((unsigned)size + 301 sizeof(struct mem_header) + HIGH_GUARD_SIZE); 56 302 if (result == NULL) { 57 303 fflush(stdout); 304 TclDumpMemoryInfo(stderr); 58 305 panic("unable to alloc %d bytes, %s line %d", size, file, 59 306 line); 60 307 } 61 return result; 62 } 63 64 65 66 /* 67 *---------------------------------------------------------------------- 68 * 69 * Tcl_Realloc -- 70 * Interface to TclpRealloc. 71 * It does check that memory was actually allocated. 72 * 73 *---------------------------------------------------------------------- 74 */ 75 76 char * 77 Tcl_Realloc(ptr, size) 78 char *ptr; 79 unsigned int size; 80 { 81 char *result; 82 83 result = TclpRealloc(ptr, size); 84 if (result == NULL) 85 panic("unable to realloc %d bytes", size); 86 return result; 87 } 88 308 309 /* 310 * Fill in guard zones and size. Also initialize the contents of 311 * the block with bogus bytes to detect uses of initialized data. 312 * Link into allocated list. 313 */ 314 if (init_malloced_bodies) { 315 memset ((VOID *) result, GUARD_VALUE, 316 size + sizeof(struct mem_header) + HIGH_GUARD_SIZE); 317 } else { 318 memset ((char *) result->low_guard, GUARD_VALUE, LOW_GUARD_SIZE); 319 memset (result->body + size, GUARD_VALUE, HIGH_GUARD_SIZE); 320 } 321 result->length = size; 322 result->tagPtr = curTagPtr; 323 if (curTagPtr != NULL) { 324 curTagPtr->refCount++; 325 } 326 result->file = file; 327 result->line = line; 328 result->flink = allocHead; 329 result->blink = NULL; 330 if (allocHead != NULL) 331 allocHead->blink = result; 332 allocHead = result; 333 334 total_mallocs++; 335 if (trace_on_at_malloc && (total_mallocs >= trace_on_at_malloc)) { 336 (void) fflush(stdout); 337 fprintf(stderr, "reached malloc trace enable point (%d)\n", 338 total_mallocs); 339 fflush(stderr); 340 alloc_tracing = TRUE; 341 trace_on_at_malloc = 0; 342 } 343 344 if (alloc_tracing) 345 fprintf(stderr,"ckalloc %lx %d %s %d\n", 346 (long unsigned int) result->body, size, file, line); 347 348 if (break_on_malloc && (total_mallocs >= break_on_malloc)) { 349 break_on_malloc = 0; 350 (void) fflush(stdout); 351 fprintf(stderr,"reached malloc break limit (%d)\n", 352 total_mallocs); 353 fprintf(stderr, "program will now enter C debugger\n"); 354 (void) fflush(stderr); 355 abort(); 356 } 357 358 current_malloc_packets++; 359 if (current_malloc_packets > maximum_malloc_packets) 360 maximum_malloc_packets = current_malloc_packets; 361 current_bytes_malloced += size; 362 if (current_bytes_malloced > maximum_bytes_malloced) 363 maximum_bytes_malloced = current_bytes_malloced; 364 365 return result->body; 366 } 367 368 369 /* 370 *---------------------------------------------------------------------- 371 * 372 * Tcl_DbCkfree - debugging ckfree 373 * 374 * Verify that the low and high guards are intact, and if so 375 * then free the buffer else panic. 376 * 377 * The guards are erased after being checked to catch duplicate 378 * frees. 379 * 380 * The second and third arguments are file and line, these contain 381 * the filename and line number corresponding to the caller. 382 * These are sent by the ckfree macro; it uses the preprocessor 383 * autodefines __FILE__ and __LINE__. 384 * 385 *---------------------------------------------------------------------- 386 */ 387 388 int 389 Tcl_DbCkfree(ptr, file, line) 390 char * ptr; 391 char *file; 392 int line; 393 { 394 /* 395 * The following cast is *very* tricky. Must convert the pointer 396 * to an integer before doing arithmetic on it, because otherwise 397 * the arithmetic will be done differently (and incorrectly) on 398 * word-addressed machines such as Crays (will subtract only bytes, 399 * even though BODY_OFFSET is in words on these machines). 400 */ 401 402 struct mem_header *memp = (struct mem_header *) 403 (((unsigned long) ptr) - BODY_OFFSET); 404 405 if (alloc_tracing) 406 fprintf(stderr, "ckfree %lx %ld %s %d\n", 407 (long unsigned int) memp->body, memp->length, file, line); 408 409 if (validate_memory) 410 Tcl_ValidateAllMemory(file, line); 411 412 ValidateMemory(memp, file, line, TRUE); 413 if (init_malloced_bodies) { 414 memset((VOID *) ptr, GUARD_VALUE, (size_t) memp->length); 415 } 416 417 total_frees++; 418 current_malloc_packets--; 419 current_bytes_malloced -= memp->length; 420 421 if (memp->tagPtr != NULL) { 422 memp->tagPtr->refCount--; 423 if ((memp->tagPtr->refCount == 0) && (curTagPtr != memp->tagPtr)) { 424 TclpFree((char *) memp->tagPtr); 425 } 426 } 427 428 /* 429 * Delink from allocated list 430 */ 431 if (memp->flink != NULL) 432 memp->flink->blink = memp->blink; 433 if (memp->blink != NULL) 434 memp->blink->flink = memp->flink; 435 if (allocHead == memp) 436 allocHead = memp->flink; 437 TclpFree((char *) memp); 438 return 0; 439 } 440 441 442 /* 443 *-------------------------------------------------------------------- 444 * 445 * Tcl_DbCkrealloc - debugging ckrealloc 446 * 447 * Reallocate a chunk of memory by allocating a new one of the 448 * right size, copying the old data to the new location, and then 449 * freeing the old memory space, using all the memory checking 450 * features of this package. 451 * 452 *-------------------------------------------------------------------- 453 */ 89 454 char * 90 455 Tcl_DbCkrealloc(ptr, size, file, line) … … 94 459 int line; 95 460 { 461 char *new; 462 unsigned int copySize; 463 464 /* 465 * See comment from Tcl_DbCkfree before you change the following 466 * line. 467 */ 468 469 struct mem_header *memp = (struct mem_header *) 470 (((unsigned long) ptr) - BODY_OFFSET); 471 472 copySize = size; 473 if (copySize > (unsigned int) memp->length) { 474 copySize = memp->length; 475 } 476 new = Tcl_DbCkalloc(size, file, line); 477 memcpy((VOID *) new, (VOID *) ptr, (size_t) copySize); 478 Tcl_DbCkfree(ptr, file, line); 479 return(new); 480 } 481 482 483 484 /* 485 *---------------------------------------------------------------------- 486 * 487 * Tcl_Alloc, et al. -- 488 * 489 * These functions are defined in terms of the debugging versions 490 * when TCL_MEM_DEBUG is set. 491 * 492 * Results: 493 * Same as the debug versions. 494 * 495 * Side effects: 496 * Same as the debug versions. 497 * 498 *---------------------------------------------------------------------- 499 */ 500 501 #undef Tcl_Alloc 502 #undef Tcl_Free 503 #undef Tcl_Realloc 504 505 char * 506 Tcl_Alloc(size) 507 unsigned int size; 508 { 509 return Tcl_DbCkalloc(size, "unknown", 0); 510 } 511 512 void 513 Tcl_Free(ptr) 514 char *ptr; 515 { 516 Tcl_DbCkfree(ptr, "unknown", 0); 517 } 518 519 char * 520 Tcl_Realloc(ptr, size) 521 char *ptr; 522 unsigned int size; 523 { 524 return Tcl_DbCkrealloc(ptr, size, "unknown", 0); 525 } 526 527 528 /* 529 *---------------------------------------------------------------------- 530 * 531 * MemoryCmd -- 532 * Implements the TCL memory command: 533 * memory info 534 * memory display 535 * break_on_malloc count 536 * trace_on_at_malloc count 537 * trace on|off 538 * validate on|off 539 * 540 * Results: 541 * Standard TCL results. 542 * 543 *---------------------------------------------------------------------- 544 */ 545 /* ARGSUSED */ 546 static int 547 MemoryCmd (clientData, interp, argc, argv) 548 ClientData clientData; 549 Tcl_Interp *interp; 550 int argc; 551 char **argv; 552 { 553 char *fileName; 554 Tcl_DString buffer; 555 int result; 556 557 if (argc < 2) { 558 Tcl_AppendResult(interp, "wrong # args: should be \"", 559 argv[0], " option [args..]\"", (char *) NULL); 560 return TCL_ERROR; 561 } 562 563 if (strcmp(argv[1],"active") == 0) { 564 if (argc != 3) { 565 Tcl_AppendResult(interp, "wrong # args: should be \"", 566 argv[0], " active file\"", (char *) NULL); 567 return TCL_ERROR; 568 } 569 fileName = Tcl_TranslateFileName(interp, argv[2], &buffer); 570 if (fileName == NULL) { 571 return TCL_ERROR; 572 } 573 result = Tcl_DumpActiveMemory (fileName); 574 Tcl_DStringFree(&buffer); 575 if (result != TCL_OK) { 576 Tcl_AppendResult(interp, "error accessing ", argv[2], 577 (char *) NULL); 578 return TCL_ERROR; 579 } 580 return TCL_OK; 581 } 582 if (strcmp(argv[1],"break_on_malloc") == 0) { 583 if (argc != 3) { 584 goto argError; 585 } 586 if (Tcl_GetInt(interp, argv[2], &break_on_malloc) != TCL_OK) { 587 return TCL_ERROR; 588 } 589 return TCL_OK; 590 } 591 if (strcmp(argv[1],"info") == 0) { 592 TclDumpMemoryInfo(stdout); 593 return TCL_OK; 594 } 595 if (strcmp(argv[1],"init") == 0) { 596 if (argc != 3) { 597 goto bad_suboption; 598 } 599 init_malloced_bodies = (strcmp(argv[2],"on") == 0); 600 return TCL_OK; 601 } 602 if (strcmp(argv[1],"tag") == 0) { 603 if (argc != 3) { 604 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 605 " tag string\"", (char *) NULL); 606 return TCL_ERROR; 607 } 608 if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) { 609 TclpFree((char *) curTagPtr); 610 } 611 curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(strlen(argv[2]))); 612 curTagPtr->refCount = 0; 613 strcpy(curTagPtr->string, argv[2]); 614 return TCL_OK; 615 } 616 if (strcmp(argv[1],"trace") == 0) { 617 if (argc != 3) { 618 goto bad_suboption; 619 } 620 alloc_tracing = (strcmp(argv[2],"on") == 0); 621 return TCL_OK; 622 } 623 624 if (strcmp(argv[1],"trace_on_at_malloc") == 0) { 625 if (argc != 3) { 626 goto argError; 627 } 628 if (Tcl_GetInt(interp, argv[2], &trace_on_at_malloc) != TCL_OK) { 629 return TCL_ERROR; 630 } 631 return TCL_OK; 632 } 633 if (strcmp(argv[1],"validate") == 0) { 634 if (argc != 3) { 635 goto bad_suboption; 636 } 637 validate_memory = (strcmp(argv[2],"on") == 0); 638 return TCL_OK; 639 } 640 641 Tcl_AppendResult(interp, "bad option \"", argv[1], 642 "\": should be active, break_on_malloc, info, init, ", 643 "tag, trace, trace_on_at_malloc, or validate", (char *) NULL); 644 return TCL_ERROR; 645 646 argError: 647 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 648 " ", argv[1], " count\"", (char *) NULL); 649 return TCL_ERROR; 650 651 bad_suboption: 652 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 653 " ", argv[1], " on|off\"", (char *) NULL); 654 return TCL_ERROR; 655 } 656 657 658 /* 659 *---------------------------------------------------------------------- 660 * 661 * Tcl_InitMemory -- 662 * Initialize the memory command. 663 * 664 *---------------------------------------------------------------------- 665 */ 666 void 667 Tcl_InitMemory(interp) 668 Tcl_Interp *interp; 669 { 670 Tcl_CreateCommand (interp, "memory", MemoryCmd, (ClientData) NULL, 671 (Tcl_CmdDeleteProc *) NULL); 672 } 673 674 #else 675 676 677 678 /* 679 *---------------------------------------------------------------------- 680 * 681 * Tcl_Alloc -- 682 * Interface to TclpAlloc when TCL_MEM_DEBUG is disabled. It does check 683 * that memory was actually allocated. 684 * 685 *---------------------------------------------------------------------- 686 */ 687 688 char * 689 Tcl_Alloc (size) 690 unsigned int size; 691 { 692 char *result; 693 694 result = TclpAlloc(size); 695 if (result == NULL) 696 panic("unable to alloc %d bytes", size); 697 return result; 698 } 699 700 char * 701 Tcl_DbCkalloc(size, file, line) 702 unsigned int size; 703 char *file; 704 int line; 705 { 706 char *result; 707 708 result = (char *) TclpAlloc(size); 709 710 if (result == NULL) { 711 fflush(stdout); 712 panic("unable to alloc %d bytes, %s line %d", size, file, 713 line); 714 } 715 return result; 716 } 717 718 719 720 /* 721 *---------------------------------------------------------------------- 722 * 723 * Tcl_Realloc -- 724 * Interface to TclpRealloc when TCL_MEM_DEBUG is disabled. It does 725 * check that memory was actually allocated. 726 * 727 *---------------------------------------------------------------------- 728 */ 729 730 char * 731 Tcl_Realloc(ptr, size) 732 char *ptr; 733 unsigned int size; 734 { 735 char *result; 736 737 result = TclpRealloc(ptr, size); 738 if (result == NULL) 739 panic("unable to realloc %d bytes", size); 740 return result; 741 } 742 743 char * 744 Tcl_DbCkrealloc(ptr, size, file, line) 745 char *ptr; 746 unsigned int size; 747 char *file; 748 int line; 749 { 96 750 char *result; 97 751 … … 111 765 * 112 766 * Tcl_Free -- 113 * Interface to TclpFree. 767 * Interface to TclpFree when TCL_MEM_DEBUG is disabled. Done here 768 * rather in the macro to keep some modules from being compiled with 769 * TCL_MEM_DEBUG enabled and some with it disabled. 114 770 * 115 771 *---------------------------------------------------------------------- … … 122 778 TclpFree(ptr); 123 779 } 780 781 int 782 Tcl_DbCkfree(ptr, file, line) 783 char * ptr; 784 char *file; 785 int line; 786 { 787 TclpFree(ptr); 788 return 0; 789 } 790 791 792 /* 793 *---------------------------------------------------------------------- 794 * 795 * Tcl_InitMemory -- 796 * Dummy initialization for memory command, which is only available 797 * if TCL_MEM_DEBUG is on. 798 * 799 *---------------------------------------------------------------------- 800 */ 801 /* ARGSUSED */ 802 void 803 Tcl_InitMemory(interp) 804 Tcl_Interp *interp; 805 { 806 } 807 808 #undef Tcl_DumpActiveMemory 809 #undef Tcl_ValidateAllMemory 810 811 extern int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName)); 812 extern void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file, 813 int line)); 814 815 int 816 Tcl_DumpActiveMemory(fileName) 817 char *fileName; 818 { 819 return TCL_OK; 820 } 821 822 void 823 Tcl_ValidateAllMemory(file, line) 824 char *file; 825 int line; 826 { 827 } 828 829 #endif -
external/tcl/tclCompExpr.c
r0e7d64a re39abb4 31 31 #define ERANGE 34 32 32 #endif 33 34 /* 35 * Boolean variable that controls whether expression compilation tracing 36 * is enabled. 37 */ 38 39 #ifdef TCL_COMPILE_DEBUG 40 static int traceCompileExpr = 0; 41 #endif /* TCL_COMPILE_DEBUG */ 33 42 34 43 /* … … 123 132 #define NOT (COLON + 1) 124 133 #define BIT_NOT (NOT + 1) 134 135 /* 136 * Mapping from tokens to strings; used for debugging messages. These 137 * entries must match the order and number of the token definitions above. 138 */ 139 140 #ifdef TCL_COMPILE_DEBUG 141 static char *tokenStrings[] = { 142 "LITERAL", "FUNCNAME", 143 "[", "]", "(", ")", "$", "\"", ",", "END", "UNKNOWN", 144 "*", "/", "%", "+", "-", 145 "<<", ">>", "<", ">", "<=", ">=", "==", "!=", 146 "&", "^", "|", "&&", "||", "?", ":", 147 "!", "~" 148 }; 149 #endif /* TCL_COMPILE_DEBUG */ 125 150 126 151 /* … … 173 198 ExprInfo *infoPtr, CompileEnv *envPtr)); 174 199 200 /* 201 * Macro used to debug the execution of the recursive descent parser used 202 * to compile expressions. 203 */ 204 205 #ifdef TCL_COMPILE_DEBUG 206 #define HERE(production, level) \ 207 if (traceCompileExpr) { \ 208 fprintf(stderr, "%*s%s: token=%s, next=\"%.20s\"\n", \ 209 (level), " ", (production), tokenStrings[infoPtr->token], \ 210 infoPtr->next); \ 211 } 212 #else 213 #define HERE(production, level) 214 #endif /* TCL_COMPILE_DEBUG */ 175 215 176 216 … … 237 277 * to execute the expression. */ 238 278 int result; 279 280 #ifdef TCL_COMPILE_DEBUG 281 if (traceCompileExpr) { 282 fprintf(stderr, "expr: string=\"%.30s\"\n", string); 283 } 284 #endif /* TCL_COMPILE_DEBUG */ 239 285 240 286 /* … … 363 409 int elseCodeOffset, currCodeOffset, jumpDist, result; 364 410 411 HERE("condExpr", 1); 365 412 result = CompileLorExpr(interp, infoPtr, flags, envPtr); 366 413 if (result != TCL_OK) { … … 524 571 Tcl_Obj *objPtr; 525 572 573 HERE("lorExpr", 2); 526 574 result = CompileLandExpr(interp, infoPtr, flags, envPtr); 527 575 if ((result != TCL_OK) || (infoPtr->token != OR)) { … … 691 739 Tcl_Obj *objPtr; 692 740 741 HERE("landExpr", 3); 693 742 result = CompileBitOrExpr(interp, infoPtr, flags, envPtr); 694 743 if ((result != TCL_OK) || (infoPtr->token != AND)) { … … 850 899 int result; 851 900 901 HERE("bitOrExpr", 4); 852 902 result = CompileBitXorExpr(interp, infoPtr, flags, envPtr); 853 903 if (result != TCL_OK) { … … 920 970 int result; 921 971 972 HERE("bitXorExpr", 5); 922 973 result = CompileBitAndExpr(interp, infoPtr, flags, envPtr); 923 974 if (result != TCL_OK) { … … 990 1041 int result; 991 1042 1043 HERE("bitAndExpr", 6); 992 1044 result = CompileEqualityExpr(interp, infoPtr, flags, envPtr); 993 1045 if (result != TCL_OK) { … … 1060 1112 int op, result; 1061 1113 1114 HERE("equalityExpr", 7); 1062 1115 result = CompileRelationalExpr(interp, infoPtr, flags, envPtr); 1063 1116 if (result != TCL_OK) { … … 1137 1190 int op, result; 1138 1191 1192 HERE("relationalExpr", 8); 1139 1193 result = CompileShiftExpr(interp, infoPtr, flags, envPtr); 1140 1194 if (result != TCL_OK) { … … 1223 1277 int op, result; 1224 1278 1279 HERE("shiftExpr", 9); 1225 1280 result = CompileAddExpr(interp, infoPtr, flags, envPtr); 1226 1281 if (result != TCL_OK) { … … 1300 1355 int op, result; 1301 1356 1357 HERE("addExpr", 10); 1302 1358 result = CompileMultiplyExpr(interp, infoPtr, flags, envPtr); 1303 1359 if (result != TCL_OK) { … … 1377 1433 int op, result; 1378 1434 1435 HERE("multiplyExpr", 11); 1379 1436 result = CompileUnaryExpr(interp, infoPtr, flags, envPtr); 1380 1437 if (result != TCL_OK) { … … 1456 1513 int op, result; 1457 1514 1515 HERE("unaryExpr", 12); 1458 1516 op = infoPtr->token; 1459 1517 if ((op == PLUS) || (op == MINUS) || (op == BIT_NOT) || (op == NOT)) { … … 1550 1608 */ 1551 1609 1610 HERE("primaryExpr", 13); 1552 1611 theToken = infoPtr->token; 1553 1612 -
external/tcl/tclCompile.c
r0e7d64a re39abb4 17 17 #include "tclInt.h" 18 18 #include "tclCompile.h" 19 20 /* 21 * Variable that controls whether compilation tracing is enabled and, if so, 22 * what level of tracing is desired: 23 * 0: no compilation tracing 24 * 1: summarize compilation of top level cmds and proc bodies 25 * 2: display all instructions of each ByteCode compiled 26 * This variable is linked to the Tcl variable "tcl_traceCompile". 27 */ 28 29 int tclTraceCompile = 0; 30 static int traceInitialized = 0; 31 32 /* 33 * Count of the number of compilations and various other compilation- 34 * related statistics. 35 */ 36 37 #ifdef TCL_COMPILE_STATS 38 long tclNumCompilations = 0; 39 double tclTotalSourceBytes = 0.0; 40 double tclTotalCodeBytes = 0.0; 41 42 double tclTotalInstBytes = 0.0; 43 double tclTotalObjBytes = 0.0; 44 double tclTotalExceptBytes = 0.0; 45 double tclTotalAuxBytes = 0.0; 46 double tclTotalCmdMapBytes = 0.0; 47 48 double tclCurrentSourceBytes = 0.0; 49 double tclCurrentCodeBytes = 0.0; 50 51 int tclSourceCount[32]; 52 int tclByteCodeCount[32]; 53 #endif /* TCL_COMPILE_STATS */ 19 54 20 55 /* … … 408 443 *---------------------------------------------------------------------- 409 444 * 445 * TclPrintByteCodeObj -- 446 * 447 * This procedure prints ("disassembles") the instructions of a 448 * bytecode object to stdout. 449 * 450 * Results: 451 * None. 452 * 453 * Side effects: 454 * None. 455 * 456 *---------------------------------------------------------------------- 457 */ 458 459 void 460 TclPrintByteCodeObj(interp, objPtr) 461 Tcl_Interp *interp; /* Used only for Tcl_GetStringFromObj. */ 462 Tcl_Obj *objPtr; /* The bytecode object to disassemble. */ 463 { 464 ByteCode* codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr; 465 unsigned char *codeStart, *codeLimit, *pc; 466 unsigned char *codeDeltaNext, *codeLengthNext; 467 unsigned char *srcDeltaNext, *srcLengthNext; 468 int codeOffset, codeLen, srcOffset, srcLen; 469 int numCmds, numObjs, delta, objBytes, i; 470 471 if (codePtr->refCount <= 0) { 472 return; /* already freed */ 473 } 474 475 codeStart = codePtr->codeStart; 476 codeLimit = (codeStart + codePtr->numCodeBytes); 477 numCmds = codePtr->numCommands; 478 numObjs = codePtr->numObjects; 479 480 objBytes = (numObjs * sizeof(Tcl_Obj)); 481 for (i = 0; i < numObjs; i++) { 482 Tcl_Obj *litObjPtr = codePtr->objArrayPtr[i]; 483 if (litObjPtr->bytes != NULL) { 484 objBytes += litObjPtr->length; 485 } 486 } 487 488 /* 489 * Print header lines describing the ByteCode. 490 */ 491 492 fprintf(stdout, "\nByteCode 0x%x, ref ct %u, epoch %u, interp 0x%x(epoch %u)\n", 493 (unsigned int) codePtr, codePtr->refCount, 494 codePtr->compileEpoch, (unsigned int) codePtr->iPtr, 495 codePtr->iPtr->compileEpoch); 496 fprintf(stdout, " Source "); 497 TclPrintSource(stdout, codePtr->source, 498 TclMin(codePtr->numSrcChars, 70)); 499 fprintf(stdout, "\n Cmds %d, chars %d, inst %d, objs %u, aux %d, stk depth %u, code/src %.2f\n", 500 numCmds, codePtr->numSrcChars, codePtr->numCodeBytes, numObjs, 501 codePtr->numAuxDataItems, codePtr->maxStackDepth, 502 (codePtr->numSrcChars? 503 ((float)codePtr->totalSize)/((float)codePtr->numSrcChars) : 0.0)); 504 fprintf(stdout, " Code %zu = %u(header)+%d(inst)+%d(objs)+%u(exc)+%u(aux)+%d(cmd map)\n", 505 codePtr->totalSize, sizeof(ByteCode), codePtr->numCodeBytes, 506 objBytes, (codePtr->numExcRanges * sizeof(ExceptionRange)), 507 (codePtr->numAuxDataItems * sizeof(AuxData)), 508 codePtr->numCmdLocBytes); 509 510 /* 511 * If the ByteCode is the compiled body of a Tcl procedure, print 512 * information about that procedure. Note that we don't know the 513 * procedure's name since ByteCode's can be shared among procedures. 514 */ 515 516 if (codePtr->procPtr != NULL) { 517 Proc *procPtr = codePtr->procPtr; 518 int numCompiledLocals = procPtr->numCompiledLocals; 519 fprintf(stdout, 520 " Proc 0x%x, ref ct %d, args %d, compiled locals %d\n", 521 (unsigned int) procPtr, procPtr->refCount, procPtr->numArgs, 522 numCompiledLocals); 523 if (numCompiledLocals > 0) { 524 CompiledLocal *localPtr = procPtr->firstLocalPtr; 525 for (i = 0; i < numCompiledLocals; i++) { 526 fprintf(stdout, " %d: slot %d%s%s%s%s%s%s", 527 i, localPtr->frameIndex, 528 ((localPtr->flags & VAR_SCALAR)? ", scalar" : ""), 529 ((localPtr->flags & VAR_ARRAY)? ", array" : ""), 530 ((localPtr->flags & VAR_LINK)? ", link" : ""), 531 ((localPtr->flags & VAR_ARGUMENT)? ", arg" : ""), 532 ((localPtr->flags & VAR_TEMPORARY)? ", temp" : ""), 533 ((localPtr->flags & VAR_RESOLVED)? ", resolved" : "")); 534 if (TclIsVarTemporary(localPtr)) { 535 fprintf(stdout, "\n"); 536 } else { 537 fprintf(stdout, ", name=\"%s\"\n", localPtr->name); 538 } 539 localPtr = localPtr->nextPtr; 540 } 541 } 542 } 543 544 /* 545 * Print the ExceptionRange array. 546 */ 547 548 if (codePtr->numExcRanges > 0) { 549 fprintf(stdout, " Exception ranges %d, depth %d:\n", 550 codePtr->numExcRanges, codePtr->maxExcRangeDepth); 551 for (i = 0; i < codePtr->numExcRanges; i++) { 552 ExceptionRange *rangePtr = &(codePtr->excRangeArrayPtr[i]); 553 fprintf(stdout, " %d: level %d, %s, pc %d-%d, ", 554 i, rangePtr->nestingLevel, 555 ((rangePtr->type == LOOP_EXCEPTION_RANGE)? "loop":"catch"), 556 rangePtr->codeOffset, 557 (rangePtr->codeOffset + rangePtr->numCodeBytes - 1)); 558 switch (rangePtr->type) { 559 case LOOP_EXCEPTION_RANGE: 560 fprintf(stdout, "continue %d, break %d\n", 561 rangePtr->continueOffset, rangePtr->breakOffset); 562 break; 563 case CATCH_EXCEPTION_RANGE: 564 fprintf(stdout, "catch %d\n", rangePtr->catchOffset); 565 break; 566 default: 567 panic("TclPrintSource: unrecognized ExceptionRange type %d\n", 568 rangePtr->type); 569 } 570 } 571 } 572 573 /* 574 * If there were no commands (e.g., an expression or an empty string 575 * was compiled), just print all instructions and return. 576 */ 577 578 if (numCmds == 0) { 579 pc = codeStart; 580 while (pc < codeLimit) { 581 fprintf(stdout, " "); 582 pc += TclPrintInstruction(codePtr, pc); 583 } 584 return; 585 } 586 587 /* 588 * Print table showing the code offset, source offset, and source 589 * length for each command. These are encoded as a sequence of bytes. 590 */ 591 592 fprintf(stdout, " Commands %d:", numCmds); 593 codeDeltaNext = codePtr->codeDeltaStart; 594 codeLengthNext = codePtr->codeLengthStart; 595 srcDeltaNext = codePtr->srcDeltaStart; 596 srcLengthNext = codePtr->srcLengthStart; 597 codeOffset = srcOffset = 0; 598 for (i = 0; i < numCmds; i++) { 599 if ((unsigned int) (*codeDeltaNext) == (unsigned int) 0xFF) { 600 codeDeltaNext++; 601 delta = TclGetInt4AtPtr(codeDeltaNext); 602 codeDeltaNext += 4; 603 } else { 604 delta = TclGetInt1AtPtr(codeDeltaNext); 605 codeDeltaNext++; 606 } 607 codeOffset += delta; 608 609 if ((unsigned int) (*codeLengthNext) == (unsigned int) 0xFF) { 610 codeLengthNext++; 611 codeLen = TclGetInt4AtPtr(codeLengthNext); 612 codeLengthNext += 4; 613 } else { 614 codeLen = TclGetInt1AtPtr(codeLengthNext); 615 codeLengthNext++; 616 } 617 618 if ((unsigned int) (*srcDeltaNext) == (unsigned int) 0xFF) { 619 srcDeltaNext++; 620 delta = TclGetInt4AtPtr(srcDeltaNext); 621 srcDeltaNext += 4; 622 } else { 623 delta = TclGetInt1AtPtr(srcDeltaNext); 624 srcDeltaNext++; 625 } 626 srcOffset += delta; 627 628 if ((unsigned int) (*srcLengthNext) == (unsigned int) 0xFF) { 629 srcLengthNext++; 630 srcLen = TclGetInt4AtPtr(srcLengthNext); 631 srcLengthNext += 4; 632 } else { 633 srcLen = TclGetInt1AtPtr(srcLengthNext); 634 srcLengthNext++; 635 } 636 637 fprintf(stdout, "%s%4d: pc %d-%d, source %d-%d", 638 ((i % 2)? " " : "\n "), 639 (i+1), codeOffset, (codeOffset + codeLen - 1), 640 srcOffset, (srcOffset + srcLen - 1)); 641 } 642 if ((numCmds > 0) && ((numCmds % 2) != 0)) { 643 fprintf(stdout, "\n"); 644 } 645 646 /* 647 * Print each instruction. If the instruction corresponds to the start 648 * of a command, print the command's source. Note that we don't need 649 * the code length here. 650 */ 651 652 codeDeltaNext = codePtr->codeDeltaStart; 653 srcDeltaNext = codePtr->srcDeltaStart; 654 srcLengthNext = codePtr->srcLengthStart; 655 codeOffset = srcOffset = 0; 656 pc = codeStart; 657 for (i = 0; i < numCmds; i++) { 658 if ((unsigned int) (*codeDeltaNext) == (unsigned int) 0xFF) { 659 codeDeltaNext++; 660 delta = TclGetInt4AtPtr(codeDeltaNext); 661 codeDeltaNext += 4; 662 } else { 663 delta = TclGetInt1AtPtr(codeDeltaNext); 664 codeDeltaNext++; 665 } 666 codeOffset += delta; 667 668 if ((unsigned int) (*srcDeltaNext) == (unsigned int) 0xFF) { 669 srcDeltaNext++; 670 delta = TclGetInt4AtPtr(srcDeltaNext); 671 srcDeltaNext += 4; 672 } else { 673 delta = TclGetInt1AtPtr(srcDeltaNext); 674 srcDeltaNext++; 675 } 676 srcOffset += delta; 677 678 if ((unsigned int) (*srcLengthNext) == (unsigned int) 0xFF) { 679 srcLengthNext++; 680 srcLen = TclGetInt4AtPtr(srcLengthNext); 681 srcLengthNext += 4; 682 } else { 683 srcLen = TclGetInt1AtPtr(srcLengthNext); 684 srcLengthNext++; 685 } 686 687 /* 688 * Print instructions before command i. 689 */ 690 691 while ((pc-codeStart) < codeOffset) { 692 fprintf(stdout, " "); 693 pc += TclPrintInstruction(codePtr, pc); 694 } 695 696 fprintf(stdout, " Command %d: ", (i+1)); 697 TclPrintSource(stdout, (codePtr->source + srcOffset), 698 TclMin(srcLen, 70)); 699 fprintf(stdout, "\n"); 700 } 701 if (pc < codeLimit) { 702 /* 703 * Print instructions after the last command. 704 */ 705 706 while (pc < codeLimit) { 707 fprintf(stdout, " "); 708 pc += TclPrintInstruction(codePtr, pc); 709 } 710 } 711 } 712 713 714 /* 715 *---------------------------------------------------------------------- 716 * 717 * TclPrintInstruction -- 718 * 719 * This procedure prints ("disassembles") one instruction from a 720 * bytecode object to stdout. 721 * 722 * Results: 723 * Returns the length in bytes of the current instruiction. 724 * 725 * Side effects: 726 * None. 727 * 728 *---------------------------------------------------------------------- 729 */ 730 731 int 732 TclPrintInstruction(codePtr, pc) 733 ByteCode* codePtr; /* Bytecode containing the instruction. */ 734 unsigned char *pc; /* Points to first byte of instruction. */ 735 { 736 Proc *procPtr = codePtr->procPtr; 737 unsigned char opCode = *pc; 738 register InstructionDesc *instDesc = &instructionTable[opCode]; 739 unsigned char *codeStart = codePtr->codeStart; 740 unsigned int pcOffset = (pc - codeStart); 741 int opnd, elemLen, i, j; 742 Tcl_Obj *elemPtr; 743 char *string; 744 745 fprintf(stdout, "(%u) %s ", pcOffset, instDesc->name); 746 for (i = 0; i < instDesc->numOperands; i++) { 747 switch (instDesc->opTypes[i]) { 748 case OPERAND_INT1: 749 opnd = TclGetInt1AtPtr(pc+1+i); 750 if ((i == 0) && ((opCode == INST_JUMP1) 751 || (opCode == INST_JUMP_TRUE1) 752 || (opCode == INST_JUMP_FALSE1))) { 753 fprintf(stdout, "%d # pc %u", opnd, (pcOffset + opnd)); 754 } else { 755 fprintf(stdout, "%d", opnd); 756 } 757 break; 758 case OPERAND_INT4: 759 opnd = TclGetInt4AtPtr(pc+1+i); 760 if ((i == 0) && ((opCode == INST_JUMP4) 761 || (opCode == INST_JUMP_TRUE4) 762 || (opCode == INST_JUMP_FALSE4))) { 763 fprintf(stdout, "%d # pc %u", opnd, (pcOffset + opnd)); 764 } else { 765 fprintf(stdout, "%d", opnd); 766 } 767 break; 768 case OPERAND_UINT1: 769 opnd = TclGetUInt1AtPtr(pc+1+i); 770 if ((i == 0) && (opCode == INST_PUSH1)) { 771 elemPtr = codePtr->objArrayPtr[opnd]; 772 string = Tcl_GetStringFromObj(elemPtr, &elemLen); 773 fprintf(stdout, "%u # ", (unsigned int) opnd); 774 TclPrintSource(stdout, string, TclMin(elemLen, 40)); 775 } else if ((i == 0) && ((opCode == INST_LOAD_SCALAR1) 776 || (opCode == INST_LOAD_ARRAY1) 777 || (opCode == INST_STORE_SCALAR1) 778 || (opCode == INST_STORE_ARRAY1))) { 779 int localCt = procPtr->numCompiledLocals; 780 CompiledLocal *localPtr = procPtr->firstLocalPtr; 781 if (opnd >= localCt) { 782 panic("TclPrintInstruction: bad local var index %u (%u locals)\n", 783 (unsigned int) opnd, localCt); 784 return instDesc->numBytes; 785 } 786 for (j = 0; j < opnd; j++) { 787 localPtr = localPtr->nextPtr; 788 } 789 if (TclIsVarTemporary(localPtr)) { 790 fprintf(stdout, "%u # temp var %u", 791 (unsigned int) opnd, (unsigned int) opnd); 792 } else { 793 fprintf(stdout, "%u # var ", (unsigned int) opnd); 794 TclPrintSource(stdout, localPtr->name, 40); 795 } 796 } else { 797 fprintf(stdout, "%u ", (unsigned int) opnd); 798 } 799 break; 800 case OPERAND_UINT4: 801 opnd = TclGetUInt4AtPtr(pc+1+i); 802 if (opCode == INST_PUSH4) { 803 elemPtr = codePtr->objArrayPtr[opnd]; 804 string = Tcl_GetStringFromObj(elemPtr, &elemLen); 805 fprintf(stdout, "%u # ", opnd); 806 TclPrintSource(stdout, string, TclMin(elemLen, 40)); 807 } else if ((i == 0) && ((opCode == INST_LOAD_SCALAR4) 808 || (opCode == INST_LOAD_ARRAY4) 809 || (opCode == INST_STORE_SCALAR4) 810 || (opCode == INST_STORE_ARRAY4))) { 811 int localCt = procPtr->numCompiledLocals; 812 CompiledLocal *localPtr = procPtr->firstLocalPtr; 813 if (opnd >= localCt) { 814 panic("TclPrintInstruction: bad local var index %u (%u locals)\n", 815 (unsigned int) opnd, localCt); 816 return instDesc->numBytes; 817 } 818 for (j = 0; j < opnd; j++) { 819 localPtr = localPtr->nextPtr; 820 } 821 if (TclIsVarTemporary(localPtr)) { 822 fprintf(stdout, "%u # temp var %u", 823 (unsigned int) opnd, (unsigned int) opnd); 824 } else { 825 fprintf(stdout, "%u # var ", (unsigned int) opnd); 826 TclPrintSource(stdout, localPtr->name, 40); 827 } 828 } else { 829 fprintf(stdout, "%u ", (unsigned int) opnd); 830 } 831 break; 832 case OPERAND_NONE: 833 default: 834 break; 835 } 836 } 837 fprintf(stdout, "\n"); 838 return instDesc->numBytes; 839 } 840 841 842 /* 843 *---------------------------------------------------------------------- 844 * 410 845 * TclPrintSource -- 411 846 * … … 537 972 register int i; 538 973 974 #ifdef TCL_COMPILE_STATS 975 tclCurrentSourceBytes -= (double) codePtr->numSrcChars; 976 tclCurrentCodeBytes -= (double) codePtr->totalSize; 977 #endif /* TCL_COMPILE_STATS */ 978 539 979 /* 540 980 * A single heap object holds the ByteCode structure and its code, … … 627 1067 int length, result; 628 1068 1069 if (!traceInitialized) { 1070 if (Tcl_LinkVar(interp, "tcl_traceCompile", 1071 (char *) &tclTraceCompile, TCL_LINK_INT) != TCL_OK) { 1072 panic("SetByteCodeFromAny: unable to create link for tcl_traceCompile variable"); 1073 } 1074 traceInitialized = 1; 1075 } 1076 629 1077 string = Tcl_GetStringFromObj(objPtr, &length); 630 1078 TclInitCompileEnv(interp, &compEnv, string); … … 665 1113 TclFreeCompileEnv(&compEnv); 666 1114 1115 if (result == TCL_OK) { 1116 if (tclTraceCompile == 2) { 1117 TclPrintByteCodeObj(interp, objPtr); 1118 } 1119 } 667 1120 return result; 668 1121 } … … 858 1311 int numObjects, i; 859 1312 Namespace *namespacePtr; 1313 #ifdef TCL_COMPILE_STATS 1314 int srcLenLog2, sizeLog2; 1315 #endif /*TCL_COMPILE_STATS*/ 860 1316 861 1317 codeBytes = (envPtr->codeNext - envPtr->codeStart); … … 886 1342 } 887 1343 totalSize = (size + objBytes); 1344 1345 #ifdef TCL_COMPILE_STATS 1346 tclNumCompilations++; 1347 tclTotalSourceBytes += (double) srcLen; 1348 tclTotalCodeBytes += (double) totalSize; 1349 1350 tclTotalInstBytes += (double) codeBytes; 1351 tclTotalObjBytes += (double) objBytes; 1352 tclTotalExceptBytes += exceptArrayBytes; 1353 tclTotalAuxBytes += (double) auxDataArrayBytes; 1354 tclTotalCmdMapBytes += (double) cmdLocBytes; 1355 1356 tclCurrentSourceBytes += (double) srcLen; 1357 tclCurrentCodeBytes += (double) totalSize; 1358 1359 srcLenLog2 = TclLog2(srcLen); 1360 sizeLog2 = TclLog2((int) totalSize); 1361 if ((srcLenLog2 > 31) || (sizeLog2 > 31)) { 1362 panic("TclInitByteCodeObj: bad source or code sizes\n"); 1363 } 1364 tclSourceCount[srcLenLog2]++; 1365 tclByteCodeCount[sizeLog2]++; 1366 #endif /* TCL_COMPILE_STATS */ 888 1367 889 1368 if (envPtr->iPtr->varFramePtr != NULL) { … … 1341 1820 cmdCodeOffset); 1342 1821 1822 if ((!(flags & TCL_BRACKET_TERM)) 1823 && (tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { 1824 /* 1825 * Display a line summarizing the top level command we are about 1826 * to compile. 1827 */ 1828 1829 char *p = cmdSrcStart; 1830 int numChars, complete; 1831 1832 while ((CHAR_TYPE(p, lastChar) != TCL_COMMAND_END) 1833 || ((*p == ']') && !(flags & TCL_BRACKET_TERM))) { 1834 p++; 1835 } 1836 numChars = (p - cmdSrcStart); 1837 complete = 1; 1838 if (numChars > 60) { 1839 numChars = 60; 1840 complete = 0; 1841 } else if ((numChars >= 2) && (*p == '\n') && (*(p-1) == '{')) { 1842 complete = 0; 1843 } 1844 fprintf(stdout, "Compiling: %.*s%s\n", 1845 numChars, cmdSrcStart, (complete? "" : " ...")); 1846 } 1847 1343 1848 while ((type != TCL_COMMAND_END) 1344 1849 || ((c == ']') && !(flags & TCL_BRACKET_TERM))) { -
external/tcl/tclCompile.h
r0e7d64a re39abb4 36 36 37 37 extern Tcl_ObjType tclCmdNameType; 38 39 /* 40 * Variable that controls whether compilation tracing is enabled and, if so, 41 * what level of tracing is desired: 42 * 0: no compilation tracing 43 * 1: summarize compilation of top level cmds and proc bodies 44 * 2: display all instructions of each ByteCode compiled 45 * This variable is linked to the Tcl variable "tcl_traceCompile". 46 */ 47 48 extern int tclTraceCompile; 49 50 /* 51 * Variable that controls whether execution tracing is enabled and, if so, 52 * what level of tracing is desired: 53 * 0: no execution tracing 54 * 1: trace invocations of Tcl procs only 55 * 2: trace invocations of all (not compiled away) commands 56 * 3: display each instruction executed 57 * This variable is linked to the Tcl variable "tcl_traceExec". 58 */ 59 60 extern int tclTraceExec; 61 62 /* 63 * The number of bytecode compilations and various other compilation-related 64 * statistics. The tclByteCodeCount and tclSourceCount arrays are used to 65 * hold the count of ByteCodes and sources whose sizes fall into various 66 * binary decades; e.g., tclByteCodeCount[5] is a count of the ByteCodes 67 * with size larger than 2**4 and less than or equal to 2**5. 68 */ 69 70 #ifdef TCL_COMPILE_STATS 71 extern long tclNumCompilations; 72 extern double tclTotalSourceBytes; 73 extern double tclTotalCodeBytes; 74 75 extern double tclTotalInstBytes; 76 extern double tclTotalObjBytes; 77 extern double tclTotalExceptBytes; 78 extern double tclTotalAuxBytes; 79 extern double tclTotalCmdMapBytes; 80 81 extern double tclCurrentSourceBytes; 82 extern double tclCurrentCodeBytes; 83 84 extern int tclSourceCount[32]; 85 extern int tclByteCodeCount[32]; 86 #endif /* TCL_COMPILE_STATS */ 38 87 39 88 /* … … 767 816 EXTERN void TclInitJumpFixupArray _ANSI_ARGS_(( 768 817 JumpFixupArray *fixupArrayPtr)); 818 #ifdef TCL_COMPILE_STATS 819 EXTERN int TclLog2 _ANSI_ARGS_((int value)); 820 #endif /*TCL_COMPILE_STATS*/ 769 821 EXTERN int TclObjIndexForString _ANSI_ARGS_((char *start, 770 822 int length, int allocStrRep, int inHeap, 771 823 CompileEnv *envPtr)); 824 EXTERN int TclPrintInstruction _ANSI_ARGS_((ByteCode* codePtr, 825 unsigned char *pc)); 772 826 EXTERN void TclPrintSource _ANSI_ARGS_((FILE *outFile, 773 827 char *string, int maxChars)); -
external/tcl/tclExecute.c
r0e7d64a re39abb4 51 51 52 52 /* 53 * Variable that controls whether execution tracing is enabled and, if so, 54 * what level of tracing is desired: 55 * 0: no execution tracing 56 * 1: trace invocations of Tcl procs only 57 * 2: trace invocations of all (not compiled away) commands 58 * 3: display each instruction executed 59 * This variable is linked to the Tcl variable "tcl_traceExec". 60 */ 61 62 int tclTraceExec = 0; 63 64 /* 53 65 * The following global variable is use to signal matherr that Tcl 54 66 * is responsible for the arithmetic, so errors can be handled in a … … 90 102 }; 91 103 104 /* 105 * Mapping from Tcl result codes to strings; used for error and debugging 106 * messages. 107 */ 108 109 #ifdef TCL_COMPILE_DEBUG 110 static char *resultStrings[] = { 111 "TCL_OK", "TCL_ERROR", "TCL_RETURN", "TCL_BREAK", "TCL_CONTINUE" 112 }; 113 #endif /* TCL_COMPILE_DEBUG */ 114 115 /* 116 * The following are statistics-related variables that record information 117 * about the bytecode compiler and interpreter's operation. This includes 118 * an array that records for each instruction how often it is executed. 119 */ 120 121 #ifdef TCL_COMPILE_STATS 122 static long numExecutions = 0; 123 static int instructionCount[256]; 124 #endif /* TCL_COMPILE_STATS */ 125 92 126 /* 93 127 * Macros for testing floating-point values for certain special cases. Test … … 153 187 #define POP_OBJECT() \ 154 188 (stackPtr[stackTop--].o) 189 190 /* 191 * Macros used to trace instruction execution. The macros TRACE, 192 * TRACE_WITH_OBJ, and O2S are only used inside TclExecuteByteCode. 193 * O2S is only used in TRACE* calls to get a string from an object. 194 * 195 * NOTE THAT CLIENTS OF O2S ARE LIKELY TO FAIL IF THE OBJECT'S 196 * STRING REP CONTAINS NULLS. 197 */ 198 199 #ifdef TCL_COMPILE_DEBUG 200 201 #define O2S(objPtr) \ 202 Tcl_GetStringFromObj((objPtr), &length) 203 204 #ifdef TCL_COMPILE_STATS 205 #define TRACE(a) \ 206 if (traceInstructions) { \ 207 fprintf(stdout, "%d: %d,%ld (%u) ", iPtr->numLevels, \ 208 stackTop, (tclObjsAlloced - tclObjsFreed), \ 209 (unsigned int)(pc - codePtr->codeStart)); \ 210 printf a; \ 211 fflush(stdout); \ 212 } 213 #define TRACE_WITH_OBJ(a, objPtr) \ 214 if (traceInstructions) { \ 215 fprintf(stdout, "%d: %d,%ld (%u) ", iPtr->numLevels, \ 216 stackTop, (tclObjsAlloced - tclObjsFreed), \ 217 (unsigned int)(pc - codePtr->codeStart)); \ 218 printf a; \ 219 bytes = Tcl_GetStringFromObj((objPtr), &length); \ 220 TclPrintSource(stdout, bytes, TclMin(length, 30)); \ 221 fprintf(stdout, "\n"); \ 222 fflush(stdout); \ 223 } 224 #else /* not TCL_COMPILE_STATS */ 225 #define TRACE(a) \ 226 if (traceInstructions) { \ 227 fprintf(stdout, "%d: %d (%u) ", iPtr->numLevels, stackTop, \ 228 (unsigned int)(pc - codePtr->codeStart)); \ 229 printf a; \ 230 fflush(stdout); \ 231 } 232 #define TRACE_WITH_OBJ(a, objPtr) \ 233 if (traceInstructions) { \ 234 fprintf(stdout, "%d: %d (%u) ", iPtr->numLevels, stackTop, \ 235 (unsigned int)(pc - codePtr->codeStart)); \ 236 printf a; \ 237 bytes = Tcl_GetStringFromObj((objPtr), &length); \ 238 TclPrintSource(stdout, bytes, TclMin(length, 30)); \ 239 fprintf(stdout, "\n"); \ 240 fflush(stdout); \ 241 } 242 #endif /* TCL_COMPILE_STATS */ 243 244 #else /* not TCL_COMPILE_DEBUG */ 245 246 #define TRACE(a) 247 #define TRACE_WITH_OBJ(a, objPtr) 248 #define O2S(objPtr) 249 250 #endif /* TCL_COMPILE_DEBUG */ 155 251 156 252 /* … … 178 274 static int ExprUnaryFunc _ANSI_ARGS_((Tcl_Interp *interp, 179 275 ExecEnv *eePtr, ClientData clientData)); 276 #ifdef TCL_COMPILE_STATS 277 static int EvalStatsCmd _ANSI_ARGS_((ClientData clientData, 278 Tcl_Interp *interp, int argc, char **argv)); 279 #endif /* TCL_COMPILE_STATS */ 180 280 static void FreeCmdNameInternalRep _ANSI_ARGS_(( 181 281 Tcl_Obj *objPtr)); … … 193 293 static int SetCmdNameFromAny _ANSI_ARGS_((Tcl_Interp *interp, 194 294 Tcl_Obj *objPtr)); 295 #ifdef TCL_COMPILE_DEBUG 296 static char * StringForResultCode _ANSI_ARGS_((int result)); 297 #endif /* TCL_COMPILE_DEBUG */ 195 298 static void UpdateStringOfCmdName _ANSI_ARGS_((Tcl_Obj *objPtr)); 299 #ifdef TCL_COMPILE_DEBUG 300 static void ValidatePcAndStackTop _ANSI_ARGS_(( 301 ByteCode *codePtr, unsigned char *pc, 302 int stackTop, int stackLowerBound, 303 int stackUpperBound)); 304 #endif /* TCL_COMPILE_DEBUG */ 196 305 197 306 /* … … 259 368 * 260 369 * Side effects: 261 * This procedure initializes the array of instruction names. 370 * This procedure initializes the array of instruction names. If 371 * compiling with the TCL_COMPILE_STATS flag, it initializes the 372 * array that counts the executions of each instruction and it 373 * creates the "evalstats" command. It also registers the command name 374 * Tcl_ObjType. It also establishes the link between the Tcl 375 * "tcl_traceExec" and C "tclTraceExec" variables. 262 376 * 263 377 *---------------------------------------------------------------------- … … 277 391 for (i = 0; instructionTable[i].name != NULL; i++) { 278 392 opName[i] = instructionTable[i].name; 393 } 394 395 #ifdef TCL_COMPILE_STATS 396 (VOID *) memset(instructionCount, 0, sizeof(instructionCount)); 397 (VOID *) memset(tclByteCodeCount, 0, sizeof(tclByteCodeCount)); 398 (VOID *) memset(tclSourceCount, 0, sizeof(tclSourceCount)); 399 400 Tcl_CreateCommand(interp, "evalstats", EvalStatsCmd, 401 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); 402 #endif /* TCL_COMPILE_STATS */ 403 404 if (Tcl_LinkVar(interp, "tcl_traceExec", (char *) &tclTraceExec, 405 TCL_LINK_INT) != TCL_OK) { 406 panic("InitByteCodeExecution: can't create link for tcl_traceExec variable"); 279 407 } 280 408 } … … 470 598 * process break, continue, and errors. */ 471 599 int result = TCL_OK; /* Return code returned after execution. */ 600 int traceInstructions = (tclTraceExec == 3); 472 601 Tcl_Obj *valuePtr, *value2Ptr, *namePtr, *objPtr; 473 602 char *bytes; 474 603 int length; 475 604 long i; 605 Tcl_DString command; /* Used for debugging. If tclTraceExec >= 2 606 * holds a string representing the last 607 * command invoked. */ 476 608 477 609 /* … … 488 620 489 621 /* 622 * THIS PROC FAILS IF AN OBJECT'S STRING REP HAS A NULL BYTE. 623 */ 624 625 if (tclTraceExec >= 2) { 626 PrintByteCodeInfo(codePtr); 627 #ifdef TCL_COMPILE_STATS 628 fprintf(stdout, " Starting stack top=%d, system objects=%ld\n", 629 eePtr->stackTop, (tclObjsAlloced - tclObjsFreed)); 630 #else 631 fprintf(stdout, " Starting stack top=%d\n", eePtr->stackTop); 632 #endif /* TCL_COMPILE_STATS */ 633 fflush(stdout); 634 } 635 636 #ifdef TCL_COMPILE_STATS 637 numExecutions++; 638 #endif /* TCL_COMPILE_STATS */ 639 640 /* 490 641 * Make sure the catch stack is large enough to hold the maximum number 491 642 * of catch commands that could ever be executing at the same time. This … … 508 659 509 660 /* 661 * Initialize the buffer that holds a string containing the name and 662 * arguments for the last invoked command. 663 */ 664 665 Tcl_DStringInit(&command); 666 667 /* 510 668 * Loop executing instructions until a "done" instruction, a TCL_RETURN, 511 669 * or some error. … … 513 671 514 672 for (;;) { 673 #ifdef TCL_COMPILE_DEBUG 674 ValidatePcAndStackTop(codePtr, pc, stackTop, initStackTop, 675 eePtr->stackEnd); 676 #else /* not TCL_COMPILE_DEBUG */ 677 if (traceInstructions) { 678 #ifdef TCL_COMPILE_STATS 679 fprintf(stdout, "%d: %d,%ld ", iPtr->numLevels, stackTop, 680 (tclObjsAlloced - tclObjsFreed)); 681 #else /* TCL_COMPILE_STATS */ 682 fprintf(stdout, "%d: %d ", iPtr->numLevels, stackTop); 683 #endif /* TCL_COMPILE_STATS */ 684 TclPrintInstruction(codePtr, pc); 685 fflush(stdout); 686 } 687 #endif /* TCL_COMPILE_DEBUG */ 688 515 689 opCode = *pc; 690 #ifdef TCL_COMPILE_STATS 691 instructionCount[opCode]++; 692 #endif /* TCL_COMPILE_STATS */ 516 693 517 694 switch (opCode) { … … 533 710 panic("TclExecuteByteCode execution failure: end stack top != start stack top"); 534 711 } 712 TRACE_WITH_OBJ(("done => return code=%d, result is ", result), 713 iPtr->objResultPtr); 535 714 goto done; 536 715 … … 538 717 valuePtr = objArrayPtr[TclGetUInt1AtPtr(pc+1)]; 539 718 PUSH_OBJECT(valuePtr); 719 TRACE_WITH_OBJ(("push1 %u => ", TclGetUInt1AtPtr(pc+1)), 720 valuePtr); 540 721 ADJUST_PC(2); 541 722 … … 543 724 valuePtr = objArrayPtr[TclGetUInt4AtPtr(pc+1)]; 544 725 PUSH_OBJECT(valuePtr); 726 TRACE_WITH_OBJ(("push4 %u => ", TclGetUInt4AtPtr(pc+1)), 727 valuePtr); 545 728 ADJUST_PC(5); 546 729 547 730 case INST_POP: 548 731 valuePtr = POP_OBJECT(); 732 TRACE_WITH_OBJ(("pop => discarding "), valuePtr); 549 733 TclDecrRefCount(valuePtr); /* finished with pop'ed object. */ 550 734 ADJUST_PC(1); … … 553 737 valuePtr = stackPtr[stackTop].o; 554 738 PUSH_OBJECT(Tcl_DuplicateObj(valuePtr)); 739 TRACE_WITH_OBJ(("dup => "), valuePtr); 555 740 ADJUST_PC(1); 556 741 … … 605 790 606 791 PUSH_OBJECT(concatObjPtr); 792 TRACE_WITH_OBJ(("concat %u => ", opnd), concatObjPtr); 607 793 ADJUST_PC(2); 608 794 } … … 629 815 * Init. to avoid compiler warning. */ 630 816 Tcl_Command cmd; 817 #ifdef TCL_COMPILE_DEBUG 818 int isUnknownCmd = 0; 819 char cmdNameBuf[30]; 820 #endif /* TCL_COMPILE_DEBUG */ 631 821 632 822 /* … … 677 867 "invalid command name \"", cmdName, "\"", 678 868 (char *) NULL); 869 TRACE(("%s %u => unknown proc not found: ", 870 opName[opCode], objc)); 679 871 result = TCL_ERROR; 680 872 goto checkForCatch; 681 873 } 682 874 cmdPtr = (Command *) cmd; 875 #ifdef TCL_COMPILE_DEBUG 876 isUnknownCmd = 1; 877 #endif /*TCL_COMPILE_DEBUG*/ 683 878 stackTop++; /* need room for new inserted objv[0] */ 684 879 for (i = objc; i >= 0; i--) { … … 723 918 Tcl_ResetResult(interp); 724 919 920 if (tclTraceExec >= 2) { 921 char buffer[50]; 922 923 sprintf(buffer, "%d: (%u) invoking ", iPtr->numLevels, 924 (unsigned int)(pc - codePtr->codeStart)); 925 Tcl_DStringAppend(&command, buffer, -1); 926 927 #ifdef TCL_COMPILE_DEBUG 928 if (traceInstructions) { /* tclTraceExec == 3 */ 929 strncpy(cmdNameBuf, cmdName, 20); 930 TRACE(("%s %u => call ", opName[opCode], 931 (isUnknownCmd? objc-1 : objc))); 932 } else { 933 fprintf(stdout, "%s", buffer); 934 } 935 #else /* TCL_COMPILE_DEBUG */ 936 fprintf(stdout, "%s", buffer); 937 #endif /*TCL_COMPILE_DEBUG*/ 938 939 for (i = 0; i < objc; i++) { 940 bytes = TclGetStringFromObj(objv[i], &length); 941 TclPrintSource(stdout, bytes, TclMin(length, 15)); 942 fprintf(stdout, " "); 943 944 sprintf(buffer, "\"%.*s\" ", TclMin(length, 15), bytes); 945 Tcl_DStringAppend(&command, buffer, -1); 946 } 947 fprintf(stdout, "\n"); 948 fflush(stdout); 949 950 Tcl_DStringFree(&command); 951 } 952 725 953 iPtr->cmdCount++; 726 954 DECACHE_STACK_INFO(); … … 768 996 */ 769 997 PUSH_OBJECT(Tcl_GetObjResult(interp)); 998 TRACE_WITH_OBJ(("%s %u => ...after \"%.20s\", result=", 999 opName[opCode], objc, cmdNameBuf), 1000 Tcl_GetObjResult(interp)); 770 1001 ADJUST_PC(pcAdjustment); 771 1002 … … 784 1015 /*catchOnly*/ 0, codePtr); 785 1016 if (rangePtr == NULL) { 1017 TRACE(("%s %u => ... after \"%.20s\", no encl. loop or catch, returning %s\n", 1018 opName[opCode], objc, cmdNameBuf, 1019 StringForResultCode(result))); 786 1020 goto abnormalReturn; /* no catch exists to check */ 787 1021 } … … 791 1025 newPcOffset = rangePtr->breakOffset; 792 1026 } else if (rangePtr->continueOffset == -1) { 1027 TRACE(("%s %u => ... after \"%.20s\", %s, loop w/o continue, checking for catch\n", 1028 opName[opCode], objc, cmdNameBuf, 1029 StringForResultCode(result))); 793 1030 goto checkForCatch; 794 1031 } else { 795 1032 newPcOffset = rangePtr->continueOffset; 796 1033 } 1034 TRACE(("%s %u => ... after \"%.20s\", %s, range at %d, new pc %d\n", 1035 opName[opCode], objc, cmdNameBuf, 1036 StringForResultCode(result), 1037 rangePtr->codeOffset, newPcOffset)); 797 1038 break; 798 1039 case CATCH_EXCEPTION_RANGE: 1040 TRACE(("%s %u => ... after \"%.20s\", %s...\n", 1041 opName[opCode], objc, cmdNameBuf, 1042 StringForResultCode(result))); 799 1043 goto processCatch; /* it will use rangePtr */ 800 1044 default: … … 810 1054 * enclosing catch exception range, if any. 811 1055 */ 1056 TRACE_WITH_OBJ(("%s %u => ... after \"%.20s\", TCL_ERROR ", 1057 opName[opCode], objc, cmdNameBuf), 1058 Tcl_GetObjResult(interp)); 812 1059 goto checkForCatch; 813 1060 … … 818 1065 * for an enclosing catch exception range, if any. 819 1066 */ 1067 TRACE(("%s %u => ... after \"%.20s\", TCL_RETURN\n", 1068 opName[opCode], objc, cmdNameBuf)); 820 1069 goto checkForCatch; 821 1070 822 1071 default: 1072 TRACE_WITH_OBJ(("%s %u => ... after \"%.20s\", OTHER RETURN CODE %d ", 1073 opName[opCode], objc, cmdNameBuf, result), 1074 Tcl_GetObjResult(interp)); 823 1075 goto checkForCatch; 824 1076 } /* end of switch on result from invoke instruction */ … … 836 1088 837 1089 PUSH_OBJECT(Tcl_GetObjResult(interp)); 1090 TRACE_WITH_OBJ(("evalStk \"%.30s\" => ", O2S(objPtr)), 1091 Tcl_GetObjResult(interp)); 838 1092 TclDecrRefCount(objPtr); 839 1093 ADJUST_PC(1); … … 855 1109 codePtr); 856 1110 if (rangePtr == NULL) { 1111 TRACE(("evalStk \"%.30s\" => no encl. loop or catch, returning %s\n", 1112 O2S(objPtr), StringForResultCode(result))); 857 1113 Tcl_DecrRefCount(objPtr); 858 1114 goto abnormalReturn; /* no catch exists to check */ … … 863 1119 newPcOffset = rangePtr->breakOffset; 864 1120 } else if (rangePtr->continueOffset == -1) { 1121 TRACE(("evalStk \"%.30s\" => %s, loop w/o continue, checking for catch\n", 1122 O2S(objPtr), StringForResultCode(result))); 865 1123 Tcl_DecrRefCount(objPtr); 866 1124 goto checkForCatch; … … 869 1127 } 870 1128 result = TCL_OK; 1129 TRACE_WITH_OBJ(("evalStk \"%.30s\" => %s, range at %d, new pc %d ", 1130 O2S(objPtr), StringForResultCode(result), 1131 rangePtr->codeOffset, newPcOffset), valuePtr); 871 1132 break; 872 1133 case CATCH_EXCEPTION_RANGE: 1134 TRACE_WITH_OBJ(("evalStk \"%.30s\" => %s ", 1135 O2S(objPtr), StringForResultCode(result)), 1136 valuePtr); 873 1137 Tcl_DecrRefCount(objPtr); 874 1138 goto processCatch; /* it will use rangePtr */ … … 880 1144 continue; /* restart outer instruction loop at pc */ 881 1145 } else { /* eval returned TCL_ERROR, TCL_RETURN, unknown code */ 1146 TRACE_WITH_OBJ(("evalStk \"%.30s\" => ERROR: ", O2S(objPtr)), 1147 Tcl_GetObjResult(interp)); 882 1148 Tcl_DecrRefCount(objPtr); 883 1149 goto checkForCatch; … … 891 1157 CACHE_STACK_INFO(); 892 1158 if (result != TCL_OK) { 1159 TRACE_WITH_OBJ(("exprStk \"%.30s\" => ERROR: ", 1160 O2S(objPtr)), Tcl_GetObjResult(interp)); 893 1161 Tcl_DecrRefCount(objPtr); 894 1162 goto checkForCatch; 895 1163 } 896 1164 stackPtr[++stackTop].o = valuePtr; /* already has right refct */ 1165 TRACE_WITH_OBJ(("exprStk \"%.30s\" => ", O2S(objPtr)), valuePtr); 897 1166 TclDecrRefCount(objPtr); 898 1167 ADJUST_PC(1); … … 913 1182 CACHE_STACK_INFO(); 914 1183 if (valuePtr == NULL) { 1184 TRACE_WITH_OBJ(("%s %u => ERROR: ", opName[opCode], opnd), 1185 Tcl_GetObjResult(interp)); 915 1186 result = TCL_ERROR; 916 1187 goto checkForCatch; 917 1188 } 918 1189 PUSH_OBJECT(valuePtr); 1190 TRACE_WITH_OBJ(("%s %u => ", opName[opCode], opnd), valuePtr); 919 1191 ADJUST_PC(pcAdjustment); 920 1192 … … 926 1198 CACHE_STACK_INFO(); 927 1199 if (valuePtr == NULL) { 1200 TRACE_WITH_OBJ(("loadScalarStk \"%.30s\" => ERROR: ", 1201 O2S(namePtr)), Tcl_GetObjResult(interp)); 928 1202 Tcl_DecrRefCount(namePtr); 929 1203 result = TCL_ERROR; … … 931 1205 } 932 1206 PUSH_OBJECT(valuePtr); 1207 TRACE_WITH_OBJ(("loadScalarStk \"%.30s\" => ", 1208 O2S(namePtr)), valuePtr); 933 1209 TclDecrRefCount(namePtr); 934 1210 ADJUST_PC(1); … … 952 1228 CACHE_STACK_INFO(); 953 1229 if (valuePtr == NULL) { 1230 TRACE_WITH_OBJ(("%s %u \"%.30s\" => ERROR: ", 1231 opName[opCode], opnd, O2S(elemPtr)), 1232 Tcl_GetObjResult(interp)); 954 1233 Tcl_DecrRefCount(elemPtr); 955 1234 result = TCL_ERROR; … … 957 1236 } 958 1237 PUSH_OBJECT(valuePtr); 1238 TRACE_WITH_OBJ(("%s %u \"%.30s\" => ", 1239 opName[opCode], opnd, O2S(elemPtr)), valuePtr); 959 1240 TclDecrRefCount(elemPtr); 960 1241 } … … 971 1252 CACHE_STACK_INFO(); 972 1253 if (valuePtr == NULL) { 1254 TRACE_WITH_OBJ(("loadArrayStk \"%.30s(%.30s)\" => ERROR: ", 1255 O2S(namePtr), O2S(elemPtr)), 1256 Tcl_GetObjResult(interp)); 973 1257 Tcl_DecrRefCount(namePtr); 974 1258 Tcl_DecrRefCount(elemPtr); … … 977 1261 } 978 1262 PUSH_OBJECT(valuePtr); 1263 TRACE_WITH_OBJ(("loadArrayStk \"%.30s(%.30s)\" => ", 1264 O2S(namePtr), O2S(elemPtr)), valuePtr); 979 1265 TclDecrRefCount(namePtr); 980 1266 TclDecrRefCount(elemPtr); … … 989 1275 CACHE_STACK_INFO(); 990 1276 if (valuePtr == NULL) { 1277 TRACE_WITH_OBJ(("loadStk \"%.30s\" => ERROR: ", 1278 O2S(namePtr)), Tcl_GetObjResult(interp)); 991 1279 Tcl_DecrRefCount(namePtr); 992 1280 result = TCL_ERROR; … … 994 1282 } 995 1283 PUSH_OBJECT(valuePtr); 1284 TRACE_WITH_OBJ(("loadStk \"%.30s\" => ", O2S(namePtr)), 1285 valuePtr); 996 1286 TclDecrRefCount(namePtr); 997 1287 ADJUST_PC(1); … … 1013 1303 CACHE_STACK_INFO(); 1014 1304 if (value2Ptr == NULL) { 1305 TRACE_WITH_OBJ(("%s %u <- \"%.30s\" => ERROR: ", 1306 opName[opCode], opnd, O2S(valuePtr)), 1307 Tcl_GetObjResult(interp)); 1015 1308 Tcl_DecrRefCount(valuePtr); 1016 1309 result = TCL_ERROR; … … 1018 1311 } 1019 1312 PUSH_OBJECT(value2Ptr); 1313 TRACE_WITH_OBJ(("%s %u <- \"%.30s\" => ", 1314 opName[opCode], opnd, O2S(valuePtr)), value2Ptr); 1020 1315 TclDecrRefCount(valuePtr); 1021 1316 ADJUST_PC(pcAdjustment); … … 1029 1324 CACHE_STACK_INFO(); 1030 1325 if (value2Ptr == NULL) { 1326 TRACE_WITH_OBJ( 1327 ("storeScalarStk \"%.30s\" <- \"%.30s\" => ERROR: ", 1328 O2S(namePtr), O2S(valuePtr)), 1329 Tcl_GetObjResult(interp)); 1031 1330 Tcl_DecrRefCount(namePtr); 1032 1331 Tcl_DecrRefCount(valuePtr); … … 1035 1334 } 1036 1335 PUSH_OBJECT(value2Ptr); 1336 TRACE_WITH_OBJ( 1337 ("storeScalarStk \"%.30s\" <- \"%.30s\" => ", 1338 O2S(namePtr), 1339 O2S(valuePtr)), 1340 value2Ptr); 1037 1341 TclDecrRefCount(namePtr); 1038 1342 TclDecrRefCount(valuePtr); … … 1059 1363 CACHE_STACK_INFO(); 1060 1364 if (value2Ptr == NULL) { 1365 TRACE_WITH_OBJ( 1366 ("%s %u \"%.30s\" <- \"%.30s\" => ERROR: ", 1367 opName[opCode], opnd, O2S(elemPtr), 1368 O2S(valuePtr)), Tcl_GetObjResult(interp)); 1061 1369 Tcl_DecrRefCount(elemPtr); 1062 1370 Tcl_DecrRefCount(valuePtr); … … 1065 1373 } 1066 1374 PUSH_OBJECT(value2Ptr); 1375 TRACE_WITH_OBJ(("%s %u \"%.30s\" <- \"%.30s\" => ", 1376 opName[opCode], opnd, O2S(elemPtr), O2S(valuePtr)), 1377 value2Ptr); 1067 1378 TclDecrRefCount(elemPtr); 1068 1379 TclDecrRefCount(valuePtr); … … 1082 1393 CACHE_STACK_INFO(); 1083 1394 if (value2Ptr == NULL) { 1395 TRACE_WITH_OBJ(("storeArrayStk \"%.30s(%.30s)\" <- \"%.30s\" => ERROR: ", 1396 O2S(namePtr), O2S(elemPtr), O2S(valuePtr)), 1397 Tcl_GetObjResult(interp)); 1084 1398 Tcl_DecrRefCount(namePtr); 1085 1399 Tcl_DecrRefCount(elemPtr); … … 1089 1403 } 1090 1404 PUSH_OBJECT(value2Ptr); 1405 TRACE_WITH_OBJ(("storeArrayStk \"%.30s(%.30s)\" <- \"%.30s\" => ", 1406 O2S(namePtr), O2S(elemPtr), O2S(valuePtr)), 1407 value2Ptr); 1091 1408 TclDecrRefCount(namePtr); 1092 1409 TclDecrRefCount(elemPtr); … … 1103 1420 CACHE_STACK_INFO(); 1104 1421 if (value2Ptr == NULL) { 1422 TRACE_WITH_OBJ(("storeStk \"%.30s\" <- \"%.30s\" => ERROR: ", 1423 O2S(namePtr), O2S(valuePtr)), 1424 Tcl_GetObjResult(interp)); 1105 1425 Tcl_DecrRefCount(namePtr); 1106 1426 Tcl_DecrRefCount(valuePtr); … … 1109 1429 } 1110 1430 PUSH_OBJECT(value2Ptr); 1431 TRACE_WITH_OBJ(("storeStk \"%.30s\" <- \"%.30s\" => ", 1432 O2S(namePtr), O2S(valuePtr)), value2Ptr); 1111 1433 TclDecrRefCount(namePtr); 1112 1434 TclDecrRefCount(valuePtr); … … 1119 1441 result = tclIntType.setFromAnyProc(interp, valuePtr); 1120 1442 if (result != TCL_OK) { 1443 TRACE_WITH_OBJ(("incrScalar1 %u (by %s) => ERROR converting increment amount to int: ", 1444 opnd, O2S(valuePtr)), Tcl_GetObjResult(interp)); 1121 1445 Tcl_DecrRefCount(valuePtr); 1122 1446 goto checkForCatch; … … 1128 1452 CACHE_STACK_INFO(); 1129 1453 if (value2Ptr == NULL) { 1454 TRACE_WITH_OBJ(("incrScalar1 %u (by %ld) => ERROR: ", 1455 opnd, i), Tcl_GetObjResult(interp)); 1130 1456 Tcl_DecrRefCount(valuePtr); 1131 1457 result = TCL_ERROR; … … 1133 1459 } 1134 1460 PUSH_OBJECT(value2Ptr); 1461 TRACE_WITH_OBJ(("incrScalar1 %u (by %ld) => ", opnd, i), 1462 value2Ptr); 1135 1463 TclDecrRefCount(valuePtr); 1136 1464 ADJUST_PC(2); … … 1143 1471 result = tclIntType.setFromAnyProc(interp, valuePtr); 1144 1472 if (result != TCL_OK) { 1473 TRACE_WITH_OBJ(("%s \"%.30s\" (by %s) => ERROR converting increment amount to int: ", 1474 opName[opCode], O2S(namePtr), O2S(valuePtr)), 1475 Tcl_GetObjResult(interp)); 1145 1476 Tcl_DecrRefCount(namePtr); 1146 1477 Tcl_DecrRefCount(valuePtr); … … 1154 1485 CACHE_STACK_INFO(); 1155 1486 if (value2Ptr == NULL) { 1487 TRACE_WITH_OBJ(("%s \"%.30s\" (by %ld) => ERROR: ", 1488 opName[opCode], O2S(namePtr), i), 1489 Tcl_GetObjResult(interp)); 1156 1490 Tcl_DecrRefCount(namePtr); 1157 1491 Tcl_DecrRefCount(valuePtr); … … 1160 1494 } 1161 1495 PUSH_OBJECT(value2Ptr); 1496 TRACE_WITH_OBJ(("%s \"%.30s\" (by %ld) => ", 1497 opName[opCode], O2S(namePtr), i), value2Ptr); 1162 1498 Tcl_DecrRefCount(namePtr); 1163 1499 Tcl_DecrRefCount(valuePtr); … … 1174 1510 result = tclIntType.setFromAnyProc(interp, valuePtr); 1175 1511 if (result != TCL_OK) { 1512 TRACE_WITH_OBJ(("incrArray1 %u \"%.30s\" (by %s) => ERROR converting increment amount to int: ", 1513 opnd, O2S(elemPtr), O2S(valuePtr)), 1514 Tcl_GetObjResult(interp)); 1176 1515 Tcl_DecrRefCount(elemPtr); 1177 1516 Tcl_DecrRefCount(valuePtr); … … 1185 1524 CACHE_STACK_INFO(); 1186 1525 if (value2Ptr == NULL) { 1526 TRACE_WITH_OBJ(("incrArray1 %u \"%.30s\" (by %ld) => ERROR: ", 1527 opnd, O2S(elemPtr), i), 1528 Tcl_GetObjResult(interp)); 1187 1529 Tcl_DecrRefCount(elemPtr); 1188 1530 Tcl_DecrRefCount(valuePtr); … … 1191 1533 } 1192 1534 PUSH_OBJECT(value2Ptr); 1535 TRACE_WITH_OBJ(("incrArray1 %u \"%.30s\" (by %ld) => ", 1536 opnd, O2S(elemPtr), i), value2Ptr); 1193 1537 Tcl_DecrRefCount(elemPtr); 1194 1538 Tcl_DecrRefCount(valuePtr); … … 1206 1550 result = tclIntType.setFromAnyProc(interp, valuePtr); 1207 1551 if (result != TCL_OK) { 1552 TRACE_WITH_OBJ(("incrArrayStk \"%.30s(%.30s)\" (by %s) => ERROR converting increment amount to int: ", 1553 O2S(namePtr), O2S(elemPtr), O2S(valuePtr)), 1554 Tcl_GetObjResult(interp)); 1208 1555 Tcl_DecrRefCount(namePtr); 1209 1556 Tcl_DecrRefCount(elemPtr); … … 1218 1565 CACHE_STACK_INFO(); 1219 1566 if (value2Ptr == NULL) { 1567 TRACE_WITH_OBJ(("incrArrayStk \"%.30s(%.30s)\" (by %ld) => ERROR: ", 1568 O2S(namePtr), O2S(elemPtr), i), 1569 Tcl_GetObjResult(interp)); 1220 1570 Tcl_DecrRefCount(namePtr); 1221 1571 Tcl_DecrRefCount(elemPtr); … … 1225 1575 } 1226 1576 PUSH_OBJECT(value2Ptr); 1577 TRACE_WITH_OBJ(("incrArrayStk \"%.30s(%.30s)\" (by %ld) => ", 1578 O2S(namePtr), O2S(elemPtr), i), value2Ptr); 1227 1579 Tcl_DecrRefCount(namePtr); 1228 1580 Tcl_DecrRefCount(elemPtr); … … 1238 1590 CACHE_STACK_INFO(); 1239 1591 if (value2Ptr == NULL) { 1592 TRACE_WITH_OBJ(("incrScalar1Imm %u %ld => ERROR: ", 1593 opnd, i), Tcl_GetObjResult(interp)); 1240 1594 result = TCL_ERROR; 1241 1595 goto checkForCatch; 1242 1596 } 1243 1597 PUSH_OBJECT(value2Ptr); 1598 TRACE_WITH_OBJ(("incrScalar1Imm %u %ld => ", opnd, i), 1599 value2Ptr); 1244 1600 ADJUST_PC(3); 1245 1601 … … 1253 1609 CACHE_STACK_INFO(); 1254 1610 if (value2Ptr == NULL) { 1611 TRACE_WITH_OBJ(("%s \"%.30s\" %ld => ERROR: ", 1612 opName[opCode], O2S(namePtr), i), 1613 Tcl_GetObjResult(interp)); 1255 1614 result = TCL_ERROR; 1256 1615 Tcl_DecrRefCount(namePtr); … … 1258 1617 } 1259 1618 PUSH_OBJECT(value2Ptr); 1619 TRACE_WITH_OBJ(("%s \"%.30s\" %ld => ", 1620 opName[opCode], O2S(namePtr), i), value2Ptr); 1260 1621 TclDecrRefCount(namePtr); 1261 1622 ADJUST_PC(2); … … 1273 1634 CACHE_STACK_INFO(); 1274 1635 if (value2Ptr == NULL) { 1636 TRACE_WITH_OBJ(("incrArray1Imm %u \"%.30s\" (by %ld) => ERROR: ", 1637 opnd, O2S(elemPtr), i), 1638 Tcl_GetObjResult(interp)); 1275 1639 Tcl_DecrRefCount(elemPtr); 1276 1640 result = TCL_ERROR; … … 1278 1642 } 1279 1643 PUSH_OBJECT(value2Ptr); 1644 TRACE_WITH_OBJ(("incrArray1Imm %u \"%.30s\" (by %ld) => ", 1645 opnd, O2S(elemPtr), i), value2Ptr); 1280 1646 Tcl_DecrRefCount(elemPtr); 1281 1647 } … … 1294 1660 CACHE_STACK_INFO(); 1295 1661 if (value2Ptr == NULL) { 1662 TRACE_WITH_OBJ(("incrArrayStkImm \"%.30s(%.30s)\" (by %ld) => ERROR: ", 1663 O2S(namePtr), O2S(elemPtr), i), 1664 Tcl_GetObjResult(interp)); 1296 1665 Tcl_DecrRefCount(namePtr); 1297 1666 Tcl_DecrRefCount(elemPtr); … … 1300 1669 } 1301 1670 PUSH_OBJECT(value2Ptr); 1671 TRACE_WITH_OBJ(("incrArrayStkImm \"%.30s(%.30s)\" (by %ld) => ", 1672 O2S(namePtr), O2S(elemPtr), i), value2Ptr); 1302 1673 Tcl_DecrRefCount(namePtr); 1303 1674 Tcl_DecrRefCount(elemPtr); … … 1307 1678 case INST_JUMP1: 1308 1679 opnd = TclGetInt1AtPtr(pc+1); 1680 TRACE(("jump1 %d => new pc %u\n", opnd, 1681 (unsigned int)(pc + opnd - codePtr->codeStart))); 1309 1682 ADJUST_PC(opnd); 1310 1683 1311 1684 case INST_JUMP4: 1312 1685 opnd = TclGetInt4AtPtr(pc+1); 1686 TRACE(("jump4 %d => new pc %u\n", opnd, 1687 (unsigned int)(pc + opnd - codePtr->codeStart))); 1313 1688 ADJUST_PC(opnd); 1314 1689 … … 1334 1709 result = Tcl_GetBooleanFromObj(interp, valuePtr, &b); 1335 1710 if (result != TCL_OK) { 1711 TRACE_WITH_OBJ(("%s %d => ERROR: ", opName[opCode], 1712 opnd), Tcl_GetObjResult(interp)); 1336 1713 Tcl_DecrRefCount(valuePtr); 1337 1714 goto checkForCatch; … … 1339 1716 } 1340 1717 if (b) { 1718 TRACE(("%s %d => %.20s true, new pc %u\n", 1719 opName[opCode], opnd, O2S(valuePtr), 1720 (unsigned int)(pc+opnd - codePtr->codeStart))); 1341 1721 TclDecrRefCount(valuePtr); 1342 1722 ADJUST_PC(opnd); 1343 1723 } else { 1724 TRACE(("%s %d => %.20s false\n", opName[opCode], opnd, 1725 O2S(valuePtr))); 1344 1726 TclDecrRefCount(valuePtr); 1345 1727 ADJUST_PC(pcAdjustment); … … 1368 1750 result = Tcl_GetBooleanFromObj(interp, valuePtr, &b); 1369 1751 if (result != TCL_OK) { 1752 TRACE_WITH_OBJ(("%s %d => ERROR: ", opName[opCode], 1753 opnd), Tcl_GetObjResult(interp)); 1370 1754 Tcl_DecrRefCount(valuePtr); 1371 1755 goto checkForCatch; … … 1373 1757 } 1374 1758 if (b) { 1759 TRACE(("%s %d => %.20s true\n", opName[opCode], opnd, 1760 O2S(valuePtr))); 1375 1761 TclDecrRefCount(valuePtr); 1376 1762 ADJUST_PC(pcAdjustment); 1377 1763 } else { 1764 TRACE(("%s %d => %.20s false, new pc %u\n", 1765 opName[opCode], opnd, O2S(valuePtr), 1766 (unsigned int)(pc + opnd - codePtr->codeStart))); 1378 1767 TclDecrRefCount(valuePtr); 1379 1768 ADJUST_PC(opnd); … … 1415 1804 } 1416 1805 if (result != TCL_OK) { 1806 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n", 1807 opName[opCode], O2S(valuePtr), 1808 (t1Ptr? t1Ptr->name : "null"))); 1417 1809 IllegalExprOperandType(interp, opCode, valuePtr); 1418 1810 Tcl_DecrRefCount(valuePtr); … … 1438 1830 } 1439 1831 if (result != TCL_OK) { 1832 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n", 1833 opName[opCode], O2S(value2Ptr), 1834 (t2Ptr? t2Ptr->name : "null"))); 1440 1835 IllegalExprOperandType(interp, opCode, value2Ptr); 1441 1836 Tcl_DecrRefCount(valuePtr); … … 1456 1851 if (Tcl_IsShared(valuePtr)) { 1457 1852 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 1853 TRACE(("%s %.20s %.20s => %d\n", opName[opCode], 1854 O2S(valuePtr), O2S(value2Ptr), iResult)); 1458 1855 TclDecrRefCount(valuePtr); 1459 1856 } else { /* reuse the valuePtr object */ 1857 TRACE(("%s %.20s %.20s => %d\n", 1858 opName[opCode], /* NB: stack top is off by 1 */ 1859 O2S(valuePtr), O2S(value2Ptr), iResult)); 1460 1860 Tcl_SetLongObj(valuePtr, iResult); 1461 1861 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 1613 2013 if (Tcl_IsShared(valuePtr)) { 1614 2014 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2015 TRACE(("%s %.20s %.20s => %ld\n", opName[opCode], 2016 O2S(valuePtr), O2S(value2Ptr), iResult)); 1615 2017 TclDecrRefCount(valuePtr); 1616 2018 } else { /* reuse the valuePtr object */ 2019 TRACE(("%s %.20s %.20s => %ld\n", 2020 opName[opCode], /* NB: stack top is off by 1 */ 2021 O2S(valuePtr), O2S(value2Ptr), iResult)); 1617 2022 Tcl_SetLongObj(valuePtr, iResult); 1618 2023 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 1644 2049 valuePtr, &i); 1645 2050 if (result != TCL_OK) { 2051 TRACE(("%s %.20s %.20s => ILLEGAL 1st TYPE %s\n", 2052 opName[opCode], O2S(valuePtr), O2S(value2Ptr), 2053 (valuePtr->typePtr? 2054 valuePtr->typePtr->name : "null"))); 1646 2055 IllegalExprOperandType(interp, opCode, valuePtr); 1647 2056 Tcl_DecrRefCount(valuePtr); … … 1656 2065 value2Ptr, &i2); 1657 2066 if (result != TCL_OK) { 2067 TRACE(("%s %.20s %.20s => ILLEGAL 2nd TYPE %s\n", 2068 opName[opCode], O2S(valuePtr), O2S(value2Ptr), 2069 (value2Ptr->typePtr? 2070 value2Ptr->typePtr->name : "null"))); 1658 2071 IllegalExprOperandType(interp, opCode, value2Ptr); 1659 2072 Tcl_DecrRefCount(valuePtr); … … 1672 2085 */ 1673 2086 if (i2 == 0) { 2087 TRACE(("mod %ld %ld => DIVIDE BY ZERO\n", i, i2)); 1674 2088 Tcl_DecrRefCount(valuePtr); 1675 2089 Tcl_DecrRefCount(value2Ptr); … … 1723 2137 if (Tcl_IsShared(valuePtr)) { 1724 2138 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2139 TRACE(("%s %ld %ld => %ld\n", opName[opCode], i, i2, 2140 iResult)); 1725 2141 TclDecrRefCount(valuePtr); 1726 2142 } else { /* reuse the valuePtr object */ 2143 TRACE(("%s %ld %ld => %ld\n", opName[opCode], i, i2, 2144 iResult)); /* NB: stack top is off by 1 */ 1727 2145 Tcl_SetLongObj(valuePtr, iResult); 1728 2146 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 1768 2186 } 1769 2187 if (result != TCL_OK) { 2188 TRACE(("%s %.20s %.20s => ILLEGAL 1st TYPE %s\n", 2189 opName[opCode], s, O2S(value2Ptr), 2190 (valuePtr->typePtr? 2191 valuePtr->typePtr->name : "null"))); 1770 2192 IllegalExprOperandType(interp, opCode, valuePtr); 1771 2193 Tcl_DecrRefCount(valuePtr); … … 1790 2212 } 1791 2213 if (result != TCL_OK) { 2214 TRACE(("%s %.20s %.20s => ILLEGAL 2nd TYPE %s\n", 2215 opName[opCode], O2S(valuePtr), s, 2216 (value2Ptr->typePtr? 2217 value2Ptr->typePtr->name : "null"))); 1792 2218 IllegalExprOperandType(interp, opCode, value2Ptr); 1793 2219 Tcl_DecrRefCount(valuePtr); … … 1820 2246 case INST_DIV: 1821 2247 if (d2 == 0.0) { 2248 TRACE(("div %.6g %.6g => DIVIDE BY ZERO\n", 2249 d1, d2)); 1822 2250 Tcl_DecrRefCount(valuePtr); 1823 2251 Tcl_DecrRefCount(value2Ptr); … … 1833 2261 1834 2262 if (IS_NAN(dResult) || IS_INF(dResult)) { 2263 TRACE(("%s %.20s %.20s => IEEE FLOATING PT ERROR\n", 2264 opName[opCode], O2S(valuePtr), O2S(value2Ptr))); 1835 2265 TclExprFloatError(interp, dResult); 1836 2266 result = TCL_ERROR; … … 1861 2291 */ 1862 2292 if (i2 == 0) { 2293 TRACE(("div %ld %ld => DIVIDE BY ZERO\n", 2294 i, i2)); 1863 2295 Tcl_DecrRefCount(valuePtr); 1864 2296 Tcl_DecrRefCount(value2Ptr); … … 1886 2318 if (doDouble) { 1887 2319 PUSH_OBJECT(Tcl_NewDoubleObj(dResult)); 2320 TRACE(("%s %.6g %.6g => %.6g\n", opName[opCode], 2321 d1, d2, dResult)); 1888 2322 } else { 1889 2323 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2324 TRACE(("%s %ld %ld => %ld\n", opName[opCode], 2325 i, i2, iResult)); 1890 2326 } 1891 2327 TclDecrRefCount(valuePtr); 1892 2328 } else { /* reuse the valuePtr object */ 1893 2329 if (doDouble) { /* NB: stack top is off by 1 */ 2330 TRACE(("%s %.6g %.6g => %.6g\n", opName[opCode], 2331 d1, d2, dResult)); 1894 2332 Tcl_SetDoubleObj(valuePtr, dResult); 1895 2333 } else { 2334 TRACE(("%s %ld %ld => %ld\n", opName[opCode], 2335 i, i2, iResult)); 1896 2336 Tcl_SetLongObj(valuePtr, iResult); 1897 2337 } … … 1923 2363 } 1924 2364 if (result != TCL_OK) { 2365 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n", 2366 opName[opCode], s, 2367 (tPtr? tPtr->name : "null"))); 1925 2368 IllegalExprOperandType(interp, opCode, valuePtr); 1926 2369 goto checkForCatch; 1927 2370 } 1928 2371 } 2372 TRACE_WITH_OBJ(("uplus %s => ", O2S(valuePtr)), valuePtr); 1929 2373 } 1930 2374 ADJUST_PC(1); … … 1955 2399 } 1956 2400 if (result != TCL_OK) { 2401 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s\n", 2402 opName[opCode], s, 2403 (tPtr? tPtr->name : "null"))); 1957 2404 IllegalExprOperandType(interp, opCode, valuePtr); 1958 2405 Tcl_DecrRefCount(valuePtr); … … 1970 2417 objPtr = Tcl_NewLongObj( 1971 2418 (opCode == INST_UMINUS)? -i : !i); 2419 TRACE_WITH_OBJ(("%s %ld => ", opName[opCode], i), 2420 objPtr); /* NB: stack top is off by 1 */ 1972 2421 } else { 1973 2422 d = valuePtr->internalRep.doubleValue; … … 1981 2430 objPtr = Tcl_NewLongObj((d==0.0)? 1 : 0); 1982 2431 } 2432 TRACE_WITH_OBJ(("%s %.6g => ", opName[opCode], d), 2433 objPtr); /* NB: stack top is off by 1 */ 1983 2434 } 1984 2435 PUSH_OBJECT(objPtr); … … 1992 2443 Tcl_SetLongObj(valuePtr, 1993 2444 (opCode == INST_UMINUS)? -i : !i); 2445 TRACE_WITH_OBJ(("%s %ld => ", opName[opCode], i), 2446 valuePtr); /* NB: stack top is off by 1 */ 1994 2447 } else { 1995 2448 d = valuePtr->internalRep.doubleValue; … … 2003 2456 Tcl_SetLongObj(valuePtr, (d==0.0)? 1 : 0); 2004 2457 } 2458 TRACE_WITH_OBJ(("%s %.6g => ", opName[opCode], d), 2459 valuePtr); /* NB: stack top is off by 1 */ 2005 2460 } 2006 2461 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 2026 2481 valuePtr, &i); 2027 2482 if (result != TCL_OK) { /* try to convert to double */ 2483 TRACE(("bitnot \"%.20s\" => ILLEGAL TYPE %s\n", 2484 O2S(valuePtr), (tPtr? tPtr->name : "null"))); 2028 2485 IllegalExprOperandType(interp, opCode, valuePtr); 2029 2486 Tcl_DecrRefCount(valuePtr); … … 2035 2492 if (Tcl_IsShared(valuePtr)) { 2036 2493 PUSH_OBJECT(Tcl_NewLongObj(~i)); 2494 TRACE(("bitnot 0x%lx => (%lu)\n", i, ~i)); 2037 2495 TclDecrRefCount(valuePtr); 2038 2496 } else { … … 2042 2500 Tcl_SetLongObj(valuePtr, ~i); 2043 2501 ++stackTop; /* valuePtr now on stk top has right r.c. */ 2502 TRACE(("bitnot 0x%lx => (%lu)\n", i, ~i)); 2044 2503 } 2045 2504 } … … 2056 2515 2057 2516 if ((opnd < 0) || (opnd > LAST_BUILTIN_FUNC)) { 2517 TRACE(("UNRECOGNIZED BUILTIN FUNC CODE %d\n", opnd)); 2058 2518 panic("TclExecuteByteCode: unrecognized builtin function code %d", opnd); 2059 2519 } … … 2068 2528 goto checkForCatch; 2069 2529 } 2530 TRACE_WITH_OBJ(("callBuiltinFunc1 %d => ", opnd), 2531 stackPtr[stackTop].o); 2070 2532 } 2071 2533 ADJUST_PC(2); … … 2093 2555 goto checkForCatch; 2094 2556 } 2557 TRACE_WITH_OBJ(("callFunc1 %d => ", objc), 2558 stackPtr[stackTop].o); 2095 2559 ADJUST_PC(2); 2096 2560 } … … 2163 2627 d = valuePtr->internalRep.doubleValue; 2164 2628 if (IS_NAN(d) || IS_INF(d)) { 2629 TRACE(("tryCvtToNumeric \"%.20s\" => IEEE FLOATING PT ERROR\n", 2630 O2S(valuePtr))); 2165 2631 TclExprFloatError(interp, d); 2166 2632 result = TCL_ERROR; … … 2170 2636 shared = shared; /* lint, shared not used. */ 2171 2637 converted = converted; /* lint, converted not used. */ 2638 TRACE(("tryCvtToNumeric \"%.20s\" => numeric, %s, %s\n", 2639 O2S(valuePtr), 2640 (converted? "converted" : "not converted"), 2641 (shared? "shared" : "not shared"))); 2642 } else { 2643 TRACE(("tryCvtToNumeric \"%.20s\" => not numeric\n", 2644 O2S(valuePtr))); 2172 2645 } 2173 2646 } … … 2187 2660 codePtr); 2188 2661 if (rangePtr == NULL) { 2662 TRACE(("break => no encl. loop or catch, returning TCL_BREAK\n")); 2189 2663 result = TCL_BREAK; 2190 2664 goto abnormalReturn; /* no catch exists to check */ … … 2193 2667 case LOOP_EXCEPTION_RANGE: 2194 2668 result = TCL_OK; 2669 TRACE(("break => range at %d, new pc %d\n", 2670 rangePtr->codeOffset, rangePtr->breakOffset)); 2195 2671 break; 2196 2672 case CATCH_EXCEPTION_RANGE: 2197 2673 result = TCL_BREAK; 2674 TRACE(("break => ...\n")); 2198 2675 goto processCatch; /* it will use rangePtr */ 2199 2676 default: … … 2216 2693 codePtr); 2217 2694 if (rangePtr == NULL) { 2695 TRACE(("continue => no encl. loop or catch, returning TCL_CONTINUE\n")); 2218 2696 result = TCL_CONTINUE; 2219 2697 goto abnormalReturn; … … 2222 2700 case LOOP_EXCEPTION_RANGE: 2223 2701 if (rangePtr->continueOffset == -1) { 2702 TRACE(("continue => loop w/o continue, checking for catch\n")); 2224 2703 goto checkForCatch; 2225 2704 } else { 2226 2705 result = TCL_OK; 2706 TRACE(("continue => range at %d, new pc %d\n", 2707 rangePtr->codeOffset, rangePtr->continueOffset)); 2227 2708 } 2228 2709 break; 2229 2710 case CATCH_EXCEPTION_RANGE: 2230 2711 result = TCL_CONTINUE; 2712 TRACE(("continue => ...\n")); 2231 2713 goto processCatch; /* it will use rangePtr */ 2232 2714 default: … … 2262 2744 TclSetVarScalar(iterVarPtr); 2263 2745 TclClearVarUndefined(iterVarPtr); 2746 TRACE(("foreach_start4 %u => loop iter count temp %d\n", 2747 opnd, iterTmpIndex)); 2264 2748 } 2265 2749 ADJUST_PC(5); … … 2310 2794 result = Tcl_ListObjLength(interp, listPtr, &listLen); 2311 2795 if (result != TCL_OK) { 2796 TRACE_WITH_OBJ(("foreach_step4 %u => ERROR converting list %ld, \"%s\": ", 2797 opnd, i, O2S(listPtr)), 2798 Tcl_GetObjResult(interp)); 2312 2799 goto checkForCatch; 2313 2800 } … … 2353 2840 CACHE_STACK_INFO(); 2354 2841 if (value2Ptr == NULL) { 2842 TRACE_WITH_OBJ(("foreach_step4 %u => ERROR init. index temp %d: ", 2843 opnd, varIndex), 2844 Tcl_GetObjResult(interp)); 2355 2845 if (setEmptyStr) { 2356 2846 Tcl_DecrRefCount(elemPtr); /* unneeded */ … … 2372 2862 2373 2863 PUSH_OBJECT(Tcl_NewLongObj(continueLoop)); 2864 TRACE(("foreach_step4 %u => %d lists, iter %d, %s loop\n", 2865 opnd, numLists, iterNum, 2866 (continueLoop? "continue" : "exit"))); 2374 2867 } 2375 2868 ADJUST_PC(5); … … 2382 2875 */ 2383 2876 catchStackPtr[++catchTop] = stackTop; 2877 TRACE(("beginCatch4 %u => catchTop=%d, stackTop=%d\n", 2878 TclGetUInt4AtPtr(pc+1), catchTop, stackTop)); 2384 2879 ADJUST_PC(5); 2385 2880 … … 2387 2882 catchTop--; 2388 2883 result = TCL_OK; 2884 TRACE(("endCatch => catchTop=%d\n", catchTop)); 2389 2885 ADJUST_PC(1); 2390 2886 2391 2887 case INST_PUSH_RESULT: 2392 2888 PUSH_OBJECT(Tcl_GetObjResult(interp)); 2889 TRACE_WITH_OBJ(("pushResult => "), Tcl_GetObjResult(interp)); 2393 2890 ADJUST_PC(1); 2394 2891 2395 2892 case INST_PUSH_RETURN_CODE: 2396 2893 PUSH_OBJECT(Tcl_NewLongObj(result)); 2894 TRACE(("pushReturnCode => %u\n", result)); 2397 2895 ADJUST_PC(1); 2398 2896 2399 2897 default: 2898 TRACE(("UNRECOGNIZED INSTRUCTION %u\n", opCode)); 2400 2899 panic("TclExecuteByteCode: unrecognized opCode %u", opCode); 2401 2900 } /* end of switch on opCode */ … … 2427 2926 rangePtr = TclGetExceptionRangeForPc(pc, /*catchOnly*/ 1, codePtr); 2428 2927 if (rangePtr == NULL) { 2928 TRACE((" ... no enclosing catch, returning %s\n", 2929 StringForResultCode(result))); 2429 2930 goto abnormalReturn; 2430 2931 } … … 2444 2945 TclDecrRefCount(valuePtr); 2445 2946 } 2947 TRACE((" ... found catch at %d, catchTop=%d, unwound to %d, new pc %u\n", 2948 rangePtr->codeOffset, catchTop, catchStackPtr[catchTop], 2949 (unsigned int)(rangePtr->catchOffset))); 2446 2950 pc = (codePtr->codeStart + rangePtr->catchOffset); 2447 2951 continue; /* restart the execution loop at pc */ … … 2471 2975 #undef STATIC_CATCH_STACK_SIZE 2472 2976 } 2977 2978 2979 /* 2980 *---------------------------------------------------------------------- 2981 * 2982 * PrintByteCodeInfo -- 2983 * 2984 * This procedure prints a summary about a bytecode object to stdout. 2985 * It is called by TclExecuteByteCode when starting to execute the 2986 * bytecode object if tclTraceExec has the value 2 or more. 2987 * 2988 * Results: 2989 * None. 2990 * 2991 * Side effects: 2992 * None. 2993 * 2994 *---------------------------------------------------------------------- 2995 */ 2996 2997 static void 2998 PrintByteCodeInfo(codePtr) 2999 register ByteCode *codePtr; /* The bytecode whose summary is printed 3000 * to stdout. */ 3001 { 3002 Proc *procPtr = codePtr->procPtr; 3003 int numCmds = codePtr->numCommands; 3004 int numObjs = codePtr->numObjects; 3005 int objBytes, i; 3006 3007 objBytes = (numObjs * sizeof(Tcl_Obj)); 3008 for (i = 0; i < numObjs; i++) { 3009 Tcl_Obj *litObjPtr = codePtr->objArrayPtr[i]; 3010 if (litObjPtr->bytes != NULL) { 3011 objBytes += litObjPtr->length; 3012 } 3013 } 3014 3015 fprintf(stdout, "\nExecuting ByteCode 0x%x, ref ct %u, epoch %u, interp 0x%x(epoch %u)\n", 3016 (unsigned int) codePtr, codePtr->refCount, 3017 codePtr->compileEpoch, (unsigned int) codePtr->iPtr, 3018 codePtr->iPtr->compileEpoch); 3019 3020 fprintf(stdout, " Source: "); 3021 TclPrintSource(stdout, codePtr->source, 70); 3022 3023 fprintf(stdout, "\n Cmds %d, chars %d, inst %u, objs %u, aux %d, stk depth %u, code/src %.2fn", 3024 numCmds, codePtr->numSrcChars, codePtr->numCodeBytes, numObjs, 3025 codePtr->numAuxDataItems, codePtr->maxStackDepth, 3026 (codePtr->numSrcChars? 3027 ((float)codePtr->totalSize)/((float)codePtr->numSrcChars) : 0.0)); 3028 3029 fprintf(stdout, " Code %zu = %u(header)+%d(inst)+%d(objs)+%u(exc)+%u(aux)+%d(cmd map)\n", 3030 codePtr->totalSize, sizeof(ByteCode), codePtr->numCodeBytes, 3031 objBytes, (codePtr->numExcRanges * sizeof(ExceptionRange)), 3032 (codePtr->numAuxDataItems * sizeof(AuxData)), 3033 codePtr->numCmdLocBytes); 3034 3035 if (procPtr != NULL) { 3036 fprintf(stdout, 3037 " Proc 0x%x, ref ct %d, args %d, compiled locals %d\n", 3038 (unsigned int) procPtr, procPtr->refCount, 3039 procPtr->numArgs, procPtr->numCompiledLocals); 3040 } 3041 } 3042 3043 3044 /* 3045 *---------------------------------------------------------------------- 3046 * 3047 * ValidatePcAndStackTop -- 3048 * 3049 * This procedure is called by TclExecuteByteCode when debugging to 3050 * verify that the program counter and stack top are valid during 3051 * execution. 3052 * 3053 * Results: 3054 * None. 3055 * 3056 * Side effects: 3057 * Prints a message to stderr and panics if either the pc or stack 3058 * top are invalid. 3059 * 3060 *---------------------------------------------------------------------- 3061 */ 3062 3063 #ifdef TCL_COMPILE_DEBUG 3064 static void 3065 ValidatePcAndStackTop(codePtr, pc, stackTop, stackLowerBound, stackUpperBound) 3066 register ByteCode *codePtr; /* The bytecode whose summary is printed 3067 * to stdout. */ 3068 unsigned char *pc; /* Points to first byte of a bytecode 3069 * instruction. The program counter. */ 3070 int stackTop; /* Current stack top. Must be between 3071 * stackLowerBound and stackUpperBound 3072 * (inclusive). */ 3073 int stackLowerBound; /* Smallest legal value for stackTop. */ 3074 int stackUpperBound; /* Greatest legal value for stackTop. */ 3075 { 3076 unsigned int relativePc = (unsigned int) (pc - codePtr->codeStart); 3077 unsigned int codeStart = (unsigned int) codePtr->codeStart; 3078 unsigned int codeEnd = (unsigned int) 3079 (codePtr->codeStart + codePtr->numCodeBytes); 3080 unsigned char opCode = *pc; 3081 3082 if (((unsigned int) pc < codeStart) || ((unsigned int) pc > codeEnd)) { 3083 fprintf(stderr, "\nBad instruction pc 0x%x in TclExecuteByteCode\n", 3084 (unsigned int) pc); 3085 panic("TclExecuteByteCode execution failure: bad pc"); 3086 } 3087 if ((unsigned int) opCode > LAST_INST_OPCODE) { 3088 fprintf(stderr, "\nBad opcode %d at pc %u in TclExecuteByteCode\n", 3089 (unsigned int) opCode, relativePc); 3090 panic("TclExecuteByteCode execution failure: bad opcode"); 3091 } 3092 if ((stackTop < stackLowerBound) || (stackTop > stackUpperBound)) { 3093 int numChars; 3094 char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars); 3095 char *ellipsis = ""; 3096 3097 fprintf(stderr, "\nBad stack top %d at pc %u in TclExecuteByteCode", 3098 stackTop, relativePc); 3099 if (cmd != NULL) { 3100 if (numChars > 100) { 3101 numChars = 100; 3102 ellipsis = "..."; 3103 } 3104 fprintf(stderr, "\n executing %.*s%s\n", numChars, cmd, 3105 ellipsis); 3106 } else { 3107 fprintf(stderr, "\n"); 3108 } 3109 panic("TclExecuteByteCode execution failure: bad stack top"); 3110 } 3111 } 3112 #endif /* TCL_COMPILE_DEBUG */ 2473 3113 2474 3114 … … 3631 4271 3632 4272 4273 #ifdef TCL_COMPILE_STATS 4274 /* 4275 *---------------------------------------------------------------------- 4276 * 4277 * TclLog2 -- 4278 * 4279 * Procedure used while collecting compilation statistics to determine 4280 * the log base 2 of an integer. 4281 * 4282 * Results: 4283 * Returns the log base 2 of the operand. If the argument is less 4284 * than or equal to zero, a zero is returned. 4285 * 4286 * Side effects: 4287 * None. 4288 * 4289 *---------------------------------------------------------------------- 4290 */ 4291 4292 int 4293 TclLog2(value) 4294 register int value; /* The integer for which to compute the 4295 * log base 2. */ 4296 { 4297 register int n = value; 4298 register int result = 0; 4299 4300 while (n > 1) { 4301 n = n >> 1; 4302 result++; 4303 } 4304 return result; 4305 } 4306 4307 4308 /* 4309 *---------------------------------------------------------------------- 4310 * 4311 * EvalStatsCmd -- 4312 * 4313 * Implements the "evalstats" command that prints instruction execution 4314 * counts to stdout. 4315 * 4316 * Results: 4317 * Standard Tcl results. 4318 * 4319 * Side effects: 4320 * None. 4321 * 4322 *---------------------------------------------------------------------- 4323 */ 4324 4325 static int 4326 EvalStatsCmd(unused, interp, argc, argv) 4327 ClientData unused; /* Unused. */ 4328 Tcl_Interp *interp; /* The current interpreter. */ 4329 int argc; /* The number of arguments. */ 4330 char **argv; /* The argument strings. */ 4331 { 4332 register double total = 0.0; 4333 register int i; 4334 int maxSizeDecade = 0; 4335 double totalHeaderBytes = (tclNumCompilations * sizeof(ByteCode)); 4336 4337 for (i = 0; i < 256; i++) { 4338 if (instructionCount[i] != 0) { 4339 total += instructionCount[i]; 4340 } 4341 } 4342 4343 for (i = 31; i >= 0; i--) { 4344 if ((tclSourceCount[i] > 0) && (tclByteCodeCount[i] > 0)) { 4345 maxSizeDecade = i; 4346 break; 4347 } 4348 } 4349 4350 fprintf(stdout, "\nNumber of compilations %ld\n", 4351 tclNumCompilations); 4352 fprintf(stdout, "Number of executions %ld\n", 4353 numExecutions); 4354 fprintf(stdout, "Average executions/compilation %.0f\n", 4355 ((float) numExecutions/tclNumCompilations)); 4356 4357 fprintf(stdout, "\nInstructions executed %.0f\n", 4358 total); 4359 fprintf(stdout, "Average instructions/compile %.0f\n", 4360 total/tclNumCompilations); 4361 fprintf(stdout, "Average instructions/execution %.0f\n", 4362 total/numExecutions); 4363 4364 fprintf(stdout, "\nTotal source bytes %.6g\n", 4365 tclTotalSourceBytes); 4366 fprintf(stdout, "Total code bytes %.6g\n", 4367 tclTotalCodeBytes); 4368 fprintf(stdout, "Average code/compilation %.0f\n", 4369 tclTotalCodeBytes/tclNumCompilations); 4370 fprintf(stdout, "Average code/source %.2f\n", 4371 tclTotalCodeBytes/tclTotalSourceBytes); 4372 fprintf(stdout, "Current source bytes %.6g\n", 4373 tclCurrentSourceBytes); 4374 fprintf(stdout, "Current code bytes %.6g\n", 4375 tclCurrentCodeBytes); 4376 fprintf(stdout, "Current code/source %.2f\n", 4377 tclCurrentCodeBytes/tclCurrentSourceBytes); 4378 4379 fprintf(stdout, "\nTotal objects allocated %ld\n", 4380 tclObjsAlloced); 4381 fprintf(stdout, "Total objects freed %ld\n", 4382 tclObjsFreed); 4383 fprintf(stdout, "Current objects: %ld\n", 4384 (tclObjsAlloced - tclObjsFreed)); 4385 4386 fprintf(stdout, "\nBreakdown of code byte requirements:\n"); 4387 fprintf(stdout, " Total bytes Pct of Avg per\n"); 4388 fprintf(stdout, " all code compile\n"); 4389 fprintf(stdout, "Total code %12.6g 100%% %8.2f\n", 4390 tclTotalCodeBytes, tclTotalCodeBytes/tclNumCompilations); 4391 fprintf(stdout, "Header %12.6g %8.2f%% %8.2f\n", 4392 totalHeaderBytes, 4393 ((totalHeaderBytes * 100.0) / tclTotalCodeBytes), 4394 totalHeaderBytes/tclNumCompilations); 4395 fprintf(stdout, "Instructions %12.6g %8.2f%% %8.2f\n", 4396 tclTotalInstBytes, 4397 ((tclTotalInstBytes * 100.0) / tclTotalCodeBytes), 4398 tclTotalInstBytes/tclNumCompilations); 4399 fprintf(stdout, "Objects %12.6g %8.2f%% %8.2f\n", 4400 tclTotalObjBytes, 4401 ((tclTotalObjBytes * 100.0) / tclTotalCodeBytes), 4402 tclTotalObjBytes/tclNumCompilations); 4403 fprintf(stdout, "Exception table %12.6g %8.2f%% %8.2f\n", 4404 tclTotalExceptBytes, 4405 ((tclTotalExceptBytes * 100.0) / tclTotalCodeBytes), 4406 tclTotalExceptBytes/tclNumCompilations); 4407 fprintf(stdout, "Auxiliary data %12.6g %8.2f%% %8.2f\n", 4408 tclTotalAuxBytes, 4409 ((tclTotalAuxBytes * 100.0) / tclTotalCodeBytes), 4410 tclTotalAuxBytes/tclNumCompilations); 4411 fprintf(stdout, "Command map %12.6g %8.2f%% %8.2f\n", 4412 tclTotalCmdMapBytes, 4413 ((tclTotalCmdMapBytes * 100.0) / tclTotalCodeBytes), 4414 tclTotalCmdMapBytes/tclNumCompilations); 4415 4416 fprintf(stdout, "\nSource and ByteCode size distributions:\n"); 4417 fprintf(stdout, " binary decade source code\n"); 4418 for (i = 0; i <= maxSizeDecade; i++) { 4419 int decadeLow, decadeHigh; 4420 4421 if (i == 0) { 4422 decadeLow = 0; 4423 } else { 4424 decadeLow = 1 << i; 4425 } 4426 decadeHigh = (1 << (i+1)) - 1; 4427 fprintf(stdout, " %6d -%6d %6d %6d\n", 4428 decadeLow, decadeHigh, 4429 tclSourceCount[i], tclByteCodeCount[i]); 4430 } 4431 4432 fprintf(stdout, "\nInstruction counts:\n"); 4433 for (i = 0; i < 256; i++) { 4434 if (instructionCount[i]) { 4435 fprintf(stdout, "%20s %8d %6.2f%%\n", 4436 opName[i], instructionCount[i], 4437 (instructionCount[i] * 100.0)/total); 4438 } 4439 } 4440 4441 #ifdef TCL_MEM_DEBUG 4442 fprintf(stdout, "\nHeap Statistics:\n"); 4443 TclDumpMemoryInfo(stdout); 4444 #endif /* TCL_MEM_DEBUG */ 4445 4446 return TCL_OK; 4447 } 4448 #endif /* TCL_COMPILE_STATS */ 4449 4450 3633 4451 /* 3634 4452 *---------------------------------------------------------------------- … … 3940 4758 panic("UpdateStringOfCmdName should never be invoked"); 3941 4759 } 4760 4761 4762 #ifdef TCL_COMPILE_DEBUG 4763 /* 4764 *---------------------------------------------------------------------- 4765 * 4766 * StringForResultCode -- 4767 * 4768 * Procedure that returns a human-readable string representing a 4769 * Tcl result code such as TCL_ERROR. 4770 * 4771 * Results: 4772 * If the result code is one of the standard Tcl return codes, the 4773 * result is a string representing that code such as "TCL_ERROR". 4774 * Otherwise, the result string is that code formatted as a 4775 * sequence of decimal digit characters. Note that the resulting 4776 * string must not be modified by the caller. 4777 * 4778 * Side effects: 4779 * None. 4780 * 4781 *---------------------------------------------------------------------- 4782 */ 4783 4784 static char * 4785 StringForResultCode(result) 4786 int result; /* The Tcl result code for which to 4787 * generate a string. */ 4788 { 4789 static char buf[20]; 4790 4791 if ((result >= TCL_OK) && (result <= TCL_CONTINUE)) { 4792 return resultStrings[result]; 4793 } 4794 TclFormatInt(buf, result); 4795 return buf; 4796 } 4797 #endif /* TCL_COMPILE_DEBUG */ -
external/tcl/tclInt.h
r0e7d64a re39abb4 1326 1326 1327 1327 extern Tcl_Obj * tclFreeObjList; 1328 1329 #ifdef TCL_COMPILE_STATS 1330 extern long tclObjsAlloced; 1331 extern long tclObjsFreed; 1332 #endif /* TCL_COMPILE_STATS */ 1328 1333 1329 1334 /* … … 1440 1445 int objc, Tcl_Obj *CONST objv[], int flags)); 1441 1446 EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned int size)); 1442 EXTERN void TclpFree(char *cp); 1447 1443 1448 EXTERN char * TclpRealloc _ANSI_ARGS_((char *ptr, 1444 1449 unsigned int size)); … … 1467 1472 EXTERN int TclPreventAliasLoop _ANSI_ARGS_((Tcl_Interp *interp, 1468 1473 Tcl_Interp *cmdInterp, Tcl_Command cmd)); 1474 EXTERN void TclPrintByteCodeObj _ANSI_ARGS_((Tcl_Interp *interp, 1475 Tcl_Obj *objPtr)); 1469 1476 EXTERN void TclProcCleanupProc _ANSI_ARGS_((Proc *procPtr)); 1470 1477 EXTERN int TclProcCompileProc _ANSI_ARGS_((Tcl_Interp *interp, … … 1681 1688 */ 1682 1689 1690 #ifdef TCL_COMPILE_STATS 1691 # define TclIncrObjsAllocated() \ 1692 tclObjsAlloced++ 1693 # define TclIncrObjsFreed() \ 1694 tclObjsFreed++ 1695 #else 1696 # define TclIncrObjsAllocated() 1697 # define TclIncrObjsFreed() 1698 #endif /* TCL_COMPILE_STATS */ 1699 1700 #ifdef TCL_MEM_DEBUG 1701 # define TclNewObj(objPtr) \ 1702 (objPtr) = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), __FILE__, __LINE__); \ 1703 (objPtr)->refCount = 0; \ 1704 (objPtr)->bytes = tclEmptyStringRep; \ 1705 (objPtr)->length = 0; \ 1706 (objPtr)->typePtr = NULL; \ 1707 TclIncrObjsAllocated() 1708 # define TclDbNewObj(objPtr, file, line) \ 1709 (objPtr) = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line)); \ 1710 (objPtr)->refCount = 0; \ 1711 (objPtr)->bytes = tclEmptyStringRep; \ 1712 (objPtr)->length = 0; \ 1713 (objPtr)->typePtr = NULL; \ 1714 TclIncrObjsAllocated() 1715 # define TclDecrRefCount(objPtr) \ 1716 if (--(objPtr)->refCount <= 0) { \ 1717 if ((objPtr)->refCount < -1) \ 1718 panic("Reference count for %lx was negative: %s line %d", \ 1719 (objPtr), __FILE__, __LINE__); \ 1720 if (((objPtr)->bytes != NULL) \ 1721 && ((objPtr)->bytes != tclEmptyStringRep)) { \ 1722 ckfree((char *) (objPtr)->bytes); \ 1723 } \ 1724 if (((objPtr)->typePtr != NULL) \ 1725 && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \ 1726 (objPtr)->typePtr->freeIntRepProc(objPtr); \ 1727 } \ 1728 ckfree((char *) (objPtr)); \ 1729 TclIncrObjsFreed(); \ 1730 } 1731 #else /* not TCL_MEM_DEBUG */ 1683 1732 # define TclNewObj(objPtr) \ 1684 1733 if (tclFreeObjList == NULL) { \ … … 1691 1740 (objPtr)->bytes = tclEmptyStringRep; \ 1692 1741 (objPtr)->length = 0; \ 1693 (objPtr)->typePtr = NULL; 1742 (objPtr)->typePtr = NULL; \ 1743 TclIncrObjsAllocated() 1694 1744 # define TclDecrRefCount(objPtr) \ 1695 1745 if (--(objPtr)->refCount <= 0) { \ … … 1704 1754 (objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \ 1705 1755 tclFreeObjList = (objPtr); \ 1756 TclIncrObjsFreed(); \ 1706 1757 } 1758 #endif /* TCL_MEM_DEBUG */ 1707 1759 1708 1760 /* -
external/tcl/tclListObj.c
r0e7d64a re39abb4 46 46 * Tcl_NewListObj -- 47 47 * 48 * This procedure creates a new list object from an (objc,objv) array: 49 * that is, each of the objc elements of the array referenced by objv 50 * is inserted as an element into a new Tcl object. 48 * This procedure is normally called when not debugging: i.e., when 49 * TCL_MEM_DEBUG is not defined. It creates a new list object from an 50 * (objc,objv) array: that is, each of the objc elements of the array 51 * referenced by objv is inserted as an element into a new Tcl object. 52 * 53 * When TCL_MEM_DEBUG is defined, this procedure just returns the 54 * result of calling the debugging version Tcl_DbNewListObj. 51 55 * 52 56 * Results: … … 62 66 *---------------------------------------------------------------------- 63 67 */ 68 69 #ifdef TCL_MEM_DEBUG 70 #undef Tcl_NewListObj 71 72 Tcl_Obj * 73 Tcl_NewListObj(objc, objv) 74 int objc; /* Count of objects referenced by objv. */ 75 Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */ 76 { 77 return Tcl_DbNewListObj(objc, objv, "unknown", 0); 78 } 79 80 #else /* if not TCL_MEM_DEBUG */ 64 81 65 82 Tcl_Obj * … … 95 112 return listPtr; 96 113 } 114 #endif /* if TCL_MEM_DEBUG */ 115 116 117 /* 118 *---------------------------------------------------------------------- 119 * 120 * Tcl_DbNewListObj -- 121 * 122 * This procedure is normally called when debugging: i.e., when 123 * TCL_MEM_DEBUG is defined. It creates new list objects. It is the 124 * same as the Tcl_NewListObj procedure above except that it calls 125 * Tcl_DbCkalloc directly with the file name and line number from its 126 * caller. This simplifies debugging since then the checkmem command 127 * will report the correct file name and line number when reporting 128 * objects that haven't been freed. 129 * 130 * When TCL_MEM_DEBUG is not defined, this procedure just returns the 131 * result of calling Tcl_NewListObj. 132 * 133 * Results: 134 * A new list object is returned that is initialized from the object 135 * pointers in objv. If objc is less than or equal to zero, an empty 136 * object is returned. The new object's string representation 137 * is left NULL. The new list object has ref count 0. 138 * 139 * Side effects: 140 * The ref counts of the elements in objv are incremented since the 141 * resulting list now refers to them. 142 * 143 *---------------------------------------------------------------------- 144 */ 145 146 #ifdef TCL_MEM_DEBUG 147 148 Tcl_Obj * 149 Tcl_DbNewListObj(objc, objv, file, line) 150 int objc; /* Count of objects referenced by objv. */ 151 Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */ 152 char *file; /* The name of the source file calling this 153 * procedure; used for debugging. */ 154 int line; /* Line number in the source file; used 155 * for debugging. */ 156 { 157 register Tcl_Obj *listPtr; 158 register Tcl_Obj **elemPtrs; 159 register List *listRepPtr; 160 int i; 161 162 TclDbNewObj(listPtr, file, line); 163 164 if (objc > 0) { 165 Tcl_InvalidateStringRep(listPtr); 166 167 elemPtrs = (Tcl_Obj **) 168 ckalloc((unsigned) (objc * sizeof(Tcl_Obj *))); 169 for (i = 0; i < objc; i++) { 170 elemPtrs[i] = objv[i]; 171 Tcl_IncrRefCount(elemPtrs[i]); 172 } 173 174 listRepPtr = (List *) ckalloc(sizeof(List)); 175 listRepPtr->maxElemCount = objc; 176 listRepPtr->elemCount = objc; 177 listRepPtr->elements = elemPtrs; 178 179 listPtr->internalRep.otherValuePtr = (VOID *) listRepPtr; 180 listPtr->typePtr = &tclListType; 181 } 182 return listPtr; 183 } 184 185 #else /* if not TCL_MEM_DEBUG */ 186 187 Tcl_Obj * 188 Tcl_DbNewListObj(objc, objv, file, line) 189 int objc; /* Count of objects referenced by objv. */ 190 Tcl_Obj *CONST objv[]; /* An array of pointers to Tcl objects. */ 191 char *file; /* The name of the source file calling this 192 * procedure; used for debugging. */ 193 int line; /* Line number in the source file; used 194 * for debugging. */ 195 { 196 return Tcl_NewListObj(objc, objv); 197 } 198 #endif /* TCL_MEM_DEBUG */ 97 199 98 200 -
external/tcl/tclObj.c
r0e7d64a re39abb4 36 36 37 37 char *tclEmptyStringRep = NULL; 38 39 /* 40 * Count of the number of Tcl objects every allocated (by Tcl_NewObj) and 41 * freed (by TclFreeObj). 42 */ 43 44 #ifdef TCL_COMPILE_STATS 45 long tclObjsAlloced = 0; 46 long tclObjsFreed = 0; 47 #endif /* TCL_COMPILE_STATS */ 38 48 39 49 /* … … 407 417 * Tcl_NewObj -- 408 418 * 409 * This procedure creates new Tcl objects that denote the empty string. 410 * These objects have a NULL object type and NULL string representation 411 * byte pointer. Type managers call this routine to allocate new objects 412 * that they further initialize. 419 * This procedure is normally called when not debugging: i.e., when 420 * TCL_MEM_DEBUG is not defined. It creates new Tcl objects that denote 421 * the empty string. These objects have a NULL object type and NULL 422 * string representation byte pointer. Type managers call this routine 423 * to allocate new objects that they further initialize. 424 * 425 * When TCL_MEM_DEBUG is defined, this procedure just returns the 426 * result of calling the debugging version Tcl_DbNewObj. 413 427 * 414 428 * Results: … … 417 431 * is set to 0. 418 432 * 419 *---------------------------------------------------------------------- 420 */ 433 * Side effects: 434 * If compiling with TCL_COMPILE_STATS, this procedure increments 435 * the global count of allocated objects (tclObjsAlloced). 436 * 437 *---------------------------------------------------------------------- 438 */ 439 440 #ifdef TCL_MEM_DEBUG 441 #undef Tcl_NewObj 442 443 Tcl_Obj * 444 Tcl_NewObj() 445 { 446 return Tcl_DbNewObj("unknown", 0); 447 } 448 449 #else /* if not TCL_MEM_DEBUG */ 421 450 422 451 Tcl_Obj * … … 439 468 objPtr->length = 0; 440 469 objPtr->typePtr = NULL; 470 #ifdef TCL_COMPILE_STATS 471 tclObjsAlloced++; 472 #endif /* TCL_COMPILE_STATS */ 441 473 return objPtr; 442 474 } 475 #endif /* TCL_MEM_DEBUG */ 476 477 478 /* 479 *---------------------------------------------------------------------- 480 * 481 * Tcl_DbNewObj -- 482 * 483 * This procedure is normally called when debugging: i.e., when 484 * TCL_MEM_DEBUG is defined. It creates new Tcl objects that denote the 485 * empty string. It is the same as the Tcl_NewObj procedure above 486 * except that it calls Tcl_DbCkalloc directly with the file name and 487 * line number from its caller. This simplifies debugging since then 488 * the checkmem command will report the correct file name and line 489 * number when reporting objects that haven't been freed. 490 * 491 * When TCL_MEM_DEBUG is not defined, this procedure just returns the 492 * result of calling Tcl_NewObj. 493 * 494 * Results: 495 * The result is a newly allocated that represents the empty string. 496 * The new object's typePtr is set NULL and its ref count is set to 0. 497 * 498 * Side effects: 499 * If compiling with TCL_COMPILE_STATS, this procedure increments 500 * the global count of allocated objects (tclObjsAlloced). 501 * 502 *---------------------------------------------------------------------- 503 */ 504 505 #ifdef TCL_MEM_DEBUG 506 507 Tcl_Obj * 508 Tcl_DbNewObj(file, line) 509 register char *file; /* The name of the source file calling this 510 * procedure; used for debugging. */ 511 register int line; /* Line number in the source file; used 512 * for debugging. */ 513 { 514 register Tcl_Obj *objPtr; 515 516 /* 517 * If debugging Tcl's memory usage, allocate the object using ckalloc. 518 * Otherwise, allocate it using the list of free Tcl_Objs we maintain. 519 */ 520 521 objPtr = (Tcl_Obj *) Tcl_DbCkalloc(sizeof(Tcl_Obj), file, line); 522 objPtr->refCount = 0; 523 objPtr->bytes = tclEmptyStringRep; 524 objPtr->length = 0; 525 objPtr->typePtr = NULL; 526 #ifdef TCL_COMPILE_STATS 527 tclObjsAlloced++; 528 #endif /* TCL_COMPILE_STATS */ 529 return objPtr; 530 } 531 532 #else /* if not TCL_MEM_DEBUG */ 533 534 Tcl_Obj * 535 Tcl_DbNewObj(file, line) 536 char *file; /* The name of the source file calling this 537 * procedure; used for debugging. */ 538 int line; /* Line number in the source file; used 539 * for debugging. */ 540 { 541 return Tcl_NewObj(); 542 } 543 #endif /* TCL_MEM_DEBUG */ 443 544 444 545 … … 508 609 * after deallocating the string representation and calling the 509 610 * type-specific Tcl_FreeInternalRepProc to deallocate the object's 510 * internal representation. 611 * internal representation. If compiling with TCL_COMPILE_STATS, 612 * this procedure increments the global count of freed objects 613 * (tclObjsFreed). 511 614 * 512 615 *---------------------------------------------------------------------- … … 519 622 register Tcl_ObjType *typePtr = objPtr->typePtr; 520 623 624 #ifdef TCL_MEM_DEBUG 625 if ((objPtr)->refCount < -1) { 626 panic("Reference count for %lx was negative", objPtr); 627 } 628 #endif /* TCL_MEM_DEBUG */ 629 521 630 Tcl_InvalidateStringRep(objPtr); 522 631 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { … … 525 634 526 635 /* 527 * Deallocate the object by adding it onto the list of free 636 * If debugging Tcl's memory usage, deallocate the object using ckfree. 637 * Otherwise, deallocate it by adding it onto the list of free 528 638 * Tcl_Objs we maintain. 529 639 */ 530 640 641 #ifdef TCL_MEM_DEBUG 642 ckfree((char *) objPtr); 643 #else 531 644 objPtr->internalRep.otherValuePtr = (VOID *) tclFreeObjList; 532 645 tclFreeObjList = objPtr; 646 #endif /* TCL_MEM_DEBUG */ 647 648 #ifdef TCL_COMPILE_STATS 649 tclObjsFreed++; 650 #endif /* TCL_COMPILE_STATS */ 533 651 } 534 652 … … 676 794 * Tcl_NewBooleanObj -- 677 795 * 678 * This procedure creates a new boolean object and initializes it from 679 * the argument boolean value. A nonzero "boolValue" is coerced to 1. 796 * This procedure is normally called when not debugging: i.e., when 797 * TCL_MEM_DEBUG is not defined. It creates a new boolean object and 798 * initializes it from the argument boolean value. A nonzero 799 * "boolValue" is coerced to 1. 800 * 801 * When TCL_MEM_DEBUG is defined, this procedure just returns the 802 * result of calling the debugging version Tcl_DbNewBooleanObj. 680 803 * 681 804 * Results: … … 688 811 *---------------------------------------------------------------------- 689 812 */ 813 814 #ifdef TCL_MEM_DEBUG 815 #undef Tcl_NewBooleanObj 690 816 691 817 Tcl_Obj * … … 693 819 register int boolValue; /* Boolean used to initialize new object. */ 694 820 { 821 return Tcl_DbNewBooleanObj(boolValue, "unknown", 0); 822 } 823 824 #else /* if not TCL_MEM_DEBUG */ 825 826 Tcl_Obj * 827 Tcl_NewBooleanObj(boolValue) 828 register int boolValue; /* Boolean used to initialize new object. */ 829 { 695 830 register Tcl_Obj *objPtr; 696 831 … … 702 837 return objPtr; 703 838 } 839 #endif /* TCL_MEM_DEBUG */ 840 841 842 /* 843 *---------------------------------------------------------------------- 844 * 845 * Tcl_DbNewBooleanObj -- 846 * 847 * This procedure is normally called when debugging: i.e., when 848 * TCL_MEM_DEBUG is defined. It creates new boolean objects. It is the 849 * same as the Tcl_NewBooleanObj procedure above except that it calls 850 * Tcl_DbCkalloc directly with the file name and line number from its 851 * caller. This simplifies debugging since then the checkmem command 852 * will report the correct file name and line number when reporting 853 * objects that haven't been freed. 854 * 855 * When TCL_MEM_DEBUG is not defined, this procedure just returns the 856 * result of calling Tcl_NewBooleanObj. 857 * 858 * Results: 859 * The newly created object is returned. This object will have an 860 * invalid string representation. The returned object has ref count 0. 861 * 862 * Side effects: 863 * None. 864 * 865 *---------------------------------------------------------------------- 866 */ 867 868 #ifdef TCL_MEM_DEBUG 869 870 Tcl_Obj * 871 Tcl_DbNewBooleanObj(boolValue, file, line) 872 register int boolValue; /* Boolean used to initialize new object. */ 873 char *file; /* The name of the source file calling this 874 * procedure; used for debugging. */ 875 int line; /* Line number in the source file; used 876 * for debugging. */ 877 { 878 register Tcl_Obj *objPtr; 879 880 TclDbNewObj(objPtr, file, line); 881 objPtr->bytes = NULL; 882 883 objPtr->internalRep.longValue = (boolValue? 1 : 0); 884 objPtr->typePtr = &tclBooleanType; 885 return objPtr; 886 } 887 888 #else /* if not TCL_MEM_DEBUG */ 889 890 Tcl_Obj * 891 Tcl_DbNewBooleanObj(boolValue, file, line) 892 register int boolValue; /* Boolean used to initialize new object. */ 893 char *file; /* The name of the source file calling this 894 * procedure; used for debugging. */ 895 int line; /* Line number in the source file; used 896 * for debugging. */ 897 { 898 return Tcl_NewBooleanObj(boolValue); 899 } 900 #endif /* TCL_MEM_DEBUG */ 704 901 705 902 … … 981 1178 * Tcl_NewDoubleObj -- 982 1179 * 983 * This procedure creates a new double object and initializes it from 984 * the argument double value. 1180 * This procedure is normally called when not debugging: i.e., when 1181 * TCL_MEM_DEBUG is not defined. It creates a new double object and 1182 * initializes it from the argument double value. 1183 * 1184 * When TCL_MEM_DEBUG is defined, this procedure just returns the 1185 * result of calling the debugging version Tcl_DbNewDoubleObj. 985 1186 * 986 1187 * Results: … … 993 1194 *---------------------------------------------------------------------- 994 1195 */ 1196 1197 #ifdef TCL_MEM_DEBUG 1198 #undef Tcl_NewDoubleObj 995 1199 996 1200 Tcl_Obj * … … 998 1202 register double dblValue; /* Double used to initialize the object. */ 999 1203 { 1204 return Tcl_DbNewDoubleObj(dblValue, "unknown", 0); 1205 } 1206 1207 #else /* if not TCL_MEM_DEBUG */ 1208 1209 Tcl_Obj * 1210 Tcl_NewDoubleObj(dblValue) 1211 register double dblValue; /* Double used to initialize the object. */ 1212 { 1000 1213 register Tcl_Obj *objPtr; 1001 1214 … … 1007 1220 return objPtr; 1008 1221 } 1222 #endif /* if TCL_MEM_DEBUG */ 1223 1224 1225 /* 1226 *---------------------------------------------------------------------- 1227 * 1228 * Tcl_DbNewDoubleObj -- 1229 * 1230 * This procedure is normally called when debugging: i.e., when 1231 * TCL_MEM_DEBUG is defined. It creates new double objects. It is the 1232 * same as the Tcl_NewDoubleObj procedure above except that it calls 1233 * Tcl_DbCkalloc directly with the file name and line number from its 1234 * caller. This simplifies debugging since then the checkmem command 1235 * will report the correct file name and line number when reporting 1236 * objects that haven't been freed. 1237 * 1238 * When TCL_MEM_DEBUG is not defined, this procedure just returns the 1239 * result of calling Tcl_NewDoubleObj. 1240 * 1241 * Results: 1242 * The newly created object is returned. This object will have an 1243 * invalid string representation. The returned object has ref count 0. 1244 * 1245 * Side effects: 1246 * None. 1247 * 1248 *---------------------------------------------------------------------- 1249 */ 1250 1251 #ifdef TCL_MEM_DEBUG 1252 1253 Tcl_Obj * 1254 Tcl_DbNewDoubleObj(dblValue, file, line) 1255 register double dblValue; /* Double used to initialize the object. */ 1256 char *file; /* The name of the source file calling this 1257 * procedure; used for debugging. */ 1258 int line; /* Line number in the source file; used 1259 * for debugging. */ 1260 { 1261 register Tcl_Obj *objPtr; 1262 1263 TclDbNewObj(objPtr, file, line); 1264 objPtr->bytes = NULL; 1265 1266 objPtr->internalRep.doubleValue = dblValue; 1267 objPtr->typePtr = &tclDoubleType; 1268 return objPtr; 1269 } 1270 1271 #else /* if not TCL_MEM_DEBUG */ 1272 1273 Tcl_Obj * 1274 Tcl_DbNewDoubleObj(dblValue, file, line) 1275 register double dblValue; /* Double used to initialize the object. */ 1276 char *file; /* The name of the source file calling this 1277 * procedure; used for debugging. */ 1278 int line; /* Line number in the source file; used 1279 * for debugging. */ 1280 { 1281 return Tcl_NewDoubleObj(dblValue); 1282 } 1283 #endif /* TCL_MEM_DEBUG */ 1009 1284 1010 1285 … … 1256 1531 * Tcl_NewIntObj -- 1257 1532 * 1258 * Calls to Tcl_NewIntObj result in a call to one of the two 1533 * If a client is compiled with TCL_MEM_DEBUG defined, calls to 1534 * Tcl_NewIntObj to create a new integer object end up calling the 1535 * debugging procedure Tcl_DbNewLongObj instead. 1536 * 1537 * Otherwise, if the client is compiled without TCL_MEM_DEBUG defined, 1538 * calls to Tcl_NewIntObj result in a call to one of the two 1259 1539 * Tcl_NewIntObj implementations below. We provide two implementations 1260 1540 * so that the Tcl core can be compiled to do memory debugging of the … … 1276 1556 */ 1277 1557 1558 #ifdef TCL_MEM_DEBUG 1559 #undef Tcl_NewIntObj 1560 1278 1561 Tcl_Obj * 1279 1562 Tcl_NewIntObj(intValue) 1280 1563 register int intValue; /* Int used to initialize the new object. */ 1281 1564 { 1565 return Tcl_DbNewLongObj((long)intValue, "unknown", 0); 1566 } 1567 1568 #else /* if not TCL_MEM_DEBUG */ 1569 1570 Tcl_Obj * 1571 Tcl_NewIntObj(intValue) 1572 register int intValue; /* Int used to initialize the new object. */ 1573 { 1282 1574 register Tcl_Obj *objPtr; 1283 1575 … … 1289 1581 return objPtr; 1290 1582 } 1583 #endif /* if TCL_MEM_DEBUG */ 1291 1584 1292 1585 … … 1563 1856 * Tcl_NewLongObj -- 1564 1857 * 1565 * Calls to Tcl_NewLongObj result in a call to one of the two 1858 * If a client is compiled with TCL_MEM_DEBUG defined, calls to 1859 * Tcl_NewLongObj to create a new long integer object end up calling 1860 * the debugging procedure Tcl_DbNewLongObj instead. 1861 * 1862 * Otherwise, if the client is compiled without TCL_MEM_DEBUG defined, 1863 * calls to Tcl_NewLongObj result in a call to one of the two 1566 1864 * Tcl_NewLongObj implementations below. We provide two implementations 1567 1865 * so that the Tcl core can be compiled to do memory debugging of the … … 1583 1881 */ 1584 1882 1883 #ifdef TCL_MEM_DEBUG 1884 #undef Tcl_NewLongObj 1885 1585 1886 Tcl_Obj * 1586 1887 Tcl_NewLongObj(longValue) … … 1588 1889 * new object. */ 1589 1890 { 1891 return Tcl_DbNewLongObj(longValue, "unknown", 0); 1892 } 1893 1894 #else /* if not TCL_MEM_DEBUG */ 1895 1896 Tcl_Obj * 1897 Tcl_NewLongObj(longValue) 1898 register long longValue; /* Long integer used to initialize the 1899 * new object. */ 1900 { 1590 1901 register Tcl_Obj *objPtr; 1591 1902 … … 1597 1908 return objPtr; 1598 1909 } 1910 #endif /* if TCL_MEM_DEBUG */ 1599 1911 1600 1912 … … 1604 1916 * Tcl_DbNewLongObj -- 1605 1917 * 1606 * This procedure just returns the result of calling Tcl_NewLongObj. 1918 * If a client is compiled with TCL_MEM_DEBUG defined, calls to 1919 * Tcl_NewIntObj and Tcl_NewLongObj to create new integer or 1920 * long integer objects end up calling the debugging procedure 1921 * Tcl_DbNewLongObj instead. We provide two implementations of 1922 * Tcl_DbNewLongObj so that whether the Tcl core is compiled to do 1923 * memory debugging of the core is independent of whether a client 1924 * requests debugging for itself. 1925 * 1926 * When the core is compiled with TCL_MEM_DEBUG defined, 1927 * Tcl_DbNewLongObj calls Tcl_DbCkalloc directly with the file name and 1928 * line number from its caller. This simplifies debugging since then 1929 * the checkmem command will report the caller's file name and line 1930 * number when reporting objects that haven't been freed. 1931 * 1932 * Otherwise, when the core is compiled without TCL_MEM_DEBUG defined, 1933 * this procedure just returns the result of calling Tcl_NewLongObj. 1607 1934 * 1608 1935 * Results: … … 1616 1943 *---------------------------------------------------------------------- 1617 1944 */ 1945 1946 #ifdef TCL_MEM_DEBUG 1618 1947 1619 1948 Tcl_Obj * … … 1626 1955 * for debugging. */ 1627 1956 { 1957 register Tcl_Obj *objPtr; 1958 1959 TclDbNewObj(objPtr, file, line); 1960 objPtr->bytes = NULL; 1961 1962 objPtr->internalRep.longValue = longValue; 1963 objPtr->typePtr = &tclIntType; 1964 return objPtr; 1965 } 1966 1967 #else /* if not TCL_MEM_DEBUG */ 1968 1969 Tcl_Obj * 1970 Tcl_DbNewLongObj(longValue, file, line) 1971 register long longValue; /* Long integer used to initialize the 1972 * new object. */ 1973 char *file; /* The name of the source file calling this 1974 * procedure; used for debugging. */ 1975 int line; /* Line number in the source file; used 1976 * for debugging. */ 1977 { 1628 1978 return Tcl_NewLongObj(longValue); 1629 1979 } 1980 #endif /* TCL_MEM_DEBUG */ 1630 1981 1631 1982 … … 1709 2060 return result; 1710 2061 } 2062 2063 2064 /* 2065 *---------------------------------------------------------------------- 2066 * 2067 * Tcl_DbIncrRefCount -- 2068 * 2069 * This procedure is normally called when debugging: i.e., when 2070 * TCL_MEM_DEBUG is defined. This checks to see whether or not 2071 * the memory has been freed before incrementing the ref count. 2072 * 2073 * When TCL_MEM_DEBUG is not defined, this procedure just increments 2074 * the reference count of the object. 2075 * 2076 * Results: 2077 * None. 2078 * 2079 * Side effects: 2080 * The object's ref count is incremented. 2081 * 2082 *---------------------------------------------------------------------- 2083 */ 2084 2085 void 2086 Tcl_DbIncrRefCount(objPtr, file, line) 2087 register Tcl_Obj *objPtr; /* The object we are adding a reference to. */ 2088 char *file; /* The name of the source file calling this 2089 * procedure; used for debugging. */ 2090 int line; /* Line number in the source file; used 2091 * for debugging. */ 2092 { 2093 #ifdef TCL_MEM_DEBUG 2094 if (objPtr->refCount == 0x61616161) { 2095 fprintf(stderr, "file = %s, line = %d\n", file, line); 2096 fflush(stderr); 2097 panic("Trying to increment refCount of previously disposed object."); 2098 } 2099 #endif 2100 ++(objPtr)->refCount; 2101 } 2102 2103 2104 /* 2105 *---------------------------------------------------------------------- 2106 * 2107 * Tcl_DbDecrRefCount -- 2108 * 2109 * This procedure is normally called when debugging: i.e., when 2110 * TCL_MEM_DEBUG is defined. This checks to see whether or not 2111 * the memory has been freed before incrementing the ref count. 2112 * 2113 * When TCL_MEM_DEBUG is not defined, this procedure just increments 2114 * the reference count of the object. 2115 * 2116 * Results: 2117 * None. 2118 * 2119 * Side effects: 2120 * The object's ref count is incremented. 2121 * 2122 *---------------------------------------------------------------------- 2123 */ 2124 2125 void 2126 Tcl_DbDecrRefCount(objPtr, file, line) 2127 register Tcl_Obj *objPtr; /* The object we are adding a reference to. */ 2128 char *file; /* The name of the source file calling this 2129 * procedure; used for debugging. */ 2130 int line; /* Line number in the source file; used 2131 * for debugging. */ 2132 { 2133 #ifdef TCL_MEM_DEBUG 2134 if (objPtr->refCount == 0x61616161) { 2135 fprintf(stderr, "file = %s, line = %d\n", file, line); 2136 fflush(stderr); 2137 panic("Trying to decrement refCount of previously disposed object."); 2138 } 2139 #endif 2140 if (--(objPtr)->refCount <= 0) { 2141 TclFreeObj(objPtr); 2142 } 2143 } 2144 2145 2146 /* 2147 *---------------------------------------------------------------------- 2148 * 2149 * Tcl_DbIsShared -- 2150 * 2151 * This procedure is normally called when debugging: i.e., when 2152 * TCL_MEM_DEBUG is defined. This checks to see whether or not 2153 * the memory has been freed before incrementing the ref count. 2154 * 2155 * When TCL_MEM_DEBUG is not defined, this procedure just decrements 2156 * the reference count of the object and throws it away if the count 2157 * is 0 or less. 2158 * 2159 * Results: 2160 * None. 2161 * 2162 * Side effects: 2163 * The object's ref count is incremented. 2164 * 2165 *---------------------------------------------------------------------- 2166 */ 2167 2168 int 2169 Tcl_DbIsShared(objPtr, file, line) 2170 register Tcl_Obj *objPtr; /* The object we are adding a reference to. */ 2171 char *file; /* The name of the source file calling this 2172 * procedure; used for debugging. */ 2173 int line; /* Line number in the source file; used 2174 * for debugging. */ 2175 { 2176 #ifdef TCL_MEM_DEBUG 2177 if (objPtr->refCount == 0x61616161) { 2178 fprintf(stderr, "file = %s, line = %d\n", file, line); 2179 fflush(stderr); 2180 panic("Trying to check whether previously disposed object is shared."); 2181 } 2182 #endif 2183 return ((objPtr)->refCount > 1); 2184 } -
external/tcl/tclProc.c
r0e7d64a re39abb4 985 985 */ 986 986 987 if (tclTraceExec >= 1) { 988 fprintf(stdout, "Calling proc "); 989 for (i = 0; i < objc; i++) { 990 bytes = Tcl_GetStringFromObj(objv[i], &length); 991 TclPrintSource(stdout, bytes, TclMin(length, 15)); 992 fprintf(stdout, " "); 993 } 994 fprintf(stdout, "\n"); 995 fflush(stdout); 996 } 997 987 998 iPtr->returnCode = TCL_OK; 988 999 procPtr->refCount++; … … 1108 1119 int numChars; 1109 1120 char *ellipsis; 1121 1122 if (tclTraceCompile >= 1) { 1123 /* 1124 * Display a line summarizing the top level command we 1125 * are about to compile. 1126 */ 1127 1128 numChars = strlen(procName); 1129 ellipsis = ""; 1130 if (numChars > 50) { 1131 numChars = 50; 1132 ellipsis = "..."; 1133 } 1134 fprintf(stdout, "Compiling %s \"%.*s%s\"\n", 1135 description, numChars, procName, ellipsis); 1136 } 1110 1137 1111 1138 /* -
external/tcl/tclStringObj.c
r0e7d64a re39abb4 50 50 * Tcl_NewStringObj -- 51 51 * 52 * This procedure creates a new string object and initializes it from 53 * the byte pointer and length arguments. 52 * This procedure is normally called when not debugging: i.e., when 53 * TCL_MEM_DEBUG is not defined. It creates a new string object and 54 * initializes it from the byte pointer and length arguments. 55 * 56 * When TCL_MEM_DEBUG is defined, this procedure just returns the 57 * result of calling the debugging version Tcl_DbNewStringObj. 54 58 * 55 59 * Results: … … 66 70 *---------------------------------------------------------------------- 67 71 */ 72 73 #ifdef TCL_MEM_DEBUG 74 #undef Tcl_NewStringObj 68 75 69 76 Tcl_Obj * … … 76 83 * NULL byte. */ 77 84 { 85 return Tcl_DbNewStringObj(bytes, length, "unknown", 0); 86 } 87 88 #else /* if not TCL_MEM_DEBUG */ 89 90 Tcl_Obj * 91 Tcl_NewStringObj(bytes, length) 92 register char *bytes; /* Points to the first of the length bytes 93 * used to initialize the new object. */ 94 register int length; /* The number of bytes to copy from "bytes" 95 * when initializing the new object. If 96 * negative, use bytes up to the first 97 * NULL byte. */ 98 { 78 99 register Tcl_Obj *objPtr; 79 100 … … 85 106 return objPtr; 86 107 } 108 #endif /* TCL_MEM_DEBUG */ 109 110 111 /* 112 *---------------------------------------------------------------------- 113 * 114 * Tcl_DbNewStringObj -- 115 * 116 * This procedure is normally called when debugging: i.e., when 117 * TCL_MEM_DEBUG is defined. It creates new string objects. It is the 118 * same as the Tcl_NewStringObj procedure above except that it calls 119 * Tcl_DbCkalloc directly with the file name and line number from its 120 * caller. This simplifies debugging since then the checkmem command 121 * will report the correct file name and line number when reporting 122 * objects that haven't been freed. 123 * 124 * When TCL_MEM_DEBUG is not defined, this procedure just returns the 125 * result of calling Tcl_NewStringObj. 126 * 127 * Results: 128 * A newly created string object is returned that has ref count zero. 129 * 130 * Side effects: 131 * The new object's internal string representation will be set to a 132 * copy of the length bytes starting at "bytes". If "length" is 133 * negative, use bytes up to the first NULL byte; i.e., assume "bytes" 134 * points to a C-style NULL-terminated string. The object's type is set 135 * to NULL. An extra NULL is added to the end of the new object's byte 136 * array. 137 * 138 *---------------------------------------------------------------------- 139 */ 140 141 #ifdef TCL_MEM_DEBUG 142 143 Tcl_Obj * 144 Tcl_DbNewStringObj(bytes, length, file, line) 145 register char *bytes; /* Points to the first of the length bytes 146 * used to initialize the new object. */ 147 register int length; /* The number of bytes to copy from "bytes" 148 * when initializing the new object. If 149 * negative, use bytes up to the first 150 * NULL byte. */ 151 char *file; /* The name of the source file calling this 152 * procedure; used for debugging. */ 153 int line; /* Line number in the source file; used 154 * for debugging. */ 155 { 156 register Tcl_Obj *objPtr; 157 158 if (length < 0) { 159 length = (bytes? strlen(bytes) : 0); 160 } 161 TclDbNewObj(objPtr, file, line); 162 TclInitStringRep(objPtr, bytes, length); 163 return objPtr; 164 } 165 166 #else /* if not TCL_MEM_DEBUG */ 167 168 Tcl_Obj * 169 Tcl_DbNewStringObj(bytes, length, file, line) 170 register char *bytes; /* Points to the first of the length bytes 171 * used to initialize the new object. */ 172 register int length; /* The number of bytes to copy from "bytes" 173 * when initializing the new object. If 174 * negative, use bytes up to the first 175 * NULL byte. */ 176 char *file; /* The name of the source file calling this 177 * procedure; used for debugging. */ 178 int line; /* Line number in the source file; used 179 * for debugging. */ 180 { 181 return Tcl_NewStringObj(bytes, length); 182 } 183 #endif /* TCL_MEM_DEBUG */ 87 184 88 185 -
external/tcl/tclVar.c
r0e7d64a re39abb4 711 711 char *msg; 712 712 713 #ifdef TCL_COMPILE_DEBUG 714 Proc *procPtr = varFramePtr->procPtr; 715 int localCt = procPtr->numCompiledLocals; 716 717 if (compiledLocals == NULL) { 718 fprintf(stderr, "\nTclGetIndexedScalar: can't get local %i in frame 0x%x, no compiled locals\n", 719 localIndex, (unsigned int) varFramePtr); 720 panic("TclGetIndexedScalar: no compiled locals in frame 0x%x", 721 (unsigned int) varFramePtr); 722 } 723 if ((localIndex < 0) || (localIndex >= localCt)) { 724 fprintf(stderr, "\nTclGetIndexedScalar: can't get local %i in frame 0x%x with %i locals\n", 725 localIndex, (unsigned int) varFramePtr, localCt); 726 panic("TclGetIndexedScalar: bad local index %i in frame 0x%x", 727 localIndex, (unsigned int) varFramePtr); 728 } 729 #endif /* TCL_COMPILE_DEBUG */ 730 713 731 varPtr = &(compiledLocals[localIndex]); 714 732 varName = varPtr->name; … … 814 832 int new; 815 833 834 #ifdef TCL_COMPILE_DEBUG 835 Proc *procPtr = varFramePtr->procPtr; 836 int localCt = procPtr->numCompiledLocals; 837 838 if (compiledLocals == NULL) { 839 fprintf(stderr, "\nTclGetElementOfIndexedArray: can't get element of local %i in frame 0x%x, no compiled locals\n", 840 localIndex, (unsigned int) varFramePtr); 841 panic("TclGetIndexedScalar: no compiled locals in frame 0x%x", 842 (unsigned int) varFramePtr); 843 } 844 if ((localIndex < 0) || (localIndex >= localCt)) { 845 fprintf(stderr, "\nTclGetIndexedScalar: can't get element of local %i in frame 0x%x with %i locals\n", 846 localIndex, (unsigned int) varFramePtr, localCt); 847 panic("TclGetElementOfIndexedArray: bad local index %i in frame 0x%x", 848 localIndex, (unsigned int) varFramePtr); 849 } 850 #endif /* TCL_COMPILE_DEBUG */ 851 816 852 /* 817 853 * THIS FAILS IF THE ELEMENT NAME OBJECT'S STRING REP HAS A NULL BYTE. … … 1413 1449 Tcl_Obj *resultPtr = NULL; 1414 1450 1451 #ifdef TCL_COMPILE_DEBUG 1452 Proc *procPtr = varFramePtr->procPtr; 1453 int localCt = procPtr->numCompiledLocals; 1454 1455 if (compiledLocals == NULL) { 1456 fprintf(stderr, "\nTclSetIndexedScalar: can't set local %i in frame 0x%x, no compiled locals\n", 1457 localIndex, (unsigned int) varFramePtr); 1458 panic("TclSetIndexedScalar: no compiled locals in frame 0x%x", 1459 (unsigned int) varFramePtr); 1460 } 1461 if ((localIndex < 0) || (localIndex >= localCt)) { 1462 fprintf(stderr, "\nTclSetIndexedScalar: can't set local %i in frame 0x%x with %i locals\n", 1463 localIndex, (unsigned int) varFramePtr, localCt); 1464 panic("TclSetIndexedScalar: bad local index %i in frame 0x%x", 1465 localIndex, (unsigned int) varFramePtr); 1466 } 1467 #endif /* TCL_COMPILE_DEBUG */ 1468 1415 1469 varPtr = &(compiledLocals[localIndex]); 1416 1470 varName = varPtr->name; … … 1581 1635 int new; 1582 1636 1637 #ifdef TCL_COMPILE_DEBUG 1638 Proc *procPtr = varFramePtr->procPtr; 1639 int localCt = procPtr->numCompiledLocals; 1640 1641 if (compiledLocals == NULL) { 1642 fprintf(stderr, "\nTclSetElementOfIndexedArray: can't set element of local %i in frame 0x%x, no compiled locals\n", 1643 localIndex, (unsigned int) varFramePtr); 1644 panic("TclSetIndexedScalar: no compiled locals in frame 0x%x", 1645 (unsigned int) varFramePtr); 1646 } 1647 if ((localIndex < 0) || (localIndex >= localCt)) { 1648 fprintf(stderr, "\nTclSetIndexedScalar: can't set elememt of local %i in frame 0x%x with %i locals\n", 1649 localIndex, (unsigned int) varFramePtr, localCt); 1650 panic("TclSetElementOfIndexedArray: bad local index %i in frame 0x%x", 1651 localIndex, (unsigned int) varFramePtr); 1652 } 1653 #endif /* TCL_COMPILE_DEBUG */ 1654 1583 1655 /* 1584 1656 * THIS FAILS IF THE ELEMENT NAME OBJECT'S STRING REP HAS A NULL BYTE. -
modules/AngularSmearing.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class AngularSmearing 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 76 77 fFormulaPhi->Compile(GetString("PhiResolutionFormula", "0.0")); 77 78 79 78 80 // import input array 79 81 … … 101 103 102 104 fItInputArray->Reset(); 103 while((candidate = static_cast<Candidate 105 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 104 106 { 105 107 const TLorentzVector &candidatePosition = candidate->Position; … … 114 116 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e)); 115 117 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e)); 116 118 117 119 if(pt <= 0.0) continue; 118 120 119 121 mother = candidate; 120 candidate = static_cast<Candidate 122 candidate = static_cast<Candidate*>(candidate->Clone()); 121 123 eta = candidateMomentum.Eta(); 122 124 phi = candidateMomentum.Phi(); 123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));125 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta)); 124 126 candidate->AddCandidate(mother); 125 127 126 128 fOutputArray->Add(candidate); 127 129 } -
modules/AngularSmearing.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 AngularSmearing(); 40 41 ~AngularSmearing(); … … 45 46 46 47 private: 48 47 49 DelphesFormula *fFormulaEta; //! 48 50 DelphesFormula *fFormulaPhi; //! … … 51 53 52 54 const TObjArray *fInputArray; //! 53 55 54 56 TObjArray *fOutputArray; //! 55 57 -
modules/BTagging.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class BTagging 20 21 * … … 33 34 #include "classes/DelphesFormula.h" 34 35 36 #include "TMath.h" 37 #include "TString.h" 38 #include "TFormula.h" 39 #include "TRandom3.h" 40 #include "TObjArray.h" 35 41 #include "TDatabasePDG.h" 36 #include "TFormula.h"37 42 #include "TLorentzVector.h" 38 #include "TMath.h"39 #include "TObjArray.h"40 #include "TRandom3.h"41 #include "TString.h"42 43 43 44 #include <algorithm> 45 #include <stdexcept> 44 46 #include <iostream> 45 47 #include <sstream> 46 #include <stdexcept>47 48 48 49 using namespace std; … … 65 66 void BTagging::Init() 66 67 { 67 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;68 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 68 69 ExRootConfParam param; 69 70 DelphesFormula *formula; … … 77 78 78 79 fEfficiencyMap.clear(); 79 for(i = 0; i < size /2; ++i)80 for(i = 0; i < size/2; ++i) 80 81 { 81 82 formula = new DelphesFormula; 82 formula->Compile(param[i *2 + 1].GetString());83 formula->Compile(param[i*2 + 1].GetString()); 83 84 84 fEfficiencyMap[param[i *2].GetInt()] = formula;85 fEfficiencyMap[param[i*2].GetInt()] = formula; 85 86 } 86 87 … … 105 106 void BTagging::Finish() 106 107 { 107 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;108 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 108 109 DelphesFormula *formula; 109 110 … … 123 124 Candidate *jet; 124 125 Double_t pt, eta, phi, e; 125 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;126 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 126 127 DelphesFormula *formula; 127 128 128 129 // loop over all input jets 129 130 fItJetInputArray->Reset(); 130 while((jet = static_cast<Candidate 131 while((jet = static_cast<Candidate*>(fItJetInputArray->Next()))) 131 132 { 132 133 const TLorentzVector &jetMomentum = jet->Momentum; -
modules/BTagging.h
r0e7d64a re39abb4 40 40 { 41 41 public: 42 42 43 BTagging(); 43 44 ~BTagging(); … … 48 49 49 50 private: 51 50 52 Int_t fBitNumber; 51 53 52 54 #if !defined(__CINT__) && !defined(__CLING__) 53 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!55 std::map< Int_t, DelphesFormula * > fEfficiencyMap; //! 54 56 #endif 55 57 56 58 TIterator *fItJetInputArray; //! 57 59 58 60 const TObjArray *fJetInputArray; //! 59 61 -
modules/BeamSpotFilter.cc
r0e7d64a re39abb4 7 7 */ 8 8 9 9 10 #include "modules/BeamSpotFilter.h" 10 11 … … 13 14 #include "classes/DelphesFormula.h" 14 15 16 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 15 18 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h"17 #include "ExRootAnalysis/ExRootResult.h"18 19 20 #include "TMath.h" 21 #include "TString.h" 22 #include "TFormula.h" 23 #include "TRandom3.h" 24 #include "TObjArray.h" 19 25 #include "TDatabasePDG.h" 20 #include "TFormula.h"21 26 #include "TLorentzVector.h" 22 #include "TMath.h"23 #include "TObjArray.h"24 #include "TRandom3.h"25 #include "TString.h"26 27 27 28 #include <algorithm> 29 #include <stdexcept> 28 30 #include <iostream> 29 31 #include <sstream> 30 #include <stdexcept>31 32 32 33 using namespace std; … … 49 50 void BeamSpotFilter::Init() 50 51 { 51 52 52 53 // import input array 53 54 fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles")); … … 72 73 Candidate *candidate; 73 74 Bool_t passed = false; 74 75 75 76 fItInputArray->Reset(); 76 while((candidate = static_cast<Candidate 77 while((candidate = static_cast<Candidate*>(fItInputArray->Next())) && !passed) 77 78 { 78 79 if(candidate->IsPU == 0) passed = true; 79 80 fOutputArray->Add(candidate); 80 81 } 82 81 83 } 84 85 -
modules/BeamSpotFilter.h
r0e7d64a re39abb4 20 20 { 21 21 public: 22 22 23 BeamSpotFilter(); 23 24 ~BeamSpotFilter(); … … 28 29 29 30 private: 31 30 32 Float_t fPassedOne; 31 33 -
modules/CMakeLists.txt
r0e7d64a re39abb4 28 28 if (NOT ${ROOT_VERSION} VERSION_LESS "6.0.0") 29 29 install(FILES 30 ${PROJECT_BINARY_DIR}/modules/libModulesDict_rdict.pcm 31 ${PROJECT_BINARY_DIR}/modules/libFastJetDict_rdict.pcm 32 DESTINATION lib) 33 if(PYTHIA8_FOUND) 34 install(FILES 35 ${PROJECT_BINARY_DIR}/modules/libPythia8Dict_rdict.pcm 30 ${PROJECT_BINARY_DIR}/modules/libModulesDict_rdict.pcm 31 ${PROJECT_BINARY_DIR}/modules/libFastJetDict_rdict.pcm 36 32 DESTINATION lib) 37 endif()38 33 endif() -
modules/Calorimeter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Calorimeter 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 38 39 #include "TMath.h" 40 #include "TString.h" 41 #include "TFormula.h" 42 #include "TRandom3.h" 43 #include "TObjArray.h" 38 44 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 45 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 46 46 47 #include <algorithm> 48 #include <stdexcept> 47 49 #include <iostream> 48 50 #include <sstream> 49 #include <stdexcept>50 51 51 52 using namespace std; … … 57 58 fItParticleInputArray(0), fItTrackInputArray(0) 58 59 { 59 60 60 61 fECalResolutionFormula = new DelphesFormula; 61 62 fHCalResolutionFormula = new DelphesFormula; … … 66 67 fHCalTowerTrackArray = new TObjArray; 67 68 fItHCalTowerTrackArray = fHCalTowerTrackArray->MakeIterator(); 69 68 70 } 69 71 … … 72 74 Calorimeter::~Calorimeter() 73 75 { 74 76 75 77 if(fECalResolutionFormula) delete fECalResolutionFormula; 76 78 if(fHCalResolutionFormula) delete fHCalResolutionFormula; … … 81 83 if(fHCalTowerTrackArray) delete fHCalTowerTrackArray; 82 84 if(fItHCalTowerTrackArray) delete fItHCalTowerTrackArray; 85 83 86 } 84 87 … … 91 94 Double_t ecalFraction, hcalFraction; 92 95 TBinMap::iterator itEtaBin; 93 set< Double_t>::iterator itPhiBin;94 vector< Double_t> *phiBins;96 set< Double_t >::iterator itPhiBin; 97 vector< Double_t > *phiBins; 95 98 96 99 // read eta and phi bins … … 100 103 fEtaBins.clear(); 101 104 fPhiBins.clear(); 102 for(i = 0; i < size /2; ++i)103 { 104 paramEtaBins = param[i *2];105 for(i = 0; i < size/2; ++i) 106 { 107 paramEtaBins = param[i*2]; 105 108 sizeEtaBins = paramEtaBins.GetSize(); 106 paramPhiBins = param[i *2 + 1];109 paramPhiBins = param[i*2 + 1]; 107 110 sizePhiBins = paramPhiBins.GetSize(); 108 111 … … 121 124 { 122 125 fEtaBins.push_back(itEtaBin->first); 123 phiBins = new vector< double>(itEtaBin->second.size());126 phiBins = new vector< double >(itEtaBin->second.size()); 124 127 fPhiBins.push_back(phiBins); 125 128 phiBins->clear(); … … 138 141 fFractionMap[0] = make_pair(0.0, 1.0); 139 142 140 for(i = 0; i < size /2; ++i)141 { 142 paramFractions = param[i *2 + 1];143 for(i = 0; i < size/2; ++i) 144 { 145 paramFractions = param[i*2 + 1]; 143 146 144 147 ecalFraction = paramFractions[0].GetDouble(); 145 148 hcalFraction = paramFractions[1].GetDouble(); 146 149 147 fFractionMap[param[i *2].GetInt()] = make_pair(ecalFraction, hcalFraction);150 fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction); 148 151 } 149 152 150 153 // read min E value for timing measurement in ECAL 151 fTimingEnergyMin = GetDouble("TimingEnergyMin", 154 fTimingEnergyMin = GetDouble("TimingEnergyMin",4.); 152 155 // For timing 153 156 // So far this flag needs to be false … … 189 192 void Calorimeter::Finish() 190 193 { 191 vector< vector<Double_t> *>::iterator itPhiBin;194 vector< vector< Double_t >* >::iterator itPhiBin; 192 195 if(fItParticleInputArray) delete fItParticleInputArray; 193 196 if(fItTrackInputArray) delete fItTrackInputArray; … … 215 218 TFractionMap::iterator itFractionMap; 216 219 217 vector< Double_t>::iterator itEtaBin;218 vector< Double_t>::iterator itPhiBin;219 vector< Double_t> *phiBins;220 221 vector< Long64_t>::iterator itTowerHits;220 vector< Double_t >::iterator itEtaBin; 221 vector< Double_t >::iterator itPhiBin; 222 vector< Double_t > *phiBins; 223 224 vector< Long64_t >::iterator itTowerHits; 222 225 223 226 DelphesFactory *factory = GetFactory(); … … 231 234 fItParticleInputArray->Reset(); 232 235 number = -1; 233 while((particle = static_cast<Candidate 236 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next()))) 234 237 { 235 238 const TLorentzVector &particlePosition = particle->Position; … … 277 280 fItTrackInputArray->Reset(); 278 281 number = -1; 279 while((track = static_cast<Candidate 282 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 280 283 { 281 284 const TLorentzVector &trackPosition = track->Position; … … 328 331 towerHit = (*itTowerHits); 329 332 flags = (towerHit >> 24) & 0x00000000000000FFLL; 330 number = (towerHit) &0x0000000000FFFFFFLL;333 number = (towerHit) & 0x0000000000FFFFFFLL; 331 334 hitEtaPhi = towerHit >> 32; 332 335 … … 349 352 350 353 // calculate eta and phi of the tower's center 351 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);352 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);354 fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 355 fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 353 356 354 357 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 362 365 fECalTrackEnergy = 0.0; 363 366 fHCalTrackEnergy = 0.0; 364 367 365 368 fECalTrackSigma = 0.0; 366 369 fHCalTrackSigma = 0.0; 367 370 368 371 fTowerTrackHits = 0; 369 372 fTowerPhotonHits = 0; … … 371 374 fECalTowerTrackArray->Clear(); 372 375 fHCalTowerTrackArray->Clear(); 376 373 377 } 374 378 … … 378 382 ++fTowerTrackHits; 379 383 380 track = static_cast<Candidate 384 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 381 385 momentum = track->Momentum; 382 386 position = track->Position; … … 396 400 { 397 401 fECalTrackEnergy += ecalEnergy; 398 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 399 if(ecalSigma / momentum.E() < track->TrackResolution) 400 energyGuess = ecalEnergy; 401 else 402 energyGuess = momentum.E(); 403 404 fECalTrackSigma += (track->TrackResolution) * energyGuess * (track->TrackResolution) * energyGuess; 402 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 403 if(ecalSigma/momentum.E() < track->TrackResolution) energyGuess = ecalEnergy; 404 else energyGuess = momentum.E(); 405 406 fECalTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess; 405 407 fECalTowerTrackArray->Add(track); 406 408 } 407 409 408 410 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] > 1.0E-9) 409 411 { 410 412 fHCalTrackEnergy += hcalEnergy; 411 413 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 412 if(hcalSigma / momentum.E() < track->TrackResolution) 413 energyGuess = hcalEnergy; 414 else 415 energyGuess = momentum.E(); 416 417 fHCalTrackSigma += (track->TrackResolution) * energyGuess * (track->TrackResolution) * energyGuess; 414 if(hcalSigma/momentum.E() < track->TrackResolution) energyGuess = hcalEnergy; 415 else energyGuess = momentum.E(); 416 417 fHCalTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess; 418 418 fHCalTowerTrackArray->Add(track); 419 419 } 420 420 421 421 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9) 422 422 { … … 430 430 if(flags & 2) ++fTowerPhotonHits; 431 431 432 particle = static_cast<Candidate 432 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 433 433 momentum = particle->Momentum; 434 434 position = particle->Position; … … 443 443 if(ecalEnergy > fTimingEnergyMin && fTower) 444 444 { 445 if (abs(particle->PID) != 11 || !fElectronsFromTrack)445 if (abs(particle->PID) != 11 || !fElectronsFromTrack) 446 446 { 447 447 fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T())); … … 464 464 Double_t ecalEnergy, hcalEnergy; 465 465 Double_t ecalNeutralEnergy, hcalNeutralEnergy; 466 466 467 467 Double_t ecalSigma, hcalSigma; 468 468 Double_t ecalNeutralSigma, hcalNeutralSigma; 469 469 470 470 Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor; 471 471 472 472 TLorentzVector momentum; 473 473 TFractionMap::iterator itFractionMap; … … 486 486 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy); 487 487 488 if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin *ecalSigma) ecalEnergy = 0.0;489 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin *hcalSigma) hcalEnergy = 0.0;488 if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0; 489 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0; 490 490 491 491 energy = ecalEnergy + hcalEnergy; … … 519 519 if(sumWeight > 0.0) 520 520 { 521 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime /sumWeight);521 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight); 522 522 } 523 523 else … … 525 525 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9); 526 526 } 527 527 528 528 529 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); … … 544 545 fTowerOutputArray->Add(fTower); 545 546 } 546 547 547 548 // fill energy flow candidates 548 549 fECalTrackSigma = TMath::Sqrt(fECalTrackSigma); … … 550 551 551 552 //compute neutral excesses 552 ecalNeutralEnergy = max( (ecalEnergy - fECalTrackEnergy), 0.0);553 hcalNeutralEnergy = max( (hcalEnergy - fHCalTrackEnergy), 0.0);554 555 ecalNeutralSigma = ecalNeutralEnergy / TMath::Sqrt(fECalTrackSigma * fECalTrackSigma + ecalSigma *ecalSigma);556 hcalNeutralSigma = hcalNeutralEnergy / TMath::Sqrt(fHCalTrackSigma * fHCalTrackSigma + hcalSigma *hcalSigma);557 558 // if ecal neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack553 ecalNeutralEnergy = max( (ecalEnergy - fECalTrackEnergy) , 0.0); 554 hcalNeutralEnergy = max( (hcalEnergy - fHCalTrackEnergy) , 0.0); 555 556 ecalNeutralSigma = ecalNeutralEnergy / TMath::Sqrt(fECalTrackSigma*fECalTrackSigma + ecalSigma*ecalSigma); 557 hcalNeutralSigma = hcalNeutralEnergy / TMath::Sqrt(fHCalTrackSigma*fHCalTrackSigma + hcalSigma*hcalSigma); 558 559 // if ecal neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack 559 560 if(ecalNeutralEnergy > fECalEnergyMin && ecalNeutralSigma > fECalEnergySignificanceMin) 560 561 { 561 562 // create new photon tower 562 tower = static_cast<Candidate 563 pt = ecalNeutralEnergy / TMath::CosH(eta);564 563 tower = static_cast<Candidate*>(fTower->Clone()); 564 pt = ecalNeutralEnergy / TMath::CosH(eta); 565 565 566 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalNeutralEnergy); 566 567 tower->Eem = ecalNeutralEnergy; 567 568 tower->Ehad = 0.0; 568 569 tower->PID = 22; 569 570 570 571 fEFlowPhotonOutputArray->Add(tower); 571 572 572 573 //clone tracks 573 574 fItECalTowerTrackArray->Reset(); 574 while((track = static_cast<Candidate 575 while((track = static_cast<Candidate*>(fItECalTowerTrackArray->Next()))) 575 576 { 576 577 mother = track; 577 track = static_cast<Candidate 578 track = static_cast<Candidate*>(track->Clone()); 578 579 track->AddCandidate(mother); 579 580 580 581 fEFlowTrackOutputArray->Add(track); 581 582 } 582 } 583 583 584 } 585 584 586 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 585 587 else if(fECalTrackEnergy > 0.0) 586 588 { 587 weightTrack = (fECalTrackSigma > 0.0) ? 1 / (fECalTrackSigma *fECalTrackSigma) : 0.0;588 weightCalo = (ecalSigma > 0.0) ? 1 / (ecalSigma *ecalSigma) : 0.0;589 590 bestEnergyEstimate = (weightTrack * fECalTrackEnergy + weightCalo * ecalEnergy) / (weightTrack + weightCalo);591 rescaleFactor = bestEnergyEstimate /fECalTrackEnergy;589 weightTrack = (fECalTrackSigma > 0.0) ? 1 / (fECalTrackSigma*fECalTrackSigma) : 0.0; 590 weightCalo = (ecalSigma > 0.0) ? 1 / (ecalSigma*ecalSigma) : 0.0; 591 592 bestEnergyEstimate = (weightTrack*fECalTrackEnergy + weightCalo*ecalEnergy) / (weightTrack + weightCalo); 593 rescaleFactor = bestEnergyEstimate/fECalTrackEnergy; 592 594 593 595 //rescale tracks 594 596 fItECalTowerTrackArray->Reset(); 595 while((track = static_cast<Candidate 596 { 597 while((track = static_cast<Candidate*>(fItECalTowerTrackArray->Next()))) 598 { 597 599 mother = track; 598 track = static_cast<Candidate 600 track = static_cast<Candidate*>(track->Clone()); 599 601 track->AddCandidate(mother); 600 602 … … 604 606 } 605 607 } 608 606 609 607 610 // if hcal neutral excess is significant, simply create neutral EflowNeutralHadron tower and clone each track into eflowtrack … … 609 612 { 610 613 // create new photon tower 611 tower = static_cast<Candidate 612 pt = hcalNeutralEnergy / TMath::CosH(eta);613 614 tower = static_cast<Candidate*>(fTower->Clone()); 615 pt = hcalNeutralEnergy / TMath::CosH(eta); 616 614 617 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalNeutralEnergy); 615 618 tower->Ehad = hcalNeutralEnergy; 616 619 tower->Eem = 0.0; 617 620 618 621 fEFlowNeutralHadronOutputArray->Add(tower); 619 622 620 623 //clone tracks 621 624 fItHCalTowerTrackArray->Reset(); 622 while((track = static_cast<Candidate 625 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray->Next()))) 623 626 { 624 627 mother = track; 625 track = static_cast<Candidate 628 track = static_cast<Candidate*>(track->Clone()); 626 629 track->AddCandidate(mother); 627 630 628 631 fEFlowTrackOutputArray->Add(track); 629 632 } 630 } 631 633 634 } 635 632 636 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 633 637 else if(fHCalTrackEnergy > 0.0) 634 638 { 635 weightTrack = (fHCalTrackSigma > 0.0) ? 1 / (fHCalTrackSigma *fHCalTrackSigma) : 0.0;636 weightCalo = (hcalSigma > 0.0) ? 1 / (hcalSigma *hcalSigma) : 0.0;637 638 bestEnergyEstimate = (weightTrack * fHCalTrackEnergy + weightCalo * hcalEnergy) / (weightTrack + weightCalo);639 weightTrack = (fHCalTrackSigma > 0.0) ? 1 / (fHCalTrackSigma*fHCalTrackSigma) : 0.0; 640 weightCalo = (hcalSigma > 0.0) ? 1 / (hcalSigma*hcalSigma) : 0.0; 641 642 bestEnergyEstimate = (weightTrack*fHCalTrackEnergy + weightCalo*hcalEnergy) / (weightTrack + weightCalo); 639 643 rescaleFactor = bestEnergyEstimate / fHCalTrackEnergy; 640 644 641 645 //rescale tracks 642 646 fItHCalTowerTrackArray->Reset(); 643 while((track = static_cast<Candidate 644 { 647 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray->Next()))) 648 { 645 649 mother = track; 646 track = static_cast<Candidate 650 track = static_cast<Candidate*>(track->Clone()); 647 651 track->AddCandidate(mother); 648 652 … … 652 656 } 653 657 } 658 659 654 660 } 655 661 … … 662 668 if(mean > 0.0) 663 669 { 664 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean *mean))));665 a = TMath::Log(mean) - 0.5 * b *b;666 667 return TMath::Exp(a + b *gRandom->Gaus(0.0, 1.0));670 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 671 a = TMath::Log(mean) - 0.5*b*b; 672 673 return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0)); 668 674 } 669 675 else -
modules/Calorimeter.h
r0e7d64a re39abb4 42 42 { 43 43 public: 44 44 45 Calorimeter(); 45 46 ~Calorimeter(); … … 50 51 51 52 private: 52 typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //! 53 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 53 54 typedef std::map< Long64_t, std::pair< Double_t, Double_t > > TFractionMap; //! 55 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 54 56 55 57 Candidate *fTower; … … 77 79 TBinMap fBinMap; //! 78 80 79 std::vector <Double_t> fEtaBins;80 std::vector <std::vector<Double_t> *> fPhiBins;81 std::vector < Double_t > fEtaBins; 82 std::vector < std::vector < Double_t >* > fPhiBins; 81 83 82 std::vector <Long64_t> fTowerHits;84 std::vector < Long64_t > fTowerHits; 83 85 84 std::vector <Double_t> fECalTowerFractions;85 std::vector <Double_t> fHCalTowerFractions;86 std::vector < Double_t > fECalTowerFractions; 87 std::vector < Double_t > fHCalTowerFractions; 86 88 87 std::vector <Double_t> fECalTrackFractions;88 std::vector <Double_t> fHCalTrackFractions;89 std::vector < Double_t > fECalTrackFractions; 90 std::vector < Double_t > fHCalTrackFractions; 89 91 90 92 DelphesFormula *fECalResolutionFormula; //! -
modules/Cloner.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Clone 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 37 38 #include <algorithm> 39 #include <stdexcept> 38 40 #include <iostream> 39 41 #include <sstream> 40 #include <stdexcept>41 42 42 43 using namespace std; … … 47 48 fItInputArray(0) 48 49 { 50 49 51 } 50 52 … … 53 55 Cloner::~Cloner() 54 56 { 57 55 58 } 56 59 … … 67 70 68 71 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 72 69 73 } 70 74 … … 81 85 { 82 86 Candidate *candidate; 83 84 87 88 // loop over all input candidates 85 89 fItInputArray->Reset(); 86 while((candidate = static_cast<Candidate 90 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 87 91 { 88 candidate = static_cast<Candidate 92 candidate = static_cast<Candidate*>(candidate->Clone()); 89 93 fOutputArray->Add(candidate); 90 94 } -
modules/Cloner.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 Cloner(); 40 41 ~Cloner(); … … 45 46 46 47 private: 48 47 49 TIterator *fItInputArray; //! 48 50 -
modules/ConstituentFilter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class ConstituentFilter 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 87 88 param = GetParam("ConstituentInputArray"); 88 89 size = param.GetSize(); 89 for(i = 0; i < size /2; ++i)90 for(i = 0; i < size/2; ++i) 90 91 { 91 array = ImportArray(param[i *2].GetString());92 array = ImportArray(param[i*2].GetString()); 92 93 iterator = array->MakeIterator(); 93 94 94 fInputMap[iterator] = ExportArray(param[i *2 + 1].GetString());95 fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString()); 95 96 } 96 97 } … … 100 101 void ConstituentFilter::Finish() 101 102 { 102 map< TIterator *, TObjArray *>::iterator itInputMap;103 vector< TIterator *>::iterator itInputList;103 map< TIterator *, TObjArray * >::iterator itInputMap; 104 vector< TIterator * >::iterator itInputList; 104 105 TIterator *iterator; 105 106 … … 122 123 { 123 124 Candidate *jet, *constituent; 124 map< TIterator *, TObjArray *>::iterator itInputMap;125 vector< TIterator *>::iterator itInputList;125 map< TIterator *, TObjArray * >::iterator itInputMap; 126 vector< TIterator * >::iterator itInputList; 126 127 TIterator *iterator; 127 128 TObjArray *array; … … 134 135 // loop over all jets 135 136 iterator->Reset(); 136 while((jet = static_cast<Candidate 137 while((jet = static_cast<Candidate*>(iterator->Next()))) 137 138 { 138 139 TIter itConstituents(jet->GetCandidates()); … … 141 142 142 143 // loop over all constituents 143 while((constituent = static_cast<Candidate 144 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) 144 145 { 145 146 // set the IsConstituent flag … … 157 158 // loop over all constituents 158 159 iterator->Reset(); 159 while((constituent = static_cast<Candidate 160 while((constituent = static_cast<Candidate*>(iterator->Next()))) 160 161 { 161 162 // check the IsConstituent flag -
modules/ConstituentFilter.h
r0e7d64a re39abb4 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <vector> 32 33 #include <map> 33 #include <vector>34 34 35 35 class TIterator; … … 39 39 { 40 40 public: 41 41 42 ConstituentFilter(); 42 43 ~ConstituentFilter(); … … 47 48 48 49 private: 50 49 51 Double_t fJetPTMin; 50 52 51 std::vector< TIterator *> fInputList; //!53 std::vector< TIterator * > fInputList; //! 52 54 53 std::map< TIterator *, TObjArray *> fInputMap; //!55 std::map< TIterator *, TObjArray * > fInputMap; //! 54 56 55 57 TObjArray *fOutputArray; //! -
modules/Delphes.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Delphes 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 38 #include "ExRootAnalysis/ExRootConfReader.h" 36 #include "ExRootAnalysis/ExRootFilter.h"37 #include "ExRootAnalysis/ExRootResult.h"38 39 #include "ExRootAnalysis/ExRootTreeWriter.h" 39 40 41 #include "TROOT.h" 42 #include "TMath.h" 43 #include "TFolder.h" 44 #include "TString.h" 45 #include "TFormula.h" 46 #include "TRandom3.h" 47 #include "TObjArray.h" 40 48 #include "TDatabasePDG.h" 41 #include "TFolder.h"42 #include "TFormula.h"43 49 #include "TLorentzVector.h" 44 #include "TMath.h"45 #include "TObjArray.h"46 #include "TROOT.h"47 #include "TRandom3.h"48 #include "TString.h"49 50 50 #include <algorithm> 51 #include <algorithm> 52 #include <stdexcept> 51 53 #include <iostream> 52 54 #include <sstream> 53 #include <stdexcept>54 55 56 #include <string.h> 55 57 #include <stdio.h> 56 #include <string.h>57 58 58 59 using namespace std; -
modules/Delphes.h
r0e7d64a re39abb4 41 41 { 42 42 public: 43 43 44 Delphes(const char *name = "Delphes"); 44 45 ~Delphes(); 45 46 46 47 void SetTreeWriter(ExRootTreeWriter *treeWriter); 47 48 48 49 DelphesFactory *GetFactory() const { return fFactory; } 49 50 … … 55 56 56 57 private: 58 57 59 DelphesFactory *fFactory; 58 60 … … 61 63 62 64 #endif /* Delphes_h */ 65 -
modules/DenseTrackFilter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class DenseTrackFilter 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 35 #include "ExRootAnalysis/ExRootResult.h" 36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 70 71 Long_t i, j, k, size, sizeEtaBins, sizePhiBins; 71 72 TBinMap::iterator itEtaBin; 72 set< Double_t>::iterator itPhiBin;73 vector< Double_t> *phiBins;73 set< Double_t >::iterator itPhiBin; 74 vector< Double_t > *phiBins; 74 75 75 76 // read eta and phi bins … … 79 80 fEtaBins.clear(); 80 81 fPhiBins.clear(); 81 for(i = 0; i < size /2; ++i)82 { 83 paramEtaBins = param[i *2];82 for(i = 0; i < size/2; ++i) 83 { 84 paramEtaBins = param[i*2]; 84 85 sizeEtaBins = paramEtaBins.GetSize(); 85 paramPhiBins = param[i *2 + 1];86 paramPhiBins = param[i*2 + 1]; 86 87 sizePhiBins = paramPhiBins.GetSize(); 87 88 … … 100 101 { 101 102 fEtaBins.push_back(itEtaBin->first); 102 phiBins = new vector< double>(itEtaBin->second.size());103 phiBins = new vector< double >(itEtaBin->second.size()); 103 104 fPhiBins.push_back(phiBins); 104 105 phiBins->clear(); … … 125 126 void DenseTrackFilter::Finish() 126 127 { 127 vector< vector<Double_t> *>::iterator itPhiBin;128 vector< vector< Double_t >* >::iterator itPhiBin; 128 129 if(fItTrackInputArray) delete fItTrackInputArray; 129 130 for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin) … … 144 145 Double_t ptmax; 145 146 146 vector< Double_t>::iterator itEtaBin;147 vector< Double_t>::iterator itPhiBin;148 vector< Double_t> *phiBins;149 150 vector< Long64_t>::iterator itTowerHits;147 vector< Double_t >::iterator itEtaBin; 148 vector< Double_t >::iterator itPhiBin; 149 vector< Double_t > *phiBins; 150 151 vector< Long64_t >::iterator itTowerHits; 151 152 152 153 fTowerHits.clear(); … … 155 156 fItTrackInputArray->Reset(); 156 157 number = -1; 157 while((track = static_cast<Candidate 158 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 158 159 { 159 160 const TLorentzVector &trackPosition = track->Position; … … 195 196 towerHit = (*itTowerHits); 196 197 flags = (towerHit >> 24) & 0x00000000000000FFLL; 197 number = (towerHit) &0x0000000000FFFFFFLL;198 number = (towerHit) & 0x0000000000FFFFFFLL; 198 199 hitEtaPhi = towerHit >> 32; 199 200 … … 215 216 { 216 217 ++fTowerTrackHits; 217 track = static_cast<Candidate 218 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 218 219 momentum = track->Momentum; 219 220 … … 225 226 continue; 226 227 } 228 227 229 } 228 230 229 231 // here fill last tower 230 232 FillTrack(); 233 231 234 } 232 235 … … 242 245 // saving track with highest pT that hit the tower 243 246 if(fTowerTrackHits < 1) return; 244 247 245 248 numberOfCandidates = fBestTrack->GetCandidates()->GetEntriesFast(); 246 249 if(numberOfCandidates < 1) return; 247 250 248 track = static_cast<Candidate 249 candidate = static_cast<Candidate 251 track = static_cast<Candidate*>(fBestTrack->GetCandidates()->At(numberOfCandidates - 1)); 252 candidate = static_cast<Candidate*>(track->Clone()); 250 253 pt = candidate->Momentum.Pt(); 251 254 eta = candidate->Momentum.Eta(); … … 253 256 eta = gRandom->Gaus(eta, fEtaPhiRes); 254 257 phi = gRandom->Gaus(phi, fEtaPhiRes); 255 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));258 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta)); 256 259 candidate->AddCandidate(track); 257 260 … … 259 262 switch(TMath::Abs(candidate->PID)) 260 263 { 261 case 11:262 fElectronOutputArray->Add(candidate);263 break;264 case 13:265 fMuonOutputArray->Add(candidate);266 break;267 default:268 fChargedHadronOutputArray->Add(candidate);269 } 270 } 264 case 11: 265 fElectronOutputArray->Add(candidate); 266 break; 267 case 13: 268 fMuonOutputArray->Add(candidate); 269 break; 270 default: 271 fChargedHadronOutputArray->Add(candidate); 272 } 273 } -
modules/DenseTrackFilter.h
r0e7d64a re39abb4 41 41 { 42 42 public: 43 43 44 DenseTrackFilter(); 44 45 ~DenseTrackFilter(); … … 49 50 50 51 private: 51 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 52 53 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 52 54 53 55 Candidate *fBestTrack; … … 59 61 TBinMap fBinMap; //! 60 62 61 std::vector <Double_t> fEtaBins;62 std::vector <std::vector<Double_t> *> fPhiBins;63 std::vector < Double_t > fEtaBins; 64 std::vector < std::vector < Double_t >* > fPhiBins; 63 65 64 std::vector <Long64_t> fTowerHits;66 std::vector < Long64_t > fTowerHits; 65 67 66 68 TIterator *fItTrackInputArray; //! -
modules/Efficiency.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Efficiency 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 93 94 94 95 void Efficiency::Process() 95 { 96 { 96 97 Candidate *candidate; 97 Double_t pt, eta, phi, e , d0, dz, ctgTheta;98 Double_t pt, eta, phi, e; 98 99 99 100 fItInputArray->Reset(); 100 while((candidate = static_cast<Candidate 101 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 101 102 { 102 103 const TLorentzVector &candidatePosition = candidate->Position; … … 106 107 pt = candidateMomentum.Pt(); 107 108 e = candidateMomentum.E(); 108 d0 = candidate->D0;109 dz = candidate->DZ;110 ctgTheta = candidate->CtgTheta;111 109 112 110 // apply an efficency formula 113 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e , d0, dz, ctgTheta)) continue;114 111 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e)) continue; 112 115 113 fOutputArray->Add(candidate); 116 114 } -
modules/Efficiency.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 Efficiency(); 40 41 ~Efficiency(); … … 45 46 46 47 private: 48 47 49 DelphesFormula *fFormula; //! 48 50 -
modules/EnergyScale.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class EnergyScale 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 97 98 TLorentzVector momentum; 98 99 Double_t scale; 99 100 100 101 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate 102 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 102 103 { 103 104 momentum = candidate->Momentum; … … 107 108 if(scale > 0.0) momentum *= scale; 108 109 109 candidate = static_cast<Candidate 110 candidate = static_cast<Candidate*>(candidate->Clone()); 110 111 candidate->Momentum = momentum; 111 112 -
modules/EnergyScale.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 EnergyScale(); 40 41 ~EnergyScale(); … … 45 46 46 47 private: 48 47 49 DelphesFormula *fFormula; //! 48 50 … … 50 52 51 53 const TObjArray *fInputArray; //! 52 54 53 55 TObjArray *fOutputArray; //! 54 56 -
modules/EnergySmearing.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class EnergySmearing 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 86 87 87 88 void EnergySmearing::Finish() 88 { 89 { 89 90 if(fItInputArray) delete fItInputArray; 90 91 } … … 98 99 99 100 fItInputArray->Reset(); 100 while((candidate = static_cast<Candidate 101 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 101 102 { 102 103 const TLorentzVector &candidatePosition = candidate->Position; 103 104 const TLorentzVector &candidateMomentum = candidate->Momentum; 104 105 105 106 pt = candidatePosition.Pt(); 106 107 eta = candidatePosition.Eta(); 107 108 phi = candidatePosition.Phi(); 108 109 energy = candidateMomentum.E(); 109 110 110 111 // apply smearing formula 111 112 energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy)); 112 113 113 114 if(energy <= 0.0) continue; 114 115 115 116 mother = candidate; 116 candidate = static_cast<Candidate 117 candidate = static_cast<Candidate*>(candidate->Clone()); 117 118 eta = candidateMomentum.Eta(); 118 119 phi = candidateMomentum.Phi(); 119 candidate->Momentum.SetPtEtaPhiE(energy /TMath::CosH(eta), eta, phi, energy);120 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) /candidateMomentum.E();120 candidate->Momentum.SetPtEtaPhiE(energy/TMath::CosH(eta), eta, phi, energy); 121 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy)/candidateMomentum.E(); 121 122 candidate->AddCandidate(mother); 122 123 123 124 fOutputArray->Add(candidate); 124 125 } -
modules/EnergySmearing.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 EnergySmearing(); 40 41 ~EnergySmearing(); … … 45 46 46 47 private: 48 47 49 DelphesFormula *fFormula; //! 48 50 … … 50 52 51 53 const TObjArray *fInputArray; //! 52 54 53 55 TObjArray *fOutputArray; //! 54 56 -
modules/ExampleModule.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class ExampleModule 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 86 87 fArrayParam.push_back(param[i].GetDouble()); 87 88 } 88 89 89 90 // import input array(s) 90 91 … … 95 96 96 97 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 98 97 99 } 98 100 … … 113 115 // loop over all input candidates 114 116 fItInputArray->Reset(); 115 while((candidate = static_cast<Candidate 117 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 116 118 { 117 119 candidatePosition = candidate->Position; -
modules/ExampleModule.h
r0e7d64a re39abb4 38 38 { 39 39 public: 40 40 41 ExampleModule(); 41 42 ~ExampleModule(); … … 46 47 47 48 private: 49 48 50 Int_t fIntParam; 49 51 Double_t fDoubleParam; 50 51 std::deque <Double_t> fArrayParam;52 52 53 std::deque <Double_t> fArrayParam; 54 53 55 DelphesFormula *fFormula; //! 54 56 -
modules/FastJetFinder.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class FastJetFinder 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 35 #include "ExRootAnalysis/ExRootResult.h" 36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 #include <vector> 50 51 52 #include "fastjet/PseudoJet.hh" 53 #include "fastjet/JetDefinition.hh" 51 54 #include "fastjet/ClusterSequence.hh" 55 #include "fastjet/Selector.hh" 52 56 #include "fastjet/ClusterSequenceArea.hh" 53 #include "fastjet/JetDefinition.hh"54 #include "fastjet/PseudoJet.hh"55 #include "fastjet/Selector.hh"56 57 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" 57 58 59 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh" 60 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 58 61 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh" 59 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 60 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh" 61 62 #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh" 62 63 #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 63 64 #include "fastjet/contribs/Nsubjettiness/Njettiness.hh" 64 65 #include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh" 65 #include "fastjet/contribs/Nsubjettiness/ Nsubjettiness.hh"66 #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh" 66 67 67 68 #include "fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh" 68 69 69 #include "fastjet/contribs/RecursiveTools/SoftDrop.hh"70 70 #include "fastjet/tools/Filter.hh" 71 71 #include "fastjet/tools/Pruner.hh" 72 #include "fastjet/contribs/RecursiveTools/SoftDrop.hh" 72 73 73 74 using namespace std; 74 75 using namespace fastjet; 75 76 using namespace fastjet::contrib; 77 76 78 77 79 //------------------------------------------------------------------------------ … … 81 83 fDefinition(0), fAreaDefinition(0), fItInputArray(0) 82 84 { 85 83 86 } 84 87 … … 87 90 FastJetFinder::~FastJetFinder() 88 91 { 92 89 93 } 90 94 … … 116 120 fJetPTMin = GetDouble("JetPTMin", 10.0); 117 121 122 118 123 //-- N(sub)jettiness parameters -- 119 124 … … 122 127 fAxisMode = GetInt("AxisMode", 1); 123 128 fRcutOff = GetDouble("RcutOff", 0.8); // used only if Njettiness is used as jet clustering algo (case 8) 124 fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8)129 fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8) 125 130 126 131 //-- Exclusive clustering for e+e- collisions -- 127 128 fNJets = GetInt("NJets", 132 133 fNJets = GetInt("NJets",2); 129 134 fExclusiveClustering = GetBool("ExclusiveClustering", false); 130 135 131 136 //-- Valencia Linear Collider algorithm 132 133 137 fGamma = GetDouble("Gamma", 1.0); 134 138 //fBeta parameter see above 135 139 136 140 fMeasureDef = new NormalizedMeasure(fBeta, fParameterR); 137 141 138 142 switch(fAxisMode) 139 143 { 140 default:141 case 1:142 fAxesDef = new WTA_KT_Axes();143 break;144 case 2:145 fAxesDef = new OnePass_WTA_KT_Axes();146 break;147 case 3:148 fAxesDef = new KT_Axes();149 break;150 case 4:151 fAxesDef = new OnePass_KT_Axes();152 }144 default: 145 case 1: 146 fAxesDef = new WTA_KT_Axes(); 147 break; 148 case 2: 149 fAxesDef = new OnePass_WTA_KT_Axes(); 150 break; 151 case 3: 152 fAxesDef = new KT_Axes(); 153 break; 154 case 4: 155 fAxesDef = new OnePass_KT_Axes(); 156 } 153 157 154 158 //-- Trimming parameters -- 155 159 156 160 fComputeTrimming = GetBool("ComputeTrimming", false); 157 161 fRTrim = GetDouble("RTrim", 0.2); 158 162 fPtFracTrim = GetDouble("PtFracTrim", 0.05); 163 159 164 160 165 //-- Pruning parameters -- 161 166 162 167 fComputePruning = GetBool("ComputePruning", false); 163 168 fZcutPrun = GetDouble("ZcutPrun", 0.1); 164 169 fRcutPrun = GetDouble("RcutPrun", 0.5); 165 170 fRPrun = GetDouble("RPrun", 0.8); 166 171 167 172 //-- SoftDrop parameters -- 168 169 fComputeSoftDrop = GetBool("ComputeSoftDrop", false);170 fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0);173 174 fComputeSoftDrop = GetBool("ComputeSoftDrop", false); 175 fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0); 171 176 fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1); 172 fR0SoftDrop = GetDouble("R0SoftDrop=", 0.8); 177 fR0SoftDrop= GetDouble("R0SoftDrop=", 0.8); 178 173 179 174 180 // --- Jet Area Parameters --- 175 176 181 fAreaAlgorithm = GetInt("AreaAlgorithm", 0); 177 182 fComputeRho = GetBool("ComputeRho", false); … … 190 195 switch(fAreaAlgorithm) 191 196 { 192 default:193 case 0:194 fAreaDefinition = 0;195 break;196 case 1:197 fAreaDefinition = new AreaDefinition(active_area_explicit_ghosts, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));198 break;199 case 2:200 fAreaDefinition = new AreaDefinition(one_ghost_passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));201 break;202 case 3:203 fAreaDefinition = new AreaDefinition(passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));204 break;205 case 4:206 fAreaDefinition = new AreaDefinition(VoronoiAreaSpec(fEffectiveRfact));207 break;208 case 5:209 fAreaDefinition = new AreaDefinition(active_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt));210 break;197 case 1: 198 fAreaDefinition = new AreaDefinition(active_area_explicit_ghosts, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt)); 199 break; 200 case 2: 201 fAreaDefinition = new AreaDefinition(one_ghost_passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt)); 202 break; 203 case 3: 204 fAreaDefinition = new AreaDefinition(passive_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt)); 205 break; 206 case 4: 207 fAreaDefinition = new AreaDefinition(VoronoiAreaSpec(fEffectiveRfact)); 208 break; 209 case 5: 210 fAreaDefinition = new AreaDefinition(active_area, GhostedAreaSpec(fGhostEtaMax, fRepeat, fGhostArea, fGridScatter, fPtScatter, fMeanGhostPt)); 211 break; 212 default: 213 case 0: 214 fAreaDefinition = 0; 215 break; 211 216 } 212 217 213 218 switch(fJetAlgorithm) 214 219 { 215 case 1:216 plugin = new CDFJetCluPlugin(fSeedThreshold, fConeRadius, fAdjacencyCut, fMaxIterations, fIratch, fOverlapThreshold);217 fDefinition = new JetDefinition(plugin);218 break;219 case 2:220 plugin = new CDFMidPointPlugin(fSeedThreshold, fConeRadius, fConeAreaFraction, fMaxPairSize, fMaxIterations, fOverlapThreshold);221 fDefinition = new JetDefinition(plugin);222 break;223 case 3:224 plugin = new SISConePlugin(fConeRadius, fOverlapThreshold, fMaxIterations, fJetPTMin);225 fDefinition = new JetDefinition(plugin);226 break;227 case 4:228 fDefinition = new JetDefinition(kt_algorithm, fParameterR);229 break;230 case 5:231 fDefinition = new JetDefinition(cambridge_algorithm, fParameterR);232 break;233 default:234 case 6:235 fDefinition = new JetDefinition(antikt_algorithm, fParameterR);236 break;237 case 7:238 recomb = new WinnerTakeAllRecombiner();239 fDefinition = new JetDefinition(antikt_algorithm, fParameterR, recomb, Best);240 break;241 case 8:242 fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);243 fDefinition = new JetDefinition(fNjettinessPlugin);244 break;220 case 1: 221 plugin = new CDFJetCluPlugin(fSeedThreshold, fConeRadius, fAdjacencyCut, fMaxIterations, fIratch, fOverlapThreshold); 222 fDefinition = new JetDefinition(plugin); 223 break; 224 case 2: 225 plugin = new CDFMidPointPlugin(fSeedThreshold, fConeRadius, fConeAreaFraction, fMaxPairSize, fMaxIterations, fOverlapThreshold); 226 fDefinition = new JetDefinition(plugin); 227 break; 228 case 3: 229 plugin = new SISConePlugin(fConeRadius, fOverlapThreshold, fMaxIterations, fJetPTMin); 230 fDefinition = new JetDefinition(plugin); 231 break; 232 case 4: 233 fDefinition = new JetDefinition(kt_algorithm, fParameterR); 234 break; 235 case 5: 236 fDefinition = new JetDefinition(cambridge_algorithm, fParameterR); 237 break; 238 default: 239 case 6: 240 fDefinition = new JetDefinition(antikt_algorithm, fParameterR); 241 break; 242 case 7: 243 recomb = new WinnerTakeAllRecombiner(); 244 fDefinition = new JetDefinition(antikt_algorithm, fParameterR, recomb, Best); 245 break; 246 case 8: 247 fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff); 248 fDefinition = new JetDefinition(fNjettinessPlugin); 249 break; 245 250 case 9: 246 fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma); 247 fDefinition = new JetDefinition(fValenciaPlugin); 248 break; 249 } 251 fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma); 252 fDefinition = new JetDefinition(fValenciaPlugin); 253 break; 254 255 } 256 257 250 258 251 259 fPlugin = plugin; … … 262 270 263 271 fEstimators.clear(); 264 for(i = 0; i < size /2; ++i)265 { 266 etaMin = param[i *2].GetDouble();267 etaMax = param[i *2 + 1].GetDouble();272 for(i = 0; i < size/2; ++i) 273 { 274 etaMin = param[i*2].GetDouble(); 275 etaMax = param[i*2 + 1].GetDouble(); 268 276 estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorRapRange(etaMin, etaMax), *fDefinition, *fAreaDefinition); 269 277 estimatorStruct.etaMin = etaMin; … … 282 290 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 283 291 fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho")); 284 fConstituentsOutputArray = ExportArray(GetString("ConstituentsOutputArray", "constituents"));285 292 } 286 293 … … 289 296 void FastJetFinder::Finish() 290 297 { 291 vector< TEstimatorStruct>::iterator itEstimators;298 vector< TEstimatorStruct >::iterator itEstimators; 292 299 293 300 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) … … 299 306 if(fDefinition) delete fDefinition; 300 307 if(fAreaDefinition) delete fAreaDefinition; 301 if(fPlugin) delete static_cast<JetDefinition::Plugin 302 if(fRecomb) delete static_cast<JetDefinition::Recombiner 303 if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin 308 if(fPlugin) delete static_cast<JetDefinition::Plugin*>(fPlugin); 309 if(fRecomb) delete static_cast<JetDefinition::Recombiner*>(fRecomb); 310 if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin*>(fNjettinessPlugin); 304 311 if(fAxesDef) delete fAxesDef; 305 312 if(fMeasureDef) delete fMeasureDef; 306 if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin *>(fValenciaPlugin); 313 if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin*>(fValenciaPlugin); 314 307 315 } 308 316 … … 317 325 Double_t time, timeWeight; 318 326 Int_t number, ncharged, nneutrals; 319 Int_t charge; 327 Int_t charge; 320 328 Double_t rho = 0.0; 321 329 PseudoJet jet, area; 322 330 ClusterSequence *sequence; 323 vector< PseudoJet> inputList, outputList, subjets;324 vector< PseudoJet>::iterator itInputList, itOutputList;325 vector< TEstimatorStruct>::iterator itEstimators;331 vector< PseudoJet > inputList, outputList, subjets; 332 vector< PseudoJet >::iterator itInputList, itOutputList; 333 vector< TEstimatorStruct >::iterator itEstimators; 326 334 Double_t excl_ymerge23 = 0.0; 327 335 Double_t excl_ymerge34 = 0.0; 328 336 Double_t excl_ymerge45 = 0.0; 329 337 Double_t excl_ymerge56 = 0.0; 330 338 331 339 DelphesFactory *factory = GetFactory(); 332 340 … … 336 344 fItInputArray->Reset(); 337 345 number = 0; 338 while((candidate = static_cast<Candidate 346 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 339 347 { 340 348 momentum = candidate->Momentum; … … 373 381 outputList.clear(); 374 382 383 375 384 if(fExclusiveClustering) 376 { 377 try 378 { 379 outputList = sorted_by_pt(sequence->exclusive_jets(fNJets)); 380 } 381 catch(fastjet::Error) 382 { 383 outputList.clear(); 384 } 385 386 excl_ymerge23 = sequence->exclusive_ymerge(2); 387 excl_ymerge34 = sequence->exclusive_ymerge(3); 388 excl_ymerge45 = sequence->exclusive_ymerge(4); 389 excl_ymerge56 = sequence->exclusive_ymerge(5); 390 } 385 { 386 try{ 387 outputList = sorted_by_pt(sequence->exclusive_jets( fNJets )); 388 } 389 catch(fastjet::Error) 390 { 391 outputList.clear(); 392 } 393 394 excl_ymerge23 = sequence->exclusive_ymerge( 2 ); 395 excl_ymerge34 = sequence->exclusive_ymerge( 3 ); 396 excl_ymerge45 = sequence->exclusive_ymerge( 4 ); 397 excl_ymerge56 = sequence->exclusive_ymerge( 5 ); 398 } 391 399 else 392 {393 outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin));394 }400 { 401 outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin)); 402 } 395 403 396 404 // loop over all jets and export them 397 405 detaMax = 0.0; 398 406 dphiMax = 0.0; 399 407 400 408 for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList) 401 409 { … … 408 416 if(fAreaDefinition) area = itOutputList->area_4vector(); 409 417 418 419 410 420 candidate = factory->NewCandidate(); 411 421 … … 424 434 { 425 435 if(itInputList->user_index() < 0) continue; 426 constituent = static_cast<Candidate 436 constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index())); 427 437 428 438 deta = TMath::Abs(momentum.Eta() - constituent->Momentum.Eta()); … … 431 441 if(dphi > dphiMax) dphiMax = dphi; 432 442 433 if(constituent->Charge == 0) 434 nneutrals++; 435 else 436 ncharged++; 437 438 time += TMath::Sqrt(constituent->Momentum.E()) * (constituent->Position.T()); 443 if(constituent->Charge == 0) nneutrals++; 444 else ncharged++; 445 446 time += TMath::Sqrt(constituent->Momentum.E())*(constituent->Position.T()); 439 447 timeWeight += TMath::Sqrt(constituent->Momentum.E()); 440 448 441 449 charge += constituent->Charge; 442 450 443 fConstituentsOutputArray->Add(constituent);444 451 candidate->AddCandidate(constituent); 445 452 } 446 453 447 454 candidate->Momentum = momentum; 448 candidate->Position.SetT(time /timeWeight);455 candidate->Position.SetT(time/timeWeight); 449 456 candidate->Area.SetPxPyPzE(area.px(), area.py(), area.pz(), area.E()); 450 457 451 458 candidate->DeltaEta = detaMax; 452 459 candidate->DeltaPhi = dphiMax; 453 candidate->Charge = charge; 460 candidate->Charge = charge; 454 461 candidate->NNeutrals = nneutrals; 455 462 candidate->NCharged = ncharged; 463 456 464 457 465 //for exclusive clustering, access y_n,n+1 as exclusive_ymerge (fNJets); … … 460 468 candidate->ExclYmerge45 = excl_ymerge45; 461 469 candidate->ExclYmerge56 = excl_ymerge56; 462 470 463 471 //------------------------------------ 464 472 // Trimming … … 468 476 { 469 477 470 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim));478 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm,fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim)); 471 479 fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList); 472 480 473 481 trimmed_jet = join(trimmed_jet.constituents()); 474 482 475 483 candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m()); 476 477 // four hardest subjets 484 485 // four hardest subjets 478 486 subjets.clear(); 479 487 subjets = trimmed_jet.pieces(); 480 488 subjets = sorted_by_pt(subjets); 481 489 482 490 candidate->NSubJetsTrimmed = subjets.size(); 483 491 484 for (size_t i = 0; i < subjets.size() and i < 4; i++)492 for (size_t i = 0; i < subjets.size() and i < 4; i++) 485 493 { 486 if(subjets.at(i).pt() < 0) continue; 487 candidate->TrimmedP4[i +1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());494 if(subjets.at(i).pt() < 0) continue ; 495 candidate->TrimmedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 488 496 } 489 497 } 490 498 499 491 500 //------------------------------------ 492 501 // Pruning 493 502 //------------------------------------ 494 503 504 495 505 if(fComputePruning) 496 506 { 497 507 498 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm, fRPrun), fZcutPrun,fRcutPrun);508 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm,fRPrun),fZcutPrun,fRcutPrun); 499 509 fastjet::PseudoJet pruned_jet = pruner(*itOutputList); 500 510 501 511 candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m()); 502 503 // four hardest subjet 512 513 // four hardest subjet 504 514 subjets.clear(); 505 515 subjets = pruned_jet.pieces(); 506 516 subjets = sorted_by_pt(subjets); 507 517 508 518 candidate->NSubJetsPruned = subjets.size(); 509 519 510 for (size_t i = 0; i < subjets.size() and i < 4; i++)520 for (size_t i = 0; i < subjets.size() and i < 4; i++) 511 521 { 512 if(subjets.at(i).pt() < 0) continue; 513 candidate->PrunedP4[i +1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());522 if(subjets.at(i).pt() < 0) continue ; 523 candidate->PrunedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 514 524 } 515 } 516 525 526 } 527 517 528 //------------------------------------ 518 529 // SoftDrop 519 530 //------------------------------------ 520 531 521 532 if(fComputeSoftDrop) 522 533 { 523 524 contrib::SoftDrop softDrop(fBetaSoftDrop, fSymmetryCutSoftDrop,fR0SoftDrop);534 535 contrib::SoftDrop softDrop(fBetaSoftDrop,fSymmetryCutSoftDrop,fR0SoftDrop); 525 536 fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList); 526 537 527 538 candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m()); 528 529 // four hardest subjet 530 539 540 // four hardest subjet 541 531 542 subjets.clear(); 532 subjets = softdrop_jet.pieces();533 subjets = sorted_by_pt(subjets);543 subjets = softdrop_jet.pieces(); 544 subjets = sorted_by_pt(subjets); 534 545 candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size(); 535 546 536 547 candidate->SoftDroppedJet = candidate->SoftDroppedP4[0]; 537 548 538 for (size_t i = 0; i < subjets.size()and i < 4; i++)549 for (size_t i = 0; i < subjets.size() and i < 4; i++) 539 550 { 540 if(subjets.at(i).pt() < 0) continue; 541 candidate->SoftDroppedP4[i +1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());542 if(i == 0) candidate->SoftDroppedSubJet1 = candidate->SoftDroppedP4[i +1];543 if(i == 1) candidate->SoftDroppedSubJet2 = candidate->SoftDroppedP4[i +1];551 if(subjets.at(i).pt() < 0) continue ; 552 candidate->SoftDroppedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 553 if(i==0) candidate->SoftDroppedSubJet1 = candidate->SoftDroppedP4[i+1]; 554 if(i==1) candidate->SoftDroppedSubJet2 = candidate->SoftDroppedP4[i+1]; 544 555 } 545 556 } 546 557 547 558 // --- compute N-subjettiness with N = 1,2,3,4,5 ---- 548 559 549 560 if(fComputeNsubjettiness) 550 561 { 551 562 552 563 Nsubjettiness nSub1(1, *fAxesDef, *fMeasureDef); 553 564 Nsubjettiness nSub2(2, *fAxesDef, *fMeasureDef); … … 555 566 Nsubjettiness nSub4(4, *fAxesDef, *fMeasureDef); 556 567 Nsubjettiness nSub5(5, *fAxesDef, *fMeasureDef); 557 568 558 569 candidate->Tau[0] = nSub1(*itOutputList); 559 570 candidate->Tau[1] = nSub2(*itOutputList); … … 561 572 candidate->Tau[3] = nSub4(*itOutputList); 562 573 candidate->Tau[4] = nSub5(*itOutputList); 574 563 575 } 564 576 -
modules/FastJetFinder.h
r0e7d64a re39abb4 35 35 class TIterator; 36 36 37 namespace fastjet 38 { 39 class JetDefinition; 40 class AreaDefinition; 41 class JetMedianBackgroundEstimator; 42 namespace contrib 43 { 44 class NjettinessPlugin; 45 class ValenciaPlugin; 46 class AxesDefinition; 47 class MeasureDefinition; 48 } // namespace contrib 49 } // namespace fastjet 37 namespace fastjet { 38 class JetDefinition; 39 class AreaDefinition; 40 class JetMedianBackgroundEstimator; 41 namespace contrib { 42 class NjettinessPlugin; 43 class ValenciaPlugin; 44 class AxesDefinition; 45 class MeasureDefinition; 46 } 47 } 50 48 51 49 class FastJetFinder: public DelphesModule 52 50 { 53 51 public: 52 54 53 FastJetFinder(); 55 54 ~FastJetFinder(); … … 60 59 61 60 private: 61 62 62 void *fPlugin; //! 63 63 void *fRecomb; //! 64 64 65 fastjet::contrib::AxesDefinition *fAxesDef; 66 fastjet::contrib::MeasureDefinition *fMeasureDef; 65 fastjet::contrib::AxesDefinition *fAxesDef; 66 fastjet::contrib::MeasureDefinition *fMeasureDef; 67 67 68 68 fastjet::contrib::NjettinessPlugin *fNjettinessPlugin; //! … … 90 90 //-- Valencia Linear Collider algorithm 91 91 Double_t fGamma; 92 92 93 93 //-- N (sub)jettiness parameters -- 94 94 … … 97 97 Int_t fAxisMode; 98 98 Double_t fRcutOff; 99 Int_t fN ;99 Int_t fN ; 100 100 101 101 //-- Trimming parameters -- 102 102 103 103 Bool_t fComputeTrimming; 104 104 Double_t fRTrim; 105 105 Double_t fPtFracTrim; 106 106 107 107 //-- Pruning parameters -- 108 108 … … 123 123 fastjet::AreaDefinition *fAreaDefinition; 124 124 Int_t fAreaAlgorithm; 125 Bool_t fComputeRho;125 Bool_t fComputeRho; 126 126 127 127 // -- ghost based areas -- … … 143 143 }; 144 144 145 std::vector< TEstimatorStruct> fEstimators; //!145 std::vector< TEstimatorStruct > fEstimators; //! 146 146 #endif 147 147 … … 152 152 TObjArray *fOutputArray; //! 153 153 TObjArray *fRhoOutputArray; //! 154 TObjArray *fConstituentsOutputArray; //!155 154 156 155 ClassDef(FastJetFinder, 1) -
modules/FastJetGridMedianEstimator.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class FastJetGridMedianEstimator 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include < stdexcept>50 #include <vector> 49 51 #include <utility> 50 #include <vector>51 52 53 #include "fastjet/PseudoJet.hh" 54 #include "fastjet/JetDefinition.hh" 52 55 #include "fastjet/ClusterSequence.hh" 56 #include "fastjet/Selector.hh" 57 #include "fastjet/RectangularGrid.hh" 53 58 #include "fastjet/ClusterSequenceArea.hh" 54 #include "fastjet/JetDefinition.hh"55 #include "fastjet/PseudoJet.hh"56 #include "fastjet/RectangularGrid.hh"57 #include "fastjet/Selector.hh"58 59 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" 59 60 60 61 #include "fastjet/tools/GridMedianBackgroundEstimator.hh" 61 62 63 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh" 64 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 62 65 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh" 63 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"64 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh"65 66 66 #include "fastjet/contribs/Nsubjettiness/ ExtraRecombiners.hh"67 #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 67 68 #include "fastjet/contribs/Nsubjettiness/Njettiness.hh" 68 69 #include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh" 69 #include "fastjet/contribs/Nsubjettiness/ Nsubjettiness.hh"70 #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh" 70 71 71 72 using namespace std; 72 73 using namespace fastjet; 73 74 using namespace fastjet::contrib; 75 74 76 75 77 //------------------------------------------------------------------------------ … … 78 80 fItInputArray(0) 79 81 { 82 80 83 } 81 84 … … 84 87 FastJetGridMedianEstimator::~FastJetGridMedianEstimator() 85 88 { 89 86 90 } 87 91 … … 100 104 101 105 fEstimators.clear(); 102 for(i = 0; i < size /4; ++i)106 for(i = 0; i < size/4; ++i) 103 107 { 104 rapMin = param[i *4].GetDouble();105 rapMax = param[i *4 + 1].GetDouble();106 drap = param[i *4 + 2].GetDouble();107 dphi = param[i *4 + 3].GetDouble();108 rapMin = param[i*4].GetDouble(); 109 rapMax = param[i*4 + 1].GetDouble(); 110 drap = param[i*4 + 2].GetDouble(); 111 dphi = param[i*4 + 3].GetDouble(); 108 112 fEstimators.push_back(new GridMedianBackgroundEstimator(rapMin, rapMax, drap, dphi)); 109 113 } … … 121 125 void FastJetGridMedianEstimator::Finish() 122 126 { 123 vector< GridMedianBackgroundEstimator *>::iterator itEstimators;127 vector< GridMedianBackgroundEstimator * >::iterator itEstimators; 124 128 125 129 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) … … 140 144 Double_t rho = 0; 141 145 PseudoJet jet; 142 vector< PseudoJet> inputList, outputList;146 vector< PseudoJet > inputList, outputList; 143 147 144 vector<GridMedianBackgroundEstimator *>::iterator itEstimators; 145 ; 148 vector< GridMedianBackgroundEstimator * >::iterator itEstimators;; 146 149 147 150 DelphesFactory *factory = GetFactory(); … … 152 155 fItInputArray->Reset(); 153 156 number = 0; 154 while((candidate = static_cast<Candidate 157 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 155 158 { 156 159 momentum = candidate->Momentum; -
modules/FastJetGridMedianEstimator.h
r0e7d64a re39abb4 20 20 #define FastJetGridMedianEstimator_h 21 21 22 22 23 /** \class FastJetGridMedianEstimator 23 24 * … … 34 35 class TIterator; 35 36 36 namespace fastjet 37 { 38 class GridMedianBackgroundEstimator; 37 namespace fastjet { 38 class GridMedianBackgroundEstimator; 39 39 } 40 40 … … 42 42 { 43 43 public: 44 44 45 FastJetGridMedianEstimator(); 45 46 ~FastJetGridMedianEstimator(); … … 50 51 51 52 private: 52 std::vector<fastjet::GridMedianBackgroundEstimator *> fEstimators; //! 53 54 std::vector< fastjet::GridMedianBackgroundEstimator * > fEstimators; //! 53 55 54 56 TIterator *fItInputArray; //! -
modules/Hector.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Hector 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 #include "Hector/H_BeamLine.h" 52 #include "Hector/H_RecRPObject.h" 51 53 #include "Hector/H_BeamParticle.h" 52 #include "Hector/H_RecRPObject.h"53 54 54 55 using namespace std; … … 119 120 120 121 fItInputArray->Reset(); 121 while((candidate = static_cast<Candidate 122 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 122 123 { 123 124 const TLorentzVector &candidatePosition = candidate->Position; … … 131 132 z = 1.0E-3 * candidatePosition.Z(); 132 133 133 134 134 // tx = 1.0E6 * TMath::ATan(candidateMomentum.Px()/pz); 135 // ty = 1.0E6 * TMath::ATan(candidateMomentum.Py()/pz); 135 136 136 137 tx = 0.0; 137 138 ty = 0.0; 138 139 139 theta = TMath::Hypot(TMath::ATan(candidateMomentum.Px() / pz), TMath::ATan(candidateMomentum.Py() /pz));140 distance = (fDistance - 1.0E-3 * candidatePosition.Z()) /TMath::Cos(theta);141 time = gRandom->Gaus((distance + 1.0E-3 * candidatePosition.T()) /c_light, fSigmaT);140 theta = TMath::Hypot(TMath::ATan(candidateMomentum.Px()/pz), TMath::ATan(candidateMomentum.Py()/pz)); 141 distance = (fDistance - 1.0E-3 * candidatePosition.Z())/TMath::Cos(theta); 142 time = gRandom->Gaus((distance + 1.0E-3 * candidatePosition.T())/c_light, fSigmaT); 142 143 143 144 H_BeamParticle particle(candidate->Mass, candidate->Charge); 144 145 particle.set4Momentum(candidateMomentum.Px(), candidateMomentum.Py(), 146 candidateMomentum.Pz(), candidateMomentum.E());145 // particle.set4Momentum(candidateMomentum); 146 particle.set4Momentum(candidateMomentum.Px(), candidateMomentum.Py(), 147 candidateMomentum.Pz(), candidateMomentum.E()); 147 148 particle.setPosition(x, y, tx, ty, z); 148 149 … … 157 158 158 159 mother = candidate; 159 candidate = static_cast<Candidate 160 candidate = static_cast<Candidate*>(candidate->Clone()); 160 161 candidate->Position.SetXYZT(particle.getX(), particle.getY(), particle.getS(), time); 161 162 candidate->Momentum.SetPxPyPzE(particle.getTX(), particle.getTY(), 0.0, particle.getE()); -
modules/Hector.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 Hector(); 40 41 ~Hector(); … … 45 46 46 47 private: 48 47 49 Int_t fDirection; 48 50 -
modules/IdentificationMap.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class IdentificationMap 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootResult.h"37 38 39 #include "TMath.h" 40 #include "TString.h" 41 #include "TFormula.h" 42 #include "TRandom3.h" 43 #include "TObjArray.h" 38 44 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 45 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 46 46 47 #include <algorithm> 48 #include <stdexcept> 47 49 #include <iostream> 48 50 #include <sstream> 49 #include <stdexcept>50 51 51 52 using namespace std; … … 78 79 79 80 fEfficiencyMap.clear(); 80 for(i = 0; i < size /3; ++i)81 for(i = 0; i < size/3; ++i) 81 82 { 82 83 formula = new DelphesFormula; 83 formula->Compile(param[i *3 + 2].GetString());84 pdg = param[i *3].GetInt();85 fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i *3 + 1].GetInt(), formula)));84 formula->Compile(param[i*3 + 2].GetString()); 85 pdg = param[i*3].GetInt(); 86 fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i*3 + 1].GetInt(), formula))); 86 87 } 87 88 … … 128 129 Double_t pt, eta, phi, e; 129 130 TMisIDMap::iterator itEfficiencyMap; 130 pair <TMisIDMap::iterator, TMisIDMap::iterator> range;131 pair <TMisIDMap::iterator, TMisIDMap::iterator> range; 131 132 DelphesFormula *formula; 132 133 Int_t pdgCodeIn, pdgCodeOut, charge; … … 135 136 136 137 fItInputArray->Reset(); 137 while((candidate = static_cast<Candidate 138 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 138 139 { 139 140 const TLorentzVector &candidatePosition = candidate->Position; … … 143 144 pt = candidateMomentum.Pt(); 144 145 e = candidateMomentum.E(); 145 146 146 147 pdgCodeIn = candidate->PID; 147 148 charge = candidate->Charge; … … 170 171 { 171 172 // change PID of particle 172 if(pdgCodeOut != 0) candidate->PID = charge *pdgCodeOut;173 if(pdgCodeOut != 0) candidate->PID = charge*pdgCodeOut; 173 174 fOutputArray->Add(candidate); 174 175 break; -
modules/IdentificationMap.h
r0e7d64a re39abb4 20 20 #define IdentificationMap_h 21 21 22 22 23 /** \class IdentificationMap 23 24 * … … 38 39 { 39 40 public: 41 40 42 IdentificationMap(); 41 43 ~IdentificationMap(); … … 46 48 47 49 private: 48 typedef std::multimap<Int_t, std::pair<Int_t, DelphesFormula *> > TMisIDMap; //! 50 51 typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //! 49 52 50 53 TMisIDMap fEfficiencyMap; //! -
modules/ImpactParameterSmearing.cc
r0e7d64a re39abb4 25 25 */ 26 26 27 27 28 #include "modules/ImpactParameterSmearing.h" 28 29 … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 99 100 100 101 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate 102 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 102 103 { 103 104 104 105 // take momentum before smearing (otherwise apply double smearing on d0) 105 particle = static_cast<Candidate 106 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 106 107 107 108 const TLorentzVector &candidateMomentum = particle->Momentum; … … 111 112 phi = candidateMomentum.Phi(); 112 113 e = candidateMomentum.E(); 113 114 114 115 px = candidateMomentum.Px(); 115 116 py = candidateMomentum.Py(); 116 117 117 118 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 118 xd = candidate->Xd;119 yd = candidate->Yd;120 zd = candidate->Zd;119 xd = candidate->Xd; 120 yd = candidate->Yd; 121 zd = candidate->Zd; 121 122 122 123 // calculate smeared values … … 130 131 131 132 // calculate impact parameter (after-smearing) 132 d0 = (xd * py - yd * px) /pt;133 d0 = (xd*py - yd*px)/pt; 133 134 134 135 dd0 = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); … … 137 138 mother = candidate; 138 139 139 candidate = static_cast<Candidate 140 candidate = static_cast<Candidate*>(candidate->Clone()); 140 141 candidate->Xd = xd; 141 142 candidate->Yd = yd; -
modules/ImpactParameterSmearing.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 ImpactParameterSmearing(); 40 41 ~ImpactParameterSmearing(); … … 45 46 46 47 private: 48 47 49 DelphesFormula *fFormula; //! 48 50 … … 50 52 51 53 const TObjArray *fInputArray; //! 52 54 53 55 TObjArray *fOutputArray; //! 54 56 -
modules/Isolation.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Isolation 20 21 * … … 34 35 #include "classes/DelphesFormula.h" 35 36 37 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 36 39 #include "ExRootAnalysis/ExRootClassifier.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 38 #include "ExRootAnalysis/ExRootResult.h" 39 40 41 #include "TMath.h" 42 #include "TString.h" 43 #include "TFormula.h" 44 #include "TRandom3.h" 45 #include "TObjArray.h" 40 46 #include "TDatabasePDG.h" 41 #include "TFormula.h"42 47 #include "TLorentzVector.h" 43 #include "TMath.h"44 #include "TObjArray.h"45 #include "TRandom3.h"46 #include "TString.h"47 48 48 49 #include <algorithm> 50 #include <stdexcept> 49 51 #include <iostream> 50 52 #include <sstream> 51 #include <stdexcept>52 53 53 54 using namespace std; … … 58 59 { 59 60 public: 61 60 62 IsolationClassifier() {} 61 63 … … 69 71 Int_t IsolationClassifier::GetCategory(TObject *object) 70 72 { 71 Candidate *track = static_cast<Candidate 73 Candidate *track = static_cast<Candidate*>(object); 72 74 const TLorentzVector &momentum = track->Momentum; 73 75 … … 169 171 // loop over all input jets 170 172 fItCandidateInputArray->Reset(); 171 while((candidate = static_cast<Candidate 173 while((candidate = static_cast<Candidate*>(fItCandidateInputArray->Next()))) 172 174 { 173 175 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 179 181 { 180 182 fItRhoInputArray->Reset(); 181 while((object = static_cast<Candidate 183 while((object = static_cast<Candidate*>(fItRhoInputArray->Next()))) 182 184 { 183 185 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 196 198 197 199 itIsolationArray.Reset(); 198 while((isolation = static_cast<Candidate 200 while((isolation = static_cast<Candidate*>(itIsolationArray.Next()))) 199 201 { 200 202 const TLorentzVector &isolationMomentum = isolation->Momentum; … … 202 204 if(fUseMiniCone) 203 205 { 204 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidateMomentum.DeltaR(isolationMomentum) > fDeltaRMin; 206 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && 207 candidateMomentum.DeltaR(isolationMomentum) > fDeltaRMin; 205 208 } 206 209 else 207 210 { 208 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidate->GetUniqueID() != isolation->GetUniqueID(); 211 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && 212 candidate->GetUniqueID() != isolation->GetUniqueID(); 209 213 } 210 214 … … 229 233 } 230 234 } 235 231 236 } 232 237 233 238 // find rho 234 239 rho = 0.0; 235 240 if(fRhoInputArray) 236 241 { 237 242 fItRhoInputArray->Reset(); 238 while((object = static_cast<Candidate 243 while((object = static_cast<Candidate*>(fItRhoInputArray->Next()))) 239 244 { 240 245 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 245 250 } 246 251 252 253 247 254 // correct sum for pile-up contamination 248 sumDBeta = sumChargedNoPU + TMath::Max(sumNeutral - 0.5 *sumChargedPU, 0.0);249 sumRhoCorr = sumChargedNoPU + TMath::Max(sumNeutral - TMath::Max(rho, 0.0) * fDeltaRMax * fDeltaRMax *TMath::Pi(), 0.0);250 ratioDBeta = sumDBeta /candidateMomentum.Pt();251 ratioRhoCorr = sumRhoCorr /candidateMomentum.Pt();255 sumDBeta = sumChargedNoPU + TMath::Max(sumNeutral - 0.5*sumChargedPU, 0.0); 256 sumRhoCorr = sumChargedNoPU + TMath::Max(sumNeutral - TMath::Max(rho, 0.0)*fDeltaRMax*fDeltaRMax*TMath::Pi(), 0.0); 257 ratioDBeta = sumDBeta/candidateMomentum.Pt(); 258 ratioRhoCorr = sumRhoCorr/candidateMomentum.Pt(); 252 259 253 260 candidate->IsolationVar = ratioDBeta; -
modules/Isolation.h
r0e7d64a re39abb4 41 41 { 42 42 public: 43 43 44 Isolation(); 44 45 ~Isolation(); … … 49 50 50 51 private: 52 51 53 Double_t fDeltaRMax; 52 54 -
modules/JetFakeParticle.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class JetFakeParticle 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 38 39 #include "TMath.h" 40 #include "TString.h" 41 #include "TFormula.h" 42 #include "TRandom3.h" 43 #include "TObjArray.h" 38 44 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 45 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 46 46 47 #include <algorithm> 48 #include <stdexcept> 47 49 #include <iostream> 48 50 #include <sstream> 49 #include <stdexcept> 51 50 52 51 53 using namespace std; … … 79 81 fEfficiencyMap.clear(); 80 82 81 for(i = 0; i < size /2; ++i)83 for(i = 0; i < size/2; ++i) 82 84 { 83 85 formula = new DelphesFormula; 84 formula->Compile(param[i *2 + 1].GetString());85 pdgCode = param[i *2].GetInt();86 formula->Compile(param[i*2 + 1].GetString()); 87 pdgCode = param[i*2].GetInt(); 86 88 87 89 if(TMath::Abs(pdgCode) != 11 && TMath::Abs(pdgCode) != 13 && TMath::Abs(pdgCode) != 22) … … 90 92 } 91 93 92 fEfficiencyMap[param[i *2].GetInt()] = formula;94 fEfficiencyMap[param[i*2].GetInt()] = formula; 93 95 } 94 96 … … 114 116 fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "fakePhotons")); 115 117 fJetOutputArray = ExportArray(GetString("JetOutputArray", "jets")); 118 116 119 } 117 120 … … 144 147 145 148 fItInputArray->Reset(); 146 while((candidate = static_cast<Candidate 149 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 147 150 { 148 151 const TLorentzVector &candidatePosition = candidate->Position; … … 167 170 if(total <= r && r < total + p) 168 171 { 169 fake = static_cast<Candidate 172 fake = static_cast<Candidate*>(candidate->Clone()); 170 173 171 174 // convert jet … … 175 178 if(candidate->Charge != 0) 176 179 { 177 fake->Charge = candidate->Charge /TMath::Abs(candidate->Charge);180 fake->Charge = candidate->Charge/TMath::Abs(candidate->Charge); 178 181 } 179 182 else … … 181 184 rs = gRandom->Uniform(); 182 185 fake->Charge = (rs < 0.5) ? -1 : 1; 186 183 187 } 184 188 } -
modules/JetFakeParticle.h
r0e7d64a re39abb4 20 20 #define JetFakeParticle_h 21 21 22 22 23 /** \class JetFakeParticle 23 24 * … … 38 39 { 39 40 public: 41 40 42 JetFakeParticle(); 41 43 ~JetFakeParticle(); … … 46 48 47 49 private: 48 #if !defined(__CINT__) && !defined(__CLING__) 49 typedef std::map<Int_t, DelphesFormula *> TFakeMap; //! 50 51 #if !defined(__CINT__) && !defined(__CLING__) 52 typedef std::map< Int_t, DelphesFormula * > TFakeMap; //! 50 53 TFakeMap fEfficiencyMap; 51 #endif54 #endif 52 55 53 56 TIterator *fItInputArray; //! -
modules/JetFlavorAssociation.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class JetFlavorAssociation 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 35 #include "ExRootAnalysis/ExRootResult.h" 36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 52 53 //------------------------------------------------------------------------------ 53 54 54 class PartonClassifier 55 class PartonClassifier: public ExRootClassifier 55 56 { 56 57 public: 58 57 59 PartonClassifier() {} 58 60 Int_t GetCategory(TObject *object); … … 65 67 Int_t PartonClassifier::GetCategory(TObject *object) 66 68 { 67 69 // select parton in the parton list 68 70 69 71 Candidate *parton = static_cast<Candidate *>(object); … … 85 87 //------------------------------------------------------------------------------ 86 88 87 class ParticleLHEFClassifier 89 class ParticleLHEFClassifier: public ExRootClassifier 88 90 { 89 91 public: 92 90 93 ParticleLHEFClassifier() {} 91 94 Int_t GetCategory(TObject *object); … … 187 190 //------------------------------------------------------------------------------ 188 191 189 void JetFlavorAssociation::Process() 190 { 192 void JetFlavorAssociation::Process(){ 191 193 192 194 Candidate *jet; … … 199 201 if(partonArray == 0) return; 200 202 201 if(fParticleLHEFInputArray) 203 if(fParticleLHEFInputArray) 202 204 { 203 205 fParticleLHEFFilter->Reset(); … … 225 227 Candidate *tempParton = 0, *tempPartonHighestPt = 0; 226 228 int pdgCode, pdgCodeMax = -1; 227 229 228 230 TIter itPartonArray(partonArray); 229 231 TIter itPartonLHEFArray(partonLHEFArray); … … 239 241 if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode; 240 242 } 241 243 242 244 if(!fParticleLHEFInputArray) continue; 243 245 244 246 itPartonLHEFArray.Reset(); 245 247 while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next()))) 246 248 { 247 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge) 248 { 249 break; 249 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 && 250 parton->PID == partonLHEF->PID && 251 partonLHEF->Charge == parton->Charge) 252 { 253 break; 250 254 } 251 255 … … 326 330 while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next()))) 327 331 { 328 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge) 332 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 && 333 parton->PID == partonLHEF->PID && 334 partonLHEF->Charge == parton->Charge) 329 335 { 330 336 isGoodCandidate = false; -
modules/JetFlavorAssociation.h
r0e7d64a re39abb4 28 28 */ 29 29 30 #include "classes/DelphesModule.h" 30 31 #include "classes/DelphesClasses.h" 31 #include "classes/DelphesModule.h"32 32 #include <map> 33 33 … … 42 42 { 43 43 public: 44 44 45 JetFlavorAssociation(); 45 46 ~JetFlavorAssociation(); … … 53 54 54 55 private: 56 55 57 Double_t fDeltaR; 56 58 -
modules/JetPileUpSubtractor.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class JetPileUpSubtractor 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 55 56 fItJetInputArray(0), fItRhoInputArray(0) 56 57 { 58 57 59 } 58 60 … … 61 63 JetPileUpSubtractor::~JetPileUpSubtractor() 62 64 { 65 63 66 } 64 67 … … 80 83 81 84 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 85 82 86 } 83 87 … … 101 105 // loop over all input candidates 102 106 fItJetInputArray->Reset(); 103 while((candidate = static_cast<Candidate 107 while((candidate = static_cast<Candidate*>(fItJetInputArray->Next()))) 104 108 { 105 109 momentum = candidate->Momentum; … … 112 116 { 113 117 fItRhoInputArray->Reset(); 114 while((object = static_cast<Candidate 118 while((object = static_cast<Candidate*>(fItRhoInputArray->Next()))) 115 119 { 116 120 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 128 132 if(momentum.Pt() <= fJetPTMin) continue; 129 133 130 candidate = static_cast<Candidate 134 candidate = static_cast<Candidate*>(candidate->Clone()); 131 135 candidate->Momentum = momentum; 132 136 -
modules/JetPileUpSubtractor.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 JetPileUpSubtractor(); 40 41 ~JetPileUpSubtractor(); … … 45 46 46 47 private: 48 47 49 Double_t fJetPTMin; 48 50 -
modules/LeptonDressing.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class LeptonDressing 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 53 54 54 55 LeptonDressing::LeptonDressing() : 55 56 fItDressingInputArray(0), fItCandidateInputArray(0) 56 57 { 57 58 } … … 73 74 fDressingInputArray = ImportArray(GetString("DressingInputArray", "Calorimeter/photons")); 74 75 fItDressingInputArray = fDressingInputArray->MakeIterator(); 75 76 76 77 fCandidateInputArray = ImportArray(GetString("CandidateInputArray", "UniqueObjectFinder/electrons")); 77 78 fItCandidateInputArray = fCandidateInputArray->MakeIterator(); 78 79 79 80 // create output array 80 81 … … 96 97 Candidate *candidate, *dressing, *mother; 97 98 TLorentzVector momentum; 98 99 99 100 // loop over all input candidate 100 101 fItCandidateInputArray->Reset(); 101 while((candidate = static_cast<Candidate 102 while((candidate = static_cast<Candidate*>(fItCandidateInputArray->Next()))) 102 103 { 103 104 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 106 107 fItDressingInputArray->Reset(); 107 108 momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 108 while((dressing = static_cast<Candidate 109 while((dressing = static_cast<Candidate*>(fItDressingInputArray->Next()))) 109 110 { 110 111 const TLorentzVector &dressingMomentum = dressing->Momentum; 111 if (dressingMomentum.Pt() > 0.1)112 if (dressingMomentum.Pt() > 0.1) 112 113 { 113 114 if(candidateMomentum.DeltaR(dressingMomentum) <= fDeltaR) … … 119 120 120 121 mother = candidate; 121 candidate = static_cast<Candidate 122 candidate = static_cast<Candidate*>(candidate->Clone()); 122 123 123 124 candidate->Momentum += momentum; 124 125 candidate->AddCandidate(mother); 125 126 126 127 fOutputArray->Add(candidate); 127 128 } -
modules/LeptonDressing.h
r0e7d64a re39abb4 34 34 { 35 35 public: 36 36 37 LeptonDressing(); 37 38 ~LeptonDressing(); 38 39 39 40 void Init(); 40 41 void Process(); … … 42 43 43 44 private: 45 44 46 Double_t fDeltaR; 45 47 46 48 TIterator *fItDressingInputArray; //! 47 49 48 50 TIterator *fItCandidateInputArray; //! 49 51 50 52 const TObjArray *fDressingInputArray; //! 51 53 52 54 const TObjArray *fCandidateInputArray; //! 53 55 -
modules/Merger.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Merger 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootResult.h"37 38 39 #include "TMath.h" 40 #include "TString.h" 41 #include "TFormula.h" 42 #include "TRandom3.h" 43 #include "TObjArray.h" 38 44 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 45 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 46 46 #include <algorithm> 47 #include <algorithm> 48 #include <stdexcept> 47 49 #include <iostream> 48 50 #include <sstream> 49 #include <stdexcept>50 51 51 52 using namespace std; … … 88 89 89 90 fMomentumOutputArray = ExportArray(GetString("MomentumOutputArray", "momentum")); 90 91 91 92 fEnergyOutputArray = ExportArray(GetString("EnergyOutputArray", "energy")); 92 93 } … … 96 97 void Merger::Finish() 97 98 { 98 vector< TIterator *>::iterator itInputList;99 vector< TIterator * >::iterator itInputList; 99 100 TIterator *iterator; 100 101 … … 112 113 Candidate *candidate; 113 114 TLorentzVector momentum; 114 Double_t sumPT, sumE; 115 vector< TIterator *>::iterator itInputList;115 Double_t sumPT, sumE; 116 vector< TIterator * >::iterator itInputList; 116 117 TIterator *iterator; 117 118 118 119 DelphesFactory *factory = GetFactory(); 119 120 120 121 momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 121 122 sumPT = 0; … … 129 130 // loop over all candidates 130 131 iterator->Reset(); 131 while((candidate = static_cast<Candidate 132 while((candidate = static_cast<Candidate*>(iterator->Next()))) 132 133 { 133 134 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 142 143 143 144 candidate = factory->NewCandidate(); 144 145 145 146 candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0); 146 147 candidate->Momentum = momentum; 147 148 148 149 fMomentumOutputArray->Add(candidate); 149 150 150 151 candidate = factory->NewCandidate(); 151 152 152 153 candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0); 153 154 candidate->Momentum.SetPtEtaPhiE(sumPT, 0.0, 0.0, sumE); 154 155 155 156 fEnergyOutputArray->Add(candidate); 156 157 } -
modules/Merger.h
r0e7d64a re39abb4 39 39 { 40 40 public: 41 41 42 Merger(); 42 43 ~Merger(); … … 47 48 48 49 private: 49 std::vector<TIterator *> fInputList; //! 50 51 std::vector< TIterator * > fInputList; //! 50 52 51 53 TObjArray *fOutputArray; //! -
modules/MomentumSmearing.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class MomentumSmearing 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 98 99 99 100 fItInputArray->Reset(); 100 while((candidate = static_cast<Candidate 101 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 101 102 { 102 103 const TLorentzVector &candidatePosition = candidate->Position; … … 107 108 e = candidateMomentum.E(); 108 109 res = fFormula->Eval(pt, eta, phi, e); 109 110 110 111 // apply smearing formula 111 112 //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 113 114 res = ( res > 1.0 ) ? 1.0 : res; 112 115 113 res = (res > 1.0) ? 1.0 : res; 114 115 pt = LogNormal(pt, res * pt); 116 116 pt = LogNormal(pt, res * pt ); 117 117 118 //if(pt <= 0.0) continue; 118 119 119 120 mother = candidate; 120 candidate = static_cast<Candidate 121 candidate = static_cast<Candidate*>(candidate->Clone()); 121 122 eta = candidateMomentum.Eta(); 122 123 phi = candidateMomentum.Phi(); 123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));124 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta)); 124 125 //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 125 126 candidate->TrackResolution = res; 126 127 candidate->AddCandidate(mother); 127 128 128 129 fOutputArray->Add(candidate); 129 130 } … … 137 138 if(mean > 0.0) 138 139 { 139 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean *mean))));140 a = TMath::Log(mean) - 0.5 * b *b;140 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 141 a = TMath::Log(mean) - 0.5*b*b; 141 142 142 return TMath::Exp(a + b *gRandom->Gaus(0.0, 1.0));143 return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0)); 143 144 } 144 145 else … … 148 149 } 149 150 151 150 152 //------------------------------------------------------------------------------ -
modules/MomentumSmearing.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 MomentumSmearing(); 40 41 ~MomentumSmearing(); … … 45 46 46 47 private: 48 47 49 Double_t LogNormal(Double_t mean, Double_t sigma); 48 50 … … 52 54 53 55 const TObjArray *fInputArray; //! 54 56 55 57 TObjArray *fOutputArray; //! 56 58 -
modules/OldCalorimeter.cc
r0e7d64a re39abb4 19 19 #include "classes/DelphesFormula.h" 20 20 21 #include "ExRootAnalysis/ExRootResult.h" 22 #include "ExRootAnalysis/ExRootFilter.h" 21 23 #include "ExRootAnalysis/ExRootClassifier.h" 22 #include "ExRootAnalysis/ExRootFilter.h" 23 #include "ExRootAnalysis/ExRootResult.h" 24 24 25 #include "TMath.h" 26 #include "TString.h" 27 #include "TFormula.h" 28 #include "TRandom3.h" 29 #include "TObjArray.h" 25 30 #include "TDatabasePDG.h" 26 #include "TFormula.h"27 31 #include "TLorentzVector.h" 28 #include "TMath.h"29 #include "TObjArray.h"30 #include "TRandom3.h"31 #include "TString.h"32 32 33 33 #include <algorithm> 34 #include <stdexcept> 34 35 #include <iostream> 35 36 #include <sstream> 36 #include <stdexcept>37 37 38 38 using namespace std; … … 82 82 if(fItTowerECalTrackArray) delete fItTowerECalTrackArray; 83 83 if(fTowerHCalTrackArray) delete fTowerHCalTrackArray; 84 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray; 85 } 84 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray;} 86 85 87 86 //------------------------------------------------------------------------------ … … 93 92 Double_t ecalFraction, hcalFraction; 94 93 TBinMap::iterator itEtaBin; 95 set< Double_t>::iterator itPhiBin;96 vector< Double_t> *phiBins;94 set< Double_t >::iterator itPhiBin; 95 vector< Double_t > *phiBins; 97 96 98 97 // read eta and phi bins … … 102 101 fEtaBins.clear(); 103 102 fPhiBins.clear(); 104 for(i = 0; i < size /2; ++i)105 { 106 paramEtaBins = param[i *2];103 for(i = 0; i < size/2; ++i) 104 { 105 paramEtaBins = param[i*2]; 107 106 sizeEtaBins = paramEtaBins.GetSize(); 108 paramPhiBins = param[i *2 + 1];107 paramPhiBins = param[i*2 + 1]; 109 108 sizePhiBins = paramPhiBins.GetSize(); 110 109 … … 123 122 { 124 123 fEtaBins.push_back(itEtaBin->first); 125 phiBins = new vector< double>(itEtaBin->second.size());124 phiBins = new vector< double >(itEtaBin->second.size()); 126 125 fPhiBins.push_back(phiBins); 127 126 phiBins->clear(); … … 140 139 fFractionMap[0] = make_pair(0.0, 1.0); 141 140 142 for(i = 0; i < size /2; ++i)143 { 144 paramFractions = param[i *2 + 1];141 for(i = 0; i < size/2; ++i) 142 { 143 paramFractions = param[i*2 + 1]; 145 144 sizeFractions = paramFractions.GetSize(); 146 145 … … 148 147 hcalFraction = paramFractions[1].GetDouble(); 149 148 150 fFractionMap[param[i *2].GetInt()] = make_pair(ecalFraction, hcalFraction);151 } 152 149 fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction); 150 } 151 /* 153 152 TFractionMap::iterator itFractionMap; 154 153 for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap) … … 180 179 void OldCalorimeter::Finish() 181 180 { 182 vector< vector<Double_t> *>::iterator itPhiBin;181 vector< vector< Double_t>* >::iterator itPhiBin; 183 182 if(fItParticleInputArray) delete fItParticleInputArray; 184 183 if(fItTrackInputArray) delete fItTrackInputArray; … … 204 203 TFractionMap::iterator itFractionMap; 205 204 206 vector< Double_t>::iterator itEtaBin;207 vector< Double_t>::iterator itPhiBin;208 vector< Double_t> *phiBins;209 210 vector< Long64_t>::iterator itTowerHits;205 vector< Double_t >::iterator itEtaBin; 206 vector< Double_t >::iterator itPhiBin; 207 vector< Double_t > *phiBins; 208 209 vector< Long64_t >::iterator itTowerHits; 211 210 212 211 DelphesFactory *factory = GetFactory(); … … 218 217 fItParticleInputArray->Reset(); 219 218 number = -1; 220 while((particle = static_cast<Candidate 219 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next()))) 221 220 { 222 221 const TLorentzVector &particlePosition = particle->Position; … … 266 265 fItTrackInputArray->Reset(); 267 266 number = -1; 268 while((track = static_cast<Candidate 267 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 269 268 { 270 269 const TLorentzVector &trackPosition = track->Position; … … 316 315 towerHit = (*itTowerHits); 317 316 flags = (towerHit >> 24) & 0x00000000000000FFLL; 318 number = (towerHit) &0x0000000000FFFFFFLL;317 number = (towerHit) & 0x0000000000FFFFFFLL; 319 318 hitEtaPhi = towerHit >> 32; 320 319 … … 337 336 338 337 // calculate eta and phi of the tower's center 339 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);340 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);338 fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 339 fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 341 340 342 341 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 369 368 if(flags & 1) 370 369 { 371 track = static_cast<Candidate 370 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 372 371 373 372 ++fTowerTrackAllHits; … … 409 408 if(flags & 8) ++fTowerPhotonHits; 410 409 411 particle = static_cast<Candidate 410 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 412 411 momentum = particle->Momentum; 413 412 … … 437 436 if(!fTower) return; 438 437 439 440 438 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 439 // if(ecalEnergy < 0.0) ecalEnergy = 0.0; 441 440 442 441 ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 443 442 444 445 443 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 444 // if(hcalEnergy < 0.0) hcalEnergy = 0.0; 446 445 447 446 hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); … … 449 448 energy = ecalEnergy + hcalEnergy; 450 449 451 452 450 // eta = fTowerEta; 451 // phi = fTowerPhi; 453 452 454 453 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 482 481 { 483 482 fItTowerTrackArray->Reset(); 484 while((track = static_cast<Candidate 483 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 485 484 { 486 485 fEFlowTrackOutputArray->Add(track); 487 486 } 488 487 } 489 else if(fTowerTrackAllHits > 0 && fTowerECalHits + fTowerHCalHits == fTowerAllHits) 490 { 491 if(fTowerECalHits == fTowerECalTrackHits && fTowerHCalHits == fTowerHCalTrackHits) 488 else if(fTowerTrackAllHits > 0 && 489 fTowerECalHits + fTowerHCalHits == fTowerAllHits) 490 { 491 if(fTowerECalHits == fTowerECalTrackHits && 492 fTowerHCalHits == fTowerHCalTrackHits) 492 493 { 493 494 itTowerTrackArray = fItTowerTrackArray; … … 505 506 506 507 fItTowerHCalArray->Reset(); 507 while((particle = static_cast<Candidate 508 while((particle = static_cast<Candidate*>(fItTowerHCalArray->Next()))) 508 509 { 509 510 tower->AddCandidate(particle); … … 537 538 538 539 fItTowerECalArray->Reset(); 539 while((particle = static_cast<Candidate 540 while((particle = static_cast<Candidate*>(fItTowerECalArray->Next()))) 540 541 { 541 542 tower->AddCandidate(particle); … … 566 567 { 567 568 itTowerTrackArray->Reset(); 568 while((track = static_cast<Candidate 569 while((track = static_cast<Candidate*>(itTowerTrackArray->Next()))) 569 570 { 570 571 fEFlowTrackOutputArray->Add(track); … … 586 587 if(mean > 0.0) 587 588 { 588 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean *mean))));589 a = TMath::Log(mean) - 0.5 * b *b;590 591 return TMath::Exp(a + b *gRandom->Gaus(0, 1));589 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 590 a = TMath::Log(mean) - 0.5*b*b; 591 592 return TMath::Exp(a + b*gRandom->Gaus(0, 1)); 592 593 } 593 594 else -
modules/OldCalorimeter.h
r0e7d64a re39abb4 28 28 { 29 29 public: 30 30 31 OldCalorimeter(); 31 32 ~OldCalorimeter(); … … 36 37 37 38 private: 38 typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //! 39 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 39 40 typedef std::map< Long64_t, std::pair< Double_t, Double_t > > TFractionMap; //! 41 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 40 42 41 43 Candidate *fTower; … … 49 51 TBinMap fBinMap; //! 50 52 51 std::vector <Double_t> fEtaBins;52 std::vector <std::vector<Double_t> *> fPhiBins;53 std::vector < Double_t > fEtaBins; 54 std::vector < std::vector < Double_t >* > fPhiBins; 53 55 54 std::vector <Long64_t> fTowerHits;56 std::vector < Long64_t > fTowerHits; 55 57 56 std::vector <Double_t> fECalFractions;57 std::vector <Double_t> fHCalFractions;58 std::vector < Double_t > fECalFractions; 59 std::vector < Double_t > fHCalFractions; 58 60 59 61 DelphesFormula *fECalResolutionFormula; //! -
modules/ParticlePropagator.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class ParticlePropagator 20 21 * … … 34 35 #include "classes/DelphesFormula.h" 35 36 37 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 36 39 #include "ExRootAnalysis/ExRootClassifier.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 38 #include "ExRootAnalysis/ExRootResult.h" 39 40 41 #include "TMath.h" 42 #include "TString.h" 43 #include "TFormula.h" 44 #include "TRandom3.h" 45 #include "TObjArray.h" 40 46 #include "TDatabasePDG.h" 41 #include "TFormula.h"42 47 #include "TLorentzVector.h" 43 #include "TMath.h"44 #include "TObjArray.h"45 #include "TRandom3.h"46 #include "TString.h"47 48 48 49 #include <algorithm> 50 #include <stdexcept> 49 51 #include <iostream> 50 52 #include <sstream> 51 #include <stdexcept>52 53 53 54 using namespace std; … … 66 67 } 67 68 69 68 70 //------------------------------------------------------------------------------ 69 71 … … 71 73 { 72 74 fRadius = GetDouble("Radius", 1.0); 73 fRadius2 = fRadius *fRadius;75 fRadius2 = fRadius*fRadius; 74 76 fHalfLength = GetDouble("HalfLength", 3.0); 75 77 fBz = GetDouble("Bz", 0.0); … … 138 140 const Double_t c_light = 2.99792458E8; 139 141 140 if (!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0)142 if (!fBeamSpotInputArray || fBeamSpotInputArray->GetSize () == 0) 141 143 beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0); 142 144 else 143 145 { 144 Candidate &beamSpotCandidate = *((Candidate *) fBeamSpotInputArray->At(0));146 Candidate &beamSpotCandidate = *((Candidate *) fBeamSpotInputArray->At(0)); 145 147 beamSpotPosition = beamSpotCandidate.Position; 146 148 } 147 149 148 150 fItInputArray->Reset(); 149 while((candidate = static_cast<Candidate 151 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 150 152 { 151 153 if(candidate->GetCandidates()->GetEntriesFast() == 0) … … 155 157 else 156 158 { 157 particle = static_cast<Candidate 159 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 158 160 } 159 161 160 162 particlePosition = particle->Position; 161 163 particleMomentum = particle->Momentum; 162 x = particlePosition.X() *1.0E-3;163 y = particlePosition.Y() *1.0E-3;164 z = particlePosition.Z() *1.0E-3;165 166 bsx = beamSpotPosition.X() *1.0E-3;167 bsy = beamSpotPosition.Y() *1.0E-3;168 bsz = beamSpotPosition.Z() *1.0E-3;164 x = particlePosition.X()*1.0E-3; 165 y = particlePosition.Y()*1.0E-3; 166 z = particlePosition.Z()*1.0E-3; 167 168 bsx = beamSpotPosition.X()*1.0E-3; 169 bsy = beamSpotPosition.Y()*1.0E-3; 170 bsz = beamSpotPosition.Z()*1.0E-3; 169 171 170 172 q = particle->Charge; … … 191 193 { 192 194 mother = candidate; 193 candidate = static_cast<Candidate 195 candidate = static_cast<Candidate*>(candidate->Clone()); 194 196 195 197 candidate->InitialPosition = particlePosition; … … 205 207 { 206 208 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 207 tmp = px * y - py *x;208 discr2 = pt2 * fRadius2 - tmp *tmp;209 tmp = px*y - py*x; 210 discr2 = pt2*fRadius2 - tmp*tmp; 209 211 210 212 if(discr2 < 0.0) … … 214 216 } 215 217 216 tmp = px * x + py *y;218 tmp = px*x + py*y; 217 219 discr = TMath::Sqrt(discr2); 218 t1 = (-tmp + discr) /pt2;219 t2 = (-tmp - discr) /pt2;220 t1 = (-tmp + discr)/pt2; 221 t2 = (-tmp - discr)/pt2; 220 222 t = (t1 < 0.0) ? t2 : t1; 221 223 222 z_t = z + pz *t;224 z_t = z + pz*t; 223 225 if(TMath::Abs(z_t) > fHalfLength) 224 226 { … … 228 230 } 229 231 230 x_t = x + px *t;231 y_t = y + py *t;232 z_t = z + pz *t;233 234 l = TMath::Sqrt( (x_t - x) * (x_t - x) + (y_t - y) * (y_t - y) + (z_t - z) *(z_t - z));232 x_t = x + px*t; 233 y_t = y + py*t; 234 z_t = z + pz*t; 235 236 l = TMath::Sqrt( (x_t - x)*(x_t - x) + (y_t - y)*(y_t - y) + (z_t - z)*(z_t - z)); 235 237 236 238 mother = candidate; 237 candidate = static_cast<Candidate 239 candidate = static_cast<Candidate*>(candidate->Clone()); 238 240 239 241 candidate->InitialPosition = particlePosition; 240 candidate->Position.SetXYZT(x_t * 1.0E3, y_t * 1.0E3, z_t * 1.0E3, particlePosition.T() + t * e *1.0E3);241 candidate->L = l *1.0E3;242 candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*e*1.0E3); 243 candidate->L = l*1.0E3; 242 244 243 245 candidate->Momentum = particleMomentum; … … 249 251 switch(TMath::Abs(candidate->PID)) 250 252 { 251 case 11:252 fElectronOutputArray->Add(candidate);253 break;254 case 13:255 fMuonOutputArray->Add(candidate);256 break;257 default:258 fChargedHadronOutputArray->Add(candidate);253 case 11: 254 fElectronOutputArray->Add(candidate); 255 break; 256 case 13: 257 fMuonOutputArray->Add(candidate); 258 break; 259 default: 260 fChargedHadronOutputArray->Add(candidate); 259 261 } 260 262 } 261 263 else 262 264 { 263 fNeutralOutputArray->Add(candidate);265 fNeutralOutputArray->Add(candidate); 264 266 } 265 267 } … … 273 275 // helix radius r = p_{T0} / (omega gamma m) 274 276 275 gammam = e * 1.0E9 / (c_light * c_light);// gammam in [eV/c^2]276 omega = q * fBz / (gammam); // omega is here in [89875518/s]277 r = pt / (q * fBz) * 1.0E9 / c_light;// in [m]277 gammam = e*1.0E9 / (c_light*c_light); // gammam in [eV/c^2] 278 omega = q * fBz / (gammam); // omega is here in [89875518/s] 279 r = pt / (q * fBz) * 1.0E9/c_light; // in [m] 278 280 279 281 phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi] 280 282 281 283 // 2. helix axis coordinates 282 x_c = x + r *TMath::Sin(phi_0);283 y_c = y - r *TMath::Cos(phi_0);284 x_c = x + r*TMath::Sin(phi_0); 285 y_c = y - r*TMath::Cos(phi_0); 284 286 r_c = TMath::Hypot(x_c, y_c); 285 287 phi_c = TMath::ATan2(y_c, x_c); … … 288 290 289 291 rcu = TMath::Abs(r); 290 rc2 = r_c *r_c;292 rc2 = r_c*r_c; 291 293 292 294 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 293 xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c *y_c;295 xd = x_c*x_c*x_c - x_c*rcu*r_c + x_c*y_c*y_c; 294 296 xd = (rc2 > 0.0) ? xd / rc2 : -999; 295 yd = y_c * (-rcu *r_c + rc2);297 yd = y_c*(-rcu*r_c + rc2); 296 298 yd = (rc2 > 0.0) ? yd / rc2 : -999; 297 zd = z + (TMath::Sqrt(xd * xd + yd * yd) - TMath::Sqrt(x * x + y * y)) * pz /pt;299 zd = z + (TMath::Sqrt(xd*xd + yd*yd) - TMath::Sqrt(x*x + y*y))*pz/pt; 298 300 299 301 // use perigee momentum rather than original particle … … 309 311 // calculate additional track parameters (correct for beamspot position) 310 312 311 d0 = ((x - bsx) * py - (y - bsy) * px) / pt; 312 dz = z - ((x - bsx) * px + (y - bsy) * py) / pt * (pz / pt); 313 p = particleMomentum.P(); 314 ctgTheta = 1.0 / TMath::Tan(particleMomentum.Theta()); 313 d0 = ((x - bsx) * py - (y - bsy) * px) / pt; 314 dz = z - ((x - bsx) * px + (y - bsy) * py) / pt * (pz / pt); 315 p = particleMomentum.P(); 316 ctgTheta = 1.0 / TMath::Tan (particleMomentum.Theta()); 317 315 318 316 319 // 3. time evaluation t = TMath::Min(t_r, t_z) … … 319 322 t_r = 0.0; // in [ns] 320 323 int sign_pz = (pz > 0.0) ? 1 : -1; 321 if(pz == 0.0) 322 t_z = 1.0E99; 323 else 324 t_z = gammam / (pz * 1.0E9 / c_light) * (-z + fHalfLength * sign_pz); 325 326 if(r_c + TMath::Abs(r) < fRadius) 324 if(pz == 0.0) t_z = 1.0E99; 325 else t_z = gammam / (pz*1.0E9/c_light) * (-z + fHalfLength*sign_pz); 326 327 if(r_c + TMath::Abs(r) < fRadius) 327 328 { 328 329 // helix does not cross the cylinder sides … … 331 332 else 332 333 { 333 asinrho = TMath::ASin((fRadius * fRadius - r_c * r_c - r * r) / (2 * TMath::Abs(r) *r_c));334 asinrho = TMath::ASin((fRadius*fRadius - r_c*r_c - r*r) / (2*TMath::Abs(r)*r_c)); 334 335 delta = phi_0 - phi; 335 if(delta < -TMath::Pi()) delta += 2 *TMath::Pi();336 if(delta > TMath::Pi()) delta -= 2 *TMath::Pi();336 if(delta <-TMath::Pi()) delta += 2*TMath::Pi(); 337 if(delta > TMath::Pi()) delta -= 2*TMath::Pi(); 337 338 t1 = (delta + asinrho) / omega; 338 339 t2 = (delta + TMath::Pi() - asinrho) / omega; … … 358 359 x_t = x_c + r * TMath::Sin(omega * t - phi_0); 359 360 y_t = y_c + r * TMath::Cos(omega * t - phi_0); 360 z_t = z + pz *1.0E9 / c_light / gammam * t;361 z_t = z + pz*1.0E9 / c_light / gammam * t; 361 362 r_t = TMath::Hypot(x_t, y_t); 362 363 364 363 365 // compute path length for an helix 364 366 365 alpha = pz *1.0E9 / c_light / gammam;366 l = t * TMath::Sqrt(alpha * alpha + r * r * omega *omega);367 alpha = pz*1.0E9 / c_light / gammam; 368 l = t * TMath::Sqrt(alpha*alpha + r*r*omega*omega); 367 369 368 370 if(r_t > 0.0) … … 372 374 if(particle == candidate) 373 375 { 374 particle->D0 = d0 *1.0E3;375 particle->DZ = dz *1.0E3;376 particle->D0 = d0*1.0E3; 377 particle->DZ = dz*1.0E3; 376 378 particle->P = p; 377 379 particle->PT = pt; … … 381 383 382 384 mother = candidate; 383 candidate = static_cast<Candidate 385 candidate = static_cast<Candidate*>(candidate->Clone()); 384 386 385 387 candidate->InitialPosition = particlePosition; 386 candidate->Position.SetXYZT(x_t * 1.0E3, y_t * 1.0E3, z_t * 1.0E3, particlePosition.T() + t * c_light *1.0E3);388 candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*c_light*1.0E3); 387 389 388 390 candidate->Momentum = particleMomentum; 389 391 390 candidate->L = l *1.0E3;391 392 candidate->Xd = xd *1.0E3;393 candidate->Yd = yd *1.0E3;394 candidate->Zd = zd *1.0E3;392 candidate->L = l*1.0E3; 393 394 candidate->Xd = xd*1.0E3; 395 candidate->Yd = yd*1.0E3; 396 candidate->Zd = zd*1.0E3; 395 397 396 398 candidate->AddCandidate(mother); … … 399 401 switch(TMath::Abs(candidate->PID)) 400 402 { 401 case 11:402 fElectronOutputArray->Add(candidate);403 break;404 case 13:405 fMuonOutputArray->Add(candidate);406 break;407 default:408 fChargedHadronOutputArray->Add(candidate);403 case 11: 404 fElectronOutputArray->Add(candidate); 405 break; 406 case 13: 407 fMuonOutputArray->Add(candidate); 408 break; 409 default: 410 fChargedHadronOutputArray->Add(candidate); 409 411 } 410 412 } … … 414 416 415 417 //------------------------------------------------------------------------------ 418 -
modules/ParticlePropagator.h
r0e7d64a re39abb4 40 40 { 41 41 public: 42 42 43 ParticlePropagator(); 43 44 ~ParticlePropagator(); … … 48 49 49 50 private: 51 50 52 Double_t fRadius, fRadius2, fRadiusMax, fHalfLength, fHalfLengthMax; 51 53 Double_t fBz; -
modules/PdgCodeFilter.cc
r0e7d64a re39abb4 31 31 #include "classes/DelphesFormula.h" 32 32 33 #include "ExRootAnalysis/ExRootResult.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 33 35 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 36 37 #include "TMath.h" 38 #include "TString.h" 39 #include "TFormula.h" 40 #include "TRandom3.h" 41 #include "TObjArray.h" 37 42 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 43 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 44 45 45 #include <algorithm> 46 #include <stdexcept> 46 47 #include <iostream> 47 48 #include <sstream> 48 #include <stdexcept>49 49 50 50 using namespace std; … … 75 75 76 76 fInvert = GetBool("Invert", false); 77 78 // no pileup79 fRequireNotPileup = GetBool("RequireNotPileup", false);80 77 81 78 fRequireStatus = GetBool("RequireStatus", false); … … 121 118 122 119 fItInputArray->Reset(); 123 while((candidate = static_cast<Candidate 120 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 124 121 { 125 122 pdgCode = candidate->PID; … … 130 127 if(fRequireStatus && (candidate->Status != fStatus)) continue; 131 128 if(fRequireCharge && (candidate->Charge != fCharge)) continue; 132 if(fRequireNotPileup && (candidate->IsPU > 0)) continue;133 129 134 130 pass = kTRUE; … … 139 135 } 140 136 } 137 -
modules/PdgCodeFilter.h
r0e7d64a re39abb4 39 39 { 40 40 public: 41 41 42 PdgCodeFilter(); 42 43 ~PdgCodeFilter(); … … 47 48 48 49 private: 50 49 51 Double_t fPTMin; //! 50 52 Bool_t fInvert; //! … … 53 55 Bool_t fRequireCharge; //! 54 56 Int_t fCharge; //! 55 Bool_t fRequireNotPileup; //! 57 56 58 57 59 std::vector<Int_t> fPdgCodes; -
modules/PhotonConversions.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class PhotonConversions 20 21 * … … 29 30 30 31 #include "classes/DelphesClasses.h" 32 #include "classes/DelphesFactory.h" 31 33 #include "classes/DelphesCylindricalFormula.h" 32 #include "classes/DelphesFactory.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 38 39 #include "TMath.h" 40 #include "TF1.h" 41 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 38 45 #include "TDatabasePDG.h" 39 #include "TF1.h"40 #include "TFormula.h"41 46 #include "TLorentzVector.h" 42 #include "TMath.h"43 #include "TObjArray.h"44 #include "TRandom3.h"45 #include "TString.h"46 47 #include "TVector3.h" 47 48 48 49 #include <algorithm> 50 #include <stdexcept> 49 51 #include <iostream> 50 52 #include <sstream> 51 #include <stdexcept>52 53 53 54 using namespace std; … … 58 59 fItInputArray(0), fConversionMap(0), fDecayXsec(0) 59 60 { 60 fDecayXsec = new TF1("decayXsec", 61 fDecayXsec = new TF1("decayXsec","1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0); 61 62 fConversionMap = new DelphesCylindricalFormula; 62 63 } … … 73 74 { 74 75 fRadius = GetDouble("Radius", 1.0); 75 fRadius2 = fRadius *fRadius;76 fRadius2 = fRadius*fRadius; 76 77 77 78 fHalfLength = GetDouble("HalfLength", 3.0); … … 121 122 122 123 fItInputArray->Reset(); 123 while((candidate = static_cast<Candidate 124 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 124 125 { 125 126 … … 132 133 candidatePosition = candidate->Position; 133 134 candidateMomentum = candidate->Momentum; 134 x = candidatePosition.X() *1.0E-3;135 y = candidatePosition.Y() *1.0E-3;136 z = candidatePosition.Z() *1.0E-3;135 x = candidatePosition.X()*1.0E-3; 136 y = candidatePosition.Y()*1.0E-3; 137 z = candidatePosition.Z()*1.0E-3; 137 138 138 139 // check that particle position is inside the cylinder … … 151 152 152 153 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 153 tmp = px * y - py *x;154 discr2 = pt2 * fRadius2 - tmp *tmp;154 tmp = px*y - py*x; 155 discr2 = pt2*fRadius2 - tmp*tmp; 155 156 156 157 if(discr2 < 0.0) … … 160 161 } 161 162 162 tmp = px * x + py *y;163 tmp = px*x + py*y; 163 164 discr = TMath::Sqrt(discr2); 164 t1 = (-tmp + discr) /pt2;165 t2 = (-tmp - discr) /pt2;165 t1 = (-tmp + discr)/pt2; 166 t2 = (-tmp - discr)/pt2; 166 167 t = (t1 < 0.0) ? t2 : t1; 167 168 168 z_t = z + pz *t;169 z_t = z + pz*t; 169 170 if(TMath::Abs(z_t) > fHalfLength) 170 171 { … … 175 176 176 177 // final position 177 x_t = x + px * t; 178 y_t = y + py * t; 179 z_t = z + pz * t; 180 181 r_t = TMath::Sqrt(x_t * x_t + y_t * y_t + z_t * z_t); 178 x_t = x + px*t; 179 y_t = y + py*t; 180 z_t = z + pz*t; 181 182 r_t = TMath::Sqrt(x_t*x_t + y_t*y_t + z_t*z_t); 183 182 184 183 185 // here starts conversion code 184 nsteps = Int_t(r_t /fStep);186 nsteps = Int_t(r_t/fStep); 185 187 186 188 x_i = x; … … 188 190 z_i = z; 189 191 190 dt = t /nsteps;192 dt = t/nsteps; 191 193 192 194 converted = false; … … 194 196 for(i = 0; i < nsteps; ++i) 195 197 { 196 x_i += px *dt;197 y_i += py *dt;198 z_i += pz *dt;199 pos_i.SetXYZ(x_i, y_i,z_i);198 x_i += px*dt; 199 y_i += py*dt; 200 z_i += pz*dt; 201 pos_i.SetXYZ(x_i,y_i,z_i); 200 202 201 203 // convert photon position into cylindrical coordinates, cylindrical r,phi,z !! 202 204 203 r_i = TMath::Sqrt(x_i * x_i + y_i *y_i);205 r_i = TMath::Sqrt(x_i*x_i + y_i*y_i); 204 206 phi_i = pos_i.Phi(); 205 207 … … 208 210 209 211 // convert into conversion probability 210 p_conv = 1 - TMath::Exp(-7.0 / 9.0 * fStep *rate);212 p_conv = 1 - TMath::Exp(-7.0/9.0*fStep*rate); 211 213 212 214 // case conversion occurs … … 219 221 x2 = 1 - x1; 220 222 221 ep = static_cast<Candidate 222 em = static_cast<Candidate 223 224 ep->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e *1.0E3);225 em->Position.SetXYZT(x_i * 1.0E3, y_i * 1.0E3, z_i * 1.0E3, candidatePosition.T() + nsteps * dt * e *1.0E3);226 227 ep->Momentum.SetPtEtaPhiE(x1 * pt, eta, phi, x1 *e);228 em->Momentum.SetPtEtaPhiE(x2 * pt, eta, phi, x2 *e);223 ep = static_cast<Candidate*>(candidate->Clone()); 224 em = static_cast<Candidate*>(candidate->Clone()); 225 226 ep->Position.SetXYZT(x_i*1.0E3, y_i*1.0E3, z_i*1.0E3, candidatePosition.T() + nsteps*dt*e*1.0E3); 227 em->Position.SetXYZT(x_i*1.0E3, y_i*1.0E3, z_i*1.0E3, candidatePosition.T() + nsteps*dt*e*1.0E3); 228 229 ep->Momentum.SetPtEtaPhiE(x1*pt, eta, phi, x1*e); 230 em->Momentum.SetPtEtaPhiE(x2*pt, eta, phi, x2*e); 229 231 230 232 ep->PID = -11; … … 249 251 250 252 //------------------------------------------------------------------------------ 253 -
modules/PhotonConversions.h
r0e7d64a re39abb4 38 38 { 39 39 public: 40 40 41 PhotonConversions(); 41 42 ~PhotonConversions(); … … 46 47 47 48 private: 49 48 50 Double_t fRadius, fRadius2, fHalfLength; 49 51 Double_t fEtaMin, fEtaMax; -
modules/PhotonID.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class PhotonID 20 21 * … … 33 34 #include "classes/DelphesFormula.h" 34 35 36 #include "ExRootAnalysis/ExRootResult.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 35 38 #include "ExRootAnalysis/ExRootClassifier.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootResult.h" 38 39 40 #include "TMath.h" 41 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 39 45 #include "TDatabasePDG.h" 40 #include "TFormula.h"41 46 #include "TLorentzVector.h" 42 #include "TMath.h" 43 #include "TObjArray.h" 44 #include "TRandom3.h" 45 #include "TString.h" 46 47 #include <algorithm> 47 48 #include <algorithm> 49 #include <stdexcept> 48 50 #include <iostream> 49 51 #include <sstream> 50 #include <stdexcept>51 52 52 53 using namespace std; … … 55 56 56 57 PhotonID::PhotonID() : 57 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0)58 { 59 fPromptFormula= new DelphesFormula;60 fNonPromptFormula= new DelphesFormula;61 fFakeFormula= new DelphesFormula;58 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0) 59 { 60 fPromptFormula = new DelphesFormula; 61 fNonPromptFormula = new DelphesFormula; 62 fFakeFormula = new DelphesFormula; 62 63 } 63 64 … … 80 81 fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0")); 81 82 fFakeFormula->Compile(GetString("FakeFormula", "1.0")); 82 83 83 84 // import input arrays 84 85 fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons")); … … 110 111 111 112 void PhotonID::Process() 112 { 113 { 113 114 Candidate *candidate, *mother; 114 115 Double_t pt, eta, phi, e; 115 116 Double_t relIso; 116 117 Bool_t isolated; 117 118 118 119 //cout<< "---- new event ---------"<<endl; 119 120 120 121 fItInputPhotonArray->Reset(); 121 while((candidate = static_cast<Candidate 122 while((candidate = static_cast<Candidate*>(fItInputPhotonArray->Next()))) 122 123 { 123 124 124 125 mother = candidate; 125 candidate = static_cast<Candidate 126 candidate = static_cast<Candidate*>(candidate->Clone()); 126 127 candidate->AddCandidate(mother); 127 128 … … 133 134 e = candidateMomentum.E(); 134 135 135 if (pt < fPTMin) continue;136 if (pt < fPTMin) continue; 136 137 137 138 //cout<< " ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl; 138 139 139 140 // find out if photon matches does not match photon in gen collection and apply fae efficiency 140 if (isFake(candidate))141 if (isFake(candidate) ) 141 142 { 142 143 //cout<<" Fake!"<<endl; … … 156 157 157 158 // if isolated apply prompt formula 158 if (isolated)159 if (isolated) 159 160 { 160 161 //cout<<" isolated!: "<<relIso<<endl; … … 163 164 candidate->Status = 1; 164 165 fOutputArray->Add(candidate); 166 165 167 } 166 168 167 169 // if non-isolated apply non-prompt formula 168 170 else … … 180 182 //------------------------------------------------------------------------------ 181 183 182 Bool_t PhotonID::isFake(const Candidate *obj) 183 { 184 Bool_t PhotonID::isFake(const Candidate *obj){ 184 185 185 186 const TLorentzVector &mom_rec = obj->Momentum; 186 187 187 188 Bool_t matches = false; 188 189 fItInputGenArray->Reset(); 189 190 Candidate *gen; 190 191 while((gen = static_cast<Candidate 191 192 while((gen = static_cast<Candidate*>(fItInputGenArray->Next()))) 192 193 { 193 194 const TLorentzVector &mom_gen = gen->Momentum; 194 195 Int_t status = gen->Status; 195 196 Int_t pdgCode = TMath::Abs(gen->PID); 196 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) /mom_rec.Pt());197 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt())/mom_rec.Pt()); 197 198 Float_t deltaR = mom_gen.DeltaR(mom_rec); 198 199 199 if (status != 1) continue;200 if (pdgCode != 22) continue;201 if (dPtOverPt > 0.5) continue;202 if (deltaR > 0.1) continue;200 if (status != 1) continue; 201 if (pdgCode != 22) continue; 202 if (dPtOverPt > 0.5) continue; 203 if (deltaR > 0.1) continue; 203 204 204 205 matches = true; 205 206 break; 207 206 208 } 207 209 -
modules/PhotonID.h
r0e7d64a re39abb4 40 40 { 41 41 public: 42 42 43 PhotonID(); 43 44 ~PhotonID(); … … 48 49 49 50 private: 51 50 52 DelphesFormula *fPromptFormula; 51 53 DelphesFormula *fNonPromptFormula; 52 54 DelphesFormula *fFakeFormula; 53 55 54 56 // import input arrays 55 57 const TObjArray *fInputPhotonArray; -
modules/PileUpJetID.cc
r0e7d64a re39abb4 14 14 #include "classes/DelphesFormula.h" 15 15 16 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 16 18 #include "ExRootAnalysis/ExRootClassifier.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 18 #include " ExRootAnalysis/ExRootResult.h"19 19 20 #include "TMath.h" 21 #include "TString.h" 20 22 #include "TFormula.h" 21 #include "T Math.h"23 #include "TRandom3.h" 22 24 #include "TObjArray.h" 23 #include "TRandom3.h"24 #include "TString.h"25 25 //#include "TDatabasePDG.h" 26 26 #include "TLorentzVector.h" 27 27 28 28 #include <algorithm> 29 #include <stdexcept> 29 30 #include <iostream> 30 31 #include <sstream> 31 #include <stdexcept>32 32 33 33 using namespace std; … … 36 36 37 37 PileUpJetID::PileUpJetID() : 38 fItJetInputArray(0), fTrackInputArray(0), fNeutralInputArray(0) 39 { 38 fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0) 39 { 40 40 41 } 41 42 … … 44 45 PileUpJetID::~PileUpJetID() 45 46 { 47 46 48 } 47 49 … … 55 57 fUseConstituents = GetInt("UseConstituents", 0); 56 58 57 fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel", 58 fBetaMinBarrel = GetDouble("BetaMinBarrel", 59 fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap", 60 fBetaMinEndcap = GetDouble("BetaMinEndcap", 61 fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward", 59 fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1); 60 fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1); 61 fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1); 62 fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1); 63 fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1); 62 64 fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0); 63 65 fNeutralPTMin = GetDouble("NeutralPTMin", 2.0); … … 80 82 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 81 83 82 fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets", "eflowtowers")); 84 fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers")); 85 83 86 } 84 87 … … 92 95 if(fItTrackInputArray) delete fItTrackInputArray; 93 96 if(fItNeutralInputArray) delete fItNeutralInputArray; 97 94 98 } 95 99 … … 105 109 // loop over all input candidates 106 110 fItJetInputArray->Reset(); 107 while((candidate = static_cast<Candidate 111 while((candidate = static_cast<Candidate*>(fItJetInputArray->Next()))) 108 112 { 109 113 momentum = candidate->Momentum; … … 129 133 float pt_ann[5]; 130 134 131 for(int i = 0; i < 5; i++) 132 { 135 for (int i = 0 ; i < 5 ; i++) { 133 136 pt_ann[i] = 0.; 134 137 } 135 138 136 if(fUseConstituents) 137 { 139 if (fUseConstituents) { 138 140 TIter itConstituents(candidate->GetCandidates()); 139 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 140 { 141 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) { 141 142 float pt = constituent->Momentum.Pt(); 142 143 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 143 // cout << " There exists a constituent with dr=" << dr << endl; 144 sumpt += pt; 145 sumdrsqptsq += dr * dr * pt * pt; 146 sumptsq += pt * pt; 147 if(constituent->Charge == 0) 148 { 149 nn++; 150 } 151 else 152 { 153 if(constituent->IsRecoPU) 154 { 155 sumptchpu += pt; 156 } 157 else 158 { 159 sumptchpv += pt; 160 } 161 sumptch += pt; 162 nc++; 163 } 164 for(int i = 0; i < 5; i++) 165 { 166 if(dr > 0.1 * i && dr < 0.1 * (i + 1)) 167 { 168 pt_ann[i] += pt; 169 } 170 } 171 float tow_sumT = 0; 172 float tow_sumW = 0; 173 for(int i = 0; i < constituent->ECalEnergyTimePairs.size(); i++) 174 { 175 float w = TMath::Sqrt(constituent->ECalEnergyTimePairs[i].first); 176 if(fAverageEachTower) 177 { 178 tow_sumT += w * constituent->ECalEnergyTimePairs[i].second; 144 // cout << " There exists a constituent with dr=" << dr << endl; 145 sumpt += pt; 146 sumdrsqptsq += dr*dr*pt*pt; 147 sumptsq += pt*pt; 148 if (constituent->Charge == 0) { 149 nn++; 150 } else { 151 if (constituent->IsRecoPU) { 152 sumptchpu += pt; 153 } else { 154 sumptchpv += pt; 155 } 156 sumptch += pt; 157 nc++; 158 } 159 for (int i = 0 ; i < 5 ; i++) { 160 if (dr > 0.1*i && dr < 0.1*(i+1)) { 161 pt_ann[i] += pt; 162 } 163 } 164 float tow_sumT = 0; 165 float tow_sumW = 0; 166 for (int i = 0 ; i < constituent->ECalEnergyTimePairs.size() ; i++) { 167 float w = TMath::Sqrt(constituent->ECalEnergyTimePairs[i].first); 168 if (fAverageEachTower) { 169 tow_sumT += w*constituent->ECalEnergyTimePairs[i].second; 179 170 tow_sumW += w; 180 } 181 else 182 { 183 sumT0 += w * constituent->ECalEnergyTimePairs[i].second; 184 sumT1 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.001); 185 sumT10 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.010); 186 sumT20 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.020); 187 sumT30 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.030); 188 sumT40 += w * gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second, 0.040); 189 sumWeightsForT += w; 190 candidate->NTimeHits++; 191 } 192 } 193 if(fAverageEachTower && tow_sumW > 0.) 194 { 195 sumT0 += tow_sumT; 196 sumT1 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.001); 197 sumT10 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0010); 198 sumT20 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0020); 199 sumT30 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0030); 200 sumT40 += tow_sumW * gRandom->Gaus(tow_sumT / tow_sumW, 0.0040); 201 sumWeightsForT += tow_sumW; 202 candidate->NTimeHits++; 203 } 204 } 205 } 206 else 207 { 171 } else { 172 sumT0 += w*constituent->ECalEnergyTimePairs[i].second; 173 sumT1 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.001); 174 sumT10 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.010); 175 sumT20 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.020); 176 sumT30 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.030); 177 sumT40 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.040); 178 sumWeightsForT += w; 179 candidate->NTimeHits++; 180 } 181 } 182 if (fAverageEachTower && tow_sumW > 0.) { 183 sumT0 += tow_sumT; 184 sumT1 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.001); 185 sumT10 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0010); 186 sumT20 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0020); 187 sumT30 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0030); 188 sumT40 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0040); 189 sumWeightsForT += tow_sumW; 190 candidate->NTimeHits++; 191 } 192 } 193 } else { 208 194 // Not using constituents, using dr 209 195 fItTrackInputArray->Reset(); 210 while((trk = static_cast<Candidate *>(fItTrackInputArray->Next()))) 211 { 212 if(trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) 213 { 214 float pt = trk->Momentum.Pt(); 215 sumpt += pt; 216 sumptch += pt; 217 if(trk->IsRecoPU) 218 { 219 sumptchpu += pt; 220 } 221 else 222 { 223 sumptchpv += pt; 224 } 225 float dr = candidate->Momentum.DeltaR(trk->Momentum); 226 sumdrsqptsq += dr * dr * pt * pt; 227 sumptsq += pt * pt; 228 nc++; 229 for(int i = 0; i < 5; i++) 230 { 231 if(dr > 0.1 * i && dr < 0.1 * (i + 1)) 232 { 233 pt_ann[i] += pt; 234 } 235 } 236 } 196 while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) { 197 if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) { 198 float pt = trk->Momentum.Pt(); 199 sumpt += pt; 200 sumptch += pt; 201 if (trk->IsRecoPU) { 202 sumptchpu += pt; 203 } else { 204 sumptchpv += pt; 205 } 206 float dr = candidate->Momentum.DeltaR(trk->Momentum); 207 sumdrsqptsq += dr*dr*pt*pt; 208 sumptsq += pt*pt; 209 nc++; 210 for (int i = 0 ; i < 5 ; i++) { 211 if (dr > 0.1*i && dr < 0.1*(i+1)) { 212 pt_ann[i] += pt; 213 } 214 } 215 } 237 216 } 238 217 fItNeutralInputArray->Reset(); 239 while((constituent = static_cast<Candidate *>(fItNeutralInputArray->Next()))) 240 { 241 if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) 242 { 243 float pt = constituent->Momentum.Pt(); 244 sumpt += pt; 245 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 246 sumdrsqptsq += dr * dr * pt * pt; 247 sumptsq += pt * pt; 248 nn++; 249 for(int i = 0; i < 5; i++) 250 { 251 if(dr > 0.1 * i && dr < 0.1 * (i + 1)) 252 { 253 pt_ann[i] += pt; 254 } 255 } 256 } 257 } 258 } 259 260 if(sumptch > 0.) 261 { 262 candidate->Beta = sumptchpv / sumptch; 263 candidate->BetaStar = sumptchpu / sumptch; 264 } 265 else 266 { 218 while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) { 219 if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) { 220 float pt = constituent->Momentum.Pt(); 221 sumpt += pt; 222 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 223 sumdrsqptsq += dr*dr*pt*pt; 224 sumptsq += pt*pt; 225 nn++; 226 for (int i = 0 ; i < 5 ; i++) { 227 if (dr > 0.1*i && dr < 0.1*(i+1)) { 228 pt_ann[i] += pt; 229 } 230 } 231 } 232 } 233 } 234 235 if (sumptch > 0.) { 236 candidate->Beta = sumptchpv/sumptch; 237 candidate->BetaStar = sumptchpu/sumptch; 238 } else { 267 239 candidate->Beta = -999.; 268 240 candidate->BetaStar = -999.; 269 241 } 270 if(sumptsq > 0.) 271 { 272 candidate->MeanSqDeltaR = sumdrsqptsq / sumptsq; 273 } 274 else 275 { 242 if (sumptsq > 0.) { 243 candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq; 244 } else { 276 245 candidate->MeanSqDeltaR = -999.; 277 246 } 278 247 candidate->NCharged = nc; 279 248 candidate->NNeutrals = nn; 280 if(sumpt > 0.) 281 { 249 if (sumpt > 0.) { 282 250 candidate->PTD = TMath::Sqrt(sumptsq) / sumpt; 283 for(int i = 0; i < 5; i++) 284 { 285 candidate->FracPt[i] = pt_ann[i] / sumpt; 286 } 287 } 288 else 289 { 251 for (int i = 0 ; i < 5 ; i++) { 252 candidate->FracPt[i] = pt_ann[i]/sumpt; 253 } 254 } else { 290 255 candidate->PTD = -999.; 291 for(int i = 0; i < 5; i++) 292 { 256 for (int i = 0 ; i < 5 ; i++) { 293 257 candidate->FracPt[i] = -999.; 294 258 } … … 307 271 308 272 bool passId = false; 309 if(candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) 310 { 311 if(fabs(candidate->Momentum.Eta()) < 1.5) 312 { 313 passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel)); 314 } 315 else if(fabs(candidate->Momentum.Eta()) < 4.0) 316 { 317 passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap)); 318 } 319 else 320 { 321 passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward); 322 } 323 } 324 325 // cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt() 273 if (candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) { 274 if (fabs(candidate->Momentum.Eta())<1.5) { 275 passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel)); 276 } else if (fabs(candidate->Momentum.Eta())<4.0) { 277 passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap)); 278 } else { 279 passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward); 280 } 281 } 282 283 // cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt() 326 284 // << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl; 327 285 328 if(passId) 329 { 330 if(fUseConstituents) 331 { 332 TIter itConstituents(candidate->GetCandidates()); 333 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 334 { 335 if(constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) 336 { 337 fNeutralsInPassingJets->Add(constituent); 338 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 339 } 340 } 341 } 342 else 343 { // use DeltaR 344 fItNeutralInputArray->Reset(); 345 while((constituent = static_cast<Candidate *>(fItNeutralInputArray->Next()))) 346 { 347 if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) 348 { 349 fNeutralsInPassingJets->Add(constituent); 350 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 351 } 352 } 353 } 354 } 286 if (passId) { 287 if (fUseConstituents) { 288 TIter itConstituents(candidate->GetCandidates()); 289 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) { 290 if (constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) { 291 fNeutralsInPassingJets->Add(constituent); 292 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 293 } 294 } 295 } else { // use DeltaR 296 fItNeutralInputArray->Reset(); 297 while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) { 298 if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) { 299 fNeutralsInPassingJets->Add(constituent); 300 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 301 } 302 } 303 } 304 } 305 306 355 307 } 356 308 } -
modules/PileUpJetID.h
r0e7d64a re39abb4 10 10 */ 11 11 12 12 13 #include "classes/DelphesModule.h" 13 14 … … 20 21 { 21 22 public: 23 22 24 PileUpJetID(); 23 25 ~PileUpJetID(); … … 28 30 29 31 private: 32 30 33 Double_t fJetPTMin; 31 34 Double_t fParameterR; … … 85 88 // If set to false, uses everything within dR < fParameterR even if in other jets &c. 86 89 // Results should be very similar for PF 87 Int_t fUseConstituents; 90 Int_t fUseConstituents; 88 91 89 92 Bool_t fAverageEachTower; … … 94 97 95 98 const TObjArray *fTrackInputArray; // SCZ 96 const TObjArray *fNeutralInputArray; 99 const TObjArray *fNeutralInputArray; 97 100 98 101 TIterator *fItTrackInputArray; // SCZ … … 102 105 TObjArray *fNeutralsInPassingJets; // SCZ 103 106 107 104 108 ClassDef(PileUpJetID, 2) 105 109 }; -
modules/PileUpMerger.cc
r0e7d64a re39abb4 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/DelphesTF2.h" 31 32 #include "classes/DelphesPileUpReader.h" 32 #include "classes/DelphesTF2.h" 33 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 38 43 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 44 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept> 47 48 #include <iostream> 48 49 #include <sstream> 49 #include <stdexcept>50 50 51 51 using namespace std; … … 59 59 } 60 60 61 61 62 //------------------------------------------------------------------------------ 62 63 … … 74 75 fPileUpDistribution = GetInt("PileUpDistribution", 0); 75 76 76 fMeanPileUp = GetDouble("MeanPileUp", 10);77 fMeanPileUp = GetDouble("MeanPileUp", 10); 77 78 78 79 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); … … 134 135 dt0 = -1.0e6; 135 136 136 dt *= c_light *1.0E3; // necessary in order to make t in mm/c137 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 137 138 dz *= 1.0E3; // necessary in order to make z in mm 138 139 … … 149 150 vertex = factory->NewCandidate(); 150 151 151 while((candidate = static_cast<Candidate 152 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 152 153 { 153 154 vx += candidate->Position.X(); … … 158 159 159 160 // take postion and time from first stable particle 160 if (dz0 < -999999.0)161 if (dz0 < -999999.0) 161 162 dz0 = z; 162 if (dt0 < -999999.0)163 if (dt0 < -999999.0) 163 164 dt0 = t; 164 165 … … 171 172 fParticleOutputArray->Add(candidate); 172 173 173 if(TMath::Abs(candidate->Charge) > 1.0E-9)174 if(TMath::Abs(candidate->Charge) > 1.0E-9) 174 175 { 175 176 nch++; 176 sumpt2 += pt *pt;177 sumpt2 += pt*pt; 177 178 vertex->AddCandidate(candidate); 178 179 } … … 197 198 switch(fPileUpDistribution) 198 199 { 199 case 0:200 numberOfEvents = gRandom->Poisson(fMeanPileUp);201 break;202 case 1:203 numberOfEvents = gRandom->Integer(2 *fMeanPileUp + 1);204 break;205 case 2:206 numberOfEvents = fMeanPileUp;207 break;208 default:209 numberOfEvents = gRandom->Poisson(fMeanPileUp);210 break;200 case 0: 201 numberOfEvents = gRandom->Poisson(fMeanPileUp); 202 break; 203 case 1: 204 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1); 205 break; 206 case 2: 207 numberOfEvents = fMeanPileUp; 208 break; 209 default: 210 numberOfEvents = gRandom->Poisson(fMeanPileUp); 211 break; 211 212 } 212 213 213 214 allEntries = fReader->GetEntries(); 215 214 216 215 217 for(event = 0; event < numberOfEvents; ++event) … … 217 219 do 218 220 { 219 entry = TMath::Nint(gRandom->Rndm() * allEntries); 220 } while(entry >= allEntries); 221 entry = TMath::Nint(gRandom->Rndm()*allEntries); 222 } 223 while(entry >= allEntries); 221 224 222 225 fReader->ReadEntry(entry); 223 226 224 227 // --- Pile-up vertex smearing 225 228 226 229 fFunction->GetRandom2(dz, dt); 227 230 228 dt *= c_light *1.0E3; // necessary in order to make t in mm/c231 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 229 232 dz *= 1.0E3; // necessary in order to make z in mm 230 233 … … 249 252 250 253 pdgParticle = pdg->GetParticle(pid); 251 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;254 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 252 255 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 253 256 … … 268 271 269 272 ++numberOfParticles; 270 if(TMath::Abs(candidate->Charge) > 1.0E-9)273 if(TMath::Abs(candidate->Charge) > 1.0E-9) 271 274 { 272 275 nch++; 273 sumpt2 += pt *pt;276 sumpt2 += pt*pt; 274 277 vertex->AddCandidate(candidate); 275 278 } … … 296 299 297 300 fVertexOutputArray->Add(vertex); 301 298 302 } 299 303 } -
modules/PileUpMerger.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 PileUpMerger(); 40 41 ~PileUpMerger(); … … 45 46 46 47 private: 48 47 49 Int_t fPileUpDistribution; 48 50 Double_t fMeanPileUp; -
modules/PileUpMergerPythia8.cc
r0e7d64a re39abb4 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/DelphesTF2.h" 31 32 #include "classes/DelphesPileUpReader.h" 32 #include "classes/DelphesTF2.h" 33 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootResult.h"37 37 38 38 #include "Pythia.h" 39 39 40 #include "TMath.h" 41 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 40 45 #include "TDatabasePDG.h" 41 #include "TFormula.h"42 46 #include "TLorentzVector.h" 43 #include "TMath.h"44 #include "TObjArray.h"45 #include "TRandom3.h"46 #include "TString.h"47 47 48 48 #include <algorithm> 49 #include <stdexcept> 49 50 #include <iostream> 50 51 #include <sstream> 51 #include <stdexcept>52 52 53 53 using namespace std; … … 76 76 fPileUpDistribution = GetInt("PileUpDistribution", 0); 77 77 78 fMeanPileUp = GetDouble("MeanPileUp", 10);78 fMeanPileUp = GetDouble("MeanPileUp", 10); 79 79 80 80 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); … … 133 133 fFunction->GetRandom2(dz, dt); 134 134 135 dt *= c_light *1.0E3; // necessary in order to make t in mm/c135 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 136 136 dz *= 1.0E3; // necessary in order to make z in mm 137 137 vx = 0.0; 138 138 vy = 0.0; 139 139 numberOfParticles = fInputArray->GetEntriesFast(); 140 while((candidate = static_cast<Candidate 140 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 141 141 { 142 142 vx += candidate->Position.X(); … … 165 165 switch(fPileUpDistribution) 166 166 { 167 case 0:168 numberOfEvents = gRandom->Poisson(fMeanPileUp);169 break;170 case 1:171 numberOfEvents = gRandom->Integer(2 *fMeanPileUp + 1);172 break;173 default:174 numberOfEvents = gRandom->Poisson(fMeanPileUp);175 break;167 case 0: 168 numberOfEvents = gRandom->Poisson(fMeanPileUp); 169 break; 170 case 1: 171 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1); 172 break; 173 default: 174 numberOfEvents = gRandom->Poisson(fMeanPileUp); 175 break; 176 176 } 177 177 178 178 for(event = 0; event < numberOfEvents; ++event) 179 179 { 180 while(!fPythia->next()) 181 ; 182 183 // --- Pile-up vertex smearing 180 while(!fPythia->next()); 181 182 // --- Pile-up vertex smearing 184 183 185 184 fFunction->GetRandom2(dz, dt); 186 185 187 dt *= c_light *1.0E3; // necessary in order to make t in mm/c186 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 188 187 dz *= 1.0E3; // necessary in order to make z in mm 189 188 … … 202 201 203 202 pid = particle.id(); 204 px = particle.px(); 205 py = particle.py(); 206 pz = particle.pz(); 207 e = particle.e(); 208 x = particle.xProd(); 209 y = particle.yProd(); 210 z = particle.zProd(); 211 t = particle.tProd(); 203 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.e(); 204 x = particle.xProd(); y = particle.yProd(); z = particle.zProd(); t = particle.tProd(); 212 205 213 206 candidate = factory->NewCandidate(); … … 218 211 219 212 pdgParticle = pdg->GetParticle(pid); 220 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;213 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 221 214 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 222 215 -
modules/PileUpMergerPythia8.h
r0e7d64a re39abb4 35 35 namespace Pythia8 36 36 { 37 class Pythia;37 class Pythia; 38 38 }; 39 39 … … 41 41 { 42 42 public: 43 43 44 PileUpMergerPythia8(); 44 45 ~PileUpMergerPythia8(); … … 49 50 50 51 private: 52 51 53 Int_t fPileUpDistribution; 52 54 Double_t fMeanPileUp; -
modules/RecoPuFilter.cc
r0e7d64a re39abb4 32 32 #include "classes/DelphesFormula.h" 33 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootResult.h"37 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 38 43 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 44 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept> 47 48 #include <iostream> 48 49 #include <sstream> 49 #include <stdexcept>50 50 51 51 using namespace std; … … 97 97 98 98 fItInputArray->Reset(); 99 while((candidate = static_cast<Candidate 99 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 100 100 { 101 101 if(candidate->IsRecoPU) continue; … … 103 103 } 104 104 } 105 -
modules/RecoPuFilter.h
r0e7d64a re39abb4 40 40 { 41 41 public: 42 42 43 RecoPuFilter(); 43 44 ~RecoPuFilter(); … … 48 49 49 50 private: 51 50 52 TIterator *fItInputArray; //! 51 53 -
modules/RunPUPPI.cc
r0e7d64a re39abb4 1 1 #include "modules/RunPUPPI.h" 2 2 3 #include "PUPPI/RecoObj2.hh" 3 4 #include "PUPPI/AlgoObj.hh" 4 5 #include "PUPPI/PuppiContainer.hh" 5 #include "PUPPI/RecoObj2.hh"6 6 7 7 #include "fastjet/PseudoJet.hh" … … 11 11 #include "classes/DelphesFormula.h" 12 12 13 #include <algorithm> 13 #include <algorithm> 14 #include <stdexcept> 14 15 #include <iostream> 15 16 #include <sstream> 16 #include <stdexcept>17 17 #include <vector> 18 18 … … 22 22 //------------------------------------------------------------------------------ 23 23 RunPUPPI::RunPUPPI() : 24 fItTrackInputArray(0), 24 fItTrackInputArray(0), 25 25 fItNeutralInputArray(0) 26 { 27 } 28 29 //------------------------------------------------------------------------------ 30 RunPUPPI::~RunPUPPI() {} 31 32 //------------------------------------------------------------------------------ 33 34 void RunPUPPI::Init() 35 { 26 {} 27 28 //------------------------------------------------------------------------------ 29 RunPUPPI::~RunPUPPI(){} 30 31 //------------------------------------------------------------------------------ 32 33 void RunPUPPI::Init(){ 36 34 // input collection 37 fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/towers"));38 fItTrackInputArray = fTrackInputArray->MakeIterator();39 fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/towers"));35 fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/towers")); 36 fItTrackInputArray = fTrackInputArray->MakeIterator(); 37 fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/towers")); 40 38 fItNeutralInputArray = fNeutralInputArray->MakeIterator(); 41 fPVInputArray = ImportArray(GetString("PVInputArray", "PV"));42 fPVItInputArray = fPVInputArray->MakeIterator();43 // puppi parameters 44 fApplyNoLep = GetBool("UseNoLep", true);39 fPVInputArray = ImportArray(GetString("PVInputArray", "PV")); 40 fPVItInputArray = fPVInputArray->MakeIterator(); 41 // puppi parameters 42 fApplyNoLep = GetBool("UseNoLep", true); 45 43 fMinPuppiWeight = GetDouble("MinPuppiWeight", 0.01); 46 fUseExp = GetBool("UseExp", false);44 fUseExp = GetBool("UseExp", false); 47 45 // read eta min ranges 48 46 ExRootConfParam param = GetParam("EtaMinBin"); … … 57 55 fPtMinBin.clear(); 58 56 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fPtMinBin.push_back(param[iMap].GetDouble()); 59 // read cone size 57 // read cone size 60 58 param = GetParam("ConeSizeBin"); 61 59 fConeSizeBin.clear(); 62 60 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fConeSizeBin.push_back(param[iMap].GetDouble()); 63 // read RMS min pt 61 // read RMS min pt 64 62 param = GetParam("RMSPtMinBin"); 65 63 fRMSPtMinBin.clear(); … … 77 75 fNeutralPtSlope.clear(); 78 76 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralPtSlope.push_back(param[iMap].GetDouble()); 79 // read apply chs 77 // read apply chs 80 78 //param = GetParam("ApplyCHS"); 81 79 //fApplyCHS.clear(); … … 89 87 fApplyLowPUCorr.clear(); 90 88 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyLowPUCorr.push_back(param[iMap].GetBool()); 91 // read metric id 89 // read metric id 92 90 param = GetParam("MetricId"); 93 91 fMetricId.clear(); … … 98 96 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fCombId.push_back(param[iMap].GetInt()); 99 97 // create output array 100 fOutputArray = ExportArray(GetString("OutputArray", "puppiParticles"));101 fOutputTrackArray = ExportArray(GetString("OutputArrayTracks", "puppiTracks"));98 fOutputArray = ExportArray(GetString("OutputArray", "puppiParticles")); 99 fOutputTrackArray = ExportArray(GetString("OutputArrayTracks", "puppiTracks")); 102 100 fOutputNeutralArray = ExportArray(GetString("OutputArrayNeutrals", "puppiNeutrals")); 103 101 // Create algorithm list for puppi 104 102 std::vector<AlgoObj> puppiAlgo; 105 if(puppiAlgo.empty()) 106 { 103 if(puppiAlgo.empty()){ 107 104 if(!(fEtaMinBin.size() == fEtaMaxBin.size() and fEtaMinBin.size() == fPtMinBin.size() and fEtaMinBin.size() == fConeSizeBin.size() and fEtaMinBin.size() == fRMSPtMinBin.size() 108 and fEtaMinBin.size() == fRMSScaleFactorBin.size() and fEtaMinBin.size() == fNeutralMinEBin.size() and fEtaMinBin.size() == fNeutralPtSlope.size() 109 and fEtaMinBin.size() == fUseCharged.size() 110 and fEtaMinBin.size() == fApplyLowPUCorr.size() and fEtaMinBin.size() == fMetricId.size())) 111 { 112 std::cerr << " Error in PUPPI configuration, algo info should have the same size --> exit from the code" << std::endl; 105 and fEtaMinBin.size() == fRMSScaleFactorBin.size() and fEtaMinBin.size() == fNeutralMinEBin.size() and fEtaMinBin.size() == fNeutralPtSlope.size() 106 and fEtaMinBin.size() == fUseCharged.size() 107 and fEtaMinBin.size() == fApplyLowPUCorr.size() and fEtaMinBin.size() == fMetricId.size())) { 108 std::cerr<<" Error in PUPPI configuration, algo info should have the same size --> exit from the code"<<std::endl; 113 109 std::exit(EXIT_FAILURE); 114 110 } 115 111 } 116 for(size_t iAlgo = 0; iAlgo < fEtaMinBin.size(); iAlgo++) 117 { 118 AlgoObj algoTmp; 119 algoTmp.etaMin = fEtaMinBin.at(iAlgo); 120 algoTmp.etaMax = fEtaMaxBin.at(iAlgo); 121 algoTmp.ptMin = fPtMinBin.at(iAlgo); 122 algoTmp.minNeutralPt = fNeutralMinEBin.at(iAlgo); 112 for( size_t iAlgo = 0 ; iAlgo < fEtaMinBin.size() ; iAlgo++){ 113 AlgoObj algoTmp ; 114 algoTmp.etaMin = fEtaMinBin.at(iAlgo); 115 algoTmp.etaMax = fEtaMaxBin.at(iAlgo); 116 algoTmp.ptMin = fPtMinBin.at(iAlgo); 117 algoTmp.minNeutralPt = fNeutralMinEBin.at(iAlgo); 123 118 algoTmp.minNeutralPtSlope = fNeutralPtSlope.at(iAlgo); 124 119 //Eta Extrapolation stuff is missing 125 120 //Loop through file requiring algos for same bins to be adjacent 126 while(iAlgo < fEtaMinBin.size() and algoTmp.etaMin == fEtaMinBin.at(iAlgo) and algoTmp.etaMax == fEtaMaxBin.at(iAlgo)) 127 { 121 while(iAlgo < fEtaMinBin.size() and algoTmp.etaMin == fEtaMinBin.at(iAlgo) and algoTmp.etaMax == fEtaMaxBin.at(iAlgo)) { 128 122 AlgoSubObj algoSubTmp; 129 algoSubTmp.metricId = fMetricId.at(iAlgo);130 algoSubTmp.useCharged = fUseCharged.at(iAlgo);131 algoSubTmp.applyLowPUCorr = fApplyLowPUCorr.at(iAlgo);132 algoSubTmp.combId = fCombId.at(iAlgo);133 algoSubTmp.coneSize = fConeSizeBin.at(iAlgo);134 algoSubTmp.rmsPtMin = fRMSPtMinBin.at(iAlgo);135 algoSubTmp.rmsScaleFactor = fRMSScaleFactorBin.at(iAlgo);123 algoSubTmp.metricId = fMetricId.at(iAlgo); 124 algoSubTmp.useCharged = fUseCharged.at(iAlgo); 125 algoSubTmp.applyLowPUCorr = fApplyLowPUCorr.at(iAlgo); 126 algoSubTmp.combId = fCombId.at(iAlgo); 127 algoSubTmp.coneSize = fConeSizeBin.at(iAlgo); 128 algoSubTmp.rmsPtMin = fRMSPtMinBin.at(iAlgo); 129 algoSubTmp.rmsScaleFactor = fRMSScaleFactorBin.at(iAlgo); 136 130 algoTmp.subAlgos.push_back(algoSubTmp); 137 131 iAlgo++; 138 132 } 139 133 iAlgo--; 140 //if(std::find(puppiAlgo.begin(),puppiAlgo.end(),algoTmp) != puppiAlgo.end()) continue; 141 puppiAlgo.push_back(algoTmp); 142 } 143 fPuppi = new PuppiContainer(true, fUseExp, fMinPuppiWeight,puppiAlgo);134 //if(std::find(puppiAlgo.begin(),puppiAlgo.end(),algoTmp) != puppiAlgo.end()) continue; 135 puppiAlgo.push_back(algoTmp); 136 } 137 fPuppi = new PuppiContainer(true,fUseExp,fMinPuppiWeight,puppiAlgo); 144 138 } 145 139 146 140 //------------------------------------------------------------------------------ 147 141 148 void RunPUPPI::Finish() 149 { 150 if(fItTrackInputArray) delete fItTrackInputArray; 142 void RunPUPPI::Finish(){ 143 if(fItTrackInputArray) delete fItTrackInputArray; 151 144 if(fItNeutralInputArray) delete fItNeutralInputArray; 152 145 if(fPuppi) delete fPuppi; … … 155 148 //------------------------------------------------------------------------------ 156 149 157 void RunPUPPI::Process() 158 { 150 void RunPUPPI::Process(){ 159 151 160 152 Candidate *candidate, *particle; … … 164 156 165 157 // loop over input objects 166 fItTrackInputArray ->Reset();167 fItNeutralInputArray ->Reset();168 fPVItInputArray ->Reset();158 fItTrackInputArray ->Reset(); 159 fItNeutralInputArray ->Reset(); 160 fPVItInputArray ->Reset(); 169 161 170 162 std::vector<Candidate *> InputParticles; 171 163 InputParticles.clear(); 172 164 173 // take the leading vertex 165 // take the leading vertex 174 166 float PVZ = 0.; 175 Candidate *pv = static_cast<Candidate 176 if (pv) PVZ = pv->Position.Z();167 Candidate *pv = static_cast<Candidate*>(fPVItInputArray->Next()); 168 if (pv) PVZ = pv->Position.Z(); 177 169 // Fill input particles for puppi 178 170 std::vector<RecoObj> puppiInputVector; 179 171 puppiInputVector.clear(); 180 int lNBad = 0;172 int lNBad = 0; 181 173 // Loop on charge track candidate 182 while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next()))) 183 { 184 momentum = candidate->Momentum; 185 RecoObj curRecoObj; 186 curRecoObj.pt = momentum.Pt(); 187 curRecoObj.eta = momentum.Eta(); 188 curRecoObj.phi = momentum.Phi(); 189 curRecoObj.m = momentum.M(); 190 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); //if(fApplyNoLep && TMath::Abs(candidate->PID) == 11) continue; //Dumb cut to minimize the nolepton on electron 191 //if(fApplyNoLep && TMath::Abs(candidate->PID) == 13) continue; 192 if(candidate->IsRecoPU and candidate->Charge != 0) 193 { // if it comes fromPU vertexes after the resolution smearing and the dZ matching within resolution 194 lNBad++; 195 curRecoObj.id = 2; 196 curRecoObj.vtxId = 0.7 * (fPVInputArray->GetEntries()); //Hack apply reco vtx efficiency of 70% for calibration 197 if(TMath::Abs(candidate->PID) == 11) 198 curRecoObj.pfType = 2; 199 else if(TMath::Abs(candidate->PID) == 13) 200 curRecoObj.pfType = 3; 201 else if(TMath::Abs(candidate->PID) == 22) 202 curRecoObj.pfType = 4; 203 else 204 curRecoObj.pfType = 1; 205 curRecoObj.dZ = particle->Position.Z() - PVZ; 206 } 207 else if(!candidate->IsRecoPU && candidate->Charge != 0) 208 { 209 curRecoObj.id = 1; // charge from LV 210 curRecoObj.vtxId = 1; // from PV 211 if(TMath::Abs(candidate->PID) == 11) 212 curRecoObj.pfType = 2; 213 else if(TMath::Abs(candidate->PID) == 13) 214 curRecoObj.pfType = 3; 215 else if(TMath::Abs(candidate->PID) == 22) 216 curRecoObj.pfType = 4; 217 else 218 curRecoObj.pfType = 1; 219 curRecoObj.dZ = particle->Position.Z() - PVZ; 220 } 221 else 222 { 223 std::cerr << " RunPUPPI: problem with a charged track --> it has charge 0 " << std::endl; 224 continue; 225 } 226 227 puppiInputVector.push_back(curRecoObj); 228 InputParticles.push_back(candidate); 229 } 230 231 // Loop on neutral calo cells 232 while((candidate = static_cast<Candidate *>(fItNeutralInputArray->Next()))) 233 { 234 momentum = candidate->Momentum; 235 RecoObj curRecoObj; 236 curRecoObj.pt = momentum.Pt(); 237 curRecoObj.eta = momentum.Eta(); 238 curRecoObj.phi = momentum.Phi(); 239 curRecoObj.m = momentum.M(); 240 curRecoObj.charge = 0; 241 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 242 if(candidate->Charge == 0) 243 { 244 curRecoObj.id = 0; // neutrals have id==0 245 curRecoObj.vtxId = 0; // neutrals have vtxId==0 246 if(TMath::Abs(candidate->PID) == 11) 247 curRecoObj.pfType = 2; 248 else if(TMath::Abs(candidate->PID) == 13) 249 curRecoObj.pfType = 3; 250 else if(TMath::Abs(candidate->PID) == 22) 251 curRecoObj.pfType = 4; 252 else 253 curRecoObj.pfType = 5; 254 curRecoObj.dZ = particle->Position.Z() - PVZ; 255 } 256 else 257 { 258 std::cerr << " RunPUPPI: problem with a neutrals cells --> it has charge !=0 " << std::endl; 259 continue; 260 } 261 puppiInputVector.push_back(curRecoObj); 262 InputParticles.push_back(candidate); 174 while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next()))){ 175 momentum = candidate->Momentum; 176 RecoObj curRecoObj; 177 curRecoObj.pt = momentum.Pt(); 178 curRecoObj.eta = momentum.Eta(); 179 curRecoObj.phi = momentum.Phi(); 180 curRecoObj.m = momentum.M(); 181 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));//if(fApplyNoLep && TMath::Abs(candidate->PID) == 11) continue; //Dumb cut to minimize the nolepton on electron 182 //if(fApplyNoLep && TMath::Abs(candidate->PID) == 13) continue; 183 if (candidate->IsRecoPU and candidate->Charge !=0) { // if it comes fromPU vertexes after the resolution smearing and the dZ matching within resolution 184 lNBad++; 185 curRecoObj.id = 2; 186 curRecoObj.vtxId = 0.7*(fPVInputArray->GetEntries()); //Hack apply reco vtx efficiency of 70% for calibration 187 if(TMath::Abs(candidate->PID) == 11) curRecoObj.pfType = 2; 188 else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3; 189 else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4; 190 else curRecoObj.pfType = 1; 191 curRecoObj.dZ = particle->Position.Z()-PVZ; 192 } 193 else if(!candidate->IsRecoPU && candidate->Charge !=0) { 194 curRecoObj.id = 1; // charge from LV 195 curRecoObj.vtxId = 1; // from PV 196 if(TMath::Abs(candidate->PID) == 11) curRecoObj.pfType = 2; 197 else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3; 198 else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4; 199 else curRecoObj.pfType = 1; 200 curRecoObj.dZ = particle->Position.Z()-PVZ; 201 } 202 else { 203 std::cerr<<" RunPUPPI: problem with a charged track --> it has charge 0 "<<std::endl; 204 continue; 205 } 206 207 puppiInputVector.push_back(curRecoObj); 208 InputParticles.push_back(candidate); 209 } 210 211 // Loop on neutral calo cells 212 while((candidate = static_cast<Candidate*>(fItNeutralInputArray->Next()))){ 213 momentum = candidate->Momentum; 214 RecoObj curRecoObj; 215 curRecoObj.pt = momentum.Pt(); 216 curRecoObj.eta = momentum.Eta(); 217 curRecoObj.phi = momentum.Phi(); 218 curRecoObj.m = momentum.M(); 219 curRecoObj.charge = 0; 220 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 221 if(candidate->Charge == 0){ 222 curRecoObj.id = 0; // neutrals have id==0 223 curRecoObj.vtxId = 0; // neutrals have vtxId==0 224 if(TMath::Abs(candidate->PID) == 11) curRecoObj.pfType = 2; 225 else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3; 226 else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4; 227 else curRecoObj.pfType = 5; 228 curRecoObj.dZ = particle->Position.Z()-PVZ; 229 } 230 else{ 231 std::cerr<<" RunPUPPI: problem with a neutrals cells --> it has charge !=0 "<<std::endl; 232 continue; 233 } 234 puppiInputVector.push_back(curRecoObj); 235 InputParticles.push_back(candidate); 263 236 } 264 237 // Create PUPPI container … … 268 241 269 242 // Loop on final particles 270 for(std::vector<PseudoJet>::iterator it = puppiParticles.begin(); it != puppiParticles.end(); it++) 271 { 272 if(it->user_index() <= int(InputParticles.size())) 273 { 243 for (std::vector<PseudoJet>::iterator it = puppiParticles.begin() ; it != puppiParticles.end() ; it++) { 244 if(it->user_index() <= int(InputParticles.size())){ 274 245 candidate = static_cast<Candidate *>(InputParticles.at(it->user_index())->Clone()); 275 candidate->Momentum.SetPxPyPzE(it->px(), it->py(), it->pz(),it->e());246 candidate->Momentum.SetPxPyPzE(it->px(),it->py(),it->pz(),it->e()); 276 247 fOutputArray->Add(candidate); 277 if(puppiInputVector.at(it->user_index()).id == 1 or puppiInputVector.at(it->user_index()).id == 2) 278 fOutputTrackArray->Add(candidate); 279 else if(puppiInputVector.at(it->user_index()).id == 0) 280 fOutputNeutralArray->Add(candidate); 248 if( puppiInputVector.at(it->user_index()).id == 1 or puppiInputVector.at(it->user_index()).id == 2) fOutputTrackArray->Add(candidate); 249 else if (puppiInputVector.at(it->user_index()).id == 0) fOutputNeutralArray->Add(candidate); 281 250 } 282 else 283 { 284 std::cerr << " particle not found in the input Array --> skip " << std::endl; 251 else{ 252 std::cerr<<" particle not found in the input Array --> skip "<<std::endl; 285 253 continue; 286 } 287 } 254 } 255 } 256 288 257 } -
modules/RunPUPPI.h
r0e7d64a re39abb4 9 9 class PuppiContainer; 10 10 11 class RunPUPPI: public DelphesModule 12 { 11 class RunPUPPI: public DelphesModule { 13 12 14 public: 13 public: 14 15 15 RunPUPPI(); 16 16 ~RunPUPPI(); … … 19 19 void Process(); 20 20 void Finish(); 21 22 private: 21 23 22 private:23 24 TIterator *fItTrackInputArray; 24 25 TIterator *fItNeutralInputArray; //! 25 TIterator *fPVItInputArray; //! 26 26 TIterator *fPVItInputArray; //! 27 27 28 const TObjArray *fTrackInputArray; 28 29 const TObjArray *fNeutralInputArray; //! 29 const TObjArray *fPVInputArray; //! 30 PuppiContainer *fPuppi;30 const TObjArray *fPVInputArray; //! 31 PuppiContainer* fPuppi; 31 32 // puppi parameters 32 33 bool fApplyNoLep; 33 34 double fMinPuppiWeight; 34 35 bool fUseExp; 35 36 std::vector<float> fEtaMinBin ;37 std::vector<float> fEtaMaxBin ;38 std::vector<float> fPtMinBin ;39 std::vector<float> fConeSizeBin ;40 std::vector<float> fRMSPtMinBin ;41 std::vector<float> fRMSScaleFactorBin ;36 37 std::vector<float> fEtaMinBin ; 38 std::vector<float> fEtaMaxBin ; 39 std::vector<float> fPtMinBin ; 40 std::vector<float> fConeSizeBin ; 41 std::vector<float> fRMSPtMinBin ; 42 std::vector<float> fRMSScaleFactorBin ; 42 43 std::vector<float> fNeutralMinEBin; 43 44 std::vector<float> fNeutralPtSlope; 44 std::vector<bool> fApplyCHS;45 std::vector<bool> fUseCharged;46 std::vector<bool> fApplyLowPUCorr;47 std::vector<int> fMetricId;48 std::vector<int> fCombId;45 std::vector<bool> fApplyCHS; 46 std::vector<bool> fUseCharged; 47 std::vector<bool> fApplyLowPUCorr; 48 std::vector<int> fMetricId; 49 std::vector<int> fCombId; 49 50 50 51 TObjArray *fOutputArray; -
modules/SimpleCalorimeter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class SimpleCalorimeter 20 21 * … … 32 33 #include "classes/DelphesFormula.h" 33 34 35 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 34 37 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 38 39 #include "TMath.h" 40 #include "TString.h" 41 #include "TFormula.h" 42 #include "TRandom3.h" 43 #include "TObjArray.h" 38 44 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 45 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 46 46 47 #include <algorithm> 48 #include <stdexcept> 47 49 #include <iostream> 48 50 #include <sstream> 49 #include <stdexcept>50 51 51 52 using namespace std; … … 57 58 fItParticleInputArray(0), fItTrackInputArray(0) 58 59 { 59 60 60 61 fResolutionFormula = new DelphesFormula; 61 62 fTowerTrackArray = new TObjArray; 62 63 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 64 63 65 } 64 66 … … 67 69 SimpleCalorimeter::~SimpleCalorimeter() 68 70 { 69 71 70 72 if(fResolutionFormula) delete fResolutionFormula; 71 73 if(fTowerTrackArray) delete fTowerTrackArray; 72 74 if(fItTowerTrackArray) delete fItTowerTrackArray; 75 73 76 } 74 77 … … 81 84 Double_t fraction; 82 85 TBinMap::iterator itEtaBin; 83 set< Double_t>::iterator itPhiBin;84 vector< Double_t> *phiBins;86 set< Double_t >::iterator itPhiBin; 87 vector< Double_t > *phiBins; 85 88 86 89 // read eta and phi bins … … 90 93 fEtaBins.clear(); 91 94 fPhiBins.clear(); 92 for(i = 0; i < size /2; ++i)93 { 94 paramEtaBins = param[i *2];95 for(i = 0; i < size/2; ++i) 96 { 97 paramEtaBins = param[i*2]; 95 98 sizeEtaBins = paramEtaBins.GetSize(); 96 paramPhiBins = param[i *2 + 1];99 paramPhiBins = param[i*2 + 1]; 97 100 sizePhiBins = paramPhiBins.GetSize(); 98 101 … … 111 114 { 112 115 fEtaBins.push_back(itEtaBin->first); 113 phiBins = new vector< double>(itEtaBin->second.size());116 phiBins = new vector< double >(itEtaBin->second.size()); 114 117 fPhiBins.push_back(phiBins); 115 118 phiBins->clear(); … … 128 131 fFractionMap[0] = 1.0; 129 132 130 for(i = 0; i < size /2; ++i)131 { 132 paramFractions = param[i *2 + 1];133 for(i = 0; i < size/2; ++i) 134 { 135 paramFractions = param[i*2 + 1]; 133 136 fraction = paramFractions[0].GetDouble(); 134 fFractionMap[param[i *2].GetInt()] = fraction;137 fFractionMap[param[i*2].GetInt()] = fraction; 135 138 } 136 139 … … 167 170 void SimpleCalorimeter::Finish() 168 171 { 169 vector< vector<Double_t> *>::iterator itPhiBin;172 vector< vector< Double_t >* >::iterator itPhiBin; 170 173 if(fItParticleInputArray) delete fItParticleInputArray; 171 174 if(fItTrackInputArray) delete fItTrackInputArray; … … 194 197 TFractionMap::iterator itFractionMap; 195 198 196 vector< Double_t>::iterator itEtaBin;197 vector< Double_t>::iterator itPhiBin;198 vector< Double_t> *phiBins;199 200 vector< Long64_t>::iterator itTowerHits;199 vector< Double_t >::iterator itEtaBin; 200 vector< Double_t >::iterator itPhiBin; 201 vector< Double_t > *phiBins; 202 203 vector< Long64_t >::iterator itTowerHits; 201 204 202 205 DelphesFactory *factory = GetFactory(); … … 208 211 fItParticleInputArray->Reset(); 209 212 number = -1; 210 while((particle = static_cast<Candidate 213 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next()))) 211 214 { 212 215 const TLorentzVector &particlePosition = particle->Position; … … 251 254 fItTrackInputArray->Reset(); 252 255 number = -1; 253 while((track = static_cast<Candidate 256 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 254 257 { 255 258 const TLorentzVector &trackPosition = track->Position; … … 300 303 towerHit = (*itTowerHits); 301 304 flags = (towerHit >> 24) & 0x00000000000000FFLL; 302 number = (towerHit) &0x0000000000FFFFFFLL;305 number = (towerHit) & 0x0000000000FFFFFFLL; 303 306 hitEtaPhi = towerHit >> 32; 304 307 … … 321 324 322 325 // calculate eta and phi of the tower's center 323 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);324 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);326 fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 327 fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 325 328 326 329 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 343 346 344 347 fTowerTrackArray->Clear(); 345 }348 } 346 349 347 350 // check for track hits … … 350 353 ++fTowerTrackHits; 351 354 352 track = static_cast<Candidate 355 track = static_cast<Candidate*>(fTrackInputArray->At(number)); 353 356 momentum = track->Momentum; 354 357 position = track->Position; … … 356 359 energy = momentum.E() * fTrackFractions[number]; 357 360 358 fTrackTime += TMath::Sqrt(energy) *position.T();361 fTrackTime += TMath::Sqrt(energy)*position.T(); 359 362 fTrackTimeWeight += TMath::Sqrt(energy); 360 363 361 364 if(fTrackFractions[number] > 1.0E-9) 362 365 { 363 364 // compute total charged energy 365 fTrackEnergy += energy; 366 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 367 if(sigma / momentum.E() < track->TrackResolution) 368 energyGuess = energy; 369 else 370 energyGuess = momentum.E(); 371 372 fTrackSigma += ((track->TrackResolution) * energyGuess) * ((track->TrackResolution) * energyGuess); 373 fTowerTrackArray->Add(track); 366 367 // compute total charged energy 368 fTrackEnergy += energy; 369 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 370 if(sigma/momentum.E() < track->TrackResolution) energyGuess = energy; 371 else energyGuess = momentum.E(); 372 373 fTrackSigma += ((track->TrackResolution)*energyGuess)*((track->TrackResolution)*energyGuess); 374 fTowerTrackArray->Add(track); 374 375 } 375 376 376 377 else 377 378 { … … 385 386 if(flags & 2) ++fTowerPhotonHits; 386 387 387 particle = static_cast<Candidate 388 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 388 389 momentum = particle->Momentum; 389 390 position = particle->Position; … … 394 395 fTowerEnergy += energy; 395 396 396 fTowerTime += energy *position.T();397 fTowerTime += energy*position.T(); 397 398 fTowerTimeWeight += energy; 398 399 … … 409 410 { 410 411 Candidate *tower, *track, *mother; 411 Double_t energy, 412 Double_t energy,neutralEnergy, pt, eta, phi; 412 413 Double_t sigma, neutralSigma; 413 414 Double_t time; 414 415 415 416 Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor; 416 417 … … 424 425 energy = LogNormal(fTowerEnergy, sigma); 425 426 426 time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime /fTowerTimeWeight;427 time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime/fTowerTimeWeight; 427 428 428 429 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 429 430 430 if(energy < fEnergyMin || energy < fEnergySignificanceMin * sigma) energy = 0.0; 431 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 432 431 433 432 434 if(fSmearTowerCenter) … … 457 459 if(energy > 0.0) fTowerOutputArray->Add(fTower); 458 460 461 459 462 // e-flow candidates 460 463 461 464 //compute neutral excess 462 465 463 466 fTrackSigma = TMath::Sqrt(fTrackSigma); 464 neutralEnergy = max( (energy - fTrackEnergy), 0.0);465 467 neutralEnergy = max( (energy - fTrackEnergy) , 0.0); 468 466 469 //compute sigma_trk total 467 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma * fTrackSigma + sigma *sigma);468 470 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma+ sigma*sigma); 471 469 472 // if neutral excess is significant, simply create neutral Eflow tower and clone each track into eflowtrack 470 473 if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin) 471 474 { 472 475 // create new photon tower 473 tower = static_cast<Candidate 476 tower = static_cast<Candidate*>(fTower->Clone()); 474 477 pt = neutralEnergy / TMath::CosH(eta); 475 478 … … 477 480 tower->Ehad = (fIsEcal) ? 0 : neutralEnergy; 478 481 tower->PID = (fIsEcal) ? 22 : 0; 479 482 480 483 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy); 481 484 fEFlowTowerOutputArray->Add(tower); 482 485 483 486 fItTowerTrackArray->Reset(); 484 while((track = static_cast<Candidate 487 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 485 488 { 486 489 mother = track; 487 track = static_cast<Candidate 490 track = static_cast<Candidate*>(track->Clone()); 488 491 track->AddCandidate(mother); 489 492 … … 491 494 } 492 495 } 493 496 494 497 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 495 else if (fTrackEnergy > 0.0)496 { 497 weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma *fTrackSigma) : 0.0;498 weightCalo = (sigma > 0.0) ? 1 / (sigma *sigma) : 0.0;499 500 bestEnergyEstimate = (weightTrack * fTrackEnergy + weightCalo * energy) / (weightTrack + weightCalo);501 rescaleFactor = bestEnergyEstimate /fTrackEnergy;502 498 else if (fTrackEnergy > 0.0) 499 { 500 weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma*fTrackSigma) : 0.0; 501 weightCalo = (sigma > 0.0) ? 1 / (sigma*sigma) : 0.0; 502 503 bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo); 504 rescaleFactor = bestEnergyEstimate/fTrackEnergy; 505 503 506 fItTowerTrackArray->Reset(); 504 while((track = static_cast<Candidate 507 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 505 508 { 506 509 mother = track; 507 track = static_cast<Candidate 510 track = static_cast<Candidate*>(track->Clone()); 508 511 track->AddCandidate(mother); 509 512 … … 513 516 } 514 517 } 518 519 } 520 521 //------------------------------------------------------------------------------ 522 523 Double_t SimpleCalorimeter::LogNormal(Double_t mean, Double_t sigma) 524 { 525 Double_t a, b; 526 527 if(mean > 0.0) 528 { 529 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 530 a = TMath::Log(mean) - 0.5*b*b; 531 532 return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0)); 533 } 534 else 535 { 536 return 0.0; 537 } 515 538 } 516 517 //------------------------------------------------------------------------------518 519 Double_t SimpleCalorimeter::LogNormal(Double_t mean, Double_t sigma)520 {521 Double_t a, b;522 523 if(mean > 0.0)524 {525 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean))));526 a = TMath::Log(mean) - 0.5 * b * b;527 528 return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0));529 }530 else531 {532 return 0.0;533 }534 } -
modules/SimpleCalorimeter.h
r0e7d64a re39abb4 43 43 { 44 44 public: 45 45 46 SimpleCalorimeter(); 46 47 ~SimpleCalorimeter(); … … 51 52 52 53 private: 53 typedef std::map<Long64_t, Double_t> TFractionMap; //! 54 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 54 55 typedef std::map< Long64_t, Double_t > TFractionMap; //! 56 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 55 57 56 58 Candidate *fTower; … … 80 82 TBinMap fBinMap; //! 81 83 82 std::vector <Double_t> fEtaBins;83 std::vector <std::vector<Double_t> *> fPhiBins;84 std::vector < Double_t > fEtaBins; 85 std::vector < std::vector < Double_t >* > fPhiBins; 84 86 85 std::vector <Long64_t> fTowerHits;87 std::vector < Long64_t > fTowerHits; 86 88 87 std::vector <Double_t> fTowerFractions;89 std::vector < Double_t > fTowerFractions; 88 90 89 std::vector <Double_t> fTrackFractions;91 std::vector < Double_t > fTrackFractions; 90 92 91 93 DelphesFormula *fResolutionFormula; //! -
modules/StatusPidFilter.cc
r0e7d64a re39abb4 32 32 #include "classes/DelphesFormula.h" 33 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootResult.h" 37 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 38 43 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 44 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TRandom3.h"44 #include "TString.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept> 47 48 #include <iostream> 48 49 #include <sstream> 49 #include <stdexcept>50 50 51 51 using namespace std; 52 52 53 namespace 54 { 55 // integer power (faster than TMath::Pow() + cast to integer) 56 int ipow(int base, int exp) 57 { 58 int result = 1; 59 while(exp) 60 { 61 if(exp & 1) 62 result *= base; 63 exp >>= 1; 64 base *= base; 65 } 66 67 return result; 68 } 69 70 // standalone function to extract the i-th digit from a number (counting from 0 = rightmost, etc..) 71 int digit(int val, int i) 72 { 73 int y = ipow(10, i); 74 int z = val / y; 75 int val2 = val / (y * 10); 76 return (z - val2 * 10); 77 } 78 79 // return the first two digits if this is a "fundamental" particle 80 // ID = 100 is a special case (internal generator ID's are 81-100) 81 // also, 101 and 102 are now used (by HepPID) for geantinos 82 int fundamentalID(int pdgCode) 83 { 84 pdgCode = abs(pdgCode); 85 if((digit(pdgCode, 9) == 1) && (digit(pdgCode, 8) == 0)) 86 { 87 return 0; 88 } 89 if(digit(pdgCode, 2) == 0 && digit(pdgCode, 3) == 0) 90 { 91 return pdgCode % 10000; 92 } 93 else if(pdgCode <= 102) 94 { 95 return pdgCode; 96 } 97 else 98 { 99 return 0; 100 } 101 } 102 103 bool hasBottom(int pdgCode) 104 { 105 if((pdgCode / 10000000) > 0) 53 namespace { 54 // integer power (faster than TMath::Pow() + cast to integer) 55 int ipow(int base, int exp) 56 { 57 int result = 1; 58 while (exp) 59 { 60 if (exp & 1) 61 result *= base; 62 exp >>= 1; 63 base *= base; 64 } 65 66 return result; 67 } 68 69 // standalone function to extract the i-th digit from a number (counting from 0 = rightmost, etc..) 70 int digit(int val, int i) 71 { 72 int y = ipow(10,i); 73 int z = val/y; 74 int val2 = val / (y * 10); 75 return (z - val2*10); 76 } 77 78 // return the first two digits if this is a "fundamental" particle 79 // ID = 100 is a special case (internal generator ID's are 81-100) 80 // also, 101 and 102 are now used (by HepPID) for geantinos 81 int fundamentalID(int pdgCode) 82 { 83 pdgCode = abs(pdgCode); 84 if( ( digit(pdgCode, 9) == 1 ) && ( digit(pdgCode, 8) == 0 ) ) { return 0; } 85 if( digit(pdgCode, 2) == 0 && digit(pdgCode, 3) == 0) { 86 return pdgCode%10000; 87 } else if( pdgCode <= 102 ) { 88 return pdgCode; 89 } else { 90 return 0; 91 } 92 } 93 94 bool hasBottom(int pdgCode) 95 { 96 if ( (pdgCode/10000000) > 0) 97 return false; 98 if (pdgCode <= 100) 99 return false; 100 if (fundamentalID(pdgCode) <= 100 && fundamentalID(pdgCode) > 0) 101 return false; 102 if( digit(pdgCode, 3) == 5 || digit(pdgCode, 2) == 5 || digit(pdgCode, 1) == 5 ) 103 return true; 104 return false; 105 } 106 107 bool isTauDaughter(int pdgCode, int M1, const TObjArray *fInputArray){ 108 //not needed, just to speed up the code - can be further refined but gives only negligible improvement: 109 if ( pdgCode==15 || pdgCode<11 || (pdgCode > 22 && pdgCode < 100) || pdgCode>1000 ) 110 return false; 111 112 if ( M1 < 0 ) 113 return false; 114 115 Candidate *mother; 116 mother = static_cast<Candidate*>(fInputArray->At( M1 )); 117 if ( TMath::Abs(mother->PID) == 15 ) 118 return true; 119 106 120 return false; 107 if(pdgCode <= 100) 108 return false; 109 if(fundamentalID(pdgCode) <= 100 && fundamentalID(pdgCode) > 0) 110 return false; 111 if(digit(pdgCode, 3) == 5 || digit(pdgCode, 2) == 5 || digit(pdgCode, 1) == 5) 112 return true; 113 return false; 114 } 115 116 bool isTauDaughter(int pdgCode, int M1, const TObjArray *fInputArray) 117 { 118 //not needed, just to speed up the code - can be further refined but gives only negligible improvement: 119 if(pdgCode == 15 || pdgCode < 11 || (pdgCode > 22 && pdgCode < 100) || pdgCode > 1000) 120 return false; 121 122 if(M1 < 0) 123 return false; 124 125 Candidate *mother; 126 mother = static_cast<Candidate *>(fInputArray->At(M1)); 127 if(TMath::Abs(mother->PID) == 15) 128 return true; 129 130 return false; 131 } 132 133 bool isWDaughter(int M1, const TObjArray *fInputArray) 134 { 135 if(M1 < 0) return false; 136 137 Candidate *mother; 138 mother = static_cast<Candidate *>(fInputArray->At(M1)); 139 if(TMath::Abs(mother->PID) == 24) return true; 140 141 return false; 142 } 143 144 } // namespace 121 } 122 123 bool isWDaughter(int M1, const TObjArray *fInputArray) 124 { 125 if ( M1 < 0 ) return false; 126 127 Candidate *mother; 128 mother = static_cast<Candidate*>(fInputArray->At( M1 )); 129 if ( TMath::Abs(mother->PID) == 24 ) return true; 130 131 return false; 132 } 133 134 } 135 145 136 146 137 //------------------------------------------------------------------------------ … … 162 153 { 163 154 // PT threshold 155 164 156 fPTMin = GetDouble("PTMin", 0.5); 165 166 // keep or remove pileup particles167 fRequireNotPileup = GetBool("RequireNotPileup", false);168 157 169 158 // import input array … … 192 181 193 182 fItInputArray->Reset(); 194 while((candidate = static_cast<Candidate 183 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 195 184 { 196 185 status = candidate->Status; … … 204 193 // hard scattering particles (first condition for Py6, second for Py8) 205 194 if(status == 3) pass = kTRUE; 206 if(status > 20 && status < 30 ) pass = kTRUE;195 if(status > 20 && status < 30 ) pass = kTRUE; 207 196 208 197 // electrons, muons, taus and neutrinos … … 210 199 211 200 // heavy quarks 212 if(pdgCode == 4 || 201 if(pdgCode == 4 ||pdgCode == 5 || pdgCode == 6) pass = kTRUE; 213 202 214 203 // Gauge bosons and other fundamental bosons 215 204 if(pdgCode > 22 && pdgCode < 43) pass = kTRUE; 216 205 217 //Stable photons 218 if(pdgCode == 22 && status ==1) pass = kTRUE;206 //Stable photons 207 if(pdgCode == 22 && status==1) pass = kTRUE; 219 208 220 209 // logic ported from HepPDF: http://lcgapp.cern.ch/project/simu/HepPDT/HepPDT.2.05.02/html/ParticleID_8cc-source.html#l00081 221 210 bool is_b_hadron = hasBottom(pdgCode); 222 bool is_b_quark = (pdgCode == 5);211 bool is_b_quark = (pdgCode == 5); 223 212 224 213 bool is_tau_daughter = isTauDaughter(pdgCode, candidate->M1, fInputArray); 225 214 226 if (is_b_hadron)215 if (is_b_hadron) 227 216 pass = kTRUE; 228 217 229 if (is_tau_daughter)218 if (is_tau_daughter) 230 219 pass = kTRUE; 231 220 232 221 bool is_W_daughter = isWDaughter(candidate->M1, fInputArray); 233 if (is_W_daughter)222 if (is_W_daughter) 234 223 pass = kTRUE; 235 224 236 225 // fPTMin not applied to b_hadrons / b_quarks to allow for b-enriched sample stitching 237 226 // fPTMin not applied to tau decay products to allow visible-tau four momentum determination 238 if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark || is_tau_daughter || is_W_daughter))) continue; 239 240 // not pileup particles 241 if(fRequireNotPileup && (candidate->IsPU > 0)) continue; 227 if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark || is_tau_daughter || is_W_daughter)) ) continue; 242 228 243 229 fOutputArray->Add(candidate); 244 230 } 245 231 } 232 -
modules/StatusPidFilter.h
r0e7d64a re39abb4 39 39 { 40 40 public: 41 41 42 StatusPidFilter(); 42 43 ~StatusPidFilter(); … … 47 48 48 49 private: 50 49 51 Double_t fPTMin; //! 50 51 Bool_t fRequireNotPileup; //!52 52 53 53 TIterator *fItInputArray; //! -
modules/TaggingParticlesSkimmer.cc
r0e7d64a re39abb4 35 35 #include "classes/DelphesFormula.h" 36 36 37 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 37 39 #include "ExRootAnalysis/ExRootClassifier.h" 38 #include "ExRootAnalysis/ExRootFilter.h"39 #include "ExRootAnalysis/ExRootResult.h"40 40 41 #include "TMath.h" 42 #include "TString.h" 43 #include "TFormula.h" 44 #include "TRandom3.h" 45 #include "TObjArray.h" 41 46 #include "TDatabasePDG.h" 42 #include "TFormula.h"43 47 #include "TLorentzVector.h" 44 #include "TMath.h"45 #include "TObjArray.h"46 #include "TRandom3.h"47 #include "TString.h"48 48 49 49 #include <algorithm> 50 #include <stdexcept> 50 51 #include <iostream> 51 52 #include <sstream> 52 #include <stdexcept>53 53 54 54 using namespace std; 55 55 56 56 57 //------------------------------------------------------------------------------ 57 58 58 59 TaggingParticlesSkimmer::TaggingParticlesSkimmer() : 59 fClassifier(0), fFilter(0), fItPartonInputArray(0), 60 fPartonInputArray(0), fParticleInputArray(0), fOutputArray(0) 60 fItPartonInputArray(0), fFilter(0), fClassifier(0) 61 61 { 62 62 } … … 72 72 void TaggingParticlesSkimmer::Init() 73 73 { 74 74 75 75 fPTMin = GetDouble("PTMin", 15.0); 76 76 fEtaMax = GetDouble("EtaMax", 2.5); 77 77 78 78 // import input array 79 79 fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons")); 80 80 fItPartonInputArray = fPartonInputArray->MakeIterator(); 81 81 82 82 fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles")); 83 83 84 84 85 fClassifier = new TauTaggingPartonClassifier(fParticleInputArray); 85 86 fClassifier->fPTMin = GetDouble("PTMin", 15.0); 86 87 fClassifier->fEtaMax = GetDouble("EtaMax", 2.5); 87 88 89 88 90 fFilter = new ExRootFilter(fPartonInputArray); 89 91 … … 95 97 96 98 void TaggingParticlesSkimmer::Finish() 97 { 99 { 98 100 if(fItPartonInputArray) delete fItPartonInputArray; 99 101 if(fFilter) delete fFilter; … … 125 127 if(tau->D1 < 0) continue; 126 128 127 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 129 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 130 tau->D2 >= fParticleInputArray->GetEntriesFast()) 128 131 { 129 132 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 131 134 132 135 tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 133 136 134 137 for(i = tau->D1; i <= tau->D2; ++i) 135 138 { … … 138 141 tauMomentum += daughter->Momentum; 139 142 } 143 144 candidate = static_cast<Candidate*>(tau->Clone()); 145 candidate->Momentum = tauMomentum; 140 146 141 candidate = static_cast<Candidate *>(tau->Clone());142 candidate->Momentum = tauMomentum;147 148 fOutputArray->Add(candidate); 143 149 150 } 151 152 // then add all other partons (except tau's to avoid double counting) 153 154 fItPartonInputArray->Reset(); 155 while((candidate = static_cast<Candidate*>(fItPartonInputArray->Next()))) 156 { 157 pdgCode = TMath::Abs(candidate->PID); 158 if(pdgCode == 15) continue; 159 160 pt = candidate->Momentum.Pt(); 161 if(pt < fPTMin) continue; 162 163 eta = TMath::Abs(candidate->Momentum.Eta()); 164 if(eta > fEtaMax) continue; 165 144 166 fOutputArray->Add(candidate); 145 167 } 146 168 147 // then add all other partons (except tau's to avoid double counting)148 169 149 fItPartonInputArray->Reset(); 150 while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next()))) 151 { 152 pdgCode = TMath::Abs(candidate->PID); 153 if(pdgCode == 15) continue; 170 } 154 171 155 pt = candidate->Momentum.Pt();156 if(pt < fPTMin) continue;157 158 eta = TMath::Abs(candidate->Momentum.Eta());159 if(eta > fEtaMax) continue;160 161 fOutputArray->Add(candidate);162 }163 } -
modules/TaggingParticlesSkimmer.h
r0e7d64a re39abb4 42 42 { 43 43 public: 44 44 45 TaggingParticlesSkimmer(); 45 46 ~TaggingParticlesSkimmer(); … … 50 51 51 52 private: 53 52 54 Double_t fPTMin; //! 53 55 Double_t fEtaMax; //! 54 56 55 57 TauTaggingPartonClassifier *fClassifier; //! 56 58 57 59 ExRootFilter *fFilter; 58 60 59 61 TIterator *fItPartonInputArray; //! 60 62 61 63 const TObjArray *fPartonInputArray; //! 62 64 const TObjArray *fParticleInputArray; //! -
modules/TauTagging.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class TauTagging 20 21 * … … 33 34 #include "classes/DelphesFormula.h" 34 35 36 #include "TMath.h" 37 #include "TString.h" 38 #include "TFormula.h" 39 #include "TRandom3.h" 40 #include "TObjArray.h" 35 41 #include "TDatabasePDG.h" 36 #include "TFormula.h"37 42 #include "TLorentzVector.h" 38 #include "TMath.h"39 #include "TObjArray.h"40 #include "TRandom3.h"41 #include "TString.h"42 43 43 44 #include <algorithm> 45 #include <stdexcept> 44 46 #include <iostream> 45 47 #include <sstream> 46 #include <stdexcept>47 48 48 49 using namespace std; 50 49 51 50 52 //------------------------------------------------------------------------------ … … 61 63 Candidate *daughter1 = 0; 62 64 Candidate *daughter2 = 0; 63 65 64 66 const TLorentzVector &momentum = tau->Momentum; 65 67 Int_t pdgCode, i, j; … … 74 76 if(tau->D2 < tau->D1) return -1; 75 77 76 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 78 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 79 tau->D2 >= fParticleInputArray->GetEntriesFast()) 77 80 { 78 81 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 83 86 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 84 87 pdgCode = TMath::Abs(daughter1->PID); 85 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 86 return -1; 88 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 87 89 else if(pdgCode == 24) 88 90 { 89 if(daughter1->D1 < 0) return -1; 90 for(j = daughter1->D1; j <= daughter1->D2; ++j) 91 { 92 daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j)); 93 pdgCode = TMath::Abs(daughter2->PID); 94 if(pdgCode == 11 || pdgCode == 13) return -1; 95 } 91 if(daughter1->D1 < 0) return -1; 92 for(j = daughter1->D1; j <= daughter1->D2; ++j) 93 { 94 daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j)); 95 pdgCode = TMath::Abs(daughter2->PID); 96 if(pdgCode == 11 || pdgCode == 13) return -1; 97 } 98 96 99 } 97 100 } … … 118 121 void TauTagging::Init() 119 122 { 120 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;123 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 121 124 ExRootConfParam param; 122 125 DelphesFormula *formula; … … 132 135 133 136 fEfficiencyMap.clear(); 134 for(i = 0; i < size /2; ++i)137 for(i = 0; i < size/2; ++i) 135 138 { 136 139 formula = new DelphesFormula; 137 formula->Compile(param[i *2 + 1].GetString());138 139 fEfficiencyMap[param[i *2].GetInt()] = formula;140 formula->Compile(param[i*2 + 1].GetString()); 141 142 fEfficiencyMap[param[i*2].GetInt()] = formula; 140 143 } 141 144 … … 171 174 void TauTagging::Finish() 172 175 { 173 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;176 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 174 177 DelphesFormula *formula; 175 178 … … 194 197 Double_t pt, eta, phi, e, eff; 195 198 TObjArray *tauArray; 196 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;199 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 197 200 DelphesFormula *formula; 198 201 Int_t pdgCode, charge, i; … … 215 218 216 219 // loop over all input taus 217 if(tauArray) 218 { 220 if(tauArray){ 219 221 TIter itTauArray(tauArray); 220 222 while((tau = static_cast<Candidate *>(itTauArray.Next()))) … … 222 224 if(tau->D1 < 0) continue; 223 225 224 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 226 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 227 tau->D2 >= fParticleInputArray->GetEntriesFast()) 225 228 { 226 229 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 254 257 eff = formula->Eval(pt, eta, phi, e); 255 258 jet->TauTag |= (gRandom->Uniform() <= eff) << fBitNumber; 256 jet->TauWeight = eff; 259 jet->TauWeight = eff; 257 260 258 261 // set tau charge -
modules/TauTagging.h
r0e7d64a re39abb4 30 30 */ 31 31 32 #include "classes/DelphesModule.h" 33 #include "ExRootAnalysis/ExRootResult.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 32 35 #include "ExRootAnalysis/ExRootClassifier.h" 33 #include "ExRootAnalysis/ExRootFilter.h"34 #include "ExRootAnalysis/ExRootResult.h"35 #include "classes/DelphesModule.h"36 36 37 37 #include <map> … … 46 46 { 47 47 public: 48 48 49 TauTagging(); 49 50 ~TauTagging(); … … 54 55 55 56 private: 57 56 58 Int_t fBitNumber; 57 59 58 60 Double_t fDeltaR; 59 61 60 62 #if !defined(__CINT__) && !defined(__CLING__) 61 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!63 std::map< Int_t, DelphesFormula * > fEfficiencyMap; //! 62 64 #endif 63 65 64 66 TauTaggingPartonClassifier *fClassifier; //! 65 67 66 68 ExRootFilter *fFilter; 67 69 68 70 TIterator *fItPartonInputArray; //! 69 71 70 72 TIterator *fItJetInputArray; //! 71 73 … … 73 75 74 76 const TObjArray *fPartonInputArray; //! 75 77 76 78 const TObjArray *fJetInputArray; //! 77 79 … … 79 81 }; 80 82 83 81 84 //------------------------------------------------------------------------------ 82 85 83 class TauTaggingPartonClassifier : public ExRootClassifier86 class TauTaggingPartonClassifier : public ExRootClassifier 84 87 { 85 88 public: 89 86 90 TauTaggingPartonClassifier(const TObjArray *array); 87 91 … … 93 97 }; 94 98 99 95 100 #endif -
modules/TimeSmearing.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class TimeSmearing 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 53 54 54 55 TimeSmearing::TimeSmearing() : 55 56 fItInputArray(0) 56 57 { 57 58 } … … 96 97 97 98 fItInputArray->Reset(); 98 while((candidate = static_cast<Candidate 99 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 99 100 { 100 101 const TLorentzVector &candidateInitialPosition = candidate->InitialPosition; 101 102 const TLorentzVector &candidateFinalPosition = candidate->Position; 102 103 103 ti = candidateInitialPosition.T() * 1.0E-3 /c_light;104 tf = candidateFinalPosition.T() * 1.0E-3 /c_light;104 ti = candidateInitialPosition.T()*1.0E-3/c_light; 105 tf = candidateFinalPosition.T()*1.0E-3/c_light; 105 106 106 107 // apply smearing formula … … 108 109 ti = ti + tf_smeared - tf; 109 110 tf = tf_smeared; 111 112 mother = candidate; 113 candidate = static_cast<Candidate*>(candidate->Clone()); 114 candidate->InitialPosition.SetT(ti*1.0E3*c_light); 115 candidate->Position.SetT(tf*1.0E3*c_light); 110 116 111 mother = candidate; 112 candidate = static_cast<Candidate *>(candidate->Clone()); 113 candidate->InitialPosition.SetT(ti * 1.0E3 * c_light); 114 candidate->Position.SetT(tf * 1.0E3 * c_light); 115 116 candidate->ErrorT = fTimeResolution * 1.0E3 * c_light; 117 candidate->ErrorT = fTimeResolution*1.0E3*c_light; 117 118 118 119 candidate->AddCandidate(mother); -
modules/TimeSmearing.h
r0e7d64a re39abb4 36 36 { 37 37 public: 38 38 39 TimeSmearing(); 39 40 ~TimeSmearing(); … … 44 45 45 46 private: 47 46 48 Double_t fTimeResolution; 47 49 -
modules/TrackCountingBTagging.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class TrackCountingBTagging 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "TMath.h" 35 #include "TString.h" 33 36 #include "TFormula.h" 37 #include "TRandom3.h" 38 #include "TObjArray.h" 34 39 #include "TLorentzVector.h" 35 #include "TMath.h"36 #include "TObjArray.h"37 #include "TRandom3.h"38 #include "TString.h"39 40 40 41 #include <algorithm> 42 #include <stdexcept> 41 43 #include <iostream> 42 44 #include <sstream> 43 #include <stdexcept>44 45 45 46 using namespace std; … … 106 107 // loop over all input jets 107 108 fItJetInputArray->Reset(); 108 while((jet = static_cast<Candidate 109 while((jet = static_cast<Candidate*>(fItJetInputArray->Next()))) 109 110 { 110 111 const TLorentzVector &jetMomentum = jet->Momentum; … … 117 118 count = 0; 118 119 // stop once we have enough tracks 119 while((track = static_cast<Candidate 120 while((track = static_cast<Candidate*>(fItTrackInputArray->Next())) and count < fNtracks) 120 121 { 121 122 const TLorentzVector &trkMomentum = track->Momentum; 122 123 tpt = trkMomentum.Pt(); 123 124 if(tpt < fPtMin) continue; 124 125 125 126 d0 = TMath::Abs(track->D0); 126 127 if(d0 > fIPmax) continue; … … 136 137 ddz = TMath::Abs(track->ErrorDZ); 137 138 138 if(fUse3D) 139 { 140 sign = (jpx * xd + jpy * yd + jpz * zd > 0.0) ? 1 : -1; 139 if(fUse3D){ 140 sign = (jpx*xd + jpy*yd + jpz*zd > 0.0) ? 1 : -1; 141 141 //add transverse and longitudinal significances in quadrature 142 sip = sign * TMath::Sqrt( TMath::Power(d0 / dd0, 2) + TMath::Power(dz / ddz, 2));142 sip = sign * TMath::Sqrt( TMath::Power(d0 / dd0, 2) + TMath::Power(dz / ddz, 2) ); 143 143 } 144 else 145 { 146 sign = (jpx * xd + jpy * yd > 0.0) ? 1 : -1; 144 else { 145 sign = (jpx*xd + jpy*yd > 0.0) ? 1 : -1; 147 146 sip = sign * d0 / TMath::Abs(dd0); 148 147 } -
modules/TrackCountingBTagging.h
r0e7d64a re39abb4 37 37 { 38 38 public: 39 39 40 TrackCountingBTagging(); 40 41 ~TrackCountingBTagging(); … … 45 46 46 47 private: 48 47 49 Int_t fBitNumber; 48 50 … … 51 53 Double_t fIPmax; 52 54 Double_t fSigMin; 53 Int_t fNtracks;54 Bool_t fUse3D;55 Int_t fNtracks; 56 Bool_t fUse3D; 55 57 56 58 TIterator *fItTrackInputArray; //! -
modules/TrackCountingTauTagging.cc
r0e7d64a re39abb4 20 20 #include "classes/DelphesFormula.h" 21 21 22 #include "ExRootAnalysis/ExRootResult.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 22 24 #include "ExRootAnalysis/ExRootClassifier.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 24 #include "ExRootAnalysis/ExRootResult.h" 25 25 26 #include "TMath.h" 27 #include "TString.h" 28 #include "TFormula.h" 29 #include "TRandom3.h" 30 #include "TObjArray.h" 26 31 #include "TDatabasePDG.h" 27 #include "TFormula.h"28 32 #include "TLorentzVector.h" 29 #include "TMath.h"30 #include "TObjArray.h"31 #include "TRandom3.h"32 #include "TString.h"33 33 34 34 #include <algorithm> 35 #include <stdexcept> 35 36 #include <iostream> 36 37 #include <sstream> 37 #include <stdexcept>38 38 39 39 using namespace std; … … 44 44 { 45 45 public: 46 46 47 TrackCountingTauTaggingPartonClassifier(const TObjArray *array); 47 48 … … 66 67 Candidate *daughter1 = 0; 67 68 Candidate *daughter2 = 0; 68 69 69 70 const TLorentzVector &momentum = tau->Momentum; 70 71 Int_t pdgCode, i, j; … … 79 80 if(tau->D2 < tau->D1) return -1; 80 81 81 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 82 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 83 tau->D2 >= fParticleInputArray->GetEntriesFast()) 82 84 { 83 85 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 88 90 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 89 91 pdgCode = TMath::Abs(daughter1->PID); 90 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 91 return -1; 92 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 92 93 else if(pdgCode == 24) 93 94 { 94 if(daughter1->D1 < 0) return -1; 95 for(j = daughter1->D1; j <= daughter1->D2; ++j) 96 { 97 daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j)); 98 pdgCode = TMath::Abs(daughter2->PID); 99 if(pdgCode == 11 || pdgCode == 13) return -1; 100 } 95 if(daughter1->D1 < 0) return -1; 96 for(j = daughter1->D1; j <= daughter1->D2; ++j) 97 { 98 daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j)); 99 pdgCode = TMath::Abs(daughter2->PID); 100 if(pdgCode == 11 || pdgCode == 13) return -1; 101 } 102 101 103 } 102 104 } … … 123 125 void TrackCountingTauTagging::Init() 124 126 { 125 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;127 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 126 128 ExRootConfParam param; 127 129 DelphesFormula *formula; … … 133 135 fDeltaRTrack = GetDouble("DeltaRTrack", 0.2); 134 136 fTrackPTMin = GetDouble("TrackPTMin", 1.0); 135 137 136 138 // read efficiency formulas 137 139 param = GetParam("EfficiencyFormula"); … … 139 141 140 142 fEfficiencyMap.clear(); 141 for(i = 0; i < size /2; ++i)143 for(i = 0; i < size/2; ++i) 142 144 { 143 145 formula = new DelphesFormula; 144 formula->Compile(param[i *2 + 1].GetString());145 146 fEfficiencyMap[param[i *2].GetInt()] = formula;146 formula->Compile(param[i*2 + 1].GetString()); 147 148 fEfficiencyMap[param[i*2].GetInt()] = formula; 147 149 } 148 150 … … 170 172 fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks")); 171 173 fItTrackInputArray = fTrackInputArray->MakeIterator(); 172 174 173 175 fFilter = new ExRootFilter(fPartonInputArray); 174 176 … … 181 183 void TrackCountingTauTagging::Finish() 182 184 { 183 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;185 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 184 186 DelphesFormula *formula; 185 187 … … 205 207 Double_t pt, eta, phi, e; 206 208 TObjArray *tauArray; 207 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;209 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 208 210 DelphesFormula *formula; 209 211 Int_t pdgCode, charge, i, identifier; … … 230 232 e = jetMomentum.E(); 231 233 232 // loop over all input tracks 234 235 // loop over all input tracks 233 236 fItTrackInputArray->Reset(); 234 237 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 235 238 { 236 if((track->Momentum).Pt() < fTrackPTMin) continue; 237 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) 238 { 239 identifier -= 1; 240 charge += track->Charge; 241 } 239 if((track->Momentum).Pt() < fTrackPTMin) continue; 240 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) { 241 identifier -= 1; 242 charge += track->Charge; 243 } 242 244 } 243 245 244 246 // loop over all input taus 245 247 itTauArray.Reset(); … … 249 251 if(tau->D1 < 0) continue; 250 252 251 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 253 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 254 tau->D2 >= fParticleInputArray->GetEntriesFast()) 252 255 { 253 256 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 260 263 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 261 264 if(TMath::Abs(daughter->PID) == 16) continue; 262 tauMomentum += daughter->Momentum; 265 tauMomentum += daughter->Momentum; 263 266 } 264 267 265 268 if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR) 266 { 269 { 267 270 matchedTau = true; 268 271 pdgCode = 15; … … 270 273 } 271 274 if(matchedTau) 272 275 identifier *= -1; 273 276 // find an efficency formula 274 277 // If the identifier is larger than 2, set it to 2 (multiprong requires at least 2 tracks) 275 if(identifier > 2) 276 identifier = 2; 277 else if(identifier < -2) 278 identifier = -2; 279 278 if (identifier > 2) 279 identifier = 2; 280 else if (identifier < -2) 281 identifier = -2; 282 283 280 284 itEfficiencyMap = fEfficiencyMap.find(identifier); 281 285 if(itEfficiencyMap == fEfficiencyMap.end()) … … 289 293 // apply an efficency formula 290 294 jet->TauTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 291 295 296 292 297 // set tau charge 293 298 jet->Charge = charge; -
modules/TrackCountingTauTagging.h
r0e7d64a re39abb4 29 29 { 30 30 public: 31 31 32 TrackCountingTauTagging(); 32 33 ~TrackCountingTauTagging(); … … 37 38 38 39 private: 40 39 41 Int_t fBitNumber; 40 42 … … 43 45 Double_t fTrackPTMin; 44 46 45 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!46 47 std::map< Int_t, DelphesFormula * > fEfficiencyMap; //! 48 47 49 TrackCountingTauTaggingPartonClassifier *fClassifier; //! 48 50 49 51 ExRootFilter *fFilter; 50 52 51 53 TIterator *fItPartonInputArray; //! 52 54 53 55 TIterator *fItTrackInputArray; //! 54 56 55 57 TIterator *fItJetInputArray; //! 56 58 … … 60 62 61 63 const TObjArray *fPartonInputArray; //! 62 64 63 65 const TObjArray *fJetInputArray; //! 64 66 -
modules/TrackPileUpSubtractor.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class TrackPileUpSubtractor 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 53 54 54 55 TrackPileUpSubtractor::TrackPileUpSubtractor() : 55 fFormula(0) 56 fFormula(0) 56 57 { 57 58 fFormula = new DelphesFormula; … … 87 88 88 89 size = param.GetSize(); 89 for(i = 0; i < size /2; ++i)90 for(i = 0; i < size/2; ++i) 90 91 { 91 array = ImportArray(param[i *2].GetString());92 array = ImportArray(param[i*2].GetString()); 92 93 iterator = array->MakeIterator(); 93 94 94 fInputMap[iterator] = ExportArray(param[i *2 + 1].GetString());95 fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString()); 95 96 } 96 97 } … … 100 101 void TrackPileUpSubtractor::Finish() 101 102 { 102 map< TIterator *, TObjArray *>::iterator itInputMap;103 map< TIterator *, TObjArray * >::iterator itInputMap; 103 104 TIterator *iterator; 104 105 … … 118 119 { 119 120 Candidate *candidate, *particle; 120 map< TIterator *, TObjArray *>::iterator itInputMap;121 map< TIterator *, TObjArray * >::iterator itInputMap; 121 122 TIterator *iterator; 122 123 TObjArray *array; 123 Double_t z, zvtx =0;124 Double_t z, zvtx=0; 124 125 Double_t pt, eta, phi, e; 126 125 127 126 128 // find z position of primary vertex 127 129 128 130 fItVertexInputArray->Reset(); 129 while((candidate = static_cast<Candidate 131 while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next()))) 130 132 { 131 133 if(!candidate->IsPU) … … 144 146 // loop over all candidates 145 147 iterator->Reset(); 146 while((candidate = static_cast<Candidate 148 while((candidate = static_cast<Candidate*>(iterator->Next()))) 147 149 { 148 particle = static_cast<Candidate 150 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 149 151 const TLorentzVector &candidateMomentum = particle->Momentum; 150 152 … … 153 155 phi = candidateMomentum.Phi(); 154 156 e = candidateMomentum.E(); 155 157 156 158 z = particle->Position.Z(); 157 159 … … 159 161 // assume perfect pile-up subtraction for tracks outside fZVertexResolution 160 162 161 if(candidate->Charge != 0 && candidate->IsPU && TMath::Abs(z - zvtx) > fFormula->Eval(pt, eta, phi, e)* 1.0e3)163 if(candidate->Charge !=0 && candidate->IsPU && TMath::Abs(z-zvtx) > fFormula->Eval(pt, eta, phi, e)* 1.0e3) 162 164 { 163 165 candidate->IsRecoPU = 1; -
modules/TrackPileUpSubtractor.h
r0e7d64a re39abb4 39 39 { 40 40 public: 41 41 42 TrackPileUpSubtractor(); 42 43 ~TrackPileUpSubtractor(); … … 47 48 48 49 private: 50 49 51 DelphesFormula *fFormula; //! 50 52 51 53 Double_t fPTMin; 52 54 53 std::map< TIterator *, TObjArray *> fInputMap; //!55 std::map< TIterator *, TObjArray * > fInputMap; //! 54 56 55 57 ClassDef(TrackPileUpSubtractor, 1) 56 58 57 59 TIterator *fItVertexInputArray; //! 58 60 59 61 const TObjArray *fVertexInputArray; //! 62 60 63 }; 61 64 -
modules/TrackSmearing.cc
r0e7d64a re39abb4 13 13 #include "classes/DelphesFormula.h" 14 14 15 #include "ExRootAnalysis/ExRootResult.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 15 17 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 17 #include "ExRootAnalysis/ExRootResult.h" 18 18 19 #include "TMath.h" 20 #include "TString.h" 21 #include "TFormula.h" 22 #include "TRandom3.h" 23 #include "TObjArray.h" 19 24 #include "TDatabasePDG.h" 25 #include "TLorentzVector.h" 20 26 #include "TFile.h" 21 #include "TFormula.h"22 #include "TLorentzVector.h"23 #include "TMath.h"24 #include "TObjArray.h"25 27 #include "TProfile2D.h" 26 #include "TRandom3.h" 27 #include "TString.h" 28 29 #include <algorithm> 28 29 #include <algorithm> 30 #include <stdexcept> 30 31 #include <iostream> 31 32 #include <sstream> 32 #include <stdexcept>33 33 34 34 using namespace std; … … 66 66 67 67 // !!! IF WE WANT TO KEEP ROOT INPUT !!! 68 if (string(GetString("D0ResolutionFormula", "0.0")) != "0.0")69 {70 fD0Formula->Compile(GetString("D0ResolutionFormula", "0.0"));71 fUseD0Formula = true;72 }73 else 74 {75 fD0ResolutionFile = GetString("D0ResolutionFile", "errors.root");76 fD0ResolutionHist = GetString("D0ResolutionHist", "d0");77 fUseD0Formula = false;78 }79 if (string(GetString("DZResolutionFormula", "0.0")) != "0.0")80 {81 fDZFormula->Compile(GetString("DZResolutionFormula", "0.0"));82 fUseDZFormula = true;83 }84 else 85 {86 fDZResolutionFile = GetString("DZResolutionFile", "errors.root");87 fDZResolutionHist = GetString("DZResolutionHist", "dz");88 fUseDZFormula = false;89 }90 if (string(GetString("PResolutionFormula", "0.0")) != "0.0")91 {92 fPFormula->Compile(GetString("PResolutionFormula", "0.0"));93 fUsePFormula = true;94 }95 else 96 {97 fPResolutionFile = GetString("PResolutionFile", "errors.root");98 fPResolutionHist = GetString("PResolutionHist", "p");99 fUsePFormula = false;100 }101 if (string(GetString("CtgThetaResolutionFormula", "0.0")) != "0.0")102 {103 fCtgThetaFormula->Compile(GetString("CtgThetaResolutionFormula", "0.0"));104 fUseCtgThetaFormula = true;105 }106 else 107 {108 fCtgThetaResolutionFile = GetString("CtgThetaResolutionFile", "errors.root");109 fCtgThetaResolutionHist = GetString("CtgThetaResolutionHist", "ctgTheta");110 fUseCtgThetaFormula = false;111 }112 if (string(GetString("PhiResolutionFormula", "0.0")) != "0.0")113 {114 fPhiFormula->Compile(GetString("PhiResolutionFormula", "0.0"));115 fUsePhiFormula = true;116 }117 else 118 {119 fPhiResolutionFile = GetString("PhiResolutionFile", "errors.root");120 fPhiResolutionHist = GetString("PhiResolutionHist", "phi");121 fUsePhiFormula = false;122 }68 if (string (GetString("D0ResolutionFormula", "0.0")) != "0.0") 69 { 70 fD0Formula->Compile(GetString("D0ResolutionFormula", "0.0")); 71 fUseD0Formula = true; 72 } 73 else 74 { 75 fD0ResolutionFile = GetString("D0ResolutionFile", "errors.root"); 76 fD0ResolutionHist = GetString("D0ResolutionHist", "d0"); 77 fUseD0Formula = false; 78 } 79 if (string (GetString("DZResolutionFormula", "0.0")) != "0.0") 80 { 81 fDZFormula->Compile(GetString("DZResolutionFormula", "0.0")); 82 fUseDZFormula = true; 83 } 84 else 85 { 86 fDZResolutionFile = GetString("DZResolutionFile", "errors.root"); 87 fDZResolutionHist = GetString("DZResolutionHist", "dz"); 88 fUseDZFormula = false; 89 } 90 if (string (GetString("PResolutionFormula", "0.0")) != "0.0") 91 { 92 fPFormula->Compile(GetString("PResolutionFormula", "0.0")); 93 fUsePFormula = true; 94 } 95 else 96 { 97 fPResolutionFile = GetString("PResolutionFile", "errors.root"); 98 fPResolutionHist = GetString("PResolutionHist", "p"); 99 fUsePFormula = false; 100 } 101 if (string (GetString("CtgThetaResolutionFormula", "0.0")) != "0.0") 102 { 103 fCtgThetaFormula->Compile(GetString("CtgThetaResolutionFormula", "0.0")); 104 fUseCtgThetaFormula = true; 105 } 106 else 107 { 108 fCtgThetaResolutionFile = GetString("CtgThetaResolutionFile", "errors.root"); 109 fCtgThetaResolutionHist = GetString("CtgThetaResolutionHist", "ctgTheta"); 110 fUseCtgThetaFormula = false; 111 } 112 if (string (GetString("PhiResolutionFormula", "0.0")) != "0.0") 113 { 114 fPhiFormula->Compile(GetString("PhiResolutionFormula", "0.0")); 115 fUsePhiFormula = true; 116 } 117 else 118 { 119 fPhiResolutionFile = GetString("PhiResolutionFile", "errors.root"); 120 fPhiResolutionHist = GetString("PhiResolutionHist", "phi"); 121 fUsePhiFormula = false; 122 } 123 123 124 124 fApplyToPileUp = GetBool("ApplyToPileUp", true); … … 128 128 fInputArray = ImportArray(GetString("InputArray", "ParticlePropagator/stableParticles")); 129 129 fItInputArray = fInputArray->MakeIterator(); 130 130 131 131 // import beamspot 132 132 try … … 137 137 { 138 138 fBeamSpotInputArray = 0; 139 } 140 139 } 140 141 141 // create output array 142 142 … … 170 170 *phiErrorHist = NULL; 171 171 172 if (!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0)172 if (!fBeamSpotInputArray || fBeamSpotInputArray->GetSize () == 0) 173 173 beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0); 174 174 else 175 175 { 176 Candidate &beamSpotCandidate = *((Candidate *) fBeamSpotInputArray->At(0));176 Candidate &beamSpotCandidate = *((Candidate *) fBeamSpotInputArray->At (0)); 177 177 beamSpotPosition = beamSpotCandidate.Position; 178 178 } 179 179 180 if (!fUseD0Formula)181 { 182 TFile *fin = TFile::Open(fD0ResolutionFile.c_str());183 d0ErrorHist = (TProfile2D *)fin->Get(fD0ResolutionHist.c_str());184 d0ErrorHist->SetDirectory(0);185 fin->Close();186 } 187 if (!fUseDZFormula)188 { 189 TFile *fin = TFile::Open(fDZResolutionFile.c_str());190 dzErrorHist = (TProfile2D *)fin->Get(fDZResolutionHist.c_str());191 dzErrorHist->SetDirectory(0);192 fin->Close();193 } 194 if (!fUsePFormula)195 { 196 TFile *fin = TFile::Open(fPResolutionFile.c_str());197 pErrorHist = (TProfile2D *)fin->Get(fPResolutionHist.c_str());198 pErrorHist->SetDirectory(0);199 fin->Close();200 } 201 if (!fUseCtgThetaFormula)202 { 203 TFile *fin = TFile::Open(fCtgThetaResolutionFile.c_str());204 ctgThetaErrorHist = (TProfile2D *)fin->Get(fCtgThetaResolutionHist.c_str());205 ctgThetaErrorHist->SetDirectory(0);206 fin->Close();207 } 208 if (!fUsePhiFormula)209 { 210 TFile *fin = TFile::Open(fPhiResolutionFile.c_str());211 phiErrorHist = (TProfile2D *)fin->Get(fPhiResolutionHist.c_str());212 phiErrorHist->SetDirectory(0);213 fin->Close();180 if (!fUseD0Formula) 181 { 182 TFile *fin = TFile::Open (fD0ResolutionFile.c_str ()); 183 d0ErrorHist = (TProfile2D *) fin->Get (fD0ResolutionHist.c_str ()); 184 d0ErrorHist->SetDirectory (0); 185 fin->Close (); 186 } 187 if (!fUseDZFormula) 188 { 189 TFile *fin = TFile::Open (fDZResolutionFile.c_str ()); 190 dzErrorHist = (TProfile2D *) fin->Get (fDZResolutionHist.c_str ()); 191 dzErrorHist->SetDirectory (0); 192 fin->Close (); 193 } 194 if (!fUsePFormula) 195 { 196 TFile *fin = TFile::Open (fPResolutionFile.c_str ()); 197 pErrorHist = (TProfile2D *) fin->Get (fPResolutionHist.c_str ()); 198 pErrorHist->SetDirectory (0); 199 fin->Close (); 200 } 201 if (!fUseCtgThetaFormula) 202 { 203 TFile *fin = TFile::Open (fCtgThetaResolutionFile.c_str ()); 204 ctgThetaErrorHist = (TProfile2D *) fin->Get (fCtgThetaResolutionHist.c_str ()); 205 ctgThetaErrorHist->SetDirectory (0); 206 fin->Close (); 207 } 208 if (!fUsePhiFormula) 209 { 210 TFile *fin = TFile::Open (fPhiResolutionFile.c_str ()); 211 phiErrorHist = (TProfile2D *) fin->Get (fPhiResolutionHist.c_str ()); 212 phiErrorHist->SetDirectory (0); 213 fin->Close (); 214 214 } 215 215 216 216 fItInputArray->Reset(); 217 while((candidate = static_cast<Candidate 218 { 219 217 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 218 { 219 220 220 const TLorentzVector &momentum = candidate->Momentum; 221 221 const TLorentzVector &position = candidate->InitialPosition; 222 222 223 223 pt = momentum.Pt(); 224 224 eta = momentum.Eta(); … … 226 226 d0 = trueD0 = candidate->D0; 227 227 dz = trueDZ = candidate->DZ; 228 228 229 229 p = trueP = candidate->P; 230 230 ctgTheta = trueCtgTheta = candidate->CtgTheta; 231 231 phi = truePhi = candidate->Phi; 232 232 233 if (fUseD0Formula)233 if (fUseD0Formula) 234 234 d0Error = fD0Formula->Eval(pt, eta); 235 235 else 236 236 { 237 Int_t xbin, ybin; 238 239 xbin = pt < d0ErrorHist->GetXaxis()->GetXmax() ? d0ErrorHist->GetXaxis()->FindBin(pt) : d0ErrorHist->GetXaxis()->GetBinCenter(d0ErrorHist->GetXaxis()->GetNbins()); 240 ybin = d0ErrorHist->GetYaxis()->FindBin(TMath::Abs(eta)); 241 d0Error = d0ErrorHist->GetBinContent(xbin, ybin); 242 if(!d0Error) 243 d0Error = -1.0; 244 } 245 if(d0Error < 0.0) 237 Int_t xbin, ybin; 238 239 xbin = pt < d0ErrorHist->GetXaxis ()->GetXmax () ? d0ErrorHist->GetXaxis ()->FindBin (pt) 240 : d0ErrorHist->GetXaxis ()->GetBinCenter (d0ErrorHist->GetXaxis ()->GetNbins ()); 241 ybin = d0ErrorHist->GetYaxis ()->FindBin (TMath::Abs (eta)); 242 d0Error = d0ErrorHist->GetBinContent (xbin, ybin); 243 if (!d0Error) 244 d0Error = -1.0; 245 } 246 if (d0Error < 0.0) 246 247 continue; 247 248 248 if (fUseDZFormula)249 if (fUseDZFormula) 249 250 dzError = fDZFormula->Eval(pt, eta); 250 251 else 251 252 { 252 Int_t xbin, ybin; 253 254 xbin = pt < dzErrorHist->GetXaxis()->GetXmax() ? dzErrorHist->GetXaxis()->FindBin(pt) : dzErrorHist->GetXaxis()->GetBinCenter(dzErrorHist->GetXaxis()->GetNbins()); 255 ybin = dzErrorHist->GetYaxis()->FindBin(TMath::Abs(eta)); 256 dzError = dzErrorHist->GetBinContent(xbin, ybin); 257 if(!dzError) 258 dzError = -1.0; 259 } 260 if(dzError < 0.0) 253 Int_t xbin, ybin; 254 255 xbin = pt < dzErrorHist->GetXaxis ()->GetXmax () ? dzErrorHist->GetXaxis ()->FindBin (pt) 256 : dzErrorHist->GetXaxis ()->GetBinCenter (dzErrorHist->GetXaxis ()->GetNbins ()); 257 ybin = dzErrorHist->GetYaxis ()->FindBin (TMath::Abs (eta)); 258 dzError = dzErrorHist->GetBinContent (xbin, ybin); 259 if (!dzError) 260 dzError = -1.0; 261 } 262 if (dzError < 0.0) 261 263 continue; 262 264 263 if (fUsePFormula)265 if (fUsePFormula) 264 266 pError = fPFormula->Eval(pt, eta) * p; 265 267 else 266 268 { 267 Int_t xbin, ybin; 268 269 xbin = pt < pErrorHist->GetXaxis()->GetXmax() ? pErrorHist->GetXaxis()->FindBin(pt) : pErrorHist->GetXaxis()->GetBinCenter(pErrorHist->GetXaxis()->GetNbins()); 270 ybin = pErrorHist->GetYaxis()->FindBin(TMath::Abs(eta)); 271 pError = pErrorHist->GetBinContent(xbin, ybin) * p; 272 if(!pError) 273 pError = -1.0; 274 } 275 if(pError < 0.0) 269 Int_t xbin, ybin; 270 271 xbin = pt < pErrorHist->GetXaxis ()->GetXmax () ? pErrorHist->GetXaxis ()->FindBin (pt) 272 : pErrorHist->GetXaxis ()->GetBinCenter (pErrorHist->GetXaxis ()->GetNbins ()); 273 ybin = pErrorHist->GetYaxis ()->FindBin (TMath::Abs (eta)); 274 pError = pErrorHist->GetBinContent (xbin, ybin) * p; 275 if (!pError) 276 pError = -1.0; 277 } 278 if (pError < 0.0) 276 279 continue; 277 280 278 if (fUseCtgThetaFormula)281 if (fUseCtgThetaFormula) 279 282 ctgThetaError = fCtgThetaFormula->Eval(pt, eta); 280 283 else 281 284 { 282 Int_t xbin, ybin; 283 284 xbin = pt < ctgThetaErrorHist->GetXaxis()->GetXmax() ? ctgThetaErrorHist->GetXaxis()->FindBin(pt) : ctgThetaErrorHist->GetXaxis()->GetBinCenter(ctgThetaErrorHist->GetXaxis()->GetNbins()); 285 ybin = ctgThetaErrorHist->GetYaxis()->FindBin(TMath::Abs(eta)); 286 ctgThetaError = ctgThetaErrorHist->GetBinContent(xbin, ybin); 287 if(!ctgThetaError) 288 ctgThetaError = -1.0; 289 } 290 if(ctgThetaError < 0.0) 285 Int_t xbin, ybin; 286 287 xbin = pt < ctgThetaErrorHist->GetXaxis ()->GetXmax () ? ctgThetaErrorHist->GetXaxis ()->FindBin (pt) 288 : ctgThetaErrorHist->GetXaxis ()->GetBinCenter (ctgThetaErrorHist->GetXaxis ()->GetNbins ()); 289 ybin = ctgThetaErrorHist->GetYaxis ()->FindBin (TMath::Abs (eta)); 290 ctgThetaError = ctgThetaErrorHist->GetBinContent (xbin, ybin); 291 if (!ctgThetaError) 292 ctgThetaError = -1.0; 293 } 294 if (ctgThetaError < 0.0) 291 295 continue; 292 296 293 if (fUsePhiFormula)297 if (fUsePhiFormula) 294 298 phiError = fPhiFormula->Eval(pt, eta); 295 299 else 296 300 { 297 Int_t xbin, ybin; 298 299 xbin = pt < phiErrorHist->GetXaxis()->GetXmax() ? phiErrorHist->GetXaxis()->FindBin(pt) : phiErrorHist->GetXaxis()->GetBinCenter(phiErrorHist->GetXaxis()->GetNbins()); 300 ybin = phiErrorHist->GetYaxis()->FindBin(TMath::Abs(eta)); 301 phiError = phiErrorHist->GetBinContent(xbin, ybin); 302 if(!phiError) 303 phiError = -1.0; 304 } 305 if(phiError < 0.0) 301 Int_t xbin, ybin; 302 303 xbin = pt < phiErrorHist->GetXaxis ()->GetXmax () ? phiErrorHist->GetXaxis ()->FindBin (pt) 304 : phiErrorHist->GetXaxis ()->GetBinCenter (phiErrorHist->GetXaxis ()->GetNbins ()); 305 ybin = phiErrorHist->GetYaxis ()->FindBin (TMath::Abs (eta)); 306 phiError = phiErrorHist->GetBinContent (xbin, ybin); 307 if (!phiError) 308 phiError = -1.0; 309 } 310 if (phiError < 0.0) 306 311 continue; 307 312 308 if (fApplyToPileUp || !candidate->IsPU)309 { 310 d0 = gRandom->Gaus(d0, d0Error);311 dz = gRandom->Gaus(dz, dzError);312 p = gRandom->Gaus(p, pError);313 ctgTheta = gRandom->Gaus(ctgTheta, ctgThetaError);314 phi = gRandom->Gaus(phi, phiError);313 if (fApplyToPileUp || !candidate->IsPU) 314 { 315 d0 = gRandom->Gaus(d0, d0Error); 316 dz = gRandom->Gaus(dz, dzError); 317 p = gRandom->Gaus(p, pError); 318 ctgTheta = gRandom->Gaus(ctgTheta, ctgThetaError); 319 phi = gRandom->Gaus(phi, phiError); 315 320 } 316 321 317 322 if(p < 0.0) continue; 318 while (phi > TMath::Pi()) phi -= TMath::TwoPi();319 while (phi <= -TMath::Pi()) phi += TMath::TwoPi();323 while (phi > TMath::Pi ()) phi -= TMath::TwoPi (); 324 while (phi <= -TMath::Pi ()) phi += TMath::TwoPi (); 320 325 321 326 mother = candidate; 322 candidate = static_cast<Candidate 327 candidate = static_cast<Candidate*>(candidate->Clone()); 323 328 candidate->D0 = d0; 324 329 candidate->DZ = dz; … … 327 332 candidate->Phi = phi; 328 333 329 theta = TMath::ACos(ctgTheta / TMath::Sqrt (1.0 + ctgTheta * ctgTheta));330 candidate->Momentum.SetPx (p * TMath::Cos(phi) * TMath::Sin(theta));331 candidate->Momentum.SetPy (p * TMath::Sin(phi) * TMath::Sin(theta));332 candidate->Momentum.SetPz (p * TMath::Cos(theta));333 candidate->Momentum.SetE (candidate->Momentum.Pt() * TMath::CosH(eta));334 candidate->PT = candidate->Momentum.Pt ();335 336 x = position.X ();337 y = position.Y ();338 z = position.Z ();339 t = position.T ();340 px = candidate->Momentum.Px ();341 py = candidate->Momentum.Py ();342 pz = candidate->Momentum.Pz ();343 pt = candidate->Momentum.Pt ();344 334 theta = TMath::ACos(ctgTheta / TMath::Sqrt (1.0 + ctgTheta * ctgTheta)); 335 candidate->Momentum.SetPx (p * TMath::Cos (phi) * TMath::Sin (theta)); 336 candidate->Momentum.SetPy (p * TMath::Sin (phi) * TMath::Sin (theta)); 337 candidate->Momentum.SetPz (p * TMath::Cos (theta)); 338 candidate->Momentum.SetE (candidate->Momentum.Pt () * TMath::CosH (eta)); 339 candidate->PT = candidate->Momentum.Pt (); 340 341 x = position.X (); 342 y = position.Y (); 343 z = position.Z (); 344 t = position.T (); 345 px = candidate->Momentum.Px (); 346 py = candidate->Momentum.Py (); 347 pz = candidate->Momentum.Pz (); 348 pt = candidate->Momentum.Pt (); 349 345 350 // -- solve for delta: d0' = ( (x+delta)*py' - (y+delta)*px' )/pt' 346 347 candidate->InitialPosition.SetX (x + ((px * y - py * x + d0 * pt) / (py - px)));348 candidate->InitialPosition.SetY (y + ((px * y - py * x + d0 * pt) / (py - px)));349 x = candidate->InitialPosition.X ();350 y = candidate->InitialPosition.Y ();351 candidate->InitialPosition.SetZ (z + ((pz * (px * (x - beamSpotPosition.X()) + py * (y - beamSpotPosition.Y())) + pt * pt * (dz - z)) / (pt * pt)));352 z = candidate->InitialPosition.Z ();351 352 candidate->InitialPosition.SetX (x + ((px * y - py * x + d0 * pt) / (py - px))); 353 candidate->InitialPosition.SetY (y + ((px * y - py * x + d0 * pt) / (py - px))); 354 x = candidate->InitialPosition.X (); 355 y = candidate->InitialPosition.Y (); 356 candidate->InitialPosition.SetZ (z + ((pz * (px * (x - beamSpotPosition.X ()) + py * (y - beamSpotPosition.Y ())) + pt * pt * (dz - z)) / (pt * pt))); 357 z = candidate->InitialPosition.Z (); 353 358 354 359 candidate->InitialPosition.SetT(t); … … 361 366 q = candidate->Charge; 362 367 363 r = pt / (q * fBz) * 1.0E9 / c_light;// in [m]368 r = pt / (q * fBz) * 1.0E9/c_light; // in [m] 364 369 phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi] 365 370 366 371 // 2. helix axis coordinates 367 x_c = x + r *TMath::Sin(phi_0);368 y_c = y - r *TMath::Cos(phi_0);372 x_c = x + r*TMath::Sin(phi_0); 373 y_c = y - r*TMath::Cos(phi_0); 369 374 r_c = TMath::Hypot(x_c, y_c); 370 375 371 376 rcu = TMath::Abs(r); 372 rc2 = r_c *r_c;377 rc2 = r_c*r_c; 373 378 374 379 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 375 xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c *y_c;380 xd = x_c*x_c*x_c - x_c*rcu*r_c + x_c*y_c*y_c; 376 381 xd = (rc2 > 0.0) ? xd / rc2 : -999; 377 yd = y_c * (-rcu *r_c + rc2);382 yd = y_c*(-rcu*r_c + rc2); 378 383 yd = (rc2 > 0.0) ? yd / rc2 : -999; 379 zd = z + (TMath::Sqrt(xd * xd + yd * yd) - TMath::Sqrt(x * x + y * y)) * pz /pt;380 381 candidate->Xd = xd *1.0E3;382 candidate->Yd = yd *1.0E3;383 candidate->Zd = zd *1.0E3;384 385 if (fApplyToPileUp || !candidate->IsPU)386 { 387 candidate->ErrorD0 = d0Error;388 candidate->ErrorDZ = dzError;389 candidate->ErrorP = pError;390 candidate->ErrorCtgTheta = ctgThetaError;391 candidate->ErrorPhi = phiError;392 candidate->ErrorPT = ptError(p, ctgTheta, pError, ctgThetaError);393 candidate->TrackResolution = pError /p;394 } 395 384 zd = z + (TMath::Sqrt(xd*xd + yd*yd) - TMath::Sqrt(x*x + y*y))*pz/pt; 385 386 candidate->Xd = xd*1.0E3; 387 candidate->Yd = yd*1.0E3; 388 candidate->Zd = zd*1.0E3; 389 390 if (fApplyToPileUp || !candidate->IsPU) 391 { 392 candidate->ErrorD0 = d0Error; 393 candidate->ErrorDZ = dzError; 394 candidate->ErrorP = pError; 395 candidate->ErrorCtgTheta = ctgThetaError; 396 candidate->ErrorPhi = phiError; 397 candidate->ErrorPT = ptError (p, ctgTheta, pError, ctgThetaError); 398 candidate->TrackResolution = pError/p; 399 } 400 396 401 candidate->AddCandidate(mother); 397 402 fOutputArray->Add(candidate); … … 401 406 } 402 407 403 Double_t TrackSmearing::ptError (const Double_t p, const Double_t ctgTheta, const Double_t dP, const Double_t dCtgTheta)408 Double_t TrackSmearing::ptError (const Double_t p, const Double_t ctgTheta, const Double_t dP, const Double_t dCtgTheta) 404 409 { 405 410 Double_t a, b; 406 411 a = (p * p * ctgTheta * ctgTheta * dCtgTheta * dCtgTheta) / ((ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1)); 407 412 b = (dP * dP) / (ctgTheta * ctgTheta + 1); 408 return sqrt (a + b);409 } 410 411 //------------------------------------------------------------------------------ 413 return sqrt (a + b); 414 } 415 416 //------------------------------------------------------------------------------ -
modules/TrackSmearing.h
r0e7d64a re39abb4 21 21 { 22 22 public: 23 23 24 TrackSmearing(); 24 25 ~TrackSmearing(); … … 29 30 30 31 private: 31 Double_t ptError(const Double_t, const Double_t, const Double_t, const Double_t); 32 33 Double_t ptError (const Double_t, const Double_t, const Double_t, const Double_t); 32 34 33 35 Double_t fBz; … … 64 66 const TObjArray *fInputArray; //! 65 67 const TObjArray *fBeamSpotInputArray; //! 66 68 67 69 TObjArray *fOutputArray; //! 68 70 -
modules/TreeWriter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class TreeWriter 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 #include "ExRootAnalysis/ExRootTreeBranch.h" 37 38 39 #include "TROOT.h" 40 #include "TMath.h" 41 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 38 45 #include "TDatabasePDG.h" 39 #include "TFormula.h"40 46 #include "TLorentzVector.h" 41 #include "TMath.h"42 #include "TObjArray.h"43 #include "TROOT.h"44 #include "TRandom3.h"45 #include "TString.h"46 47 47 48 #include <algorithm> 49 #include <stdexcept> 48 50 #include <iostream> 49 51 #include <sstream> 50 #include <stdexcept>51 52 52 53 using namespace std; … … 83 84 84 85 TBranchMap::iterator itBranchMap; 85 map< TClass *, TProcessMethod>::iterator itClassMap;86 map< TClass *, TProcessMethod >::iterator itClassMap; 86 87 87 88 // read branch configuration and … … 96 97 97 98 size = param.GetSize(); 98 for(i = 0; i < size /3; ++i)99 { 100 branchInputArray = param[i *3].GetString();101 branchName = param[i *3 + 1].GetString();102 branchClassName = param[i *3 + 2].GetString();99 for(i = 0; i < size/3; ++i) 100 { 101 branchInputArray = param[i*3].GetString(); 102 branchName = param[i*3 + 1].GetString(); 103 branchClassName = param[i*3 + 2].GetString(); 103 104 104 105 branchClass = gROOT->GetClass(branchClassName); … … 122 123 fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array))); 123 124 } 125 124 126 } 125 127 … … 137 139 it1.Reset(); 138 140 array->Clear(); 139 while((candidate = static_cast<Candidate 141 while((candidate = static_cast<Candidate*>(it1.Next()))) 140 142 { 141 143 TIter it2(candidate->GetCandidates()); … … 149 151 150 152 // track 151 candidate = static_cast<Candidate 153 candidate = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 152 154 if(candidate->GetCandidates()->GetEntriesFast() == 0) 153 155 { … … 158 160 // tower 159 161 it2.Reset(); 160 while((candidate = static_cast<Candidate 162 while((candidate = static_cast<Candidate*>(it2.Next()))) 161 163 { 162 164 array->Add(candidate->GetCandidates()->At(0)); … … 178 180 // loop over all particles 179 181 iterator.Reset(); 180 while((candidate = static_cast<Candidate 182 while((candidate = static_cast<Candidate*>(iterator.Next()))) 181 183 { 182 184 const TLorentzVector &momentum = candidate->Momentum; 183 185 const TLorentzVector &position = candidate->Position; 184 186 185 entry = static_cast<GenParticle 187 entry = static_cast<GenParticle*>(branch->NewEntry()); 186 188 187 189 entry->SetBit(kIsReferenced); … … 191 193 cosTheta = TMath::Abs(momentum.CosTheta()); 192 194 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 193 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());194 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());195 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 196 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 195 197 196 198 entry->PID = candidate->PID; … … 213 215 entry->Pz = momentum.Pz(); 214 216 215 entry->D0 = candidate->D0;216 entry->DZ = candidate->DZ;217 entry->P = candidate->P;218 entry->PT = candidate->PT;219 entry->CtgTheta = candidate->CtgTheta;220 entry->Phi = candidate->Phi;217 entry->D0 = candidate->D0; 218 entry->DZ = candidate->DZ; 219 entry->P = candidate->P; 220 entry->PT = candidate->PT; 221 entry->CtgTheta = candidate->CtgTheta; 222 entry->Phi = candidate->Phi; 221 223 222 224 entry->Eta = eta; … … 229 231 entry->Y = position.Y(); 230 232 entry->Z = position.Z(); 231 entry->T = position.T() * 1.0E-3 /c_light;233 entry->T = position.T()*1.0E-3/c_light; 232 234 } 233 235 } … … 253 255 // loop over all vertices 254 256 iterator.Reset(); 255 while((candidate = static_cast<Candidate 257 while((candidate = static_cast<Candidate*>(iterator.Next()))) 256 258 { 257 259 … … 267 269 y = candidate->Position.Y(); 268 270 z = candidate->Position.Z(); 269 t = candidate->Position.T() * 1.0E-3 /c_light;270 271 xError = candidate->PositionError.X ();272 yError = candidate->PositionError.Y ();273 zError = candidate->PositionError.Z ();274 tError = candidate->PositionError.T () * 1.0E-3 /c_light;275 276 entry = static_cast<Vertex 271 t = candidate->Position.T()*1.0E-3/c_light; 272 273 xError = candidate->PositionError.X (); 274 yError = candidate->PositionError.Y (); 275 zError = candidate->PositionError.Z (); 276 tError = candidate->PositionError.T ()*1.0E-3/c_light; 277 278 entry = static_cast<Vertex*>(branch->NewEntry()); 277 279 278 280 entry->Index = index; … … 294 296 entry->ErrorT = tError; 295 297 298 296 299 TIter itConstituents(candidate->GetCandidates()); 297 300 itConstituents.Reset(); 298 301 entry->Constituents.Clear(); 299 while((constituent = static_cast<Candidate 302 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) 300 303 { 301 304 entry->Constituents.Add(constituent); 302 305 } 303 } 304 } 306 307 } 308 } 309 305 310 306 311 //------------------------------------------------------------------------------ … … 317 322 // loop over all tracks 318 323 iterator.Reset(); 319 while((candidate = static_cast<Candidate 324 while((candidate = static_cast<Candidate*>(iterator.Next()))) 320 325 { 321 326 const TLorentzVector &position = candidate->Position; … … 323 328 cosTheta = TMath::Abs(position.CosTheta()); 324 329 signz = (position.Pz() >= 0.0) ? 1.0 : -1.0; 325 eta = (cosTheta == 1.0 ? signz *999.9 : position.Eta());326 rapidity = (cosTheta == 1.0 ? signz *999.9 : position.Rapidity());327 328 entry = static_cast<Track 330 eta = (cosTheta == 1.0 ? signz*999.9 : position.Eta()); 331 rapidity = (cosTheta == 1.0 ? signz*999.9 : position.Rapidity()); 332 333 entry = static_cast<Track*>(branch->NewEntry()); 329 334 330 335 entry->SetBit(kIsReferenced); … … 341 346 entry->YOuter = position.Y(); 342 347 entry->ZOuter = position.Z(); 343 entry->TOuter = position.T() * 1.0E-3 /c_light;348 entry->TOuter = position.T()*1.0E-3/c_light; 344 349 345 350 entry->L = candidate->L; 346 351 347 entry->D0 = candidate->D0;348 entry->ErrorD0 = candidate->ErrorD0;349 entry->DZ = candidate->DZ;350 entry->ErrorDZ = candidate->ErrorDZ;351 352 entry->ErrorP = candidate->ErrorP;353 entry->ErrorPT = candidate->ErrorPT;352 entry->D0 = candidate->D0; 353 entry->ErrorD0 = candidate->ErrorD0; 354 entry->DZ = candidate->DZ; 355 entry->ErrorDZ = candidate->ErrorDZ; 356 357 entry->ErrorP = candidate->ErrorP; 358 entry->ErrorPT = candidate->ErrorPT; 354 359 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 355 entry->ErrorPhi = candidate->ErrorPhi;360 entry->ErrorPhi = candidate->ErrorPhi; 356 361 357 362 entry->Xd = candidate->Xd; … … 364 369 p = momentum.P(); 365 370 phi = momentum.Phi(); 366 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 /TMath::Tan(momentum.Theta()) : 1e10;371 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1/TMath::Tan(momentum.Theta()) : 1e10; 367 372 368 373 cosTheta = TMath::Abs(momentum.CosTheta()); 369 374 signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 370 eta = (cosTheta == 1.0 ? signz *999.9 : momentum.Eta());371 rapidity = (cosTheta == 1.0 ? signz *999.9 : momentum.Rapidity());375 eta = (cosTheta == 1.0 ? signz*999.9 : momentum.Eta()); 376 rapidity = (cosTheta == 1.0 ? signz*999.9 : momentum.Rapidity()); 372 377 373 378 entry->P = p; 374 entry->PT = pt;379 entry->PT = pt; 375 380 entry->Eta = eta; 376 381 entry->Phi = phi; 377 382 entry->CtgTheta = ctgTheta; 378 383 379 particle = static_cast<Candidate 384 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0)); 380 385 const TLorentzVector &initialPosition = particle->Position; 381 386 … … 383 388 entry->Y = initialPosition.Y(); 384 389 entry->Z = initialPosition.Z(); 385 entry->T = initialPosition.T() * 1.0E-3 /c_light;390 entry->T = initialPosition.T()*1.0E-3/c_light; 386 391 387 392 entry->Particle = particle; 388 393 389 394 entry->VertexIndex = candidate->ClusterIndex; 395 390 396 } 391 397 } … … 403 409 // loop over all towers 404 410 iterator.Reset(); 405 while((candidate = static_cast<Candidate 411 while((candidate = static_cast<Candidate*>(iterator.Next()))) 406 412 { 407 413 const TLorentzVector &momentum = candidate->Momentum; … … 411 417 cosTheta = TMath::Abs(momentum.CosTheta()); 412 418 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 413 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());414 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());415 416 entry = static_cast<Tower 419 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 420 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 421 422 entry = static_cast<Tower*>(branch->NewEntry()); 417 423 418 424 entry->SetBit(kIsReferenced); … … 430 436 entry->Edges[3] = candidate->Edges[3]; 431 437 432 entry->T = position.T() * 1.0E-3 /c_light;438 entry->T = position.T()*1.0E-3/c_light; 433 439 entry->NTimeHits = candidate->NTimeHits; 434 440 … … 451 457 // loop over all photons 452 458 iterator.Reset(); 453 while((candidate = static_cast<Candidate 459 while((candidate = static_cast<Candidate*>(iterator.Next()))) 454 460 { 455 461 TIter it1(candidate->GetCandidates()); … … 460 466 cosTheta = TMath::Abs(momentum.CosTheta()); 461 467 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 462 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());463 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());464 465 entry = static_cast<Photon 468 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 469 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 470 471 entry = static_cast<Photon*>(branch->NewEntry()); 466 472 467 473 entry->Eta = eta; … … 469 475 entry->PT = pt; 470 476 entry->E = momentum.E(); 471 entry->T = position.T() * 1.0E-3 /c_light;477 entry->T = position.T()*1.0E-3/c_light; 472 478 473 479 // Isolation variables 474 480 475 481 entry->IsolationVar = candidate->IsolationVar; 476 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;477 entry->SumPtCharged = candidate->SumPtCharged ;478 entry->SumPtNeutral = candidate->SumPtNeutral ;479 entry->SumPtChargedPU = candidate->SumPtChargedPU ;480 entry->SumPt = candidate->SumPt ;481 482 entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad /candidate->Eem : 999.9;482 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 483 entry->SumPtCharged = candidate->SumPtCharged ; 484 entry->SumPtNeutral = candidate->SumPtNeutral ; 485 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 486 entry->SumPt = candidate->SumPt ; 487 488 entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9; 483 489 484 490 // 1: prompt -- 2: non prompt -- 3: fake … … 503 509 // loop over all electrons 504 510 iterator.Reset(); 505 while((candidate = static_cast<Candidate 511 while((candidate = static_cast<Candidate*>(iterator.Next()))) 506 512 { 507 513 const TLorentzVector &momentum = candidate->Momentum; … … 511 517 cosTheta = TMath::Abs(momentum.CosTheta()); 512 518 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 513 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());514 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());515 516 entry = static_cast<Electron 519 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 520 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 521 522 entry = static_cast<Electron*>(branch->NewEntry()); 517 523 518 524 entry->Eta = eta; … … 520 526 entry->PT = pt; 521 527 522 entry->T = position.T() * 1.0E-3 / c_light; 523 524 // displacement 525 entry->D0 = candidate->D0; 526 entry->ErrorD0 = candidate->ErrorD0; 527 entry->DZ = candidate->DZ; 528 entry->ErrorDZ = candidate->ErrorDZ; 528 entry->T = position.T()*1.0E-3/c_light; 529 529 530 530 // Isolation variables 531 531 532 entry->IsolationVar = candidate->IsolationVar; 532 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr; 533 entry->SumPtCharged = candidate->SumPtCharged; 534 entry->SumPtNeutral = candidate->SumPtNeutral; 535 entry->SumPtChargedPU = candidate->SumPtChargedPU; 536 entry->SumPt = candidate->SumPt; 533 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 534 entry->SumPtCharged = candidate->SumPtCharged ; 535 entry->SumPtNeutral = candidate->SumPtNeutral ; 536 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 537 entry->SumPt = candidate->SumPt ; 538 537 539 538 540 entry->Charge = candidate->Charge; … … 559 561 // loop over all muons 560 562 iterator.Reset(); 561 while((candidate = static_cast<Candidate 563 while((candidate = static_cast<Candidate*>(iterator.Next()))) 562 564 { 563 565 const TLorentzVector &momentum = candidate->Momentum; … … 567 569 cosTheta = TMath::Abs(momentum.CosTheta()); 568 570 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 569 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());570 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());571 572 entry = static_cast<Muon 571 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 572 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 573 574 entry = static_cast<Muon*>(branch->NewEntry()); 573 575 574 576 entry->SetBit(kIsReferenced); … … 579 581 entry->PT = pt; 580 582 581 entry->T = position.T() * 1.0E-3 / c_light; 582 583 // displacement 584 entry->D0 = candidate->D0; 585 entry->ErrorD0 = candidate->ErrorD0; 586 entry->DZ = candidate->DZ; 587 entry->ErrorDZ = candidate->ErrorDZ; 583 entry->T = position.T()*1.0E-3/c_light; 588 584 589 585 // Isolation variables 590 586 591 587 entry->IsolationVar = candidate->IsolationVar; 592 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;593 entry->SumPtCharged = candidate->SumPtCharged ;594 entry->SumPtNeutral = candidate->SumPtNeutral ;595 entry->SumPtChargedPU = candidate->SumPtChargedPU ;596 entry->SumPt = candidate->SumPt ;588 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 589 entry->SumPtCharged = candidate->SumPtCharged ; 590 entry->SumPtNeutral = candidate->SumPtNeutral ; 591 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 592 entry->SumPt = candidate->SumPt ; 597 593 598 594 entry->Charge = candidate->Charge; … … 618 614 // loop over all jets 619 615 iterator.Reset(); 620 while((candidate = static_cast<Candidate 616 while((candidate = static_cast<Candidate*>(iterator.Next()))) 621 617 { 622 618 TIter itConstituents(candidate->GetCandidates()); … … 628 624 cosTheta = TMath::Abs(momentum.CosTheta()); 629 625 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 630 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());631 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());632 633 entry = static_cast<Jet 626 eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta()); 627 rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity()); 628 629 entry = static_cast<Jet*>(branch->NewEntry()); 634 630 635 631 entry->Eta = eta; … … 637 633 entry->PT = pt; 638 634 639 entry->T = position.T() * 1.0E-3 /c_light;635 entry->T = position.T()*1.0E-3/c_light; 640 636 641 637 entry->Mass = momentum.M(); … … 664 660 ecalEnergy = 0.0; 665 661 hcalEnergy = 0.0; 666 while((constituent = static_cast<Candidate 662 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) 667 663 { 668 664 entry->Constituents.Add(constituent); … … 671 667 } 672 668 673 entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy /ecalEnergy : 999.9;669 entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy/ecalEnergy : 999.9; 674 670 675 671 //--- Pile-Up Jet ID variables ---- … … 688 684 entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped; 689 685 690 entry->SoftDroppedJet = candidate->SoftDroppedJet;691 entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1 ;686 entry->SoftDroppedJet = candidate->SoftDroppedJet ; 687 entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1 ; 692 688 entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2; 689 693 690 694 691 for(i = 0; i < 5; i++) 695 692 { 696 entry->FracPt[i] = candidate ->FracPt[i];697 entry->Tau[i] = candidate ->Tau[i];698 entry->TrimmedP4[i] = candidate ->TrimmedP4[i];699 entry->PrunedP4[i] = candidate ->PrunedP4[i];700 entry->SoftDroppedP4[i] = candidate ->SoftDroppedP4[i];693 entry->FracPt[i] = candidate -> FracPt[i]; 694 entry->Tau[i] = candidate -> Tau[i]; 695 entry->TrimmedP4[i] = candidate -> TrimmedP4[i]; 696 entry->PrunedP4[i] = candidate -> PrunedP4[i]; 697 entry->SoftDroppedP4[i] = candidate -> SoftDroppedP4[i]; 701 698 } 702 699 … … 705 702 entry->ExclYmerge34 = candidate->ExclYmerge34; 706 703 entry->ExclYmerge45 = candidate->ExclYmerge45; 707 entry->ExclYmerge56 = candidate->ExclYmerge56; 704 entry->ExclYmerge56 = candidate->ExclYmerge56; 705 708 706 709 707 FillParticles(candidate, &entry->Particles); … … 719 717 720 718 // get the first entry 721 if((candidate = static_cast<Candidate 722 { 723 const TLorentzVector &momentum = candidate->Momentum; 724 725 entry = static_cast<MissingET 719 if((candidate = static_cast<Candidate*>(array->At(0)))) 720 { 721 const TLorentzVector &momentum = candidate->Momentum; 722 723 entry = static_cast<MissingET*>(branch->NewEntry()); 726 724 727 725 entry->Eta = (-momentum).Eta(); … … 739 737 740 738 // get the first entry 741 if((candidate = static_cast<Candidate 742 { 743 const TLorentzVector &momentum = candidate->Momentum; 744 745 entry = static_cast<ScalarHT 739 if((candidate = static_cast<Candidate*>(array->At(0)))) 740 { 741 const TLorentzVector &momentum = candidate->Momentum; 742 743 entry = static_cast<ScalarHT*>(branch->NewEntry()); 746 744 747 745 entry->HT = momentum.Pt(); … … 759 757 // loop over all rho 760 758 iterator.Reset(); 761 while((candidate = static_cast<Candidate 762 { 763 const TLorentzVector &momentum = candidate->Momentum; 764 765 entry = static_cast<Rho 759 while((candidate = static_cast<Candidate*>(iterator.Next()))) 760 { 761 const TLorentzVector &momentum = candidate->Momentum; 762 763 entry = static_cast<Rho*>(branch->NewEntry()); 766 764 767 765 entry->Rho = momentum.E(); … … 779 777 780 778 // get the first entry 781 if((candidate = static_cast<Candidate 782 { 783 const TLorentzVector &momentum = candidate->Momentum; 784 785 entry = static_cast<Weight 779 if((candidate = static_cast<Candidate*>(array->At(0)))) 780 { 781 const TLorentzVector &momentum = candidate->Momentum; 782 783 entry = static_cast<Weight*>(branch->NewEntry()); 786 784 787 785 entry->Weight = momentum.E(); … … 799 797 // loop over all roman pot hits 800 798 iterator.Reset(); 801 while((candidate = static_cast<Candidate 799 while((candidate = static_cast<Candidate*>(iterator.Next()))) 802 800 { 803 801 const TLorentzVector &position = candidate->Position; 804 802 const TLorentzVector &momentum = candidate->Momentum; 805 803 806 entry = static_cast<HectorHit 804 entry = static_cast<HectorHit*>(branch->NewEntry()); 807 805 808 806 entry->E = momentum.E(); -
modules/TreeWriter.h
r0e7d64a re39abb4 42 42 { 43 43 public: 44 44 45 TreeWriter(); 45 46 ~TreeWriter(); … … 50 51 51 52 private: 53 52 54 void FillParticles(Candidate *candidate, TRefArray *array); 53 55 … … 70 72 typedef void (TreeWriter::*TProcessMethod)(ExRootTreeBranch *, TObjArray *); //! 71 73 72 typedef std::map< ExRootTreeBranch *, std::pair<TProcessMethod, TObjArray *> > TBranchMap; //!74 typedef std::map< ExRootTreeBranch *, std::pair< TProcessMethod, TObjArray * > > TBranchMap; //! 73 75 74 76 TBranchMap fBranchMap; //! 75 77 76 std::map< TClass *, TProcessMethod> fClassMap; //!78 std::map< TClass *, TProcessMethod > fClassMap; //! 77 79 #endif 78 80 -
modules/UniqueObjectFinder.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class UniqueObjectFinder 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 #include <algorithm> 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 66 67 void UniqueObjectFinder::Init() 67 68 { 68 // use GetUniqueID algorithm to find unique objects (faster than the default Overlaps method)69 fUseUniqueID = GetBool("UseUniqueID", false);70 71 69 // import arrays with output from other modules 72 70 … … 79 77 80 78 size = param.GetSize(); 81 for(i = 0; i < size /2; ++i)79 for(i = 0; i < size/2; ++i) 82 80 { 83 array = ImportArray(param[i *2].GetString());81 array = ImportArray(param[i*2].GetString()); 84 82 iterator = array->MakeIterator(); 85 83 86 fInputMap.push_back(make_pair(iterator, ExportArray(param[i *2 + 1].GetString())));84 fInputMap.push_back(make_pair(iterator, ExportArray(param[i*2 + 1].GetString()))); 87 85 } 88 86 } … … 92 90 void UniqueObjectFinder::Finish() 93 91 { 94 vector< pair<TIterator *, TObjArray *> >::iterator itInputMap;92 vector< pair< TIterator *, TObjArray * > >::iterator itInputMap; 95 93 TIterator *iterator; 96 94 … … 108 106 { 109 107 Candidate *candidate; 110 vector< pair<TIterator *, TObjArray *> >::iterator itInputMap;108 vector< pair< TIterator *, TObjArray * > >::iterator itInputMap; 111 109 TIterator *iterator; 112 110 TObjArray *array; … … 120 118 // loop over all candidates 121 119 iterator->Reset(); 122 while((candidate = static_cast<Candidate 120 while((candidate = static_cast<Candidate*>(iterator->Next()))) 123 121 { 124 122 if(Unique(candidate, itInputMap)) … … 132 130 //------------------------------------------------------------------------------ 133 131 134 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair<TIterator *, TObjArray *> >::iterator itInputMap)132 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray * > >::iterator itInputMap) 135 133 { 136 134 Candidate *previousCandidate; 137 vector< pair<TIterator *, TObjArray *> >::iterator previousItInputMap;135 vector< pair< TIterator *, TObjArray * > >::iterator previousItInputMap; 138 136 TObjArray *array; 139 137 … … 146 144 // loop over all candidates 147 145 iterator.Reset(); 148 while((previousCandidate = static_cast<Candidate 146 while((previousCandidate = static_cast<Candidate*>(iterator.Next()))) 149 147 { 150 if( fUseUniqueID)148 if(candidate->Overlaps(previousCandidate)) 151 149 { 152 if(candidate->GetUniqueID() == previousCandidate->GetUniqueID()) 153 { 154 return kFALSE; 155 } 156 } 157 else 158 { 159 if(candidate->Overlaps(previousCandidate)) 160 { 161 return kFALSE; 162 } 150 return kFALSE; 163 151 } 164 152 } -
modules/UniqueObjectFinder.h
r0e7d64a re39abb4 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <vector> 32 33 #include <utility> 33 #include <vector>34 34 35 35 class TIterator; … … 40 40 { 41 41 public: 42 42 43 UniqueObjectFinder(); 43 44 ~UniqueObjectFinder(); … … 48 49 49 50 private: 50 Bool_t fUseUniqueID;51 51 52 Bool_t Unique(Candidate *candidate, std::vector< std::pair<TIterator *, TObjArray *> >::iterator itInputMap);52 Bool_t Unique(Candidate *candidate, std::vector< std::pair< TIterator *, TObjArray * > >::iterator itInputMap); 53 53 54 std::vector< std::pair<TIterator *, TObjArray *> > fInputMap; //!54 std::vector< std::pair< TIterator *, TObjArray * > > fInputMap; //! 55 55 56 56 ClassDef(UniqueObjectFinder, 1) -
modules/VertexFinder.cc
r0e7d64a re39abb4 7 7 */ 8 8 9 9 10 #include "modules/VertexFinder.h" 10 11 #include "classes/DelphesClasses.h" … … 13 14 #include "classes/DelphesPileUpReader.h" 14 15 16 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 15 18 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 17 #include "ExRootAnalysis/ExRootResult.h" 18 19 20 #include "TMath.h" 21 #include "TString.h" 22 #include "TFormula.h" 23 #include "TRandom3.h" 24 #include "TObjArray.h" 19 25 #include "TDatabasePDG.h" 20 #include "TFormula.h"21 26 #include "TLorentzVector.h" 22 #include "TMath.h"23 27 #include "TMatrixT.h" 24 #include "TObjArray.h"25 #include "TRandom3.h"26 #include "TString.h"27 28 #include "TVector3.h" 28 29 30 #include <utility> 29 31 #include <algorithm> 32 #include <stdexcept> 30 33 #include <iostream> 34 #include <vector> 31 35 #include <map> 32 #include <stdexcept>33 36 #include <string> 34 #include <utility>35 #include <vector>36 37 37 38 using namespace std; 38 39 39 static const Double_t mm = 1.;40 static const Double_t m = 1000. *mm;41 static const Double_t ns = 1.;42 static const Double_t s = 1.e+9 * 43 static const Double_t c_light = 2.99792458e+8 * m /s;40 static const Double_t mm = 1.; 41 static const Double_t m = 1000.*mm; 42 static const Double_t ns = 1.; 43 static const Double_t s = 1.e+9 *ns; 44 static const Double_t c_light = 2.99792458e+8 * m/s; 44 45 45 46 //------------------------------------------------------------------------------ … … 83 84 //------------------------------------------------------------------------------ 84 85 85 static Bool_t secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)86 static Bool_t secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 86 87 { 87 88 return (pair0.second < pair1.second); 88 89 } 89 90 90 static Bool_t secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)91 static Bool_t secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 91 92 { 92 93 return (pair0.second > pair1.second); … … 100 101 101 102 // Clear the track and cluster maps before starting 102 trackIDToDouble.clear ();103 trackIDToInt.clear ();104 trackIDToBool.clear ();105 clusterIDToDouble.clear ();106 clusterIDToInt.clear ();107 clusterIDToBool.clear ();108 trackPT.clear ();109 clusterSumPT2.clear ();103 trackIDToDouble.clear (); 104 trackIDToInt.clear (); 105 trackIDToBool.clear (); 106 clusterIDToDouble.clear (); 107 clusterIDToInt.clear (); 108 clusterIDToBool.clear (); 109 trackPT.clear (); 110 clusterSumPT2.clear (); 110 111 111 112 // Create the initial cluster seeds 112 createSeeds ();113 createSeeds (); 113 114 114 115 // In order of descending seed pt, grow each cluster. If a cluster ends up with 115 116 // fewer than MinNDF tracks, release the tracks for other clusters to claim. 116 sort (clusterSumPT2.begin(), clusterSumPT2.end(), secondDescending);117 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin(); cluster != clusterSumPT2.end(); cluster++)118 {119 // Skip the cluster if it no longer has any tracks120 if(!clusterIDToInt.at(cluster->first).at("ndf"))121 continue;122 123 // Grow the cluster if GrowSeeds is true124 if(fGrowSeeds)125 growCluster(cluster->first);126 127 // If the cluster still has fewer than MinNDF tracks, release the tracks;128 // otherwise, mark the seed track as claimed129 130 if((Int_t)clusterIDToInt.at(cluster->first).at("ndf") < fMinNDF)131 {132 for(map<UInt_t, map<string, Int_t> >::iterator track = trackIDToInt.begin(); track != trackIDToInt.end(); track++)133 {134 if(track->second.at("clusterIndex") != (Int_t)cluster->first)135 continue;136 track->second["clusterIndex"] = -1;137 trackIDToBool[track->first]["claimed"] = false;138 }139 }140 else141 trackIDToBool[clusterIDToInt.at(cluster->first).at("seed")]["claimed"] = true;142 }117 sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending); 118 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++) 119 { 120 // Skip the cluster if it no longer has any tracks 121 if (!clusterIDToInt.at (cluster->first).at ("ndf")) 122 continue; 123 124 // Grow the cluster if GrowSeeds is true 125 if (fGrowSeeds) 126 growCluster (cluster->first); 127 128 // If the cluster still has fewer than MinNDF tracks, release the tracks; 129 // otherwise, mark the seed track as claimed 130 131 if ((Int_t) clusterIDToInt.at (cluster->first).at ("ndf") < fMinNDF) 132 { 133 for (map<UInt_t, map<string, Int_t> >::iterator track = trackIDToInt.begin (); track != trackIDToInt.end (); track++) 134 { 135 if (track->second.at ("clusterIndex") != (Int_t) cluster->first) 136 continue; 137 track->second["clusterIndex"] = -1; 138 trackIDToBool[track->first]["claimed"] = false; 139 } 140 } 141 else 142 trackIDToBool[clusterIDToInt.at (cluster->first).at ("seed")]["claimed"] = true; 143 } 143 144 144 145 // Add tracks to the output array after updating their ClusterIndex. 145 fItInputArray->Reset ();146 while((candidate = static_cast<Candidate 147 {148 if(candidate->Momentum.Pt() < fMinPT || fabs(candidate->Momentum.Eta()) > fMaxEta)149 continue;150 candidate->ClusterIndex = trackIDToInt.at(candidate->GetUniqueID()).at("clusterIndex");151 fOutputArray->Add(candidate);152 }146 fItInputArray->Reset (); 147 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 148 { 149 if (candidate->Momentum.Pt () < fMinPT || fabs (candidate->Momentum.Eta ()) > fMaxEta) 150 continue; 151 candidate->ClusterIndex = trackIDToInt.at (candidate->GetUniqueID ()).at ("clusterIndex"); 152 fOutputArray->Add(candidate); 153 } 153 154 154 155 // Add clusters with at least MinNDF tracks to the output array in order of 155 156 // descending sum(pt**2). 156 clusterSumPT2.clear ();157 for (map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin(); cluster != clusterIDToInt.end(); cluster++)157 clusterSumPT2.clear (); 158 for (map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin (); cluster != clusterIDToInt.end (); cluster++) 158 159 { 159 160 if (cluster->second.at("ndf") < fMinNDF)160 161 if (cluster->second.at ("ndf") < fMinNDF) 161 162 continue; 162 clusterSumPT2.push_back (make_pair(cluster->first, clusterIDToDouble.at(cluster->first).at("sumPT2")));163 clusterSumPT2.push_back (make_pair (cluster->first, clusterIDToDouble.at (cluster->first).at ("sumPT2"))); 163 164 } 164 sort (clusterSumPT2.begin(), clusterSumPT2.end(), secondDescending);165 166 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin(); cluster != clusterSumPT2.end(); cluster++)165 sort (clusterSumPT2.begin (), clusterSumPT2.end (), secondDescending); 166 167 for (vector<pair<UInt_t, Double_t> >::const_iterator cluster = clusterSumPT2.begin (); cluster != clusterSumPT2.end (); cluster++) 167 168 { 168 169 DelphesFactory *factory = GetFactory(); … … 170 171 171 172 candidate->ClusterIndex = cluster->first; 172 candidate->ClusterNDF = clusterIDToInt.at (cluster->first).at("ndf");173 candidate->ClusterNDF = clusterIDToInt.at (cluster->first).at ("ndf"); 173 174 candidate->ClusterSigma = fSigma; 174 175 candidate->SumPT2 = cluster->second; 175 candidate->Position.SetXYZT(0.0, 0.0, clusterIDToDouble.at (cluster->first).at("z"), 0.0);176 candidate->PositionError.SetXYZT(0.0, 0.0, clusterIDToDouble.at (cluster->first).at("ez"), 0.0);176 candidate->Position.SetXYZT(0.0, 0.0, clusterIDToDouble.at (cluster->first).at ("z"), 0.0); 177 candidate->PositionError.SetXYZT(0.0, 0.0, clusterIDToDouble.at (cluster->first).at ("ez"), 0.0); 177 178 178 179 fVertexOutputArray->Add(candidate); … … 182 183 //------------------------------------------------------------------------------ 183 184 184 void VertexFinder::createSeeds ()185 void VertexFinder::createSeeds () 185 186 { 186 187 Candidate *candidate; … … 189 190 // Loop over all tracks, initializing some variables. 190 191 fItInputArray->Reset(); 191 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 192 { 193 if(candidate->Momentum.Pt() < fMinPT || fabs(candidate->Momentum.Eta()) > fMaxEta) 194 continue; 195 196 trackIDToDouble[candidate->GetUniqueID()]["pt"] = candidate->Momentum.Pt(); 197 trackIDToDouble[candidate->GetUniqueID()]["ept"] = candidate->ErrorPT ? candidate->ErrorPT : 1.0e-15; 198 ; 199 trackIDToDouble[candidate->GetUniqueID()]["eta"] = candidate->Momentum.Eta(); 200 201 trackIDToDouble[candidate->GetUniqueID()]["z"] = candidate->DZ; 202 trackIDToDouble[candidate->GetUniqueID()]["ez"] = candidate->ErrorDZ ? candidate->ErrorDZ : 1.0e-15; 203 204 trackIDToInt[candidate->GetUniqueID()]["clusterIndex"] = -1; 205 trackIDToInt[candidate->GetUniqueID()]["interactionIndex"] = candidate->IsPU; 206 207 trackIDToBool[candidate->GetUniqueID()]["claimed"] = false; 208 209 trackPT.push_back(make_pair(candidate->GetUniqueID(), candidate->Momentum.Pt())); 210 } 192 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 193 { 194 if (candidate->Momentum.Pt () < fMinPT || fabs (candidate->Momentum.Eta ()) > fMaxEta) 195 continue; 196 197 trackIDToDouble[candidate->GetUniqueID ()]["pt"] = candidate->Momentum.Pt (); 198 trackIDToDouble[candidate->GetUniqueID ()]["ept"] = candidate->ErrorPT ? candidate->ErrorPT : 1.0e-15;; 199 trackIDToDouble[candidate->GetUniqueID ()]["eta"] = candidate->Momentum.Eta (); 200 201 trackIDToDouble[candidate->GetUniqueID ()]["z"] = candidate->DZ; 202 trackIDToDouble[candidate->GetUniqueID ()]["ez"] = candidate->ErrorDZ ? candidate->ErrorDZ : 1.0e-15; 203 204 trackIDToInt[candidate->GetUniqueID ()]["clusterIndex"] = -1; 205 trackIDToInt[candidate->GetUniqueID ()]["interactionIndex"] = candidate->IsPU; 206 207 trackIDToBool[candidate->GetUniqueID ()]["claimed"] = false; 208 209 trackPT.push_back (make_pair (candidate->GetUniqueID (), candidate->Momentum.Pt ())); 210 } 211 211 212 212 // Sort tracks by pt and leave only the SeedMinPT highest pt ones in the 213 213 // trackPT vector. 214 sort (trackPT.begin(), trackPT.end(), secondDescending);215 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin(); track != trackPT.end(); track++, maxSeeds++)216 {217 if(track->second < fSeedMinPT)218 break;219 }214 sort (trackPT.begin (), trackPT.end (), secondDescending); 215 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, maxSeeds++) 216 { 217 if (track->second < fSeedMinPT) 218 break; 219 } 220 220 // If there are no tracks with pt above MinSeedPT, create just one seed from 221 221 // the highest pt track. 222 if (!maxSeeds)222 if (!maxSeeds) 223 223 maxSeeds++; 224 if (trackPT.size() > maxSeeds)225 {226 trackPT.erase(trackPT.begin() + maxSeeds, trackPT.end());227 }224 if (trackPT.size () > maxSeeds) 225 { 226 trackPT.erase (trackPT.begin () + maxSeeds, trackPT.end ()); 227 } 228 228 229 229 // Create the seeds from the SeedMinPT highest pt tracks. 230 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin(); track != trackPT.end(); track++, clusterIndex++)231 {232 addTrackToCluster(track->first, clusterIndex);233 clusterSumPT2.push_back(make_pair(clusterIndex, track->second * track->second));234 }235 } 236 237 //------------------------------------------------------------------------------ 238 239 void VertexFinder::growCluster (const UInt_t clusterIndex)230 for (vector<pair<UInt_t, Double_t> >::const_iterator track = trackPT.begin (); track != trackPT.end (); track++, clusterIndex++) 231 { 232 addTrackToCluster (track->first, clusterIndex); 233 clusterSumPT2.push_back (make_pair (clusterIndex, track->second * track->second)); 234 } 235 } 236 237 //------------------------------------------------------------------------------ 238 239 void VertexFinder::growCluster (const UInt_t clusterIndex) 240 240 { 241 241 Bool_t done = false; … … 244 244 Double_t nearestDistance; 245 245 vector<UInt_t> nearTracks; 246 nearTracks.clear ();246 nearTracks.clear (); 247 247 248 248 // Grow the cluster until there are no more tracks within Sigma standard 249 249 // deviations of the cluster. 250 while(!done) 251 { 252 done = true; 253 nearestID = 0; 254 nearestDistance = -1.0; 255 256 // These two loops are for finding the nearest track to the cluster. The 257 // first time, the ID of each track within 10*Sigma of the cluster is 258 // saved in the nearTracks vector; subsequently, to save time, only the 259 // tracks in this vector are checked. 260 if(!nearTracks.size()) 261 { 262 263 for(map<UInt_t, map<string, Double_t> >::const_iterator track = trackIDToDouble.begin(); track != trackIDToDouble.end(); track++) 264 { 265 if(trackIDToBool.at(track->first).at("claimed") || trackIDToInt.at(track->first).at("clusterIndex") == (Int_t)clusterIndex) 250 while (!done) 251 { 252 done = true; 253 nearestID = 0; 254 nearestDistance = -1.0; 255 256 // These two loops are for finding the nearest track to the cluster. The 257 // first time, the ID of each track within 10*Sigma of the cluster is 258 // saved in the nearTracks vector; subsequently, to save time, only the 259 // tracks in this vector are checked. 260 if (!nearTracks.size ()) 261 { 262 263 for (map<UInt_t, map<string, Double_t> >::const_iterator track = trackIDToDouble.begin (); track != trackIDToDouble.end (); track++) 264 { 265 if (trackIDToBool.at (track->first).at ("claimed") || trackIDToInt.at (track->first).at ("clusterIndex") == (Int_t) clusterIndex) 266 continue; 267 268 Double_t distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - track->second.at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), track->second.at ("ez")); 269 if (nearestDistance < 0.0 || distance < nearestDistance) 270 { 271 nearestID = track->first; 272 nearestDistance = distance; 273 } 274 if (distance < 10.0 * fSigma) 275 nearTracks.push_back (track->first); 276 } 277 } 278 279 else 280 { 281 for (vector<UInt_t>::const_iterator track = nearTracks.begin (); track != nearTracks.end (); track++) 282 { 283 if (trackIDToBool.at (*track).at ("claimed") || trackIDToInt.at (*track).at ("clusterIndex") == (Int_t) clusterIndex) 284 continue; 285 Double_t distance = fabs (clusterIDToDouble.at (clusterIndex).at ("z") - trackIDToDouble.at (*track).at ("z")) / hypot (clusterIDToDouble.at (clusterIndex).at ("ez"), trackIDToDouble.at (*track).at ("ez")); 286 if (nearestDistance < 0.0 || distance < nearestDistance) 287 { 288 nearestID = *track; 289 nearestDistance = distance; 290 } 291 } 292 } 293 294 // If no tracks within Sigma of the cluster were found, stop growing. 295 done = nearestDistance > fSigma || nearestDistance < 0.0; 296 if (done) 297 { 266 298 continue; 267 268 Double_t distance = fabs(clusterIDToDouble.at(clusterIndex).at("z") - track->second.at("z")) / hypot(clusterIDToDouble.at(clusterIndex).at("ez"), track->second.at("ez")); 269 if(nearestDistance < 0.0 || distance < nearestDistance) 270 { 271 nearestID = track->first; 272 nearestDistance = distance; 273 } 274 if(distance < 10.0 * fSigma) 275 nearTracks.push_back(track->first); 276 } 277 } 278 279 else 280 { 281 for(vector<UInt_t>::const_iterator track = nearTracks.begin(); track != nearTracks.end(); track++) 282 { 283 if(trackIDToBool.at(*track).at("claimed") || trackIDToInt.at(*track).at("clusterIndex") == (Int_t)clusterIndex) 284 continue; 285 Double_t distance = fabs(clusterIDToDouble.at(clusterIndex).at("z") - trackIDToDouble.at(*track).at("z")) / hypot(clusterIDToDouble.at(clusterIndex).at("ez"), trackIDToDouble.at(*track).at("ez")); 286 if(nearestDistance < 0.0 || distance < nearestDistance) 287 { 288 nearestID = *track; 289 nearestDistance = distance; 290 } 291 } 292 } 293 294 // If no tracks within Sigma of the cluster were found, stop growing. 295 done = nearestDistance > fSigma || nearestDistance < 0.0; 296 if(done) 297 { 298 continue; 299 } 300 301 // Add the nearest track within Sigma to the cluster. If it already 302 // belonged to another cluster, remove it from that cluster first. 303 if(nearestDistance < fSigma) 304 { 305 oldClusterIndex = trackIDToInt.at(nearestID).at("clusterIndex"); 306 if(oldClusterIndex >= 0) 307 removeTrackFromCluster(nearestID, oldClusterIndex); 308 309 trackIDToBool[nearestID]["claimed"] = true; 310 addTrackToCluster(nearestID, clusterIndex); 311 } 312 } 313 } 314 315 //------------------------------------------------------------------------------ 316 317 Double_t VertexFinder::weight(const UInt_t trackID) 318 { 319 return ((trackIDToDouble.at(trackID).at("pt") / (trackIDToDouble.at(trackID).at("ept") * trackIDToDouble.at(trackID).at("ez"))) * (trackIDToDouble.at(trackID).at("pt") / (trackIDToDouble.at(trackID).at("ept") * trackIDToDouble.at(trackID).at("ez")))); 320 } 321 322 //------------------------------------------------------------------------------ 323 324 void VertexFinder::removeTrackFromCluster(const UInt_t trackID, const UInt_t clusterID) 325 { 326 Double_t wz = weight(trackID); 299 } 300 301 // Add the nearest track within Sigma to the cluster. If it already 302 // belonged to another cluster, remove it from that cluster first. 303 if (nearestDistance < fSigma) 304 { 305 oldClusterIndex = trackIDToInt.at (nearestID).at ("clusterIndex"); 306 if (oldClusterIndex >= 0) 307 removeTrackFromCluster (nearestID, oldClusterIndex); 308 309 trackIDToBool[nearestID]["claimed"] = true; 310 addTrackToCluster (nearestID, clusterIndex); 311 } 312 } 313 } 314 315 //------------------------------------------------------------------------------ 316 317 Double_t VertexFinder::weight (const UInt_t trackID) 318 { 319 return ((trackIDToDouble.at (trackID).at ("pt") / (trackIDToDouble.at (trackID).at ("ept") * trackIDToDouble.at (trackID).at ("ez"))) * (trackIDToDouble.at (trackID).at ("pt") / (trackIDToDouble.at (trackID).at ("ept") * trackIDToDouble.at (trackID).at ("ez")))); 320 } 321 322 //------------------------------------------------------------------------------ 323 324 void VertexFinder::removeTrackFromCluster (const UInt_t trackID, const UInt_t clusterID) 325 { 326 Double_t wz = weight (trackID); 327 327 328 328 trackIDToInt[trackID]["clusterIndex"] = -1; 329 329 clusterIDToInt[clusterID]["ndf"]--; 330 330 331 clusterIDToDouble[clusterID]["sumZ"] -= wz * trackIDToDouble.at (trackID).at("z");332 clusterIDToDouble[clusterID]["errorSumZ"] -= wz * trackIDToDouble.at (trackID).at("ez") * trackIDToDouble.at(trackID).at("ez");331 clusterIDToDouble[clusterID]["sumZ"] -= wz * trackIDToDouble.at (trackID).at ("z"); 332 clusterIDToDouble[clusterID]["errorSumZ"] -= wz * trackIDToDouble.at (trackID).at ("ez") * trackIDToDouble.at (trackID).at ("ez"); 333 333 clusterIDToDouble[clusterID]["sumOfWeightsZ"] -= wz; 334 clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at (clusterID).at("sumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ");335 clusterIDToDouble[clusterID]["ez"] = sqrt ((1.0 / clusterIDToInt.at(clusterID).at("ndf")) * (clusterIDToDouble.at(clusterID).at("errorSumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ")));336 clusterIDToDouble[clusterID]["sumPT2"] -= trackIDToDouble.at (trackID).at("pt") * trackIDToDouble.at(trackID).at("pt");337 } 338 339 //------------------------------------------------------------------------------ 340 341 void VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID)342 { 343 Double_t wz = weight (trackID);344 345 if (!clusterIDToInt.count(clusterID))346 {347 clusterIDToInt[clusterID]["ndf"] = 0;348 clusterIDToInt[clusterID]["seed"] = trackID;349 clusterIDToDouble[clusterID]["sumZ"] = 0.0;350 clusterIDToDouble[clusterID]["errorSumZ"] = 0.0;351 clusterIDToDouble[clusterID]["sumOfWeightsZ"] = 0.0;352 clusterIDToDouble[clusterID]["sumPT2"] = 0.0;353 }334 clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at (clusterID).at ("sumZ") / clusterIDToDouble.at (clusterID).at ("sumOfWeightsZ"); 335 clusterIDToDouble[clusterID]["ez"] = sqrt ((1.0 / clusterIDToInt.at (clusterID).at ("ndf")) * (clusterIDToDouble.at (clusterID).at ("errorSumZ") / clusterIDToDouble.at (clusterID).at ("sumOfWeightsZ"))); 336 clusterIDToDouble[clusterID]["sumPT2"] -= trackIDToDouble.at (trackID).at ("pt") * trackIDToDouble.at (trackID).at ("pt"); 337 } 338 339 //------------------------------------------------------------------------------ 340 341 void VertexFinder::addTrackToCluster (const UInt_t trackID, const UInt_t clusterID) 342 { 343 Double_t wz = weight (trackID); 344 345 if (!clusterIDToInt.count (clusterID)) 346 { 347 clusterIDToInt[clusterID]["ndf"] = 0; 348 clusterIDToInt[clusterID]["seed"] = trackID; 349 clusterIDToDouble[clusterID]["sumZ"] = 0.0; 350 clusterIDToDouble[clusterID]["errorSumZ"] = 0.0; 351 clusterIDToDouble[clusterID]["sumOfWeightsZ"] = 0.0; 352 clusterIDToDouble[clusterID]["sumPT2"] = 0.0; 353 } 354 354 355 355 trackIDToInt[trackID]["clusterIndex"] = clusterID; 356 356 clusterIDToInt[clusterID]["ndf"]++; 357 357 358 clusterIDToDouble[clusterID]["sumZ"] += wz * trackIDToDouble.at (trackID).at("z");359 clusterIDToDouble[clusterID]["errorSumZ"] += wz * trackIDToDouble.at (trackID).at("ez") * trackIDToDouble.at(trackID).at("ez");358 clusterIDToDouble[clusterID]["sumZ"] += wz * trackIDToDouble.at (trackID).at ("z"); 359 clusterIDToDouble[clusterID]["errorSumZ"] += wz * trackIDToDouble.at (trackID).at ("ez") * trackIDToDouble.at (trackID).at ("ez"); 360 360 clusterIDToDouble[clusterID]["sumOfWeightsZ"] += wz; 361 clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at (clusterID).at("sumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ");362 clusterIDToDouble[clusterID]["ez"] = sqrt ((1.0 / clusterIDToInt.at(clusterID).at("ndf")) * (clusterIDToDouble.at(clusterID).at("errorSumZ") / clusterIDToDouble.at(clusterID).at("sumOfWeightsZ")));363 clusterIDToDouble[clusterID]["sumPT2"] += trackIDToDouble.at (trackID).at("pt") * trackIDToDouble.at(trackID).at("pt");364 } 365 366 //------------------------------------------------------------------------------ 361 clusterIDToDouble[clusterID]["z"] = clusterIDToDouble.at (clusterID).at ("sumZ") / clusterIDToDouble.at (clusterID).at ("sumOfWeightsZ"); 362 clusterIDToDouble[clusterID]["ez"] = sqrt ((1.0 / clusterIDToInt.at (clusterID).at ("ndf")) * (clusterIDToDouble.at (clusterID).at ("errorSumZ") / clusterIDToDouble.at (clusterID).at ("sumOfWeightsZ"))); 363 clusterIDToDouble[clusterID]["sumPT2"] += trackIDToDouble.at (trackID).at ("pt") * trackIDToDouble.at (trackID).at ("pt"); 364 } 365 366 //------------------------------------------------------------------------------ -
modules/VertexFinder.h
r0e7d64a re39abb4 10 10 */ 11 11 12 12 13 #include "classes/DelphesModule.h" 13 14 14 #include <map>15 15 #include <string> 16 16 #include <vector> 17 #include <map> 17 18 18 19 class TObjArray; … … 22 23 { 23 24 public: 25 24 26 VertexFinder(); 25 27 ~VertexFinder(); … … 30 32 31 33 private: 32 void createSeeds(); 33 void growCluster(const UInt_t); 34 Double_t weight(const UInt_t); 35 void addTrackToCluster(const UInt_t, const UInt_t); 36 void removeTrackFromCluster(const UInt_t, const UInt_t); 34 35 void createSeeds (); 36 void growCluster (const UInt_t); 37 Double_t weight (const UInt_t); 38 void addTrackToCluster (const UInt_t, const UInt_t); 39 void removeTrackFromCluster (const UInt_t, const UInt_t); 37 40 38 41 Double_t fSigma; -
modules/VertexFinderDA4D.cc
r0e7d64a re39abb4 7 7 */ 8 8 9 9 10 #include "modules/VertexFinderDA4D.h" 10 11 #include "classes/DelphesClasses.h" … … 13 14 #include "classes/DelphesPileUpReader.h" 14 15 16 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 15 18 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 17 #include "ExRootAnalysis/ExRootResult.h" 18 19 20 #include "TMath.h" 21 #include "TString.h" 22 #include "TFormula.h" 23 #include "TRandom3.h" 24 #include "TObjArray.h" 19 25 #include "TDatabasePDG.h" 20 #include "TFormula.h"21 26 #include "TLorentzVector.h" 22 #include "TMath.h"23 27 #include "TMatrixT.h" 24 #include "TObjArray.h"25 #include "TRandom3.h"26 #include "TString.h"27 28 #include "TVector3.h" 28 29 30 #include <utility> 29 31 #include <algorithm> 32 #include <stdexcept> 30 33 #include <iostream> 31 #include <stdexcept>32 #include <utility>33 34 #include <vector> 34 35 35 36 using namespace std; 36 37 37 static const Double_t mm = 1.;38 static const Double_t m = 1000. *mm;39 static const Double_t ns = 1.;40 static const Double_t s = 1.e+9 * 41 static const Double_t c_light = 2.99792458e+8 * m /s;38 static const Double_t mm = 1.; 39 static const Double_t m = 1000.*mm; 40 static const Double_t ns = 1.; 41 static const Double_t s = 1.e+9 *ns; 42 static const Double_t c_light = 2.99792458e+8 * m/s; 42 43 43 44 struct track_t 44 45 { 45 double z; // z-coordinate at point of closest approach to the beamline46 double t; // t-coordinate at point of closest approach to the beamline47 double dz2; // square of the error of z(pca)48 double dtz; // covariance of z-t49 double dt2; // square of the error of t(pca)46 double z; // z-coordinate at point of closest approach to the beamline 47 double t; // t-coordinate at point of closest approach to the beamline 48 double dz2; // square of the error of z(pca) 49 double dtz; // covariance of z-t 50 double dt2; // square of the error of t(pca) 50 51 Candidate *tt; // a pointer to the Candidate Track 51 double Z; // Z[i] for DA clustering52 double pi; // track weight52 double Z; // Z[i] for DA clustering 53 double pi; // track weight 53 54 double pt; 54 55 double eta; … … 60 61 double z; 61 62 double t; 62 double pk; // vertex weight for "constrained" clustering63 double pk; // vertex weight for "constrained" clustering 63 64 // --- temporary numbers, used during update 64 65 double ei; … … 75 76 static double update1(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y); 76 77 static double update2(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y, double &rho0, const double dzCutOff); 77 static void dump(const double beta, const std::vector<vertex_t> & y, const std::vector<track_t> &tks);78 static void dump(const double beta, const std::vector<vertex_t> & y, const std::vector<track_t> & tks); 78 79 static bool merge(std::vector<vertex_t> &); 79 80 static bool merge(std::vector<vertex_t> &, double &); 80 static bool purge(std::vector<vertex_t> &, std::vector<track_t> & , double &, const double, const double);81 static bool purge(std::vector<vertex_t> &, std::vector<track_t> & , double &, const double, const double); 81 82 static void splitAll(std::vector<vertex_t> &y); 82 83 static double beta0(const double betamax, std::vector<track_t> &tks, std::vector<vertex_t> &y, const double coolingFactor); 83 84 static double Eik(const track_t &t, const vertex_t &k); 84 85 85 static bool recTrackLessZ1(const track_t & tk1, const track_t &tk2)86 static bool recTrackLessZ1(const track_t & tk1, const track_t & tk2) 86 87 { 87 88 return tk1.z < tk2.z; … … 114 115 fVertexSpaceSize = GetDouble("VertexSpaceSize", 0.5); //in mm 115 116 fVertexTimeSize = GetDouble("VertexTimeSize", 10E-12); //in s 116 fUseTc = GetBool("UseTc", 1);117 fBetaMax = GetDouble("BetaMax ", 0.1);118 fBetaStop = GetDouble("BetaStop", 1.0);117 fUseTc = GetBool("UseTc", 1); 118 fBetaMax = GetDouble("BetaMax ", 0.1); 119 fBetaStop = GetDouble("BetaStop", 1.0); 119 120 fCoolingFactor = GetDouble("CoolingFactor", 0.8); 120 121 fMaxIterations = GetInt("MaxIterations", 100); 121 fDzCutOff = GetDouble("DzCutOff", 40);// Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes122 fD0CutOff = GetDouble("D0CutOff", 30);123 fDtCutOff = GetDouble("DtCutOff", 100E-12);// dummy122 fDzCutOff = GetDouble("DzCutOff", 40); // Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes 123 fD0CutOff = GetDouble("D0CutOff", 30); 124 fDtCutOff = GetDouble("DtCutOff", 100E-12); // dummy 124 125 125 126 // convert stuff in cm, ns 126 127 fVertexSpaceSize /= 10.0; 127 128 fVertexTimeSize *= 1E9; 128 fDzCutOff /= 10.0;// Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes129 fD0CutOff /= 10.0;129 fDzCutOff /= 10.0; // Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes 130 fD0CutOff /= 10.0; 130 131 131 132 fInputArray = ImportArray(GetString("InputArray", "TrackSmearing/tracks")); … … 156 157 157 158 TLorentzVector pos, mom; 158 if (fVerbose)159 if (fVerbose) 159 160 { 160 cout << " start processing vertices ..." <<endl;161 cout << " Found " << fInputArray->GetEntriesFast() << " input tracks" <<endl;162 //loop over input tracks163 fItInputArray->Reset();164 while((candidate = static_cast<Candidate*>(fItInputArray->Next())))165 {166 pos = candidate->InitialPosition;167 mom = candidate->Momentum;168 169 cout << "pt: " << mom.Pt() << ", eta: " << mom.Eta() << ", phi: " << mom.Phi() << ", z: " << candidate->DZ / 10 <<endl;170 }161 cout<<" start processing vertices ..."<<endl; 162 cout<<" Found "<<fInputArray->GetEntriesFast()<<" input tracks"<<endl; 163 //loop over input tracks 164 fItInputArray->Reset(); 165 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 166 { 167 pos = candidate->InitialPosition; 168 mom = candidate->Momentum; 169 170 cout<<"pt: "<<mom.Pt()<<", eta: "<<mom.Eta()<<", phi: "<<mom.Phi()<<", z: "<<candidate->DZ/10<<endl; 171 } 171 172 } 172 173 … … 174 175 clusterize(*fInputArray, *ClusterArray); 175 176 176 if(fVerbose) 177 { 178 std::cout << " clustering returned " << ClusterArray->GetEntriesFast() << " clusters from " << fInputArray->GetEntriesFast() << " selected tracks" << std::endl; 179 } 177 if (fVerbose){std::cout << " clustering returned "<< ClusterArray->GetEntriesFast() << " clusters from " << fInputArray->GetEntriesFast() << " selected tracks" <<std::endl;} 180 178 181 179 //loop over vertex candidates 182 180 ItClusterArray = ClusterArray->MakeIterator(); 183 181 ItClusterArray->Reset(); 184 while((candidate = static_cast<Candidate 182 while((candidate = static_cast<Candidate*>(ItClusterArray->Next()))) 185 183 { 186 184 187 double meantime = 0.;188 double expv_x2 = 0.;189 double normw = 0.;190 double errtime = 0;191 192 double meanpos = 0.;193 double meanerr2 = 0.;194 double normpos = 0.;195 double errpos = 0.;196 197 double sumpt2 = 0.;198 199 int itr = 0;200 201 if(fVerbose) cout << "this vertex has: " << candidate->GetCandidates()->GetEntriesFast() << " tracks" <<endl;202 203 // loop over tracks belonging to this vertex204 TIter it1(candidate->GetCandidates());205 it1.Reset();206 207 while((track = static_cast<Candidate*>(it1.Next())))208 {209 210 itr++;211 // TBC: the time is in ns for now TBC212 double t = track->InitialPosition.T() /c_light;213 double dt = track->ErrorT /c_light;214 const double time = t;215 const double inverr = 1.0 /dt;216 meantime += time *inverr;217 expv_x2 += time * time *inverr;218 normw+= inverr;219 220 // compute error position TBC221 const double pt = track->Momentum.Pt();222 const double z = track->DZ /10.0;223 const double err_pt = track->ErrorPT;224 const double err_z = track->ErrorDZ;225 226 const double wi = (pt / (err_pt * err_z)) * (pt / (err_pt *err_z));227 meanpos += z *wi;228 229 meanerr2 += err_z * err_z *wi;230 normpos += wi;231 sumpt2 += pt *pt;232 233 // while we are here store cluster index in tracks234 track->ClusterIndex = ivtx;235 }236 237 meantime = meantime /normw;238 expv_x2 = expv_x2 /normw;239 errtime = TMath::Sqrt((expv_x2 - meantime * meantime) /itr);240 meanpos = meanpos /normpos;241 meanerr2 = meanerr2 /normpos;242 errpos = TMath::Sqrt(meanerr2 /itr);243 244 candidate->Position.SetXYZT(0.0, 0.0, meanpos * 10.0, meantime *c_light);245 candidate->PositionError.SetXYZT(0.0, 0.0, errpos * 10.0, errtime *c_light);246 candidate->SumPT2 = sumpt2;247 candidate->ClusterNDF = itr;248 candidate->ClusterIndex = ivtx;249 250 fVertexOutputArray->Add(candidate);251 252 ivtx++;253 254 if(fVerbose)255 {256 std::cout << "x,y,z";257 std::cout << ",t";258 std::cout << "=" << candidate->Position.X() / 10.0 << " " << candidate->Position.Y() / 10.0 << " " << candidate->Position.Z() / 10.0;259 std::cout << " " << candidate->Position.T() / c_light; 260 261 std::cout << std::endl;262 std::cout << "sumpt2 " << candidate->SumPT2 << endl;263 264 std::cout << "ex,ey,ez";265 std::cout << ",et";266 std::cout << "=" << candidate->PositionError.X() / 10.0 << " " << candidate->PositionError.Y() / 10.0 << " " << candidate->PositionError.Z() / 10.0;267 std::cout << " " << candidate->PositionError.T() / c_light;268 std::cout << std::endl; 269 }270 }// end of cluster loop271 272 if(fVerbose) 273 {274 std::cout << "PrimaryVertexProducerAlgorithm::vertices candidates =" << ClusterArray->GetEntriesFast() << std::endl;275 }276 277 //TBC maybe this can be done later278 // sort vertices by pt**2 vertex (aka signal vertex tagging)279 /*if(pvs.size()>1){185 double meantime = 0.; 186 double expv_x2 = 0.; 187 double normw = 0.; 188 double errtime = 0; 189 190 double meanpos = 0.; 191 double meanerr2 = 0.; 192 double normpos = 0.; 193 double errpos = 0.; 194 195 double sumpt2 = 0.; 196 197 int itr = 0; 198 199 if(fVerbose)cout<<"this vertex has: "<<candidate->GetCandidates()->GetEntriesFast()<<" tracks"<<endl; 200 201 // loop over tracks belonging to this vertex 202 TIter it1(candidate->GetCandidates()); 203 it1.Reset(); 204 205 while((track = static_cast<Candidate*>(it1.Next()))) 206 { 207 208 itr++; 209 // TBC: the time is in ns for now TBC 210 double t = track->InitialPosition.T()/c_light; 211 double dt = track->ErrorT/c_light; 212 const double time = t; 213 const double inverr = 1.0/dt; 214 meantime += time*inverr; 215 expv_x2 += time*time*inverr; 216 normw += inverr; 217 218 // compute error position TBC 219 const double pt = track->Momentum.Pt(); 220 const double z = track->DZ/10.0; 221 const double err_pt = track->ErrorPT; 222 const double err_z = track->ErrorDZ; 223 224 const double wi = (pt/(err_pt*err_z))*(pt/(err_pt*err_z)); 225 meanpos += z*wi; 226 227 meanerr2 += err_z*err_z*wi; 228 normpos += wi; 229 sumpt2 += pt*pt; 230 231 // while we are here store cluster index in tracks 232 track->ClusterIndex = ivtx; 233 } 234 235 meantime = meantime/normw; 236 expv_x2 = expv_x2/normw; 237 errtime = TMath::Sqrt((expv_x2 - meantime*meantime)/itr); 238 meanpos = meanpos/normpos; 239 meanerr2 = meanerr2/normpos; 240 errpos = TMath::Sqrt(meanerr2/itr); 241 242 candidate->Position.SetXYZT(0.0, 0.0, meanpos*10.0 , meantime*c_light); 243 candidate->PositionError.SetXYZT(0.0, 0.0, errpos*10.0 , errtime*c_light); 244 candidate->SumPT2 = sumpt2; 245 candidate->ClusterNDF = itr; 246 candidate->ClusterIndex = ivtx; 247 248 fVertexOutputArray->Add(candidate); 249 250 ivtx++; 251 252 if (fVerbose){ 253 std::cout << "x,y,z"; 254 std::cout << ",t"; 255 std::cout << "=" << candidate->Position.X()/10.0 <<" " << candidate->Position.Y()/10.0 << " " << candidate->Position.Z()/10.0; 256 std::cout << " " << candidate->Position.T()/c_light; 257 258 std::cout << std::endl; 259 std::cout << "sumpt2 " << candidate->SumPT2<<endl; 260 261 std::cout << "ex,ey,ez"; 262 std::cout << ",et"; 263 std::cout << "=" << candidate->PositionError.X()/10.0 <<" " << candidate->PositionError.Y()/10.0 << " " << candidate->PositionError.Z()/10.0; 264 std::cout << " " << candidate->PositionError.T()/c_light; 265 std::cout << std::endl; 266 267 } 268 }// end of cluster loop 269 270 271 if(fVerbose){ 272 std::cout << "PrimaryVertexProducerAlgorithm::vertices candidates =" << ClusterArray->GetEntriesFast() << std::endl; 273 } 274 275 //TBC maybe this can be done later 276 // sort vertices by pt**2 vertex (aka signal vertex tagging) 277 /*if(pvs.size()>1){ 280 278 sort(pvs.begin(), pvs.end(), VertexHigherPtSquared()); 281 279 } … … 283 281 284 282 delete ClusterArray; 283 285 284 } 286 285 … … 289 288 void VertexFinderDA4D::clusterize(const TObjArray &tracks, TObjArray &clusters) 290 289 { 291 if(fVerbose) 292 { 290 if(fVerbose) { 293 291 cout << "###################################################" << endl; 294 cout << "# VertexFinderDA4D::clusterize nt=" <<tracks.GetEntriesFast() << endl;292 cout << "# VertexFinderDA4D::clusterize nt="<<tracks.GetEntriesFast() << endl; 295 293 cout << "###################################################" << endl; 296 294 } 297 295 298 vector<Candidate *> pv = vertices(); 299 300 if(fVerbose) 301 { 302 cout << "# VertexFinderDA4D::clusterize pv.size=" << pv.size() << endl; 303 } 304 if(pv.size() == 0) 305 { 306 return; 307 } 296 vector< Candidate* > pv = vertices(); 297 298 if(fVerbose){ cout << "# VertexFinderDA4D::clusterize pv.size="<<pv.size() << endl; } 299 if (pv.size()==0){ return; } 308 300 309 301 // convert into vector of candidates 310 302 //TObjArray *ClusterArray = pv.begin()->GetCandidates(); 311 303 //Candidate *aCluster = static_cast<Candidate*>(&(pv.at(0))); 312 Candidate *aCluster = pv.at(0);304 Candidate *aCluster = pv.at(0); 313 305 314 306 // fill into clusters and merge 315 307 316 if(fVerbose) 317 { 318 std::cout << '\t' << 0; 319 std::cout << ' ' << (*pv.begin())->Position.Z() / 10.0 << ' ' << (*pv.begin())->Position.T() / c_light << std::endl; 320 } 321 322 for(vector<Candidate *>::iterator k = pv.begin() + 1; k != pv.end(); k++) 323 { 324 if(fVerbose) 325 { 326 std::cout << '\t' << std::distance(pv.begin(), k); 308 309 if( fVerbose ) { 310 std::cout << '\t' << 0; 311 std::cout << ' ' << (*pv.begin())->Position.Z()/10.0 << ' ' << (*pv.begin())->Position.T()/c_light << std::endl; 312 } 313 314 for(vector<Candidate*>::iterator k=pv.begin()+1; k!=pv.end(); k++){ 315 if( fVerbose ) { 316 std::cout << '\t' << std::distance(pv.begin(),k); 327 317 std::cout << ' ' << (*k)->Position.Z() << ' ' << (*k)->Position.T() << std::endl; 328 318 } 329 319 320 330 321 // TBC - check units here 331 if (std::abs((*k)->Position.Z() - (*(k - 1))->Position.Z()) / 10.0 > (2 * fVertexSpaceSize) || std::abs((*k)->Position.T() - (*(k - 1))->Position.Z()) / c_light > 2 * 0.010)332 {322 if ( std::abs((*k)->Position.Z() - (*(k-1))->Position.Z())/10.0 > (2*fVertexSpaceSize) || 323 std::abs((*k)->Position.T() - (*(k-1))->Position.Z())/c_light > 2*0.010 ) { 333 324 // close a cluster 334 325 clusters.Add(aCluster); … … 336 327 } 337 328 //for(unsigned int i=0; i<k->GetCandidates().GetEntriesFast(); i++){ 338 aCluster = *k;329 aCluster = *k; 339 330 //} 331 340 332 } 341 333 clusters.Add(aCluster); 342 334 343 if(fVerbose) 344 { 345 std::cout << "# VertexFinderDA4D::clusterize clusters.size=" << clusters.GetEntriesFast() << std::endl; 346 } 347 } 348 349 //------------------------------------------------------------------------------ 350 351 vector<Candidate *> VertexFinderDA4D::vertices() 335 if(fVerbose) { std::cout << "# VertexFinderDA4D::clusterize clusters.size="<<clusters.GetEntriesFast() << std::endl; } 336 337 } 338 339 //------------------------------------------------------------------------------ 340 341 vector< Candidate* > VertexFinderDA4D::vertices() 352 342 { 353 343 Candidate *candidate; 354 344 UInt_t clusterIndex = 0; 355 vector< Candidate *> clusters;345 vector< Candidate* > clusters; 356 346 357 347 vector<track_t> tks; … … 361 351 // loop over input tracks 362 352 fItInputArray->Reset(); 363 while((candidate = static_cast<Candidate 353 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 364 354 { 365 355 //TBC everything in cm 366 z = candidate->DZ /10;356 z = candidate->DZ/10; 367 357 tr.z = z; 368 dz = candidate->ErrorDZ /10;369 tr.dz2 = dz * dz// track error370 371 372 + fVertexSpaceSize *fVertexSpaceSize; // intrinsic vertex size, safer for outliers and short lived decays358 dz = candidate->ErrorDZ/10; 359 tr.dz2 = dz*dz // track error 360 //TBC: beamspot size induced error, take 0 for now. 361 // + (std::pow(beamspot.BeamWidthX()*cos(phi),2.)+std::pow(beamspot.BeamWidthY()*sin(phi),2.))/std::pow(tantheta,2.) // beam-width induced 362 + fVertexSpaceSize*fVertexSpaceSize; // intrinsic vertex size, safer for outliers and short lived decays 373 363 374 364 // TBC: the time is in ns for now TBC 375 365 //t = candidate->Position.T()/c_light; 376 t = candidate->InitialPosition.T() /c_light;377 l = candidate->L /c_light;366 t = candidate->InitialPosition.T()/c_light; 367 l = candidate->L/c_light; 378 368 double pt = candidate->Momentum.Pt(); 379 369 double eta = candidate->Momentum.Eta(); … … 385 375 tr.t = t; // 386 376 tr.dtz = 0.; 387 dt = candidate->ErrorT /c_light;388 tr.dt2 = dt * dt + fVertexTimeSize * fVertexTimeSize;// the ~injected~ timing error plus a small minimum vertex size in time389 if(fD0CutOff >0)377 dt = candidate->ErrorT/c_light; 378 tr.dt2 = dt*dt + fVertexTimeSize*fVertexTimeSize; // the ~injected~ timing error plus a small minimum vertex size in time 379 if(fD0CutOff>0) 390 380 { 391 381 392 d0 = TMath::Abs(candidate->D0) / 10.0; 393 d0error = candidate->ErrorD0 / 10.0; 394 395 tr.pi = 1. / (1. + exp((d0 * d0) / (d0error * d0error) - fD0CutOff * fD0CutOff)); // reduce weight for high ip tracks 382 d0 = TMath::Abs(candidate->D0)/10.0; 383 d0error = candidate->ErrorD0/10.0; 384 385 tr.pi=1./(1.+exp((d0*d0)/(d0error*d0error) - fD0CutOff*fD0CutOff)); // reduce weight for high ip tracks 386 396 387 } 397 388 else 398 389 { 399 tr.pi =1.;400 } 401 tr.tt =&(*candidate);402 tr.Z =1.;390 tr.pi=1.; 391 } 392 tr.tt=&(*candidate); 393 tr.Z=1.; 403 394 404 395 // TBC now putting track selection here (> fPTMin) … … 413 404 if(fVerbose) 414 405 { 415 std::cout << " start processing vertices ..." <<std::endl;416 std::cout << " Found " << tks.size() << " input tracks" <<std::endl;406 std::cout<<" start processing vertices ..."<<std::endl; 407 std::cout<<" Found "<<tks.size()<<" input tracks"<<std::endl; 417 408 //loop over input tracks 418 409 419 for(std::vector<track_t>::const_iterator it = tks.begin(); it != tks.end(); it++) 420 421 422 double pt =it->pt;423 double eta =it->eta;424 double phi =it->phi;425 426 427 std::cout << "pt: " << pt << ", eta: " << eta << ", phi: " << phi << ", z: " << z << ", t: " << t <<std::endl;428 429 } 430 431 unsigned int nt =tks.size();432 double rho0 = 0.0;// start with no outlier rejection433 434 if (tks.empty()) return clusters;410 411 for(std::vector<track_t>::const_iterator it=tks.begin(); it!=tks.end(); it++){ 412 double z = it->z; 413 double pt=it->pt; 414 double eta=it->eta; 415 double phi=it->phi; 416 double t = it->t; 417 418 std::cout<<"pt: "<<pt<<", eta: "<<eta<<", phi: "<<phi<<", z: "<<z<<", t: "<<t<<std::endl; 419 } 420 } 421 422 unsigned int nt=tks.size(); 423 double rho0=0.0; // start with no outlier rejection 424 425 if (tks.empty()) return clusters; 435 426 436 427 vector<vertex_t> y; // the vertex prototypes … … 438 429 // initialize:single vertex at infinite temperature 439 430 vertex_t vstart; 440 vstart.z =0.;441 vstart.t =0.;442 vstart.pk =1.;431 vstart.z=0.; 432 vstart.t=0.; 433 vstart.pk=1.; 443 434 y.push_back(vstart); 444 int niter = 0;// number of iterations435 int niter=0; // number of iterations 445 436 446 437 // estimate first critical temperature 447 double beta = beta0(fBetaMax, tks, y, fCoolingFactor); 448 niter = 0; 449 while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations)) 450 { 451 } 438 double beta=beta0(fBetaMax, tks, y, fCoolingFactor); 439 niter=0; while((update1(beta, tks,y)>1.e-6) && (niter++ < fMaxIterations)){ } 452 440 453 441 // annealing loop, stop when T<Tmin (i.e. beta>1/Tmin) 454 while(beta < fBetaMax) 455 { 456 457 if(fUseTc) 458 { 459 update1(beta, tks, y); 460 while(merge(y, beta)) 461 { 462 update1(beta, tks, y); 463 } 464 split(beta, tks, y); 465 beta = beta / fCoolingFactor; 466 } 467 else 468 { 469 beta = beta / fCoolingFactor; 442 while(beta<fBetaMax){ 443 444 if(fUseTc){ 445 update1(beta, tks,y); 446 while(merge(y,beta)){update1(beta, tks,y);} 447 split(beta, tks,y); 448 beta=beta/fCoolingFactor; 449 }else{ 450 beta=beta/fCoolingFactor; 470 451 splitAll(y); 471 452 } 472 453 473 // make sure we are not too far from equilibrium before cooling further 474 niter = 0; 475 while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations)) 476 { 477 } 478 } 479 480 if(fUseTc) 481 { 454 // make sure we are not too far from equilibrium before cooling further 455 niter=0; while((update1(beta, tks,y)>1.e-6) && (niter++ < fMaxIterations)){ } 456 457 } 458 459 if(fUseTc){ 482 460 // last round of splitting, make sure no critical clusters are left 483 update1(beta, tks, y); 484 while(merge(y, beta)) 485 { 486 update1(beta, tks, y); 487 } 488 unsigned int ntry = 0; 489 while(split(beta, tks, y) && (ntry++ < 10)) 490 { 491 niter = 0; 492 while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations)) 493 { 494 } 495 merge(y, beta); 496 update1(beta, tks, y); 497 } 498 } 499 else 500 { 461 update1(beta, tks,y); 462 while(merge(y,beta)){update1(beta, tks,y);} 463 unsigned int ntry=0; 464 while( split(beta, tks,y) && (ntry++<10) ){ 465 niter=0; 466 while((update1(beta, tks,y)>1.e-6) && (niter++ < fMaxIterations)){} 467 merge(y,beta); 468 update1(beta, tks,y); 469 } 470 }else{ 501 471 // merge collapsed clusters 502 while(merge(y, beta)) 503 { 504 update1(beta, tks, y); 505 } 506 if(fVerbose) 507 { 508 cout << "dump after 1st merging " << endl; 509 dump(beta, y, tks); 510 } 472 while(merge(y,beta)){update1(beta, tks,y);} 473 if(fVerbose ){ cout << "dump after 1st merging " << endl; dump(beta,y,tks);} 511 474 } 512 475 513 476 // switch on outlier rejection 514 rho0 = 1. / nt; 515 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 516 { 517 k->pk = 1.; 518 } // democratic 519 niter = 0; 520 while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-8) && (niter++ < fMaxIterations)) 521 { 522 } 523 if(fVerbose) 524 { 525 cout << "rho0=" << rho0 << " niter=" << niter << endl; 526 dump(beta, y, tks); 527 } 477 rho0=1./nt; for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ k->pk =1.; } // democratic 478 niter=0; while((update2(beta, tks,y,rho0, fDzCutOff) > 1.e-8) && (niter++ < fMaxIterations)){ } 479 if(fVerbose ){ cout << "rho0=" << rho0 << " niter=" << niter << endl; dump(beta,y,tks);} 480 528 481 529 482 // merge again (some cluster split by outliers collapse here) 530 while(merge(y)) 531 { 532 } 533 if(fVerbose) 534 { 535 cout << "dump after 2nd merging " << endl; 536 dump(beta, y, tks); 537 } 483 while(merge(y)){} 484 if(fVerbose ){ cout << "dump after 2nd merging " << endl; dump(beta,y,tks);} 485 538 486 539 487 // continue from freeze-out to Tstop (=1) without splitting, eliminate insignificant vertices 540 while(beta <= fBetaStop) 541 { 542 while(purge(y, tks, rho0, beta, fDzCutOff)) 543 { 544 niter = 0; 545 while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)) 546 { 547 } 548 } 549 beta /= fCoolingFactor; 550 niter = 0; 551 while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)) 552 { 553 } 554 } 555 556 // // new, one last round of cleaning at T=Tstop 557 // while(purge(y,tks,rho0, beta)){ 558 // niter=0; while((update2(beta, tks,y,rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)){ } 559 // } 560 561 if(fVerbose) 562 { 563 cout << "Final result, rho0=" << rho0 << endl; 564 dump(beta, y, tks); 565 } 488 while(beta<=fBetaStop){ 489 while(purge(y,tks,rho0, beta, fDzCutOff)){ 490 niter=0; while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)){ } 491 } 492 beta/=fCoolingFactor; 493 niter=0; while((update2(beta, tks, y, rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)){ } 494 } 495 496 497 // // new, one last round of cleaning at T=Tstop 498 // while(purge(y,tks,rho0, beta)){ 499 // niter=0; while((update2(beta, tks,y,rho0, fDzCutOff) > 1.e-6) && (niter++ < fMaxIterations)){ } 500 // } 501 502 503 if(fVerbose){ 504 cout << "Final result, rho0=" << rho0 << endl; 505 dump(beta,y,tks); 506 } 507 566 508 567 509 // select significant tracks and use a TransientVertex as a container … … 569 511 570 512 // ensure correct normalization of probabilities, should make double assginment reasonably impossible 571 for(unsigned int i = 0; i < nt; i++) 572 { 573 tks[i].Z = rho0 * exp(-beta * (fDzCutOff * fDzCutOff)); 574 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 575 { 576 tks[i].Z += k->pk * exp(-beta * Eik(tks[i], *k)); 577 } 578 } 579 580 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 581 { 513 for(unsigned int i=0; i<nt; i++){ 514 tks[i].Z=rho0*exp(-beta*( fDzCutOff*fDzCutOff)); 515 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 516 tks[i].Z += k->pk * exp(-beta*Eik(tks[i],*k)); 517 } 518 } 519 520 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 582 521 583 522 DelphesFactory *factory = GetFactory(); … … 593 532 double expv_x2 = 0.; 594 533 double normw = 0.; 595 for(unsigned int i = 0; i < nt; i++) 596 { 597 const double invdt = 1.0 / std::sqrt(tks[i].dt2); 598 if(tks[i].Z > 0) 599 { 600 double p = k->pk * exp(-beta * Eik(tks[i], *k)) / tks[i].Z; 601 if((tks[i].pi > 0) && (p > 0.5)) 602 { 534 for(unsigned int i=0; i<nt; i++){ 535 const double invdt = 1.0/std::sqrt(tks[i].dt2); 536 if(tks[i].Z>0){ 537 double p = k->pk * exp(-beta*Eik(tks[i],*k)) / tks[i].Z; 538 if( (tks[i].pi>0) && ( p > 0.5 ) ){ 603 539 //std::cout << "pushing back " << i << ' ' << tks[i].tt << std::endl; 604 540 //vertexTracks.push_back(*(tks[i].tt)); tks[i].Z=0; 605 541 606 candidate->AddCandidate(tks[i].tt); 607 tks[i].Z = 0; 608 609 mean += tks[i].t * invdt * p; 610 expv_x2 += tks[i].t * tks[i].t * invdt * p; 611 normw += invdt * p; 542 candidate->AddCandidate(tks[i].tt); tks[i].Z=0; 543 544 mean += tks[i].t*invdt*p; 545 expv_x2 += tks[i].t*tks[i].t*invdt*p; 546 normw += invdt*p; 612 547 } // setting Z=0 excludes double assignment 613 548 } 614 549 } 615 550 616 mean = mean /normw;617 expv_x2 = expv_x2 /normw;618 const double time_var = expv_x2 - mean *mean;551 mean = mean/normw; 552 expv_x2 = expv_x2/normw; 553 const double time_var = expv_x2 - mean*mean; 619 554 const double crappy_error_guess = std::sqrt(time_var); 620 555 /*GlobalError dummyErrorWithTime(0, … … 624 559 //TransientVertex v(pos, time, dummyErrorWithTime, vertexTracks, 5); 625 560 626 candidate->ClusterIndex = clusterIndex++; 627 ;628 candidate->Position.SetXYZT(0.0, 0.0, z * 10.0, time *c_light);561 562 candidate->ClusterIndex = clusterIndex++;; 563 candidate->Position.SetXYZT(0.0, 0.0, z*10.0 , time*c_light); 629 564 630 565 // TBC - fill error later ... 631 candidate->PositionError.SetXYZT(0.0, 0.0, 0.0 , crappy_error_guess *c_light);566 candidate->PositionError.SetXYZT(0.0, 0.0, 0.0 , crappy_error_guess*c_light); 632 567 633 568 clusterIndex++; … … 635 570 } 636 571 572 637 573 return clusters; 638 } 639 640 //------------------------------------------------------------------------------ 641 642 static double Eik(const track_t &t, const vertex_t &k) 643 { 644 return std::pow(t.z - k.z, 2.) / t.dz2 + std::pow(t.t - k.t, 2.) / t.dt2; 574 575 } 576 577 //------------------------------------------------------------------------------ 578 579 static double Eik(const track_t & t, const vertex_t &k) 580 { 581 return std::pow(t.z-k.z,2.)/t.dz2 + std::pow(t.t - k.t,2.)/t.dt2; 645 582 } 646 583 … … 651 588 // copy and sort for nicer printout 652 589 vector<track_t> tks; 653 for(vector<track_t>::const_iterator t = tks0.begin(); t != tks0.end(); t++) 654 { 655 tks.push_back(*t); 656 } 590 for(vector<track_t>::const_iterator t=tks0.begin(); t!=tks0.end(); t++){tks.push_back(*t); } 657 591 std::stable_sort(tks.begin(), tks.end(), recTrackLessZ1); 658 592 … … 661 595 cout << " z= "; 662 596 cout.precision(4); 663 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 664 { 597 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 665 598 //cout << setw(8) << fixed << k->z; 666 599 } 667 cout << endl 668 << " t= "; 669 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 670 { 600 cout << endl << " t= "; 601 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 671 602 //cout << setw(8) << fixed << k->t; 672 603 } 673 604 //cout << endl << "T=" << setw(15) << 1./beta <<" Tc= "; 674 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 675 { 605 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 676 606 //cout << setw(8) << fixed << k->Tc ; 677 607 } 678 608 679 cout << endl 680 << " pk="; 681 double sumpk = 0; 682 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 683 { 609 cout << endl << " pk="; 610 double sumpk=0; 611 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 684 612 //cout << setw(8) << setprecision(3) << fixed << k->pk; 685 sumpk +=k->pk;686 } 687 cout << endl;688 689 double E = 0, F =0;613 sumpk+=k->pk; 614 } 615 cout << endl; 616 617 double E=0, F=0; 690 618 cout << endl; 691 619 cout << "---- z +/- dz t +/- dt ip +/-dip pt phi eta weights ----" << endl; 692 620 cout.precision(4); 693 for(unsigned int i = 0; i < tks.size(); i++) 694 { 695 if(tks[i].Z > 0) 696 { 697 F -= log(tks[i].Z) / beta; 698 } 699 double tz = tks[i].z; 700 double tt = tks[i].t; 621 for(unsigned int i=0; i<tks.size(); i++){ 622 if (tks[i].Z>0){ F-=log(tks[i].Z)/beta;} 623 double tz= tks[i].z; 624 double tt= tks[i].t; 701 625 //cout << setw (3)<< i << ")" << setw (8) << fixed << setprecision(4)<< tz << " +/-" << setw (6)<< sqrt(tks[i].dz2) 702 626 // << setw(8) << fixed << setprecision(4) << tt << " +/-" << setw(6) << std::sqrt(tks[i].dt2) ; 703 627 704 double sump = 0.; 705 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 706 { 707 if((tks[i].pi > 0) && (tks[i].Z > 0)) 708 { 709 //double p=pik(beta,tks[i],*k); 710 double p = k->pk * std::exp(-beta * Eik(tks[i], *k)) / tks[i].Z; 711 if(p > 0.0001) 712 { 713 //cout << setw (8) << setprecision(3) << p; 714 } 715 else 716 { 717 cout << " . "; 718 } 719 E += p * Eik(tks[i], *k); 720 sump += p; 628 double sump=0.; 629 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 630 if((tks[i].pi>0)&&(tks[i].Z>0)){ 631 //double p=pik(beta,tks[i],*k); 632 double p=k->pk * std::exp(-beta*Eik(tks[i],*k)) / tks[i].Z; 633 if( p > 0.0001){ 634 //cout << setw (8) << setprecision(3) << p; 635 }else{ 636 cout << " . "; 637 } 638 E+=p*Eik(tks[i],*k); 639 sump+=p; 640 }else{ 641 cout << " "; 642 } 721 643 } 722 else 723 { 724 cout << " "; 725 } 726 } 727 cout << endl; 728 } 729 cout << endl 730 << "T=" << 1 / beta << " E=" << E << " n=" << y.size() << " F= " << F << endl 731 << "----------" << endl; 644 cout << endl; 645 } 646 cout << endl << "T=" << 1/beta << " E=" << E << " n="<< y.size() << " F= " << F << endl << "----------" << endl; 732 647 } 733 648 … … 740 655 // returns the squared sum of changes of vertex positions 741 656 742 unsigned int nt =tks.size();657 unsigned int nt=tks.size(); 743 658 744 659 //initialize sums 745 double sumpi = 0; 746 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k) 747 { 748 k->sw = 0.; 749 k->swz = 0.; 750 k->swt = 0.; 751 k->se = 0.; 752 k->swE = 0.; 753 k->Tc = 0.; 754 } 660 double sumpi=0; 661 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); ++k){ 662 k->sw=0.; k->swz=0.; k->swt = 0.; k->se=0.; 663 k->swE=0.; k->Tc=0.; 664 } 665 755 666 756 667 // loop over tracks 757 for(unsigned int i = 0; i < nt; i++) 758 { 668 for(unsigned int i=0; i<nt; i++){ 759 669 760 670 // update pik and Zi 761 671 double Zi = 0.; 762 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k) 763 { 764 k->ei = std::exp(-beta * Eik(tks[i], *k)); // cache exponential for one track at a time 765 Zi += k->pk * k->ei; 766 } 767 tks[i].Z = Zi; 672 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); ++k){ 673 k->ei = std::exp(-beta*Eik(tks[i],*k));// cache exponential for one track at a time 674 Zi += k->pk * k->ei; 675 } 676 tks[i].Z=Zi; 768 677 769 678 // normalization for pk 770 if(tks[i].Z > 0) 771 { 679 if (tks[i].Z>0){ 772 680 sumpi += tks[i].pi; 773 681 // accumulate weighted z and weights for vertex update 774 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); ++k) 775 { 776 k->se += tks[i].pi * k->ei / Zi; 777 const double w = k->pk * tks[i].pi * k->ei / (Zi * (tks[i].dz2 * tks[i].dt2)); 778 k->sw += w; 779 k->swz += w * tks[i].z; 682 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); ++k){ 683 k->se += tks[i].pi* k->ei / Zi; 684 const double w = k->pk * tks[i].pi* k->ei / ( Zi * ( tks[i].dz2 * tks[i].dt2 ) ); 685 k->sw += w; 686 k->swz += w * tks[i].z; 780 687 k->swt += w * tks[i].t; 781 k->swE += w * Eik(tks[i],*k);688 k->swE += w * Eik(tks[i],*k); 782 689 } 783 } 784 else 785 { 690 }else{ 786 691 sumpi += tks[i].pi; 787 692 } 788 693 694 789 695 } // end of track loop 790 696 697 791 698 // now update z and pk 792 double delta = 0; 793 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 794 { 795 if(k->sw > 0) 796 { 797 const double znew = k->swz / k->sw; 798 const double tnew = k->swt / k->sw; 799 delta += std::pow(k->z - znew, 2.) + std::pow(k->t - tnew, 2.); 800 k->z = znew; 801 k->t = tnew; 802 k->Tc = 2. * k->swE / k->sw; 803 } 804 else 805 { 699 double delta=0; 700 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 701 if ( k->sw > 0){ 702 const double znew = k->swz/k->sw; 703 const double tnew = k->swt/k->sw; 704 delta += std::pow(k->z-znew,2.) + std::pow(k->t-tnew,2.); 705 k->z = znew; 706 k->t = tnew; 707 k->Tc = 2.*k->swE/k->sw; 708 }else{ 806 709 // cout << " a cluster melted away ? pk=" << k->pk << " sumw=" << k->sw << endl 807 k->Tc =-1;710 k->Tc=-1; 808 711 } 809 712 … … 822 725 // returns the squared sum of changes of vertex positions 823 726 824 unsigned int nt =tks.size();727 unsigned int nt=tks.size(); 825 728 826 729 //initialize sums 827 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 828 { 829 k->sw = 0.; 830 k->swz = 0.; 831 k->swt = 0.; 832 k->se = 0.; 833 k->swE = 0.; 834 k->Tc = 0.; 835 } 730 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 731 k->sw = 0.; k->swz = 0.; k->swt = 0.; k->se = 0.; 732 k->swE = 0.; k->Tc=0.; 733 } 734 836 735 837 736 // loop over tracks 838 for(unsigned int i = 0; i < nt; i++) 839 { 737 for(unsigned int i=0; i<nt; i++){ 840 738 841 739 // update pik and Zi and Ti 842 double Zi = rho0 * std::exp(-beta * (dzCutOff * dzCutOff));// cut-off (eventually add finite size in time)740 double Zi = rho0*std::exp(-beta*(dzCutOff*dzCutOff));// cut-off (eventually add finite size in time) 843 741 //double Ti = 0.; // dt0*std::exp(-beta*fDtCutOff); 844 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 845 { 846 k->ei = std::exp(-beta * Eik(tks[i], *k)); // cache exponential for one track at a time 847 Zi += k->pk * k->ei; 848 } 849 tks[i].Z = Zi; 742 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 743 k->ei = std::exp(-beta*Eik(tks[i],*k));// cache exponential for one track at a time 744 Zi += k->pk * k->ei; 745 } 746 tks[i].Z=Zi; 850 747 851 748 // normalization 852 if(tks[i].Z > 0) 853 { 854 // accumulate weighted z and weights for vertex update 855 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 856 { 857 k->se += tks[i].pi * k->ei / Zi; 858 double w = k->pk * tks[i].pi * k->ei / (Zi * (tks[i].dz2 * tks[i].dt2)); 859 k->sw += w; 860 k->swz += w * tks[i].z; 749 if (tks[i].Z>0){ 750 // accumulate weighted z and weights for vertex update 751 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 752 k->se += tks[i].pi* k->ei / Zi; 753 double w = k->pk * tks[i].pi * k->ei /( Zi * ( tks[i].dz2 * tks[i].dt2 ) ); 754 k->sw += w; 755 k->swz += w * tks[i].z; 861 756 k->swt += w * tks[i].t; 862 k->swE += w * Eik(tks[i],*k);757 k->swE += w * Eik(tks[i],*k); 863 758 } 864 759 } … … 867 762 868 763 // now update z 869 double delta = 0; 870 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 871 { 872 if(k->sw > 0) 873 { 874 const double znew = k->swz / k->sw; 875 const double tnew = k->swt / k->sw; 876 delta += std::pow(k->z - znew, 2.) + std::pow(k->t - tnew, 2.); 877 k->z = znew; 878 k->t = tnew; 879 k->Tc = 2 * k->swE / k->sw; 880 } 881 else 882 { 764 double delta=0; 765 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 766 if ( k->sw > 0){ 767 const double znew=k->swz/k->sw; 768 const double tnew=k->swt/k->sw; 769 delta += std::pow(k->z-znew,2.) + std::pow(k->t-tnew,2.); 770 k->z = znew; 771 k->t = tnew; 772 k->Tc = 2*k->swE/k->sw; 773 }else{ 883 774 // cout << " a cluster melted away ? pk=" << k->pk << " sumw=" << k->sw << endl; 884 775 k->Tc = 0; 885 776 } 777 886 778 } 887 779 … … 896 788 // merge clusters that collapsed or never separated, return true if vertices were merged, false otherwise 897 789 898 if(y.size() < 2) return false; 899 900 for(vector<vertex_t>::iterator k = y.begin(); (k + 1) != y.end(); k++) 901 { 902 if(std::abs((k + 1)->z - k->z) < 1.e-3 && std::abs((k + 1)->t - k->t) < 1.e-3) 903 { // with fabs if only called after freeze-out (splitAll() at highter T) 904 double rho = k->pk + (k + 1)->pk; 905 if(rho > 0) 906 { 907 k->z = (k->pk * k->z + (k + 1)->z * (k + 1)->pk) / rho; 908 k->t = (k->pk * k->t + (k + 1)->t * (k + 1)->pk) / rho; 909 } 910 else 911 { 912 k->z = 0.5 * (k->z + (k + 1)->z); 913 k->t = 0.5 * (k->t + (k + 1)->t); 790 if(y.size()<2) return false; 791 792 for(vector<vertex_t>::iterator k=y.begin(); (k+1)!=y.end(); k++){ 793 if( std::abs( (k+1)->z - k->z ) < 1.e-3 && 794 std::abs( (k+1)->t - k->t ) < 1.e-3 ){ // with fabs if only called after freeze-out (splitAll() at highter T) 795 double rho = k->pk + (k+1)->pk; 796 if(rho>0){ 797 k->z = ( k->pk * k->z + (k+1)->z * (k+1)->pk)/rho; 798 k->t = ( k->pk * k->t + (k+1)->t * (k+1)->pk)/rho; 799 }else{ 800 k->z = 0.5*(k->z + (k+1)->z); 801 k->t = 0.5*(k->t + (k+1)->t); 914 802 } 915 803 k->pk = rho; 916 804 917 y.erase(k +1);805 y.erase(k+1); 918 806 return true; 919 807 } … … 930 818 // only merge if the estimated critical temperature of the merged vertex is below the current temperature 931 819 // return true if vertices were merged, false otherwise 932 if(y.size() < 2) return false; 933 934 for(vector<vertex_t>::iterator k = y.begin(); (k + 1) != y.end(); k++) 935 { 936 if(std::abs((k + 1)->z - k->z) < 2.e-3 && std::abs((k + 1)->t - k->t) < 2.e-3) 937 { 938 double rho = k->pk + (k + 1)->pk; 939 double swE = k->swE + (k + 1)->swE - k->pk * (k + 1)->pk / rho * (std::pow((k + 1)->z - k->z, 2.) + std::pow((k + 1)->t - k->t, 2.)); 940 double Tc = 2 * swE / (k->sw + (k + 1)->sw); 941 942 if(Tc * beta < 1) 943 { 944 if(rho > 0) 945 { 946 k->z = (k->pk * k->z + (k + 1)->z * (k + 1)->pk) / rho; 947 k->t = (k->pk * k->t + (k + 1)->t * (k + 1)->pk) / rho; 948 } 949 else 950 { 951 k->z = 0.5 * (k->z + (k + 1)->z); 952 k->t = 0.5 * (k->t + (k + 1)->t); 953 } 954 k->pk = rho; 955 k->sw += (k + 1)->sw; 956 k->swE = swE; 957 k->Tc = Tc; 958 y.erase(k + 1); 959 return true; 820 if(y.size()<2) return false; 821 822 for(vector<vertex_t>::iterator k=y.begin(); (k+1)!=y.end(); k++){ 823 if ( std::abs((k+1)->z - k->z) < 2.e-3 && 824 std::abs((k+1)->t - k->t) < 2.e-3 ) { 825 double rho=k->pk + (k+1)->pk; 826 double swE=k->swE+(k+1)->swE - k->pk * (k+1)->pk / rho * ( std::pow((k+1)->z - k->z,2.) + 827 std::pow((k+1)->t - k->t,2.) ); 828 double Tc=2*swE/(k->sw+(k+1)->sw); 829 830 if(Tc*beta<1){ 831 if(rho>0){ 832 k->z = ( k->pk * k->z + (k+1)->z * (k+1)->pk)/rho; 833 k->t = ( k->pk * k->t + (k+1)->t * (k+1)->pk)/rho; 834 }else{ 835 k->z = 0.5*(k->z + (k+1)->z); 836 k->t = 0.5*(k->t + (k+1)->t); 837 } 838 k->pk = rho; 839 k->sw += (k+1)->sw; 840 k->swE = swE; 841 k->Tc = Tc; 842 y.erase(k+1); 843 return true; 960 844 } 961 845 } … … 967 851 //------------------------------------------------------------------------------ 968 852 969 static bool purge(vector<vertex_t> &y, vector<track_t> &tks, double & rho0, const double beta, const double dzCutOff)853 static bool purge(vector<vertex_t> &y, vector<track_t> &tks, double & rho0, const double beta, const double dzCutOff) 970 854 { 971 855 // eliminate clusters with only one significant/unique track 972 if(y.size() < 2) return false; 973 974 unsigned int nt = tks.size(); 975 double sumpmin = nt; 976 vector<vertex_t>::iterator k0 = y.end(); 977 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 978 { 979 int nUnique = 0; 980 double sump = 0; 981 double pmax = k->pk / (k->pk + rho0 * exp(-beta * dzCutOff * dzCutOff)); 982 for(unsigned int i = 0; i < nt; i++) 983 { 984 if(tks[i].Z > 0) 985 { 986 double p = k->pk * std::exp(-beta * Eik(tks[i], *k)) / tks[i].Z; 987 sump += p; 988 if((p > 0.9 * pmax) && (tks[i].pi > 0)) 989 { 990 nUnique++; 991 } 856 if(y.size()<2) return false; 857 858 unsigned int nt=tks.size(); 859 double sumpmin=nt; 860 vector<vertex_t>::iterator k0=y.end(); 861 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 862 int nUnique=0; 863 double sump=0; 864 double pmax=k->pk/(k->pk+rho0*exp(-beta*dzCutOff*dzCutOff)); 865 for(unsigned int i=0; i<nt; i++){ 866 if(tks[i].Z > 0){ 867 double p = k->pk * std::exp(-beta*Eik(tks[i],*k)) / tks[i].Z ; 868 sump+=p; 869 if( (p > 0.9*pmax) && (tks[i].pi>0) ){ nUnique++; } 992 870 } 993 871 } 994 872 995 if((nUnique < 2) && (sump < sumpmin)) 996 { 997 sumpmin = sump; 998 k0 = k; 999 } 1000 } 1001 1002 if(k0 != y.end()) 1003 { 873 if((nUnique<2)&&(sump<sumpmin)){ 874 sumpmin=sump; 875 k0=k; 876 } 877 } 878 879 if(k0!=y.end()){ 1004 880 //cout << "eliminating prototype at " << k0->z << "," << k0->t << " with sump=" << sumpmin << endl; 1005 881 //rho0+=k0->pk; 1006 882 y.erase(k0); 1007 883 return true; 1008 } 1009 else 1010 { 884 }else{ 1011 885 return false; 1012 886 } … … 1018 892 { 1019 893 1020 double T0 = 0;// max Tc for beta=0894 double T0=0; // max Tc for beta=0 1021 895 // estimate critical temperature from beta=0 (T=inf) 1022 unsigned int nt = tks.size(); 1023 1024 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 1025 { 896 unsigned int nt=tks.size(); 897 898 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 1026 899 1027 900 // vertex fit at T=inf 1028 double sumwz = 0.; 1029 double sumwt = 0.; 1030 double sumw = 0.; 1031 for(unsigned int i = 0; i < nt; i++) 1032 { 1033 double w = tks[i].pi / (tks[i].dz2 * tks[i].dt2); 1034 sumwz += w * tks[i].z; 1035 sumwt += w * tks[i].t; 1036 sumw += w; 1037 } 1038 k->z = sumwz / sumw; 1039 k->t = sumwt / sumw; 901 double sumwz=0.; 902 double sumwt=0.; 903 double sumw=0.; 904 for(unsigned int i=0; i<nt; i++){ 905 double w = tks[i].pi/(tks[i].dz2 * tks[i].dt2); 906 sumwz += w*tks[i].z; 907 sumwt += w*tks[i].t; 908 sumw += w; 909 } 910 k->z = sumwz/sumw; 911 k->t = sumwt/sumw; 1040 912 1041 913 // estimate Tcrit, eventually do this in the same loop 1042 double a = 0, b = 0; 1043 for(unsigned int i = 0; i < nt; i++) 1044 { 1045 double dx = tks[i].z - (k->z); 1046 double dt = tks[i].t - (k->t); 1047 double w = tks[i].pi / (tks[i].dz2 * tks[i].dt2); 1048 a += w * (std::pow(dx, 2.) / tks[i].dz2 + std::pow(dt, 2.) / tks[i].dt2); 914 double a=0, b=0; 915 for(unsigned int i=0; i<nt; i++){ 916 double dx = tks[i].z-(k->z); 917 double dt = tks[i].t-(k->t); 918 double w = tks[i].pi/(tks[i].dz2 * tks[i].dt2); 919 a += w*(std::pow(dx,2.)/tks[i].dz2 + std::pow(dt,2.)/tks[i].dt2); 1049 920 b += w; 1050 921 } 1051 double Tc = 2. * a / b; // the critical temperature of this vertex 1052 if(Tc > T0) T0 = Tc; 1053 } // vertex loop (normally there should be only one vertex at beta=0) 1054 1055 if(T0 > 1. / betamax) 1056 { 1057 return betamax / pow(coolingFactor, int(std::log(T0 * betamax) / std::log(coolingFactor)) - 1); 1058 } 1059 else 1060 { 922 double Tc= 2.*a/b; // the critical temperature of this vertex 923 if(Tc>T0) T0=Tc; 924 }// vertex loop (normally there should be only one vertex at beta=0) 925 926 if (T0>1./betamax){ 927 return betamax/pow(coolingFactor, int(std::log(T0*betamax)/std::log(coolingFactor))-1 ); 928 }else{ 1061 929 // ensure at least one annealing step 1062 return betamax /coolingFactor;930 return betamax/coolingFactor; 1063 931 } 1064 932 } … … 1078 946 1079 947 std::vector<std::pair<double, unsigned int> > critical; 1080 for(unsigned int ik = 0; ik < y.size(); ik++) 1081 { 1082 if(beta * y[ik].Tc > 1.) 1083 { 1084 critical.push_back(make_pair(y[ik].Tc, ik)); 1085 } 1086 } 1087 std::stable_sort(critical.begin(), critical.end(), std::greater<std::pair<double, unsigned int> >()); 1088 1089 for(unsigned int ic = 0; ic < critical.size(); ic++) 1090 { 1091 unsigned int ik = critical[ic].second; 948 for(unsigned int ik=0; ik<y.size(); ik++){ 949 if (beta*y[ik].Tc > 1.){ 950 critical.push_back( make_pair(y[ik].Tc, ik)); 951 } 952 } 953 std::stable_sort(critical.begin(), critical.end(), std::greater<std::pair<double, unsigned int> >() ); 954 955 for(unsigned int ic=0; ic<critical.size(); ic++){ 956 unsigned int ik=critical[ic].second; 1092 957 // estimate subcluster positions and weight 1093 double p1 = 0, z1 = 0, t1 = 0, w1 =0;1094 double p2 = 0, z2 = 0, t2 = 0, w2 =0;958 double p1=0, z1=0, t1=0, w1=0; 959 double p2=0, z2=0, t2=0, w2=0; 1095 960 //double sumpi=0; 1096 for(unsigned int i = 0; i < tks.size(); i++) 1097 { 1098 if(tks[i].Z > 0) 1099 { 1100 //sumpi+=tks[i].pi; 1101 double p = y[ik].pk * exp(-beta * Eik(tks[i], y[ik])) / tks[i].Z * tks[i].pi; 1102 double w = p / (tks[i].dz2 * tks[i].dt2); 1103 if(tks[i].z < y[ik].z) 1104 { 1105 p1 += p; 1106 z1 += w * tks[i].z; 1107 t1 += w * tks[i].t; 1108 w1 += w; 1109 } 1110 else 1111 { 1112 p2 += p; 1113 z2 += w * tks[i].z; 1114 t2 += w * tks[i].t; 1115 w2 += w; 1116 } 961 for(unsigned int i=0; i<tks.size(); i++){ 962 if(tks[i].Z>0){ 963 //sumpi+=tks[i].pi; 964 double p=y[ik].pk * exp(-beta*Eik(tks[i],y[ik])) / tks[i].Z*tks[i].pi; 965 double w=p/(tks[i].dz2 * tks[i].dt2); 966 if(tks[i].z < y[ik].z){ 967 p1+=p; z1+=w*tks[i].z; t1+=w*tks[i].t; w1+=w; 968 }else{ 969 p2+=p; z2+=w*tks[i].z; t2+=w*tks[i].t; w2+=w; 970 } 1117 971 } 1118 972 } 1119 if(w1 > 0) 1120 { 1121 z1 = z1 / w1; 1122 t1 = t1 / w1; 1123 } 1124 else 1125 { 1126 z1 = y[ik].z - epsilon; 1127 t1 = y[ik].t - epsilon; 1128 } 1129 if(w2 > 0) 1130 { 1131 z2 = z2 / w2; 1132 t2 = t2 / w2; 1133 } 1134 else 1135 { 1136 z2 = y[ik].z + epsilon; 1137 t2 = y[ik].t + epsilon; 1138 } 973 if(w1>0){ z1=z1/w1; t1=t1/w1;} else{ z1=y[ik].z-epsilon; t1=y[ik].t-epsilon; } 974 if(w2>0){ z2=z2/w2; t2=t2/w2;} else{ z2=y[ik].z+epsilon; t2=y[ik].t+epsilon;} 1139 975 1140 976 // reduce split size if there is not enough room 1141 if((ik > 0) && (y[ik - 1].z >= z1)) 1142 { 1143 z1 = 0.5 * (y[ik].z + y[ik - 1].z); 1144 t1 = 0.5 * (y[ik].t + y[ik - 1].t); 1145 } 1146 if((ik + 1 < y.size()) && (y[ik + 1].z <= z2)) 1147 { 1148 z2 = 0.5 * (y[ik].z + y[ik + 1].z); 1149 t2 = 0.5 * (y[ik].t + y[ik + 1].t); 1150 } 977 if( ( ik > 0 ) && ( y[ik-1].z>=z1 ) ){ z1=0.5*(y[ik].z+y[ik-1].z); t1=0.5*(y[ik].t+y[ik-1].t); } 978 if( ( ik+1 < y.size()) && ( y[ik+1].z<=z2 ) ){ z2=0.5*(y[ik].z+y[ik+1].z); t2=0.5*(y[ik].t+y[ik+1].t); } 1151 979 1152 980 // split if the new subclusters are significantly separated 1153 if((z2 - z1) > epsilon || std::abs(t2 - t1) > epsilon) 1154 { 1155 split = true; 981 if( (z2-z1)>epsilon || std::abs(t2-t1) > epsilon){ 982 split=true; 1156 983 vertex_t vnew; 1157 vnew.pk = p1 * y[ik].pk / (p1 +p2);1158 y[ik].pk = p2 * y[ik].pk / (p1 +p2);1159 vnew.z = z1;1160 vnew.t = t1;984 vnew.pk = p1*y[ik].pk/(p1+p2); 985 y[ik].pk= p2*y[ik].pk/(p1+p2); 986 vnew.z = z1; 987 vnew.t = t1; 1161 988 y[ik].z = z2; 1162 989 y[ik].t = t2; 1163 y.insert(y.begin() + ik, vnew); 1164 1165 // adjust remaining pointers 1166 for(unsigned int jc = ic; jc < critical.size(); jc++) 1167 { 1168 if(critical[jc].second > ik) 1169 { 1170 critical[jc].second++; 1171 } 990 y.insert(y.begin()+ik, vnew); 991 992 // adjust remaining pointers 993 for(unsigned int jc=ic; jc<critical.size(); jc++){ 994 if (critical[jc].second>ik) {critical[jc].second++;} 1172 995 } 1173 996 } … … 1183 1006 { 1184 1007 1185 const double epsilon = 1e-3; // split all single vertices by 10 um 1186 const double zsep = 2 * epsilon; // split vertices that are isolated by at least zsep (vertices that haven't collapsed) 1187 const double tsep = 2 * epsilon; // check t as well 1008 1009 const double epsilon=1e-3; // split all single vertices by 10 um 1010 const double zsep=2*epsilon; // split vertices that are isolated by at least zsep (vertices that haven't collapsed) 1011 const double tsep=2*epsilon; // check t as well 1188 1012 1189 1013 vector<vertex_t> y1; 1190 1014 1191 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 1192 { 1193 if(((k == y.begin()) || (k - 1)->z < k->z - zsep) && (((k + 1) == y.end()) || (k + 1)->z > k->z + zsep)) 1194 { 1015 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 1016 if ( ( (k==y.begin())|| (k-1)->z < k->z - zsep) && (((k+1)==y.end() )|| (k+1)->z > k->z + zsep)) { 1195 1017 // isolated prototype, split 1196 1018 vertex_t vnew; 1197 vnew.z = k->z - epsilon;1198 vnew.t = k->t - epsilon;1199 (*k).z = k->z + epsilon;1200 (*k).t = k->t + epsilon;1201 vnew.pk = 0.5* (*k).pk;1202 (*k).pk = 0.5* (*k).pk;1019 vnew.z = k->z - epsilon; 1020 vnew.t = k->t - epsilon; 1021 (*k).z = k->z + epsilon; 1022 (*k).t = k->t + epsilon; 1023 vnew.pk= 0.5* (*k).pk; 1024 (*k).pk= 0.5* (*k).pk; 1203 1025 y1.push_back(vnew); 1204 1026 y1.push_back(*k); 1205 } 1206 else if(y1.empty() || (y1.back().z < k->z - zsep) || (y1.back().t < k->t - tsep)) 1207 { 1027 1028 }else if( y1.empty() || (y1.back().z < k->z -zsep) || (y1.back().t < k->t - tsep) ){ 1208 1029 y1.push_back(*k); 1209 } 1210 else 1211 { 1030 }else{ 1212 1031 y1.back().z -= epsilon; 1213 1032 y1.back().t -= epsilon; … … 1216 1035 y1.push_back(*k); 1217 1036 } 1218 } // vertex loop 1219 1220 y = y1; 1221 } 1037 }// vertex loop 1038 1039 y=y1; 1040 } 1041 1042 1043 -
modules/VertexFinderDA4D.h
r0e7d64a re39abb4 9 9 * 10 10 */ 11 11 12 12 13 #include "classes/DelphesModule.h" … … 21 22 { 22 23 public: 24 23 25 VertexFinderDA4D(); 24 26 ~VertexFinderDA4D(); … … 29 31 30 32 void clusterize(const TObjArray &tracks, TObjArray &clusters); 31 std::vector< Candidate *> vertices();33 std::vector< Candidate* > vertices(); 32 34 33 35 private: 36 34 37 Bool_t fVerbose; 35 38 Double_t fMinPT; -
modules/VertexSorter.cc
r0e7d64a re39abb4 16 16 #include "classes/DelphesPileUpReader.h" 17 17 18 #include "ExRootAnalysis/ExRootResult.h" 19 #include "ExRootAnalysis/ExRootFilter.h" 18 20 #include "ExRootAnalysis/ExRootClassifier.h" 19 #include "ExRootAnalysis/ExRootFilter.h" 20 #include "ExRootAnalysis/ExRootResult.h" 21 21 22 #include "TMath.h" 23 #include "TString.h" 24 #include "TFormula.h" 25 #include "TRandom3.h" 26 #include "TObjArray.h" 22 27 #include "TDatabasePDG.h" 23 #include "TFormula.h"24 28 #include "TLorentzVector.h" 25 #include "TMath.h"26 29 #include "TMatrixT.h" 27 #include "TObjArray.h"28 #include "TRandom3.h"29 #include "TString.h"30 30 #include "TVector3.h" 31 31 32 #include <utility> 32 33 #include <algorithm> 34 #include <stdexcept> 33 35 #include <iostream> 36 #include <vector> 34 37 #include <map> 35 #include <stdexcept>36 38 #include <string> 37 #include <utility>38 #include <vector>39 39 40 40 using namespace std; 41 41 42 static const Double_t mm = 1.;43 static const Double_t m = 1000. *mm;44 static const Double_t ns = 1.;45 static const Double_t s = 1.e+9 * 46 static const Double_t c_light = 2.99792458e+8 * m /s;42 static const Double_t mm = 1.; 43 static const Double_t m = 1000.*mm; 44 static const Double_t ns = 1.; 45 static const Double_t s = 1.e+9 *ns; 46 static const Double_t c_light = 2.99792458e+8 * m/s; 47 47 48 48 //------------------------------------------------------------------------------ … … 68 68 fItTrackInputArray = fTrackInputArray->MakeIterator(); 69 69 70 if (string(GetString("JetInputArray", "")) != "")71 {72 fJetInputArray = ImportArray(GetString("JetInputArray", ""));73 fItJetInputArray = fJetInputArray->MakeIterator();74 }70 if (string (GetString("JetInputArray", "")) != "") 71 { 72 fJetInputArray = ImportArray(GetString("JetInputArray", "")); 73 fItJetInputArray = fJetInputArray->MakeIterator(); 74 } 75 75 76 76 // import beamspot … … 82 82 { 83 83 fBeamSpotInputArray = 0; 84 } 85 84 } 85 86 86 fOutputArray = ExportArray(GetString("OutputArray", "clusters")); 87 87 … … 99 99 //------------------------------------------------------------------------------ 100 100 101 static Bool_t secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)101 static Bool_t secondDescending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 102 102 { 103 103 return (pair0.second > pair1.second); 104 104 } 105 105 106 static Bool_t secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1)106 static Bool_t secondAscending (pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 107 107 { 108 108 return (pair0.second < pair1.second); … … 121 121 vector<pair<Int_t, Double_t> >::const_iterator itSortedClusterIDs; 122 122 123 for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries(); iCluster++)124 {125 const Candidate &cluster = *((Candidate *)fInputArray->At(iCluster));126 clusterIDToIndex[cluster.ClusterIndex] = iCluster;127 clusterIDToSumPT2[cluster.ClusterIndex] = 0.0;128 }123 for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++) 124 { 125 const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster)); 126 clusterIDToIndex[cluster.ClusterIndex] = iCluster; 127 clusterIDToSumPT2[cluster.ClusterIndex] = 0.0; 128 } 129 129 130 130 if(fMethod == "BTV") 131 { 132 if(!fJetInputArray) 133 { 134 cout << "BTV PV sorting selected, but no jet collection given!" << endl; 131 { 132 if (!fJetInputArray) 133 { 134 cout << "BTV PV sorting selected, but no jet collection given!" << endl; 135 throw 0; 136 } 137 138 fItTrackInputArray->Reset(); 139 while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next()))) 140 { 141 if (candidate->Momentum.Pt () < 1.0) 142 continue; 143 if (candidate->ClusterIndex < 0) 144 continue; 145 TLorentzVector p (candidate->Momentum.Px (), candidate->Momentum.Py (), candidate->Momentum.Pz (), candidate->Momentum.E ()); 146 Bool_t isInJet = false; 147 148 fItJetInputArray->Reset(); 149 while((jetCandidate = static_cast<Candidate*>(fItJetInputArray->Next()))) 150 { 151 if (jetCandidate->Momentum.Pt () < 30.0) 152 continue; 153 TLorentzVector q (jetCandidate->Momentum.Px (), jetCandidate->Momentum.Py (), jetCandidate->Momentum.Pz (), jetCandidate->Momentum.E ()); 154 155 if (p.DeltaR (q) > 0.4) 156 continue; 157 isInJet = true; 158 break; 159 } 160 if (!isInJet) 161 continue; 162 163 clusterIDToSumPT2.at (candidate->ClusterIndex) += candidate->Momentum.Pt () * candidate->Momentum.Pt (); 164 } 165 166 for (itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2) 167 sortedClusterIDs.push_back (make_pair (itClusterIDToSumPT2->first, itClusterIDToSumPT2->second)); 168 sort (sortedClusterIDs.begin (), sortedClusterIDs.end (), secondDescending); 169 } 170 else if (fMethod == "GenClosest") 171 { 172 if (!fBeamSpotInputArray) 173 { 174 cout << "GenClosest PV sorting selected, but no beamspot collection given!" << endl; 175 throw 0; 176 } 177 if (!fBeamSpotInputArray->GetSize ()) 178 { 179 cout << "Beamspot collection is empty!" << endl; 180 throw 0; 181 } 182 183 beamSpotCandidate = (Candidate *) fBeamSpotInputArray->At (0); 184 for (Int_t iCluster = 0; iCluster < fInputArray->GetEntries (); iCluster++) 185 { 186 const Candidate &cluster = *((Candidate *) fInputArray->At (iCluster)); 187 sortedClusterIDs.push_back (make_pair (cluster.ClusterIndex, fabs (cluster.Position.Z () - beamSpotCandidate->Position.Z ()))); 188 } 189 sort (sortedClusterIDs.begin (), sortedClusterIDs.end (), secondAscending); 190 } 191 else if (fMethod == "GenBest") 192 { 193 fItTrackInputArray->Reset(); 194 while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next()))) 195 { 196 if (candidate->IsPU) 197 continue; 198 for (itClusterIDToIndex = clusterIDToIndex.begin(); itClusterIDToIndex != clusterIDToIndex.end(); ++itClusterIDToIndex) 199 { 200 if (candidate->ClusterIndex != itClusterIDToIndex->first) 201 continue; 202 clusterIDToSumPT2.at (itClusterIDToIndex->first) += candidate->Momentum.Pt () * candidate->Momentum.Pt (); 203 } 204 } 205 206 for (itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2) 207 sortedClusterIDs.push_back (make_pair (itClusterIDToSumPT2->first, itClusterIDToSumPT2->second)); 208 sort (sortedClusterIDs.begin (), sortedClusterIDs.end (), secondDescending); 209 } 210 else 211 { 212 cout << "\"" << fMethod << "\" is not a valid sorting method!" << endl; 213 cout << "Valid methods are:" << endl; 214 cout << " BTV" << endl; 215 cout << " GenClosest" << endl; 216 cout << " GenBest" << endl; 135 217 throw 0; 136 218 } 137 138 fItTrackInputArray->Reset(); 139 while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next()))) 140 { 141 if(candidate->Momentum.Pt() < 1.0) 142 continue; 143 if(candidate->ClusterIndex < 0) 144 continue; 145 TLorentzVector p(candidate->Momentum.Px(), candidate->Momentum.Py(), candidate->Momentum.Pz(), candidate->Momentum.E()); 146 Bool_t isInJet = false; 147 148 fItJetInputArray->Reset(); 149 while((jetCandidate = static_cast<Candidate *>(fItJetInputArray->Next()))) 150 { 151 if(jetCandidate->Momentum.Pt() < 30.0) 152 continue; 153 TLorentzVector q(jetCandidate->Momentum.Px(), jetCandidate->Momentum.Py(), jetCandidate->Momentum.Pz(), jetCandidate->Momentum.E()); 154 155 if(p.DeltaR(q) > 0.4) 156 continue; 157 isInJet = true; 158 break; 159 } 160 if(!isInJet) 161 continue; 162 163 clusterIDToSumPT2.at(candidate->ClusterIndex) += candidate->Momentum.Pt() * candidate->Momentum.Pt(); 164 } 165 166 for(itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2) 167 sortedClusterIDs.push_back(make_pair(itClusterIDToSumPT2->first, itClusterIDToSumPT2->second)); 168 sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondDescending); 169 } 170 else if(fMethod == "GenClosest") 171 { 172 if(!fBeamSpotInputArray) 173 { 174 cout << "GenClosest PV sorting selected, but no beamspot collection given!" << endl; 175 throw 0; 176 } 177 if(!fBeamSpotInputArray->GetSize()) 178 { 179 cout << "Beamspot collection is empty!" << endl; 180 throw 0; 181 } 182 183 beamSpotCandidate = (Candidate *)fBeamSpotInputArray->At(0); 184 for(Int_t iCluster = 0; iCluster < fInputArray->GetEntries(); iCluster++) 185 { 186 const Candidate &cluster = *((Candidate *)fInputArray->At(iCluster)); 187 sortedClusterIDs.push_back(make_pair(cluster.ClusterIndex, fabs(cluster.Position.Z() - beamSpotCandidate->Position.Z()))); 188 } 189 sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondAscending); 190 } 191 else if(fMethod == "GenBest") 192 { 193 fItTrackInputArray->Reset(); 194 while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next()))) 195 { 196 if(candidate->IsPU) 197 continue; 198 for(itClusterIDToIndex = clusterIDToIndex.begin(); itClusterIDToIndex != clusterIDToIndex.end(); ++itClusterIDToIndex) 199 { 200 if(candidate->ClusterIndex != itClusterIDToIndex->first) 201 continue; 202 clusterIDToSumPT2.at(itClusterIDToIndex->first) += candidate->Momentum.Pt() * candidate->Momentum.Pt(); 203 } 204 } 205 206 for(itClusterIDToSumPT2 = clusterIDToSumPT2.begin(); itClusterIDToSumPT2 != clusterIDToSumPT2.end(); ++itClusterIDToSumPT2) 207 sortedClusterIDs.push_back(make_pair(itClusterIDToSumPT2->first, itClusterIDToSumPT2->second)); 208 sort(sortedClusterIDs.begin(), sortedClusterIDs.end(), secondDescending); 209 } 210 else 211 { 212 cout << "\"" << fMethod << "\" is not a valid sorting method!" << endl; 213 cout << "Valid methods are:" << endl; 214 cout << " BTV" << endl; 215 cout << " GenClosest" << endl; 216 cout << " GenBest" << endl; 217 throw 0; 218 } 219 for(itSortedClusterIDs = sortedClusterIDs.begin(); itSortedClusterIDs != sortedClusterIDs.end(); ++itSortedClusterIDs) 220 { 221 Candidate *cluster = (Candidate *)fInputArray->At(clusterIDToIndex.at(itSortedClusterIDs->first)); 222 if(fMethod == "BTV") 223 cluster->BTVSumPT2 = itSortedClusterIDs->second; 224 else if(fMethod == "GenClosest") 225 cluster->GenDeltaZ = itSortedClusterIDs->second; 226 else if(fMethod == "GenBest") 227 cluster->GenSumPT2 = itSortedClusterIDs->second; 228 fOutputArray->Add(cluster); 229 } 230 } 231 232 //------------------------------------------------------------------------------ 219 for (itSortedClusterIDs = sortedClusterIDs.begin(); itSortedClusterIDs != sortedClusterIDs.end(); ++itSortedClusterIDs) 220 { 221 Candidate *cluster = (Candidate *) fInputArray->At (clusterIDToIndex.at (itSortedClusterIDs->first)); 222 if (fMethod == "BTV") 223 cluster->BTVSumPT2 = itSortedClusterIDs->second; 224 else if (fMethod == "GenClosest") 225 cluster->GenDeltaZ = itSortedClusterIDs->second; 226 else if (fMethod == "GenBest") 227 cluster->GenSumPT2 = itSortedClusterIDs->second; 228 fOutputArray->Add (cluster); 229 } 230 } 231 232 //------------------------------------------------------------------------------ -
modules/VertexSorter.h
r0e7d64a re39abb4 23 23 { 24 24 public: 25 25 26 VertexSorter(); 26 27 ~VertexSorter(); … … 31 32 32 33 private: 34 33 35 TObjArray *fInputArray; 34 36 -
modules/Weighter.cc
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 /** \class Weighter 20 21 * … … 31 32 #include "classes/DelphesFormula.h" 32 33 34 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 33 36 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootResult.h"36 37 38 #include "TMath.h" 39 #include "TString.h" 40 #include "TFormula.h" 41 #include "TRandom3.h" 42 #include "TObjArray.h" 37 43 #include "TDatabasePDG.h" 38 #include "TFormula.h"39 44 #include "TLorentzVector.h" 40 #include "TMath.h"41 #include "TObjArray.h"42 #include "TRandom3.h"43 #include "TString.h"44 45 45 46 #include <algorithm> 47 #include <stdexcept> 46 48 #include <iostream> 47 49 #include <sstream> 48 #include <stdexcept>49 50 50 51 using namespace std; … … 52 53 //------------------------------------------------------------------------------ 53 54 54 bool Weighter::TIndexStruct::operator< (const Weighter::TIndexStruct &value) const55 bool Weighter::TIndexStruct::operator< (const Weighter::TIndexStruct &value) const 55 56 { 56 57 Int_t i; … … 89 90 fWeightSet.clear(); 90 91 92 91 93 // set default weight value 92 94 fWeightMap.clear(); 93 memset(index.codes, 0, 4 *sizeof(Int_t));95 memset(index.codes, 0, 4*sizeof(Int_t)); 94 96 fWeightMap[index] = 1.0; 95 97 … … 97 99 param = GetParam("Weight"); 98 100 size = param.GetSize(); 99 for(i = 0; i < size /2; ++i)101 for(i = 0; i < size/2; ++i) 100 102 { 101 paramCodes = param[i *2];103 paramCodes = param[i*2]; 102 104 sizeCodes = paramCodes.GetSize(); 103 weight = param[i *2 + 1].GetDouble();105 weight = param[i*2 + 1].GetDouble(); 104 106 105 107 if(sizeCodes < 1 || sizeCodes > 4) … … 108 110 } 109 111 110 memset(index.codes, 0, 4 *sizeof(Int_t));112 memset(index.codes, 0, 4*sizeof(Int_t)); 111 113 112 114 for(j = 0; j < sizeCodes; ++j) … … 155 157 fCodeSet.clear(); 156 158 fItInputArray->Reset(); 157 while((candidate = static_cast<Candidate 159 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 158 160 { 159 161 if(candidate->Status != 3) continue; … … 165 167 166 168 // find default weight value 167 memset(index.codes, 0, 4 *sizeof(Int_t));169 memset(index.codes, 0, 4*sizeof(Int_t)); 168 170 itWeightMap = fWeightMap.find(index); 169 171 weight = itWeightMap->second; -
modules/Weighter.h
r0e7d64a re39abb4 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <set> 32 33 #include <map> 33 #include <set>34 34 35 35 class TObjArray; … … 38 38 { 39 39 public: 40 40 41 Weighter(); 41 42 ~Weighter(); … … 46 47 47 48 private: 49 48 50 #if !defined(__CINT__) && !defined(__CLING__) 49 51 struct TIndexStruct 50 52 { 51 53 Int_t codes[4]; 52 bool operator< (const TIndexStruct &value) const;54 bool operator< (const TIndexStruct &value) const; 53 55 }; 54 56 -
readers/DelphesCMSFWLite.cpp
r0e7d64a re39abb4 18 18 19 19 #include <algorithm> 20 #include <stdexcept> 20 21 #include <iostream> 22 #include <sstream> 21 23 #include <memory> 22 #include <sstream>23 #include <stdexcept>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h> 28 29 #include <signal.h> 29 30 #include <stdio.h> 30 #include <stdlib.h> 31 31 32 #include "TROOT.h" 32 33 #include "TApplication.h" 33 #include "TROOT.h" 34 34 35 #include "TFile.h" 36 #include "TObjArray.h" 37 #include "TStopwatch.h" 35 38 #include "TDatabasePDG.h" 36 #include "T File.h"39 #include "TParticlePDG.h" 37 40 #include "TLorentzVector.h" 38 #include "TObjArray.h" 39 #include "TParticlePDG.h" 40 #include "TStopwatch.h" 41 41 42 #include "modules/Delphes.h" 43 #include "classes/DelphesStream.h" 42 44 #include "classes/DelphesClasses.h" 43 45 #include "classes/DelphesFactory.h" 44 #include "classes/DelphesStream.h" 45 #include " modules/Delphes.h"46 46 47 #include "ExRootAnalysis/ExRootTreeWriter.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 47 49 #include "ExRootAnalysis/ExRootProgressBar.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 49 #include "ExRootAnalysis/ExRootTreeWriter.h" 50 50 51 #include "FWCore/FWLite/interface/FWLiteEnabler.h" 51 52 #include "DataFormats/FWLite/interface/Event.h" 52 53 #include "DataFormats/FWLite/interface/Handle.h" 53 54 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 54 55 #include "DataFormats/PatCandidates/interface/PackedGenParticle.h" 55 #include " FWCore/FWLite/interface/FWLiteEnabler.h"56 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 56 57 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" 57 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"58 58 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" 59 59 #include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h" … … 69 69 { 70 70 71 fwlite::Handle< GenEventInfoProduct> handleGenEventInfo;72 fwlite::Handle< LHEEventProduct> handleLHEEvent;73 fwlite::Handle< vector<reco::GenParticle> > handleParticle;74 fwlite::Handle< vector<pat::PackedGenParticle> > handlePackedParticle;75 76 vector< reco::GenParticle>::const_iterator itParticle;77 vector< pat::PackedGenParticle>::const_iterator itPackedParticle;78 79 vector< const reco::Candidate *> vectorCandidate;80 vector< const reco::Candidate *>::iterator itCandidate;71 fwlite::Handle< GenEventInfoProduct > handleGenEventInfo; 72 fwlite::Handle< LHEEventProduct > handleLHEEvent; 73 fwlite::Handle< vector< reco::GenParticle > > handleParticle; 74 fwlite::Handle< vector< pat::PackedGenParticle > > handlePackedParticle; 75 76 vector< reco::GenParticle >::const_iterator itParticle; 77 vector< pat::PackedGenParticle >::const_iterator itPackedParticle; 78 79 vector< const reco::Candidate * > vectorCandidate; 80 vector< const reco::Candidate * >::iterator itCandidate; 81 81 82 82 handleGenEventInfo.getByLabel(event, "generator"); … … 99 99 handleParticle.getByLabel(event, "genParticles"); 100 100 } 101 else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event, 101 else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event,"prunedGenParticles")).empty())) 102 102 { 103 103 handleParticle.getByLabel(event, "prunedGenParticles"); … … 106 106 else 107 107 { 108 std::cout << "Wrong GenParticle Label! Please, check the input file." <<std::endl;108 std::cout<<"Wrong GenParticle Label! Please, check the input file."<<std::endl; 109 109 exit(-1); 110 110 } 111 111 112 112 Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty()); 113 Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()) ;113 Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()) ; 114 114 115 115 HepMCEvent *element; … … 148 148 if(foundLHE) 149 149 { 150 const vector< gen::WeightsInfo> &vectorWeightsInfo = handleLHEEvent->weights();151 vector< gen::WeightsInfo>::const_iterator itWeightsInfo;150 const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights(); 151 vector< gen::WeightsInfo >::const_iterator itWeightsInfo; 152 152 153 153 for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) … … 173 173 status = particle.status(); 174 174 if(isMiniAOD && particle.status() == 1) continue; 175 px = particle.px(); 176 py = particle.py(); 177 pz = particle.pz(); 178 e = particle.energy(); 179 mass = particle.mass(); 180 x = particle.vx(); 181 y = particle.vy(); 182 z = particle.vz(); 175 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); 176 x = particle.vx(); y = particle.vy(); z = particle.vz(); 183 177 184 178 candidate = factory->NewCandidate(); … … 202 196 203 197 pdgParticle = pdg->GetParticle(pid); 204 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;198 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 205 199 candidate->Mass = mass; 206 200 207 201 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 208 202 209 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z *10.0, 0.0);203 candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0); 210 204 211 205 allParticleOutputArray->Add(candidate); … … 238 232 pid = particle.pdgId(); 239 233 status = particle.status(); 240 px = particle.px(); 241 py = particle.py(); 242 pz = particle.pz(); 243 e = particle.energy(); 244 mass = particle.mass(); 245 x = particle.vx(); 246 y = particle.vy(); 247 z = particle.vz(); 234 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); 235 x = particle.vx(); y = particle.vy(); z = particle.vz(); 248 236 249 237 candidate = factory->NewCandidate(); … … 267 255 268 256 pdgParticle = pdg->GetParticle(pid); 269 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;257 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 270 258 candidate->Mass = mass; 271 259 272 260 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 273 261 274 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z *10.0, 0.0);262 candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0); 275 263 276 264 allParticleOutputArray->Add(candidate); … … 315 303 if(argc < 4) 316 304 { 317 cout << " Usage: " << appName << " config_file" 318 << " output_file" 319 << " input_file(s)" << endl; 305 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 320 306 cout << " config_file - configuration file in Tcl format," << endl; 321 307 cout << " output_file - output file in ROOT format," << endl; -
readers/DelphesHepMC.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 #include <signal.h> 24 24 25 #include "TROOT.h" 25 26 #include "TApplication.h" 26 #include "TROOT.h" 27 27 28 #include "TFile.h" 29 #include "TObjArray.h" 30 #include "TStopwatch.h" 28 31 #include "TDatabasePDG.h" 29 #include "T File.h"32 #include "TParticlePDG.h" 30 33 #include "TLorentzVector.h" 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 33 #include "TStopwatch.h" 34 34 35 #include "modules/Delphes.h" 35 36 #include "classes/DelphesClasses.h" 36 37 #include "classes/DelphesFactory.h" 37 38 #include "classes/DelphesHepMCReader.h" 38 #include "modules/Delphes.h" 39 39 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootTreeWriter.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 79 77 cout << " config_file - configuration file in Tcl format," << endl; 80 78 cout << " output_file - output file in ROOT format," << endl; … … 180 178 reader->Clear(); 181 179 readStopWatch.Start(); 182 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 180 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 181 reader->ReadBlock(factory, allParticleOutputArray, 182 stableParticleOutputArray, partonOutputArray) && !interrupted) 183 183 { 184 184 if(reader->EventReady()) … … 217 217 218 218 ++i; 219 } while(i < argc); 219 } 220 while(i < argc); 220 221 221 222 modularDelphes->FinishTask(); -
readers/DelphesLHEF.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 #include <signal.h> 24 24 25 #include "TROOT.h" 25 26 #include "TApplication.h" 26 #include "TROOT.h" 27 27 28 #include "TFile.h" 29 #include "TObjArray.h" 30 #include "TStopwatch.h" 28 31 #include "TDatabasePDG.h" 29 #include "T File.h"32 #include "TParticlePDG.h" 30 33 #include "TLorentzVector.h" 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 33 #include "TStopwatch.h" 34 34 35 #include "modules/Delphes.h" 35 36 #include "classes/DelphesClasses.h" 36 37 #include "classes/DelphesFactory.h" 37 38 #include "classes/DelphesLHEFReader.h" 38 #include "modules/Delphes.h" 39 39 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootTreeWriter.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 79 77 cout << " config_file - configuration file in Tcl format," << endl; 80 78 cout << " output_file - output file in ROOT format," << endl; … … 180 178 reader->Clear(); 181 179 readStopWatch.Start(); 182 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 180 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 181 reader->ReadBlock(factory, allParticleOutputArray, 182 stableParticleOutputArray, partonOutputArray) && !interrupted) 183 183 { 184 184 if(reader->EventReady()) … … 218 218 219 219 ++i; 220 } while(i < argc); 220 } 221 while(i < argc); 221 222 222 223 modularDelphes->FinishTask(); -
readers/DelphesProIO.cpp
r0e7d64a re39abb4 18 18 */ 19 19 20 #include <stdexcept> 20 21 #include <iostream> 22 #include <sstream> 21 23 #include <memory> 22 #include <sstream>23 #include <stdexcept>24 24 25 25 #include <map> 26 26 27 #include <stdlib.h> 27 28 #include <signal.h> 28 29 #include <stdio.h> 29 #include <stdlib.h> 30 30 31 #include "TROOT.h" 31 32 #include "TApplication.h" 32 #include "TROOT.h" 33 33 34 #include "TFile.h" 35 #include "TObjArray.h" 36 #include "TStopwatch.h" 34 37 #include "TDatabasePDG.h" 35 #include "T File.h"38 #include "TParticlePDG.h" 36 39 #include "TLorentzVector.h" 37 #include "TObjArray.h" 38 #include "TParticlePDG.h" 39 #include "TStopwatch.h" 40 40 41 #include "modules/Delphes.h" 42 #include "classes/DelphesStream.h" 41 43 #include "classes/DelphesClasses.h" 42 44 #include "classes/DelphesFactory.h" 43 #include "classes/DelphesStream.h" 44 #include " modules/Delphes.h"45 45 46 #include "ExRootAnalysis/ExRootTreeWriter.h" 47 #include "ExRootAnalysis/ExRootTreeBranch.h" 46 48 #include "ExRootAnalysis/ExRootProgressBar.h" 47 #include "ExRootAnalysis/ExRootTreeBranch.h" 48 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 49 50 #include <proio/reader.h> 50 51 #include <proio/event.h> 51 52 #include <proio/model/mc.pb.h> 52 #include <proio/reader.h> 53 namespace model = proio::model::mc; 53 namespace model=proio::model::mc; 54 54 55 55 56 using namespace std; … … 58 59 // This method dynamically checks the message type (varint or not) depending on 59 60 // non-zero value of units momentumUnit and positionUnit. 60 void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 61 void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 61 62 ExRootTreeBranch *branch, DelphesFactory *factory, 62 63 TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, … … 79 80 element = static_cast<HepMCEvent *>(branch->NewEntry()); 80 81 81 int nID = 0; 82 double weight = 0; 83 int process_id = 0; 84 auto mcentries = event->TaggedEntries("MCParameters"); 85 for(uint64_t mcentryID : mcentries) 86 { 87 auto mcpar = dynamic_cast<proio::model::mc::MCParameters *>(event->GetEntry(mcentryID)); 88 nID = mcpar->number(); 89 weight = mcpar->weight(); 90 process_id = mcpar->processid(); 91 break; // consider only most generic from 1st entry 92 }; 82 int nID=0; 83 double weight=0; 84 int process_id=0; 85 auto mcentries = event->TaggedEntries("MCParameters"); 86 for (uint64_t mcentryID : mcentries) { 87 auto mcpar = dynamic_cast<proio::model::mc::MCParameters *>(event->GetEntry(mcentryID)); 88 nID=mcpar->number(); 89 weight=mcpar->weight(); 90 process_id=mcpar->processid(); 91 break; // consider only most generic from 1st entry 92 }; 93 93 94 94 element->Number = nID; 95 element->ProcessID = 95 element->ProcessID =process_id; 96 96 element->Weight = weight; 97 97 98 98 /* 99 99 // Pythia8 specific 100 100 element->MPI = mutableEvent->mpi(); … … 114 114 element->ProcTime = procStopWatch->RealTime(); 115 115 116 if(momentumUnit > 0 && positionUnit > 0) 117 { 118 119 auto entries = event->TaggedEntries("VarintPackedParticles"); 120 121 for(uint64_t entryID : entries) 122 { 123 124 auto mutableParticles = dynamic_cast<model::VarintPackedParticles *>(event->GetEntry(entryID)); 125 126 for(int i = 0; i < mutableParticles->pdg_size(); ++i) 127 { 128 pid = mutableParticles->pdg(i); 129 status = mutableParticles->status(i); 130 px = mutableParticles->px(i) / momentumUnit; 131 py = mutableParticles->py(i) / momentumUnit; 132 pz = mutableParticles->pz(i) / momentumUnit; 133 mass = mutableParticles->mass(i) / momentumUnit; 134 x = mutableParticles->x(i) / positionUnit; 135 y = mutableParticles->y(i) / positionUnit; 136 z = mutableParticles->z(i) / positionUnit; 137 t = mutableParticles->t(i) / positionUnit; 138 139 candidate = factory->NewCandidate(); 140 candidate->PID = pid; 141 pdgCode = TMath::Abs(candidate->PID); 142 candidate->Status = status; 143 candidate->M1 = mutableParticles->parent1(i); 144 candidate->M2 = mutableParticles->parent2(i); 145 candidate->D1 = mutableParticles->child1(i); 146 candidate->D2 = mutableParticles->child2(i); 147 pdgParticle = pdg->GetParticle(pid); 148 candidate->Charge = mutableParticles->charge(i) / 3.0; 149 //candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 150 candidate->Mass = mass; 151 candidate->Momentum.SetXYZM(px, py, pz, mass); 152 candidate->Position.SetXYZT(x, y, z, t); 153 allParticleOutputArray->Add(candidate); 154 if(!pdgParticle) continue; 155 156 if(status == 1) 157 { 158 stableParticleOutputArray->Add(candidate); 159 } 160 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 161 { 162 partonOutputArray->Add(candidate); 163 } 116 117 118 if ( momentumUnit >0 && positionUnit>0) { 119 120 121 auto entries = event->TaggedEntries("VarintPackedParticles"); 122 123 for (uint64_t entryID : entries) { 124 125 auto mutableParticles = dynamic_cast<model::VarintPackedParticles *>(event->GetEntry(entryID)); 126 127 for(int i = 0; i < mutableParticles->pdg_size(); ++i) 128 { 129 pid = mutableParticles->pdg(i); 130 status = mutableParticles->status(i); 131 px = mutableParticles->px(i)/momentumUnit; 132 py = mutableParticles->py(i)/momentumUnit; 133 pz = mutableParticles->pz(i)/momentumUnit; 134 mass = mutableParticles->mass(i)/momentumUnit; 135 x = mutableParticles->x(i)/positionUnit; 136 y = mutableParticles->y(i)/positionUnit; 137 z = mutableParticles->z(i)/positionUnit; 138 t = mutableParticles->t(i)/positionUnit; 139 140 candidate = factory->NewCandidate(); 141 candidate->PID = pid; 142 pdgCode = TMath::Abs(candidate->PID); 143 candidate->Status = status; 144 candidate->M1 = mutableParticles->parent1(i); 145 candidate->M2 = mutableParticles->parent2(i); 146 candidate->D1 = mutableParticles->child1(i); 147 candidate->D2 = mutableParticles->child2(i); 148 pdgParticle = pdg->GetParticle(pid); 149 candidate->Charge = mutableParticles->charge(i)/3.0; 150 //candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 151 candidate->Mass = mass; 152 candidate->Momentum.SetXYZM(px, py, pz, mass); 153 candidate->Position.SetXYZT(x, y, z, t); 154 allParticleOutputArray->Add(candidate); 155 if(!pdgParticle) continue; 156 157 if(status == 1) 158 { 159 stableParticleOutputArray->Add(candidate); 160 } 161 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 162 { 163 partonOutputArray->Add(candidate); 164 } 165 } 166 167 } 168 169 } else { 170 171 172 auto entries = event->TaggedEntries("Particle"); 173 174 for (uint64_t entryID : entries) { 175 auto part = dynamic_cast<model::Particle *>(event->GetEntry(entryID)); 176 pid = part->pdg(); 177 status = part->status(); 178 model::XYZF pvector=part->p(); 179 px=pvector.x(); 180 py=pvector.y(); 181 pz=pvector.z(); 182 mass = part->mass(); 183 auto v =part->vertex(); 184 x=v.x(); 185 y=v.y(); 186 z=v.z(); 187 t=v.t(); 188 189 candidate = factory->NewCandidate(); 190 candidate->PID = pid; 191 pdgCode = TMath::Abs(candidate->PID); 192 candidate->Status = status; 193 194 int M1=0; 195 int M2=0; 196 for (int k1=0; k1<part->parent_size(); k1++){ 197 if (k1==0) { 198 auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(0))); 199 M1=mother->barcode(); 200 } 201 if (k1==1) { 202 auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(1))); 203 M2=mother->barcode(); 204 } 205 } 206 207 208 int D1=0; 209 int D2=0; 210 for (int k1=0; k1<part->child_size(); k1++){ 211 if (k1==0) { 212 auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(0))); 213 D1=child->barcode(); 214 } 215 216 if (k1==1) { 217 auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(1))); 218 D2=child->barcode(); 219 }; 164 220 } 165 } 166 } 167 else 168 { 169 170 auto entries = event->TaggedEntries("Particle"); 171 172 for(uint64_t entryID : entries) 173 { 174 auto part = dynamic_cast<model::Particle *>(event->GetEntry(entryID)); 175 pid = part->pdg(); 176 status = part->status(); 177 model::XYZF pvector = part->p(); 178 px = pvector.x(); 179 py = pvector.y(); 180 pz = pvector.z(); 181 mass = part->mass(); 182 auto v = part->vertex(); 183 x = v.x(); 184 y = v.y(); 185 z = v.z(); 186 t = v.t(); 187 188 candidate = factory->NewCandidate(); 189 candidate->PID = pid; 190 pdgCode = TMath::Abs(candidate->PID); 191 candidate->Status = status; 192 193 int M1 = 0; 194 int M2 = 0; 195 for(int k1 = 0; k1 < part->parent_size(); k1++) 196 { 197 if(k1 == 0) 198 { 199 auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(0))); 200 M1 = mother->barcode(); 201 } 202 if(k1 == 1) 203 { 204 auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(1))); 205 M2 = mother->barcode(); 206 } 207 } 208 209 int D1 = 0; 210 int D2 = 0; 211 for(int k1 = 0; k1 < part->child_size(); k1++) 212 { 213 if(k1 == 0) 214 { 215 auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(0))); 216 D1 = child->barcode(); 217 } 218 219 if(k1 == 1) 220 { 221 auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(1))); 222 D2 = child->barcode(); 223 }; 224 } 225 226 candidate->M1 = M1; 227 candidate->M2 = M2; 228 candidate->D1 = D1; 229 candidate->D2 = D2; 230 231 pdgParticle = pdg->GetParticle(pid); 232 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 233 candidate->Mass = mass; 234 235 candidate->Momentum.SetXYZM(px, py, pz, mass); 236 237 candidate->Position.SetXYZT(x, y, z, t); 238 239 allParticleOutputArray->Add(candidate); 240 241 if(!pdgParticle) continue; 242 243 if(status == 1) 244 { 245 stableParticleOutputArray->Add(candidate); 246 } 247 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 248 { 249 partonOutputArray->Add(candidate); 250 } 251 } 252 253 } // end particle type 221 222 223 candidate->M1 = M1; 224 candidate->M2 = M2; 225 candidate->D1 = D1; 226 candidate->D2 = D2; 227 228 pdgParticle = pdg->GetParticle(pid); 229 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 230 candidate->Mass = mass; 231 232 candidate->Momentum.SetXYZM(px, py, pz, mass); 233 234 candidate->Position.SetXYZT(x, y, z, t); 235 236 allParticleOutputArray->Add(candidate); 237 238 if(!pdgParticle) continue; 239 240 if(status == 1) 241 { 242 stableParticleOutputArray->Add(candidate); 243 } 244 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 245 { 246 partonOutputArray->Add(candidate); 247 } 248 249 } 250 251 252 } // end particle type 253 254 254 } 255 255 … … 283 283 if(argc < 4) 284 284 { 285 cout << " Usage: " << appName << " config_file" 286 << " output_file" 287 << " input_file(s)" << endl; 285 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 288 286 cout << " config_file - configuration file in Tcl format," << endl; 289 287 cout << " output_file - output file in ROOT format," << endl; … … 332 330 cout << "** INFO: Reading " << argv[i] << endl; 333 331 334 inputFile = new proio::Reader(argv[i]);332 inputFile=new proio::Reader( argv[i] ); 335 333 336 334 if(inputFile == NULL) … … 340 338 } 341 339 342 /* 340 341 /* 343 342 // this is slow method, but general 344 343 inputFile->SeekToStart(); … … 351 350 */ 352 351 353 auto event = new proio::Event(); 354 355 double varint_energy = 0; 356 double varint_length = 0; 357 358 auto max_n_events = std::numeric_limits<uint64_t>::max(); 359 auto nn = inputFile->Skip(max_n_events); 360 cout << "** INFO: " << nn - 1 << " events found in ProIO file" << endl; 361 inputFile->SeekToStart(); 362 numberOfEvents = nn - 1; // last event has only metadata (no particle record) 363 364 if(numberOfEvents <= 0) continue; 365 366 ExRootProgressBar progressBar(numberOfEvents - 1); 352 353 auto event = new proio::Event(); 354 355 356 double varint_energy=0; 357 double varint_length=0; 358 359 360 auto max_n_events = std::numeric_limits<uint64_t>::max(); 361 auto nn = inputFile->Skip(max_n_events); 362 cout << "** INFO: " << nn-1 << " events found in ProIO file" << endl; 363 inputFile->SeekToStart(); 364 numberOfEvents = nn-1; // last event has only metadata (no particle record) 365 366 if(numberOfEvents <= 0) continue; 367 368 ExRootProgressBar progressBar(numberOfEvents - 1); 369 367 370 368 371 // Loop over all objects … … 373 376 for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter) 374 377 { 375 inputFile->Next(event); 378 inputFile->Next(event); 376 379 if(event == 0) continue; 377 380 378 // get metadata 379 if(eventCounter == 0) 380 { 381 auto metadata = event->Metadata(); 382 std::cout << "** INFO: ProIO file metadata:" << std::endl; 383 for(auto element : metadata) 384 { 385 string key = (string)element.first; 386 string value = (string)(*element.second); 387 std::cout << "** INFO: " << key << " = " << value << std::endl; 388 if(key == "info:varint_energy") varint_energy = std::stod(value); 389 if(key == "info:varint_length") varint_length = std::stod(value); 390 } 381 // get metadata 382 if (eventCounter == 0) { 383 auto metadata = event->Metadata(); 384 std::cout << "** INFO: ProIO file metadata:" << std::endl; 385 for (auto element : metadata) { 386 string key=(string)element.first; 387 string value=(string)(*element.second); 388 std::cout << "** INFO: " << key << " = " << value << std::endl; 389 if (key=="info:varint_energy") varint_energy=std::stod(value); 390 if (key=="info:varint_length") varint_length=std::stod(value); 391 391 } 392 } 393 392 394 393 395 readStopWatch.Stop(); … … 395 397 procStopWatch.Start(); 396 398 397 ConvertInput(event, varint_energy, varint_length, 399 ConvertInput(event, varint_energy, varint_length, 398 400 branchEvent, factory, 399 401 allParticleOutputArray, stableParticleOutputArray, 400 402 partonOutputArray, &readStopWatch, &procStopWatch); 401 403 402 404 modularDelphes->ProcessTask(); 403 405 procStopWatch.Stop(); … … 412 414 } 413 415 416 414 417 progressBar.Update(eventCounter, eventCounter, kTRUE); 415 418 progressBar.Finish(); … … 417 420 delete inputFile; 418 421 } 422 419 423 420 424 modularDelphes->FinishTask(); -
readers/DelphesProMC.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 21 #include <sstream> 20 22 #include <memory> 21 #include <sstream>22 #include <stdexcept>23 23 24 24 #include <map> 25 25 26 #include <stdlib.h> 26 27 #include <signal.h> 27 28 #include <stdio.h> 28 #include <stdlib.h> 29 29 30 #include "TROOT.h" 30 31 #include "TApplication.h" 31 #include "TROOT.h" 32 32 33 #include "TFile.h" 34 #include "TObjArray.h" 35 #include "TStopwatch.h" 33 36 #include "TDatabasePDG.h" 34 #include "T File.h"37 #include "TParticlePDG.h" 35 38 #include "TLorentzVector.h" 36 #include "TObjArray.h" 37 #include "TParticlePDG.h" 38 #include "TStopwatch.h" 39 39 40 #include "modules/Delphes.h" 41 #include "classes/DelphesStream.h" 40 42 #include "classes/DelphesClasses.h" 41 43 #include "classes/DelphesFactory.h" 42 #include "classes/DelphesStream.h" 43 #include " modules/Delphes.h"44 44 45 #include "ExRootAnalysis/ExRootTreeWriter.h" 46 #include "ExRootAnalysis/ExRootTreeBranch.h" 45 47 #include "ExRootAnalysis/ExRootProgressBar.h" 46 #include "ExRootAnalysis/ExRootTreeBranch.h"47 #include "ExRootAnalysis/ExRootTreeWriter.h"48 48 49 49 #include "ProMC.pb.h" … … 109 109 status = mutableParticles->status(i); 110 110 111 px = mutableParticles->px(i) /momentumUnit;112 py = mutableParticles->py(i) /momentumUnit;113 pz = mutableParticles->pz(i) /momentumUnit;114 mass = mutableParticles->mass(i) /momentumUnit;115 x = mutableParticles->x(i) /positionUnit;116 y = mutableParticles->y(i) /positionUnit;117 z = mutableParticles->z(i) /positionUnit;118 t = mutableParticles->t(i) /positionUnit;111 px = mutableParticles->px(i)/momentumUnit; 112 py = mutableParticles->py(i)/momentumUnit; 113 pz = mutableParticles->pz(i)/momentumUnit; 114 mass = mutableParticles->mass(i)/momentumUnit; 115 x = mutableParticles->x(i)/positionUnit; 116 y = mutableParticles->y(i)/positionUnit; 117 z = mutableParticles->z(i)/positionUnit; 118 t = mutableParticles->t(i)/positionUnit; 119 119 120 120 candidate = factory->NewCandidate(); … … 125 125 candidate->Status = status; 126 126 127 candidate->IsPU = 0;128 if(mutableParticles->barcode(i) > 0) candidate->IsPU = 1; // pileup particle129 130 127 candidate->M1 = mutableParticles->mother1(i); 131 128 candidate->M2 = mutableParticles->mother2(i); … … 135 132 136 133 pdgParticle = pdg->GetParticle(pid); 137 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;134 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 138 135 candidate->Mass = mass; 139 136 … … 187 184 if(argc < 4) 188 185 { 189 cout << " Usage: " << appName << " config_file" 190 << " output_file" 191 << " input_file(s)" << endl; 186 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 192 187 cout << " config_file - configuration file in Tcl format," << endl; 193 188 cout << " output_file - output file in ROOT format," << endl; … … 236 231 cout << "** Reading " << argv[i] << endl; 237 232 238 // use 64 bit239 //inputFile = new ProMCBook(argv[i], "r", true);240 241 //use 32 bit zip (faster but limitted to 64k events)242 233 inputFile = new ProMCBook(argv[i], "r"); 243 234 … … 246 237 momentumUnit = static_cast<double>(header.momentumunit()); 247 238 positionUnit = static_cast<double>(header.lengthunit()); 239 240 248 241 249 242 if(inputFile == NULL) -
readers/DelphesPythia8.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 #include <string> 23 23 … … 27 27 #include "Pythia8Plugins/CombineMatchingInput.h" 28 28 29 #include "TROOT.h" 29 30 #include "TApplication.h" 30 #include "TROOT.h" 31 31 32 #include "TFile.h" 33 #include "TObjArray.h" 34 #include "TStopwatch.h" 32 35 #include "TDatabasePDG.h" 33 #include "T File.h"36 #include "TParticlePDG.h" 34 37 #include "TLorentzVector.h" 35 #include "TObjArray.h" 36 #include "TParticlePDG.h" 37 #include "TStopwatch.h" 38 38 39 #include "modules/Delphes.h" 39 40 #include "classes/DelphesClasses.h" 40 41 #include "classes/DelphesFactory.h" 41 42 #include "classes/DelphesLHEFReader.h" 42 #include "modules/Delphes.h" 43 43 44 #include "ExRootAnalysis/ExRootTreeWriter.h" 45 #include "ExRootAnalysis/ExRootTreeBranch.h" 44 46 #include "ExRootAnalysis/ExRootProgressBar.h" 45 #include "ExRootAnalysis/ExRootTreeBranch.h"46 #include "ExRootAnalysis/ExRootTreeWriter.h"47 47 48 48 using namespace std; … … 98 98 pid = particle.id(); 99 99 status = particle.statusHepMC(); 100 px = particle.px(); 101 py = particle.py(); 102 pz = particle.pz(); 103 e = particle.e(); 104 mass = particle.m(); 105 x = particle.xProd(); 106 y = particle.yProd(); 107 z = particle.zProd(); 108 t = particle.tProd(); 100 px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.e(); mass = particle.m(); 101 x = particle.xProd(); y = particle.yProd(); z = particle.zProd(); t = particle.tProd(); 109 102 110 103 candidate = factory->NewCandidate(); … … 122 115 123 116 pdgParticle = pdg->GetParticle(pid); 124 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;117 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; 125 118 candidate->Mass = mass; 126 119 … … 173 166 174 167 // pMin = 0.1 GeV for single particles 175 pp = pow(10, - 1.0 + (log10(pMax) + 1.0) * rndm.flat());168 pp = pow(10, - 1.0 + (log10(pMax) + 1.0) * rndm.flat()); 176 169 eta = (2.0 * rndm.flat() - 1.0) * etaMax; 177 170 phi = 2.0 * M_PI * rndm.flat(); 178 171 mm = pdt.mSel(id); 179 ee = Pythia8::sqrtpos(pp * pp + mm *mm);172 ee = Pythia8::sqrtpos(pp*pp + mm*mm); 180 173 pt = pp / cosh(eta); 181 174 … … 200 193 phi = 2.0 * M_PI * rndm.flat(); 201 194 mm = pdt.mSel(id); 202 ee = Pythia8::sqrtpos(pp * pp + mm *mm);195 ee = Pythia8::sqrtpos(pp*pp + mm*mm); 203 196 pt = pp / cosh(eta); 204 197 205 if( (id == 4 || id == 5) && pt < 10.0) return;198 if( (id == 4 || id == 5) && pt < 10.0) return; 206 199 207 200 if(id == 21) … … 245 238 // for matching 246 239 Pythia8::CombineMatchingInput *combined = 0; 247 Pythia8::UserHooks *matching = 0;240 Pythia8::UserHooks* matching = 0; 248 241 249 242 if(argc != 4) 250 243 { 251 cout << " Usage: " << appName << " config_file" 252 << " pythia_card" 253 << " output_file" << endl; 244 cout << " Usage: " << appName << " config_file" << " pythia_card" << " output_file" << endl; 254 245 cout << " config_file - configuration file in Tcl format," << endl; 255 246 cout << " pythia_card - Pythia8 configuration file," << endl; … … 302 293 } 303 294 pythia->setUserHooksPtr(matching); 295 304 296 305 297 if(pythia == NULL) … … 356 348 for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter) 357 349 { 358 while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF, stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady())359 ;350 while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF, 351 stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady()); 360 352 361 353 if(spareFlag1) -
readers/DelphesROOT.cpp
r0e7d64a re39abb4 18 18 19 19 #include <algorithm> 20 #include <stdexcept> 20 21 #include <iostream> 22 #include <sstream> 21 23 #include <memory> 22 #include <sstream>23 #include <stdexcept>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h> 28 29 #include <signal.h> 29 30 #include <stdio.h> 30 #include <stdlib.h> 31 31 32 #include "TROOT.h" 32 33 #include "TApplication.h" 33 #include "TROOT.h" 34 34 35 #include "TFile.h" 35 36 #include "TClonesArray.h" 37 #include "TObjArray.h" 38 #include "TStopwatch.h" 36 39 #include "TDatabasePDG.h" 37 #include "T File.h"40 #include "TParticlePDG.h" 38 41 #include "TLorentzVector.h" 39 #include "TObjArray.h" 40 #include "TParticlePDG.h" 41 #include "TStopwatch.h" 42 42 43 #include "modules/Delphes.h" 44 #include "classes/DelphesStream.h" 43 45 #include "classes/DelphesClasses.h" 44 46 #include "classes/DelphesFactory.h" 45 #include "classes/DelphesStream.h" 46 #include "modules/Delphes.h" 47 47 48 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 #include "ExRootAnalysis/ExRootTreeReader.h" 50 #include "ExRootAnalysis/ExRootTreeBranch.h" 48 51 #include "ExRootAnalysis/ExRootProgressBar.h" 49 #include "ExRootAnalysis/ExRootTreeBranch.h" 50 #include "ExRootAnalysis/ExRootTreeReader.h" 51 #include "ExRootAnalysis/ExRootTreeWriter.h" 52 53 52 54 53 55 using namespace std; 54 56 55 57 //--------------------------------------------------------------------------- 58 56 59 57 60 //--------------------------------------------------------------------------- … … 91 94 if(argc < 4) 92 95 { 93 cout << " Usage: " << appName << " config_file" 94 << " output_file" 95 << " input_file(s)" << endl; 96 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 96 97 cout << " config_file - configuration file in Tcl format," << endl; 97 98 cout << " output_file - output file in ROOT format," << endl; … … 121 122 122 123 branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class()); 123 124 124 125 confReader = new ExRootConfReader; 125 126 confReader->ReadFile(argv[1]); … … 128 129 modularDelphes->SetConfReader(confReader); 129 130 modularDelphes->SetTreeWriter(treeWriter); 130 131 131 132 TChain *chain = new TChain("Delphes"); 132 133 133 134 factory = modularDelphes->GetFactory(); 134 135 allParticleOutputArray = modularDelphes->ExportArray("allParticles"); … … 144 145 chain->Add(argv[i]); 145 146 ExRootTreeReader *treeReader = new ExRootTreeReader(chain); 146 147 147 148 inputFile = TFile::Open(argv[i]); 148 149 … … 152 153 throw runtime_error(message.str()); 153 154 } 154 155 155 156 numberOfEvents = treeReader->GetEntries(); 156 TClonesArray *branchParticle = treeReader->UseBranch("Particle");157 TClonesArray *branchParticle = treeReader->UseBranch("Particle"); 157 158 TClonesArray *branchHepMCEvent = treeReader->UseBranch("Event"); 158 159 159 160 if(numberOfEvents <= 0) continue; 160 161 … … 168 169 for(Int_t entry = 0; entry < numberOfEvents && !interrupted; ++entry) 169 170 { 170 171 171 172 treeReader->ReadEntry(entry); 172 173 173 // -- TBC need also to include event weights -- 174 175 eve = (HepMCEvent *)branchHepMCEvent->At(0);174 // -- TBC need also to include event weights -- 175 176 eve = (HepMCEvent*) branchHepMCEvent->At(0); 176 177 element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); 177 178 178 179 element->Number = eventCounter; 179 180 … … 196 197 element->ProcTime = eve->ProcTime; 197 198 198 for(Int_t j =0; j < branchParticle->GetEntriesFast(); j++)199 { 200 201 gen = (GenParticle *)branchParticle->At(j);199 for(Int_t j=0; j < branchParticle->GetEntriesFast(); j++) 200 { 201 202 gen = (GenParticle*) branchParticle->At(j); 202 203 candidate = factory->NewCandidate(); 203 204 204 205 candidate->Momentum = gen->P4(); 205 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T * 1.0E3 *c_light);206 206 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T*1.0E3*c_light); 207 207 208 candidate->PID = gen->PID; 208 209 candidate->Status = gen->Status; 209 210 210 211 candidate->M1 = gen->M1; 211 212 candidate->M2 = gen->M2; … … 215 216 216 217 candidate->Charge = gen->Charge; 217 candidate->Mass = gen->Mass;218 218 candidate->Mass = gen->Mass; 219 219 220 allParticleOutputArray->Add(candidate); 220 221 221 222 pdgCode = TMath::Abs(gen->PID); 222 223 … … 230 231 } 231 232 } 232 233 233 234 modularDelphes->ProcessTask(); 234 235 … … 241 242 ++eventCounter; 242 243 } 243 244 244 245 progressBar.Update(eventCounter, eventCounter, kTRUE); 245 246 progressBar.Finish(); 246 247 247 248 inputFile->Close(); 248 249 249 250 delete treeReader; 251 250 252 } 251 253 … … 260 262 delete outputFile; 261 263 delete chain; 262 264 263 265 return 0; 264 266 } -
readers/DelphesSTDHEP.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 #include <stdexcept> 19 20 #include <iostream> 20 21 #include <sstream> 21 #include <stdexcept>22 22 23 23 #include <signal.h> 24 24 25 #include "TROOT.h" 25 26 #include "TApplication.h" 26 #include "TROOT.h" 27 27 28 #include "TFile.h" 29 #include "TObjArray.h" 30 #include "TStopwatch.h" 28 31 #include "TDatabasePDG.h" 29 #include "T File.h"32 #include "TParticlePDG.h" 30 33 #include "TLorentzVector.h" 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 33 #include "TStopwatch.h" 34 34 35 #include "modules/Delphes.h" 35 36 #include "classes/DelphesClasses.h" 36 37 #include "classes/DelphesFactory.h" 37 38 #include "classes/DelphesSTDHEPReader.h" 38 #include "modules/Delphes.h" 39 39 40 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootTreeWriter.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 79 77 cout << " config_file - configuration file in Tcl format," << endl; 80 78 cout << " output_file - output file in ROOT format," << endl; … … 179 177 reader->Clear(); 180 178 readStopWatch.Start(); 181 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 179 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 180 reader->ReadBlock(factory, allParticleOutputArray, 181 stableParticleOutputArray, partonOutputArray) && !interrupted) 182 182 { 183 183 if(reader->EventReady()) … … 215 215 216 216 ++i; 217 } while(i < argc); 217 } 218 while(i < argc); 218 219 219 220 modularDelphes->FinishTask(); -
validation/DelphesValidation.cpp
r0e7d64a re39abb4 17 17 */ 18 18 19 19 20 #include <iostream> 20 #include <typeinfo>21 21 #include <utility> 22 22 #include <vector> 23 24 #include "TApplication.h" 23 #include <typeinfo> 24 25 25 #include "TROOT.h" 26 26 #include "TSystem.h" 27 #include "TApplication.h" 27 28 28 29 #include "TString.h" 29 30 30 #include "TCanvas.h"31 #include "TClonesArray.h"32 #include "TGraph.h"33 #include "TGraphErrors.h"34 31 #include "TH1.h" 35 32 #include "TH2.h" 33 #include "TMath.h" 34 #include "TStyle.h" 35 #include "TGraph.h" 36 #include "TCanvas.h" 36 37 #include "THStack.h" 37 38 #include "TLegend.h" 39 #include "TPaveText.h" 40 #include "TClonesArray.h" 38 41 #include "TLorentzVector.h" 39 #include "T Math.h"42 #include "TGraphErrors.h" 40 43 #include "TMultiGraph.h" 41 #include "TPaveText.h"42 #include "TStyle.h"43 44 44 45 #include "classes/DelphesClasses.h" 45 46 46 #include "ExRootAnalysis/ExRootResult.h"47 #include "ExRootAnalysis/ExRootTreeBranch.h"48 47 #include "ExRootAnalysis/ExRootTreeReader.h" 49 48 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 #include "ExRootAnalysis/ExRootTreeBranch.h" 50 #include "ExRootAnalysis/ExRootResult.h" 50 51 #include "ExRootAnalysis/ExRootUtilities.h" 51 52 … … 81 82 unsigned int k; 82 83 84 83 85 struct resolPlot 84 86 { 85 TH1 *resolHist;87 TH1* resolHist; 86 88 double ptmin; 87 89 double ptmax; … … 97 99 void set(double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2); 98 100 void set(double etadown, double etaup, double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2); 99 void print() { std::cout << ptmin << std::endl;}101 void print(){std::cout << ptmin << std::endl;} 100 102 }; 103 101 104 102 105 resolPlot::resolPlot() … … 106 109 resolPlot::resolPlot(double ptdown, double ptup, TString object) 107 110 { 108 this->set(ptdown, ptup,object);111 this->set(ptdown,ptup,object); 109 112 } 110 113 … … 120 123 obj = object; 121 124 122 resolHist = new TH1D(obj + "_delta_pt_" + Form("%4.2f", ptmin) + "_" + Form("%4.2f", ptmax), obj + "_delta_pt_" + Form("%4.2f", ptmin) + "_" + Form("%4.2f", ptmax), 1000,xmin, xmax);125 resolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax), obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax), 1000, xmin, xmax); 123 126 } 124 127 … … 131 134 obj = object; 132 135 133 resolHist = new TH1D(obj + "_delta_pt_" + Form("%4.2f", ptmin) + "_" + Form("%4.2f", ptmax) + "_" + Form("%4.2f", etamin) + "_" + Form("%4.2f", etamax), obj + "_delta_pt_" + Form("%4.2f", ptmin) + "_" + Form("%4.2f", ptmax) + "_" + Form("%4.2f", etamin) + "_" + Form("%4.2f", etamax), 1000,xmin, xmax);136 resolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_"+Form("%4.2f",etamin)+"_"+Form("%4.2f",etamax), obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_"+Form("%4.2f",etamin)+"_"+Form("%4.2f",etamax), 1000, xmin, xmax); 134 137 } 138 139 135 140 136 141 void HistogramsCollection(std::vector<resolPlot> *histos, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2) … … 141 146 resolPlot ptemp; 142 147 143 for (int i = 0; i < Nbins; i++)148 for (int i = 0; i < Nbins; i++) 144 149 { 145 150 width = (ptmax - ptmin) / Nbins; 146 ptdown = TMath::Power(10, ptmin + i * width);147 ptup = TMath::Power(10, ptmin + (i + 1) * width);151 ptdown = TMath::Power(10,ptmin + i * width ); 152 ptup = TMath::Power(10,ptmin + (i+1) * width ); 148 153 ptemp.set(ptdown, ptup, obj, xmin, xmax); 149 154 histos->push_back(ptemp); 150 155 } 151 156 } 157 152 158 153 159 void HistogramsCollectionVsEta(std::vector<resolPlot> *histos, double etamin, double etamax, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2) … … 158 164 double etaup; 159 165 160 for (int i = 0; i < Nbins; i++)166 for (int i = 0; i < Nbins; i++) 161 167 { 162 168 width = (etamax - etamin) / Nbins; 163 169 etadown = etamin + i * width; 164 etaup = etamin + (i +1) * width;170 etaup = etamin + (i+1) * width; 165 171 166 172 ptemp.set(etadown, etaup, ptmin, ptmax, obj, xmin, xmax); … … 169 175 } 170 176 177 171 178 //------------------------------------------------------------------------------ 172 179 … … 176 183 //------------------------------------------------------------------------------ 177 184 178 void BinLogX(TH1 185 void BinLogX(TH1*h) 179 186 { 180 187 TAxis *axis = h->GetXaxis(); … … 186 193 Axis_t *new_bins = new Axis_t[bins + 1]; 187 194 188 for (int i = 0; i <= bins; i++)195 for (int i = 0; i <= bins; i++) 189 196 { 190 197 new_bins[i] = TMath::Power(10, from + i * width); … … 194 201 } 195 202 203 196 204 //------------------------------------------------------------------------------ 197 205 198 template 199 TH1D *GetEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)206 template<typename T> 207 TH1D* GetEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 200 208 { 201 209 202 cout << "** Computing Efficiency of reconstructing " 210 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 203 211 204 212 Long64_t allEntries = treeReader->GetEntries(); … … 215 223 Int_t i, j; 216 224 217 TH1D *histGenPt = new TH1D(name + " gen spectra Pt", name +" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));218 TH1D *histRecoPt = new TH1D(name + " reco spectra Pt", name +" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));225 TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 226 TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 219 227 220 228 histGenPt->SetDirectory(0); … … 234 242 { 235 243 236 particle = (GenParticle *)branchParticle->At(i);244 particle = (GenParticle*) branchParticle->At(i); 237 245 genMomentum = particle->P4(); 238 246 239 247 deltaR = 999; 240 248 241 pt = genMomentum.Pt();249 pt = genMomentum.Pt(); 242 250 eta = TMath::Abs(genMomentum.Eta()); 243 251 244 if(eta > etamax || eta < etamin) continue; 245 246 if(particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax) 252 253 if(eta > etamax || eta < etamin ) continue; 254 255 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 247 256 //if (TMath::Abs(particle->PID) == pdgID && (particle->Status>20 && particle->Status <30) && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 248 257 { … … 250 259 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 251 260 { 252 recoObj = (T 261 recoObj = (T*)branchReco->At(j); 253 262 recoMomentum = recoObj->P4(); 254 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 263 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 264 265 255 266 256 267 // take the closest parton candidate … … 258 269 { 259 270 Jet *jet = (Jet *)recoObj; 260 if( !(jet->BTag & (1 << 0))) continue;271 if( !(jet->BTag & (1 << 0)) ) continue; 261 272 262 273 //if(jet->BTag != ) continue; 263 274 } 264 275 265 if(TMath::Abs(pdgID) == 4)276 if(TMath::Abs(pdgID) == 4) 266 277 { 267 278 Jet *jet = (Jet *)recoObj; 268 if( !(jet->BTag & (1 << 0))) continue;279 if( !(jet->BTag & (1 << 0)) ) continue; 269 280 } 270 281 271 282 if(TMath::Abs(pdgID) == 1) 272 283 { 273 284 Jet *jet = (Jet *)recoObj; 274 if(!(jet->BTag & (1 << 0))) continue;285 if( !(jet->BTag & (1 << 0)) ) continue; 275 286 } 276 287 … … 280 291 if(jet->TauTag != 1) continue; 281 292 } 293 282 294 283 295 if(genMomentum.DeltaR(recoMomentum) < deltaR) … … 288 300 } 289 301 histGenPt->Fill(pt); 290 if(deltaR < 0.3 && bestRecoMomentum.Pt() > 0.20 * pt) 291 { 292 histRecoPt->Fill(pt); 293 } 302 if(deltaR < 0.3 && bestRecoMomentum.Pt()> 0.20*pt ) { histRecoPt->Fill(pt);} 303 294 304 } 295 305 } … … 305 315 } 306 316 307 template <typename T> 308 TH1D *GetEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 317 318 template<typename T> 319 TH1D* GetEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 309 320 { 310 321 311 cout << "** Computing Efficiency of reconstructing " 322 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 312 323 313 324 Long64_t allEntries = treeReader->GetEntries(); … … 324 335 Int_t i, j; 325 336 326 TH1D *histGenEta = new TH1D(name + " gen spectra Eta", name +" gen spectra", Nbins, etamin, etamax);327 TH1D *histRecoEta = new TH1D(name + " reco spectra Eta", name +" reco spectra", Nbins, etamin, etamax);337 TH1D *histGenEta = new TH1D(name+" gen spectra Eta",name+" gen spectra", Nbins, etamin, etamax); 338 TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra", Nbins, etamin, etamax); 328 339 329 340 histGenEta->SetDirectory(0); … … 340 351 { 341 352 342 particle = (GenParticle *)branchParticle->At(i);353 particle = (GenParticle*) branchParticle->At(i); 343 354 genMomentum = particle->P4(); 344 355 345 356 deltaR = 999; 346 357 347 pt = genMomentum.Pt();358 pt = genMomentum.Pt(); 348 359 eta = genMomentum.Eta(); 349 360 350 if(pt > ptmax || pt < ptmin ) continue;351 352 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)361 if(pt > ptmax || pt < ptmin ) continue; 362 363 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 353 364 //if (TMath::Abs(particle->PID) == pdgID && (particle->Status>20 && particle->Status <30) && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 354 365 { … … 356 367 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 357 368 { 358 recoObj = (T 369 recoObj = (T*)branchReco->At(j); 359 370 recoMomentum = recoObj->P4(); 360 371 // this is simply to avoid warnings from initial state particle 361 372 // having infite rapidity ... 362 373 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 363 374 364 375 // take the closest parton candidate … … 366 377 { 367 378 Jet *jet = (Jet *)recoObj; 368 if(!(jet->BTag & (1 << 0))) continue; 379 if( !(jet->BTag & (1 << 0)) ) continue; 380 369 381 } 370 382 … … 372 384 { 373 385 Jet *jet = (Jet *)recoObj; 374 if( !(jet->BTag & (1 << 0))) continue;386 if( !(jet->BTag & (1 << 0)) ) continue; 375 387 } 376 388 377 if(TMath::Abs(pdgID) == 1)389 if(TMath::Abs(pdgID) == 1) 378 390 { 379 391 Jet *jet = (Jet *)recoObj; 380 if( !(jet->BTag & (1 << 0))) continue;392 if( !(jet->BTag & (1 << 0)) ) continue; 381 393 } 382 394 … … 394 406 395 407 histGenEta->Fill(eta); 396 if(deltaR < 0.3) 397 { 398 histRecoEta->Fill(eta); 399 } 408 if(deltaR < 0.3) { histRecoEta->Fill(eta); } 409 400 410 } 401 411 } … … 411 421 } 412 422 423 413 424 //------------------------------------------------------------------------------ 414 425 415 template 416 TH1D *GetJetEffPt(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)426 template<typename T> 427 TH1D* GetJetEffPt(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 417 428 { 418 429 419 cout << "** Computing Efficiency of reconstructing " 430 cout << "** Computing Efficiency of reconstructing "<< branchJet->GetName() << " with PID " << pdgID << endl; 420 431 421 432 Long64_t allEntries = treeReader->GetEntries(); … … 430 441 Int_t j; 431 442 432 TH1D *histGenPt = new TH1D(name + " gen spectra Pt", name +" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));433 TH1D *histRecoPt = new TH1D(name + " reco spectra Pt", name +" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));443 TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 444 TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 434 445 435 446 histGenPt->SetDirectory(0); … … 448 459 for(j = 0; j < branchJet->GetEntriesFast(); ++j) 449 460 { 450 recoObj = (T 461 recoObj = (T*)branchJet->At(j); 451 462 recoMomentum = recoObj->P4(); 452 pt = recoMomentum.Pt();463 pt = recoMomentum.Pt(); 453 464 eta = TMath::Abs(recoMomentum.Eta()); 454 465 Jet *jet = (Jet *)recoObj; 455 456 if(eta > etamax || eta < etamin ) continue;466 467 if(eta > etamax || eta < etamin ) continue; 457 468 if(pt < ptmin || pt > ptmax) continue; 458 469 459 470 Int_t flavor = jet->Flavor; 460 471 if(flavor == 21) flavor = 0; 461 472 462 473 if(TMath::Abs(pdgID) == 1) 463 474 { 464 475 465 476 if(flavor < 4) 466 477 { 467 478 histGenPt->Fill(pt); 468 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);479 if( jet->BTag & (1 << 0) ) histRecoPt->Fill(pt); 469 480 } 470 481 } … … 474 485 { 475 486 histGenPt->Fill(pt); 476 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);487 if( jet->BTag & (1 << 0) ) histRecoPt->Fill(pt); 477 488 } 478 489 } … … 482 493 { 483 494 histGenPt->Fill(pt); 484 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);495 if( jet->BTag & (1 << 0) ) histRecoPt->Fill(pt); 485 496 } 486 497 } 487 } 498 } 499 488 500 } 489 501 … … 499 511 // ------------------------------------------------------------------------------------------------------------------------------------------------------ 500 512 501 template 502 TH1D *GetJetEffEta(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)513 template<typename T> 514 TH1D* GetJetEffEta(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 503 515 { 504 516 505 cout << "** Computing Efficiency of reconstructing " 517 cout << "** Computing Efficiency of reconstructing "<< branchJet->GetName() << " with PID " << pdgID << endl; 506 518 507 519 Long64_t allEntries = treeReader->GetEntries(); … … 516 528 Int_t j; 517 529 518 TH1D *histGenEta = new TH1D(name + " gen spectra Eta", name +" gen spectra", Nbins, etamin, etamax);519 TH1D *histRecoEta = new TH1D(name + " reco spectra Eta", name +" reco spectra", Nbins, etamin, etamax);530 TH1D *histGenEta = new TH1D(name+" gen spectra Eta",name+" gen spectra", Nbins, etamin, etamax); 531 TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra", Nbins, etamin, etamax); 520 532 521 533 histGenEta->SetDirectory(0); … … 530 542 for(j = 0; j < branchJet->GetEntriesFast(); ++j) 531 543 { 532 recoObj = (T 544 recoObj = (T*)branchJet->At(j); 533 545 recoMomentum = recoObj->P4(); 534 pt = recoMomentum.Pt();546 pt = recoMomentum.Pt(); 535 547 eta = recoMomentum.Eta(); 536 548 Jet *jet = (Jet *)recoObj; 537 538 if(eta > etamax || eta < etamin ) continue;549 550 if(eta > etamax || eta < etamin ) continue; 539 551 if(pt < ptmin || pt > ptmax) continue; 540 552 541 553 Int_t flavor = jet->Flavor; 542 554 if(flavor == 21) flavor = 0; 543 555 544 556 if(TMath::Abs(pdgID) == 1) 545 557 { 546 if(flavor == 1 || flavor == 21)558 if(flavor == 1 || flavor == 21) 547 559 { 548 560 histGenEta->Fill(eta); 549 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);561 if( jet->BTag & (1 << 0) ) histRecoEta->Fill(eta); 550 562 } 551 563 } … … 555 567 { 556 568 histGenEta->Fill(eta); 557 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);569 if( jet->BTag & (1 << 0) ) histRecoEta->Fill(eta); 558 570 } 559 571 } … … 563 575 { 564 576 histGenEta->Fill(eta); 565 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);577 if( jet->BTag & (1 << 0) ) histRecoEta->Fill(eta); 566 578 } 567 579 } 568 } 569 } 580 } 581 582 } 583 570 584 571 585 histRecoEta->Sumw2(); … … 578 592 } 579 593 594 580 595 // ----------------------------------------------------------------------------------------------------------------------------------------------------- 581 596 582 template 583 TH1D *GetTauEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)597 template<typename T> 598 TH1D* GetTauEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 584 599 { 585 600 586 cout << "** Computing Efficiency of reconstructing " 601 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 587 602 588 603 Long64_t allEntries = treeReader->GetEntries(); … … 599 614 Int_t i, j; 600 615 601 TH1D *histGenPt = new TH1D(name + " gen spectra Pt", name +" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));602 TH1D *histRecoPt = new TH1D(name + " reco spectra Pt", name +" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax));616 TH1D *histGenPt = new TH1D(name+" gen spectra Pt",name+" gen spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 617 TH1D *histRecoPt = new TH1D(name+" reco spectra Pt",name+" reco spectra cen", Nbins, TMath::Log10(ptmin), TMath::Log10(ptmax)); 603 618 604 619 histGenPt->SetDirectory(0); … … 618 633 { 619 634 620 particle = (GenParticle *)branchParticle->At(i);635 particle = (GenParticle*) branchParticle->At(i); 621 636 genMomentum = particle->P4(); 622 637 623 638 deltaR = 999; 624 639 625 pt = genMomentum.Pt();640 pt = genMomentum.Pt(); 626 641 eta = TMath::Abs(genMomentum.Eta()); 627 642 628 if(eta > etamax || eta < etamin ) continue;629 630 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)643 if(eta > etamax || eta < etamin ) continue; 644 645 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 631 646 { 632 647 // Loop over all reco object in event 633 648 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 634 649 { 635 recoObj = (T 650 recoObj = (T*)branchReco->At(j); 636 651 recoMomentum = recoObj->P4(); 637 652 // this is simply to avoid warnings from initial state particle … … 642 657 { 643 658 Jet *jet = (Jet *)recoObj; 644 if( jet->TauTag != 1) continue;659 if( jet->TauTag != 1 ) continue; 645 660 } 646 661 … … 659 674 660 675 histGenPt->Fill(pt); 661 if(deltaR < 0.3) 662 { 663 histRecoPt->Fill(pt); 664 } 676 if(deltaR < 0.3) { histRecoPt->Fill(pt); } 677 665 678 } 666 679 } … … 670 683 histGenPt->Sumw2(); 671 684 685 672 686 histRecoPt->Divide(histGenPt); 673 687 histRecoPt->Scale(100.); 674 if(TMath::Abs(pdgID) == 15) histRecoPt->Scale(1 /0.648);688 if(TMath::Abs(pdgID) == 15) histRecoPt->Scale(1/0.648); 675 689 676 690 return histRecoPt; 677 691 } 678 692 679 template 680 TH1D *GetTauEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)693 template<typename T> 694 TH1D* GetTauEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 681 695 { 682 696 683 cout << "** Computing Efficiency of reconstructing " 697 cout << "** Computing Efficiency of reconstructing "<< branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 684 698 685 699 Long64_t allEntries = treeReader->GetEntries(); … … 696 710 Int_t i, j; 697 711 698 TH1D *histGenEta = new TH1D(name + " gen spectra Eta", name +" gen spectra", Nbins, etamin, etamax);699 TH1D *histRecoEta = new TH1D(name + " reco spectra Eta", name +" reco spectra", Nbins, etamin, etamax);712 TH1D *histGenEta = new TH1D(name+" gen spectra Eta",name+" gen spectra", Nbins, etamin, etamax); 713 TH1D *histRecoEta = new TH1D(name+" reco spectra Eta",name+" reco spectra", Nbins, etamin, etamax); 700 714 701 715 histGenEta->SetDirectory(0); … … 712 726 { 713 727 714 particle = (GenParticle *)branchParticle->At(i);728 particle = (GenParticle*) branchParticle->At(i); 715 729 genMomentum = particle->P4(); 716 730 717 731 deltaR = 999; 718 732 719 pt = genMomentum.Pt();733 pt = genMomentum.Pt(); 720 734 eta = genMomentum.Eta(); 721 735 722 if(pt > ptmax || pt < ptmin ) continue;723 724 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)736 if(pt > ptmax || pt < ptmin ) continue; 737 738 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 725 739 { 726 740 // Loop over all reco object in event 727 741 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 728 742 { 729 recoObj = (T 743 recoObj = (T*)branchReco->At(j); 730 744 recoMomentum = recoObj->P4(); 731 745 // this is simply to avoid warnings from initial state particle 732 746 // having infite rapidity ... 733 734 735 747 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 748 749 if(TMath::Abs(pdgID) == 1) 736 750 { 737 751 Jet *jet = (Jet *)recoObj; 738 if( jet->TauTag != 1) continue;752 if( jet->TauTag != 1 ) continue; 739 753 } 740 754 … … 753 767 754 768 histGenEta->Fill(eta); 755 if(deltaR < 0.3) 756 { 757 histRecoEta->Fill(eta); 758 } 769 if(deltaR < 0.3) { histRecoEta->Fill(eta); } 770 759 771 } 760 772 } … … 766 778 histRecoEta->Divide(histGenEta); 767 779 histRecoEta->Scale(100.); 768 if(TMath::Abs(pdgID) == 15) histRecoEta->Scale(1 /0.648);780 if(TMath::Abs(pdgID) == 15) histRecoEta->Scale(1/0.648); 769 781 770 782 return histRecoEta; 771 783 } 772 784 773 template <typename T> 785 786 template<typename T> 774 787 void GetPtres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader) 775 788 { … … 779 792 780 793 GenParticle *particle; 781 T *recoObj;794 T* recoObj; 782 795 783 796 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 798 811 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 799 812 { 800 recoObj = (T *)branchReco->At(i);813 recoObj = (T*) branchReco->At(i); 801 814 recoMomentum = recoObj->P4(); 802 815 803 816 deltaR = 999; 804 817 805 806 807 808 particle = (GenParticle *)branchParticle->At(j);809 if (particle->PID == pdgID && particle->Status == 1)818 // Loop over all hard partons in event 819 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 820 { 821 particle = (GenParticle*) branchParticle->At(j); 822 if (particle->PID == pdgID && particle->Status == 1) 810 823 { 811 824 genMomentum = particle->P4(); … … 818 831 if(genMomentum.DeltaR(recoMomentum) < deltaR) 819 832 { 820 deltaR = genMomentum.DeltaR(recoMomentum);821 bestGenMomentum = genMomentum;833 deltaR = genMomentum.DeltaR(recoMomentum); 834 bestGenMomentum = genMomentum; 822 835 } 823 836 } … … 826 839 if(deltaR < 0.3) 827 840 { 828 pt = bestGenMomentum.Pt();841 pt = bestGenMomentum.Pt(); 829 842 eta = TMath::Abs(bestGenMomentum.Eta()); 830 843 831 for (bin = 0; bin < Nbins; bin++)844 for (bin = 0; bin < Nbins; bin++) 832 845 { 833 846 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > etaMin && eta < etaMax) 834 847 { 835 histos->at(bin).resolHist->Fill(recoMomentum.Pt() /bestGenMomentum.Pt());848 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt()); 836 849 } 837 850 } … … 841 854 } 842 855 843 template <typename T> 856 857 template<typename T> 844 858 void GetEres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader) 845 859 { … … 849 863 850 864 GenParticle *particle; 851 T *recoObj;865 T* recoObj; 852 866 853 867 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 865 879 treeReader->ReadEntry(entry); 866 880 867 // Loop over all reconstructed jets in event881 // Loop over all reconstructed jets in event 868 882 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 869 883 { 870 recoObj = (T *)branchReco->At(i);884 recoObj = (T*) branchReco->At(i); 871 885 recoMomentum = recoObj->P4(); 872 886 873 887 deltaR = 999; 874 888 875 876 877 878 particle = (GenParticle *)branchParticle->At(j);879 if (particle->PID == pdgID && particle->Status == 1)889 // Loop over all hard partons in event 890 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 891 { 892 particle = (GenParticle*) branchParticle->At(j); 893 if (particle->PID == pdgID && particle->Status == 1) 880 894 { 881 895 genMomentum = particle->P4(); … … 888 902 if(genMomentum.DeltaR(recoMomentum) < deltaR) 889 903 { 890 deltaR = genMomentum.DeltaR(recoMomentum);891 bestGenMomentum = genMomentum;904 deltaR = genMomentum.DeltaR(recoMomentum); 905 bestGenMomentum = genMomentum; 892 906 } 893 907 } … … 896 910 if(deltaR < 0.3) 897 911 { 898 e = bestGenMomentum.E();912 e = bestGenMomentum.E(); 899 913 eta = TMath::Abs(bestGenMomentum.Eta()); 900 914 901 for (bin = 0; bin < Nbins; bin++)915 for (bin = 0; bin < Nbins; bin++) 902 916 { 903 917 if(e > histos->at(bin).ptmin && e < histos->at(bin).ptmax && eta > etaMin && eta < etaMax) 904 918 { 905 histos->at(bin).resolHist->Fill(recoMomentum.E() /bestGenMomentum.E());919 histos->at(bin).resolHist->Fill(recoMomentum.E()/bestGenMomentum.E()); 906 920 } 907 921 } … … 911 925 } 912 926 913 template <typename T> 927 928 template<typename T> 914 929 void GetPtresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t ptMin, Double_t ptMax, ExRootTreeReader *treeReader) 915 930 { … … 919 934 920 935 GenParticle *particle; 921 T *recoObj;936 T* recoObj; 922 937 923 938 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 938 953 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 939 954 { 940 recoObj = (T *)branchReco->At(i);955 recoObj = (T*) branchReco->At(i); 941 956 recoMomentum = recoObj->P4(); 942 957 943 958 deltaR = 999; 944 959 945 946 947 948 particle = (GenParticle *)branchParticle->At(j);949 if (particle->PID == pdgID && particle->Status == 1)960 // Loop over all hard partons in event 961 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 962 { 963 particle = (GenParticle*) branchParticle->At(j); 964 if (particle->PID == pdgID && particle->Status == 1) 950 965 { 951 966 genMomentum = particle->P4(); … … 958 973 if(genMomentum.DeltaR(recoMomentum) < deltaR) 959 974 { 960 deltaR = genMomentum.DeltaR(recoMomentum);961 bestGenMomentum = genMomentum;975 deltaR = genMomentum.DeltaR(recoMomentum); 976 bestGenMomentum = genMomentum; 962 977 } 963 978 } … … 966 981 if(deltaR < 0.3) 967 982 { 968 pt = bestGenMomentum.Pt();983 pt = bestGenMomentum.Pt(); 969 984 eta = bestGenMomentum.Eta(); 970 985 971 for (bin = 0; bin < Nbins; bin++)986 for (bin = 0; bin < Nbins; bin++) 972 987 { 973 988 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt > ptMin && pt < ptMax) 974 989 { 975 histos->at(bin).resolHist->Fill(recoMomentum.Pt() /bestGenMomentum.Pt());990 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt()); 976 991 } 977 992 } … … 981 996 } 982 997 983 template 998 template<typename T> 984 999 void GetEresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t eMin, Double_t eMax, ExRootTreeReader *treeReader) 985 1000 { … … 989 1004 990 1005 GenParticle *particle; 991 T *recoObj;1006 T* recoObj; 992 1007 993 1008 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 1008 1023 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 1009 1024 { 1010 recoObj = (T *)branchReco->At(i);1025 recoObj = (T*) branchReco->At(i); 1011 1026 recoMomentum = recoObj->P4(); 1012 1027 1013 1028 deltaR = 999; 1014 1029 1015 1016 1017 1018 particle = (GenParticle *)branchParticle->At(j);1019 if (particle->PID == pdgID && particle->Status == 1)1030 // Loop over all hard partons in event 1031 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 1032 { 1033 particle = (GenParticle*) branchParticle->At(j); 1034 if (particle->PID == pdgID && particle->Status == 1) 1020 1035 { 1021 1036 genMomentum = particle->P4(); … … 1028 1043 if(genMomentum.DeltaR(recoMomentum) < deltaR) 1029 1044 { 1030 deltaR = genMomentum.DeltaR(recoMomentum);1031 bestGenMomentum = genMomentum;1045 deltaR = genMomentum.DeltaR(recoMomentum); 1046 bestGenMomentum = genMomentum; 1032 1047 } 1033 1048 } … … 1036 1051 if(deltaR < 0.3) 1037 1052 { 1038 e = bestGenMomentum.E();1053 e = bestGenMomentum.E(); 1039 1054 eta = bestGenMomentum.Eta(); 1040 1055 1041 for(bin = 0; bin < Nbins; bin++) 1056 1057 1058 for (bin = 0; bin < Nbins; bin++) 1042 1059 { 1043 1060 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && e > eMin && e < eMax) 1044 1061 { 1045 histos->at(bin).resolHist->Fill(recoMomentum.E() /bestGenMomentum.E());1062 histos->at(bin).resolHist->Fill(recoMomentum.E()/bestGenMomentum.E()); 1046 1063 } 1047 1064 } … … 1051 1068 } 1052 1069 1070 1071 1053 1072 void GetJetsEres(std::vector<resolPlot> *histos, TClonesArray *branchJet, TClonesArray *branchGenJet, ExRootTreeReader *treeReader, Double_t etaMin, Double_t etaMax) 1054 1073 { … … 1074 1093 treeReader->ReadEntry(entry); 1075 1094 1076 if(entry % 10000 == 0) cout << "Event number: " << entry <<endl;1095 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl; 1077 1096 1078 1097 // Loop over all reconstructed jets in event 1079 for(i = 0; i < TMath::Min(2, 1098 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i) 1080 1099 { 1081 1100 1082 jet = (Jet *)branchJet->At(i);1101 jet = (Jet*) branchJet->At(i); 1083 1102 jetMomentum = jet->P4(); 1084 1103 1085 1104 deltaR = 999; 1086 1105 1087 1088 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)1089 1090 genjet = (Jet *)branchGenJet->At(j);1106 // Loop over all hard partons in event 1107 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j) 1108 { 1109 genjet = (Jet*) branchGenJet->At(j); 1091 1110 1092 1111 genJetMomentum = genjet->P4(); … … 1099 1118 if(genJetMomentum.DeltaR(jetMomentum) < deltaR) 1100 1119 { 1101 deltaR = genJetMomentum.DeltaR(jetMomentum);1102 bestGenJetMomentum = genJetMomentum;1120 deltaR = genJetMomentum.DeltaR(jetMomentum); 1121 bestGenJetMomentum = genJetMomentum; 1103 1122 } 1104 1123 } … … 1106 1125 if(deltaR < 0.3) 1107 1126 { 1108 pt = genJetMomentum.E();1127 pt = genJetMomentum.E(); 1109 1128 eta = genJetMomentum.Eta(); 1110 1129 1111 for (bin = 0; bin < Nbins; bin++)1130 for (bin = 0; bin < Nbins; bin++) 1112 1131 { 1113 1132 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < etaMax && eta > etaMin) 1114 1133 { 1115 histos->at(bin).resolHist->Fill(jetMomentum.E() /bestGenJetMomentum.E());1134 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E()); 1116 1135 } 1117 1136 } … … 1144 1163 treeReader->ReadEntry(entry); 1145 1164 1146 if(entry % 10000 == 0) cout << "Event number: " << entry <<endl;1165 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl; 1147 1166 1148 1167 // Loop over all reconstructed jets in event 1149 for(i = 0; i < TMath::Min(2, 1168 for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i) 1150 1169 { 1151 1170 1152 jet = (Jet *)branchJet->At(i);1171 jet = (Jet*) branchJet->At(i); 1153 1172 jetMomentum = jet->P4(); 1154 1173 1155 1174 deltaR = 999; 1156 1175 1157 1158 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)1159 1160 genjet = (Jet *)branchGenJet->At(j);1176 // Loop over all hard partons in event 1177 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j) 1178 { 1179 genjet = (Jet*) branchGenJet->At(j); 1161 1180 1162 1181 genJetMomentum = genjet->P4(); … … 1169 1188 if(genJetMomentum.DeltaR(jetMomentum) < deltaR) 1170 1189 { 1171 deltaR = genJetMomentum.DeltaR(jetMomentum);1172 bestGenJetMomentum = genJetMomentum;1190 deltaR = genJetMomentum.DeltaR(jetMomentum); 1191 bestGenJetMomentum = genJetMomentum; 1173 1192 } 1174 1193 } … … 1177 1196 { 1178 1197 1179 pt = genJetMomentum.E();1198 pt = genJetMomentum.E(); 1180 1199 eta = genJetMomentum.Eta(); 1181 1200 1182 for (bin = 0; bin < Nbins; bin++)1201 for (bin = 0; bin < Nbins; bin++) 1183 1202 { 1184 1203 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt < eMax && pt > eMin) 1185 1204 { 1186 histos->at(bin).resolHist->Fill(jetMomentum.E() /bestGenJetMomentum.E());1205 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E()); 1187 1206 } 1188 1207 } … … 1192 1211 } 1193 1212 1194 std::pair<Double_t, Double_t> GausFit(TH1 *hist) 1213 1214 1215 std::pair<Double_t, Double_t> GausFit(TH1* hist) 1195 1216 { 1196 TF1 *f1 = new TF1("f1", "gaus", hist->GetMean() - 2 * hist->GetRMS(), hist->GetMean() + 2 *hist->GetRMS());1197 hist->Fit("f1", 1198 1199 TF1 *f2 = new TF1("f2", "gaus", f1->GetParameter(1) - 2 * f1->GetParameter(2), f1->GetParameter(1) + 2 *f1->GetParameter(2));1200 hist->Fit("f2", 1217 TF1 *f1 = new TF1("f1", "gaus", hist->GetMean()-2*hist->GetRMS(), hist->GetMean()+2*hist->GetRMS()); 1218 hist->Fit("f1","RQ"); 1219 1220 TF1 *f2 = new TF1("f2", "gaus", f1->GetParameter(1) - 2*f1->GetParameter(2), f1->GetParameter(1) + 2*f1->GetParameter(2)); 1221 hist->Fit("f2","RQ"); 1201 1222 1202 1223 Double_t sig = f2->GetParameter(2); … … 1205 1226 delete f1; 1206 1227 delete f2; 1207 return make_pair (sig, sigErr);1228 return make_pair (sig, sigErr); 1208 1229 } 1230 1209 1231 1210 1232 TGraphErrors EresGraph(std::vector<resolPlot> *histos, bool rms = false) … … 1212 1234 Int_t bin; 1213 1235 Int_t count = 0; 1214 TGraphErrors gr = TGraphErrors(Nbins /2);1236 TGraphErrors gr = TGraphErrors(Nbins/2); 1215 1237 double val, error; 1216 for (bin = 0; bin < Nbins; bin++)1217 { 1218 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);1219 if(rms == true)1220 {1221 gr.SetPoint(count, (histos->at(bin).ptmin + histos->at(bin).ptmax) / 2.0, 100 *histos->at(bin).resolHist->GetRMS());1222 //gr.SetPointError(count,0, 100*sigvalues.second); // to correct1223 error = 100 *histos->at(bin).resolHist->GetRMSError();1224 val = 100 *histos->at(bin).resolHist->GetRMS();1225 if(error > 0.2 * val) error = 0.2 *val;1226 gr.SetPointError(count,0, error); // to correct1227 }1228 else1229 {1230 1231 gr.SetPoint(count, (histos->at(bin).ptmin + histos->at(bin).ptmax) / 2.0, 100 *sigvalues.first);1232 error = 100 *sigvalues.second;1233 val = 100 *sigvalues.first;1234 if(error > 0.2 * val) error = 0.2 *val;1235 gr.SetPointError(count,0, error); // to correct1236 //gr.SetPointError(count,0, 100*sigvalues.second);1237 }1238 count++;1238 for (bin = 0; bin < Nbins; bin++) 1239 { 1240 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist); 1241 if (rms == true) 1242 { 1243 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, 100*histos->at(bin).resolHist->GetRMS()); 1244 //gr.SetPointError(count,0, 100*sigvalues.second); // to correct 1245 error = 100*histos->at(bin).resolHist->GetRMSError(); 1246 val = 100*histos->at(bin).resolHist->GetRMS(); 1247 if(error > 0.2*val) error = 0.2*val; 1248 gr.SetPointError(count,0, error); // to correct 1249 } 1250 else 1251 { 1252 1253 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, 100*sigvalues.first); 1254 error = 100*sigvalues.second; 1255 val = 100*sigvalues.first; 1256 if(error > 0.2*val) error = 0.2*val; 1257 gr.SetPointError(count,0, error); // to correct 1258 //gr.SetPointError(count,0, 100*sigvalues.second); 1259 } 1260 count++; 1239 1261 } 1240 1262 … … 1246 1268 Int_t bin; 1247 1269 Int_t count = 0; 1248 TGraphErrors gr = TGraphErrors(Nbins /2);1270 TGraphErrors gr = TGraphErrors(Nbins/2); 1249 1271 double val, error; 1250 for (bin = 0; bin < Nbins; bin++)1251 { 1252 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);1253 if(rms == true)1254 {1255 gr.SetPoint(count, (histos->at(bin).ptmin + histos->at(bin).ptmax) /2.0, histos->at(bin).resolHist->GetRMS());1256 error = histos->at(bin).resolHist->GetRMSError();1257 val = histos->at(bin).resolHist->GetRMS();1258 if(error > 0.2 * val) error = 0.2 *val;1259 gr.SetPointError(count,0, error); // to correct1260 }1261 else1262 {1263 1264 gr.SetPoint(count, (histos->at(bin).ptmin + histos->at(bin).ptmax) /2.0, sigvalues.first);1265 val = sigvalues.first;1266 error = sigvalues.second;1267 if(error > 0.2 * val) error = 0.2 *val;1268 gr.SetPointError(count,0, error);1269 //gr.SetPointError(count,0, 100*sigvalues.second);1270 }1271 count++;1272 for (bin = 0; bin < Nbins; bin++) 1273 { 1274 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist); 1275 if (rms == true) 1276 { 1277 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, histos->at(bin).resolHist->GetRMS()); 1278 error = histos->at(bin).resolHist->GetRMSError(); 1279 val = histos->at(bin).resolHist->GetRMS(); 1280 if(error > 0.2*val) error = 0.2*val; 1281 gr.SetPointError(count,0, error); // to correct 1282 } 1283 else 1284 { 1285 1286 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first); 1287 val = sigvalues.first; 1288 error = sigvalues.second; 1289 if(error > 0.2*val) error = 0.2*val; 1290 gr.SetPointError(count,0, error); 1291 //gr.SetPointError(count,0, 100*sigvalues.second); 1292 } 1293 count++; 1272 1294 } 1273 1295 1274 1296 return gr; 1275 1297 } 1298 1299 1276 1300 1277 1301 TGraphErrors EresGraphVsEta(std::vector<resolPlot> *histos, bool rms = false) … … 1279 1303 Int_t bin; 1280 1304 Int_t count = 0; 1281 TGraphErrors gr = TGraphErrors(Nbins /2);1305 TGraphErrors gr = TGraphErrors(Nbins/2); 1282 1306 double val, error; 1283 for (bin = 0; bin < Nbins; bin++)1284 { 1285 1286 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist);1287 if(rms == true)1288 {1289 gr.SetPoint(count, (histos->at(bin).etamin + histos->at(bin).etamax) /2.0, histos->at(bin).resolHist->GetRMS());1290 error = 100 *histos->at(bin).resolHist->GetRMSError();1291 val = 100 *histos->at(bin).resolHist->GetRMS();1292 if(error > 0.2 * val) error = 0.2 *val;1293 gr.SetPointError(count,0, error); // to correct1294 }1295 else1296 {1297 gr.SetPoint(count, (histos->at(bin).etamin + histos->at(bin).etamax) / 2.0, 100 *sigvalues.first);1298 val = 100 *sigvalues.first;1299 error = 100 *sigvalues.second;1300 if(error > 0.2 * val) error = 0.2 *val;1301 gr.SetPointError(count,0, error);1302 //gr.SetPointError(count,0, 100*sigvalues.second);1303 }1304 count++;1307 for (bin = 0; bin < Nbins; bin++) 1308 { 1309 1310 std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).resolHist); 1311 if (rms == true) 1312 { 1313 gr.SetPoint(count,(histos->at(bin).etamin+histos->at(bin).etamax)/2.0, histos->at(bin).resolHist->GetRMS()); 1314 error = 100*histos->at(bin).resolHist->GetRMSError(); 1315 val = 100*histos->at(bin).resolHist->GetRMS(); 1316 if(error > 0.2*val) error = 0.2*val; 1317 gr.SetPointError(count,0, error); // to correct 1318 } 1319 else 1320 { 1321 gr.SetPoint(count,(histos->at(bin).etamin+histos->at(bin).etamax)/2.0, 100*sigvalues.first); 1322 val = 100*sigvalues.first; 1323 error = 100*sigvalues.second; 1324 if(error > 0.2*val) error = 0.2*val; 1325 gr.SetPointError(count,0, error); 1326 //gr.SetPointError(count,0, 100*sigvalues.second); 1327 } 1328 count++; 1305 1329 } 1306 1330 … … 1332 1356 treeReader->ReadEntry(entry); 1333 1357 1334 if(entry % 10000 == 0) cout << "Event number: " << entry <<endl;1335 1336 if (branchJet->GetEntriesFast() > 1)1358 if(entry%10000 == 0) cout << "Event number: "<< entry <<endl; 1359 1360 if (branchJet->GetEntriesFast() > 1) 1337 1361 { 1338 1362 1339 jet = (Jet *)branchJet->At(0);1363 jet = (Jet*) branchJet->At(0); 1340 1364 p1 = jet->P4(); 1341 jet = (Jet *)branchJet->At(1);1365 jet = (Jet*) branchJet->At(1); 1342 1366 p2 = jet->P4(); 1343 1367 1344 met = (MissingET *)branchMet->At(0);1345 scalarHT = (ScalarHT *)branchScalarHT->At(0);1368 met = (MissingET*) branchMet->At(0); 1369 scalarHT = (ScalarHT*) branchScalarHT->At(0); 1346 1370 ht = scalarHT->HT; 1347 1371 1348 if(p1.Pt() < 0.75 * ht /2) continue;1349 if(p2.Pt() < 0.75 * ht /2) continue;1350 1351 for (bin = 0; bin < Nbins; bin++)1372 if(p1.Pt() < 0.75*ht/2) continue; 1373 if(p2.Pt() < 0.75*ht/2) continue; 1374 1375 for (bin = 0; bin < Nbins; bin++) 1352 1376 { 1353 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax )1377 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax ) 1354 1378 { 1355 1379 histos->at(bin).resolHist->Fill(met->P4().Px()); … … 1360 1384 } 1361 1385 1386 1387 1362 1388 //------------------------------------------------------------------------------ 1389 1363 1390 1364 1391 void addResoGraph(TMultiGraph *mg, TGraphErrors *gr, TLegend *leg, int style, Color_t color, TString text) … … 1373 1400 std::cout << "Adding " << gr->GetName() << std::endl; 1374 1401 mg->Add(gr); 1375 leg->AddEntry(gr, text, "p"); 1402 leg->AddEntry(gr,text,"p"); 1403 1376 1404 } 1405 1377 1406 1378 1407 void DrawAxis(TMultiGraph *mg, TLegend *leg, double xmin, double xmax, double ymin, double ymax, TString tx, TString ty, bool logx = 0, bool logy = 0) … … 1380 1409 mg->SetMinimum(ymin); 1381 1410 mg->SetMaximum(ymax); 1382 mg->GetXaxis()->SetLimits(xmin, 1411 mg->GetXaxis()->SetLimits(xmin,xmax); 1383 1412 1384 1413 mg->GetXaxis()->SetTitle(tx); … … 1411 1440 if(logy) gPad->SetLogy(); 1412 1441 1442 1413 1443 //gPad->SetGridx(); 1414 1444 //gPad->SetGridy(); … … 1417 1447 gPad->Modified(); 1418 1448 gPad->Update(); 1449 1419 1450 } 1451 1420 1452 1421 1453 void DelphesValidation( … … 1513 1545 colors.push_back(kBlue); 1514 1546 colors.push_back(kRed); 1515 colors.push_back(kGreen +1);1516 colors.push_back(kMagenta +1);1547 colors.push_back(kGreen+1); 1548 colors.push_back(kMagenta+1); 1517 1549 colors.push_back(kOrange); 1518 1550 … … 1534 1566 Int_t lastSlash = figPath.Last('/'); 1535 1567 Int_t sizePath = figPath.Length(); 1536 figPath.Remove(lastSlash + 1,sizePath);1568 figPath.Remove(lastSlash+1,sizePath); 1537 1569 1538 1570 TString header = pdfOutput; … … 1541 1573 lastSlash = header.Last('/'); 1542 1574 sizePath = header.Length(); 1543 header.Remove(0, lastSlash +1);1575 header.Remove(0,lastSlash+1); 1544 1576 1545 1577 TString vrs(version); 1546 1578 1547 TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94, 1579 TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94,"NDC"); 1548 1580 pave->SetTextAlign(30); 1549 1581 pave->SetTextFont(132); … … 1552 1584 pave->SetFillColor(0); 1553 1585 pave->SetFillStyle(0); 1554 pave->AddText("Delphes " + vrs + " - " +header);1586 pave->AddText("Delphes "+vrs+" - "+header); 1555 1587 1556 1588 TString s_etaMin, s_etaMax, s_eta, s_pt, s_e; … … 1578 1610 etaVals.push_back(6.0); 1579 1611 1580 const int n_etabins = etaVals.size() -1;1612 const int n_etabins = etaVals.size()-1; 1581 1613 const int n_ptbins = ptVals.size(); 1582 1614 … … 1587 1619 // --------- Pion Tracks --------- // 1588 1620 1589 TMultiGraph *mg_trkpi_res_pt = new TMultiGraph("","");1590 TMultiGraph *mg_trkpi_eff_pt = new TMultiGraph("","");1591 TMultiGraph *mg_trkpi_res_eta = new TMultiGraph("", 1592 TMultiGraph *mg_trkpi_eff_eta = new TMultiGraph("", 1593 1594 TLegend *leg_trkpi_res_pt = new TLegend(0.55, 0.22, 0.90,0.48);1595 TLegend *leg_trkpi_eff_pt = (TLegend 1596 TLegend *leg_trkpi_res_eta = (TLegend 1597 TLegend *leg_trkpi_eff_eta = (TLegend 1598 1599 TGraphErrors *gr_trkpi_res_pt = new TGraphErrors[n_etabins];1600 TGraphErrors *gr_trkpi_eff_pt = new TGraphErrors[n_etabins];1621 TMultiGraph *mg_trkpi_res_pt = new TMultiGraph("",""); 1622 TMultiGraph *mg_trkpi_eff_pt = new TMultiGraph("",""); 1623 TMultiGraph *mg_trkpi_res_eta = new TMultiGraph("",""); 1624 TMultiGraph *mg_trkpi_eff_eta = new TMultiGraph("",""); 1625 1626 TLegend *leg_trkpi_res_pt = new TLegend(0.55,0.22,0.90,0.48); 1627 TLegend *leg_trkpi_eff_pt = (TLegend*)leg_trkpi_res_pt->Clone(); 1628 TLegend *leg_trkpi_res_eta = (TLegend*)leg_trkpi_res_pt->Clone(); 1629 TLegend *leg_trkpi_eff_eta = (TLegend*)leg_trkpi_res_eta->Clone(); 1630 1631 TGraphErrors *gr_trkpi_res_pt = new TGraphErrors[n_etabins]; 1632 TGraphErrors *gr_trkpi_eff_pt = new TGraphErrors[n_etabins]; 1601 1633 TGraphErrors *gr_trkpi_res_eta = new TGraphErrors[n_ptbins]; 1602 1634 TGraphErrors *gr_trkpi_eff_eta = new TGraphErrors[n_ptbins]; 1603 TH1D *h_trkpi_eff_pt, *h_trkpi_eff_eta;1604 1605 std::vector<resolPlot> *plots_trkpi_res_pt = new std::vector<resolPlot>[n_etabins];1606 std::vector<resolPlot> *plots_trkpi_res_eta = new std::vector<resolPlot>[n_ptbins];1635 TH1D* h_trkpi_eff_pt, *h_trkpi_eff_eta; 1636 1637 std::vector<resolPlot> *plots_trkpi_res_pt = new std::vector<resolPlot>[n_etabins]; 1638 std::vector<resolPlot> *plots_trkpi_res_eta = new std::vector<resolPlot>[n_ptbins]; 1607 1639 1608 1640 // loop over eta bins 1609 for (k = 0; k < etaVals.size() -1; k++)1610 { 1611 HistogramsCollection(&plots_trkpi_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi");1612 GetPtres<Track>(&plots_trkpi_res_pt[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k +1), treeReaderPion);1613 gr_trkpi_res_pt[k] = EresGraph(&plots_trkpi_res_pt[k]);1614 1615 h_trkpi_eff_pt = GetEffPt<Track>(branchTrackPion, branchParticlePion, "Pion", 211, ptMin, ptMax, etaVals.at(k), etaVals.at(k +1), treeReaderPion);1616 gr_trkpi_eff_pt[k] = TGraphErrors(h_trkpi_eff_pt);1617 1618 s_etaMin = Form("%.1f",etaVals.at(k));1619 s_etaMax = Form("%.1f", etaVals.at(k +1));1620 1621 s_eta = "#pi^{ #pm} , " + s_etaMin + " < | #eta | < " +s_etaMax;1622 1623 gr_trkpi_res_pt[k].SetName("trkRes_" + s_etaMin + "_" +s_etaMax);1624 gr_trkpi_eff_pt[k].SetName("trkEff_" + s_etaMin + "_" +s_etaMax);1625 1626 addResoGraph(mg_trkpi_res_pt, &gr_trkpi_res_pt[k], leg_trkpi_res_pt, markerStyles.at(k), colors.at(k), s_eta);1627 addResoGraph(mg_trkpi_eff_pt, &gr_trkpi_eff_pt[k], leg_trkpi_eff_pt, markerStyles.at(k), colors.at(k), s_eta);1641 for (k = 0; k < etaVals.size()-1; k++) 1642 { 1643 HistogramsCollection(&plots_trkpi_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi"); 1644 GetPtres<Track>(&plots_trkpi_res_pt[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion); 1645 gr_trkpi_res_pt[k] = EresGraph(&plots_trkpi_res_pt[k]); 1646 1647 h_trkpi_eff_pt = GetEffPt<Track>(branchTrackPion, branchParticlePion, "Pion", 211, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPion); 1648 gr_trkpi_eff_pt[k] = TGraphErrors(h_trkpi_eff_pt); 1649 1650 s_etaMin = Form("%.1f",etaVals.at(k)); 1651 s_etaMax = Form("%.1f",etaVals.at(k+1)); 1652 1653 s_eta = "#pi^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax; 1654 1655 gr_trkpi_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax); 1656 gr_trkpi_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax); 1657 1658 addResoGraph(mg_trkpi_res_pt, &gr_trkpi_res_pt[k], leg_trkpi_res_pt, markerStyles.at(k), colors.at(k), s_eta); 1659 addResoGraph(mg_trkpi_eff_pt, &gr_trkpi_eff_pt[k], leg_trkpi_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 1628 1660 } 1629 1661 1630 1662 // loop over pt 1631 for(k = 0; k < ptVals.size(); k++) 1632 { 1633 HistogramsCollectionVsEta(&plots_trkpi_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "trkpi", 0.0, 2.0); 1634 GetPtresVsEta<Track>(&plots_trkpi_res_eta[k], branchTrackPion, branchParticlePion, 211, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderPion); 1635 gr_trkpi_res_eta[k] = EresGraphVsEta(&plots_trkpi_res_eta[k]); 1636 1637 h_trkpi_eff_eta = GetEffEta<Track>(branchTrackPion, branchParticlePion, "Pion", 211, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderPion); 1638 gr_trkpi_eff_eta[k] = TGraphErrors(h_trkpi_eff_eta); 1639 1640 s_pt = Form("#pi^{ #pm} , p_{T} = %.0f GeV", ptVals.at(k)); 1641 if(ptVals.at(k) >= 1000.) s_pt = Form("#pi^{ #pm} , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 1642 1643 addResoGraph(mg_trkpi_res_eta, &gr_trkpi_res_eta[k], leg_trkpi_res_eta, markerStyles.at(k), colors.at(k), s_pt); 1644 addResoGraph(mg_trkpi_eff_eta, &gr_trkpi_eff_eta[k], leg_trkpi_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 1645 } 1646 1647 TCanvas *c_trkpi_res_pt = new TCanvas("", "", 800, 600); 1663 for (k = 0; k < ptVals.size(); k++) 1664 { 1665 HistogramsCollectionVsEta(&plots_trkpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0); 1666 GetPtresVsEta<Track>(&plots_trkpi_res_eta[k], branchTrackPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion); 1667 gr_trkpi_res_eta[k] = EresGraphVsEta(&plots_trkpi_res_eta[k]); 1668 1669 h_trkpi_eff_eta = GetEffEta<Track>(branchTrackPion, branchParticlePion, "Pion", 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPion); 1670 gr_trkpi_eff_eta[k] = TGraphErrors(h_trkpi_eff_eta); 1671 1672 s_pt = Form("#pi^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k)); 1673 if(ptVals.at(k) >= 1000.) s_pt = Form("#pi^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 1674 1675 addResoGraph(mg_trkpi_res_eta, &gr_trkpi_res_eta[k], leg_trkpi_res_eta, markerStyles.at(k), colors.at(k), s_pt ); 1676 addResoGraph(mg_trkpi_eff_eta, &gr_trkpi_eff_eta[k], leg_trkpi_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 1677 1678 } 1679 1680 TCanvas *c_trkpi_res_pt = new TCanvas("","", 800, 600); 1648 1681 1649 1682 mg_trkpi_res_pt->Draw("APE"); … … 1652 1685 pave->Draw(); 1653 1686 1654 c_trkpi_res_pt->Print(pdfOutput + "(","pdf");1655 c_trkpi_res_pt->Print(figPath + "img_trkpi_res_pt.pdf","pdf");1656 c_trkpi_res_pt->Print(figPath + "img_trkpi_res_pt.png","png");1657 1658 TCanvas *c_trkpi_res_eta = new TCanvas("", 1687 c_trkpi_res_pt->Print(pdfOutput+"(","pdf"); 1688 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.pdf","pdf"); 1689 c_trkpi_res_pt->Print(figPath+"img_trkpi_res_pt.png","png"); 1690 1691 TCanvas *c_trkpi_res_eta = new TCanvas("","", 800, 600); 1659 1692 1660 1693 mg_trkpi_res_eta->Draw("APE"); … … 1663 1696 pave->Draw(); 1664 1697 1665 c_trkpi_res_eta->Print(pdfOutput, 1666 c_trkpi_res_eta->Print(figPath + "img_trkpi_res_eta.pdf","pdf");1667 c_trkpi_res_eta->Print(figPath + "img_trkpi_res_eta.png","png");1668 1669 TCanvas *c_trkpi_eff_pt = new TCanvas("", 1698 c_trkpi_res_eta->Print(pdfOutput,"pdf"); 1699 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.pdf","pdf"); 1700 c_trkpi_res_eta->Print(figPath+"img_trkpi_res_eta.png","png"); 1701 1702 TCanvas *c_trkpi_eff_pt = new TCanvas("","", 800, 600); 1670 1703 1671 1704 mg_trkpi_eff_pt->Draw("APE"); … … 1674 1707 pave->Draw(); 1675 1708 1676 c_trkpi_eff_pt->Print(pdfOutput, 1677 c_trkpi_eff_pt->Print(figPath + "img_trkpi_eff_pt.pdf","pdf");1678 c_trkpi_eff_pt->Print(figPath + "img_trkpi_eff_pt.png","png");1679 1680 TCanvas *c_trkpi_eff_eta = new TCanvas("", 1709 c_trkpi_eff_pt->Print(pdfOutput,"pdf"); 1710 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.pdf","pdf"); 1711 c_trkpi_eff_pt->Print(figPath+"img_trkpi_eff_pt.png","png"); 1712 1713 TCanvas *c_trkpi_eff_eta = new TCanvas("","", 800, 600); 1681 1714 1682 1715 mg_trkpi_eff_eta->Draw("APE"); … … 1685 1718 pave->Draw(); 1686 1719 1687 c_trkpi_eff_eta->Print(pdfOutput, "pdf"); 1688 c_trkpi_eff_eta->Print(figPath + "img_trkpi_eff_eta.pdf", "pdf"); 1689 c_trkpi_eff_eta->Print(figPath + "img_trkpi_eff_eta.png", "png"); 1720 1721 c_trkpi_eff_eta->Print(pdfOutput,"pdf"); 1722 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.pdf","pdf"); 1723 c_trkpi_eff_eta->Print(figPath+"img_trkpi_eff_eta.png","png"); 1690 1724 1691 1725 // --------- Electron Tracks --------- // 1692 1726 1693 TMultiGraph *mg_trkele_res_pt = new TMultiGraph("","");1694 TMultiGraph *mg_trkele_eff_pt = new TMultiGraph("","");1695 TMultiGraph *mg_trkele_res_eta = new TMultiGraph("", 1696 TMultiGraph *mg_trkele_eff_eta = new TMultiGraph("", 1697 1698 TLegend *leg_trkele_res_pt = new TLegend(0.55, 0.22, 0.90,0.48);1699 TLegend *leg_trkele_eff_pt = (TLegend 1700 TLegend *leg_trkele_res_eta = (TLegend 1701 TLegend *leg_trkele_eff_eta = (TLegend 1702 1703 TGraphErrors *gr_trkele_res_pt = new TGraphErrors[n_etabins];1704 TGraphErrors *gr_trkele_eff_pt = new TGraphErrors[n_etabins];1727 TMultiGraph *mg_trkele_res_pt = new TMultiGraph("",""); 1728 TMultiGraph *mg_trkele_eff_pt = new TMultiGraph("",""); 1729 TMultiGraph *mg_trkele_res_eta = new TMultiGraph("",""); 1730 TMultiGraph *mg_trkele_eff_eta = new TMultiGraph("",""); 1731 1732 TLegend *leg_trkele_res_pt = new TLegend(0.55,0.22,0.90,0.48); 1733 TLegend *leg_trkele_eff_pt = (TLegend*)leg_trkele_res_pt->Clone(); 1734 TLegend *leg_trkele_res_eta = (TLegend*)leg_trkele_res_pt->Clone(); 1735 TLegend *leg_trkele_eff_eta = (TLegend*)leg_trkele_res_eta->Clone(); 1736 1737 TGraphErrors *gr_trkele_res_pt = new TGraphErrors[n_etabins]; 1738 TGraphErrors *gr_trkele_eff_pt = new TGraphErrors[n_etabins]; 1705 1739 TGraphErrors *gr_trkele_res_eta = new TGraphErrors[n_ptbins]; 1706 1740 TGraphErrors *gr_trkele_eff_eta = new TGraphErrors[n_ptbins]; 1707 1741 1708 TH1D *h_trkele_eff_pt, *h_trkele_eff_eta;1709 1710 std::vector<resolPlot> *plots_trkele_res_pt = new std::vector<resolPlot>[n_etabins];1711 std::vector<resolPlot> *plots_trkele_res_eta = new std::vector<resolPlot>[n_ptbins];1742 TH1D* h_trkele_eff_pt, *h_trkele_eff_eta; 1743 1744 std::vector<resolPlot> *plots_trkele_res_pt = new std::vector<resolPlot>[n_etabins]; 1745 std::vector<resolPlot> *plots_trkele_res_eta = new std::vector<resolPlot>[n_ptbins]; 1712 1746 1713 1747 // loop over eta bins 1714 for (k = 0; k < etaVals.size() -1; k++)1715 { 1716 HistogramsCollection(&plots_trkele_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele");1717 GetPtres<Track>(&plots_trkele_res_pt[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k +1), treeReaderElectron);1718 gr_trkele_res_pt[k] = EresGraph(&plots_trkele_res_pt[k]);1719 1720 h_trkele_eff_pt = GetEffPt<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k +1), treeReaderElectron);1721 gr_trkele_eff_pt[k] = TGraphErrors(h_trkele_eff_pt);1722 1723 s_etaMin = Form("%.1f",etaVals.at(k));1724 s_etaMax = Form("%.1f", etaVals.at(k +1));1725 1726 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < " +s_etaMax;1727 1728 gr_trkele_res_pt[k].SetName("trkRes_" + s_etaMin + "_" +s_etaMax);1729 gr_trkele_eff_pt[k].SetName("trkEff_" + s_etaMin + "_" +s_etaMax);1730 1731 addResoGraph(mg_trkele_res_pt, &gr_trkele_res_pt[k], leg_trkele_res_pt, markerStyles.at(k), colors.at(k), s_eta);1732 addResoGraph(mg_trkele_eff_pt, &gr_trkele_eff_pt[k], leg_trkele_eff_pt, markerStyles.at(k), colors.at(k), s_eta);1748 for (k = 0; k < etaVals.size()-1; k++) 1749 { 1750 HistogramsCollection(&plots_trkele_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele"); 1751 GetPtres<Track>(&plots_trkele_res_pt[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron); 1752 gr_trkele_res_pt[k] = EresGraph(&plots_trkele_res_pt[k]); 1753 1754 h_trkele_eff_pt = GetEffPt<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron); 1755 gr_trkele_eff_pt[k] = TGraphErrors(h_trkele_eff_pt); 1756 1757 s_etaMin = Form("%.1f",etaVals.at(k)); 1758 s_etaMax = Form("%.1f",etaVals.at(k+1)); 1759 1760 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax; 1761 1762 gr_trkele_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax); 1763 gr_trkele_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax); 1764 1765 addResoGraph(mg_trkele_res_pt, &gr_trkele_res_pt[k], leg_trkele_res_pt, markerStyles.at(k), colors.at(k), s_eta); 1766 addResoGraph(mg_trkele_eff_pt, &gr_trkele_eff_pt[k], leg_trkele_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 1733 1767 } 1734 1768 1735 1769 // loop over pt 1736 for(k = 0; k < ptVals.size(); k++) 1737 { 1738 HistogramsCollectionVsEta(&plots_trkele_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "trkele", 0.0, 2.0); 1739 GetPtresVsEta<Track>(&plots_trkele_res_eta[k], branchTrackElectron, branchParticleElectron, 11, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderElectron); 1740 gr_trkele_res_eta[k] = EresGraphVsEta(&plots_trkele_res_eta[k]); 1741 1742 h_trkele_eff_eta = GetEffEta<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderElectron); 1743 gr_trkele_eff_eta[k] = TGraphErrors(h_trkele_eff_eta); 1744 1745 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV", ptVals.at(k)); 1746 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 1747 1748 addResoGraph(mg_trkele_res_eta, &gr_trkele_res_eta[k], leg_trkele_res_eta, markerStyles.at(k), colors.at(k), s_pt); 1749 addResoGraph(mg_trkele_eff_eta, &gr_trkele_eff_eta[k], leg_trkele_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 1750 } 1751 1752 TCanvas *c_trkele_res_pt = new TCanvas("", "", 800, 600); 1770 for (k = 0; k < ptVals.size(); k++) 1771 { 1772 HistogramsCollectionVsEta(&plots_trkele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0); 1773 GetPtresVsEta<Track>(&plots_trkele_res_eta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron); 1774 gr_trkele_res_eta[k] = EresGraphVsEta(&plots_trkele_res_eta[k]); 1775 1776 h_trkele_eff_eta = GetEffEta<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron); 1777 gr_trkele_eff_eta[k] = TGraphErrors(h_trkele_eff_eta); 1778 1779 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k)); 1780 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 1781 1782 addResoGraph(mg_trkele_res_eta, &gr_trkele_res_eta[k], leg_trkele_res_eta, markerStyles.at(k), colors.at(k), s_pt ); 1783 addResoGraph(mg_trkele_eff_eta, &gr_trkele_eff_eta[k], leg_trkele_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 1784 1785 } 1786 1787 TCanvas *c_trkele_res_pt = new TCanvas("","", 800, 600); 1753 1788 1754 1789 mg_trkele_res_pt->Draw("APE"); … … 1757 1792 pave->Draw(); 1758 1793 1759 c_trkele_res_pt->Print(pdfOutput, 1760 c_trkele_res_pt->Print(figPath + "img_trkele_res_pt.pdf","pdf");1761 c_trkele_res_pt->Print(figPath + "img_trkele_res_pt.png","png");1762 1763 TCanvas *c_trkele_res_eta = new TCanvas("", 1794 c_trkele_res_pt->Print(pdfOutput,"pdf"); 1795 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.pdf","pdf"); 1796 c_trkele_res_pt->Print(figPath+"img_trkele_res_pt.png","png"); 1797 1798 TCanvas *c_trkele_res_eta = new TCanvas("","", 800, 600); 1764 1799 1765 1800 mg_trkele_res_eta->Draw("APE"); … … 1768 1803 pave->Draw(); 1769 1804 1770 c_trkele_res_eta->Print(pdfOutput, 1771 c_trkele_res_eta->Print(figPath + "img_trkele_res_eta.pdf","pdf");1772 c_trkele_res_eta->Print(figPath + "img_trkele_res_eta.png","png");1773 1774 TCanvas *c_trkele_eff_pt = new TCanvas("", 1805 c_trkele_res_eta->Print(pdfOutput,"pdf"); 1806 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.pdf","pdf"); 1807 c_trkele_res_eta->Print(figPath+"img_trkele_res_eta.png","png"); 1808 1809 TCanvas *c_trkele_eff_pt = new TCanvas("","", 800, 600); 1775 1810 1776 1811 mg_trkele_eff_pt->Draw("APE"); … … 1779 1814 pave->Draw(); 1780 1815 1781 c_trkele_eff_pt->Print(pdfOutput, 1782 c_trkele_eff_pt->Print(figPath + "img_trkele_eff_pt.pdf","pdf");1783 c_trkele_eff_pt->Print(figPath + "img_trkele_eff_pt.png","png");1784 1785 TCanvas *c_trkele_eff_eta = new TCanvas("", 1816 c_trkele_eff_pt->Print(pdfOutput,"pdf"); 1817 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.pdf","pdf"); 1818 c_trkele_eff_pt->Print(figPath+"img_trkele_eff_pt.png","png"); 1819 1820 TCanvas *c_trkele_eff_eta = new TCanvas("","", 800, 600); 1786 1821 1787 1822 mg_trkele_eff_eta->Draw("APE"); … … 1790 1825 pave->Draw(); 1791 1826 1792 c_trkele_eff_eta->Print(pdfOutput, "pdf"); 1793 c_trkele_eff_eta->Print(figPath + "img_trkele_eff_eta.pdf", "pdf"); 1794 c_trkele_eff_eta->Print(figPath + "img_trkele_eff_eta.png", "png"); 1827 c_trkele_eff_eta->Print(pdfOutput,"pdf"); 1828 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.pdf","pdf"); 1829 c_trkele_eff_eta->Print(figPath+"img_trkele_eff_eta.png","png"); 1830 1795 1831 1796 1832 // --------- Muon Tracks --------- // 1797 1833 1798 TMultiGraph *mg_trkmu_res_pt = new TMultiGraph("", ""); 1799 TMultiGraph *mg_trkmu_eff_pt = new TMultiGraph("", ""); 1800 TMultiGraph *mg_trkmu_res_eta = new TMultiGraph("", ""); 1801 TMultiGraph *mg_trkmu_eff_eta = new TMultiGraph("", ""); 1802 1803 TLegend *leg_trkmu_res_pt = new TLegend(0.55, 0.22, 0.90, 0.48); 1804 TLegend *leg_trkmu_eff_pt = (TLegend *)leg_trkmu_res_pt->Clone(); 1805 1806 TLegend *leg_trkmu_res_eta = (TLegend *)leg_trkmu_res_pt->Clone(); 1807 TLegend *leg_trkmu_eff_eta = (TLegend *)leg_trkmu_res_eta->Clone(); 1808 1809 TGraphErrors *gr_trkmu_res_pt = new TGraphErrors[n_etabins]; 1810 TGraphErrors *gr_trkmu_eff_pt = new TGraphErrors[n_etabins]; 1834 TMultiGraph *mg_trkmu_res_pt = new TMultiGraph("",""); 1835 TMultiGraph *mg_trkmu_eff_pt = new TMultiGraph("",""); 1836 TMultiGraph *mg_trkmu_res_eta = new TMultiGraph("",""); 1837 TMultiGraph *mg_trkmu_eff_eta = new TMultiGraph("",""); 1838 1839 TLegend *leg_trkmu_res_pt = new TLegend(0.55,0.22,0.90,0.48); 1840 TLegend *leg_trkmu_eff_pt = (TLegend*)leg_trkmu_res_pt->Clone(); 1841 1842 TLegend *leg_trkmu_res_eta = (TLegend*)leg_trkmu_res_pt->Clone(); 1843 TLegend *leg_trkmu_eff_eta = (TLegend*)leg_trkmu_res_eta->Clone(); 1844 1845 1846 TGraphErrors *gr_trkmu_res_pt = new TGraphErrors[n_etabins]; 1847 TGraphErrors *gr_trkmu_eff_pt = new TGraphErrors[n_etabins]; 1811 1848 TGraphErrors *gr_trkmu_res_eta = new TGraphErrors[n_ptbins]; 1812 1849 TGraphErrors *gr_trkmu_eff_eta = new TGraphErrors[n_ptbins]; 1813 1850 1814 TH1D *h_trkmu_eff_pt, *h_trkmu_eff_eta;1815 1816 std::vector<resolPlot> *plots_trkmu_res_pt = new std::vector<resolPlot>[n_etabins];1817 std::vector<resolPlot> *plots_trkmu_res_eta = new std::vector<resolPlot>[n_ptbins];1851 TH1D* h_trkmu_eff_pt, *h_trkmu_eff_eta; 1852 1853 std::vector<resolPlot> *plots_trkmu_res_pt = new std::vector<resolPlot>[n_etabins]; 1854 std::vector<resolPlot> *plots_trkmu_res_eta = new std::vector<resolPlot>[n_ptbins]; 1818 1855 1819 1856 // loop over eta bins 1820 for (k = 0; k < etaVals.size() -1; k++)1821 { 1822 HistogramsCollection(&plots_trkmu_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkmu");1823 GetPtres<Track>(&plots_trkmu_res_pt[k], branchTrackMuon, branchParticleMuon, 13, etaVals.at(k), etaVals.at(k +1), treeReaderMuon);1824 gr_trkmu_res_pt[k] = EresGraph(&plots_trkmu_res_pt[k]);1825 1826 h_trkmu_eff_pt = GetEffPt<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k +1), treeReaderMuon);1827 gr_trkmu_eff_pt[k] = TGraphErrors(h_trkmu_eff_pt);1828 1829 s_etaMin = Form("%.1f",etaVals.at(k));1830 s_etaMax = Form("%.1f", etaVals.at(k +1));1831 1832 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < " +s_etaMax;1833 1834 gr_trkmu_res_pt[k].SetName("trkRes_" + s_etaMin + "_" +s_etaMax);1835 gr_trkmu_eff_pt[k].SetName("trkEff_" + s_etaMin + "_" +s_etaMax);1836 1837 addResoGraph(mg_trkmu_res_pt, &gr_trkmu_res_pt[k], leg_trkmu_res_pt, markerStyles.at(k), colors.at(k), s_eta);1838 addResoGraph(mg_trkmu_eff_pt, &gr_trkmu_eff_pt[k], leg_trkmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta);1857 for (k = 0; k < etaVals.size()-1; k++) 1858 { 1859 HistogramsCollection(&plots_trkmu_res_pt[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkmu"); 1860 GetPtres<Track>(&plots_trkmu_res_pt[k], branchTrackMuon, branchParticleMuon, 13, etaVals.at(k), etaVals.at(k+1), treeReaderMuon); 1861 gr_trkmu_res_pt[k] = EresGraph(&plots_trkmu_res_pt[k]); 1862 1863 h_trkmu_eff_pt = GetEffPt<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon); 1864 gr_trkmu_eff_pt[k] = TGraphErrors(h_trkmu_eff_pt); 1865 1866 s_etaMin = Form("%.1f",etaVals.at(k)); 1867 s_etaMax = Form("%.1f",etaVals.at(k+1)); 1868 1869 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax; 1870 1871 gr_trkmu_res_pt[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax); 1872 gr_trkmu_eff_pt[k].SetName("trkEff_"+s_etaMin+"_"+s_etaMax); 1873 1874 addResoGraph(mg_trkmu_res_pt, &gr_trkmu_res_pt[k], leg_trkmu_res_pt, markerStyles.at(k), colors.at(k), s_eta); 1875 addResoGraph(mg_trkmu_eff_pt, &gr_trkmu_eff_pt[k], leg_trkmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 1839 1876 } 1840 1877 1841 1878 // loop over pt 1842 for(k = 0; k < ptVals.size(); k++) 1843 { 1844 HistogramsCollectionVsEta(&plots_trkmu_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "trkmu", 0.0, 2.0); 1845 GetPtresVsEta<Track>(&plots_trkmu_res_eta[k], branchTrackMuon, branchParticleMuon, 13, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderMuon); 1846 gr_trkmu_res_eta[k] = EresGraphVsEta(&plots_trkmu_res_eta[k]); 1847 1848 h_trkmu_eff_eta = GetEffEta<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderMuon); 1849 gr_trkmu_eff_eta[k] = TGraphErrors(h_trkmu_eff_eta); 1850 1851 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV", ptVals.at(k)); 1852 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 1853 1854 addResoGraph(mg_trkmu_res_eta, &gr_trkmu_res_eta[k], leg_trkmu_res_eta, markerStyles.at(k), colors.at(k), s_pt); 1855 addResoGraph(mg_trkmu_eff_eta, &gr_trkmu_eff_eta[k], leg_trkmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 1856 } 1857 1858 TCanvas *c_trkmu_res_pt = new TCanvas("", "", 800, 600); 1879 for (k = 0; k < ptVals.size(); k++) 1880 { 1881 HistogramsCollectionVsEta(&plots_trkmu_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkmu", 0.0, 2.0); 1882 GetPtresVsEta<Track>(&plots_trkmu_res_eta[k], branchTrackMuon, branchParticleMuon, 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderMuon); 1883 gr_trkmu_res_eta[k] = EresGraphVsEta(&plots_trkmu_res_eta[k]); 1884 1885 h_trkmu_eff_eta = GetEffEta<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon); 1886 gr_trkmu_eff_eta[k] = TGraphErrors(h_trkmu_eff_eta); 1887 1888 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k)); 1889 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 1890 1891 addResoGraph(mg_trkmu_res_eta, &gr_trkmu_res_eta[k], leg_trkmu_res_eta, markerStyles.at(k), colors.at(k), s_pt ); 1892 addResoGraph(mg_trkmu_eff_eta, &gr_trkmu_eff_eta[k], leg_trkmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 1893 1894 } 1895 1896 TCanvas *c_trkmu_res_pt = new TCanvas("","", 800, 600); 1859 1897 1860 1898 mg_trkmu_res_pt->Draw("APE"); … … 1863 1901 pave->Draw(); 1864 1902 1865 c_trkmu_res_pt->Print(pdfOutput, 1866 c_trkmu_res_pt->Print(figPath + "img_trkmu_res_pt.pdf","pdf");1867 c_trkmu_res_pt->Print(figPath + "img_trkmu_res_pt.png","png");1868 1869 TCanvas *c_trkmu_res_eta = new TCanvas("", 1903 c_trkmu_res_pt->Print(pdfOutput,"pdf"); 1904 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.pdf","pdf"); 1905 c_trkmu_res_pt->Print(figPath+"img_trkmu_res_pt.png","png"); 1906 1907 TCanvas *c_trkmu_res_eta = new TCanvas("","", 800, 600); 1870 1908 1871 1909 mg_trkmu_res_eta->Draw("APE"); … … 1874 1912 pave->Draw(); 1875 1913 1876 c_trkmu_res_eta->Print(pdfOutput, 1877 c_trkmu_res_eta->Print(figPath + "img_trkmu_res_eta.pdf","pdf");1878 c_trkmu_res_eta->Print(figPath + "img_trkmu_res_eta.png","png");1879 1880 TCanvas *c_trkmu_eff_pt = new TCanvas("", 1914 c_trkmu_res_eta->Print(pdfOutput,"pdf"); 1915 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.pdf","pdf"); 1916 c_trkmu_res_eta->Print(figPath+"img_trkmu_res_eta.png","png"); 1917 1918 TCanvas *c_trkmu_eff_pt = new TCanvas("","", 800, 600); 1881 1919 1882 1920 mg_trkmu_eff_pt->Draw("APE"); … … 1885 1923 pave->Draw(); 1886 1924 1887 c_trkmu_eff_pt->Print(pdfOutput, 1888 c_trkmu_eff_pt->Print(figPath + "img_trkmu_eff_pt.pdf","pdf");1889 c_trkmu_eff_pt->Print(figPath + "img_trkmu_eff_pt.png","png");1890 1891 TCanvas *c_trkmu_eff_eta = new TCanvas("", 1925 c_trkmu_eff_pt->Print(pdfOutput,"pdf"); 1926 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.pdf","pdf"); 1927 c_trkmu_eff_pt->Print(figPath+"img_trkmu_eff_pt.png","png"); 1928 1929 TCanvas *c_trkmu_eff_eta = new TCanvas("","", 800, 600); 1892 1930 1893 1931 mg_trkmu_eff_eta->Draw("APE"); … … 1896 1934 pave->Draw(); 1897 1935 1898 c_trkmu_eff_eta->Print(pdfOutput, "pdf"); 1899 c_trkmu_eff_eta->Print(figPath + "img_trkmu_eff_eta.pdf", "pdf"); 1900 c_trkmu_eff_eta->Print(figPath + "img_trkmu_eff_eta.png", "png"); 1936 c_trkmu_eff_eta->Print(pdfOutput,"pdf"); 1937 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.pdf","pdf"); 1938 c_trkmu_eff_eta->Print(figPath+"img_trkmu_eff_eta.png","png"); 1939 1901 1940 1902 1941 ////////////////////// … … 1904 1943 ////////////////////// 1905 1944 1906 TMultiGraph *mg_ecal_res_e = new TMultiGraph("", ""); 1907 TMultiGraph *mg_ecal_res_eta = new TMultiGraph("", ""); 1908 1909 TLegend *leg_ecal_res_e = new TLegend(0.55, 0.64, 0.90, 0.90); 1910 TLegend *leg_ecal_res_eta = new TLegend(0.60, 0.59, 0.95, 0.90); 1911 1912 TGraphErrors *gr_ecal_res_e = new TGraphErrors[n_etabins]; 1913 TGraphErrors *gr_ecal_res_eta = new TGraphErrors[n_ptbins]; 1914 1915 std::vector<resolPlot> *plots_ecal_res_e = new std::vector<resolPlot>[n_etabins]; 1945 1946 TMultiGraph *mg_ecal_res_e = new TMultiGraph("",""); 1947 TMultiGraph *mg_ecal_res_eta = new TMultiGraph("",""); 1948 1949 TLegend *leg_ecal_res_e = new TLegend(0.55,0.64,0.90,0.90); 1950 TLegend *leg_ecal_res_eta = new TLegend(0.60,0.59,0.95,0.90); 1951 1952 TGraphErrors *gr_ecal_res_e = new TGraphErrors[n_etabins]; 1953 TGraphErrors *gr_ecal_res_eta = new TGraphErrors[n_ptbins]; 1954 1955 std::vector<resolPlot> *plots_ecal_res_e = new std::vector<resolPlot>[n_etabins]; 1916 1956 std::vector<resolPlot> *plots_ecal_res_eta = new std::vector<resolPlot>[n_ptbins]; 1917 1957 1918 1958 // loop over eta bins 1919 for (k = 0; k < etaVals.size() -1; k++)1920 { 1921 HistogramsCollection(&plots_ecal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "ecal");1922 GetEres<Tower>(&plots_ecal_res_e[k], branchTowerPhoton, branchParticlePhoton, 22, etaVals.at(k), etaVals.at(k +1), treeReaderPhoton);1923 gr_ecal_res_e[k] = EresGraph(&plots_ecal_res_e[k]);1924 1925 s_etaMin = Form("%.1f",etaVals.at(k));1926 s_etaMax = Form("%.1f", etaVals.at(k +1));1927 1928 s_eta = "#gamma , " + s_etaMin + " < | #eta | < " +s_etaMax;1929 1930 gr_ecal_res_e[k].SetName("trkRes_" + s_etaMin + "_" +s_etaMax);1931 1932 addResoGraph(mg_ecal_res_e, &gr_ecal_res_e[k], leg_ecal_res_e, markerStyles.at(k), colors.at(k), s_eta);1959 for (k = 0; k < etaVals.size()-1; k++) 1960 { 1961 HistogramsCollection(&plots_ecal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "ecal"); 1962 GetEres<Tower>(&plots_ecal_res_e[k], branchTowerPhoton, branchParticlePhoton, 22, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton); 1963 gr_ecal_res_e[k] = EresGraph(&plots_ecal_res_e[k]); 1964 1965 s_etaMin = Form("%.1f",etaVals.at(k)); 1966 s_etaMax = Form("%.1f",etaVals.at(k+1)); 1967 1968 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax; 1969 1970 gr_ecal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax); 1971 1972 addResoGraph(mg_ecal_res_e, &gr_ecal_res_e[k], leg_ecal_res_e, markerStyles.at(k), colors.at(k), s_eta); 1933 1973 } 1934 1974 1935 1975 // loop over pt 1936 for (k = 0; k < ptVals.size(); k++)1937 { 1938 HistogramsCollectionVsEta(&plots_ecal_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 *ptVals.at(k), "ecal", 0.0, 2.0);1939 GetEresVsEta<Tower>(&plots_ecal_res_eta[k], branchTowerPhoton, branchParticlePhoton, 22, 0.5 * ptVals.at(k), 2.0 *ptVals.at(k), treeReaderPhoton);1940 gr_ecal_res_eta[k] = EresGraphVsEta(&plots_ecal_res_eta[k]);1941 1942 s_e = Form("#gamma , E = %.0f GeV",ptVals.at(k));1943 if(ptVals.at(k) >= 1000.) s_e = Form("#gamma , E = %.0f TeV", ptVals.at(k) /1000.);1944 1945 addResoGraph(mg_ecal_res_eta, &gr_ecal_res_eta[k], leg_ecal_res_eta, markerStyles.at(k), colors.at(k), s_e);1946 } 1947 1948 TCanvas *c_ecal_res_e = new TCanvas("", 1976 for (k = 0; k < ptVals.size(); k++) 1977 { 1978 HistogramsCollectionVsEta(&plots_ecal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "ecal", 0.0, 2.0); 1979 GetEresVsEta<Tower>(&plots_ecal_res_eta[k], branchTowerPhoton, branchParticlePhoton, 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPhoton); 1980 gr_ecal_res_eta[k] = EresGraphVsEta(&plots_ecal_res_eta[k]); 1981 1982 s_e = Form("#gamma , E = %.0f GeV",ptVals.at(k)); 1983 if(ptVals.at(k) >= 1000.) s_e = Form("#gamma , E = %.0f TeV",ptVals.at(k)/1000.); 1984 1985 addResoGraph(mg_ecal_res_eta, &gr_ecal_res_eta[k], leg_ecal_res_eta, markerStyles.at(k), colors.at(k), s_e ); 1986 } 1987 1988 TCanvas *c_ecal_res_e = new TCanvas("","", 800, 600); 1949 1989 1950 1990 mg_ecal_res_e->Draw("APE"); 1951 1991 // DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.5, 100, "E [GeV]", "(ECAL resolution in E)/E (%)", true, true); 1952 1992 DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.0, 20, "E [GeV]", "(ECAL resolution in E)/E (%)", true, false); 1953 1993 leg_ecal_res_e->Draw(); 1954 1994 pave->Draw(); 1955 1995 1956 c_ecal_res_e->Print(pdfOutput, 1957 c_ecal_res_e->Print(figPath + "img_ecal_res_e.pdf","pdf");1958 c_ecal_res_e->Print(figPath + "img_ecal_res_e.png","png");1959 1960 TCanvas *c_ecal_res_eta = new TCanvas("", 1996 c_ecal_res_e->Print(pdfOutput,"pdf"); 1997 c_ecal_res_e->Print(figPath+"img_ecal_res_e.pdf","pdf"); 1998 c_ecal_res_e->Print(figPath+"img_ecal_res_e.png","png"); 1999 2000 TCanvas *c_ecal_res_eta = new TCanvas("","", 800, 600); 1961 2001 1962 2002 mg_ecal_res_eta->Draw("APE"); … … 1966 2006 pave->Draw(); 1967 2007 1968 c_ecal_res_eta->Print(pdfOutput, 1969 c_ecal_res_eta->Print(figPath + "img_ecal_res_eta.pdf","pdf");1970 c_ecal_res_eta->Print(figPath + "img_ecal_res_eta.png","png");2008 c_ecal_res_eta->Print(pdfOutput,"pdf"); 2009 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.pdf","pdf"); 2010 c_ecal_res_eta->Print(figPath+"img_ecal_res_eta.png","png"); 1971 2011 1972 2012 ////////////////////// … … 1974 2014 ////////////////////// 1975 2015 1976 TMultiGraph *mg_hcal_res_e = new TMultiGraph("", ""); 1977 TMultiGraph *mg_hcal_res_eta = new TMultiGraph("", ""); 1978 1979 TLegend *leg_hcal_res_e = new TLegend(0.55, 0.64, 0.90, 0.90); 1980 TLegend *leg_hcal_res_eta = new TLegend(0.60, 0.59, 0.95, 0.90); 1981 1982 TGraphErrors *gr_hcal_res_e = new TGraphErrors[n_etabins]; 2016 2017 TMultiGraph *mg_hcal_res_e = new TMultiGraph("",""); 2018 TMultiGraph *mg_hcal_res_eta = new TMultiGraph("",""); 2019 2020 TLegend *leg_hcal_res_e = new TLegend(0.55,0.64,0.90,0.90); 2021 TLegend *leg_hcal_res_eta = new TLegend(0.60,0.59,0.95,0.90); 2022 2023 TGraphErrors *gr_hcal_res_e = new TGraphErrors[n_etabins]; 1983 2024 TGraphErrors *gr_hcal_res_eta = new TGraphErrors[n_ptbins]; 1984 2025 1985 std::vector<resolPlot> *plots_hcal_res_e = new std::vector<resolPlot>[n_etabins];2026 std::vector<resolPlot> *plots_hcal_res_e = new std::vector<resolPlot>[n_etabins]; 1986 2027 std::vector<resolPlot> *plots_hcal_res_eta = new std::vector<resolPlot>[n_ptbins]; 1987 2028 1988 2029 // loop over eta bins 1989 for (k = 0; k < etaVals.size() -1; k++)1990 { 1991 HistogramsCollection(&plots_hcal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "hcal");1992 GetEres<Tower>(&plots_hcal_res_e[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, etaVals.at(k), etaVals.at(k +1), treeReaderNeutralHadron);1993 1994 gr_hcal_res_e[k] = EresGraph(&plots_hcal_res_e[k]);1995 1996 s_etaMin = Form("%.1f",etaVals.at(k));1997 s_etaMax = Form("%.1f", etaVals.at(k +1));1998 1999 s_eta = "n , " + s_etaMin + " < | #eta | < " +s_etaMax;2000 2001 gr_hcal_res_e[k].SetName("trkRes_" + s_etaMin + "_" +s_etaMax);2002 2003 addResoGraph(mg_hcal_res_e, &gr_hcal_res_e[k], leg_hcal_res_e, markerStyles.at(k), colors.at(k), s_eta);2030 for (k = 0; k < etaVals.size()-1; k++) 2031 { 2032 HistogramsCollection(&plots_hcal_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "hcal"); 2033 GetEres<Tower>(&plots_hcal_res_e[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, etaVals.at(k), etaVals.at(k+1), treeReaderNeutralHadron); 2034 2035 gr_hcal_res_e[k] = EresGraph(&plots_hcal_res_e[k]); 2036 2037 s_etaMin = Form("%.1f",etaVals.at(k)); 2038 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2039 2040 s_eta = "n , " + s_etaMin + " < | #eta | < "+s_etaMax; 2041 2042 gr_hcal_res_e[k].SetName("trkRes_"+s_etaMin+"_"+s_etaMax); 2043 2044 addResoGraph(mg_hcal_res_e, &gr_hcal_res_e[k], leg_hcal_res_e, markerStyles.at(k), colors.at(k), s_eta); 2004 2045 } 2005 2046 2006 2047 // loop over pt 2007 for(k = 0; k < ptVals.size(); k++) 2008 { 2009 HistogramsCollectionVsEta(&plots_hcal_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "hcal", 0.0, 2.0); 2010 GetEresVsEta<Tower>(&plots_hcal_res_eta[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderNeutralHadron); 2011 gr_hcal_res_eta[k] = EresGraphVsEta(&plots_hcal_res_eta[k]); 2012 2013 s_e = Form("n , E = %.0f GeV", ptVals.at(k)); 2014 if(ptVals.at(k) >= 1000.) s_e = Form("n , E = %.0f TeV", ptVals.at(k) / 1000.); 2015 2016 addResoGraph(mg_hcal_res_eta, &gr_hcal_res_eta[k], leg_hcal_res_eta, markerStyles.at(k), colors.at(k), s_e); 2017 } 2018 2019 TCanvas *c_hcal_res_e = new TCanvas("", "", 800, 600); 2048 for (k = 0; k < ptVals.size(); k++) 2049 { 2050 HistogramsCollectionVsEta(&plots_hcal_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "hcal", 0.0, 2.0); 2051 GetEresVsEta<Tower>(&plots_hcal_res_eta[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderNeutralHadron); 2052 gr_hcal_res_eta[k] = EresGraphVsEta(&plots_hcal_res_eta[k]); 2053 2054 s_e = Form("n , E = %.0f GeV",ptVals.at(k)); 2055 if(ptVals.at(k) >= 1000.) s_e = Form("n , E = %.0f TeV",ptVals.at(k)/1000.); 2056 2057 addResoGraph(mg_hcal_res_eta, &gr_hcal_res_eta[k], leg_hcal_res_eta, markerStyles.at(k), colors.at(k), s_e ); 2058 } 2059 2060 2061 TCanvas *c_hcal_res_e = new TCanvas("","", 800, 600); 2020 2062 2021 2063 mg_hcal_res_e->Draw("APE"); … … 2025 2067 pave->Draw(); 2026 2068 2027 c_hcal_res_e->Print(pdfOutput, 2028 c_hcal_res_e->Print(figPath + "img_hcal_res_e.pdf","pdf");2029 c_hcal_res_e->Print(figPath + "img_hcal_res_e.png","png");2030 2031 TCanvas *c_hcal_res_eta = new TCanvas("", 2069 c_hcal_res_e->Print(pdfOutput,"pdf"); 2070 c_hcal_res_e->Print(figPath+"img_hcal_res_e.pdf","pdf"); 2071 c_hcal_res_e->Print(figPath+"img_hcal_res_e.png","png"); 2072 2073 TCanvas *c_hcal_res_eta = new TCanvas("","", 800, 600); 2032 2074 2033 2075 mg_hcal_res_eta->Draw("APE"); … … 2037 2079 pave->Draw(); 2038 2080 2039 c_hcal_res_eta->Print(pdfOutput, 2040 c_hcal_res_eta->Print(figPath + "img_hcal_res_eta.pdf","pdf");2041 c_hcal_res_eta->Print(figPath + "img_hcal_res_eta.png","png");2081 c_hcal_res_eta->Print(pdfOutput,"pdf"); 2082 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.pdf","pdf"); 2083 c_hcal_res_eta->Print(figPath+"img_hcal_res_eta.png","png"); 2042 2084 2043 2085 //////////////////// … … 2056 2098 TGraphErrors *gr_trkele_res_eeta = new TGraphErrors[n_ptbins]; 2057 2099 2058 std::vector<resolPlot> *plots_pfele_res_e = new std::vector<resolPlot>[n_etabins];2059 std::vector<resolPlot> *plots_pfele_res_eta = new std::vector<resolPlot>[n_ptbins];2060 std::vector<resolPlot> *plots_trkele_res_e = new std::vector<resolPlot>[n_etabins];2100 std::vector<resolPlot> *plots_pfele_res_e = new std::vector<resolPlot>[n_etabins]; 2101 std::vector<resolPlot> *plots_pfele_res_eta = new std::vector<resolPlot>[n_ptbins]; 2102 std::vector<resolPlot> *plots_trkele_res_e = new std::vector<resolPlot>[n_etabins]; 2061 2103 std::vector<resolPlot> *plots_trkele_res_eeta = new std::vector<resolPlot>[n_ptbins]; 2062 2104 … … 2064 2106 TCanvas *c_pfele_res_eta[n_ptbins]; 2065 2107 2108 2066 2109 // loop over eta bins 2067 for(k = 0; k < etaVals.size() - 1; k++) 2068 { 2069 mg_pfele_res_e[k] = new TMultiGraph("", ""); 2070 leg_pfele_res_e[k] = new TLegend(0.40, 0.60, 0.75, 0.90); 2071 2072 HistogramsCollection(&plots_pfele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfele"); 2073 GetEres<Electron>(&plots_pfele_res_e[k], branchElectronPF, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k + 1), treeReaderElectron); 2074 gr_pfele_res_e[k] = EresGraph(&plots_pfele_res_e[k]); 2075 2076 HistogramsCollection(&plots_trkele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele"); 2077 GetEres<Track>(&plots_trkele_res_e[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k + 1), treeReaderElectron); 2078 gr_trkele_res_e[k] = EresGraph(&plots_trkele_res_e[k]); 2079 2080 s_etaMin = Form("%.1f", etaVals.at(k)); 2081 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2082 s_eta = "e^{ #pm}, " + s_etaMin + " < | #eta | < " + s_etaMax; 2083 2084 leg_pfele_res_e[k]->SetTextFont(132); 2085 leg_pfele_res_e[k]->SetHeader(s_eta); 2086 2087 addResoGraph(mg_pfele_res_e[k], &gr_ecal_res_e[k], leg_pfele_res_e[k], markerStyles.at(0), colors.at(0), "ECAL"); 2088 addResoGraph(mg_pfele_res_e[k], &gr_trkele_res_e[k], leg_pfele_res_e[k], markerStyles.at(1), colors.at(1), "Track"); 2089 addResoGraph(mg_pfele_res_e[k], &gr_pfele_res_e[k], leg_pfele_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2090 2091 c_pfele_res_e[k] = new TCanvas("", "", 800, 600); 2092 2093 mg_pfele_res_e[k]->Draw("APE"); 2094 //DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2095 DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.0, 20, "E [GeV]", "(resolution in E)/E (%)", true, false); 2096 leg_pfele_res_e[k]->Draw(); 2097 pave->Draw(); 2098 2099 TString s_etarange = "eta_" + s_etaMin + "_" + s_etaMax + "_"; 2100 2101 c_pfele_res_e[k]->Print(pdfOutput, "pdf"); 2102 c_pfele_res_e[k]->Print(figPath + "img_pfele_res_" + s_etarange + "e.pdf", "pdf"); 2103 c_pfele_res_e[k]->Print(figPath + "img_pfele_res_" + s_etarange + "e.png", "png"); 2104 } 2105 2106 // loop over eta bins 2107 for(k = 0; k < ptVals.size(); k++) 2108 { 2109 2110 mg_pfele_res_eta[k] = new TMultiGraph("", ""); 2111 leg_pfele_res_eta[k] = new TLegend(0.40, 0.60, 0.75, 0.90); 2112 2113 HistogramsCollectionVsEta(&plots_pfele_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "pfele", 0.0, 2.0); 2114 GetEresVsEta<Electron>(&plots_pfele_res_eta[k], branchElectronPF, branchParticleElectron, 11, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderElectron); 2115 gr_pfele_res_eta[k] = EresGraphVsEta(&plots_pfele_res_eta[k]); 2116 2117 HistogramsCollectionVsEta(&plots_trkele_res_eeta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "trkele", 0.0, 2.0); 2118 GetEresVsEta<Track>(&plots_trkele_res_eeta[k], branchTrackElectron, branchParticleElectron, 11, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderElectron); 2119 gr_trkele_res_eeta[k] = EresGraphVsEta(&plots_trkele_res_eeta[k]); 2120 2121 s_e = Form("e^{ #pm}, E = %.0f GeV", ptVals.at(k)); 2122 if(ptVals.at(k) >= 1000.) s_e = Form("e^{ #pm}, E = %.0f TeV", ptVals.at(k) / 1000.); 2123 2124 leg_pfele_res_eta[k]->SetTextFont(132); 2125 leg_pfele_res_eta[k]->SetHeader(s_e); 2126 2127 addResoGraph(mg_pfele_res_eta[k], &gr_ecal_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(0), colors.at(0), "ECAL"); 2128 addResoGraph(mg_pfele_res_eta[k], &gr_trkele_res_eeta[k], leg_pfele_res_eta[k], markerStyles.at(1), colors.at(1), "Track"); 2129 addResoGraph(mg_pfele_res_eta[k], &gr_pfele_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2130 2131 c_pfele_res_eta[k] = new TCanvas("", "", 800, 600); 2132 2133 mg_pfele_res_eta[k]->Draw("APE"); 2134 //DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2135 DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2136 leg_pfele_res_eta[k]->Draw(); 2137 pave->Draw(); 2138 2139 TString s_ptrange = Form("pt_%.0f_", ptVals.at(k)); 2140 2141 c_pfele_res_eta[k]->Print(pdfOutput, "pdf"); 2142 c_pfele_res_eta[k]->Print(figPath + "img_pfele_res_" + s_ptrange + "eta.pdf", "pdf"); 2143 c_pfele_res_eta[k]->Print(figPath + "img_pfele_res_" + s_ptrange + "eta.png", "png"); 2110 for (k = 0; k < etaVals.size()-1; k++) 2111 { 2112 mg_pfele_res_e[k] = new TMultiGraph("",""); 2113 leg_pfele_res_e[k] = new TLegend(0.40,0.60,0.75,0.90); 2114 2115 HistogramsCollection(&plots_pfele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfele"); 2116 GetEres<Electron>(&plots_pfele_res_e[k], branchElectronPF, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron); 2117 gr_pfele_res_e[k] = EresGraph(&plots_pfele_res_e[k]); 2118 2119 HistogramsCollection(&plots_trkele_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkele"); 2120 GetEres<Track>(&plots_trkele_res_e[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron); 2121 gr_trkele_res_e[k] = EresGraph(&plots_trkele_res_e[k]); 2122 2123 s_etaMin = Form("%.1f",etaVals.at(k)); 2124 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2125 s_eta = "e^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax; 2126 2127 leg_pfele_res_e[k]->SetTextFont(132); 2128 leg_pfele_res_e[k]->SetHeader(s_eta); 2129 2130 addResoGraph(mg_pfele_res_e[k], &gr_ecal_res_e[k], leg_pfele_res_e[k], markerStyles.at(0), colors.at(0), "ECAL"); 2131 addResoGraph(mg_pfele_res_e[k], &gr_trkele_res_e[k], leg_pfele_res_e[k], markerStyles.at(1), colors.at(1), "Track"); 2132 addResoGraph(mg_pfele_res_e[k], &gr_pfele_res_e[k], leg_pfele_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2133 2134 c_pfele_res_e[k] = new TCanvas("","", 800, 600); 2135 2136 mg_pfele_res_e[k]->Draw("APE"); 2137 //DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2138 DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.0, 20, "E [GeV]", "(resolution in E)/E (%)", true, false); 2139 leg_pfele_res_e[k]->Draw(); 2140 pave->Draw(); 2141 2142 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_"; 2143 2144 c_pfele_res_e[k]->Print(pdfOutput,"pdf"); 2145 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.pdf","pdf"); 2146 c_pfele_res_e[k]->Print(figPath+"img_pfele_res_"+s_etarange+"e.png","png"); 2147 2148 } 2149 2150 2151 // loop over eta bins 2152 for (k = 0; k < ptVals.size(); k++) 2153 { 2154 2155 mg_pfele_res_eta[k] = new TMultiGraph("",""); 2156 leg_pfele_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90); 2157 2158 HistogramsCollectionVsEta(&plots_pfele_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfele", 0.0, 2.0); 2159 GetEresVsEta<Electron>(&plots_pfele_res_eta[k], branchElectronPF, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron); 2160 gr_pfele_res_eta[k] = EresGraphVsEta(&plots_pfele_res_eta[k]); 2161 2162 HistogramsCollectionVsEta(&plots_trkele_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkele", 0.0, 2.0); 2163 GetEresVsEta<Track>(&plots_trkele_res_eeta[k], branchTrackElectron, branchParticleElectron, 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderElectron); 2164 gr_trkele_res_eeta[k] = EresGraphVsEta(&plots_trkele_res_eeta[k]); 2165 2166 s_e = Form("e^{ #pm}, E = %.0f GeV",ptVals.at(k)); 2167 if(ptVals.at(k) >= 1000.) s_e = Form("e^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.); 2168 2169 2170 leg_pfele_res_eta[k]->SetTextFont(132); 2171 leg_pfele_res_eta[k]->SetHeader(s_e); 2172 2173 addResoGraph(mg_pfele_res_eta[k], &gr_ecal_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(0), colors.at(0), "ECAL"); 2174 addResoGraph(mg_pfele_res_eta[k], &gr_trkele_res_eeta[k], leg_pfele_res_eta[k], markerStyles.at(1), colors.at(1), "Track"); 2175 addResoGraph(mg_pfele_res_eta[k], &gr_pfele_res_eta[k], leg_pfele_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2176 2177 c_pfele_res_eta[k] = new TCanvas("","", 800, 600); 2178 2179 mg_pfele_res_eta[k]->Draw("APE"); 2180 //DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2181 DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2182 leg_pfele_res_eta[k]->Draw(); 2183 pave->Draw(); 2184 2185 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k)); 2186 2187 c_pfele_res_eta[k]->Print(pdfOutput,"pdf"); 2188 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.pdf","pdf"); 2189 c_pfele_res_eta[k]->Print(figPath+"img_pfele_res_"+s_ptrange+"eta.png","png"); 2190 2144 2191 } 2145 2192 … … 2154 2201 TLegend *leg_pfpi_res_eta[n_ptbins]; 2155 2202 2156 TGraphErrors *gr_pfpi_res_e = new TGraphErrors[n_etabins];2157 TGraphErrors *gr_pfpi_res_eta = new TGraphErrors[n_ptbins];2158 2159 TGraphErrors *gr_trkpi_res_e = new TGraphErrors[n_etabins];2203 TGraphErrors *gr_pfpi_res_e = new TGraphErrors[n_etabins]; 2204 TGraphErrors *gr_pfpi_res_eta = new TGraphErrors[n_ptbins]; 2205 2206 TGraphErrors *gr_trkpi_res_e = new TGraphErrors[n_etabins]; 2160 2207 TGraphErrors *gr_trkpi_res_eeta = new TGraphErrors[n_ptbins]; 2161 2208 2162 std::vector<resolPlot> *plots_pfpi_res_e = new std::vector<resolPlot>[n_etabins];2163 std::vector<resolPlot> *plots_pfpi_res_eta = new std::vector<resolPlot>[n_ptbins];2164 std::vector<resolPlot> *plots_trkpi_res_e = new std::vector<resolPlot>[n_etabins];2209 std::vector<resolPlot> *plots_pfpi_res_e = new std::vector<resolPlot>[n_etabins]; 2210 std::vector<resolPlot> *plots_pfpi_res_eta = new std::vector<resolPlot>[n_ptbins]; 2211 std::vector<resolPlot> *plots_trkpi_res_e = new std::vector<resolPlot>[n_etabins]; 2165 2212 std::vector<resolPlot> *plots_trkpi_res_eeta = new std::vector<resolPlot>[n_ptbins]; 2166 2213 … … 2168 2215 TCanvas *c_pfpi_res_eta[n_ptbins]; 2169 2216 2217 2170 2218 // loop over eta bins 2171 for(k = 0; k < etaVals.size() - 1; k++) 2172 { 2173 mg_pfpi_res_e[k] = new TMultiGraph("", ""); 2174 leg_pfpi_res_e[k] = new TLegend(0.40, 0.60, 0.75, 0.90); 2175 2176 HistogramsCollection(&plots_pfpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfpi"); 2177 GetEres<Track>(&plots_pfpi_res_e[k], branchPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k + 1), treeReaderPion); 2178 gr_pfpi_res_e[k] = EresGraph(&plots_pfpi_res_e[k]); 2179 2180 HistogramsCollection(&plots_trkpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi"); 2181 GetEres<Track>(&plots_trkpi_res_e[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k + 1), treeReaderPion); 2182 gr_trkpi_res_e[k] = EresGraph(&plots_trkpi_res_e[k]); 2183 2184 s_etaMin = Form("%.1f", etaVals.at(k)); 2185 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2186 s_eta = "#pi^{ #pm}, " + s_etaMin + " < | #eta | < " + s_etaMax; 2187 2188 leg_pfpi_res_e[k]->SetTextFont(132); 2189 leg_pfpi_res_e[k]->SetHeader(s_eta); 2190 2191 addResoGraph(mg_pfpi_res_e[k], &gr_hcal_res_e[k], leg_pfpi_res_e[k], markerStyles.at(0), colors.at(0), "HCAL"); 2192 addResoGraph(mg_pfpi_res_e[k], &gr_trkpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(1), colors.at(1), "Track"); 2193 addResoGraph(mg_pfpi_res_e[k], &gr_pfpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2194 2195 c_pfpi_res_e[k] = new TCanvas("", "", 800, 600); 2196 2197 mg_pfpi_res_e[k]->Draw("APE"); 2198 //DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2199 DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 50, "E [GeV]", "(resolution in E)/E (%)", true, false); 2200 leg_pfpi_res_e[k]->Draw(); 2201 pave->Draw(); 2202 2203 TString s_etarange = "eta_" + s_etaMin + "_" + s_etaMax + "_"; 2204 2205 c_pfpi_res_e[k]->Print(pdfOutput, "pdf"); 2206 c_pfpi_res_e[k]->Print(figPath + "img_pfpi_res_" + s_etarange + "e.pdf", "pdf"); 2207 c_pfpi_res_e[k]->Print(figPath + "img_pfpi_res_" + s_etarange + "e.png", "png"); 2208 } 2209 2210 // loop over eta bins 2211 for(k = 0; k < ptVals.size(); k++) 2212 { 2213 2214 mg_pfpi_res_eta[k] = new TMultiGraph("", ""); 2215 leg_pfpi_res_eta[k] = new TLegend(0.40, 0.60, 0.75, 0.90); 2216 2217 HistogramsCollectionVsEta(&plots_pfpi_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "pfpi", 0.0, 2.0); 2218 GetEresVsEta<Track>(&plots_pfpi_res_eta[k], branchPion, branchParticlePion, 211, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderPion); 2219 gr_pfpi_res_eta[k] = EresGraphVsEta(&plots_pfpi_res_eta[k]); 2220 2221 HistogramsCollectionVsEta(&plots_trkpi_res_eeta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "trkpi", 0.0, 2.0); 2222 GetEresVsEta<Track>(&plots_trkpi_res_eeta[k], branchPion, branchParticlePion, 211, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), treeReaderPion); 2223 gr_trkpi_res_eeta[k] = EresGraphVsEta(&plots_trkpi_res_eeta[k]); 2224 2225 s_e = Form("#pi^{ #pm}, E = %.0f GeV", ptVals.at(k)); 2226 if(ptVals.at(k) >= 1000.) s_e = Form("#pi^{ #pm}, E = %.0f TeV", ptVals.at(k) / 1000.); 2227 2228 leg_pfpi_res_eta[k]->SetTextFont(132); 2229 leg_pfpi_res_eta[k]->SetHeader(s_e); 2230 2231 addResoGraph(mg_pfpi_res_eta[k], &gr_hcal_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(0), colors.at(0), "HCAL"); 2232 addResoGraph(mg_pfpi_res_eta[k], &gr_trkpi_res_eeta[k], leg_pfpi_res_eta[k], markerStyles.at(1), colors.at(1), "Track"); 2233 addResoGraph(mg_pfpi_res_eta[k], &gr_pfpi_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2234 2235 c_pfpi_res_eta[k] = new TCanvas("", "", 800, 600); 2236 2237 mg_pfpi_res_eta[k]->Draw("APE"); 2238 //DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2239 DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2240 leg_pfpi_res_eta[k]->Draw(); 2241 pave->Draw(); 2242 2243 TString s_ptrange = Form("pt_%.0f_", ptVals.at(k)); 2244 2245 c_pfpi_res_eta[k]->Print(pdfOutput, "pdf"); 2246 c_pfpi_res_eta[k]->Print(figPath + "img_pfpi_res_" + s_ptrange + "eta.pdf", "pdf"); 2247 c_pfpi_res_eta[k]->Print(figPath + "img_pfpi_res_" + s_ptrange + "eta.png", "png"); 2248 } 2219 for (k = 0; k < etaVals.size()-1; k++) 2220 { 2221 mg_pfpi_res_e[k] = new TMultiGraph("",""); 2222 leg_pfpi_res_e[k] = new TLegend(0.40,0.60,0.75,0.90); 2223 2224 HistogramsCollection(&plots_pfpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfpi"); 2225 GetEres<Track>(&plots_pfpi_res_e[k], branchPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion); 2226 gr_pfpi_res_e[k] = EresGraph(&plots_pfpi_res_e[k]); 2227 2228 HistogramsCollection(&plots_trkpi_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "trkpi"); 2229 GetEres<Track>(&plots_trkpi_res_e[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion); 2230 gr_trkpi_res_e[k] = EresGraph(&plots_trkpi_res_e[k]); 2231 2232 2233 s_etaMin = Form("%.1f",etaVals.at(k)); 2234 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2235 s_eta = "#pi^{ #pm}, "+ s_etaMin + " < | #eta | < " + s_etaMax; 2236 2237 leg_pfpi_res_e[k]->SetTextFont(132); 2238 leg_pfpi_res_e[k]->SetHeader(s_eta); 2239 2240 addResoGraph(mg_pfpi_res_e[k], &gr_hcal_res_e[k], leg_pfpi_res_e[k], markerStyles.at(0), colors.at(0), "HCAL"); 2241 addResoGraph(mg_pfpi_res_e[k], &gr_trkpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(1), colors.at(1), "Track"); 2242 addResoGraph(mg_pfpi_res_e[k], &gr_pfpi_res_e[k], leg_pfpi_res_e[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2243 2244 c_pfpi_res_e[k] = new TCanvas("","", 800, 600); 2245 2246 mg_pfpi_res_e[k]->Draw("APE"); 2247 //DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2248 DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 50, "E [GeV]", "(resolution in E)/E (%)", true, false); 2249 leg_pfpi_res_e[k]->Draw(); 2250 pave->Draw(); 2251 2252 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_"; 2253 2254 c_pfpi_res_e[k]->Print(pdfOutput,"pdf"); 2255 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.pdf","pdf"); 2256 c_pfpi_res_e[k]->Print(figPath+"img_pfpi_res_"+s_etarange+"e.png","png"); 2257 2258 } 2259 2260 2261 // loop over eta bins 2262 for (k = 0; k < ptVals.size(); k++) 2263 { 2264 2265 mg_pfpi_res_eta[k] = new TMultiGraph("",""); 2266 leg_pfpi_res_eta[k] = new TLegend(0.40,0.60,0.75,0.90); 2267 2268 HistogramsCollectionVsEta(&plots_pfpi_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfpi", 0.0, 2.0); 2269 GetEresVsEta<Track>(&plots_pfpi_res_eta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion); 2270 gr_pfpi_res_eta[k] = EresGraphVsEta(&plots_pfpi_res_eta[k]); 2271 2272 HistogramsCollectionVsEta(&plots_trkpi_res_eeta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "trkpi", 0.0, 2.0); 2273 GetEresVsEta<Track>(&plots_trkpi_res_eeta[k], branchPion, branchParticlePion, 211, 0.5*ptVals.at(k), 2.0*ptVals.at(k), treeReaderPion); 2274 gr_trkpi_res_eeta[k] = EresGraphVsEta(&plots_trkpi_res_eeta[k]); 2275 2276 2277 s_e = Form("#pi^{ #pm}, E = %.0f GeV",ptVals.at(k)); 2278 if(ptVals.at(k) >= 1000.) s_e = Form("#pi^{ #pm}, E = %.0f TeV",ptVals.at(k)/1000.); 2279 2280 leg_pfpi_res_eta[k]->SetTextFont(132); 2281 leg_pfpi_res_eta[k]->SetHeader(s_e); 2282 2283 addResoGraph(mg_pfpi_res_eta[k], &gr_hcal_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(0), colors.at(0), "HCAL"); 2284 addResoGraph(mg_pfpi_res_eta[k], &gr_trkpi_res_eeta[k], leg_pfpi_res_eta[k], markerStyles.at(1), colors.at(1), "Track"); 2285 addResoGraph(mg_pfpi_res_eta[k], &gr_pfpi_res_eta[k], leg_pfpi_res_eta[k], markerStyles.at(2), colors.at(2), "Particle-flow"); 2286 2287 c_pfpi_res_eta[k] = new TCanvas("","", 800, 600); 2288 2289 mg_pfpi_res_eta[k]->Draw("APE"); 2290 //DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2291 DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2292 leg_pfpi_res_eta[k]->Draw(); 2293 pave->Draw(); 2294 2295 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k)); 2296 2297 c_pfpi_res_eta[k]->Print(pdfOutput,"pdf"); 2298 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.pdf","pdf"); 2299 c_pfpi_res_eta[k]->Print(figPath+"img_pfpi_res_"+s_ptrange+"eta.png","png"); 2300 2301 } 2302 2249 2303 2250 2304 ///////////////// … … 2258 2312 TLegend *leg_pfjet_res_eta[n_ptbins]; 2259 2313 2260 TGraphErrors *gr_pfjet_res_e = new TGraphErrors[n_etabins];2314 TGraphErrors *gr_pfjet_res_e = new TGraphErrors[n_etabins]; 2261 2315 TGraphErrors *gr_pfjet_res_eta = new TGraphErrors[n_ptbins]; 2262 2316 2263 TGraphErrors *gr_cajet_res_e = new TGraphErrors[n_etabins];2317 TGraphErrors *gr_cajet_res_e = new TGraphErrors[n_etabins]; 2264 2318 TGraphErrors *gr_cajet_res_eta = new TGraphErrors[n_ptbins]; 2265 2319 2266 std::vector<resolPlot> *plots_pfjet_res_e = new std::vector<resolPlot>[n_etabins];2320 std::vector<resolPlot> *plots_pfjet_res_e = new std::vector<resolPlot>[n_etabins]; 2267 2321 std::vector<resolPlot> *plots_pfjet_res_eta = new std::vector<resolPlot>[n_ptbins]; 2268 std::vector<resolPlot> *plots_cajet_res_e = new std::vector<resolPlot>[n_etabins];2322 std::vector<resolPlot> *plots_cajet_res_e = new std::vector<resolPlot>[n_etabins]; 2269 2323 std::vector<resolPlot> *plots_cajet_res_eta = new std::vector<resolPlot>[n_ptbins]; 2270 2324 … … 2272 2326 TCanvas *c_pfjet_res_eta[n_ptbins]; 2273 2327 2328 2274 2329 // loop over eta bins 2275 for(k = 0; k < etaVals.size() - 1; k++) 2276 { 2277 2278 mg_pfjet_res_e[k] = new TMultiGraph("", ""); 2279 leg_pfjet_res_e[k] = new TLegend(0.40, 0.70, 0.90, 0.90); 2280 2281 HistogramsCollection(&plots_pfjet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfjet"); 2282 HistogramsCollection(&plots_cajet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "cajet"); 2283 2284 GetJetsEres(&plots_pfjet_res_e[k], branchPFJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k + 1)); 2285 GetJetsEres(&plots_cajet_res_e[k], branchCaloJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k + 1)); 2286 2287 gr_pfjet_res_e[k] = EresGraph(&plots_pfjet_res_e[k]); 2288 gr_cajet_res_e[k] = EresGraph(&plots_cajet_res_e[k]); 2289 2290 s_etaMin = Form("%.1f", etaVals.at(k)); 2291 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2292 s_eta = "anti-k_{T}, R = 0.4, " + s_etaMin + " < | #eta | < " + s_etaMax; 2293 2294 leg_pfjet_res_e[k]->SetTextFont(132); 2295 leg_pfjet_res_e[k]->SetHeader(s_eta); 2296 2297 addResoGraph(mg_pfjet_res_e[k], &gr_cajet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets"); 2298 addResoGraph(mg_pfjet_res_e[k], &gr_pfjet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets"); 2299 2300 c_pfjet_res_e[k] = new TCanvas("", "", 800, 600); 2301 2302 mg_pfjet_res_e[k]->Draw("APE"); 2303 //DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.5, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2304 DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.0, 30, "E [GeV]", "(resolution in E)/E (%)", true, false); 2305 leg_pfjet_res_e[k]->Draw(); 2330 for (k = 0; k < etaVals.size()-1; k++) 2331 { 2332 2333 mg_pfjet_res_e[k] = new TMultiGraph("",""); 2334 leg_pfjet_res_e[k] = new TLegend(0.40,0.70,0.90,0.90); 2335 2336 HistogramsCollection(&plots_pfjet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "pfjet"); 2337 HistogramsCollection(&plots_cajet_res_e[k], TMath::Log10(ptMin), TMath::Log10(ptMax), "cajet"); 2338 2339 GetJetsEres(&plots_pfjet_res_e[k], branchPFJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1)); 2340 GetJetsEres(&plots_cajet_res_e[k], branchCaloJet, branchGenJet, treeReaderJet, etaVals.at(k), etaVals.at(k+1)); 2341 2342 gr_pfjet_res_e[k] = EresGraph(&plots_pfjet_res_e[k]); 2343 gr_cajet_res_e[k] = EresGraph(&plots_cajet_res_e[k]); 2344 2345 s_etaMin = Form("%.1f",etaVals.at(k)); 2346 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2347 s_eta = "anti-k_{T}, R = 0.4, "+ s_etaMin + " < | #eta | < " + s_etaMax; 2348 2349 leg_pfjet_res_e[k]->SetTextFont(132); 2350 leg_pfjet_res_e[k]->SetHeader(s_eta); 2351 2352 addResoGraph(mg_pfjet_res_e[k], &gr_cajet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets"); 2353 addResoGraph(mg_pfjet_res_e[k], &gr_pfjet_res_e[k], leg_pfjet_res_e[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets"); 2354 2355 c_pfjet_res_e[k] = new TCanvas("","", 800, 600); 2356 2357 mg_pfjet_res_e[k]->Draw("APE"); 2358 //DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.5, 100, "E [GeV]", "(resolution in E)/E (%)", true, true); 2359 DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.0, 30, "E [GeV]", "(resolution in E)/E (%)", true, false); 2360 leg_pfjet_res_e[k]->Draw(); 2361 pave->Draw(); 2362 2363 TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_"; 2364 2365 c_pfjet_res_e[k]->Print(pdfOutput,"pdf"); 2366 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.pdf","pdf"); 2367 c_pfjet_res_e[k]->Print(figPath+"img_pfjet_res_"+s_etarange+"e.png","png"); 2368 2369 } 2370 2371 2372 // loop over eta bins 2373 for (k = 0; k < ptVals.size(); k++) 2374 { 2375 2376 mg_pfjet_res_eta[k] = new TMultiGraph("",""); 2377 leg_pfjet_res_eta[k] = new TLegend(0.30,0.70,0.85,0.90); 2378 2379 HistogramsCollectionVsEta(&plots_pfjet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "pfjet", 0.0, 2.0); 2380 HistogramsCollectionVsEta(&plots_cajet_res_eta[k], etaMin, etaMax, 0.5*ptVals.at(k), 2.0*ptVals.at(k), "cajet", 0.0, 2.0); 2381 2382 GetJetsEresVsEta(&plots_pfjet_res_eta[k], branchPFJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k)); 2383 GetJetsEresVsEta(&plots_cajet_res_eta[k], branchCaloJet, branchGenJet, treeReaderJet, 0.5*ptVals.at(k), 2.0*ptVals.at(k)); 2384 2385 gr_pfjet_res_eta[k] = EresGraphVsEta(&plots_pfjet_res_eta[k]); 2386 gr_cajet_res_eta[k] = EresGraphVsEta(&plots_cajet_res_eta[k]); 2387 2388 s_e = Form("anti-k_{T}, R = 0.4, jets, E = %.0f GeV",ptVals.at(k)); 2389 if(ptVals.at(k) >= 1000.) s_e = Form("anti-k_{T}, R = 0.4, E = %.0f TeV",ptVals.at(k)/1000.); 2390 2391 leg_pfjet_res_eta[k]->SetTextFont(132); 2392 leg_pfjet_res_eta[k]->SetHeader(s_e); 2393 2394 addResoGraph(mg_pfjet_res_eta[k], &gr_cajet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets"); 2395 addResoGraph(mg_pfjet_res_eta[k], &gr_pfjet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets"); 2396 2397 c_pfjet_res_eta[k] = new TCanvas("","", 800, 600); 2398 2399 mg_pfjet_res_eta[k]->Draw("APE"); 2400 //DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2401 DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2402 leg_pfjet_res_eta[k]->Draw(); 2403 pave->Draw(); 2404 2405 TString s_ptrange = Form("pt_%.0f_",ptVals.at(k)); 2406 2407 c_pfjet_res_eta[k]->Print(pdfOutput,"pdf"); 2408 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.pdf","pdf"); 2409 c_pfjet_res_eta[k]->Print(figPath+"img_pfjet_res_"+s_ptrange+"eta.png","png"); 2410 2411 } 2412 2413 2414 ///////////////////// 2415 // PF Missing ET /// 2416 ///////////////////// 2417 2418 TMultiGraph *mg_met_res_ht = new TMultiGraph("",""); 2419 TLegend *leg_met_res_ht = new TLegend(0.60,0.22,0.90,0.42); 2420 2421 std::vector<resolPlot> plots_pfmet, plots_camet; 2422 2423 HistogramsCollection(&plots_pfmet, TMath::Log10(ptMin), TMath::Log10(ptMax), "pfMET", -500, 500); 2424 HistogramsCollection(&plots_camet, TMath::Log10(ptMin), TMath::Log10(ptMax), "caMET", -500, 500); 2425 2426 GetMetres(&plots_pfmet, branchGenScalarHT, branchMet, branchPFJet, treeReaderJet); 2427 GetMetres(&plots_camet, branchGenScalarHT, branchCaloMet, branchCaloJet, treeReaderJet); 2428 2429 TGraphErrors gr_pfmet_res_ht = MetResGraph(&plots_pfmet, true); 2430 TGraphErrors gr_camet_res_ht = MetResGraph(&plots_camet, true); 2431 2432 addResoGraph(mg_met_res_ht, &gr_camet_res_ht, leg_met_res_ht, markerStyles.at(0), colors.at(0), "Calorimeter E_{T}^{miss}"); 2433 addResoGraph(mg_met_res_ht, &gr_pfmet_res_ht, leg_met_res_ht, markerStyles.at(1), colors.at(1), "Particle-flow E_{T}^{miss}"); 2434 2435 TCanvas *c_met_res_ht = new TCanvas("","", 800, 600); 2436 2437 mg_met_res_ht->Draw("APE"); 2438 DrawAxis(mg_met_res_ht, leg_met_res_ht, 1000, 100000, 0.1, 1000, " #sum p_{T} [GeV]", "resolution in E_{x,y}^{miss} [GeV]", true, true); 2439 2440 leg_met_res_ht->Draw(); 2306 2441 pave->Draw(); 2307 2308 TString s_etarange = "eta_" + s_etaMin + "_" + s_etaMax + "_"; 2309 2310 c_pfjet_res_e[k]->Print(pdfOutput, "pdf"); 2311 c_pfjet_res_e[k]->Print(figPath + "img_pfjet_res_" + s_etarange + "e.pdf", "pdf"); 2312 c_pfjet_res_e[k]->Print(figPath + "img_pfjet_res_" + s_etarange + "e.png", "png"); 2313 } 2314 2315 // loop over eta bins 2316 for(k = 0; k < ptVals.size(); k++) 2317 { 2318 2319 mg_pfjet_res_eta[k] = new TMultiGraph("", ""); 2320 leg_pfjet_res_eta[k] = new TLegend(0.30, 0.70, 0.85, 0.90); 2321 2322 HistogramsCollectionVsEta(&plots_pfjet_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "pfjet", 0.0, 2.0); 2323 HistogramsCollectionVsEta(&plots_cajet_res_eta[k], etaMin, etaMax, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), "cajet", 0.0, 2.0); 2324 2325 GetJetsEresVsEta(&plots_pfjet_res_eta[k], branchPFJet, branchGenJet, treeReaderJet, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k)); 2326 GetJetsEresVsEta(&plots_cajet_res_eta[k], branchCaloJet, branchGenJet, treeReaderJet, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k)); 2327 2328 gr_pfjet_res_eta[k] = EresGraphVsEta(&plots_pfjet_res_eta[k]); 2329 gr_cajet_res_eta[k] = EresGraphVsEta(&plots_cajet_res_eta[k]); 2330 2331 s_e = Form("anti-k_{T}, R = 0.4, jets, E = %.0f GeV", ptVals.at(k)); 2332 if(ptVals.at(k) >= 1000.) s_e = Form("anti-k_{T}, R = 0.4, E = %.0f TeV", ptVals.at(k) / 1000.); 2333 2334 leg_pfjet_res_eta[k]->SetTextFont(132); 2335 leg_pfjet_res_eta[k]->SetHeader(s_e); 2336 2337 addResoGraph(mg_pfjet_res_eta[k], &gr_cajet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(0), colors.at(0), "Calorimeter Jets"); 2338 addResoGraph(mg_pfjet_res_eta[k], &gr_pfjet_res_eta[k], leg_pfjet_res_eta[k], markerStyles.at(1), colors.at(1), "Particle-flow Jets"); 2339 2340 c_pfjet_res_eta[k] = new TCanvas("", "", 800, 600); 2341 2342 mg_pfjet_res_eta[k]->Draw("APE"); 2343 //DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.1, 1000, "#eta", "(resolution in E)/E (%)", false, true); 2344 DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false); 2345 leg_pfjet_res_eta[k]->Draw(); 2442 c_met_res_ht->Print(pdfOutput,"pdf"); 2443 c_met_res_ht->Print(figPath+"img_met_res_ht.pdf","pdf"); 2444 c_met_res_ht->Print(figPath+"img_met_res_ht.png","png"); 2445 2446 2447 ///////////////////////////////////////// 2448 // Electron Reconstruction Efficiency /// 2449 ///////////////////////////////////////// 2450 2451 TMultiGraph *mg_recele_eff_pt = new TMultiGraph("",""); 2452 TMultiGraph *mg_recele_eff_eta = new TMultiGraph("",""); 2453 2454 TLegend *leg_recele_eff_pt = new TLegend(0.55,0.22,0.90,0.48); 2455 TLegend *leg_recele_eff_eta = new TLegend(0.55,0.22,0.90,0.48); 2456 2457 TGraphErrors *gr_recele_eff_pt = new TGraphErrors[n_etabins]; 2458 TGraphErrors *gr_recele_eff_eta = new TGraphErrors[n_ptbins]; 2459 TH1D* h_recele_eff_pt, *h_recele_eff_eta; 2460 2461 // loop over eta bins 2462 for (k = 0; k < etaVals.size()-1; k++) 2463 { 2464 2465 h_recele_eff_pt = GetEffPt<Electron>(branchElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron); 2466 gr_recele_eff_pt[k] = TGraphErrors(h_recele_eff_pt); 2467 2468 s_etaMin = Form("%.1f",etaVals.at(k)); 2469 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2470 2471 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax; 2472 2473 gr_recele_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2474 2475 addResoGraph(mg_recele_eff_pt, &gr_recele_eff_pt[k], leg_recele_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2476 } 2477 2478 // loop over pt 2479 for (k = 0; k < ptVals.size(); k++) 2480 { 2481 h_recele_eff_eta = GetEffEta<Electron>(branchElectron, branchParticleElectron, "Electron", 11, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderElectron); 2482 gr_recele_eff_eta[k] = TGraphErrors(h_recele_eff_eta); 2483 2484 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k)); 2485 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2486 2487 addResoGraph(mg_recele_eff_eta, &gr_recele_eff_eta[k], leg_recele_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 2488 } 2489 2490 TCanvas *c_recele_eff_pt = new TCanvas("","", 800, 600); 2491 2492 mg_recele_eff_pt->Draw("APE"); 2493 DrawAxis(mg_recele_eff_pt, leg_recele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2494 leg_recele_eff_pt->Draw(); 2346 2495 pave->Draw(); 2347 2496 2348 TString s_ptrange = Form("pt_%.0f_", ptVals.at(k)); 2349 2350 c_pfjet_res_eta[k]->Print(pdfOutput, "pdf"); 2351 c_pfjet_res_eta[k]->Print(figPath + "img_pfjet_res_" + s_ptrange + "eta.pdf", "pdf"); 2352 c_pfjet_res_eta[k]->Print(figPath + "img_pfjet_res_" + s_ptrange + "eta.png", "png"); 2353 } 2354 2355 ///////////////////// 2356 // PF Missing ET /// 2357 ///////////////////// 2358 2359 TMultiGraph *mg_met_res_ht = new TMultiGraph("", ""); 2360 TLegend *leg_met_res_ht = new TLegend(0.60, 0.22, 0.90, 0.42); 2361 2362 std::vector<resolPlot> plots_pfmet, plots_camet; 2363 2364 HistogramsCollection(&plots_pfmet, TMath::Log10(ptMin), TMath::Log10(ptMax), "pfMET", -500, 500); 2365 HistogramsCollection(&plots_camet, TMath::Log10(ptMin), TMath::Log10(ptMax), "caMET", -500, 500); 2366 2367 GetMetres(&plots_pfmet, branchGenScalarHT, branchMet, branchPFJet, treeReaderJet); 2368 GetMetres(&plots_camet, branchGenScalarHT, branchCaloMet, branchCaloJet, treeReaderJet); 2369 2370 TGraphErrors gr_pfmet_res_ht = MetResGraph(&plots_pfmet, true); 2371 TGraphErrors gr_camet_res_ht = MetResGraph(&plots_camet, true); 2372 2373 addResoGraph(mg_met_res_ht, &gr_camet_res_ht, leg_met_res_ht, markerStyles.at(0), colors.at(0), "Calorimeter E_{T}^{miss}"); 2374 addResoGraph(mg_met_res_ht, &gr_pfmet_res_ht, leg_met_res_ht, markerStyles.at(1), colors.at(1), "Particle-flow E_{T}^{miss}"); 2375 2376 TCanvas *c_met_res_ht = new TCanvas("", "", 800, 600); 2377 2378 mg_met_res_ht->Draw("APE"); 2379 DrawAxis(mg_met_res_ht, leg_met_res_ht, 1000, 100000, 0.1, 1000, " #sum p_{T} [GeV]", "resolution in E_{x,y}^{miss} [GeV]", true, true); 2380 2381 leg_met_res_ht->Draw(); 2382 pave->Draw(); 2383 c_met_res_ht->Print(pdfOutput, "pdf"); 2384 c_met_res_ht->Print(figPath + "img_met_res_ht.pdf", "pdf"); 2385 c_met_res_ht->Print(figPath + "img_met_res_ht.png", "png"); 2386 2387 ///////////////////////////////////////// 2388 // Electron Reconstruction Efficiency /// 2389 ///////////////////////////////////////// 2390 2391 TMultiGraph *mg_recele_eff_pt = new TMultiGraph("", ""); 2392 TMultiGraph *mg_recele_eff_eta = new TMultiGraph("", ""); 2393 2394 TLegend *leg_recele_eff_pt = new TLegend(0.55, 0.22, 0.90, 0.48); 2395 TLegend *leg_recele_eff_eta = new TLegend(0.55, 0.22, 0.90, 0.48); 2396 2397 TGraphErrors *gr_recele_eff_pt = new TGraphErrors[n_etabins]; 2398 TGraphErrors *gr_recele_eff_eta = new TGraphErrors[n_ptbins]; 2399 TH1D *h_recele_eff_pt, *h_recele_eff_eta; 2400 2401 // loop over eta bins 2402 for(k = 0; k < etaVals.size() - 1; k++) 2403 { 2404 2405 h_recele_eff_pt = GetEffPt<Electron>(branchElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderElectron); 2406 gr_recele_eff_pt[k] = TGraphErrors(h_recele_eff_pt); 2407 2408 s_etaMin = Form("%.1f", etaVals.at(k)); 2409 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2410 2411 s_eta = "e^{ #pm} , " + s_etaMin + " < | #eta | < " + s_etaMax; 2412 2413 gr_recele_eff_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2414 2415 addResoGraph(mg_recele_eff_pt, &gr_recele_eff_pt[k], leg_recele_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2416 } 2417 2418 // loop over pt 2419 for(k = 0; k < ptVals.size(); k++) 2420 { 2421 h_recele_eff_eta = GetEffEta<Electron>(branchElectron, branchParticleElectron, "Electron", 11, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderElectron); 2422 gr_recele_eff_eta[k] = TGraphErrors(h_recele_eff_eta); 2423 2424 s_pt = Form("e^{ #pm} , p_{T} = %.0f GeV", ptVals.at(k)); 2425 if(ptVals.at(k) >= 1000.) s_pt = Form("e^{ #pm} , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2426 2427 addResoGraph(mg_recele_eff_eta, &gr_recele_eff_eta[k], leg_recele_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 2428 } 2429 2430 TCanvas *c_recele_eff_pt = new TCanvas("", "", 800, 600); 2431 2432 mg_recele_eff_pt->Draw("APE"); 2433 DrawAxis(mg_recele_eff_pt, leg_recele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2434 leg_recele_eff_pt->Draw(); 2435 pave->Draw(); 2436 2437 c_recele_eff_pt->Print(pdfOutput, "pdf"); 2438 c_recele_eff_pt->Print(figPath + "img_recele_eff_pt.pdf", "pdf"); 2439 c_recele_eff_pt->Print(figPath + "img_recele_eff_pt.png", "png"); 2440 2441 TCanvas *c_recele_eff_eta = new TCanvas("", "", 800, 600); 2442 2443 mg_recele_eff_eta->Draw("APE"); 2444 DrawAxis(mg_recele_eff_eta, leg_recele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2445 leg_recele_eff_eta->Draw(); 2446 pave->Draw(); 2447 2448 c_recele_eff_eta->Print(pdfOutput, "pdf"); 2449 c_recele_eff_eta->Print(figPath + "img_recele_eff_eta.pdf", "pdf"); 2450 c_recele_eff_eta->Print(figPath + "img_recele_eff_eta.png", "png"); 2451 2452 ///////////////////////////////////////// 2453 // Muon Reconstruction Efficiency /// 2454 ///////////////////////////////////////// 2455 2456 TMultiGraph *mg_recmu_eff_pt = new TMultiGraph("", ""); 2457 TMultiGraph *mg_recmu_eff_eta = new TMultiGraph("", ""); 2458 2459 TLegend *leg_recmu_eff_pt = new TLegend(0.55, 0.22, 0.90, 0.48); 2460 TLegend *leg_recmu_eff_eta = new TLegend(0.55, 0.22, 0.90, 0.48); 2461 2462 TGraphErrors *gr_recmu_eff_pt = new TGraphErrors[n_etabins]; 2463 TGraphErrors *gr_recmu_eff_eta = new TGraphErrors[n_ptbins]; 2464 TH1D *h_recmu_eff_pt, *h_recmu_eff_eta; 2465 2466 // loop over eta bins 2467 for(k = 0; k < etaVals.size() - 1; k++) 2468 { 2469 2470 h_recmu_eff_pt = GetEffPt<Muon>(branchMuon, branchParticleMuon, "muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderMuon); 2471 gr_recmu_eff_pt[k] = TGraphErrors(h_recmu_eff_pt); 2472 2473 s_etaMin = Form("%.1f", etaVals.at(k)); 2474 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2475 2476 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < " + s_etaMax; 2477 2478 gr_recmu_eff_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2479 2480 addResoGraph(mg_recmu_eff_pt, &gr_recmu_eff_pt[k], leg_recmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2481 } 2482 2483 // loop over pt 2484 for(k = 0; k < ptVals.size(); k++) 2485 { 2486 h_recmu_eff_eta = GetEffEta<Muon>(branchMuon, branchParticleMuon, "muon", 13, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderMuon); 2487 gr_recmu_eff_eta[k] = TGraphErrors(h_recmu_eff_eta); 2488 2489 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV", ptVals.at(k)); 2490 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2491 2492 addResoGraph(mg_recmu_eff_eta, &gr_recmu_eff_eta[k], leg_recmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 2493 } 2494 2495 TCanvas *c_recmu_eff_pt = new TCanvas("", "", 800, 600); 2496 2497 mg_recmu_eff_pt->Draw("APE"); 2498 DrawAxis(mg_recmu_eff_pt, leg_recmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2499 leg_recmu_eff_pt->Draw(); 2500 pave->Draw(); 2501 2502 c_recmu_eff_pt->Print(pdfOutput, "pdf"); 2503 c_recmu_eff_pt->Print(figPath + "img_recmu_eff_pt.pdf", "pdf"); 2504 c_recmu_eff_pt->Print(figPath + "img_recmu_eff_pt.png", "png"); 2505 2506 TCanvas *c_recmu_eff_eta = new TCanvas("", "", 800, 600); 2507 2508 mg_recmu_eff_eta->Draw("APE"); 2509 DrawAxis(mg_recmu_eff_eta, leg_recmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2510 leg_recmu_eff_eta->Draw(); 2511 pave->Draw(); 2512 2513 c_recmu_eff_eta->Print(pdfOutput, "pdf"); 2514 c_recmu_eff_eta->Print(figPath + "img_recmu_eff_eta.pdf", "pdf"); 2515 c_recmu_eff_eta->Print(figPath + "img_recmu_eff_eta.png", "png"); 2516 2517 ///////////////////////////////////////// 2518 // Photon Reconstruction Efficiency /// 2519 ///////////////////////////////////////// 2520 2521 TMultiGraph *mg_recpho_eff_pt = new TMultiGraph("", ""); 2522 TMultiGraph *mg_recpho_eff_eta = new TMultiGraph("", ""); 2523 2524 TLegend *leg_recpho_eff_pt = new TLegend(0.55, 0.22, 0.90, 0.48); 2525 TLegend *leg_recpho_eff_eta = new TLegend(0.55, 0.22, 0.90, 0.48); 2526 2527 TGraphErrors *gr_recpho_eff_pt = new TGraphErrors[n_etabins]; 2528 TGraphErrors *gr_recpho_eff_eta = new TGraphErrors[n_ptbins]; 2529 TH1D *h_recpho_eff_pt, *h_recpho_eff_eta; 2530 2531 // loop over eta bins 2532 for(k = 0; k < etaVals.size() - 1; k++) 2533 { 2534 2535 h_recpho_eff_pt = GetEffPt<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderPhoton); 2536 gr_recpho_eff_pt[k] = TGraphErrors(h_recpho_eff_pt); 2537 2538 s_etaMin = Form("%.1f", etaVals.at(k)); 2539 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2540 2541 s_eta = "#gamma , " + s_etaMin + " < | #eta | < " + s_etaMax; 2542 2543 gr_recpho_eff_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2544 2545 addResoGraph(mg_recpho_eff_pt, &gr_recpho_eff_pt[k], leg_recpho_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2546 } 2547 2548 // loop over pt 2549 for(k = 0; k < ptVals.size(); k++) 2550 { 2551 h_recpho_eff_eta = GetEffEta<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderPhoton); 2552 gr_recpho_eff_eta[k] = TGraphErrors(h_recpho_eff_eta); 2553 2554 s_pt = Form("#gamma , p_{T} = %.0f GeV", ptVals.at(k)); 2555 if(ptVals.at(k) >= 1000.) s_pt = Form("#gamma , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2556 2557 addResoGraph(mg_recpho_eff_eta, &gr_recpho_eff_eta[k], leg_recpho_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 2558 } 2559 2560 TCanvas *c_recpho_eff_pt = new TCanvas("", "", 800, 600); 2561 2562 mg_recpho_eff_pt->Draw("APE"); 2563 DrawAxis(mg_recpho_eff_pt, leg_recpho_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2564 leg_recpho_eff_pt->Draw(); 2565 pave->Draw(); 2566 2567 c_recpho_eff_pt->Print(pdfOutput, "pdf"); 2568 c_recpho_eff_pt->Print(figPath + "img_recpho_eff_pt.pdf", "pdf"); 2569 c_recpho_eff_pt->Print(figPath + "img_recpho_eff_pt.png", "png"); 2570 2571 TCanvas *c_recpho_eff_eta = new TCanvas("", "", 800, 600); 2572 2573 mg_recpho_eff_eta->Draw("APE"); 2574 DrawAxis(mg_recpho_eff_eta, leg_recpho_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2575 leg_recpho_eff_eta->Draw(); 2576 pave->Draw(); 2577 2578 c_recpho_eff_eta->Print(pdfOutput, "pdf"); 2579 c_recpho_eff_eta->Print(figPath + "img_recpho_eff_eta.pdf", "pdf"); 2580 c_recpho_eff_eta->Print(figPath + "img_recpho_eff_eta.png", "png"); 2581 2582 ///////////////////////////////////////// 2583 // B-jets Efficiency/ mistag rates /// 2584 ///////////////////////////////////////// 2585 2586 TMultiGraph *mg_recbjet_eff_pt = new TMultiGraph("", ""); 2587 TMultiGraph *mg_recbjet_eff_eta = new TMultiGraph("", ""); 2588 2589 TLegend *leg_recbjet_eff_pt = new TLegend(0.50, 0.22, 0.90, 0.48); 2590 TLegend *leg_recbjet_eff_eta = new TLegend(0.50, 0.22, 0.90, 0.48); 2591 2592 TGraphErrors *gr_recbjet_eff_pt = new TGraphErrors[n_etabins]; 2593 TGraphErrors *gr_recbjet_eff_eta = new TGraphErrors[n_ptbins]; 2594 TH1D *h_recbjet_eff_pt, *h_recbjet_eff_eta; 2595 2596 // loop over eta bins 2597 for(k = 0; k < etaVals.size() - 1; k++) 2598 { 2599 2600 h_recbjet_eff_pt = GetJetEffPt<Jet>(branchPFBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderBJet); 2601 //h_recbjet_eff_pt = GetEffPt<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderBJet); 2602 gr_recbjet_eff_pt[k] = TGraphErrors(h_recbjet_eff_pt); 2603 2604 s_etaMin = Form("%.1f", etaVals.at(k)); 2605 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2606 2607 s_eta = "b-jet , " + s_etaMin + " < | #eta | < " + s_etaMax; 2608 2609 gr_recbjet_eff_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2610 2611 addResoGraph(mg_recbjet_eff_pt, &gr_recbjet_eff_pt[k], leg_recbjet_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2612 } 2613 2614 // loop over pt 2615 for(k = 0; k < ptVals.size(); k++) 2616 { 2617 h_recbjet_eff_eta = GetJetEffEta<Jet>(branchPFBJet, "BJet", 5, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderBJet); 2618 //h_recbjet_eff_eta = GetEffEta<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderBJet); 2619 gr_recbjet_eff_eta[k] = TGraphErrors(h_recbjet_eff_eta); 2620 2621 s_pt = Form("b-jet , p_{T} = %.0f GeV", ptVals.at(k)); 2622 if(ptVals.at(k) >= 1000.) s_pt = Form("b-jet , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2623 2624 addResoGraph(mg_recbjet_eff_eta, &gr_recbjet_eff_eta[k], leg_recbjet_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 2625 } 2626 2627 TCanvas *c_recbjet_eff_pt = new TCanvas("", "", 800, 600); 2628 2629 mg_recbjet_eff_pt->Draw("APE"); 2630 DrawAxis(mg_recbjet_eff_pt, leg_recbjet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "b - tag efficiency (%)", true, false); 2631 leg_recbjet_eff_pt->Draw(); 2632 pave->Draw(); 2633 2634 c_recbjet_eff_pt->Print(pdfOutput, "pdf"); 2635 c_recbjet_eff_pt->Print(figPath + "img_recbjet_eff_pt.pdf", "pdf"); 2636 c_recbjet_eff_pt->Print(figPath + "img_recbjet_eff_pt.png", "png"); 2637 2638 TCanvas *c_recbjet_eff_eta = new TCanvas("", "", 800, 600); 2639 2640 mg_recbjet_eff_eta->Draw("APE"); 2641 DrawAxis(mg_recbjet_eff_eta, leg_recbjet_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "b - tag efficiency (%)", false, false); 2642 leg_recbjet_eff_eta->Draw(); 2643 pave->Draw(); 2644 2645 c_recbjet_eff_eta->Print(pdfOutput, "pdf"); 2646 c_recbjet_eff_eta->Print(figPath + "img_recbjet_eff_eta.pdf", "pdf"); 2647 c_recbjet_eff_eta->Print(figPath + "img_recbjet_eff_eta.png", "png"); 2648 2649 // ------ c - mistag ------ 2650 2651 TMultiGraph *mg_recbjet_cmis_pt = new TMultiGraph("", ""); 2652 TMultiGraph *mg_recbjet_cmis_eta = new TMultiGraph("", ""); 2653 2654 TLegend *leg_recbjet_cmis_pt = new TLegend(0.50, 0.64, 0.90, 0.90); 2655 TLegend *leg_recbjet_cmis_eta = new TLegend(0.50, 0.64, 0.90, 0.90); 2656 2657 TGraphErrors *gr_recbjet_cmis_pt = new TGraphErrors[n_etabins]; 2658 TGraphErrors *gr_recbjet_cmis_eta = new TGraphErrors[n_ptbins]; 2659 TH1D *h_recbjet_cmis_pt, *h_recbjet_cmis_eta; 2660 2661 // loop over eta bins 2662 for(k = 0; k < etaVals.size() - 1; k++) 2663 { 2664 2665 h_recbjet_cmis_pt = GetJetEffPt<Jet>(branchPFCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderCJet); 2666 //h_recbjet_cmis_pt = GetEffPt<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderCJet); 2667 gr_recbjet_cmis_pt[k] = TGraphErrors(h_recbjet_cmis_pt); 2668 2669 s_etaMin = Form("%.1f", etaVals.at(k)); 2670 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2671 2672 s_eta = "c-jet , " + s_etaMin + " < | #eta | < " + s_etaMax; 2673 2674 gr_recbjet_cmis_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2675 2676 addResoGraph(mg_recbjet_cmis_pt, &gr_recbjet_cmis_pt[k], leg_recbjet_cmis_pt, markerStyles.at(k), colors.at(k), s_eta); 2677 } 2678 2679 // loop over pt 2680 for(k = 0; k < ptVals.size(); k++) 2681 { 2682 h_recbjet_cmis_eta = GetJetEffEta<Jet>(branchPFCJet, "CJet", 4, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderCJet); 2683 //h_recbjet_cmis_eta = GetEffEta<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderCJet); 2684 gr_recbjet_cmis_eta[k] = TGraphErrors(h_recbjet_cmis_eta); 2685 2686 s_pt = Form("c-jet , p_{T} = %.0f GeV", ptVals.at(k)); 2687 if(ptVals.at(k) >= 1000.) s_pt = Form("c-jet , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2688 2689 addResoGraph(mg_recbjet_cmis_eta, &gr_recbjet_cmis_eta[k], leg_recbjet_cmis_eta, markerStyles.at(k), colors.at(k), s_pt); 2690 } 2691 2692 TCanvas *c_recbjet_cmis_pt = new TCanvas("", "", 800, 600); 2693 2694 mg_recbjet_cmis_pt->Draw("APE"); 2695 DrawAxis(mg_recbjet_cmis_pt, leg_recbjet_cmis_pt, ptMin, ptMax, 0.0, 20, "p_{T} [GeV]", "c - mistag rate (%)", true, false); 2696 leg_recbjet_cmis_pt->Draw(); 2697 pave->Draw(); 2698 2699 c_recbjet_cmis_pt->Print(pdfOutput, "pdf"); 2700 c_recbjet_cmis_pt->Print(figPath + "img_recbjet_cmis_pt.pdf", "pdf"); 2701 c_recbjet_cmis_pt->Print(figPath + "img_recbjet_cmis_pt.png", "png"); 2702 2703 TCanvas *c_recbjet_cmis_eta = new TCanvas("", "", 800, 600); 2704 2705 mg_recbjet_cmis_eta->Draw("APE"); 2706 DrawAxis(mg_recbjet_cmis_eta, leg_recbjet_cmis_eta, etaMin, etaMax, 0.0, 20, " #eta ", "c - mistag rate (%)", false, false); 2707 leg_recbjet_cmis_eta->Draw(); 2708 pave->Draw(); 2709 2710 c_recbjet_cmis_eta->Print(pdfOutput, "pdf"); 2711 c_recbjet_cmis_eta->Print(figPath + "img_recbjet_cmis_eta.pdf", "pdf"); 2712 c_recbjet_cmis_eta->Print(figPath + "img_recbjet_cmis_eta.png", "png"); 2713 2714 // ------ light - mistag ------ 2715 2716 TMultiGraph *mg_recbjet_lmis_pt = new TMultiGraph("", ""); 2717 TMultiGraph *mg_recbjet_lmis_eta = new TMultiGraph("", ""); 2718 2719 TLegend *leg_recbjet_lmis_pt = new TLegend(0.50, 0.64, 0.90, 0.90); 2720 TLegend *leg_recbjet_lmis_eta = new TLegend(0.50, 0.64, 0.90, 0.90); 2721 2722 TGraphErrors *gr_recbjet_lmis_pt = new TGraphErrors[n_etabins]; 2723 TGraphErrors *gr_recbjet_lmis_eta = new TGraphErrors[n_ptbins]; 2724 TH1D *h_recbjet_lmis_pt, *h_recbjet_lmis_eta; 2725 2726 // loop over eta bins 2727 for(k = 0; k < etaVals.size() - 1; k++) 2728 { 2729 2730 h_recbjet_lmis_pt = GetJetEffPt<Jet>(branchJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderJet); 2731 //h_recbjet_lmis_pt = GetEffPt<Jet>(branchJet, branchParticleJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet); 2732 gr_recbjet_lmis_pt[k] = TGraphErrors(h_recbjet_lmis_pt); 2733 2734 s_etaMin = Form("%.1f", etaVals.at(k)); 2735 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2736 2737 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < " + s_etaMax; 2738 2739 gr_recbjet_lmis_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2740 2741 addResoGraph(mg_recbjet_lmis_pt, &gr_recbjet_lmis_pt[k], leg_recbjet_lmis_pt, markerStyles.at(k), colors.at(k), s_eta); 2742 } 2743 2744 // loop over pt 2745 for(k = 0; k < ptVals.size(); k++) 2746 { 2747 h_recbjet_lmis_eta = GetJetEffEta<Jet>(branchJet, "Jet", 1, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderJet); 2748 //h_recbjet_lmis_eta = GetEffEta<Jet>(branchJet, branchParticleJet, "Jet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet); 2749 gr_recbjet_lmis_eta[k] = TGraphErrors(h_recbjet_lmis_eta); 2750 2751 s_pt = Form("uds-jet , p_{T} = %.0f GeV", ptVals.at(k)); 2752 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2753 2754 addResoGraph(mg_recbjet_lmis_eta, &gr_recbjet_lmis_eta[k], leg_recbjet_lmis_eta, markerStyles.at(k), colors.at(k), s_pt); 2755 } 2756 2757 TCanvas *c_recbjet_lmis_pt = new TCanvas("", "", 800, 600); 2758 2759 mg_recbjet_lmis_pt->Draw("APE"); 2760 2761 DrawAxis(mg_recbjet_lmis_pt, leg_recbjet_lmis_pt, ptMin, ptMax, 0.0, 1.0, "p_{T} [GeV]", "light - mistag rate (%)", true, false); 2762 2763 leg_recbjet_lmis_pt->Draw(); 2764 pave->Draw(); 2765 2766 c_recbjet_lmis_pt->Print(pdfOutput, "pdf"); 2767 c_recbjet_lmis_pt->Print(figPath + "img_recbjet_lmis_pt.pdf", "pdf"); 2768 c_recbjet_lmis_pt->Print(figPath + "img_recbjet_lmis_pt.png", "png"); 2769 2770 TCanvas *c_recbjet_lmis_eta = new TCanvas("", "", 800, 600); 2771 2772 mg_recbjet_lmis_eta->Draw("APE"); 2773 DrawAxis(mg_recbjet_lmis_eta, leg_recbjet_lmis_eta, etaMin, etaMax, 0.0, 1.0, " #eta ", "light - mistag rate (%)", false, false); 2774 leg_recbjet_lmis_eta->Draw(); 2775 pave->Draw(); 2776 2777 c_recbjet_lmis_eta->Print(pdfOutput, "pdf"); 2778 c_recbjet_lmis_eta->Print(figPath + "img_recbjet_lmis_eta.pdf", "pdf"); 2779 c_recbjet_lmis_eta->Print(figPath + "img_recbjet_lmis_eta.png", "png"); 2780 2781 /////////////////////////////////////////// 2782 // tau-jets Efficiency/ mistag rates /// 2783 /////////////////////////////////////////// 2784 2785 TMultiGraph *mg_rectaujet_eff_pt = new TMultiGraph("", ""); 2786 TMultiGraph *mg_rectaujet_eff_eta = new TMultiGraph("", ""); 2787 2788 TLegend *leg_rectaujet_eff_pt = new TLegend(0.50, 0.22, 0.90, 0.48); 2789 TLegend *leg_rectaujet_eff_eta = new TLegend(0.50, 0.22, 0.90, 0.48); 2790 2791 TGraphErrors *gr_rectaujet_eff_pt = new TGraphErrors[n_etabins]; 2792 TGraphErrors *gr_rectaujet_eff_eta = new TGraphErrors[n_ptbins]; 2793 TH1D *h_rectaujet_eff_pt, *h_rectaujet_eff_eta; 2794 2795 // loop over eta bins 2796 for(k = 0; k < etaVals.size() - 1; k++) 2797 { 2798 2799 h_rectaujet_eff_pt = GetTauEffPt<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderTauJet); 2800 gr_rectaujet_eff_pt[k] = TGraphErrors(h_rectaujet_eff_pt); 2801 2802 s_etaMin = Form("%.1f", etaVals.at(k)); 2803 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2804 2805 s_eta = "#tau-jet , " + s_etaMin + " < | #eta | < " + s_etaMax; 2806 2807 gr_rectaujet_eff_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2808 2809 addResoGraph(mg_rectaujet_eff_pt, &gr_rectaujet_eff_pt[k], leg_rectaujet_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2810 } 2811 2812 // loop over pt 2813 for(k = 0; k < ptVals.size(); k++) 2814 { 2815 h_rectaujet_eff_eta = GetTauEffEta<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderTauJet); 2816 gr_rectaujet_eff_eta[k] = TGraphErrors(h_rectaujet_eff_eta); 2817 2818 s_pt = Form("#tau-jet , p_{T} = %.0f GeV", ptVals.at(k)); 2819 if(ptVals.at(k) >= 1000.) s_pt = Form("#tau-jet , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2820 2821 addResoGraph(mg_rectaujet_eff_eta, &gr_rectaujet_eff_eta[k], leg_rectaujet_eff_eta, markerStyles.at(k), colors.at(k), s_pt); 2822 } 2823 2824 TCanvas *c_rectaujet_eff_pt = new TCanvas("", "", 800, 600); 2825 2826 mg_rectaujet_eff_pt->Draw("APE"); 2827 DrawAxis(mg_rectaujet_eff_pt, leg_rectaujet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "#tau - tag efficiency (%)", true, false); 2828 leg_rectaujet_eff_pt->Draw(); 2829 pave->Draw(); 2830 2831 c_rectaujet_eff_pt->Print(pdfOutput, "pdf"); 2832 c_rectaujet_eff_pt->Print(figPath + "img_rectaujet_eff_pt.pdf", "pdf"); 2833 c_rectaujet_eff_pt->Print(figPath + "img_rectaujet_eff_pt.png", "png"); 2834 2835 TCanvas *c_rectaujet_eff_eta = new TCanvas("", "", 800, 600); 2836 2837 mg_rectaujet_eff_eta->Draw("APE"); 2838 DrawAxis(mg_rectaujet_eff_eta, leg_rectaujet_eff_eta, etaMin, etaMax, 0.0, 100., " #eta ", "#tau - tag efficiency (%)", false, false); 2839 leg_rectaujet_eff_eta->Draw(); 2840 pave->Draw(); 2841 2842 c_rectaujet_eff_eta->Print(pdfOutput, "pdf"); 2843 c_rectaujet_eff_eta->Print(figPath + "img_rectaujet_eff_eta.pdf", "pdf"); 2844 c_rectaujet_eff_eta->Print(figPath + "img_rectaujet_eff_eta.png", "png"); 2845 2846 //--------------- tau mistag rate ---------- 2847 2848 TMultiGraph *mg_rectaujet_mis_pt = new TMultiGraph("", ""); 2849 TMultiGraph *mg_rectaujet_mis_eta = new TMultiGraph("", ""); 2850 2851 TLegend *leg_rectaujet_mis_pt = new TLegend(0.50, 0.64, 0.90, 0.90); 2852 TLegend *leg_rectaujet_mis_eta = new TLegend(0.50, 0.64, 0.90, 0.90); 2853 2854 TGraphErrors *gr_rectaujet_mis_pt = new TGraphErrors[n_etabins]; 2855 TGraphErrors *gr_rectaujet_mis_eta = new TGraphErrors[n_ptbins]; 2856 TH1D *h_rectaujet_mis_pt, *h_rectaujet_mis_eta; 2857 2858 // loop over eta bins 2859 for(k = 0; k < etaVals.size() - 1; k++) 2860 { 2861 2862 h_rectaujet_mis_pt = GetTauEffPt<Jet>(branchJet, branchParticleJet, "TauJet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k + 1), treeReaderJet); 2863 gr_rectaujet_mis_pt[k] = TGraphErrors(h_rectaujet_mis_pt); 2864 2865 s_etaMin = Form("%.1f", etaVals.at(k)); 2866 s_etaMax = Form("%.1f", etaVals.at(k + 1)); 2867 2868 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < " + s_etaMax; 2869 2870 gr_rectaujet_mis_pt[k].SetName("recEff_" + s_etaMin + "_" + s_etaMax); 2871 2872 addResoGraph(mg_rectaujet_mis_pt, &gr_rectaujet_mis_pt[k], leg_rectaujet_mis_pt, markerStyles.at(k), colors.at(k), s_eta); 2873 } 2874 2875 // loop over pt 2876 for(k = 0; k < ptVals.size(); k++) 2877 { 2878 h_rectaujet_mis_eta = GetTauEffEta<Jet>(branchJet, branchParticleJet, "TauJet", 1, 0.5 * ptVals.at(k), 2.0 * ptVals.at(k), etaMin, etaMax, treeReaderJet); 2879 gr_rectaujet_mis_eta[k] = TGraphErrors(h_rectaujet_mis_eta); 2880 2881 s_pt = Form("uds-jet , p_{T} = %.0f GeV", ptVals.at(k)); 2882 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV", ptVals.at(k) / 1000.); 2883 2884 addResoGraph(mg_rectaujet_mis_eta, &gr_rectaujet_mis_eta[k], leg_rectaujet_mis_eta, markerStyles.at(k), colors.at(k), s_pt); 2885 } 2886 2887 TCanvas *c_rectaujet_mis_pt = new TCanvas("", "", 800, 600); 2888 2889 mg_rectaujet_mis_pt->Draw("APE"); 2890 DrawAxis(mg_rectaujet_mis_pt, leg_rectaujet_mis_pt, ptMin, ptMax, 0.0, 5., "p_{T} [GeV]", "#tau - mistag(%)", true, false); 2891 leg_rectaujet_mis_pt->Draw(); 2892 pave->Draw(); 2893 2894 c_rectaujet_mis_pt->Print(pdfOutput, "pdf"); 2895 c_rectaujet_mis_pt->Print(figPath + "img_rectaujet_mis_pt.pdf", "pdf"); 2896 c_rectaujet_mis_pt->Print(figPath + "img_rectaujet_mis_pt.png", "png"); 2897 2898 TCanvas *c_rectaujet_mis_eta = new TCanvas("", "", 800, 600); 2899 2900 mg_rectaujet_mis_eta->Draw("APE"); 2901 DrawAxis(mg_rectaujet_mis_eta, leg_rectaujet_mis_eta, etaMin, etaMax, 0.0, 5., " #eta ", "#tau - mistag (%)", false, false); 2902 leg_rectaujet_mis_eta->Draw(); 2903 pave->Draw(); 2904 2905 c_rectaujet_mis_eta->Print(pdfOutput + ")", "pdf"); 2906 c_rectaujet_mis_eta->Print(figPath + "img_rectaujet_mis_eta.pdf", "pdf"); 2907 c_rectaujet_mis_eta->Print(figPath + "img_rectaujet_mis_eta.png", "png"); 2908 2909 // ---- store resolution histograms in the output (for leave efficiencies out) --- 2910 2911 TFile *fout = new TFile(outputFile, "recreate"); 2912 2913 for(int bin = 0; bin < Nbins; bin++) 2914 { 2915 2916 for(k = 0; k < etaVals.size() - 1; k++) 2497 c_recele_eff_pt->Print(pdfOutput,"pdf"); 2498 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.pdf","pdf"); 2499 c_recele_eff_pt->Print(figPath+"img_recele_eff_pt.png","png"); 2500 2501 TCanvas *c_recele_eff_eta = new TCanvas("","", 800, 600); 2502 2503 mg_recele_eff_eta->Draw("APE"); 2504 DrawAxis(mg_recele_eff_eta, leg_recele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2505 leg_recele_eff_eta->Draw(); 2506 pave->Draw(); 2507 2508 c_recele_eff_eta->Print(pdfOutput,"pdf"); 2509 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.pdf","pdf"); 2510 c_recele_eff_eta->Print(figPath+"img_recele_eff_eta.png","png"); 2511 2512 2513 ///////////////////////////////////////// 2514 // Muon Reconstruction Efficiency /// 2515 ///////////////////////////////////////// 2516 2517 TMultiGraph *mg_recmu_eff_pt = new TMultiGraph("",""); 2518 TMultiGraph *mg_recmu_eff_eta = new TMultiGraph("",""); 2519 2520 TLegend *leg_recmu_eff_pt = new TLegend(0.55,0.22,0.90,0.48); 2521 TLegend *leg_recmu_eff_eta = new TLegend(0.55,0.22,0.90,0.48); 2522 2523 TGraphErrors *gr_recmu_eff_pt = new TGraphErrors[n_etabins]; 2524 TGraphErrors *gr_recmu_eff_eta = new TGraphErrors[n_ptbins]; 2525 TH1D* h_recmu_eff_pt, *h_recmu_eff_eta; 2526 2527 // loop over eta bins 2528 for (k = 0; k < etaVals.size()-1; k++) 2917 2529 { 2918 plots_trkpi_res_pt[k].at(bin).resolHist->Write(); 2919 plots_trkele_res_pt[k].at(bin).resolHist->Write(); 2920 plots_trkmu_res_pt[k].at(bin).resolHist->Write(); 2921 plots_ecal_res_e[k].at(bin).resolHist->Write(); 2922 plots_hcal_res_e[k].at(bin).resolHist->Write(); 2923 plots_pfele_res_e[k].at(bin).resolHist->Write(); 2924 plots_pfpi_res_e[k].at(bin).resolHist->Write(); 2925 plots_pfjet_res_e[k].at(bin).resolHist->Write(); 2926 plots_cajet_res_e[k].at(bin).resolHist->Write(); 2530 2531 h_recmu_eff_pt = GetEffPt<Muon>(branchMuon, branchParticleMuon, "muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon); 2532 gr_recmu_eff_pt[k] = TGraphErrors(h_recmu_eff_pt); 2533 2534 s_etaMin = Form("%.1f",etaVals.at(k)); 2535 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2536 2537 s_eta = "#mu^{ #pm} , " + s_etaMin + " < | #eta | < "+s_etaMax; 2538 2539 gr_recmu_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2540 2541 addResoGraph(mg_recmu_eff_pt, &gr_recmu_eff_pt[k], leg_recmu_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2927 2542 } 2928 2543 2929 for(k = 0; k < ptVals.size(); k++) 2544 // loop over pt 2545 for (k = 0; k < ptVals.size(); k++) 2930 2546 { 2931 plots_trkpi_res_eta[k].at(bin).resolHist->Write(); 2932 plots_trkele_res_eta[k].at(bin).resolHist->Write(); 2933 plots_trkmu_res_eta[k].at(bin).resolHist->Write(); 2934 plots_ecal_res_eta[k].at(bin).resolHist->Write(); 2935 plots_hcal_res_eta[k].at(bin).resolHist->Write(); 2936 plots_pfele_res_eta[k].at(bin).resolHist->Write(); 2937 plots_pfpi_res_eta[k].at(bin).resolHist->Write(); 2938 plots_pfjet_res_eta[k].at(bin).resolHist->Write(); 2939 plots_cajet_res_eta[k].at(bin).resolHist->Write(); 2547 h_recmu_eff_eta = GetEffEta<Muon>(branchMuon, branchParticleMuon, "muon", 13, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderMuon); 2548 gr_recmu_eff_eta[k] = TGraphErrors(h_recmu_eff_eta); 2549 2550 s_pt = Form("#mu^{ #pm} , p_{T} = %.0f GeV",ptVals.at(k)); 2551 if(ptVals.at(k) >= 1000.) s_pt = Form("#mu^{ #pm} , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2552 2553 addResoGraph(mg_recmu_eff_eta, &gr_recmu_eff_eta[k], leg_recmu_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 2554 } 2555 2556 TCanvas *c_recmu_eff_pt = new TCanvas("","", 800, 600); 2557 2558 mg_recmu_eff_pt->Draw("APE"); 2559 DrawAxis(mg_recmu_eff_pt, leg_recmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2560 leg_recmu_eff_pt->Draw(); 2561 pave->Draw(); 2562 2563 c_recmu_eff_pt->Print(pdfOutput,"pdf"); 2564 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.pdf","pdf"); 2565 c_recmu_eff_pt->Print(figPath+"img_recmu_eff_pt.png","png"); 2566 2567 TCanvas *c_recmu_eff_eta = new TCanvas("","", 800, 600); 2568 2569 mg_recmu_eff_eta->Draw("APE"); 2570 DrawAxis(mg_recmu_eff_eta, leg_recmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2571 leg_recmu_eff_eta->Draw(); 2572 pave->Draw(); 2573 2574 c_recmu_eff_eta->Print(pdfOutput,"pdf"); 2575 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.pdf","pdf"); 2576 c_recmu_eff_eta->Print(figPath+"img_recmu_eff_eta.png","png"); 2577 2578 2579 ///////////////////////////////////////// 2580 // Photon Reconstruction Efficiency /// 2581 ///////////////////////////////////////// 2582 2583 TMultiGraph *mg_recpho_eff_pt = new TMultiGraph("",""); 2584 TMultiGraph *mg_recpho_eff_eta = new TMultiGraph("",""); 2585 2586 TLegend *leg_recpho_eff_pt = new TLegend(0.55,0.22,0.90,0.48); 2587 TLegend *leg_recpho_eff_eta = new TLegend(0.55,0.22,0.90,0.48); 2588 2589 TGraphErrors *gr_recpho_eff_pt = new TGraphErrors[n_etabins]; 2590 TGraphErrors *gr_recpho_eff_eta = new TGraphErrors[n_ptbins]; 2591 TH1D* h_recpho_eff_pt, *h_recpho_eff_eta; 2592 2593 // loop over eta bins 2594 for (k = 0; k < etaVals.size()-1; k++) 2595 { 2596 2597 h_recpho_eff_pt = GetEffPt<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton); 2598 gr_recpho_eff_pt[k] = TGraphErrors(h_recpho_eff_pt); 2599 2600 s_etaMin = Form("%.1f",etaVals.at(k)); 2601 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2602 2603 s_eta = "#gamma , " + s_etaMin + " < | #eta | < "+s_etaMax; 2604 2605 gr_recpho_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2606 2607 addResoGraph(mg_recpho_eff_pt, &gr_recpho_eff_pt[k], leg_recpho_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2608 } 2609 2610 // loop over pt 2611 for (k = 0; k < ptVals.size(); k++) 2612 { 2613 h_recpho_eff_eta = GetEffEta<Photon>(branchPhoton, branchParticlePhoton, "Photon", 22, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderPhoton); 2614 gr_recpho_eff_eta[k] = TGraphErrors(h_recpho_eff_eta); 2615 2616 s_pt = Form("#gamma , p_{T} = %.0f GeV",ptVals.at(k)); 2617 if(ptVals.at(k) >= 1000.) s_pt = Form("#gamma , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2618 2619 addResoGraph(mg_recpho_eff_eta, &gr_recpho_eff_eta[k], leg_recpho_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 2620 } 2621 2622 TCanvas *c_recpho_eff_pt = new TCanvas("","", 800, 600); 2623 2624 mg_recpho_eff_pt->Draw("APE"); 2625 DrawAxis(mg_recpho_eff_pt, leg_recpho_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false); 2626 leg_recpho_eff_pt->Draw(); 2627 pave->Draw(); 2628 2629 c_recpho_eff_pt->Print(pdfOutput,"pdf"); 2630 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.pdf","pdf"); 2631 c_recpho_eff_pt->Print(figPath+"img_recpho_eff_pt.png","png"); 2632 2633 TCanvas *c_recpho_eff_eta = new TCanvas("","", 800, 600); 2634 2635 mg_recpho_eff_eta->Draw("APE"); 2636 DrawAxis(mg_recpho_eff_eta, leg_recpho_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false); 2637 leg_recpho_eff_eta->Draw(); 2638 pave->Draw(); 2639 2640 c_recpho_eff_eta->Print(pdfOutput,"pdf"); 2641 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.pdf","pdf"); 2642 c_recpho_eff_eta->Print(figPath+"img_recpho_eff_eta.png","png"); 2643 2644 ///////////////////////////////////////// 2645 // B-jets Efficiency/ mistag rates /// 2646 ///////////////////////////////////////// 2647 2648 TMultiGraph *mg_recbjet_eff_pt = new TMultiGraph("",""); 2649 TMultiGraph *mg_recbjet_eff_eta = new TMultiGraph("",""); 2650 2651 TLegend *leg_recbjet_eff_pt = new TLegend(0.50,0.22,0.90,0.48); 2652 TLegend *leg_recbjet_eff_eta = new TLegend(0.50,0.22,0.90,0.48); 2653 2654 TGraphErrors *gr_recbjet_eff_pt = new TGraphErrors[n_etabins]; 2655 TGraphErrors *gr_recbjet_eff_eta = new TGraphErrors[n_ptbins]; 2656 TH1D* h_recbjet_eff_pt, *h_recbjet_eff_eta; 2657 2658 // loop over eta bins 2659 for (k = 0; k < etaVals.size()-1; k++) 2660 { 2661 2662 h_recbjet_eff_pt = GetJetEffPt<Jet>(branchPFBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderBJet); 2663 //h_recbjet_eff_pt = GetEffPt<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderBJet); 2664 gr_recbjet_eff_pt[k] = TGraphErrors(h_recbjet_eff_pt); 2665 2666 s_etaMin = Form("%.1f",etaVals.at(k)); 2667 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2668 2669 s_eta = "b-jet , " + s_etaMin + " < | #eta | < "+s_etaMax; 2670 2671 gr_recbjet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2672 2673 addResoGraph(mg_recbjet_eff_pt, &gr_recbjet_eff_pt[k], leg_recbjet_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2674 } 2675 2676 // loop over pt 2677 for (k = 0; k < ptVals.size(); k++) 2678 { 2679 h_recbjet_eff_eta = GetJetEffEta<Jet>(branchPFBJet, "BJet", 5, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderBJet); 2680 //h_recbjet_eff_eta = GetEffEta<Jet>(branchPFBJet, branchParticleBJet, "BJet", 5, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderBJet); 2681 gr_recbjet_eff_eta[k] = TGraphErrors(h_recbjet_eff_eta); 2682 2683 s_pt = Form("b-jet , p_{T} = %.0f GeV",ptVals.at(k)); 2684 if(ptVals.at(k) >= 1000.) s_pt = Form("b-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2685 2686 addResoGraph(mg_recbjet_eff_eta, &gr_recbjet_eff_eta[k], leg_recbjet_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 2687 } 2688 2689 TCanvas *c_recbjet_eff_pt = new TCanvas("","", 800, 600); 2690 2691 mg_recbjet_eff_pt->Draw("APE"); 2692 DrawAxis(mg_recbjet_eff_pt, leg_recbjet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "b - tag efficiency (%)", true, false); 2693 leg_recbjet_eff_pt->Draw(); 2694 pave->Draw(); 2695 2696 c_recbjet_eff_pt->Print(pdfOutput,"pdf"); 2697 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.pdf","pdf"); 2698 c_recbjet_eff_pt->Print(figPath+"img_recbjet_eff_pt.png","png"); 2699 2700 TCanvas *c_recbjet_eff_eta = new TCanvas("","", 800, 600); 2701 2702 mg_recbjet_eff_eta->Draw("APE"); 2703 DrawAxis(mg_recbjet_eff_eta, leg_recbjet_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "b - tag efficiency (%)", false, false); 2704 leg_recbjet_eff_eta->Draw(); 2705 pave->Draw(); 2706 2707 c_recbjet_eff_eta->Print(pdfOutput,"pdf"); 2708 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.pdf","pdf"); 2709 c_recbjet_eff_eta->Print(figPath+"img_recbjet_eff_eta.png","png"); 2710 2711 // ------ c - mistag ------ 2712 2713 TMultiGraph *mg_recbjet_cmis_pt = new TMultiGraph("",""); 2714 TMultiGraph *mg_recbjet_cmis_eta = new TMultiGraph("",""); 2715 2716 TLegend *leg_recbjet_cmis_pt = new TLegend(0.50,0.64,0.90,0.90); 2717 TLegend *leg_recbjet_cmis_eta = new TLegend(0.50,0.64,0.90,0.90); 2718 2719 TGraphErrors *gr_recbjet_cmis_pt = new TGraphErrors[n_etabins]; 2720 TGraphErrors *gr_recbjet_cmis_eta = new TGraphErrors[n_ptbins]; 2721 TH1D* h_recbjet_cmis_pt, *h_recbjet_cmis_eta; 2722 2723 // loop over eta bins 2724 for (k = 0; k < etaVals.size()-1; k++) 2725 { 2726 2727 h_recbjet_cmis_pt = GetJetEffPt<Jet>(branchPFCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderCJet); 2728 //h_recbjet_cmis_pt = GetEffPt<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderCJet); 2729 gr_recbjet_cmis_pt[k] = TGraphErrors(h_recbjet_cmis_pt); 2730 2731 s_etaMin = Form("%.1f",etaVals.at(k)); 2732 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2733 2734 s_eta = "c-jet , " + s_etaMin + " < | #eta | < "+s_etaMax; 2735 2736 gr_recbjet_cmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2737 2738 addResoGraph(mg_recbjet_cmis_pt, &gr_recbjet_cmis_pt[k], leg_recbjet_cmis_pt, markerStyles.at(k), colors.at(k), s_eta); 2739 } 2740 2741 // loop over pt 2742 for (k = 0; k < ptVals.size(); k++) 2743 { 2744 h_recbjet_cmis_eta = GetJetEffEta<Jet>(branchPFCJet, "CJet", 4, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderCJet); 2745 //h_recbjet_cmis_eta = GetEffEta<Jet>(branchPFCJet, branchParticleCJet, "CJet", 4, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderCJet); 2746 gr_recbjet_cmis_eta[k] = TGraphErrors(h_recbjet_cmis_eta); 2747 2748 s_pt = Form("c-jet , p_{T} = %.0f GeV",ptVals.at(k)); 2749 if(ptVals.at(k) >= 1000.) s_pt = Form("c-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2750 2751 addResoGraph(mg_recbjet_cmis_eta, &gr_recbjet_cmis_eta[k], leg_recbjet_cmis_eta, markerStyles.at(k), colors.at(k), s_pt ); 2752 } 2753 2754 TCanvas *c_recbjet_cmis_pt = new TCanvas("","", 800, 600); 2755 2756 mg_recbjet_cmis_pt->Draw("APE"); 2757 DrawAxis(mg_recbjet_cmis_pt, leg_recbjet_cmis_pt, ptMin, ptMax, 0.0, 20, "p_{T} [GeV]", "c - mistag rate (%)", true, false); 2758 leg_recbjet_cmis_pt->Draw(); 2759 pave->Draw(); 2760 2761 c_recbjet_cmis_pt->Print(pdfOutput,"pdf"); 2762 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.pdf","pdf"); 2763 c_recbjet_cmis_pt->Print(figPath+"img_recbjet_cmis_pt.png","png"); 2764 2765 TCanvas *c_recbjet_cmis_eta = new TCanvas("","", 800, 600); 2766 2767 mg_recbjet_cmis_eta->Draw("APE"); 2768 DrawAxis(mg_recbjet_cmis_eta, leg_recbjet_cmis_eta, etaMin, etaMax, 0.0, 20, " #eta ", "c - mistag rate (%)", false, false); 2769 leg_recbjet_cmis_eta->Draw(); 2770 pave->Draw(); 2771 2772 c_recbjet_cmis_eta->Print(pdfOutput,"pdf"); 2773 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.pdf","pdf"); 2774 c_recbjet_cmis_eta->Print(figPath+"img_recbjet_cmis_eta.png","png"); 2775 2776 // ------ light - mistag ------ 2777 2778 TMultiGraph *mg_recbjet_lmis_pt = new TMultiGraph("",""); 2779 TMultiGraph *mg_recbjet_lmis_eta = new TMultiGraph("",""); 2780 2781 TLegend *leg_recbjet_lmis_pt = new TLegend(0.50,0.64,0.90,0.90); 2782 TLegend *leg_recbjet_lmis_eta = new TLegend(0.50,0.64,0.90,0.90); 2783 2784 TGraphErrors *gr_recbjet_lmis_pt = new TGraphErrors[n_etabins]; 2785 TGraphErrors *gr_recbjet_lmis_eta = new TGraphErrors[n_ptbins]; 2786 TH1D* h_recbjet_lmis_pt, *h_recbjet_lmis_eta; 2787 2788 // loop over eta bins 2789 for (k = 0; k < etaVals.size()-1; k++) 2790 { 2791 2792 h_recbjet_lmis_pt = GetJetEffPt<Jet>(branchJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet); 2793 //h_recbjet_lmis_pt = GetEffPt<Jet>(branchJet, branchParticleJet, "Jet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet); 2794 gr_recbjet_lmis_pt[k] = TGraphErrors(h_recbjet_lmis_pt); 2795 2796 s_etaMin = Form("%.1f",etaVals.at(k)); 2797 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2798 2799 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax; 2800 2801 gr_recbjet_lmis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2802 2803 addResoGraph(mg_recbjet_lmis_pt, &gr_recbjet_lmis_pt[k], leg_recbjet_lmis_pt, markerStyles.at(k), colors.at(k), s_eta); 2804 } 2805 2806 // loop over pt 2807 for (k = 0; k < ptVals.size(); k++) 2808 { 2809 h_recbjet_lmis_eta = GetJetEffEta<Jet>(branchJet, "Jet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet); 2810 //h_recbjet_lmis_eta = GetEffEta<Jet>(branchJet, branchParticleJet, "Jet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet); 2811 gr_recbjet_lmis_eta[k] = TGraphErrors(h_recbjet_lmis_eta); 2812 2813 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k)); 2814 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2815 2816 addResoGraph(mg_recbjet_lmis_eta, &gr_recbjet_lmis_eta[k], leg_recbjet_lmis_eta, markerStyles.at(k), colors.at(k), s_pt ); 2817 } 2818 2819 TCanvas *c_recbjet_lmis_pt = new TCanvas("","", 800, 600); 2820 2821 mg_recbjet_lmis_pt->Draw("APE"); 2822 2823 DrawAxis(mg_recbjet_lmis_pt, leg_recbjet_lmis_pt, ptMin, ptMax, 0.0, 1.0, "p_{T} [GeV]", "light - mistag rate (%)", true, false); 2824 2825 leg_recbjet_lmis_pt->Draw(); 2826 pave->Draw(); 2827 2828 c_recbjet_lmis_pt->Print(pdfOutput,"pdf"); 2829 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.pdf","pdf"); 2830 c_recbjet_lmis_pt->Print(figPath+"img_recbjet_lmis_pt.png","png"); 2831 2832 TCanvas *c_recbjet_lmis_eta = new TCanvas("","", 800, 600); 2833 2834 mg_recbjet_lmis_eta->Draw("APE"); 2835 DrawAxis(mg_recbjet_lmis_eta, leg_recbjet_lmis_eta, etaMin, etaMax, 0.0, 1.0, " #eta ", "light - mistag rate (%)", false, false); 2836 leg_recbjet_lmis_eta->Draw(); 2837 pave->Draw(); 2838 2839 c_recbjet_lmis_eta->Print(pdfOutput,"pdf"); 2840 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.pdf","pdf"); 2841 c_recbjet_lmis_eta->Print(figPath+"img_recbjet_lmis_eta.png","png"); 2842 2843 2844 /////////////////////////////////////////// 2845 // tau-jets Efficiency/ mistag rates /// 2846 /////////////////////////////////////////// 2847 2848 TMultiGraph *mg_rectaujet_eff_pt = new TMultiGraph("",""); 2849 TMultiGraph *mg_rectaujet_eff_eta = new TMultiGraph("",""); 2850 2851 TLegend *leg_rectaujet_eff_pt = new TLegend(0.50,0.22,0.90,0.48); 2852 TLegend *leg_rectaujet_eff_eta = new TLegend(0.50,0.22,0.90,0.48); 2853 2854 TGraphErrors *gr_rectaujet_eff_pt = new TGraphErrors[n_etabins]; 2855 TGraphErrors *gr_rectaujet_eff_eta = new TGraphErrors[n_ptbins]; 2856 TH1D* h_rectaujet_eff_pt, *h_rectaujet_eff_eta; 2857 2858 // loop over eta bins 2859 for (k = 0; k < etaVals.size()-1; k++) 2860 { 2861 2862 h_rectaujet_eff_pt = GetTauEffPt<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderTauJet); 2863 gr_rectaujet_eff_pt[k] = TGraphErrors(h_rectaujet_eff_pt); 2864 2865 s_etaMin = Form("%.1f",etaVals.at(k)); 2866 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2867 2868 s_eta = "#tau-jet , " + s_etaMin + " < | #eta | < "+s_etaMax; 2869 2870 gr_rectaujet_eff_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2871 2872 addResoGraph(mg_rectaujet_eff_pt, &gr_rectaujet_eff_pt[k], leg_rectaujet_eff_pt, markerStyles.at(k), colors.at(k), s_eta); 2873 } 2874 2875 // loop over pt 2876 for (k = 0; k < ptVals.size(); k++) 2877 { 2878 h_rectaujet_eff_eta = GetTauEffEta<Jet>(branchPFTauJet, branchParticleTauJet, "TauJet", 15, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderTauJet); 2879 gr_rectaujet_eff_eta[k] = TGraphErrors(h_rectaujet_eff_eta); 2880 2881 s_pt = Form("#tau-jet , p_{T} = %.0f GeV",ptVals.at(k)); 2882 if(ptVals.at(k) >= 1000.) s_pt = Form("#tau-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2883 2884 addResoGraph(mg_rectaujet_eff_eta, &gr_rectaujet_eff_eta[k], leg_rectaujet_eff_eta, markerStyles.at(k), colors.at(k), s_pt ); 2885 } 2886 2887 2888 TCanvas *c_rectaujet_eff_pt = new TCanvas("","", 800, 600); 2889 2890 mg_rectaujet_eff_pt->Draw("APE"); 2891 DrawAxis(mg_rectaujet_eff_pt, leg_rectaujet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "#tau - tag efficiency (%)", true, false); 2892 leg_rectaujet_eff_pt->Draw(); 2893 pave->Draw(); 2894 2895 c_rectaujet_eff_pt->Print(pdfOutput,"pdf"); 2896 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.pdf","pdf"); 2897 c_rectaujet_eff_pt->Print(figPath+"img_rectaujet_eff_pt.png","png"); 2898 2899 TCanvas *c_rectaujet_eff_eta = new TCanvas("","", 800, 600); 2900 2901 mg_rectaujet_eff_eta->Draw("APE"); 2902 DrawAxis(mg_rectaujet_eff_eta, leg_rectaujet_eff_eta, etaMin, etaMax, 0.0, 100., " #eta ", "#tau - tag efficiency (%)", false, false); 2903 leg_rectaujet_eff_eta->Draw(); 2904 pave->Draw(); 2905 2906 c_rectaujet_eff_eta->Print(pdfOutput,"pdf"); 2907 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.pdf","pdf"); 2908 c_rectaujet_eff_eta->Print(figPath+"img_rectaujet_eff_eta.png","png"); 2909 2910 2911 //--------------- tau mistag rate ---------- 2912 2913 TMultiGraph *mg_rectaujet_mis_pt = new TMultiGraph("",""); 2914 TMultiGraph *mg_rectaujet_mis_eta = new TMultiGraph("",""); 2915 2916 TLegend *leg_rectaujet_mis_pt = new TLegend(0.50,0.64,0.90,0.90); 2917 TLegend *leg_rectaujet_mis_eta = new TLegend(0.50,0.64,0.90,0.90); 2918 2919 TGraphErrors *gr_rectaujet_mis_pt = new TGraphErrors[n_etabins]; 2920 TGraphErrors *gr_rectaujet_mis_eta = new TGraphErrors[n_ptbins]; 2921 TH1D* h_rectaujet_mis_pt, *h_rectaujet_mis_eta; 2922 2923 // loop over eta bins 2924 for (k = 0; k < etaVals.size()-1; k++) 2925 { 2926 2927 h_rectaujet_mis_pt = GetTauEffPt<Jet>(branchJet, branchParticleJet, "TauJet", 1, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderJet); 2928 gr_rectaujet_mis_pt[k] = TGraphErrors(h_rectaujet_mis_pt); 2929 2930 s_etaMin = Form("%.1f",etaVals.at(k)); 2931 s_etaMax = Form("%.1f",etaVals.at(k+1)); 2932 2933 s_eta = "uds-jet , " + s_etaMin + " < | #eta | < "+s_etaMax; 2934 2935 gr_rectaujet_mis_pt[k].SetName("recEff_"+s_etaMin+"_"+s_etaMax); 2936 2937 addResoGraph(mg_rectaujet_mis_pt, &gr_rectaujet_mis_pt[k], leg_rectaujet_mis_pt, markerStyles.at(k), colors.at(k), s_eta); 2938 } 2939 2940 // loop over pt 2941 for (k = 0; k < ptVals.size(); k++) 2942 { 2943 h_rectaujet_mis_eta = GetTauEffEta<Jet>(branchJet, branchParticleJet, "TauJet", 1, 0.5*ptVals.at(k), 2.0*ptVals.at(k) ,etaMin, etaMax , treeReaderJet); 2944 gr_rectaujet_mis_eta[k] = TGraphErrors(h_rectaujet_mis_eta); 2945 2946 s_pt = Form("uds-jet , p_{T} = %.0f GeV",ptVals.at(k)); 2947 if(ptVals.at(k) >= 1000.) s_pt = Form("uds-jet , p_{T} = %.0f TeV",ptVals.at(k)/1000.); 2948 2949 addResoGraph(mg_rectaujet_mis_eta, &gr_rectaujet_mis_eta[k], leg_rectaujet_mis_eta, markerStyles.at(k), colors.at(k), s_pt ); 2950 } 2951 2952 TCanvas *c_rectaujet_mis_pt = new TCanvas("","", 800, 600); 2953 2954 mg_rectaujet_mis_pt->Draw("APE"); 2955 DrawAxis(mg_rectaujet_mis_pt, leg_rectaujet_mis_pt, ptMin, ptMax, 0.0, 5., "p_{T} [GeV]", "#tau - mistag(%)", true, false); 2956 leg_rectaujet_mis_pt->Draw(); 2957 pave->Draw(); 2958 2959 c_rectaujet_mis_pt->Print(pdfOutput,"pdf"); 2960 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.pdf","pdf"); 2961 c_rectaujet_mis_pt->Print(figPath+"img_rectaujet_mis_pt.png","png"); 2962 2963 TCanvas *c_rectaujet_mis_eta = new TCanvas("","", 800, 600); 2964 2965 mg_rectaujet_mis_eta->Draw("APE"); 2966 DrawAxis(mg_rectaujet_mis_eta, leg_rectaujet_mis_eta, etaMin, etaMax, 0.0, 5., " #eta ", "#tau - mistag (%)", false, false); 2967 leg_rectaujet_mis_eta->Draw(); 2968 pave->Draw(); 2969 2970 c_rectaujet_mis_eta->Print(pdfOutput+")","pdf"); 2971 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.pdf","pdf"); 2972 c_rectaujet_mis_eta->Print(figPath+"img_rectaujet_mis_eta.png","png"); 2973 2974 2975 // ---- store resolution histograms in the output (for leave efficiencies out) --- 2976 2977 2978 TFile *fout = new TFile(outputFile,"recreate"); 2979 2980 for (int bin = 0; bin < Nbins; bin++) 2981 { 2982 2983 for (k = 0; k < etaVals.size()-1; k++) 2984 { 2985 plots_trkpi_res_pt[k].at(bin).resolHist->Write(); 2986 plots_trkele_res_pt[k].at(bin).resolHist->Write(); 2987 plots_trkmu_res_pt[k].at(bin).resolHist->Write(); 2988 plots_ecal_res_e[k].at(bin).resolHist->Write(); 2989 plots_hcal_res_e[k].at(bin).resolHist->Write(); 2990 plots_pfele_res_e[k].at(bin).resolHist->Write(); 2991 plots_pfpi_res_e[k].at(bin).resolHist->Write(); 2992 plots_pfjet_res_e[k].at(bin).resolHist->Write(); 2993 plots_cajet_res_e[k].at(bin).resolHist->Write(); 2994 2995 } 2996 2997 for (k = 0; k < ptVals.size(); k++) 2998 { 2999 plots_trkpi_res_eta[k].at(bin).resolHist->Write(); 3000 plots_trkele_res_eta[k].at(bin).resolHist->Write(); 3001 plots_trkmu_res_eta[k].at(bin).resolHist->Write(); 3002 plots_ecal_res_eta[k].at(bin).resolHist->Write(); 3003 plots_hcal_res_eta[k].at(bin).resolHist->Write(); 3004 plots_pfele_res_eta[k].at(bin).resolHist->Write(); 3005 plots_pfpi_res_eta[k].at(bin).resolHist->Write(); 3006 plots_pfjet_res_eta[k].at(bin).resolHist->Write(); 3007 plots_cajet_res_eta[k].at(bin).resolHist->Write(); 3008 2940 3009 } 2941 3010 2942 3011 plots_pfmet.at(bin).resolHist->Write(); 2943 3012 plots_camet.at(bin).resolHist->Write(); 3013 2944 3014 } 2945 3015 2946 3016 fout->Write(); 3017 2947 3018 2948 3019 cout << "** Exiting..." << endl; … … 2994 3065 DelphesValidation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]); 2995 3066 } 3067 3068 3069
Note:
See TracChangeset
for help on using the changeset viewer.