1 |
/** @file |
/** @file |
2 |
* $Author: mocchiut $ |
* $Author: mocchiut $ |
3 |
* $Date: 2008/09/23 07:19:55 $ |
* $Date: 2008/12/18 14:47:09 $ |
4 |
* $Revision: 1.1.1.1 $ |
* $Revision: 1.2 $ |
5 |
* |
* |
6 |
* Implementation of the PamelaRun class. |
* Implementation of the PamelaRun class. |
7 |
*/ |
*/ |
78 |
* @return int |
* @return int |
79 |
*/ |
*/ |
80 |
void PamelaRun::RunExists(std::string input) throw (std::exception){ |
void PamelaRun::RunExists(std::string input) throw (std::exception){ |
81 |
int res; |
// int res; |
82 |
DIR *dirp; |
// DIR *dirp; |
83 |
std::string fileName; |
std::string fileName; |
84 |
//std::string pathDir((char*)getenv("YODA_DATA")); |
//std::string pathDir((char*)getenv("YODA_DATA")); |
85 |
std::string pathDir(GetPath()); |
std::string pathDir(GetPath()); |
316 |
SubPacket *packet = *(SubPacket**)subpacket; |
SubPacket *packet = *(SubPacket**)subpacket; |
317 |
|
|
318 |
// look into the map of subpackets if we already read it. |
// look into the map of subpackets if we already read it. |
319 |
std::string FullName = packet->GetPacketType()->GetName() + "." + name; |
// std::string FullName = packet->GetPacketType()->GetName() + "." + name; |
320 |
|
std::string FullName = (const std::string)packet->GetPacketType()->GetName() + "." + name; |
321 |
SubPacketMap::iterator i = SubPacketAddresses.find(FullName); |
SubPacketMap::iterator i = SubPacketAddresses.find(FullName); |
322 |
if (i != SubPacketAddresses.end()) { // it is in the map |
if (i != SubPacketAddresses.end()) { // it is in the map |
323 |
*(SubPacket**)subpacket = i->second; |
*(SubPacket**)subpacket = i->second; |
390 |
FileName = GetFileName(packet, name); |
FileName = GetFileName(packet, name); |
391 |
CreateDirectoryStructure(FileName.c_str()); |
CreateDirectoryStructure(FileName.c_str()); |
392 |
File = new TFile(FileName.c_str(), "create"); |
File = new TFile(FileName.c_str(), "create"); |
393 |
tree = new TTree(TreeName.c_str(), algo->GetAlgorithmName().c_str()); |
// tree = new TTree(TreeName.c_str(), algo->GetAlgorithmName().c_str()); |
394 |
|
tree = new TTree(TreeName.c_str(), algo->GetAlgorithmName()); |
395 |
WritingRootTrees[packet->GetPacketType()].push_back(tree); |
WritingRootTrees[packet->GetPacketType()].push_back(tree); |
396 |
|
|
397 |
File->SetCompressionLevel(compression); |
File->SetCompressionLevel(compression); |
421 |
oss << "Register: " << name << " for " << algo->GetAlgorithmName() << " (writing)"; |
oss << "Register: " << name << " for " << algo->GetAlgorithmName() << " (writing)"; |
422 |
//logger->debug(oss.str().c_str()); |
//logger->debug(oss.str().c_str()); |
423 |
TTree* HeaderTree = ReadTTree(packet->GetPacketType()); |
TTree* HeaderTree = ReadTTree(packet->GetPacketType()); |
424 |
std::string FullName = packet->GetPacketType()->GetName() + "." + name; |
// std::string FullName = packet->GetPacketType()->GetName() + "." + name; |
425 |
|
std::string FullName = (const std::string)packet->GetPacketType()->GetName() + "." + name; |
426 |
if (Multiple) { |
if (Multiple) { |
427 |
TTree* tree = CreateTTree(algo, packet, name); |
TTree* tree = CreateTTree(algo, packet, name); |
428 |
oss.str(""); |
oss.str(""); |
570 |
|
|
571 |
EventHeader header(type); |
EventHeader header(type); |
572 |
std::string EventType = (&header)->GetPacketType()->GetName(); |
std::string EventType = (&header)->GetPacketType()->GetName(); |
573 |
// std::cout<<EventType<<std::endl; |
// std::cout<<EventType<<std::endl; |
574 |
|
|
575 |
std::string FileName = ""; |
std::string FileName = ""; |
576 |
TFile* File = 0; |
TFile* File = 0; |
582 |
CreateDirectoryStructure(FileName.c_str()); |
CreateDirectoryStructure(FileName.c_str()); |
583 |
File = new TFile(FileName.c_str(), "create"); |
File = new TFile(FileName.c_str(), "create"); |
584 |
File->SetCompressionLevel(compression); |
File->SetCompressionLevel(compression); |
585 |
tree = new TTree("Pscu", algo->GetAlgorithmName().c_str()); |
// tree = new TTree("Pscu", algo->GetAlgorithmName().c_str()); |
586 |
|
tree = new TTree("Pscu", algo->GetAlgorithmName()); |
587 |
WritingRootTrees[(&header)->GetPacketType()].push_back(tree); |
WritingRootTrees[(&header)->GetPacketType()].push_back(tree); |
588 |
tree->GetCurrentFile()->cd(); |
tree->GetCurrentFile()->cd(); |
589 |
tree->Branch(GetDefaultBranchName(&header).c_str(), |
tree->Branch(GetDefaultBranchName(&header).c_str(), |
597 |
SingleFile->SetCompressionLevel(compression); |
SingleFile->SetCompressionLevel(compression); |
598 |
} |
} |
599 |
|
|
600 |
tree = new TTree(EventType.c_str(), algo->GetAlgorithmName().c_str()); |
// tree = new TTree(EventType.c_str(), algo->GetAlgorithmName().c_str()); |
601 |
|
tree = new TTree(EventType.c_str(), algo->GetAlgorithmName()); |
602 |
WritingRootTrees[type].push_back(tree); |
WritingRootTrees[type].push_back(tree); |
603 |
tree->GetCurrentFile()->cd(); |
tree->GetCurrentFile()->cd(); |
604 |
tree->Branch(GetDefaultBranchName(&header).c_str(), |
tree->Branch(GetDefaultBranchName(&header).c_str(), |
605 |
(*subpacket)->Class()->GetName(), subpacket); |
(*subpacket)->Class()->GetName(), subpacket); |
606 |
|
|
607 |
TTreeMap.insert(RootTreeMap::value_type(type, tree)); |
TTreeMap.insert(RootTreeMap::value_type(type, tree)); |
608 |
} |
} |
609 |
|
|