ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/src/TrackToPartMod.cc
Revision: 1.1
Committed: Fri Jun 26 16:47:18 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, 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, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, HEAD
Branch point for: Mit_025c_branch
Log Message:
Cleanup and added TrackToPartMod

File Contents

# Content
1 // $Id: PublisherMod.cc,v 1.2 2009/03/11 18:13:11 bendavid Exp $
2
3 #include "MitAna/PhysicsMod/interface/TrackToPartMod.h"
4 #include "MitAna/DataTree/interface/StableParticleCol.h"
5 #include "MitAna/DataTree/interface/TrackCol.h"
6
7 using namespace mithep;
8
9 //--------------------------------------------------------------------------------------------------
10 TrackToPartMod::TrackToPartMod(const char *name, const char *title) :
11 BaseMod(name,title),
12 fBranchName("SetMe"),
13 fPublicName(""),
14 fPubPerEvent(kTRUE),
15 fAbsPdgId(22),
16 fColIn(0),
17 fColOut(0)
18 {
19 // Constructor.
20 }
21
22 //--------------------------------------------------------------------------------------------------
23 void TrackToPartMod::Process()
24 {
25 // Load the branch, add pointers to the object array. Publish object array if needed.
26
27 if (!LoadEventObject(GetBranchName(), fColIn)) {
28 SendError(kAbortModule, "Process", "Could not load data!");
29 return;
30 }
31
32 const UInt_t entries = fColIn->GetEntries();
33
34 if (fPubPerEvent) {
35 fColOut = new StableParticleOArr(entries, GetPublicName());
36 fColOut->SetOwner(kTRUE);
37 }
38 else
39 fColOut->Reset();
40
41 for(UInt_t i=0; i<entries; ++i)
42 fColOut->AddOwned(new StableParticle(fAbsPdgId,fColIn->At(i)));
43
44 if (fPubPerEvent)
45 AddObjThisEvt(fColOut);
46 }
47
48 //--------------------------------------------------------------------------------------------------
49 void TrackToPartMod::SlaveBegin()
50 {
51 // Request the branch to be published. Depending on the user's decision publish the array.
52
53 ReqEventObject(GetBranchName(), fColIn);
54
55 if (fPublicName.IsNull())
56 fPublicName = GetBranchName();
57
58 if (!GetPubPerEvent()) {
59 fColOut = new StableParticleOArr(0, GetPublicName());
60 fColOut->SetOwner(kTRUE);
61 PublishObj(fColOut);
62 }
63 }
64
65 //--------------------------------------------------------------------------------------------------
66 void TrackToPartMod::SlaveTerminate()
67 {
68 // Cleanup in case objects are published only once.
69
70 if (!fPubPerEvent) {
71 RetractObj(GetPublicName());
72 delete fColOut;
73 }
74 }