00001 #include "TClonesArray.h"
00002
00003 #include "CandNtupleSR/NtpSRTrack.h"
00004 #include "CandNtupleSR/NtpSREvent.h"
00005 #include "JobControl/JobCModuleRegistry.h"
00006 #include "JobControl/JobCResult.h"
00007 #include "MessageService/MsgService.h"
00008 #include "MinosObjectMap/MomNavigator.h"
00009 #include "StandardNtuple/NtpStRecord.h"
00010 #include "Conventions/ReleaseType.h"
00011
00012 #include "NtupleUtils/LISieve.h"
00013 #include "NtupleUtils/NuEvent.h"
00014 #include "NtupleUtils/NuLibrary.h"
00015
00016 #include "NtupleUtils/NuDemoModule.h"
00017
00018 ClassImp(NuDemoModule)
00019
00020 CVSID("$Id: NuDemoModule.cxx,v 1.8 2007/11/24 11:26:47 hartnell Exp $");
00021
00022 JOBMODULE(NuDemoModule,"NuDemoModule","Demo Module");
00023
00024
00025
00026 NuDemoModule::NuDemoModule()
00027 {
00028
00029 }
00030
00031
00032
00033 NuDemoModule::~NuDemoModule()
00034 {
00035
00036 }
00037
00038
00039
00040 JobCResult NuDemoModule::Ana(const MomNavigator *mom)
00041 {
00042
00043 NtpStRecord* pntp = dynamic_cast<NtpStRecord*>
00044 (mom->GetFragment("NtpStRecord"));
00045 const NtpStRecord& ntp = *pntp;
00046
00047 const RecCandHeader& rec=ntp.GetHeader();
00048 MAXMSG("NuAnalysis",Msg::kInfo,5)
00049 <<"Found: run="<<rec.GetRun()
00050 <<", subrun="<<rec.GetSubRun()
00051 <<", detector="<<rec.GetVldContext().GetDetector()
00052 <<", simFlag="<<rec.GetVldContext().GetSimFlag()
00053 <<endl;
00054
00055
00056 NuLibrary& lib=NuLibrary::Instance();
00057
00058 static Int_t entry=-1;
00059 entry++;
00060
00061 TClonesArray& evtTca=(*ntp.evt);
00062 const Int_t numEvts=evtTca.GetEntriesFast();
00063
00065
00067 for (Int_t ievt=0;ievt<numEvts;ievt++){
00068 const NtpSREvent& evt=
00069 *dynamic_cast<NtpSREvent*>(evtTca[ievt]);
00070 lib.cnt.evtCounter++;
00071
00072 MAXMSG("NuAnalysis",Msg::kInfo,5)
00073 <<"Found event, "<<ievt+1<<"/"<<numEvts<<endl;
00074
00075 const NtpSREventSummary& evthdr=ntp.evthdr;
00076
00077 if (evthdr.litime!=-1) continue;
00078 lib.cnt.evtNotlitime++;
00079
00080
00081
00082 NuEvent nu;
00083
00084 nu.entry=entry;
00085 nu.nevt=numEvts;
00086 nu.anaVersion=NuCuts::kCC0250Std;
00087 nu.releaseType=ReleaseType::kCedarDaikon;
00088
00089
00090
00091 lib.ext.ExtractGeneralInfo(ntp,nu);
00092
00093
00094 lib.ext.ExtractEvtInfo(evt,nu);
00095
00096
00097 if (!lib.cuts.IsGoodNumberOfTracks(nu)) continue;
00098 lib.cnt.evtWithTrkCounter++;
00099
00100
00101 Int_t bestTrack=lib.reco.GetBestTrack(nu);
00102 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,
00103 bestTrack-1);
00104 if (ptrk==0) {
00105 MSG("NuAnalysis",Msg::kWarning)
00106 <<endl<<endl<<"Ahhh, no track in this event!"<<endl<<endl;
00107 }
00108 const NtpSRTrack& trk=*ptrk;
00109
00110
00111 lib.ext.ExtractTrkShwInfo(ntp,evt,nu);
00112
00114
00115 lib.reco.GetEvtEnergy(nu);
00116
00117
00118 if (!lib.cuts.IsInFidVolTrk(nu)) continue;
00119 lib.cnt.trkInFidVolCounter++;
00120
00121
00122 lib.ext.ExtractMinMaxEvtTimes(ntp,evt,nu);
00123 lib.ext.ExtractTimeToNearestSpill(nu);
00124
00125 lib.reco.GetTruthInfo(ntp,evt,nu);
00126
00127
00128
00129
00130 lib.ext.ExtractDataQuality(ntp,nu);
00131 lib.ext.ExtractLITags(ntp,nu);
00132 lib.ext.ExtractBeamInfoDB(nu);
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00149
00151
00152
00153
00154 if (lib.cuts.IsLI(nu)) continue;
00155 lib.cnt.evtNotIsLI++;
00156
00157
00158 if (!lib.cuts.IsGoodDataQuality(nu)) continue;
00159 lib.cnt.goodDataQualityCounter++;
00160
00161
00162
00163 if (!lib.cuts.IsGoodTimeToNearestSpill(nu)) continue;
00164 lib.cnt.goodTimeToNearestSpillCounter++;
00165
00166
00167 if (!lib.cuts.IsGoodBeam(nu)) continue;
00168 lib.cnt.goodBeamInfoDBCounter++;
00169
00170
00171 if (!lib.cuts.IsGoodTrackFitPass(nu)) continue;
00172 lib.cnt.goodTrkPassCounter++;
00173
00174
00175 if (!lib.cuts.IsGoodDirCos(nu)) continue;
00176 lib.cnt.goodDirectionCosineCounter++;
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 if (!lib.cuts.IsGoodPID(nu)) {
00191
00192 continue;
00193 }
00194 lib.cnt.goodPIDCounter++;
00195
00196
00197
00198 if (!lib.cuts.IsGoodSigmaQP_QP(nu)) {
00199
00200 continue;
00201 }
00202 lib.cnt.goodFitSigQPCounter++;
00203
00204
00205
00206
00207
00208
00209 if (!lib.cuts.IsGoodFitProb(nu)) {
00210
00211 continue;
00212 }
00213 lib.cnt.goodFitProbCounter++;
00214
00215
00216
00217 if (nu.charge==-1) {
00218
00219
00220 lib.cnt.nuNQCounter++;
00221 }
00222 else if (nu.charge==+1) {
00223
00224 lib.cnt.CountTrkStdhepId(ntp,evt,trk,nu);
00225
00226 lib.cnt.nuPQCounter++;
00227 }
00228 else cout<<"ahhh, bad charge"<<endl;
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245 if (nu.charge<0) {
00246
00247 }
00248 else if (nu.charge>0) {
00249
00250 }
00251 else cout<<"ahhh, zero qp"<<endl;
00252
00253 }
00254
00258
00259
00260 return JobCResult::kPassed;
00261 }
00262
00263
00264
00265 const Registry& NuDemoModule::DefaultConfig() const
00266 {
00268
00269 MSG("NuDemoModule", Msg::kDebug)
00270 << "Running NuDemoModule::DefaultConfig..." << endl;
00271
00272 static Registry r;
00273
00274 string name=this->JobCModule::GetName();
00275 name+=".config.default";
00276 r.SetName(name.c_str());
00277 r.UnLockValues();
00278
00279 r.LockValues();
00280
00281 return r;
00282 }
00283
00284
00285
00286 void NuDemoModule::Config(const Registry& )
00287 {
00289
00290 MSG("NuDemoModule", Msg::kDebug)
00291 << "Running NuDemoModule::Config..." << endl;
00292 }