#include <FillData.h>
Inheritance diagram for Anp::FillData:

Public Member Functions | |
| FillData () | |
| virtual | ~FillData () |
| bool | Run (Record &record) |
| void | Config (const Registry ®) |
| void | Set (TDirectory *dir) |
| void | End (const DataBlock &) |
Private Types | |
| typedef std::map< std::string, Tree > | TreeMap |
Private Member Functions | |
| void | Fill (DataIter ibeg, DataIter iend, const std::string &key) |
Private Attributes | |
| TDirectory * | fDir |
| TFile * | fFile |
| std::string | fDirName |
| TreeMap | fTree |
|
|
Definition at line 46 of file FillData.h. |
|
|
Definition at line 21 of file FillData.cxx.
|
|
|
Definition at line 29 of file FillData.cxx. 00030 {
00031 }
|
|
|
Reimplemented from Anp::AlgSnarl. Definition at line 101 of file FillData.cxx. References fDir, fDirName, fFile, Registry::Get(), Anp::GetDir(), Registry::KeyExists(), and reg. 00102 {
00103 //
00104 // create an output file if a path is given
00105 //
00106
00107 const char *value_char = 0;
00108 if(reg.Get("FillDataDirName", value_char) && value_char)
00109 {
00110 fDirName = value_char;
00111 }
00112
00113 const char *path_char = 0;
00114 if(reg.Get("FillDataPath", path_char) && path_char)
00115 {
00116 fFile = new TFile(path_char, "RECREATE");
00117 if(!fFile || !fFile -> IsOpen())
00118 {
00119 cerr << "FillData::Config - failed to create ROOT file:\n " << path_char << endl;
00120 fFile = 0;
00121 }
00122 else
00123 {
00124 cout << "FillData::Config - recreated ROOT file:\n " << path_char << endl;
00125 }
00126
00127 fDir = Anp::GetDir(fDirName, fFile);
00128 }
00129
00130 if(reg.KeyExists("PrintConfig"))
00131 {
00132 cout << "FillData::Config" << endl
00133 << " DirName = " << fDirName << endl;
00134
00135 if(path_char)
00136 {
00137 cout << " Path = " << path_char << endl;
00138 }
00139 }
00140 }
|
|
|
Reimplemented from Anp::AlgSnarl. Definition at line 143 of file FillData.cxx. References fFile.
|
|
||||||||||||||||
|
Definition at line 54 of file FillData.cxx. References Anp::FillData::Tree::branch_ptr, Anp::Data, Anp::FillData::Tree::data, Anp::DataIter, fDir, fTree, Anp::Corr::Key, and Anp::FillData::Tree::tree_ptr. Referenced by Run(). 00055 {
00056 //
00057 // Fill (create first time) tree and branches
00058 //
00059 if(!fDir || ibeg == iend || key.empty())
00060 {
00061 return;
00062 }
00063
00064 for(DataIter dit = ibeg; dit != iend; ++dit)
00065 {
00066 stringstream tname;
00067 tname << key << "_" << setw(5) << setfill('0') << dit -> Key();
00068
00069 //
00070 // Find (create first time) tree
00071 //
00072 TreeMap::iterator itree = fTree.find(tname.str());
00073 if(itree == fTree.end())
00074 {
00075 itree = fTree.insert(TreeMap::value_type(tname.str(), FillData::Tree())).first;
00076
00077 Tree &tree = itree -> second;
00078 tree.tree_ptr = new TTree(tname.str().c_str(), tname.str().c_str());
00079 tree.tree_ptr -> SetDirectory(fDir);
00080 tree.branch_ptr = tree.tree_ptr -> Branch("data", &tree.data, "data/F");
00081 }
00082
00083 (itree -> second).data = dit -> Data();
00084 (itree -> second).tree_ptr -> Fill();
00085 }
00086 }
|
|
|
Implements Anp::AlgSnarl. Definition at line 34 of file FillData.cxx. References Anp::Record::EventBeg(), Anp::Record::EventEnd(), Anp::EventIter, Fill(), Anp::Record::TrackBeg(), Anp::Record::TrackEnd(), and Anp::TrackIter. 00035 {
00036 if(!fDir)
00037 {
00038 return true;
00039 }
00040
00041 for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00042 {
00043 Fill(ievent -> DataBeg(), ievent -> DataEnd(), "event");
00044 }
00045 for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00046 {
00047 Fill(itrack -> DataBeg(), itrack -> DataEnd(), "track");
00048 }
00049
00050 return true;
00051 }
|
|
|
Reimplemented from Anp::AlgSnarl. Definition at line 89 of file FillData.cxx. References fDir, fDirName, and Anp::GetDir(). 00090 {
00091 //
00092 // If not ROOT file exist, then use outside TDirectory pointer if it is valid
00093 //
00094 if(!fDir)
00095 {
00096 fDir = Anp::GetDir(fDirName, dir);
00097 }
00098 }
|
|
|
Definition at line 54 of file FillData.h. |
|
|
Definition at line 57 of file FillData.h. |
|
|
Definition at line 55 of file FillData.h. |
|
|
Definition at line 59 of file FillData.h. Referenced by Fill(). |
1.3.9.1