#include <CondensedNtpModuleNC.h>
Inheritance diagram for CondensedNtpModuleNC:

Public Member Functions | |
| CondensedNtpModuleNC () | |
| virtual | ~CondensedNtpModuleNC () |
| void | BeginJob () |
| JobCResult | Ana (const MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
| void | Help () |
| void | EndJob () |
Private Member Functions | |
| void | ResetTreeVariables () |
Private Attributes | |
| TString | fFileName |
| TString | fTreeName |
| TFile * | fNtpFile |
| TTree * | fNtuple |
| int | fDataType |
| int | fFailedDeMux |
| ANtpNueInfo * | fNueInfo |
| ANtpEventInfoNC * | fEventInfo |
| ANtpHeaderInfo * | fHeaderInfo |
| ANtpBeamInfo * | fBeamInfo |
| ANtpShowerInfoNC * | fShowerInfo |
| ANtpTrackInfoNC * | fTrackInfo |
| ANtpTruthInfoBeam * | fTruthInfo |
| ANtpEventInfoMRCC * | fEventInfoMRCC |
| ANtpInfoObjectFillerNC * | fInfoFiller |
| ANtpInfoObjectFillerMRCC * | fInfoFillerMRCC |
| ANtpInfoObjectFillerNue * | fInfoFillerNue |
| int | fVHSPlanes |
| int | fVHSStrips |
| int | fMakeNueBranch |
|
|
|
Definition at line 84 of file CondensedNtpModuleNC.cxx. References MSG. 00085 {
00086
00087 MSG("JobC", Msg::kDebug) << "CondensedNtpModuleNC::Destructor" << endl;
00088
00089 if(fHeaderInfo) delete fHeaderInfo;
00090 if(fEventInfo) delete fEventInfo;
00091 if(fEventInfoMRCC) delete fEventInfoMRCC;
00092 if(fShowerInfo) delete fShowerInfo;
00093 if(fTrackInfo) delete fTrackInfo;
00094 if(fTruthInfo) delete fTruthInfo;
00095 if(fBeamInfo) delete fBeamInfo;
00096 if(fNueInfo) delete fNueInfo;
00097 }
|
|
|
Implement this for read only access to the MomNavigator Reimplemented from JobCModule. Definition at line 145 of file CondensedNtpModuleNC.cxx. References ANtpInfoObjectFillerNue::Analyze(), ANtpEventInfoMRCC::bestEvent, det, ANtpHeaderInfo::events, fBeamInfo, fDataType, fEventInfo, fEventInfoMRCC, fHeaderInfo, ANtpInfoObjectFillerBeam::FillBeamInformation(), ANtpInfoObjectFillerMRCC::FillEventInformation(), ANtpInfoObjectFiller::FillHeaderInformation(), ANtpInfoObjectFillerNC::FillInformation(), fInfoFiller, fInfoFillerMRCC, fInfoFillerNue, fNtuple, fShowerInfo, fTrackInfo, fTruthInfo, ANtpRecoNtpManipulator::GetClusterArray(), VldContext::GetDetector(), MomNavigator::GetFragment(), ANtpRecoNtpManipulator::GetNtpStRecord(), VldContext::GetSimFlag(), ANtpRecoNtpManipulator::GetStripArray(), VldContext::GetTimeStamp(), RecRecordImp< T >::GetVldContext(), ANtpEventInfo::index, ANtpInfoObjectFillerNC::InitializekNN(), MAXMSG, MSG, ANtpHeaderInfo::newSnarl, ANtpHeaderInfo::passedDeMux, ANtpEventInfoMRCC::Reset(), ANtpShowerInfoNC::Reset(), ANtpTrackInfoNC::Reset(), ANtpEventInfoNC::Reset(), ResetTreeVariables(), ANtpInfoObjectFillerNC::SetClusterArray(), ANtpInfoObjectFillerNC::SetDetector(), JobCResult::SetFailed(), ANtpRecoNtpManipulator::SetPrimaryShowerCriteria(), ANtpRecoNtpManipulator::SetPrimaryTrackCriteria(), ANtpInfoObjectFiller::SetStripArray(), JobCResult::SetWarning(), ANtpHeaderInfo::snarl, and ANtpHeaderInfo::year. 00146 {
00147 JobCResult result(JobCResult::kPassed);
00148
00149 //get the records from MOM
00150 assert(mom);
00151
00152 NtpSRRecord* record = (NtpSRRecord*)(mom->GetFragment("NtpSRRecord"));
00153 NtpMRRecord* mrRecord = (NtpMRRecord*)(mom->GetFragment("NtpMRRecord"));
00154
00155 NtpStRecord* stRecord=0;
00156 NtpStRecord* stRecordOrig=0;
00157 // Only want to create the MRCC output branch if the input file had MRCC in
00158 // This information isn't available to us in BeginJob, I can't think of a
00159 // better way than this.
00160 if(mrRecord){
00161
00162 // This is a little fiddly: for MRCC processing, we need two
00163 // NtpStRecords; the one that got produced when we processed with
00164 // MRCC, and the one for the same snarl as processed without
00165 // MRCC. The former has name "MuonRemoved", while the latter has
00166 // name "Primary"
00167 stRecordOrig = (NtpStRecord*)(mom->GetFragment("NtpStRecord",
00168 "Primary"));
00169 stRecord = (NtpStRecord*)(mom->GetFragment("NtpStRecord",
00170 "MuonRemoved"));
00171
00172 if(!stRecordOrig){
00173 // Would really like to exit if this happens, to avoid the case
00174 // where only one file is given (although this check is done in
00175 // the macro). However, concatenation is not our friend, and
00176 // sometimes the concatenated sntp file gets chopped before the
00177 // mrnt file, so it doesn't have all the same subruns in it. In
00178 // this case, just ignore this snarl.
00179 MAXMSG("CondensedNtpModuleNC", Msg::kWarning, 10)
00180 << "No NtpStRecord found. Probably the sntp file is shorter than the mrnt."
00181 << "Ignoring this snarl" << endl;
00182 return JobCResult::kFailed;
00183 }
00184 static bool once = true;
00185 if(once){
00186 fNtuple->Branch("mrcc.", "ANtpEventInfoMRCC", &fEventInfoMRCC, 64000, 2);
00187 once = false;
00188 }
00189 }
00190 else{
00191 // If we're not running MRCC, the Primary NtpStRecord is the one to use
00192 stRecord = (NtpStRecord*)(mom->GetFragment("NtpStRecord",
00193 "Primary"));
00194 }
00195
00196 if(!record && !stRecord){
00197 MSG("CondensedNtpModuleNC", Msg::kWarning) << "Could not get NtpSR or NtpSt "
00198 << "Record from MOM" << endl;
00199 result.SetWarning().SetFailed();
00200 return result;
00201 }//end if no NtpSRRecord
00202
00203 NtpMCRecord* mcRecord = (NtpMCRecord*)(mom->GetFragment("NtpMCRecord"));
00204 NtpTHRecord* thRecord = (NtpTHRecord*)(mom->GetFragment("NtpTHRecord"));
00205
00206 //instantiate a NtpHelper object to help you get the info you want
00207 ANtpRecoNtpManipulator *ntpManipulator = 0;
00208 if(record) ntpManipulator = new ANtpRecoNtpManipulator(record, mcRecord, thRecord);
00209 else if(stRecord) ntpManipulator = new ANtpRecoNtpManipulator(stRecord);
00210
00211 const VldContext *vldc = stRecord ? stRecord->GetVldContext() : record->GetVldContext();
00212 VldTimeStamp timeStamp = vldc->GetTimeStamp();
00213
00214 //fill the header information
00215 Detector::Detector_t det = vldc->GetDetector();
00216
00217 //get a sim flag
00218 SimFlag::SimFlag_t dataType = vldc->GetSimFlag();
00219
00220 fInfoFiller->SetDetector(det);
00221 fInfoFiller->SetStripArray(ntpManipulator->GetStripArray());
00222 fInfoFiller->SetClusterArray(ntpManipulator->GetClusterArray());
00223 fInfoFiller->FillHeaderInformation(ntpManipulator, det, dataType, fHeaderInfo);
00224
00225 if(fHeaderInfo->snarl%500==0)
00226 MSG("CondensedNtpModuleNC", Msg::kInfo) << "snarl " << fHeaderInfo->snarl << endl;
00227
00228 // MAXMSG("CondensedNtpModuleNC",Msg::kDebug,20)
00229 // << "detector = " << fHeaderInfo->detector << " " << det << endl;
00230
00231 if(fHeaderInfo->year > 2004){
00232 fInfoFiller->FillBeamInformation(timeStamp, det, dataType, fBeamInfo);
00233 MAXMSG("CondensedNtpModuleNC",Msg::kDebug,1)
00234 << "Calling db method to fill beam info." << endl;
00235 }
00236
00237 if(fHeaderInfo->passedDeMux == 0)
00238 ++fFailedDeMux;
00239
00240 //set up which flags you want to use to determine the primary shower or track
00241 //a value of 0 for a flag means it will not be used
00242 ntpManipulator->SetPrimaryTrackCriteria(0,1,0); // nplanes, length, total pulse height
00243
00244 //for now set the primary shower criteria both to 0, that will pick out the first
00245 //shower in the reco array, which has been determined to be the one to use. some
00246 //other cuts still apply, but can be put in at the analysis level, not the ntuple
00247 //making level. this was settled at the reco meeting on 2/9/06 - bjr
00248 ntpManipulator->SetPrimaryShowerCriteria(0,0); // nplanes, total pulse height
00249
00250 //--------------------------------------------------------------------
00251 //here is where you start looping over the events in the ntuple to fill
00252 //your analysis tree
00253
00254 //handle the special case where you have a spill but no events
00255 if(fHeaderInfo->events < 1){
00256 //reset all the event, track and shower info objects to their default values
00257 //the beam and header values remain
00258 fEventInfo->Reset();
00259 fTrackInfo->Reset();
00260 fShowerInfo->Reset();
00261 fEventInfoMRCC->Reset();
00262 fNtuple->Fill();
00263 return result;
00264 }
00265
00266 //initialize the kNN stuff as it should only be done once per snarl
00267 fInfoFiller->InitializekNN(ntpManipulator);
00268
00269 //loop over the events in the snarl
00270 for(Int_t i = 0; i < fHeaderInfo->events; ++i){
00271
00272 MSG("CondensedNtpModuleNC", Msg::kDebug) << "on event " << i << endl;
00273
00274 //reset the variables for the tree
00275 ResetTreeVariables();
00276
00277 //if this isnt the first event in the snarl, then set the fHeaderInfo->newSnarl
00278 //to 0
00279 if(i > 0) fHeaderInfo->newSnarl = 0;
00280
00281 if(fMakeNueBranch)fInfoFillerNue->Analyze(i, ntpManipulator->GetNtpStRecord(), fNueInfo);
00282
00283 // HACK HACK HACK:
00284 //
00285 // With MRCC files, this line will fill fTruthInfo
00286 // with the truth found from the mrnt file. Sadly, due to the
00287 // processing snafu documented in docdb 6599, the truth
00288 // information in mrnts isn't filled, so we'll later on fill the
00289 // truth from fInfoFillerMRCC::FillEventInformation
00290 if( fInfoFiller->FillInformation(i, ntpManipulator, fEventInfo, fTrackInfo,
00291 fShowerInfo, fTruthInfo) ){
00292 // The index field should actually be the index in this snarl. If this
00293 // isn't true then I don't know how the indexing works.
00294 assert(fEventInfo->index == i);
00295 // Fill the MRCC branch if this appears to be an MRCC file. Will
00296 // also fill the truth information, because of the problem
00297 // explained a couple of lines above
00298 if(mrRecord){
00299 fInfoFillerMRCC->FillEventInformation(i, mrRecord, stRecordOrig,
00300 fEventInfoMRCC,
00301 fDataType==1 ? fTruthInfo : 0);
00302 // Make sure it did the right thing
00303 assert(fEventInfoMRCC->bestEvent == fEventInfo->index ||
00304 fEventInfoMRCC->bestEvent == ANtpDefaultValue::kInt);
00305 } // end if mrRecord
00306
00307 fNtuple->Fill();
00308
00309 }//end if filling succeeded
00310 }//end loop over events for this snarl
00311 //-------------------------------------------------------------------
00312
00313 return result;
00314 }
|
|
|
Implement for notification of begin of job Reimplemented from JobCModule. Definition at line 100 of file CondensedNtpModuleNC.cxx. References fBeamInfo, fDataType, fEventInfo, fFileName, fHeaderInfo, fNtpFile, fNtuple, fNueInfo, fShowerInfo, fTrackInfo, fTreeName, fTruthInfo, and MSG. 00101 {
00102 MSG("CondensedNtpModuleNC", Msg::kDebug)
00103 << "in BeginJob" << endl;
00104
00105 // save the current working directory
00106 //TDirectory* savedir = gDirectory;
00107
00108 //create the new TFile for holding the electronics tree
00109 // this changes the value of gDirectory
00110 fNtpFile = new TFile(fFileName,"RECREATE");
00111 // if(!fNtpFile->IsOpen() ) MSG("CondensedNtpModuleNC", Msg::kFatal) << "file not open "
00112 // << fFileName << endl;
00113
00114 // create TTree, these will attach themselves to the current
00115 //working directory
00116 fNtuple = new TTree(fTreeName, "Analysis Tree");
00117
00118 //-----------------------------------------------------------------------
00119 //here is where you define your tree
00120 fNtuple->Branch("header.", "ANtpHeaderInfo", &fHeaderInfo, 64000, 2);
00121 fNtuple->Branch("event.", "ANtpEventInfoNC", &fEventInfo, 64000, 2);
00122 fNtuple->Branch("shower.", "ANtpShowerInfoNC", &fShowerInfo, 64000, 2);
00123 fNtuple->Branch("track.", "ANtpTrackInfoNC", &fTrackInfo, 64000, 2);
00124 fNtuple->Branch("beam.", "ANtpBeamInfo", &fBeamInfo, 64000, 2);
00125 if(fMakeNueBranch)fNtuple->Branch("nue.", "ANtpNueInfo", &fNueInfo, 64000, 2);
00126 if(fDataType==1)
00127 fNtuple->Branch("truth.", "ANtpTruthInfoBeam", &fTruthInfo, 64000, 2);
00128
00129 MSG("CondensedNtpModuleNC", Msg::kDebug) << "got branches" << endl;
00130
00131 //-----------------------------------------------------------------------
00132
00133 // Setup Kregg's image recognition filling
00134 //fInfoFiller->InitializeVHSTraining(fVHSPlanes, fVHSStrips);
00135
00136 // change back to current working directory before leaving constructor
00137 //savedir->cd();
00138
00139 return;
00140 }
|
|
|
Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables. Reimplemented from JobCModule. Definition at line 372 of file CondensedNtpModuleNC.cxx. References fDataType, fFileName, fMakeNueBranch, fTreeName, fVHSPlanes, fVHSStrips, and Registry::Get(). 00373 {
00374 int tmpb; // a temp bool. See comment under DefaultConfig...
00375 int tmpi; // a temp int.
00376 const char* tmps; // a temp string
00377
00378 if (r.Get("FileName", tmps)) fFileName = tmps;
00379 if (r.Get("TreeName", tmps)) fTreeName = tmps;
00380 if (r.Get("DataType", tmpi)) fDataType = tmpi;
00381
00382 if (r.Get("VHSPlanes", tmpi)) fVHSPlanes = tmpi;
00383 if (r.Get("VHSStrips", tmpi)) fVHSStrips = tmpi;
00384
00385 if (r.Get("MakeNueBranch", tmpb)) fMakeNueBranch = tmpb;
00386
00387 }
|
|
|
Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like: const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; } Reimplemented from JobCModule. Definition at line 344 of file CondensedNtpModuleNC.cxx. References Registry::LockValues(), Registry::Set(), and Registry::UnLockValues(). 00345 {
00346
00347 int itrue = 1; // work around for lack of bool in registry
00348 int ifalse = 0; // work around for lack of bool in registry
00349
00350 static Registry r;
00351
00352 r.UnLockValues();
00353
00354 r.Set("FileName", "analysisTree.root");
00355 r.Set("TreeName", "analysisTree");
00356 r.Set("DataType", 1);
00357
00358 r.Set("VHSPlanes",20);
00359 r.Set("VHSStrips",20);
00360
00361 r.Set("MakeNueBranch", false);
00362
00363 r.LockValues();
00364
00365 //quiet the compiler
00366 itrue = ifalse;
00367
00368 return r;
00369 }
|
|
|
Implement for notification of end of job Reimplemented from JobCModule. Definition at line 327 of file CondensedNtpModuleNC.cxx. References fFailedDeMux, fNtpFile, and MSG. 00328 {
00329
00330 MSG("CondensedNtpModuleNC", Msg::kInfo) << "start end job method " << fFailedDeMux
00331 << " failed demuxing" << endl;
00332
00333 //cd to the "directory" of the file
00334 fNtpFile->cd();
00335
00336 // only write file -- this is enough and prevents duplication
00337 fNtpFile->Write();
00338 fNtpFile->Close();
00339
00340 return;
00341 }
|
|
|
Implement to spew some useful help to cout Reimplemented from JobCModule. Definition at line 317 of file CondensedNtpModuleNC.cxx. References MSG. 00318 {
00319 MSG("JobC", Msg::kDebug)
00320 << "CondensedNtpModuleNC::Help\n"
00321 <<"CondensedNtpModuleNC is a module which demultiplexes events "
00322 <<"in the far detector."
00323 << endl;
00324 }
|
|
|
Definition at line 390 of file CondensedNtpModuleNC.cxx. References fEventInfo, fEventInfoMRCC, fNueInfo, fShowerInfo, fTrackInfo, fTruthInfo, ANtpEventInfoMRCC::Reset(), ANtpNueInfo::Reset(), ANtpTruthInfoBeam::Reset(), ANtpShowerInfoNC::Reset(), ANtpTrackInfoNC::Reset(), and ANtpEventInfoNC::Reset(). Referenced by Ana(). 00391 {
00392
00393 fEventInfo->Reset();
00394 fTrackInfo->Reset();
00395 fShowerInfo->Reset();
00396 fTruthInfo->Reset();
00397 if(fMakeNueBranch)fNueInfo->Reset();
00398 fEventInfoMRCC->Reset();
00399
00400 return;
00401 }
|
|
|
Definition at line 62 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), and CondensedNtpModuleNC(). |
|
|
Definition at line 56 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), and Config(). |
|
|
Definition at line 60 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 66 of file CondensedNtpModuleNC.h. Referenced by Ana(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 57 of file CondensedNtpModuleNC.h. Referenced by CondensedNtpModuleNC(), and EndJob(). |
|
|
Definition at line 52 of file CondensedNtpModuleNC.h. Referenced by BeginJob(), and Config(). |
|
|
Definition at line 61 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), and CondensedNtpModuleNC(). |
|
|
Definition at line 68 of file CondensedNtpModuleNC.h. Referenced by Ana(), and CondensedNtpModuleNC(). |
|
|
Definition at line 69 of file CondensedNtpModuleNC.h. Referenced by Ana(), and CondensedNtpModuleNC(). |
|
|
Definition at line 70 of file CondensedNtpModuleNC.h. Referenced by Ana(), and CondensedNtpModuleNC(). |
|
|
Definition at line 76 of file CondensedNtpModuleNC.h. Referenced by Config(). |
|
|
Definition at line 54 of file CondensedNtpModuleNC.h. Referenced by BeginJob(), and EndJob(). |
|
|
Definition at line 55 of file CondensedNtpModuleNC.h. Referenced by Ana(), and BeginJob(). |
|
|
Definition at line 59 of file CondensedNtpModuleNC.h. Referenced by BeginJob(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 63 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 64 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 53 of file CondensedNtpModuleNC.h. Referenced by BeginJob(), and Config(). |
|
|
Definition at line 65 of file CondensedNtpModuleNC.h. Referenced by Ana(), BeginJob(), CondensedNtpModuleNC(), and ResetTreeVariables(). |
|
|
Definition at line 73 of file CondensedNtpModuleNC.h. Referenced by Config(). |
|
|
Definition at line 74 of file CondensedNtpModuleNC.h. Referenced by Config(). |
1.3.9.1