StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StIstClusterMaker.cxx
1 #include <climits>
2 
3 #include "StIstClusterMaker.h"
4 #include "StEvent.h"
6 #include "StIstUtil/StIstCollection.h"
7 #include "StIstUtil/StIstRawHit.h"
8 #include "StIstUtil/StIstRawHitCollection.h"
9 #include "StIstUtil/StIstCluster.h"
10 #include "StIstUtil/StIstClusterCollection.h"
11 #include "StIstUtil/StIstConsts.h"
12 #include "StIstClusterMaker/StIstIClusterAlgo.h"
13 #include "StIstClusterMaker/StIstScanClusterAlgo.h"
14 
15 StIstClusterMaker::StIstClusterMaker( const char *name ) : StMaker(name), mIstCollectionPtr(0), mClusterAlgoPtr(0), mTimeBin(UCHAR_MAX), mSplitCluster(true)
16 {
17  /* nothing to do */
18 };
19 
20 StIstClusterMaker::~StIstClusterMaker()
21 {
22 //Is deleted as part of structure(VP) delete mIstCollectionPtr;
23  delete mClusterAlgoPtr;
24 };
25 
26 void StIstClusterMaker::Clear( Option_t *opts )
27 {
28  if ( mIstCollectionPtr ) {
29  for ( unsigned char i = 0; i < kIstNumLadders; ++i ) {
30  mIstCollectionPtr->getRawHitCollection(i)->Clear( "" );
31  mIstCollectionPtr->getClusterCollection(i)->Clear( "" );
32  }
33  }
34 };
35 
36 
44 {
45  //input data
46  TObjectSet *istDataSet = (TObjectSet*) GetDataSet("istRawHitAndCluster");
47 
48  if (!istDataSet) {
49  LOG_WARN << "Make() - istRawHitAndCluster dataset not found. No IST clusters will be built" << endm;
50  return kStWarn;
51  }
52 
53  mIstCollectionPtr = (StIstCollection*) istDataSet->GetObject();
54 
55  if (!mIstCollectionPtr) {
56  LOG_WARN << "Make() - StIstCollection not found. No IST clusters will be built" << endm;
57  return kStWarn;
58  }
59 
60  mClusterAlgoPtr->setUsedTimeBin(mTimeBin);
61  mClusterAlgoPtr->setSplitFlag(mSplitCluster);
62  mClusterAlgoPtr->doClustering(*mIstCollectionPtr);
63 
64 
65  if (Debug() >= 2) {
66 
67  LOG_DEBUG << "End of StIstClusterMaker::Make()" << endm
68  << "Total raw hits: " << mIstCollectionPtr->getNumRawHits()
69  << ", total clusters: " << mIstCollectionPtr->getNumClusters() << endm;
70 
71  for (unsigned char iLadder = 0; iLadder < kIstNumLadders; iLadder++)
72  {
73  LOG_DEBUG << "Content: iLadder=" << (short) iLadder + 1
74  << " # of : raw hits=" << mIstCollectionPtr->getNumRawHits(iLadder)
75  << " clusters=" << mIstCollectionPtr->getNumClusters( iLadder) << endm;
76 
77  // Print all raw hits
78  StIstRawHitCollection *rawHitPtr = mIstCollectionPtr->getRawHitCollection(iLadder);
79  size_t nTimeBins = mIstCollectionPtr->getNumTimeBins();
80  rawHitPtr->Print(nTimeBins);
81 
82  // Print all 1D clusters
83  StIstClusterCollection *clustPtr = mIstCollectionPtr->getClusterCollection(iLadder);
84  clustPtr->Print();
85  }
86  }
87 
88  return kStOk;
89 }
90 
91 void StIstClusterMaker::setClusterAlgo(StIstIClusterAlgo *algo)
92 {
93  mClusterAlgoPtr = algo;
94 }
95 
96 Int_t StIstClusterMaker::Init()
97 {
98  if ( !mClusterAlgoPtr ) {
99  LOG_INFO << "IST clustering algorithm: Scanning algorithm" << endm;
100  mClusterAlgoPtr = new StIstScanClusterAlgo();
101  }
102 
103  return kStOk;
104 };
105 
106 ClassImp(StIstClusterMaker);
107 
108 
109 /***************************************************************************
110 *
111 * $Log: StIstClusterMaker.cxx,v $
112 * Revision 1.32 2018/01/04 17:34:37 smirnovd
113 * [Cosmetic] Remove StRoot/ from include path
114 *
115 * $STAR/StRoot is already in the default path search
116 *
117 * Revision 1.31 2017/04/26 19:54:01 perev
118 * Remove crash at the end
119 *
120 * Revision 1.30 2015/05/20 20:53:53 smirnovd
121 * Set default value of unsigned variables in a more explicit way
122 *
123 * Revision 1.29 2014/10/14 21:06:40 smirnovd
124 * Updated debug and log messages, added doxygen comments. Also other minor whitespace and style changes
125 *
126 * Revision 1.28 2014/10/14 21:06:02 smirnovd
127 * Maximum debug level is 2 AFAIK
128 *
129 * Revision 1.27 2014/10/14 21:05:54 smirnovd
130 * Don't wait until the end of routine to return error codes. Leads to somewhat cleaner code and eliminates if statements
131 *
132 * Revision 1.26 2014/09/17 20:36:26 smirnovd
133 * StIstClusterMaker: Use the updated public interface of StIstIClusterAlgo. The
134 * previous functionality has been moved to the base class
135 *
136 * Revision 1.25 2014/09/17 20:33:31 smirnovd
137 * Squashed commit of the following:
138 *
139 * commit 72dc19a6663ea31c719c1a61f6d2b4752dd766aa
140 * Author: Dmitri Smirnov <d.s@plexoos.com>
141 * Date: Wed Sep 17 12:34:42 2014 -0400
142 *
143 * Minor code refactoring, clean up
144 *
145 * commit e083a10a9fb60b7dcce692ef8043b9227c12768b
146 * Author: Dmitri Smirnov <d.s@plexoos.com>
147 * Date: Wed Sep 17 12:18:16 2014 -0400
148 *
149 * Removed pointless comments
150 *
151 * commit 88d51857362c91c954704cec4a31a0b0fa7fccc5
152 * Author: Dmitri Smirnov <d.s@plexoos.com>
153 * Date: Wed Sep 17 12:17:26 2014 -0400
154 *
155 * Updated description in doxygen comments
156 *
157 * commit eb09527489179fc7dab6aa7f23fd132b25185bb1
158 * Author: Dmitri Smirnov <d.s@plexoos.com>
159 * Date: Tue Sep 9 15:15:56 2014 -0400
160 *
161 * StIstScanClusterAlgo: Removed unused variable
162 *
163 * commit 1a8df63533c71a0e2ba4d8275ebf89f4e3004765
164 * Author: Dmitri Smirnov <d.s@plexoos.com>
165 * Date: Fri Aug 22 16:04:47 2014 -0400
166 *
167 * Neatened headers: Removed unused, spelled paths in includes explicitly as it slightly helps in identifying dependencies
168 *
169 * commit 972e8ed41403bd680ade5ecc509f8bca004e86ee
170 * Author: Dmitri Smirnov <d.s@plexoos.com>
171 * Date: Wed Sep 17 12:34:20 2014 -0400
172 *
173 * Minor stylistic changes
174 *
175 * commit 57daf5a1e0b3246fd12f1dd1c2ca089b62930c83
176 * Author: Dmitri Smirnov <d.s@plexoos.com>
177 * Date: Tue Sep 16 16:29:14 2014 -0400
178 *
179 * Improved doxygen comments
180 *
181 * Revision 1.24 2014/09/09 15:50:09 smirnovd
182 * StIstClusterMaker: Refactored conditional statements and added a formal warning for missing collections. Adjusted white space indentation
183 *
184 * Revision 1.23 2014/09/09 05:42:38 ypwang
185 * minor update the data type for temporary variable numRawHits from UShort_t to Int_t
186 *
187 * Revision 1.22 2014/09/08 19:29:31 smirnovd
188 * StIstClusterMaker: Use Print() methods of respective collections for debugging
189 *
190 * Revision 1.21 2014/09/08 14:45:17 smirnovd
191 * StIstClusterMaker: No need to check for a null pointer before deleting the object
192 *
193 * Revision 1.20 2014/09/07 11:44:52 ypwang
194 * remove Init() function for clustering algorithms
195 *
196 * Revision 1.19 2014/09/07 11:34:42 ypwang
197 * update the setClusterAlgo() returning void instead of Int_t type
198 *
199 * Revision 1.18 2014/09/07 11:31:29 ypwang
200 * update the setClusterAlgo() returning void instead of Int_t type
201 *
202 * Revision 1.17 2014/09/07 08:15:18 ypwang
203 * destructor was added for the mIstCollectionPtr and mClusterAlgoPtr objects killing
204 *
205 * Revision 1.16 2014/08/22 15:55:15 smirnovd
206 * Fixed style with astyle -s3 -p -H -A3 -k3 -O -o -y -Y -f
207 *
208 * Revision 1.15 2014/08/21 17:51:08 smirnovd
209 * Moved CVS history to the end of file
210 *
211 * Revision 1.14 2014/08/12 23:04:53 ypwang
212 * remove the raw hit number cut per ladder before doing clustering, due to chip occupancy cut was added in raw hit maker which can do the bad column rejection; simplfy the code by removing the InitRun() function
213 *
214 * Revision 1.13 2014/08/06 18:56:52 ypwang
215 * minor update due to coding style update of the StIstDb method
216 *
217 * Revision 1.12 2014/07/29 20:13:31 ypwang
218 * update the IST DB obtain method
219 *
220 * Revision 1.11 2014/04/15 06:46:59 ypwang
221 * updates for collections clear due to Clear() function removed from StIstCollection
222 *
223 * Revision 1.10 2014/03/25 03:06:52 ypwang
224 * updates on Db table accessory method
225 *
226 * Revision 1.9 2014/03/24 15:55:07 ypwang
227 * minor updates due to returned const pointers in StIstDbMaker
228 *
229 * Revision 1.8 2014/03/17 21:51:56 ypwang
230 * minor update due to some IST constants moved to StEnumurations.h
231 *
232 * Revision 1.7 2014/02/16 21:42:54 ypwang
233 * getting number of time bins used in current event by StIstCollection::getNumTimeBins() function
234 *
235 * Revision 1.6 2014/02/15 20:02:37 ypwang
236 * Clear() member function added, and mIstCollectionPtr data member defined
237 *
238 * Revision 1.4 2014/02/08 03:34:16 ypwang
239 * updating scripts
240 *
241 *
242 ****************************************************************************
243 * StIstClusterMaker.cxx,v 1.0
244 * Revision 1.0 2013/11/04 15:55:30 Yaping
245 * Initial version
246 ****************************************************************************/
void doClustering(StIstCollection &stIstCollection)
Bool_t mSplitCluster
Flag to split clusters.
const int kIstNumLadders
24 IST Ladders
UChar_t mTimeBin
Time bin to be used.
Definition: Stypes.h:42
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56
Definition: Stypes.h:41
void Clear(Option_t *opts="")
User defined functions.