00001
00002
00003
00004
00005
00006
00008
00009 #include <cassert>
00010
00011 #include "Cluster3D/Cluster3DModule.h"
00012 #include "Algorithm/AlgConfig.h"
00013 #include "Algorithm/AlgFactory.h"
00014 #include "Algorithm/AlgHandle.h"
00015 #include "CandData/CandHeader.h"
00016 #include "CandData/CandRecord.h"
00017 #include "Candidate/CandContext.h"
00018 #include "Conventions/Munits.h"
00019 #include "JobControl/JobCModuleRegistry.h"
00020 #include "JobControl/JobCommand.h"
00021 #include "MessageService/MsgService.h"
00022 #include "MinosObjectMap/MomNavigator.h"
00023 #include "Validity/VldContext.h"
00024 #include "CandDigit/CandDigitListHandle.h"
00025 #include "RecoBase/CandSliceListHandle.h"
00026 #include "RecoBase/CandStripListHandle.h"
00027 #include "Cluster3D/CandCluster3DListHandle.h"
00028 #include "Cluster3D/CandCluster3DList.h"
00029 #include "Cluster3D/CandCluster3DHandle.h"
00030
00031 #include <iostream>
00032
00033 using std::cout;
00034 using std::endl;
00035
00036 ClassImp(Cluster3DModule)
00037
00038 JOBMODULE(Cluster3DModule,"Cluster3DModule","Clustering in 3D");
00039 CVSID("$Id: Cluster3DModule.cxx,v 1.3 2007/03/01 17:44:17 rhatcher Exp $");
00040
00041
00042 Cluster3DModule::Cluster3DModule()
00043 {
00044
00045
00046
00047
00048 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule Constructor - " << endl;
00049
00050 AlgFactory &af = AlgFactory::GetInstance();
00051 af.Register("AlgCluster3DList","default","libCluster3D.so","AlgConfig");
00052 af.Register("AlgCluster3D","default","libCluster3D.so","AlgConfig");
00053
00054 }
00055
00056
00057
00058 Cluster3DModule::~Cluster3DModule()
00059 {
00060
00061
00062
00063
00064 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule Destructor - " << endl;
00065
00066 }
00067
00068
00069
00070 void Cluster3DModule::BeginJob()
00071 {
00072
00073
00074
00075
00076 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginJob - " << endl;
00077
00078 }
00079
00080
00081
00082 void Cluster3DModule::EndJob()
00083 {
00084
00085
00086
00087
00088 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndJob - " << endl;
00089
00090 }
00091
00092
00093
00094 void Cluster3DModule::BeginFile()
00095 {
00096
00097
00098
00099
00100 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginFile - " << endl;
00101
00102 }
00103
00104
00105
00106 void Cluster3DModule::EndFile()
00107 {
00108
00109
00110
00111
00112 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndFile - " << endl;
00113
00114 }
00115
00116
00117
00118 void Cluster3DModule::BeginRun()
00119 {
00120
00121
00122
00123
00124 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginRun - " << endl;
00125
00126 }
00127
00128
00129
00130 void Cluster3DModule::EndRun()
00131 {
00132
00133
00134
00135
00136 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndRun - " << endl;
00137
00138 }
00139
00140
00141
00142 JobCResult Cluster3DModule::Ana(const MomNavigator* )
00143 {
00144
00145
00146
00147
00148 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Ana - " << endl;
00149
00150 return JobCResult::kPassed;
00151 }
00152
00153
00154
00155 JobCResult Cluster3DModule::Reco(MomNavigator* mom)
00156 {
00157
00158
00159
00160
00161 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Reco - " << endl;
00162
00163
00164
00165 CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00166 if(candrec==0){
00167 MSG("Cluster3D",Msg::kWarning)
00168 << "Cluster3DModule::Reco: Failed to Find CandRecord " << endl;
00169 return (JobCResult::kWarning);
00170 }
00171
00172
00173
00174
00175
00176 CandDigitListHandle *digitlist = dynamic_cast<CandDigitListHandle*>
00177 (candrec->FindCandHandle("CandDigitListHandle"));
00178
00179 if(!digitlist){
00180 MSG("Cluster3D",Msg::kDebug)
00181 << " No CandDigitListHandle in CandRecord" << endl;
00182 }
00183 else{
00184 Int_t ndigits = digitlist->GetNDaughters();
00185 MSG("Cluster3D",Msg::kDebug)
00186 << " Found " << ndigits << " digits" << endl;
00187 }
00188
00189
00190
00191 CandSliceListHandle* slclisth = dynamic_cast<CandSliceListHandle*>
00192 (candrec->FindCandHandle("CandSliceListHandle") );
00193
00194
00195
00196 if(!slclisth){
00197 MSG("Cluster3D",Msg::kWarning) << "Cluster3DModule::Reco:"
00198 << "No CandSliceListHandle in CandRecord" << endl;
00199 return JobCResult::kFailed;
00200 }
00201 else{
00202 Int_t nslice = slclisth->GetNDaughters();
00203 MSG("Cluster3D",Msg::kDebug) << " Cluster3DModule::Reco: "
00204 << " Found " << nslice << " slices" << endl;
00205 }
00206
00207
00208
00209
00210 AlgFactory &af = AlgFactory::GetInstance();
00211
00212
00213 AlgHandle aclh = af.GetAlgHandle("AlgCluster3DList","default");
00214
00215
00216 CandContext cx(this, mom);
00217 cx.SetDataIn(slclisth);
00218 cx.SetCandRecord(candrec);
00219
00220
00221
00222
00223 CandCluster3DListHandle clustlisth =
00224 CandCluster3DList::MakeCandidate(aclh, cx);
00225
00226 CandCluster3DListHandle* cl = &clustlisth;
00227 Int_t nclust = cl->GetNDaughters();
00228 MSG("Cluster3D",Msg::kDebug) << " Cluster3DModule::Reco: "
00229 << " Found " << nclust << " clusters" << endl;
00230
00231
00232
00233 clustlisth.SetName("CandCluster3DList");
00234 clustlisth.SetTitle(TString("Created by Cluster3DModule from ").
00235 Append(slclisth->GetName()));
00236
00237
00238
00239 candrec->SecureCandHandle(clustlisth);
00240
00241 return JobCResult::kAOK;
00242
00243 }
00244
00245
00246
00247 const Registry& Cluster3DModule::DefaultConfig() const
00248 {
00249
00250
00251
00252 static Registry r;
00253
00254
00255
00256
00257 std::string name = this->JobCModule::GetName();
00258 name += ".config.default";
00259 r.SetName(name.c_str());
00260
00261
00262
00263
00264
00265
00266 AlgFactory &af = AlgFactory::GetInstance();
00267
00268
00269
00270 AlgHandle alglisthandle = af.GetAlgHandle("AlgCluster3DList","default");
00271 AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00272
00273
00274
00275 alglistconfig.Set("plnDist",4);
00276 alglistconfig.Set("stpDist",8);
00277
00278
00279
00280
00281 alglistconfig.Set("minClustStp",4);
00282 alglistconfig.Set("minClustAmbStp",4);
00283
00284 alglistconfig.Set("minClustPe",10.);
00285 alglistconfig.Set("maxDist",3);
00286
00287 alglistconfig.Set("xTalk",1);
00288 alglistconfig.Set("xTalkMode",2);
00289
00290 alglistconfig.Set("xTalkPeCut",2.);
00291
00292 alglistconfig.Set("timeInfo",0);
00293 alglistconfig.Set("vLightInScint",2.179);
00294 alglistconfig.Set("t1-t2ResolutionInNs",3.5);
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 static bool been_here = false;
00310 if (!been_here) {
00311 been_here = true;
00312
00313 std::string name = this->JobCModule::GetName();
00314 name += ".config.default";
00315 r.SetName(name.c_str());
00316
00317
00318
00319
00320
00321
00322
00323
00324 r.Merge(alglistconfig);
00325 r.LockValues();
00326 }
00327
00328
00329
00330 return r;
00331 }
00332
00333
00334
00335 void Cluster3DModule::Config(const Registry& r)
00336 {
00337
00338
00339
00340
00341 Int_t tmpi;
00342 Double_t tmpd;
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354 AlgFactory &af = AlgFactory::GetInstance();
00355
00356
00357
00358 AlgHandle alglisthandle = af.GetAlgHandle("AlgCluster3DList","default");
00359 AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00360
00361 alglistconfig.UnLockValues();
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372 if (r.Get("plnDist",tmpi)) {
00373 alglistconfig.Set("plnDist",tmpi);
00374 }
00375 if (r.Get("stpDist",tmpi)) {
00376 alglistconfig.Set("stpDist",tmpi);
00377 }
00378 if (r.Get("minClustStp",tmpi)) {
00379 alglistconfig.Set("minClustStp",tmpi);
00380 }
00381 if (r.Get("minClustAmbStp",tmpi)) {
00382 alglistconfig.Set("minClustAmbStp",tmpi);
00383 }
00384 if (r.Get("minClustPe",tmpd)) {
00385 alglistconfig.Set("minClustPe",tmpd);
00386 }
00387 if (r.Get("maxDist",tmpi)) {
00388 alglistconfig.Set("maxDist",tmpi);
00389 }
00390 if (r.Get("xTalk",tmpi)) {
00391 alglistconfig.Set("xTalk",tmpi);
00392 }
00393 if (r.Get("xTalkMode",tmpi)) {
00394 alglistconfig.Set("xTalkMode",tmpi);
00395 }
00396 if (r.Get("xTalkPeCut",tmpd)) {
00397 alglistconfig.Set("xTalkPeCut",tmpd);
00398 }
00399 if (r.Get("timeInfo",tmpi)) {
00400 alglistconfig.Set("timeInfo",tmpi);
00401 }
00402 if (r.Get("vLightInScint",tmpd)) {
00403 alglistconfig.Set("vLightInScint",tmpd);
00404 }
00405 if (r.Get("t1-t2ResolutionInNs",tmpd)) {
00406 alglistconfig.Set("t1-t2ResolutionInNs",tmpd);
00407 }
00408
00409 alglistconfig.LockValues();
00410
00411 }
00412
00413
00414
00415 void Cluster3DModule::Help()
00416 {
00417
00418
00419
00420
00421
00422
00423
00424 }
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440 void Cluster3DModule::Reset()
00441 {
00442
00443
00444
00445 }
00446
00447
00448
00449 JobCResult Cluster3DModule::Get(MomNavigator* )
00450 {
00451
00452
00453
00454
00455 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Get - " << endl;
00456
00457 return JobCResult::kPassed;
00458 }
00459
00460
00461
00462 JobCResult Cluster3DModule::Put(const MomNavigator* )
00463 {
00464
00465
00466
00467
00468 MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Put - " << endl;
00469
00470 return JobCResult::kPassed;
00471 }
00472
00473
00474