1 |
/** @file |
/** @file |
2 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
3 |
* $Date: 2006/02/07 17:11:07 $ |
* $Date: 2006/06/26 08:43:20 $ |
4 |
* $Revision: 6.0 $ |
* $Revision: 6.6 $ |
5 |
* |
* |
6 |
* Implementation of the PamelaRun class. |
* Implementation of the PamelaRun class. |
7 |
*/ |
*/ |
55 |
int res; |
int res; |
56 |
DIR *dirp; |
DIR *dirp; |
57 |
std::string fileName; |
std::string fileName; |
58 |
std::string pathDir((char*)getenv("YODA_DATA")); |
//std::string pathDir((char*)getenv("YODA_DATA")); |
59 |
|
std::string pathDir(GetPath()); |
60 |
std::string tempName; |
std::string tempName; |
61 |
std::string::size_type pos; |
std::string::size_type pos; |
62 |
|
|
63 |
pos = input.find_last_of("/"); |
pos = input.find_last_of("/"); |
|
//if ((pos == std::string::npos) && !input.empty()) ;//throw Exception("Directories not allowed...."); |
|
64 |
fileName = input.substr(pos+1); |
fileName = input.substr(pos+1); |
65 |
pos = fileName.find_last_of("."); |
pos = fileName.find_last_of("."); |
66 |
fileName = fileName.substr(0,pos); |
fileName = fileName.substr(0,pos); |
67 |
pathDir = pathDir + "/"; |
pathDir = pathDir + "/"; |
68 |
tempName = pathDir + fileName + "00"; |
tempName = pathDir + fileName; |
69 |
//oss << pathDir << fileName << std::setw( 2 ) << std::setfill( '0' ); |
oss.str(""); |
70 |
oss.str(tempName.c_str()); |
oss << Path << "/" << fileName; |
71 |
int i = 0; |
UnpackPath = oss.str(); |
|
while (res){ |
|
|
//if ((dirp = opendir(tempName.c_str())) == NULL) { |
|
|
if ((dirp = opendir(oss.str().c_str())) == NULL) { |
|
|
res = 0; |
|
|
} else { |
|
|
closedir(dirp); |
|
|
oss.str(""); |
|
|
oss << pathDir << fileName << std::setw( 2 ) << std::setfill( '0' ) << ++i; |
|
|
res = 1; |
|
|
} |
|
|
} |
|
|
oss.str(""); |
|
|
oss << Path << "/" << fileName << std::setw( 2 ) << std::setfill( '0' ) << i; |
|
|
Path = oss.str(); |
|
72 |
oss.str(""); |
oss.str(""); |
73 |
oss << fileName << std::setw( 2 ) << std::setfill( '0' ) << i; |
oss << fileName; |
74 |
Run = oss.str(); |
Run = oss.str(); |
|
//return (oss.str()); |
|
75 |
} |
} |
76 |
|
|
77 |
/** |
/** |
117 |
*/ |
*/ |
118 |
std::string PamelaRun::GetFileName(const SubPacket* type, std::string name) { |
std::string PamelaRun::GetFileName(const SubPacket* type, std::string name) { |
119 |
if (type->IsDetectorSpecific()) { |
if (type->IsDetectorSpecific()) { |
120 |
return Path + "/" + type->GetPacketType()->GetName() + "/" |
return UnpackPath + "/" + type->GetPacketType()->GetName() + "/" |
121 |
+ Run + "." + type->GetPacketType()->GetName() + "." |
+ Run + "." + type->GetPacketType()->GetName() + "." |
122 |
+ type->GetSubDetector()->GetName() + "." |
+ type->GetSubDetector()->GetName() + "." |
123 |
+ name + ".root"; |
+ name + ".root"; |
124 |
} else { |
} else { |
125 |
return Path + "/" + type->GetPacketType()->GetName() + "/" |
return UnpackPath + "/" + type->GetPacketType()->GetName() + "/" |
126 |
+ Run + "." + type->GetPacketType()->GetName() + "." |
+ Run + "." + type->GetPacketType()->GetName() + "." |
127 |
+ name + ".root"; |
+ name + ".root"; |
128 |
/* |
/* |
449 |
WriteHeader(algo, subpacket, PacketType::CalibCalPulse1); |
WriteHeader(algo, subpacket, PacketType::CalibCalPulse1); |
450 |
WriteHeader(algo, subpacket, PacketType::CalibCalPulse2); |
WriteHeader(algo, subpacket, PacketType::CalibCalPulse2); |
451 |
WriteHeader(algo, subpacket, PacketType::Physics); |
WriteHeader(algo, subpacket, PacketType::Physics); |
452 |
|
WriteHeader(algo, subpacket, PacketType::CalibTrkBoth); |
453 |
WriteHeader(algo, subpacket, PacketType::CalibTrk1); |
WriteHeader(algo, subpacket, PacketType::CalibTrk1); |
454 |
WriteHeader(algo, subpacket, PacketType::CalibTrk2); |
WriteHeader(algo, subpacket, PacketType::CalibTrk2); |
455 |
WriteHeader(algo, subpacket, PacketType::CalibTof); |
WriteHeader(algo, subpacket, PacketType::CalibTof); |
482 |
WriteHeader(algo, subpacket, PacketType::S4Init); |
WriteHeader(algo, subpacket, PacketType::S4Init); |
483 |
WriteHeader(algo, subpacket, PacketType::Ac2Init); |
WriteHeader(algo, subpacket, PacketType::Ac2Init); |
484 |
WriteHeader(algo, subpacket, PacketType::CalAlarm); |
WriteHeader(algo, subpacket, PacketType::CalAlarm); |
485 |
WriteHeader(algo, subpacket, PacketType::AcAlarm); |
WriteHeader(algo, subpacket, PacketType::Ac1Alarm); |
486 |
WriteHeader(algo, subpacket, PacketType::TrkAlarm); |
WriteHeader(algo, subpacket, PacketType::TrkAlarm); |
487 |
WriteHeader(algo, subpacket, PacketType::TrgAlarm); |
WriteHeader(algo, subpacket, PacketType::TrgAlarm); |
488 |
WriteHeader(algo, subpacket, PacketType::TofAlarm); |
WriteHeader(algo, subpacket, PacketType::TofAlarm); |
489 |
WriteHeader(algo, subpacket, PacketType::S4Alarm); |
WriteHeader(algo, subpacket, PacketType::S4Alarm); |
490 |
|
WriteHeader(algo, subpacket, PacketType::Ac2Alarm); |
491 |
WriteHeader(algo, subpacket, PacketType::TsbT); |
WriteHeader(algo, subpacket, PacketType::TsbT); |
492 |
WriteHeader(algo, subpacket, PacketType::TsbB); |
WriteHeader(algo, subpacket, PacketType::TsbB); |
493 |
} |
} |
543 |
|
|
544 |
std::string FileName = ""; |
std::string FileName = ""; |
545 |
TFile* File = 0; |
TFile* File = 0; |
546 |
|
Long64_t maxsize = 5000000000LL; |
547 |
|
TTree::SetMaxTreeSize(maxsize); |
548 |
TTree *tree = 0; |
TTree *tree = 0; |
549 |
if ( Multiple ){ |
if ( Multiple ){ |
550 |
FileName = GetFileName(&header, GetDefaultBranchName(&header)); |
FileName = GetFileName(&header, GetDefaultBranchName(&header)); |
559 |
TTreeMap.insert(RootTreeMap::value_type(type, tree)); |
TTreeMap.insert(RootTreeMap::value_type(type, tree)); |
560 |
} else { |
} else { |
561 |
if (!Multiple && (SingleFile == NULL)){ |
if (!Multiple && (SingleFile == NULL)){ |
562 |
std::string pathDir((char*)getenv("YODA_DATA")); |
//std::string pathDir((char*)getenv("YODA_DATA")); |
563 |
SingleFile = new TFile((pathDir + "/" + Run + ".root").c_str(), "update"); |
SingleFile = new TFile((GetPath() + "/" + Run + ".root").c_str(), "update"); |
564 |
SingleFile->SetCompressionLevel(compression); |
SingleFile->SetCompressionLevel(compression); |
565 |
} |
} |
566 |
tree = new TTree(EventType.c_str(), algo->GetAlgorithmName().c_str()); |
tree = new TTree(EventType.c_str(), algo->GetAlgorithmName().c_str()); |