ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/interface/PublisherMod.h
Revision: 1.1
Committed: Fri Nov 28 20:27:23 2008 UTC (16 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
Added PlotKineMod and PublisherMod. Needs more finetuning.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2     // $Id: PublisherMod.h,v 1.1 2008/11/25 14:30:53 loizides Exp $
3     //
4     // PublisherMod
5     //
6     // Authors: C.Loizides
7     //--------------------------------------------------------------------------------------------------
8    
9     #ifndef MITANA_PHYSICSMOD_PUBLISHERMOD_H
10     #define MITANA_PHYSICSMOD_PUBLISHERMOD_H
11    
12     #include "MitAna/TreeMod/interface/BaseMod.h"
13     #include "MitAna/DataTree/interface/Collections.h"
14    
15     namespace mithep
16     {
17     template<class T>
18     class PublisherMod : public BaseMod
19     {
20     public:
21     PublisherMod(const char *name="PublisherMod",
22     const char *title="Publisher module");
23     ~PublisherMod() {}
24    
25     const char *GetBranchName() const { return fBranchName; }
26     void SetBranchName(const char *n) { fBranchName=n; }
27     const char *GetPublicName() const { return fPublicName; }
28     void SetPublicName(const char *n) { fPublicName=n; }
29    
30     protected:
31     TString fBranchName; //name of collection
32     TString fPublicName; //name of collection
33     T *fObj; //!pointer to collection
34    
35     void Process();
36     void SlaveBegin();
37    
38     ClassDefT(PublisherMod,1) // Plot kinematics module
39     };
40     }
41    
42     //--------------------------------------------------------------------------------------------------
43     template<class T>
44     mithep::PublisherMod<T>::PublisherMod(const char *name, const char *title) :
45     BaseMod(name,title),
46     fBranchName("SetMe"),
47     fPublicName(""),
48     fObj(0)
49     {
50     // Constructor.
51     }
52    
53     //--------------------------------------------------------------------------------------------------
54     template<class T>
55     void mithep::PublisherMod<T>::Process()
56     {
57     // Process entries of the tree: Just load the branch and fill the histograms.
58    
59     LoadBranch(GetBranchName());
60     AddObjThisEvt(fObj,GetPublicName());
61     }
62    
63     //--------------------------------------------------------------------------------------------------
64     template<class T>
65     void mithep::PublisherMod<T>::SlaveBegin()
66     {
67     // Request a branch and create the histograms.
68    
69     ReqBranch(GetBranchName(), fObj);
70    
71     if (fPublicName.IsNull())
72     fPublicName = fBranchName;
73     }
74     #endif