ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Validation/src/MCParticlesValMod.cc
Revision: 1.2
Committed: Mon Jun 15 15:00:23 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b
Changes since 1.1: +3 -2 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

# Content
1 // $Id: MCParticlesValMod.cc,v 1.1 2009/03/23 09:09:14 loizides Exp $
2
3 #include "MitPhysics/Validation/interface/MCParticlesValMod.h"
4 #include "MitAna/DataTree/interface/MCParticleCol.h"
5 #include "MitAna/DataTree/interface/Names.h"
6 #include <TH1D.h>
7
8 using namespace mithep;
9
10 ClassImp(mithep::MCParticlesValMod)
11
12 //--------------------------------------------------------------------------------------------------
13 MCParticlesValMod::MCParticlesValMod(const char *name, const char *title) :
14 BaseMod(name,title),
15 fPartName(Names::gkMCPartBrn),
16 fParticles(0)
17 {
18 // Constructor.
19 }
20
21 //--------------------------------------------------------------------------------------------------
22 void MCParticlesValMod::Process()
23 {
24 // Process entries of the tree. For this module, we just load
25 // the branch and fill the histograms.
26
27 LoadBranch(GetPartName());
28
29 Int_t ents=fParticles->GetEntries();
30 for(Int_t i=0;i<ents;++i) {
31 const MCParticle *p = fParticles->At(i);
32 fHs[0]->Fill(p->Pt());
33 fHs[1]->Fill(p->Eta());
34 if (p->IsGenerated()) {
35 fHs[2]->Fill(p->Pt());
36 fHs[3]->Fill(p->Eta());
37 }
38 if (p->IsSimulated()) {
39 fHs[4]->Fill(p->Pt());
40 fHs[5]->Fill(p->Eta());
41 }
42
43 Double_t mdiff = (p->Mass() - p->PdgMass()) / (p->PdgMass()+0.01);
44 fHs[6]->Fill(mdiff);
45 if (p->IsGenerated())
46 fHs[7]->Fill(mdiff);
47 if (p->IsSimulated())
48 fHs[8]->Fill(mdiff);
49 if (mdiff>0.01) {
50 cout << "----" << mdiff << "-> " << p->Mass() << " " << p->PdgMass() << ": ";
51 p->Print();
52 fHs[9]->Fill(p->AbsPdgId());
53 }
54 }
55 }
56
57 //--------------------------------------------------------------------------------------------------
58 void MCParticlesValMod::SlaveBegin()
59 {
60 // Run startup code on the computer (slave) doing the actual
61 // analysis. Here, we typically initialize histograms and
62 // other analysis objects and request branches. For this module,
63 // we request a branch of the MitTree.
64
65 ReqBranch(GetPartName(), fParticles);
66
67 AddTH1(fHs[0],"hPtHist",";p_{t};#",100,0.,250.);
68 AddTH1(fHs[1],"hEtaHist",";#eta;#",160,-8.,8.);
69 AddTH1(fHs[2],"hGenPtHist",";p_{t};#",100,0.,250.);
70 AddTH1(fHs[3],"hGenEtaHist",";#eta;#",160,-8.,8.);
71 AddTH1(fHs[4],"hSimPtHist",";p_{t};#",100,0.,250.);
72 AddTH1(fHs[5],"hSimEtaHist",";#eta;#",160,-8.,8.);
73 AddTH1(fHs[6],"hMassDiff",";#eta;#",1000,-5.,5.);
74 AddTH1(fHs[7],"hGenMassDiff",";#eta;#",1000,-5.,5.);
75 AddTH1(fHs[8],"hSimMassDiff",";#eta;#",1000,-5.,5.);
76 AddTH1(fHs[9],"hDiffPdg",";pdg;#",500,0.5,500.5);
77 }
78
79 //--------------------------------------------------------------------------------------------------
80 void MCParticlesValMod::SlaveTerminate()
81 {
82 // Run finishing code on the computer (slave) that did the
83 // analysis. For this module, we dont do anything here.
84 }
85