StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StStrangeMuDstMaker.h
Go to the documentation of this file.
1 
11 #ifndef STAR_StStrangeMuDstMaker
12 #define STAR_StStrangeMuDstMaker
13 #include "StMaker.h"
14 #include "TClonesArray.h"
15 #include "StStrangeControllerBase.h"
16 
17 class TFile;
18 class TTree;
19 class TChain;
20 class StStrangeMuDst;
21 class StStrangeEvMuDst;
22 class StV0I;
23 class StV0MuDst;
24 class StV0Mc;
25 class StXiI;
26 class StXiMuDst;
27 class StXiMc;
28 class StKinkI;
29 class StKinkMuDst;
30 class StKinkMc;
31 class StStrangeAssoc;
32 class StFile;
33 class StStrangeCuts;
34 
36 enum StrDstType {
38  evT = 0,
40  v0T,
42  xiT,
45  strDstT};
46 
48 static const char* strTypeNames[strDstT] = {"Ev","V0","Xi","Kink"};
50 enum StrangeEnum {StrangeNoKeep, StrangeNoFile, StrangeWrite, StrangeRead};
51 
52 class StStrangeMuDstMaker : public StMaker {
53  public:
54  StStrangeMuDstMaker(const char *name="strangeMuDst");
55  virtual ~StStrangeMuDstMaker();
56  void DoT0JitterAbort(Bool_t doIt=kTRUE);
58  void AbortEvent() { abortEvent = kTRUE; }
59 
61 
62  void SetCorrectionFile(char*);
63  void SetFractionFile(char*);
65 
67 
68  void SetRead (const char* eFile=0, const char* treeName=0);
69  void SetRead (StFile* eFiles, const char* treeName=0);
70  void SetWrite(const char* eFile);
71  void SetWrite(){SetWrite(0);}
72  void SetNoKeep();
73  char* GetFile();
75 
77 
78  void DoV0(Bool_t doIt=kTRUE);
79  void DoXi(Bool_t doIt=kTRUE);
80  void DoKink(Bool_t doIt=kTRUE);
81  void DoMc(Bool_t doIt=kTRUE);
82  void Do(Int_t dstType, Bool_t doIt=kTRUE);
83  void Do(const char* name, Bool_t doIt=kTRUE);
84  Bool_t GetDoMc();
86 
88 
89  Int_t GetNV0I(Bool_t MC=kFALSE) { return (MC ? GetNV0Mc() : GetNV0()); }
90  Int_t GetNXiI(Bool_t MC=kFALSE) { return (MC ? GetNXiMc() : GetNXi()); }
91  Int_t GetNKinkI(Bool_t MC=kFALSE) { return (MC ? GetNKinkMc() : GetNKink()); }
92 
93  Int_t GetNV0() { return v0->GetN(); }
94  Int_t GetNV0Mc() { return v0->GetNMc(); }
95  Int_t GetNV0Assoc() { return v0->GetNAssoc(); }
96  Int_t GetNXi() { return xi->GetN(); }
97  Int_t GetNXiMc() { return xi->GetNMc(); }
98  Int_t GetNXiAssoc() { return xi->GetNAssoc(); }
99  Int_t GetNKink() { return kink->GetN(); }
100  Int_t GetNKinkMc() { return kink->GetNMc(); }
101  Int_t GetNKinkAssoc() { return kink->GetNAssoc(); }
103 
105 
106  StStrangeMuDst* GetDatum(Int_t i=0, Bool_t MC=kFALSE, Int_t dstType=evT);
108 
109  StStrangeEvMuDst* GetEventI(Bool_t MC=kFALSE);
110  StV0I* GetV0I(Int_t i=0, Bool_t MC=kFALSE);
111  StXiI* GetXiI(Int_t i=0, Bool_t MC=kFALSE);
112  StKinkI* GetKinkI(Int_t i=0, Bool_t MC=kFALSE);
113 
114  StStrangeEvMuDst* GetEvent();
116 
117  StV0MuDst* GetV0(Int_t i=0);
119  StV0Mc* GetV0Mc(Int_t i=0);
120 
121  StXiMuDst* GetXi(Int_t i=0);
124  StXiMc* GetXiMc(Int_t i=0);
125 
126  StKinkMuDst* GetKink(Int_t i=0);
128  StKinkMc* GetKinkMc(Int_t i=0);
129 
130  StStrangeAssoc* GetXiAssoc(Int_t i=0);
131  StStrangeAssoc* GetV0Assoc(Int_t i=0);
132  StStrangeAssoc* GetKinkAssoc(Int_t i=0);
133 
134  StStrangeCuts& Cuts();
136 
138 
139  TTree* GetTree();
140  TClonesArray* GetEvClonesArray();
141  TClonesArray* GetEvMcArray();
142  TClonesArray* GetCutsArray();
143 
144  TClonesArray* GetV0ClonesArray() { return v0->GetDataArray(); }
145  TClonesArray* GetV0McArray() { return v0->GetMcArray(); }
146  TClonesArray* GetV0AssocArray() { return v0->GetAssocArray(); }
147  TClonesArray* GetXiClonesArray() { return xi->GetDataArray(); }
148  TClonesArray* GetXiMcArray() { return xi->GetMcArray(); }
149  TClonesArray* GetXiAssocArray() { return xi->GetAssocArray(); }
150  TClonesArray* GetKinkClonesArray() { return kink->GetDataArray(); }
151  TClonesArray* GetKinkMcArray() { return kink->GetMcArray(); }
152  TClonesArray* GetKinkAssocArray() { return kink->GetAssocArray(); }
154 
156 
157  virtual Int_t Init();
158  virtual Int_t Make();
159  virtual void Clear(Option_t *option="");
160  virtual Int_t Finish();
161  virtual const char *GetCVS() const {
162  static const char cvs[]="Tag $Name: $ $Id: StStrangeMuDstMaker.h,v 3.21 2014/08/06 11:43:44 jeromel Exp $ built " __DATE__ " " __TIME__ ;
163  return cvs;
164  }
166 
168 
169  void SubDst(StStrangeMuDstMaker* maker);
170  void SubDst(StStrangeMuDstMaker& maker);
171  void SubDst(const char* maker_name);
172  StStrangeMuDstMaker* GetSubDst();
174 
176 
177  void SelectEvent();
180  void UnselectEvent();
181  // ...or select portions (use i<0 to select all of the V0s, etc...
182  void SelectV0(Int_t i=-1) { v0->Select(i); }
183  void SelectXi(Int_t i=-1) { xi->Select(i); }
184  void SelectKink(Int_t i=-1) { kink->Select(i); }
185  void UnselectV0(Int_t i=-1) { v0->Unselect(i); }
186  void UnselectXi(Int_t i=-1) { xi->Unselect(i); }
187  void UnselectKink(Int_t i=-1) { kink->Unselect(i); }
189 
191 
192  void SetV0BufferSize(Int_t b) { bsize[v0T]=b; }
193  void SetXiBufferSize(Int_t b) { bsize[xiT]=b; }
194  void SetKinkBufferSize(Int_t b) { bsize[kinkT]=b; }
196 
198 
199  StStrangeControllerBase* Get(const char* name) const;
200  StStrangeControllerBase* Get(Int_t dstType) const;
202 
203 
204  protected:
206 
207  virtual void InitReadDst();
208  virtual void InitCreateDst();
209  virtual void InitCreateSubDst();
210  virtual Int_t MakeReadDst();
211  virtual Int_t MakeCreateDst();
212  virtual Int_t MakeCreateMcDst();
213  virtual Int_t MakeCreateSubDst();
215 
217 
218  void SetFile(const char* eFile);
219  void SetTreeName(const char* treeName);
220  Int_t OpenFile();
221  Int_t CloseFile();
222  void CheckFile();
224 
225  Int_t MatchName(const char* name) const;
226 
227  TTree* tree;
228  TChain* chain;
229  StStrangeCuts* cuts;
230  char file[1024];
231  TFile* muDst;
232 
233  Bool_t abortEvent;
234  Bool_t firstEvent;
235  Int_t evNumber;
236  Int_t outFileNum;
237  Bool_t fileBlind;
238 
239  Bool_t doT[strDstT];
240  Bool_t doMc;
241  Int_t bsize[strDstT];
242 
243  Bool_t doT0JitterAbort;
244 
245  TClonesArray* evClonesArray;
246  TClonesArray* evMcArray;
247  TClonesArray* cutsArray;
248 
249  StStrangeMuDstMaker* dstMaker;
250  TObjArray subMakers;
251 
252 
253  // Sub-controllers
257  StStrangeControllerBase* cont[strDstT];
258  private:
259  virtual void ClearForReal(Option_t *option="");
260 
261  ClassDef(StStrangeMuDstMaker,4)
262 };
263 
264 inline void StStrangeMuDstMaker::DoT0JitterAbort(Bool_t doIt)
265  { doT0JitterAbort = doIt; }
266 inline void StStrangeMuDstMaker::DoV0(Bool_t doIt)
267  { doT[v0T] = doIt; }
268 inline void StStrangeMuDstMaker::DoXi(Bool_t doIt)
269  { doT[xiT] = doIt; }
270 inline void StStrangeMuDstMaker::DoKink(Bool_t doIt)
271  { doT[kinkT] = doIt; }
272 inline void StStrangeMuDstMaker::Do(Int_t dstType, Bool_t doIt)
273  { doT[dstType] = doIt; }
274 inline void StStrangeMuDstMaker::Do(const char* name, Bool_t doIt)
275  { Do(MatchName(name),doIt); }
276 inline void StStrangeMuDstMaker::DoMc(Bool_t doIt)
277  { doMc = doIt; }
278 inline Bool_t StStrangeMuDstMaker::GetDoMc()
279  { return doMc; }
280 inline TClonesArray* StStrangeMuDstMaker::GetEvClonesArray()
281  { return evClonesArray; }
282 inline TClonesArray* StStrangeMuDstMaker::GetEvMcArray()
283  { return evMcArray; }
284 inline TClonesArray* StStrangeMuDstMaker::GetCutsArray()
285  { return cutsArray; }
287  Int_t dstType)
288  { if (dstType) return cont[dstType]->Get(i,(int) MC);
289  else return (StStrangeMuDst*) GetEventI(MC); }
290 inline StStrangeEvMuDst* StStrangeMuDstMaker::GetEvent()
291  { return (evClonesArray ?
292  (StStrangeEvMuDst*) evClonesArray->At(0) : 0); }
294  { return (evMcArray ?
295  (StStrangeEvMuDst*) evMcArray->At(0) : 0); }
296 inline StStrangeEvMuDst* StStrangeMuDstMaker::GetEventI(Bool_t MC)
297  { return (MC ? GetMcEvent() : GetEvent()); }
298 inline StV0I* StStrangeMuDstMaker::GetV0I(Int_t i, Bool_t MC)
299  { return (StV0I*) (MC ? v0->GetMc(i) : v0->Get(i)); }
300 inline StXiI* StStrangeMuDstMaker::GetXiI(Int_t i, Bool_t MC)
301  { return (StXiI*) (MC ? xi->GetMc(i) : xi->Get(i)); }
302 inline StKinkI* StStrangeMuDstMaker::GetKinkI(Int_t i, Bool_t MC)
303  { return (StKinkI*) (MC ? kink->GetMc(i) : kink->Get(i)); }
304 inline StV0MuDst* StStrangeMuDstMaker::GetV0(Int_t i)
305  { return (StV0MuDst*) v0->Get(i); }
306 inline StXiMuDst* StStrangeMuDstMaker::GetXi(Int_t i)
307  { return (StXiMuDst*) xi->Get(i); }
308 inline StKinkMuDst* StStrangeMuDstMaker::GetKink(Int_t i)
309  { return (StKinkMuDst*) kink->Get(i); }
311  { return (StV0Mc*) v0->GetMc(i); }
313  { return (StXiMc*) xi->GetMc(i); }
315  { return (StKinkMc*) kink->GetMc(i); }
316 inline StStrangeAssoc* StStrangeMuDstMaker::GetV0Assoc(Int_t i)
317  { return v0->GetAssoc(i); }
318 inline StStrangeAssoc* StStrangeMuDstMaker::GetXiAssoc(Int_t i)
319  { return xi->GetAssoc(i); }
321  { return kink->GetAssoc(i); }
322 inline TTree* StStrangeMuDstMaker::GetTree()
323  { return tree; }
324 inline StStrangeCuts& StStrangeMuDstMaker::Cuts()
325  { return (*cuts); }
326 inline void StStrangeMuDstMaker::SubDst(StStrangeMuDstMaker& maker)
327  { SubDst(&maker); }
328 inline void StStrangeMuDstMaker::SubDst(const char* maker_name)
329  { SubDst((StStrangeMuDstMaker*) GetMaker(maker_name)); }
330 inline StStrangeMuDstMaker* StStrangeMuDstMaker::GetSubDst()
331  { return dstMaker; }
332 inline StStrangeControllerBase* StStrangeMuDstMaker::Get(Int_t dstType) const
333  { return cont[dstType]; }
334 inline StStrangeControllerBase* StStrangeMuDstMaker::Get(const char* name) const
335  { return cont[MatchName(name)]; }
336 inline Int_t StStrangeMuDstMaker::MatchName(const char* name) const
337  { for (Int_t i=1; i<strDstT; i++)
338  if (!(strcmp(name,strTypeNames[i]))) return i;
339  return 0; }
340 
341 #endif
342 
343 //____________________________________________________________________
344 //
345 // $Id: StStrangeMuDstMaker.h,v 3.21 2014/08/06 11:43:44 jeromel Exp $
346 // $Log: StStrangeMuDstMaker.h,v $
347 // Revision 3.21 2014/08/06 11:43:44 jeromel
348 // Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
349 //
350 // Revision 3.20 2009/09/02 19:39:44 genevb
351 // Fixes to pointer and string conversions (RT ticket 1612), prep for 64-bit
352 //
353 // Revision 3.19 2009/08/26 16:56:06 fine
354 // fix the compilation issues under SL5_64_bits gcc 4.3.2
355 //
356 // Revision 3.18 2004/11/02 17:54:07 genevb
357 // Leave corrupt file protection to ROOT / Remove my protection
358 //
359 // Revision 3.17 2004/07/12 21:45:35 genevb
360 // Handle missing Event branch info condition
361 //
362 // Revision 3.16 2003/10/20 00:21:47 genevb
363 // Fix a typo for Assoc introduced in vers. 3.13
364 //
365 // Revision 3.15 2003/09/02 17:59:04 perev
366 // gcc 3.2 updates + WarnOff
367 //
368 // Revision 3.14 2003/07/09 21:58:30 genevb
369 // Use Get/SetMode() from StMaker
370 //
371 // Revision 3.13 2003/05/30 21:20:19 genevb
372 // doxygen savvy, encoding of FTPC mults, change virtual funcs
373 //
374 // Revision 3.12 2003/02/16 21:28:45 jeromel
375 // GetCVS() added
376 //
377 // Revision 3.11 2003/02/10 16:02:24 genevb
378 // Now read files using TChains; no splitting of MuDst file
379 //
380 // Revision 3.10 2002/06/21 02:44:10 genevb
381 // handle events without primary vertex better
382 //
383 // Revision 3.9 2002/05/29 19:08:16 genevb
384 // Better handling of improperly closed files
385 //
386 // Revision 3.8 2002/04/30 16:02:48 genevb
387 // Common muDst, improved MC code, better kinks, StrangeCuts now a branch
388 //
389 // Revision 3.7 2001/09/14 21:39:02 genevb
390 // Adjustments to not depend on order in which maker Clear() is called
391 //
392 // Revision 3.6 2001/08/23 13:20:56 genevb
393 // Many bug workarounds...
394 //
395 // Revision 3.5 2001/05/04 20:15:14 genevb
396 // Common interfaces and reorganization of components, add MC event info
397 //
398 // Revision 3.4 2000/12/18 21:35:18 genevb
399 // Introduced variable buffer-sizing
400 //
401 // Revision 3.3 2000/09/28 20:16:05 jones
402 // Added doT0JitterAbort() optio; added fix to CheckFile in case of no file
403 //
404 // Revision 3.2 2000/09/07 02:22:10 genevb
405 // Added AbortEvent() functionality
406 //
407 // Revision 3.1 2000/07/17 20:28:40 genevb
408 // File size limitation workaround, some under the hood improvements
409 //
410 // Revision 3.0 2000/07/14 12:56:50 genevb
411 // Revision 3 has event multiplicities and dedx information for vertex tracks
412 //
413 // Revision 2.1 2000/06/09 22:17:11 genevb
414 // Allow MC data to be copied between DSTs, other small improvements
415 //
416 // Revision 2.0 2000/06/02 22:11:54 genevb
417 // New version of Strangeness micro DST package
418 //
419 // Revision 1.5 2000/04/18 02:30:04 genevb
420 // Added multi-file capabilities
421 //
422 // Revision 1.4 2000/04/06 14:51:11 genevb
423 // Fixed bug with storing event info when making subDST
424 //
425 // Revision 1.3 2000/04/05 20:23:53 genevb
426 // Introduce creating sub-Micro DSTs, dynamic expansion of clones arrays as needed, SetNoKeep() function
427 //
428 // Revision 1.2 2000/03/29 20:52:13 genevb
429 // Added StKinkMuDst, replaced arrays
430 //
431 // Revision 1.1 2000/03/29 03:10:07 genevb
432 // Introduction of Strangeness Micro DST package
433 //
StXiMc * GetXiMc(Int_t i=0)
StStrangeAssoc * GetKinkAssoc(Int_t i=0)
Data-MC association maps.
Definition: StV0I.hh:31
StrangeEnum
I/O modes.
Definition: StTree.h:125
StV0Mc * GetV0Mc(Int_t i=0)
See StV0I interface for available functions.
Definition: StXiI.hh:24
StrDstType
DST types.
virtual void Clear(Option_t *option="")
User defined functions.
void UnselectEvent()
Unselect whole event for sub DST.
StKinkI * GetKinkI(Int_t i=0, Bool_t MC=kFALSE)
Interfaces for data and MC.
Event.
StStrangeMuDst * GetDatum(Int_t i=0, Bool_t MC=kFALSE, Int_t dstType=evT)
General datum, where dstType is of the enumeration StrDstType.
Definition: StV0Mc.hh:17
StStrangeEvMuDst * GetMcEvent()
Event information.
void AbortEvent()
turn off filling of TTree for this event, regardless
Definition: StXiMc.hh:17
StKinkMc * GetKinkMc(Int_t i=0)
See StKinkI interface for available functions.
void SelectEvent()
Select whole event for sub DST.