1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.2 |
// $Id: PublisherMod.h,v 1.1 2008/11/28 20:27:23 loizides Exp $
|
3 |
loizides |
1.1 |
//
|
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 |
loizides |
1.2 |
ClassDefT(PublisherMod,1) // Publisher module
|
39 |
loizides |
1.1 |
};
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
//--------------------------------------------------------------------------------------------------
|
43 |
|
|
template<class T>
|
44 |
|
|
mithep::PublisherMod<T>::PublisherMod(const char *name, const char *title) :
|
45 |
|
|
BaseMod(name,title),
|
46 |
loizides |
1.2 |
fBranchName(""),
|
47 |
loizides |
1.1 |
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 |
loizides |
1.2 |
AddObjThisEvt(fObj, GetPublicName());
|
61 |
loizides |
1.1 |
}
|
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
|