00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "TTree.h"
00010 #include "TFile.h"
00011 #include "TDirectory.h"
00012 #include "TROOT.h"
00013
00014 #include "NueAna/ParticlePID/ParticleAna/ParticleAna.h"
00015 #include "MessageService/MsgService.h"
00016 #include "MinosObjectMap/MomNavigator.h"
00017 #include "JobControl/JobCModuleRegistry.h"
00018
00019 #include "NueAna/ParticlePID/ParticleAna/PRecord.h"
00020 #include "NueAna/ParticlePID/ParticleAna/PRecordAna.h"
00021
00022
00023 #include "NueAna/ParticlePID/ParticleFinder/ParticleObjectHolder.h"
00024 #include "NueAna/ParticlePID/ParticleFinder/ParticleObject.h"
00025
00026
00027 #include "NueAna/ParticlePID/ParticleFinder/ParticleBeamMonAna.h"
00028
00029 #include "DataUtil/MCInfo.h"
00030
00031 JOBMODULE(ParticleAna, "ParticleAna",
00032 "does the ana for ParticleFinder");
00033 CVSID("$Id: ParticleAna.cxx,v 1.5 2009/06/30 16:45:12 scavan Exp $");
00034
00035
00036
00037
00038
00039
00040 ParticleAna::ParticleAna()
00041 {
00042
00043 lastrun=-1;
00044 DoMRCC=0;
00045 outObjectName="normal";
00046
00047
00048
00052 }
00053
00054
00055 ParticleAna::~ParticleAna()
00056 {
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 }
00070
00071
00072
00073 void ParticleAna::BeginJob()
00074 {
00078 }
00079
00080
00081
00082 void ParticleAna::EndJob()
00083 {
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 }
00108
00109
00110
00111 JobCResult ParticleAna::Reco(MomNavigator* mom)
00112 {
00116
00117
00118
00119
00120 std::vector<TObject* > hft =( mom->GetFragmentList("ParticleObjectHolder",outObjectName.c_str()));
00121
00122
00123
00124
00125
00126 ParticleBeamMon *bmon=0;
00127
00128 for(unsigned int s =0;s<hft.size();s++)
00129 {
00130
00131
00132 ParticleObjectHolder *n=0;
00133 n=dynamic_cast<ParticleObjectHolder *>(hft[s]);
00134
00135
00136
00137
00138
00139
00140 RecCandHeader ntphdr(n->GetHeader().GetVldContext(),n->GetHeader().GetRun(),
00141 n->GetHeader().GetSubRun(),n->GetHeader().GetRunType(),n->GetHeader().GetErrorCode(),
00142 n->GetHeader().GetSnarl(),n->GetHeader().GetTrigSrc(),n->GetHeader().GetTimeFrame(),
00143 n->GetHeader().GetRemoteSpillType(),n->GetHeader().GetEvent());
00144
00145
00146
00147
00148 if(s==0)
00149 {
00150
00151 RecCandHeader ntphdr(n->GetHeader().GetVldContext(),n->GetHeader().GetRun(),
00152 n->GetHeader().GetSubRun(),n->GetHeader().GetRunType(),n->GetHeader().GetErrorCode(),
00153 n->GetHeader().GetSnarl(),n->GetHeader().GetTrigSrc(),n->GetHeader().GetTimeFrame(),
00154 n->GetHeader().GetRemoteSpillType(),-1);
00155
00156 bmon = new ParticleBeamMon(ntphdr);
00157
00158
00159
00160
00161
00162
00163
00164 }
00165
00166
00167
00168
00169
00170
00171
00172 PRecord * r = new PRecord(ntphdr);
00173
00174
00175 PRecordAna pra;
00176
00177
00178 pra.ana(n,r,bmon);
00179 r->SetName(outObjectName.c_str());
00180 mom->AdoptFragment(r);
00181
00182 delete bmon;
00183 bmon=0;
00184 }
00185
00186
00187
00188
00189 return JobCResult::kPassed;
00190 }
00191
00192
00193
00194 const Registry& ParticleAna::DefaultConfig() const
00195 {
00199 static Registry r;
00200
00201
00202 std::string name = this->GetName();
00203 name += ".config.default";
00204 r.SetName(name.c_str());
00205
00206
00207 r.UnLockValues();
00208
00209 r.Set("DoMRCC",0);
00210 r.Set("OutObjectName","Normal");
00211 r.LockValues();
00212
00213
00214 return r;
00215 }
00216
00217
00218
00219 void ParticleAna::Config(const Registry& r)
00220 {
00224
00225
00226 const char* tmps;
00227 int tmpi;
00228
00229 if(r.Get("DoMRCC",tmpi)){DoMRCC=tmpi;}
00230 if(r.Get("OutObjectName",tmps)){outObjectName=tmps;}
00231 }
00232
00233
00234
00235 void ParticleAna::Reset()
00236 {
00240 }
00241
00243
00244
00245 void ParticleAna::FillPot(ParticleBeamMon *bmon)
00246 {
00247
00248 VldContext evt_vldc = bmon->GetHeader().GetVldContext();
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301 lastrun=bmon->GetHeader().GetRun();
00302
00303
00304 }
00305
00306
00307