StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTofrNtupleMaker.h
1 /*******************************************************************
2  *
3  * $Id: StTofrNtupleMaker.h,v 1.5 2014/08/06 11:43:48 jeromel Exp $
4  *
5  * Author: Xin Dong
6  *****************************************************************
7  *
8  * Description: example maker to get the matched TOFr cells and fill
9  * into TOFr tree.
10  *
11  *****************************************************************
12  *
13  * $Log: StTofrNtupleMaker.h,v $
14  * Revision 1.5 2014/08/06 11:43:48 jeromel
15  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
16  *
17  * Revision 1.4 2008/05/06 18:42:09 dongx
18  * Updated for Run8 analysis
19  *
20  * Revision 1.2 2004/04/12 16:17:03 dongx
21  * add AdcLoRes in the ntuple
22  *
23  * Revision 1.1 2004/03/11 22:39:54 dongx
24  * first release
25  *
26  *
27  *******************************************************************/
28 #ifndef StTofrNtupleMaker_hh
29 #define StTofrNtupleMaker_hh
30 #include "StMaker.h"
31 
32 #define __SIGMA_SCALE__ 1000.
33 #include <string>
34 #ifndef ST_NO_NAMESPACES
35 using std::string;
36 #endif
37 #include "StTofrCellData.h"
38 #include <StPhysicalHelixD.hh>
39 
40 class StEvent;
41 class StTofCollection;
43 class StSPtrVecTofData;
44 class StTofrGeometry;
45 //class StTofrDaqMap;
46 class TFile;
47 class TTree;
48 class TNtuple;
49 
50 class StTofrNtupleMaker : public StMaker {
51  public:
52  StTofrNtupleMaker(const Char_t *name, const Char_t *outname);
54 
55  Int_t Init();
56  Int_t InitRun(int runnumber);
57  Int_t Make();
58  Int_t FinishRun(int runnumber);
59  Int_t Finish();
60 
61  void SetNtupleFileName(Char_t*);
62  void setOuterTrackGeometry();
63  void setStandardTrackGeometry();
64  void setValidAdcRange(Int_t, Int_t);
65  void setValidTdcRange(Int_t, Int_t);
66  void setInitGeomFromOther(const Bool_t);
67 
68  void bookNtuples();
69 
70  bool strobeEvent(StSPtrVecTofData&); // check pVPD data for strobe event
71 
72  bool validAdc(float const);
73  bool validTdc(float const);
74 
75 private:
76  static const Int_t mNTOFR = 120; //72;
77  static const Int_t mNPVPD = 3;
78 
79  Bool_t mYear2;
80  Bool_t mYear3;
81  Bool_t mYear4;
82 
83  StPhysicalHelixD* mBeamHelix;
84  float mBeamX, mBeamY;
85 
86  StTofrGeometry *mTofrGeom;
87  Bool_t mInitGeomFromOther;
88  // StTofrDaqMap * mDaqMap; //! tofr daq map
89  Bool_t mOuterTrackGeometry;
90 
91  Int_t mStrobeTdcMin[mNPVPD];
92  Int_t mStrobeTdcMax[mNPVPD];
93 
94  // various cut-offs and ranges
95  float mMinValidTdc;
96  float mMaxValidTdc;
97  float mMinValidAdc;
98  float mMaxValidAdc;
99  Float_t mPvpdAdc[mNPVPD];
100  Float_t mPvpdTdc[mNPVPD];
101  Float_t mPvpdAdcLoRes[mNPVPD];
102 
103  // ntuple related data members
104  Int_t mAcceptedEvents;
105  Int_t mPvpdEntries;
106  Int_t mTofrEvents;
107  Int_t mTofrEntries;
108 
109  string mTupleFileName;
110  TFile *mTupleFile;
111 
112  StTofrCellData mCellData;
113 
114  Bool_t doPrintMemoryInfo;
115  Bool_t doPrintCpuInfo;
116 
117  TTree *mPvpdTuple;
118  TTree *mCellTuple;
119  TTree *mMatchTuple;
120  TTree *mNoMatchTuple;
121  TNtuple *mHitPosTuple;
122 
123  virtual const char *GetCVS() const
124  {static const char cvs[]="Tag $Name: $ $Id: StTofrNtupleMaker.h,v 1.5 2014/08/06 11:43:48 jeromel Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
125 
126  ClassDef(StTofrNtupleMaker,2)
127 };
128 
129 inline void StTofrNtupleMaker::setOuterTrackGeometry(){mOuterTrackGeometry=true;}
130 inline void StTofrNtupleMaker::setStandardTrackGeometry(){mOuterTrackGeometry=false;}
131 inline void StTofrNtupleMaker::SetNtupleFileName(Char_t* filename){mTupleFileName=filename;}
132 
133 inline void StTofrNtupleMaker::setValidAdcRange(Int_t min, Int_t max){
134  mMinValidAdc=min;
135  mMaxValidAdc=max;
136 }
137 
138 inline void StTofrNtupleMaker::setValidTdcRange(Int_t min, Int_t max){
139  mMinValidTdc=min;
140  mMaxValidTdc=max;
141 }
142 
143 inline bool StTofrNtupleMaker::validAdc(const float adc){return((adc>=mMinValidAdc) && (adc<=mMaxValidAdc));}
144 inline bool StTofrNtupleMaker::validTdc(const float tdc){return((tdc>=mMinValidTdc) && (tdc<=mMaxValidTdc));}
145 
146 inline void StTofrNtupleMaker::setInitGeomFromOther(const Bool_t init) { mInitGeomFromOther = init; }
147 
148 #endif
StTofrNtupleMaker(const Char_t *name, const Char_t *outname)
constructor sets default parameters
Int_t Finish()
write and close the ntuple file
Int_t Make()
get tofr slat, pvpd rawdata and global data from StEvent and store in flat TTrees (ntuples) ...
Int_t Init()
initialize ntuple and daqmap, and reset counters
~StTofrNtupleMaker()
default empty destructor
void bookNtuples()
create and initialize ntuple and TTrees