StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuDstFilterMaker.h
1 /***************************************************************************
2  *
3  * $Id: StMuDstFilterMaker.h,v 1.11 2014/08/06 11:43:31 jeromel Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  ***************************************************************************/
6 #ifndef StMuDstFilterMaker_hh
7 #define StMuDstFilterMaker_hh
8 
9 #include "StMaker.h"
10 #include "StChain.h"
11 
12 #include "StMuDstMaker.h"
13 #include "StMuDst.h"
14 #include "StMuEvent.h"
15 #include "StMuTrack.h"
16 #ifndef __NO_STRANGE_MUDST__
17 class StStrangeEvMuDst;
18 class StV0MuDst;
19 class StXiMuDst;
20 #endif
21 #include <string>
22 
23 class StMuEmcCollection;
24 
25 class TTree;
26 class TFile;
27 
32 class StMuDstFilterMaker : public StMaker {
33  public:
35  StMuDstFilterMaker(const char* name="muDstFilter");
37 
38  int Make();
39  int Finish();
40  virtual const char *GetCVS() const {
41  static const char cvs[]="Tag $Name: $ $Id: StMuDstFilterMaker.h,v 1.11 2014/08/06 11:43:31 jeromel Exp $ built " __DATE__ " " __TIME__ ;
42  return cvs;
43  }
44 
45  void setOutputDirName(const char* name) { mOutDirName = string(name); }
46  void setOutputFileName(const char* name) { mOutFileName = string(name); }
47  void setMuDstMaker( StMuDstMaker* maker) { mMuDstMaker = maker; }
48  void setFilterGlobals(int filterGlobals = 1) { mFilterGlobals = filterGlobals; }
49  void setDoBemc(int doBemc=1) { mDoBemc = doBemc;}
50  void setDoEemc(int doEemc=1) { mDoEemc = doEemc;}
51 
52  protected:
54  template<class T> bool filter(T* t) { return false;}
56  bool filter(StMuDst* mu) {return mu->event() && fabs(mu->event()->primaryVertexPosition().z())<100 ;}
58  bool filter(StMuEvent* ev) {return true; } // keep all event-wise information
59  bool filter(StMuTrack* track);
60  bool filter(StMuEmcCollection* emc) { return true; } // and I want to keep the emc collection
61 
62 
63  StMuDstMaker* mMuDstMaker; // pointer to the StMuDstMaker that is providing the input
64 
65  // output file
66  TFile* mFile;
67  string mOutDirName;
68  string mOutFileName;
69  string mCurFileName;
70  TChain* mChain;
71  TTree* mTTree;
73  Int_t mDoBemc;
74  Int_t mDoEemc;
75  void createArrays();
76  void clearArrays();
77  void clear();
78  void close();
79  void open(const Char_t *);
80  template <class T>
81  int addType(TClonesArray* tcaTo , T t);
82  template <class T>
83  int addType(TClonesArray *tca, TClonesArray* tcaTo , T *t);
84 
86  TClonesArray* mArrays[__NARRAYS__];//->
87 #ifndef __NO_STRANGE_MUDST__
88  TClonesArray* mStrangeArrays[__NSTRANGEARRAYS__];//->
89 #endif
90  TClonesArray* mEmcArrays[__NEMCARRAYS__];//->
91 
92  ClassDef(StMuDstFilterMaker, 1)
93 };
94 
95 
96 #endif
97 
98 /***************************************************************************
99  *
100  * $Log: StMuDstFilterMaker.h,v $
101  * Revision 1.11 2014/08/06 11:43:31 jeromel
102  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
103  *
104  * Revision 1.10 2011/04/08 01:25:50 fisyak
105  * Add branches for MC track and vertex information, add IdTruth to tracks and vertices, reserve a possiblity to remove Strange MuDst
106  *
107  * Revision 1.9 2005/05/18 22:47:29 mvl
108  * Fixed StMuDstFilterMaker to work again with changes in MuDstMaker
109  * (the change in v1.6 was faulty. Thanks Alex for finding this)
110  * Added some new features suggested by Alex Suiade:
111  * - Emc data now supported (for SL04k and later MuDst).
112  * Flags added to switch Eemc and Bemc copying seperately (setDoBemc and setDoEemc)
113  * - Global tracks are checked seperately. They were only copied
114  * if the corresponding primary fullfills the filter() criteria.
115  * Now they are also copied if only the global track fullfills the criteria
116  * Can be switched with setFilterGlobals()
117  *
118  * Revision 1.8 2004/07/27 04:31:37 mvl
119  * Changed includes to class StV0MuDst etc to reduce interdependence of makers
120  *
121  * Revision 1.7 2004/07/27 02:37:40 mvl
122  * Added includes for some Strange Mudst classes to rpovide base class for Strange Mudst filter
123  *
124  * Revision 1.6 2004/05/02 04:10:14 perev
125  * private => protected
126  *
127  * Revision 1.5 2004/04/29 03:35:57 perev
128  * protected ==> protected
129  *
130  * Revision 1.4 2003/11/24 23:36:36 laue
131  * commented the StMuEmcCollection out
132  *
133  * Revision 1.3 2003/09/07 03:49:03 perev
134  * gcc 3.2 + WarnOff
135  *
136  * Revision 1.2 2003/08/04 14:38:10 laue
137  * Alex Suaide's updated for the EMC. Now EEMC is included.
138  *
139  * Revision 1.1 2003/04/15 18:48:36 laue
140  * Minor changes to be able to filter MuDst.root files and an example
141  * how to do this. The StMuDstFilterMaker is just an example, it has to be
142  * customized (spoilers, chrome weels, etc.) by the user.
143  *
144  *
145  **************************************************************************/
Int_t mFilterGlobals
If set, keep also globals that fulfill cuts, while primary does not.
Int_t mDoBemc
Copy barrel data (if it passes cuts)
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in &#39;physical events&#39;. Therefore there is only 1 primary vert...
Definition: StMuEvent.cxx:221
bool filter(StMuEvent *ev)
Now I specialize the filter function to select individual object.
int Make()
Filters the muDst and writes the filtered version.
StMuDstFilterMaker(const char *name="muDstFilter")
Default constructor; get pointer to StMuDstMaker.
TClonesArray * mArrays[__NARRAYS__]
the list of TClonesArrays to copy
int Finish()
Writes and closes the output file.
void open(const Char_t *)
bool filter(StMuDst *mu)
If this function returns false, the whole event is discarded.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
Int_t mDoEemc
Copy endcap data (if it passes cuts)
bool filter(T *t)
specialize this function to apply filters to the individual branches