ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/Validation/src/MCParticlesValMod.cc
Revision: 1.1
Committed: Tue Mar 17 15:44:08 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008pre2
Log Message:
Test mods

File Contents

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