StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEpcMaker.cxx
1 //
2 // $Id: StEpcMaker.cxx,v 1.30 2017/04/26 19:46:07 perev Exp $
3 // $Log: StEpcMaker.cxx,v $
4 // Revision 1.30 2017/04/26 19:46:07 perev
5 // Hide m_DataSet
6 //
7 // Revision 1.29 2007/01/22 19:13:50 kocolosk
8 // use STAR logger for all output
9 //
10 // Revision 1.28 2005/05/23 12:35:14 suaide
11 // New Point maker code
12 //
13 // Revision 1.27 2004/09/07 14:32:20 suaide
14 // small changes in the histograms
15 //
16 // Revision 1.26 2004/09/03 03:09:45 suaide
17 // changes in the histograms
18 //
19 // Revision 1.25 2004/09/03 00:15:28 jeromel
20 // Create histo arrays only if histos attribute is set
21 //
22 // Revision 1.24 2003/10/02 15:27:54 suaide
23 // changed some return values to avoid non-necessary printouts
24 //
25 // Revision 1.23 2003/09/02 17:58:03 perev
26 // gcc 3.2 updates + WarnOff
27 //
28 // Revision 1.22 2003/05/26 13:44:34 suaide
29 // added setPrint() method
30 //
31 // Revision 1.21 2003/04/30 16:08:30 alexst
32 // Two changes:
33 // 1. Clear vector of existing barrel points in StEvent. This accounts for the case when one needs to redo points with different parameters.
34 // 2. Don't require clusters in both SMD planes to proceed with point reconstruction. Only tower clusters are required.
35 //
36 // Revision 1.20 2003/01/23 04:03:21 jeromel
37 // Include fixed
38 //
39 // Revision 1.19 2002/02/19 17:42:13 alexst
40 // Removed a bunch of redundant branching statements and some (but not all) useless output
41 //
42 // Revision 1.18 2001/12/03 22:24:28 pavlinov
43 // tuned for case of no tracks
44 //
45 // Revision 1.17 2001/12/01 02:44:49 pavlinov
46 // Cleanp for events with zero number of tracks
47 //
48 // Revision 1.16 2001/11/06 23:35:27 suaide
49 // fixed bug in the way we get magnetic field
50 //
51 // Revision 1.15 2001/11/02 15:32:16 jeromel
52 // Added return kStOK; which makes Insure happy (function is Int_t and does not return
53 // a value).
54 //
55 // Revision 1.14 2001/11/01 00:15:23 suaide
56 // Clean up and small modification to stop crashing at Finish()
57 //
58 // Revision 1.13 2001/10/24 13:55:05 suaide
59 // small bugs fixed
60 //
61 // Revision 1.12 2001/10/15 01:41:41 pavlinov
62 // Added Clear method
63 //
64 // Revision 1.11 2001/10/03 17:27:37 pavlinov
65 // clean up for production
66 //
67 // Revision 1.10 2001/07/25 15:29:18 subhasis
68 // check if clusters exist in bemc , bsmde and bsmdp
69 //
70 // Revision 1.9 2001/04/25 17:26:13 perev
71 // HPcorrs
72 //
73 // Revision 1.8 2001/04/24 23:06:08 subhasis
74 // clusters attached to Points, QA hists are made for all category separately
75 //
76 // Revision 1.6 2000/08/29 20:40:06 subhasis
77 // Modified to accept input from StEvent and writing output to StEvent for Emc
78 //
79 // Revision 1.3 2000/05/16 21:48:32 subhasis
80 // new checks for events with no clusters
81 //
82 // Revision 1.2 2000/05/15 21:53:57 subhasis
83 // initialversion
84 //
85 // Revision 1.1 2000/05/15 21:18:32 subhasis
86 // initial version
87 //
88 // EMC-track Match Maker
89 //
90 //
91 // Authors: Subhasis Chattopadhyay , February 2000.
92 //
93 
95 //
96 // StEpcMaker class
97 //
99 
100 #include <Stiostream.h>
101 #include <TBrowser.h>
102 #include "StEpcMaker.h"
103 #include "StPointCollection.h"
104 #include "StEvent.h"
105 #include "StEventTypes.h"
106 
107 ClassImp(StEpcMaker)
108 
109 //_____________________________________________________________________________
110 StEpcMaker::StEpcMaker(const char *name):StMaker(name)
111 {
112  mPoint = 0;
113  for(int i=0;i<4;i++)
114  {
115  m_point_energy[i] = 0;
116  m_point_eta[i] = 0;
117  m_point_phi[i] = 0;
118  m_point_sigeta[i] = 0;
119  m_point_sigphi[i] = 0;
120  m_point_trmom[i] = 0;
121  m_emc_points[i] = 0;
122  }
123  m_point_flag = 0;
124  mFillHisto = kTRUE;
125 }
126 //_____________________________________________________________________________
127 StEpcMaker::~StEpcMaker()
128 {}
129 //________________________________________________________________________
130 Int_t StEpcMaker::Init()
131 {
132  // Making QA histgrams for points
133  m_point_flag= new TH1F(" Point_Flag "," Point Flag ",5,0.5,5.5);
134  m_point_quality= new TH1F(" Point_Quality "," Point Quality distribution ",32,-0.5,31.5);
135 
136  const TString catname[] =
137  { "Cat1", "Cat2", "Cat3", "Cat4"
138  };
139 
140  for (Int_t i=0; i<4; i++)
141  {
142  TString name_e = catname[i] + "_Point_Energy";
143  TString tit_e = catname[i] + " Point Energy";
144  m_point_energy[i]= new TH1F(name_e,tit_e,150,0.,15.);
145 
146  TString name_eta = catname[i] + "_Point_Eta";
147  TString tit_eta = catname[i] + " Point Eta";
148  m_point_eta[i]= new TH1F(name_eta,tit_eta,100,-1.,1.);
149 
150  TString name_phi = catname[i] + "_Point_Phi";
151  TString tit_phi = catname[i] + " Point Phi";
152  m_point_phi[i]= new TH1F(name_phi,tit_phi,100,-3.14,3.14);
153  if (mFillHisto)
154  {
155  TString name_sigeta = catname[i] + "_Sigma_Eta";
156  TString tit_sigeta = catname[i] + " Sigma Eta";
157  m_point_sigeta[i]= new TH1F(name_sigeta,tit_sigeta,100,0.,.2);
158 
159  TString name_sigphi = catname[i] + "_Sigma_Phi";
160  TString tit_sigphi = catname[i] + " Sigma Phi";
161  m_point_sigphi[i]= new TH1F(name_sigphi,tit_sigphi,100,0.,.2);
162 
163  TString name_points = catname[i] + "_Points_Multiplicity";
164  TString tit_points = catname[i] + " Points Multiplicity";
165  m_emc_points[i]= new TH1F(name_points,tit_points,200,0.,200.);
166 
167  TString name_mom = catname[i] + "_Track_Momenta";
168  TString tit_mom = catname[i] + " Track Momenta ";
169  m_point_trmom[i]= new TH1F(name_mom,tit_mom,150,0.,15.);
170  }
171  }
172  return StMaker::Init();
173 }
174 //_________________________________________________________________________
176 {
177  mEvent = (StEvent *) GetInputDS("StEvent");
178 
179  if (!mEvent)
180  {
181  LOG_ERROR << "No StEvent! Can not continue. " << endm;
182  return kStOK; // If no event, we're done
183  }
184  mTheEmcCollection = mEvent->emcCollection();
185  if(!mTheEmcCollection)
186  {
187  LOG_ERROR <<" EPC:: No EmcCollection, Cannot continue**"<<endm;
188  return kStOK;
189  }
190 
191  // ******Creating StPointCollection and calling findPoints
192  mPoint = new StPointCollection("point");
193 //VP AddData(mPoint); // for convinience only
194  AddData(mPoint);
195  if(mPoint->makeEmcPoints(mEvent) != 1)
196  {
197  return kStOk;
198  }
199  else {
200  LOG_DEBUG << "findEmcPoint == kStOK" << endm;
201  }
202 
203  MakeHistograms(); // Fill QA histgrams
204  LOG_DEBUG << "Epc: *** Filling StEvent ***" << endm;
205  if(fillStEvent() != kStOK)
206  {
207  LOG_WARN << "StEvent filling is not OK"<<endm;
208  }
209  return kStOK;
210 }
211 //_________________________________________________________________________
212 
213 void StEpcMaker::MakeHistograms()
214 {
215  Int_t mult[4]={0,0,0,0};
216  if(mPoint)
217  {
218  Int_t nR = mPoint->NPointsReal();
219 
220  if(nR>0)
221  {
222  LOG_DEBUG << "Number of Emc points " << nR << endm;
223  TIter next(mPoint->PointsReal());
224  StEmcPoint *cl;
225 
226  for(Int_t i=0; i<nR; i++)
227  {
228  cl = (StEmcPoint*)next();
229  if(cl)
230  {
231  Int_t C = 0;
232  Int_t Q = cl->quality();
233  if( (Q&1) )
234  C = 1; // only tower
235  if( (Q&1) && (Q&4))
236  C = 2; // tower + smd eta
237  if( (Q&1) && (Q&8))
238  C = 3; // tower + smd phi
239  if( (Q&1) && (Q&4) && (Q&8))
240  C = 4; // tower + smd eta + smd phi
241  m_point_flag->Fill(C);
242  m_point_quality->Fill(Q);
243  if(C>0)
244  {
245  mult[C-1]++;
246  if(m_point_energy[C-1])
247  m_point_energy[C-1]->Fill(cl->energy());
248  if(m_point_eta[C-1])
249  m_point_eta[C-1]->Fill(cl->position().pseudoRapidity());
250  if(m_point_phi[C-1])
251  m_point_phi[C-1]->Fill(cl->position().phi());
252  if(m_point_sigeta[C-1])
253  m_point_sigeta[C-1]->Fill(cl->size().x());
254  if(m_point_sigphi[C-1])
255  m_point_sigphi[C-1]->Fill(cl->size().y());
256  StPtrVecTrack& tr = cl->track();
257  for(UInt_t j = 0;j<tr.size();j++)
258  {
259  StTrack* t = tr[j];
260  if(t)
261  {
262  StTrackGeometry *g = t->geometry();
263  if(m_point_trmom[C-1])
264  m_point_trmom[C-1]->Fill(g->momentum().mag());
265  }
266  }
267  }
268  }
269  }
270  }
271  }
272  for(Int_t i = 0;i<4;i++)
273  if(m_emc_points[i])
274  m_emc_points[i]->Fill(mult[i]);
275 }
276 
277 Int_t
278 StEpcMaker::fillStEvent()
279 {
280  LOG_DEBUG <<"Epc::fillStEvent() ***"<<endm;
281 
282  if(mPoint)
283  {
284  Int_t nR = mPoint->NPointsReal();
285 
286  if(nR>0)
287  {
288  LOG_DEBUG << "Number of Emc points " << nR << endm;
289  TIter next(mPoint->PointsReal());
290  StEmcPoint *cl;
291 
292  for(Int_t i=0; i<nR; i++)
293  {
294  cl = (StEmcPoint*)next();
295  mTheEmcCollection->addBarrelPoint(cl);
296  }
297  }
298  }
299  else {
300  LOG_DEBUG << "There is no BEMC points in this event" <<endm;
301  }
302  return kStOK;
303 }
304 //-------------------------------------------------------
306 {
307  return kStOK;
308 }
309 void
310 StEpcMaker::Browse(TBrowser* b)
311 {
312  // Will be see StEmcCollection in browser as separate entity (if unzero) the same as in StEvent
313  if(mTheEmcCollection)
314  b->Add((TObject*)mTheEmcCollection);
315  TDataSet::Browse(b);
316 }
TH1F * m_point_sigphi[4]
//Point SigmaEta spectra
Definition: StEpcMaker.h:76
Bool_t mFillHisto
//Emc Point multiplicity
Definition: StEpcMaker.h:80
virtual Int_t Make()
Definition: StEpcMaker.cxx:175
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
TH1F * m_point_quality
//Point Flag spectra
Definition: StEpcMaker.h:69
TH1F * m_point_sigeta[4]
//Point Phi spectra
Definition: StEpcMaker.h:75
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Definition: TDataSet.cxx:297
TH1F * m_emc_points[4]
//Point TrMom spectra
Definition: StEpcMaker.h:78
TH1F * m_point_eta[4]
//Point Energy spectra
Definition: StEpcMaker.h:71
TH1F * m_point_energy[4]
//Point quality spectra
Definition: StEpcMaker.h:70
TH1F * m_point_trmom[4]
//Point SigmaPhi spectra
Definition: StEpcMaker.h:77
TH1F * m_point_phi[4]
//Point Eta spectra
Definition: StEpcMaker.h:72
Definition: Stypes.h:40
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Definition: StEpcMaker.cxx:310
virtual Int_t Finish()
Definition: StEpcMaker.cxx:305
Definition: Stypes.h:41