StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtMaxClusterAlgo.cxx
1 //
2 // $Id: StFgtMaxClusterAlgo.cxx,v 1.16 2013/02/20 01:32:27 avossen Exp $
3 // $Log: StFgtMaxClusterAlgo.cxx,v $
4 // Revision 1.16 2013/02/20 01:32:27 avossen
5 // added n strips before and after cluster
6 //
7 // Revision 1.15 2013/02/19 18:29:05 avossen
8 // signature of max cluster algo now updated to conform with interface
9 //
10 // Revision 1.14 2012/03/08 17:43:40 avossen
11 // added default cluster algo, made StFgtIClusterAlgo destructor =0
12 //
13 // Revision 1.13 2012/03/07 03:57:23 avossen
14 // various updates
15 //
16 // Revision 1.12 2012/02/28 19:32:25 avossen
17 // many changes to enable new clustering algo: New strip fields, identification of seed strips, passing neighboring strips, new order in strip collections
18 //
19 // Revision 1.11 2011/11/17 19:23:54 ckriley
20 // fixed small bug
21 //
22 // Revision 1.10 2011/11/03 20:04:17 avossen
23 // updated clustering makers and algos to reflect new containers
24 //
25 // Revision 1.9 2011/11/03 14:59:49 sgliske
26 // Error estimate set to twice the pitch
27 //
28 // Revision 1.8 2011/11/02 18:44:45 sgliske
29 // updated for changed StFgtHit constructor:
30 // changed saving central strip ptr to geoId in StFgtHit
31 //
32 // Revision 1.7 2011/11/01 18:46:30 sgliske
33 // Updated to correspond with StEvent containers, take 2.
34 //
35 // Revision 1.6 2011/10/14 18:45:27 avossen
36 // fixed some bugs in simple cluster algo
37 //
38 // Revision 1.5 2011/10/10 20:35:08 avossen
39 // fixed strip-cluster association in MaxCluster algo, made other files cvs compliant
40 //
41 //
42 // \class StFgtMaxClusterAlgo
43 // \author Anselm Vossen (avossen@indiana.edu)
44 //
45 
46 #include "Stypes.h"
47 #include "StFgtMaxClusterAlgo.h"
48 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
49 #include <iostream>
50 
51 #include "StRoot/StEvent/StFgtStripCollection.h"
52 #include "StRoot/StEvent/StFgtStrip.h"
53 #include "StRoot/StEvent/StFgtHitCollection.h"
54 #include "StRoot/StEvent/StFgtHit.h"
55 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
56 #include "StRoot/StFgtDbMaker/StFgtDb.h"
57 
58 StFgtMaxClusterAlgo::StFgtMaxClusterAlgo()
59 {
60  //nothing else to do....
61 };
62 
63 Int_t StFgtMaxClusterAlgo::Init()
64 {
65  return kStOk;
66 };
67 
68 
71 {
72 
73  //we make use of the fact, that the hits are already sorted by geoId
74  strips.sortByGeoId();
75 
76  Short_t disc, quadrant;
77  Char_t layer;
78  Double_t ordinate, lowerSpan, upperSpan;
79  Double_t maxRCharge=0;
80  Double_t maxPhiCharge=0;
81  Double_t phiOrdinate,rOrdinate;
82  Int_t phiGeoId, rGeoId;
83  bool isPhi, isR;
84  // cout <<"we have " << mSortPtr.size() << " points " <<endl;
85  StFgtStrip *rStripPtr = 0;
86  StFgtStrip *phiStripPtr = 0;
87 
88  for( StSPtrVecFgtStripIterator it=strips.getStripVec().begin();it!=strips.getStripVec().end();++it)
89  {
90  StFgtGeom::getPhysicalCoordinate((*it)->getGeoId(),disc,quadrant,layer,ordinate,lowerSpan,upperSpan);
91  isPhi=(layer=='P');
92  isR=(!isPhi);
93  // cout <<"charge is: " << (*it)->getCharge() << " maxRcharge: " <<maxRCharge <<" maxPhicharge: " << maxPhiCharge << " isPhi: "<< isPhi <<endl;
94  if(isR && ((*it)->getCharge() > maxRCharge))
95  {
96  maxRCharge=(*it)->getCharge();
97  rOrdinate=ordinate;
98  rGeoId=(*it)->getGeoId();
99  rStripPtr = *it;
100  }
101  if(isPhi && ((*it)->getCharge() > maxPhiCharge))
102  {
103  maxPhiCharge=(*it)->getCharge();
104  phiOrdinate=ordinate;
105  phiGeoId=(*it)->getGeoId();
106  phiStripPtr = *it;
107  }
108  }
109 
110 
111  StFgtHit *rHit = 0;
112  StFgtHit *phiHit = 0;
113  if(maxRCharge>0)
114  {
115  // cout <<"have maxR" <<endl;
116  rHit = new StFgtHit( clusters.getHitVec().size(),rGeoId,maxRCharge, disc, quadrant, 'R', rOrdinate, 2*StFgtGeom::radStrip_pitch(), 0.0, 0.0, 0.0, 0.0);
117  }
118  if( rHit ){
119  clusters.getHitVec().push_back( rHit );
120  stripWeightMap_t &stripWeightMap = rHit->getStripWeightMap();
121  stripWeightMap[ rStripPtr ] = 1;
122 
123  };
124 
125  if(maxPhiCharge>0)
126  {
127  phiHit = new StFgtHit( clusters.getHitVec().size(), phiGeoId,maxPhiCharge, disc, quadrant, 'P', 0.0, 0.0,phiOrdinate, 2*StFgtGeom::phiStrip_pitch(),0.0,0.0);
128  // cout <<" new phi cluster " << endl;
129  }
130  if(phiHit ){
131  clusters.getHitVec().push_back( phiHit );
132  stripWeightMap_t &stripWeightMap = phiHit->getStripWeightMap();
133  stripWeightMap[ phiStripPtr ] = 1;
134  };
135 
136 
137  return kStOk;
138 };
139 
140 StFgtMaxClusterAlgo::~StFgtMaxClusterAlgo()
141 {
142 }
143 
144 ClassImp(StFgtMaxClusterAlgo);
145 
virtual Int_t doClustering(const StFgtCollection &fgtCollection, StFgtStripCollection &strips, StFgtHitCollection &clusters)
main work functions getting strips above pedestal for each disk
Definition: Stypes.h:41