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

Diff of /chewbacca/event/PamelaRun.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by mocchiut, Thu Dec 18 14:47:09 2008 UTC revision 1.3 by mocchiut, Fri Jul 24 13:53:51 2009 UTC
# Line 1  Line 1 
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   */   */
# Line 78  std::string PamelaRun::GetRunName(int ru Line 78  std::string PamelaRun::GetRunName(int ru
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());
# Line 316  void PamelaRun::ReadSubPacket(void* subp Line 316  void PamelaRun::ReadSubPacket(void* subp
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;
# Line 389  TTree* PamelaRun::CreateTTree(Algorithm* Line 390  TTree* PamelaRun::CreateTTree(Algorithm*
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);
# Line 419  void PamelaRun::WriteSubPacket(Algorithm Line 421  void PamelaRun::WriteSubPacket(Algorithm
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("");
# Line 567  void PamelaRun::WriteHeader(Algorithm* a Line 570  void PamelaRun::WriteHeader(Algorithm* a
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;
# Line 579  void PamelaRun::WriteHeader(Algorithm* a Line 582  void PamelaRun::WriteHeader(Algorithm* a
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(),
# Line 593  void PamelaRun::WriteHeader(Algorithm* a Line 597  void PamelaRun::WriteHeader(Algorithm* a
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    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23