The EventNavigator class provides acess to all the collections in the (MIDAS) Event, which corresponds to a single ROOT branch. More...
#include <EventNavigator.h>
Public Types | |
enum | OutputMode { kNew = 0, kOverwrite } |
Public Member Functions | |
~EventNavigator () | |
const TSetupData *const | GetSetupData () |
const LoopSequence & | GetLoopSequence () const |
const char * | GetOutputFileName () const |
const LoopSequence & | MakeLoopSequence (const ARGUMENTS &args) |
Bool_t | ConnectInput (const char *input_name) |
Bool_t | ConnectOutput (const char *output_name, OutputMode mode=kOverwrite) |
Bool_t | ConnectOutputFile (const char *output_file_name, Bool_t append=false) |
Long64_t | EntryNo () const |
Returns the current event number. | |
Long64_t | GetInputNEntries () const |
Long64_t | GetStartEntry () const |
Returns the entry processing starts from. | |
Long64_t | GetStopEntry () const |
Returns the past-the-end entry processing stops at. | |
Long64_t | GetLoopNEntries () const |
Int_t | NextEntry () |
Int_t | GetEntry (Long64_t entry) |
Int_t | WriteCurrentEntry () |
void | SetSavePulseIslands (bool save=1) |
void | Adopt (PulseIslandList &pil, const SourceID &sid) |
void | Adopt (AnalysedPulseList &apl, const SourceID &sid) |
void | Adopt (DetectorPulseList &dpl, const SourceID &sid) |
void | Adopt (PulseIslandList &pil, const ChannelID &cid) |
This will probably become protected, for copying TAPs. | |
void | AdoptTemporary (PulseIslandList &pil, const SourceID &sid) |
void | AdoptTemporary (AnalysedPulseList &apl, const SourceID &sid) |
void | AdoptTemporary (DetectorPulseList &dpl, const SourceID &sid) |
void | AdoptTemporary (PulseIslandList &pil, const ChannelID &cid) |
This will probably become protected, for copying TAPs. | |
PulseIslandBankIter | MatchIslandBanks (const SourceID &sid) const |
Iterable getters for a list of banks. | |
PulseIslandBankIter | MatchAnalysedBanks (const SourceID &sid) const |
PulseIslandBankIter | MatchDetectorBanks (const SourceID &sid) const |
PulseIslandBankIter | MatchIslandBanks (const ChannelID &cid, GeneratorStr gid="") const |
AnalysedPulseBankIter | MatchAnalysedBanks (const ChannelID &cid, GeneratorStr gid="") const |
AnalysedPulseBankIter | MatchDetectorBanks (const ChannelID &cid, GeneratorStr gid="") const |
void | Close () |
TGlobalData * | GetRawData () const |
TTree * | GetRawTree () const |
void | DumpRawTree () const |
Static Public Member Functions | |
static EventNavigator & | InitInstance (const ARGUMENTS &command_line) |
static EventNavigator & | Instance () |
static const SetupRecord & | GetSetupRecord () |
Protected Member Functions | |
TGlobalData * | ConnectRawData (TFile *raw_file) |
Bool_t | VerifyRawData (TTree *raw_tree) |
TSetupData * | ConnectSetupData (TFile *raw_file) |
Bool_t | VerifySetupData (TTree *setup_tree) |
Bool_t | MirrorRawInputFormat () |
Copy the input raw data tree (TGlobalData) to the output file. | |
Int_t | LoadEntry (Long64_t entry) |
Implementation for loading an entry. | |
Private Types | |
typedef IDs::channel | ChannelID |
typedef IDs::generator | GeneratorID |
typedef IDs::source | SourceID |
typedef IDs::Generator_t | GeneratorStr |
typedef IDs::Config_t | Config |
Private Member Functions | |
EventNavigator () | |
EventNavigator (const ARGUMENTS &command_line) | |
EventNavigator (const EventNavigator &src) | |
EventNavigator & | operator= (const EventNavigator &rhs) |
Private Attributes | |
Bool_t | fCopyRaw |
TFile * | fRawInput |
Input ROOT file, raw format. | |
TFile * | fOutput |
Output ROOT file (may be same as input file). | |
Int_t | fEntryNo |
The current entry number. | |
TTree * | fRawTree |
Input Raw Data (Event) Tree. | |
TTree * | fSetupTree |
Input Setup Tree. | |
TTree * | fEventTree |
TTree * | fOutputTreeTPI |
TGlobalData * | fRawData |
TSetupData * | fSetupData |
SetupRecord * | fSetupRecord |
LoopSequence * | fLoopSequence |
Static Private Attributes | |
static EventNavigator * | fInstance = 0x0 |
The EventNavigator class provides acess to all the collections in the (MIDAS) Event, which corresponds to a single ROOT branch.
The general principle is that the event navigator owns all objects that are read or written to disk. Thus....
Definition at line 40 of file EventNavigator.h.
typedef IDs::channel EventNavigator::ChannelID [private] |
Definition at line 41 of file EventNavigator.h.
typedef IDs::Config_t EventNavigator::Config [private] |
Definition at line 45 of file EventNavigator.h.
typedef IDs::generator EventNavigator::GeneratorID [private] |
Definition at line 42 of file EventNavigator.h.
typedef IDs::Generator_t EventNavigator::GeneratorStr [private] |
Definition at line 44 of file EventNavigator.h.
typedef IDs::source EventNavigator::SourceID [private] |
Definition at line 43 of file EventNavigator.h.
Definition at line 49 of file EventNavigator.h.
00049 {kNew = 0, kOverwrite }; //, kAppend};
EventNavigator::~EventNavigator | ( | ) | [inline] |
Definition at line 58 of file EventNavigator.h.
EventNavigator::EventNavigator | ( | ) | [private] |
Definition at line 59 of file EventNavigator.cpp.
References fOutput, and fRawInput.
Referenced by InitInstance(), and Instance().
00060 : fCopyRaw(true) 00061 , fLoopSequence(0x0) 00062 { 00063 fRawInput = 0x0; 00064 fOutput = 0x0; 00065 //no-op 00066 }
EventNavigator::EventNavigator | ( | const ARGUMENTS & | command_line | ) | [private] |
Definition at line 69 of file EventNavigator.cpp.
00070 : fCopyRaw(true) 00071 , fRawInput(0x0) 00072 , fOutput(0x0) 00073 , fLoopSequence(new LoopSequence(args)) 00074 { 00075 }
EventNavigator::EventNavigator | ( | const EventNavigator & | src | ) | [inline, private] |
Definition at line 231 of file EventNavigator.h.
void EventNavigator::Adopt | ( | PulseIslandList & | pil, | |
const ChannelID & | cid | |||
) |
This will probably become protected, for copying TAPs.
void EventNavigator::Adopt | ( | DetectorPulseList & | dpl, | |
const SourceID & | sid | |||
) |
void EventNavigator::Adopt | ( | AnalysedPulseList & | apl, | |
const SourceID & | sid | |||
) |
void EventNavigator::Adopt | ( | PulseIslandList & | pil, | |
const SourceID & | sid | |||
) |
Adoption: take ownership of a container of reconstruction objects. The calling code should lose ownership so the object is frozen at adoption. Implemetaion could use a swaped body.
void EventNavigator::AdoptTemporary | ( | PulseIslandList & | pil, | |
const ChannelID & | cid | |||
) |
This will probably become protected, for copying TAPs.
void EventNavigator::AdoptTemporary | ( | DetectorPulseList & | dpl, | |
const SourceID & | sid | |||
) |
void EventNavigator::AdoptTemporary | ( | AnalysedPulseList & | apl, | |
const SourceID & | sid | |||
) |
void EventNavigator::AdoptTemporary | ( | PulseIslandList & | pil, | |
const SourceID & | sid | |||
) |
Adoption of temporaries: As Adopt(), but the adopted objects expire and are deleted at the end of the current event.
void EventNavigator::Close | ( | ) |
Bool_t EventNavigator::ConnectInput | ( | const char * | input_name | ) |
Opens an input file and connects to the trees therein. Returns true if file exists, is a ROOT file, and contains at least one EACH of setup and event trees that we recognise. Else false.
Definition at line 115 of file EventNavigator.cpp.
References ConnectRawData(), ConnectSetupData(), AlCapFormat::Raw::DataTreeName, fEntryNo, fSetupTree, and AlCapFormat::Raw::SetupTreeName.
Referenced by main().
00116 { 00117 00118 TFile* ifile = TFile::Open(input_name, "READ"); 00119 if (!ifile) return false; 00120 TList* lok = ifile->GetListOfKeys(); 00121 bool success_data = false; 00122 bool success_meta = false; 00123 fSetupTree = 0x0; 00124 if (lok->Contains(Format::Raw::SetupTreeName) ) { 00125 if ( ConnectSetupData(ifile) != 0x0) 00126 success_meta = true; 00127 } 00128 //TTree* raw_tree = 0x0; 00129 if (lok->Contains(Format::Raw::DataTreeName) ) { 00130 if ( ConnectRawData(ifile) != 0x0) 00131 success_data = true; 00132 } 00133 //if (TODO: lok contians other trees) 00134 00135 fEntryNo = 0; 00136 return success_data && success_meta; 00137 }
Bool_t EventNavigator::ConnectOutput | ( | const char * | output_name, | |
OutputMode | mode = kOverwrite | |||
) |
Opens an output file to put trees and histograms in. By default this overites any existing file with the same name but we can change it to fail instead.
Definition at line 267 of file EventNavigator.cpp.
References fCopyRaw, fOutput, fRawData, fRawTree, and MirrorRawInputFormat().
00268 { 00269 static const char* output_mode[3] = {"NEW", "RECREATE", "UPDATE"}; 00270 TFile* ofile = TFile::Open(output_name, output_mode[mode]); 00271 if (!ofile) return false; 00272 00273 fOutput = ofile; 00274 #ifdef DEFER 00275 if (fRawTree && fRawData && fCopyRaw) MirrorRawInputFormat(); 00276 #endif 00277 00278 return true; 00279 }
Bool_t EventNavigator::ConnectOutputFile | ( | const char * | output_file_name, | |
Bool_t | append = false | |||
) |
Opens an output file. By default this overwrites the output file Appending not yet implemented
Definition at line 338 of file EventNavigator.cpp.
References fOutput.
00340 { 00341 //Not very careful about tidying up after failures or repeat attempts 00342 //here. Probably doesen't matter since the program is likely to 00343 //abort shortly afterward. Revisit if that is not true. 00344 TFile* prev_output = fOutput; 00345 00346 fOutput = TFile::Open(output_file_name, (append ? "UPDATE" : "RECREATE")); 00347 if (!fOutput || fOutput->IsZombie()) return false; 00348 00349 prev_output->cd(); 00350 return true; 00351 }
TGlobalData * EventNavigator::ConnectRawData | ( | TFile * | raw_file | ) | [protected] |
Attach a raw data tree (found in raw_file). If sucessful will load the zeroth entry return a non-null pointer
Definition at line 141 of file EventNavigator.cpp.
References AlCapFormat::Raw::DataBranchName, AlCapFormat::Raw::DataTreeName, fRawData, fRawTree, LoadEntry(), and VerifyRawData().
Referenced by ConnectInput().
00142 { 00143 raw_file->GetObject(Format::Raw::DataTreeName, fRawTree); 00144 if ( !VerifyRawData(fRawTree) ){ 00145 raw_file->Delete(Format::Raw::DataTreeName); 00146 fRawTree = 0x0; 00147 fRawData = 0x0; 00148 return 0x0; 00149 } 00150 00151 //Allocate memory locations to hold branches 00152 //TGlobalData* raw_data(0x0); 00153 fRawData = new TGlobalData; 00154 int status = fRawTree->SetBranchAddress(Format::Raw::DataBranchName, 00155 &fRawData); 00156 if (status!=0){ 00157 fRawTree = 0x0; 00158 fRawData = 0x0; 00159 return 0x0; 00160 } 00161 00162 this->LoadEntry(0); 00163 00164 return fRawData; 00165 }
TSetupData * EventNavigator::ConnectSetupData | ( | TFile * | raw_file | ) | [protected] |
Attach a setup data tree (found in raw_file). If sucessful will load the SetupDAta into memory, which can be accesed via fSetupData (depricated) or fSetupRecord (preferred)
Definition at line 217 of file EventNavigator.cpp.
References fSetupData, fSetupRecord, fSetupTree, AlCapFormat::Raw::SetupBranchName, AlCapFormat::Raw::SetupTreeName, and VerifySetupData().
Referenced by ConnectInput().
00218 { 00219 raw_file->GetObject(Format::Raw::SetupTreeName, fSetupTree); 00220 if ( !VerifySetupData(fSetupTree) ){ 00221 raw_file->Delete(Format::Raw::SetupTreeName); 00222 fSetupData = 0x0; 00223 fSetupTree = 0x0; 00224 return 0x0; 00225 } 00226 //Allocate memory locations to hold branches 00227 fSetupData = new TSetupData; 00228 int status = fSetupTree->SetBranchAddress(Format::Raw::SetupBranchName, 00229 &fSetupData); 00230 if (status!=0){ 00231 fSetupTree = 0x0; 00232 fSetupData = 0x0; 00233 return 0x0; 00234 } 00235 00236 fSetupTree->GetEntry(0); 00237 fSetupRecord = new SetupRecord(fSetupData); 00238 return fSetupData; 00239 00240 }
void EventNavigator::DumpRawTree | ( | ) | const |
Definition at line 191 of file EventNavigator.cpp.
References AlCapFormat::Raw::DataBranchName, GetRawTree(), and AlCapFormat::Raw::SetupBranchName.
Referenced by main().
00192 { 00193 TTree* raw_tree=GetRawTree(); 00194 if ( !raw_tree ){ 00195 std::cerr << "No raw data tree in file" << std::endl; 00196 return; 00197 } 00198 std::cout << "Raw Tree '" << raw_tree->GetName() << "' has " << 00199 raw_tree->GetEntriesFast()<<" entries. "<< std::endl; 00200 TBranch* raw_branch=raw_tree->GetBranch(Format::Raw::DataBranchName); 00201 if(!raw_branch) { 00202 std::cout << "Tree " << raw_tree->GetName() 00203 << " has no branch called " << Format::Raw::SetupBranchName 00204 << " which should normally contain the input data." << std::endl; 00205 } else { 00206 raw_branch->Print(); 00207 } 00208 }
Long64_t EventNavigator::EntryNo | ( | ) | const [inline] |
Returns the current event number.
Definition at line 95 of file EventNavigator.h.
References fEntryNo.
Referenced by PulseViewer::ConsiderDrawing(), FirstCompleteAPGenerator::DrawPulse(), and MakeAnalysedPulses::ProcessEntry().
00095 {return fEntryNo;}
Int_t EventNavigator::GetEntry | ( | Long64_t | entry | ) | [inline] |
Load the branches for a particular entry from the input file. Random access probably only make sense if it output is not being written. Return values are same as for NextEntry()
Definition at line 123 of file EventNavigator.h.
References LoadEntry().
Referenced by MirrorRawInputFormat(), LoopSequence::Preprocess(), and LoopSequence::Process().
00123 { 00124 return LoadEntry(entry); 00125 }
Long64_t EventNavigator::GetInputNEntries | ( | ) | const [inline] |
Returns the number of entries in the input file. TODO revisit this with multiple inputs??
Definition at line 99 of file EventNavigator.h.
References fRawTree.
Referenced by LoopSequence::Init(), and Main_event_loop().
00099 {return fRawTree->GetEntriesFast();}
Long64_t EventNavigator::GetLoopNEntries | ( | ) | const [inline] |
Returns the total number of entries selected for processing, assuming no errors
Definition at line 109 of file EventNavigator.h.
References GetStartEntry(), and GetStopEntry().
Referenced by PlotTME_activeSiRmuStops::BeforeFirstEntry().
00110 { return GetStopEntry() - GetStartEntry(); }
const LoopSequence & EventNavigator::GetLoopSequence | ( | ) | const |
Gives read access to the LoopSequence, which must first be initailised with MakeLoopSequence() in main()
Definition at line 79 of file EventNavigator.cpp.
References fLoopSequence.
Referenced by GetStartEntry(), GetStopEntry(), and MakeLoopSequence().
00080 { 00081 if (!fLoopSequence) throw std::runtime_error("No LoopSequence"); 00082 return *fLoopSequence; 00083 }
const char * EventNavigator::GetOutputFileName | ( | ) | const |
Definition at line 96 of file EventNavigator.cpp.
References fOutput.
TGlobalData* EventNavigator::GetRawData | ( | ) | const [inline] |
Definition at line 198 of file EventNavigator.h.
References fRawData.
Referenced by Main_event_loop(), LoopSequence::Postprocess(), LoopSequence::Preprocess(), and LoopSequence::Process().
00198 {return fRawData;}
TTree* EventNavigator::GetRawTree | ( | ) | const [inline] |
Definition at line 199 of file EventNavigator.h.
References fRawTree.
Referenced by DumpRawTree(), and main().
00199 {return fRawTree;}
const TSetupData* const EventNavigator::GetSetupData | ( | ) | [inline] |
Transitional function to replace gSetup. Users should use the GetSetupRecord interface.
Definition at line 62 of file EventNavigator.h.
References fSetupData.
Referenced by LoopSequence::Postprocess(), LoopSequence::Preprocess(), and LoopSequence::Process().
00062 {return fSetupData;}
static const SetupRecord& EventNavigator::GetSetupRecord | ( | ) | [inline, static] |
Gives access to the run meta-data, including all information stored in the TSetupData struct
Definition at line 66 of file EventNavigator.h.
References fSetupRecord, and Instance().
Referenced by TTemplateConvolveAnalysedPulse::Draw(), TemplateConvolveAPGenerator::TemplateConvolveAPGenerator(), TemplateFitAPGenerator::TemplateFitAPGenerator(), and TemplateMultiFitter::TemplateMultiFitter().
00066 {return *Instance().fSetupRecord;}
Long64_t EventNavigator::GetStartEntry | ( | ) | const |
Returns the entry processing starts from.
Definition at line 101 of file EventNavigator.cpp.
References GetLoopSequence(), and LoopSequence::StartEntry().
Referenced by PlotTME_activeSiRmuStops::BeforeFirstEntry(), LoadPulses::BeforeFirstEntry(), and GetLoopNEntries().
00102 { 00103 return GetLoopSequence().StartEntry(); 00104 }
Long64_t EventNavigator::GetStopEntry | ( | ) | const |
Returns the past-the-end entry processing stops at.
Definition at line 108 of file EventNavigator.cpp.
References GetLoopSequence(), and LoopSequence::StopEntry().
Referenced by PlotTME_activeSiRmuStops::BeforeFirstEntry(), and GetLoopNEntries().
00109 { 00110 return GetLoopSequence().StopEntry(); 00111 }
EventNavigator & EventNavigator::InitInstance | ( | const ARGUMENTS & | command_line | ) | [static] |
Definition at line 36 of file EventNavigator.cpp.
References EventNavigator(), and fInstance.
00037 { 00038 if (fInstance) { 00039 std::cout << "WARNING: " 00040 << "Instance has already been created and will not be altered" 00041 << std::endl; 00042 } 00043 else { 00044 fInstance = new EventNavigator(command_line); 00045 //fInstance->fCopyRaw = true; 00046 } 00047 return *fInstance; 00048 }
EventNavigator & EventNavigator::Instance | ( | ) | [static] |
The user accessor. Not sure yet if it can be used without providing initalisation info.
Definition at line 50 of file EventNavigator.cpp.
References EventNavigator(), and fInstance.
Referenced by TemplateCreator::BeforeFirstEntry(), PlotTME_activeSiRmuStops::BeforeFirstEntry(), LoadPulses::BeforeFirstEntry(), PulseViewer::ConsiderDrawing(), FirstCompleteAPGenerator::DrawPulse(), Finish(), TTemplateFitAnalysedPulse::GetHisto(), GetSetupRecord(), LoopSequence::Init(), main(), Main_event_loop(), LoopSequence::Postprocess(), PrepareSingletonObjects(), LoopSequence::Preprocess(), LoopSequence::Process(), MakeAnalysedPulses::ProcessEntry(), ExportPulse::ProcessEntry(), TemplateConvolveAPGenerator::TemplateConvolveAPGenerator(), TemplateFitAPGenerator::TemplateFitAPGenerator(), and TemplateMultiFitter::TemplateMultiFitter().
00051 { 00052 if (!fInstance){ 00053 fInstance = new EventNavigator(); 00054 } 00055 return *fInstance; 00056 }
Int_t EventNavigator::LoadEntry | ( | Long64_t | entry | ) | [protected] |
Implementation for loading an entry.
Definition at line 354 of file EventNavigator.cpp.
References TGlobalData::Clear(), fEntryNo, fEventTree, fRawData, and fRawTree.
Referenced by ConnectRawData(), GetEntry(), MirrorRawInputFormat(), and NextEntry().
00355 { 00356 Int_t nBytes = 0; 00357 if (fRawTree){ 00358 fRawData->Clear(); 00359 nBytes = fRawTree->GetEntry(entry); 00360 } 00361 else if (fEventTree) { 00362 nBytes = fEventTree->GetEntry(entry); 00363 } 00364 else return 0; 00365 if (nBytes < 0) throw io_error(); 00366 fEntryNo = entry; 00367 return nBytes; 00368 }
const LoopSequence & EventNavigator::MakeLoopSequence | ( | const ARGUMENTS & | args | ) |
Initialises the LoopSequence this must be called once beforit is used. Calling it a second time is undefined behavior (currently forces an exception)
Definition at line 86 of file EventNavigator.cpp.
References fLoopSequence, and GetLoopSequence().
Referenced by Main_event_loop().
00087 { 00088 //Not sure if allowing this to be replaced is safe. Lets err on the 00089 //side of caution and make it a runtime error for now. 00090 if (fLoopSequence) throw std::runtime_error("Redfined LoopSequence"); 00091 fLoopSequence = new LoopSequence(args); 00092 return GetLoopSequence(); 00093 }
AnalysedPulseBankIter EventNavigator::MatchAnalysedBanks | ( | const ChannelID & | cid, | |
GeneratorStr | gid = "" | |||
) | const |
PulseIslandBankIter EventNavigator::MatchAnalysedBanks | ( | const SourceID & | sid | ) | const |
AnalysedPulseBankIter EventNavigator::MatchDetectorBanks | ( | const ChannelID & | cid, | |
GeneratorStr | gid = "" | |||
) | const |
PulseIslandBankIter EventNavigator::MatchDetectorBanks | ( | const SourceID & | sid | ) | const |
PulseIslandBankIter EventNavigator::MatchIslandBanks | ( | const ChannelID & | cid, | |
GeneratorStr | gid = "" | |||
) | const |
PulseIslandBankIter EventNavigator::MatchIslandBanks | ( | const SourceID & | sid | ) | const |
Iterable getters for a list of banks.
Bool_t EventNavigator::MirrorRawInputFormat | ( | ) | [protected] |
Copy the input raw data tree (TGlobalData) to the output file.
Definition at line 283 of file EventNavigator.cpp.
References fEntryNo, fOutputTreeTPI, TGlobalData::fPulseIslandToChannelMap, fRawData, GetEntry(), and LoadEntry().
Referenced by ConnectOutput().
00284 { 00285 int prev_entry_no = fEntryNo; 00286 //loop untill we find an entry in which the object is filled (should 00287 //be the first one) 00288 int nBytes = 0; 00289 int entry = fEntryNo; 00290 while (( nBytes = LoadEntry(++entry) )){ 00291 if (fRawData->fPulseIslandToChannelMap.size() > 0) break; 00292 } 00293 if (nBytes <= 0) return false; 00294 00295 fOutputTreeTPI = new TTree("TPI","TPulseIslands"); 00296 fOutputTreeTPI->SetAutoSave(3000000); 00297 00298 typedef StringPulseIslandMap::const_iterator raw_map_iter; 00299 StringPulseIslandMap& rawBanks = fRawData->fPulseIslandToChannelMap; 00300 //fBufferTPI = new PulseIslandList*[rawBanks.size()]; 00301 00302 TObjArray* obj_arr = new TObjArray(rawBanks.size()); 00303 //obj_arr = new TObjArray(rawBanks.size()); 00304 //raw_map_iter b_it = fRawData->fPulseIslandToChannelMap.begin(); 00305 Int_t element =0; 00306 for (raw_map_iter b_it = rawBanks.begin(); b_it != rawBanks.end(); ++b_it) { 00307 std::string bank_name = b_it->first; 00308 //fBufferTPI[element] = new PulseIslandList; 00309 //fRecordTPI.insert(make_pair(bank_name, fBufferTPI[element])); 00310 //fRecordTPI[bank_Name] = fBufferTPI[element] 00311 //fOutputTreeTPI->Branch(bank_name.c_str(), &fBufferTPI[element]); 00312 ++element; 00313 00314 //TNamed* foo = new TNamed((bank_name + "_name").c_str(), (bank_name + "_title").c_str()); 00315 BankBranch<PulseIslandList>* foo = 00316 new BankBranch<PulseIslandList>(IDs::generator(bank_name)); 00317 obj_arr->Add(foo); 00318 } 00319 fOutputTreeTPI->Branch(obj_arr); 00320 00321 fOutputTreeTPI->Print(); 00322 00323 fOutputTreeTPI->Write(); 00324 GetEntry(prev_entry_no); 00325 return true; 00326 }
Int_t EventNavigator::NextEntry | ( | ) | [inline] |
Load the next entry in the input tree. Returns the number of bytes if sucessful, 0 if reached the end or there is no input tree. Throws an exception for an underlying I/O error
Definition at line 116 of file EventNavigator.h.
References fEntryNo, and LoadEntry().
EventNavigator& EventNavigator::operator= | ( | const EventNavigator & | rhs | ) | [inline, private] |
Definition at line 232 of file EventNavigator.h.
void EventNavigator::SetSavePulseIslands | ( | bool | save = 1 |
) | [inline] |
Save (or not) TPulseIslands in output file. By default they are not saved, call this method to enable saving.
Definition at line 132 of file EventNavigator.h.
References fCopyRaw.
00132 {fCopyRaw =save;};
Bool_t EventNavigator::VerifyRawData | ( | TTree * | raw_tree | ) | [protected] |
Verifies that the raw data tree found conforms to the expected format.
Definition at line 169 of file EventNavigator.cpp.
References AlCapFormat::Raw::DataBranchName, and AlCapFormat::Raw::SetupBranchName.
Referenced by ConnectRawData().
00170 { 00171 if ( !raw_tree ){ 00172 std::cerr << "No raw data tree in file" << std::endl; 00173 return false; 00174 } 00175 if ( raw_tree->GetEntriesFast() == 0 ){ 00176 std::cerr << "Tree " << raw_tree->GetName() << " is empty!" 00177 << std::endl; 00178 return false; 00179 } 00180 TObjArray* lob = raw_tree->GetListOfBranches(); 00181 if ( !lob->Contains(Format::Raw::DataBranchName ) ){ 00182 std::cerr << "Tree " << raw_tree->GetName() 00183 << " has no branch " << Format::Raw::SetupBranchName 00184 << "!" << std::endl; 00185 return false; 00186 } 00187 return true; 00188 }
Bool_t EventNavigator::VerifySetupData | ( | TTree * | setup_tree | ) | [protected] |
Verifies that the setup data tree found conforms to the expected format.
Definition at line 244 of file EventNavigator.cpp.
References AlCapFormat::Raw::SetupBranchName.
Referenced by ConnectSetupData().
00245 { 00246 if ( !setup_tree ){ 00247 std::cerr << "No 'Setup' tree in file" << std::endl; 00248 return false; 00249 } 00250 if ( setup_tree->GetEntriesFast() == 0 ){ 00251 std::cerr << "Tree " << setup_tree->GetName() << " is empty!" 00252 << std::endl; 00253 return false; 00254 } 00255 TObjArray* lob = setup_tree->GetListOfBranches(); 00256 if ( !lob->Contains(Format::Raw::SetupBranchName ) ){ 00257 std::cerr << "Tree " << setup_tree->GetName() 00258 << " has no branch " << Format::Raw::SetupBranchName 00259 << "!" << std::endl; 00260 return false; 00261 } 00262 return true; 00263 }
Int_t EventNavigator::WriteCurrentEntry | ( | ) |
Definition at line 371 of file EventNavigator.cpp.
References fOutputTreeTPI.
00372 { 00373 fOutputTreeTPI->Fill(); 00374 return 0; 00375 }
Bool_t EventNavigator::fCopyRaw [private] |
Definition at line 236 of file EventNavigator.h.
Referenced by ConnectOutput(), and SetSavePulseIslands().
Int_t EventNavigator::fEntryNo [private] |
The current entry number.
Definition at line 245 of file EventNavigator.h.
Referenced by ConnectInput(), EntryNo(), LoadEntry(), MirrorRawInputFormat(), and NextEntry().
TTree* EventNavigator::fEventTree [private] |
Definition at line 254 of file EventNavigator.h.
Referenced by LoadEntry().
EventNavigator * EventNavigator::fInstance = 0x0 [static, private] |
Definition at line 234 of file EventNavigator.h.
Referenced by InitInstance(), and Instance().
LoopSequence* EventNavigator::fLoopSequence [private] |
Definition at line 264 of file EventNavigator.h.
Referenced by GetLoopSequence(), and MakeLoopSequence().
TFile* EventNavigator::fOutput [private] |
Output ROOT file (may be same as input file).
Definition at line 242 of file EventNavigator.h.
Referenced by Close(), ConnectOutput(), ConnectOutputFile(), EventNavigator(), and GetOutputFileName().
TTree* EventNavigator::fOutputTreeTPI [private] |
Definition at line 256 of file EventNavigator.h.
Referenced by MirrorRawInputFormat(), and WriteCurrentEntry().
TGlobalData* EventNavigator::fRawData [private] |
Definition at line 258 of file EventNavigator.h.
Referenced by ConnectOutput(), ConnectRawData(), GetRawData(), LoadEntry(), and MirrorRawInputFormat().
TFile* EventNavigator::fRawInput [private] |
Input ROOT file, raw format.
Definition at line 239 of file EventNavigator.h.
Referenced by Close(), and EventNavigator().
TTree* EventNavigator::fRawTree [private] |
Input Raw Data (Event) Tree.
Definition at line 248 of file EventNavigator.h.
Referenced by ConnectOutput(), ConnectRawData(), GetInputNEntries(), GetRawTree(), and LoadEntry().
TSetupData* EventNavigator::fSetupData [private] |
Definition at line 260 of file EventNavigator.h.
Referenced by ConnectSetupData(), and GetSetupData().
SetupRecord* EventNavigator::fSetupRecord [private] |
Definition at line 262 of file EventNavigator.h.
Referenced by ConnectSetupData(), and GetSetupRecord().
TTree* EventNavigator::fSetupTree [private] |
Input Setup Tree.
Definition at line 251 of file EventNavigator.h.
Referenced by ConnectInput(), and ConnectSetupData().