00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "TClass.h"
00016
00017 #include "Algorithm/AlgHandle.h"
00018 #include "MessageService/MsgService.h"
00019 #include "RecoBase/CandShower.h"
00020 #include "RecoBase/CandShowerHandle.h"
00021 #include "RecoBase/CandStrip.h"
00022 #include "RecoBase/CandStripHandle.h"
00023 #include "RecoBase/CandClusterHandle.h"
00024 ClassImp(CandShower)
00025
00026
00027 CVSID("$Id: CandShower.cxx,v 1.15 2008/11/05 17:33:15 rodriges Exp $");
00028
00029
00030 CandShower::CandShower() :
00031 fEnergy(0.), fMinStripPE(0.)
00032 {
00033 MSG("Cand", Msg::kDebug)
00034 << "Begin CandShower::CandShower() ctor: " << endl
00035 << "UidInt = " << GetUidInt()
00036 << ", ArchUidInt " << GetArchUidInt() << endl
00037 << "No. of links = " << GetNLinks() << endl
00038 << "End CandShower::CandShower() ctor." << endl;
00039 }
00040
00041
00042 CandShower::CandShower(AlgHandle &ah) :
00043 CandReco(ah),
00044 fEnergy(0.),
00045 fEnergy_wtCC(0.),
00046 fEnergy_CC(0.),
00047 fEnergy_wtNC(0.),
00048 fEnergy_NC(0.),
00049 fEnergy_EM(0.),
00050 fMinStripPE(0.)
00051 {
00052
00053
00054
00055
00056
00057
00058 }
00059
00060
00061 CandShower::CandShower(AlgHandle &ah, CandHandle &ch, CandContext &cx) :
00062 CandReco(ah),
00063 fEnergy(0.),
00064 fEnergy_wtCC(0.),
00065 fEnergy_CC(0.),
00066 fEnergy_wtNC(0.),
00067 fEnergy_NC(0.),
00068 fEnergy_EM(0.),
00069 fMinStripPE(0.)
00070 {
00071 CreateLocalHandle();
00072 MSG("Cand", Msg::kDebug)
00073 << "Begin CandShower::CandShower(AlgHandle &, CandHandle &, "
00074 << "CandContext &) ctor: " << endl
00075 << "UidInt = " << GetUidInt()
00076 << ", ArchUidInt " << GetArchUidInt() << endl
00077 << "No. of links = " << GetNLinks() << endl
00078 << "End CandShower::CandShower(AlgHandle &, CandHandle &, "
00079 << "CandContext &) ctor." << endl;
00080
00081
00082 {
00083 CandShowerHandle csh(this);
00084 ch = csh;
00085 }
00086 ah.RunAlg(ch, cx);
00087 }
00088
00089
00090 CandShower::CandShower(const CandShower &rhs) :
00091 CandReco(rhs),
00092 fEnergy(rhs.fEnergy),
00093 fEnergy_wtCC(rhs.fEnergy_wtCC),
00094 fEnergy_CC(rhs.fEnergy_CC),
00095 fEnergy_wtNC(rhs.fEnergy_wtNC),
00096 fEnergy_NC(rhs.fEnergy_NC),
00097 fEnergy_EM(rhs.fEnergy_EM),
00098 fMinStripPE(rhs.fMinStripPE)
00099 {
00100
00101
00102 MSG("Cand", Msg::kDebug)
00103 << "Begin CandShower::CandShower(const CandShower &rhs) ctor: " << endl
00104 << "UidInt = " << GetUidInt()
00105 << ", ArchUidInt " << GetArchUidInt() << endl
00106 << "No. of links = " << GetNLinks() << endl
00107 << "End CandShower::CandShower(const CandShower &rhs) ctor." << endl;
00108
00109 fUPos.erase(fUPos.begin(),fUPos.end());
00110 fVPos.erase(fVPos.begin(),fVPos.end());
00111 fTime[0].erase(fTime[0].begin(),fTime[0].end());
00112 fTime[1].erase(fTime[1].begin(),fTime[1].end());
00113 TIter stripItr(rhs.GetDaughterIterator());
00114 while (const CandStripHandle *striphandle =
00115 dynamic_cast<CandStripHandle*>(stripItr())) {
00116
00117 fUPos[striphandle->GetPlane()] = rhs.fUPos[striphandle->GetPlane()];
00118 fVPos[striphandle->GetPlane()] = rhs.fVPos[striphandle->GetPlane()];
00119 fTime[0][striphandle->GetPlane()] = rhs.fTime[0][striphandle->GetPlane()];
00120 fTime[1][striphandle->GetPlane()] = rhs.fTime[1][striphandle->GetPlane()];
00121 }
00122
00123
00124 CandHandle *ch;
00125 TIter cliter(&rhs.fClusterList);
00126 while ((ch = dynamic_cast<CandHandle *>(cliter())))
00127 fClusterList.Add(ch->DupHandle());
00128 }
00129
00130
00131 CandShower::~CandShower()
00132 {
00133
00134 MSG("Cand", Msg::kDebug)
00135 << "Begin CandShower::~CandShower() dtor: " << endl
00136 << "UidInt = " << GetUidInt()
00137 << ", ArchUidInt " << GetArchUidInt() << endl
00138 << "No. of links = " << GetNLinks() << endl
00139 << "End CandShower::~CandShower() dtor." << endl;
00140
00141 fClusterList.Delete();
00142 }
00143
00144
00145 void CandShower::CreateLocalHandle()
00146 {
00147 SetLocalHandle(new CandShowerHandle(this));
00148 }
00149
00150
00151 CandShower *CandShower::Dup() const
00152 {
00153
00154
00155
00156
00157
00158 CandShower *cb = new CandShower(*this);
00159 cb->CreateLocalHandle();
00160 cb->SetCandRecord(fCandRecord);
00161 TIter iterdau = GetDaughterIterator();
00162 CandHandle *dau;
00163 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00164 return cb;
00165 }
00166
00167
00168 Bool_t CandShower::IsEquivalent(const TObject *rhs) const
00169 {
00170 Bool_t result = true;
00171 if (!CandReco::IsEquivalent(rhs)) result = false;
00172 TestDisplayCandBanner("CandShower");
00173 const CandShower* rCnd = dynamic_cast<const CandShower*>(rhs);
00174 if (rCnd == NULL) return false;
00175
00176 result = TestTObjArrayCandHandleDup("fClusterList",
00177 this->fClusterList,
00178 rCnd->fClusterList) && result;
00179 result = TestEquality("fEnergy", this->fEnergy,
00180 rCnd->fEnergy) && result;
00181 result = TestEquality("fEnergy_wtCC", this->fEnergy_wtCC,
00182 rCnd->fEnergy_wtCC) && result;
00183 result = TestEquality("fEnergyCC", this->fEnergy_CC,
00184 rCnd->fEnergy_CC) && result;
00185 result = TestEquality("fEnergy_wtNC", this->fEnergy_wtNC,
00186 rCnd->fEnergy_wtNC) && result;
00187 result = TestEquality("fEnergy_NC", this->fEnergy_NC,
00188 rCnd->fEnergy_NC) && result;
00189 result = TestEquality("fEnergy_EM", this->fEnergy_EM,
00190 rCnd->fEnergy_EM) && result;
00191 result = TestEquality("fUPos", this->fUPos,
00192 rCnd->fUPos) && result;
00193 result = TestEquality("fVPos", this->fVPos,
00194 rCnd->fVPos) && result;
00195 result = TestArrayEquality("fTime", 2, this->fTime,
00196 rCnd->fTime) && result;
00197 return result;
00198 }
00199
00200
00201 CandShowerHandle CandShower::MakeCandidate(AlgHandle &ah,
00202 CandContext &cx)
00203 {
00204 CandShowerHandle csh;
00205 new CandShower(ah, csh, cx);
00206 return csh;
00207 }
00208
00209
00210 std::ostream& CandShower::FormatToOStream(std::ostream& os,
00211 Option_t *option) const
00212 {
00213 CandReco::FormatToOStream(os,option);
00214
00215 TString opt(option);
00216 if (!opt.Contains("v0")) {
00217 const TString& indent = GetIndentString();
00218
00219 os << indent << GetDataIndent()
00220 << "fClusterList.size " << fClusterList.GetSize()
00221 << " Energy " << fEnergy
00222 << " de-weighted CC Energy " << fEnergy_wtCC
00223 << " linear CC Energy " << fEnergy_CC
00224 << " de-weighted NC Energy " << fEnergy_wtNC
00225 << " linear NC Energy " << fEnergy_NC
00226 << " EM Energy " << fEnergy_EM
00227 << " UVPos map sizes " << fUPos.size() << " " << fVPos.size()
00228 << " Time map sizes " << fTime[0].size() << " " << fTime[1].size()
00229 << endl;
00230 }
00231 return os;
00232
00233 }
00234
00235
00236 void CandShower::Streamer(TBuffer &R__b)
00237 {
00238
00239
00240 if (R__b.IsReading()) {
00241 UInt_t R__s, R__c;
00242 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00243 CandShower::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
00244 if (R__v < 2) {
00245
00246
00247 CandHandle *ch;
00248 TIter cliter(&fClusterList);
00249 while ((ch = dynamic_cast<CandHandle *>(cliter())))
00250 fClusterList.AddAt(ch->DupHandle(), fClusterList.IndexOf(ch));
00251 }
00252 }
00253 else {
00254 CandShower::Class()->WriteBuffer(R__b, this);
00255 }
00256 }
00257
00258