StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFstClusterMaker.cxx
1 #include <climits>
2 
3 #include "StFstClusterMaker.h"
4 #include "StEvent.h"
6 #include "StFstUtil/StFstCollection.h"
7 #include "StEvent/StFstRawHit.h"
8 #include "StFstUtil/StFstRawHitCollection.h"
9 #include "StFstUtil/StFstCluster.h"
10 #include "StFstUtil/StFstClusterCollection.h"
11 #include "StEvent/StFstConsts.h"
12 #include "StFstClusterMaker/StFstIClusterAlgo.h"
13 #include "StFstClusterMaker/StFstScanRadiusClusterAlgo.h"
14 StFstClusterMaker::StFstClusterMaker( const char *name ) : StMaker(name), mFstCollectionPtr(0), mClusterAlgoPtr(0), mTimeBin(UCHAR_MAX), mSplitCluster(true)
15 {};
16 
17 StFstClusterMaker::~StFstClusterMaker()
18 {
19 //Is deleted as part of structure(VP) delete mFstCollectionPtr;
20  delete mClusterAlgoPtr;
21 };
22 
23 void StFstClusterMaker::Clear( Option_t *opts )
24 {
25  if ( mFstCollectionPtr ) {
26  for ( unsigned char i = 0; i < kFstNumWedges; ++i ) {
27  mFstCollectionPtr->getRawHitCollection(i)->Clear( "" );
28  mFstCollectionPtr->getClusterCollection(i)->Clear( "" );
29  }
30  }
31 };
32 
33 
41 {
42  //input data
43  TObjectSet *fstDataSet = (TObjectSet*) GetDataSet("fstRawHitAndCluster");
44 
45  if (!fstDataSet) {
46  LOG_WARN << "Make() - fstRawHitAndCluster dataset not found. No FST clusters will be built" << endm;
47  return kStWarn;
48  }
49 
50  mFstCollectionPtr = (StFstCollection*) fstDataSet->GetObject();
51 
52  if (!mFstCollectionPtr) {
53  LOG_WARN << "Make() - StFstCollection not found. No FST clusters will be built" << endm;
54  return kStWarn;
55  }
56 
57  mClusterAlgoPtr->setUsedTimeBin(mTimeBin);
58  mClusterAlgoPtr->setSplitFlag(mSplitCluster);
59  mClusterAlgoPtr->doClustering(*mFstCollectionPtr);
60 
61 
62  if (Debug() >= 2) {
63 
64  LOG_DEBUG << "End of StFstClusterMaker::Make()" << endm
65  << "Total raw hits: " << mFstCollectionPtr->getNumRawHits()
66  << ", total clusters: " << mFstCollectionPtr->getNumClusters() << endm;
67 
68  for (unsigned char iWedge = 0; iWedge < kFstNumWedges; iWedge++)
69  {
70  LOG_DEBUG << "Content: iWedge=" << (short) iWedge + 1
71  << " # of : raw hits=" << mFstCollectionPtr->getNumRawHits(iWedge)
72  << " clusters=" << mFstCollectionPtr->getNumClusters( iWedge) << endm;
73 
74  // Print all raw hits
75  StFstRawHitCollection *rawHitPtr = mFstCollectionPtr->getRawHitCollection(iWedge);
76  size_t nTimeBins = mFstCollectionPtr->getNumTimeBins();
77  rawHitPtr->Print(nTimeBins);
78 
79  // Print all 1D clusters
80  StFstClusterCollection *clustPtr = mFstCollectionPtr->getClusterCollection(iWedge);
81  clustPtr->Print();
82  }
83  }
84 
85  return kStOk;
86 }
87 
88 void StFstClusterMaker::setClusterAlgo(StFstIClusterAlgo *algo)
89 {
90  mClusterAlgoPtr = algo;
91 }
92 
93 Int_t StFstClusterMaker::Init()
94 {
95  if ( !mClusterAlgoPtr ) {
96  LOG_INFO << "FST clustering algorithm: Scanning Radius algorithm" << endm;
97  mClusterAlgoPtr = new StFstScanRadiusClusterAlgo();
98  }
99 
100  return kStOk;
101 };
102 
103 ClassImp(StFstClusterMaker);
void Clear(Option_t *opts="")
User defined functions.
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