Changes in / [e39abb4:0e7d64a] in git
- Files:
-
- 7 added
- 217 edited
Legend:
- Unmodified
- Added
- Removed
-
.circleci/config.yml
re39abb4 r0e7d64a 8 8 command: | 9 9 make distclean 10 make -j `nproc`HAS_PYTHIA8=true10 make -j 8 HAS_PYTHIA8=true 11 11 - run: 12 12 name: Build Delphes using cmake … … 16 16 cd build 17 17 cmake .. 18 make -j `nproc`18 make -j 8 19 19 20 20 jobs: … … 27 27 docker: 28 28 - image: delphes/ubuntu:18.04 29 fedora- 28:29 fedora-30: 30 30 <<: *shared 31 31 docker: 32 - image: delphes/fedora: 2832 - image: delphes/fedora:30 33 33 34 34 workflows: … … 38 38 - ubuntu-1404 39 39 - ubuntu-1804 40 - fedora- 2840 - fedora-30 -
.clang-format
re39abb4 r0e7d64a 1 1 BasedOnStyle: LLVM 2 2 Language: Cpp 3 Standard: Cpp03 3 4 IndentWidth: 2 4 5 ConstructorInitializerIndentWidth: 2 -
CHANGELOG
re39abb4 r0e7d64a 1 3.4.2: 2 - added DenseTrackFilter for modelling tracking inefficiencies in boosted, dense environments 3 - added detector cards for CLIC and HL-LHC detectors 4 - added muons to Tower collection used for jets reconstruction and MET calculation in the ATLAS card (#1118) 5 - added Weight branch to HepMC 6 - 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 generator 9 - added NeutralOutputArray in ParticlePropagator 10 - 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 particles 14 - 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.041 17 - updated copyright and licensing information 18 - removed dependency on the RPC and XDR libraries from STDHEP reader (#1310) 19 - fixed Delphes class destructor (TList::Clear error) (#1320) 20 1 21 3.4.1: 2 22 - added RadiusMax and HalfLengthMax to ParticlePropagator to keep decay products of the long-lived particles (#1084) … … 4 24 - improved CMake configuration 5 25 - fixed weights in LHEFReader 6 - fixed bug in Charged Hadron Subtraction (CHS) 26 - fixed bug in Charged Hadron Subtraction (CHS) 7 27 - promoted z vertex resolution to TFormula 8 28 - fixed bugs in DelphesDisplay -
Makefile
re39abb4 r0e7d64a 105 105 classes/DelphesHepMCReader.h \ 106 106 classes/DelphesPileUpWriter.h \ 107 external/ExRootAnalysis/ExRoot TreeWriter.h \107 external/ExRootAnalysis/ExRootProgressBar.h \ 108 108 external/ExRootAnalysis/ExRootTreeBranch.h \ 109 external/ExRootAnalysis/ExRoot ProgressBar.h109 external/ExRootAnalysis/ExRootTreeWriter.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 \ 117 classes/DelphesStream.h \ 115 118 modules/Delphes.h \ 116 classes/DelphesStream.h \ 117 classes/DelphesClasses.h \ 118 classes/DelphesFactory.h \ 119 external/ExRootAnalysis/ExRootTreeWriter.h \ 119 external/ExRootAnalysis/ExRootProgressBar.h \ 120 120 external/ExRootAnalysis/ExRootTreeBranch.h \ 121 external/ExRootAnalysis/ExRoot ProgressBar.h121 external/ExRootAnalysis/ExRootTreeWriter.h 122 122 pileup2root$(ExeSuf): \ 123 123 tmp/converters/pileup2root.$(ObjSuf) … … 125 125 tmp/converters/pileup2root.$(ObjSuf): \ 126 126 converters/pileup2root.cpp \ 127 classes/DelphesClasses.h \ 128 classes/DelphesFactory.h \ 129 classes/DelphesPileUpReader.h \ 127 130 classes/DelphesStream.h \ 128 classes/DelphesClasses.h \ 129 classes/DelphesFactory.h \ 130 classes/DelphesPileUpReader.h \ 131 external/ExRootAnalysis/ExRootTreeWriter.h \ 131 external/ExRootAnalysis/ExRootProgressBar.h \ 132 132 external/ExRootAnalysis/ExRootTreeBranch.h \ 133 external/ExRootAnalysis/ExRoot ProgressBar.h133 external/ExRootAnalysis/ExRootTreeWriter.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 TreeReader.h \141 external/ExRootAnalysis/ExRoot ProgressBar.h140 external/ExRootAnalysis/ExRootProgressBar.h \ 141 external/ExRootAnalysis/ExRootTreeReader.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 TreeReader.h \150 external/ExRootAnalysis/ExRoot ProgressBar.h149 external/ExRootAnalysis/ExRootProgressBar.h \ 150 external/ExRootAnalysis/ExRootTreeReader.h 151 151 stdhep2pileup$(ExeSuf): \ 152 152 tmp/converters/stdhep2pileup.$(ObjSuf) … … 156 156 classes/DelphesClasses.h \ 157 157 classes/DelphesFactory.h \ 158 classes/DelphesPileUpWriter.h \ 158 159 classes/DelphesSTDHEPReader.h \ 159 classes/DelphesPileUpWriter.h \ 160 external/ExRootAnalysis/ExRootTreeWriter.h \ 160 external/ExRootAnalysis/ExRootProgressBar.h \ 161 161 external/ExRootAnalysis/ExRootTreeBranch.h \ 162 external/ExRootAnalysis/ExRoot ProgressBar.h162 external/ExRootAnalysis/ExRootTreeWriter.h 163 163 CaloGrid$(ExeSuf): \ 164 164 tmp/examples/CaloGrid.$(ObjSuf) … … 166 166 tmp/examples/CaloGrid.$(ObjSuf): \ 167 167 examples/CaloGrid.cpp \ 168 display/Delphes3DGeometry.h \169 classes/DelphesClasses.h \ 170 external/ExRootAnalysis/ExRootConfReader.h168 external/ExRootAnalysis/ExRootConfReader.h \ 169 classes/DelphesClasses.h \ 170 display/Delphes3DGeometry.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 \ 177 179 external/ExRootAnalysis/ExRootTreeReader.h \ 178 180 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 \ 188 190 external/ExRootAnalysis/ExRootTreeReader.h \ 189 191 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 classes/DelphesClasses.h \ 221 classes/DelphesFactory.h \ 222 classes/DelphesHepMCReader.h \ 220 223 modules/Delphes.h \ 221 classes/DelphesClasses.h \ 222 classes/DelphesFactory.h \ 223 classes/DelphesHepMCReader.h \ 224 external/ExRootAnalysis/ExRootTreeWriter.h \ 224 external/ExRootAnalysis/ExRootProgressBar.h \ 225 225 external/ExRootAnalysis/ExRootTreeBranch.h \ 226 external/ExRootAnalysis/ExRoot ProgressBar.h226 external/ExRootAnalysis/ExRootTreeWriter.h 227 227 DelphesLHEF$(ExeSuf): \ 228 228 tmp/readers/DelphesLHEF.$(ObjSuf) … … 230 230 tmp/readers/DelphesLHEF.$(ObjSuf): \ 231 231 readers/DelphesLHEF.cpp \ 232 classes/DelphesClasses.h \ 233 classes/DelphesFactory.h \ 234 classes/DelphesLHEFReader.h \ 232 235 modules/Delphes.h \ 233 classes/DelphesClasses.h \ 234 classes/DelphesFactory.h \ 235 classes/DelphesLHEFReader.h \ 236 external/ExRootAnalysis/ExRootTreeWriter.h \ 236 external/ExRootAnalysis/ExRootProgressBar.h \ 237 237 external/ExRootAnalysis/ExRootTreeBranch.h \ 238 external/ExRootAnalysis/ExRoot ProgressBar.h238 external/ExRootAnalysis/ExRootTreeWriter.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 \ 246 classes/DelphesStream.h \ 244 247 modules/Delphes.h \ 245 classes/DelphesStream.h \ 246 classes/DelphesClasses.h \ 247 classes/DelphesFactory.h \ 248 external/ExRootAnalysis/ExRootTreeWriter.h \ 248 external/ExRootAnalysis/ExRootProgressBar.h \ 249 external/ExRootAnalysis/ExRootTreeBranch.h \ 249 250 external/ExRootAnalysis/ExRootTreeReader.h \ 250 external/ExRootAnalysis/ExRootTreeBranch.h \ 251 external/ExRootAnalysis/ExRootProgressBar.h 251 external/ExRootAnalysis/ExRootTreeWriter.h 252 252 DelphesSTDHEP$(ExeSuf): \ 253 253 tmp/readers/DelphesSTDHEP.$(ObjSuf) … … 255 255 tmp/readers/DelphesSTDHEP.$(ObjSuf): \ 256 256 readers/DelphesSTDHEP.cpp \ 257 classes/DelphesClasses.h \ 258 classes/DelphesFactory.h \ 259 classes/DelphesSTDHEPReader.h \ 257 260 modules/Delphes.h \ 258 classes/DelphesClasses.h \ 259 classes/DelphesFactory.h \ 260 classes/DelphesSTDHEPReader.h \ 261 external/ExRootAnalysis/ExRootTreeWriter.h \ 261 external/ExRootAnalysis/ExRootProgressBar.h \ 262 262 external/ExRootAnalysis/ExRootTreeBranch.h \ 263 external/ExRootAnalysis/ExRoot ProgressBar.h263 external/ExRootAnalysis/ExRootTreeWriter.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 \ 284 classes/DelphesStream.h \ 282 285 modules/Delphes.h \ 283 classes/DelphesStream.h \ 284 classes/DelphesClasses.h \ 285 classes/DelphesFactory.h \ 286 external/ExRootAnalysis/ExRootTreeWriter.h \ 286 external/ExRootAnalysis/ExRootProgressBar.h \ 287 287 external/ExRootAnalysis/ExRootTreeBranch.h \ 288 external/ExRootAnalysis/ExRoot ProgressBar.h288 external/ExRootAnalysis/ExRootTreeWriter.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 \ 305 classes/DelphesStream.h \ 303 306 modules/Delphes.h \ 304 classes/DelphesStream.h \ 305 classes/DelphesClasses.h \ 306 classes/DelphesFactory.h \ 307 external/ExRootAnalysis/ExRootTreeWriter.h \ 307 external/ExRootAnalysis/ExRootProgressBar.h \ 308 308 external/ExRootAnalysis/ExRootTreeBranch.h \ 309 external/ExRootAnalysis/ExRoot ProgressBar.h309 external/ExRootAnalysis/ExRootTreeWriter.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 \ 326 classes/DelphesStream.h \ 324 327 modules/Delphes.h \ 325 classes/DelphesStream.h \ 326 classes/DelphesClasses.h \ 327 classes/DelphesFactory.h \ 328 external/ExRootAnalysis/ExRootTreeWriter.h \ 328 external/ExRootAnalysis/ExRootProgressBar.h \ 329 329 external/ExRootAnalysis/ExRootTreeBranch.h \ 330 external/ExRootAnalysis/ExRoot ProgressBar.h330 external/ExRootAnalysis/ExRootTreeWriter.h 331 331 EXECUTABLE += \ 332 332 DelphesProIO$(ExeSuf) … … 343 343 tmp/readers/DelphesPythia8.$(ObjSuf): \ 344 344 readers/DelphesPythia8.cpp \ 345 classes/DelphesClasses.h \ 346 classes/DelphesFactory.h \ 347 classes/DelphesLHEFReader.h \ 345 348 modules/Delphes.h \ 346 classes/DelphesClasses.h \ 347 classes/DelphesFactory.h \ 348 classes/DelphesLHEFReader.h \ 349 external/ExRootAnalysis/ExRootTreeWriter.h \ 349 external/ExRootAnalysis/ExRootProgressBar.h \ 350 350 external/ExRootAnalysis/ExRootTreeBranch.h \ 351 external/ExRootAnalysis/ExRoot ProgressBar.h351 external/ExRootAnalysis/ExRootTreeWriter.h 352 352 EXECUTABLE += \ 353 353 DelphesPythia8$(ExeSuf) … … 527 527 classes/DelphesModule.h \ 528 528 classes/DelphesFactory.h \ 529 external/ExRootAnalysis/ExRootResult.h \ 530 external/ExRootAnalysis/ExRootTreeBranch.h \ 529 531 external/ExRootAnalysis/ExRootTreeReader.h \ 530 external/ExRootAnalysis/ExRootTreeBranch.h \ 531 external/ExRootAnalysis/ExRootTreeWriter.h \ 532 external/ExRootAnalysis/ExRootResult.h 532 external/ExRootAnalysis/ExRootTreeWriter.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 Result.h \653 external/ExRootAnalysis/ExRootFilter.h \ 654 external/ExRootAnalysis/ExRoot Classifier.h652 external/ExRootAnalysis/ExRootClassifier.h \ 653 external/ExRootAnalysis/ExRootFilter.h \ 654 external/ExRootAnalysis/ExRootResult.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 Result.h \668 external/ExRootAnalysis/ExRootFilter.h \ 669 external/ExRootAnalysis/ExRoot Classifier.h667 external/ExRootAnalysis/ExRootClassifier.h \ 668 external/ExRootAnalysis/ExRootFilter.h \ 669 external/ExRootAnalysis/ExRootResult.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 Result.h \677 external/ExRootAnalysis/ExRootFilter.h \ 678 external/ExRootAnalysis/ExRoot Classifier.h676 external/ExRootAnalysis/ExRootClassifier.h \ 677 external/ExRootAnalysis/ExRootFilter.h \ 678 external/ExRootAnalysis/ExRootResult.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 Result.h \686 external/ExRootAnalysis/ExRootFilter.h \ 687 external/ExRootAnalysis/ExRoot Classifier.h685 external/ExRootAnalysis/ExRootClassifier.h \ 686 external/ExRootAnalysis/ExRootFilter.h \ 687 external/ExRootAnalysis/ExRootResult.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 Result.h \695 external/ExRootAnalysis/ExRootFilter.h \ 696 external/ExRootAnalysis/ExRoot Classifier.h694 external/ExRootAnalysis/ExRootClassifier.h \ 695 external/ExRootAnalysis/ExRootFilter.h \ 696 external/ExRootAnalysis/ExRootResult.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/ExRootClassifier.h \ 704 external/ExRootAnalysis/ExRootConfReader.h \ 705 external/ExRootAnalysis/ExRootFilter.h \ 703 706 external/ExRootAnalysis/ExRootResult.h \ 704 external/ExRootAnalysis/ExRootFilter.h \705 external/ExRootAnalysis/ExRootClassifier.h \706 external/ExRootAnalysis/ExRootConfReader.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 Result.h \715 external/ExRootAnalysis/ExRootFilter.h \ 716 external/ExRootAnalysis/ExRoot Classifier.h714 external/ExRootAnalysis/ExRootClassifier.h \ 715 external/ExRootAnalysis/ExRootFilter.h \ 716 external/ExRootAnalysis/ExRootResult.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 Result.h \733 external/ExRootAnalysis/ExRootFilter.h \ 734 external/ExRootAnalysis/ExRoot Classifier.h732 external/ExRootAnalysis/ExRootClassifier.h \ 733 external/ExRootAnalysis/ExRootFilter.h \ 734 external/ExRootAnalysis/ExRootResult.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 Result.h \742 external/ExRootAnalysis/ExRootFilter.h \ 743 external/ExRootAnalysis/ExRoot Classifier.h741 external/ExRootAnalysis/ExRootClassifier.h \ 742 external/ExRootAnalysis/ExRootFilter.h \ 743 external/ExRootAnalysis/ExRootResult.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 Result.h \751 external/ExRootAnalysis/ExRootFilter.h \ 752 external/ExRootAnalysis/ExRoot Classifier.h750 external/ExRootAnalysis/ExRootClassifier.h \ 751 external/ExRootAnalysis/ExRootFilter.h \ 752 external/ExRootAnalysis/ExRootResult.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 Result.h \760 external/ExRootAnalysis/ExRootFilter.h \ 761 external/ExRootAnalysis/ExRoot Classifier.h759 external/ExRootAnalysis/ExRootClassifier.h \ 760 external/ExRootAnalysis/ExRootFilter.h \ 761 external/ExRootAnalysis/ExRootResult.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/ExRootClassifier.h \ 769 external/ExRootAnalysis/ExRootFilter.h \ 768 770 external/ExRootAnalysis/ExRootResult.h \ 769 external/ExRootAnalysis/ExRootFilter.h \770 external/ExRootAnalysis/ExRootClassifier.h \771 771 external/Hector/H_BeamLine.h \ 772 external/Hector/H_ RecRPObject.h \773 external/Hector/H_ BeamParticle.h772 external/Hector/H_BeamParticle.h \ 773 external/Hector/H_RecRPObject.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 Result.h \781 external/ExRootAnalysis/ExRootFilter.h \ 782 external/ExRootAnalysis/ExRoot Classifier.h780 external/ExRootAnalysis/ExRootClassifier.h \ 781 external/ExRootAnalysis/ExRootFilter.h \ 782 external/ExRootAnalysis/ExRootResult.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 Result.h \790 external/ExRootAnalysis/ExRootFilter.h \ 791 external/ExRootAnalysis/ExRoot Classifier.h789 external/ExRootAnalysis/ExRootClassifier.h \ 790 external/ExRootAnalysis/ExRootFilter.h \ 791 external/ExRootAnalysis/ExRootResult.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 Result.h \799 external/ExRootAnalysis/ExRootFilter.h \ 800 external/ExRootAnalysis/ExRoot Classifier.h798 external/ExRootAnalysis/ExRootClassifier.h \ 799 external/ExRootAnalysis/ExRootFilter.h \ 800 external/ExRootAnalysis/ExRootResult.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 Result.h \808 external/ExRootAnalysis/ExRootFilter.h \ 809 external/ExRootAnalysis/ExRoot Classifier.h807 external/ExRootAnalysis/ExRootClassifier.h \ 808 external/ExRootAnalysis/ExRootFilter.h \ 809 external/ExRootAnalysis/ExRootResult.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 Result.h \817 external/ExRootAnalysis/ExRootFilter.h \ 818 external/ExRootAnalysis/ExRoot Classifier.h816 external/ExRootAnalysis/ExRootClassifier.h \ 817 external/ExRootAnalysis/ExRootFilter.h \ 818 external/ExRootAnalysis/ExRootResult.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 Result.h \826 external/ExRootAnalysis/ExRootFilter.h \ 827 external/ExRootAnalysis/ExRoot Classifier.h825 external/ExRootAnalysis/ExRootClassifier.h \ 826 external/ExRootAnalysis/ExRootFilter.h \ 827 external/ExRootAnalysis/ExRootResult.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 Result.h \835 external/ExRootAnalysis/ExRootFilter.h \ 836 external/ExRootAnalysis/ExRoot Classifier.h834 external/ExRootAnalysis/ExRootClassifier.h \ 835 external/ExRootAnalysis/ExRootFilter.h \ 836 external/ExRootAnalysis/ExRootResult.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 Result.h \844 external/ExRootAnalysis/ExRootFilter.h \ 845 external/ExRootAnalysis/ExRoot Classifier.h843 external/ExRootAnalysis/ExRootClassifier.h \ 844 external/ExRootAnalysis/ExRootFilter.h \ 845 external/ExRootAnalysis/ExRootResult.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 Result.h \853 external/ExRootAnalysis/ExRootFilter.h \ 854 external/ExRootAnalysis/ExRoot Classifier.h852 external/ExRootAnalysis/ExRootClassifier.h \ 853 external/ExRootAnalysis/ExRootFilter.h \ 854 external/ExRootAnalysis/ExRootResult.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 Result.h \862 external/ExRootAnalysis/ExRootFilter.h \ 863 external/ExRootAnalysis/ExRoot Classifier.h861 external/ExRootAnalysis/ExRootClassifier.h \ 862 external/ExRootAnalysis/ExRootFilter.h \ 863 external/ExRootAnalysis/ExRootResult.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 Result.h \871 external/ExRootAnalysis/ExRootFilter.h \ 872 external/ExRootAnalysis/ExRoot Classifier.h870 external/ExRootAnalysis/ExRootClassifier.h \ 871 external/ExRootAnalysis/ExRootFilter.h \ 872 external/ExRootAnalysis/ExRootResult.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 Result.h \880 external/ExRootAnalysis/ExRootFilter.h \ 881 external/ExRootAnalysis/ExRoot Classifier.h879 external/ExRootAnalysis/ExRootClassifier.h \ 880 external/ExRootAnalysis/ExRootFilter.h \ 881 external/ExRootAnalysis/ExRootResult.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 \887 886 classes/DelphesCylindricalFormula.h \ 888 external/ExRootAnalysis/ExRootResult.h \ 889 external/ExRootAnalysis/ExRootFilter.h \ 890 external/ExRootAnalysis/ExRootClassifier.h 887 classes/DelphesFactory.h \ 888 external/ExRootAnalysis/ExRootClassifier.h \ 889 external/ExRootAnalysis/ExRootFilter.h \ 890 external/ExRootAnalysis/ExRootResult.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 Result.h \898 external/ExRootAnalysis/ExRootFilter.h \ 899 external/ExRootAnalysis/ExRoot Classifier.h897 external/ExRootAnalysis/ExRootClassifier.h \ 898 external/ExRootAnalysis/ExRootFilter.h \ 899 external/ExRootAnalysis/ExRootResult.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 Result.h \907 external/ExRootAnalysis/ExRootFilter.h \ 908 external/ExRootAnalysis/ExRoot Classifier.h906 external/ExRootAnalysis/ExRootClassifier.h \ 907 external/ExRootAnalysis/ExRootFilter.h \ 908 external/ExRootAnalysis/ExRootResult.h 909 909 tmp/modules/PileUpMerger.$(ObjSuf): \ 910 910 modules/PileUpMerger.$(SrcSuf) \ … … 912 912 classes/DelphesClasses.h \ 913 913 classes/DelphesFactory.h \ 914 classes/DelphesPileUpReader.h \ 914 915 classes/DelphesTF2.h \ 915 classes/DelphesPileUpReader.h \ 916 external/ExRootAnalysis/ExRootResult.h \ 917 external/ExRootAnalysis/ExRootFilter.h \ 918 external/ExRootAnalysis/ExRootClassifier.h 916 external/ExRootAnalysis/ExRootClassifier.h \ 917 external/ExRootAnalysis/ExRootFilter.h \ 918 external/ExRootAnalysis/ExRootResult.h 919 919 tmp/modules/PileUpMergerPythia8.$(ObjSuf): \ 920 920 modules/PileUpMergerPythia8.$(SrcSuf) \ … … 922 922 classes/DelphesClasses.h \ 923 923 classes/DelphesFactory.h \ 924 classes/DelphesPileUpReader.h \ 924 925 classes/DelphesTF2.h \ 925 classes/DelphesPileUpReader.h \ 926 external/ExRootAnalysis/ExRootResult.h \ 927 external/ExRootAnalysis/ExRootFilter.h \ 928 external/ExRootAnalysis/ExRootClassifier.h 926 external/ExRootAnalysis/ExRootClassifier.h \ 927 external/ExRootAnalysis/ExRootFilter.h \ 928 external/ExRootAnalysis/ExRootResult.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 Result.h \936 external/ExRootAnalysis/ExRootFilter.h \ 937 external/ExRootAnalysis/ExRoot Classifier.h935 external/ExRootAnalysis/ExRootClassifier.h \ 936 external/ExRootAnalysis/ExRootFilter.h \ 937 external/ExRootAnalysis/ExRootResult.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 Result.h \945 external/ExRootAnalysis/ExRootFilter.h \ 946 external/ExRootAnalysis/ExRoot Classifier.h944 external/ExRootAnalysis/ExRootClassifier.h \ 945 external/ExRootAnalysis/ExRootFilter.h \ 946 external/ExRootAnalysis/ExRootResult.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 Result.h \954 external/ExRootAnalysis/ExRootFilter.h \ 955 external/ExRootAnalysis/ExRoot Classifier.h953 external/ExRootAnalysis/ExRootClassifier.h \ 954 external/ExRootAnalysis/ExRootFilter.h \ 955 external/ExRootAnalysis/ExRootResult.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 Result.h \964 external/ExRootAnalysis/ExRootFilter.h \ 965 external/ExRootAnalysis/ExRoot Classifier.h963 external/ExRootAnalysis/ExRootClassifier.h \ 964 external/ExRootAnalysis/ExRootFilter.h \ 965 external/ExRootAnalysis/ExRootResult.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 Result.h \979 external/ExRootAnalysis/ExRootFilter.h \ 980 external/ExRootAnalysis/ExRoot Classifier.h978 external/ExRootAnalysis/ExRootClassifier.h \ 979 external/ExRootAnalysis/ExRootFilter.h \ 980 external/ExRootAnalysis/ExRootResult.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 Result.h \994 external/ExRootAnalysis/ExRootFilter.h \ 995 external/ExRootAnalysis/ExRoot Classifier.h993 external/ExRootAnalysis/ExRootClassifier.h \ 994 external/ExRootAnalysis/ExRootFilter.h \ 995 external/ExRootAnalysis/ExRootResult.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 Result.h \1003 external/ExRootAnalysis/ExRootFilter.h \ 1004 external/ExRootAnalysis/ExRoot Classifier.h1002 external/ExRootAnalysis/ExRootClassifier.h \ 1003 external/ExRootAnalysis/ExRootFilter.h \ 1004 external/ExRootAnalysis/ExRootResult.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 Result.h \1012 external/ExRootAnalysis/ExRootFilter.h \ 1013 external/ExRootAnalysis/ExRoot Classifier.h1011 external/ExRootAnalysis/ExRootClassifier.h \ 1012 external/ExRootAnalysis/ExRootFilter.h \ 1013 external/ExRootAnalysis/ExRootResult.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/ExRootClassifier.h \ 1021 external/ExRootAnalysis/ExRootFilter.h \ 1020 1022 external/ExRootAnalysis/ExRootResult.h \ 1021 external/ExRootAnalysis/ExRootFilter.h \1022 external/ExRootAnalysis/ExRootClassifier.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 Result.h \1031 external/ExRootAnalysis/ExRootFilter.h \ 1032 external/ExRootAnalysis/ExRoot Classifier.h1030 external/ExRootAnalysis/ExRootClassifier.h \ 1031 external/ExRootAnalysis/ExRootFilter.h \ 1032 external/ExRootAnalysis/ExRootResult.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 Result.h \1041 external/ExRootAnalysis/ExRootFilter.h \ 1042 external/ExRootAnalysis/ExRoot Classifier.h1040 external/ExRootAnalysis/ExRootClassifier.h \ 1041 external/ExRootAnalysis/ExRootFilter.h \ 1042 external/ExRootAnalysis/ExRootResult.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 Result.h \1051 external/ExRootAnalysis/ExRootFilter.h \ 1052 external/ExRootAnalysis/ExRoot Classifier.h1050 external/ExRootAnalysis/ExRootClassifier.h \ 1051 external/ExRootAnalysis/ExRootFilter.h \ 1052 external/ExRootAnalysis/ExRootResult.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 Result.h \1061 external/ExRootAnalysis/ExRootFilter.h \ 1062 external/ExRootAnalysis/ExRoot Classifier.h1060 external/ExRootAnalysis/ExRootClassifier.h \ 1061 external/ExRootAnalysis/ExRootFilter.h \ 1062 external/ExRootAnalysis/ExRootResult.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 Result.h \1070 external/ExRootAnalysis/ExRootFilter.h \ 1071 external/ExRootAnalysis/ExRoot Classifier.h1069 external/ExRootAnalysis/ExRootClassifier.h \ 1070 external/ExRootAnalysis/ExRootFilter.h \ 1071 external/ExRootAnalysis/ExRootResult.h 1072 1072 DELPHES_OBJ += \ 1073 1073 tmp/classes/DelphesClasses.$(ObjSuf) \ … … 1501 1501 classes/DelphesFactory.h \ 1502 1502 classes/DelphesFormula.h \ 1503 external/ExRootAnalysis/ExRootClassifier.h \ 1504 external/ExRootAnalysis/ExRootFilter.h \ 1503 1505 external/ExRootAnalysis/ExRootResult.h \ 1504 external/ExRootAnalysis/ExRootFilter.h \ 1505 external/ExRootAnalysis/ExRootClassifier.h \ 1506 external/fastjet/ClusterSequence.hh \ 1507 external/fastjet/ClusterSequenceArea.hh \ 1508 external/fastjet/JetDefinition.hh \ 1506 1509 external/fastjet/PseudoJet.hh \ 1507 external/fastjet/JetDefinition.hh \1508 external/fastjet/ClusterSequence.hh \1509 1510 external/fastjet/Selector.hh \ 1510 external/fastjet/ClusterSequenceArea.hh \1511 1511 external/fastjet/tools/JetMedianBackgroundEstimator.hh \ 1512 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1513 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1512 1514 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1513 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1514 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1515 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh \ 1515 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh \ 1516 1516 external/fastjet/contribs/Nsubjettiness/Njettiness.hh \ 1517 1517 external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh \ 1518 external/fastjet/contribs/Nsubjettiness/ ExtraRecombiners.hh \1518 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh \ 1519 1519 external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh \ 1520 external/fastjet/contribs/RecursiveTools/SoftDrop.hh \ 1520 1521 external/fastjet/tools/Filter.hh \ 1521 external/fastjet/tools/Pruner.hh \ 1522 external/fastjet/contribs/RecursiveTools/SoftDrop.hh 1522 external/fastjet/tools/Pruner.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/ExRootClassifier.h \ 1530 external/ExRootAnalysis/ExRootFilter.h \ 1529 1531 external/ExRootAnalysis/ExRootResult.h \ 1530 external/ExRootAnalysis/ExRootFilter.h \ 1531 external/ExRootAnalysis/ExRootClassifier.h \ 1532 external/fastjet/ClusterSequence.hh \ 1533 external/fastjet/ClusterSequenceArea.hh \ 1534 external/fastjet/JetDefinition.hh \ 1532 1535 external/fastjet/PseudoJet.hh \ 1533 external/fastjet/JetDefinition.hh \ 1534 external/fastjet/ClusterSequence.hh \ 1536 external/fastjet/RectangularGrid.hh \ 1535 1537 external/fastjet/Selector.hh \ 1536 external/fastjet/RectangularGrid.hh \1537 external/fastjet/ClusterSequenceArea.hh \1538 1538 external/fastjet/tools/JetMedianBackgroundEstimator.hh \ 1539 1539 external/fastjet/tools/GridMedianBackgroundEstimator.hh \ 1540 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1541 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1540 1542 external/fastjet/plugins/SISCone/fastjet/SISConePlugin.hh \ 1541 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh \ 1542 external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh \ 1543 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh \ 1543 external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh \ 1544 1544 external/fastjet/contribs/Nsubjettiness/Njettiness.hh \ 1545 1545 external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh \ 1546 external/fastjet/contribs/Nsubjettiness/ ExtraRecombiners.hh1546 external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh 1547 1547 tmp/modules/RunPUPPI.$(ObjSuf): \ 1548 1548 modules/RunPUPPI.$(SrcSuf) \ 1549 1549 modules/RunPUPPI.h \ 1550 external/PUPPI/RecoObj2.hh \1551 1550 external/PUPPI/AlgoObj.hh \ 1552 1551 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/Delphes3DGeometry.h \ 1685 display/DelphesBranchElement.h \ 1684 1686 display/DelphesCaloData.h \ 1685 display/DelphesBranchElement.h \ 1686 display/Delphes3DGeometry.h \ 1687 display/DelphesDisplay.h \ 1687 1688 display/DelphesEventDisplay.h \ 1688 display/DelphesDisplay.h \1689 display/Delphes3DGeometry.h \1690 1689 display/DelphesHtmlSummary.h \ 1691 1690 display/DelphesPlotSummary.h \ … … 2055 2054 2056 2055 modules/TauTagging.h: \ 2057 classes/DelphesModule.h \ 2056 external/ExRootAnalysis/ExRootClassifier.h \ 2057 external/ExRootAnalysis/ExRootFilter.h \ 2058 2058 external/ExRootAnalysis/ExRootResult.h \ 2059 external/ExRootAnalysis/ExRootFilter.h \ 2060 external/ExRootAnalysis/ExRootClassifier.h 2059 classes/DelphesModule.h 2061 2060 @touch $@ 2062 2061 … … 2106 2105 2107 2106 modules/JetFlavorAssociation.h: \ 2108 classes/Delphes Module.h \2109 classes/Delphes Classes.h2107 classes/DelphesClasses.h \ 2108 classes/DelphesModule.h 2110 2109 @touch $@ 2111 2110 -
README
re39abb4 r0e7d64a 4 4 Commands to get the code: 5 5 6 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4. 1.tar.gz6 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.2.tar.gz 7 7 8 tar -zxf Delphes-3.4. 1.tar.gz8 tar -zxf Delphes-3.4.2.tar.gz 9 9 10 10 Commands to compile the code: 11 11 12 cd Delphes-3.4. 112 cd Delphes-3.4.2 13 13 14 14 make -
README.md
re39abb4 r0e7d64a 14 14 15 15 ``` 16 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4. 1.tar.gz16 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.2.tar.gz 17 17 18 tar -zxf Delphes-3.4. 1.tar.gz18 tar -zxf Delphes-3.4.2.tar.gz 19 19 ``` 20 20 … … 22 22 23 23 ``` 24 cd Delphes-3.4. 124 cd Delphes-3.4.2 25 25 26 26 make -
VERSION
re39abb4 r0e7d64a 1 3.4. 11 3.4.2 -
cards/FCC/FCChh.tcl
re39abb4 r0e7d64a 1239 1239 1240 1240 (pt <= 10.0) * (0.00) + 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.) + \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.) + \ 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. 45) + \1245 (abs(eta) > 2.5 && abs(eta) < 4.0) * (pt > 5000.0 && pt < 34000.0) * (0. 45)*(8./9. - pt/30000.) + \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.) + \ 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
re39abb4 r0e7d64a 1 1 ####################################### 2 2 # CLICdet model 3 # based on CLICdp-Note-2017-001 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 4 6 # Ulrike Schnoor ulrike.schnoor@cern.ch 5 7 # … … 11 13 # according to final state 12 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 # Order of execution of various modules … … 707 714 set OutputArray photons 708 715 709 set DeltaRMax 0. 5716 set DeltaRMax 0.1 710 717 711 718 set PTMin 0.5 712 719 713 set PTRatioMax 0. 12720 set PTRatioMax 0.2 714 721 } 715 722 … … 805 812 set OutputArray electrons 806 813 807 set DeltaRMax 0. 5814 set DeltaRMax 0.1 808 815 809 816 set PTMin 0.5 810 817 811 set PTRatioMax 0. 12818 set PTRatioMax 0.2 812 819 } 813 820 … … 844 851 set OutputArray muons 845 852 846 set DeltaRMax 0. 5853 set DeltaRMax 0.1 847 854 848 855 set PTMin 0.5 849 856 850 set PTRatioMax 0.2 5857 set PTRatioMax 0.2 851 858 } 852 859 -
cards/delphes_card_CLICdet_Stage2.tcl
re39abb4 r0e7d64a 1 1 ####################################### 2 2 # CLICdet model 3 # based on CLICdp-Note-2017-001 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 4 6 # Ulrike Schnoor ulrike.schnoor@cern.ch 5 7 # … … 11 13 # according to final state 12 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 # Order of execution of various modules … … 124 131 125 132 JetFlavorAssociation_R05N2 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 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 237 281 BTaggingWP50_R05_inclusive 238 282 BTaggingWP70_R05_inclusive … … 251 295 BTaggingWP90_R15_inclusive 252 296 297 298 299 BTagging_JER_WP50_R05N2 300 BTagging_JER_WP70_R05N2 301 BTagging_JER_WP90_R05N2 302 BTagging_JER_WP50_R05N3 303 BTagging_JER_WP70_R05N3 304 BTagging_JER_WP90_R05N3 305 BTagging_JER_WP50_R05N4 306 BTagging_JER_WP70_R05N4 307 BTagging_JER_WP90_R05N4 308 BTagging_JER_WP50_R05N5 309 BTagging_JER_WP70_R05N5 310 BTagging_JER_WP90_R05N5 311 BTagging_JER_WP50_R05N6 312 BTagging_JER_WP70_R05N6 313 BTagging_JER_WP90_R05N6 314 BTagging_JER_WP50_R07N2 315 BTagging_JER_WP70_R07N2 316 BTagging_JER_WP90_R07N2 317 BTagging_JER_WP50_R07N3 318 BTagging_JER_WP70_R07N3 319 BTagging_JER_WP90_R07N3 320 BTagging_JER_WP50_R07N4 321 BTagging_JER_WP70_R07N4 322 BTagging_JER_WP90_R07N4 323 BTagging_JER_WP50_R07N5 324 BTagging_JER_WP70_R07N5 325 BTagging_JER_WP90_R07N5 326 BTagging_JER_WP50_R07N6 327 BTagging_JER_WP70_R07N6 328 BTagging_JER_WP90_R07N6 329 BTagging_JER_WP50_R10N2 330 BTagging_JER_WP70_R10N2 331 BTagging_JER_WP90_R10N2 332 BTagging_JER_WP50_R10N3 333 BTagging_JER_WP70_R10N3 334 BTagging_JER_WP90_R10N3 335 BTagging_JER_WP50_R10N4 336 BTagging_JER_WP70_R10N4 337 BTagging_JER_WP90_R10N4 338 BTagging_JER_WP50_R10N5 339 BTagging_JER_WP70_R10N5 340 BTagging_JER_WP90_R10N5 341 BTagging_JER_WP50_R10N6 342 BTagging_JER_WP70_R10N6 343 BTagging_JER_WP90_R10N6 344 BTagging_JER_WP50_R12N2 345 BTagging_JER_WP70_R12N2 346 BTagging_JER_WP90_R12N2 347 BTagging_JER_WP50_R12N3 348 BTagging_JER_WP70_R12N3 349 BTagging_JER_WP90_R12N3 350 BTagging_JER_WP50_R12N4 351 BTagging_JER_WP70_R12N4 352 BTagging_JER_WP90_R12N4 353 BTagging_JER_WP50_R12N5 354 BTagging_JER_WP70_R12N5 355 BTagging_JER_WP90_R12N5 356 BTagging_JER_WP50_R12N6 357 BTagging_JER_WP70_R12N6 358 BTagging_JER_WP90_R12N6 359 BTagging_JER_WP50_R15N2 360 BTagging_JER_WP70_R15N2 361 BTagging_JER_WP90_R15N2 362 BTagging_JER_WP50_R15N3 363 BTagging_JER_WP70_R15N3 364 BTagging_JER_WP90_R15N3 365 BTagging_JER_WP50_R15N4 366 BTagging_JER_WP70_R15N4 367 BTagging_JER_WP90_R15N4 368 BTagging_JER_WP50_R15N5 369 BTagging_JER_WP70_R15N5 370 BTagging_JER_WP90_R15N5 371 BTagging_JER_WP50_R15N6 372 BTagging_JER_WP70_R15N6 373 BTagging_JER_WP90_R15N6 374 BTagging_JER_WP50_R05_inclusive 375 BTagging_JER_WP70_R05_inclusive 376 BTagging_JER_WP90_R05_inclusive 377 BTagging_JER_WP50_R07_inclusive 378 BTagging_JER_WP70_R07_inclusive 379 BTagging_JER_WP90_R07_inclusive 380 BTagging_JER_WP50_R10_inclusive 381 BTagging_JER_WP70_R10_inclusive 382 BTagging_JER_WP90_R10_inclusive 383 BTagging_JER_WP50_R12_inclusive 384 BTagging_JER_WP70_R12_inclusive 385 BTagging_JER_WP90_R12_inclusive 386 BTagging_JER_WP50_R15_inclusive 387 BTagging_JER_WP70_R15_inclusive 388 BTagging_JER_WP90_R15_inclusive 389 253 390 254 391 TauTagging_R05N2 … … 277 414 TauTagging_R15N5 278 415 TauTagging_R15N6 279 280 416 TauTagging_R05_inclusive 281 417 TauTagging_R07_inclusive … … 283 419 TauTagging_R12_inclusive 284 420 TauTagging_R15_inclusive 421 422 TauTagging_JER_R05N2 423 TauTagging_JER_R05N3 424 TauTagging_JER_R05N4 425 TauTagging_JER_R05N5 426 TauTagging_JER_R05N6 427 TauTagging_JER_R07N2 428 TauTagging_JER_R07N3 429 TauTagging_JER_R07N4 430 TauTagging_JER_R07N5 431 TauTagging_JER_R07N6 432 TauTagging_JER_R10N2 433 TauTagging_JER_R10N3 434 TauTagging_JER_R10N4 435 TauTagging_JER_R10N5 436 TauTagging_JER_R10N6 437 TauTagging_JER_R12N2 438 TauTagging_JER_R12N3 439 TauTagging_JER_R12N4 440 TauTagging_JER_R12N5 441 TauTagging_JER_R12N6 442 TauTagging_JER_R15N2 443 TauTagging_JER_R15N3 444 TauTagging_JER_R15N4 445 TauTagging_JER_R15N5 446 TauTagging_JER_R15N6 447 TauTagging_JER_R05_inclusive 448 TauTagging_JER_R07_inclusive 449 TauTagging_JER_R10_inclusive 450 TauTagging_JER_R12_inclusive 451 TauTagging_JER_R15_inclusive 285 452 286 453 … … 739 906 set OutputArray photons 740 907 741 set DeltaRMax 0. 5908 set DeltaRMax 0.1 742 909 743 910 set PTMin 0.5 744 911 745 set PTRatioMax 0. 12912 set PTRatioMax 0.2 746 913 } 747 914 … … 837 1004 set OutputArray electrons 838 1005 839 set DeltaRMax 0. 51006 set DeltaRMax 0.1 840 1007 841 1008 set PTMin 0.5 842 1009 843 set PTRatioMax 0. 121010 set PTRatioMax 0.2 844 1011 } 845 1012 … … 875 1042 set OutputArray muons 876 1043 877 set DeltaRMax 0. 51044 set DeltaRMax 0.1 878 1045 879 1046 set PTMin 0.5 880 1047 881 set PTRatioMax 0.2 51048 set PTRatioMax 0.2 882 1049 } 883 1050 … … 1000 1167 1001 1168 source CLIC/CLICdet_JetFlavorAssociation.tcl 1169 source CLIC/CLICdet_JetFlavorAssociation_JER.tcl 1002 1170 1003 1171 ########### … … 1007 1175 1008 1176 source CLIC/CLICdet_BTagging.tcl 1177 source CLIC/CLICdet_BTagging_JER.tcl 1009 1178 1010 1179 … … 1015 1184 1016 1185 source CLIC/CLICdet_TauTagging.tcl 1186 source CLIC/CLICdet_TauTagging_JER.tcl 1017 1187 1018 1188 -
cards/delphes_card_CLICdet_Stage3.tcl
re39abb4 r0e7d64a 1 1 ####################################### 2 2 # CLICdet model 3 # based on CLICdp-Note-2017-001 3 # based on arXiv:1812.07337 and 4 # CLICdp-Note-2017-001 5 # 4 6 # Ulrike Schnoor ulrike.schnoor@cern.ch 5 #6 7 # 7 8 # For the high energy stage of … … 11 12 # use exclusive clustering with njets 12 13 # according to final state 13 # 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 14 20 ####################################### 15 21 # Order of execution of various modules … … 125 131 126 132 JetFlavorAssociation_R05N2 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 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 238 279 BTaggingWP50_R05_inclusive 239 280 BTaggingWP70_R05_inclusive … … 252 293 BTaggingWP90_R15_inclusive 253 294 254 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 255 386 TauTagging_R05N2 256 387 TauTagging_R05N3 … … 278 409 TauTagging_R15N5 279 410 TauTagging_R15N6 280 281 411 TauTagging_R05_inclusive 282 412 TauTagging_R07_inclusive … … 285 415 TauTagging_R15_inclusive 286 416 417 TauTagging_JER_R05N2 418 TauTagging_JER_R05N3 419 TauTagging_JER_R05N4 420 TauTagging_JER_R05N5 421 TauTagging_JER_R05N6 422 TauTagging_JER_R07N2 423 TauTagging_JER_R07N3 424 TauTagging_JER_R07N4 425 TauTagging_JER_R07N5 426 TauTagging_JER_R07N6 427 TauTagging_JER_R10N2 428 TauTagging_JER_R10N3 429 TauTagging_JER_R10N4 430 TauTagging_JER_R10N5 431 TauTagging_JER_R10N6 432 TauTagging_JER_R12N2 433 TauTagging_JER_R12N3 434 TauTagging_JER_R12N4 435 TauTagging_JER_R12N5 436 TauTagging_JER_R12N6 437 TauTagging_JER_R15N2 438 TauTagging_JER_R15N3 439 TauTagging_JER_R15N4 440 TauTagging_JER_R15N5 441 TauTagging_JER_R15N6 442 TauTagging_JER_R05_inclusive 443 TauTagging_JER_R07_inclusive 444 TauTagging_JER_R10_inclusive 445 TauTagging_JER_R12_inclusive 446 TauTagging_JER_R15_inclusive 287 447 288 448 … … 730 890 } 731 891 892 732 893 ################## 733 894 # Photon isolation … … 740 901 set OutputArray photons 741 902 742 set DeltaRMax 0. 5903 set DeltaRMax 0.1 743 904 744 905 set PTMin 0.5 745 906 746 set PTRatioMax 0.12 747 } 907 set PTRatioMax 0.2 908 } 909 748 910 749 911 ##################### … … 838 1000 set OutputArray electrons 839 1001 840 set DeltaRMax 0. 51002 set DeltaRMax 0.1 841 1003 842 1004 set PTMin 0.5 843 1005 844 set PTRatioMax 0. 121006 set PTRatioMax 0.2 845 1007 } 846 1008 … … 876 1038 set OutputArray muons 877 1039 878 set DeltaRMax 0. 51040 set DeltaRMax 0.1 879 1041 880 1042 set PTMin 0.5 881 1043 882 set PTRatioMax 0.2 51044 set PTRatioMax 0.2 883 1045 } 884 1046 … … 1003 1165 1004 1166 source CLIC/CLICdet_JetFlavorAssociation.tcl 1167 source CLIC/CLICdet_JetFlavorAssociation_JER.tcl 1005 1168 1006 1169 ########### … … 1010 1173 1011 1174 source CLIC/CLICdet_BTagging.tcl 1175 source CLIC/CLICdet_BTagging_JER.tcl 1012 1176 1013 1177 … … 1018 1182 1019 1183 source CLIC/CLICdet_TauTagging.tcl 1184 source CLIC/CLICdet_TauTagging_JER.tcl 1020 1185 1021 1186 -
classes/DelphesClasses.cc
re39abb4 r0e7d64a 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 18 20 19 /** … … 122 121 Charge(0), Mass(0.0), 123 122 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0), 124 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),125 123 Flavor(0), FlavorAlgo(0), FlavorPhys(0), 126 124 BTag(0), BTagAlgo(0), BTagPhys(0), … … 129 127 Momentum(0.0, 0.0, 0.0, 0.0), 130 128 Position(0.0, 0.0, 0.0, 0.0), 129 InitialPosition(0.0, 0.0, 0.0, 0.0), 131 130 PositionError(0.0, 0.0, 0.0, 0.0), 132 InitialPosition(0.0, 0.0, 0.0, 0.0),133 131 Area(0.0, 0.0, 0.0, 0.0), 134 132 L(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), 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), 142 140 TrackResolution(0), 143 141 NCharged(0), … … 154 152 SumPtChargedPU(-999), 155 153 SumPt(-999), 154 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0), 156 155 NSubJetsTrimmed(0), 157 156 NSubJetsPruned(0), … … 236 235 return kFALSE; 237 236 } 238 239 237 240 238 //------------------------------------------------------------------------------ … … 304 302 object.PT = PT; 305 303 object.ErrorPT = ErrorPT; 306 object.CtgTheta = CtgTheta 304 object.CtgTheta = CtgTheta; 307 305 object.ErrorCtgTheta = ErrorCtgTheta; 308 306 object.Phi = Phi; 309 object.ErrorPhi = ErrorPhi; 307 object.ErrorPhi = ErrorPhi; 310 308 object.Xd = Xd; 311 309 object.Yd = Yd; … … 327 325 object.ClusterIndex = ClusterIndex; 328 326 object.ClusterNDF = ClusterNDF; 329 object.ClusterSigma = ClusterSigma; 327 object.ClusterSigma = ClusterSigma; 330 328 object.SumPT2 = SumPT2; 331 329 332 330 object.FracPt[0] = FracPt[0]; 333 331 object.FracPt[1] = FracPt[1]; … … 361 359 object.NSubJetsSoftDropped = NSubJetsSoftDropped; 362 360 363 object.SoftDroppedJet = SoftDroppedJet;361 object.SoftDroppedJet = SoftDroppedJet; 364 362 object.SoftDroppedSubJet1 = SoftDroppedSubJet1; 365 363 object.SoftDroppedSubJet2 = SoftDroppedSubJet2; … … 384 382 //------------------------------------------------------------------------------ 385 383 386 void Candidate::Clear(Option_t *option)384 void Candidate::Clear(Option_t *option) 387 385 { 388 386 int i; … … 391 389 PID = 0; 392 390 Status = 0; 393 M1 = -1; M2 = -1; D1 = -1; D2 = -1; 391 M1 = -1; 392 M2 = -1; 393 D1 = -1; 394 D2 = -1; 394 395 Charge = 0; 395 396 Mass = 0.0; … … 420 421 L = 0.0; 421 422 ErrorT = 0.0; 422 D0 = 0.0; 423 D0 = 0.0; 423 424 ErrorD0 = 0.0; 424 425 DZ = 0.0; 425 426 ErrorDZ = 0.0; 426 P = 0.0;427 ErrorP = 0.0;427 P = 0.0; 428 ErrorP = 0.0; 428 429 PT = 0.0; 429 430 ErrorPT = 0.0; … … 455 456 ClusterIndex = -1; 456 457 ClusterNDF = -99; 457 ClusterSigma = 0.0; 458 ClusterSigma = 0.0; 458 459 SumPT2 = 0.0; 459 460 BTVSumPT2 = 0.0; 460 461 GenDeltaZ = 0.0; 461 GenSumPT2 = 0.0; 462 462 GenSumPT2 = 0.0; 463 463 464 FracPt[0] = 0.0; 464 465 FracPt[1] = 0.0; … … 476 477 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0); 477 478 478 479 479 for(i = 0; i < 5; ++i) 480 480 { -
classes/DelphesClasses.h
re39abb4 r0e7d64a 32 32 // Dependencies (#includes) 33 33 34 #include "TLorentzVector.h" 35 #include "TObject.h" 34 36 #include "TRef.h" 35 #include "TObject.h"36 37 #include "TRefArray.h" 37 #include "TLorentzVector.h"38 38 39 39 #include "classes/SortableObject.h" … … 46 46 { 47 47 public: 48 49 48 Long64_t Number; // event number 50 49 … … 60 59 { 61 60 public: 62 63 61 Int_t Trigger; // trigger word 64 62 … … 71 69 { 72 70 public: 73 74 71 Int_t ProcessID; // subprocess code for the event | hepup.IDPRUP 75 72 … … 80 77 Float_t AlphaQCD; // value of the QCD coupling used in the event | hepup.AQCDUP 81 78 82 ClassDef(LHEFEvent, 2)79 ClassDef(LHEFEvent, 3) 83 80 }; 84 81 … … 99 96 { 100 97 public: 101 102 98 Int_t ProcessID; // unique signal process id | signal_process_id() 103 99 Int_t MPI; // number of multi parton interactions | mpi () … … 122 118 Float_t PDF2; // PDF (id2, x2, Q) | pdf_info()->pdf2() 123 119 124 125 126 ClassDef(HepMCEvent, 2) 120 ClassDef(HepMCEvent, 3) 127 121 }; 128 122 … … 181 175 { 182 176 public: 183 184 177 Float_t T; // vertex position (t component) 185 178 Float_t X; // vertex position (x component) … … 260 253 { 261 254 public: 262 263 255 Float_t PT; // photon transverse momentum 264 256 Float_t Eta; // photon pseudorapidity … … 287 279 TLorentzVector P4() const; 288 280 289 ClassDef(Photon, 3)281 ClassDef(Photon, 4) 290 282 }; 291 283 … … 295 287 { 296 288 public: 297 298 289 Float_t PT; // electron transverse momentum 299 290 Float_t Eta; // electron pseudorapidity … … 315 306 Float_t SumPt; // isolation variable 316 307 317 static CompBase *fgCompare; //! 318 const CompBase *GetCompare() const { return fgCompare; } 319 320 TLorentzVector P4() const; 321 322 ClassDef(Electron, 3) 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) 323 319 }; 324 320 … … 328 324 { 329 325 public: 330 331 326 Float_t PT; // muon transverse momentum 332 327 Float_t Eta; // muon pseudorapidity … … 346 341 Float_t SumPt; // isolation variable 347 342 348 static CompBase *fgCompare; //! 349 const CompBase *GetCompare() const { return fgCompare; } 350 351 TLorentzVector P4() const; 352 353 ClassDef(Muon, 3) 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) 354 354 }; 355 355 … … 359 359 { 360 360 public: 361 362 361 Float_t PT; // jet transverse momentum 363 362 Float_t Eta; // jet pseudorapidity … … 368 367 Float_t Mass; // jet invariant mass 369 368 370 Float_t DeltaEta; 371 Float_t DeltaPhi; 369 Float_t DeltaEta; // jet radius in pseudorapidity 370 Float_t DeltaPhi; // jet radius in azimuthal angle 372 371 373 372 UInt_t Flavor; // jet flavor … … 404 403 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 405 404 406 407 405 Int_t NSubJetsTrimmed; // number of subjets trimmed 408 406 Int_t NSubJetsPruned; // number of subjets pruned … … 413 411 Double_t ExclYmerge45; 414 412 Double_t ExclYmerge56; 415 413 416 414 TRefArray Constituents; // references to constituents 417 415 TRefArray Particles; // references to generated particles … … 423 421 TLorentzVector Area; 424 422 425 ClassDef(Jet, 3)423 ClassDef(Jet, 4) 426 424 }; 427 425 … … 616 614 617 615 Int_t NTimeHits; 618 std::vector< std::pair< Float_t, Float_t> > ECalEnergyTimePairs;616 std::vector<std::pair<Float_t, Float_t> > ECalEnergyTimePairs; 619 617 620 618 // Isolation variables … … 660 658 Double_t ExclYmerge45; 661 659 Double_t ExclYmerge56; 662 660 663 661 static CompBase *fgCompare; //! 664 662 const CompBase *GetCompare() const { return fgCompare; } … … 671 669 virtual void Copy(TObject &object) const; 672 670 virtual TObject *Clone(const char *newname = "") const; 673 virtual void Clear(Option_t *option = "");671 virtual void Clear(Option_t *option = ""); 674 672 675 673 private: … … 679 677 void SetFactory(DelphesFactory *factory) { fFactory = factory; } 680 678 681 ClassDef(Candidate, 5)679 ClassDef(Candidate, 6) 682 680 }; 683 681 684 682 #endif // DelphesClasses_h 685 686 -
classes/DelphesCylindricalFormula.cc
re39abb4 r0e7d64a 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 18 20 19 #include "classes/DelphesCylindricalFormula.h" … … 54 53 for(it = expression; *it; ++it) 55 54 { 56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' 55 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\') continue; 57 56 buffer.Append(*it); 58 57 } -
classes/DelphesCylindricalFormula.h
re39abb4 r0e7d64a 25 25 { 26 26 public: 27 28 27 DelphesCylindricalFormula(); 29 28 … … 38 37 39 38 #endif /* DelphesCylindricalFormula_h */ 40 -
classes/DelphesFactory.cc
re39abb4 r0e7d64a 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 18 20 19 /** \class DelphesFactory … … 51 50 if(fObjArrays) delete fObjArrays; 52 51 53 map< const TClass*, ExRootTreeBranch*>::iterator itBranches;52 map<const TClass *, ExRootTreeBranch *>::iterator itBranches; 54 53 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 55 54 { 56 delete 55 delete(itBranches->second); 57 56 } 58 57 } … … 60 59 //------------------------------------------------------------------------------ 61 60 62 void DelphesFactory::Clear(Option_t *option)61 void DelphesFactory::Clear(Option_t *option) 63 62 { 64 63 set<TObject *>::iterator itPool; … … 70 69 TProcessID::SetObjectCount(0); 71 70 72 map< const TClass*, ExRootTreeBranch*>::iterator itBranches;71 map<const TClass *, ExRootTreeBranch *>::iterator itBranches; 73 72 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 74 73 { … … 120 119 121 120 //------------------------------------------------------------------------------ 122 -
classes/DelphesFactory.h
re39abb4 r0e7d64a 42 42 { 43 43 public: 44 45 44 DelphesFactory(const char *name = "ObjectFactory"); 46 45 ~DelphesFactory(); 47 46 48 virtual void Clear(Option_t *option = "");49 47 virtual void Clear(Option_t *option = ""); 48 50 49 TObjArray *NewPermanentArray(); 51 50 … … 56 55 TObject *New(TClass *cl); 57 56 58 template <typename T>57 template <typename T> 59 58 T *New() { return static_cast<T *>(New(T::Class())); } 60 59 61 60 private: 62 63 61 ExRootTreeBranch *fObjArrays; //! 64 62 65 63 #if !defined(__CINT__) && !defined(__CLING__) 66 std::map< const TClass*, ExRootTreeBranch*> fBranches; //!64 std::map<const TClass *, ExRootTreeBranch *> fBranches; //! 67 65 #endif 68 66 69 std::set< TObject*> fPool; //!70 67 std::set<TObject *> fPool; //! 68 71 69 ClassDef(DelphesFactory, 1) 72 70 }; 73 71 74 72 #endif /* DelphesFactory */ 75 -
classes/DelphesFormula.cc
re39abb4 r0e7d64a 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 18 20 19 #include "classes/DelphesFormula.h" … … 54 53 for(it = expression; *it; ++it) 55 54 { 56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' 55 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\') continue; 57 56 buffer.Append(*it); 58 57 } … … 61 60 buffer.ReplaceAll("phi", "z"); 62 61 buffer.ReplaceAll("energy", "t"); 62 buffer.ReplaceAll("d0", "[0]"); 63 buffer.ReplaceAll("dz", "[1]"); 64 buffer.ReplaceAll("ctgTheta", "[2]"); 63 65 66 #if ROOT_VERSION_CODE < ROOT_VERSION(6, 3, 0) 67 TFormula::SetMaxima(100000, 1000, 1000000); 68 #endif 64 69 65 66 #if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)67 TFormula::SetMaxima(100000,1000,1000000);68 #endif69 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, Double_t energy) 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) 80 82 { 81 Double_t x[4] = {pt, eta, phi, energy}; 82 return EvalPar(x); 83 Double_t x[4] = {pt, eta, phi, energy}; 84 Double_t params[3] = {d0, dz, ctgTheta}; 85 return EvalPar(x, params); 83 86 } 84 87 -
classes/DelphesFormula.h
re39abb4 r0e7d64a 25 25 { 26 26 public: 27 28 27 DelphesFormula(); 29 28 … … 34 33 Int_t Compile(const char *expression); 35 34 36 Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0, Double_t energy = 0); 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); 37 38 }; 38 39 39 40 #endif /* DelphesFormula_h */ 40 -
classes/DelphesHepMCReader.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesHepMCReader 21 20 * … … 28 27 #include "classes/DelphesHepMCReader.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 31 #include <stdexcept> 33 32 34 33 #include <map> … … 37 36 #include <stdio.h> 38 37 38 #include "TDatabasePDG.h" 39 #include "TLorentzVector.h" 39 40 #include "TObjArray.h" 41 #include "TParticlePDG.h" 40 42 #include "TStopwatch.h" 41 #include "TDatabasePDG.h"42 #include "TParticlePDG.h"43 #include "TLorentzVector.h"44 43 45 44 #include "classes/DelphesClasses.h" … … 111 110 TObjArray *partonOutputArray) 112 111 { 113 map< int, pair< int, int> >::iterator itMotherMap;114 map< int, pair< int, int> >::iterator itDaughterMap;112 map<int, pair<int, int> >::iterator itMotherMap; 113 map<int, pair<int, int> >::iterator itDaughterMap; 115 114 char key, momentumUnit[4], positionUnit[3]; 116 115 int i, rc, state; … … 141 140 if(!rc) 142 141 { 143 cerr << "** ERROR: " << "invalid event format" << endl; 142 cerr << "** ERROR: " 143 << "invalid event format" << endl; 144 144 return kFALSE; 145 145 } … … 155 155 if(!rc) 156 156 { 157 cerr << "** ERROR: " << "invalid event format" << endl; 157 cerr << "** ERROR: " 158 << "invalid event format" << endl; 158 159 return kFALSE; 159 160 } … … 167 168 if(!rc) 168 169 { 169 cerr << "** ERROR: " << "invalid event format" << endl; 170 cerr << "** ERROR: " 171 << "invalid event format" << endl; 170 172 return kFALSE; 171 173 } … … 177 179 if(rc != 2) 178 180 { 179 cerr << "** ERROR: " << "invalid units format" << endl; 181 cerr << "** ERROR: " 182 << "invalid units format" << endl; 180 183 return kFALSE; 181 184 } … … 189 192 fMomentumCoefficient = 0.001; 190 193 } 191 194 192 195 if(strncmp(positionUnit, "MM", 3) == 0) 193 196 { … … 199 202 } 200 203 } 201 204 202 205 else if(key == 'C') 203 206 { … … 205 208 && bufferStream.ReadDbl(fCrossSectionError); 206 209 } 207 210 208 211 else if(key == 'F') 209 212 { … … 218 221 if(!rc) 219 222 { 220 cerr << "** ERROR: " << "invalid PDF format" << endl; 223 cerr << "** ERROR: " 224 << "invalid PDF format" << endl; 221 225 return kFALSE; 222 226 } … … 235 239 if(!rc) 236 240 { 237 cerr << "** ERROR: " << "invalid vertex format" << endl; 241 cerr << "** ERROR: " 242 << "invalid vertex format" << endl; 238 243 return kFALSE; 239 244 } … … 256 261 if(!rc) 257 262 { 258 cerr << "** ERROR: " << "invalid particle format" << endl; 263 cerr << "** ERROR: " 264 << "invalid particle format" << endl; 259 265 return kFALSE; 260 266 } … … 345 351 { 346 352 Weight *element; 347 vector< double>::const_iterator itWeight;353 vector<double>::const_iterator itWeight; 348 354 349 355 for(itWeight = fWeight.begin(); itWeight != fWeight.end(); ++itWeight) … … 374 380 375 381 pdgParticle = fPDG->GetParticle(fPID); 376 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;382 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999; 377 383 candidate->Mass = fMass; 378 384 … … 427 433 { 428 434 Candidate *candidate; 429 map< int, pair< int, int> >::iterator itMotherMap;430 map< int, pair< int, int> >::iterator itDaughterMap;435 map<int, pair<int, int> >::iterator itMotherMap; 436 map<int, pair<int, int> >::iterator itDaughterMap; 431 437 int i; 432 438 -
classes/DelphesHepMCReader.h
re39abb4 r0e7d64a 42 42 { 43 43 public: 44 45 44 DelphesHepMCReader(); 46 45 ~DelphesHepMCReader(); … … 62 61 63 62 private: 64 65 63 void AnalyzeParticle(DelphesFactory *factory, 66 64 TObjArray *allParticleOutputArray, … … 82 80 83 81 int fStateSize; 84 std::vector< int> fState;82 std::vector<int> fState; 85 83 86 84 int fWeightSize; 87 std::vector< double> fWeight;85 std::vector<double> fWeight; 88 86 89 87 double fCrossSection, fCrossSectionError; … … 100 98 int fParticleCounter; 101 99 102 std::map< int, std::pair < int, int> > fMotherMap;103 std::map< int, std::pair < int, int> > fDaughterMap;100 std::map<int, std::pair<int, int> > fMotherMap; 101 std::map<int, std::pair<int, int> > fDaughterMap; 104 102 }; 105 103 106 104 #endif // DelphesHepMCReader_h 107 108 -
classes/DelphesLHEFReader.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesLHEFReader 21 20 * … … 28 27 #include "classes/DelphesLHEFReader.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 31 #include <stdexcept> 33 32 34 33 #include <stdio.h> 35 34 35 #include "TDatabasePDG.h" 36 #include "TLorentzVector.h" 36 37 #include "TObjArray.h" 38 #include "TParticlePDG.h" 37 39 #include "TStopwatch.h" 38 #include "TDatabasePDG.h"39 #include "TParticlePDG.h"40 #include "TLorentzVector.h"41 40 42 41 #include "classes/DelphesClasses.h" … … 54 53 DelphesLHEFReader::DelphesLHEFReader() : 55 54 fInputFile(0), fBuffer(0), fPDG(0), 56 fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1), 55 fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1), fCrossSection(1) 57 56 58 57 { … … 124 123 if(!rc) 125 124 { 126 cerr << "** ERROR: " << "invalid event format" << endl; 125 cerr << "** ERROR: " 126 << "invalid event format" << endl; 127 127 return kFALSE; 128 128 } … … 148 148 if(!rc) 149 149 { 150 cerr << "** ERROR: " << "invalid particle format" << endl; 150 cerr << "** ERROR: " 151 << "invalid particle format" << endl; 151 152 return kFALSE; 152 153 } … … 162 163 if(!pch) 163 164 { 164 cerr << "** ERROR: " << "invalid weight format" << endl; 165 cerr << "** ERROR: " 166 << "invalid weight format" << endl; 165 167 return kFALSE; 166 168 } … … 172 174 if(!pch) 173 175 { 174 cerr << "** ERROR: " << "invalid weight format" << endl; 176 cerr << "** ERROR: " 177 << "invalid weight format" << endl; 175 178 return kFALSE; 176 179 } … … 181 184 if(!rc) 182 185 { 183 cerr << "** ERROR: " << "invalid weight format" << endl; 186 cerr << "** ERROR: " 187 << "invalid weight format" << endl; 184 188 return kFALSE; 185 189 } … … 192 196 if(!pch) 193 197 { 194 cerr << "** ERROR: " << "invalid cross section format" << endl; 198 cerr << "** ERROR: " 199 << "invalid cross section format" << endl; 195 200 return kFALSE; 196 201 } … … 199 204 if(!pch) 200 205 { 201 cerr << "** ERROR: " << "invalid cross section format" << endl; 206 cerr << "** ERROR: " 207 << "invalid cross section format" << endl; 202 208 return kFALSE; 203 209 } … … 208 214 if(!rc) 209 215 { 210 cerr << "** ERROR: " << "invalid cross section format" << endl; 216 cerr << "** ERROR: " 217 << "invalid cross section format" << endl; 211 218 return kFALSE; 212 219 } … … 249 256 { 250 257 LHEFWeight *element; 251 vector< pair< int, double> >::const_iterator itWeightList;258 vector<pair<int, double> >::const_iterator itWeightList; 252 259 253 260 for(itWeightList = fWeightList.begin(); itWeightList != fWeightList.end(); ++itWeightList) … … 279 286 280 287 pdgParticle = fPDG->GetParticle(fPID); 281 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;288 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999; 282 289 candidate->Mass = fMass; 283 290 -
classes/DelphesLHEFReader.h
re39abb4 r0e7d64a 30 30 #include <stdio.h> 31 31 32 #include <utility> 32 33 #include <vector> 33 #include <utility>34 34 35 35 class TObjArray; … … 42 42 { 43 43 public: 44 45 44 DelphesLHEFReader(); 46 45 ~DelphesLHEFReader(); … … 62 61 63 62 private: 64 65 63 void AnalyzeParticle(DelphesFactory *factory, 66 64 TObjArray *allParticleOutputArray, … … 83 81 int fPID, fStatus, fM1, fM2, fC1, fC2; 84 82 double fPx, fPy, fPz, fE, fMass; 85 86 std::vector< std::pair< int, double> > fWeightList;83 84 std::vector<std::pair<int, double> > fWeightList; 87 85 }; 88 86 89 87 #endif // DelphesLHEFReader_h 90 91 -
classes/DelphesModule.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesModule 21 20 * … … 30 29 #include "classes/DelphesFactory.h" 31 30 31 #include "ExRootAnalysis/ExRootResult.h" 32 #include "ExRootAnalysis/ExRootTreeBranch.h" 32 33 #include "ExRootAnalysis/ExRootTreeReader.h" 33 #include "ExRootAnalysis/ExRootTreeBranch.h"34 34 #include "ExRootAnalysis/ExRootTreeWriter.h" 35 #include "ExRootAnalysis/ExRootResult.h"36 35 37 #include "TROOT.h"38 36 #include "TClass.h" 39 37 #include "TFolder.h" 40 38 #include "TObjArray.h" 39 #include "TROOT.h" 41 40 42 41 #include <iostream> 42 #include <sstream> 43 43 #include <stdexcept> 44 #include <sstream>45 44 46 45 using namespace std; … … 157 156 return fFactory; 158 157 } 159 160 -
classes/DelphesModule.h
re39abb4 r0e7d64a 41 41 class DelphesFactory; 42 42 43 class DelphesModule: public ExRootTask 43 class DelphesModule: public ExRootTask 44 44 { 45 45 public: 46 47 46 DelphesModule(); 48 47 ~DelphesModule(); … … 61 60 62 61 protected: 63 64 62 ExRootTreeWriter *fTreeWriter; 65 63 DelphesFactory *fFactory; 66 64 67 65 private: 68 69 66 ExRootResult *fPlots; 70 67 … … 75 72 76 73 #endif /* DelphesModule_h */ 77 -
classes/DelphesPileUpReader.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesPileUpReader 21 20 * … … 28 27 #include "classes/DelphesPileUpReader.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 31 #include <stdexcept> 33 32 33 #include <stdint.h> 34 34 #include <stdio.h> 35 #include <stdint.h>36 35 37 36 #include "classes/DelphesXDRReader.h" … … 52 51 stringstream message; 53 52 54 fIndex = new uint8_t[kIndexSize *8];55 fBuffer = new uint8_t[kBufferSize *kRecordSize*4];53 fIndex = new uint8_t[kIndexSize * 8]; 54 fBuffer = new uint8_t[kBufferSize * kRecordSize * 4]; 56 55 fInputReader = new DelphesXDRReader; 57 56 fIndexReader = new DelphesXDRReader; … … 82 81 83 82 // read index of events 84 fseeko(fPileUpFile, -8 - 8 *fEntries, SEEK_END);85 fInputReader->ReadRaw(fIndex, fEntries *8);83 fseeko(fPileUpFile, -8 - 8 * fEntries, SEEK_END); 84 fInputReader->ReadRaw(fIndex, fEntries * 8); 86 85 } 87 86 … … 130 129 131 130 // read event position 132 fIndexReader->SetOffset(8 *entry);131 fIndexReader->SetOffset(8 * entry); 133 132 fIndexReader->ReadValue(&offset, 8); 134 133 … … 142 141 } 143 142 144 fInputReader->ReadRaw(fBuffer, fEntrySize *kRecordSize*4);143 fInputReader->ReadRaw(fBuffer, fEntrySize * kRecordSize * 4); 145 144 fBufferReader->SetOffset(0); 146 145 fCounter = 0; -
classes/DelphesPileUpReader.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include <stdint.h> 30 31 #include <stdio.h> 31 #include <stdint.h>32 32 33 33 class DelphesXDRReader; … … 36 36 { 37 37 public: 38 39 38 DelphesPileUpReader(const char *fileName); 40 39 … … 50 49 51 50 private: 52 53 51 int64_t fEntries; 54 52 -
classes/DelphesPileUpWriter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesPileUpWriter 21 20 * … … 28 27 #include "classes/DelphesPileUpWriter.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 31 #include <stdexcept> 33 32 33 #include <stdint.h> 34 34 #include <stdio.h> 35 #include <stdint.h>36 35 37 36 #include "classes/DelphesXDRWriter.h" … … 52 51 stringstream message; 53 52 54 fIndex = new uint8_t[kIndexSize *8];55 fBuffer = new uint8_t[kBufferSize *kRecordSize*4];53 fIndex = new uint8_t[kIndexSize * 8]; 54 fBuffer = new uint8_t[kBufferSize * kRecordSize * 4]; 56 55 fOutputWriter = new DelphesXDRWriter; 57 56 fIndexWriter = new DelphesXDRWriter; … … 118 117 119 118 fOutputWriter->WriteValue(&fEntrySize, 4); 120 fOutputWriter->WriteRaw(fBuffer, fEntrySize *kRecordSize*4);119 fOutputWriter->WriteRaw(fBuffer, fEntrySize * kRecordSize * 4); 121 120 122 121 fIndexWriter->WriteValue(&fOffset, 8); 123 fOffset += fEntrySize *kRecordSize*4 + 4;122 fOffset += fEntrySize * kRecordSize * 4 + 4; 124 123 125 124 fBufferWriter->SetOffset(0); … … 133 132 void DelphesPileUpWriter::WriteIndex() 134 133 { 135 fOutputWriter->WriteRaw(fIndex, fEntries *8);134 fOutputWriter->WriteRaw(fIndex, fEntries * 8); 136 135 fOutputWriter->WriteValue(&fEntries, 8); 137 136 } -
classes/DelphesPileUpWriter.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include <stdint.h> 30 31 #include <stdio.h> 31 #include <stdint.h>32 32 33 33 class DelphesXDRWriter; … … 36 36 { 37 37 public: 38 39 38 DelphesPileUpWriter(const char *fileName); 40 39 … … 50 49 51 50 private: 52 53 51 int64_t fEntries; 54 52 int32_t fEntrySize; -
classes/DelphesSTDHEPReader.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesSTDHEPReader 21 20 * … … 28 27 #include "classes/DelphesSTDHEPReader.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 33 34 #include <stdio.h> 31 #include <stdexcept> 32 35 33 #include <errno.h> 36 34 #include <stdint.h> 35 #include <stdio.h> 37 36 #include <string.h> 38 37 38 #include "TDatabasePDG.h" 39 #include "TLorentzVector.h" 39 40 #include "TObjArray.h" 41 #include "TParticlePDG.h" 40 42 #include "TStopwatch.h" 41 #include "TDatabasePDG.h"42 #include "TParticlePDG.h"43 #include "TLorentzVector.h"44 43 45 44 #include "classes/DelphesClasses.h" … … 51 50 using namespace std; 52 51 53 static const int kBufferSize 52 static const int kBufferSize = 1000000; 54 53 55 54 //--------------------------------------------------------------------------- … … 58 57 fInputFile(0), fBuffer(0), fPDG(0), fBlockType(-1) 59 58 { 60 fBuffer = new uint8_t[kBufferSize *96 + 24];59 fBuffer = new uint8_t[kBufferSize * 96 + 24]; 61 60 62 61 fPDG = TDatabasePDG::Instance(); … … 117 116 ReadEventHeader(); 118 117 } 119 else if(fBlockType == MCFIO_STDHEPBEG || 120 fBlockType == MCFIO_STDHEPEND) 118 else if(fBlockType == MCFIO_STDHEPBEG || fBlockType == MCFIO_STDHEPEND) 121 119 { 122 120 ReadSTDCM1(); … … 170 168 uint32_t size; 171 169 fReader[0].ReadValue(&size, 4); 172 SkipBytes(size *elsize);170 SkipBytes(size * elsize); 173 171 } 174 172 … … 178 176 { 179 177 uint32_t i; 180 enum STDHEPVersion {UNKNOWN, V1, V2, V21} version; 178 enum STDHEPVersion 179 { 180 UNKNOWN, 181 V1, 182 V2, 183 V21 184 } version; 181 185 182 186 // version 183 187 fReader[0].ReadString(fBuffer, 100); 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; 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; 189 198 190 199 if(version == UNKNOWN) … … 363 372 // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24 364 373 365 fReader[0].ReadRaw(fBuffer, 96 *fEventSize + 24);374 fReader[0].ReadRaw(fBuffer, 96 * fEventSize + 24); 366 375 367 376 fReader[1].SetBuffer(fBuffer); 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);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); 373 382 374 383 fReader[1].ReadValue(&idhepSize, 4); … … 391 400 fAlphaQCD = 0.0; 392 401 fScaleSize = 0; 393 memset(fScale, 0, 10 *sizeof(double));402 memset(fScale, 0, 10 * sizeof(double)); 394 403 } 395 404 … … 494 503 495 504 pdgParticle = fPDG->GetParticle(pid); 496 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;505 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999; 497 506 candidate->Mass = mass; 498 507 -
classes/DelphesSTDHEPReader.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include <stdint.h> 30 31 #include <stdio.h> 31 #include <stdint.h>32 32 33 33 #include "classes/DelphesXDRReader.h" … … 72 72 73 73 private: 74 75 74 void AnalyzeParticles(DelphesFactory *factory, 76 75 TObjArray *allParticleOutputArray, -
classes/DelphesStream.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesStream 21 20 * … … 28 27 #include "classes/DelphesStream.h" 29 28 29 #include <errno.h> 30 #include <limits.h> 31 #include <math.h> 32 #include <stdio.h> 30 33 #include <stdlib.h> 31 #include <limits.h>32 34 #include <string.h> 33 #include <stdio.h>34 #include <errno.h>35 #include <math.h>36 35 37 36 #include <iostream> … … 65 64 if(fFirstHugePos && value == HUGE_VAL) 66 65 { 67 fFirstHugePos = false; 66 fFirstHugePos = false; 68 67 cout << "** WARNING: too large positive value, return " << value << endl; 69 68 } 70 69 else if(fFirstHugeNeg && value == -HUGE_VAL) 71 70 { 72 fFirstHugeNeg = false; 71 fFirstHugeNeg = false; 73 72 cout << "** WARNING: too large negative value, return " << value << endl; 74 73 } 75 74 else if(fFirstZero) 76 75 { 77 fFirstZero = false; 76 fFirstZero = false; 78 77 value = 0.0; 79 78 cout << "** WARNING: too small value, return " << value << endl; … … 94 93 if(fFirstLongMin && value == LONG_MIN) 95 94 { 96 fFirstLongMin = false; 95 fFirstLongMin = false; 97 96 cout << "** WARNING: too large positive value, return " << value << endl; 98 97 } 99 98 else if(fFirstLongMax && value == LONG_MAX) 100 99 { 101 fFirstLongMax = false; 100 fFirstLongMax = false; 102 101 cout << "** WARNING: too large negative value, return " << value << endl; 103 102 } -
classes/DelphesStream.h
re39abb4 r0e7d64a 31 31 { 32 32 public: 33 34 33 DelphesStream(char *buffer); 35 34 … … 38 37 39 38 private: 39 char *fBuffer; 40 40 41 char *fBuffer;42 43 41 static bool fFirstLongMin; 44 42 static bool fFirstLongMax; … … 49 47 50 48 #endif // DelphesStream_h 51 52 -
classes/DelphesTF2.cc
re39abb4 r0e7d64a 32 32 { 33 33 34 #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 04,00)34 #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 3, 0) 35 35 fFormula = new TFormula(); 36 36 #endif 37 38 39 37 } 40 38 … … 60 58 for(it = expression; *it; ++it) 61 59 { 62 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' 60 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\') continue; 63 61 buffer.Append(*it); 64 62 } 65 63 buffer.ReplaceAll("z", "x"); 66 64 buffer.ReplaceAll("t", "y"); 67 #if ROOT_VERSION_CODE < ROOT_VERSION(6, 04,00)65 #if ROOT_VERSION_CODE < ROOT_VERSION(6, 3, 0) 68 66 if(TF2::Compile(buffer) != 0) 69 67 #else -
classes/DelphesTF2.h
re39abb4 r0e7d64a 25 25 { 26 26 public: 27 28 27 DelphesTF2(); 29 28 -
classes/DelphesXDRReader.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesXDRReader 21 20 * … … 28 27 #include "classes/DelphesXDRReader.h" 29 28 29 #include <stdint.h> 30 30 #include <stdio.h> 31 #include <stdint.h>32 31 #include <string.h> 33 32 … … 109 108 110 109 if(size > maxSize) size = maxSize; 111 110 112 111 if(fBuffer) 113 112 { -
classes/DelphesXDRReader.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include <stdint.h> 30 31 #include <stdio.h> 31 #include <stdint.h>32 32 33 33 class DelphesXDRReader 34 34 { 35 35 public: 36 37 36 DelphesXDRReader(); 38 37 … … 46 45 47 46 private: 48 49 47 FILE *fFile; 50 48 uint8_t *fBuffer; -
classes/DelphesXDRWriter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DelphesXDRWriter 21 20 * … … 28 27 #include "classes/DelphesXDRWriter.h" 29 28 29 #include <stdint.h> 30 30 #include <stdio.h> 31 #include <stdint.h>32 31 #include <string.h> 33 32 -
classes/DelphesXDRWriter.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include <stdint.h> 30 31 #include <stdio.h> 31 #include <stdint.h>32 32 33 33 class DelphesXDRWriter 34 34 { 35 35 public: 36 37 36 DelphesXDRWriter(); 38 37 … … 45 44 46 45 private: 47 48 46 FILE *fFile; 49 47 uint8_t *fBuffer; -
classes/SortableObject.h
re39abb4 r0e7d64a 26 26 */ 27 27 28 #include "TObject.h" 28 29 #include "TRef.h" 29 #include "TObject.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 50 49 Bool_t IsSortable() const { return GetCompare() ? GetCompare()->IsSortable(this) : kFALSE; } 51 50 Int_t Compare(const TObject *obj) const { return GetCompare()->Compare(this, obj); } … … 64 63 { 65 64 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 *>(obj1);76 const T *t2 = static_cast<const T *>(obj2);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 92 93 public: 93 94 static CompPT *Instance() … … 99 100 Int_t Compare(const TObject *obj1, const TObject *obj2) const 100 101 { 101 const T *t1 = static_cast<const T *>(obj1);102 const T *t2 = static_cast<const T *>(obj2);102 const T *t1 = static_cast<const T *>(obj1); 103 const T *t2 = static_cast<const T *>(obj2); 103 104 if(t1->PT > t2->PT) 104 105 return -1; … … 116 117 { 117 118 CompMomentumPt() {} 119 118 120 public: 119 121 static CompMomentumPt *Instance() … … 125 127 Int_t Compare(const TObject *obj1, const TObject *obj2) const 126 128 { 127 const T *t1 = static_cast<const T *>(obj1);128 const T *t2 = static_cast<const T *>(obj2);129 const T *t1 = static_cast<const T *>(obj1); 130 const T *t2 = static_cast<const T *>(obj2); 129 131 if(t1->Momentum.Pt() > t2->Momentum.Pt()) 130 132 return -1; … … 142 144 { 143 145 CompET() {} 146 144 147 public: 145 148 static CompET *Instance() … … 151 154 Int_t Compare(const TObject *obj1, const TObject *obj2) const 152 155 { 153 const T *t1 = static_cast<const T *>(obj1);154 const T *t2 = static_cast<const T *>(obj2);156 const T *t1 = static_cast<const T *>(obj1); 157 const T *t2 = static_cast<const T *>(obj2); 155 158 if(t1->ET > t2->ET) 156 159 return -1; … … 168 171 { 169 172 CompSumPT2() {} 173 170 174 public: 171 175 static CompSumPT2 *Instance() … … 177 181 Int_t Compare(const TObject *obj1, const TObject *obj2) const 178 182 { 179 const T *t1 = static_cast<const T *>(obj1);180 const T *t2 = static_cast<const T *>(obj2);183 const T *t1 = static_cast<const T *>(obj1); 184 const T *t2 = static_cast<const T *>(obj2); 181 185 if(t1->SumPT2 > t2->SumPT2) 182 186 return -1; … … 193 197 class CompDeltaR: public CompBase 194 198 { 195 CompDeltaR(const T2 *obj = 0) : fObj(obj) {} 199 CompDeltaR(const T2 *obj = 0) : 200 fObj(obj) {} 196 201 197 202 Double_t DeltaPhi(Double_t phi1, Double_t phi2) 198 203 { 199 204 Double_t phi = TMath::Abs(phi1 - phi2); 200 return (phi <= TMath::Pi()) ? phi : (2.0 *TMath::Pi()) - phi;201 } 202 203 Double_t Sqr(Double_t x) { return x *x; }205 return (phi <= TMath::Pi()) ? phi : (2.0 * TMath::Pi()) - phi; 206 } 207 208 Double_t Sqr(Double_t x) { return x * x; } 204 209 205 210 Double_t SumSqr(Double_t a, Double_t b) … … 207 212 Double_t aAbs = TMath::Abs(a); 208 213 Double_t bAbs = TMath::Abs(b); 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)); 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)); 211 218 }; 212 219 … … 214 221 215 222 public: 216 217 { 218 219 223 static CompDeltaR *Instance(const T2 *obj = 0) 224 { 225 static CompDeltaR single(obj); 226 return &single; 220 227 } 221 228 … … 225 232 { 226 233 Double_t eta[3], phi[3], deltaR[2]; 227 const T1 *t1 = static_cast<const T1 *>(obj1);228 const T1 *t2 = static_cast<const T1 *>(obj2);234 const T1 *t1 = static_cast<const T1 *>(obj1); 235 const T1 *t2 = static_cast<const T1 *>(obj2); 229 236 230 237 eta[0] = fObj->Eta; … … 250 257 251 258 #endif // SortableObject_h 252 253 -
converters/hepmc2pileup.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h"27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h"32 #include "TParticlePDG.h"33 #include "TLorentzVector.h"34 34 35 35 #include "classes/DelphesClasses.h" … … 38 38 #include "classes/DelphesPileUpWriter.h" 39 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 74 75 cout << " output_file - output binary pile-up file," << endl; 75 76 cout << " input_file(s) - input file(s) in HepMC format," << endl; … … 142 143 reader->Clear(); 143 144 while(reader->ReadBlock(factory, allParticleOutputArray, 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 145 147 { 146 148 if(reader->EventReady()) … … 149 151 150 152 itParticle->Reset(); 151 while((candidate = static_cast<Candidate *>(itParticle->Next())))153 while((candidate = static_cast<Candidate *>(itParticle->Next()))) 152 154 { 153 155 const TLorentzVector &position = candidate->Position; … … 173 175 174 176 ++i; 175 } 176 while(i < argc); 177 } while(i < argc); 177 178 178 179 writer->WriteIndex(); -
converters/lhco2root.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 22 23 #include <stdlib.h> 21 #include <stdexcept> 22 24 23 #include <signal.h> 25 24 #include <stdio.h> 26 25 #include <stdlib.h> 26 27 #include "TApplication.h" 27 28 #include "TROOT.h" 28 #include "TApplication.h" 29 29 30 #include "TDatabasePDG.h" 30 31 #include "TFile.h" 32 #include "TLorentzVector.h" 31 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 32 35 #include "TStopwatch.h" 33 #include "TDatabasePDG.h" 34 #include "TParticlePDG.h" 35 #include "TLorentzVector.h" 36 37 #include "modules/Delphes.h" 38 #include "classes/DelphesStream.h" 36 39 37 #include "classes/DelphesClasses.h" 40 38 #include "classes/DelphesFactory.h" 41 39 #include "classes/DelphesStream.h" 40 #include "modules/Delphes.h" 41 42 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h" 42 44 #include "ExRootAnalysis/ExRootTreeWriter.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h"44 #include "ExRootAnalysis/ExRootProgressBar.h"45 45 46 46 using namespace std; 47 47 48 static const int kBufferSize 48 static const int kBufferSize = 1024; 49 49 50 50 /* … … 74 74 75 75 private: 76 77 76 void AddMissingEvents(); 78 77 … … 86 85 void AnalyseMissingET(ExRootTreeBranch *branch); 87 86 88 enum {kIntParamSize = 2, kDblParamSize = 7}; 87 enum 88 { 89 kIntParamSize = 2, 90 kDblParamSize = 7 91 }; 89 92 Int_t fIntParam[kIntParamSize]; 90 93 Double_t fDblParam[kDblParamSize]; … … 106 109 ExRootTreeBranch *fBranchJet; 107 110 ExRootTreeBranch *fBranchMissingET; 108 109 111 }; 110 112 … … 169 171 if(!rc) 170 172 { 171 cerr << "** ERROR: " << "invalid event format" << endl; 173 cerr << "** ERROR: " 174 << "invalid event format" << endl; 172 175 return kFALSE; 173 176 } … … 195 198 if(!rc) 196 199 { 197 cerr << "** ERROR: " << "invalid object format" << endl; 200 cerr << "** ERROR: " 201 << "invalid object format" << endl; 198 202 return kFALSE; 199 203 } … … 201 205 switch(fIntParam[1]) 202 206 { 203 204 205 206 207 208 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; 209 213 } 210 214 } … … 228 232 LHCOEvent *element; 229 233 230 element = static_cast<LHCOEvent *>(branch->NewEntry());234 element = static_cast<LHCOEvent *>(branch->NewEntry()); 231 235 232 236 element->Number = fEventNumber; … … 240 244 Photon *element; 241 245 242 element = static_cast<Photon *>(branch->NewEntry());246 element = static_cast<Photon *>(branch->NewEntry()); 243 247 244 248 element->Eta = fDblParam[0]; … … 254 258 Electron *element; 255 259 256 element = static_cast<Electron *>(branch->NewEntry());260 element = static_cast<Electron *>(branch->NewEntry()); 257 261 258 262 element->Eta = fDblParam[0]; … … 261 265 262 266 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 263 /*267 /* 264 268 element->Ntrk = TMath::Abs(fDblParam[4]); 265 269 */ … … 273 277 Muon *element; 274 278 275 element = static_cast<Muon *>(branch->NewEntry());279 element = static_cast<Muon *>(branch->NewEntry()); 276 280 277 281 element->Eta = fDblParam[0]; … … 280 284 281 285 element->Charge = fDblParam[4] < 0.0 ? -1 : 1; 282 /*286 /* 283 287 element->Ntrk = TMath::Abs(fDblParam[4]); 284 288 … … 296 300 Jet *element; 297 301 298 element = static_cast<Jet *>(branch->NewEntry());302 element = static_cast<Jet *>(branch->NewEntry()); 299 303 300 304 element->Eta = fDblParam[0]; … … 308 312 309 313 element->Charge = fDblParam[4] < 0 ? -1 : 1; 310 /*314 /* 311 315 element->Ntrk = TMath::Abs(fDblParam[4]); 312 316 */ … … 320 324 Jet *element; 321 325 322 element = static_cast<Jet *>(branch->NewEntry());326 element = static_cast<Jet *>(branch->NewEntry()); 323 327 324 328 element->Eta = fDblParam[0]; … … 327 331 328 332 element->Mass = fDblParam[3]; 329 /*333 /* 330 334 element->Ntrk = TMath::Abs(Int_t(fDblParam[4])); 331 335 */ … … 336 340 337 341 element->EhadOverEem = fDblParam[6]; 338 /*342 /* 339 343 element->Index = fIntParam[0]; 340 344 */ … … 347 351 MissingET *element; 348 352 349 element = static_cast<MissingET *>(branch->NewEntry());353 element = static_cast<MissingET *>(branch->NewEntry()); 350 354 351 355 element->Phi = fDblParam[1]; … … 376 380 if(argc < 2) 377 381 { 378 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 382 cout << " Usage: " << appName << " output_file" 383 << " [input_file(s)]" << endl; 379 384 cout << " output_file - output file in ROOT format," << endl; 380 385 cout << " input_file(s) - input file(s) in LHCO format," << endl; … … 456 461 457 462 ++i; 458 } 459 while(i < argc); 463 } while(i < argc); 460 464 461 465 cout << "** Exiting..." << endl; … … 474 478 } 475 479 } 476 477 -
converters/pileup2root.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 #include <stdexcept>21 19 #include <iostream> 22 20 #include <sstream> 23 24 #include <stdlib.h> 21 #include <stdexcept> 22 25 23 #include <signal.h> 26 24 #include <stdio.h> 27 25 #include <stdlib.h> 26 27 #include "TApplication.h" 28 28 #include "TROOT.h" 29 #include "TApplication.h" 30 29 30 #include "TDatabasePDG.h" 31 31 #include "TFile.h" 32 #include "TLorentzVector.h" 32 33 #include "TObjArray.h" 34 #include "TParticlePDG.h" 33 35 #include "TStopwatch.h" 34 #include "TDatabasePDG.h" 35 #include "TParticlePDG.h" 36 #include "TLorentzVector.h" 37 38 #include "classes/DelphesStream.h" 36 39 37 #include "classes/DelphesClasses.h" 40 38 #include "classes/DelphesFactory.h" 41 39 #include "classes/DelphesPileUpReader.h" 42 40 #include "classes/DelphesStream.h" 41 42 #include "ExRootAnalysis/ExRootProgressBar.h" 43 #include "ExRootAnalysis/ExRootTreeBranch.h" 43 44 #include "ExRootAnalysis/ExRootTreeWriter.h" 44 #include "ExRootAnalysis/ExRootTreeBranch.h"45 #include "ExRootAnalysis/ExRootProgressBar.h"46 45 47 46 using namespace std; … … 62 61 while(reader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 63 62 { 64 particle = static_cast<GenParticle *>(branch->NewEntry());63 particle = static_cast<GenParticle *>(branch->NewEntry()); 65 64 66 65 particle->PID = pid; … … 84 83 85 84 pdgParticle = pdg->GetParticle(pid); 86 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;85 particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 87 86 88 87 particle->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; … … 92 91 cosTheta = TMath::Abs(momentum.CosTheta()); 93 92 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 94 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());95 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());93 eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta()); 94 rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity()); 96 95 97 96 particle->Eta = eta; … … 126 125 if(argc != 3) 127 126 { 128 cout << " Usage: " << appName << " output_file" << " input_file" << endl; 127 cout << " Usage: " << appName << " output_file" 128 << " 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
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <fstream> 20 #include <iostream> 21 #include <sstream> 19 22 #include <stdexcept> 20 #include <iostream>21 #include <fstream>22 #include <sstream>23 23 #include <string> 24 24 25 #include <stdlib.h>26 25 #include <signal.h> 27 26 #include <stdio.h> 28 27 #include <stdlib.h> 28 29 #include "TApplication.h" 29 30 #include "TROOT.h" 30 #include "TApplication.h" 31 31 32 #include "TClonesArray.h" 32 33 #include "TFile.h" 33 #include "TClonesArray.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 37 #include "ExRootAnalysis/ExRootProgressBar.h" 37 38 #include "ExRootAnalysis/ExRootTreeReader.h" 38 #include "ExRootAnalysis/ExRootProgressBar.h"39 39 40 40 using namespace std; … … 62 62 63 63 private: 64 65 64 void Reset(); 66 65 void Write(); … … 76 75 void AnalyseMissingET(); 77 76 78 enum {kIntParamSize = 2, kDblParamSize = 9}; 77 enum 78 { 79 kIntParamSize = 2, 80 kDblParamSize = 9 81 }; 79 82 Int_t fIntParam[kIntParamSize]; 80 83 Double_t fDblParam[kDblParamSize]; … … 132 135 fBranchMissingET = fTreeReader->UseBranch("MissingET"); 133 136 134 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || 135 !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 137 if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET) 136 138 { 137 139 throw runtime_error("ROOT file doesn't contain all required branches"); … … 202 204 Event *element; 203 205 204 element = static_cast<Event *>(fBranchEvent->At(0));206 element = static_cast<Event *>(fBranchEvent->At(0)); 205 207 206 208 fprintf(fOutputFile, "%4d %13lld %8d\n", 0, element->Number, 0); … … 216 218 217 219 fItPhoton->Reset(); 218 while((element = static_cast<Photon *>(fItPhoton->Next())))220 while((element = static_cast<Photon *>(fItPhoton->Next()))) 219 221 { 220 222 Reset(); … … 239 241 240 242 fItElectron->Reset(); 241 while((element = static_cast<Electron *>(fItElectron->Next())))243 while((element = static_cast<Electron *>(fItElectron->Next()))) 242 244 { 243 245 Reset(); … … 270 272 muonCounter = 0; 271 273 fItMuon->Reset(); 272 while((element = static_cast<Muon *>(fItMuon->Next())))274 while((element = static_cast<Muon *>(fItMuon->Next()))) 273 275 { 274 276 Reset(); … … 276 278 sumPT = 0.0; 277 279 fItTrack->Reset(); 278 while((track = static_cast<Track *>(fItTrack->Next())))280 while((track = static_cast<Track *>(fItTrack->Next()))) 279 281 { 280 282 if(element->P4().DeltaR(track->P4()) < 0.5) sumPT += track->PT; … … 283 285 sumET = 0.0; 284 286 fItTower->Reset(); 285 while((tower = static_cast<Tower *>(fItTower->Next())))287 while((tower = static_cast<Tower *>(fItTower->Next()))) 286 288 { 287 289 if(element->P4().DeltaR(tower->P4()) < 0.5) sumET += tower->ET; … … 293 295 minDR = 1.0E9; 294 296 fItJet->Reset(); 295 while((jet = static_cast<Jet *>(fItJet->Next())))297 while((jet = static_cast<Jet *>(fItJet->Next()))) 296 298 { 297 299 if(jet->TauTag != 0) … … 325 327 } 326 328 327 ratET = sumET /element->PT;329 ratET = sumET / element->PT; 328 330 fDblParam[6] = Float_t(TMath::Nint(sumPT)) + (ratET < 1.0 ? ratET : 0.99); 329 331 … … 342 344 343 345 fItJet->Reset(); 344 while((element = static_cast<Jet *>(fItJet->Next())))346 while((element = static_cast<Jet *>(fItJet->Next()))) 345 347 { 346 348 if(element->TauTag == 0) continue; … … 350 352 counter = 1; 351 353 352 /*354 /* 353 355 fItTrack->Reset(); 354 356 while((track = static_cast<Track*>(fItTrack->Next()))) … … 380 382 381 383 fItJet->Reset(); 382 while((element = static_cast<Jet *>(fItJet->Next())))384 while((element = static_cast<Jet *>(fItJet->Next()))) 383 385 { 384 386 if(element->TauTag != 0) continue; … … 388 390 counter = 0; 389 391 fItTrack->Reset(); 390 while((track = static_cast<Track *>(fItTrack->Next())))392 while((track = static_cast<Track *>(fItTrack->Next()))) 391 393 { 392 394 if(element->P4().DeltaR(track->P4()) < 0.5) ++counter; … … 413 415 MissingET *element; 414 416 415 element = static_cast<MissingET *>(fBranchMissingET->At(0));417 element = static_cast<MissingET *>(fBranchMissingET->At(0)); 416 418 417 419 Reset(); … … 471 473 if(argc < 2 || argc > 4) 472 474 { 473 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl; 475 cerr << " Usage: " << appName << " input_file" 476 << " [output_file] [--jet-branch=Jet]" << endl; 474 477 cerr << " input_file - input file in ROOT format," << endl; 475 478 cerr << " output_file - output file in LHCO format," << endl; -
converters/root2pileup.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 #include <string> 23 23 24 24 #include <signal.h> 25 25 26 #include "TApplication.h" 26 27 #include "TROOT.h" 27 #include "TApplication.h"28 28 29 #include "TClonesArray.h" 29 30 #include "TFile.h" 30 #include "TClonesArray.h"31 31 32 32 #include "classes/DelphesClasses.h" 33 33 #include "classes/DelphesPileUpWriter.h" 34 34 35 #include "ExRootAnalysis/ExRootProgressBar.h" 35 36 #include "ExRootAnalysis/ExRootTreeReader.h" 36 #include "ExRootAnalysis/ExRootProgressBar.h"37 37 38 38 using namespace std; … … 64 64 if(argc < 3) 65 65 { 66 cout << " Usage: " << appName << " output_file" << " input_file(s)" << endl; 66 cout << " Usage: " << appName << " output_file" 67 << " input_file(s)" << endl; 67 68 cout << " output_file - output binary pile-up file," << endl; 68 69 cout << " input_file(s) - input file(s) in ROOT format." << endl; … … 108 109 109 110 itParticle->Reset(); 110 while((particle = static_cast<GenParticle *>(itParticle->Next())))111 while((particle = static_cast<GenParticle *>(itParticle->Next()))) 111 112 { 112 113 writer->WriteParticle(particle->PID, … … 114 115 particle->Px, particle->Py, particle->Pz, particle->E); 115 116 } 116 117 117 118 writer->WriteEntry(); 118 119 -
converters/stdhep2pileup.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h"27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h"32 #include "TParticlePDG.h"33 #include "TLorentzVector.h"34 34 35 35 #include "classes/DelphesClasses.h" 36 36 #include "classes/DelphesFactory.h" 37 #include "classes/DelphesPileUpWriter.h" 37 38 #include "classes/DelphesSTDHEPReader.h" 38 #include "classes/DelphesPileUpWriter.h"39 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 71 71 if(argc < 2) 72 72 { 73 cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl; 73 cout << " Usage: " << appName << " output_file" 74 << " [input_file(s)]" << endl; 74 75 cout << " output_file - output binary pile-up file," << endl; 75 76 cout << " input_file(s) - input file(s) in STDHEP format," << endl; … … 142 143 reader->Clear(); 143 144 while(reader->ReadBlock(factory, allParticleOutputArray, 144 stableParticleOutputArray, partonOutputArray) && !interrupted) 145 stableParticleOutputArray, partonOutputArray) 146 && !interrupted) 145 147 { 146 148 if(reader->EventReady()) … … 149 151 150 152 itParticle->Reset(); 151 while((candidate = static_cast<Candidate *>(itParticle->Next())))153 while((candidate = static_cast<Candidate *>(itParticle->Next()))) 152 154 { 153 155 const TLorentzVector &position = candidate->Position; … … 173 175 174 176 ++i; 175 } 176 while(i < argc); 177 } while(i < argc); 177 178 178 179 writer->WriteIndex(); -
display/Delphes3DGeometry.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <algorithm> 20 #include <cassert> 21 #include <map> 19 22 #include <set> 20 #include < map>23 #include <sstream> 21 24 #include <utility> 22 25 #include <vector> 23 #include <algorithm>24 #include <sstream>25 #include <cassert>26 26 27 27 #include "TAxis.h" 28 #include "TF2.h" 29 #include "TFormula.h" 30 #include "TGeoArb8.h" 31 #include "TGeoCompositeShape.h" 32 #include "TGeoCone.h" 28 33 #include "TGeoManager.h" 29 #include "TGeo Volume.h"34 #include "TGeoMatrix.h" 30 35 #include "TGeoMedium.h" 31 36 #include "TGeoNode.h" 32 #include "TGeoCompositeShape.h"33 #include "TGeoMatrix.h"34 37 #include "TGeoTube.h" 35 #include "TGeoCone.h" 36 #include "TGeoArb8.h" 37 #include "TF2.h" 38 #include "TFormula.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 //--- 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.; 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.; 86 88 } 87 89 88 90 void Delphes3DGeometry::readFile(const char *configFile, 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 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 } -
display/Delphes3DGeometry.h
re39abb4 r0e7d64a 20 20 #define Delphes3DGeometry_h 21 21 22 #include <map> 22 23 #include <set> 23 #include <map>24 24 #include <vector> 25 25 … … 33 33 // TODO: asymmetric detector 34 34 35 class Delphes3DGeometry { 36 public: 37 Delphes3DGeometry(TGeoManager *geom = NULL, bool transp = false); 38 ~Delphes3DGeometry() {} 35 class Delphes3DGeometry 36 { 37 public: 38 Delphes3DGeometry(TGeoManager *geom = NULL, bool transp = false); 39 ~Delphes3DGeometry() {} 39 40 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");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"); 44 45 45 46 47 48 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; } 49 50 50 51 TGeoVolume *getDetector(bool withTowers = true); 51 52 52 53 54 55 56 57 std::pair<TAxis*, TAxis*> getCaloAxes() { return std::make_pair(etaAxis_,phiAxis_); }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_); } 58 59 59 60 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 63 void addCaloTowers(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >&caloBinning);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); 64 65 65 private: 66 private: 67 TGeoManager *geom_; 66 68 67 TGeoManager *geom_; 69 TGeoMedium *vacuum_; 70 TGeoMedium *tkmed_; 71 TGeoMedium *calomed_; 72 TGeoMedium *mudetmed_; 68 73 69 TGeoMedium *vacuum_; 70 TGeoMedium *tkmed_; 71 TGeoMedium *calomed_; 72 TGeoMedium *mudetmed_; 74 TAxis *etaAxis_; 75 TAxis *phiAxis_; 73 76 74 TAxis *etaAxis_; 75 TAxis *phiAxis_; 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_; 76 87 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_; 88 std::vector<std::string> calorimeters_; 89 std::vector<std::string> muondets_; 87 90 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 91 std::map<std::string, Double_t> muonSystem_etamax_; 92 std::map<std::string, std::set<std::pair<Double_t, Int_t> > > caloBinning_; 94 93 }; 95 94 -
display/DelphesBranchElement.cc
re39abb4 r0e7d64a 18 18 19 19 #include "display/DelphesBranchElement.h" 20 #include " classes/DelphesClasses.h"20 #include "TEveArrow.h" 21 21 #include "TEveJetCone.h" 22 22 #include "TEveTrack.h" 23 23 #include "TEveTrackPropagator.h" 24 #include "TEveArrow.h"25 24 #include "TEveVector.h" 25 #include "classes/DelphesClasses.h" 26 26 #include <iostream> 27 27 28 28 // special case for calo towers 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") { 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 { 38 45 // Loop over all towers 39 46 TIter itTower(branch_); 40 47 Tower *tower; 41 while((tower = (Tower *) itTower.Next())) { 48 while((tower = (Tower *)itTower.Next())) 49 { 42 50 data_->AddTower(tower->Edges[0], tower->Edges[1], tower->Edges[2], tower->Edges[3]); 43 51 data_->FillSlice(0, tower->Eem); … … 47 55 } 48 56 } 49 template<> std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors() { 57 template <> 58 std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors() 59 { 50 60 std::vector<TLorentzVector> output; 51 if(TString(GetType())=="Tower") { 61 if(TString(GetType()) == "Tower") 62 { 52 63 TIter itTower(branch_); 53 64 Tower *tower; 54 while((tower = (Tower *) itTower.Next())) { 65 while((tower = (Tower *)itTower.Next())) 66 { 55 67 TLorentzVector v; 56 v.SetPtEtaPhiM(tower->Eem +tower->Ehad,(tower->Edges[0]+tower->Edges[1])/2.,(tower->Edges[2]+tower->Edges[3])/2.,0.);68 v.SetPtEtaPhiM(tower->Eem + tower->Ehad, (tower->Edges[0] + tower->Edges[1]) / 2., (tower->Edges[2] + tower->Edges[3]) / 2., 0.); 57 69 output.push_back(v); 58 70 } … … 62 74 63 75 // special case for element lists 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") { 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 { 71 90 TIter itJet(branch_); 72 91 Jet *jet; … … 74 93 // Loop over all jets 75 94 Int_t counter = 0; 76 while((jet = (Jet *) itJet.Next())) { 95 while((jet = (Jet *)itJet.Next())) 96 { 77 97 eveJetCone = new TEveJetCone(); 78 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f", counter,jet->PT, jet->Eta, jet->Phi, jet->Mass));98 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f", counter, jet->PT, jet->Eta, jet->Phi, jet->Mass)); 79 99 eveJetCone->SetName(Form("jet [%d]", counter++)); 80 100 eveJetCone->SetMainTransparency(60); … … 86 106 data_->AddElement(eveJetCone); 87 107 } 88 } else if(TString(GetType())=="MissingET") { 108 } 109 else if(TString(GetType()) == "MissingET") 110 { 89 111 // MissingET as invisible track (like a photon) 90 112 MissingET *MET; … … 94 116 trkProp->SetMaxR(tkRadius_); 95 117 trkProp->SetMaxZ(tkHalfLength_); 96 if(branch_->GetEntriesFast() > 0) { 97 MET = (MissingET*) branch_->At(0); 118 if(branch_->GetEntriesFast() > 0) 119 { 120 MET = (MissingET *)branch_->At(0); 98 121 TParticle pb(13, 1, 0, 0, 0, 0, 99 (tkRadius_ * MET->MET/maxPt_)*cos(MET->Phi),100 (tkRadius_ * MET->MET/maxPt_)*sin(MET->Phi),101 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); 102 125 eveMet = new TEveTrack(&pb, 0, trkProp); 103 126 eveMet->SetName("Missing Et"); … … 115 138 } 116 139 } 117 template<> std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors() { 140 template <> 141 std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors() 142 { 118 143 std::vector<TLorentzVector> output; 119 if(TString(GetType())=="Jet") { 144 if(TString(GetType()) == "Jet") 145 { 120 146 TIter itJet(branch_); 121 147 Jet *jet; 122 148 // Loop over all jets 123 while((jet = (Jet *) itJet.Next())) { 149 while((jet = (Jet *)itJet.Next())) 150 { 124 151 TLorentzVector v; 125 152 v.SetPtEtaPhiM(jet->PT, jet->Eta, jet->Phi, jet->Mass); 126 153 output.push_back(v); 127 154 } 128 } else if(TString(GetType())=="MissingET") { 155 } 156 else if(TString(GetType()) == "MissingET") 157 { 129 158 TIter itMet(branch_); 130 159 MissingET *MET; 131 160 // Missing Et 132 while((MET = (MissingET*) itMet.Next())) { 161 while((MET = (MissingET *)itMet.Next())) 162 { 133 163 TLorentzVector v; 134 v.SetPtEtaPhiM(MET->MET, MET->Eta,MET->Phi,0.);164 v.SetPtEtaPhiM(MET->MET, MET->Eta, MET->Phi, 0.); 135 165 output.push_back(v); 136 166 } … … 140 170 141 171 // special case for track lists 142 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt):DelphesBranchBase(name, branch, color, maxPt) { 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 { 143 176 data_ = new TEveTrackList(name); 144 177 data_->SetMainColor(color_); … … 147 180 data_->SetMarkerSize(0.5); 148 181 } 149 template<> void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz) { 150 tkRadius_ = r; 182 template <> 183 void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz) 184 { 185 tkRadius_ = r; 151 186 tkHalfLength_ = l; 152 187 tk_Bz_ = Bz; … … 156 191 trkProp->SetMaxZ(tkHalfLength_); 157 192 } 158 template<> void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); } 159 template<> void DelphesBranchElement<TEveTrackList>::ReadBranch() { 193 template <> 194 void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); } 195 template <> 196 void DelphesBranchElement<TEveTrackList>::ReadBranch() 197 { 160 198 TString type = GetType(); 161 199 TIter itTrack(branch_); … … 167 205 trkProp->SetMaxZ(tkHalfLength_); 168 206 GenParticle *particle; 169 if(type=="Track") { // CASE 1: TRACKS 207 if(type == "Track") 208 { // CASE 1: TRACKS 170 209 Track *track; 171 while((track = (Track *) itTrack.Next())) { 210 while((track = (Track *)itTrack.Next())) 211 { 172 212 TParticle pb(track->PID, 1, 0, 0, 0, 0, 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 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 185 227 Electron *electron; 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 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 201 246 Muon *muon; 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 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 217 265 Photon *photon; 218 while((photon = (Photon *) itTrack.Next())) { 266 while((photon = (Photon *)itTrack.Next())) 267 { 219 268 TParticle pb(22, 1, 0, 0, 0, 0, 220 221 222 269 photon->P4().Px(), photon->P4().Py(), 270 photon->P4().Pz(), photon->P4().E(), 271 0.0, 0.0, 0.0, 0.0); 223 272 eveTrack = new TEveTrack(&pb, counter, trkProp); 224 273 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); … … 230 279 eveTrack->MakeTrack(); 231 280 } 232 } else if(type=="GenParticle") { // CASE 5: GENPARTICLES 281 } 282 else if(type == "GenParticle") 283 { // CASE 5: GENPARTICLES 233 284 GenParticle *particle; 234 while((particle = (GenParticle *) itTrack.Next())) { 285 while((particle = (GenParticle *)itTrack.Next())) 286 { 235 287 if(particle->Status != 1) continue; 236 288 TParticle pb(particle->PID, particle->Status, particle->M1, particle->M2, particle->D1, particle->D2, 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() { 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 { 252 306 std::vector<TLorentzVector> output; 253 307 TString type = GetType(); 254 308 TIter itTrack(branch_); 255 if(type=="Track") { // CASE 1: TRACKS 309 if(type == "Track") 310 { // CASE 1: TRACKS 256 311 Track *track; 257 while((track = (Track *) itTrack.Next())) { 312 while((track = (Track *)itTrack.Next())) 313 { 258 314 output.push_back(track->P4()); 259 315 } 260 } else if(type=="Electron") { // CASE 2: ELECTRONS 316 } 317 else if(type == "Electron") 318 { // CASE 2: ELECTRONS 261 319 Electron *electron; 262 while((electron = (Electron *) itTrack.Next())) { 320 while((electron = (Electron *)itTrack.Next())) 321 { 263 322 output.push_back(electron->P4()); 264 323 } 265 } else if(type=="Muon") { // CASE 3: MUONS 324 } 325 else if(type == "Muon") 326 { // CASE 3: MUONS 266 327 Muon *muon; 267 while((muon = (Muon *) itTrack.Next())) { 328 while((muon = (Muon *)itTrack.Next())) 329 { 268 330 output.push_back(muon->P4()); 269 331 } 270 } else if(type=="Photon") { // CASE 4: PHOTONS 332 } 333 else if(type == "Photon") 334 { // CASE 4: PHOTONS 271 335 Photon *photon; 272 while((photon = (Photon *) itTrack.Next())) { 336 while((photon = (Photon *)itTrack.Next())) 337 { 273 338 output.push_back(photon->P4()); 274 339 } 275 } else if(type=="GenParticle") { // CASE 5: GENPARTICLES 340 } 341 else if(type == "GenParticle") 342 { // CASE 5: GENPARTICLES 276 343 GenParticle *particle; 277 while((particle = (GenParticle *) itTrack.Next())) { 344 while((particle = (GenParticle *)itTrack.Next())) 345 { 278 346 if(particle->Status != 1) continue; 279 347 output.push_back(particle->P4()); 280 348 } 281 349 } -
display/DelphesBranchElement.h
re39abb4 r0e7d64a 20 20 #define DelphesBranchElement_h 21 21 22 #include "TClass.h" 23 #include "TClonesArray.h" 22 24 #include "TColor.h" 25 #include "TEveElement.h" 26 #include "TEveTrack.h" 23 27 #include "TString.h" 24 #include "TClonesArray.h" 25 #include "TClass.h" 28 #include "display/DelphesCaloData.h" 26 29 #include <exception> 27 30 #include <iostream> 28 #include "display/DelphesCaloData.h"29 #include "TEveElement.h"30 #include "TEveTrack.h"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.):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; 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; 46 52 47 48 49 50 TClonesArray*branch_;51 52 Float_t tkRadius_,tkHalfLength_, tk_Bz_;53 protected: 54 TString name_; 55 Float_t maxPt_; 56 TClonesArray *branch_; 57 const enum EColor color_; 58 Float_t tkRadius_, tkHalfLength_, tk_Bz_; 53 59 }; 54 60 55 61 // concrete implementations. EveContainer can be a TrackList, ElementList or CaloData. 56 template<typename EveContainer> class DelphesBranchElement: public DelphesBranchBase 62 template <typename EveContainer> 63 class DelphesBranchElement: public DelphesBranchBase 57 64 { 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 } 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 } 63 72 64 65 73 // destructor 74 virtual ~DelphesBranchElement() { delete data_; } 66 75 67 68 EveContainer*GetContainer() { return data_; }76 // get the container (ElementList, TrackList, or CaloData) 77 EveContainer *GetContainer() { return data_; } 69 78 70 // tracking volume 71 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; } 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 } 72 86 73 74 virtual void Reset(){};87 // resets the collection (before moving to the next event) 88 virtual void Reset(){}; 75 89 76 77 virtual const char*GetClassName() { return data_->ClassName(); }90 // template class name 91 virtual const char *GetClassName() { return data_->ClassName(); } 78 92 79 80 93 // read the branch and fill elements for display 94 virtual void ReadBranch() {} 81 95 82 // return the vector for all elements 83 virtual std::vector<TLorentzVector> GetVectors() { std::vector<TLorentzVector> v; return v; } 96 // return the vector for all elements 97 virtual std::vector<TLorentzVector> GetVectors() 98 { 99 std::vector<TLorentzVector> v; 100 return v; 101 } 84 102 85 86 EveContainer*data_;103 private: 104 EveContainer *data_; 87 105 }; 88 106 … … 90 108 91 109 // special case for calo towers 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(); 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(); 96 118 97 119 // special case for element lists 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(); 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(); 102 128 103 129 // special case for track lists 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(); 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(); 109 140 110 141 #endif // CINT, CLING -
display/DelphesCaloData.cc
re39abb4 r0e7d64a 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 18 20 19 #include "display/DelphesCaloData.h" … … 37 36 void DelphesCaloData::ClearTowers() 38 37 { 39 38 fGeomVec.clear(); 40 39 } 41 40 -
display/DelphesCaloData.h
re39abb4 r0e7d64a 22 22 #include "TEveCaloData.h" 23 23 24 class DelphesCaloData: public TEveCaloDataVec 24 class DelphesCaloData: public TEveCaloDataVec 25 25 { 26 26 public: 27 28 27 DelphesCaloData(Int_t nslices); 29 28 … … 36 35 37 36 #endif /* DelphesCaloData_h */ 38 -
display/DelphesDisplay.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 19 #include "TEveBrowser.h" 20 20 #include "TEveManager.h" 21 #include "TEveProjectionAxes.h" 22 #include "TEveProjectionManager.h" 23 #include "TEveScene.h" 21 24 #include "TEveViewer.h" 25 #include "TEveWindow.h" 22 26 #include "TGLViewer.h" 23 27 #include "TGLWidget.h" 24 #include "TEveScene.h"25 #include "TEveProjectionManager.h"26 #include "TEveProjectionAxes.h"27 #include "TEveBrowser.h"28 #include "TEveWindow.h"29 28 #include "TGTab.h" 30 29 31 30 #include "TEveCalo2DGL.h" 32 #include "TEveCalo3DGL.h" 31 #include "TEveCalo3DGL.h" 33 32 #include "TEveCaloLegoGL.h" 34 33 #include "TEveCaloLegoOverlay.h" … … 48 47 fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ); 49 48 50 51 49 fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry"); 50 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry"); 52 51 53 54 55 52 fRPhiCaloScene = gEve->SpawnNewScene("RPhi Calorimeter"); 53 fRhoZCaloScene = gEve->SpawnNewScene("RhoZ Calorimeter"); 54 fLegoCaloScene = gEve->SpawnNewScene("Lego Calorimeter"); 56 55 57 58 59 56 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data"); 57 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data"); 58 60 59 axes = new TEveProjectionAxes(fRPhiMgr); 61 60 fRPhiGeomScene->AddElement(axes); … … 85 84 f3DimView->AddScene(gEve->GetGlobalScene()); 86 85 f3DimView->AddScene(gEve->GetEventScene()); 87 86 88 87 pack1->NewSlot()->MakeCurrent(); 89 88 fLegoView = gEve->SpawnNewViewer("Lego View", ""); 90 89 fLegoView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); 91 90 fLegoView->AddScene(fLegoCaloScene); 92 91 93 92 pack0->NewSlot()->MakeCurrent(); 94 93 fRPhiView = gEve->SpawnNewViewer("RPhi View", ""); … … 97 96 fRPhiView->AddScene(fRPhiCaloScene); 98 97 fRPhiView->AddScene(fRPhiEventScene); 99 98 100 99 pack0->NewSlot()->MakeCurrent(); 101 100 fRhoZView = gEve->SpawnNewViewer("RhoZ View", ""); … … 114 113 //------------------------------------------------------------------------------ 115 114 116 void DelphesDisplay::ImportGeomRPhi(TEveElement *el)117 { 115 void DelphesDisplay::ImportGeomRPhi(TEveElement *el) 116 { 118 117 fRPhiMgr->ImportElements(el, fRPhiGeomScene); 119 118 } 120 119 121 void DelphesDisplay::ImportGeomRhoZ(TEveElement *el)122 { 120 void DelphesDisplay::ImportGeomRhoZ(TEveElement *el) 121 { 123 122 fRhoZMgr->ImportElements(el, fRhoZGeomScene); 124 123 } … … 137 136 { 138 137 TEveCaloLegoOverlay *overlay = new TEveCaloLegoOverlay(); 139 138 140 139 overlay->SetCaloLego(calo); 141 140 fLegoView->GetGLViewer()->AddOverlayElement(overlay); … … 144 143 } 145 144 146 void DelphesDisplay::ImportEventRPhi(TEveElement *el)147 { 145 void DelphesDisplay::ImportEventRPhi(TEveElement *el) 146 { 148 147 fRPhiMgr->ImportElements(el, fRPhiEventScene); 149 148 } 150 149 151 void DelphesDisplay::ImportEventRhoZ(TEveElement *el)152 { 150 void DelphesDisplay::ImportEventRhoZ(TEveElement *el) 151 { 153 152 fRhoZMgr->ImportElements(el, fRhoZEventScene); 154 153 } … … 166 165 } 167 166 //------------------------------------------------------------------------------ 168 -
display/DelphesDisplay.h
re39abb4 r0e7d64a 30 30 { 31 31 public: 32 33 32 DelphesDisplay(); 34 33 35 34 virtual ~DelphesDisplay(); 36 35 37 void ImportGeomRPhi(TEveElement *el);38 void ImportGeomRhoZ(TEveElement *el);36 void ImportGeomRPhi(TEveElement *el); 37 void ImportGeomRhoZ(TEveElement *el); 39 38 40 39 void ImportCaloRPhi(TEveCalo3D *calo); … … 42 41 void ImportCaloLego(TEveCaloLego *calo); 43 42 44 void ImportEventRPhi(TEveElement *el);45 void ImportEventRhoZ(TEveElement *el);43 void ImportEventRPhi(TEveElement *el); 44 void ImportEventRhoZ(TEveElement *el); 46 45 47 46 void DestroyEventRPhi(); … … 49 48 50 49 private: 51 52 50 TEveProjectionManager *fRPhiMgr; 53 51 TEveProjectionManager *fRhoZMgr; … … 70 68 71 69 #endif /* DelphesDisplay_h */ 72 -
display/DelphesEventDisplay.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <algorithm> 19 20 #include <cassert> 20 21 #include <iostream> 21 22 #include <utility> 22 #include <algorithm> 23 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" 31 #include "TEveElement.h" 32 #include "TEveEventManager.h" 33 #include "TEveGeoNode.h" 34 #include "TEveJetCone.h" 35 #include "TEveManager.h" 36 #include "TEveTrack.h" 37 #include "TEveTrackPropagator.h" 38 #include "TEveTrans.h" 39 #include "TEveViewer.h" 40 #include "TGButton.h" 41 #include "TGHtml.h" 42 #include "TGNumberEntry.h" 43 #include "TGProgressBar.h" 44 #include "TGStatusBar.h" 45 #include "TGTextEntry.h" 24 46 #include "TGeoManager.h" 25 47 #include "TGeoVolume.h" 26 #include "TEveElement.h" 27 #include "TEveJetCone.h" 28 #include "TEveTrack.h" 29 #include "TEveTrackPropagator.h" 30 #include "TEveCalo.h" 31 #include "TEveManager.h" 32 #include "TEveGeoNode.h" 33 #include "TEveTrans.h" 34 #include "TEveViewer.h" 35 #include "TEveBrowser.h" 36 #include "TEveArrow.h" 48 #include "TH1F.h" 37 49 #include "TMath.h" 50 #include "TRootBrowser.h" 51 #include "TRootEmbeddedCanvas.h" 38 52 #include "TSystem.h" 39 #include "TRootBrowser.h" 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" 51 #include "TGHtml.h" 52 #include "TGStatusBar.h" 53 53 54 #include "display/Delphes3DGeometry.h" 55 #include "display/DelphesBranchElement.h" 54 56 #include "display/DelphesCaloData.h" 55 #include "display/DelphesBranchElement.h" 56 #include "display/Delphes3DGeometry.h" 57 #include "display/DelphesDisplay.h" 57 58 #include "display/DelphesEventDisplay.h" 58 #include "display/DelphesDisplay.h"59 #include "display/Delphes3DGeometry.h"60 59 #include "display/DelphesHtmlSummary.h" 61 60 #include "display/DelphesPlotSummary.h" … … 67 66 DelphesEventDisplay::DelphesEventDisplay() 68 67 { 69 70 71 72 73 74 75 76 77 78 79 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; 80 79 } 81 80 82 81 DelphesEventDisplay::~DelphesEventDisplay() 83 82 { 84 83 delete chain_; 85 84 } 86 85 87 86 void DelphesEventDisplay::EventChanged(Int_t e) 88 87 { 89 if( e!= event_id_ ) { 88 if(e != event_id_) 89 { 90 90 event_id_ = e; 91 Emit("EventChanged(Int_t)", e);91 Emit("EventChanged(Int_t)", e); 92 92 load_event(); 93 93 } 94 94 } 95 95 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 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); 187 189 } 188 190 189 191 // function that parses the config to extract the branches of interest and prepare containers 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 } 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); 224 } 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 } 259 283 } 260 284 261 285 void DelphesEventDisplay::load_event() 262 286 { 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(); 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(); 298 324 } 299 325 300 326 void DelphesEventDisplay::update_html_summary() 301 327 { 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 } 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); 351 352 } 352 htmlSummary_->Build(); 353 gHtml_->Clear(); 354 gHtml_->ParseText((char*)htmlSummary_->Html().Data()); 355 gHtml_->Layout(); 356 } 357 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 } 358 388 } 359 389 … … 364 394 void DelphesEventDisplay::make_gui() 365 395 { 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"); 453 } 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"); 461 } 462 } 463 464 void DelphesEventDisplay::PreSetEv(char *ev) { 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)"); 442 } 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()"); 449 } 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 { 465 502 event_id_tmp_ = Int_t(atoi(ev)); 466 503 } 467 504 468 void DelphesEventDisplay::GoTo() { 469 if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) { 505 void DelphesEventDisplay::GoTo() 506 { 507 if(event_id_tmp_ >= 0 && event_id_tmp_ < treeReader_->GetEntries() - 1) 508 { 470 509 EventChanged(event_id_tmp_); 471 } else { 510 } 511 else 512 { 472 513 printf("Error: no such event.\n"); 473 514 } 474 515 } 475 516 476 void DelphesEventDisplay::InitSummaryPlots() { 517 void DelphesEventDisplay::InitSummaryPlots() 518 { 477 519 plotSummary_->FillSample(treeReader_, event_id_); 478 520 plotSummary_->FillEvent(); … … 480 522 } 481 523 482 void DelphesEventDisplay::DisplayProgress(Int_t p) { 483 fStatusBar_->SetText(Form("Processing... %d %%",p), 1); 524 void DelphesEventDisplay::DisplayProgress(Int_t p) 525 { 526 fStatusBar_->SetText(Form("Processing... %d %%", p), 1); 484 527 gSystem->ProcessEvents(); 485 528 } -
display/DelphesEventDisplay.h
re39abb4 r0e7d64a 22 22 #include <vector> 23 23 24 #include "RQ_OBJECT.h" 24 25 #include "Rtypes.h" 25 #include "RQ_OBJECT.h"26 26 27 27 class TAxis; … … 45 45 class DelphesEventDisplay 46 46 { 47 48 49 50 DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry&det3D);51 52 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 55 56 57 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_; 73 74 // gui controls 75 public: 76 void Fwd(); 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_; 77 73 78 void Bck(); 74 // gui controls 75 public: 76 void Fwd(); 79 77 80 void PreSetEv(char *ev);78 void Bck(); 81 79 82 void GoTo();80 void PreSetEv(char *ev); 83 81 84 void InitSummaryPlots();82 void GoTo(); 85 83 86 void DisplayProgress(Int_t p); 84 void InitSummaryPlots(); 85 86 void DisplayProgress(Int_t p); 87 87 }; 88 88 -
display/DelphesHtmlSummary.cc
re39abb4 r0e7d64a 18 18 19 19 #include "display/DelphesHtmlSummary.h" 20 #include "TGHtml.h"21 20 #include "TEveElement.h" 21 #include "TEveEventManager.h" 22 22 #include "TEveManager.h" 23 #include "TEveEventManager.h"24 23 #include "TEvePointSet.h" 25 24 #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 37 { 38 39 40 41 for (int i=0;i<fNFields;i++)42 43 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 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 BuildLabels(); 65 BuildTable(); 66 } 67 68 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 { 65 BuildLabels(); 66 BuildTable(); 67 } 68 69 fHtml += "</table>"; 69 70 } 70 71 … … 72 73 void DelphesHtmlObjTable::BuildTitle() 73 74 { 74 75 76 77 fHtml += Form("%d>", fNFields+1);78 79 80 81 82 83 84 85 86 87 88 89 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>"; 90 91 } 91 92 … … 93 94 void DelphesHtmlObjTable::BuildLabels() 94 95 { 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>"; 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>"; 106 108 } 107 109 … … 109 111 void DelphesHtmlObjTable::BuildTable() 110 112 { 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); 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]); 126 138 fHtml += "</td>"; 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(); 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(); 146 151 } 147 152 … … 149 154 DelphesHtmlSummary::~DelphesHtmlSummary() 150 155 { 151 152 153 156 // Destructor. 157 158 Reset(); 154 159 } 155 160 156 161 //______________________________________________________________________________ 157 162 DelphesHtmlObjTable *DelphesHtmlSummary::AddTable(const char *name, Int_t nfields, Int_t nvals, 158 159 { 160 161 162 163 164 165 166 if(opt.Contains("first"))167 168 169 170 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 else 174 fObjTables->Add(table); 175 return table; 171 176 } 172 177 … … 174 179 void DelphesHtmlSummary::Clear(Option_t *option) 175 180 { 176 177 178 if(option && option[0] == 'D')179 180 181 182 181 // Clear the table list. 182 183 if(option && option[0] == 'D') 184 fObjTables->Delete(option); 185 else 186 fObjTables->Clear(option); 187 fNTables = 0; 183 188 } 184 189 … … 186 191 void DelphesHtmlSummary::Reset(Option_t *) 187 192 { 188 // Reset (delete) the table list; 189 190 delete fObjTables; fObjTables = 0; 191 fNTables = 0; 193 // Reset (delete) the table list; 194 195 delete fObjTables; 196 fObjTables = 0; 197 fNTables = 0; 192 198 } 193 199 … … 195 201 void DelphesHtmlSummary::Build() 196 202 { 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(); 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(); 205 212 } 206 213 … … 208 215 void DelphesHtmlSummary::MakeHeader() 209 216 { 210 211 212 fHeader= "<html><head><title>";213 214 215 216 217 218 fHtml= fHeader;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; 219 226 } 220 227 … … 222 229 void DelphesHtmlSummary::MakeFooter() 223 230 { 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 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 } -
display/DelphesHtmlSummary.h
re39abb4 r0e7d64a 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 29 { 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; 28 37 29 class DelphesHtmlObjTable : public TObject 30 { 31 public: // make them public for shorter code 38 TString fHtml; // HTML output code 32 39 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 40 TString fHtml; // HTML output code 41 42 void Build(); 43 void BuildTitle(); 44 void BuildLabels(); 45 void BuildTable(); 40 void Build(); 41 void BuildTitle(); 42 void BuildLabels(); 43 void BuildTable(); 46 44 47 45 public: 48 DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp=kTRUE);49 46 DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp = kTRUE); 47 virtual ~DelphesHtmlObjTable(); 50 48 51 voidSetLabel(Int_t col, const char *label) { fLabels[col] = label; }52 voidSetValue(Int_t col, Int_t row, Float_t val) { fValues[col].SetAt(val, row); }53 TStringHtml() const { return fHtml; }49 void SetLabel(Int_t col, const char *label) { fLabels[col] = label; } 50 void SetValue(Int_t col, Int_t row, Float_t val) { fValues[col].SetAt(val, row); } 51 TString Html() const { return fHtml; } 54 52 55 53 ClassDef(DelphesHtmlObjTable, 0); 56 54 }; 57 55 … … 60 58 class DelphesHtmlSummary 61 59 { 62 public: 63 Int_tfNTables;64 TOrdCollection *fObjTables;// ->array of object tables65 TString fHtml;// output HTML string66 TString fTitle;// page title67 TString fHeader;// HTML header68 TString fFooter;// HTML footer60 public: // make them public for shorter code 61 Int_t fNTables; 62 TOrdCollection *fObjTables; // ->array of object tables 63 TString fHtml; // output HTML string 64 TString fTitle; // page title 65 TString fHeader; // HTML header 66 TString fFooter; // HTML footer 69 67 70 voidMakeHeader();71 voidMakeFooter();68 void MakeHeader(); 69 void MakeFooter(); 72 70 73 71 public: 74 75 72 DelphesHtmlSummary(const char *title); 73 virtual ~DelphesHtmlSummary(); 76 74 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 voidBuild();81 void Clear(Option_t *option="");82 void Reset(Option_t *option="");83 TStringHtml() const { return fHtml; }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 void Build(); 79 void Clear(Option_t *option = ""); 80 void Reset(Option_t *option = ""); 81 TString Html() const { return fHtml; } 84 82 85 83 ClassDef(DelphesHtmlSummary, 0); 86 84 }; 87 85 -
display/DelphesPlotSummary.cc
re39abb4 r0e7d64a 21 21 #include <algorithm> 22 22 23 bool vecsorter (TLorentzVector i,TLorentzVector j) { return (i.Pt()>j.Pt()); } 24 25 DelphesPlotSummary::DelphesPlotSummary(TEveWindowTab* tab):tab_(tab) {} 23 bool vecsorter(TLorentzVector i, TLorentzVector j) { return (i.Pt() > j.Pt()); } 24 25 DelphesPlotSummary::DelphesPlotSummary(TEveWindowTab *tab) : 26 tab_(tab) {} 26 27 27 28 DelphesPlotSummary::~DelphesPlotSummary() {} … … 29 30 void DelphesPlotSummary::Progress(Int_t p) 30 31 { 31 Emit("Progress(Int_t)",p); 32 } 33 34 void DelphesPlotSummary::Init(std::vector<DelphesBranchBase*>& elements) { 32 Emit("Progress(Int_t)", p); 33 } 34 35 void DelphesPlotSummary::Init(std::vector<DelphesBranchBase *> &elements) 36 { 35 37 elements_ = &elements; 36 38 // loop on the elements, and create tabs 37 for(std::vector<DelphesBranchBase*>::iterator data=elements.begin();data<elements.end();++data) { 39 for(std::vector<DelphesBranchBase *>::iterator data = elements.begin(); data < elements.end(); ++data) 40 { 38 41 // the canvas 39 TEveWindowSlot *slot = tab_->NewSlot();40 TRootEmbeddedCanvas *trec = new TRootEmbeddedCanvas();41 TCanvas *canvas = trec->GetCanvas();42 TEveWindowFrame * 42 TEveWindowSlot *slot = tab_->NewSlot(); 43 TRootEmbeddedCanvas *trec = new TRootEmbeddedCanvas(); 44 TCanvas *canvas = trec->GetCanvas(); 45 TEveWindowFrame *wf = slot->MakeFrame(trec); 43 46 wf->SetElementName((*data)->GetName()); 44 canvas->Divide(3, 3);47 canvas->Divide(3, 3); 45 48 canvases_[(*data)->GetName()] = canvas; 46 49 // the histograms 47 TH1F *h;48 std::vector<TH1F *> histograms;50 TH1F *h; 51 std::vector<TH1F *> histograms; 49 52 histograms.reserve(9); 50 h = new TH1F(Form("%sPt", (*data)->GetName()),Form("%s Pt",(*data)->GetName()),100,0,-1);51 histograms.push_back(h); 52 h = new TH1F(Form("%sEta", (*data)->GetName()),Form("%s Eta",(*data)->GetName()),100,0,-1);53 histograms.push_back(h); 54 h = new TH1F(Form("%sPhi", (*data)->GetName()),Form("%s Phi",(*data)->GetName()),100,0,-1);55 histograms.push_back(h); 56 h = new TH1F(Form("l%sPt", (*data)->GetName()),Form("leading %s Pt",(*data)->GetName()),100,0,-1);57 histograms.push_back(h); 58 h = new TH1F(Form("l%sEta", (*data)->GetName()),Form("leading %s Eta",(*data)->GetName()),100,0,-1);59 histograms.push_back(h); 60 h = new TH1F(Form("l%sPhi", (*data)->GetName()),Form("leading %s Phi",(*data)->GetName()),100,0,-1);61 histograms.push_back(h); 62 h = new TH1F(Form("sl%sPt", (*data)->GetName()),Form("subleading %s Pt",(*data)->GetName()),100,0,-1);63 histograms.push_back(h); 64 h = new TH1F(Form("sl%sEta", (*data)->GetName()),Form("subleading %s Eta",(*data)->GetName()),100,0,-1);65 histograms.push_back(h); 66 h = new TH1F(Form("sl%sPhi", (*data)->GetName()),Form("subleading %s Phi",(*data)->GetName()),100,0,-1);53 h = new TH1F(Form("%sPt", (*data)->GetName()), Form("%s Pt", (*data)->GetName()), 100, 0, -1); 54 histograms.push_back(h); 55 h = new TH1F(Form("%sEta", (*data)->GetName()), Form("%s Eta", (*data)->GetName()), 100, 0, -1); 56 histograms.push_back(h); 57 h = new TH1F(Form("%sPhi", (*data)->GetName()), Form("%s Phi", (*data)->GetName()), 100, 0, -1); 58 histograms.push_back(h); 59 h = new TH1F(Form("l%sPt", (*data)->GetName()), Form("leading %s Pt", (*data)->GetName()), 100, 0, -1); 60 histograms.push_back(h); 61 h = new TH1F(Form("l%sEta", (*data)->GetName()), Form("leading %s Eta", (*data)->GetName()), 100, 0, -1); 62 histograms.push_back(h); 63 h = new TH1F(Form("l%sPhi", (*data)->GetName()), Form("leading %s Phi", (*data)->GetName()), 100, 0, -1); 64 histograms.push_back(h); 65 h = new TH1F(Form("sl%sPt", (*data)->GetName()), Form("subleading %s Pt", (*data)->GetName()), 100, 0, -1); 66 histograms.push_back(h); 67 h = new TH1F(Form("sl%sEta", (*data)->GetName()), Form("subleading %s Eta", (*data)->GetName()), 100, 0, -1); 68 histograms.push_back(h); 69 h = new TH1F(Form("sl%sPhi", (*data)->GetName()), Form("subleading %s Phi", (*data)->GetName()), 100, 0, -1); 67 70 histograms.push_back(h); 68 71 histograms_[(*data)->GetName()] = histograms; 69 72 // the event histograms 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; 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; 74 83 hv.push_back(h1); 75 84 hv.push_back(h2); … … 78 87 // the event markers 79 88 TMarker *m; 80 std::vector<TMarker*> mv; 81 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 82 mv.push_back(m); 83 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 84 mv.push_back(m); 85 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 86 mv.push_back(m); 87 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 88 mv.push_back(m); 89 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 90 mv.push_back(m); 91 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 89 std::vector<TMarker *> mv; 90 m = new TMarker(0, 0, 29); 91 m->SetMarkerColor(kBlue); 92 m->SetMarkerSize(3); 93 mv.push_back(m); 94 m = new TMarker(0, 0, 29); 95 m->SetMarkerColor(kBlue); 96 m->SetMarkerSize(3); 97 mv.push_back(m); 98 m = new TMarker(0, 0, 29); 99 m->SetMarkerColor(kBlue); 100 m->SetMarkerSize(3); 101 mv.push_back(m); 102 m = new TMarker(0, 0, 29); 103 m->SetMarkerColor(kBlue); 104 m->SetMarkerSize(3); 105 mv.push_back(m); 106 m = new TMarker(0, 0, 29); 107 m->SetMarkerColor(kBlue); 108 m->SetMarkerSize(3); 109 mv.push_back(m); 110 m = new TMarker(0, 0, 29); 111 m->SetMarkerColor(kBlue); 112 m->SetMarkerSize(3); 92 113 mv.push_back(m); 93 114 eventMarkers_[(*data)->GetName()] = mv; … … 95 116 } 96 117 97 void DelphesPlotSummary::FillSample(ExRootTreeReader* treeReader, Int_t event_id) { 118 void DelphesPlotSummary::FillSample(ExRootTreeReader *treeReader, Int_t event_id) 119 { 98 120 Int_t entries = treeReader->GetEntries(); 99 for(Int_t i=0;i<entries;++i) { 121 for(Int_t i = 0; i < entries; ++i) 122 { 100 123 treeReader->ReadEntry(i); 101 for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) { 124 for(std::vector<DelphesBranchBase *>::iterator element = elements_->begin(); element < elements_->end(); ++element) 125 { 102 126 std::vector<TLorentzVector> vectors = (*element)->GetVectors(); 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) { 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 { 106 131 histograms[0]->Fill(it->Pt()); 107 132 histograms[1]->Fill(it->Eta()); 108 133 histograms[2]->Fill(it->Phi()); 109 if(it==vectors.begin()) { 134 if(it == vectors.begin()) 135 { 110 136 histograms[3]->Fill(it->Pt()); 111 137 histograms[4]->Fill(it->Eta()); 112 138 histograms[5]->Fill(it->Phi()); 113 139 } 114 if(it==vectors.begin()+1) { 140 if(it == vectors.begin() + 1) 141 { 115 142 histograms[6]->Fill(it->Pt()); 116 143 histograms[7]->Fill(it->Eta()); … … 119 146 } 120 147 } 121 Progress(int(100 *i/entries));148 Progress(int(100 * i / entries)); 122 149 } 123 150 treeReader->ReadEntry(event_id); … … 125 152 } 126 153 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; 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; 136 166 histograms[i]->Draw(); 137 if(i<3) { 167 if(i < 3) 168 { 138 169 eventProfiles[i]->Draw("same"); 139 } else { 140 eventMarkers[i-3]->Draw("same"); 170 } 171 else 172 { 173 eventMarkers[i - 3]->Draw("same"); 141 174 } 142 175 } 143 176 c->Update(); 144 } 145 } 146 147 void DelphesPlotSummary::FillEvent() { 177 } 178 } 179 180 void DelphesPlotSummary::FillEvent() 181 { 148 182 // clear event histograms and markers 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) { 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 { 151 187 (*h)->Reset(); 152 188 } 153 189 } 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) { 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 { 156 194 (*m)->SetMarkerSize(0); 157 195 } 158 196 } 159 197 // loop over the elements and fill markers with event data 160 for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) { 198 for(std::vector<DelphesBranchBase *>::iterator element = elements_->begin(); element < elements_->end(); ++element) 199 { 161 200 std::vector<TLorentzVector> vectors = (*element)->GetVectors(); 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) { 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 { 169 212 h1->Fill(it->Pt()); 170 213 h2->Fill(it->Eta()); 171 214 h3->Fill(it->Phi()); 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); 176 } 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); 181 } 182 } 183 } 184 } 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); 223 } 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); 232 } 233 } 234 } 235 } -
display/DelphesPlotSummary.h
re39abb4 r0e7d64a 20 20 #define DelphesPlotSummary_h 21 21 22 #include <vector> 23 #include <map> 24 #include "TString.h" 25 #include "TH1F.h" 22 #include "DelphesBranchElement.h" 26 23 #include "TCanvas.h" 27 24 #include "TEveWindow.h" 28 #include "DelphesBranchElement.h" 25 #include "TH1F.h" 26 #include "TString.h" 29 27 #include "external/ExRootAnalysis/ExRootTreeReader.h" 30 28 #include <RQ_OBJECT.h> 31 29 #include <map> 30 #include <vector> 32 31 33 32 class DelphesPlotSummary 34 33 { 35 36 37 DelphesPlotSummary(TEveWindowTab*tab);38 39 void Init(std::vector<DelphesBranchBase*>&elements);40 void FillSample(ExRootTreeReader*treeReader, Int_t event_id);41 42 43 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* 44 43 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 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_; 53 51 }; 54 52 55 53 #endif // DelphesPlotSummary_h 56 -
doc/update_fastjet.sh
re39abb4 r0e7d64a 1 version=3.3. 11 version=3.3.2 2 2 3 3 wget http://fastjet.fr/repo/fastjet-${version}.tar.gz … … 9 9 10 10 cd fastjet-${version} 11 ./configure --enable-allcxxplugins 11 ./configure --enable-allcxxplugins --disable-auto-ptr 12 12 cd - 13 13 -
examples/CMakeLists.txt
re39abb4 r0e7d64a 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
re39abb4 r0e7d64a 1 1 //calorimeter grid 2 #include <algorithm> 3 #include <cassert> 4 #include <iostream> 5 #include <map> 2 6 #include <set> 3 #include < map>7 #include <sstream> 4 8 #include <utility> 5 9 #include <vector> 6 #include <algorithm>7 #include <sstream>8 #include <iostream>9 #include <cassert>10 10 11 #include "ExRootAnalysis/ExRootConfReader.h" 12 #include "classes/DelphesClasses.h" 11 13 #include "display/Delphes3DGeometry.h" 12 #include "classes/DelphesClasses.h"13 #include "ExRootAnalysis/ExRootConfReader.h"14 14 15 15 #include "TCanvas.h" 16 #include "TStyle.h"17 #include "TString.h"18 #include "TText.h"19 16 #include "TH2F.h" 20 17 #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 return 0;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 41 42 42 std::vector<std::string> calorimeters_; 43 std::map<std::string, std::set< 44 43 std::map<std::string, std::set<std::pair<Double_t, Int_t> > > caloBinning_; 44 45 45 std::string s(argv[2]); 46 std::replace( s.begin(), s.end(), ',', ' ');47 std::istringstream stream( s);46 std::replace(s.begin(), s.end(), ',', ' '); 47 std::istringstream stream(s); 48 48 std::string word; 49 while 49 while(stream >> word) calorimeters_.push_back(word); 50 50 51 caloBinning_.clear(); 51 caloBinning_.clear(); // calo binning 52 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) ; 81 82 h2.GetXaxis()->SetTickLength(0.0) ; 83 h2.GetYaxis()->SetTickLength(0.0) ; 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); 84 81 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 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 91 91 //first entry is eta bin, second is number of phi bins 92 set< 92 set<pair<Double_t, Int_t> > caloBinning; 93 93 ExRootConfParam paramEtaBins, paramPhiBins; 94 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins", calo->c_str()));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 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)); 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)); 103 104 } 104 105 caloBinning_[*calo] = caloBinning; 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++) 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) 127 115 { 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 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 } 143 139 } 144 140 145 141 TString text = TString(s); 146 TText *th1 = new TText(5.00, 6.45,text);147 th1->SetTextAlign(31); 148 th1->SetTextFont(132); 142 TText *th1 = new TText(5.00, 6.45, text); 143 th1->SetTextAlign(31); 144 th1->SetTextFont(132); 149 145 th1->SetTextSize(0.075); 150 146 th1->Draw(); 151 147 152 153 148 TString output = TString(s); 154 c.Print(output+".png","png"); 155 c.Print(output+".pdf","pdf"); 156 149 c.Print(output + ".png", "png"); 150 c.Print(output + ".pdf", "pdf"); 157 151 } -
examples/Example1.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 #include <iostream> 21 20 #include <utility> 22 21 #include <vector> 23 22 23 #include "TApplication.h" 24 24 #include "TROOT.h" 25 25 #include "TSystem.h" 26 #include "TApplication.h"27 26 28 27 #include "TString.h" 29 28 29 #include "TClonesArray.h" 30 30 #include "TH2.h" 31 31 #include "THStack.h" 32 32 #include "TLegend.h" 33 #include "TLorentzVector.h" 33 34 #include "TPaveText.h" 34 #include "TClonesArray.h"35 #include "TLorentzVector.h"36 35 37 36 #include "classes/DelphesClasses.h" 38 37 38 #include "ExRootAnalysis/ExRootResult.h" 39 #include "ExRootAnalysis/ExRootTreeBranch.h" 39 40 #include "ExRootAnalysis/ExRootTreeReader.h" 40 41 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootResult.h"43 42 #include "ExRootAnalysis/ExRootUtilities.h" 44 43 … … 72 71 TString inputFile(argv[1]); 73 72 74 //------------------------------------------------------------------------------73 //------------------------------------------------------------------------------ 75 74 76 // Here you call your macro's main function75 // Here you call your macro's main function 77 76 78 77 Example1(inputFile); 79 78 80 //------------------------------------------------------------------------------ 81 79 //------------------------------------------------------------------------------ 82 80 } 83 84 -
external/ExRootAnalysis/ExRootClassifier.h
re39abb4 r0e7d64a 11 11 virtual ~ExRootClassifier() {} 12 12 virtual Int_t GetCategory(TObject *object) = 0; 13 14 13 }; 15 14 16 15 #endif /* ExRootClassifier */ 17 -
external/ExRootAnalysis/ExRootConfReader.cc
re39abb4 r0e7d64a 14 14 #include "TSystem.h" 15 15 16 #include <fstream> 17 #include <iomanip> 16 18 #include <iostream> 17 #include < iomanip>18 #include < fstream>19 #include <sstream> 20 #include <stdexcept> 19 21 #include <string> 20 #include <stdexcept>21 #include <sstream>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 *>(clientData);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 *>(clientData);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 '" << fName << "' is not an integer." << endl;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 '" << fName << "' is not an long integer." << endl;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 '" << fName << "' is not a number." << endl;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 '" << fName << "' is not a boolean." << endl;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 '" << fName << "' is not a list." << endl;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 '" << fName << "' is not a list." << endl;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
re39abb4 r0e7d64a 21 21 { 22 22 public: 23 24 23 ExRootConfParam(const char *name = 0, Tcl_Obj *object = 0, Tcl_Interp *interp = 0); 25 24 … … 34 33 35 34 private: 36 37 35 const char *fName; //! 38 36 Tcl_Obj *fObject; //! … … 42 40 //------------------------------------------------------------------------------ 43 41 44 class ExRootConfReader 42 class ExRootConfReader: public TNamed 45 43 { 46 44 public: … … 66 64 67 65 private: 68 69 66 const char *fTopDir; //! 70 67 … … 77 74 78 75 #endif 79 -
external/ExRootAnalysis/ExRootFilter.cc
re39abb4 r0e7d64a 11 11 #include "ExRootAnalysis/ExRootClassifier.h" 12 12 13 #include "TObjArray.h" 13 14 #include "TSeqCollection.h" 14 #include "TObjArray.h"15 15 16 16 #include <iostream> 17 #include <sstream> 17 18 #include <stdexcept> 18 #include <sstream>19 19 20 20 using namespace std; 21 21 22 typedef map<Int_t, TObjArray *> TCategoryMap;23 typedef map<ExRootClassifier *, pair<Bool_t, TCategoryMap> > TClassifierMap;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 42 delete(itSubMap->second); 43 43 } 44 44 } … … 132 132 133 133 //------------------------------------------------------------------------------ 134 -
external/ExRootAnalysis/ExRootFilter.h
re39abb4 r0e7d64a 14 14 { 15 15 public: 16 17 16 ExRootFilter(const TSeqCollection *collection); 18 17 ~ExRootFilter(); … … 23 22 24 23 private: 25 26 24 const TSeqCollection *fCollection; //! 27 25 TIterator *fIter; //! 28 26 29 std::map<ExRootClassifier*, std::pair<Bool_t, std::map<Int_t, TObjArray*> > > fMap; //! 30 27 std::map<ExRootClassifier *, std::pair<Bool_t, std::map<Int_t, TObjArray *> > > fMap; //! 31 28 }; 32 29 33 30 #endif /* ExRootFilter */ 34 -
external/ExRootAnalysis/ExRootProgressBar.cc
re39abb4 r0e7d64a 14 14 #include <iostream> 15 15 16 #include <stdio.h> 16 17 #include <string.h> 17 #include <stdio.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
re39abb4 r0e7d64a 7 7 { 8 8 public: 9 10 9 ExRootProgressBar(Long64_t entries, Int_t width = 64); 11 10 ~ExRootProgressBar(); … … 15 14 16 15 private: 17 18 16 Long64_t fEntries, fEventCounter; 19 17 Int_t fWidth; … … 23 21 24 22 char *fBar; //! 25 26 23 }; 27 24 28 25 #endif /* ExRootProgressBar */ 29 -
external/ExRootAnalysis/ExRootResult.cc
re39abb4 r0e7d64a 12 12 #include "ExRootAnalysis/ExRootUtilities.h" 13 13 14 #include "TROOT.h" 14 #include "TCanvas.h" 15 #include "TClass.h" 15 16 #include "TFile.h" 16 #include "TClass.h" 17 #include "TStyle.h" 18 #include "TCanvas.h" 19 #include "TLegend.h" 20 #include "TPaveText.h" 21 #include "TPaveStats.h" 22 #include "TList.h" 17 #include "TFolder.h" 23 18 #include "TH2.h" 24 19 #include "THStack.h" 20 #include "TLegend.h" 21 #include "TList.h" 22 #include "TObjArray.h" 23 #include "TPaveStats.h" 24 #include "TPaveText.h" 25 25 #include "TProfile.h" 26 #include "T ObjArray.h"27 #include "T Folder.h"26 #include "TROOT.h" 27 #include "TStyle.h" 28 28 29 29 #include <iostream> … … 37 37 //------------------------------------------------------------------------------ 38 38 39 ExRootResult::ExRootResult() : fCanvas(0), fFolder(0) 39 ExRootResult::ExRootResult() : 40 fCanvas(0), fFolder(0) 40 41 { 41 42 } … … 45 46 ExRootResult::~ExRootResult() 46 47 { 47 set<TObject *>::iterator itPool;48 set<TObject *>::iterator itPool; 48 49 for(itPool = fPool.begin(); itPool != fPool.end(); ++itPool) 49 50 { … … 68 69 TFile *file = new TFile(fileName, "RECREATE"); 69 70 file->cd(); 70 std::map<TObject *, PlotSettings>::iterator itPlotMap;71 std::map<TObject *, PlotSettings>::iterator itPlotMap; 71 72 for(itPlotMap = fPlotMap.begin(); itPlotMap != fPlotMap.end(); ++itPlotMap) 72 73 { … … 123 124 // gStyle->SetOptFit(101); 124 125 125 fCanvas = static_cast<TCanvas *>(gROOT->FindObject("c1"));126 fCanvas = static_cast<TCanvas *>(gROOT->FindObject("c1")); 126 127 if(fCanvas) 127 128 { … … 154 155 if(!plot) return; 155 156 156 std::map<TObject *, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot);157 std::map<TObject *, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot); 157 158 if(itPlotMap != fPlotMap.end()) 158 159 { … … 178 179 if(plot->IsA()->InheritsFrom(TH1::Class())) 179 180 { 180 histogram = static_cast<TH1 *>(plot);181 } 182 183 map<TObject *, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot);181 histogram = static_cast<TH1 *>(plot); 182 } 183 184 map<TObject *, PlotSettings>::iterator itPlotMap = fPlotMap.find(plot); 184 185 if(itPlotMap != fPlotMap.end()) 185 186 { … … 224 225 TCanvas *canvas = GetCanvas(); 225 226 226 map<TObject *, PlotSettings>::iterator itPlotMap;227 map<TObject *, PlotSettings>::iterator itPlotMap; 227 228 228 229 for(itPlotMap = fPlotMap.begin(); itPlotMap != fPlotMap.end(); ++itPlotMap) … … 236 237 if(object->IsA()->InheritsFrom(TH1::Class())) 237 238 { 238 histogram = static_cast<TH1 *>(object);239 histogram = static_cast<TH1 *>(object); 239 240 } 240 241 else if(object->IsA()->InheritsFrom(THStack::Class())) 241 242 { 242 stack = static_cast<THStack *>(object);243 histogram = static_cast<TH1 *>(stack->GetHists()->First());243 stack = static_cast<THStack *>(object); 244 histogram = static_cast<TH1 *>(stack->GetHists()->First()); 244 245 } 245 246 … … 271 272 if(histogram) 272 273 { 273 stats = static_cast<TPaveStats *>(histogram->FindObject("stats"));274 stats = static_cast<TPaveStats *>(histogram->FindObject("stats")); 274 275 if(stats) 275 276 { … … 300 301 301 302 TH1 *ExRootResult::AddHist1D(const char *name, const char *title, 302 303 304 303 const char *xlabel, const char *ylabel, 304 Int_t nxbins, Axis_t xmin, Axis_t xmax, 305 Int_t logx, Int_t logy) 305 306 { 306 307 TH1F *hist = new TH1F(name, title, nxbins, xmin, xmax); … … 324 325 325 326 TH1 *ExRootResult::AddHist1D(const char *name, const char *title, 326 327 328 327 const char *xlabel, const char *ylabel, 328 Int_t nxbins, const Float_t *bins, 329 Int_t logx, Int_t logy) 329 330 { 330 331 TH1F *hist = new TH1F(name, title, nxbins, bins); … … 348 349 349 350 TProfile *ExRootResult::AddProfile(const char *name, const char *title, 350 351 352 351 const char *xlabel, const char *ylabel, 352 Int_t nxbins, Axis_t xmin, Axis_t xmax, 353 Int_t logx, Int_t logy) 353 354 { 354 355 TProfile *profile = new TProfile(name, title, nxbins, xmin, xmax); … … 372 373 373 374 TH2 *ExRootResult::AddHist2D(const char *name, const char *title, 374 375 376 377 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) 378 379 { 379 380 TH2F *hist = new TH2F(name, title, nxbins, xmin, xmax, nybins, ymin, ymax); -
external/ExRootAnalysis/ExRootResult.h
re39abb4 r0e7d64a 2 2 #define ExRootResult_h 3 3 4 #include "Gtypes.h" 4 5 #include "Rtypes.h" 5 #include "Gtypes.h"6 6 #include "TMath.h" 7 7 8 #include <map> 8 9 #include <set> 9 #include <map>10 10 11 11 class TH1; … … 23 23 24 24 public: 25 26 25 ExRootResult(); 27 26 ~ExRootResult(); … … 32 31 33 32 TH1 *AddHist1D(const char *name, const char *title, 34 35 36 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); 37 36 38 37 TH1 *AddHist1D(const char *name, const char *title, 39 40 41 38 const char *xlabel, const char *ylabel, 39 Int_t nxbins, const Float_t *bins, 40 Int_t logx = 0, Int_t logy = 0); 42 41 43 42 TProfile *AddProfile(const char *name, const char *title, 44 45 46 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); 47 46 48 47 TH2 *AddHist2D(const char *name, const char *title, 49 50 51 52 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); 53 52 54 53 THStack *AddHistStack(const char *name, const char *title); … … 62 61 TCanvas *GetCanvas(); 63 62 64 void PrintPlot(TObject *plot, const char *sufix = "", 63 void PrintPlot(TObject *plot, const char *sufix = "", const char *format = "eps"); 65 64 66 65 void SetFolder(TFolder *folder) { fFolder = folder; } 67 66 68 67 private: 69 70 68 struct PlotSettings 71 69 { … … 79 77 TCanvas *fCanvas; //! 80 78 81 std::set<TObject *> fPool; //!79 std::set<TObject *> fPool; //! 82 80 83 std::map<TObject *, PlotSettings> fPlotMap; //!81 std::map<TObject *, PlotSettings> fPlotMap; //! 84 82 85 83 TFolder *fFolder; //! 86 87 84 }; 88 85 89 86 #endif /* ExRootResult_h */ 90 -
external/ExRootAnalysis/ExRootTask.cc
re39abb4 r0e7d64a 11 11 #include "ExRootAnalysis/ExRootConfReader.h" 12 12 13 #include "TROOT.h"14 13 #include "TClass.h" 15 14 #include "TFolder.h" 15 #include "TROOT.h" 16 16 #include "TString.h" 17 17 18 #include <iomanip> 18 19 #include <iostream> 19 #include < iomanip>20 #include <sstream> 20 21 #include <stdexcept> 21 #include <sstream>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
re39abb4 r0e7d64a 17 17 class TFolder; 18 18 19 class ExRootTask 19 class ExRootTask: public TTask 20 20 { 21 21 public: 22 23 22 ExRootTask(); 24 23 virtual ~ExRootTask(); … … 41 40 ExRootTask *NewTask(const char *className, const char *taskName); 42 41 43 void Exec(Option_t *option);42 void Exec(Option_t *option); 44 43 45 44 int GetInt(const char *name, int defaultValue, int index = -1); … … 55 54 56 55 protected: 57 58 56 TFolder *GetFolder() const { return fFolder; } 59 57 ExRootConfReader *GetConfReader() const { return fConfReader; } … … 63 61 64 62 private: 65 66 63 TFolder *fFolder; //! 67 64 ExRootConfReader *fConfReader; //! … … 71 68 72 69 #endif /* ExRootTask */ 73 -
external/ExRootAnalysis/ExRootTreeBranch.cc
re39abb4 r0e7d64a 11 11 #include "ExRootAnalysis/ExRootTreeBranch.h" 12 12 13 #include "TClonesArray.h" 13 14 #include "TFile.h" 15 #include "TString.h" 14 16 #include "TTree.h" 15 #include "TString.h"16 #include "TClonesArray.h"17 17 18 18 #include <iostream> 19 #include <sstream> 19 20 #include <stdexcept> 20 #include <sstream>21 21 22 22 using namespace std; … … 28 28 { 29 29 stringstream message; 30 // cl->IgnoreTObjectStreamer();31 // cl->BypassStreamer();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) 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; 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; 72 77 73 78 fData->ExpandCreateFast(fCapacity); … … 76 81 fData->ExpandCreateFast(fSize); 77 82 } 78 83 79 84 return fData->AddrAt(fSize++); 80 85 } … … 89 94 90 95 //------------------------------------------------------------------------------ 91 -
external/ExRootAnalysis/ExRootTreeBranch.h
re39abb4 r0e7d64a 19 19 { 20 20 public: 21 22 21 ExRootTreeBranch(const char *name, TClass *cl, TTree *tree = 0); 23 22 ~ExRootTreeBranch(); … … 27 26 28 27 private: 29 30 28 Int_t fSize, fCapacity; //! 31 29 TClonesArray *fData; //! … … 33 31 34 32 #endif /* ExRootTreeBranch */ 35 -
external/ExRootAnalysis/ExRootTreeReader.cc
re39abb4 r0e7d64a 10 10 #include "ExRootAnalysis/ExRootTreeReader.h" 11 11 12 #include "TBranchElement.h" 13 #include "TCanvas.h" 14 #include "TClonesArray.h" 12 15 #include "TH2.h" 13 16 #include "TStyle.h" 14 #include "TCanvas.h"15 #include "TClonesArray.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 *>(fChain);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 *>(branch);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
re39abb4 r0e7d64a 10 10 */ 11 11 12 #include "TROOT.h"13 #include "TNamed.h"14 12 #include "TChain.h" 15 13 #include "TFile.h" 14 #include "TNamed.h" 15 #include "TROOT.h" 16 16 17 17 #include <map> 18 18 19 class ExRootTreeReader 19 class ExRootTreeReader: public TNamed 20 20 { 21 public : 22 21 public: 23 22 ExRootTreeReader(TTree *tree = 0); 24 23 ~ExRootTreeReader(); … … 32 31 33 32 private: 34 35 33 Bool_t Notify(); 36 34 … … 38 36 Int_t fCurrentTree; //! current Tree number in a TChain 39 37 40 typedef std::map<TString, std::pair<TBranch *, TClonesArray*> > TBranchMap;38 typedef std::map<TString, std::pair<TBranch *, TClonesArray *> > TBranchMap; 41 39 42 40 TBranchMap fBranchMap; //! -
external/ExRootAnalysis/ExRootTreeWriter.cc
re39abb4 r0e7d64a 11 11 #include "ExRootAnalysis/ExRootTreeBranch.h" 12 12 13 #include "TClonesArray.h" 14 #include "TFile.h" 13 15 #include "TROOT.h" 14 #include "TFile.h"15 16 #include "TTree.h" 16 #include "TClonesArray.h"17 17 18 18 #include <iostream> 19 #include <sstream> 19 20 #include <stdexcept> 20 #include <sstream>21 21 22 22 using namespace std; … … 31 31 ExRootTreeWriter::~ExRootTreeWriter() 32 32 { 33 set<ExRootTreeBranch *>::iterator itBranches;33 set<ExRootTreeBranch *>::iterator itBranches; 34 34 for(itBranches = fBranches.begin(); itBranches != fBranches.end(); ++itBranches) 35 35 { 36 delete 36 delete(*itBranches); 37 37 } 38 38 … … 69 69 void ExRootTreeWriter::Clear() 70 70 { 71 set<ExRootTreeBranch *>::iterator itBranches;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); 97 tree->SetAutoSave(10000000); // autosave when 10 MB written 98 98 99 99 return tree; -
external/ExRootAnalysis/ExRootTreeWriter.h
re39abb4 r0e7d64a 19 19 class ExRootTreeBranch; 20 20 21 class ExRootTreeWriter 21 class ExRootTreeWriter: public TNamed 22 22 { 23 23 public: 24 25 24 ExRootTreeWriter(TFile *file = 0, const char *treeName = "Analysis"); 26 25 ~ExRootTreeWriter(); … … 36 35 37 36 private: 38 39 37 TTree *NewTree(); 40 38 … … 44 42 TString fTreeName; //! 45 43 46 std::set<ExRootTreeBranch *> fBranches; //!44 std::set<ExRootTreeBranch *> fBranches; //! 47 45 48 46 ClassDef(ExRootTreeWriter, 1) … … 50 48 51 49 #endif /* ExRootTreeWriter */ 52 -
external/ExRootAnalysis/ExRootUtilities.cc
re39abb4 r0e7d64a 10 10 #include "ExRootAnalysis/ExRootUtilities.h" 11 11 12 #include "TChain.h" 13 #include "TH1.h" 12 14 #include "TROOT.h" 13 #include "TH1.h"14 #include "TChain.h"15 15 16 #include <fstream> 16 17 #include <iostream> 17 #include <fstream>18 18 19 19 using namespace std; … … 74 74 75 75 //------------------------------------------------------------------------------ 76 -
external/Hector/H_Beam.h
re39abb4 r0e7d64a 107 107 //@{ 108 108 inline const float getEmittanceX() const { 109 if( !x_disp*tx_disp) cout<<"Warning : Degenerate Beam : x-emittance = 0"<<endl;109 if(x_disp * tx_disp == 0) 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) cout<<"Warning : Degenerate Beam : y-emittance = 0"<<endl;113 if(y_disp * ty_disp == 0) cout<<"Warning : Degenerate Beam : y-emittance = 0"<<endl; 114 114 return y_disp * tan(ty_disp/URAD)/URAD; 115 115 } -
external/fastjet/VERSION
re39abb4 r0e7d64a 1 3.3. 11 3.3.2 -
external/fastjet/config_auto.h
re39abb4 r0e7d64a 65 65 66 66 /* compile the deprecated parts of the interface using auto-ptr */ 67 #ifndef FASTJET_HAVE_AUTO_PTR_INTERFACE 68 #define FASTJET_HAVE_AUTO_PTR_INTERFACE /**/ 69 #endif 67 /* #undef HAVE_AUTO_PTR_INTERFACE */ 70 68 71 69 /* compiler supports c++14 deprecated keyword */ … … 169 167 /* Define to the full name and version of this package. */ 170 168 #ifndef FASTJET_PACKAGE_STRING 171 #define FASTJET_PACKAGE_STRING "FastJet 3.3. 1"169 #define FASTJET_PACKAGE_STRING "FastJet 3.3.2" 172 170 #endif 173 171 … … 184 182 /* Define to the version of this package. */ 185 183 #ifndef FASTJET_PACKAGE_VERSION 186 #define FASTJET_PACKAGE_VERSION "3.3. 1"184 #define FASTJET_PACKAGE_VERSION "3.3.2" 187 185 #endif 188 186 … … 194 192 /* Version number of package */ 195 193 #ifndef FASTJET_VERSION 196 #define FASTJET_VERSION "3.3. 1"194 #define FASTJET_VERSION "3.3.2" 197 195 #endif 198 196 … … 209 207 /* Version of the package under the form XYYZZ (instead of X.Y.Z) */ 210 208 #ifndef FASTJET_VERSION_NUMBER 211 #define FASTJET_VERSION_NUMBER 3030 1209 #define FASTJET_VERSION_NUMBER 30302 212 210 #endif 213 211 214 212 /* Patch version of this package */ 215 213 #ifndef FASTJET_VERSION_PATCHLEVEL 216 #define FASTJET_VERSION_PATCHLEVEL 1214 #define FASTJET_VERSION_PATCHLEVEL 2 217 215 #endif 218 216 -
external/fastjet/config_raw.h
re39abb4 r0e7d64a 39 39 40 40 /* compile the deprecated parts of the interface using auto-ptr */ 41 #define HAVE_AUTO_PTR_INTERFACE /**/41 /* #undef 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. 1"108 #define PACKAGE_STRING "FastJet 3.3.2" 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. 1"117 #define PACKAGE_VERSION "3.3.2" 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. 1"123 #define VERSION "3.3.2" 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 1132 #define VERSION_NUMBER 30302 133 133 134 134 /* Patch version of this package */ 135 #define VERSION_PATCHLEVEL 1135 #define VERSION_PATCHLEVEL 2 136 136 137 137 /* Pre-release version of this package */ -
external/fastjet/config_win.h
re39abb4 r0e7d64a 1 #define FASTJET_PACKAGE_STRING "FastJet 3.3. 1"2 #define FASTJET_PACKAGE_VERSION "3.3. 1"3 #define FASTJET_VERSION "3.3. 1"1 #define FASTJET_PACKAGE_STRING "FastJet 3.3.2" 2 #define FASTJET_PACKAGE_VERSION "3.3.2" 3 #define FASTJET_VERSION "3.3.2" 4 4 #define FASTJET_VERSION_MAJOR 3 5 5 #define FASTJET_VERSION_MINOR 3 6 #define FASTJET_VERSION_PATCHLEVEL 17 #define FASTJET_VERSION_NUMBER 3030 16 #define FASTJET_VERSION_PATCHLEVEL 2 7 #define FASTJET_VERSION_NUMBER 30302 8 8 9 9 /* The ATLASCone plugin is disabled by default*/ -
external/fastjet/contribs/ValenciaPlugin/AUTHORS
re39abb4 r0e7d64a 1 The Valencia JetAlgorithmFastJet contrib was written and is maintained and developed by: Ignacio Garcia Garcia, Marcel Vos, IFIC (UVEG/CSIC) Valencia, Spain1 The ValenciaPlugin FastJet contrib was written and is maintained and developed by: Ignacio Garcia Garcia, Marcel Vos, IFIC (UVEG/CSIC) Valencia, Spain 2 2 3 Acknowledging suggestions by Gavin P. Salam (CERN) and J. Thaler (MIT) 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 4 5 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)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) 6 7 7 8 Please contact: marcel.vos@ific.uv.es for questions, queries and comments -
external/fastjet/contribs/ValenciaPlugin/ChangeLog
re39abb4 r0e7d64a 1 22-12-2018: Gavin Salam <gavin.salam@cern.ch> 2 * VERSION: 3 * NEWS: 4 updated version to 2.0.2 5 6 2018-12-18: Marcel Vos <marcel.vos@ific.uv.es>a 7 * ValenciaPlugin.cc: 8 Incorporates a modification suggested by 9 Filip Zarnecki (Warsaw) to make sure the behaviour for negative 10 beta is correct (added to trunk in june 2017 but left out of 11 2.0.1) 12 13 2018-12-04: Marcel Vos <marcel.vos@ific.uv.es> 14 * VERSION 15 * NEWS 16 updated version to 2.0.1 17 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-negligible 23 1 24 24-02-2015 Marcel Vos <marcel.vos@ific.uv.es> 2 25 -
external/fastjet/contribs/ValenciaPlugin/NEWS
re39abb4 r0e7d64a 1 22 December 2018: bug-fix release 2.0.2, for negative beta 2 04 December 2018: bug-fix release 2.0.1, for massive constituents 1 3 24 February 2015: version 2.0.0 2 4 21 February 2015: released 2.0-devel -
external/fastjet/contribs/ValenciaPlugin/VERSION
re39abb4 r0e7d64a 1 2.0. 01 2.0.2 -
external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.cc
re39abb4 r0e7d64a 1 // $Id: ValenciaPlugin.cc 776 2015-02-24 17:53:27Z vos $1 // $Id: ValenciaPlugin.cc 1209 2018-12-05 16:18:01Z 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 diB = pow(E,2*beta) * pow(jet.perp()/E,2*info->gamma()); 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()); 69 70 } 70 71 … … 78 79 - nz*jet->nz; 79 80 80 if ( jet->E < E)81 if (pow(jet->E,2*beta) < pow(E,2*beta)) 81 82 dij *= 2 * pow(jet->E,2*beta); 82 83 else -
external/fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh
re39abb4 r0e7d64a 1 // $Id: ValenciaPlugin.hh 77 6 2015-02-24 17:53:27Z vos $1 // $Id: ValenciaPlugin.hh 771 2015-02-21 16:40:07Z vos $ 2 2 // 3 3 // Copyright (c) 2014, Marcel Vos and Ignacio Garcia -
external/fastjet/plugins/SISCone/config.h
re39abb4 r0e7d64a 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. 3"85 #define SISCONE_PACKAGE_STRING "SISCone 3.0.4" 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. 3"100 #define SISCONE_PACKAGE_VERSION "3.0.4" 101 101 #endif 102 102 … … 111 111 /* Version number of package */ 112 112 #ifndef SISCONE_VERSION 113 #define SISCONE_VERSION "3.0. 3"113 #define SISCONE_VERSION "3.0.4" 114 114 #endif 115 115 -
external/fastjet/plugins/SISCone/config_raw.h
re39abb4 r0e7d64a 48 48 49 49 /* Define to the full name and version of this package. */ 50 #define PACKAGE_STRING "SISCone 3.0. 3"50 #define PACKAGE_STRING "SISCone 3.0.4" 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. 3"59 #define PACKAGE_VERSION "3.0.4" 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. 3"68 #define VERSION "3.0.4" -
external/fastjet/plugins/SISCone/split_merge.h
re39abb4 r0e7d64a 446 446 // jet information 447 447 /// list of jet candidates 448 #ifdef SISCONE_USES_UNIQUE_PTR_AS_AUTO_PTR 448 #if __cplusplus < 201103L 449 std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates; 450 #else 449 451 std::unique_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates; 450 #else451 std::auto_ptr<std::multiset<Cjet,Csplit_merge_ptcomparison> > candidates;452 452 #endif 453 453 -
external/tcl/tcl.h
re39abb4 r0e7d64a 488 488 EXTERN int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr)); 489 489 490 #ifdef TCL_MEM_DEBUG491 # 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 #else498 490 # define Tcl_IncrRefCount(objPtr) \ 499 491 ++(objPtr)->refCount … … 502 494 # define Tcl_IsShared(objPtr) \ 503 495 ((objPtr)->refCount > 1) 504 #endif505 496 506 497 /* 507 498 * Macros and definitions that help to debug the use of Tcl objects. 508 * When TCL_MEM_DEBUG is defined, the Tcl_New* declarations are509 * overridden to call debugging versions of the object creation procedures.510 499 */ 511 500 … … 519 508 EXTERN Tcl_Obj * Tcl_NewStringObj _ANSI_ARGS_((char *bytes, 520 509 int length)); 521 522 #ifdef TCL_MEM_DEBUG523 # 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 */538 510 539 511 /* … … 726 698 unsigned int size)); 727 699 728 #ifdef TCL_MEM_DEBUG729 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 #else742 743 700 /* 744 701 * If USE_TCLALLOC is true, then we need to call Tcl_Alloc instead of … … 760 717 # define Tcl_DumpActiveMemory(x) 761 718 # define Tcl_ValidateAllMemory(x,y) 762 763 #endif /* TCL_MEM_DEBUG */764 719 765 720 /* -
external/tcl/tclBasic.c
re39abb4 r0e7d64a 3287 3287 TclInitByteCodeObj(objPtr, &compEnv); 3288 3288 codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr; 3289 if (tclTraceCompile == 2) {3290 TclPrintByteCodeObj(interp, objPtr);3291 }3292 3289 TclFreeCompileEnv(&compEnv); 3293 3290 } else { -
external/tcl/tclCkalloc.c
re39abb4 r0e7d64a 22 22 #define TRUE 1 23 23 24 #ifdef TCL_MEM_DEBUG25 26 /*27 * One of the following structures is allocated each time the28 * "memory tag" command is invoked, to hold the current tag.29 */30 31 typedef struct MemTag {32 int refCount; /* Number of mem_headers referencing33 * this tag. */34 char string[4]; /* Actual size of string will be as35 * large as needed for actual tag. This36 * 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_headers42 * (set by "memory tag" command). */43 44 /*45 * One of the following structures is allocated just before each46 * dynamically allocated chunk of memory, both to record information47 * 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 be55 * 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, plus61 * provides at least 8 additional guard bytes62 * to detect underruns. */63 char body[1]; /* First byte of client's space. Actual64 * size of this field will be larger than65 * one. */66 };67 68 static struct mem_header *allocHead = NULL; /* List of allocated structures */69 70 #define GUARD_VALUE 014171 72 /*73 * The following macro determines the amount of guard space *above* each74 * chunk of memory.75 */76 77 #define HIGH_GUARD_SIZE 878 79 /*80 * The following macro computes the offset of the "body" field within81 * mem_header. It is used to get back to the header pointer from the82 * 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_VALIDATE99 static int validate_memory = TRUE;100 #else101 static int validate_memory = FALSE;102 #endif103 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 void124 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 void151 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 void222 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 int246 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 ckalloc275 *276 * Allocate the requested amount of space plus some extra for277 * guard bands at both ends of the request, plus a size, panicing278 * if there isn't enough space, then write in the guard bands279 * and return the address of the space in the middle that the280 * user asked for.281 *282 * The second and third arguments are file and line, these contain283 * the filename and line number corresponding to the caller.284 * These are sent by the ckalloc macro; it uses the preprocessor285 * autodefines __FILE__ and __LINE__.286 *287 *----------------------------------------------------------------------288 */289 char *290 Tcl_DbCkalloc(size, file, line)291 unsigned int size;292 char *file;293 int line;294 {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);302 if (result == NULL) {303 fflush(stdout);304 TclDumpMemoryInfo(stderr);305 panic("unable to alloc %d bytes, %s line %d", size, file,306 line);307 }308 309 /*310 * Fill in guard zones and size. Also initialize the contents of311 * 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 ckfree373 *374 * Verify that the low and high guards are intact, and if so375 * then free the buffer else panic.376 *377 * The guards are erased after being checked to catch duplicate378 * frees.379 *380 * The second and third arguments are file and line, these contain381 * the filename and line number corresponding to the caller.382 * These are sent by the ckfree macro; it uses the preprocessor383 * autodefines __FILE__ and __LINE__.384 *385 *----------------------------------------------------------------------386 */387 388 int389 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 pointer396 * to an integer before doing arithmetic on it, because otherwise397 * the arithmetic will be done differently (and incorrectly) on398 * 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 list430 */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 ckrealloc446 *447 * Reallocate a chunk of memory by allocating a new one of the448 * right size, copying the old data to the new location, and then449 * freeing the old memory space, using all the memory checking450 * features of this package.451 *452 *--------------------------------------------------------------------453 */454 char *455 Tcl_DbCkrealloc(ptr, size, file, line)456 char *ptr;457 unsigned int size;458 char *file;459 int line;460 {461 char *new;462 unsigned int copySize;463 464 /*465 * See comment from Tcl_DbCkfree before you change the following466 * 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 versions490 * 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_Alloc502 #undef Tcl_Free503 #undef Tcl_Realloc504 505 char *506 Tcl_Alloc(size)507 unsigned int size;508 {509 return Tcl_DbCkalloc(size, "unknown", 0);510 }511 512 void513 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 info534 * memory display535 * break_on_malloc count536 * trace_on_at_malloc count537 * trace on|off538 * validate on|off539 *540 * Results:541 * Standard TCL results.542 *543 *----------------------------------------------------------------------544 */545 /* ARGSUSED */546 static int547 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 void667 Tcl_InitMemory(interp)668 Tcl_Interp *interp;669 {670 Tcl_CreateCommand (interp, "memory", MemoryCmd, (ClientData) NULL,671 (Tcl_CmdDeleteProc *) NULL);672 }673 674 #else675 676 677 678 24 /* 679 25 *---------------------------------------------------------------------- 680 26 * 681 27 * Tcl_Alloc -- 682 * Interface to TclpAlloc when TCL_MEM_DEBUG is disabled. It does check683 * 28 * Interface to TclpAlloc. 29 * It does check that memory was actually allocated. 684 30 * 685 31 *---------------------------------------------------------------------- … … 722 68 * 723 69 * Tcl_Realloc -- 724 * Interface to TclpRealloc when TCL_MEM_DEBUG is disabled. It does725 * 70 * Interface to TclpRealloc. 71 * It does check that memory was actually allocated. 726 72 * 727 73 *---------------------------------------------------------------------- … … 765 111 * 766 112 * Tcl_Free -- 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. 113 * Interface to TclpFree. 770 114 * 771 115 *---------------------------------------------------------------------- … … 778 122 TclpFree(ptr); 779 123 } 780 781 int782 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 available797 * if TCL_MEM_DEBUG is on.798 *799 *----------------------------------------------------------------------800 */801 /* ARGSUSED */802 void803 Tcl_InitMemory(interp)804 Tcl_Interp *interp;805 {806 }807 808 #undef Tcl_DumpActiveMemory809 #undef Tcl_ValidateAllMemory810 811 extern int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName));812 extern void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file,813 int line));814 815 int816 Tcl_DumpActiveMemory(fileName)817 char *fileName;818 {819 return TCL_OK;820 }821 822 void823 Tcl_ValidateAllMemory(file, line)824 char *file;825 int line;826 {827 }828 829 #endif -
external/tcl/tclCompExpr.c
re39abb4 r0e7d64a 31 31 #define ERANGE 34 32 32 #endif 33 34 /*35 * Boolean variable that controls whether expression compilation tracing36 * is enabled.37 */38 39 #ifdef TCL_COMPILE_DEBUG40 static int traceCompileExpr = 0;41 #endif /* TCL_COMPILE_DEBUG */42 33 43 34 /* … … 132 123 #define NOT (COLON + 1) 133 124 #define BIT_NOT (NOT + 1) 134 135 /*136 * Mapping from tokens to strings; used for debugging messages. These137 * entries must match the order and number of the token definitions above.138 */139 140 #ifdef TCL_COMPILE_DEBUG141 static char *tokenStrings[] = {142 "LITERAL", "FUNCNAME",143 "[", "]", "(", ")", "$", "\"", ",", "END", "UNKNOWN",144 "*", "/", "%", "+", "-",145 "<<", ">>", "<", ">", "<=", ">=", "==", "!=",146 "&", "^", "|", "&&", "||", "?", ":",147 "!", "~"148 };149 #endif /* TCL_COMPILE_DEBUG */150 125 151 126 /* … … 198 173 ExprInfo *infoPtr, CompileEnv *envPtr)); 199 174 200 /*201 * Macro used to debug the execution of the recursive descent parser used202 * to compile expressions.203 */204 205 #ifdef TCL_COMPILE_DEBUG206 #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 #else213 #define HERE(production, level)214 #endif /* TCL_COMPILE_DEBUG */215 175 216 176 … … 277 237 * to execute the expression. */ 278 238 int result; 279 280 #ifdef TCL_COMPILE_DEBUG281 if (traceCompileExpr) {282 fprintf(stderr, "expr: string=\"%.30s\"\n", string);283 }284 #endif /* TCL_COMPILE_DEBUG */285 239 286 240 /* … … 409 363 int elseCodeOffset, currCodeOffset, jumpDist, result; 410 364 411 HERE("condExpr", 1);412 365 result = CompileLorExpr(interp, infoPtr, flags, envPtr); 413 366 if (result != TCL_OK) { … … 571 524 Tcl_Obj *objPtr; 572 525 573 HERE("lorExpr", 2);574 526 result = CompileLandExpr(interp, infoPtr, flags, envPtr); 575 527 if ((result != TCL_OK) || (infoPtr->token != OR)) { … … 739 691 Tcl_Obj *objPtr; 740 692 741 HERE("landExpr", 3);742 693 result = CompileBitOrExpr(interp, infoPtr, flags, envPtr); 743 694 if ((result != TCL_OK) || (infoPtr->token != AND)) { … … 899 850 int result; 900 851 901 HERE("bitOrExpr", 4);902 852 result = CompileBitXorExpr(interp, infoPtr, flags, envPtr); 903 853 if (result != TCL_OK) { … … 970 920 int result; 971 921 972 HERE("bitXorExpr", 5);973 922 result = CompileBitAndExpr(interp, infoPtr, flags, envPtr); 974 923 if (result != TCL_OK) { … … 1041 990 int result; 1042 991 1043 HERE("bitAndExpr", 6);1044 992 result = CompileEqualityExpr(interp, infoPtr, flags, envPtr); 1045 993 if (result != TCL_OK) { … … 1112 1060 int op, result; 1113 1061 1114 HERE("equalityExpr", 7);1115 1062 result = CompileRelationalExpr(interp, infoPtr, flags, envPtr); 1116 1063 if (result != TCL_OK) { … … 1190 1137 int op, result; 1191 1138 1192 HERE("relationalExpr", 8);1193 1139 result = CompileShiftExpr(interp, infoPtr, flags, envPtr); 1194 1140 if (result != TCL_OK) { … … 1277 1223 int op, result; 1278 1224 1279 HERE("shiftExpr", 9);1280 1225 result = CompileAddExpr(interp, infoPtr, flags, envPtr); 1281 1226 if (result != TCL_OK) { … … 1355 1300 int op, result; 1356 1301 1357 HERE("addExpr", 10);1358 1302 result = CompileMultiplyExpr(interp, infoPtr, flags, envPtr); 1359 1303 if (result != TCL_OK) { … … 1433 1377 int op, result; 1434 1378 1435 HERE("multiplyExpr", 11);1436 1379 result = CompileUnaryExpr(interp, infoPtr, flags, envPtr); 1437 1380 if (result != TCL_OK) { … … 1513 1456 int op, result; 1514 1457 1515 HERE("unaryExpr", 12);1516 1458 op = infoPtr->token; 1517 1459 if ((op == PLUS) || (op == MINUS) || (op == BIT_NOT) || (op == NOT)) { … … 1608 1550 */ 1609 1551 1610 HERE("primaryExpr", 13);1611 1552 theToken = infoPtr->token; 1612 1553 -
external/tcl/tclCompile.c
re39abb4 r0e7d64a 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 tracing24 * 1: summarize compilation of top level cmds and proc bodies25 * 2: display all instructions of each ByteCode compiled26 * 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_STATS38 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 */54 19 55 20 /* … … 443 408 *---------------------------------------------------------------------- 444 409 * 445 * TclPrintByteCodeObj --446 *447 * This procedure prints ("disassembles") the instructions of a448 * bytecode object to stdout.449 *450 * Results:451 * None.452 *453 * Side effects:454 * None.455 *456 *----------------------------------------------------------------------457 */458 459 void460 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, print512 * information about that procedure. Note that we don't know the513 * 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 string575 * 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 source589 * 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 start648 * of a command, print the command's source. Note that we don't need649 * 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 a720 * 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 int732 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 *845 410 * TclPrintSource -- 846 411 * … … 972 537 register int i; 973 538 974 #ifdef TCL_COMPILE_STATS975 tclCurrentSourceBytes -= (double) codePtr->numSrcChars;976 tclCurrentCodeBytes -= (double) codePtr->totalSize;977 #endif /* TCL_COMPILE_STATS */978 979 539 /* 980 540 * A single heap object holds the ByteCode structure and its code, … … 1067 627 int length, result; 1068 628 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 1077 629 string = Tcl_GetStringFromObj(objPtr, &length); 1078 630 TclInitCompileEnv(interp, &compEnv, string); … … 1113 665 TclFreeCompileEnv(&compEnv); 1114 666 1115 if (result == TCL_OK) {1116 if (tclTraceCompile == 2) {1117 TclPrintByteCodeObj(interp, objPtr);1118 }1119 }1120 667 return result; 1121 668 } … … 1311 858 int numObjects, i; 1312 859 Namespace *namespacePtr; 1313 #ifdef TCL_COMPILE_STATS1314 int srcLenLog2, sizeLog2;1315 #endif /*TCL_COMPILE_STATS*/1316 860 1317 861 codeBytes = (envPtr->codeNext - envPtr->codeStart); … … 1342 886 } 1343 887 totalSize = (size + objBytes); 1344 1345 #ifdef TCL_COMPILE_STATS1346 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 */1367 888 1368 889 if (envPtr->iPtr->varFramePtr != NULL) { … … 1820 1341 cmdCodeOffset); 1821 1342 1822 if ((!(flags & TCL_BRACKET_TERM))1823 && (tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) {1824 /*1825 * Display a line summarizing the top level command we are about1826 * 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 1848 1343 while ((type != TCL_COMMAND_END) 1849 1344 || ((c == ']') && !(flags & TCL_BRACKET_TERM))) { -
external/tcl/tclCompile.h
re39abb4 r0e7d64a 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 tracing43 * 1: summarize compilation of top level cmds and proc bodies44 * 2: display all instructions of each ByteCode compiled45 * 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 tracing54 * 1: trace invocations of Tcl procs only55 * 2: trace invocations of all (not compiled away) commands56 * 3: display each instruction executed57 * 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-related64 * statistics. The tclByteCodeCount and tclSourceCount arrays are used to65 * hold the count of ByteCodes and sources whose sizes fall into various66 * binary decades; e.g., tclByteCodeCount[5] is a count of the ByteCodes67 * with size larger than 2**4 and less than or equal to 2**5.68 */69 70 #ifdef TCL_COMPILE_STATS71 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 */87 38 88 39 /* … … 816 767 EXTERN void TclInitJumpFixupArray _ANSI_ARGS_(( 817 768 JumpFixupArray *fixupArrayPtr)); 818 #ifdef TCL_COMPILE_STATS819 EXTERN int TclLog2 _ANSI_ARGS_((int value));820 #endif /*TCL_COMPILE_STATS*/821 769 EXTERN int TclObjIndexForString _ANSI_ARGS_((char *start, 822 770 int length, int allocStrRep, int inHeap, 823 771 CompileEnv *envPtr)); 824 EXTERN int TclPrintInstruction _ANSI_ARGS_((ByteCode* codePtr,825 unsigned char *pc));826 772 EXTERN void TclPrintSource _ANSI_ARGS_((FILE *outFile, 827 773 char *string, int maxChars)); -
external/tcl/tclExecute.c
re39abb4 r0e7d64a 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 tracing56 * 1: trace invocations of Tcl procs only57 * 2: trace invocations of all (not compiled away) commands58 * 3: display each instruction executed59 * This variable is linked to the Tcl variable "tcl_traceExec".60 */61 62 int tclTraceExec = 0;63 64 /*65 53 * The following global variable is use to signal matherr that Tcl 66 54 * is responsible for the arithmetic, so errors can be handled in a … … 102 90 }; 103 91 104 /*105 * Mapping from Tcl result codes to strings; used for error and debugging106 * messages.107 */108 109 #ifdef TCL_COMPILE_DEBUG110 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 information117 * about the bytecode compiler and interpreter's operation. This includes118 * an array that records for each instruction how often it is executed.119 */120 121 #ifdef TCL_COMPILE_STATS122 static long numExecutions = 0;123 static int instructionCount[256];124 #endif /* TCL_COMPILE_STATS */125 126 92 /* 127 93 * Macros for testing floating-point values for certain special cases. Test … … 187 153 #define POP_OBJECT() \ 188 154 (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'S196 * STRING REP CONTAINS NULLS.197 */198 199 #ifdef TCL_COMPILE_DEBUG200 201 #define O2S(objPtr) \202 Tcl_GetStringFromObj((objPtr), &length)203 204 #ifdef TCL_COMPILE_STATS205 #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 */251 155 252 156 /* … … 274 178 static int ExprUnaryFunc _ANSI_ARGS_((Tcl_Interp *interp, 275 179 ExecEnv *eePtr, ClientData clientData)); 276 #ifdef TCL_COMPILE_STATS277 static int EvalStatsCmd _ANSI_ARGS_((ClientData clientData,278 Tcl_Interp *interp, int argc, char **argv));279 #endif /* TCL_COMPILE_STATS */280 180 static void FreeCmdNameInternalRep _ANSI_ARGS_(( 281 181 Tcl_Obj *objPtr)); … … 293 193 static int SetCmdNameFromAny _ANSI_ARGS_((Tcl_Interp *interp, 294 194 Tcl_Obj *objPtr)); 295 #ifdef TCL_COMPILE_DEBUG296 static char * StringForResultCode _ANSI_ARGS_((int result));297 #endif /* TCL_COMPILE_DEBUG */298 195 static void UpdateStringOfCmdName _ANSI_ARGS_((Tcl_Obj *objPtr)); 299 #ifdef TCL_COMPILE_DEBUG300 static void ValidatePcAndStackTop _ANSI_ARGS_((301 ByteCode *codePtr, unsigned char *pc,302 int stackTop, int stackLowerBound,303 int stackUpperBound));304 #endif /* TCL_COMPILE_DEBUG */305 196 306 197 /* … … 368 259 * 369 260 * Side effects: 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. 261 * This procedure initializes the array of instruction names. 376 262 * 377 263 *---------------------------------------------------------------------- … … 391 277 for (i = 0; instructionTable[i].name != NULL; i++) { 392 278 opName[i] = instructionTable[i].name; 393 }394 395 #ifdef TCL_COMPILE_STATS396 (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");407 279 } 408 280 } … … 598 470 * process break, continue, and errors. */ 599 471 int result = TCL_OK; /* Return code returned after execution. */ 600 int traceInstructions = (tclTraceExec == 3);601 472 Tcl_Obj *valuePtr, *value2Ptr, *namePtr, *objPtr; 602 473 char *bytes; 603 474 int length; 604 475 long i; 605 Tcl_DString command; /* Used for debugging. If tclTraceExec >= 2606 * holds a string representing the last607 * command invoked. */608 476 609 477 /* … … 620 488 621 489 /* 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_STATS628 fprintf(stdout, " Starting stack top=%d, system objects=%ld\n",629 eePtr->stackTop, (tclObjsAlloced - tclObjsFreed));630 #else631 fprintf(stdout, " Starting stack top=%d\n", eePtr->stackTop);632 #endif /* TCL_COMPILE_STATS */633 fflush(stdout);634 }635 636 #ifdef TCL_COMPILE_STATS637 numExecutions++;638 #endif /* TCL_COMPILE_STATS */639 640 /*641 490 * Make sure the catch stack is large enough to hold the maximum number 642 491 * of catch commands that could ever be executing at the same time. This … … 659 508 660 509 /* 661 * Initialize the buffer that holds a string containing the name and662 * arguments for the last invoked command.663 */664 665 Tcl_DStringInit(&command);666 667 /*668 510 * Loop executing instructions until a "done" instruction, a TCL_RETURN, 669 511 * or some error. … … 671 513 672 514 for (;;) { 673 #ifdef TCL_COMPILE_DEBUG674 ValidatePcAndStackTop(codePtr, pc, stackTop, initStackTop,675 eePtr->stackEnd);676 #else /* not TCL_COMPILE_DEBUG */677 if (traceInstructions) {678 #ifdef TCL_COMPILE_STATS679 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 689 515 opCode = *pc; 690 #ifdef TCL_COMPILE_STATS691 instructionCount[opCode]++;692 #endif /* TCL_COMPILE_STATS */693 516 694 517 switch (opCode) { … … 710 533 panic("TclExecuteByteCode execution failure: end stack top != start stack top"); 711 534 } 712 TRACE_WITH_OBJ(("done => return code=%d, result is ", result),713 iPtr->objResultPtr);714 535 goto done; 715 536 … … 717 538 valuePtr = objArrayPtr[TclGetUInt1AtPtr(pc+1)]; 718 539 PUSH_OBJECT(valuePtr); 719 TRACE_WITH_OBJ(("push1 %u => ", TclGetUInt1AtPtr(pc+1)),720 valuePtr);721 540 ADJUST_PC(2); 722 541 … … 724 543 valuePtr = objArrayPtr[TclGetUInt4AtPtr(pc+1)]; 725 544 PUSH_OBJECT(valuePtr); 726 TRACE_WITH_OBJ(("push4 %u => ", TclGetUInt4AtPtr(pc+1)),727 valuePtr);728 545 ADJUST_PC(5); 729 546 730 547 case INST_POP: 731 548 valuePtr = POP_OBJECT(); 732 TRACE_WITH_OBJ(("pop => discarding "), valuePtr);733 549 TclDecrRefCount(valuePtr); /* finished with pop'ed object. */ 734 550 ADJUST_PC(1); … … 737 553 valuePtr = stackPtr[stackTop].o; 738 554 PUSH_OBJECT(Tcl_DuplicateObj(valuePtr)); 739 TRACE_WITH_OBJ(("dup => "), valuePtr);740 555 ADJUST_PC(1); 741 556 … … 790 605 791 606 PUSH_OBJECT(concatObjPtr); 792 TRACE_WITH_OBJ(("concat %u => ", opnd), concatObjPtr);793 607 ADJUST_PC(2); 794 608 } … … 815 629 * Init. to avoid compiler warning. */ 816 630 Tcl_Command cmd; 817 #ifdef TCL_COMPILE_DEBUG818 int isUnknownCmd = 0;819 char cmdNameBuf[30];820 #endif /* TCL_COMPILE_DEBUG */821 631 822 632 /* … … 867 677 "invalid command name \"", cmdName, "\"", 868 678 (char *) NULL); 869 TRACE(("%s %u => unknown proc not found: ",870 opName[opCode], objc));871 679 result = TCL_ERROR; 872 680 goto checkForCatch; 873 681 } 874 682 cmdPtr = (Command *) cmd; 875 #ifdef TCL_COMPILE_DEBUG876 isUnknownCmd = 1;877 #endif /*TCL_COMPILE_DEBUG*/878 683 stackTop++; /* need room for new inserted objv[0] */ 879 684 for (i = objc; i >= 0; i--) { … … 918 723 Tcl_ResetResult(interp); 919 724 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_DEBUG928 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 953 725 iPtr->cmdCount++; 954 726 DECACHE_STACK_INFO(); … … 996 768 */ 997 769 PUSH_OBJECT(Tcl_GetObjResult(interp)); 998 TRACE_WITH_OBJ(("%s %u => ...after \"%.20s\", result=",999 opName[opCode], objc, cmdNameBuf),1000 Tcl_GetObjResult(interp));1001 770 ADJUST_PC(pcAdjustment); 1002 771 … … 1015 784 /*catchOnly*/ 0, codePtr); 1016 785 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)));1020 786 goto abnormalReturn; /* no catch exists to check */ 1021 787 } … … 1025 791 newPcOffset = rangePtr->breakOffset; 1026 792 } 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)));1030 793 goto checkForCatch; 1031 794 } else { 1032 795 newPcOffset = rangePtr->continueOffset; 1033 796 } 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));1038 797 break; 1039 798 case CATCH_EXCEPTION_RANGE: 1040 TRACE(("%s %u => ... after \"%.20s\", %s...\n",1041 opName[opCode], objc, cmdNameBuf,1042 StringForResultCode(result)));1043 799 goto processCatch; /* it will use rangePtr */ 1044 800 default: … … 1054 810 * enclosing catch exception range, if any. 1055 811 */ 1056 TRACE_WITH_OBJ(("%s %u => ... after \"%.20s\", TCL_ERROR ",1057 opName[opCode], objc, cmdNameBuf),1058 Tcl_GetObjResult(interp));1059 812 goto checkForCatch; 1060 813 … … 1065 818 * for an enclosing catch exception range, if any. 1066 819 */ 1067 TRACE(("%s %u => ... after \"%.20s\", TCL_RETURN\n",1068 opName[opCode], objc, cmdNameBuf));1069 820 goto checkForCatch; 1070 821 1071 822 default: 1072 TRACE_WITH_OBJ(("%s %u => ... after \"%.20s\", OTHER RETURN CODE %d ",1073 opName[opCode], objc, cmdNameBuf, result),1074 Tcl_GetObjResult(interp));1075 823 goto checkForCatch; 1076 824 } /* end of switch on result from invoke instruction */ … … 1088 836 1089 837 PUSH_OBJECT(Tcl_GetObjResult(interp)); 1090 TRACE_WITH_OBJ(("evalStk \"%.30s\" => ", O2S(objPtr)),1091 Tcl_GetObjResult(interp));1092 838 TclDecrRefCount(objPtr); 1093 839 ADJUST_PC(1); … … 1109 855 codePtr); 1110 856 if (rangePtr == NULL) { 1111 TRACE(("evalStk \"%.30s\" => no encl. loop or catch, returning %s\n",1112 O2S(objPtr), StringForResultCode(result)));1113 857 Tcl_DecrRefCount(objPtr); 1114 858 goto abnormalReturn; /* no catch exists to check */ … … 1119 863 newPcOffset = rangePtr->breakOffset; 1120 864 } else if (rangePtr->continueOffset == -1) { 1121 TRACE(("evalStk \"%.30s\" => %s, loop w/o continue, checking for catch\n",1122 O2S(objPtr), StringForResultCode(result)));1123 865 Tcl_DecrRefCount(objPtr); 1124 866 goto checkForCatch; … … 1127 869 } 1128 870 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);1132 871 break; 1133 872 case CATCH_EXCEPTION_RANGE: 1134 TRACE_WITH_OBJ(("evalStk \"%.30s\" => %s ",1135 O2S(objPtr), StringForResultCode(result)),1136 valuePtr);1137 873 Tcl_DecrRefCount(objPtr); 1138 874 goto processCatch; /* it will use rangePtr */ … … 1144 880 continue; /* restart outer instruction loop at pc */ 1145 881 } else { /* eval returned TCL_ERROR, TCL_RETURN, unknown code */ 1146 TRACE_WITH_OBJ(("evalStk \"%.30s\" => ERROR: ", O2S(objPtr)),1147 Tcl_GetObjResult(interp));1148 882 Tcl_DecrRefCount(objPtr); 1149 883 goto checkForCatch; … … 1157 891 CACHE_STACK_INFO(); 1158 892 if (result != TCL_OK) { 1159 TRACE_WITH_OBJ(("exprStk \"%.30s\" => ERROR: ",1160 O2S(objPtr)), Tcl_GetObjResult(interp));1161 893 Tcl_DecrRefCount(objPtr); 1162 894 goto checkForCatch; 1163 895 } 1164 896 stackPtr[++stackTop].o = valuePtr; /* already has right refct */ 1165 TRACE_WITH_OBJ(("exprStk \"%.30s\" => ", O2S(objPtr)), valuePtr);1166 897 TclDecrRefCount(objPtr); 1167 898 ADJUST_PC(1); … … 1182 913 CACHE_STACK_INFO(); 1183 914 if (valuePtr == NULL) { 1184 TRACE_WITH_OBJ(("%s %u => ERROR: ", opName[opCode], opnd),1185 Tcl_GetObjResult(interp));1186 915 result = TCL_ERROR; 1187 916 goto checkForCatch; 1188 917 } 1189 918 PUSH_OBJECT(valuePtr); 1190 TRACE_WITH_OBJ(("%s %u => ", opName[opCode], opnd), valuePtr);1191 919 ADJUST_PC(pcAdjustment); 1192 920 … … 1198 926 CACHE_STACK_INFO(); 1199 927 if (valuePtr == NULL) { 1200 TRACE_WITH_OBJ(("loadScalarStk \"%.30s\" => ERROR: ",1201 O2S(namePtr)), Tcl_GetObjResult(interp));1202 928 Tcl_DecrRefCount(namePtr); 1203 929 result = TCL_ERROR; … … 1205 931 } 1206 932 PUSH_OBJECT(valuePtr); 1207 TRACE_WITH_OBJ(("loadScalarStk \"%.30s\" => ",1208 O2S(namePtr)), valuePtr);1209 933 TclDecrRefCount(namePtr); 1210 934 ADJUST_PC(1); … … 1228 952 CACHE_STACK_INFO(); 1229 953 if (valuePtr == NULL) { 1230 TRACE_WITH_OBJ(("%s %u \"%.30s\" => ERROR: ",1231 opName[opCode], opnd, O2S(elemPtr)),1232 Tcl_GetObjResult(interp));1233 954 Tcl_DecrRefCount(elemPtr); 1234 955 result = TCL_ERROR; … … 1236 957 } 1237 958 PUSH_OBJECT(valuePtr); 1238 TRACE_WITH_OBJ(("%s %u \"%.30s\" => ",1239 opName[opCode], opnd, O2S(elemPtr)), valuePtr);1240 959 TclDecrRefCount(elemPtr); 1241 960 } … … 1252 971 CACHE_STACK_INFO(); 1253 972 if (valuePtr == NULL) { 1254 TRACE_WITH_OBJ(("loadArrayStk \"%.30s(%.30s)\" => ERROR: ",1255 O2S(namePtr), O2S(elemPtr)),1256 Tcl_GetObjResult(interp));1257 973 Tcl_DecrRefCount(namePtr); 1258 974 Tcl_DecrRefCount(elemPtr); … … 1261 977 } 1262 978 PUSH_OBJECT(valuePtr); 1263 TRACE_WITH_OBJ(("loadArrayStk \"%.30s(%.30s)\" => ",1264 O2S(namePtr), O2S(elemPtr)), valuePtr);1265 979 TclDecrRefCount(namePtr); 1266 980 TclDecrRefCount(elemPtr); … … 1275 989 CACHE_STACK_INFO(); 1276 990 if (valuePtr == NULL) { 1277 TRACE_WITH_OBJ(("loadStk \"%.30s\" => ERROR: ",1278 O2S(namePtr)), Tcl_GetObjResult(interp));1279 991 Tcl_DecrRefCount(namePtr); 1280 992 result = TCL_ERROR; … … 1282 994 } 1283 995 PUSH_OBJECT(valuePtr); 1284 TRACE_WITH_OBJ(("loadStk \"%.30s\" => ", O2S(namePtr)),1285 valuePtr);1286 996 TclDecrRefCount(namePtr); 1287 997 ADJUST_PC(1); … … 1303 1013 CACHE_STACK_INFO(); 1304 1014 if (value2Ptr == NULL) { 1305 TRACE_WITH_OBJ(("%s %u <- \"%.30s\" => ERROR: ",1306 opName[opCode], opnd, O2S(valuePtr)),1307 Tcl_GetObjResult(interp));1308 1015 Tcl_DecrRefCount(valuePtr); 1309 1016 result = TCL_ERROR; … … 1311 1018 } 1312 1019 PUSH_OBJECT(value2Ptr); 1313 TRACE_WITH_OBJ(("%s %u <- \"%.30s\" => ",1314 opName[opCode], opnd, O2S(valuePtr)), value2Ptr);1315 1020 TclDecrRefCount(valuePtr); 1316 1021 ADJUST_PC(pcAdjustment); … … 1324 1029 CACHE_STACK_INFO(); 1325 1030 if (value2Ptr == NULL) { 1326 TRACE_WITH_OBJ(1327 ("storeScalarStk \"%.30s\" <- \"%.30s\" => ERROR: ",1328 O2S(namePtr), O2S(valuePtr)),1329 Tcl_GetObjResult(interp));1330 1031 Tcl_DecrRefCount(namePtr); 1331 1032 Tcl_DecrRefCount(valuePtr); … … 1334 1035 } 1335 1036 PUSH_OBJECT(value2Ptr); 1336 TRACE_WITH_OBJ(1337 ("storeScalarStk \"%.30s\" <- \"%.30s\" => ",1338 O2S(namePtr),1339 O2S(valuePtr)),1340 value2Ptr);1341 1037 TclDecrRefCount(namePtr); 1342 1038 TclDecrRefCount(valuePtr); … … 1363 1059 CACHE_STACK_INFO(); 1364 1060 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));1369 1061 Tcl_DecrRefCount(elemPtr); 1370 1062 Tcl_DecrRefCount(valuePtr); … … 1373 1065 } 1374 1066 PUSH_OBJECT(value2Ptr); 1375 TRACE_WITH_OBJ(("%s %u \"%.30s\" <- \"%.30s\" => ",1376 opName[opCode], opnd, O2S(elemPtr), O2S(valuePtr)),1377 value2Ptr);1378 1067 TclDecrRefCount(elemPtr); 1379 1068 TclDecrRefCount(valuePtr); … … 1393 1082 CACHE_STACK_INFO(); 1394 1083 if (value2Ptr == NULL) { 1395 TRACE_WITH_OBJ(("storeArrayStk \"%.30s(%.30s)\" <- \"%.30s\" => ERROR: ",1396 O2S(namePtr), O2S(elemPtr), O2S(valuePtr)),1397 Tcl_GetObjResult(interp));1398 1084 Tcl_DecrRefCount(namePtr); 1399 1085 Tcl_DecrRefCount(elemPtr); … … 1403 1089 } 1404 1090 PUSH_OBJECT(value2Ptr); 1405 TRACE_WITH_OBJ(("storeArrayStk \"%.30s(%.30s)\" <- \"%.30s\" => ",1406 O2S(namePtr), O2S(elemPtr), O2S(valuePtr)),1407 value2Ptr);1408 1091 TclDecrRefCount(namePtr); 1409 1092 TclDecrRefCount(elemPtr); … … 1420 1103 CACHE_STACK_INFO(); 1421 1104 if (value2Ptr == NULL) { 1422 TRACE_WITH_OBJ(("storeStk \"%.30s\" <- \"%.30s\" => ERROR: ",1423 O2S(namePtr), O2S(valuePtr)),1424 Tcl_GetObjResult(interp));1425 1105 Tcl_DecrRefCount(namePtr); 1426 1106 Tcl_DecrRefCount(valuePtr); … … 1429 1109 } 1430 1110 PUSH_OBJECT(value2Ptr); 1431 TRACE_WITH_OBJ(("storeStk \"%.30s\" <- \"%.30s\" => ",1432 O2S(namePtr), O2S(valuePtr)), value2Ptr);1433 1111 TclDecrRefCount(namePtr); 1434 1112 TclDecrRefCount(valuePtr); … … 1441 1119 result = tclIntType.setFromAnyProc(interp, valuePtr); 1442 1120 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));1445 1121 Tcl_DecrRefCount(valuePtr); 1446 1122 goto checkForCatch; … … 1452 1128 CACHE_STACK_INFO(); 1453 1129 if (value2Ptr == NULL) { 1454 TRACE_WITH_OBJ(("incrScalar1 %u (by %ld) => ERROR: ",1455 opnd, i), Tcl_GetObjResult(interp));1456 1130 Tcl_DecrRefCount(valuePtr); 1457 1131 result = TCL_ERROR; … … 1459 1133 } 1460 1134 PUSH_OBJECT(value2Ptr); 1461 TRACE_WITH_OBJ(("incrScalar1 %u (by %ld) => ", opnd, i),1462 value2Ptr);1463 1135 TclDecrRefCount(valuePtr); 1464 1136 ADJUST_PC(2); … … 1471 1143 result = tclIntType.setFromAnyProc(interp, valuePtr); 1472 1144 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));1476 1145 Tcl_DecrRefCount(namePtr); 1477 1146 Tcl_DecrRefCount(valuePtr); … … 1485 1154 CACHE_STACK_INFO(); 1486 1155 if (value2Ptr == NULL) { 1487 TRACE_WITH_OBJ(("%s \"%.30s\" (by %ld) => ERROR: ",1488 opName[opCode], O2S(namePtr), i),1489 Tcl_GetObjResult(interp));1490 1156 Tcl_DecrRefCount(namePtr); 1491 1157 Tcl_DecrRefCount(valuePtr); … … 1494 1160 } 1495 1161 PUSH_OBJECT(value2Ptr); 1496 TRACE_WITH_OBJ(("%s \"%.30s\" (by %ld) => ",1497 opName[opCode], O2S(namePtr), i), value2Ptr);1498 1162 Tcl_DecrRefCount(namePtr); 1499 1163 Tcl_DecrRefCount(valuePtr); … … 1510 1174 result = tclIntType.setFromAnyProc(interp, valuePtr); 1511 1175 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));1515 1176 Tcl_DecrRefCount(elemPtr); 1516 1177 Tcl_DecrRefCount(valuePtr); … … 1524 1185 CACHE_STACK_INFO(); 1525 1186 if (value2Ptr == NULL) { 1526 TRACE_WITH_OBJ(("incrArray1 %u \"%.30s\" (by %ld) => ERROR: ",1527 opnd, O2S(elemPtr), i),1528 Tcl_GetObjResult(interp));1529 1187 Tcl_DecrRefCount(elemPtr); 1530 1188 Tcl_DecrRefCount(valuePtr); … … 1533 1191 } 1534 1192 PUSH_OBJECT(value2Ptr); 1535 TRACE_WITH_OBJ(("incrArray1 %u \"%.30s\" (by %ld) => ",1536 opnd, O2S(elemPtr), i), value2Ptr);1537 1193 Tcl_DecrRefCount(elemPtr); 1538 1194 Tcl_DecrRefCount(valuePtr); … … 1550 1206 result = tclIntType.setFromAnyProc(interp, valuePtr); 1551 1207 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));1555 1208 Tcl_DecrRefCount(namePtr); 1556 1209 Tcl_DecrRefCount(elemPtr); … … 1565 1218 CACHE_STACK_INFO(); 1566 1219 if (value2Ptr == NULL) { 1567 TRACE_WITH_OBJ(("incrArrayStk \"%.30s(%.30s)\" (by %ld) => ERROR: ",1568 O2S(namePtr), O2S(elemPtr), i),1569 Tcl_GetObjResult(interp));1570 1220 Tcl_DecrRefCount(namePtr); 1571 1221 Tcl_DecrRefCount(elemPtr); … … 1575 1225 } 1576 1226 PUSH_OBJECT(value2Ptr); 1577 TRACE_WITH_OBJ(("incrArrayStk \"%.30s(%.30s)\" (by %ld) => ",1578 O2S(namePtr), O2S(elemPtr), i), value2Ptr);1579 1227 Tcl_DecrRefCount(namePtr); 1580 1228 Tcl_DecrRefCount(elemPtr); … … 1590 1238 CACHE_STACK_INFO(); 1591 1239 if (value2Ptr == NULL) { 1592 TRACE_WITH_OBJ(("incrScalar1Imm %u %ld => ERROR: ",1593 opnd, i), Tcl_GetObjResult(interp));1594 1240 result = TCL_ERROR; 1595 1241 goto checkForCatch; 1596 1242 } 1597 1243 PUSH_OBJECT(value2Ptr); 1598 TRACE_WITH_OBJ(("incrScalar1Imm %u %ld => ", opnd, i),1599 value2Ptr);1600 1244 ADJUST_PC(3); 1601 1245 … … 1609 1253 CACHE_STACK_INFO(); 1610 1254 if (value2Ptr == NULL) { 1611 TRACE_WITH_OBJ(("%s \"%.30s\" %ld => ERROR: ",1612 opName[opCode], O2S(namePtr), i),1613 Tcl_GetObjResult(interp));1614 1255 result = TCL_ERROR; 1615 1256 Tcl_DecrRefCount(namePtr); … … 1617 1258 } 1618 1259 PUSH_OBJECT(value2Ptr); 1619 TRACE_WITH_OBJ(("%s \"%.30s\" %ld => ",1620 opName[opCode], O2S(namePtr), i), value2Ptr);1621 1260 TclDecrRefCount(namePtr); 1622 1261 ADJUST_PC(2); … … 1634 1273 CACHE_STACK_INFO(); 1635 1274 if (value2Ptr == NULL) { 1636 TRACE_WITH_OBJ(("incrArray1Imm %u \"%.30s\" (by %ld) => ERROR: ",1637 opnd, O2S(elemPtr), i),1638 Tcl_GetObjResult(interp));1639 1275 Tcl_DecrRefCount(elemPtr); 1640 1276 result = TCL_ERROR; … … 1642 1278 } 1643 1279 PUSH_OBJECT(value2Ptr); 1644 TRACE_WITH_OBJ(("incrArray1Imm %u \"%.30s\" (by %ld) => ",1645 opnd, O2S(elemPtr), i), value2Ptr);1646 1280 Tcl_DecrRefCount(elemPtr); 1647 1281 } … … 1660 1294 CACHE_STACK_INFO(); 1661 1295 if (value2Ptr == NULL) { 1662 TRACE_WITH_OBJ(("incrArrayStkImm \"%.30s(%.30s)\" (by %ld) => ERROR: ",1663 O2S(namePtr), O2S(elemPtr), i),1664 Tcl_GetObjResult(interp));1665 1296 Tcl_DecrRefCount(namePtr); 1666 1297 Tcl_DecrRefCount(elemPtr); … … 1669 1300 } 1670 1301 PUSH_OBJECT(value2Ptr); 1671 TRACE_WITH_OBJ(("incrArrayStkImm \"%.30s(%.30s)\" (by %ld) => ",1672 O2S(namePtr), O2S(elemPtr), i), value2Ptr);1673 1302 Tcl_DecrRefCount(namePtr); 1674 1303 Tcl_DecrRefCount(elemPtr); … … 1678 1307 case INST_JUMP1: 1679 1308 opnd = TclGetInt1AtPtr(pc+1); 1680 TRACE(("jump1 %d => new pc %u\n", opnd,1681 (unsigned int)(pc + opnd - codePtr->codeStart)));1682 1309 ADJUST_PC(opnd); 1683 1310 1684 1311 case INST_JUMP4: 1685 1312 opnd = TclGetInt4AtPtr(pc+1); 1686 TRACE(("jump4 %d => new pc %u\n", opnd,1687 (unsigned int)(pc + opnd - codePtr->codeStart)));1688 1313 ADJUST_PC(opnd); 1689 1314 … … 1709 1334 result = Tcl_GetBooleanFromObj(interp, valuePtr, &b); 1710 1335 if (result != TCL_OK) { 1711 TRACE_WITH_OBJ(("%s %d => ERROR: ", opName[opCode],1712 opnd), Tcl_GetObjResult(interp));1713 1336 Tcl_DecrRefCount(valuePtr); 1714 1337 goto checkForCatch; … … 1716 1339 } 1717 1340 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)));1721 1341 TclDecrRefCount(valuePtr); 1722 1342 ADJUST_PC(opnd); 1723 1343 } else { 1724 TRACE(("%s %d => %.20s false\n", opName[opCode], opnd,1725 O2S(valuePtr)));1726 1344 TclDecrRefCount(valuePtr); 1727 1345 ADJUST_PC(pcAdjustment); … … 1750 1368 result = Tcl_GetBooleanFromObj(interp, valuePtr, &b); 1751 1369 if (result != TCL_OK) { 1752 TRACE_WITH_OBJ(("%s %d => ERROR: ", opName[opCode],1753 opnd), Tcl_GetObjResult(interp));1754 1370 Tcl_DecrRefCount(valuePtr); 1755 1371 goto checkForCatch; … … 1757 1373 } 1758 1374 if (b) { 1759 TRACE(("%s %d => %.20s true\n", opName[opCode], opnd,1760 O2S(valuePtr)));1761 1375 TclDecrRefCount(valuePtr); 1762 1376 ADJUST_PC(pcAdjustment); 1763 1377 } else { 1764 TRACE(("%s %d => %.20s false, new pc %u\n",1765 opName[opCode], opnd, O2S(valuePtr),1766 (unsigned int)(pc + opnd - codePtr->codeStart)));1767 1378 TclDecrRefCount(valuePtr); 1768 1379 ADJUST_PC(opnd); … … 1804 1415 } 1805 1416 if (result != TCL_OK) { 1806 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n",1807 opName[opCode], O2S(valuePtr),1808 (t1Ptr? t1Ptr->name : "null")));1809 1417 IllegalExprOperandType(interp, opCode, valuePtr); 1810 1418 Tcl_DecrRefCount(valuePtr); … … 1830 1438 } 1831 1439 if (result != TCL_OK) { 1832 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n",1833 opName[opCode], O2S(value2Ptr),1834 (t2Ptr? t2Ptr->name : "null")));1835 1440 IllegalExprOperandType(interp, opCode, value2Ptr); 1836 1441 Tcl_DecrRefCount(valuePtr); … … 1851 1456 if (Tcl_IsShared(valuePtr)) { 1852 1457 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 1853 TRACE(("%s %.20s %.20s => %d\n", opName[opCode],1854 O2S(valuePtr), O2S(value2Ptr), iResult));1855 1458 TclDecrRefCount(valuePtr); 1856 1459 } 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));1860 1460 Tcl_SetLongObj(valuePtr, iResult); 1861 1461 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 2013 1613 if (Tcl_IsShared(valuePtr)) { 2014 1614 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2015 TRACE(("%s %.20s %.20s => %ld\n", opName[opCode],2016 O2S(valuePtr), O2S(value2Ptr), iResult));2017 1615 TclDecrRefCount(valuePtr); 2018 1616 } 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));2022 1617 Tcl_SetLongObj(valuePtr, iResult); 2023 1618 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 2049 1644 valuePtr, &i); 2050 1645 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")));2055 1646 IllegalExprOperandType(interp, opCode, valuePtr); 2056 1647 Tcl_DecrRefCount(valuePtr); … … 2065 1656 value2Ptr, &i2); 2066 1657 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")));2071 1658 IllegalExprOperandType(interp, opCode, value2Ptr); 2072 1659 Tcl_DecrRefCount(valuePtr); … … 2085 1672 */ 2086 1673 if (i2 == 0) { 2087 TRACE(("mod %ld %ld => DIVIDE BY ZERO\n", i, i2));2088 1674 Tcl_DecrRefCount(valuePtr); 2089 1675 Tcl_DecrRefCount(value2Ptr); … … 2137 1723 if (Tcl_IsShared(valuePtr)) { 2138 1724 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2139 TRACE(("%s %ld %ld => %ld\n", opName[opCode], i, i2,2140 iResult));2141 1725 TclDecrRefCount(valuePtr); 2142 1726 } 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 */2145 1727 Tcl_SetLongObj(valuePtr, iResult); 2146 1728 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 2186 1768 } 2187 1769 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")));2192 1770 IllegalExprOperandType(interp, opCode, valuePtr); 2193 1771 Tcl_DecrRefCount(valuePtr); … … 2212 1790 } 2213 1791 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")));2218 1792 IllegalExprOperandType(interp, opCode, value2Ptr); 2219 1793 Tcl_DecrRefCount(valuePtr); … … 2246 1820 case INST_DIV: 2247 1821 if (d2 == 0.0) { 2248 TRACE(("div %.6g %.6g => DIVIDE BY ZERO\n",2249 d1, d2));2250 1822 Tcl_DecrRefCount(valuePtr); 2251 1823 Tcl_DecrRefCount(value2Ptr); … … 2261 1833 2262 1834 if (IS_NAN(dResult) || IS_INF(dResult)) { 2263 TRACE(("%s %.20s %.20s => IEEE FLOATING PT ERROR\n",2264 opName[opCode], O2S(valuePtr), O2S(value2Ptr)));2265 1835 TclExprFloatError(interp, dResult); 2266 1836 result = TCL_ERROR; … … 2291 1861 */ 2292 1862 if (i2 == 0) { 2293 TRACE(("div %ld %ld => DIVIDE BY ZERO\n",2294 i, i2));2295 1863 Tcl_DecrRefCount(valuePtr); 2296 1864 Tcl_DecrRefCount(value2Ptr); … … 2318 1886 if (doDouble) { 2319 1887 PUSH_OBJECT(Tcl_NewDoubleObj(dResult)); 2320 TRACE(("%s %.6g %.6g => %.6g\n", opName[opCode],2321 d1, d2, dResult));2322 1888 } else { 2323 1889 PUSH_OBJECT(Tcl_NewLongObj(iResult)); 2324 TRACE(("%s %ld %ld => %ld\n", opName[opCode],2325 i, i2, iResult));2326 1890 } 2327 1891 TclDecrRefCount(valuePtr); 2328 1892 } else { /* reuse the valuePtr object */ 2329 1893 if (doDouble) { /* NB: stack top is off by 1 */ 2330 TRACE(("%s %.6g %.6g => %.6g\n", opName[opCode],2331 d1, d2, dResult));2332 1894 Tcl_SetDoubleObj(valuePtr, dResult); 2333 1895 } else { 2334 TRACE(("%s %ld %ld => %ld\n", opName[opCode],2335 i, i2, iResult));2336 1896 Tcl_SetLongObj(valuePtr, iResult); 2337 1897 } … … 2363 1923 } 2364 1924 if (result != TCL_OK) { 2365 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s \n",2366 opName[opCode], s,2367 (tPtr? tPtr->name : "null")));2368 1925 IllegalExprOperandType(interp, opCode, valuePtr); 2369 1926 goto checkForCatch; 2370 1927 } 2371 1928 } 2372 TRACE_WITH_OBJ(("uplus %s => ", O2S(valuePtr)), valuePtr);2373 1929 } 2374 1930 ADJUST_PC(1); … … 2399 1955 } 2400 1956 if (result != TCL_OK) { 2401 TRACE(("%s \"%.20s\" => ILLEGAL TYPE %s\n",2402 opName[opCode], s,2403 (tPtr? tPtr->name : "null")));2404 1957 IllegalExprOperandType(interp, opCode, valuePtr); 2405 1958 Tcl_DecrRefCount(valuePtr); … … 2417 1970 objPtr = Tcl_NewLongObj( 2418 1971 (opCode == INST_UMINUS)? -i : !i); 2419 TRACE_WITH_OBJ(("%s %ld => ", opName[opCode], i),2420 objPtr); /* NB: stack top is off by 1 */2421 1972 } else { 2422 1973 d = valuePtr->internalRep.doubleValue; … … 2430 1981 objPtr = Tcl_NewLongObj((d==0.0)? 1 : 0); 2431 1982 } 2432 TRACE_WITH_OBJ(("%s %.6g => ", opName[opCode], d),2433 objPtr); /* NB: stack top is off by 1 */2434 1983 } 2435 1984 PUSH_OBJECT(objPtr); … … 2443 1992 Tcl_SetLongObj(valuePtr, 2444 1993 (opCode == INST_UMINUS)? -i : !i); 2445 TRACE_WITH_OBJ(("%s %ld => ", opName[opCode], i),2446 valuePtr); /* NB: stack top is off by 1 */2447 1994 } else { 2448 1995 d = valuePtr->internalRep.doubleValue; … … 2456 2003 Tcl_SetLongObj(valuePtr, (d==0.0)? 1 : 0); 2457 2004 } 2458 TRACE_WITH_OBJ(("%s %.6g => ", opName[opCode], d),2459 valuePtr); /* NB: stack top is off by 1 */2460 2005 } 2461 2006 ++stackTop; /* valuePtr now on stk top has right r.c. */ … … 2481 2026 valuePtr, &i); 2482 2027 if (result != TCL_OK) { /* try to convert to double */ 2483 TRACE(("bitnot \"%.20s\" => ILLEGAL TYPE %s\n",2484 O2S(valuePtr), (tPtr? tPtr->name : "null")));2485 2028 IllegalExprOperandType(interp, opCode, valuePtr); 2486 2029 Tcl_DecrRefCount(valuePtr); … … 2492 2035 if (Tcl_IsShared(valuePtr)) { 2493 2036 PUSH_OBJECT(Tcl_NewLongObj(~i)); 2494 TRACE(("bitnot 0x%lx => (%lu)\n", i, ~i));2495 2037 TclDecrRefCount(valuePtr); 2496 2038 } else { … … 2500 2042 Tcl_SetLongObj(valuePtr, ~i); 2501 2043 ++stackTop; /* valuePtr now on stk top has right r.c. */ 2502 TRACE(("bitnot 0x%lx => (%lu)\n", i, ~i));2503 2044 } 2504 2045 } … … 2515 2056 2516 2057 if ((opnd < 0) || (opnd > LAST_BUILTIN_FUNC)) { 2517 TRACE(("UNRECOGNIZED BUILTIN FUNC CODE %d\n", opnd));2518 2058 panic("TclExecuteByteCode: unrecognized builtin function code %d", opnd); 2519 2059 } … … 2528 2068 goto checkForCatch; 2529 2069 } 2530 TRACE_WITH_OBJ(("callBuiltinFunc1 %d => ", opnd),2531 stackPtr[stackTop].o);2532 2070 } 2533 2071 ADJUST_PC(2); … … 2555 2093 goto checkForCatch; 2556 2094 } 2557 TRACE_WITH_OBJ(("callFunc1 %d => ", objc),2558 stackPtr[stackTop].o);2559 2095 ADJUST_PC(2); 2560 2096 } … … 2627 2163 d = valuePtr->internalRep.doubleValue; 2628 2164 if (IS_NAN(d) || IS_INF(d)) { 2629 TRACE(("tryCvtToNumeric \"%.20s\" => IEEE FLOATING PT ERROR\n",2630 O2S(valuePtr)));2631 2165 TclExprFloatError(interp, d); 2632 2166 result = TCL_ERROR; … … 2636 2170 shared = shared; /* lint, shared not used. */ 2637 2171 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)));2645 2172 } 2646 2173 } … … 2660 2187 codePtr); 2661 2188 if (rangePtr == NULL) { 2662 TRACE(("break => no encl. loop or catch, returning TCL_BREAK\n"));2663 2189 result = TCL_BREAK; 2664 2190 goto abnormalReturn; /* no catch exists to check */ … … 2667 2193 case LOOP_EXCEPTION_RANGE: 2668 2194 result = TCL_OK; 2669 TRACE(("break => range at %d, new pc %d\n",2670 rangePtr->codeOffset, rangePtr->breakOffset));2671 2195 break; 2672 2196 case CATCH_EXCEPTION_RANGE: 2673 2197 result = TCL_BREAK; 2674 TRACE(("break => ...\n"));2675 2198 goto processCatch; /* it will use rangePtr */ 2676 2199 default: … … 2693 2216 codePtr); 2694 2217 if (rangePtr == NULL) { 2695 TRACE(("continue => no encl. loop or catch, returning TCL_CONTINUE\n"));2696 2218 result = TCL_CONTINUE; 2697 2219 goto abnormalReturn; … … 2700 2222 case LOOP_EXCEPTION_RANGE: 2701 2223 if (rangePtr->continueOffset == -1) { 2702 TRACE(("continue => loop w/o continue, checking for catch\n"));2703 2224 goto checkForCatch; 2704 2225 } else { 2705 2226 result = TCL_OK; 2706 TRACE(("continue => range at %d, new pc %d\n",2707 rangePtr->codeOffset, rangePtr->continueOffset));2708 2227 } 2709 2228 break; 2710 2229 case CATCH_EXCEPTION_RANGE: 2711 2230 result = TCL_CONTINUE; 2712 TRACE(("continue => ...\n"));2713 2231 goto processCatch; /* it will use rangePtr */ 2714 2232 default: … … 2744 2262 TclSetVarScalar(iterVarPtr); 2745 2263 TclClearVarUndefined(iterVarPtr); 2746 TRACE(("foreach_start4 %u => loop iter count temp %d\n",2747 opnd, iterTmpIndex));2748 2264 } 2749 2265 ADJUST_PC(5); … … 2794 2310 result = Tcl_ListObjLength(interp, listPtr, &listLen); 2795 2311 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));2799 2312 goto checkForCatch; 2800 2313 } … … 2840 2353 CACHE_STACK_INFO(); 2841 2354 if (value2Ptr == NULL) { 2842 TRACE_WITH_OBJ(("foreach_step4 %u => ERROR init. index temp %d: ",2843 opnd, varIndex),2844 Tcl_GetObjResult(interp));2845 2355 if (setEmptyStr) { 2846 2356 Tcl_DecrRefCount(elemPtr); /* unneeded */ … … 2862 2372 2863 2373 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")));2867 2374 } 2868 2375 ADJUST_PC(5); … … 2875 2382 */ 2876 2383 catchStackPtr[++catchTop] = stackTop; 2877 TRACE(("beginCatch4 %u => catchTop=%d, stackTop=%d\n",2878 TclGetUInt4AtPtr(pc+1), catchTop, stackTop));2879 2384 ADJUST_PC(5); 2880 2385 … … 2882 2387 catchTop--; 2883 2388 result = TCL_OK; 2884 TRACE(("endCatch => catchTop=%d\n", catchTop));2885 2389 ADJUST_PC(1); 2886 2390 2887 2391 case INST_PUSH_RESULT: 2888 2392 PUSH_OBJECT(Tcl_GetObjResult(interp)); 2889 TRACE_WITH_OBJ(("pushResult => "), Tcl_GetObjResult(interp));2890 2393 ADJUST_PC(1); 2891 2394 2892 2395 case INST_PUSH_RETURN_CODE: 2893 2396 PUSH_OBJECT(Tcl_NewLongObj(result)); 2894 TRACE(("pushReturnCode => %u\n", result));2895 2397 ADJUST_PC(1); 2896 2398 2897 2399 default: 2898 TRACE(("UNRECOGNIZED INSTRUCTION %u\n", opCode));2899 2400 panic("TclExecuteByteCode: unrecognized opCode %u", opCode); 2900 2401 } /* end of switch on opCode */ … … 2926 2427 rangePtr = TclGetExceptionRangeForPc(pc, /*catchOnly*/ 1, codePtr); 2927 2428 if (rangePtr == NULL) { 2928 TRACE((" ... no enclosing catch, returning %s\n",2929 StringForResultCode(result)));2930 2429 goto abnormalReturn; 2931 2430 } … … 2945 2444 TclDecrRefCount(valuePtr); 2946 2445 } 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)));2950 2446 pc = (codePtr->codeStart + rangePtr->catchOffset); 2951 2447 continue; /* restart the execution loop at pc */ … … 2975 2471 #undef STATIC_CATCH_STACK_SIZE 2976 2472 } 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 the2986 * 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 void2998 PrintByteCodeInfo(codePtr)2999 register ByteCode *codePtr; /* The bytecode whose summary is printed3000 * 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 to3050 * verify that the program counter and stack top are valid during3051 * execution.3052 *3053 * Results:3054 * None.3055 *3056 * Side effects:3057 * Prints a message to stderr and panics if either the pc or stack3058 * top are invalid.3059 *3060 *----------------------------------------------------------------------3061 */3062 3063 #ifdef TCL_COMPILE_DEBUG3064 static void3065 ValidatePcAndStackTop(codePtr, pc, stackTop, stackLowerBound, stackUpperBound)3066 register ByteCode *codePtr; /* The bytecode whose summary is printed3067 * to stdout. */3068 unsigned char *pc; /* Points to first byte of a bytecode3069 * instruction. The program counter. */3070 int stackTop; /* Current stack top. Must be between3071 * stackLowerBound and stackUpperBound3072 * (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 */3113 2473 3114 2474 … … 4271 3631 4272 3632 4273 #ifdef TCL_COMPILE_STATS4274 /*4275 *----------------------------------------------------------------------4276 *4277 * TclLog2 --4278 *4279 * Procedure used while collecting compilation statistics to determine4280 * the log base 2 of an integer.4281 *4282 * Results:4283 * Returns the log base 2 of the operand. If the argument is less4284 * than or equal to zero, a zero is returned.4285 *4286 * Side effects:4287 * None.4288 *4289 *----------------------------------------------------------------------4290 */4291 4292 int4293 TclLog2(value)4294 register int value; /* The integer for which to compute the4295 * 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 execution4314 * counts to stdout.4315 *4316 * Results:4317 * Standard Tcl results.4318 *4319 * Side effects:4320 * None.4321 *4322 *----------------------------------------------------------------------4323 */4324 4325 static int4326 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_DEBUG4442 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 4451 3633 /* 4452 3634 *---------------------------------------------------------------------- … … 4758 3940 panic("UpdateStringOfCmdName should never be invoked"); 4759 3941 } 4760 4761 4762 #ifdef TCL_COMPILE_DEBUG4763 /*4764 *----------------------------------------------------------------------4765 *4766 * StringForResultCode --4767 *4768 * Procedure that returns a human-readable string representing a4769 * Tcl result code such as TCL_ERROR.4770 *4771 * Results:4772 * If the result code is one of the standard Tcl return codes, the4773 * result is a string representing that code such as "TCL_ERROR".4774 * Otherwise, the result string is that code formatted as a4775 * sequence of decimal digit characters. Note that the resulting4776 * 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 to4787 * 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
re39abb4 r0e7d64a 1326 1326 1327 1327 extern Tcl_Obj * tclFreeObjList; 1328 1329 #ifdef TCL_COMPILE_STATS1330 extern long tclObjsAlloced;1331 extern long tclObjsFreed;1332 #endif /* TCL_COMPILE_STATS */1333 1328 1334 1329 /* … … 1445 1440 int objc, Tcl_Obj *CONST objv[], int flags)); 1446 1441 EXTERN char * TclpAlloc _ANSI_ARGS_((unsigned int size)); 1447 1442 EXTERN void TclpFree(char *cp); 1448 1443 EXTERN char * TclpRealloc _ANSI_ARGS_((char *ptr, 1449 1444 unsigned int size)); … … 1472 1467 EXTERN int TclPreventAliasLoop _ANSI_ARGS_((Tcl_Interp *interp, 1473 1468 Tcl_Interp *cmdInterp, Tcl_Command cmd)); 1474 EXTERN void TclPrintByteCodeObj _ANSI_ARGS_((Tcl_Interp *interp,1475 Tcl_Obj *objPtr));1476 1469 EXTERN void TclProcCleanupProc _ANSI_ARGS_((Proc *procPtr)); 1477 1470 EXTERN int TclProcCompileProc _ANSI_ARGS_((Tcl_Interp *interp, … … 1688 1681 */ 1689 1682 1690 #ifdef TCL_COMPILE_STATS1691 # define TclIncrObjsAllocated() \1692 tclObjsAlloced++1693 # define TclIncrObjsFreed() \1694 tclObjsFreed++1695 #else1696 # define TclIncrObjsAllocated()1697 # define TclIncrObjsFreed()1698 #endif /* TCL_COMPILE_STATS */1699 1700 #ifdef TCL_MEM_DEBUG1701 # 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 */1732 1683 # define TclNewObj(objPtr) \ 1733 1684 if (tclFreeObjList == NULL) { \ … … 1740 1691 (objPtr)->bytes = tclEmptyStringRep; \ 1741 1692 (objPtr)->length = 0; \ 1742 (objPtr)->typePtr = NULL; \ 1743 TclIncrObjsAllocated() 1693 (objPtr)->typePtr = NULL; 1744 1694 # define TclDecrRefCount(objPtr) \ 1745 1695 if (--(objPtr)->refCount <= 0) { \ … … 1754 1704 (objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \ 1755 1705 tclFreeObjList = (objPtr); \ 1756 TclIncrObjsFreed(); \1757 1706 } 1758 #endif /* TCL_MEM_DEBUG */1759 1707 1760 1708 /* -
external/tcl/tclListObj.c
re39abb4 r0e7d64a 46 46 * Tcl_NewListObj -- 47 47 * 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. 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. 55 51 * 56 52 * Results: … … 66 62 *---------------------------------------------------------------------- 67 63 */ 68 69 #ifdef TCL_MEM_DEBUG70 #undef Tcl_NewListObj71 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 */81 64 82 65 Tcl_Obj * … … 112 95 return listPtr; 113 96 } 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., when123 * TCL_MEM_DEBUG is defined. It creates new list objects. It is the124 * same as the Tcl_NewListObj procedure above except that it calls125 * Tcl_DbCkalloc directly with the file name and line number from its126 * caller. This simplifies debugging since then the checkmem command127 * will report the correct file name and line number when reporting128 * objects that haven't been freed.129 *130 * When TCL_MEM_DEBUG is not defined, this procedure just returns the131 * result of calling Tcl_NewListObj.132 *133 * Results:134 * A new list object is returned that is initialized from the object135 * pointers in objv. If objc is less than or equal to zero, an empty136 * object is returned. The new object's string representation137 * 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 the141 * resulting list now refers to them.142 *143 *----------------------------------------------------------------------144 */145 146 #ifdef TCL_MEM_DEBUG147 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 this153 * procedure; used for debugging. */154 int line; /* Line number in the source file; used155 * 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 this192 * procedure; used for debugging. */193 int line; /* Line number in the source file; used194 * for debugging. */195 {196 return Tcl_NewListObj(objc, objv);197 }198 #endif /* TCL_MEM_DEBUG */199 97 200 98 -
external/tcl/tclObj.c
re39abb4 r0e7d64a 36 36 37 37 char *tclEmptyStringRep = NULL; 38 39 /*40 * Count of the number of Tcl objects every allocated (by Tcl_NewObj) and41 * freed (by TclFreeObj).42 */43 44 #ifdef TCL_COMPILE_STATS45 long tclObjsAlloced = 0;46 long tclObjsFreed = 0;47 #endif /* TCL_COMPILE_STATS */48 38 49 39 /* … … 417 407 * Tcl_NewObj -- 418 408 * 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. 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. 427 413 * 428 414 * Results: … … 431 417 * is set to 0. 432 418 * 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 */ 419 *---------------------------------------------------------------------- 420 */ 450 421 451 422 Tcl_Obj * … … 468 439 objPtr->length = 0; 469 440 objPtr->typePtr = NULL; 470 #ifdef TCL_COMPILE_STATS471 tclObjsAlloced++;472 #endif /* TCL_COMPILE_STATS */473 441 return objPtr; 474 442 } 475 #endif /* TCL_MEM_DEBUG */476 477 478 /*479 *----------------------------------------------------------------------480 *481 * Tcl_DbNewObj --482 *483 * This procedure is normally called when debugging: i.e., when484 * TCL_MEM_DEBUG is defined. It creates new Tcl objects that denote the485 * empty string. It is the same as the Tcl_NewObj procedure above486 * except that it calls Tcl_DbCkalloc directly with the file name and487 * line number from its caller. This simplifies debugging since then488 * the checkmem command will report the correct file name and line489 * number when reporting objects that haven't been freed.490 *491 * When TCL_MEM_DEBUG is not defined, this procedure just returns the492 * 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 increments500 * the global count of allocated objects (tclObjsAlloced).501 *502 *----------------------------------------------------------------------503 */504 505 #ifdef TCL_MEM_DEBUG506 507 Tcl_Obj *508 Tcl_DbNewObj(file, line)509 register char *file; /* The name of the source file calling this510 * procedure; used for debugging. */511 register int line; /* Line number in the source file; used512 * 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_STATS527 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 this537 * procedure; used for debugging. */538 int line; /* Line number in the source file; used539 * for debugging. */540 {541 return Tcl_NewObj();542 }543 #endif /* TCL_MEM_DEBUG */544 443 545 444 … … 609 508 * after deallocating the string representation and calling the 610 509 * type-specific Tcl_FreeInternalRepProc to deallocate the object's 611 * internal representation. If compiling with TCL_COMPILE_STATS, 612 * this procedure increments the global count of freed objects 613 * (tclObjsFreed). 510 * internal representation. 614 511 * 615 512 *---------------------------------------------------------------------- … … 622 519 register Tcl_ObjType *typePtr = objPtr->typePtr; 623 520 624 #ifdef TCL_MEM_DEBUG625 if ((objPtr)->refCount < -1) {626 panic("Reference count for %lx was negative", objPtr);627 }628 #endif /* TCL_MEM_DEBUG */629 630 521 Tcl_InvalidateStringRep(objPtr); 631 522 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { … … 634 525 635 526 /* 636 * If debugging Tcl's memory usage, deallocate the object using ckfree. 637 * Otherwise, deallocate it by adding it onto the list of free 527 * Deallocate the object by adding it onto the list of free 638 528 * Tcl_Objs we maintain. 639 529 */ 640 530 641 #ifdef TCL_MEM_DEBUG642 ckfree((char *) objPtr);643 #else644 531 objPtr->internalRep.otherValuePtr = (VOID *) tclFreeObjList; 645 532 tclFreeObjList = objPtr; 646 #endif /* TCL_MEM_DEBUG */647 648 #ifdef TCL_COMPILE_STATS649 tclObjsFreed++;650 #endif /* TCL_COMPILE_STATS */651 533 } 652 534 … … 794 676 * Tcl_NewBooleanObj -- 795 677 * 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. 678 * This procedure creates a new boolean object and initializes it from 679 * the argument boolean value. A nonzero "boolValue" is coerced to 1. 803 680 * 804 681 * Results: … … 811 688 *---------------------------------------------------------------------- 812 689 */ 813 814 #ifdef TCL_MEM_DEBUG815 #undef Tcl_NewBooleanObj816 690 817 691 Tcl_Obj * … … 819 693 register int boolValue; /* Boolean used to initialize new object. */ 820 694 { 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 {830 695 register Tcl_Obj *objPtr; 831 696 … … 837 702 return objPtr; 838 703 } 839 #endif /* TCL_MEM_DEBUG */840 841 842 /*843 *----------------------------------------------------------------------844 *845 * Tcl_DbNewBooleanObj --846 *847 * This procedure is normally called when debugging: i.e., when848 * TCL_MEM_DEBUG is defined. It creates new boolean objects. It is the849 * same as the Tcl_NewBooleanObj procedure above except that it calls850 * Tcl_DbCkalloc directly with the file name and line number from its851 * caller. This simplifies debugging since then the checkmem command852 * will report the correct file name and line number when reporting853 * objects that haven't been freed.854 *855 * When TCL_MEM_DEBUG is not defined, this procedure just returns the856 * result of calling Tcl_NewBooleanObj.857 *858 * Results:859 * The newly created object is returned. This object will have an860 * invalid string representation. The returned object has ref count 0.861 *862 * Side effects:863 * None.864 *865 *----------------------------------------------------------------------866 */867 868 #ifdef TCL_MEM_DEBUG869 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 this874 * procedure; used for debugging. */875 int line; /* Line number in the source file; used876 * 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 this894 * procedure; used for debugging. */895 int line; /* Line number in the source file; used896 * for debugging. */897 {898 return Tcl_NewBooleanObj(boolValue);899 }900 #endif /* TCL_MEM_DEBUG */901 704 902 705 … … 1178 981 * Tcl_NewDoubleObj -- 1179 982 * 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. 983 * This procedure creates a new double object and initializes it from 984 * the argument double value. 1186 985 * 1187 986 * Results: … … 1194 993 *---------------------------------------------------------------------- 1195 994 */ 1196 1197 #ifdef TCL_MEM_DEBUG1198 #undef Tcl_NewDoubleObj1199 995 1200 996 Tcl_Obj * … … 1202 998 register double dblValue; /* Double used to initialize the object. */ 1203 999 { 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 {1213 1000 register Tcl_Obj *objPtr; 1214 1001 … … 1220 1007 return objPtr; 1221 1008 } 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., when1231 * TCL_MEM_DEBUG is defined. It creates new double objects. It is the1232 * same as the Tcl_NewDoubleObj procedure above except that it calls1233 * Tcl_DbCkalloc directly with the file name and line number from its1234 * caller. This simplifies debugging since then the checkmem command1235 * will report the correct file name and line number when reporting1236 * objects that haven't been freed.1237 *1238 * When TCL_MEM_DEBUG is not defined, this procedure just returns the1239 * result of calling Tcl_NewDoubleObj.1240 *1241 * Results:1242 * The newly created object is returned. This object will have an1243 * invalid string representation. The returned object has ref count 0.1244 *1245 * Side effects:1246 * None.1247 *1248 *----------------------------------------------------------------------1249 */1250 1251 #ifdef TCL_MEM_DEBUG1252 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 this1257 * procedure; used for debugging. */1258 int line; /* Line number in the source file; used1259 * 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 this1277 * procedure; used for debugging. */1278 int line; /* Line number in the source file; used1279 * for debugging. */1280 {1281 return Tcl_NewDoubleObj(dblValue);1282 }1283 #endif /* TCL_MEM_DEBUG */1284 1009 1285 1010 … … 1531 1256 * Tcl_NewIntObj -- 1532 1257 * 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 1258 * Calls to Tcl_NewIntObj result in a call to one of the two 1539 1259 * Tcl_NewIntObj implementations below. We provide two implementations 1540 1260 * so that the Tcl core can be compiled to do memory debugging of the … … 1556 1276 */ 1557 1277 1558 #ifdef TCL_MEM_DEBUG1559 #undef Tcl_NewIntObj1560 1561 1278 Tcl_Obj * 1562 1279 Tcl_NewIntObj(intValue) 1563 1280 register int intValue; /* Int used to initialize the new object. */ 1564 1281 { 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 {1574 1282 register Tcl_Obj *objPtr; 1575 1283 … … 1581 1289 return objPtr; 1582 1290 } 1583 #endif /* if TCL_MEM_DEBUG */1584 1291 1585 1292 … … 1856 1563 * Tcl_NewLongObj -- 1857 1564 * 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 1565 * Calls to Tcl_NewLongObj result in a call to one of the two 1864 1566 * Tcl_NewLongObj implementations below. We provide two implementations 1865 1567 * so that the Tcl core can be compiled to do memory debugging of the … … 1881 1583 */ 1882 1584 1883 #ifdef TCL_MEM_DEBUG1884 #undef Tcl_NewLongObj1885 1886 1585 Tcl_Obj * 1887 1586 Tcl_NewLongObj(longValue) … … 1889 1588 * new object. */ 1890 1589 { 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 the1899 * new object. */1900 {1901 1590 register Tcl_Obj *objPtr; 1902 1591 … … 1908 1597 return objPtr; 1909 1598 } 1910 #endif /* if TCL_MEM_DEBUG */1911 1599 1912 1600 … … 1916 1604 * Tcl_DbNewLongObj -- 1917 1605 * 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. 1606 * This procedure just returns the result of calling Tcl_NewLongObj. 1934 1607 * 1935 1608 * Results: … … 1943 1616 *---------------------------------------------------------------------- 1944 1617 */ 1945 1946 #ifdef TCL_MEM_DEBUG1947 1618 1948 1619 Tcl_Obj * … … 1955 1626 * for debugging. */ 1956 1627 { 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 the1972 * new object. */1973 char *file; /* The name of the source file calling this1974 * procedure; used for debugging. */1975 int line; /* Line number in the source file; used1976 * for debugging. */1977 {1978 1628 return Tcl_NewLongObj(longValue); 1979 1629 } 1980 #endif /* TCL_MEM_DEBUG */1981 1630 1982 1631 … … 2060 1709 return result; 2061 1710 } 2062 2063 2064 /*2065 *----------------------------------------------------------------------2066 *2067 * Tcl_DbIncrRefCount --2068 *2069 * This procedure is normally called when debugging: i.e., when2070 * TCL_MEM_DEBUG is defined. This checks to see whether or not2071 * the memory has been freed before incrementing the ref count.2072 *2073 * When TCL_MEM_DEBUG is not defined, this procedure just increments2074 * 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 void2086 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 this2089 * procedure; used for debugging. */2090 int line; /* Line number in the source file; used2091 * for debugging. */2092 {2093 #ifdef TCL_MEM_DEBUG2094 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 #endif2100 ++(objPtr)->refCount;2101 }2102 2103 2104 /*2105 *----------------------------------------------------------------------2106 *2107 * Tcl_DbDecrRefCount --2108 *2109 * This procedure is normally called when debugging: i.e., when2110 * TCL_MEM_DEBUG is defined. This checks to see whether or not2111 * the memory has been freed before incrementing the ref count.2112 *2113 * When TCL_MEM_DEBUG is not defined, this procedure just increments2114 * 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 void2126 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 this2129 * procedure; used for debugging. */2130 int line; /* Line number in the source file; used2131 * for debugging. */2132 {2133 #ifdef TCL_MEM_DEBUG2134 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 #endif2140 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., when2152 * TCL_MEM_DEBUG is defined. This checks to see whether or not2153 * the memory has been freed before incrementing the ref count.2154 *2155 * When TCL_MEM_DEBUG is not defined, this procedure just decrements2156 * the reference count of the object and throws it away if the count2157 * 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 int2169 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 this2172 * procedure; used for debugging. */2173 int line; /* Line number in the source file; used2174 * for debugging. */2175 {2176 #ifdef TCL_MEM_DEBUG2177 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 #endif2183 return ((objPtr)->refCount > 1);2184 } -
external/tcl/tclProc.c
re39abb4 r0e7d64a 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 998 987 iPtr->returnCode = TCL_OK; 999 988 procPtr->refCount++; … … 1119 1108 int numChars; 1120 1109 char *ellipsis; 1121 1122 if (tclTraceCompile >= 1) {1123 /*1124 * Display a line summarizing the top level command we1125 * 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 }1137 1110 1138 1111 /* -
external/tcl/tclStringObj.c
re39abb4 r0e7d64a 50 50 * Tcl_NewStringObj -- 51 51 * 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. 52 * This procedure creates a new string object and initializes it from 53 * the byte pointer and length arguments. 58 54 * 59 55 * Results: … … 70 66 *---------------------------------------------------------------------- 71 67 */ 72 73 #ifdef TCL_MEM_DEBUG74 #undef Tcl_NewStringObj75 68 76 69 Tcl_Obj * … … 83 76 * NULL byte. */ 84 77 { 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 bytes93 * used to initialize the new object. */94 register int length; /* The number of bytes to copy from "bytes"95 * when initializing the new object. If96 * negative, use bytes up to the first97 * NULL byte. */98 {99 78 register Tcl_Obj *objPtr; 100 79 … … 106 85 return objPtr; 107 86 } 108 #endif /* TCL_MEM_DEBUG */109 110 111 /*112 *----------------------------------------------------------------------113 *114 * Tcl_DbNewStringObj --115 *116 * This procedure is normally called when debugging: i.e., when117 * TCL_MEM_DEBUG is defined. It creates new string objects. It is the118 * same as the Tcl_NewStringObj procedure above except that it calls119 * Tcl_DbCkalloc directly with the file name and line number from its120 * caller. This simplifies debugging since then the checkmem command121 * will report the correct file name and line number when reporting122 * objects that haven't been freed.123 *124 * When TCL_MEM_DEBUG is not defined, this procedure just returns the125 * 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 a132 * copy of the length bytes starting at "bytes". If "length" is133 * 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 set135 * to NULL. An extra NULL is added to the end of the new object's byte136 * array.137 *138 *----------------------------------------------------------------------139 */140 141 #ifdef TCL_MEM_DEBUG142 143 Tcl_Obj *144 Tcl_DbNewStringObj(bytes, length, file, line)145 register char *bytes; /* Points to the first of the length bytes146 * used to initialize the new object. */147 register int length; /* The number of bytes to copy from "bytes"148 * when initializing the new object. If149 * negative, use bytes up to the first150 * NULL byte. */151 char *file; /* The name of the source file calling this152 * procedure; used for debugging. */153 int line; /* Line number in the source file; used154 * 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 bytes171 * used to initialize the new object. */172 register int length; /* The number of bytes to copy from "bytes"173 * when initializing the new object. If174 * negative, use bytes up to the first175 * NULL byte. */176 char *file; /* The name of the source file calling this177 * procedure; used for debugging. */178 int line; /* Line number in the source file; used179 * for debugging. */180 {181 return Tcl_NewStringObj(bytes, length);182 }183 #endif /* TCL_MEM_DEBUG */184 87 185 88 -
external/tcl/tclVar.c
re39abb4 r0e7d64a 711 711 char *msg; 712 712 713 #ifdef TCL_COMPILE_DEBUG714 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 731 713 varPtr = &(compiledLocals[localIndex]); 732 714 varName = varPtr->name; … … 832 814 int new; 833 815 834 #ifdef TCL_COMPILE_DEBUG835 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 852 816 /* 853 817 * THIS FAILS IF THE ELEMENT NAME OBJECT'S STRING REP HAS A NULL BYTE. … … 1449 1413 Tcl_Obj *resultPtr = NULL; 1450 1414 1451 #ifdef TCL_COMPILE_DEBUG1452 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 1469 1415 varPtr = &(compiledLocals[localIndex]); 1470 1416 varName = varPtr->name; … … 1635 1581 int new; 1636 1582 1637 #ifdef TCL_COMPILE_DEBUG1638 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 1655 1583 /* 1656 1584 * THIS FAILS IF THE ELEMENT NAME OBJECT'S STRING REP HAS A NULL BYTE. -
modules/AngularSmearing.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class AngularSmearing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 77 76 fFormulaPhi->Compile(GetString("PhiResolutionFormula", "0.0")); 78 77 79 80 78 // import input array 81 79 … … 103 101 104 102 fItInputArray->Reset(); 105 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))103 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 106 104 { 107 105 const TLorentzVector &candidatePosition = candidate->Position; … … 116 114 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e)); 117 115 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e)); 118 116 119 117 if(pt <= 0.0) continue; 120 118 121 119 mother = candidate; 122 candidate = static_cast<Candidate *>(candidate->Clone());120 candidate = static_cast<Candidate *>(candidate->Clone()); 123 121 eta = candidateMomentum.Eta(); 124 122 phi = candidateMomentum.Phi(); 125 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt * TMath::CosH(eta)); 126 124 candidate->AddCandidate(mother); 127 125 128 126 fOutputArray->Add(candidate); 129 127 } -
modules/AngularSmearing.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 AngularSmearing(); 41 40 ~AngularSmearing(); … … 46 45 47 46 private: 48 49 47 DelphesFormula *fFormulaEta; //! 50 48 DelphesFormula *fFormulaPhi; //! … … 53 51 54 52 const TObjArray *fInputArray; //! 55 53 56 54 TObjArray *fOutputArray; //! 57 55 -
modules/BTagging.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class BTagging 21 20 * … … 34 33 #include "classes/DelphesFormula.h" 35 34 35 #include "TDatabasePDG.h" 36 #include "TFormula.h" 37 #include "TLorentzVector.h" 36 38 #include "TMath.h" 39 #include "TObjArray.h" 40 #include "TRandom3.h" 37 41 #include "TString.h" 38 #include "TFormula.h"39 #include "TRandom3.h"40 #include "TObjArray.h"41 #include "TDatabasePDG.h"42 #include "TLorentzVector.h"43 42 44 43 #include <algorithm> 45 #include <stdexcept>46 44 #include <iostream> 47 45 #include <sstream> 46 #include <stdexcept> 48 47 49 48 using namespace std; … … 66 65 void BTagging::Init() 67 66 { 68 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;67 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 69 68 ExRootConfParam param; 70 69 DelphesFormula *formula; … … 78 77 79 78 fEfficiencyMap.clear(); 80 for(i = 0; i < size /2; ++i)79 for(i = 0; i < size / 2; ++i) 81 80 { 82 81 formula = new DelphesFormula; 83 formula->Compile(param[i *2 + 1].GetString());82 formula->Compile(param[i * 2 + 1].GetString()); 84 83 85 fEfficiencyMap[param[i *2].GetInt()] = formula;84 fEfficiencyMap[param[i * 2].GetInt()] = formula; 86 85 } 87 86 … … 106 105 void BTagging::Finish() 107 106 { 108 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;107 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 109 108 DelphesFormula *formula; 110 109 … … 124 123 Candidate *jet; 125 124 Double_t pt, eta, phi, e; 126 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;125 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 127 126 DelphesFormula *formula; 128 127 129 128 // loop over all input jets 130 129 fItJetInputArray->Reset(); 131 while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))130 while((jet = static_cast<Candidate *>(fItJetInputArray->Next()))) 132 131 { 133 132 const TLorentzVector &jetMomentum = jet->Momentum; -
modules/BTagging.h
re39abb4 r0e7d64a 40 40 { 41 41 public: 42 43 42 BTagging(); 44 43 ~BTagging(); … … 49 48 50 49 private: 51 52 50 Int_t fBitNumber; 53 51 54 52 #if !defined(__CINT__) && !defined(__CLING__) 55 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!53 std::map<Int_t, DelphesFormula *> fEfficiencyMap; //! 56 54 #endif 57 55 58 56 TIterator *fItJetInputArray; //! 59 57 60 58 const TObjArray *fJetInputArray; //! 61 59 -
modules/BeamSpotFilter.cc
re39abb4 r0e7d64a 7 7 */ 8 8 9 10 9 #include "modules/BeamSpotFilter.h" 11 10 … … 14 13 #include "classes/DelphesFormula.h" 15 14 15 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 16 17 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h"18 #include "ExRootAnalysis/ExRootClassifier.h"19 18 19 #include "TDatabasePDG.h" 20 #include "TFormula.h" 21 #include "TLorentzVector.h" 20 22 #include "TMath.h" 23 #include "TObjArray.h" 24 #include "TRandom3.h" 21 25 #include "TString.h" 22 #include "TFormula.h"23 #include "TRandom3.h"24 #include "TObjArray.h"25 #include "TDatabasePDG.h"26 #include "TLorentzVector.h"27 26 28 27 #include <algorithm> 29 #include <stdexcept>30 28 #include <iostream> 31 29 #include <sstream> 30 #include <stdexcept> 32 31 33 32 using namespace std; … … 50 49 void BeamSpotFilter::Init() 51 50 { 52 51 53 52 // import input array 54 53 fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles")); … … 73 72 Candidate *candidate; 74 73 Bool_t passed = false; 75 74 76 75 fItInputArray->Reset(); 77 while((candidate = static_cast<Candidate *>(fItInputArray->Next())) && !passed)76 while((candidate = static_cast<Candidate *>(fItInputArray->Next())) && !passed) 78 77 { 79 78 if(candidate->IsPU == 0) passed = true; 80 79 fOutputArray->Add(candidate); 81 80 } 82 83 81 } 84 85 -
modules/BeamSpotFilter.h
re39abb4 r0e7d64a 20 20 { 21 21 public: 22 23 22 BeamSpotFilter(); 24 23 ~BeamSpotFilter(); … … 29 28 30 29 private: 31 32 30 Float_t fPassedOne; 33 31 -
modules/CMakeLists.txt
re39abb4 r0e7d64a 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 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 32 36 DESTINATION lib) 37 endif() 33 38 endif() -
modules/Calorimeter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Calorimeter 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 39 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 40 44 #include "TString.h" 41 #include "TFormula.h"42 #include "TRandom3.h"43 #include "TObjArray.h"44 #include "TDatabasePDG.h"45 #include "TLorentzVector.h"46 45 47 46 #include <algorithm> 48 #include <stdexcept>49 47 #include <iostream> 50 48 #include <sstream> 49 #include <stdexcept> 51 50 52 51 using namespace std; … … 58 57 fItParticleInputArray(0), fItTrackInputArray(0) 59 58 { 60 59 61 60 fECalResolutionFormula = new DelphesFormula; 62 61 fHCalResolutionFormula = new DelphesFormula; … … 67 66 fHCalTowerTrackArray = new TObjArray; 68 67 fItHCalTowerTrackArray = fHCalTowerTrackArray->MakeIterator(); 69 70 68 } 71 69 … … 74 72 Calorimeter::~Calorimeter() 75 73 { 76 74 77 75 if(fECalResolutionFormula) delete fECalResolutionFormula; 78 76 if(fHCalResolutionFormula) delete fHCalResolutionFormula; … … 83 81 if(fHCalTowerTrackArray) delete fHCalTowerTrackArray; 84 82 if(fItHCalTowerTrackArray) delete fItHCalTowerTrackArray; 85 86 83 } 87 84 … … 94 91 Double_t ecalFraction, hcalFraction; 95 92 TBinMap::iterator itEtaBin; 96 set< Double_t>::iterator itPhiBin;97 vector< Double_t> *phiBins;93 set<Double_t>::iterator itPhiBin; 94 vector<Double_t> *phiBins; 98 95 99 96 // read eta and phi bins … … 103 100 fEtaBins.clear(); 104 101 fPhiBins.clear(); 105 for(i = 0; i < size /2; ++i)106 { 107 paramEtaBins = param[i *2];102 for(i = 0; i < size / 2; ++i) 103 { 104 paramEtaBins = param[i * 2]; 108 105 sizeEtaBins = paramEtaBins.GetSize(); 109 paramPhiBins = param[i *2 + 1];106 paramPhiBins = param[i * 2 + 1]; 110 107 sizePhiBins = paramPhiBins.GetSize(); 111 108 … … 124 121 { 125 122 fEtaBins.push_back(itEtaBin->first); 126 phiBins = new vector< double>(itEtaBin->second.size());123 phiBins = new vector<double>(itEtaBin->second.size()); 127 124 fPhiBins.push_back(phiBins); 128 125 phiBins->clear(); … … 141 138 fFractionMap[0] = make_pair(0.0, 1.0); 142 139 143 for(i = 0; i < size /2; ++i)144 { 145 paramFractions = param[i *2 + 1];140 for(i = 0; i < size / 2; ++i) 141 { 142 paramFractions = param[i * 2 + 1]; 146 143 147 144 ecalFraction = paramFractions[0].GetDouble(); 148 145 hcalFraction = paramFractions[1].GetDouble(); 149 146 150 fFractionMap[param[i *2].GetInt()] = make_pair(ecalFraction, hcalFraction);147 fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction); 151 148 } 152 149 153 150 // read min E value for timing measurement in ECAL 154 fTimingEnergyMin = GetDouble("TimingEnergyMin", 4.);151 fTimingEnergyMin = GetDouble("TimingEnergyMin", 4.); 155 152 // For timing 156 153 // So far this flag needs to be false … … 192 189 void Calorimeter::Finish() 193 190 { 194 vector< vector< Double_t >*>::iterator itPhiBin;191 vector<vector<Double_t> *>::iterator itPhiBin; 195 192 if(fItParticleInputArray) delete fItParticleInputArray; 196 193 if(fItTrackInputArray) delete fItTrackInputArray; … … 218 215 TFractionMap::iterator itFractionMap; 219 216 220 vector< Double_t>::iterator itEtaBin;221 vector< Double_t>::iterator itPhiBin;222 vector< Double_t> *phiBins;223 224 vector< Long64_t>::iterator itTowerHits;217 vector<Double_t>::iterator itEtaBin; 218 vector<Double_t>::iterator itPhiBin; 219 vector<Double_t> *phiBins; 220 221 vector<Long64_t>::iterator itTowerHits; 225 222 226 223 DelphesFactory *factory = GetFactory(); … … 234 231 fItParticleInputArray->Reset(); 235 232 number = -1; 236 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))233 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next()))) 237 234 { 238 235 const TLorentzVector &particlePosition = particle->Position; … … 280 277 fItTrackInputArray->Reset(); 281 278 number = -1; 282 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))279 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 283 280 { 284 281 const TLorentzVector &trackPosition = track->Position; … … 331 328 towerHit = (*itTowerHits); 332 329 flags = (towerHit >> 24) & 0x00000000000000FFLL; 333 number = (towerHit) &0x0000000000FFFFFFLL;330 number = (towerHit)&0x0000000000FFFFFFLL; 334 331 hitEtaPhi = towerHit >> 32; 335 332 … … 352 349 353 350 // calculate eta and phi of the tower's center 354 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);355 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);351 fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 352 fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 356 353 357 354 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 365 362 fECalTrackEnergy = 0.0; 366 363 fHCalTrackEnergy = 0.0; 367 364 368 365 fECalTrackSigma = 0.0; 369 366 fHCalTrackSigma = 0.0; 370 367 371 368 fTowerTrackHits = 0; 372 369 fTowerPhotonHits = 0; … … 374 371 fECalTowerTrackArray->Clear(); 375 372 fHCalTowerTrackArray->Clear(); 376 377 373 } 378 374 … … 382 378 ++fTowerTrackHits; 383 379 384 track = static_cast<Candidate *>(fTrackInputArray->At(number));380 track = static_cast<Candidate *>(fTrackInputArray->At(number)); 385 381 momentum = track->Momentum; 386 382 position = track->Position; … … 400 396 { 401 397 fECalTrackEnergy += ecalEnergy; 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; 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; 407 405 fECalTowerTrackArray->Add(track); 408 406 } 409 407 410 408 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] > 1.0E-9) 411 409 { 412 410 fHCalTrackEnergy += hcalEnergy; 413 411 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 414 if(hcalSigma/momentum.E() < track->TrackResolution) energyGuess = hcalEnergy; 415 else energyGuess = momentum.E(); 416 417 fHCalTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess; 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; 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 *>(fParticleInputArray->At(number));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 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 528 527 529 528 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); … … 545 544 fTowerOutputArray->Add(fTower); 546 545 } 547 546 548 547 // fill energy flow candidates 549 548 fECalTrackSigma = TMath::Sqrt(fECalTrackSigma); … … 551 550 552 551 //compute neutral excesses 553 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 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 eflowtrack 560 559 if(ecalNeutralEnergy > fECalEnergyMin && ecalNeutralSigma > fECalEnergySignificanceMin) 561 560 { 562 561 // create new photon tower 563 tower = static_cast<Candidate *>(fTower->Clone());564 pt = 565 562 tower = static_cast<Candidate *>(fTower->Clone()); 563 pt = ecalNeutralEnergy / TMath::CosH(eta); 564 566 565 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalNeutralEnergy); 567 566 tower->Eem = ecalNeutralEnergy; 568 567 tower->Ehad = 0.0; 569 568 tower->PID = 22; 570 569 571 570 fEFlowPhotonOutputArray->Add(tower); 572 571 573 572 //clone tracks 574 573 fItECalTowerTrackArray->Reset(); 575 while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next())))574 while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next()))) 576 575 { 577 576 mother = track; 578 track = static_cast<Candidate *>(track->Clone());577 track = static_cast<Candidate *>(track->Clone()); 579 578 track->AddCandidate(mother); 580 579 581 580 fEFlowTrackOutputArray->Add(track); 582 581 } 583 584 } 585 582 } 583 586 584 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 587 585 else if(fECalTrackEnergy > 0.0) 588 586 { 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;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; 594 592 595 593 //rescale tracks 596 594 fItECalTowerTrackArray->Reset(); 597 while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next())))598 { 595 while((track = static_cast<Candidate *>(fItECalTowerTrackArray->Next()))) 596 { 599 597 mother = track; 600 track = static_cast<Candidate *>(track->Clone());598 track = static_cast<Candidate *>(track->Clone()); 601 599 track->AddCandidate(mother); 602 600 … … 606 604 } 607 605 } 608 609 606 610 607 // if hcal neutral excess is significant, simply create neutral EflowNeutralHadron tower and clone each track into eflowtrack … … 612 609 { 613 610 // create new photon tower 614 tower = static_cast<Candidate *>(fTower->Clone());615 pt = 616 611 tower = static_cast<Candidate *>(fTower->Clone()); 612 pt = hcalNeutralEnergy / TMath::CosH(eta); 613 617 614 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalNeutralEnergy); 618 615 tower->Ehad = hcalNeutralEnergy; 619 616 tower->Eem = 0.0; 620 617 621 618 fEFlowNeutralHadronOutputArray->Add(tower); 622 619 623 620 //clone tracks 624 621 fItHCalTowerTrackArray->Reset(); 625 while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next())))622 while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next()))) 626 623 { 627 624 mother = track; 628 track = static_cast<Candidate *>(track->Clone());625 track = static_cast<Candidate *>(track->Clone()); 629 626 track->AddCandidate(mother); 630 627 631 628 fEFlowTrackOutputArray->Add(track); 632 629 } 633 634 } 635 630 } 631 636 632 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 637 633 else if(fHCalTrackEnergy > 0.0) 638 634 { 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);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); 643 639 rescaleFactor = bestEnergyEstimate / fHCalTrackEnergy; 644 640 645 641 //rescale tracks 646 642 fItHCalTowerTrackArray->Reset(); 647 while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next())))648 { 643 while((track = static_cast<Candidate *>(fItHCalTowerTrackArray->Next()))) 644 { 649 645 mother = track; 650 track = static_cast<Candidate *>(track->Clone());646 track = static_cast<Candidate *>(track->Clone()); 651 647 track->AddCandidate(mother); 652 648 … … 656 652 } 657 653 } 658 659 660 654 } 661 655 … … 668 662 if(mean > 0.0) 669 663 { 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));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)); 674 668 } 675 669 else -
modules/Calorimeter.h
re39abb4 r0e7d64a 42 42 { 43 43 public: 44 45 44 Calorimeter(); 46 45 ~Calorimeter(); … … 51 50 52 51 private: 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; //! 52 typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //! 53 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 56 54 57 55 Candidate *fTower; … … 79 77 TBinMap fBinMap; //! 80 78 81 std::vector < Double_t> fEtaBins;82 std::vector < std::vector < Double_t >*> fPhiBins;79 std::vector<Double_t> fEtaBins; 80 std::vector<std::vector<Double_t> *> fPhiBins; 83 81 84 std::vector < Long64_t> fTowerHits;82 std::vector<Long64_t> fTowerHits; 85 83 86 std::vector < Double_t> fECalTowerFractions;87 std::vector < Double_t> fHCalTowerFractions;84 std::vector<Double_t> fECalTowerFractions; 85 std::vector<Double_t> fHCalTowerFractions; 88 86 89 std::vector < Double_t> fECalTrackFractions;90 std::vector < Double_t> fHCalTrackFractions;87 std::vector<Double_t> fECalTrackFractions; 88 std::vector<Double_t> fHCalTrackFractions; 91 89 92 90 DelphesFormula *fECalResolutionFormula; //! -
modules/Cloner.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Clone 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 38 37 #include <algorithm> 39 #include <stdexcept>40 38 #include <iostream> 41 39 #include <sstream> 40 #include <stdexcept> 42 41 43 42 using namespace std; … … 48 47 fItInputArray(0) 49 48 { 50 51 49 } 52 50 … … 55 53 Cloner::~Cloner() 56 54 { 57 58 55 } 59 56 … … 70 67 71 68 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 72 73 69 } 74 70 … … 85 81 { 86 82 Candidate *candidate; 87 88 // loop over all input candidates83 84 // loop over all input candidates 89 85 fItInputArray->Reset(); 90 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))86 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 91 87 { 92 candidate = static_cast<Candidate *>(candidate->Clone());88 candidate = static_cast<Candidate *>(candidate->Clone()); 93 89 fOutputArray->Add(candidate); 94 90 } -
modules/Cloner.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 Cloner(); 41 40 ~Cloner(); … … 46 45 47 46 private: 48 49 47 TIterator *fItInputArray; //! 50 48 -
modules/ConstituentFilter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class ConstituentFilter 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 88 87 param = GetParam("ConstituentInputArray"); 89 88 size = param.GetSize(); 90 for(i = 0; i < size /2; ++i)89 for(i = 0; i < size / 2; ++i) 91 90 { 92 array = ImportArray(param[i *2].GetString());91 array = ImportArray(param[i * 2].GetString()); 93 92 iterator = array->MakeIterator(); 94 93 95 fInputMap[iterator] = ExportArray(param[i *2 + 1].GetString());94 fInputMap[iterator] = ExportArray(param[i * 2 + 1].GetString()); 96 95 } 97 96 } … … 101 100 void ConstituentFilter::Finish() 102 101 { 103 map< TIterator *, TObjArray *>::iterator itInputMap;104 vector< TIterator *>::iterator itInputList;102 map<TIterator *, TObjArray *>::iterator itInputMap; 103 vector<TIterator *>::iterator itInputList; 105 104 TIterator *iterator; 106 105 … … 123 122 { 124 123 Candidate *jet, *constituent; 125 map< TIterator *, TObjArray *>::iterator itInputMap;126 vector< TIterator *>::iterator itInputList;124 map<TIterator *, TObjArray *>::iterator itInputMap; 125 vector<TIterator *>::iterator itInputList; 127 126 TIterator *iterator; 128 127 TObjArray *array; … … 135 134 // loop over all jets 136 135 iterator->Reset(); 137 while((jet = static_cast<Candidate *>(iterator->Next())))136 while((jet = static_cast<Candidate *>(iterator->Next()))) 138 137 { 139 138 TIter itConstituents(jet->GetCandidates()); … … 142 141 143 142 // loop over all constituents 144 while((constituent = static_cast<Candidate *>(itConstituents.Next())))143 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 145 144 { 146 145 // set the IsConstituent flag … … 158 157 // loop over all constituents 159 158 iterator->Reset(); 160 while((constituent = static_cast<Candidate *>(iterator->Next())))159 while((constituent = static_cast<Candidate *>(iterator->Next()))) 161 160 { 162 161 // check the IsConstituent flag -
modules/ConstituentFilter.h
re39abb4 r0e7d64a 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <map> 32 33 #include <vector> 33 #include <map>34 34 35 35 class TIterator; … … 39 39 { 40 40 public: 41 42 41 ConstituentFilter(); 43 42 ~ConstituentFilter(); … … 48 47 49 48 private: 50 51 49 Double_t fJetPTMin; 52 50 53 std::vector< TIterator *> fInputList; //!51 std::vector<TIterator *> fInputList; //! 54 52 55 std::map< TIterator *, TObjArray *> fInputMap; //!53 std::map<TIterator *, TObjArray *> fInputMap; //! 56 54 57 55 TObjArray *fOutputArray; //! -
modules/Delphes.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Delphes 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 35 #include "ExRootAnalysis/ExRootResult.h"36 #include "ExRootAnalysis/ExRootFilter.h"37 34 #include "ExRootAnalysis/ExRootClassifier.h" 38 35 #include "ExRootAnalysis/ExRootConfReader.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootResult.h" 39 38 #include "ExRootAnalysis/ExRootTreeWriter.h" 40 39 40 #include "TDatabasePDG.h" 41 #include "TFolder.h" 42 #include "TFormula.h" 43 #include "TLorentzVector.h" 44 #include "TMath.h" 45 #include "TObjArray.h" 41 46 #include "TROOT.h" 42 #include "TMath.h" 43 #include "TFolder.h" 47 #include "TRandom3.h" 44 48 #include "TString.h" 45 #include "TFormula.h"46 #include "TRandom3.h"47 #include "TObjArray.h"48 #include "TDatabasePDG.h"49 #include "TLorentzVector.h"50 49 51 #include <algorithm> 52 #include <stdexcept> 50 #include <algorithm> 53 51 #include <iostream> 54 52 #include <sstream> 53 #include <stdexcept> 55 54 55 #include <stdio.h> 56 56 #include <string.h> 57 #include <stdio.h>58 57 59 58 using namespace std; -
modules/Delphes.h
re39abb4 r0e7d64a 41 41 { 42 42 public: 43 44 43 Delphes(const char *name = "Delphes"); 45 44 ~Delphes(); 46 45 47 46 void SetTreeWriter(ExRootTreeWriter *treeWriter); 48 47 49 48 DelphesFactory *GetFactory() const { return fFactory; } 50 49 … … 56 55 57 56 private: 58 59 57 DelphesFactory *fFactory; 60 58 … … 63 61 64 62 #endif /* Delphes_h */ 65 -
modules/DenseTrackFilter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class DenseTrackFilter 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 71 70 Long_t i, j, k, size, sizeEtaBins, sizePhiBins; 72 71 TBinMap::iterator itEtaBin; 73 set< Double_t>::iterator itPhiBin;74 vector< Double_t> *phiBins;72 set<Double_t>::iterator itPhiBin; 73 vector<Double_t> *phiBins; 75 74 76 75 // read eta and phi bins … … 80 79 fEtaBins.clear(); 81 80 fPhiBins.clear(); 82 for(i = 0; i < size /2; ++i)83 { 84 paramEtaBins = param[i *2];81 for(i = 0; i < size / 2; ++i) 82 { 83 paramEtaBins = param[i * 2]; 85 84 sizeEtaBins = paramEtaBins.GetSize(); 86 paramPhiBins = param[i *2 + 1];85 paramPhiBins = param[i * 2 + 1]; 87 86 sizePhiBins = paramPhiBins.GetSize(); 88 87 … … 101 100 { 102 101 fEtaBins.push_back(itEtaBin->first); 103 phiBins = new vector< double>(itEtaBin->second.size());102 phiBins = new vector<double>(itEtaBin->second.size()); 104 103 fPhiBins.push_back(phiBins); 105 104 phiBins->clear(); … … 126 125 void DenseTrackFilter::Finish() 127 126 { 128 vector< vector< Double_t >*>::iterator itPhiBin;127 vector<vector<Double_t> *>::iterator itPhiBin; 129 128 if(fItTrackInputArray) delete fItTrackInputArray; 130 129 for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin) … … 145 144 Double_t ptmax; 146 145 147 vector< Double_t>::iterator itEtaBin;148 vector< Double_t>::iterator itPhiBin;149 vector< Double_t> *phiBins;150 151 vector< Long64_t>::iterator itTowerHits;146 vector<Double_t>::iterator itEtaBin; 147 vector<Double_t>::iterator itPhiBin; 148 vector<Double_t> *phiBins; 149 150 vector<Long64_t>::iterator itTowerHits; 152 151 153 152 fTowerHits.clear(); … … 156 155 fItTrackInputArray->Reset(); 157 156 number = -1; 158 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))157 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 159 158 { 160 159 const TLorentzVector &trackPosition = track->Position; … … 196 195 towerHit = (*itTowerHits); 197 196 flags = (towerHit >> 24) & 0x00000000000000FFLL; 198 number = (towerHit) &0x0000000000FFFFFFLL;197 number = (towerHit)&0x0000000000FFFFFFLL; 199 198 hitEtaPhi = towerHit >> 32; 200 199 … … 216 215 { 217 216 ++fTowerTrackHits; 218 track = static_cast<Candidate *>(fTrackInputArray->At(number));217 track = static_cast<Candidate *>(fTrackInputArray->At(number)); 219 218 momentum = track->Momentum; 220 219 … … 226 225 continue; 227 226 } 228 229 227 } 230 228 231 229 // here fill last tower 232 230 FillTrack(); 233 234 231 } 235 232 … … 245 242 // saving track with highest pT that hit the tower 246 243 if(fTowerTrackHits < 1) return; 247 244 248 245 numberOfCandidates = fBestTrack->GetCandidates()->GetEntriesFast(); 249 246 if(numberOfCandidates < 1) return; 250 247 251 track = static_cast<Candidate *>(fBestTrack->GetCandidates()->At(numberOfCandidates - 1));252 candidate = static_cast<Candidate *>(track->Clone());248 track = static_cast<Candidate *>(fBestTrack->GetCandidates()->At(numberOfCandidates - 1)); 249 candidate = static_cast<Candidate *>(track->Clone()); 253 250 pt = candidate->Momentum.Pt(); 254 251 eta = candidate->Momentum.Eta(); … … 256 253 eta = gRandom->Gaus(eta, fEtaPhiRes); 257 254 phi = gRandom->Gaus(phi, fEtaPhiRes); 258 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));255 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt * TMath::CosH(eta)); 259 256 candidate->AddCandidate(track); 260 257 … … 262 259 switch(TMath::Abs(candidate->PID)) 263 260 { 264 265 266 267 268 269 270 271 272 } 273 } 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 } -
modules/DenseTrackFilter.h
re39abb4 r0e7d64a 41 41 { 42 42 public: 43 44 43 DenseTrackFilter(); 45 44 ~DenseTrackFilter(); … … 50 49 51 50 private: 52 53 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 51 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 54 52 55 53 Candidate *fBestTrack; … … 61 59 TBinMap fBinMap; //! 62 60 63 std::vector < Double_t> fEtaBins;64 std::vector < std::vector < Double_t >*> fPhiBins;61 std::vector<Double_t> fEtaBins; 62 std::vector<std::vector<Double_t> *> fPhiBins; 65 63 66 std::vector < Long64_t> fTowerHits;64 std::vector<Long64_t> fTowerHits; 67 65 68 66 TIterator *fItTrackInputArray; //! -
modules/Efficiency.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Efficiency 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 94 93 95 94 void Efficiency::Process() 96 { 95 { 97 96 Candidate *candidate; 98 Double_t pt, eta, phi, e ;97 Double_t pt, eta, phi, e, d0, dz, ctgTheta; 99 98 100 99 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))100 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 102 101 { 103 102 const TLorentzVector &candidatePosition = candidate->Position; … … 107 106 pt = candidateMomentum.Pt(); 108 107 e = candidateMomentum.E(); 108 d0 = candidate->D0; 109 dz = candidate->DZ; 110 ctgTheta = candidate->CtgTheta; 109 111 110 112 // apply an efficency formula 111 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e )) continue;112 113 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e, d0, dz, ctgTheta)) continue; 114 113 115 fOutputArray->Add(candidate); 114 116 } -
modules/Efficiency.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 Efficiency(); 41 40 ~Efficiency(); … … 46 45 47 46 private: 48 49 47 DelphesFormula *fFormula; //! 50 48 -
modules/EnergyScale.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class EnergyScale 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 98 97 TLorentzVector momentum; 99 98 Double_t scale; 100 99 101 100 fItInputArray->Reset(); 102 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))101 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 103 102 { 104 103 momentum = candidate->Momentum; … … 108 107 if(scale > 0.0) momentum *= scale; 109 108 110 candidate = static_cast<Candidate *>(candidate->Clone());109 candidate = static_cast<Candidate *>(candidate->Clone()); 111 110 candidate->Momentum = momentum; 112 111 -
modules/EnergyScale.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 EnergyScale(); 41 40 ~EnergyScale(); … … 46 45 47 46 private: 48 49 47 DelphesFormula *fFormula; //! 50 48 … … 52 50 53 51 const TObjArray *fInputArray; //! 54 52 55 53 TObjArray *fOutputArray; //! 56 54 -
modules/EnergySmearing.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class EnergySmearing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 87 86 88 87 void EnergySmearing::Finish() 89 { 88 { 90 89 if(fItInputArray) delete fItInputArray; 91 90 } … … 99 98 100 99 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))100 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 102 101 { 103 102 const TLorentzVector &candidatePosition = candidate->Position; 104 103 const TLorentzVector &candidateMomentum = candidate->Momentum; 105 104 106 105 pt = candidatePosition.Pt(); 107 106 eta = candidatePosition.Eta(); 108 107 phi = candidatePosition.Phi(); 109 108 energy = candidateMomentum.E(); 110 109 111 110 // apply smearing formula 112 111 energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy)); 113 112 114 113 if(energy <= 0.0) continue; 115 114 116 115 mother = candidate; 117 candidate = static_cast<Candidate *>(candidate->Clone());116 candidate = static_cast<Candidate *>(candidate->Clone()); 118 117 eta = candidateMomentum.Eta(); 119 118 phi = candidateMomentum.Phi(); 120 candidate->Momentum.SetPtEtaPhiE(energy /TMath::CosH(eta), eta, phi, energy);121 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) /candidateMomentum.E();119 candidate->Momentum.SetPtEtaPhiE(energy / TMath::CosH(eta), eta, phi, energy); 120 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E(); 122 121 candidate->AddCandidate(mother); 123 122 124 123 fOutputArray->Add(candidate); 125 124 } -
modules/EnergySmearing.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 EnergySmearing(); 41 40 ~EnergySmearing(); … … 46 45 47 46 private: 48 49 47 DelphesFormula *fFormula; //! 50 48 … … 52 50 53 51 const TObjArray *fInputArray; //! 54 52 55 53 TObjArray *fOutputArray; //! 56 54 -
modules/ExampleModule.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class ExampleModule 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 87 86 fArrayParam.push_back(param[i].GetDouble()); 88 87 } 89 88 90 89 // import input array(s) 91 90 … … 96 95 97 96 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 98 99 97 } 100 98 … … 115 113 // loop over all input candidates 116 114 fItInputArray->Reset(); 117 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))115 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 118 116 { 119 117 candidatePosition = candidate->Position; -
modules/ExampleModule.h
re39abb4 r0e7d64a 38 38 { 39 39 public: 40 41 40 ExampleModule(); 42 41 ~ExampleModule(); … … 47 46 48 47 private: 49 50 48 Int_t fIntParam; 51 49 Double_t fDoubleParam; 52 53 std::deque 54 50 51 std::deque<Double_t> fArrayParam; 52 55 53 DelphesFormula *fFormula; //! 56 54 -
modules/FastJetFinder.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class FastJetFinder 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 #include <vector> 51 50 51 #include "fastjet/ClusterSequence.hh" 52 #include "fastjet/ClusterSequenceArea.hh" 53 #include "fastjet/JetDefinition.hh" 52 54 #include "fastjet/PseudoJet.hh" 53 #include "fastjet/JetDefinition.hh"54 #include "fastjet/ClusterSequence.hh"55 55 #include "fastjet/Selector.hh" 56 #include "fastjet/ClusterSequenceArea.hh"57 56 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" 58 57 58 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh" 59 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 59 60 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh" 60 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 61 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh" 62 63 #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 61 62 #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh" 64 63 #include "fastjet/contribs/Nsubjettiness/Njettiness.hh" 65 64 #include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh" 66 #include "fastjet/contribs/Nsubjettiness/ ExtraRecombiners.hh"65 #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 67 66 68 67 #include "fastjet/contribs/ValenciaPlugin/ValenciaPlugin.hh" 69 68 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"73 72 74 73 using namespace std; 75 74 using namespace fastjet; 76 75 using namespace fastjet::contrib; 77 78 76 79 77 //------------------------------------------------------------------------------ … … 83 81 fDefinition(0), fAreaDefinition(0), fItInputArray(0) 84 82 { 85 86 83 } 87 84 … … 90 87 FastJetFinder::~FastJetFinder() 91 88 { 92 93 89 } 94 90 … … 120 116 fJetPTMin = GetDouble("JetPTMin", 10.0); 121 117 122 123 118 //-- N(sub)jettiness parameters -- 124 119 … … 127 122 fAxisMode = GetInt("AxisMode", 1); 128 123 fRcutOff = GetDouble("RcutOff", 0.8); // used only if Njettiness is used as jet clustering algo (case 8) 129 fN = GetInt("N", 2); 124 fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8) 130 125 131 126 //-- Exclusive clustering for e+e- collisions -- 132 133 fNJets = GetInt("NJets", 2);127 128 fNJets = GetInt("NJets", 2); 134 129 fExclusiveClustering = GetBool("ExclusiveClustering", false); 135 130 136 131 //-- Valencia Linear Collider algorithm 132 137 133 fGamma = GetDouble("Gamma", 1.0); 138 134 //fBeta parameter see above 139 135 140 136 fMeasureDef = new NormalizedMeasure(fBeta, fParameterR); 141 137 142 138 switch(fAxisMode) 143 139 { 144 145 146 147 148 149 150 151 152 153 154 155 156 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 } 157 153 158 154 //-- Trimming parameters -- 159 155 160 156 fComputeTrimming = GetBool("ComputeTrimming", false); 161 157 fRTrim = GetDouble("RTrim", 0.2); 162 158 fPtFracTrim = GetDouble("PtFracTrim", 0.05); 163 164 159 165 160 //-- Pruning parameters -- 166 161 167 162 fComputePruning = GetBool("ComputePruning", false); 168 163 fZcutPrun = GetDouble("ZcutPrun", 0.1); 169 164 fRcutPrun = GetDouble("RcutPrun", 0.5); 170 165 fRPrun = GetDouble("RPrun", 0.8); 171 166 172 167 //-- SoftDrop parameters -- 173 174 fComputeSoftDrop 175 fBetaSoftDrop 168 169 fComputeSoftDrop = GetBool("ComputeSoftDrop", false); 170 fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0); 176 171 fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1); 177 fR0SoftDrop= GetDouble("R0SoftDrop=", 0.8); 178 172 fR0SoftDrop = GetDouble("R0SoftDrop=", 0.8); 179 173 180 174 // --- Jet Area Parameters --- 175 181 176 fAreaAlgorithm = GetInt("AreaAlgorithm", 0); 182 177 fComputeRho = GetBool("ComputeRho", false); … … 195 190 switch(fAreaAlgorithm) 196 191 { 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 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; 216 211 } 217 212 218 213 switch(fJetAlgorithm) 219 214 { 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 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; 250 245 case 9: 251 fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma); 252 fDefinition = new JetDefinition(fValenciaPlugin); 253 break; 254 255 } 256 257 246 fValenciaPlugin = new ValenciaPlugin(fParameterR, fBeta, fGamma); 247 fDefinition = new JetDefinition(fValenciaPlugin); 248 break; 249 } 258 250 259 251 fPlugin = plugin; … … 270 262 271 263 fEstimators.clear(); 272 for(i = 0; i < size /2; ++i)273 { 274 etaMin = param[i *2].GetDouble();275 etaMax = param[i *2 + 1].GetDouble();264 for(i = 0; i < size / 2; ++i) 265 { 266 etaMin = param[i * 2].GetDouble(); 267 etaMax = param[i * 2 + 1].GetDouble(); 276 268 estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorRapRange(etaMin, etaMax), *fDefinition, *fAreaDefinition); 277 269 estimatorStruct.etaMin = etaMin; … … 290 282 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 291 283 fRhoOutputArray = ExportArray(GetString("RhoOutputArray", "rho")); 284 fConstituentsOutputArray = ExportArray(GetString("ConstituentsOutputArray", "constituents")); 292 285 } 293 286 … … 296 289 void FastJetFinder::Finish() 297 290 { 298 vector< TEstimatorStruct>::iterator itEstimators;291 vector<TEstimatorStruct>::iterator itEstimators; 299 292 300 293 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) … … 306 299 if(fDefinition) delete fDefinition; 307 300 if(fAreaDefinition) delete fAreaDefinition; 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);301 if(fPlugin) delete static_cast<JetDefinition::Plugin *>(fPlugin); 302 if(fRecomb) delete static_cast<JetDefinition::Recombiner *>(fRecomb); 303 if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin *>(fNjettinessPlugin); 311 304 if(fAxesDef) delete fAxesDef; 312 305 if(fMeasureDef) delete fMeasureDef; 313 if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin*>(fValenciaPlugin); 314 306 if(fValenciaPlugin) delete static_cast<JetDefinition::Plugin *>(fValenciaPlugin); 315 307 } 316 308 … … 325 317 Double_t time, timeWeight; 326 318 Int_t number, ncharged, nneutrals; 327 Int_t charge; 319 Int_t charge; 328 320 Double_t rho = 0.0; 329 321 PseudoJet jet, area; 330 322 ClusterSequence *sequence; 331 vector< PseudoJet> inputList, outputList, subjets;332 vector< PseudoJet>::iterator itInputList, itOutputList;333 vector< TEstimatorStruct>::iterator itEstimators;323 vector<PseudoJet> inputList, outputList, subjets; 324 vector<PseudoJet>::iterator itInputList, itOutputList; 325 vector<TEstimatorStruct>::iterator itEstimators; 334 326 Double_t excl_ymerge23 = 0.0; 335 327 Double_t excl_ymerge34 = 0.0; 336 328 Double_t excl_ymerge45 = 0.0; 337 329 Double_t excl_ymerge56 = 0.0; 338 330 339 331 DelphesFactory *factory = GetFactory(); 340 332 … … 344 336 fItInputArray->Reset(); 345 337 number = 0; 346 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))338 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 347 339 { 348 340 momentum = candidate->Momentum; … … 381 373 outputList.clear(); 382 374 383 384 375 if(fExclusiveClustering) 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 } 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 } 399 391 else 400 401 402 392 { 393 outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin)); 394 } 403 395 404 396 // loop over all jets and export them 405 397 detaMax = 0.0; 406 398 dphiMax = 0.0; 407 399 408 400 for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList) 409 401 { … … 416 408 if(fAreaDefinition) area = itOutputList->area_4vector(); 417 409 418 419 420 410 candidate = factory->NewCandidate(); 421 411 … … 434 424 { 435 425 if(itInputList->user_index() < 0) continue; 436 constituent = static_cast<Candidate *>(fInputArray->At(itInputList->user_index()));426 constituent = static_cast<Candidate *>(fInputArray->At(itInputList->user_index())); 437 427 438 428 deta = TMath::Abs(momentum.Eta() - constituent->Momentum.Eta()); … … 441 431 if(dphi > dphiMax) dphiMax = dphi; 442 432 443 if(constituent->Charge == 0) nneutrals++; 444 else ncharged++; 445 446 time += TMath::Sqrt(constituent->Momentum.E())*(constituent->Position.T()); 433 if(constituent->Charge == 0) 434 nneutrals++; 435 else 436 ncharged++; 437 438 time += TMath::Sqrt(constituent->Momentum.E()) * (constituent->Position.T()); 447 439 timeWeight += TMath::Sqrt(constituent->Momentum.E()); 448 440 449 441 charge += constituent->Charge; 450 442 443 fConstituentsOutputArray->Add(constituent); 451 444 candidate->AddCandidate(constituent); 452 445 } 453 446 454 447 candidate->Momentum = momentum; 455 candidate->Position.SetT(time /timeWeight);448 candidate->Position.SetT(time / timeWeight); 456 449 candidate->Area.SetPxPyPzE(area.px(), area.py(), area.pz(), area.E()); 457 450 458 451 candidate->DeltaEta = detaMax; 459 452 candidate->DeltaPhi = dphiMax; 460 candidate->Charge = charge; 453 candidate->Charge = charge; 461 454 candidate->NNeutrals = nneutrals; 462 455 candidate->NCharged = ncharged; 463 464 456 465 457 //for exclusive clustering, access y_n,n+1 as exclusive_ymerge (fNJets); … … 468 460 candidate->ExclYmerge45 = excl_ymerge45; 469 461 candidate->ExclYmerge56 = excl_ymerge56; 470 462 471 463 //------------------------------------ 472 464 // Trimming … … 476 468 { 477 469 478 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm,fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim));470 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, fRTrim), fastjet::SelectorPtFractionMin(fPtFracTrim)); 479 471 fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList); 480 472 481 473 trimmed_jet = join(trimmed_jet.constituents()); 482 474 483 475 candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m()); 484 485 // four hardest subjets 476 477 // four hardest subjets 486 478 subjets.clear(); 487 479 subjets = trimmed_jet.pieces(); 488 480 subjets = sorted_by_pt(subjets); 489 481 490 482 candidate->NSubJetsTrimmed = subjets.size(); 491 483 492 for 484 for(size_t i = 0; i < subjets.size() and i < 4; i++) 493 485 { 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());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()); 496 488 } 497 489 } 498 499 490 500 491 //------------------------------------ 501 492 // Pruning 502 493 //------------------------------------ 503 504 494 505 495 if(fComputePruning) 506 496 { 507 497 508 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm,fRPrun),fZcutPrun,fRcutPrun);498 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm, fRPrun), fZcutPrun, fRcutPrun); 509 499 fastjet::PseudoJet pruned_jet = pruner(*itOutputList); 510 500 511 501 candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m()); 512 513 // four hardest subjet 502 503 // four hardest subjet 514 504 subjets.clear(); 515 505 subjets = pruned_jet.pieces(); 516 506 subjets = sorted_by_pt(subjets); 517 507 518 508 candidate->NSubJetsPruned = subjets.size(); 519 509 520 for 510 for(size_t i = 0; i < subjets.size() and i < 4; i++) 521 511 { 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());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()); 524 514 } 525 526 } 527 515 } 516 528 517 //------------------------------------ 529 518 // SoftDrop 530 519 //------------------------------------ 531 520 532 521 if(fComputeSoftDrop) 533 522 { 534 535 contrib::SoftDrop softDrop(fBetaSoftDrop, fSymmetryCutSoftDrop,fR0SoftDrop);523 524 contrib::SoftDrop softDrop(fBetaSoftDrop, fSymmetryCutSoftDrop, fR0SoftDrop); 536 525 fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList); 537 526 538 527 candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m()); 539 540 // four hardest subjet 541 528 529 // four hardest subjet 530 542 531 subjets.clear(); 543 subjets 544 subjets 532 subjets = softdrop_jet.pieces(); 533 subjets = sorted_by_pt(subjets); 545 534 candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size(); 546 535 547 536 candidate->SoftDroppedJet = candidate->SoftDroppedP4[0]; 548 537 549 for (size_t i = 0; i < subjets.size()and i < 4; i++)538 for(size_t i = 0; i < subjets.size() and i < 4; i++) 550 539 { 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];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]; 555 544 } 556 545 } 557 546 558 547 // --- compute N-subjettiness with N = 1,2,3,4,5 ---- 559 548 560 549 if(fComputeNsubjettiness) 561 550 { 562 551 563 552 Nsubjettiness nSub1(1, *fAxesDef, *fMeasureDef); 564 553 Nsubjettiness nSub2(2, *fAxesDef, *fMeasureDef); … … 566 555 Nsubjettiness nSub4(4, *fAxesDef, *fMeasureDef); 567 556 Nsubjettiness nSub5(5, *fAxesDef, *fMeasureDef); 568 557 569 558 candidate->Tau[0] = nSub1(*itOutputList); 570 559 candidate->Tau[1] = nSub2(*itOutputList); … … 572 561 candidate->Tau[3] = nSub4(*itOutputList); 573 562 candidate->Tau[4] = nSub5(*itOutputList); 574 575 563 } 576 564 -
modules/FastJetFinder.h
re39abb4 r0e7d64a 35 35 class TIterator; 36 36 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 } 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 48 50 49 51 class FastJetFinder: public DelphesModule 50 52 { 51 53 public: 52 53 54 FastJetFinder(); 54 55 ~FastJetFinder(); … … 59 60 60 61 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 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; //! 154 155 155 156 ClassDef(FastJetFinder, 1) -
modules/FastJetGridMedianEstimator.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class FastJetGridMedianEstimator 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 49 #include <utility> 50 50 #include <vector> 51 #include <utility>52 51 52 #include "fastjet/ClusterSequence.hh" 53 #include "fastjet/ClusterSequenceArea.hh" 54 #include "fastjet/JetDefinition.hh" 53 55 #include "fastjet/PseudoJet.hh" 54 #include "fastjet/JetDefinition.hh" 55 #include "fastjet/ClusterSequence.hh" 56 #include "fastjet/RectangularGrid.hh" 56 57 #include "fastjet/Selector.hh" 57 #include "fastjet/RectangularGrid.hh"58 #include "fastjet/ClusterSequenceArea.hh"59 58 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" 60 59 61 60 #include "fastjet/tools/GridMedianBackgroundEstimator.hh" 62 61 62 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh" 63 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh" 63 64 #include "fastjet/plugins/SISCone/fastjet/SISConePlugin.hh" 64 #include "fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh"65 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh"66 65 67 #include "fastjet/contribs/Nsubjettiness/ Nsubjettiness.hh"66 #include "fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh" 68 67 #include "fastjet/contribs/Nsubjettiness/Njettiness.hh" 69 68 #include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh" 70 #include "fastjet/contribs/Nsubjettiness/ ExtraRecombiners.hh"69 #include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 71 70 72 71 using namespace std; 73 72 using namespace fastjet; 74 73 using namespace fastjet::contrib; 75 76 74 77 75 //------------------------------------------------------------------------------ … … 80 78 fItInputArray(0) 81 79 { 82 83 80 } 84 81 … … 87 84 FastJetGridMedianEstimator::~FastJetGridMedianEstimator() 88 85 { 89 90 86 } 91 87 … … 104 100 105 101 fEstimators.clear(); 106 for(i = 0; i < size /4; ++i)102 for(i = 0; i < size / 4; ++i) 107 103 { 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();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(); 112 108 fEstimators.push_back(new GridMedianBackgroundEstimator(rapMin, rapMax, drap, dphi)); 113 109 } … … 125 121 void FastJetGridMedianEstimator::Finish() 126 122 { 127 vector< GridMedianBackgroundEstimator *>::iterator itEstimators;123 vector<GridMedianBackgroundEstimator *>::iterator itEstimators; 128 124 129 125 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) … … 144 140 Double_t rho = 0; 145 141 PseudoJet jet; 146 vector< PseudoJet> inputList, outputList;142 vector<PseudoJet> inputList, outputList; 147 143 148 vector< GridMedianBackgroundEstimator * >::iterator itEstimators;; 144 vector<GridMedianBackgroundEstimator *>::iterator itEstimators; 145 ; 149 146 150 147 DelphesFactory *factory = GetFactory(); … … 155 152 fItInputArray->Reset(); 156 153 number = 0; 157 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))154 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 158 155 { 159 156 momentum = candidate->Momentum; -
modules/FastJetGridMedianEstimator.h
re39abb4 r0e7d64a 20 20 #define FastJetGridMedianEstimator_h 21 21 22 23 22 /** \class FastJetGridMedianEstimator 24 23 * … … 35 34 class TIterator; 36 35 37 namespace fastjet { 38 class GridMedianBackgroundEstimator; 36 namespace fastjet 37 { 38 class GridMedianBackgroundEstimator; 39 39 } 40 40 … … 42 42 { 43 43 public: 44 45 44 FastJetGridMedianEstimator(); 46 45 ~FastJetGridMedianEstimator(); … … 51 50 52 51 private: 53 54 std::vector< fastjet::GridMedianBackgroundEstimator * > fEstimators; //! 52 std::vector<fastjet::GridMedianBackgroundEstimator *> fEstimators; //! 55 53 56 54 TIterator *fItInputArray; //! -
modules/Hector.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Hector 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 #include "Hector/H_BeamLine.h" 51 #include "Hector/H_BeamParticle.h" 52 52 #include "Hector/H_RecRPObject.h" 53 #include "Hector/H_BeamParticle.h"54 53 55 54 using namespace std; … … 120 119 121 120 fItInputArray->Reset(); 122 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))121 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 123 122 { 124 123 const TLorentzVector &candidatePosition = candidate->Position; … … 132 131 z = 1.0E-3 * candidatePosition.Z(); 133 132 134 // tx = 1.0E6 * TMath::ATan(candidateMomentum.Px()/pz);135 // ty = 1.0E6 * TMath::ATan(candidateMomentum.Py()/pz);133 // tx = 1.0E6 * TMath::ATan(candidateMomentum.Px()/pz); 134 // ty = 1.0E6 * TMath::ATan(candidateMomentum.Py()/pz); 136 135 137 136 tx = 0.0; 138 137 ty = 0.0; 139 138 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);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); 143 142 144 143 H_BeamParticle particle(candidate->Mass, candidate->Charge); 145 // particle.set4Momentum(candidateMomentum);146 particle.set4Momentum(candidateMomentum.Px(), candidateMomentum.Py(), 147 144 // particle.set4Momentum(candidateMomentum); 145 particle.set4Momentum(candidateMomentum.Px(), candidateMomentum.Py(), 146 candidateMomentum.Pz(), candidateMomentum.E()); 148 147 particle.setPosition(x, y, tx, ty, z); 149 148 … … 158 157 159 158 mother = candidate; 160 candidate = static_cast<Candidate *>(candidate->Clone());159 candidate = static_cast<Candidate *>(candidate->Clone()); 161 160 candidate->Position.SetXYZT(particle.getX(), particle.getY(), particle.getS(), time); 162 161 candidate->Momentum.SetPxPyPzE(particle.getTX(), particle.getTY(), 0.0, particle.getE()); -
modules/Hector.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 Hector(); 41 40 ~Hector(); … … 46 45 47 46 private: 48 49 47 Int_t fDirection; 50 48 -
modules/IdentificationMap.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class IdentificationMap 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h"37 #include "ExRootAnalysis/ExRootClassifier.h"38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 39 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 40 44 #include "TString.h" 41 #include "TFormula.h"42 #include "TRandom3.h"43 #include "TObjArray.h"44 #include "TDatabasePDG.h"45 #include "TLorentzVector.h"46 45 47 46 #include <algorithm> 48 #include <stdexcept>49 47 #include <iostream> 50 48 #include <sstream> 49 #include <stdexcept> 51 50 52 51 using namespace std; … … 79 78 80 79 fEfficiencyMap.clear(); 81 for(i = 0; i < size /3; ++i)80 for(i = 0; i < size / 3; ++i) 82 81 { 83 82 formula = new DelphesFormula; 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)));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))); 87 86 } 88 87 … … 129 128 Double_t pt, eta, phi, e; 130 129 TMisIDMap::iterator itEfficiencyMap; 131 pair 130 pair<TMisIDMap::iterator, TMisIDMap::iterator> range; 132 131 DelphesFormula *formula; 133 132 Int_t pdgCodeIn, pdgCodeOut, charge; … … 136 135 137 136 fItInputArray->Reset(); 138 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))137 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 139 138 { 140 139 const TLorentzVector &candidatePosition = candidate->Position; … … 144 143 pt = candidateMomentum.Pt(); 145 144 e = candidateMomentum.E(); 146 145 147 146 pdgCodeIn = candidate->PID; 148 147 charge = candidate->Charge; … … 171 170 { 172 171 // change PID of particle 173 if(pdgCodeOut != 0) candidate->PID = charge *pdgCodeOut;172 if(pdgCodeOut != 0) candidate->PID = charge * pdgCodeOut; 174 173 fOutputArray->Add(candidate); 175 174 break; -
modules/IdentificationMap.h
re39abb4 r0e7d64a 20 20 #define IdentificationMap_h 21 21 22 23 22 /** \class IdentificationMap 24 23 * … … 39 38 { 40 39 public: 41 42 40 IdentificationMap(); 43 41 ~IdentificationMap(); … … 48 46 49 47 private: 50 51 typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //! 48 typedef std::multimap<Int_t, std::pair<Int_t, DelphesFormula *> > TMisIDMap; //! 52 49 53 50 TMisIDMap fEfficiencyMap; //! -
modules/ImpactParameterSmearing.cc
re39abb4 r0e7d64a 25 25 */ 26 26 27 28 27 #include "modules/ImpactParameterSmearing.h" 29 28 … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 100 99 101 100 fItInputArray->Reset(); 102 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))101 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 103 102 { 104 103 105 104 // take momentum before smearing (otherwise apply double smearing on d0) 106 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));105 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 107 106 108 107 const TLorentzVector &candidateMomentum = particle->Momentum; … … 112 111 phi = candidateMomentum.Phi(); 113 112 e = candidateMomentum.E(); 114 113 115 114 px = candidateMomentum.Px(); 116 115 py = candidateMomentum.Py(); 117 116 118 117 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 119 xd = 120 yd = 121 zd = 118 xd = candidate->Xd; 119 yd = candidate->Yd; 120 zd = candidate->Zd; 122 121 123 122 // calculate smeared values … … 131 130 132 131 // calculate impact parameter (after-smearing) 133 d0 = (xd *py - yd*px)/pt;132 d0 = (xd * py - yd * px) / pt; 134 133 135 134 dd0 = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); … … 138 137 mother = candidate; 139 138 140 candidate = static_cast<Candidate *>(candidate->Clone());139 candidate = static_cast<Candidate *>(candidate->Clone()); 141 140 candidate->Xd = xd; 142 141 candidate->Yd = yd; -
modules/ImpactParameterSmearing.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 ImpactParameterSmearing(); 41 40 ~ImpactParameterSmearing(); … … 46 45 47 46 private: 48 49 47 DelphesFormula *fFormula; //! 50 48 … … 52 50 53 51 const TObjArray *fInputArray; //! 54 52 55 53 TObjArray *fOutputArray; //! 56 54 -
modules/Isolation.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Isolation 21 20 * … … 35 34 #include "classes/DelphesFormula.h" 36 35 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 37 38 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 39 #include "ExRootAnalysis/ExRootClassifier.h" 40 39 40 #include "TDatabasePDG.h" 41 #include "TFormula.h" 42 #include "TLorentzVector.h" 41 43 #include "TMath.h" 44 #include "TObjArray.h" 45 #include "TRandom3.h" 42 46 #include "TString.h" 43 #include "TFormula.h"44 #include "TRandom3.h"45 #include "TObjArray.h"46 #include "TDatabasePDG.h"47 #include "TLorentzVector.h"48 47 49 48 #include <algorithm> 50 #include <stdexcept>51 49 #include <iostream> 52 50 #include <sstream> 51 #include <stdexcept> 53 52 54 53 using namespace std; … … 59 58 { 60 59 public: 61 62 60 IsolationClassifier() {} 63 61 … … 71 69 Int_t IsolationClassifier::GetCategory(TObject *object) 72 70 { 73 Candidate *track = static_cast<Candidate *>(object);71 Candidate *track = static_cast<Candidate *>(object); 74 72 const TLorentzVector &momentum = track->Momentum; 75 73 … … 171 169 // loop over all input jets 172 170 fItCandidateInputArray->Reset(); 173 while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next())))171 while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next()))) 174 172 { 175 173 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 181 179 { 182 180 fItRhoInputArray->Reset(); 183 while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))181 while((object = static_cast<Candidate *>(fItRhoInputArray->Next()))) 184 182 { 185 183 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 198 196 199 197 itIsolationArray.Reset(); 200 while((isolation = static_cast<Candidate *>(itIsolationArray.Next())))198 while((isolation = static_cast<Candidate *>(itIsolationArray.Next()))) 201 199 { 202 200 const TLorentzVector &isolationMomentum = isolation->Momentum; … … 204 202 if(fUseMiniCone) 205 203 { 206 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && 207 candidateMomentum.DeltaR(isolationMomentum) > fDeltaRMin; 204 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidateMomentum.DeltaR(isolationMomentum) > fDeltaRMin; 208 205 } 209 206 else 210 207 { 211 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && 212 candidate->GetUniqueID() != isolation->GetUniqueID(); 208 pass = candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && candidate->GetUniqueID() != isolation->GetUniqueID(); 213 209 } 214 210 … … 233 229 } 234 230 } 235 236 231 } 237 232 238 // find rho233 // find rho 239 234 rho = 0.0; 240 235 if(fRhoInputArray) 241 236 { 242 237 fItRhoInputArray->Reset(); 243 while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))238 while((object = static_cast<Candidate *>(fItRhoInputArray->Next()))) 244 239 { 245 240 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 250 245 } 251 246 252 253 254 247 // correct sum for pile-up contamination 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();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(); 259 252 260 253 candidate->IsolationVar = ratioDBeta; -
modules/Isolation.h
re39abb4 r0e7d64a 41 41 { 42 42 public: 43 44 43 Isolation(); 45 44 ~Isolation(); … … 50 49 51 50 private: 52 53 51 Double_t fDeltaRMax; 54 52 -
modules/JetFakeParticle.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class JetFakeParticle 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 39 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 40 44 #include "TString.h" 41 #include "TFormula.h"42 #include "TRandom3.h"43 #include "TObjArray.h"44 #include "TDatabasePDG.h"45 #include "TLorentzVector.h"46 45 47 46 #include <algorithm> 48 #include <stdexcept>49 47 #include <iostream> 50 48 #include <sstream> 51 49 #include <stdexcept> 52 50 53 51 using namespace std; … … 81 79 fEfficiencyMap.clear(); 82 80 83 for(i = 0; i < size /2; ++i)81 for(i = 0; i < size / 2; ++i) 84 82 { 85 83 formula = new DelphesFormula; 86 formula->Compile(param[i *2 + 1].GetString());87 pdgCode = param[i *2].GetInt();84 formula->Compile(param[i * 2 + 1].GetString()); 85 pdgCode = param[i * 2].GetInt(); 88 86 89 87 if(TMath::Abs(pdgCode) != 11 && TMath::Abs(pdgCode) != 13 && TMath::Abs(pdgCode) != 22) … … 92 90 } 93 91 94 fEfficiencyMap[param[i *2].GetInt()] = formula;92 fEfficiencyMap[param[i * 2].GetInt()] = formula; 95 93 } 96 94 … … 116 114 fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "fakePhotons")); 117 115 fJetOutputArray = ExportArray(GetString("JetOutputArray", "jets")); 118 119 116 } 120 117 … … 147 144 148 145 fItInputArray->Reset(); 149 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))146 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 150 147 { 151 148 const TLorentzVector &candidatePosition = candidate->Position; … … 170 167 if(total <= r && r < total + p) 171 168 { 172 fake = static_cast<Candidate *>(candidate->Clone());169 fake = static_cast<Candidate *>(candidate->Clone()); 173 170 174 171 // convert jet … … 178 175 if(candidate->Charge != 0) 179 176 { 180 fake->Charge = candidate->Charge /TMath::Abs(candidate->Charge);177 fake->Charge = candidate->Charge / TMath::Abs(candidate->Charge); 181 178 } 182 179 else … … 184 181 rs = gRandom->Uniform(); 185 182 fake->Charge = (rs < 0.5) ? -1 : 1; 186 187 183 } 188 184 } -
modules/JetFakeParticle.h
re39abb4 r0e7d64a 20 20 #define JetFakeParticle_h 21 21 22 23 22 /** \class JetFakeParticle 24 23 * … … 39 38 { 40 39 public: 41 42 40 JetFakeParticle(); 43 41 ~JetFakeParticle(); … … 48 46 49 47 private: 50 51 #if !defined(__CINT__) && !defined(__CLING__) 52 typedef std::map< Int_t, DelphesFormula * > TFakeMap; //! 48 #if !defined(__CINT__) && !defined(__CLING__) 49 typedef std::map<Int_t, DelphesFormula *> TFakeMap; //! 53 50 TFakeMap fEfficiencyMap; 54 51 #endif 55 52 56 53 TIterator *fItInputArray; //! -
modules/JetFlavorAssociation.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class JetFlavorAssociation 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 53 52 //------------------------------------------------------------------------------ 54 53 55 class PartonClassifier : public ExRootClassifier54 class PartonClassifier : public ExRootClassifier 56 55 { 57 56 public: 58 59 57 PartonClassifier() {} 60 58 Int_t GetCategory(TObject *object); … … 67 65 Int_t PartonClassifier::GetCategory(TObject *object) 68 66 { 69 // select parton in the parton list67 // select parton in the parton list 70 68 71 69 Candidate *parton = static_cast<Candidate *>(object); … … 87 85 //------------------------------------------------------------------------------ 88 86 89 class ParticleLHEFClassifier : public ExRootClassifier87 class ParticleLHEFClassifier : public ExRootClassifier 90 88 { 91 89 public: 92 93 90 ParticleLHEFClassifier() {} 94 91 Int_t GetCategory(TObject *object); … … 190 187 //------------------------------------------------------------------------------ 191 188 192 void JetFlavorAssociation::Process(){ 189 void JetFlavorAssociation::Process() 190 { 193 191 194 192 Candidate *jet; … … 201 199 if(partonArray == 0) return; 202 200 203 if(fParticleLHEFInputArray) 201 if(fParticleLHEFInputArray) 204 202 { 205 203 fParticleLHEFFilter->Reset(); … … 227 225 Candidate *tempParton = 0, *tempPartonHighestPt = 0; 228 226 int pdgCode, pdgCodeMax = -1; 229 227 230 228 TIter itPartonArray(partonArray); 231 229 TIter itPartonLHEFArray(partonLHEFArray); … … 241 239 if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode; 242 240 } 243 241 244 242 if(!fParticleLHEFInputArray) continue; 245 243 246 244 itPartonLHEFArray.Reset(); 247 245 while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next()))) 248 246 { 249 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 && 250 parton->PID == partonLHEF->PID && 251 partonLHEF->Charge == parton->Charge) 252 { 253 break; 247 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge) 248 { 249 break; 254 250 } 255 251 … … 330 326 while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next()))) 331 327 { 332 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 && 333 parton->PID == partonLHEF->PID && 334 partonLHEF->Charge == parton->Charge) 328 if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 && parton->PID == partonLHEF->PID && partonLHEF->Charge == parton->Charge) 335 329 { 336 330 isGoodCandidate = false; -
modules/JetFlavorAssociation.h
re39abb4 r0e7d64a 28 28 */ 29 29 30 #include "classes/DelphesClasses.h" 30 31 #include "classes/DelphesModule.h" 31 #include "classes/DelphesClasses.h"32 32 #include <map> 33 33 … … 42 42 { 43 43 public: 44 45 44 JetFlavorAssociation(); 46 45 ~JetFlavorAssociation(); … … 54 53 55 54 private: 56 57 55 Double_t fDeltaR; 58 56 -
modules/JetPileUpSubtractor.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class JetPileUpSubtractor 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 56 55 fItJetInputArray(0), fItRhoInputArray(0) 57 56 { 58 59 57 } 60 58 … … 63 61 JetPileUpSubtractor::~JetPileUpSubtractor() 64 62 { 65 66 63 } 67 64 … … 83 80 84 81 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 85 86 82 } 87 83 … … 105 101 // loop over all input candidates 106 102 fItJetInputArray->Reset(); 107 while((candidate = static_cast<Candidate *>(fItJetInputArray->Next())))103 while((candidate = static_cast<Candidate *>(fItJetInputArray->Next()))) 108 104 { 109 105 momentum = candidate->Momentum; … … 116 112 { 117 113 fItRhoInputArray->Reset(); 118 while((object = static_cast<Candidate *>(fItRhoInputArray->Next())))114 while((object = static_cast<Candidate *>(fItRhoInputArray->Next()))) 119 115 { 120 116 if(eta >= object->Edges[0] && eta < object->Edges[1]) … … 132 128 if(momentum.Pt() <= fJetPTMin) continue; 133 129 134 candidate = static_cast<Candidate *>(candidate->Clone());130 candidate = static_cast<Candidate *>(candidate->Clone()); 135 131 candidate->Momentum = momentum; 136 132 -
modules/JetPileUpSubtractor.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 JetPileUpSubtractor(); 41 40 ~JetPileUpSubtractor(); … … 46 45 47 46 private: 48 49 47 Double_t fJetPTMin; 50 48 -
modules/LeptonDressing.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class LeptonDressing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 54 53 55 54 LeptonDressing::LeptonDressing() : 56 fItDressingInputArray(0), fItCandidateInputArray(0)55 fItDressingInputArray(0), fItCandidateInputArray(0) 57 56 { 58 57 } … … 74 73 fDressingInputArray = ImportArray(GetString("DressingInputArray", "Calorimeter/photons")); 75 74 fItDressingInputArray = fDressingInputArray->MakeIterator(); 76 75 77 76 fCandidateInputArray = ImportArray(GetString("CandidateInputArray", "UniqueObjectFinder/electrons")); 78 77 fItCandidateInputArray = fCandidateInputArray->MakeIterator(); 79 78 80 79 // create output array 81 80 … … 97 96 Candidate *candidate, *dressing, *mother; 98 97 TLorentzVector momentum; 99 98 100 99 // loop over all input candidate 101 100 fItCandidateInputArray->Reset(); 102 while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next())))101 while((candidate = static_cast<Candidate *>(fItCandidateInputArray->Next()))) 103 102 { 104 103 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 107 106 fItDressingInputArray->Reset(); 108 107 momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 109 while((dressing = static_cast<Candidate *>(fItDressingInputArray->Next())))108 while((dressing = static_cast<Candidate *>(fItDressingInputArray->Next()))) 110 109 { 111 110 const TLorentzVector &dressingMomentum = dressing->Momentum; 112 if 111 if(dressingMomentum.Pt() > 0.1) 113 112 { 114 113 if(candidateMomentum.DeltaR(dressingMomentum) <= fDeltaR) … … 120 119 121 120 mother = candidate; 122 candidate = static_cast<Candidate *>(candidate->Clone());121 candidate = static_cast<Candidate *>(candidate->Clone()); 123 122 124 123 candidate->Momentum += momentum; 125 124 candidate->AddCandidate(mother); 126 125 127 126 fOutputArray->Add(candidate); 128 127 } -
modules/LeptonDressing.h
re39abb4 r0e7d64a 34 34 { 35 35 public: 36 37 36 LeptonDressing(); 38 37 ~LeptonDressing(); 39 38 40 39 void Init(); 41 40 void Process(); … … 43 42 44 43 private: 44 Double_t fDeltaR; 45 45 46 Double_t fDeltaR;47 48 46 TIterator *fItDressingInputArray; //! 49 47 50 48 TIterator *fItCandidateInputArray; //! 51 49 52 50 const TObjArray *fDressingInputArray; //! 53 51 54 52 const TObjArray *fCandidateInputArray; //! 55 53 -
modules/Merger.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Merger 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h"37 #include "ExRootAnalysis/ExRootClassifier.h"38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 39 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 40 44 #include "TString.h" 41 #include "TFormula.h"42 #include "TRandom3.h"43 #include "TObjArray.h"44 #include "TDatabasePDG.h"45 #include "TLorentzVector.h"46 45 47 #include <algorithm> 48 #include <stdexcept> 46 #include <algorithm> 49 47 #include <iostream> 50 48 #include <sstream> 49 #include <stdexcept> 51 50 52 51 using namespace std; … … 89 88 90 89 fMomentumOutputArray = ExportArray(GetString("MomentumOutputArray", "momentum")); 91 90 92 91 fEnergyOutputArray = ExportArray(GetString("EnergyOutputArray", "energy")); 93 92 } … … 97 96 void Merger::Finish() 98 97 { 99 vector< TIterator *>::iterator itInputList;98 vector<TIterator *>::iterator itInputList; 100 99 TIterator *iterator; 101 100 … … 113 112 Candidate *candidate; 114 113 TLorentzVector momentum; 115 Double_t sumPT, sumE; 116 vector< TIterator *>::iterator itInputList;114 Double_t sumPT, sumE; 115 vector<TIterator *>::iterator itInputList; 117 116 TIterator *iterator; 118 117 119 118 DelphesFactory *factory = GetFactory(); 120 119 121 120 momentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 122 121 sumPT = 0; … … 130 129 // loop over all candidates 131 130 iterator->Reset(); 132 while((candidate = static_cast<Candidate *>(iterator->Next())))131 while((candidate = static_cast<Candidate *>(iterator->Next()))) 133 132 { 134 133 const TLorentzVector &candidateMomentum = candidate->Momentum; … … 143 142 144 143 candidate = factory->NewCandidate(); 145 144 146 145 candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0); 147 146 candidate->Momentum = momentum; 148 147 149 148 fMomentumOutputArray->Add(candidate); 150 149 151 150 candidate = factory->NewCandidate(); 152 151 153 152 candidate->Position.SetXYZT(0.0, 0.0, 0.0, 0.0); 154 153 candidate->Momentum.SetPtEtaPhiE(sumPT, 0.0, 0.0, sumE); 155 154 156 155 fEnergyOutputArray->Add(candidate); 157 156 } -
modules/Merger.h
re39abb4 r0e7d64a 39 39 { 40 40 public: 41 42 41 Merger(); 43 42 ~Merger(); … … 48 47 49 48 private: 50 51 std::vector< TIterator * > fInputList; //! 49 std::vector<TIterator *> fInputList; //! 52 50 53 51 TObjArray *fOutputArray; //! -
modules/MomentumSmearing.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class MomentumSmearing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 99 98 100 99 fItInputArray->Reset(); 101 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))100 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 102 101 { 103 102 const TLorentzVector &candidatePosition = candidate->Position; … … 108 107 e = candidateMomentum.E(); 109 108 res = fFormula->Eval(pt, eta, phi, e); 110 109 111 110 // apply smearing formula 112 111 //pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 113 114 res = ( res > 1.0 ) ? 1.0 : res;115 112 116 pt = LogNormal(pt, res * pt ); 117 113 res = (res > 1.0) ? 1.0 : res; 114 115 pt = LogNormal(pt, res * pt); 116 118 117 //if(pt <= 0.0) continue; 119 118 120 119 mother = candidate; 121 candidate = static_cast<Candidate *>(candidate->Clone());120 candidate = static_cast<Candidate *>(candidate->Clone()); 122 121 eta = candidateMomentum.Eta(); 123 122 phi = candidateMomentum.Phi(); 124 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt *TMath::CosH(eta));123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt * TMath::CosH(eta)); 125 124 //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 126 125 candidate->TrackResolution = res; 127 126 candidate->AddCandidate(mother); 128 127 129 128 fOutputArray->Add(candidate); 130 129 } … … 138 137 if(mean > 0.0) 139 138 { 140 b = TMath::Sqrt(TMath::Log((1.0 + (sigma *sigma)/(mean*mean))));141 a = TMath::Log(mean) - 0.5 *b*b;139 b = TMath::Sqrt(TMath::Log((1.0 + (sigma * sigma) / (mean * mean)))); 140 a = TMath::Log(mean) - 0.5 * b * b; 142 141 143 return TMath::Exp(a + b *gRandom->Gaus(0.0, 1.0));142 return TMath::Exp(a + b * gRandom->Gaus(0.0, 1.0)); 144 143 } 145 144 else … … 149 148 } 150 149 151 152 150 //------------------------------------------------------------------------------ -
modules/MomentumSmearing.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 MomentumSmearing(); 41 40 ~MomentumSmearing(); … … 46 45 47 46 private: 48 49 47 Double_t LogNormal(Double_t mean, Double_t sigma); 50 48 … … 54 52 55 53 const TObjArray *fInputArray; //! 56 54 57 55 TObjArray *fOutputArray; //! 58 56 -
modules/OldCalorimeter.cc
re39abb4 r0e7d64a 19 19 #include "classes/DelphesFormula.h" 20 20 21 #include "ExRootAnalysis/ExRootClassifier.h" 22 #include "ExRootAnalysis/ExRootFilter.h" 21 23 #include "ExRootAnalysis/ExRootResult.h" 22 #include "ExRootAnalysis/ExRootFilter.h" 23 #include "ExRootAnalysis/ExRootClassifier.h" 24 24 25 #include "TDatabasePDG.h" 26 #include "TFormula.h" 27 #include "TLorentzVector.h" 25 28 #include "TMath.h" 29 #include "TObjArray.h" 30 #include "TRandom3.h" 26 31 #include "TString.h" 27 #include "TFormula.h"28 #include "TRandom3.h"29 #include "TObjArray.h"30 #include "TDatabasePDG.h"31 #include "TLorentzVector.h"32 32 33 33 #include <algorithm> 34 #include <stdexcept>35 34 #include <iostream> 36 35 #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;} 84 if(fItTowerHCalTrackArray) delete fItTowerHCalTrackArray; 85 } 85 86 86 87 //------------------------------------------------------------------------------ … … 92 93 Double_t ecalFraction, hcalFraction; 93 94 TBinMap::iterator itEtaBin; 94 set< Double_t>::iterator itPhiBin;95 vector< Double_t> *phiBins;95 set<Double_t>::iterator itPhiBin; 96 vector<Double_t> *phiBins; 96 97 97 98 // read eta and phi bins … … 101 102 fEtaBins.clear(); 102 103 fPhiBins.clear(); 103 for(i = 0; i < size /2; ++i)104 { 105 paramEtaBins = param[i *2];104 for(i = 0; i < size / 2; ++i) 105 { 106 paramEtaBins = param[i * 2]; 106 107 sizeEtaBins = paramEtaBins.GetSize(); 107 paramPhiBins = param[i *2 + 1];108 paramPhiBins = param[i * 2 + 1]; 108 109 sizePhiBins = paramPhiBins.GetSize(); 109 110 … … 122 123 { 123 124 fEtaBins.push_back(itEtaBin->first); 124 phiBins = new vector< double>(itEtaBin->second.size());125 phiBins = new vector<double>(itEtaBin->second.size()); 125 126 fPhiBins.push_back(phiBins); 126 127 phiBins->clear(); … … 139 140 fFractionMap[0] = make_pair(0.0, 1.0); 140 141 141 for(i = 0; i < size /2; ++i)142 { 143 paramFractions = param[i *2 + 1];142 for(i = 0; i < size / 2; ++i) 143 { 144 paramFractions = param[i * 2 + 1]; 144 145 sizeFractions = paramFractions.GetSize(); 145 146 … … 147 148 hcalFraction = paramFractions[1].GetDouble(); 148 149 149 fFractionMap[param[i *2].GetInt()] = make_pair(ecalFraction, hcalFraction);150 } 151 /*150 fFractionMap[param[i * 2].GetInt()] = make_pair(ecalFraction, hcalFraction); 151 } 152 /* 152 153 TFractionMap::iterator itFractionMap; 153 154 for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap) … … 179 180 void OldCalorimeter::Finish() 180 181 { 181 vector< vector< Double_t>*>::iterator itPhiBin;182 vector<vector<Double_t> *>::iterator itPhiBin; 182 183 if(fItParticleInputArray) delete fItParticleInputArray; 183 184 if(fItTrackInputArray) delete fItTrackInputArray; … … 203 204 TFractionMap::iterator itFractionMap; 204 205 205 vector< Double_t>::iterator itEtaBin;206 vector< Double_t>::iterator itPhiBin;207 vector< Double_t> *phiBins;208 209 vector< Long64_t>::iterator itTowerHits;206 vector<Double_t>::iterator itEtaBin; 207 vector<Double_t>::iterator itPhiBin; 208 vector<Double_t> *phiBins; 209 210 vector<Long64_t>::iterator itTowerHits; 210 211 211 212 DelphesFactory *factory = GetFactory(); … … 217 218 fItParticleInputArray->Reset(); 218 219 number = -1; 219 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))220 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next()))) 220 221 { 221 222 const TLorentzVector &particlePosition = particle->Position; … … 265 266 fItTrackInputArray->Reset(); 266 267 number = -1; 267 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))268 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 268 269 { 269 270 const TLorentzVector &trackPosition = track->Position; … … 315 316 towerHit = (*itTowerHits); 316 317 flags = (towerHit >> 24) & 0x00000000000000FFLL; 317 number = (towerHit) &0x0000000000FFFFFFLL;318 number = (towerHit)&0x0000000000FFFFFFLL; 318 319 hitEtaPhi = towerHit >> 32; 319 320 … … 336 337 337 338 // calculate eta and phi of the tower's center 338 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);339 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);339 fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 340 fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 340 341 341 342 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 368 369 if(flags & 1) 369 370 { 370 track = static_cast<Candidate *>(fTrackInputArray->At(number));371 track = static_cast<Candidate *>(fTrackInputArray->At(number)); 371 372 372 373 ++fTowerTrackAllHits; … … 408 409 if(flags & 8) ++fTowerPhotonHits; 409 410 410 particle = static_cast<Candidate *>(fParticleInputArray->At(number));411 particle = static_cast<Candidate *>(fParticleInputArray->At(number)); 411 412 momentum = particle->Momentum; 412 413 … … 436 437 if(!fTower) return; 437 438 438 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));439 // if(ecalEnergy < 0.0) ecalEnergy = 0.0;439 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 440 // if(ecalEnergy < 0.0) ecalEnergy = 0.0; 440 441 441 442 ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 442 443 443 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));444 // if(hcalEnergy < 0.0) hcalEnergy = 0.0;444 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 445 // if(hcalEnergy < 0.0) hcalEnergy = 0.0; 445 446 446 447 hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); … … 448 449 energy = ecalEnergy + hcalEnergy; 449 450 450 // eta = fTowerEta;451 // phi = fTowerPhi;451 // eta = fTowerEta; 452 // phi = fTowerPhi; 452 453 453 454 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 481 482 { 482 483 fItTowerTrackArray->Reset(); 483 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))484 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next()))) 484 485 { 485 486 fEFlowTrackOutputArray->Add(track); 486 487 } 487 488 } 488 else if(fTowerTrackAllHits > 0 && 489 fTowerECalHits + fTowerHCalHits == fTowerAllHits) 490 { 491 if(fTowerECalHits == fTowerECalTrackHits && 492 fTowerHCalHits == fTowerHCalTrackHits) 489 else if(fTowerTrackAllHits > 0 && fTowerECalHits + fTowerHCalHits == fTowerAllHits) 490 { 491 if(fTowerECalHits == fTowerECalTrackHits && fTowerHCalHits == fTowerHCalTrackHits) 493 492 { 494 493 itTowerTrackArray = fItTowerTrackArray; … … 506 505 507 506 fItTowerHCalArray->Reset(); 508 while((particle = static_cast<Candidate *>(fItTowerHCalArray->Next())))507 while((particle = static_cast<Candidate *>(fItTowerHCalArray->Next()))) 509 508 { 510 509 tower->AddCandidate(particle); … … 538 537 539 538 fItTowerECalArray->Reset(); 540 while((particle = static_cast<Candidate *>(fItTowerECalArray->Next())))539 while((particle = static_cast<Candidate *>(fItTowerECalArray->Next()))) 541 540 { 542 541 tower->AddCandidate(particle); … … 567 566 { 568 567 itTowerTrackArray->Reset(); 569 while((track = static_cast<Candidate *>(itTowerTrackArray->Next())))568 while((track = static_cast<Candidate *>(itTowerTrackArray->Next()))) 570 569 { 571 570 fEFlowTrackOutputArray->Add(track); … … 587 586 if(mean > 0.0) 588 587 { 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));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)); 593 592 } 594 593 else -
modules/OldCalorimeter.h
re39abb4 r0e7d64a 28 28 { 29 29 public: 30 31 30 OldCalorimeter(); 32 31 ~OldCalorimeter(); … … 37 36 38 37 private: 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; //! 38 typedef std::map<Long64_t, std::pair<Double_t, Double_t> > TFractionMap; //! 39 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 42 40 43 41 Candidate *fTower; … … 51 49 TBinMap fBinMap; //! 52 50 53 std::vector < Double_t> fEtaBins;54 std::vector < std::vector < Double_t >*> fPhiBins;51 std::vector<Double_t> fEtaBins; 52 std::vector<std::vector<Double_t> *> fPhiBins; 55 53 56 std::vector < Long64_t> fTowerHits;54 std::vector<Long64_t> fTowerHits; 57 55 58 std::vector < Double_t> fECalFractions;59 std::vector < Double_t> fHCalFractions;56 std::vector<Double_t> fECalFractions; 57 std::vector<Double_t> fHCalFractions; 60 58 61 59 DelphesFormula *fECalResolutionFormula; //! -
modules/ParticlePropagator.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class ParticlePropagator 21 20 * … … 35 34 #include "classes/DelphesFormula.h" 36 35 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 37 38 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 39 #include "ExRootAnalysis/ExRootClassifier.h" 40 39 40 #include "TDatabasePDG.h" 41 #include "TFormula.h" 42 #include "TLorentzVector.h" 41 43 #include "TMath.h" 44 #include "TObjArray.h" 45 #include "TRandom3.h" 42 46 #include "TString.h" 43 #include "TFormula.h"44 #include "TRandom3.h"45 #include "TObjArray.h"46 #include "TDatabasePDG.h"47 #include "TLorentzVector.h"48 47 49 48 #include <algorithm> 50 #include <stdexcept>51 49 #include <iostream> 52 50 #include <sstream> 51 #include <stdexcept> 53 52 54 53 using namespace std; … … 67 66 } 68 67 69 70 68 //------------------------------------------------------------------------------ 71 69 … … 73 71 { 74 72 fRadius = GetDouble("Radius", 1.0); 75 fRadius2 = fRadius *fRadius;73 fRadius2 = fRadius * fRadius; 76 74 fHalfLength = GetDouble("HalfLength", 3.0); 77 75 fBz = GetDouble("Bz", 0.0); … … 140 138 const Double_t c_light = 2.99792458E8; 141 139 142 if (!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0)140 if(!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0) 143 141 beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0); 144 142 else 145 143 { 146 Candidate &beamSpotCandidate = *((Candidate *) 144 Candidate &beamSpotCandidate = *((Candidate *)fBeamSpotInputArray->At(0)); 147 145 beamSpotPosition = beamSpotCandidate.Position; 148 146 } 149 147 150 148 fItInputArray->Reset(); 151 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))149 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 152 150 { 153 151 if(candidate->GetCandidates()->GetEntriesFast() == 0) … … 157 155 else 158 156 { 159 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));157 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 160 158 } 161 159 162 160 particlePosition = particle->Position; 163 161 particleMomentum = particle->Momentum; 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;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; 171 169 172 170 q = particle->Charge; … … 193 191 { 194 192 mother = candidate; 195 candidate = static_cast<Candidate *>(candidate->Clone());193 candidate = static_cast<Candidate *>(candidate->Clone()); 196 194 197 195 candidate->InitialPosition = particlePosition; … … 207 205 { 208 206 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 209 tmp = px *y - py*x;210 discr2 = pt2 *fRadius2 - tmp*tmp;207 tmp = px * y - py * x; 208 discr2 = pt2 * fRadius2 - tmp * tmp; 211 209 212 210 if(discr2 < 0.0) … … 216 214 } 217 215 218 tmp = px *x + py*y;216 tmp = px * x + py * y; 219 217 discr = TMath::Sqrt(discr2); 220 t1 = (-tmp + discr) /pt2;221 t2 = (-tmp - discr) /pt2;218 t1 = (-tmp + discr) / pt2; 219 t2 = (-tmp - discr) / pt2; 222 220 t = (t1 < 0.0) ? t2 : t1; 223 221 224 z_t = z + pz *t;222 z_t = z + pz * t; 225 223 if(TMath::Abs(z_t) > fHalfLength) 226 224 { … … 230 228 } 231 229 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));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)); 237 235 238 236 mother = candidate; 239 candidate = static_cast<Candidate *>(candidate->Clone());237 candidate = static_cast<Candidate *>(candidate->Clone()); 240 238 241 239 candidate->InitialPosition = particlePosition; 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;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; 244 242 245 243 candidate->Momentum = particleMomentum; … … 251 249 switch(TMath::Abs(candidate->PID)) 252 250 { 253 254 255 256 257 258 259 260 251 case 11: 252 fElectronOutputArray->Add(candidate); 253 break; 254 case 13: 255 fMuonOutputArray->Add(candidate); 256 break; 257 default: 258 fChargedHadronOutputArray->Add(candidate); 261 259 } 262 260 } 263 261 else 264 262 { 265 263 fNeutralOutputArray->Add(candidate); 266 264 } 267 265 } … … 275 273 // helix radius r = p_{T0} / (omega gamma m) 276 274 277 gammam = e *1.0E9 / (c_light*c_light);// gammam in [eV/c^2]278 omega = q * fBz / (gammam); 279 r = pt / (q * fBz) * 1.0E9 /c_light;// in [m]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] 280 278 281 279 phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi] 282 280 283 281 // 2. helix axis coordinates 284 x_c = x + r *TMath::Sin(phi_0);285 y_c = y - r *TMath::Cos(phi_0);282 x_c = x + r * TMath::Sin(phi_0); 283 y_c = y - r * TMath::Cos(phi_0); 286 284 r_c = TMath::Hypot(x_c, y_c); 287 285 phi_c = TMath::ATan2(y_c, x_c); … … 290 288 291 289 rcu = TMath::Abs(r); 292 rc2 = r_c *r_c;290 rc2 = r_c * r_c; 293 291 294 292 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 295 xd = x_c *x_c*x_c - x_c*rcu*r_c + x_c*y_c*y_c;293 xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c * y_c; 296 294 xd = (rc2 > 0.0) ? xd / rc2 : -999; 297 yd = y_c *(-rcu*r_c + rc2);295 yd = y_c * (-rcu * r_c + rc2); 298 296 yd = (rc2 > 0.0) ? yd / rc2 : -999; 299 zd = z + (TMath::Sqrt(xd *xd + yd*yd) - TMath::Sqrt(x*x + y*y))*pz/pt;297 zd = z + (TMath::Sqrt(xd * xd + yd * yd) - TMath::Sqrt(x * x + y * y)) * pz / pt; 300 298 301 299 // use perigee momentum rather than original particle … … 311 309 // calculate additional track parameters (correct for beamspot position) 312 310 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 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()); 318 315 319 316 // 3. time evaluation t = TMath::Min(t_r, t_z) … … 322 319 t_r = 0.0; // in [ns] 323 320 int sign_pz = (pz > 0.0) ? 1 : -1; 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) 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) 328 327 { 329 328 // helix does not cross the cylinder sides … … 332 331 else 333 332 { 334 asinrho = TMath::ASin((fRadius *fRadius - r_c*r_c - r*r) / (2*TMath::Abs(r)*r_c));333 asinrho = TMath::ASin((fRadius * fRadius - r_c * r_c - r * r) / (2 * TMath::Abs(r) * r_c)); 335 334 delta = phi_0 - phi; 336 if(delta < -TMath::Pi()) delta += 2*TMath::Pi();337 if(delta > TMath::Pi()) delta -= 2 *TMath::Pi();335 if(delta < -TMath::Pi()) delta += 2 * TMath::Pi(); 336 if(delta > TMath::Pi()) delta -= 2 * TMath::Pi(); 338 337 t1 = (delta + asinrho) / omega; 339 338 t2 = (delta + TMath::Pi() - asinrho) / omega; … … 359 358 x_t = x_c + r * TMath::Sin(omega * t - phi_0); 360 359 y_t = y_c + r * TMath::Cos(omega * t - phi_0); 361 z_t = z + pz *1.0E9 / c_light / gammam * t;360 z_t = z + pz * 1.0E9 / c_light / gammam * t; 362 361 r_t = TMath::Hypot(x_t, y_t); 363 362 364 365 363 // compute path length for an helix 366 364 367 alpha = pz *1.0E9 / c_light / gammam;368 l = t * TMath::Sqrt(alpha *alpha + r*r*omega*omega);365 alpha = pz * 1.0E9 / c_light / gammam; 366 l = t * TMath::Sqrt(alpha * alpha + r * r * omega * omega); 369 367 370 368 if(r_t > 0.0) … … 374 372 if(particle == candidate) 375 373 { 376 particle->D0 = d0 *1.0E3;377 particle->DZ = dz *1.0E3;374 particle->D0 = d0 * 1.0E3; 375 particle->DZ = dz * 1.0E3; 378 376 particle->P = p; 379 377 particle->PT = pt; … … 383 381 384 382 mother = candidate; 385 candidate = static_cast<Candidate *>(candidate->Clone());383 candidate = static_cast<Candidate *>(candidate->Clone()); 386 384 387 385 candidate->InitialPosition = particlePosition; 388 candidate->Position.SetXYZT(x_t *1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*c_light*1.0E3);386 candidate->Position.SetXYZT(x_t * 1.0E3, y_t * 1.0E3, z_t * 1.0E3, particlePosition.T() + t * c_light * 1.0E3); 389 387 390 388 candidate->Momentum = particleMomentum; 391 389 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;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; 397 395 398 396 candidate->AddCandidate(mother); … … 401 399 switch(TMath::Abs(candidate->PID)) 402 400 { 403 404 405 406 407 408 409 410 401 case 11: 402 fElectronOutputArray->Add(candidate); 403 break; 404 case 13: 405 fMuonOutputArray->Add(candidate); 406 break; 407 default: 408 fChargedHadronOutputArray->Add(candidate); 411 409 } 412 410 } … … 416 414 417 415 //------------------------------------------------------------------------------ 418 -
modules/ParticlePropagator.h
re39abb4 r0e7d64a 40 40 { 41 41 public: 42 43 42 ParticlePropagator(); 44 43 ~ParticlePropagator(); … … 49 48 50 49 private: 51 52 50 Double_t fRadius, fRadius2, fRadiusMax, fHalfLength, fHalfLengthMax; 53 51 Double_t fBz; -
modules/PdgCodeFilter.cc
re39abb4 r0e7d64a 31 31 #include "classes/DelphesFormula.h" 32 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 33 35 #include "ExRootAnalysis/ExRootResult.h" 34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootClassifier.h"36 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 37 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 38 43 #include "TString.h" 39 #include "TFormula.h"40 #include "TRandom3.h"41 #include "TObjArray.h"42 #include "TDatabasePDG.h"43 #include "TLorentzVector.h"44 44 45 45 #include <algorithm> 46 #include <stdexcept>47 46 #include <iostream> 48 47 #include <sstream> 48 #include <stdexcept> 49 49 50 50 using namespace std; … … 75 75 76 76 fInvert = GetBool("Invert", false); 77 78 // no pileup 79 fRequireNotPileup = GetBool("RequireNotPileup", false); 77 80 78 81 fRequireStatus = GetBool("RequireStatus", false); … … 118 121 119 122 fItInputArray->Reset(); 120 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))123 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 121 124 { 122 125 pdgCode = candidate->PID; … … 127 130 if(fRequireStatus && (candidate->Status != fStatus)) continue; 128 131 if(fRequireCharge && (candidate->Charge != fCharge)) continue; 132 if(fRequireNotPileup && (candidate->IsPU > 0)) continue; 129 133 130 134 pass = kTRUE; … … 135 139 } 136 140 } 137 -
modules/PdgCodeFilter.h
re39abb4 r0e7d64a 39 39 { 40 40 public: 41 42 41 PdgCodeFilter(); 43 42 ~PdgCodeFilter(); … … 48 47 49 48 private: 50 51 49 Double_t fPTMin; //! 52 50 Bool_t fInvert; //! … … 55 53 Bool_t fRequireCharge; //! 56 54 Int_t fCharge; //! 57 55 Bool_t fRequireNotPileup; //! 58 56 59 57 std::vector<Int_t> fPdgCodes; -
modules/PhotonConversions.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class PhotonConversions 21 20 * … … 30 29 31 30 #include "classes/DelphesClasses.h" 31 #include "classes/DelphesCylindricalFormula.h" 32 32 #include "classes/DelphesFactory.h" 33 #include "classes/DelphesCylindricalFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TF1.h" 40 #include "TFormula.h" 41 #include "TLorentzVector.h" 39 42 #include "TMath.h" 40 #include "TF1.h" 43 #include "TObjArray.h" 44 #include "TRandom3.h" 41 45 #include "TString.h" 42 #include "TFormula.h"43 #include "TRandom3.h"44 #include "TObjArray.h"45 #include "TDatabasePDG.h"46 #include "TLorentzVector.h"47 46 #include "TVector3.h" 48 47 49 48 #include <algorithm> 50 #include <stdexcept>51 49 #include <iostream> 52 50 #include <sstream> 51 #include <stdexcept> 53 52 54 53 using namespace std; … … 59 58 fItInputArray(0), fConversionMap(0), fDecayXsec(0) 60 59 { 61 fDecayXsec = new TF1("decayXsec", "1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0);60 fDecayXsec = new TF1("decayXsec", "1.0 - 4.0/3.0 * x * (1.0 - x)", 0.0, 1.0); 62 61 fConversionMap = new DelphesCylindricalFormula; 63 62 } … … 74 73 { 75 74 fRadius = GetDouble("Radius", 1.0); 76 fRadius2 = fRadius *fRadius;75 fRadius2 = fRadius * fRadius; 77 76 78 77 fHalfLength = GetDouble("HalfLength", 3.0); … … 122 121 123 122 fItInputArray->Reset(); 124 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))123 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 125 124 { 126 125 … … 133 132 candidatePosition = candidate->Position; 134 133 candidateMomentum = candidate->Momentum; 135 x = candidatePosition.X() *1.0E-3;136 y = candidatePosition.Y() *1.0E-3;137 z = candidatePosition.Z() *1.0E-3;134 x = candidatePosition.X() * 1.0E-3; 135 y = candidatePosition.Y() * 1.0E-3; 136 z = candidatePosition.Z() * 1.0E-3; 138 137 139 138 // check that particle position is inside the cylinder … … 152 151 153 152 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 154 tmp = px *y - py*x;155 discr2 = pt2 *fRadius2 - tmp*tmp;153 tmp = px * y - py * x; 154 discr2 = pt2 * fRadius2 - tmp * tmp; 156 155 157 156 if(discr2 < 0.0) … … 161 160 } 162 161 163 tmp = px *x + py*y;162 tmp = px * x + py * y; 164 163 discr = TMath::Sqrt(discr2); 165 t1 = (-tmp + discr) /pt2;166 t2 = (-tmp - discr) /pt2;164 t1 = (-tmp + discr) / pt2; 165 t2 = (-tmp - discr) / pt2; 167 166 t = (t1 < 0.0) ? t2 : t1; 168 167 169 z_t = z + pz *t;168 z_t = z + pz * t; 170 169 if(TMath::Abs(z_t) > fHalfLength) 171 170 { … … 176 175 177 176 // final position 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 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); 184 182 185 183 // here starts conversion code 186 nsteps = Int_t(r_t /fStep);184 nsteps = Int_t(r_t / fStep); 187 185 188 186 x_i = x; … … 190 188 z_i = z; 191 189 192 dt = t /nsteps;190 dt = t / nsteps; 193 191 194 192 converted = false; … … 196 194 for(i = 0; i < nsteps; ++i) 197 195 { 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);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); 202 200 203 201 // convert photon position into cylindrical coordinates, cylindrical r,phi,z !! 204 202 205 r_i = TMath::Sqrt(x_i *x_i + y_i*y_i);203 r_i = TMath::Sqrt(x_i * x_i + y_i * y_i); 206 204 phi_i = pos_i.Phi(); 207 205 … … 210 208 211 209 // convert into conversion probability 212 p_conv = 1 - TMath::Exp(-7.0 /9.0*fStep*rate);210 p_conv = 1 - TMath::Exp(-7.0 / 9.0 * fStep * rate); 213 211 214 212 // case conversion occurs … … 221 219 x2 = 1 - x1; 222 220 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);221 ep = static_cast<Candidate *>(candidate->Clone()); 222 em = static_cast<Candidate *>(candidate->Clone()); 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); 231 229 232 230 ep->PID = -11; … … 251 249 252 250 //------------------------------------------------------------------------------ 253 -
modules/PhotonConversions.h
re39abb4 r0e7d64a 38 38 { 39 39 public: 40 41 40 PhotonConversions(); 42 41 ~PhotonConversions(); … … 47 46 48 47 private: 49 50 48 Double_t fRadius, fRadius2, fHalfLength; 51 49 Double_t fEtaMin, fEtaMax; -
modules/PhotonID.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class PhotonID 21 20 * … … 34 33 #include "classes/DelphesFormula.h" 35 34 35 #include "ExRootAnalysis/ExRootClassifier.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 36 37 #include "ExRootAnalysis/ExRootResult.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 38 #include "ExRootAnalysis/ExRootClassifier.h" 39 38 39 #include "TDatabasePDG.h" 40 #include "TFormula.h" 41 #include "TLorentzVector.h" 40 42 #include "TMath.h" 43 #include "TObjArray.h" 44 #include "TRandom3.h" 41 45 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 45 #include "TDatabasePDG.h" 46 #include "TLorentzVector.h" 47 48 #include <algorithm> 49 #include <stdexcept> 46 47 #include <algorithm> 50 48 #include <iostream> 51 49 #include <sstream> 50 #include <stdexcept> 52 51 53 52 using namespace std; … … 56 55 57 56 PhotonID::PhotonID() : 58 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), 59 { 60 fPromptFormula= new DelphesFormula;61 fNonPromptFormula= new DelphesFormula;62 fFakeFormula= new DelphesFormula;57 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0) 58 { 59 fPromptFormula = new DelphesFormula; 60 fNonPromptFormula = new DelphesFormula; 61 fFakeFormula = new DelphesFormula; 63 62 } 64 63 … … 81 80 fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0")); 82 81 fFakeFormula->Compile(GetString("FakeFormula", "1.0")); 83 82 84 83 // import input arrays 85 84 fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons")); … … 111 110 112 111 void PhotonID::Process() 113 { 112 { 114 113 Candidate *candidate, *mother; 115 114 Double_t pt, eta, phi, e; 116 115 Double_t relIso; 117 116 Bool_t isolated; 118 117 119 118 //cout<< "---- new event ---------"<<endl; 120 119 121 120 fItInputPhotonArray->Reset(); 122 while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next())))121 while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next()))) 123 122 { 124 123 125 124 mother = candidate; 126 candidate = static_cast<Candidate *>(candidate->Clone());125 candidate = static_cast<Candidate *>(candidate->Clone()); 127 126 candidate->AddCandidate(mother); 128 127 … … 134 133 e = candidateMomentum.E(); 135 134 136 if 135 if(pt < fPTMin) continue; 137 136 138 137 //cout<< " ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl; 139 138 140 139 // find out if photon matches does not match photon in gen collection and apply fae efficiency 141 if (isFake(candidate) )140 if(isFake(candidate)) 142 141 { 143 142 //cout<<" Fake!"<<endl; … … 157 156 158 157 // if isolated apply prompt formula 159 if 158 if(isolated) 160 159 { 161 160 //cout<<" isolated!: "<<relIso<<endl; … … 164 163 candidate->Status = 1; 165 164 fOutputArray->Add(candidate); 166 167 165 } 168 166 169 167 // if non-isolated apply non-prompt formula 170 168 else … … 182 180 //------------------------------------------------------------------------------ 183 181 184 Bool_t PhotonID::isFake(const Candidate *obj){ 182 Bool_t PhotonID::isFake(const Candidate *obj) 183 { 185 184 186 185 const TLorentzVector &mom_rec = obj->Momentum; 187 186 188 187 Bool_t matches = false; 189 188 fItInputGenArray->Reset(); 190 189 Candidate *gen; 191 192 while((gen = static_cast<Candidate *>(fItInputGenArray->Next())))190 191 while((gen = static_cast<Candidate *>(fItInputGenArray->Next()))) 193 192 { 194 193 const TLorentzVector &mom_gen = gen->Momentum; 195 194 Int_t status = gen->Status; 196 195 Int_t pdgCode = TMath::Abs(gen->PID); 197 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) /mom_rec.Pt());196 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) / mom_rec.Pt()); 198 197 Float_t deltaR = mom_gen.DeltaR(mom_rec); 199 198 200 if 201 if 202 if 203 if 199 if(status != 1) continue; 200 if(pdgCode != 22) continue; 201 if(dPtOverPt > 0.5) continue; 202 if(deltaR > 0.1) continue; 204 203 205 204 matches = true; 206 205 break; 207 208 206 } 209 207 -
modules/PhotonID.h
re39abb4 r0e7d64a 40 40 { 41 41 public: 42 43 42 PhotonID(); 44 43 ~PhotonID(); … … 49 48 50 49 private: 51 52 50 DelphesFormula *fPromptFormula; 53 51 DelphesFormula *fNonPromptFormula; 54 52 DelphesFormula *fFakeFormula; 55 53 56 54 // import input arrays 57 55 const TObjArray *fInputPhotonArray; -
modules/PileUpJetID.cc
re39abb4 r0e7d64a 14 14 #include "classes/DelphesFormula.h" 15 15 16 #include "ExRootAnalysis/ExRootClassifier.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 16 18 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 18 #include "ExRootAnalysis/ExRootClassifier.h" 19 19 20 #include "TFormula.h" 20 21 #include "TMath.h" 22 #include "TObjArray.h" 23 #include "TRandom3.h" 21 24 #include "TString.h" 22 #include "TFormula.h"23 #include "TRandom3.h"24 #include "TObjArray.h"25 25 //#include "TDatabasePDG.h" 26 26 #include "TLorentzVector.h" 27 27 28 28 #include <algorithm> 29 #include <stdexcept>30 29 #include <iostream> 31 30 #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 { 40 38 fItJetInputArray(0), fTrackInputArray(0), fNeutralInputArray(0) 39 { 41 40 } 42 41 … … 45 44 PileUpJetID::~PileUpJetID() 46 45 { 47 48 46 } 49 47 … … 57 55 fUseConstituents = GetInt("UseConstituents", 0); 58 56 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);57 fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel", 0.1); 58 fBetaMinBarrel = GetDouble("BetaMinBarrel", 0.1); 59 fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap", 0.1); 60 fBetaMinEndcap = GetDouble("BetaMinEndcap", 0.1); 61 fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward", 0.1); 64 62 fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0); 65 63 fNeutralPTMin = GetDouble("NeutralPTMin", 2.0); … … 82 80 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 83 81 84 fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers")); 85 82 fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets", "eflowtowers")); 86 83 } 87 84 … … 95 92 if(fItTrackInputArray) delete fItTrackInputArray; 96 93 if(fItNeutralInputArray) delete fItNeutralInputArray; 97 98 94 } 99 95 … … 109 105 // loop over all input candidates 110 106 fItJetInputArray->Reset(); 111 while((candidate = static_cast<Candidate *>(fItJetInputArray->Next())))107 while((candidate = static_cast<Candidate *>(fItJetInputArray->Next()))) 112 108 { 113 109 momentum = candidate->Momentum; … … 133 129 float pt_ann[5]; 134 130 135 for (int i = 0 ; i < 5 ; i++) { 131 for(int i = 0; i < 5; i++) 132 { 136 133 pt_ann[i] = 0.; 137 134 } 138 135 139 if (fUseConstituents) { 136 if(fUseConstituents) 137 { 140 138 TIter itConstituents(candidate->GetCandidates()); 141 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) { 139 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 140 { 142 141 float pt = constituent->Momentum.Pt(); 143 142 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 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; 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; 170 179 tow_sumW += w; 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 { 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 { 194 208 // Not using constituents, using dr 195 209 fItTrackInputArray->Reset(); 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 } 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 } 216 237 } 217 238 fItNeutralInputArray->Reset(); 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 { 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 { 239 267 candidate->Beta = -999.; 240 268 candidate->BetaStar = -999.; 241 269 } 242 if (sumptsq > 0.) { 243 candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq; 244 } else { 270 if(sumptsq > 0.) 271 { 272 candidate->MeanSqDeltaR = sumdrsqptsq / sumptsq; 273 } 274 else 275 { 245 276 candidate->MeanSqDeltaR = -999.; 246 277 } 247 278 candidate->NCharged = nc; 248 279 candidate->NNeutrals = nn; 249 if (sumpt > 0.) { 280 if(sumpt > 0.) 281 { 250 282 candidate->PTD = TMath::Sqrt(sumptsq) / sumpt; 251 for (int i = 0 ; i < 5 ; i++) { 252 candidate->FracPt[i] = pt_ann[i]/sumpt; 253 } 254 } else { 283 for(int i = 0; i < 5; i++) 284 { 285 candidate->FracPt[i] = pt_ann[i] / sumpt; 286 } 287 } 288 else 289 { 255 290 candidate->PTD = -999.; 256 for (int i = 0 ; i < 5 ; i++) { 291 for(int i = 0; i < 5; i++) 292 { 257 293 candidate->FracPt[i] = -999.; 258 294 } … … 271 307 272 308 bool passId = false; 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() 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() 284 326 // << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl; 285 327 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 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 } 307 355 } 308 356 } -
modules/PileUpJetID.h
re39abb4 r0e7d64a 10 10 */ 11 11 12 13 12 #include "classes/DelphesModule.h" 14 13 … … 21 20 { 22 21 public: 23 24 22 PileUpJetID(); 25 23 ~PileUpJetID(); … … 30 28 31 29 private: 32 33 30 Double_t fJetPTMin; 34 31 Double_t fParameterR; … … 88 85 // If set to false, uses everything within dR < fParameterR even if in other jets &c. 89 86 // Results should be very similar for PF 90 Int_t fUseConstituents; 87 Int_t fUseConstituents; 91 88 92 89 Bool_t fAverageEachTower; … … 97 94 98 95 const TObjArray *fTrackInputArray; // SCZ 99 const TObjArray *fNeutralInputArray; 96 const TObjArray *fNeutralInputArray; 100 97 101 98 TIterator *fItTrackInputArray; // SCZ … … 105 102 TObjArray *fNeutralsInPassingJets; // SCZ 106 103 107 108 104 ClassDef(PileUpJetID, 2) 109 105 }; -
modules/PileUpMerger.cc
re39abb4 r0e7d64a 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/DelphesPileUpReader.h" 31 32 #include "classes/DelphesTF2.h" 32 #include "classes/DelphesPileUpReader.h" 33 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 38 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 39 44 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept>48 47 #include <iostream> 49 48 #include <sstream> 49 #include <stdexcept> 50 50 51 51 using namespace std; … … 59 59 } 60 60 61 62 61 //------------------------------------------------------------------------------ 63 62 … … 75 74 fPileUpDistribution = GetInt("PileUpDistribution", 0); 76 75 77 fMeanPileUp 76 fMeanPileUp = GetDouble("MeanPileUp", 10); 78 77 79 78 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); … … 135 134 dt0 = -1.0e6; 136 135 137 dt *= c_light *1.0E3; // necessary in order to make t in mm/c136 dt *= c_light * 1.0E3; // necessary in order to make t in mm/c 138 137 dz *= 1.0E3; // necessary in order to make z in mm 139 138 … … 150 149 vertex = factory->NewCandidate(); 151 150 152 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))151 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 153 152 { 154 153 vx += candidate->Position.X(); … … 159 158 160 159 // take postion and time from first stable particle 161 if 160 if(dz0 < -999999.0) 162 161 dz0 = z; 163 if 162 if(dt0 < -999999.0) 164 163 dt0 = t; 165 164 … … 172 171 fParticleOutputArray->Add(candidate); 173 172 174 if(TMath::Abs(candidate->Charge) > 173 if(TMath::Abs(candidate->Charge) > 1.0E-9) 175 174 { 176 175 nch++; 177 sumpt2 += pt *pt;176 sumpt2 += pt * pt; 178 177 vertex->AddCandidate(candidate); 179 178 } … … 198 197 switch(fPileUpDistribution) 199 198 { 200 201 202 203 204 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);205 206 207 208 209 210 211 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; 212 211 } 213 212 214 213 allEntries = fReader->GetEntries(); 215 216 214 217 215 for(event = 0; event < numberOfEvents; ++event) … … 219 217 do 220 218 { 221 entry = TMath::Nint(gRandom->Rndm()*allEntries); 222 } 223 while(entry >= allEntries); 219 entry = TMath::Nint(gRandom->Rndm() * allEntries); 220 } while(entry >= allEntries); 224 221 225 222 fReader->ReadEntry(entry); 226 223 227 // --- Pile-up vertex smearing224 // --- Pile-up vertex smearing 228 225 229 226 fFunction->GetRandom2(dz, dt); 230 227 231 dt *= c_light *1.0E3; // necessary in order to make t in mm/c228 dt *= c_light * 1.0E3; // necessary in order to make t in mm/c 232 229 dz *= 1.0E3; // necessary in order to make z in mm 233 230 … … 252 249 253 250 pdgParticle = pdg->GetParticle(pid); 254 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;251 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 255 252 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 256 253 … … 271 268 272 269 ++numberOfParticles; 273 if(TMath::Abs(candidate->Charge) > 270 if(TMath::Abs(candidate->Charge) > 1.0E-9) 274 271 { 275 272 nch++; 276 sumpt2 += pt *pt;273 sumpt2 += pt * pt; 277 274 vertex->AddCandidate(candidate); 278 275 } … … 299 296 300 297 fVertexOutputArray->Add(vertex); 301 302 298 } 303 299 } -
modules/PileUpMerger.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 PileUpMerger(); 41 40 ~PileUpMerger(); … … 46 45 47 46 private: 48 49 47 Int_t fPileUpDistribution; 50 48 Double_t fMeanPileUp; -
modules/PileUpMergerPythia8.cc
re39abb4 r0e7d64a 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/DelphesPileUpReader.h" 31 32 #include "classes/DelphesTF2.h" 32 #include "classes/DelphesPileUpReader.h" 33 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 37 38 38 #include "Pythia.h" 39 39 40 #include "TDatabasePDG.h" 41 #include "TFormula.h" 42 #include "TLorentzVector.h" 40 43 #include "TMath.h" 44 #include "TObjArray.h" 45 #include "TRandom3.h" 41 46 #include "TString.h" 42 #include "TFormula.h"43 #include "TRandom3.h"44 #include "TObjArray.h"45 #include "TDatabasePDG.h"46 #include "TLorentzVector.h"47 47 48 48 #include <algorithm> 49 #include <stdexcept>50 49 #include <iostream> 51 50 #include <sstream> 51 #include <stdexcept> 52 52 53 53 using namespace std; … … 76 76 fPileUpDistribution = GetInt("PileUpDistribution", 0); 77 77 78 fMeanPileUp 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 *>(fItInputArray->Next())))140 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 141 141 { 142 142 vx += candidate->Position.X(); … … 165 165 switch(fPileUpDistribution) 166 166 { 167 168 169 170 171 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);172 173 174 175 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 // --- Pile-up vertex smearing 180 while(!fPythia->next()) 181 ; 182 183 // --- Pile-up vertex smearing 183 184 184 185 fFunction->GetRandom2(dz, dt); 185 186 186 dt *= c_light *1.0E3; // necessary in order to make t in mm/c187 dt *= c_light * 1.0E3; // necessary in order to make t in mm/c 187 188 dz *= 1.0E3; // necessary in order to make z in mm 188 189 … … 201 202 202 203 pid = particle.id(); 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(); 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(); 205 212 206 213 candidate = factory->NewCandidate(); … … 211 218 212 219 pdgParticle = pdg->GetParticle(pid); 213 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;220 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 214 221 candidate->Mass = pdgParticle ? pdgParticle->Mass() : -999.9; 215 222 -
modules/PileUpMergerPythia8.h
re39abb4 r0e7d64a 35 35 namespace Pythia8 36 36 { 37 37 class Pythia; 38 38 }; 39 39 … … 41 41 { 42 42 public: 43 44 43 PileUpMergerPythia8(); 45 44 ~PileUpMergerPythia8(); … … 50 49 51 50 private: 52 53 51 Int_t fPileUpDistribution; 54 52 Double_t fMeanPileUp; -
modules/RecoPuFilter.cc
re39abb4 r0e7d64a 32 32 #include "classes/DelphesFormula.h" 33 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 38 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 39 44 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept>48 47 #include <iostream> 49 48 #include <sstream> 49 #include <stdexcept> 50 50 51 51 using namespace std; … … 97 97 98 98 fItInputArray->Reset(); 99 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))99 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 100 100 { 101 101 if(candidate->IsRecoPU) continue; … … 103 103 } 104 104 } 105 -
modules/RecoPuFilter.h
re39abb4 r0e7d64a 40 40 { 41 41 public: 42 43 42 RecoPuFilter(); 44 43 ~RecoPuFilter(); … … 49 48 50 49 private: 51 52 50 TIterator *fItInputArray; //! 53 51 -
modules/RunPUPPI.cc
re39abb4 r0e7d64a 1 1 #include "modules/RunPUPPI.h" 2 2 3 #include "PUPPI/RecoObj2.hh"4 3 #include "PUPPI/AlgoObj.hh" 5 4 #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> 14 #include <stdexcept> 13 #include <algorithm> 15 14 #include <iostream> 16 15 #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 RunPUPPI::~RunPUPPI(){} 30 31 //------------------------------------------------------------------------------ 32 33 void RunPUPPI::Init(){ 26 { 27 } 28 29 //------------------------------------------------------------------------------ 30 RunPUPPI::~RunPUPPI() {} 31 32 //------------------------------------------------------------------------------ 33 34 void RunPUPPI::Init() 35 { 34 36 // input collection 35 fTrackInputArray 36 fItTrackInputArray 37 fNeutralInputArray 37 fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/towers")); 38 fItTrackInputArray = fTrackInputArray->MakeIterator(); 39 fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/towers")); 38 40 fItNeutralInputArray = fNeutralInputArray->MakeIterator(); 39 fPVInputArray 40 fPVItInputArray 41 // puppi parameters 42 fApplyNoLep = GetBool("UseNoLep", true);41 fPVInputArray = ImportArray(GetString("PVInputArray", "PV")); 42 fPVItInputArray = fPVInputArray->MakeIterator(); 43 // puppi parameters 44 fApplyNoLep = GetBool("UseNoLep", true); 43 45 fMinPuppiWeight = GetDouble("MinPuppiWeight", 0.01); 44 fUseExp 46 fUseExp = GetBool("UseExp", false); 45 47 // read eta min ranges 46 48 ExRootConfParam param = GetParam("EtaMinBin"); … … 55 57 fPtMinBin.clear(); 56 58 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fPtMinBin.push_back(param[iMap].GetDouble()); 57 // read cone size 59 // read cone size 58 60 param = GetParam("ConeSizeBin"); 59 61 fConeSizeBin.clear(); 60 62 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fConeSizeBin.push_back(param[iMap].GetDouble()); 61 // read RMS min pt 63 // read RMS min pt 62 64 param = GetParam("RMSPtMinBin"); 63 65 fRMSPtMinBin.clear(); … … 75 77 fNeutralPtSlope.clear(); 76 78 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralPtSlope.push_back(param[iMap].GetDouble()); 77 // read apply chs 79 // read apply chs 78 80 //param = GetParam("ApplyCHS"); 79 81 //fApplyCHS.clear(); … … 87 89 fApplyLowPUCorr.clear(); 88 90 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyLowPUCorr.push_back(param[iMap].GetBool()); 89 // read metric id 91 // read metric id 90 92 param = GetParam("MetricId"); 91 93 fMetricId.clear(); … … 96 98 for(int iMap = 0; iMap < param.GetSize(); ++iMap) fCombId.push_back(param[iMap].GetInt()); 97 99 // create output array 98 fOutputArray 99 fOutputTrackArray 100 fOutputArray = ExportArray(GetString("OutputArray", "puppiParticles")); 101 fOutputTrackArray = ExportArray(GetString("OutputArrayTracks", "puppiTracks")); 100 102 fOutputNeutralArray = ExportArray(GetString("OutputArrayNeutrals", "puppiNeutrals")); 101 103 // Create algorithm list for puppi 102 104 std::vector<AlgoObj> puppiAlgo; 103 if(puppiAlgo.empty()){ 105 if(puppiAlgo.empty()) 106 { 104 107 if(!(fEtaMinBin.size() == fEtaMaxBin.size() and fEtaMinBin.size() == fPtMinBin.size() and fEtaMinBin.size() == fConeSizeBin.size() and fEtaMinBin.size() == fRMSPtMinBin.size() 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; 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; 109 113 std::exit(EXIT_FAILURE); 110 114 } 111 115 } 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); 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); 118 123 algoTmp.minNeutralPtSlope = fNeutralPtSlope.at(iAlgo); 119 124 //Eta Extrapolation stuff is missing 120 125 //Loop through file requiring algos for same bins to be adjacent 121 while(iAlgo < fEtaMinBin.size() and algoTmp.etaMin == fEtaMinBin.at(iAlgo) and algoTmp.etaMax == fEtaMaxBin.at(iAlgo)) { 126 while(iAlgo < fEtaMinBin.size() and algoTmp.etaMin == fEtaMinBin.at(iAlgo) and algoTmp.etaMax == fEtaMaxBin.at(iAlgo)) 127 { 122 128 AlgoSubObj algoSubTmp; 123 algoSubTmp.metricId 124 algoSubTmp.useCharged 125 algoSubTmp.applyLowPUCorr 126 algoSubTmp.combId 127 algoSubTmp.coneSize 128 algoSubTmp.rmsPtMin 129 algoSubTmp.rmsScaleFactor 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); 130 136 algoTmp.subAlgos.push_back(algoSubTmp); 131 137 iAlgo++; 132 138 } 133 139 iAlgo--; 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); 138 } 139 140 //------------------------------------------------------------------------------ 141 142 void RunPUPPI::Finish(){ 143 if(fItTrackInputArray) delete fItTrackInputArray; 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); 144 } 145 146 //------------------------------------------------------------------------------ 147 148 void RunPUPPI::Finish() 149 { 150 if(fItTrackInputArray) delete fItTrackInputArray; 144 151 if(fItNeutralInputArray) delete fItNeutralInputArray; 145 152 if(fPuppi) delete fPuppi; … … 148 155 //------------------------------------------------------------------------------ 149 156 150 void RunPUPPI::Process(){ 157 void RunPUPPI::Process() 158 { 151 159 152 160 Candidate *candidate, *particle; … … 156 164 157 165 // loop over input objects 158 fItTrackInputArray 159 fItNeutralInputArray 160 fPVItInputArray 166 fItTrackInputArray->Reset(); 167 fItNeutralInputArray->Reset(); 168 fPVItInputArray->Reset(); 161 169 162 170 std::vector<Candidate *> InputParticles; 163 171 InputParticles.clear(); 164 172 165 // take the leading vertex 173 // take the leading vertex 166 174 float PVZ = 0.; 167 Candidate *pv = static_cast<Candidate *>(fPVItInputArray->Next());168 if 175 Candidate *pv = static_cast<Candidate *>(fPVItInputArray->Next()); 176 if(pv) PVZ = pv->Position.Z(); 169 177 // Fill input particles for puppi 170 178 std::vector<RecoObj> puppiInputVector; 171 179 puppiInputVector.clear(); 172 int lNBad = 0;180 int lNBad = 0; 173 181 // Loop on charge track 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); 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); 236 263 } 237 264 // Create PUPPI container … … 241 268 242 269 // Loop on final particles 243 for (std::vector<PseudoJet>::iterator it = puppiParticles.begin() ; it != puppiParticles.end() ; it++) { 244 if(it->user_index() <= int(InputParticles.size())){ 270 for(std::vector<PseudoJet>::iterator it = puppiParticles.begin(); it != puppiParticles.end(); it++) 271 { 272 if(it->user_index() <= int(InputParticles.size())) 273 { 245 274 candidate = static_cast<Candidate *>(InputParticles.at(it->user_index())->Clone()); 246 candidate->Momentum.SetPxPyPzE(it->px(), it->py(),it->pz(),it->e());275 candidate->Momentum.SetPxPyPzE(it->px(), it->py(), it->pz(), it->e()); 247 276 fOutputArray->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); 250 } 251 else{ 252 std::cerr<<" particle not found in the input Array --> skip "<<std::endl; 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); 281 } 282 else 283 { 284 std::cerr << " particle not found in the input Array --> skip " << std::endl; 253 285 continue; 254 } 255 } 256 257 } 286 } 287 } 288 } -
modules/RunPUPPI.h
re39abb4 r0e7d64a 9 9 class PuppiContainer; 10 10 11 class RunPUPPI: public DelphesModule { 11 class RunPUPPI: public DelphesModule 12 { 12 13 13 public: 14 14 public: 15 15 RunPUPPI(); 16 16 ~RunPUPPI(); … … 19 19 void Process(); 20 20 void Finish(); 21 22 private:23 21 22 private: 24 23 TIterator *fItTrackInputArray; 25 24 TIterator *fItNeutralInputArray; //! 26 TIterator *fPVItInputArray; //! 27 25 TIterator *fPVItInputArray; //! 26 28 27 const TObjArray *fTrackInputArray; 29 28 const TObjArray *fNeutralInputArray; //! 30 const TObjArray *fPVInputArray; //! 31 PuppiContainer *fPuppi;29 const TObjArray *fPVInputArray; //! 30 PuppiContainer *fPuppi; 32 31 // puppi parameters 33 32 bool fApplyNoLep; 34 33 double fMinPuppiWeight; 35 34 bool fUseExp; 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 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; 43 42 std::vector<float> fNeutralMinEBin; 44 43 std::vector<float> fNeutralPtSlope; 45 std::vector<bool> 46 std::vector<bool> 47 std::vector<bool> 48 std::vector<int> 49 std::vector<int> 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; 50 49 51 50 TObjArray *fOutputArray; -
modules/SimpleCalorimeter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class SimpleCalorimeter 21 20 * … … 33 32 #include "classes/DelphesFormula.h" 34 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 35 36 #include "ExRootAnalysis/ExRootResult.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 39 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 40 44 #include "TString.h" 41 #include "TFormula.h"42 #include "TRandom3.h"43 #include "TObjArray.h"44 #include "TDatabasePDG.h"45 #include "TLorentzVector.h"46 45 47 46 #include <algorithm> 48 #include <stdexcept>49 47 #include <iostream> 50 48 #include <sstream> 49 #include <stdexcept> 51 50 52 51 using namespace std; … … 58 57 fItParticleInputArray(0), fItTrackInputArray(0) 59 58 { 60 59 61 60 fResolutionFormula = new DelphesFormula; 62 61 fTowerTrackArray = new TObjArray; 63 62 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 64 65 63 } 66 64 … … 69 67 SimpleCalorimeter::~SimpleCalorimeter() 70 68 { 71 69 72 70 if(fResolutionFormula) delete fResolutionFormula; 73 71 if(fTowerTrackArray) delete fTowerTrackArray; 74 72 if(fItTowerTrackArray) delete fItTowerTrackArray; 75 76 73 } 77 74 … … 84 81 Double_t fraction; 85 82 TBinMap::iterator itEtaBin; 86 set< Double_t>::iterator itPhiBin;87 vector< Double_t> *phiBins;83 set<Double_t>::iterator itPhiBin; 84 vector<Double_t> *phiBins; 88 85 89 86 // read eta and phi bins … … 93 90 fEtaBins.clear(); 94 91 fPhiBins.clear(); 95 for(i = 0; i < size /2; ++i)96 { 97 paramEtaBins = param[i *2];92 for(i = 0; i < size / 2; ++i) 93 { 94 paramEtaBins = param[i * 2]; 98 95 sizeEtaBins = paramEtaBins.GetSize(); 99 paramPhiBins = param[i *2 + 1];96 paramPhiBins = param[i * 2 + 1]; 100 97 sizePhiBins = paramPhiBins.GetSize(); 101 98 … … 114 111 { 115 112 fEtaBins.push_back(itEtaBin->first); 116 phiBins = new vector< double>(itEtaBin->second.size());113 phiBins = new vector<double>(itEtaBin->second.size()); 117 114 fPhiBins.push_back(phiBins); 118 115 phiBins->clear(); … … 131 128 fFractionMap[0] = 1.0; 132 129 133 for(i = 0; i < size /2; ++i)134 { 135 paramFractions = param[i *2 + 1];130 for(i = 0; i < size / 2; ++i) 131 { 132 paramFractions = param[i * 2 + 1]; 136 133 fraction = paramFractions[0].GetDouble(); 137 fFractionMap[param[i *2].GetInt()] = fraction;134 fFractionMap[param[i * 2].GetInt()] = fraction; 138 135 } 139 136 … … 170 167 void SimpleCalorimeter::Finish() 171 168 { 172 vector< vector< Double_t >*>::iterator itPhiBin;169 vector<vector<Double_t> *>::iterator itPhiBin; 173 170 if(fItParticleInputArray) delete fItParticleInputArray; 174 171 if(fItTrackInputArray) delete fItTrackInputArray; … … 197 194 TFractionMap::iterator itFractionMap; 198 195 199 vector< Double_t>::iterator itEtaBin;200 vector< Double_t>::iterator itPhiBin;201 vector< Double_t> *phiBins;202 203 vector< Long64_t>::iterator itTowerHits;196 vector<Double_t>::iterator itEtaBin; 197 vector<Double_t>::iterator itPhiBin; 198 vector<Double_t> *phiBins; 199 200 vector<Long64_t>::iterator itTowerHits; 204 201 205 202 DelphesFactory *factory = GetFactory(); … … 211 208 fItParticleInputArray->Reset(); 212 209 number = -1; 213 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next())))210 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next()))) 214 211 { 215 212 const TLorentzVector &particlePosition = particle->Position; … … 254 251 fItTrackInputArray->Reset(); 255 252 number = -1; 256 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))253 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 257 254 { 258 255 const TLorentzVector &trackPosition = track->Position; … … 303 300 towerHit = (*itTowerHits); 304 301 flags = (towerHit >> 24) & 0x00000000000000FFLL; 305 number = (towerHit) &0x0000000000FFFFFFLL;302 number = (towerHit)&0x0000000000FFFFFFLL; 306 303 hitEtaPhi = towerHit >> 32; 307 304 … … 324 321 325 322 // calculate eta and phi of the tower's center 326 fTowerEta = 0.5 *(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);327 fTowerPhi = 0.5 *((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);323 fTowerEta = 0.5 * (fEtaBins[etaBin - 1] + fEtaBins[etaBin]); 324 fTowerPhi = 0.5 * ((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]); 328 325 329 326 fTowerEdges[0] = fEtaBins[etaBin - 1]; … … 346 343 347 344 fTowerTrackArray->Clear(); 348 345 } 349 346 350 347 // check for track hits … … 353 350 ++fTowerTrackHits; 354 351 355 track = static_cast<Candidate *>(fTrackInputArray->At(number));352 track = static_cast<Candidate *>(fTrackInputArray->At(number)); 356 353 momentum = track->Momentum; 357 354 position = track->Position; … … 359 356 energy = momentum.E() * fTrackFractions[number]; 360 357 361 fTrackTime += TMath::Sqrt(energy) *position.T();358 fTrackTime += TMath::Sqrt(energy) * position.T(); 362 359 fTrackTimeWeight += TMath::Sqrt(energy); 363 360 364 361 if(fTrackFractions[number] > 1.0E-9) 365 362 { 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); 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); 375 374 } 376 375 377 376 else 378 377 { … … 386 385 if(flags & 2) ++fTowerPhotonHits; 387 386 388 particle = static_cast<Candidate *>(fParticleInputArray->At(number));387 particle = static_cast<Candidate *>(fParticleInputArray->At(number)); 389 388 momentum = particle->Momentum; 390 389 position = particle->Position; … … 395 394 fTowerEnergy += energy; 396 395 397 fTowerTime += energy *position.T();396 fTowerTime += energy * position.T(); 398 397 fTowerTimeWeight += energy; 399 398 … … 410 409 { 411 410 Candidate *tower, *track, *mother; 412 Double_t energy, neutralEnergy, pt, eta, phi;411 Double_t energy, neutralEnergy, pt, eta, phi; 413 412 Double_t sigma, neutralSigma; 414 413 Double_t time; 415 414 416 415 Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor; 417 416 … … 425 424 energy = LogNormal(fTowerEnergy, sigma); 426 425 427 time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime/fTowerTimeWeight;426 time = (fTowerTimeWeight < 1.0E-09) ? 0.0 : fTowerTime / fTowerTimeWeight; 428 427 429 428 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 430 429 431 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 432 430 if(energy < fEnergyMin || energy < fEnergySignificanceMin * sigma) energy = 0.0; 433 431 434 432 if(fSmearTowerCenter) … … 459 457 if(energy > 0.0) fTowerOutputArray->Add(fTower); 460 458 461 462 459 // e-flow candidates 463 460 464 461 //compute neutral excess 465 462 466 463 fTrackSigma = TMath::Sqrt(fTrackSigma); 467 neutralEnergy = max( (energy - fTrackEnergy), 0.0);468 464 neutralEnergy = max((energy - fTrackEnergy), 0.0); 465 469 466 //compute sigma_trk total 470 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma *fTrackSigma+ sigma*sigma);471 467 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma * fTrackSigma + sigma * sigma); 468 472 469 // if neutral excess is significant, simply create neutral Eflow tower and clone each track into eflowtrack 473 470 if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin) 474 471 { 475 472 // create new photon tower 476 tower = static_cast<Candidate *>(fTower->Clone());473 tower = static_cast<Candidate *>(fTower->Clone()); 477 474 pt = neutralEnergy / TMath::CosH(eta); 478 475 … … 480 477 tower->Ehad = (fIsEcal) ? 0 : neutralEnergy; 481 478 tower->PID = (fIsEcal) ? 22 : 0; 482 479 483 480 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy); 484 481 fEFlowTowerOutputArray->Add(tower); 485 482 486 483 fItTowerTrackArray->Reset(); 487 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))484 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next()))) 488 485 { 489 486 mother = track; 490 track = static_cast<Candidate *>(track->Clone());487 track = static_cast<Candidate *>(track->Clone()); 491 488 track->AddCandidate(mother); 492 489 … … 494 491 } 495 492 } 496 493 497 494 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 498 else if 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 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 506 503 fItTowerTrackArray->Reset(); 507 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next())))504 while((track = static_cast<Candidate *>(fItTowerTrackArray->Next()))) 508 505 { 509 506 mother = track; 510 track = static_cast<Candidate *>(track->Clone());507 track = static_cast<Candidate *>(track->Clone()); 511 508 track->AddCandidate(mother); 512 509 … … 516 513 } 517 514 } 518 519 } 515 } 520 516 521 517 //------------------------------------------------------------------------------ … … 527 523 if(mean > 0.0) 528 524 { 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));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)); 533 529 } 534 530 else -
modules/SimpleCalorimeter.h
re39abb4 r0e7d64a 43 43 { 44 44 public: 45 46 45 SimpleCalorimeter(); 47 46 ~SimpleCalorimeter(); … … 52 51 53 52 private: 54 55 typedef std::map< Long64_t, Double_t > TFractionMap; //! 56 typedef std::map< Double_t, std::set< Double_t > > TBinMap; //! 53 typedef std::map<Long64_t, Double_t> TFractionMap; //! 54 typedef std::map<Double_t, std::set<Double_t> > TBinMap; //! 57 55 58 56 Candidate *fTower; … … 82 80 TBinMap fBinMap; //! 83 81 84 std::vector < Double_t> fEtaBins;85 std::vector < std::vector < Double_t >*> fPhiBins;82 std::vector<Double_t> fEtaBins; 83 std::vector<std::vector<Double_t> *> fPhiBins; 86 84 87 std::vector < Long64_t> fTowerHits;85 std::vector<Long64_t> fTowerHits; 88 86 89 std::vector < Double_t> fTowerFractions;87 std::vector<Double_t> fTowerFractions; 90 88 91 std::vector < Double_t> fTrackFractions;89 std::vector<Double_t> fTrackFractions; 92 90 93 91 DelphesFormula *fResolutionFormula; //! -
modules/StatusPidFilter.cc
re39abb4 r0e7d64a 32 32 #include "classes/DelphesFormula.h" 33 33 34 #include "ExRootAnalysis/ExRootClassifier.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 34 36 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h" 36 #include "ExRootAnalysis/ExRootClassifier.h" 37 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 38 41 #include "TMath.h" 42 #include "TObjArray.h" 43 #include "TRandom3.h" 39 44 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 45 46 46 #include <algorithm> 47 #include <stdexcept>48 47 #include <iostream> 49 48 #include <sstream> 49 #include <stdexcept> 50 50 51 51 using namespace std; 52 52 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 120 return false; 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 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) 106 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 136 145 137 146 //------------------------------------------------------------------------------ … … 153 162 { 154 163 // PT threshold 155 156 164 fPTMin = GetDouble("PTMin", 0.5); 165 166 // keep or remove pileup particles 167 fRequireNotPileup = GetBool("RequireNotPileup", false); 157 168 158 169 // import input array … … 181 192 182 193 fItInputArray->Reset(); 183 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))194 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 184 195 { 185 196 status = candidate->Status; … … 193 204 // hard scattering particles (first condition for Py6, second for Py8) 194 205 if(status == 3) pass = kTRUE; 195 if(status > 20 && status < 30 206 if(status > 20 && status < 30) pass = kTRUE; 196 207 197 208 // electrons, muons, taus and neutrinos … … 199 210 200 211 // heavy quarks 201 if(pdgCode == 4 || pdgCode == 5 || pdgCode == 6) pass = kTRUE;212 if(pdgCode == 4 || pdgCode == 5 || pdgCode == 6) pass = kTRUE; 202 213 203 214 // Gauge bosons and other fundamental bosons 204 215 if(pdgCode > 22 && pdgCode < 43) pass = kTRUE; 205 216 206 //Stable photons 207 if(pdgCode == 22 && status ==1) pass = kTRUE;217 //Stable photons 218 if(pdgCode == 22 && status == 1) pass = kTRUE; 208 219 209 220 // logic ported from HepPDF: http://lcgapp.cern.ch/project/simu/HepPDT/HepPDT.2.05.02/html/ParticleID_8cc-source.html#l00081 210 221 bool is_b_hadron = hasBottom(pdgCode); 211 bool is_b_quark 222 bool is_b_quark = (pdgCode == 5); 212 223 213 224 bool is_tau_daughter = isTauDaughter(pdgCode, candidate->M1, fInputArray); 214 225 215 if 226 if(is_b_hadron) 216 227 pass = kTRUE; 217 228 218 if 229 if(is_tau_daughter) 219 230 pass = kTRUE; 220 231 221 232 bool is_W_daughter = isWDaughter(candidate->M1, fInputArray); 222 if (is_W_daughter)233 if(is_W_daughter) 223 234 pass = kTRUE; 224 235 225 236 // fPTMin not applied to b_hadrons / b_quarks to allow for b-enriched sample stitching 226 237 // fPTMin not applied to tau decay products to allow visible-tau four momentum determination 227 if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark || is_tau_daughter || is_W_daughter)) ) continue; 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; 228 242 229 243 fOutputArray->Add(candidate); 230 244 } 231 245 } 232 -
modules/StatusPidFilter.h
re39abb4 r0e7d64a 39 39 { 40 40 public: 41 42 41 StatusPidFilter(); 43 42 ~StatusPidFilter(); … … 48 47 49 48 private: 49 Double_t fPTMin; //! 50 50 51 Double_t fPTMin; //!51 Bool_t fRequireNotPileup; //! 52 52 53 53 TIterator *fItInputArray; //! -
modules/TaggingParticlesSkimmer.cc
re39abb4 r0e7d64a 35 35 #include "classes/DelphesFormula.h" 36 36 37 #include "ExRootAnalysis/ExRootClassifier.h" 38 #include "ExRootAnalysis/ExRootFilter.h" 37 39 #include "ExRootAnalysis/ExRootResult.h" 38 #include "ExRootAnalysis/ExRootFilter.h"39 #include "ExRootAnalysis/ExRootClassifier.h"40 40 41 #include "TDatabasePDG.h" 42 #include "TFormula.h" 43 #include "TLorentzVector.h" 41 44 #include "TMath.h" 45 #include "TObjArray.h" 46 #include "TRandom3.h" 42 47 #include "TString.h" 43 #include "TFormula.h"44 #include "TRandom3.h"45 #include "TObjArray.h"46 #include "TDatabasePDG.h"47 #include "TLorentzVector.h"48 48 49 49 #include <algorithm> 50 #include <stdexcept>51 50 #include <iostream> 52 51 #include <sstream> 52 #include <stdexcept> 53 53 54 54 using namespace std; 55 56 55 57 56 //------------------------------------------------------------------------------ 58 57 59 58 TaggingParticlesSkimmer::TaggingParticlesSkimmer() : 60 fItPartonInputArray(0), fFilter(0), fClassifier(0) 59 fClassifier(0), fFilter(0), fItPartonInputArray(0), 60 fPartonInputArray(0), fParticleInputArray(0), fOutputArray(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 85 84 fClassifier = new TauTaggingPartonClassifier(fParticleInputArray); 86 85 fClassifier->fPTMin = GetDouble("PTMin", 15.0); 87 86 fClassifier->fEtaMax = GetDouble("EtaMax", 2.5); 88 87 89 90 88 fFilter = new ExRootFilter(fPartonInputArray); 91 89 … … 97 95 98 96 void TaggingParticlesSkimmer::Finish() 99 { 97 { 100 98 if(fItPartonInputArray) delete fItPartonInputArray; 101 99 if(fFilter) delete fFilter; … … 127 125 if(tau->D1 < 0) continue; 128 126 129 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 130 tau->D2 >= fParticleInputArray->GetEntriesFast()) 127 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 131 128 { 132 129 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 134 131 135 132 tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 136 133 137 134 for(i = tau->D1; i <= tau->D2; ++i) 138 135 { … … 141 138 tauMomentum += daughter->Momentum; 142 139 } 143 144 candidate = static_cast<Candidate*>(tau->Clone());145 candidate->Momentum = tauMomentum;146 140 147 148 fOutputArray->Add(candidate);141 candidate = static_cast<Candidate *>(tau->Clone()); 142 candidate->Momentum = tauMomentum; 149 143 144 fOutputArray->Add(candidate); 150 145 } 151 146 152 147 // then add all other partons (except tau's to avoid double counting) 153 148 154 149 fItPartonInputArray->Reset(); 155 while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next())))150 while((candidate = static_cast<Candidate *>(fItPartonInputArray->Next()))) 156 151 { 157 152 pdgCode = TMath::Abs(candidate->PID); 158 153 if(pdgCode == 15) continue; 159 154 160 155 pt = candidate->Momentum.Pt(); 161 156 if(pt < fPTMin) continue; 162 157 163 158 eta = TMath::Abs(candidate->Momentum.Eta()); 164 159 if(eta > fEtaMax) continue; 165 160 166 161 fOutputArray->Add(candidate); 167 162 } 168 169 170 163 } 171 -
modules/TaggingParticlesSkimmer.h
re39abb4 r0e7d64a 42 42 { 43 43 public: 44 45 44 TaggingParticlesSkimmer(); 46 45 ~TaggingParticlesSkimmer(); … … 51 50 52 51 private: 53 54 52 Double_t fPTMin; //! 55 53 Double_t fEtaMax; //! 56 54 57 55 TauTaggingPartonClassifier *fClassifier; //! 58 56 59 57 ExRootFilter *fFilter; 60 58 61 59 TIterator *fItPartonInputArray; //! 62 60 63 61 const TObjArray *fPartonInputArray; //! 64 62 const TObjArray *fParticleInputArray; //! -
modules/TauTagging.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class TauTagging 21 20 * … … 34 33 #include "classes/DelphesFormula.h" 35 34 35 #include "TDatabasePDG.h" 36 #include "TFormula.h" 37 #include "TLorentzVector.h" 36 38 #include "TMath.h" 39 #include "TObjArray.h" 40 #include "TRandom3.h" 37 41 #include "TString.h" 38 #include "TFormula.h"39 #include "TRandom3.h"40 #include "TObjArray.h"41 #include "TDatabasePDG.h"42 #include "TLorentzVector.h"43 42 44 43 #include <algorithm> 45 #include <stdexcept>46 44 #include <iostream> 47 45 #include <sstream> 46 #include <stdexcept> 48 47 49 48 using namespace std; 50 51 49 52 50 //------------------------------------------------------------------------------ … … 63 61 Candidate *daughter1 = 0; 64 62 Candidate *daughter2 = 0; 65 63 66 64 const TLorentzVector &momentum = tau->Momentum; 67 65 Int_t pdgCode, i, j; … … 76 74 if(tau->D2 < tau->D1) return -1; 77 75 78 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 79 tau->D2 >= fParticleInputArray->GetEntriesFast()) 76 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 80 77 { 81 78 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 86 83 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 87 84 pdgCode = TMath::Abs(daughter1->PID); 88 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 85 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 86 return -1; 89 87 else if(pdgCode == 24) 90 88 { 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 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 } 99 96 } 100 97 } … … 121 118 void TauTagging::Init() 122 119 { 123 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;120 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 124 121 ExRootConfParam param; 125 122 DelphesFormula *formula; … … 135 132 136 133 fEfficiencyMap.clear(); 137 for(i = 0; i < size /2; ++i)134 for(i = 0; i < size / 2; ++i) 138 135 { 139 136 formula = new DelphesFormula; 140 formula->Compile(param[i *2 + 1].GetString());141 142 fEfficiencyMap[param[i *2].GetInt()] = formula;137 formula->Compile(param[i * 2 + 1].GetString()); 138 139 fEfficiencyMap[param[i * 2].GetInt()] = formula; 143 140 } 144 141 … … 174 171 void TauTagging::Finish() 175 172 { 176 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;173 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 177 174 DelphesFormula *formula; 178 175 … … 197 194 Double_t pt, eta, phi, e, eff; 198 195 TObjArray *tauArray; 199 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;196 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 200 197 DelphesFormula *formula; 201 198 Int_t pdgCode, charge, i; … … 218 215 219 216 // loop over all input taus 220 if(tauArray){ 217 if(tauArray) 218 { 221 219 TIter itTauArray(tauArray); 222 220 while((tau = static_cast<Candidate *>(itTauArray.Next()))) … … 224 222 if(tau->D1 < 0) continue; 225 223 226 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 227 tau->D2 >= fParticleInputArray->GetEntriesFast()) 224 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 228 225 { 229 226 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 257 254 eff = formula->Eval(pt, eta, phi, e); 258 255 jet->TauTag |= (gRandom->Uniform() <= eff) << fBitNumber; 259 jet->TauWeight = eff; 256 jet->TauWeight = eff; 260 257 261 258 // set tau charge -
modules/TauTagging.h
re39abb4 r0e7d64a 30 30 */ 31 31 32 #include "ExRootAnalysis/ExRootClassifier.h" 33 #include "ExRootAnalysis/ExRootFilter.h" 34 #include "ExRootAnalysis/ExRootResult.h" 32 35 #include "classes/DelphesModule.h" 33 #include "ExRootAnalysis/ExRootResult.h"34 #include "ExRootAnalysis/ExRootFilter.h"35 #include "ExRootAnalysis/ExRootClassifier.h"36 36 37 37 #include <map> … … 46 46 { 47 47 public: 48 49 48 TauTagging(); 50 49 ~TauTagging(); … … 55 54 56 55 private: 57 58 56 Int_t fBitNumber; 59 57 60 58 Double_t fDeltaR; 61 59 62 60 #if !defined(__CINT__) && !defined(__CLING__) 63 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!61 std::map<Int_t, DelphesFormula *> fEfficiencyMap; //! 64 62 #endif 65 63 66 64 TauTaggingPartonClassifier *fClassifier; //! 67 65 68 66 ExRootFilter *fFilter; 69 67 70 68 TIterator *fItPartonInputArray; //! 71 69 72 70 TIterator *fItJetInputArray; //! 73 71 … … 75 73 76 74 const TObjArray *fPartonInputArray; //! 77 75 78 76 const TObjArray *fJetInputArray; //! 79 77 … … 81 79 }; 82 80 83 84 81 //------------------------------------------------------------------------------ 85 82 86 class TauTaggingPartonClassifier 83 class TauTaggingPartonClassifier: public ExRootClassifier 87 84 { 88 85 public: 89 90 86 TauTaggingPartonClassifier(const TObjArray *array); 91 87 … … 97 93 }; 98 94 99 100 95 #endif -
modules/TimeSmearing.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class TimeSmearing 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 54 53 55 54 TimeSmearing::TimeSmearing() : 56 fItInputArray(0)55 fItInputArray(0) 57 56 { 58 57 } … … 97 96 98 97 fItInputArray->Reset(); 99 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))98 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 100 99 { 101 100 const TLorentzVector &candidateInitialPosition = candidate->InitialPosition; 102 101 const TLorentzVector &candidateFinalPosition = candidate->Position; 103 102 104 ti = candidateInitialPosition.T() *1.0E-3/c_light;105 tf = candidateFinalPosition.T() *1.0E-3/c_light;103 ti = candidateInitialPosition.T() * 1.0E-3 / c_light; 104 tf = candidateFinalPosition.T() * 1.0E-3 / c_light; 106 105 107 106 // apply smearing formula … … 109 108 ti = ti + tf_smeared - tf; 110 109 tf = tf_smeared; 111 110 112 111 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);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); 116 115 117 candidate->ErrorT = fTimeResolution *1.0E3*c_light;116 candidate->ErrorT = fTimeResolution * 1.0E3 * c_light; 118 117 119 118 candidate->AddCandidate(mother); -
modules/TimeSmearing.h
re39abb4 r0e7d64a 36 36 { 37 37 public: 38 39 38 TimeSmearing(); 40 39 ~TimeSmearing(); … … 45 44 46 45 private: 47 48 46 Double_t fTimeResolution; 49 47 -
modules/TrackCountingBTagging.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class TrackCountingBTagging 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "TFormula.h" 34 #include "TLorentzVector.h" 34 35 #include "TMath.h" 36 #include "TObjArray.h" 37 #include "TRandom3.h" 35 38 #include "TString.h" 36 #include "TFormula.h"37 #include "TRandom3.h"38 #include "TObjArray.h"39 #include "TLorentzVector.h"40 39 41 40 #include <algorithm> 42 #include <stdexcept>43 41 #include <iostream> 44 42 #include <sstream> 43 #include <stdexcept> 45 44 46 45 using namespace std; … … 107 106 // loop over all input jets 108 107 fItJetInputArray->Reset(); 109 while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))108 while((jet = static_cast<Candidate *>(fItJetInputArray->Next()))) 110 109 { 111 110 const TLorentzVector &jetMomentum = jet->Momentum; … … 118 117 count = 0; 119 118 // stop once we have enough tracks 120 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())) and count < fNtracks)119 while((track = static_cast<Candidate *>(fItTrackInputArray->Next())) and count < fNtracks) 121 120 { 122 121 const TLorentzVector &trkMomentum = track->Momentum; 123 122 tpt = trkMomentum.Pt(); 124 123 if(tpt < fPtMin) continue; 125 124 126 125 d0 = TMath::Abs(track->D0); 127 126 if(d0 > fIPmax) continue; … … 137 136 ddz = TMath::Abs(track->ErrorDZ); 138 137 139 if(fUse3D){ 140 sign = (jpx*xd + jpy*yd + jpz*zd > 0.0) ? 1 : -1; 138 if(fUse3D) 139 { 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 sign = (jpx*xd + jpy*yd > 0.0) ? 1 : -1; 144 else 145 { 146 sign = (jpx * xd + jpy * yd > 0.0) ? 1 : -1; 146 147 sip = sign * d0 / TMath::Abs(dd0); 147 148 } -
modules/TrackCountingBTagging.h
re39abb4 r0e7d64a 37 37 { 38 38 public: 39 40 39 TrackCountingBTagging(); 41 40 ~TrackCountingBTagging(); … … 46 45 47 46 private: 48 49 47 Int_t fBitNumber; 50 48 … … 53 51 Double_t fIPmax; 54 52 Double_t fSigMin; 55 Int_t 56 Bool_t 53 Int_t fNtracks; 54 Bool_t fUse3D; 57 55 58 56 TIterator *fItTrackInputArray; //! -
modules/TrackCountingTauTagging.cc
re39abb4 r0e7d64a 20 20 #include "classes/DelphesFormula.h" 21 21 22 #include "ExRootAnalysis/ExRootClassifier.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 22 24 #include "ExRootAnalysis/ExRootResult.h" 23 #include "ExRootAnalysis/ExRootFilter.h" 24 #include "ExRootAnalysis/ExRootClassifier.h" 25 25 26 #include "TDatabasePDG.h" 27 #include "TFormula.h" 28 #include "TLorentzVector.h" 26 29 #include "TMath.h" 30 #include "TObjArray.h" 31 #include "TRandom3.h" 27 32 #include "TString.h" 28 #include "TFormula.h"29 #include "TRandom3.h"30 #include "TObjArray.h"31 #include "TDatabasePDG.h"32 #include "TLorentzVector.h"33 33 34 34 #include <algorithm> 35 #include <stdexcept>36 35 #include <iostream> 37 36 #include <sstream> 37 #include <stdexcept> 38 38 39 39 using namespace std; … … 44 44 { 45 45 public: 46 47 46 TrackCountingTauTaggingPartonClassifier(const TObjArray *array); 48 47 … … 67 66 Candidate *daughter1 = 0; 68 67 Candidate *daughter2 = 0; 69 68 70 69 const TLorentzVector &momentum = tau->Momentum; 71 70 Int_t pdgCode, i, j; … … 80 79 if(tau->D2 < tau->D1) return -1; 81 80 82 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 83 tau->D2 >= fParticleInputArray->GetEntriesFast()) 81 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 84 82 { 85 83 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 90 88 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 91 89 pdgCode = TMath::Abs(daughter1->PID); 92 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 90 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 91 return -1; 93 92 else if(pdgCode == 24) 94 93 { 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 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 } 103 101 } 104 102 } … … 125 123 void TrackCountingTauTagging::Init() 126 124 { 127 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;125 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 128 126 ExRootConfParam param; 129 127 DelphesFormula *formula; … … 135 133 fDeltaRTrack = GetDouble("DeltaRTrack", 0.2); 136 134 fTrackPTMin = GetDouble("TrackPTMin", 1.0); 137 135 138 136 // read efficiency formulas 139 137 param = GetParam("EfficiencyFormula"); … … 141 139 142 140 fEfficiencyMap.clear(); 143 for(i = 0; i < size /2; ++i)141 for(i = 0; i < size / 2; ++i) 144 142 { 145 143 formula = new DelphesFormula; 146 formula->Compile(param[i *2 + 1].GetString());147 148 fEfficiencyMap[param[i *2].GetInt()] = formula;144 formula->Compile(param[i * 2 + 1].GetString()); 145 146 fEfficiencyMap[param[i * 2].GetInt()] = formula; 149 147 } 150 148 … … 172 170 fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks")); 173 171 fItTrackInputArray = fTrackInputArray->MakeIterator(); 174 172 175 173 fFilter = new ExRootFilter(fPartonInputArray); 176 174 … … 183 181 void TrackCountingTauTagging::Finish() 184 182 { 185 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;183 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 186 184 DelphesFormula *formula; 187 185 … … 207 205 Double_t pt, eta, phi, e; 208 206 TObjArray *tauArray; 209 map< Int_t, DelphesFormula *>::iterator itEfficiencyMap;207 map<Int_t, DelphesFormula *>::iterator itEfficiencyMap; 210 208 DelphesFormula *formula; 211 209 Int_t pdgCode, charge, i, identifier; … … 232 230 e = jetMomentum.E(); 233 231 234 235 // loop over all input tracks 232 // loop over all input tracks 236 233 fItTrackInputArray->Reset(); 237 234 while((track = static_cast<Candidate *>(fItTrackInputArray->Next()))) 238 235 { 239 if((track->Momentum).Pt() < fTrackPTMin) continue; 240 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) { 241 identifier -= 1; 242 charge += track->Charge; 243 } 244 } 245 236 if((track->Momentum).Pt() < fTrackPTMin) continue; 237 if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) 238 { 239 identifier -= 1; 240 charge += track->Charge; 241 } 242 } 243 246 244 // loop over all input taus 247 245 itTauArray.Reset(); … … 251 249 if(tau->D1 < 0) continue; 252 250 253 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 254 tau->D2 >= fParticleInputArray->GetEntriesFast()) 251 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast()) 255 252 { 256 253 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); … … 263 260 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 264 261 if(TMath::Abs(daughter->PID) == 16) continue; 265 tauMomentum += daughter->Momentum; 262 tauMomentum += daughter->Momentum; 266 263 } 267 264 268 265 if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR) 269 { 266 { 270 267 matchedTau = true; 271 268 pdgCode = 15; … … 273 270 } 274 271 if(matchedTau) 275 272 identifier *= -1; 276 273 // find an efficency formula 277 274 // If the identifier is larger than 2, set it to 2 (multiprong requires at least 2 tracks) 278 if (identifier > 2) 279 identifier = 2; 280 else if (identifier < -2) 281 identifier = -2; 282 283 275 if(identifier > 2) 276 identifier = 2; 277 else if(identifier < -2) 278 identifier = -2; 279 284 280 itEfficiencyMap = fEfficiencyMap.find(identifier); 285 281 if(itEfficiencyMap == fEfficiencyMap.end()) … … 293 289 // apply an efficency formula 294 290 jet->TauTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 295 296 291 297 292 // set tau charge 298 293 jet->Charge = charge; -
modules/TrackCountingTauTagging.h
re39abb4 r0e7d64a 29 29 { 30 30 public: 31 32 31 TrackCountingTauTagging(); 33 32 ~TrackCountingTauTagging(); … … 38 37 39 38 private: 40 41 39 Int_t fBitNumber; 42 40 … … 45 43 Double_t fTrackPTMin; 46 44 47 std::map< Int_t, DelphesFormula *> fEfficiencyMap; //!48 45 std::map<Int_t, DelphesFormula *> fEfficiencyMap; //! 46 49 47 TrackCountingTauTaggingPartonClassifier *fClassifier; //! 50 48 51 49 ExRootFilter *fFilter; 52 50 53 51 TIterator *fItPartonInputArray; //! 54 52 55 53 TIterator *fItTrackInputArray; //! 56 54 57 55 TIterator *fItJetInputArray; //! 58 56 … … 62 60 63 61 const TObjArray *fPartonInputArray; //! 64 62 65 63 const TObjArray *fJetInputArray; //! 66 64 -
modules/TrackPileUpSubtractor.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class TrackPileUpSubtractor 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 54 53 55 54 TrackPileUpSubtractor::TrackPileUpSubtractor() : 56 fFormula(0) 55 fFormula(0) 57 56 { 58 57 fFormula = new DelphesFormula; … … 88 87 89 88 size = param.GetSize(); 90 for(i = 0; i < size /2; ++i)89 for(i = 0; i < size / 2; ++i) 91 90 { 92 array = ImportArray(param[i *2].GetString());91 array = ImportArray(param[i * 2].GetString()); 93 92 iterator = array->MakeIterator(); 94 93 95 fInputMap[iterator] = ExportArray(param[i *2 + 1].GetString());94 fInputMap[iterator] = ExportArray(param[i * 2 + 1].GetString()); 96 95 } 97 96 } … … 101 100 void TrackPileUpSubtractor::Finish() 102 101 { 103 map< TIterator *, TObjArray *>::iterator itInputMap;102 map<TIterator *, TObjArray *>::iterator itInputMap; 104 103 TIterator *iterator; 105 104 … … 119 118 { 120 119 Candidate *candidate, *particle; 121 map< TIterator *, TObjArray *>::iterator itInputMap;120 map<TIterator *, TObjArray *>::iterator itInputMap; 122 121 TIterator *iterator; 123 122 TObjArray *array; 124 Double_t z, zvtx =0;123 Double_t z, zvtx = 0; 125 124 Double_t pt, eta, phi, e; 126 127 125 128 126 // find z position of primary vertex 129 127 130 128 fItVertexInputArray->Reset(); 131 while((candidate = static_cast<Candidate *>(fItVertexInputArray->Next())))129 while((candidate = static_cast<Candidate *>(fItVertexInputArray->Next()))) 132 130 { 133 131 if(!candidate->IsPU) … … 146 144 // loop over all candidates 147 145 iterator->Reset(); 148 while((candidate = static_cast<Candidate *>(iterator->Next())))146 while((candidate = static_cast<Candidate *>(iterator->Next()))) 149 147 { 150 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));148 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 151 149 const TLorentzVector &candidateMomentum = particle->Momentum; 152 150 … … 155 153 phi = candidateMomentum.Phi(); 156 154 e = candidateMomentum.E(); 157 155 158 156 z = particle->Position.Z(); 159 157 … … 161 159 // assume perfect pile-up subtraction for tracks outside fZVertexResolution 162 160 163 if(candidate->Charge != 0 && candidate->IsPU && TMath::Abs(z-zvtx) > fFormula->Eval(pt, eta, phi, e)* 1.0e3)161 if(candidate->Charge != 0 && candidate->IsPU && TMath::Abs(z - zvtx) > fFormula->Eval(pt, eta, phi, e) * 1.0e3) 164 162 { 165 163 candidate->IsRecoPU = 1; -
modules/TrackPileUpSubtractor.h
re39abb4 r0e7d64a 39 39 { 40 40 public: 41 42 41 TrackPileUpSubtractor(); 43 42 ~TrackPileUpSubtractor(); … … 48 47 49 48 private: 50 51 49 DelphesFormula *fFormula; //! 52 50 53 51 Double_t fPTMin; 54 52 55 std::map< TIterator *, TObjArray *> fInputMap; //!53 std::map<TIterator *, TObjArray *> fInputMap; //! 56 54 57 55 ClassDef(TrackPileUpSubtractor, 1) 58 56 59 TIterator *fItVertexInputArray; //!57 TIterator *fItVertexInputArray; //! 60 58 61 59 const TObjArray *fVertexInputArray; //! 62 63 60 }; 64 61 -
modules/TrackSmearing.cc
re39abb4 r0e7d64a 13 13 #include "classes/DelphesFormula.h" 14 14 15 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 15 17 #include "ExRootAnalysis/ExRootResult.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 17 #include "ExRootAnalysis/ExRootClassifier.h" 18 18 19 #include "TDatabasePDG.h" 20 #include "TFile.h" 21 #include "TFormula.h" 22 #include "TLorentzVector.h" 19 23 #include "TMath.h" 24 #include "TObjArray.h" 25 #include "TProfile2D.h" 26 #include "TRandom3.h" 20 27 #include "TString.h" 21 #include "TFormula.h" 22 #include "TRandom3.h" 23 #include "TObjArray.h" 24 #include "TDatabasePDG.h" 25 #include "TLorentzVector.h" 26 #include "TFile.h" 27 #include "TProfile2D.h" 28 29 #include <algorithm> 30 #include <stdexcept> 28 29 #include <algorithm> 31 30 #include <iostream> 32 31 #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 71 72 73 else 74 75 76 77 78 79 if (string(GetString("DZResolutionFormula", "0.0")) != "0.0")80 81 82 83 84 else 85 86 87 88 89 90 if (string(GetString("PResolutionFormula", "0.0")) != "0.0")91 92 93 94 95 else 96 97 98 99 100 101 if (string(GetString("CtgThetaResolutionFormula", "0.0")) != "0.0")102 103 104 105 106 else 107 108 109 110 111 112 if (string(GetString("PhiResolutionFormula", "0.0")) != "0.0")113 114 115 116 117 else 118 119 120 121 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 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 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 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 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 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 *>(fItInputArray->Next())))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 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) 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) 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) 247 246 continue; 248 247 249 if 248 if(fUseDZFormula) 250 249 dzError = fDZFormula->Eval(pt, eta); 251 250 else 252 251 { 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) 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) 263 261 continue; 264 262 265 if 263 if(fUsePFormula) 266 264 pError = fPFormula->Eval(pt, eta) * p; 267 265 else 268 266 { 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) 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) 279 276 continue; 280 277 281 if 278 if(fUseCtgThetaFormula) 282 279 ctgThetaError = fCtgThetaFormula->Eval(pt, eta); 283 280 else 284 281 { 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) 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) 295 291 continue; 296 292 297 if 293 if(fUsePhiFormula) 298 294 phiError = fPhiFormula->Eval(pt, eta); 299 295 else 300 296 { 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) 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) 311 306 continue; 312 307 313 if 314 { 315 316 317 318 319 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); 320 315 } 321 316 322 317 if(p < 0.0) continue; 323 while (phi > TMath::Pi ()) phi -= TMath::TwoPi();324 while (phi <= -TMath::Pi ()) phi += TMath::TwoPi();318 while(phi > TMath::Pi()) phi -= TMath::TwoPi(); 319 while(phi <= -TMath::Pi()) phi += TMath::TwoPi(); 325 320 326 321 mother = candidate; 327 candidate = static_cast<Candidate *>(candidate->Clone());322 candidate = static_cast<Candidate *>(candidate->Clone()); 328 323 candidate->D0 = d0; 329 324 candidate->DZ = dz; … … 332 327 candidate->Phi = phi; 333 328 334 theta = TMath::ACos(ctgTheta / TMath::Sqrt 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 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 350 345 // -- solve for delta: d0' = ( (x+delta)*py' - (y+delta)*px' )/pt' 351 352 candidate->InitialPosition.SetX 353 candidate->InitialPosition.SetY 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 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(); 358 353 359 354 candidate->InitialPosition.SetT(t); … … 366 361 q = candidate->Charge; 367 362 368 r = pt / (q * fBz) * 1.0E9 /c_light;// in [m]363 r = pt / (q * fBz) * 1.0E9 / c_light; // in [m] 369 364 phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi] 370 365 371 366 // 2. helix axis coordinates 372 x_c = x + r *TMath::Sin(phi_0);373 y_c = y - r *TMath::Cos(phi_0);367 x_c = x + r * TMath::Sin(phi_0); 368 y_c = y - r * TMath::Cos(phi_0); 374 369 r_c = TMath::Hypot(x_c, y_c); 375 370 376 371 rcu = TMath::Abs(r); 377 rc2 = r_c *r_c;372 rc2 = r_c * r_c; 378 373 379 374 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 380 xd = x_c *x_c*x_c - x_c*rcu*r_c + x_c*y_c*y_c;375 xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c * y_c; 381 376 xd = (rc2 > 0.0) ? xd / rc2 : -999; 382 yd = y_c *(-rcu*r_c + rc2);377 yd = y_c * (-rcu * r_c + rc2); 383 378 yd = (rc2 > 0.0) ? yd / rc2 : -999; 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 391 { 392 393 394 395 396 397 candidate->ErrorPT = ptError(p, ctgTheta, pError, ctgThetaError);398 candidate->TrackResolution = pError/p;399 } 400 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 401 396 candidate->AddCandidate(mother); 402 397 fOutputArray->Add(candidate); … … 406 401 } 407 402 408 Double_t TrackSmearing::ptError 403 Double_t TrackSmearing::ptError(const Double_t p, const Double_t ctgTheta, const Double_t dP, const Double_t dCtgTheta) 409 404 { 410 405 Double_t a, b; 411 406 a = (p * p * ctgTheta * ctgTheta * dCtgTheta * dCtgTheta) / ((ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1) * (ctgTheta * ctgTheta + 1)); 412 407 b = (dP * dP) / (ctgTheta * ctgTheta + 1); 413 return sqrt 414 } 415 416 //------------------------------------------------------------------------------ 408 return sqrt(a + b); 409 } 410 411 //------------------------------------------------------------------------------ -
modules/TrackSmearing.h
re39abb4 r0e7d64a 21 21 { 22 22 public: 23 24 23 TrackSmearing(); 25 24 ~TrackSmearing(); … … 30 29 31 30 private: 32 33 Double_t ptError (const Double_t, const Double_t, const Double_t, const Double_t); 31 Double_t ptError(const Double_t, const Double_t, const Double_t, const Double_t); 34 32 35 33 Double_t fBz; … … 66 64 const TObjArray *fInputArray; //! 67 65 const TObjArray *fBeamSpotInputArray; //! 68 66 69 67 TObjArray *fOutputArray; //! 70 68 -
modules/TreeWriter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class TreeWriter 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 #include "ExRootAnalysis/ExRootTreeBranch.h" 38 37 38 #include "TDatabasePDG.h" 39 #include "TFormula.h" 40 #include "TLorentzVector.h" 41 #include "TMath.h" 42 #include "TObjArray.h" 39 43 #include "TROOT.h" 40 #include "T Math.h"44 #include "TRandom3.h" 41 45 #include "TString.h" 42 #include "TFormula.h"43 #include "TRandom3.h"44 #include "TObjArray.h"45 #include "TDatabasePDG.h"46 #include "TLorentzVector.h"47 46 48 47 #include <algorithm> 49 #include <stdexcept>50 48 #include <iostream> 51 49 #include <sstream> 50 #include <stdexcept> 52 51 53 52 using namespace std; … … 84 83 85 84 TBranchMap::iterator itBranchMap; 86 map< TClass *, TProcessMethod>::iterator itClassMap;85 map<TClass *, TProcessMethod>::iterator itClassMap; 87 86 88 87 // read branch configuration and … … 97 96 98 97 size = param.GetSize(); 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();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(); 104 103 105 104 branchClass = gROOT->GetClass(branchClassName); … … 123 122 fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array))); 124 123 } 125 126 124 } 127 125 … … 139 137 it1.Reset(); 140 138 array->Clear(); 141 while((candidate = static_cast<Candidate *>(it1.Next())))139 while((candidate = static_cast<Candidate *>(it1.Next()))) 142 140 { 143 141 TIter it2(candidate->GetCandidates()); … … 151 149 152 150 // track 153 candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));151 candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 154 152 if(candidate->GetCandidates()->GetEntriesFast() == 0) 155 153 { … … 160 158 // tower 161 159 it2.Reset(); 162 while((candidate = static_cast<Candidate *>(it2.Next())))160 while((candidate = static_cast<Candidate *>(it2.Next()))) 163 161 { 164 162 array->Add(candidate->GetCandidates()->At(0)); … … 180 178 // loop over all particles 181 179 iterator.Reset(); 182 while((candidate = static_cast<Candidate *>(iterator.Next())))180 while((candidate = static_cast<Candidate *>(iterator.Next()))) 183 181 { 184 182 const TLorentzVector &momentum = candidate->Momentum; 185 183 const TLorentzVector &position = candidate->Position; 186 184 187 entry = static_cast<GenParticle *>(branch->NewEntry());185 entry = static_cast<GenParticle *>(branch->NewEntry()); 188 186 189 187 entry->SetBit(kIsReferenced); … … 193 191 cosTheta = TMath::Abs(momentum.CosTheta()); 194 192 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 195 eta = (cosTheta == 1.0 ? signPz *999.9 : momentum.Eta());196 rapidity = (cosTheta == 1.0 ? signPz *999.9 : momentum.Rapidity());193 eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta()); 194 rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity()); 197 195 198 196 entry->PID = candidate->PID; … … 215 213 entry->Pz = momentum.Pz(); 216 214 217 entry->D0 218 entry->DZ 219 entry->P 220 entry->PT 221 entry->CtgTheta 222 entry->Phi 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; 223 221 224 222 entry->Eta = eta; … … 231 229 entry->Y = position.Y(); 232 230 entry->Z = position.Z(); 233 entry->T = position.T() *1.0E-3/c_light;231 entry->T = position.T() * 1.0E-3 / c_light; 234 232 } 235 233 } … … 255 253 // loop over all vertices 256 254 iterator.Reset(); 257 while((candidate = static_cast<Candidate *>(iterator.Next())))255 while((candidate = static_cast<Candidate *>(iterator.Next()))) 258 256 { 259 257 … … 269 267 y = candidate->Position.Y(); 270 268 z = candidate->Position.Z(); 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());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 *>(branch->NewEntry()); 279 277 280 278 entry->Index = index; … … 296 294 entry->ErrorT = tError; 297 295 298 299 296 TIter itConstituents(candidate->GetCandidates()); 300 297 itConstituents.Reset(); 301 298 entry->Constituents.Clear(); 302 while((constituent = static_cast<Candidate *>(itConstituents.Next())))299 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 303 300 { 304 301 entry->Constituents.Add(constituent); 305 302 } 306 307 } 308 } 309 303 } 304 } 310 305 311 306 //------------------------------------------------------------------------------ … … 322 317 // loop over all tracks 323 318 iterator.Reset(); 324 while((candidate = static_cast<Candidate *>(iterator.Next())))319 while((candidate = static_cast<Candidate *>(iterator.Next()))) 325 320 { 326 321 const TLorentzVector &position = candidate->Position; … … 328 323 cosTheta = TMath::Abs(position.CosTheta()); 329 324 signz = (position.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 334 329 335 330 entry->SetBit(kIsReferenced); … … 346 341 entry->YOuter = position.Y(); 347 342 entry->ZOuter = position.Z(); 348 entry->TOuter = position.T() *1.0E-3/c_light;343 entry->TOuter = position.T() * 1.0E-3 / c_light; 349 344 350 345 entry->L = candidate->L; 351 346 352 entry->D0 353 entry->ErrorD0 354 entry->DZ 355 entry->ErrorDZ 356 357 entry->ErrorP 358 entry->ErrorPT 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; 359 354 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 360 entry->ErrorPhi 355 entry->ErrorPhi = candidate->ErrorPhi; 361 356 362 357 entry->Xd = candidate->Xd; … … 369 364 p = momentum.P(); 370 365 phi = momentum.Phi(); 371 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 /TMath::Tan(momentum.Theta()) : 1e10;366 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10; 372 367 373 368 cosTheta = TMath::Abs(momentum.CosTheta()); 374 369 signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 375 eta = (cosTheta == 1.0 ? signz *999.9 : momentum.Eta());376 rapidity = (cosTheta == 1.0 ? signz *999.9 : momentum.Rapidity());370 eta = (cosTheta == 1.0 ? signz * 999.9 : momentum.Eta()); 371 rapidity = (cosTheta == 1.0 ? signz * 999.9 : momentum.Rapidity()); 377 372 378 373 entry->P = p; 379 entry->PT 374 entry->PT = pt; 380 375 entry->Eta = eta; 381 376 entry->Phi = phi; 382 377 entry->CtgTheta = ctgTheta; 383 378 384 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));379 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 385 380 const TLorentzVector &initialPosition = particle->Position; 386 381 … … 388 383 entry->Y = initialPosition.Y(); 389 384 entry->Z = initialPosition.Z(); 390 entry->T = initialPosition.T() *1.0E-3/c_light;385 entry->T = initialPosition.T() * 1.0E-3 / c_light; 391 386 392 387 entry->Particle = particle; 393 388 394 389 entry->VertexIndex = candidate->ClusterIndex; 395 396 390 } 397 391 } … … 409 403 // loop over all towers 410 404 iterator.Reset(); 411 while((candidate = static_cast<Candidate *>(iterator.Next())))405 while((candidate = static_cast<Candidate *>(iterator.Next()))) 412 406 { 413 407 const TLorentzVector &momentum = candidate->Momentum; … … 417 411 cosTheta = TMath::Abs(momentum.CosTheta()); 418 412 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 423 417 424 418 entry->SetBit(kIsReferenced); … … 436 430 entry->Edges[3] = candidate->Edges[3]; 437 431 438 entry->T = position.T() *1.0E-3/c_light;432 entry->T = position.T() * 1.0E-3 / c_light; 439 433 entry->NTimeHits = candidate->NTimeHits; 440 434 … … 457 451 // loop over all photons 458 452 iterator.Reset(); 459 while((candidate = static_cast<Candidate *>(iterator.Next())))453 while((candidate = static_cast<Candidate *>(iterator.Next()))) 460 454 { 461 455 TIter it1(candidate->GetCandidates()); … … 466 460 cosTheta = TMath::Abs(momentum.CosTheta()); 467 461 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 472 466 473 467 entry->Eta = eta; … … 475 469 entry->PT = pt; 476 470 entry->E = momentum.E(); 477 entry->T = position.T() *1.0E-3/c_light;471 entry->T = position.T() * 1.0E-3 / c_light; 478 472 479 473 // Isolation variables 480 474 481 475 entry->IsolationVar = candidate->IsolationVar; 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;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; 489 483 490 484 // 1: prompt -- 2: non prompt -- 3: fake … … 509 503 // loop over all electrons 510 504 iterator.Reset(); 511 while((candidate = static_cast<Candidate *>(iterator.Next())))505 while((candidate = static_cast<Candidate *>(iterator.Next()))) 512 506 { 513 507 const TLorentzVector &momentum = candidate->Momentum; … … 517 511 cosTheta = TMath::Abs(momentum.CosTheta()); 518 512 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 523 517 524 518 entry->Eta = eta; … … 526 520 entry->PT = pt; 527 521 528 entry->T = position.T()*1.0E-3/c_light; 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; 529 529 530 530 // Isolation variables 531 532 531 entry->IsolationVar = candidate->IsolationVar; 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 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; 539 537 540 538 entry->Charge = candidate->Charge; … … 561 559 // loop over all muons 562 560 iterator.Reset(); 563 while((candidate = static_cast<Candidate *>(iterator.Next())))561 while((candidate = static_cast<Candidate *>(iterator.Next()))) 564 562 { 565 563 const TLorentzVector &momentum = candidate->Momentum; … … 569 567 cosTheta = TMath::Abs(momentum.CosTheta()); 570 568 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 575 573 576 574 entry->SetBit(kIsReferenced); … … 581 579 entry->PT = pt; 582 580 583 entry->T = position.T()*1.0E-3/c_light; 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; 584 588 585 589 // Isolation variables 586 590 587 591 entry->IsolationVar = candidate->IsolationVar; 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 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; 593 597 594 598 entry->Charge = candidate->Charge; … … 614 618 // loop over all jets 615 619 iterator.Reset(); 616 while((candidate = static_cast<Candidate *>(iterator.Next())))620 while((candidate = static_cast<Candidate *>(iterator.Next()))) 617 621 { 618 622 TIter itConstituents(candidate->GetCandidates()); … … 624 628 cosTheta = TMath::Abs(momentum.CosTheta()); 625 629 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 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());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 *>(branch->NewEntry()); 630 634 631 635 entry->Eta = eta; … … 633 637 entry->PT = pt; 634 638 635 entry->T = position.T() *1.0E-3/c_light;639 entry->T = position.T() * 1.0E-3 / c_light; 636 640 637 641 entry->Mass = momentum.M(); … … 660 664 ecalEnergy = 0.0; 661 665 hcalEnergy = 0.0; 662 while((constituent = static_cast<Candidate *>(itConstituents.Next())))666 while((constituent = static_cast<Candidate *>(itConstituents.Next()))) 663 667 { 664 668 entry->Constituents.Add(constituent); … … 667 671 } 668 672 669 entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy /ecalEnergy : 999.9;673 entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy / ecalEnergy : 999.9; 670 674 671 675 //--- Pile-Up Jet ID variables ---- … … 684 688 entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped; 685 689 686 entry->SoftDroppedJet = candidate->SoftDroppedJet;687 entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1 690 entry->SoftDroppedJet = candidate->SoftDroppedJet; 691 entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1; 688 692 entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2; 689 690 693 691 694 for(i = 0; i < 5; i++) 692 695 { 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];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]; 698 701 } 699 702 … … 702 705 entry->ExclYmerge34 = candidate->ExclYmerge34; 703 706 entry->ExclYmerge45 = candidate->ExclYmerge45; 704 entry->ExclYmerge56 = candidate->ExclYmerge56; 705 707 entry->ExclYmerge56 = candidate->ExclYmerge56; 706 708 707 709 FillParticles(candidate, &entry->Particles); … … 717 719 718 720 // get the first entry 719 if((candidate = static_cast<Candidate *>(array->At(0))))720 { 721 const TLorentzVector &momentum = candidate->Momentum; 722 723 entry = static_cast<MissingET *>(branch->NewEntry());721 if((candidate = static_cast<Candidate *>(array->At(0)))) 722 { 723 const TLorentzVector &momentum = candidate->Momentum; 724 725 entry = static_cast<MissingET *>(branch->NewEntry()); 724 726 725 727 entry->Eta = (-momentum).Eta(); … … 737 739 738 740 // get the first entry 739 if((candidate = static_cast<Candidate *>(array->At(0))))740 { 741 const TLorentzVector &momentum = candidate->Momentum; 742 743 entry = static_cast<ScalarHT *>(branch->NewEntry());741 if((candidate = static_cast<Candidate *>(array->At(0)))) 742 { 743 const TLorentzVector &momentum = candidate->Momentum; 744 745 entry = static_cast<ScalarHT *>(branch->NewEntry()); 744 746 745 747 entry->HT = momentum.Pt(); … … 757 759 // loop over all rho 758 760 iterator.Reset(); 759 while((candidate = static_cast<Candidate *>(iterator.Next())))760 { 761 const TLorentzVector &momentum = candidate->Momentum; 762 763 entry = static_cast<Rho *>(branch->NewEntry());761 while((candidate = static_cast<Candidate *>(iterator.Next()))) 762 { 763 const TLorentzVector &momentum = candidate->Momentum; 764 765 entry = static_cast<Rho *>(branch->NewEntry()); 764 766 765 767 entry->Rho = momentum.E(); … … 777 779 778 780 // get the first entry 779 if((candidate = static_cast<Candidate *>(array->At(0))))780 { 781 const TLorentzVector &momentum = candidate->Momentum; 782 783 entry = static_cast<Weight *>(branch->NewEntry());781 if((candidate = static_cast<Candidate *>(array->At(0)))) 782 { 783 const TLorentzVector &momentum = candidate->Momentum; 784 785 entry = static_cast<Weight *>(branch->NewEntry()); 784 786 785 787 entry->Weight = momentum.E(); … … 797 799 // loop over all roman pot hits 798 800 iterator.Reset(); 799 while((candidate = static_cast<Candidate *>(iterator.Next())))801 while((candidate = static_cast<Candidate *>(iterator.Next()))) 800 802 { 801 803 const TLorentzVector &position = candidate->Position; 802 804 const TLorentzVector &momentum = candidate->Momentum; 803 805 804 entry = static_cast<HectorHit *>(branch->NewEntry());806 entry = static_cast<HectorHit *>(branch->NewEntry()); 805 807 806 808 entry->E = momentum.E(); -
modules/TreeWriter.h
re39abb4 r0e7d64a 42 42 { 43 43 public: 44 45 44 TreeWriter(); 46 45 ~TreeWriter(); … … 51 50 52 51 private: 53 54 52 void FillParticles(Candidate *candidate, TRefArray *array); 55 53 … … 72 70 typedef void (TreeWriter::*TProcessMethod)(ExRootTreeBranch *, TObjArray *); //! 73 71 74 typedef std::map< ExRootTreeBranch *, std::pair< TProcessMethod, TObjArray *> > TBranchMap; //!72 typedef std::map<ExRootTreeBranch *, std::pair<TProcessMethod, TObjArray *> > TBranchMap; //! 75 73 76 74 TBranchMap fBranchMap; //! 77 75 78 std::map< TClass *, TProcessMethod> fClassMap; //!76 std::map<TClass *, TProcessMethod> fClassMap; //! 79 77 #endif 80 78 -
modules/UniqueObjectFinder.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class UniqueObjectFinder 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 67 66 void UniqueObjectFinder::Init() 68 67 { 68 // use GetUniqueID algorithm to find unique objects (faster than the default Overlaps method) 69 fUseUniqueID = GetBool("UseUniqueID", false); 70 69 71 // import arrays with output from other modules 70 72 … … 77 79 78 80 size = param.GetSize(); 79 for(i = 0; i < size /2; ++i)81 for(i = 0; i < size / 2; ++i) 80 82 { 81 array = ImportArray(param[i *2].GetString());83 array = ImportArray(param[i * 2].GetString()); 82 84 iterator = array->MakeIterator(); 83 85 84 fInputMap.push_back(make_pair(iterator, ExportArray(param[i *2 + 1].GetString())));86 fInputMap.push_back(make_pair(iterator, ExportArray(param[i * 2 + 1].GetString()))); 85 87 } 86 88 } … … 90 92 void UniqueObjectFinder::Finish() 91 93 { 92 vector< pair< TIterator *, TObjArray *> >::iterator itInputMap;94 vector<pair<TIterator *, TObjArray *> >::iterator itInputMap; 93 95 TIterator *iterator; 94 96 … … 106 108 { 107 109 Candidate *candidate; 108 vector< pair< TIterator *, TObjArray *> >::iterator itInputMap;110 vector<pair<TIterator *, TObjArray *> >::iterator itInputMap; 109 111 TIterator *iterator; 110 112 TObjArray *array; … … 118 120 // loop over all candidates 119 121 iterator->Reset(); 120 while((candidate = static_cast<Candidate *>(iterator->Next())))122 while((candidate = static_cast<Candidate *>(iterator->Next()))) 121 123 { 122 124 if(Unique(candidate, itInputMap)) … … 130 132 //------------------------------------------------------------------------------ 131 133 132 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray *> >::iterator itInputMap)134 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector<pair<TIterator *, TObjArray *> >::iterator itInputMap) 133 135 { 134 136 Candidate *previousCandidate; 135 vector< pair< TIterator *, TObjArray *> >::iterator previousItInputMap;137 vector<pair<TIterator *, TObjArray *> >::iterator previousItInputMap; 136 138 TObjArray *array; 137 139 … … 144 146 // loop over all candidates 145 147 iterator.Reset(); 146 while((previousCandidate = static_cast<Candidate *>(iterator.Next())))148 while((previousCandidate = static_cast<Candidate *>(iterator.Next()))) 147 149 { 148 if( candidate->Overlaps(previousCandidate))150 if(fUseUniqueID) 149 151 { 150 return kFALSE; 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 } 151 163 } 152 164 } -
modules/UniqueObjectFinder.h
re39abb4 r0e7d64a 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <utility> 32 33 #include <vector> 33 #include <utility>34 34 35 35 class TIterator; … … 40 40 { 41 41 public: 42 43 42 UniqueObjectFinder(); 44 43 ~UniqueObjectFinder(); … … 49 48 50 49 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
re39abb4 r0e7d64a 7 7 */ 8 8 9 10 9 #include "modules/VertexFinder.h" 11 10 #include "classes/DelphesClasses.h" … … 14 13 #include "classes/DelphesPileUpReader.h" 15 14 15 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 16 17 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 18 #include "ExRootAnalysis/ExRootClassifier.h" 19 18 19 #include "TDatabasePDG.h" 20 #include "TFormula.h" 21 #include "TLorentzVector.h" 20 22 #include "TMath.h" 23 #include "TMatrixT.h" 24 #include "TObjArray.h" 25 #include "TRandom3.h" 21 26 #include "TString.h" 22 #include "TFormula.h"23 #include "TRandom3.h"24 #include "TObjArray.h"25 #include "TDatabasePDG.h"26 #include "TLorentzVector.h"27 #include "TMatrixT.h"28 27 #include "TVector3.h" 29 28 29 #include <algorithm> 30 #include <iostream> 31 #include <map> 32 #include <stdexcept> 33 #include <string> 30 34 #include <utility> 31 #include <algorithm>32 #include <stdexcept>33 #include <iostream>34 35 #include <vector> 35 #include <map>36 #include <string>37 36 38 37 using namespace std; 39 38 40 static const Double_t mm 41 static const Double_t m = 1000. *mm;42 static const Double_t ns 43 static const Double_t s = 1.e+9 * ns;44 static const Double_t c_light = 2.99792458e+8 * m/s;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 * ns; 43 static const Double_t c_light = 2.99792458e+8 * m / s; 45 44 46 45 //------------------------------------------------------------------------------ … … 84 83 //------------------------------------------------------------------------------ 85 84 86 static Bool_t secondAscending 85 static Bool_t secondAscending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 87 86 { 88 87 return (pair0.second < pair1.second); 89 88 } 90 89 91 static Bool_t secondDescending 90 static Bool_t secondDescending(pair<UInt_t, Double_t> pair0, pair<UInt_t, Double_t> pair1) 92 91 { 93 92 return (pair0.second > pair1.second); … … 101 100 102 101 // Clear the track and cluster maps before starting 103 trackIDToDouble.clear 104 trackIDToInt.clear 105 trackIDToBool.clear 106 clusterIDToDouble.clear 107 clusterIDToInt.clear 108 clusterIDToBool.clear 109 trackPT.clear 110 clusterSumPT2.clear 102 trackIDToDouble.clear(); 103 trackIDToInt.clear(); 104 trackIDToBool.clear(); 105 clusterIDToDouble.clear(); 106 clusterIDToInt.clear(); 107 clusterIDToBool.clear(); 108 trackPT.clear(); 109 clusterSumPT2.clear(); 111 110 112 111 // Create the initial cluster seeds 113 createSeeds 112 createSeeds(); 114 113 115 114 // In order of descending seed pt, grow each cluster. If a cluster ends up with 116 115 // fewer than MinNDF tracks, release the tracks for other clusters to claim. 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 121 if (!clusterIDToInt.at (cluster->first).at("ndf"))122 123 124 125 if(fGrowSeeds)126 growCluster(cluster->first);127 128 129 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 137 138 139 140 141 142 trackIDToBool[clusterIDToInt.at (cluster->first).at("seed")]["claimed"] = true;143 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 tracks 120 if(!clusterIDToInt.at(cluster->first).at("ndf")) 121 continue; 122 123 // Grow the cluster if GrowSeeds is true 124 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 claimed 129 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 else 141 trackIDToBool[clusterIDToInt.at(cluster->first).at("seed")]["claimed"] = true; 142 } 144 143 145 144 // Add tracks to the output array after updating their ClusterIndex. 146 fItInputArray->Reset 147 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))148 149 if (candidate->Momentum.Pt () < fMinPT || fabs (candidate->Momentum.Eta()) > fMaxEta)150 151 candidate->ClusterIndex = trackIDToInt.at (candidate->GetUniqueID ()).at("clusterIndex");152 153 145 fItInputArray->Reset(); 146 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 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 } 154 153 155 154 // Add clusters with at least MinNDF tracks to the output array in order of 156 155 // descending sum(pt**2). 157 clusterSumPT2.clear 158 for (map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin (); cluster != clusterIDToInt.end(); cluster++)159 { 160 161 if (cluster->second.at("ndf") < fMinNDF)162 continue; 163 clusterSumPT2.push_back (make_pair (cluster->first, clusterIDToDouble.at (cluster->first).at("sumPT2")));164 } 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++)156 clusterSumPT2.clear(); 157 for(map<UInt_t, map<string, Int_t> >::const_iterator cluster = clusterIDToInt.begin(); cluster != clusterIDToInt.end(); cluster++) 158 { 159 160 if(cluster->second.at("ndf") < fMinNDF) 161 continue; 162 clusterSumPT2.push_back(make_pair(cluster->first, clusterIDToDouble.at(cluster->first).at("sumPT2"))); 163 } 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++) 168 167 { 169 168 DelphesFactory *factory = GetFactory(); … … 171 170 172 171 candidate->ClusterIndex = cluster->first; 173 candidate->ClusterNDF = clusterIDToInt.at (cluster->first).at("ndf");172 candidate->ClusterNDF = clusterIDToInt.at(cluster->first).at("ndf"); 174 173 candidate->ClusterSigma = fSigma; 175 174 candidate->SumPT2 = cluster->second; 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);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); 178 177 179 178 fVertexOutputArray->Add(candidate); … … 183 182 //------------------------------------------------------------------------------ 184 183 185 void VertexFinder::createSeeds 184 void VertexFinder::createSeeds() 186 185 { 187 186 Candidate *candidate; … … 190 189 // Loop over all tracks, initializing some variables. 191 190 fItInputArray->Reset(); 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 } 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 } 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 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 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 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 ()) 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) 261 270 { 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 } 271 nearestID = track->first; 272 nearestDistance = distance; 277 273 } 278 279 else 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) 280 287 { 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 } 288 nearestID = *track; 289 nearestDistance = distance; 292 290 } 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); 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); 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 342 { 343 Double_t wz = weight 344 345 if (!clusterIDToInt.count(clusterID))346 347 348 349 350 351 352 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
re39abb4 r0e7d64a 10 10 */ 11 11 12 13 12 #include "classes/DelphesModule.h" 14 13 14 #include <map> 15 15 #include <string> 16 16 #include <vector> 17 #include <map>18 17 19 18 class TObjArray; … … 23 22 { 24 23 public: 25 26 24 VertexFinder(); 27 25 ~VertexFinder(); … … 32 30 33 31 private: 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); 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); 40 37 41 38 Double_t fSigma; -
modules/VertexFinderDA4D.cc
re39abb4 r0e7d64a 7 7 */ 8 8 9 10 9 #include "modules/VertexFinderDA4D.h" 11 10 #include "classes/DelphesClasses.h" … … 14 13 #include "classes/DelphesPileUpReader.h" 15 14 15 #include "ExRootAnalysis/ExRootClassifier.h" 16 #include "ExRootAnalysis/ExRootFilter.h" 16 17 #include "ExRootAnalysis/ExRootResult.h" 17 #include "ExRootAnalysis/ExRootFilter.h" 18 #include "ExRootAnalysis/ExRootClassifier.h" 19 18 19 #include "TDatabasePDG.h" 20 #include "TFormula.h" 21 #include "TLorentzVector.h" 20 22 #include "TMath.h" 23 #include "TMatrixT.h" 24 #include "TObjArray.h" 25 #include "TRandom3.h" 21 26 #include "TString.h" 22 #include "TFormula.h"23 #include "TRandom3.h"24 #include "TObjArray.h"25 #include "TDatabasePDG.h"26 #include "TLorentzVector.h"27 #include "TMatrixT.h"28 27 #include "TVector3.h" 29 28 29 #include <algorithm> 30 #include <iostream> 31 #include <stdexcept> 30 32 #include <utility> 31 #include <algorithm>32 #include <stdexcept>33 #include <iostream>34 33 #include <vector> 35 34 36 35 using namespace std; 37 36 38 static const Double_t mm 39 static const Double_t m = 1000. *mm;40 static const Double_t ns 41 static const Double_t s = 1.e+9 * ns;42 static const Double_t c_light = 2.99792458e+8 * m/s;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 * ns; 41 static const Double_t c_light = 2.99792458e+8 * m / s; 43 42 44 43 struct track_t 45 44 { 46 double z; 47 double t; 48 double dz2; 49 double dtz; 50 double dt2; 45 double z; // z-coordinate at point of closest approach to the beamline 46 double t; // t-coordinate at point of closest approach to the beamline 47 double dz2; // square of the error of z(pca) 48 double dtz; // covariance of z-t 49 double dt2; // square of the error of t(pca) 51 50 Candidate *tt; // a pointer to the Candidate Track 52 double Z; 53 double pi; 51 double Z; // Z[i] for DA clustering 52 double pi; // track weight 54 53 double pt; 55 54 double eta; … … 61 60 double z; 62 61 double t; 63 double pk; 62 double pk; // vertex weight for "constrained" clustering 64 63 // --- temporary numbers, used during update 65 64 double ei; … … 76 75 static double update1(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y); 77 76 static double update2(double beta, std::vector<track_t> &tks, std::vector<vertex_t> &y, double &rho0, const double dzCutOff); 78 static void dump(const double beta, const std::vector<vertex_t> & y, const std::vector<track_t> &tks);77 static void dump(const double beta, const std::vector<vertex_t> &y, const std::vector<track_t> &tks); 79 78 static bool merge(std::vector<vertex_t> &); 80 79 static bool merge(std::vector<vertex_t> &, double &); 81 static bool purge(std::vector<vertex_t> &, std::vector<track_t> & 80 static bool purge(std::vector<vertex_t> &, std::vector<track_t> &, double &, const double, const double); 82 81 static void splitAll(std::vector<vertex_t> &y); 83 82 static double beta0(const double betamax, std::vector<track_t> &tks, std::vector<vertex_t> &y, const double coolingFactor); 84 83 static double Eik(const track_t &t, const vertex_t &k); 85 84 86 static bool recTrackLessZ1(const track_t & tk1, const track_t &tk2)85 static bool recTrackLessZ1(const track_t &tk1, const track_t &tk2) 87 86 { 88 87 return tk1.z < tk2.z; … … 115 114 fVertexSpaceSize = GetDouble("VertexSpaceSize", 0.5); //in mm 116 115 fVertexTimeSize = GetDouble("VertexTimeSize", 10E-12); //in s 117 fUseTc 118 fBetaMax 119 fBetaStop 116 fUseTc = GetBool("UseTc", 1); 117 fBetaMax = GetDouble("BetaMax ", 0.1); 118 fBetaStop = GetDouble("BetaStop", 1.0); 120 119 fCoolingFactor = GetDouble("CoolingFactor", 0.8); 121 120 fMaxIterations = GetInt("MaxIterations", 100); 122 fDzCutOff = GetDouble("DzCutOff", 40);// Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes123 fD0CutOff 124 fDtCutOff = GetDouble("DtCutOff", 100E-12);// dummy121 fDzCutOff = GetDouble("DzCutOff", 40); // Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes 122 fD0CutOff = GetDouble("D0CutOff", 30); 123 fDtCutOff = GetDouble("DtCutOff", 100E-12); // dummy 125 124 126 125 // convert stuff in cm, ns 127 126 fVertexSpaceSize /= 10.0; 128 127 fVertexTimeSize *= 1E9; 129 fDzCutOff /= 10.0;// Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes130 fD0CutOff 128 fDzCutOff /= 10.0; // Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes 129 fD0CutOff /= 10.0; 131 130 132 131 fInputArray = ImportArray(GetString("InputArray", "TrackSmearing/tracks")); … … 157 156 158 157 TLorentzVector pos, mom; 159 if 160 { 161 cout<<" start processing vertices ..."<<endl;162 cout<<" Found "<<fInputArray->GetEntriesFast()<<" input tracks"<<endl;163 164 165 while((candidate = static_cast<Candidate*>(fItInputArray->Next())))166 167 168 169 170 cout<<"pt: "<<mom.Pt()<<", eta: "<<mom.Eta()<<", phi: "<<mom.Phi()<<", z: "<<candidate->DZ/10<<endl;171 158 if(fVerbose) 159 { 160 cout << " start processing vertices ..." << endl; 161 cout << " Found " << fInputArray->GetEntriesFast() << " input tracks" << endl; 162 //loop over input tracks 163 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 } 172 171 } 173 172 … … 175 174 clusterize(*fInputArray, *ClusterArray); 176 175 177 if (fVerbose){std::cout << " clustering returned "<< ClusterArray->GetEntriesFast() << " clusters from " << fInputArray->GetEntriesFast() << " selected tracks" <<std::endl;} 176 if(fVerbose) 177 { 178 std::cout << " clustering returned " << ClusterArray->GetEntriesFast() << " clusters from " << fInputArray->GetEntriesFast() << " selected tracks" << std::endl; 179 } 178 180 179 181 //loop over vertex candidates 180 182 ItClusterArray = ClusterArray->MakeIterator(); 181 183 ItClusterArray->Reset(); 182 while((candidate = static_cast<Candidate *>(ItClusterArray->Next())))183 { 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 if(fVerbose)cout<<"this vertex has: "<<candidate->GetCandidates()->GetEntriesFast()<<" tracks"<<endl;200 201 202 203 204 205 while((track = static_cast<Candidate*>(it1.Next())))206 207 208 209 210 double t = track->InitialPosition.T()/c_light;211 double dt = track->ErrorT/c_light;212 213 const double inverr = 1.0/dt;214 meantime += time*inverr;215 expv_x2 += time*time*inverr;216 normw+= inverr;217 218 219 220 const double z = track->DZ/10.0;221 222 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 229 sumpt2 += pt*pt;230 231 232 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 245 246 247 248 249 250 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 loop269 270 271 if(fVerbose){272 273 274 275 276 277 184 while((candidate = static_cast<Candidate *>(ItClusterArray->Next()))) 185 { 186 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 vertex 204 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 TBC 212 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 TBC 221 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 tracks 234 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 loop 271 272 if(fVerbose) 273 { 274 std::cout << "PrimaryVertexProducerAlgorithm::vertices candidates =" << ClusterArray->GetEntriesFast() << std::endl; 275 } 276 277 //TBC maybe this can be done later 278 // sort vertices by pt**2 vertex (aka signal vertex tagging) 279 /*if(pvs.size()>1){ 278 280 sort(pvs.begin(), pvs.end(), VertexHigherPtSquared()); 279 281 } … … 281 283 282 284 delete ClusterArray; 283 284 285 } 285 286 … … 288 289 void VertexFinderDA4D::clusterize(const TObjArray &tracks, TObjArray &clusters) 289 290 { 290 if(fVerbose) { 291 if(fVerbose) 292 { 291 293 cout << "###################################################" << endl; 292 cout << "# VertexFinderDA4D::clusterize nt=" <<tracks.GetEntriesFast() << endl;294 cout << "# VertexFinderDA4D::clusterize nt=" << tracks.GetEntriesFast() << endl; 293 295 cout << "###################################################" << endl; 294 296 } 295 297 296 vector< Candidate* > pv = vertices(); 297 298 if(fVerbose){ cout << "# VertexFinderDA4D::clusterize pv.size="<<pv.size() << endl; } 299 if (pv.size()==0){ return; } 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 } 300 308 301 309 // convert into vector of candidates 302 310 //TObjArray *ClusterArray = pv.begin()->GetCandidates(); 303 311 //Candidate *aCluster = static_cast<Candidate*>(&(pv.at(0))); 304 312 Candidate *aCluster = pv.at(0); 305 313 306 314 // fill into clusters and merge 307 315 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); 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); 317 327 std::cout << ' ' << (*k)->Position.Z() << ' ' << (*k)->Position.T() << std::endl; 318 328 } 319 329 320 321 330 // TBC - check units here 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 ){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 { 324 333 // close a cluster 325 334 clusters.Add(aCluster); … … 327 336 } 328 337 //for(unsigned int i=0; i<k->GetCandidates().GetEntriesFast(); i++){ 329 338 aCluster = *k; 330 339 //} 331 332 340 } 333 341 clusters.Add(aCluster); 334 342 335 if(fVerbose) { std::cout << "# VertexFinderDA4D::clusterize clusters.size="<<clusters.GetEntriesFast() << std::endl; } 336 337 } 338 339 //------------------------------------------------------------------------------ 340 341 vector< Candidate* > VertexFinderDA4D::vertices() 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() 342 352 { 343 353 Candidate *candidate; 344 354 UInt_t clusterIndex = 0; 345 vector< Candidate*> clusters;355 vector<Candidate *> clusters; 346 356 347 357 vector<track_t> tks; … … 351 361 // loop over input tracks 352 362 fItInputArray->Reset(); 353 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))363 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 354 364 { 355 365 //TBC everything in cm 356 z = candidate->DZ /10;366 z = candidate->DZ / 10; 357 367 tr.z = z; 358 dz = candidate->ErrorDZ /10;359 tr.dz2 = dz *dz// track error360 //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 induced362 + fVertexSpaceSize*fVertexSpaceSize; // intrinsic vertex size, safer for outliers and short lived decays368 dz = candidate->ErrorDZ / 10; 369 tr.dz2 = dz * dz // track error 370 //TBC: beamspot size induced error, take 0 for now. 371 // + (std::pow(beamspot.BeamWidthX()*cos(phi),2.)+std::pow(beamspot.BeamWidthY()*sin(phi),2.))/std::pow(tantheta,2.) // beam-width induced 372 + fVertexSpaceSize * fVertexSpaceSize; // intrinsic vertex size, safer for outliers and short lived decays 363 373 364 374 // TBC: the time is in ns for now TBC 365 375 //t = candidate->Position.T()/c_light; 366 t = candidate->InitialPosition.T() /c_light;367 l = candidate->L /c_light;376 t = candidate->InitialPosition.T() / c_light; 377 l = candidate->L / c_light; 368 378 double pt = candidate->Momentum.Pt(); 369 379 double eta = candidate->Momentum.Eta(); … … 375 385 tr.t = t; // 376 386 tr.dtz = 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) 380 { 381 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 387 dt = candidate->ErrorT / c_light; 388 tr.dt2 = dt * dt + fVertexTimeSize * fVertexTimeSize; // the ~injected~ timing error plus a small minimum vertex size in time 389 if(fD0CutOff > 0) 390 { 391 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 387 396 } 388 397 else 389 398 { 390 tr.pi =1.;391 } 392 tr.tt =&(*candidate);393 tr.Z =1.;399 tr.pi = 1.; 400 } 401 tr.tt = &(*candidate); 402 tr.Z = 1.; 394 403 395 404 // TBC now putting track selection here (> fPTMin) … … 404 413 if(fVerbose) 405 414 { 406 std::cout <<" start processing vertices ..."<<std::endl;407 std::cout <<" Found "<<tks.size()<<" input tracks"<<std::endl;415 std::cout << " start processing vertices ..." << std::endl; 416 std::cout << " Found " << tks.size() << " input tracks" << std::endl; 408 417 //loop over input tracks 409 418 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 rejection424 425 if 419 for(std::vector<track_t>::const_iterator it = tks.begin(); it != tks.end(); it++) 420 { 421 double z = it->z; 422 double pt = it->pt; 423 double eta = it->eta; 424 double phi = it->phi; 425 double t = it->t; 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 rejection 433 434 if(tks.empty()) return clusters; 426 435 427 436 vector<vertex_t> y; // the vertex prototypes … … 429 438 // initialize:single vertex at infinite temperature 430 439 vertex_t vstart; 431 vstart.z =0.;432 vstart.t =0.;433 vstart.pk =1.;440 vstart.z = 0.; 441 vstart.t = 0.; 442 vstart.pk = 1.; 434 443 y.push_back(vstart); 435 int niter =0;// number of iterations444 int niter = 0; // number of iterations 436 445 437 446 // estimate first critical temperature 438 double beta=beta0(fBetaMax, tks, y, fCoolingFactor); 439 niter=0; while((update1(beta, tks,y)>1.e-6) && (niter++ < fMaxIterations)){ } 447 double beta = beta0(fBetaMax, tks, y, fCoolingFactor); 448 niter = 0; 449 while((update1(beta, tks, y) > 1.e-6) && (niter++ < fMaxIterations)) 450 { 451 } 440 452 441 453 // annealing loop, stop when T<Tmin (i.e. beta>1/Tmin) 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; 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; 451 470 splitAll(y); 452 471 } 453 472 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){ 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 { 460 482 // last round of splitting, make sure no critical clusters are left 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{ 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 { 471 501 // merge collapsed clusters 472 while(merge(y,beta)){update1(beta, tks,y);} 473 if(fVerbose ){ cout << "dump after 1st merging " << endl; dump(beta,y,tks);} 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 } 474 511 } 475 512 476 513 // switch on outlier rejection 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 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 } 481 528 482 529 // merge again (some cluster split by outliers collapse here) 483 while(merge(y)){} 484 if(fVerbose ){ cout << "dump after 2nd merging " << endl; dump(beta,y,tks);} 485 530 while(merge(y)) 531 { 532 } 533 if(fVerbose) 534 { 535 cout << "dump after 2nd merging " << endl; 536 dump(beta, y, tks); 537 } 486 538 487 539 // continue from freeze-out to Tstop (=1) without splitting, eliminate insignificant vertices 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 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 } 508 566 509 567 // select significant tracks and use a TransientVertex as a container … … 511 569 512 570 // ensure correct normalization of probabilities, should make double assginment reasonably impossible 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++){ 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 { 521 582 522 583 DelphesFactory *factory = GetFactory(); … … 532 593 double expv_x2 = 0.; 533 594 double normw = 0.; 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 ) ){ 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 { 539 603 //std::cout << "pushing back " << i << ' ' << tks[i].tt << std::endl; 540 604 //vertexTracks.push_back(*(tks[i].tt)); tks[i].Z=0; 541 605 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; 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; 547 612 } // setting Z=0 excludes double assignment 548 613 } 549 614 } 550 615 551 mean = mean /normw;552 expv_x2 = expv_x2 /normw;553 const double time_var = expv_x2 - mean *mean;616 mean = mean / normw; 617 expv_x2 = expv_x2 / normw; 618 const double time_var = expv_x2 - mean * mean; 554 619 const double crappy_error_guess = std::sqrt(time_var); 555 620 /*GlobalError dummyErrorWithTime(0, … … 559 624 //TransientVertex v(pos, time, dummyErrorWithTime, vertexTracks, 5); 560 625 561 562 candidate->ClusterIndex = clusterIndex++;;563 candidate->Position.SetXYZT(0.0, 0.0, z *10.0 , time*c_light);626 candidate->ClusterIndex = clusterIndex++; 627 ; 628 candidate->Position.SetXYZT(0.0, 0.0, z * 10.0, time * c_light); 564 629 565 630 // TBC - fill error later ... 566 candidate->PositionError.SetXYZT(0.0, 0.0, 0.0 , crappy_error_guess*c_light);631 candidate->PositionError.SetXYZT(0.0, 0.0, 0.0, crappy_error_guess * c_light); 567 632 568 633 clusterIndex++; … … 570 635 } 571 636 572 573 637 return clusters; 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; 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; 582 645 } 583 646 … … 588 651 // copy and sort for nicer printout 589 652 vector<track_t> tks; 590 for(vector<track_t>::const_iterator t=tks0.begin(); t!=tks0.end(); t++){tks.push_back(*t); } 653 for(vector<track_t>::const_iterator t = tks0.begin(); t != tks0.end(); t++) 654 { 655 tks.push_back(*t); 656 } 591 657 std::stable_sort(tks.begin(), tks.end(), recTrackLessZ1); 592 658 … … 595 661 cout << " z= "; 596 662 cout.precision(4); 597 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 663 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 664 { 598 665 //cout << setw(8) << fixed << k->z; 599 666 } 600 cout << endl << " t= "; 601 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 667 cout << endl 668 << " t= "; 669 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 670 { 602 671 //cout << setw(8) << fixed << k->t; 603 672 } 604 673 //cout << endl << "T=" << setw(15) << 1./beta <<" Tc= "; 605 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 674 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 675 { 606 676 //cout << setw(8) << fixed << k->Tc ; 607 677 } 608 678 609 cout << endl << " pk="; 610 double sumpk=0; 611 for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){ 679 cout << endl 680 << " pk="; 681 double sumpk = 0; 682 for(vector<vertex_t>::const_iterator k = y.begin(); k != y.end(); k++) 683 { 612 684 //cout << setw(8) << setprecision(3) << fixed << k->pk; 613 sumpk +=k->pk;614 } 615 cout 616 617 double E =0, F=0;685 sumpk += k->pk; 686 } 687 cout << endl; 688 689 double E = 0, F = 0; 618 690 cout << endl; 619 691 cout << "---- z +/- dz t +/- dt ip +/-dip pt phi eta weights ----" << endl; 620 692 cout.precision(4); 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; 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; 625 701 //cout << setw (3)<< i << ")" << setw (8) << fixed << setprecision(4)<< tz << " +/-" << setw (6)<< sqrt(tks[i].dz2) 626 702 // << setw(8) << fixed << setprecision(4) << tt << " +/-" << setw(6) << std::sqrt(tks[i].dt2) ; 627 703 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 } 643 } 644 cout << endl; 645 } 646 cout << endl << "T=" << 1/beta << " E=" << E << " n="<< y.size() << " F= " << F << endl << "----------" << endl; 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; 721 } 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; 647 732 } 648 733 … … 655 740 // returns the squared sum of changes of vertex positions 656 741 657 unsigned int nt =tks.size();742 unsigned int nt = tks.size(); 658 743 659 744 //initialize sums 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 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 } 666 755 667 756 // loop over tracks 668 for(unsigned int i=0; i<nt; i++){ 757 for(unsigned int i = 0; i < nt; i++) 758 { 669 759 670 760 // update pik and Zi 671 761 double Zi = 0.; 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; 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; 677 768 678 769 // normalization for pk 679 if (tks[i].Z>0){ 770 if(tks[i].Z > 0) 771 { 680 772 sumpi += tks[i].pi; 681 773 // accumulate weighted z and weights for vertex update 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; 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; 687 780 k->swt += w * tks[i].t; 688 k->swE += w * Eik(tks[i],*k); 689 } 690 }else{ 781 k->swE += w * Eik(tks[i], *k); 782 } 783 } 784 else 785 { 691 786 sumpi += tks[i].pi; 692 787 } 693 788 694 695 789 } // end of track loop 696 790 697 698 791 // now update z and pk 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{ 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 { 709 806 // cout << " a cluster melted away ? pk=" << k->pk << " sumw=" << k->sw << endl 710 k->Tc =-1;807 k->Tc = -1; 711 808 } 712 809 … … 725 822 // returns the squared sum of changes of vertex positions 726 823 727 unsigned int nt =tks.size();824 unsigned int nt = tks.size(); 728 825 729 826 //initialize sums 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 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 } 735 836 736 837 // loop over tracks 737 for(unsigned int i=0; i<nt; i++){ 838 for(unsigned int i = 0; i < nt; i++) 839 { 738 840 739 841 // update pik and Zi and Ti 740 double Zi = rho0 *std::exp(-beta*(dzCutOff*dzCutOff));// cut-off (eventually add finite size in time)842 double Zi = rho0 * std::exp(-beta * (dzCutOff * dzCutOff)); // cut-off (eventually add finite size in time) 741 843 //double Ti = 0.; // dt0*std::exp(-beta*fDtCutOff); 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; 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; 747 850 748 851 // normalization 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; 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; 756 861 k->swt += w * tks[i].t; 757 k->swE += w * Eik(tks[i],*k);862 k->swE += w * Eik(tks[i], *k); 758 863 } 759 864 } … … 762 867 763 868 // now update z 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{ 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 { 774 883 // cout << " a cluster melted away ? pk=" << k->pk << " sumw=" << k->sw << endl; 775 884 k->Tc = 0; 776 885 } 777 778 886 } 779 887 … … 788 896 // merge clusters that collapsed or never separated, return true if vertices were merged, false otherwise 789 897 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); 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); 802 914 } 803 915 k->pk = rho; 804 916 805 y.erase(k +1);917 y.erase(k + 1); 806 918 return true; 807 919 } … … 818 930 // only merge if the estimated critical temperature of the merged vertex is below the current temperature 819 931 // return true if vertices were merged, false otherwise 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; 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; 844 960 } 845 961 } … … 851 967 //------------------------------------------------------------------------------ 852 968 853 static bool purge(vector<vertex_t> &y, vector<track_t> &tks, double & 969 static bool purge(vector<vertex_t> &y, vector<track_t> &tks, double &rho0, const double beta, const double dzCutOff) 854 970 { 855 971 // eliminate clusters with only one significant/unique track 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++; } 870 } 871 } 872 873 if((nUnique<2)&&(sump<sumpmin)){ 874 sumpmin=sump; 875 k0=k; 876 } 877 } 878 879 if(k0!=y.end()){ 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 } 992 } 993 } 994 995 if((nUnique < 2) && (sump < sumpmin)) 996 { 997 sumpmin = sump; 998 k0 = k; 999 } 1000 } 1001 1002 if(k0 != y.end()) 1003 { 880 1004 //cout << "eliminating prototype at " << k0->z << "," << k0->t << " with sump=" << sumpmin << endl; 881 1005 //rho0+=k0->pk; 882 1006 y.erase(k0); 883 1007 return true; 884 }else{ 1008 } 1009 else 1010 { 885 1011 return false; 886 1012 } … … 892 1018 { 893 1019 894 double T0 =0;// max Tc for beta=01020 double T0 = 0; // max Tc for beta=0 895 1021 // estimate critical temperature from beta=0 (T=inf) 896 unsigned int nt=tks.size(); 897 898 for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ 1022 unsigned int nt = tks.size(); 1023 1024 for(vector<vertex_t>::iterator k = y.begin(); k != y.end(); k++) 1025 { 899 1026 900 1027 // vertex fit at T=inf 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; 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; 912 1040 913 1041 // estimate Tcrit, eventually do this in the same loop 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); 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); 920 1049 b += w; 921 1050 } 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{ 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 { 929 1061 // ensure at least one annealing step 930 return betamax /coolingFactor;1062 return betamax / coolingFactor; 931 1063 } 932 1064 } … … 946 1078 947 1079 std::vector<std::pair<double, unsigned int> > critical; 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; 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; 957 1092 // estimate subcluster positions and weight 958 double p1 =0, z1=0, t1=0, w1=0;959 double p2 =0, z2=0, t2=0, w2=0;1093 double p1 = 0, z1 = 0, t1 = 0, w1 = 0; 1094 double p2 = 0, z2 = 0, t2 = 0, w2 = 0; 960 1095 //double sumpi=0; 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 } 971 } 972 } 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;} 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 } 1117 } 1118 } 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 } 975 1139 976 1140 // reduce split size if there is not enough room 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); } 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 } 979 1151 980 1152 // split if the new subclusters are significantly separated 981 if( (z2-z1)>epsilon || std::abs(t2-t1) > epsilon){ 982 split=true; 1153 if((z2 - z1) > epsilon || std::abs(t2 - t1) > epsilon) 1154 { 1155 split = true; 983 1156 vertex_t vnew; 984 vnew.pk = p1 *y[ik].pk/(p1+p2);985 y[ik].pk = p2*y[ik].pk/(p1+p2);986 vnew.z 987 vnew.t 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; 988 1161 y[ik].z = z2; 989 1162 y[ik].t = t2; 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++;} 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 } 995 1172 } 996 1173 } … … 1006 1183 { 1007 1184 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 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 1012 1188 1013 1189 vector<vertex_t> y1; 1014 1190 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)) { 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 { 1017 1195 // isolated prototype, split 1018 1196 vertex_t vnew; 1019 vnew.z 1020 vnew.t 1021 (*k).z 1022 (*k).t 1023 vnew.pk = 0.5* (*k).pk;1024 (*k).pk = 0.5* (*k).pk;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; 1025 1203 y1.push_back(vnew); 1026 1204 y1.push_back(*k); 1027 1028 }else if( y1.empty() || (y1.back().z < k->z -zsep) || (y1.back().t < k->t - tsep) ){ 1205 } 1206 else if(y1.empty() || (y1.back().z < k->z - zsep) || (y1.back().t < k->t - tsep)) 1207 { 1029 1208 y1.push_back(*k); 1030 }else{ 1209 } 1210 else 1211 { 1031 1212 y1.back().z -= epsilon; 1032 1213 y1.back().t -= epsilon; … … 1035 1216 y1.push_back(*k); 1036 1217 } 1037 }// vertex loop 1038 1039 y=y1; 1040 } 1041 1042 1043 1218 } // vertex loop 1219 1220 y = y1; 1221 } -
modules/VertexFinderDA4D.h
re39abb4 r0e7d64a 9 9 * 10 10 */ 11 12 11 13 12 #include "classes/DelphesModule.h" … … 22 21 { 23 22 public: 24 25 23 VertexFinderDA4D(); 26 24 ~VertexFinderDA4D(); … … 31 29 32 30 void clusterize(const TObjArray &tracks, TObjArray &clusters); 33 std::vector< Candidate*> vertices();31 std::vector<Candidate *> vertices(); 34 32 35 33 private: 36 37 34 Bool_t fVerbose; 38 35 Double_t fMinPT; -
modules/VertexSorter.cc
re39abb4 r0e7d64a 16 16 #include "classes/DelphesPileUpReader.h" 17 17 18 #include "ExRootAnalysis/ExRootClassifier.h" 19 #include "ExRootAnalysis/ExRootFilter.h" 18 20 #include "ExRootAnalysis/ExRootResult.h" 19 #include "ExRootAnalysis/ExRootFilter.h" 20 #include "ExRootAnalysis/ExRootClassifier.h" 21 21 22 #include "TDatabasePDG.h" 23 #include "TFormula.h" 24 #include "TLorentzVector.h" 22 25 #include "TMath.h" 26 #include "TMatrixT.h" 27 #include "TObjArray.h" 28 #include "TRandom3.h" 23 29 #include "TString.h" 24 #include "TFormula.h"25 #include "TRandom3.h"26 #include "TObjArray.h"27 #include "TDatabasePDG.h"28 #include "TLorentzVector.h"29 #include "TMatrixT.h"30 30 #include "TVector3.h" 31 31 32 #include <algorithm> 33 #include <iostream> 34 #include <map> 35 #include <stdexcept> 36 #include <string> 32 37 #include <utility> 33 #include <algorithm>34 #include <stdexcept>35 #include <iostream>36 38 #include <vector> 37 #include <map>38 #include <string>39 39 40 40 using namespace std; 41 41 42 static const Double_t mm 43 static const Double_t m = 1000. *mm;44 static const Double_t ns 45 static const Double_t s = 1.e+9 * ns;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 73 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 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 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 127 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 135 136 137 138 139 while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next())))140 141 if (candidate->Momentum.Pt() < 1.0)142 143 if(candidate->ClusterIndex < 0)144 145 TLorentzVector p (candidate->Momentum.Px (), candidate->Momentum.Py (), candidate->Momentum.Pz (), candidate->Momentum.E());146 147 148 149 while((jetCandidate = static_cast<Candidate*>(fItJetInputArray->Next())))150 151 if (jetCandidate->Momentum.Pt() < 30.0)152 153 TLorentzVector q (jetCandidate->Momentum.Px (), jetCandidate->Momentum.Py (), jetCandidate->Momentum.Pz (), jetCandidate->Momentum.E());154 155 if (p.DeltaR(q) > 0.4)156 157 158 159 160 if(!isInJet)161 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 171 172 if(!fBeamSpotInputArray)173 174 175 176 177 if (!fBeamSpotInputArray->GetSize())178 179 180 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 192 193 194 while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next())))195 196 if(candidate->IsPU)197 198 for(itClusterIDToIndex = clusterIDToIndex.begin(); itClusterIDToIndex != clusterIDToIndex.end(); ++itClusterIDToIndex)199 200 if(candidate->ClusterIndex != itClusterIDToIndex->first)201 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 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 210 else 211 212 213 214 215 216 217 218 219 for 220 221 Candidate *cluster = (Candidate *) fInputArray->At (clusterIDToIndex.at(itSortedClusterIDs->first));222 if(fMethod == "BTV")223 224 else if(fMethod == "GenClosest")225 226 else if(fMethod == "GenBest")227 228 fOutputArray->Add(cluster);229 230 } 231 232 //------------------------------------------------------------------------------ 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 //------------------------------------------------------------------------------ -
modules/VertexSorter.h
re39abb4 r0e7d64a 23 23 { 24 24 public: 25 26 25 VertexSorter(); 27 26 ~VertexSorter(); … … 32 31 33 32 private: 34 35 33 TObjArray *fInputArray; 36 34 -
modules/Weighter.cc
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 /** \class Weighter 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 45 #include <algorithm> 47 #include <stdexcept>48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 53 52 //------------------------------------------------------------------------------ 54 53 55 bool Weighter::TIndexStruct::operator< 54 bool Weighter::TIndexStruct::operator<(const Weighter::TIndexStruct &value) const 56 55 { 57 56 Int_t i; … … 90 89 fWeightSet.clear(); 91 90 92 93 91 // set default weight value 94 92 fWeightMap.clear(); 95 memset(index.codes, 0, 4 *sizeof(Int_t));93 memset(index.codes, 0, 4 * sizeof(Int_t)); 96 94 fWeightMap[index] = 1.0; 97 95 … … 99 97 param = GetParam("Weight"); 100 98 size = param.GetSize(); 101 for(i = 0; i < size /2; ++i)99 for(i = 0; i < size / 2; ++i) 102 100 { 103 paramCodes = param[i *2];101 paramCodes = param[i * 2]; 104 102 sizeCodes = paramCodes.GetSize(); 105 weight = param[i *2 + 1].GetDouble();103 weight = param[i * 2 + 1].GetDouble(); 106 104 107 105 if(sizeCodes < 1 || sizeCodes > 4) … … 110 108 } 111 109 112 memset(index.codes, 0, 4 *sizeof(Int_t));110 memset(index.codes, 0, 4 * sizeof(Int_t)); 113 111 114 112 for(j = 0; j < sizeCodes; ++j) … … 157 155 fCodeSet.clear(); 158 156 fItInputArray->Reset(); 159 while((candidate = static_cast<Candidate *>(fItInputArray->Next())))157 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 160 158 { 161 159 if(candidate->Status != 3) continue; … … 167 165 168 166 // find default weight value 169 memset(index.codes, 0, 4 *sizeof(Int_t));167 memset(index.codes, 0, 4 * sizeof(Int_t)); 170 168 itWeightMap = fWeightMap.find(index); 171 169 weight = itWeightMap->second; -
modules/Weighter.h
re39abb4 r0e7d64a 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <map> 32 33 #include <set> 33 #include <map>34 34 35 35 class TObjArray; … … 38 38 { 39 39 public: 40 41 40 Weighter(); 42 41 ~Weighter(); … … 47 46 48 47 private: 49 50 48 #if !defined(__CINT__) && !defined(__CLING__) 51 49 struct TIndexStruct 52 50 { 53 51 Int_t codes[4]; 54 bool operator< 52 bool operator<(const TIndexStruct &value) const; 55 53 }; 56 54 -
readers/DelphesCMSFWLite.cpp
re39abb4 r0e7d64a 18 18 19 19 #include <algorithm> 20 #include <iostream> 21 #include <memory> 22 #include <sstream> 20 23 #include <stdexcept> 21 #include <iostream>22 #include <sstream>23 #include <memory>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h>29 28 #include <signal.h> 30 29 #include <stdio.h> 31 30 #include <stdlib.h> 31 32 #include "TApplication.h" 32 33 #include "TROOT.h" 33 #include "TApplication.h" 34 34 35 #include "TDatabasePDG.h" 35 36 #include "TFile.h" 37 #include "TLorentzVector.h" 36 38 #include "TObjArray.h" 39 #include "TParticlePDG.h" 37 40 #include "TStopwatch.h" 38 #include "TDatabasePDG.h" 39 #include "TParticlePDG.h" 40 #include "TLorentzVector.h" 41 42 #include "modules/Delphes.h" 43 #include "classes/DelphesStream.h" 41 44 42 #include "classes/DelphesClasses.h" 45 43 #include "classes/DelphesFactory.h" 46 44 #include "classes/DelphesStream.h" 45 #include "modules/Delphes.h" 46 47 #include "ExRootAnalysis/ExRootProgressBar.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 47 49 #include "ExRootAnalysis/ExRootTreeWriter.h" 48 #include "ExRootAnalysis/ExRootTreeBranch.h" 49 #include "ExRootAnalysis/ExRootProgressBar.h" 50 51 #include "FWCore/FWLite/interface/FWLiteEnabler.h" 50 52 51 #include "DataFormats/FWLite/interface/Event.h" 53 52 #include "DataFormats/FWLite/interface/Handle.h" 54 53 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 55 54 #include "DataFormats/PatCandidates/interface/PackedGenParticle.h" 55 #include "FWCore/FWLite/interface/FWLiteEnabler.h" 56 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" 56 57 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 57 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.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, "prunedGenParticles")).empty()))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(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); 176 x = particle.vx(); y = particle.vy(); z = particle.vz(); 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(); 177 183 178 184 candidate = factory->NewCandidate(); … … 196 202 197 203 pdgParticle = pdg->GetParticle(pid); 198 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;204 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 199 205 candidate->Mass = mass; 200 206 201 207 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 202 208 203 candidate->Position.SetXYZT(x *10.0, y*10.0, z*10.0, 0.0);209 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0); 204 210 205 211 allParticleOutputArray->Add(candidate); … … 232 238 pid = particle.pdgId(); 233 239 status = particle.status(); 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(); 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(); 236 248 237 249 candidate = factory->NewCandidate(); … … 255 267 256 268 pdgParticle = pdg->GetParticle(pid); 257 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;269 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 258 270 candidate->Mass = mass; 259 271 260 272 candidate->Momentum.SetPxPyPzE(px, py, pz, e); 261 273 262 candidate->Position.SetXYZT(x *10.0, y*10.0, z*10.0, 0.0);274 candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0); 263 275 264 276 allParticleOutputArray->Add(candidate); … … 303 315 if(argc < 4) 304 316 { 305 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 317 cout << " Usage: " << appName << " config_file" 318 << " output_file" 319 << " input_file(s)" << endl; 306 320 cout << " config_file - configuration file in Tcl format," << endl; 307 321 cout << " output_file - output file in ROOT format," << endl; -
readers/DelphesHepMC.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h" 27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h" 32 #include "TParticlePDG.h" 33 #include "TLorentzVector.h" 34 35 #include "modules/Delphes.h" 34 36 35 #include "classes/DelphesClasses.h" 37 36 #include "classes/DelphesFactory.h" 38 37 #include "classes/DelphesHepMCReader.h" 39 38 #include "modules/Delphes.h" 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 77 79 cout << " config_file - configuration file in Tcl format," << endl; 78 80 cout << " output_file - output file in ROOT format," << endl; … … 178 180 reader->Clear(); 179 181 readStopWatch.Start(); 180 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 181 reader->ReadBlock(factory, allParticleOutputArray, 182 stableParticleOutputArray, partonOutputArray) && !interrupted) 182 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 183 183 { 184 184 if(reader->EventReady()) … … 217 217 218 218 ++i; 219 } 220 while(i < argc); 219 } while(i < argc); 221 220 222 221 modularDelphes->FinishTask(); -
readers/DelphesLHEF.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h" 27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h" 32 #include "TParticlePDG.h" 33 #include "TLorentzVector.h" 34 35 #include "modules/Delphes.h" 34 36 35 #include "classes/DelphesClasses.h" 37 36 #include "classes/DelphesFactory.h" 38 37 #include "classes/DelphesLHEFReader.h" 39 38 #include "modules/Delphes.h" 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 77 79 cout << " config_file - configuration file in Tcl format," << endl; 78 80 cout << " output_file - output file in ROOT format," << endl; … … 178 180 reader->Clear(); 179 181 readStopWatch.Start(); 180 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 181 reader->ReadBlock(factory, allParticleOutputArray, 182 stableParticleOutputArray, partonOutputArray) && !interrupted) 182 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 183 183 { 184 184 if(reader->EventReady()) … … 218 218 219 219 ++i; 220 } 221 while(i < argc); 220 } while(i < argc); 222 221 223 222 modularDelphes->FinishTask(); -
readers/DelphesProIO.cpp
re39abb4 r0e7d64a 18 18 */ 19 19 20 #include <iostream> 21 #include <memory> 22 #include <sstream> 20 23 #include <stdexcept> 21 #include <iostream>22 #include <sstream>23 #include <memory>24 24 25 25 #include <map> 26 26 27 #include <stdlib.h>28 27 #include <signal.h> 29 28 #include <stdio.h> 30 29 #include <stdlib.h> 30 31 #include "TApplication.h" 31 32 #include "TROOT.h" 32 #include "TApplication.h" 33 33 34 #include "TDatabasePDG.h" 34 35 #include "TFile.h" 36 #include "TLorentzVector.h" 35 37 #include "TObjArray.h" 38 #include "TParticlePDG.h" 36 39 #include "TStopwatch.h" 37 #include "TDatabasePDG.h" 38 #include "TParticlePDG.h" 39 #include "TLorentzVector.h" 40 41 #include "modules/Delphes.h" 42 #include "classes/DelphesStream.h" 40 43 41 #include "classes/DelphesClasses.h" 44 42 #include "classes/DelphesFactory.h" 45 43 #include "classes/DelphesStream.h" 44 #include "modules/Delphes.h" 45 46 #include "ExRootAnalysis/ExRootProgressBar.h" 47 #include "ExRootAnalysis/ExRootTreeBranch.h" 46 48 #include "ExRootAnalysis/ExRootTreeWriter.h" 47 #include "ExRootAnalysis/ExRootTreeBranch.h" 48 #include "ExRootAnalysis/ExRootProgressBar.h" 49 50 #include <proio/reader.h> 49 51 50 #include <proio/event.h> 52 51 #include <proio/model/mc.pb.h> 53 namespace model=proio::model::mc; 54 52 #include <proio/reader.h> 53 namespace model = proio::model::mc; 55 54 56 55 using namespace std; … … 59 58 // This method dynamically checks the message type (varint or not) depending on 60 59 // non-zero value of units momentumUnit and positionUnit. 61 void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 60 void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 62 61 ExRootTreeBranch *branch, DelphesFactory *factory, 63 62 TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, … … 80 79 element = static_cast<HepMCEvent *>(branch->NewEntry()); 81 80 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 }; 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 }; 93 93 94 94 element->Number = nID; 95 element->ProcessID = process_id;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 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) 116 if(momentumUnit > 0 && positionUnit > 0) 117 { 118 119 auto entries = event->TaggedEntries("VarintPackedParticles"); 120 121 for(uint64_t entryID : entries) 158 122 { 159 stableParticleOutputArray->Add(candidate); 160 } 161 else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) 162 { 163 partonOutputArray->Add(candidate); 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 } 164 } 164 165 } 165 166 } 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 } 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 } 205 251 } 206 252 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 }; 220 } 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 253 } // end particle type 254 254 } 255 255 … … 283 283 if(argc < 4) 284 284 { 285 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 285 cout << " Usage: " << appName << " config_file" 286 << " output_file" 287 << " input_file(s)" << endl; 286 288 cout << " config_file - configuration file in Tcl format," << endl; 287 289 cout << " output_file - output file in ROOT format," << endl; … … 330 332 cout << "** INFO: Reading " << argv[i] << endl; 331 333 332 inputFile =new proio::Reader( argv[i]);334 inputFile = new proio::Reader(argv[i]); 333 335 334 336 if(inputFile == NULL) … … 338 340 } 339 341 340 341 /* 342 /* 342 343 // this is slow method, but general 343 344 inputFile->SeekToStart(); … … 350 351 */ 351 352 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 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); 370 367 371 368 // Loop over all objects … … 376 373 for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter) 377 374 { 378 inputFile->Next(event); 375 inputFile->Next(event); 379 376 if(event == 0) continue; 380 377 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 } 392 } 393 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 } 391 } 394 392 395 393 readStopWatch.Stop(); … … 397 395 procStopWatch.Start(); 398 396 399 ConvertInput(event, varint_energy, varint_length, 397 ConvertInput(event, varint_energy, varint_length, 400 398 branchEvent, factory, 401 399 allParticleOutputArray, stableParticleOutputArray, 402 400 partonOutputArray, &readStopWatch, &procStopWatch); 403 401 404 402 modularDelphes->ProcessTask(); 405 403 procStopWatch.Stop(); … … 414 412 } 415 413 416 417 414 progressBar.Update(eventCounter, eventCounter, kTRUE); 418 415 progressBar.Finish(); … … 420 417 delete inputFile; 421 418 } 422 423 419 424 420 modularDelphes->FinishTask(); -
readers/DelphesProMC.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <iostream> 20 #include <memory> 21 #include <sstream> 19 22 #include <stdexcept> 20 #include <iostream>21 #include <sstream>22 #include <memory>23 23 24 24 #include <map> 25 25 26 #include <stdlib.h>27 26 #include <signal.h> 28 27 #include <stdio.h> 29 28 #include <stdlib.h> 29 30 #include "TApplication.h" 30 31 #include "TROOT.h" 31 #include "TApplication.h" 32 32 33 #include "TDatabasePDG.h" 33 34 #include "TFile.h" 35 #include "TLorentzVector.h" 34 36 #include "TObjArray.h" 37 #include "TParticlePDG.h" 35 38 #include "TStopwatch.h" 36 #include "TDatabasePDG.h" 37 #include "TParticlePDG.h" 38 #include "TLorentzVector.h" 39 40 #include "modules/Delphes.h" 41 #include "classes/DelphesStream.h" 39 42 40 #include "classes/DelphesClasses.h" 43 41 #include "classes/DelphesFactory.h" 44 42 #include "classes/DelphesStream.h" 43 #include "modules/Delphes.h" 44 45 #include "ExRootAnalysis/ExRootProgressBar.h" 46 #include "ExRootAnalysis/ExRootTreeBranch.h" 45 47 #include "ExRootAnalysis/ExRootTreeWriter.h" 46 #include "ExRootAnalysis/ExRootTreeBranch.h"47 #include "ExRootAnalysis/ExRootProgressBar.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 particle 129 127 130 candidate->M1 = mutableParticles->mother1(i); 128 131 candidate->M2 = mutableParticles->mother2(i); … … 132 135 133 136 pdgParticle = pdg->GetParticle(pid); 134 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;137 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 135 138 candidate->Mass = mass; 136 139 … … 184 187 if(argc < 4) 185 188 { 186 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 189 cout << " Usage: " << appName << " config_file" 190 << " output_file" 191 << " input_file(s)" << endl; 187 192 cout << " config_file - configuration file in Tcl format," << endl; 188 193 cout << " output_file - output file in ROOT format," << endl; … … 231 236 cout << "** Reading " << argv[i] << endl; 232 237 238 // use 64 bit 239 //inputFile = new ProMCBook(argv[i], "r", true); 240 241 //use 32 bit zip (faster but limitted to 64k events) 233 242 inputFile = new ProMCBook(argv[i], "r"); 234 243 … … 237 246 momentumUnit = static_cast<double>(header.momentumunit()); 238 247 positionUnit = static_cast<double>(header.lengthunit()); 239 240 241 248 242 249 if(inputFile == NULL) -
readers/DelphesPythia8.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 #include <string> 23 23 … … 27 27 #include "Pythia8Plugins/CombineMatchingInput.h" 28 28 29 #include "TApplication.h" 29 30 #include "TROOT.h" 30 #include "TApplication.h" 31 31 32 #include "TDatabasePDG.h" 32 33 #include "TFile.h" 34 #include "TLorentzVector.h" 33 35 #include "TObjArray.h" 36 #include "TParticlePDG.h" 34 37 #include "TStopwatch.h" 35 #include "TDatabasePDG.h" 36 #include "TParticlePDG.h" 37 #include "TLorentzVector.h" 38 39 #include "modules/Delphes.h" 38 40 39 #include "classes/DelphesClasses.h" 41 40 #include "classes/DelphesFactory.h" 42 41 #include "classes/DelphesLHEFReader.h" 43 42 #include "modules/Delphes.h" 43 44 #include "ExRootAnalysis/ExRootProgressBar.h" 45 #include "ExRootAnalysis/ExRootTreeBranch.h" 44 46 #include "ExRootAnalysis/ExRootTreeWriter.h" 45 #include "ExRootAnalysis/ExRootTreeBranch.h"46 #include "ExRootAnalysis/ExRootProgressBar.h"47 47 48 48 using namespace std; … … 98 98 pid = particle.id(); 99 99 status = particle.statusHepMC(); 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(); 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(); 102 109 103 110 candidate = factory->NewCandidate(); … … 115 122 116 123 pdgParticle = pdg->GetParticle(pid); 117 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() /3.0) : -999;124 candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999; 118 125 candidate->Mass = mass; 119 126 … … 166 173 167 174 // pMin = 0.1 GeV for single particles 168 pp = pow(10, - 175 pp = pow(10, -1.0 + (log10(pMax) + 1.0) * rndm.flat()); 169 176 eta = (2.0 * rndm.flat() - 1.0) * etaMax; 170 177 phi = 2.0 * M_PI * rndm.flat(); 171 178 mm = pdt.mSel(id); 172 ee = Pythia8::sqrtpos(pp *pp + mm*mm);179 ee = Pythia8::sqrtpos(pp * pp + mm * mm); 173 180 pt = pp / cosh(eta); 174 181 … … 193 200 phi = 2.0 * M_PI * rndm.flat(); 194 201 mm = pdt.mSel(id); 195 ee = Pythia8::sqrtpos(pp *pp + mm*mm);202 ee = Pythia8::sqrtpos(pp * pp + mm * mm); 196 203 pt = pp / cosh(eta); 197 204 198 if( 205 if((id == 4 || id == 5) && pt < 10.0) return; 199 206 200 207 if(id == 21) … … 238 245 // for matching 239 246 Pythia8::CombineMatchingInput *combined = 0; 240 Pythia8::UserHooks *matching = 0;247 Pythia8::UserHooks *matching = 0; 241 248 242 249 if(argc != 4) 243 250 { 244 cout << " Usage: " << appName << " config_file" << " pythia_card" << " output_file" << endl; 251 cout << " Usage: " << appName << " config_file" 252 << " pythia_card" 253 << " output_file" << endl; 245 254 cout << " config_file - configuration file in Tcl format," << endl; 246 255 cout << " pythia_card - Pythia8 configuration file," << endl; … … 293 302 } 294 303 pythia->setUserHooksPtr(matching); 295 296 304 297 305 if(pythia == NULL) … … 348 356 for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter) 349 357 { 350 while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF, 351 stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady());358 while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF, stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady()) 359 ; 352 360 353 361 if(spareFlag1) -
readers/DelphesROOT.cpp
re39abb4 r0e7d64a 18 18 19 19 #include <algorithm> 20 #include <iostream> 21 #include <memory> 22 #include <sstream> 20 23 #include <stdexcept> 21 #include <iostream>22 #include <sstream>23 #include <memory>24 24 25 25 #include <map> 26 26 #include <vector> 27 27 28 #include <stdlib.h>29 28 #include <signal.h> 30 29 #include <stdio.h> 31 30 #include <stdlib.h> 31 32 #include "TApplication.h" 32 33 #include "TROOT.h" 33 #include "TApplication.h" 34 34 35 #include "TClonesArray.h" 36 #include "TDatabasePDG.h" 35 37 #include "TFile.h" 36 #include "T ClonesArray.h"38 #include "TLorentzVector.h" 37 39 #include "TObjArray.h" 40 #include "TParticlePDG.h" 38 41 #include "TStopwatch.h" 39 #include "TDatabasePDG.h" 40 #include "TParticlePDG.h" 41 #include "TLorentzVector.h" 42 43 #include "modules/Delphes.h" 44 #include "classes/DelphesStream.h" 42 45 43 #include "classes/DelphesClasses.h" 46 44 #include "classes/DelphesFactory.h" 47 45 #include "classes/DelphesStream.h" 46 #include "modules/Delphes.h" 47 48 #include "ExRootAnalysis/ExRootProgressBar.h" 49 #include "ExRootAnalysis/ExRootTreeBranch.h" 50 #include "ExRootAnalysis/ExRootTreeReader.h" 48 51 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 #include "ExRootAnalysis/ExRootTreeReader.h"50 #include "ExRootAnalysis/ExRootTreeBranch.h"51 #include "ExRootAnalysis/ExRootProgressBar.h"52 53 54 52 55 53 using namespace std; 56 54 57 55 //--------------------------------------------------------------------------- 58 59 56 60 57 //--------------------------------------------------------------------------- … … 94 91 if(argc < 4) 95 92 { 96 cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl; 93 cout << " Usage: " << appName << " config_file" 94 << " output_file" 95 << " input_file(s)" << endl; 97 96 cout << " config_file - configuration file in Tcl format," << endl; 98 97 cout << " output_file - output file in ROOT format," << endl; … … 122 121 123 122 branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class()); 124 123 125 124 confReader = new ExRootConfReader; 126 125 confReader->ReadFile(argv[1]); … … 129 128 modularDelphes->SetConfReader(confReader); 130 129 modularDelphes->SetTreeWriter(treeWriter); 131 130 132 131 TChain *chain = new TChain("Delphes"); 133 132 134 133 factory = modularDelphes->GetFactory(); 135 134 allParticleOutputArray = modularDelphes->ExportArray("allParticles"); … … 145 144 chain->Add(argv[i]); 146 145 ExRootTreeReader *treeReader = new ExRootTreeReader(chain); 147 146 148 147 inputFile = TFile::Open(argv[i]); 149 148 … … 153 152 throw runtime_error(message.str()); 154 153 } 155 154 156 155 numberOfEvents = treeReader->GetEntries(); 157 TClonesArray *branchParticle 156 TClonesArray *branchParticle = treeReader->UseBranch("Particle"); 158 157 TClonesArray *branchHepMCEvent = treeReader->UseBranch("Event"); 159 158 160 159 if(numberOfEvents <= 0) continue; 161 160 … … 169 168 for(Int_t entry = 0; entry < numberOfEvents && !interrupted; ++entry) 170 169 { 171 170 172 171 treeReader->ReadEntry(entry); 173 172 174 // -- TBC need also to include event weights -- 175 176 eve = (HepMCEvent *)branchHepMCEvent->At(0);173 // -- TBC need also to include event weights -- 174 175 eve = (HepMCEvent *)branchHepMCEvent->At(0); 177 176 element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); 178 177 179 178 element->Number = eventCounter; 180 179 … … 197 196 element->ProcTime = eve->ProcTime; 198 197 199 for(Int_t j =0; j < branchParticle->GetEntriesFast(); j++)200 { 201 202 gen = (GenParticle *) branchParticle->At(j);198 for(Int_t j = 0; j < branchParticle->GetEntriesFast(); j++) 199 { 200 201 gen = (GenParticle *)branchParticle->At(j); 203 202 candidate = factory->NewCandidate(); 204 203 205 204 candidate->Momentum = gen->P4(); 206 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T *1.0E3*c_light);207 205 candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T * 1.0E3 * c_light); 206 208 207 candidate->PID = gen->PID; 209 208 candidate->Status = gen->Status; 210 209 211 210 candidate->M1 = gen->M1; 212 211 candidate->M2 = gen->M2; … … 216 215 217 216 candidate->Charge = gen->Charge; 218 candidate->Mass 219 217 candidate->Mass = gen->Mass; 218 220 219 allParticleOutputArray->Add(candidate); 221 220 222 221 pdgCode = TMath::Abs(gen->PID); 223 222 … … 231 230 } 232 231 } 233 232 234 233 modularDelphes->ProcessTask(); 235 234 … … 242 241 ++eventCounter; 243 242 } 244 243 245 244 progressBar.Update(eventCounter, eventCounter, kTRUE); 246 245 progressBar.Finish(); 247 246 248 247 inputFile->Close(); 249 248 250 249 delete treeReader; 251 252 250 } 253 251 … … 262 260 delete outputFile; 263 261 delete chain; 264 262 265 263 return 0; 266 264 } -
readers/DelphesSTDHEP.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 #include <stdexcept>20 19 #include <iostream> 21 20 #include <sstream> 21 #include <stdexcept> 22 22 23 23 #include <signal.h> 24 24 25 #include "TApplication.h" 25 26 #include "TROOT.h" 26 #include "TApplication.h" 27 27 28 #include "TDatabasePDG.h" 28 29 #include "TFile.h" 30 #include "TLorentzVector.h" 29 31 #include "TObjArray.h" 32 #include "TParticlePDG.h" 30 33 #include "TStopwatch.h" 31 #include "TDatabasePDG.h" 32 #include "TParticlePDG.h" 33 #include "TLorentzVector.h" 34 35 #include "modules/Delphes.h" 34 36 35 #include "classes/DelphesClasses.h" 37 36 #include "classes/DelphesFactory.h" 38 37 #include "classes/DelphesSTDHEPReader.h" 39 38 #include "modules/Delphes.h" 39 40 #include "ExRootAnalysis/ExRootProgressBar.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h" 40 42 #include "ExRootAnalysis/ExRootTreeWriter.h" 41 #include "ExRootAnalysis/ExRootTreeBranch.h"42 #include "ExRootAnalysis/ExRootProgressBar.h"43 43 44 44 using namespace std; … … 74 74 if(argc < 3) 75 75 { 76 cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl; 76 cout << " Usage: " << appName << " config_file" 77 << " output_file" 78 << " [input_file(s)]" << endl; 77 79 cout << " config_file - configuration file in Tcl format," << endl; 78 80 cout << " output_file - output file in ROOT format," << endl; … … 177 179 reader->Clear(); 178 180 readStopWatch.Start(); 179 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && 180 reader->ReadBlock(factory, allParticleOutputArray, 181 stableParticleOutputArray, partonOutputArray) && !interrupted) 181 while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted) 182 182 { 183 183 if(reader->EventReady()) … … 215 215 216 216 ++i; 217 } 218 while(i < argc); 217 } while(i < argc); 219 218 220 219 modularDelphes->FinishTask(); -
validation/DelphesValidation.cpp
re39abb4 r0e7d64a 17 17 */ 18 18 19 20 19 #include <iostream> 20 #include <typeinfo> 21 21 #include <utility> 22 22 #include <vector> 23 #include <typeinfo> 24 23 24 #include "TApplication.h" 25 25 #include "TROOT.h" 26 26 #include "TSystem.h" 27 #include "TApplication.h"28 27 29 28 #include "TString.h" 30 29 30 #include "TCanvas.h" 31 #include "TClonesArray.h" 32 #include "TGraph.h" 33 #include "TGraphErrors.h" 31 34 #include "TH1.h" 32 35 #include "TH2.h" 33 #include "TMath.h"34 #include "TStyle.h"35 #include "TGraph.h"36 #include "TCanvas.h"37 36 #include "THStack.h" 38 37 #include "TLegend.h" 38 #include "TLorentzVector.h" 39 #include "TMath.h" 40 #include "TMultiGraph.h" 39 41 #include "TPaveText.h" 40 #include "TClonesArray.h" 41 #include "TLorentzVector.h" 42 #include "TGraphErrors.h" 43 #include "TMultiGraph.h" 42 #include "TStyle.h" 44 43 45 44 #include "classes/DelphesClasses.h" 46 45 46 #include "ExRootAnalysis/ExRootResult.h" 47 #include "ExRootAnalysis/ExRootTreeBranch.h" 47 48 #include "ExRootAnalysis/ExRootTreeReader.h" 48 49 #include "ExRootAnalysis/ExRootTreeWriter.h" 49 #include "ExRootAnalysis/ExRootTreeBranch.h"50 #include "ExRootAnalysis/ExRootResult.h"51 50 #include "ExRootAnalysis/ExRootUtilities.h" 52 51 … … 82 81 unsigned int k; 83 82 84 85 83 struct resolPlot 86 84 { 87 TH1 *resolHist;85 TH1 *resolHist; 88 86 double ptmin; 89 87 double ptmax; … … 99 97 void set(double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2); 100 98 void set(double etadown, double etaup, double ptdown, double ptup, TString object, double xmin = 0, double xmax = 2); 101 void print() {std::cout << ptmin << std::endl;}99 void print() { std::cout << ptmin << std::endl; } 102 100 }; 103 104 101 105 102 resolPlot::resolPlot() … … 109 106 resolPlot::resolPlot(double ptdown, double ptup, TString object) 110 107 { 111 this->set(ptdown, ptup,object);108 this->set(ptdown, ptup, object); 112 109 } 113 110 … … 123 120 obj = object; 124 121 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);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); 126 123 } 127 124 … … 134 131 obj = object; 135 132 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);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); 137 134 } 138 139 140 135 141 136 void HistogramsCollection(std::vector<resolPlot> *histos, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2) … … 146 141 resolPlot ptemp; 147 142 148 for 143 for(int i = 0; i < Nbins; i++) 149 144 { 150 145 width = (ptmax - ptmin) / Nbins; 151 ptdown = TMath::Power(10, ptmin + i * width);152 ptup = TMath::Power(10, ptmin + (i+1) * width);146 ptdown = TMath::Power(10, ptmin + i * width); 147 ptup = TMath::Power(10, ptmin + (i + 1) * width); 153 148 ptemp.set(ptdown, ptup, obj, xmin, xmax); 154 149 histos->push_back(ptemp); 155 150 } 156 151 } 157 158 152 159 153 void HistogramsCollectionVsEta(std::vector<resolPlot> *histos, double etamin, double etamax, double ptmin, double ptmax, TString obj, double xmin = 0, double xmax = 2) … … 164 158 double etaup; 165 159 166 for 160 for(int i = 0; i < Nbins; i++) 167 161 { 168 162 width = (etamax - etamin) / Nbins; 169 163 etadown = etamin + i * width; 170 etaup = etamin + (i +1) * width;164 etaup = etamin + (i + 1) * width; 171 165 172 166 ptemp.set(etadown, etaup, ptmin, ptmax, obj, xmin, xmax); … … 175 169 } 176 170 177 178 171 //------------------------------------------------------------------------------ 179 172 … … 183 176 //------------------------------------------------------------------------------ 184 177 185 void BinLogX(TH1 *h)178 void BinLogX(TH1 *h) 186 179 { 187 180 TAxis *axis = h->GetXaxis(); … … 193 186 Axis_t *new_bins = new Axis_t[bins + 1]; 194 187 195 for 188 for(int i = 0; i <= bins; i++) 196 189 { 197 190 new_bins[i] = TMath::Power(10, from + i * width); … … 201 194 } 202 195 203 204 196 //------------------------------------------------------------------------------ 205 197 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)198 template <typename T> 199 TH1D *GetEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 208 200 { 209 201 210 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;202 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 211 203 212 204 Long64_t allEntries = treeReader->GetEntries(); … … 223 215 Int_t i, j; 224 216 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));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)); 227 219 228 220 histGenPt->SetDirectory(0); … … 242 234 { 243 235 244 particle = (GenParticle *)branchParticle->At(i);236 particle = (GenParticle *)branchParticle->At(i); 245 237 genMomentum = particle->P4(); 246 238 247 239 deltaR = 999; 248 240 249 pt 241 pt = genMomentum.Pt(); 250 242 eta = TMath::Abs(genMomentum.Eta()); 251 243 252 253 if(eta > etamax || eta < etamin ) continue; 254 255 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 244 if(eta > etamax || eta < etamin) continue; 245 246 if(particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax) 256 247 //if (TMath::Abs(particle->PID) == pdgID && (particle->Status>20 && particle->Status <30) && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 257 248 { … … 259 250 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 260 251 { 261 recoObj = (T *)branchReco->At(j);252 recoObj = (T *)branchReco->At(j); 262 253 recoMomentum = recoObj->P4(); 263 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 264 265 254 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 266 255 267 256 // take the closest parton candidate … … 269 258 { 270 259 Jet *jet = (Jet *)recoObj; 271 if( !(jet->BTag & (1 << 0))) continue;260 if(!(jet->BTag & (1 << 0))) continue; 272 261 273 262 //if(jet->BTag != ) continue; 274 263 } 275 264 276 265 if(TMath::Abs(pdgID) == 4) 277 266 { 278 267 Jet *jet = (Jet *)recoObj; 279 if( !(jet->BTag & (1 << 0))) continue;268 if(!(jet->BTag & (1 << 0))) continue; 280 269 } 281 270 282 271 if(TMath::Abs(pdgID) == 1) 283 272 { 284 273 Jet *jet = (Jet *)recoObj; 285 if( !(jet->BTag & (1 << 0))) continue;274 if(!(jet->BTag & (1 << 0))) continue; 286 275 } 287 276 … … 291 280 if(jet->TauTag != 1) continue; 292 281 } 293 294 282 295 283 if(genMomentum.DeltaR(recoMomentum) < deltaR) … … 300 288 } 301 289 histGenPt->Fill(pt); 302 if(deltaR < 0.3 && bestRecoMomentum.Pt()> 0.20*pt ) { histRecoPt->Fill(pt);} 303 290 if(deltaR < 0.3 && bestRecoMomentum.Pt() > 0.20 * pt) 291 { 292 histRecoPt->Fill(pt); 293 } 304 294 } 305 295 } … … 315 305 } 316 306 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) 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) 320 309 { 321 310 322 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;311 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 323 312 324 313 Long64_t allEntries = treeReader->GetEntries(); … … 335 324 Int_t i, j; 336 325 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);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); 339 328 340 329 histGenEta->SetDirectory(0); … … 351 340 { 352 341 353 particle = (GenParticle *)branchParticle->At(i);342 particle = (GenParticle *)branchParticle->At(i); 354 343 genMomentum = particle->P4(); 355 344 356 345 deltaR = 999; 357 346 358 pt 347 pt = genMomentum.Pt(); 359 348 eta = genMomentum.Eta(); 360 349 361 if(pt > ptmax || pt < ptmin 362 363 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)350 if(pt > ptmax || pt < ptmin) continue; 351 352 if(particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax) 364 353 //if (TMath::Abs(particle->PID) == pdgID && (particle->Status>20 && particle->Status <30) && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax ) 365 354 { … … 367 356 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 368 357 { 369 recoObj = (T *)branchReco->At(j);358 recoObj = (T *)branchReco->At(j); 370 359 recoMomentum = recoObj->P4(); 371 360 // this is simply to avoid warnings from initial state particle 372 361 // having infite rapidity ... 373 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;362 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 374 363 375 364 // take the closest parton candidate … … 377 366 { 378 367 Jet *jet = (Jet *)recoObj; 379 if( !(jet->BTag & (1 << 0)) ) continue; 380 368 if(!(jet->BTag & (1 << 0))) continue; 381 369 } 382 370 … … 384 372 { 385 373 Jet *jet = (Jet *)recoObj; 386 if( !(jet->BTag & (1 << 0))) continue;374 if(!(jet->BTag & (1 << 0))) continue; 387 375 } 388 376 389 377 if(TMath::Abs(pdgID) == 1) 390 378 { 391 379 Jet *jet = (Jet *)recoObj; 392 if( !(jet->BTag & (1 << 0))) continue;380 if(!(jet->BTag & (1 << 0))) continue; 393 381 } 394 382 … … 406 394 407 395 histGenEta->Fill(eta); 408 if(deltaR < 0.3) { histRecoEta->Fill(eta); } 409 396 if(deltaR < 0.3) 397 { 398 histRecoEta->Fill(eta); 399 } 410 400 } 411 401 } … … 421 411 } 422 412 423 424 413 //------------------------------------------------------------------------------ 425 414 426 template <typename T>427 TH1D *GetJetEffPt(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)415 template <typename T> 416 TH1D *GetJetEffPt(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 428 417 { 429 418 430 cout << "** Computing Efficiency of reconstructing " << branchJet->GetName() << " with PID " << pdgID << endl;419 cout << "** Computing Efficiency of reconstructing " << branchJet->GetName() << " with PID " << pdgID << endl; 431 420 432 421 Long64_t allEntries = treeReader->GetEntries(); … … 441 430 Int_t j; 442 431 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));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)); 445 434 446 435 histGenPt->SetDirectory(0); … … 459 448 for(j = 0; j < branchJet->GetEntriesFast(); ++j) 460 449 { 461 recoObj = (T *)branchJet->At(j);450 recoObj = (T *)branchJet->At(j); 462 451 recoMomentum = recoObj->P4(); 463 pt = recoMomentum.Pt();452 pt = recoMomentum.Pt(); 464 453 eta = TMath::Abs(recoMomentum.Eta()); 465 454 Jet *jet = (Jet *)recoObj; 466 467 if(eta > etamax || eta < etamin 455 456 if(eta > etamax || eta < etamin) continue; 468 457 if(pt < ptmin || pt > ptmax) continue; 469 458 470 459 Int_t flavor = jet->Flavor; 471 460 if(flavor == 21) flavor = 0; 472 461 473 462 if(TMath::Abs(pdgID) == 1) 474 463 { 475 464 476 465 if(flavor < 4) 477 466 { 478 467 histGenPt->Fill(pt); 479 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);468 if(jet->BTag & (1 << 0)) histRecoPt->Fill(pt); 480 469 } 481 470 } … … 485 474 { 486 475 histGenPt->Fill(pt); 487 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);476 if(jet->BTag & (1 << 0)) histRecoPt->Fill(pt); 488 477 } 489 478 } … … 493 482 { 494 483 histGenPt->Fill(pt); 495 if( jet->BTag & (1 << 0)) histRecoPt->Fill(pt);484 if(jet->BTag & (1 << 0)) histRecoPt->Fill(pt); 496 485 } 497 486 } 498 } 499 487 } 500 488 } 501 489 … … 511 499 // ------------------------------------------------------------------------------------------------------------------------------------------------------ 512 500 513 template <typename T>514 TH1D *GetJetEffEta(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader)501 template <typename T> 502 TH1D *GetJetEffEta(TClonesArray *branchJet, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 515 503 { 516 504 517 cout << "** Computing Efficiency of reconstructing " << branchJet->GetName() << " with PID " << pdgID << endl;505 cout << "** Computing Efficiency of reconstructing " << branchJet->GetName() << " with PID " << pdgID << endl; 518 506 519 507 Long64_t allEntries = treeReader->GetEntries(); … … 528 516 Int_t j; 529 517 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);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); 532 520 533 521 histGenEta->SetDirectory(0); … … 542 530 for(j = 0; j < branchJet->GetEntriesFast(); ++j) 543 531 { 544 recoObj = (T *)branchJet->At(j);532 recoObj = (T *)branchJet->At(j); 545 533 recoMomentum = recoObj->P4(); 546 pt = recoMomentum.Pt();534 pt = recoMomentum.Pt(); 547 535 eta = recoMomentum.Eta(); 548 536 Jet *jet = (Jet *)recoObj; 549 550 if(eta > etamax || eta < etamin 537 538 if(eta > etamax || eta < etamin) continue; 551 539 if(pt < ptmin || pt > ptmax) continue; 552 540 553 541 Int_t flavor = jet->Flavor; 554 542 if(flavor == 21) flavor = 0; 555 543 556 544 if(TMath::Abs(pdgID) == 1) 557 545 { 558 if(flavor 546 if(flavor == 1 || flavor == 21) 559 547 { 560 548 histGenEta->Fill(eta); 561 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);549 if(jet->BTag & (1 << 0)) histRecoEta->Fill(eta); 562 550 } 563 551 } … … 567 555 { 568 556 histGenEta->Fill(eta); 569 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);557 if(jet->BTag & (1 << 0)) histRecoEta->Fill(eta); 570 558 } 571 559 } … … 575 563 { 576 564 histGenEta->Fill(eta); 577 if( jet->BTag & (1 << 0)) histRecoEta->Fill(eta);565 if(jet->BTag & (1 << 0)) histRecoEta->Fill(eta); 578 566 } 579 567 } 580 } 581 582 } 583 568 } 569 } 584 570 585 571 histRecoEta->Sumw2(); … … 592 578 } 593 579 594 595 580 // ----------------------------------------------------------------------------------------------------------------------------------------------------- 596 581 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)582 template <typename T> 583 TH1D *GetTauEffPt(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 599 584 { 600 585 601 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;586 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 602 587 603 588 Long64_t allEntries = treeReader->GetEntries(); … … 614 599 Int_t i, j; 615 600 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));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)); 618 603 619 604 histGenPt->SetDirectory(0); … … 633 618 { 634 619 635 particle = (GenParticle *)branchParticle->At(i);620 particle = (GenParticle *)branchParticle->At(i); 636 621 genMomentum = particle->P4(); 637 622 638 623 deltaR = 999; 639 624 640 pt 625 pt = genMomentum.Pt(); 641 626 eta = TMath::Abs(genMomentum.Eta()); 642 627 643 if(eta > etamax || eta < etamin 644 645 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)628 if(eta > etamax || eta < etamin) continue; 629 630 if(particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax) 646 631 { 647 632 // Loop over all reco object in event 648 633 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 649 634 { 650 recoObj = (T *)branchReco->At(j);635 recoObj = (T *)branchReco->At(j); 651 636 recoMomentum = recoObj->P4(); 652 637 // this is simply to avoid warnings from initial state particle … … 657 642 { 658 643 Jet *jet = (Jet *)recoObj; 659 if( jet->TauTag != 1) continue;644 if(jet->TauTag != 1) continue; 660 645 } 661 646 … … 674 659 675 660 histGenPt->Fill(pt); 676 if(deltaR < 0.3) { histRecoPt->Fill(pt); } 677 661 if(deltaR < 0.3) 662 { 663 histRecoPt->Fill(pt); 664 } 678 665 } 679 666 } … … 683 670 histGenPt->Sumw2(); 684 671 685 686 672 histRecoPt->Divide(histGenPt); 687 673 histRecoPt->Scale(100.); 688 if(TMath::Abs(pdgID) == 15) histRecoPt->Scale(1 /0.648);674 if(TMath::Abs(pdgID) == 15) histRecoPt->Scale(1 / 0.648); 689 675 690 676 return histRecoPt; 691 677 } 692 678 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)679 template <typename T> 680 TH1D *GetTauEffEta(TClonesArray *branchReco, TClonesArray *branchParticle, TString name, int pdgID, double ptmin, double ptmax, double etamin, double etamax, ExRootTreeReader *treeReader) 695 681 { 696 682 697 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl;683 cout << "** Computing Efficiency of reconstructing " << branchReco->GetName() << " induced by " << branchParticle->GetName() << " with PID " << pdgID << endl; 698 684 699 685 Long64_t allEntries = treeReader->GetEntries(); … … 710 696 Int_t i, j; 711 697 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);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); 714 700 715 701 histGenEta->SetDirectory(0); … … 726 712 { 727 713 728 particle = (GenParticle *)branchParticle->At(i);714 particle = (GenParticle *)branchParticle->At(i); 729 715 genMomentum = particle->P4(); 730 716 731 717 deltaR = 999; 732 718 733 pt 719 pt = genMomentum.Pt(); 734 720 eta = genMomentum.Eta(); 735 721 736 if(pt > ptmax || pt < ptmin 737 738 if (particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax)722 if(pt > ptmax || pt < ptmin) continue; 723 724 if(particle->PID == pdgID && genMomentum.Pt() > ptmin && genMomentum.Pt() < ptmax) 739 725 { 740 726 // Loop over all reco object in event 741 727 for(j = 0; j < branchReco->GetEntriesFast(); ++j) 742 728 { 743 recoObj = (T *)branchReco->At(j);729 recoObj = (T *)branchReco->At(j); 744 730 recoMomentum = recoObj->P4(); 745 731 // this is simply to avoid warnings from initial state particle 746 732 // having infite rapidity ... 747 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue;748 749 if(TMath::Abs(pdgID) == 1)733 //if(Momentum.Px() == 0 && genMomentum.Py() == 0) continue; 734 735 if(TMath::Abs(pdgID) == 1) 750 736 { 751 737 Jet *jet = (Jet *)recoObj; 752 if( jet->TauTag != 1) continue;738 if(jet->TauTag != 1) continue; 753 739 } 754 740 … … 767 753 768 754 histGenEta->Fill(eta); 769 if(deltaR < 0.3) { histRecoEta->Fill(eta); } 770 755 if(deltaR < 0.3) 756 { 757 histRecoEta->Fill(eta); 758 } 771 759 } 772 760 } … … 778 766 histRecoEta->Divide(histGenEta); 779 767 histRecoEta->Scale(100.); 780 if(TMath::Abs(pdgID) == 15) histRecoEta->Scale(1 /0.648);768 if(TMath::Abs(pdgID) == 15) histRecoEta->Scale(1 / 0.648); 781 769 782 770 return histRecoEta; 783 771 } 784 772 785 786 template<typename T> 773 template <typename T> 787 774 void GetPtres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader) 788 775 { … … 792 779 793 780 GenParticle *particle; 794 T *recoObj;781 T *recoObj; 795 782 796 783 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 811 798 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 812 799 { 813 recoObj = (T *)branchReco->At(i);800 recoObj = (T *)branchReco->At(i); 814 801 recoMomentum = recoObj->P4(); 815 802 816 803 deltaR = 999; 817 804 818 // Loop over all hard partons in event819 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)820 {821 particle = (GenParticle *)branchParticle->At(j);822 if 805 // Loop over all hard partons in event 806 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 807 { 808 particle = (GenParticle *)branchParticle->At(j); 809 if(particle->PID == pdgID && particle->Status == 1) 823 810 { 824 811 genMomentum = particle->P4(); … … 831 818 if(genMomentum.DeltaR(recoMomentum) < deltaR) 832 819 { 833 834 820 deltaR = genMomentum.DeltaR(recoMomentum); 821 bestGenMomentum = genMomentum; 835 822 } 836 823 } … … 839 826 if(deltaR < 0.3) 840 827 { 841 pt 828 pt = bestGenMomentum.Pt(); 842 829 eta = TMath::Abs(bestGenMomentum.Eta()); 843 830 844 for 831 for(bin = 0; bin < Nbins; bin++) 845 832 { 846 833 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > etaMin && eta < etaMax) 847 834 { 848 histos->at(bin).resolHist->Fill(recoMomentum.Pt() /bestGenMomentum.Pt());835 histos->at(bin).resolHist->Fill(recoMomentum.Pt() / bestGenMomentum.Pt()); 849 836 } 850 837 } … … 854 841 } 855 842 856 857 template<typename T> 843 template <typename T> 858 844 void GetEres(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t etaMin, Double_t etaMax, ExRootTreeReader *treeReader) 859 845 { … … 863 849 864 850 GenParticle *particle; 865 T *recoObj;851 T *recoObj; 866 852 867 853 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 879 865 treeReader->ReadEntry(entry); 880 866 881 867 // Loop over all reconstructed jets in event 882 868 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 883 869 { 884 recoObj = (T *)branchReco->At(i);870 recoObj = (T *)branchReco->At(i); 885 871 recoMomentum = recoObj->P4(); 886 872 887 873 deltaR = 999; 888 874 889 // Loop over all hard partons in event890 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)891 {892 particle = (GenParticle *)branchParticle->At(j);893 if 875 // Loop over all hard partons in event 876 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 877 { 878 particle = (GenParticle *)branchParticle->At(j); 879 if(particle->PID == pdgID && particle->Status == 1) 894 880 { 895 881 genMomentum = particle->P4(); … … 902 888 if(genMomentum.DeltaR(recoMomentum) < deltaR) 903 889 { 904 905 890 deltaR = genMomentum.DeltaR(recoMomentum); 891 bestGenMomentum = genMomentum; 906 892 } 907 893 } … … 910 896 if(deltaR < 0.3) 911 897 { 912 e 898 e = bestGenMomentum.E(); 913 899 eta = TMath::Abs(bestGenMomentum.Eta()); 914 900 915 for 901 for(bin = 0; bin < Nbins; bin++) 916 902 { 917 903 if(e > histos->at(bin).ptmin && e < histos->at(bin).ptmax && eta > etaMin && eta < etaMax) 918 904 { 919 histos->at(bin).resolHist->Fill(recoMomentum.E() /bestGenMomentum.E());905 histos->at(bin).resolHist->Fill(recoMomentum.E() / bestGenMomentum.E()); 920 906 } 921 907 } … … 925 911 } 926 912 927 928 template<typename T> 913 template <typename T> 929 914 void GetPtresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t ptMin, Double_t ptMax, ExRootTreeReader *treeReader) 930 915 { … … 934 919 935 920 GenParticle *particle; 936 T *recoObj;921 T *recoObj; 937 922 938 923 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 953 938 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 954 939 { 955 recoObj = (T *)branchReco->At(i);940 recoObj = (T *)branchReco->At(i); 956 941 recoMomentum = recoObj->P4(); 957 942 958 943 deltaR = 999; 959 944 960 // Loop over all hard partons in event961 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)962 {963 particle = (GenParticle *)branchParticle->At(j);964 if 945 // Loop over all hard partons in event 946 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 947 { 948 particle = (GenParticle *)branchParticle->At(j); 949 if(particle->PID == pdgID && particle->Status == 1) 965 950 { 966 951 genMomentum = particle->P4(); … … 973 958 if(genMomentum.DeltaR(recoMomentum) < deltaR) 974 959 { 975 976 960 deltaR = genMomentum.DeltaR(recoMomentum); 961 bestGenMomentum = genMomentum; 977 962 } 978 963 } … … 981 966 if(deltaR < 0.3) 982 967 { 983 pt 968 pt = bestGenMomentum.Pt(); 984 969 eta = bestGenMomentum.Eta(); 985 970 986 for 971 for(bin = 0; bin < Nbins; bin++) 987 972 { 988 973 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt > ptMin && pt < ptMax) 989 974 { 990 histos->at(bin).resolHist->Fill(recoMomentum.Pt()/bestGenMomentum.Pt());975 histos->at(bin).resolHist->Fill(recoMomentum.Pt() / bestGenMomentum.Pt()); 991 976 } 992 977 } … … 996 981 } 997 982 998 template <typename T>983 template <typename T> 999 984 void GetEresVsEta(std::vector<resolPlot> *histos, TClonesArray *branchReco, TClonesArray *branchParticle, int pdgID, Double_t eMin, Double_t eMax, ExRootTreeReader *treeReader) 1000 985 { … … 1004 989 1005 990 GenParticle *particle; 1006 T *recoObj;991 T *recoObj; 1007 992 1008 993 TLorentzVector recoMomentum, genMomentum, bestGenMomentum; … … 1023 1008 for(i = 0; i < branchReco->GetEntriesFast(); ++i) 1024 1009 { 1025 recoObj = (T *)branchReco->At(i);1010 recoObj = (T *)branchReco->At(i); 1026 1011 recoMomentum = recoObj->P4(); 1027 1012 1028 1013 deltaR = 999; 1029 1014 1030 // Loop over all hard partons in event1031 for(j = 0; j < branchParticle->GetEntriesFast(); ++j)1032 {1033 particle = (GenParticle *)branchParticle->At(j);1034 if 1015 // Loop over all hard partons in event 1016 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 1017 { 1018 particle = (GenParticle *)branchParticle->At(j); 1019 if(particle->PID == pdgID && particle->Status == 1) 1035 1020 { 1036 1021 genMomentum = particle->P4(); … … 1043 1028 if(genMomentum.DeltaR(recoMomentum) < deltaR) 1044 1029 { 1045 1046 1030 deltaR = genMomentum.DeltaR(recoMomentum); 1031 bestGenMomentum = genMomentum; 1047 1032 } 1048 1033 } … … 1051 1036 if(deltaR < 0.3) 1052 1037 { 1053 e 1038 e = bestGenMomentum.E(); 1054 1039 eta = bestGenMomentum.Eta(); 1055 1040 1056 1057 1058 for (bin = 0; bin < Nbins; bin++) 1041 for(bin = 0; bin < Nbins; bin++) 1059 1042 { 1060 1043 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && e > eMin && e < eMax) 1061 1044 { 1062 histos->at(bin).resolHist->Fill(recoMomentum.E()/bestGenMomentum.E());1045 histos->at(bin).resolHist->Fill(recoMomentum.E() / bestGenMomentum.E()); 1063 1046 } 1064 1047 } … … 1068 1051 } 1069 1052 1070 1071 1072 1053 void GetJetsEres(std::vector<resolPlot> *histos, TClonesArray *branchJet, TClonesArray *branchGenJet, ExRootTreeReader *treeReader, Double_t etaMin, Double_t etaMax) 1073 1054 { … … 1093 1074 treeReader->ReadEntry(entry); 1094 1075 1095 if(entry %10000 == 0) cout << "Event number: "<< entry <<endl;1076 if(entry % 10000 == 0) cout << "Event number: " << entry << endl; 1096 1077 1097 1078 // Loop over all reconstructed jets in event 1098 for(i = 0; i < TMath::Min(2, branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)1079 for(i = 0; i < TMath::Min(2, branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i) 1099 1080 { 1100 1081 1101 jet = (Jet *)branchJet->At(i);1082 jet = (Jet *)branchJet->At(i); 1102 1083 jetMomentum = jet->P4(); 1103 1084 1104 1085 deltaR = 999; 1105 1086 1106 // Loop over all hard partons in event1107 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)1108 {1109 genjet = (Jet *)branchGenJet->At(j);1087 // Loop over all hard partons in event 1088 for(j = 0; j < TMath::Min(2, branchGenJet->GetEntriesFast()); ++j) 1089 { 1090 genjet = (Jet *)branchGenJet->At(j); 1110 1091 1111 1092 genJetMomentum = genjet->P4(); … … 1118 1099 if(genJetMomentum.DeltaR(jetMomentum) < deltaR) 1119 1100 { 1120 1121 1101 deltaR = genJetMomentum.DeltaR(jetMomentum); 1102 bestGenJetMomentum = genJetMomentum; 1122 1103 } 1123 1104 } … … 1125 1106 if(deltaR < 0.3) 1126 1107 { 1127 pt 1108 pt = genJetMomentum.E(); 1128 1109 eta = genJetMomentum.Eta(); 1129 1110 1130 for 1111 for(bin = 0; bin < Nbins; bin++) 1131 1112 { 1132 1113 if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta < etaMax && eta > etaMin) 1133 1114 { 1134 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E());1115 histos->at(bin).resolHist->Fill(jetMomentum.E() / bestGenJetMomentum.E()); 1135 1116 } 1136 1117 } … … 1163 1144 treeReader->ReadEntry(entry); 1164 1145 1165 if(entry %10000 == 0) cout << "Event number: "<< entry <<endl;1146 if(entry % 10000 == 0) cout << "Event number: " << entry << endl; 1166 1147 1167 1148 // Loop over all reconstructed jets in event 1168 for(i = 0; i < TMath::Min(2, branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)1149 for(i = 0; i < TMath::Min(2, branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i) 1169 1150 { 1170 1151 1171 jet = (Jet *)branchJet->At(i);1152 jet = (Jet *)branchJet->At(i); 1172 1153 jetMomentum = jet->P4(); 1173 1154 1174 1155 deltaR = 999; 1175 1156 1176 // Loop over all hard partons in event1177 for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)1178 {1179 genjet = (Jet *)branchGenJet->At(j);1157 // Loop over all hard partons in event 1158 for(j = 0; j < TMath::Min(2, branchGenJet->GetEntriesFast()); ++j) 1159 { 1160 genjet = (Jet *)branchGenJet->At(j); 1180 1161 1181 1162 genJetMomentum = genjet->P4(); … … 1188 1169 if(genJetMomentum.DeltaR(jetMomentum) < deltaR) 1189 1170 { 1190 1191 1171 deltaR = genJetMomentum.DeltaR(jetMomentum); 1172 bestGenJetMomentum = genJetMomentum; 1192 1173 } 1193 1174 } … … 1196 1177 { 1197 1178 1198 pt 1179 pt = genJetMomentum.E(); 1199 1180 eta = genJetMomentum.Eta(); 1200 1181 1201 for 1182 for(bin = 0; bin < Nbins; bin++) 1202 1183 { 1203 1184 if(eta > histos->at(bin).etamin && eta < histos->at(bin).etamax && pt < eMax && pt > eMin) 1204 1185 { 1205 histos->at(bin).resolHist->Fill(jetMomentum.E()/bestGenJetMomentum.E());1186 histos->at(bin).resolHist->Fill(jetMomentum.E() / bestGenJetMomentum.E()); 1206 1187 } 1207 1188 } … … 1211 1192 } 1212 1193 1213 1214 1215 std::pair<Double_t, Double_t> GausFit(TH1* hist) 1194 std::pair<Double_t, Double_t> GausFit(TH1 *hist) 1216 1195 { 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");1196 TF1 *f1 = new TF1("f1", "gaus", hist->GetMean() - 2 * hist->GetRMS(), hist->GetMean() + 2 * hist->GetRMS()); 1197 hist->Fit("f1", "RQ"); 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", "RQ"); 1222 1201 1223 1202 Double_t sig = f2->GetParameter(2); … … 1226 1205 delete f1; 1227 1206 delete f2; 1228 return make_pair 1207 return make_pair(sig, sigErr); 1229 1208 } 1230 1231 1209 1232 1210 TGraphErrors EresGraph(std::vector<resolPlot> *histos, bool rms = false) … … 1234 1212 Int_t bin; 1235 1213 Int_t count = 0; 1236 TGraphErrors gr = TGraphErrors(Nbins /2);1214 TGraphErrors gr = TGraphErrors(Nbins / 2); 1237 1215 double val, error; 1238 for 1239 { 1240 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 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 correct1249 1250 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 correct1258 1259 1260 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 correct 1223 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 correct 1227 } 1228 else 1229 { 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 correct 1236 //gr.SetPointError(count,0, 100*sigvalues.second); 1237 } 1238 count++; 1261 1239 } 1262 1240 … … 1268 1246 Int_t bin; 1269 1247 Int_t count = 0; 1270 TGraphErrors gr = TGraphErrors(Nbins /2);1248 TGraphErrors gr = TGraphErrors(Nbins / 2); 1271 1249 double val, error; 1272 for 1273 { 1274 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 1279 1280 if(error > 0.2*val) error = 0.2*val;1281 gr.SetPointError(count,0, error); // to correct1282 1283 1284 1285 1286 gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);1287 1288 1289 if(error > 0.2*val) error = 0.2*val;1290 gr.SetPointError(count,0, error);1291 1292 1293 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 correct 1260 } 1261 else 1262 { 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++; 1294 1272 } 1295 1273 1296 1274 return gr; 1297 1275 } 1298 1299 1300 1276 1301 1277 TGraphErrors EresGraphVsEta(std::vector<resolPlot> *histos, bool rms = false) … … 1303 1279 Int_t bin; 1304 1280 Int_t count = 0; 1305 TGraphErrors gr = TGraphErrors(Nbins /2);1281 TGraphErrors gr = TGraphErrors(Nbins / 2); 1306 1282 double val, error; 1307 for 1308 { 1309 1310 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 correct1318 1319 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 1327 1328 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 correct 1294 } 1295 else 1296 { 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++; 1329 1305 } 1330 1306 … … 1356 1332 treeReader->ReadEntry(entry); 1357 1333 1358 if(entry %10000 == 0) cout << "Event number: "<< entry <<endl;1359 1360 if 1334 if(entry % 10000 == 0) cout << "Event number: " << entry << endl; 1335 1336 if(branchJet->GetEntriesFast() > 1) 1361 1337 { 1362 1338 1363 jet = (Jet *)branchJet->At(0);1339 jet = (Jet *)branchJet->At(0); 1364 1340 p1 = jet->P4(); 1365 jet = (Jet *)branchJet->At(1);1341 jet = (Jet *)branchJet->At(1); 1366 1342 p2 = jet->P4(); 1367 1343 1368 met = (MissingET *)branchMet->At(0);1369 scalarHT = (ScalarHT *)branchScalarHT->At(0);1344 met = (MissingET *)branchMet->At(0); 1345 scalarHT = (ScalarHT *)branchScalarHT->At(0); 1370 1346 ht = scalarHT->HT; 1371 1347 1372 if(p1.Pt() < 0.75 *ht/2) continue;1373 if(p2.Pt() < 0.75 *ht/2) continue;1374 1375 for 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++) 1376 1352 { 1377 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax 1353 if(ht > histos->at(bin).ptmin && ht < histos->at(bin).ptmax) 1378 1354 { 1379 1355 histos->at(bin).resolHist->Fill(met->P4().Px()); … … 1384 1360 } 1385 1361 1386 1387 1388 1362 //------------------------------------------------------------------------------ 1389 1390 1363 1391 1364 void addResoGraph(TMultiGraph *mg, TGraphErrors *gr, TLegend *leg, int style, Color_t color, TString text) … … 1400 1373 std::cout << "Adding " << gr->GetName() << std::endl; 1401 1374 mg->Add(gr); 1402 leg->AddEntry(gr,text,"p"); 1403 1375 leg->AddEntry(gr, text, "p"); 1404 1376 } 1405 1406 1377 1407 1378 void DrawAxis(TMultiGraph *mg, TLegend *leg, double xmin, double xmax, double ymin, double ymax, TString tx, TString ty, bool logx = 0, bool logy = 0) … … 1409 1380 mg->SetMinimum(ymin); 1410 1381 mg->SetMaximum(ymax); 1411 mg->GetXaxis()->SetLimits(xmin, xmax);1382 mg->GetXaxis()->SetLimits(xmin, xmax); 1412 1383 1413 1384 mg->GetXaxis()->SetTitle(tx); … … 1440 1411 if(logy) gPad->SetLogy(); 1441 1412 1442 1443 1413 //gPad->SetGridx(); 1444 1414 //gPad->SetGridy(); … … 1447 1417 gPad->Modified(); 1448 1418 gPad->Update(); 1449 1450 1419 } 1451 1452 1420 1453 1421 void DelphesValidation( … … 1545 1513 colors.push_back(kBlue); 1546 1514 colors.push_back(kRed); 1547 colors.push_back(kGreen +1);1548 colors.push_back(kMagenta +1);1515 colors.push_back(kGreen + 1); 1516 colors.push_back(kMagenta + 1); 1549 1517 colors.push_back(kOrange); 1550 1518 … … 1566 1534 Int_t lastSlash = figPath.Last('/'); 1567 1535 Int_t sizePath = figPath.Length(); 1568 figPath.Remove(lastSlash +1,sizePath);1536 figPath.Remove(lastSlash + 1, sizePath); 1569 1537 1570 1538 TString header = pdfOutput; … … 1573 1541 lastSlash = header.Last('/'); 1574 1542 sizePath = header.Length(); 1575 header.Remove(0, lastSlash+1);1543 header.Remove(0, lastSlash + 1); 1576 1544 1577 1545 TString vrs(version); 1578 1546 1579 TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94, "NDC");1547 TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94, "NDC"); 1580 1548 pave->SetTextAlign(30); 1581 1549 pave->SetTextFont(132); … … 1584 1552 pave->SetFillColor(0); 1585 1553 pave->SetFillStyle(0); 1586 pave->AddText("Delphes " +vrs+" - "+header);1554 pave->AddText("Delphes " + vrs + " - " + header); 1587 1555 1588 1556 TString s_etaMin, s_etaMax, s_eta, s_pt, s_e; … … 1610 1578 etaVals.push_back(6.0); 1611 1579 1612 const int n_etabins = etaVals.size() -1;1580 const int n_etabins = etaVals.size() - 1; 1613 1581 const int n_ptbins = ptVals.size(); 1614 1582 … … 1619 1587 // --------- Pion Tracks --------- // 1620 1588 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 1632 TGraphErrors *gr_trkpi_eff_pt 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 *)leg_trkpi_res_pt->Clone(); 1596 TLegend *leg_trkpi_res_eta = (TLegend *)leg_trkpi_res_pt->Clone(); 1597 TLegend *leg_trkpi_eff_eta = (TLegend *)leg_trkpi_res_eta->Clone(); 1598 1599 TGraphErrors *gr_trkpi_res_pt = new TGraphErrors[n_etabins]; 1600 TGraphErrors *gr_trkpi_eff_pt = new TGraphErrors[n_etabins]; 1633 1601 TGraphErrors *gr_trkpi_res_eta = new TGraphErrors[n_ptbins]; 1634 1602 TGraphErrors *gr_trkpi_eff_eta = new TGraphErrors[n_ptbins]; 1635 TH1D *h_trkpi_eff_pt, *h_trkpi_eff_eta;1636 1637 std::vector<resolPlot> *plots_trkpi_res_pt 1638 std::vector<resolPlot> *plots_trkpi_res_eta 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]; 1639 1607 1640 1608 // loop over eta bins 1641 for (k = 0; k < etaVals.size()-1; k++)1642 { 1643 1644 GetPtres<Track>(&plots_trkpi_res_pt[k], branchTrackPion, branchParticlePion, 211, etaVals.at(k), etaVals.at(k+1), treeReaderPion);1645 1646 1647 h_trkpi_eff_pt = GetEffPt<Track>(branchTrackPion, branchParticlePion, "Pion", 211, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderPion);1648 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 1659 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); 1660 1628 } 1661 1629 1662 1630 // loop over pt 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); 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); 1681 1648 1682 1649 mg_trkpi_res_pt->Draw("APE"); … … 1685 1652 pave->Draw(); 1686 1653 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);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("", "", 800, 600); 1692 1659 1693 1660 mg_trkpi_res_eta->Draw("APE"); … … 1696 1663 pave->Draw(); 1697 1664 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);1665 c_trkpi_res_eta->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1703 1670 1704 1671 mg_trkpi_eff_pt->Draw("APE"); … … 1707 1674 pave->Draw(); 1708 1675 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);1676 c_trkpi_eff_pt->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1714 1681 1715 1682 mg_trkpi_eff_eta->Draw("APE"); … … 1718 1685 pave->Draw(); 1719 1686 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"); 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"); 1724 1690 1725 1691 // --------- Electron Tracks --------- // 1726 1692 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 1738 TGraphErrors *gr_trkele_eff_pt 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 *)leg_trkele_res_pt->Clone(); 1700 TLegend *leg_trkele_res_eta = (TLegend *)leg_trkele_res_pt->Clone(); 1701 TLegend *leg_trkele_eff_eta = (TLegend *)leg_trkele_res_eta->Clone(); 1702 1703 TGraphErrors *gr_trkele_res_pt = new TGraphErrors[n_etabins]; 1704 TGraphErrors *gr_trkele_eff_pt = new TGraphErrors[n_etabins]; 1739 1705 TGraphErrors *gr_trkele_res_eta = new TGraphErrors[n_ptbins]; 1740 1706 TGraphErrors *gr_trkele_eff_eta = new TGraphErrors[n_ptbins]; 1741 1707 1742 TH1D *h_trkele_eff_pt, *h_trkele_eff_eta;1743 1744 std::vector<resolPlot> *plots_trkele_res_pt 1745 std::vector<resolPlot> *plots_trkele_res_eta 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]; 1746 1712 1747 1713 // loop over eta bins 1748 for (k = 0; k < etaVals.size()-1; k++)1749 { 1750 1751 GetPtres<Track>(&plots_trkele_res_pt[k], branchTrackElectron, branchParticleElectron, 11, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);1752 1753 1754 h_trkele_eff_pt = GetEffPt<Track>(branchTrackElectron, branchParticleElectron, "Electron", 11, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderElectron);1755 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 1766 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); 1767 1733 } 1768 1734 1769 1735 // loop over pt 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); 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); 1788 1753 1789 1754 mg_trkele_res_pt->Draw("APE"); … … 1792 1757 pave->Draw(); 1793 1758 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);1759 c_trkele_res_pt->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1799 1764 1800 1765 mg_trkele_res_eta->Draw("APE"); … … 1803 1768 pave->Draw(); 1804 1769 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);1770 c_trkele_res_eta->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1810 1775 1811 1776 mg_trkele_eff_pt->Draw("APE"); … … 1814 1779 pave->Draw(); 1815 1780 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);1781 c_trkele_eff_pt->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1821 1786 1822 1787 mg_trkele_eff_eta->Draw("APE"); … … 1825 1790 pave->Draw(); 1826 1791 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 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"); 1831 1795 1832 1796 // --------- Muon Tracks --------- // 1833 1797 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]; 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]; 1848 1811 TGraphErrors *gr_trkmu_res_eta = new TGraphErrors[n_ptbins]; 1849 1812 TGraphErrors *gr_trkmu_eff_eta = new TGraphErrors[n_ptbins]; 1850 1813 1851 TH1D *h_trkmu_eff_pt, *h_trkmu_eff_eta;1852 1853 std::vector<resolPlot> *plots_trkmu_res_pt 1854 std::vector<resolPlot> *plots_trkmu_res_eta 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]; 1855 1818 1856 1819 // loop over eta bins 1857 for (k = 0; k < etaVals.size()-1; k++)1858 { 1859 1860 GetPtres<Track>(&plots_trkmu_res_pt[k], branchTrackMuon, branchParticleMuon, 13, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);1861 1862 1863 h_trkmu_eff_pt = GetEffPt<Track>(branchTrackMuon, branchParticleMuon, "Muon", 13, ptMin, ptMax, etaVals.at(k), etaVals.at(k+1), treeReaderMuon);1864 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 1875 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); 1876 1839 } 1877 1840 1878 1841 // loop over pt 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); 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); 1897 1859 1898 1860 mg_trkmu_res_pt->Draw("APE"); … … 1901 1863 pave->Draw(); 1902 1864 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);1865 c_trkmu_res_pt->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1908 1870 1909 1871 mg_trkmu_res_eta->Draw("APE"); … … 1912 1874 pave->Draw(); 1913 1875 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);1876 c_trkmu_res_eta->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1919 1881 1920 1882 mg_trkmu_eff_pt->Draw("APE"); … … 1923 1885 pave->Draw(); 1924 1886 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);1887 c_trkmu_eff_pt->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 1930 1892 1931 1893 mg_trkmu_eff_eta->Draw("APE"); … … 1934 1896 pave->Draw(); 1935 1897 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 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"); 1940 1901 1941 1902 ////////////////////// … … 1943 1904 ////////////////////// 1944 1905 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]; 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]; 1956 1916 std::vector<resolPlot> *plots_ecal_res_eta = new std::vector<resolPlot>[n_ptbins]; 1957 1917 1958 1918 // loop over eta bins 1959 for (k = 0; k < etaVals.size()-1; k++)1960 { 1961 1962 GetEres<Tower>(&plots_ecal_res_e[k], branchTowerPhoton, branchParticlePhoton, 22, etaVals.at(k), etaVals.at(k+1), treeReaderPhoton);1963 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 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); 1973 1933 } 1974 1934 1975 1935 // loop over pt 1976 for 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 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);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("", "", 800, 600); 1989 1949 1990 1950 mg_ecal_res_e->Draw("APE"); 1991 // DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.5, 100, "E [GeV]", "(ECAL resolution in E)/E (%)", true, true);1951 // DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.5, 100, "E [GeV]", "(ECAL resolution in E)/E (%)", true, true); 1992 1952 DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.0, 20, "E [GeV]", "(ECAL resolution in E)/E (%)", true, false); 1993 1953 leg_ecal_res_e->Draw(); 1994 1954 pave->Draw(); 1995 1955 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);1956 c_ecal_res_e->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 2001 1961 2002 1962 mg_ecal_res_eta->Draw("APE"); … … 2006 1966 pave->Draw(); 2007 1967 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");1968 c_ecal_res_eta->Print(pdfOutput, "pdf"); 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"); 2011 1971 2012 1972 ////////////////////// … … 2014 1974 ////////////////////// 2015 1975 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]; 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]; 2024 1983 TGraphErrors *gr_hcal_res_eta = new TGraphErrors[n_ptbins]; 2025 1984 2026 std::vector<resolPlot> *plots_hcal_res_e 1985 std::vector<resolPlot> *plots_hcal_res_e = new std::vector<resolPlot>[n_etabins]; 2027 1986 std::vector<resolPlot> *plots_hcal_res_eta = new std::vector<resolPlot>[n_ptbins]; 2028 1987 2029 1988 // loop over eta bins 2030 for (k = 0; k < etaVals.size()-1; k++)2031 { 2032 2033 GetEres<Tower>(&plots_hcal_res_e[k], branchTowerNeutralHadron, branchParticleNeutralHadron, 2112, etaVals.at(k), etaVals.at(k+1), treeReaderNeutralHadron);2034 2035 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 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); 2045 2004 } 2046 2005 2047 2006 // loop over pt 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); 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); 2062 2020 2063 2021 mg_hcal_res_e->Draw("APE"); … … 2067 2025 pave->Draw(); 2068 2026 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);2027 c_hcal_res_e->Print(pdfOutput, "pdf"); 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("", "", 800, 600); 2074 2032 2075 2033 mg_hcal_res_eta->Draw("APE"); … … 2079 2037 pave->Draw(); 2080 2038 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");2039 c_hcal_res_eta->Print(pdfOutput, "pdf"); 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"); 2084 2042 2085 2043 //////////////////// … … 2098 2056 TGraphErrors *gr_trkele_res_eeta = new TGraphErrors[n_ptbins]; 2099 2057 2100 std::vector<resolPlot> *plots_pfele_res_e 2101 std::vector<resolPlot> *plots_pfele_res_eta 2102 std::vector<resolPlot> *plots_trkele_res_e 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]; 2103 2061 std::vector<resolPlot> *plots_trkele_res_eeta = new std::vector<resolPlot>[n_ptbins]; 2104 2062 … … 2106 2064 TCanvas *c_pfele_res_eta[n_ptbins]; 2107 2065 2108 2109 2066 // loop over eta bins 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 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"); 2191 2144 } 2192 2145 … … 2201 2154 TLegend *leg_pfpi_res_eta[n_ptbins]; 2202 2155 2203 TGraphErrors *gr_pfpi_res_e 2204 TGraphErrors *gr_pfpi_res_eta 2205 2206 TGraphErrors *gr_trkpi_res_e 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]; 2207 2160 TGraphErrors *gr_trkpi_res_eeta = new TGraphErrors[n_ptbins]; 2208 2161 2209 std::vector<resolPlot> *plots_pfpi_res_e 2210 std::vector<resolPlot> *plots_pfpi_res_eta 2211 std::vector<resolPlot> *plots_trkpi_res_e 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]; 2212 2165 std::vector<resolPlot> *plots_trkpi_res_eeta = new std::vector<resolPlot>[n_ptbins]; 2213 2166 … … 2215 2168 TCanvas *c_pfpi_res_eta[n_ptbins]; 2216 2169 2217 2218 2170 // loop over eta bins 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 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 } 2303 2249 2304 2250 ///////////////// … … 2312 2258 TLegend *leg_pfjet_res_eta[n_ptbins]; 2313 2259 2314 TGraphErrors *gr_pfjet_res_e 2260 TGraphErrors *gr_pfjet_res_e = new TGraphErrors[n_etabins]; 2315 2261 TGraphErrors *gr_pfjet_res_eta = new TGraphErrors[n_ptbins]; 2316 2262 2317 TGraphErrors *gr_cajet_res_e 2263 TGraphErrors *gr_cajet_res_e = new TGraphErrors[n_etabins]; 2318 2264 TGraphErrors *gr_cajet_res_eta = new TGraphErrors[n_ptbins]; 2319 2265 2320 std::vector<resolPlot> *plots_pfjet_res_e 2266 std::vector<resolPlot> *plots_pfjet_res_e = new std::vector<resolPlot>[n_etabins]; 2321 2267 std::vector<resolPlot> *plots_pfjet_res_eta = new std::vector<resolPlot>[n_ptbins]; 2322 std::vector<resolPlot> *plots_cajet_res_e 2268 std::vector<resolPlot> *plots_cajet_res_e = new std::vector<resolPlot>[n_etabins]; 2323 2269 std::vector<resolPlot> *plots_cajet_res_eta = new std::vector<resolPlot>[n_ptbins]; 2324 2270 … … 2326 2272 TCanvas *c_pfjet_res_eta[n_ptbins]; 2327 2273 2328 2329 2274 // loop over eta bins 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(); 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(); 2441 2306 pave->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++) 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(); 2346 pave->Draw(); 2347 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++) 2463 2917 { 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); 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(); 2476 2927 } 2477 2928 2478 // loop over pt 2479 for (k = 0; k < ptVals.size(); k++) 2929 for(k = 0; k < ptVals.size(); k++) 2480 2930 { 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(); 2495 pave->Draw(); 2496 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++) 2529 { 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); 2542 } 2543 2544 // loop over pt 2545 for (k = 0; k < ptVals.size(); k++) 2546 { 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 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(); 3009 2940 } 3010 2941 3011 2942 plots_pfmet.at(bin).resolHist->Write(); 3012 2943 plots_camet.at(bin).resolHist->Write(); 3013 3014 2944 } 3015 2945 3016 2946 fout->Write(); 3017 3018 2947 3019 2948 cout << "** Exiting..." << endl; … … 3065 2994 DelphesValidation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]); 3066 2995 } 3067 3068 3069
Note:
See TracChangeset
for help on using the changeset viewer.