StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtSimplePointAlgo.cxx
1 #include "StFgtSimplePointAlgo.h"
2 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
3 #include "StRoot/StEvent/StFgtHit.h"
4 #include "StRoot/StEvent/StFgtCollection.h"
5 #include "StRoot/StEvent/StFgtHitCollection.h"
6 #include "StRoot/StEvent/StFgtPoint.h"
7 #include "StRoot/StEvent/StFgtPointCollection.h"
8 #include "StRoot/St_base/StMessMgr.h"
9 
10 StFgtSimplePointAlgo::StFgtSimplePointAlgo():StFgtIPointAlgo("simple point algo","simple point algo"),mIsInitialized(0),m_maxChargeAsymmetry(0.1)
11 {
12  //nothing else to do....
13 };
14 
15 StFgtSimplePointAlgo::~StFgtSimplePointAlgo()
16 {
17 
18  //nothing to do...
19 };
20 
21 Int_t StFgtSimplePointAlgo::Init()
22 {
23  mIsInitialized=true;
24  return kStOk;
25 };
26 
27 
28 
29 //Int_t StFgtSimplePointAlgo::makePoints( const StFgtHitCollection& clusters, StFgtPointCollection& points)
30 Int_t StFgtSimplePointAlgo::makePoints( StFgtCollection& c)
31 {
32  Int_t iErr=kStOk;
33 
34  StFgtPointCollection* pPointCollection=c.getPointCollection();
35  if( !pPointCollection ){
36  LOG_ERROR << "$Id: StFgtSimplePointAlgo.cxx,v 1.3 2013/04/04 20:24:50 akio Exp $ Error getting pointer to StFgtPointCollection from StFgtCollection" << endm;
37  return kStErr;
38  }
39  StFgtPointCollection& points=*pPointCollection;
40  for( UInt_t discIdx=0; discIdx<c.getNumDiscs() && !iErr; ++discIdx ){
41  const StFgtHitCollection* pClusters=c.getHitCollection(discIdx);
42  if(!pClusters)
43  continue;
44  const StFgtHitCollection& clusters=*(pClusters);
45  Int_t numClusters=clusters.getNumHits();
46  //no point in making points w/ one cluster
47  if(numClusters<2)
48  continue;
49  //prevent looping for too long
50  if(numClusters > 40)
51  {
52  LOG_WARN <<"$Id: StFgtSimplePointAlgo.cxx,v 1.3 2013/04/04 20:24:50 akio Exp $ : number of cluster too large in disk " << discIdx<<"! " <<endl;
53  continue;
54  }
55 
56  // const Char_t noLayer='N';
57  //we make use of the fact, that the hits are already sorted by geoId
58  // Short_t disc, quadrant,prvDisc,prvQuad;
59  // Char_t layer,prvLayer;
60  // Double_t ordinate, lowerSpan, upperSpan, prvOrdinate, prvLowerSpan, prvUpperSpan;
61  // Int_t prvGeoId;
62  // Double_t accuCharge=0;
63  // Double_t meanOrdinate=0;
64  // Int_t numStrips=0;
65  // bool lookForNewPoint=true;
66  // prvLayer=noLayer;
67  Int_t clusterCounter=-1;
68 
69  const StSPtrVecFgtHit& hitVec = clusters.getHitVec();
70  StSPtrVecFgtHitConstIterator iter1, iter2;
71 
72  StSPtrVecFgtPoint& pointVec = points.getPointVec();
73 
74  for( iter1 = hitVec.begin(); iter1 != hitVec.end(); ++iter1 )
75  {
76  Char_t iter1_layer = (*iter1)->getLayer();
77  Int_t iter1_quad=(*iter1)->getQuad();
78 
79  for( iter2 = hitVec.begin(); iter2 != iter1; ++iter2 )
80  if( (*iter2)->getLayer() != iter1_layer && (iter1_quad==(*iter2)->getQuad()))
81  {
82  Float_t chargeAsymmetry=fabs( ((*iter1)->charge()-(*iter2)->charge())/((*iter1)->charge()+(*iter2)->charge()));
83  // cout <<"charge asymmetry: " <<chargeAsymmetry <<" max: " << m_maxChargeAsymmetry <<endl;
84  if(chargeAsymmetry>m_maxChargeAsymmetry)
85  {
86  continue;
87  }
88  //have other cuts based on timing?
89  size_t rank=1;
90  //set this to some meaningful value...
91  // cout <<"combining charge1: " << (*iter1)->charge() <<" and charge2 "<< (*iter2)->charge() <<endl;
92  pointVec.push_back( new StFgtPoint ( *iter1, *iter2, ++clusterCounter,rank ) );
93  if( pointVec.back()->getKey() != clusterCounter ){ // error during construction
94  delete pointVec.back();
95  pointVec.pop_back();
96  }
97  }
98  }
99  cout <<"StFgtSimplePointAlgo: we have " << points.getNumPoints() <<" points after disc = " << discIdx << endl;
100  }
101  return iErr;
102 };
103 
104 ClassImp(StFgtSimplePointAlgo);
105 //
106 //
107 // $Id: StFgtSimplePointAlgo.cxx,v 1.3 2013/04/04 20:24:50 akio Exp $
108 // $Log: StFgtSimplePointAlgo.cxx,v $
109 // Revision 1.3 2013/04/04 20:24:50 akio
110 // - Filling StHit with xyz, error on xyz and detectorId
111 // - Add option to return kStSkip if max number of disc hit per quad is less than setSkipEvent (default 0)
112 // This is for expert only, and not for production. Use it with SetAttr(".Privilege",1)
113 //
114 // Revision 1.2 2013/04/03 19:44:30 akio
115 // added same quad check
116 //
117 // Revision 1.1 2013/03/13 20:36:29 jeromel
118 // Initial revision, Anselm Vossen
119 //
120 // Revision 1.8 2012/12/11 00:11:07 avossen
121 // update of StFgtPoint
122 //
123 // Revision 1.7 2012/12/10 23:56:05 avossen
124 // added charge asymmetry condition
125 //
126 // Revision 1.6 2012/03/06 22:28:01 sgliske
127 // asserts removed in StFgtPoint constructor.
128 // Now must check key after constructing
129 //
130 // Revision 1.5 2011/11/01 18:48:34 sgliske
131 // Updated to correspond with StEvent containers, take 2.
132 //
133 // Revision 1.4 2011/10/28 14:55:26 sgliske
134 // fixed CVS tags
135 //
136 //
137 //
138 // \class StFgtSimplePointAlgo
139 // \author Anselm Vossen (avossen@indiana.edu)
140 //
Definition: Stypes.h:44
Definition: Stypes.h:41
Represents a point in the FGT.
Definition: StFgtPoint.h:49