00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include "Cluster3D/ClusterKG.h"
00013 #include "Algorithm/AlgConfig.h"
00014 #include "MessageService/MsgService.h"
00015 #include "Cluster3D/StripKG.h"
00016 #include "Cluster3D/CellKG.h"
00017 #include "Cluster3D/StripListKG.h"
00018 #include "Cluster3D/CellListKG.h"
00019
00020 ClassImp(ClusterKG)
00021
00022 CVSID("$Id: ClusterKG.cxx,v 1.3 2007/03/01 17:44:17 rhatcher Exp $");
00023
00024 ClusterKG::ClusterKG():energyRaw(0.),energyPe(0.),energyGeV(0.),nbOfAmbStrips(0){
00025
00026
00027
00028 MSG("Cluster3D", Msg::kVerbose)
00029 << "Default constructor " << endl;
00030 }
00031
00032
00033
00034 Bool_t ClusterKG::Create(AlgConfig &ac, StripListKG &all1, CellListKG &all2, const std::vector<Int_t> &row){
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 Bool_t bigcluster = true;
00049 stpindexes.clear();
00050
00051
00052
00053
00054 for(UInt_t jj=0; jj<row.size(); ++jj){
00055 Int_t imult1=0;
00056 Int_t imult2=0;
00057
00058 Int_t istp1 = all1.GetStripIndex(all2.GetCellElem1(row[jj]));
00059 Int_t istp2 = all1.GetStripIndex(all2.GetCellElem2(row[jj]));
00060
00061
00062
00063 for(UInt_t ll=0; ll<stpindexes.size(); ++ll){
00064 Int_t istp = all1.GetStripIndex(stpindexes[ll]);
00065 if(istp1 == istp){
00066 ++imult1;
00067 }
00068 if(istp2 == istp){
00069 ++imult2;
00070 }
00071 }
00072 if(imult1==0){
00073 Int_t ind = all2.GetCellElem1(row[jj]) ;
00074 stpindexes.push_back(ind);
00075 all1.SetStripAmbiguity(ind);
00076 }
00077
00078 if(imult2==0 && istp1 != istp2){
00079 Int_t ind = all2.GetCellElem2(row[jj]) ;
00080 stpindexes.push_back(ind);
00081 all1.SetStripAmbiguity(ind);
00082 }
00083 }
00084
00085
00086 SetEnergy(all1);
00087
00088 FindNbOfAmbStrips(all1);
00089
00090 MSG("Cluster3D", Msg::kDebug)
00091 << " Cluster3D create "
00092 << "energyRaw= " << energyRaw
00093 << "energyPe= " << energyPe << endl;
00094
00095 const Int_t minStp = ac.GetInt("minClustStp");
00096 const Int_t minAmbStp = ac.GetInt("minClustAmbStp");
00097 const Double_t minClustPe = ac.GetDouble("minClustPe");
00098
00099 MSG("Cluster3D", Msg::kDebug)
00100 << " Cluster3D create "
00101 << " nbOfAmbStrips= " << nbOfAmbStrips
00102 << "stpindexes.size()= " << stpindexes.size() << endl;
00103
00104
00105
00106
00107
00108
00109 if(((Int_t)stpindexes.size() - nbOfAmbStrips) < minAmbStp){
00110 bigcluster=false;
00111 }
00112
00113
00114
00115
00116
00117
00118
00119
00120 if((Int_t)stpindexes.size() < minStp || energyPe < minClustPe){
00121 bigcluster=false;
00122 }
00123
00124 for(UInt_t ll=0; ll<stpindexes.size(); ++ll){
00125 MSG("Cluster3D", Msg::kDebug)
00126 << " Cluster3D create "
00127 << "all1.GetStripXTalk(stpindexes[ll])= "
00128 << all1.GetStripXTalk(stpindexes[ll])
00129 << "all1.GetStripAmbiguity(stpindexes[ll])= "
00130 << all1.GetStripAmbiguity(stpindexes[ll])
00131 << "all1.GetStripStrip(stpindexes[ll])= "
00132 << all1.GetStripStrip(stpindexes[ll])
00133 << "all1.GetStripPlane(stpindexes[ll])= "
00134 << all1.GetStripPlane(stpindexes[ll]) << endl;
00135 }
00136 return bigcluster;
00137
00138 }
00139
00140
00141
00142 void ClusterKG::SetEnergy(StripListKG &all1){
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 energyRaw=0.0;
00156 energyPe=0.0;
00157
00158 for(UInt_t i=0; i<stpindexes.size(); ++i){
00159 energyRaw=energyRaw+all1.GetStripRawE(stpindexes[i])
00160 +all1.GetStripRawW(stpindexes[i]);
00161 energyPe=energyPe+all1.GetStripPeE(stpindexes[i])
00162 +all1.GetStripPeW(stpindexes[i]);
00163 }
00164 }
00165
00166
00167
00168 Double_t ClusterKG::GetEnergy(Int_t whatKind) const{
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 if(whatKind==0){
00183 return energyRaw;
00184 }
00185 else if(whatKind==1){
00186 return energyPe;
00187 }
00188 else if(whatKind==2){
00189 return energyGeV;
00190 }
00191 else{
00192 return energyPe;
00193 }
00194
00195 return energyPe;
00196 }
00197
00198
00199
00200 void ClusterKG::FindNbOfAmbStrips(StripListKG &all1){
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 for(UInt_t i=0; i<stpindexes.size(); ++i){
00214 if(all1.GetStripAmbiguity(stpindexes[i])>1){
00215 nbOfAmbStrips=nbOfAmbStrips+1;
00216 }
00217 }
00218 }
00219
00220
00221
00222 Int_t ClusterKG::GetNbOfAmbStrips() const{
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236 return nbOfAmbStrips;
00237 }
00238
00239