|
3 | 3 | #include <EventLoop/Worker.h>
|
4 | 4 | #include <GeneratorPlotsAlt/MyxAODAnalysis.h>
|
5 | 5 |
|
6 |
| -// GitHubProgramCode added |
7 | 6 | // Infrastructure include(s):
|
8 | 7 | #include "xAODRootAccess/Init.h"
|
9 | 8 | #include "xAODRootAccess/TEvent.h"
|
|
12 | 11 | #include "xAODTruth/TruthEventContainer.h"
|
13 | 12 | #include "GeneratorPlotsAlt/truth_helpers.h"
|
14 | 13 |
|
15 |
| -// GitHubProgramCode added |
16 | 14 | // ASG status code check
|
17 | 15 | #include <AsgTools/MessageCheck.h>
|
18 | 16 |
|
19 |
| -// GitHubProgramCode added |
20 | 17 | // EDM includes:
|
21 | 18 | #include "xAODEventInfo/EventInfo.h"
|
22 | 19 |
|
23 |
| -// // GitHubProgramCode added |
24 |
| -// #include <iostream> |
25 |
| -// #include <string> |
26 |
| - |
27 |
| -// GitHubProgramCode added |
28 | 20 | // To create a basic loop over a jet container, for the AntiKt4EMTTopoJets jet collection.
|
29 | 21 | #include "xAODJet/JetContainer.h"
|
30 | 22 |
|
31 |
| -// Gordoncode added from validationPlots_HSS.cxx |
32 |
| -//#include "MCValidation/template_access.h" |
| 23 | +// Validation histograms: |
| 24 | +#include "MCValidation/lepton_plots.h" |
| 25 | +#include "MCValidation/neutrino_plots.h" |
33 | 26 | #include "MCValidation/two_particle_plots.h"
|
34 | 27 | #include "MCValidation/standard_p_plots.h"
|
35 | 28 | #include "MCValidation/lifetime_plots.h"
|
36 | 29 | #include "MCValidation/truth_helpers.h"
|
37 | 30 |
|
38 |
| -// Gordoncode added from validationPlots_HSS.cxx |
39 | 31 | // Config
|
40 | 32 | const char *APP_NAME = "validationPlots";
|
41 | 33 | const char *OutputFile = "validation.root";
|
42 | 34 |
|
43 |
| -// // Book the histos |
44 |
| -// // Gordoncode from validationPlots_HSS.cxx |
45 |
| -// lifetime_plots all ("all", "all "); |
46 |
| -// standard_p_plots hs ("hs", "#h_{s} "); |
47 |
| -// standard_p_plots hhiggs ("higgs", "Higgs "); |
48 |
| -// two_particle_plots twohs ("twoHS", "Two HSs "); |
49 |
| - |
50 |
| -// Book the histos |
51 |
| - // Gordoncode from validationPlots_HSS.cxx |
52 |
| - lifetime_plots* all; |
53 |
| - standard_p_plots* hs; |
54 |
| - two_particle_plots* twohs; |
55 |
| - |
56 | 35 | // this is needed to distribute the algorithm to the workers
|
57 | 36 | ClassImp(MyxAODAnalysis)
|
58 | 37 |
|
@@ -101,14 +80,15 @@ EL::StatusCode MyxAODAnalysis :: histInitialize ()
|
101 | 80 |
|
102 | 81 | // GitHubProgramCode added
|
103 | 82 | // This method is called before processing any events. Note that the wk()->addOutput call is a mechanism EventLoop uses for delivering the results of an algorithm to the outside world. When running in PROOF, ROOT will merge all of the objects in this list.
|
104 |
| - |
105 |
| - h_jetPt = new TH1F("h_jetPt", "h_jetPt", 100, 0, 500); // jet pt [GeV] |
106 |
| - wk()->addOutput (h_jetPt); |
107 | 83 |
|
108 |
| -// Initializing histograms |
109 |
| - all = new lifetime_plots ("all", "all ", wk()); |
110 |
| - hs = new standard_p_plots ("hs", "#h_{s} ", wk()); |
111 |
| - twohs = new two_particle_plots ("twoHS", "Two HSs ", wk()); |
| 84 | + // Initializing histograms |
| 85 | + all = new lifetime_plots ("all", "all ", wk()); |
| 86 | + hs = new standard_p_plots ("hs", "#h_{s} ", wk()); |
| 87 | + twohs = new two_particle_plots ("twoHS", "Two HSs ", wk()); |
| 88 | + e_neutrino = new neutrino_plots ("e_neutrino_", "\\nu_{e} ", wk()); |
| 89 | + mu_neutrino = new neutrino_plots ("mu_neutrino_", "\\nu_{\\mu} ", wk()); |
| 90 | + e = new lepton_plots ("e_", "e ", wk()); |
| 91 | + mu = new lepton_plots("mu_", "\\mu ", wk()); |
112 | 92 |
|
113 | 93 | return EL::StatusCode::SUCCESS;
|
114 | 94 | }
|
@@ -175,71 +155,72 @@ EL::StatusCode MyxAODAnalysis :: execute ()
|
175 | 155 |
|
176 | 156 | // GitHubProgramCode added
|
177 | 157 | // print every 100 events, so we know where we are:
|
178 |
| - if( (m_eventCounter % 100) ==0 ) Info("execute()", "Event number = %i", m_eventCounter ); |
179 |
| - m_eventCounter++; |
180 |
| - |
181 |
| - //---------------------------- |
182 |
| - // Event information |
183 |
| - //--------------------------- |
184 |
| - const xAOD::EventInfo* eventInfo = 0; |
185 |
| - ANA_CHECK(event->retrieve( eventInfo, "EventInfo")); |
186 |
| - |
187 |
| - // check if the event is data or MC |
188 |
| - // (many tools are applied either to data or MC) |
189 |
| - // Warning: set but not used below commented out |
190 |
| - // bool isMC = false; |
191 |
| - // check if the event is MC |
192 |
| - // if(eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION ) ){ |
193 |
| - // isMC = true; // can do something with this later |
194 |
| - // } |
195 |
| - |
196 |
| - // GitHubProgramCode added + Gordoncode |
197 |
| - // get jet container of interest |
198 |
| - const xAOD::TruthEventContainer* truths = 0; |
199 |
| - ANA_CHECK(event->retrieve( truths, "TruthEvents" )); |
200 |
| - Info("execute()", " number of truths = %lu", truths->size()); |
201 |
| - |
202 |
| - // loop over the jets in the container |
203 |
| - xAOD::TruthEventContainer::const_iterator truth_itr = truths->begin(); |
204 |
| - xAOD::TruthEventContainer::const_iterator truth_end = truths->end(); |
205 |
| - // for( ; jet_itr != jet_end; ++jet_itr ) { |
206 |
| - // Info("execute()", " jet pt = %.2f GeV", ((*jet_itr)->pt() * 0.001)); // just to print out something |
207 |
| - // } // end for loop over jets |
208 |
| - |
209 |
| - // GitHubProgramCode added + Gordoncode |
210 |
| - // Get the truth info |
211 |
| - const xAOD::TruthEventContainer *truth = nullptr; |
212 |
| - // RETURN_CHECK (APP_NAME, event->retrieve(truth, "TruthEvents")); |
213 |
| - ANA_CHECK(event->retrieve( truth, "TruthEvents" )); |
214 |
| - // Warning: set but not used below commented out |
215 |
| - // bool isHiggs62 = false; |
216 |
| - // Loop over all the truth particles in there |
217 |
| - for (auto evt : *truth) |
| 158 | + if( (m_eventCounter % 100) ==0 ) Info("execute()", "Event number = %i", m_eventCounter ); |
| 159 | + m_eventCounter++; |
| 160 | + |
| 161 | + //---------------------------- |
| 162 | + // Event information |
| 163 | + //--------------------------- |
| 164 | + const xAOD::EventInfo* eventInfo = 0; |
| 165 | + ANA_CHECK(event->retrieve( eventInfo, "EventInfo")); |
| 166 | + |
| 167 | + // check if the event is data or MC |
| 168 | + // (many tools are applied either to data or MC) |
| 169 | + // Warning: set but not used below commented out |
| 170 | + // bool isMC = false; |
| 171 | + // check if the event is MC |
| 172 | + // if(eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION ) ){ |
| 173 | + // isMC = true; // can do something with this later |
| 174 | + // } |
| 175 | + |
| 176 | + // GitHubProgramCode added + Gordoncode |
| 177 | + // get jet container of interest |
| 178 | + const xAOD::TruthEventContainer* truths = 0; |
| 179 | + ANA_CHECK(event->retrieve( truths, "TruthEvents" )); |
| 180 | + Info("execute()", " number of truths = %lu", truths->size()); |
| 181 | + |
| 182 | + // loop over the jets in the container |
| 183 | + xAOD::TruthEventContainer::const_iterator truth_itr = truths->begin(); |
| 184 | + xAOD::TruthEventContainer::const_iterator truth_end = truths->end(); |
| 185 | + |
| 186 | + // Get the truth info |
| 187 | + const xAOD::TruthEventContainer *truth = nullptr; |
| 188 | + // RETURN_CHECK (APP_NAME, event->retrieve(truth, "TruthEvents")); |
| 189 | + ANA_CHECK(event->retrieve( truth, "TruthEvents" )); |
| 190 | + // Warning: set but not used below commented out |
| 191 | + // bool isHiggs62 = false; |
| 192 | + // Loop over all the truth particles in there |
| 193 | + for (auto evt : *truth) |
| 194 | + { |
| 195 | + for (auto p : truth_as_range(evt)) |
| 196 | + { |
| 197 | + if (p != nullptr) |
218 | 198 | {
|
219 |
| - for (auto p : truth_as_range(evt)) |
| 199 | + all->Process(p); |
| 200 | + if (p->pdgId() == 35) // 35 is the higgs' pdgId. |
220 | 201 | {
|
221 |
| - if (p != nullptr) |
| 202 | + hs->Process(p); |
| 203 | + twohs->addParticle(p); |
| 204 | + } |
| 205 | + else if (p->pdgId() == 11) // 11 is the electron. |
222 | 206 | {
|
223 |
| - all->Process(p); |
224 |
| - if (p->pdgId() == 35) { |
225 |
| - hs->Process(p); |
226 |
| - twohs->addParticle(p); |
227 |
| - // Changed i --> 0 |
228 |
| - if(p->nParents() > 1) std::cout << "event " << 0 << ": this scalar has " << p->nParents() << " parents! " << std::endl; |
229 |
| - // Changed i --> 0 |
230 |
| - if(0 < 5){ |
231 |
| - std::cout << "h_s, particle status: " << p->status() << std::endl; |
232 |
| - std::cout << "h_s has " << p->nChildren() << std::endl; |
233 |
| - |
234 |
| - for(unsigned int k=0; k < p->nChildren(); k++){ |
235 |
| - std::cout <<" h_s child status, id: " << p->child(k)->status() << ", " << p->child(k)->pdgId() << std::endl; |
236 |
| - } |
| 207 | + e->Process(p); |
237 | 208 | }
|
| 209 | + else if (p->pdgId() == 12) // 12 is the electron neutrino. |
| 210 | + { |
| 211 | + e_neutrino->Process(p); |
| 212 | + } |
| 213 | + else if (p->pdgId() == 13) // 13 is the muon. |
| 214 | + { |
| 215 | + mu->Process(p); |
| 216 | + } |
| 217 | + else if (p->pdgId() == 14) // 14 is the muon neutrino. |
| 218 | + { |
| 219 | + mu_neutrino->Process(p); |
238 | 220 | }
|
239 | 221 | }
|
240 | 222 | }
|
241 | 223 | }
|
242 |
| - |
243 | 224 |
|
244 | 225 | return EL::StatusCode::SUCCESS;
|
245 | 226 | }
|
|
0 commit comments