/[PAMELA software]/yoda/event/PamelaRun.cpp
ViewVC logotype

Annotation of /yoda/event/PamelaRun.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2.2 - (hide annotations) (download)
Sun Oct 17 12:28:15 2004 UTC (20 years, 1 month ago) by kusanagi
Branch: MAIN
Changes since 2.1: +3 -2 lines
*** empty log message ***

1 kusanagi 1.1 /** @file
2 kusanagi 1.2 * $Author: kusanagi $
3 kusanagi 2.2 * $Date: 2004/09/24 11:57:32 $
4     * $Revision: 2.1 $
5 kusanagi 1.1 *
6     * Implementation of the PamelaRun class.
7     */
8     #include <iostream>
9     #include <iomanip>
10     #include <sstream>
11     #include <list>
12     #include <exception>
13     #include <string>
14 kusanagi 1.6 #include <log4cxx/logger.h>
15 kusanagi 1.1
16     #include <TFile.h> //Substituted by Maurizio 05 Feb 2004
17     #include <TTree.h> //Substituted by Maurizio 05 Feb 2004
18     #include <TChain.h> //Substituted by Maurizio 05 Feb 2004
19     #include <TKey.h> //Substituted by Maurizio 05 Feb 2004
20     #include <TList.h> //Substituted by Maurizio 05 Feb 2004
21    
22    
23     #include "PamelaRun.h"
24     #include "EventHeader.h"
25     #include "Algorithm.h"
26     #include "AlgorithmInfo.h"
27     #include "Exception.h"
28 kusanagi 1.6 #include <sys/stat.h>
29    
30 kusanagi 1.1 extern "C" {
31 kusanagi 1.6 #include <dirent.h>
32 kusanagi 1.1 #include "DirectoryStructure.h"
33     }
34    
35     using namespace pamela;
36    
37 kusanagi 1.6 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.PamelaRun"));
38     static std::stringstream oss;
39 kusanagi 1.1
40     /**
41     * Get the run name according to a certain run number.
42     * @param run Run number.
43     * @return a string with the run name.
44     */
45     std::string PamelaRun::GetRunName(int run) {
46     std::ostringstream t_Stream;
47     t_Stream << std::setw( 4 ) << std::setfill( '0' ) << run;
48     return "Run" + t_Stream.str();
49     }
50    
51     /**
52     * Check if the run number is already assigned
53     * @param int run - Number of the run to check
54     * @return int
55     */
56     /*int PamelaRun::RunExists(int run) throw (std::exception){
57     int res;
58     DIR *dirp;
59     std::string pathDir((char*)getenv("YODA_DATA"));
60     pathDir = pathDir + "/";
61     pathDir = pathDir + GetRunName(run);
62     // Open the directory
63     if ((dirp = opendir(pathDir.c_str())) == NULL) {
64     res = 0;
65     } else {
66     closedir(dirp);
67     res = 1;
68     }
69     return res;
70     }*/
71    
72    
73     /**
74     * Check if the run number is already assigned
75     * @param int run - Number of the run to check
76     * @return int
77     */
78     std::string PamelaRun::RunExists(std::string input) throw (std::exception){
79     int res;
80     DIR *dirp;
81     std::string fileName;
82     std::string pathDir((char*)getenv("YODA_DATA"));
83     std::string tempName;
84     std::string::size_type pos;
85     std::ostringstream t_Stream;
86    
87     pos = input.find_last_of("/");
88     //if ((pos == std::string::npos) && !input.empty()) ;//throw Exception("Directories not allowed....");
89     fileName = input.substr(pos+1);
90     pos = fileName.find_last_of(".");
91     fileName = fileName.substr(0,pos);
92     pathDir = pathDir + "/";
93     tempName = pathDir + fileName;
94    
95     int i = 0;
96     while (res){
97     if ((dirp = opendir(tempName.c_str())) == NULL) {
98     res = 0;
99     } else {
100     closedir(dirp);
101     t_Stream.str("");
102     t_Stream << std::setw( 2 ) << std::setfill( '0' ) << ++i;
103     tempName = pathDir + fileName + t_Stream.str() ;
104     res = 1;
105     }
106     }
107     return (fileName + t_Stream.str());
108     }
109    
110     /**
111     * Create a new Pamela run.
112     * @param run Run number
113     * @param path Base path name to the data
114     */
115     PamelaRun::PamelaRun(std::string fileName, std::string path):
116     Path(path),
117     RunNumber(1){ //veirificare se รจ possibilie eliminare questa variabile
118 kusanagi 1.6 logger->debug(_T("Constructor"));
119 kusanagi 1.1 Run = RunExists(fileName);
120     info = RunInfo(this);
121     }
122    
123     /**
124     * Get the directory name that contains the files of a certain event
125     * type for this run.
126     * @param type the packet type.
127     * @return the complete path for this event type.
128     */
129     std::string PamelaRun::GetDirName(PacketType const * type) const {
130     std::string EventType = type->GetName();
131     return Path + "/" + Run + "/" + EventType;
132     }
133    
134     /**
135     * Get the file name for a certain event type.
136     * @param type subpacket type.
137     * @param name subpacket name.
138     * @return the complete path and file name.
139     */
140     std::string PamelaRun::GetFileName(const SubPacket* type, std::string name) const {
141     if (type->IsDetectorSpecific()) {
142     return GetDirName(type->GetPacketType()) + "/"
143     + type->GetSubDetector()->GetName() + "/"
144     + Run + "." + type->GetPacketType()->GetName() + "."
145     + type->GetSubDetector()->GetName() + "."
146     + name + ".root";
147     } else {
148     return GetDirName(type->GetPacketType()) + "/"
149     + Run + "." + type->GetPacketType()->GetName() + "."
150     + name + ".root";
151     }
152     }
153    
154     /**
155     * Get the file name for a certain event type.
156     * @param type subpacket type.
157     * @return the complete path and file name.
158     */
159     std::string PamelaRun::GetFileName(const SubPacket* type) const {
160     return GetFileName(type, type->GetSubPacketName());
161     }
162    
163     /**
164     * Get the branch name that corresponds to a certain
165     * subpacket. Usually, this is the name of the subpacket.
166     * @param type subpacket type.
167     * @return the corresponding branch name.
168     */
169     static std::string GetDefaultBranchName(const SubPacket* type) {
170     return type->GetSubPacketName();
171     }
172    
173     /**
174     * Get the tree name for a certain subpacket. This is the name of the
175     * subdetector for detector specific subpackets, and the packet name
176     * ("Physics" etc.) for common packets.
177     * @param type the packet type.
178     * @return the corresponding tree name.
179     */
180     static std::string GetTreeName(const SubPacket* type) {
181     if (type->IsDetectorSpecific()) {
182     return type->GetSubDetector()->GetName();
183     } else {
184     return type->GetPacketType()->GetName();
185     }
186     }
187    
188     /**
189     * Get a list of all root files from a certain path.
190     * @param path Path name to start the search.
191     * @return A list of all file names.
192     */
193     static std::list<std::string> GetRootFiles(std::string path) throw (std::exception) {
194     std::list<std::string> files;
195     DIR *dir = opendir(path.c_str());
196     if (dir == 0) {
197 kusanagi 1.6 oss.flush();
198     oss << "Could not open " << path;
199     logger->debug(oss.str().c_str());
200 kusanagi 1.1 throw Exception("Could not open " + path);
201     }
202    
203     for (struct dirent *d = readdir(dir); d != NULL; d = readdir(dir)) {
204     if ((strcmp(".",d->d_name) == 0) || (strcmp("..",d->d_name) == 0))
205     continue;
206     std::string filename = path + "/" + d->d_name;
207     struct stat buf;
208     stat(filename.c_str(), &buf);
209     if S_ISDIR(buf.st_mode) {
210     std::list<std::string>toAdd = GetRootFiles(filename);
211     files.insert(files.end(), toAdd.begin(), toAdd.end());
212     } else if ((filename.substr(filename.size()-5, filename.size())
213     == ".root") // correct suffix
214     && (!isdigit(filename[filename.size()-6]))) { // base file
215     std::string nextfilename = filename;
216     nextfilename.insert(filename.size()-5, "_1");
217     if (stat(nextfilename.c_str(), &buf) == 0) {
218     filename.insert(filename.size()-5, "*");
219     }
220 kusanagi 1.6 oss.flush();
221     oss << "Using " << filename;
222     logger->debug(oss.str().c_str());
223 kusanagi 1.1 files.push_back(filename);
224     }
225     }
226     return files;
227     }
228    
229     /**
230     * Helper function to open the ROOT TTree of the header within the run
231     * framework.
232     * @param type The packet type.
233     * @return the ROOT TTree.
234     */
235     TChain* PamelaRun::ReadHeaderTree(const PacketType *type)
236     throw (std::exception) {
237     EventHeader header(type);
238     std::string FileName = GetFileName(&header);
239     std::string TreeName = GetTreeName(&header);
240     TChain *tree = new TChain(TreeName.c_str());
241     tree->Add(FileName.c_str());
242     return tree;
243     }
244    
245     /**
246     * All add trees of a file as friend to a given tree. The tree name of
247     * each tree found in the file is used as the name of the friend alias.
248     * @param tree The base tree to add all other as friends.
249     * @param FileName The name of the file with other trees.
250     */
251     static void AddAllAsFriend(TChain* tree, std::string FileName) {
252     std::string BaseFileName = FileName;
253     bool HaveChain = false;
254     if (BaseFileName[BaseFileName.size()-6] == '*') {
255     BaseFileName.erase(BaseFileName.size()-6, 1);
256     HaveChain = true;
257     }
258     TFile* File = new TFile(BaseFileName.c_str(), "read");
259     if (!File->IsOpen()) {
260 kusanagi 1.6 oss.flush();
261     oss << "Could not open file " << BaseFileName << " for reading.";
262     logger->warn(oss.str().c_str());
263 kusanagi 1.1 return;
264     }
265     TList* list = File->GetListOfKeys();
266     if (HaveChain) {
267     for (TIter i(list); TKey* k = (TKey*)i();) {
268     if (std::string(TTree::Class()->GetName()) == k->GetClassName()) {
269     std::string TreeName = k->GetName();
270     TChain* FriendChain = new TChain(TreeName.c_str());
271     FriendChain->Add(FileName.c_str());
272     tree->AddFriend(FriendChain, TreeName.c_str());
273 kusanagi 1.6 oss.flush();
274     oss << "Adding chain " << TreeName << " with "
275     << FriendChain->GetEntries() << " entries as Friend";
276     logger->warn(oss.str().c_str());
277 kusanagi 1.1 }
278     }
279     File->Close();
280     } else {
281     for (TIter i(list); TKey* k = (TKey*)i();) {
282     if (std::string(TTree::Class()->GetName()) == k->GetClassName()) {
283     std::string TreeName = k->GetName();
284     TTree* FriendTree = (TTree *)File->Get(TreeName.c_str());
285     tree->AddFriend(FriendTree, TreeName.c_str());
286 kusanagi 1.6 oss.flush();
287     oss << "Adding tree " << TreeName << " with "
288     << FriendTree->GetEntries() << " entries as Friend";
289     logger->debug(oss.str().c_str());
290 kusanagi 1.1 }
291     }
292     }
293     }
294    
295     /**
296     * Read all Root TTrees which belong to a certain event type and mount them
297     * together as "friends".
298     * @param type The packet type.
299     * @return The root trees with the friends.
300     */
301     TTree* PamelaRun::ReadTTree(const PacketType* type) {
302 kusanagi 1.6 oss.flush();
303     oss << "Getting root files of " << type->GetName();
304     logger->debug(oss.str().c_str());
305 kusanagi 1.1 RootTreeMap::iterator t = TTreeMap.find(type);
306     if (t != TTreeMap.end()) {
307     return t->second;
308     } else {
309 kusanagi 1.6 oss.flush();
310     oss << "Reading root files of " << type->GetName();
311     logger->debug(oss.str().c_str());
312 kusanagi 1.1 EventHeader header(type);
313     std::string HeaderFileName = GetFileName(&header);
314     TChain* HeaderTree = ReadHeaderTree(type);
315     std::list<std::string> rootfiles = GetRootFiles(GetDirName(type));
316     for (std::list<std::string>::iterator i = rootfiles.begin();
317     i != rootfiles.end(); i++){
318     if (*i == HeaderFileName)
319     continue; // dont add the header tree itself.
320     AddAllAsFriend(HeaderTree, *i);
321     }
322     TTreeMap.insert(RootTreeMap::value_type(type, HeaderTree));
323     return HeaderTree;
324     }
325     }
326    
327     /**
328     * Register a certain SubPacket, identified by its name, to be read
329     * from the repository. This function is made for interactive work.
330     * @param subpacket A pointer to the pointer of the packet.
331     * @param name The name of the subpacket
332     */
333     void PamelaRun::ReadSubPacket(void* subpacket, std::string name) {
334     SubPacket *packet = *(SubPacket**)subpacket;
335    
336     // look into the map of subpackets if we already read it.
337     std::string FullName = packet->GetPacketType()->GetName() + "." + name;
338     SubPacketMap::iterator i = SubPacketAddresses.find(FullName);
339     if (i != SubPacketAddresses.end()) { // it is in the map
340     *(SubPacket**)subpacket = i->second;
341     return;
342     } else { // not found in the map of used subpackets
343     TTree* tree = ReadTTree(packet->GetPacketType());
344     TBranch* branch = tree->GetBranch(name.c_str());
345     if (branch != 0) {
346     branch->SetAddress(subpacket);
347     SubPacketAddresses.insert(SubPacketMap::value_type(FullName, packet));
348     } else {
349 kusanagi 1.6 oss.flush();
350     oss << "Could not find data for " << packet->GetPacketType()->GetName() << "/" << name ;
351     logger->error(oss.str().c_str());
352 kusanagi 1.1 }
353     }
354     }
355    
356     /**
357     * Register a certain SubPacket, identified by its default name, to be
358     * read from the repository. This function is made for
359     * interactive work.
360     * @param subpacket A pointer to the pointer of the packet.
361     */
362     void PamelaRun::ReadSubPacket(void* subpacket) {
363     SubPacket *packet = *(SubPacket**)subpacket;
364     ReadSubPacket(subpacket, GetDefaultBranchName(packet));
365     }
366    
367     /**
368     * Register a certain SubPacket with its default name, to be read from
369     * the repository. This functions is for use from the algorithm.
370     * @param algo Algorithm that needs this SubPacket.
371     * @param subpacket A pointer to the pointer of the packet.
372     */
373     void PamelaRun::ReadSubPacket(const Algorithm* algo, void* subpacket) {
374     //:TODO: store the request of the algorithm here.
375     ReadSubPacket(subpacket);
376     }
377    
378     /**
379     * Register a certain SubPacket, with a custom name, to
380     * be read from the repository. This functions is for use from
381     * the algorithm.
382     * @param algo Algorithm that needs this SubPacket.
383     * @param subpacket A pointer to the pointer of the packet.
384     * @param name The name of the subpacket
385     */
386     void PamelaRun::ReadSubPacket(const Algorithm* algo, void* subpacket,
387     std::string name) {
388     //:TODO: store the request of the algorithm here.
389     ReadSubPacket(subpacket, name);
390     }
391    
392     /**
393     * Helper function to create a ROOT TTree within the run framework.
394     * @param algo Algorithm that creates this SubPacket.
395     * @param packet subpacket type
396     * @param name the name of the subpacket
397     * @return the ROOT TTree.
398     */
399     TTree* PamelaRun::CreateTTree(Algorithm* algo, const SubPacket* packet,
400     std::string name)
401     throw (std::exception) {
402     std::string FileName = GetFileName(packet, name);
403     std::string EventType = packet->GetPacketType()->GetName();
404     CreateDirectoryStructure(FileName.c_str());
405     TFile* File = new TFile(FileName.c_str(), "create");
406 kusanagi 2.2 File->SetCompressionLevel(5);
407 kusanagi 1.1 if (!File->IsOpen()) {
408 kusanagi 1.6 oss.flush();
409     oss << "Could not open file " << FileName ;
410     logger->error(oss.str().c_str());
411 kusanagi 1.1 throw Exception("Could not open file " + FileName);
412     }
413     std::string TreeName = GetTreeName(packet);
414     TTree *tree = new TTree(TreeName.c_str(), algo->GetAlgorithmName().c_str());
415     WritingRootTrees[packet->GetPacketType()].push_back(tree);
416     tree->GetCurrentFile()->cd();
417     AlgorithmInfo ai(algo);
418     ai.Write();
419     info.Write();
420 kusanagi 1.6 oss.flush();
421     oss << "Creating file " << FileName << " with Tree " << TreeName;
422     logger->info(oss.str().c_str());
423 kusanagi 1.1 return tree;
424     }
425    
426    
427     /**
428     * Register a certain SubPacket to be written to the repository. A
429     * usual call sequence for this function ist
430     * MyEvent *event = new MyEvent();
431     * run->WriteSubPacket(this, &event, event->Class()
432     * @param algo Algorithm that produces this SubPacket.
433     * @param subpacket A pointer to the pointer of the subpacket.
434     * @param c The class the subpacket belongs to.
435     * @param name The name of the packet.
436     */
437     void PamelaRun::WriteSubPacket(Algorithm *algo, void* subpacket,
438     const TClass *c, std::string name) {
439     SubPacket *packet = *(SubPacket **)subpacket;
440 kusanagi 1.6 oss.flush();
441     oss << "Register: " << name << " for " << algo->GetAlgorithmName() << " (writing)";
442     logger->debug(oss.str().c_str());
443 kusanagi 1.1 TTree* HeaderTree = ReadTTree(packet->GetPacketType());
444     TTree* tree = CreateTTree(algo, packet, name);
445 kusanagi 1.6 oss.flush();
446     oss << "Branch: " << name << " Class: " << c->GetName();
447     logger->debug(oss.str().c_str());
448 kusanagi 1.1 tree->Branch(name.c_str(), c->GetName(), subpacket);
449     HeaderTree->AddFriend(tree, tree->GetName());
450    
451     std::string FullName = packet->GetPacketType()->GetName() + "." + name;
452     SubPacketAddresses.insert(SubPacketMap::value_type(FullName, packet));
453     }
454    
455     /**
456     * Register a certain SubPacket with its default name to be written to
457     * the repository. A usual call sequence for this function ist
458     * MyEvent *event = new MyEvent();
459     * run->WriteSubPacket(this, &event, event->Class()
460     * @param algo Algorithm that produces this SubPacket.
461     * @param subpacket A pointer to the pointer of the subpacket.
462     * @param c The class the subpacket belongs to.
463     */
464     void PamelaRun::WriteSubPacket(Algorithm *algo, void* subpacket,
465     const TClass *c) {
466     SubPacket *packet = *(SubPacket **)subpacket;
467     WriteSubPacket(algo, subpacket, c, GetDefaultBranchName(packet));
468     }
469    
470     /**
471     * Write the header packet of a specified packet type. This is mainly used
472     * for the raw reader to create the base for the event structure.
473     * @param algo Algorithm that produces this SubPacket.
474     * @param subpacket A pointer to the pointer of the packet.
475     * @param type The packet type.
476     */
477     void PamelaRun::WriteHeader(Algorithm* algo, EventHeader** subpacket,
478     const PacketType* type) {
479 kusanagi 1.6 oss.flush();
480     oss << "Creating header tree for " << type->GetName();
481     logger->debug(oss.str().c_str());
482 kusanagi 1.1 EventHeader header(type);
483     std::string FileName = GetFileName(&header, GetDefaultBranchName(&header));
484     std::string EventType = (&header)->GetPacketType()->GetName();
485     CreateDirectoryStructure(FileName.c_str());
486     TFile* File = new TFile(FileName.c_str(), "create");
487     if (!File->IsOpen()) {
488 kusanagi 1.6 oss.flush();
489     oss << "Could not open file " << FileName ;
490     logger->error(oss.str().c_str());
491 kusanagi 1.1 throw Exception("Could not open file " + FileName);
492     }
493     //std::string TreeName = GetTreeName(packet);
494     TTree *tree = new TTree("Pscu", algo->GetAlgorithmName().c_str());
495     WritingRootTrees[(&header)->GetPacketType()].push_back(tree);
496     tree->GetCurrentFile()->cd();
497     AlgorithmInfo ai(algo);
498     ai.Write();
499     info.Write();
500 kusanagi 1.6 oss.flush();
501     oss << "Creating file " << FileName << " with Tree Pscu";
502     logger->info(oss.str().c_str());
503 kusanagi 1.1 tree->Branch(GetDefaultBranchName(&header).c_str(),
504     (*subpacket)->Class()->GetName(), subpacket);
505     TTreeMap.insert(RootTreeMap::value_type(type, tree));
506     }
507    
508    
509     /**
510     * Write the header packet to all ROOT files in the tree. Intended to
511     * be used for raw data readers that create the initial event structure.
512     * @param algo Algorithm that produces this SubPacket.
513     * @param subpacket A pointer to the pointer of the header packet.
514     */
515     void PamelaRun::WriteHeaders(Algorithm* algo, EventHeader** subpacket) {
516 kusanagi 1.4
517     WriteHeader(algo, subpacket, PacketType::PhysEndRun);
518     WriteHeader(algo, subpacket, PacketType::CalibCalPulse1);
519     WriteHeader(algo, subpacket, PacketType::CalibCalPulse2);
520 kusanagi 1.1 WriteHeader(algo, subpacket, PacketType::Physics);
521 kusanagi 1.4 WriteHeader(algo, subpacket, PacketType::CalibTrkBoth);
522 kusanagi 1.2 WriteHeader(algo, subpacket, PacketType::CalibTrk1);
523     WriteHeader(algo, subpacket, PacketType::CalibTrk2);
524 kusanagi 1.1 WriteHeader(algo, subpacket, PacketType::CalibTrd);
525     WriteHeader(algo, subpacket, PacketType::CalibTof);
526     WriteHeader(algo, subpacket, PacketType::CalibS4);
527 kusanagi 1.4 WriteHeader(algo, subpacket, PacketType::CalibCalPed);
528 kusanagi 1.3 WriteHeader(algo, subpacket, PacketType::CalibAc);
529 kusanagi 1.1 WriteHeader(algo, subpacket, PacketType::RunHeader);
530     WriteHeader(algo, subpacket, PacketType::RunTrailer);
531 kusanagi 1.4 WriteHeader(algo, subpacket, PacketType::CalibHeader);
532     WriteHeader(algo, subpacket, PacketType::CalibTrailer);
533     WriteHeader(algo, subpacket, PacketType::InitHeader);
534     WriteHeader(algo, subpacket, PacketType::InitTrailer);
535     WriteHeader(algo, subpacket, PacketType::EventTrk);
536     WriteHeader(algo, subpacket, PacketType::TestTrk);
537 kusanagi 1.6 WriteHeader(algo, subpacket, PacketType::TestTof);
538 kusanagi 1.4 WriteHeader(algo, subpacket, PacketType::Log);
539     WriteHeader(algo, subpacket, PacketType::VarDump);
540     WriteHeader(algo, subpacket, PacketType::ArrDump);
541     WriteHeader(algo, subpacket, PacketType::TabDump);
542     WriteHeader(algo, subpacket, PacketType::Tmtc);
543     WriteHeader(algo, subpacket, PacketType::Mcmd);
544     WriteHeader(algo, subpacket, PacketType::ForcedFECmd);
545     WriteHeader(algo, subpacket, PacketType::AcInit);
546     WriteHeader(algo, subpacket, PacketType::CalInit);
547     WriteHeader(algo, subpacket, PacketType::TrkInit);
548     WriteHeader(algo, subpacket, PacketType::TofInit);
549     WriteHeader(algo, subpacket, PacketType::TrgInit);
550 kusanagi 2.1 WriteHeader(algo, subpacket, PacketType::NdInit);
551 kusanagi 1.6 WriteHeader(algo, subpacket, PacketType::CalAlarm);
552     WriteHeader(algo, subpacket, PacketType::AcAlarm);
553     WriteHeader(algo, subpacket, PacketType::TrkAlarm);
554     WriteHeader(algo, subpacket, PacketType::TrgAlarm);
555     WriteHeader(algo, subpacket, PacketType::TofAlarm);
556 kusanagi 1.1 }
557    
558     /**
559     * Write the ROOT files to disk.
560     */
561     void PamelaRun::WriteFiles(void) {
562     // Workaround: unlink all friend trees first top avoid to store
563     // the links in the header tree file.
564     for (RootTreeMap::iterator i = TTreeMap.begin(); i != TTreeMap.end(); i++) {
565     if (i->second->GetListOfFriends() != 0) {
566     i->second->GetListOfFriends()->Delete();
567     }
568     }
569    
570     for (TTreeListMap::iterator i = WritingRootTrees.begin();
571     i != WritingRootTrees.end(); i++) {
572     for (TTreeList::iterator j = i->second.begin();
573     j != i->second.end(); j++) {
574     (*j)->GetCurrentFile()->Write();
575     }
576     }
577     }
578    
579     /**
580     * Fill all ROOT trees of a certain type that were opened for writing.
581     * @param type the package type of the trees to fill.
582     */
583     void PamelaRun::FillTrees(const PacketType* type) {
584     for (TTreeList::iterator j = WritingRootTrees[type].begin();
585     j != WritingRootTrees[type].end(); j++) {
586     (*j)->Fill();
587     ;
588     }
589     }
590    
591 kusanagi 1.6

  ViewVC Help
Powered by ViewVC 1.1.23