StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSpaceChargeEbyEMaker.h
1 
10 #ifndef STAR_StSpaceChargeEbyEMaker
11 #define STAR_StSpaceChargeEbyEMaker
12 
13 #ifndef StMaker_H
14 #include "StMaker.h"
15 #endif
16 
17 class StMagUtilities;
18 class TH1F;
19 class TH2F;
20 class TH3F;
21 #include "StPhysicalHelixD.hh"
22 class TNtuple;
23 class St_spaceChargeCor;
24 class StRunInfo;
25 class StEvent;
26 class StTrack;
27 const int SCHN = 96;
28 
29 
31 
32 public:
33  StSpaceChargeEbyEMaker(const char *name="SCEbyE");
34  virtual ~StSpaceChargeEbyEMaker();
35  virtual Int_t Init();
36  virtual Int_t Make();
37  virtual Int_t Finish();
38  virtual Int_t DecideSpaceCharge(int time);
39 
40  void DoQAmode() { QAmode = kTRUE; }
41  void DoPrePassmode() { PrePassmode = kTRUE; }
42  void DoNtuple() { doNtuple = kTRUE; DoGaps(); }
43  void DoGaps() { doGaps = kTRUE; }
44  void DoSecGaps() { doSecGaps = kTRUE; DoGaps(); }
45  void DontReset() { doReset = kFALSE; }
46  void DoCalib() { Calibmode = kTRUE; DoQAmode(); DoNtuple(); }
47  float EvalCalib(TDirectory* hdir=0);
48  void DoTrackInfo(Int_t mode=1) { TrackInfomode = mode; }
49  void DoAsym() { Asymmode = kTRUE; }
50 
51  void setVtxVpdAgree(float x) { vtxVpdAgree = x; }
52  void setVtxPCTs(UInt_t x) { vtxPCTs = x; }
53  void setVtxEmcMatch(UInt_t x) { vtxEmcMatch = x; }
54  void setVtxTofMatch(UInt_t x) { vtxTofMatch = x; }
55  void setVtxMinTrks(UInt_t x) { vtxMinTrks = x; }
56 
57  void setMinTpcHits(UInt_t x) { minTpcHits = x; }
58  void setReqEmcMatch(Bool_t match = kTRUE)
59  { reqEmcMatch = match; reqEmcOrTofMatch = kFALSE; }
60  void setReqTofMatch(Bool_t match = kTRUE)
61  { reqTofMatch = match; reqEmcOrTofMatch = kFALSE; }
62  void setReqEmcOrTofMatch(Bool_t match = kTRUE)
63  { reqEmcOrTofMatch = match; reqEmcMatch = kFALSE; reqTofMatch = kFALSE; }
64 
65  virtual const char *GetCVS() const
66  {static const char cvs[]="Tag $Name: $ $Id: StSpaceChargeEbyEMaker.h,v 1.21 2015/05/23 04:26:07 genevb Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
67 
68 
69 protected:
70 
71  StEvent* event;
72  int evt;
73  int runid;
74  int curhist;
75  int lasttime;
76  float sc;
77  float esc;
78  float scS[24];
79  float escS[24];
80  float scE;
81  float escE;
82  float scW;
83  float escW;
84  float lastsc;
85  float lastEWRatio;
86  int oldevt;
87  int firstEvent;
88  StRunInfo* runinfo;
89  Bool_t did_auto;
90  Bool_t Calibmode;
91  Bool_t PrePassmode;
92  Bool_t PrePassdone;
93  Bool_t QAmode;
94  Int_t TrackInfomode;
95  Bool_t Asymmode;
96  Bool_t doNtuple;
97  Bool_t doReset;
98  Bool_t doGaps;
99  Bool_t doSecGaps;
100  UInt_t inGapRow;
101  float vtxVpdAgree;
102  UInt_t vtxPCTs;
103  UInt_t vtxEmcMatch;
104  UInt_t vtxTofMatch;
105  UInt_t vtxMinTrks;
106  UInt_t minTpcHits;
107  Bool_t reqEmcMatch;
108  Bool_t reqTofMatch;
109  Bool_t reqEmcOrTofMatch;
110 
111  float MINTRACKS;
112  float MAXDIFFE;
113  float MAXDIFFA;
114  float SCALER_ERROR;
115 
116  StMagUtilities* m_ExB;
117  void BuildHist(int i, TH1F* aschist, TH1F** aschists);
118  void FindSpaceCharge(TH1F* aschist, float& asc, float& aesc);
119  double FindPeak(TH1*,float&);
120  float oldness(int i,int j=-1);
121  int imodHN(int i);
122  float FakeAutoSpaceCharge();
123 
124  TH1F* schist;
125  TH1F* schistS[24];
126  TH1F* schistE;
127  TH1F* schistW;
128  TH1F* schists[SCHN];
129  TH1F* schistsE[SCHN];
130  TH1F* schistsW[SCHN];
131  int times[SCHN];
132  float ntrks[SCHN];
133  float ntrksE[SCHN];
134  float ntrksW[SCHN];
135  float ntrksS[24];
136  int evts[SCHN];
137  float evtstbin[SCHN];
138  float evtsnow;
139  TNamed* SCcorrection;
140  TNamed* GLcorrection;
141  TNamed* SCEWRatio;
142 
143  // PrePass info
144  TString tabname;
145  void SetTableName();
146  void WriteTableToFile();
147  St_spaceChargeCor* SCTable();
148 
149  // QA hists
150  TH1F* scehist;
151  TH1F* timehist;
152  TH3F* myhist;
153  TH3F* myhistN;
154  TH3F* myhistP;
155  TH3F* myhistE;
156  TH3F* myhistW;
157  TH2F* dczhist;
158  TH2F* dcehist;
159  TH3F* dcphist;
160  TH3F* dcahist;
161  TH3F* dcahistN;
162  TH3F* dcahistP;
163  TH3F* dcahistE;
164  TH3F* dcahistW;
165 
166  // Gap hists
167  TH2F* gapZhist;
168  TH2F* gapZhistneg;
169  TH2F* gapZhistpos;
170  TH2F* gapZhistS[24];
171  TH2F* gapZhistnegS[24];
172  TH2F* gapZhistposS[24];
173 
174 
175  // QA hists and ntuple
176  TH1I* cutshist;
177  TNtuple* ntup;
178 
179  float gapZfitslope;
180  float egapZfitslope;
181  float gapZfitintercept;
182  float egapZfitintercept;
183  float gapZdivslope;
184  float egapZdivslope;
185  float gapZfitslopeneg;
186  float gapZfitinterceptneg;
187  float gapZdivslopeneg;
188  float gapZfitslopepos;
189  float gapZfitinterceptpos;
190  float gapZdivslopepos;
191  float gapZfitslopeeast;
192  float gapZfitintercepteast;
193  float gapZdivslopeeast;
194  float gapZfitslopewest;
195  float gapZfitinterceptwest;
196  float gapZdivslopewest;
197 
198  float gapZfitslopeS[24];
199  float gapZfitinterceptS[24];
200  float gapZdivslopeS[24];
201  float gapZfitslopenegS[24];
202  float gapZfitinterceptnegS[24];
203  float gapZdivslopenegS[24];
204  float gapZfitslopeposS[24];
205  float gapZfitinterceptposS[24];
206  float gapZdivslopeposS[24];
207 
208 
209  void InitQAHists();
210  void WriteQAHists();
211  void FillQAHists(float,float,float,int,StPhysicalHelixD&,int);
212  void FillGapHists(StTrack*,StPhysicalHelixD&,int,int);
213  void DetermineGaps();
214  TString DetermineGapHelper(TH2F*,float&,float&,float&);
215 
216 
217  ClassDef(StSpaceChargeEbyEMaker, 0)
218 };
219 
220 #endif
221 
222 //_____________________________________________________________________________
223 // $Id: StSpaceChargeEbyEMaker.h,v 1.21 2015/05/23 04:26:07 genevb Exp $
224 // $Log: StSpaceChargeEbyEMaker.h,v $
225 // Revision 1.21 2015/05/23 04:26:07 genevb
226 // More vertex selection criteria: PCT daughters, and VPD z agreement
227 //
228 // Revision 1.20 2014/10/23 21:07:23 genevb
229 // Add GridLeak-by-sector codes, East/WestOff handling, and some code reformatting
230 //
231 // Revision 1.19 2014/08/06 11:43:32 jeromel
232 // Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
233 //
234 // Revision 1.18 2014/07/23 17:58:46 genevb
235 // Machinery for sector-by-sector Gaps (GridLeak) measurements
236 //
237 // Revision 1.17 2014/05/02 02:38:07 genevb
238 // TrackInfo mode with pile-up tracks too
239 //
240 // Revision 1.16 2014/01/02 20:54:28 genevb
241 // TrackInfomode, and Basic E/W asymmetry functionality
242 //
243 // Revision 1.15 2013/09/25 20:55:51 genevb
244 // Allow use of multiple PPVF vertices, introduce EmcOrTofMatch, keep track of Predict...() cuts
245 //
246 // Revision 1.14 2012/12/15 03:13:50 genevb
247 // Store used calibrations in histogram files
248 //
249 // Revision 1.13 2011/02/10 18:31:45 genevb
250 // Restore corrected coincidence rates, add QA histogram of where events/tracks are cut
251 //
252 // Revision 1.12 2010/06/09 20:24:53 genevb
253 // Modify interface to allow EMC and TOF matching requirements (needs implementation)
254 //
255 // Revision 1.11 2010/01/28 18:53:30 genevb
256 // Remove unneeded members
257 //
258 // Revision 1.10 2009/11/20 18:51:19 genevb
259 // Avoid compiler warning about unsigned comparison
260 //
261 // Revision 1.9 2009/11/16 22:02:19 genevb
262 // Loosen nDaughters cut, add BEMCmatch cut, PCT hits cut, enable padrow 13 for Run 9+
263 //
264 // Revision 1.8 2008/07/15 22:30:39 genevb
265 // Added evaluation of calibration performance
266 //
267 // Revision 1.7 2006/08/15 23:40:59 genevb
268 // Averaging was done improperly in DontReset mode
269 //
270 // Revision 1.6 2006/06/01 17:27:11 genevb
271 // Bug fix: gapd and gapf backwards; Improvements: gap fit intercepts, hist and fit ranges
272 //
273 // Revision 1.5 2006/01/05 19:12:53 genevb
274 // Added calib mode
275 //
276 // Revision 1.4 2005/07/06 22:51:40 fisyak
277 // use Templated StPhysicalHelixD
278 //
279 // Revision 1.3 2005/04/21 19:38:20 genevb
280 // Additional code for studying SpaceCharge
281 //
282 // Revision 1.2 2004/08/13 20:49:12 genevb
283 // Improve upon keeping method locked on for each event, and timestamp change
284 //
285 // Revision 1.1 2004/06/30 23:16:00 genevb
286 // Introduction of StSpaceChargeEbyEMaker
287 //
288 //