StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtPicoEventCollectionVectorHideAway.cc
1 /***************************************************************************
2  *
3  * $Id: StHbtPicoEventCollectionVectorHideAway.cc,v 1.3 2002/11/01 20:45:53 magestro Exp $
4  *
5  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  *
10  ***************************************************************************
11  *
12  * $Log: StHbtPicoEventCollectionVectorHideAway.cc,v $
13  * Revision 1.3 2002/11/01 20:45:53 magestro
14  * Fixed bug in 3rd dimension of event collection vector, probably never encountered
15  *
16  * Revision 1.2 2001/11/11 18:34:13 laue
17  * StHbtPicoEventCollectionVectorHideAway: updated for 3d grid
18  * StHbtVertexMultAnalysis: new
19  *
20  * Revision 1.1 2000/07/16 21:44:11 laue
21  * Collection and analysis for vertex dependent event mixing
22  *
23  *
24  **************************************************************************/
25 #include "StHbtMaker/Infrastructure/StHbtPicoEventCollectionVectorHideAway.hh"
26 
27 // -----------------------------------
28 StHbtPicoEventCollectionVectorHideAway::StHbtPicoEventCollectionVectorHideAway(int bx, double lx, double ux,
29  int by, double ly, double uy,
30  int bz, double lz, double uz) {
31  mBinsx = bx; mMinx = lx; mMaxx = ux;
32  mBinsy = by; mMiny = ly; mMaxy = uy;
33  mBinsz = bz; mMinz = lz; mMaxz = uz;
34 
35  mBinsTot = mBinsx * mBinsy * mBinsz;
36  mStepx=0; mStepx = (mMaxx-mMinx)/mBinsx;
37  mStepy=0; mStepy = (mMaxy-mMiny)/mBinsy;
38  mStepz=0; mStepz = (mMaxz-mMinz)/mBinsz;
39 
40 
41  //mCollectionVector = new StHbtPicoEventCollectionVector();
42  mCollection = 0;
43  for ( int i=0; i<mBinsTot; i++) {
44  mCollection = new StHbtPicoEventCollection();
45  mCollectionVector.push_back(mCollection);
46  }
47 }
48 // -----------------------------------
49 StHbtPicoEventCollection* StHbtPicoEventCollectionVectorHideAway::PicoEventCollection(int ix, int iy, int iz) {
50  if ( ix<0 || ix >= mBinsx) return 0;
51  if ( iy<0 || iy >= mBinsy) return 0;
52  if ( iz<0 || iz >= mBinsz) return 0;
53  int bin = ix + iy*mBinsx + iz*mBinsy*mBinsx;
54  cout << " StHbtPicoEventCollectionVectorHideAway::PicoEventCollection(...) - bin(ix,iy,iz): ";
55  cout << bin << "(" << ix <<"," << iy << "," << iz <<")" << endl;
56  return mCollectionVector[bin];
57 }
58 // -----------------------------------
59 StHbtPicoEventCollection* StHbtPicoEventCollectionVectorHideAway::PicoEventCollection(double x, double y, double z) {
60  int ix,iy,iz;
61  ix=0;iy=0;iz=0;
62 
63  ix = (int)floor( (x-mMinx)/mStepx );
64  iy = (int)floor( (y-mMiny)/mStepy );
65  iz = (int)floor( (z-mMinz)/mStepz );
66 
67  return PicoEventCollection( ix,iy,iz );
68 }
69