Revision: | 1.9 |
Committed: | Tue Jul 6 08:33:16 2010 UTC (14 years, 10 months ago) by sixie |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_029c, Mit_029b, Mit_029a, Mit_028a, Mit_028, Mit_027, Mit_027a, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, HEAD |
Changes since 1.8: | +2 -2 lines |
Log Message: | added null pointer protections |
# | Content |
---|---|
1 | // $Id: TauIDMod.cc,v 1.8 2009/06/15 15:00:21 loizides Exp $ |
2 | |
3 | #include "MitPhysics/Mods/interface/TauIDMod.h" |
4 | #include "MitPhysics/Init/interface/ModNames.h" |
5 | #include "MitAna/DataTree/interface/CaloTauCol.h" |
6 | |
7 | using namespace mithep; |
8 | |
9 | ClassImp(mithep::TauIDMod) |
10 | |
11 | //------------------------------------------------------------------------------ |
12 | TauIDMod::TauIDMod(const char *name, const char *title) : |
13 | BaseMod(name,title), |
14 | fCaloTausName(Names::gkCaloTauBrn), |
15 | fGoodTausName(ModNames::gkGoodTausName), |
16 | fPtMin(10.0), |
17 | fJetPtMin(20.0), |
18 | fLeadTrackPtMin(6.0), |
19 | fNSignalTracksMax(3), |
20 | fNIsoTracksMax(0), |
21 | fSignalTracksMassMax(2.0), |
22 | fIsoTrackPtSumMax(5.0), |
23 | fEnergyFractionEmMax(0.95), |
24 | fHCalEtOverPtMin(0.1), |
25 | fCaloTaus(0) |
26 | { |
27 | // Constructor. |
28 | } |
29 | |
30 | //------------------------------------------------------------------------------ |
31 | void TauIDMod::Process() |
32 | { |
33 | // Process entries of the tree. |
34 | |
35 | LoadBranch(fCaloTausName); |
36 | |
37 | CaloTauOArr *GoodTaus = new CaloTauOArr; |
38 | GoodTaus->SetName(fGoodTausName); |
39 | |
40 | for (UInt_t i=0; i<fCaloTaus->GetEntries(); ++i) { |
41 | const CaloTau *tau = fCaloTaus->At(i); |
42 | |
43 | if (tau->Pt() <= fPtMin) |
44 | continue; |
45 | |
46 | if (!tau->SourceCaloJet() || tau->SourceCaloJet()->Pt() <= fJetPtMin) |
47 | continue; |
48 | |
49 | if (tau->NSignalTracks() == 0 || tau->NSignalTracks() > fNSignalTracksMax) |
50 | continue; |
51 | |
52 | if (!tau->LeadTrack() || tau->LeadTrack()->Pt() < fLeadTrackPtMin) |
53 | continue; |
54 | |
55 | if (tau->NIsoTracks() > fNIsoTracksMax) |
56 | continue; |
57 | |
58 | if (tau->SignalTracksMass() > fSignalTracksMassMax) |
59 | continue; |
60 | |
61 | if (tau->IsoTrackPtSum() > fIsoTrackPtSumMax) |
62 | continue; |
63 | |
64 | if (tau->SourceCaloJet()->EnergyFractionEm() > fEnergyFractionEmMax) |
65 | continue; |
66 | |
67 | if (tau->LeadTrack3x3HCalEt()/tau->LeadTrack()->Pt() < fHCalEtOverPtMin) |
68 | continue; |
69 | |
70 | // always apply these requirements |
71 | if (TMath::Abs(tau->Charge()) != 1) |
72 | continue; |
73 | |
74 | if (TMath::Abs(TMath::Abs(tau->Eta())-1.53) < 0.02) |
75 | continue; |
76 | |
77 | // add good tau to output collection |
78 | GoodTaus->Add(tau); |
79 | } |
80 | |
81 | // sort according to pt |
82 | GoodTaus->Sort(); |
83 | |
84 | // add to event for other modules to use |
85 | AddObjThisEvt(GoodTaus); |
86 | } |
87 | |
88 | //------------------------------------------------------------------------------ |
89 | void TauIDMod::SlaveBegin() |
90 | { |
91 | // Run startup code on the computer (slave) doing the actual analysis. Here, |
92 | // we just request the Tau collection branch. |
93 | |
94 | ReqBranch(fCaloTausName, fCaloTaus); |
95 | } |