ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/PhysicsMod/interface/PublisherMod.h
(Generate patch)

Comparing UserCode/MitAna/PhysicsMod/interface/PublisherMod.h (file contents):
Revision 1.3 by loizides, Tue Dec 9 10:18:33 2008 UTC vs.
Revision 1.7 by loizides, Tue May 12 18:41:40 2009 UTC

# Line 18 | Line 18
18  
19   namespace mithep
20   {
21 <  template<class T>
21 >  template<class TIn, class TOut=TIn>
22    class PublisherMod : public BaseMod
23    {
24      public:
25        PublisherMod(const char *name="PublisherMod",
26                     const char *title="Publisher module");
27      ~PublisherMod() {}
27  
28 <      const char              *GetBranchName()              const { return fBranchName;  }
29 <      const char              *GetPublicName()              const { return fPublicName;  }
30 <      Bool_t                   GetPubPerEvent()             const { return fPubPerEvent; }
31 <      void                     SetBranchName(const char *n)       { fBranchName=n;       }
32 <      void                     SetPublicName(const char *n)       { fPublicName=n;       }
33 <      void                     PublishPerEvent(Bool_t b)          { fPubPerEvent = b;    }
28 >      const char              *GetBranchName()              const { return fBranchName;     }
29 >      const char              *GetInputName()               const { return GetBranchName(); }
30 >      const char              *GetOutputName()              const { return GetPublicName(); }
31 >      const char              *GetPublicName()              const { return fPublicName;     }
32 >      Bool_t                   GetPubPerEvent()             const { return fPubPerEvent;    }
33 >      void                     SetBranchName(const char *n)       { fBranchName=n;          }
34 >      void                     SetInputName(const char *n)        { SetBranchName(n);       }
35 >      void                     SetOutputName(const char *n)       { SetPublicName(n);       }
36 >      void                     SetPublicName(const char *n)       { fPublicName=n;          }
37 >      void                     PublishPerEvent(Bool_t b)          { fPubPerEvent = b;       }
38  
39      protected:
40        TString                  fBranchName;    //name of collection
41        TString                  fPublicName;    //name of collection
42        Bool_t                   fPubPerEvent;   //=true then publish per event (def=1)
43 <      const Collection<T>     *fColIn;         //!pointer to collection (in)
44 <      ObjArray<T>             *fColOut;        //!pointer to collection (out)
43 >      const Collection<TIn>   *fColIn;         //!pointer to collection (in)
44 >      ObjArray<TOut>          *fColOut;        //!pointer to collection (out)
45  
46        void                     Process();
47        void                     SlaveBegin();
48        void                     SlaveTerminate();
49  
50 <      ClassDefT(PublisherMod,1) // Publisher module
50 >      ClassDefT(PublisherMod, 1) // Publisher module
51    };
52   }
53  
54   //--------------------------------------------------------------------------------------------------
55 < template<class T>
56 < mithep::PublisherMod<T>::PublisherMod(const char *name, const char *title) :
55 > template<class TIn, class TOut>
56 > mithep::PublisherMod<TIn, TOut>::PublisherMod(const char *name, const char *title) :
57    BaseMod(name,title),
58    fBranchName("SetMe"),
59    fPublicName(""),
# Line 62 | Line 65 | mithep::PublisherMod<T>::PublisherMod(co
65   }
66  
67   //--------------------------------------------------------------------------------------------------
68 < template<class T>
69 < void mithep::PublisherMod<T>::Process()
68 > template<class TIn, class TOut>
69 > void mithep::PublisherMod<TIn, TOut>::Process()
70   {
71    // Load the branch, add pointers to the object array. Publish object array if needed.
72  
73    LoadBranch(GetBranchName());
74    if (fPubPerEvent)
75 <    fColOut = new mithep::ObjArray<T>(0, GetPublicName());
75 >    fColOut = new mithep::ObjArray<TOut>(0, GetPublicName());
76    else
77      fColOut->Reset();
78  
# Line 82 | Line 85 | void mithep::PublisherMod<T>::Process()
85   }
86  
87   //--------------------------------------------------------------------------------------------------
88 < template<class T>
89 < void mithep::PublisherMod<T>::SlaveBegin()
88 > template<class TIn, class TOut>
89 > void mithep::PublisherMod<TIn, TOut>::SlaveBegin()
90   {
91    // Request the branch to be published. Depending on the user's decision publish the array.
92  
# Line 93 | Line 96 | void mithep::PublisherMod<T>::SlaveBegin
96      fPublicName = fBranchName;
97  
98    if (!GetPubPerEvent()) {
99 <    fColOut = new mithep::ObjArray<T>(0, GetPublicName());
99 >    fColOut = new mithep::ObjArray<TOut>(0, GetPublicName());
100      PublishObj(fColOut);
101    }
102   }
103  
104   //--------------------------------------------------------------------------------------------------
105 < template<class T>
106 < void mithep::PublisherMod<T>::SlaveTerminate()
105 > template<class TIn, class TOut>
106 > void mithep::PublisherMod<TIn, TOut>::SlaveTerminate()
107   {
108    // Cleanup in case objects are published only once.
109  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines