00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00044
00045
00046
00048 #include "TH1.h"
00049 #include "TH2.h"
00050 #include "St_DataSetIter.h"
00051 #include "TObjectSet.h"
00052 #include "StSequence.hh"
00053
00054 #include "StMessMgr.h"
00055
00056 #include "StSvtClassLibrary/StSvtHybridCollection.hh"
00057 #include "StSvtClassLibrary/StSvtHybridData.hh"
00058 #include "StSvtClassLibrary/StSvtData.hh"
00059 #include "StSvtHybridCluster.hh"
00060 #include "StSvtClusterMaker.h"
00061 #include "StDbUtilities/St_svtRDOstrippedC.h"
00062
00063
00064
00065
00066 StSvtClusterMaker::StSvtClusterMaker(const char *name) : StMaker(name)
00067 {
00068 mSvtEvent = NULL;
00069 mHybridData = NULL;
00070 mHybridCluster = NULL;
00071 mClusterColl = NULL;
00072 mClusterSet = NULL;
00073 mClusterFinder = NULL;
00074 }
00075
00076 StSvtClusterMaker::~StSvtClusterMaker()
00077 {
00078
00079 delete mClusterFinder;
00080 }
00081
00082
00083 Int_t StSvtClusterMaker::Init(){
00084
00085
00086 if (Debug()) gMessMgr->Debug() << "In StSvtClusterMaker::Init() ..." <<
00087 GetName() << endm;
00088
00089 if( GetSvtRawData()) gMessMgr->Warning() << "No SVT Raw data..." << endm;
00090
00091 SetSvtCluster();
00092 mClusterFinder = new StSvtClusterFinder();
00093
00094 return StMaker::Init();
00095
00096 }
00097
00098
00099 Int_t StSvtClusterMaker::GetSvtRawData(){
00100
00101 St_DataSet *dataSet = GetDataSet("StSvtData");
00102
00103 if( !dataSet) return kStWarn;
00104
00105 mSvtEvent = (StSvtData*)(dataSet->GetObject());
00106 if( !mSvtEvent) return kStWarn;
00107
00108 return kStOk;
00109
00110
00111 }
00112
00113 Int_t StSvtClusterMaker::SetSvtCluster()
00114 {
00115 mClusterSet = new St_ObjectSet("StSvtCluster");
00116
00117 AddConst(mClusterSet);
00118 SetOutput(mClusterSet);
00119
00120
00121 mClusterColl = new StSvtHybridCollection(mSvtEvent->getConfiguration());
00122 mClusterSet->SetObject(mClusterColl);
00123
00124 return kStOK;
00125 }
00126
00127
00128
00129 Int_t StSvtClusterMaker::Make(){
00130
00131
00132 if (Debug()) gMessMgr->Debug() << "In StSvtClusterMaker::Make() ..." <<
00133 GetName() << endm;
00134
00135 if( GetSvtRawData()) {
00136 gMessMgr->Warning() << " Problem with SVt raw in ClusterMaker" << endm;
00137 return kStWarn;
00138 }
00139
00140 SetHybridClusters();
00141
00142 return kStOK;
00143 }
00144
00145
00146 Int_t StSvtClusterMaker::SetHybridClusters()
00147 {
00148 int index =0;
00149
00150 for(int barrel = 1;barrel <= mSvtEvent->getNumberOfBarrels();barrel++) {
00151
00152 for (int ladder = 1;ladder <= mSvtEvent->getNumberOfLadders(barrel);ladder++) {
00153
00154 for (int wafer = 1;wafer <= mSvtEvent->getNumberOfWafers(barrel);wafer++) {
00155
00156
00157 if (St_svtRDOstrippedC::instance()->svtRDOstrippedStatus(barrel,ladder,wafer)) continue;
00158
00159 for (int hybrid = 1;hybrid <=mSvtEvent->getNumberOfHybrids();hybrid++){
00160
00161
00162 index = mSvtEvent->getHybridIndex(barrel,ladder,wafer,hybrid);
00163 if(index < 0) continue;
00164
00165
00166 mHybridData = (StSvtHybridData *)mSvtEvent->at(index);
00167 if( !mHybridData) continue;
00168
00169 mClusterFinder->setHybridPointer(mHybridData);
00170 mClusterFinder->SetHybIndex(index);
00171 mClusterFinder->ClusterFinder();
00172
00173
00174 mHybridCluster = (StSvtHybridCluster* )mClusterColl->at(index);
00175 if( mHybridCluster){
00176 delete mHybridCluster;
00177 mClusterColl->at(index)=0;
00178 }
00179
00180 mHybridCluster = new StSvtHybridCluster();
00181
00182 mHybridCluster->setCluster(mClusterFinder);
00183 mClusterColl->put_at(mHybridCluster,index);
00184 mClusterFinder->ResetContainers();
00185
00186 }
00187 }
00188 }
00189 }
00190
00191 return kStOK;
00192 }
00193
00194
00195
00196
00197 Int_t StSvtClusterMaker::Finish(){
00198
00199 if (Debug()) gMessMgr->Debug() << "In StSvtClusterMaker::Finish() ..." <<
00200 GetName() << endm;
00201
00202 return kStOK;
00203 }
00204
00205
00206 Int_t StSvtClusterMaker::Reset(){
00207
00208 if (Debug()) gMessMgr->Debug() << "In StSvtClusterMaker::reset() ..." <<
00209 GetName() << endm;
00210
00211
00212 mClusterSet->SetObject(0);
00213 delete mClusterFinder;
00214
00215 mHybridCluster = NULL;
00216 mClusterColl = NULL;
00217 mClusterFinder = NULL;
00218
00219 return kStOK;
00220 }
00221
00222 void StSvtClusterMaker::Clear(const char *)
00223 {
00224 if (mClusterColl) {
00225 int n = mClusterColl->size();
00226 mClusterColl->clear();
00227 mClusterColl->resize(n);
00228 }
00229 StMaker::Clear();
00230 }
00231
00232 ClassImp(StSvtClusterMaker)
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242