ALIROOT-5559 - modified streamer for the AliTPCcalibAlign - rducing memory usage...
authormivanov <marian.ivanov@cern.ch>
Fri, 8 Aug 2014 13:44:50 +0000 (15:44 +0200)
committermivanov <marian.ivanov@cern.ch>
Fri, 8 Aug 2014 13:44:50 +0000 (15:44 +0200)
TPC/Calib/AliTPCcalibAlign.cxx
TPC/Calib/test/UnitTest.C

index 2698fa4..810ab80 100644 (file)
 #include "Riostream.h"
 #include "TRandom.h"
 #include <sstream>
+
+#include "AliSysInfo.h"
 using namespace std;
 
 AliTPCcalibAlign* AliTPCcalibAlign::fgInstance = 0;
@@ -3816,3 +3818,88 @@ void AliTPCcalibAlign::MakeReportDyPhi(TFile */*output*/){
 }
 
 
+//______________________________________________________________________________
+void AliTPCcalibAlign::Streamer(TBuffer &R__b)
+{
+  // Stream an object of class AliTPCcalibAlign.
+
+  Bool_t isDebug=AliLog::GetDebugLevel("","AliTPCcalibAlign")>0;
+  if (isDebug) AliSysInfo::SetVerbose(kTRUE);
+  if (R__b.IsReading()) {
+    // Read the class using the automatic streamer. Might be wrong
+    R__b.ReadClassBuffer(AliTPCcalibAlign::Class(),this);
+    for (Int_t i=0; i<2; ++i){
+      if (gDirectory){
+       TString hisName=TString::Format("fClusterDelta[%d]",i);
+       if (gDirectory->Get(hisName.Data())){
+         fClusterDelta[i] = dynamic_cast<THn*>(gDirectory->Get((hisName).Data()));
+       }
+      }
+    }
+  } else {
+    // R__b.WriteClassBuffer(AliTPCcalibAlign::Class(),this);
+    if (isDebug) AliSysInfo::AddStamp("Start");
+    R__b.WriteVersion(AliTPCcalibAlign::IsA());
+    if (isDebug) AliSysInfo::AddStamp("Version");
+    AliTPCcalibBase::Streamer(R__b); // Stream the base class
+    if (isDebug) AliSysInfo::AddStamp("BaseClass");
+    
+    //    for (Int_t i=0; i<2; ++i)
+    //  R__b << fClusterDelta[i];
+    for (Int_t i=0; i<2; ++i){
+      if (fClusterDelta[i]) fClusterDelta[i]->Write(TString::Format("fClusterDelta[%d]",i).Data());
+    }
+    
+    if (isDebug) AliSysInfo::AddStamp("THn");
+    
+    for (Int_t i=0; i<4; ++i)
+      R__b << fTrackletDelta[i];
+    if (isDebug) AliSysInfo::AddStamp("THnSparse");
+    
+    fDphiHistArray.Streamer(R__b);
+    fDthetaHistArray.Streamer(R__b);
+    fDyHistArray.Streamer(R__b);
+    fDzHistArray.Streamer(R__b);
+
+    fDyPhiHistArray.Streamer(R__b);
+    fDzThetaHistArray.Streamer(R__b);
+    
+    fDphiZHistArray.Streamer(R__b);
+    fDthetaZHistArray.Streamer(R__b);
+    fDyZHistArray.Streamer(R__b);
+    fDzZHistArray.Streamer(R__b);
+    
+    fFitterArray12.Streamer(R__b);
+    fFitterArray9.Streamer(R__b);
+    fFitterArray6.Streamer(R__b);
+    
+    fMatrixArray12.Streamer(R__b);
+    fMatrixArray9.Streamer(R__b);
+    fMatrixArray6.Streamer(R__b);
+    
+    fCombinedMatrixArray6.Streamer(R__b);
+    if (isDebug) AliSysInfo::AddStamp("ObjArrays1");
+    
+    R__b.WriteFastArray(fPoints,72*72);
+    if (isDebug) AliSysInfo::AddStamp("Points");
+    R__b << fNoField;
+    R__b << fXIO;
+    R__b << fXmiddle;
+    R__b << fXquadrant;
+    if (isDebug) AliSysInfo::AddStamp("Floats");
+    
+    fArraySectorIntParam.Streamer(R__b);
+    fArraySectorIntCovar.Streamer(R__b);
+    if (isDebug) AliSysInfo::AddStamp("ObjArrays2");
+    
+    R__b << fSectorParamA;
+    R__b << fSectorCovarA;
+    R__b << fSectorParamC;
+    R__b << fSectorCovarC;
+    if (isDebug) AliSysInfo::AddStamp("TMatrixD");
+    
+    R__b << fUseInnerOuter;
+    R__b << fgkMergeEntriesCut; // Should we write the static member?
+    if (isDebug) AliSysInfo::AddStamp("End");
+  }
+}
index 7981bdb..1070079 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliTPCcalibLaser.h"
 #include "AliSysInfo.h"
 #include "TTree.h"
+#include "AliLog.h"
 
 const Double_t kAlmost0=1.e-13;
 
@@ -73,7 +74,8 @@ void UnitTestF1Plane(){
 void UnitTestAliTPCcalibAlignStreamer(const char *fname="/hera/alice/local/benchmark/vAN-20140518/000128503/cpass1/CalibObjects.root"){
   //
   // 0.) ReadPart
-  //
+  // 
+  AliLog::SetClassDebugLevel("AliTPCcalibAlign",1);
   TFile *fin= TFile::Open(fname);
   AliSysInfo::AddStamp("LoadFile");
   AliTPCcalibAlign * align = (AliTPCcalibAlign * )fin->Get("TPCAlign/alignTPC");
@@ -81,23 +83,23 @@ void UnitTestAliTPCcalibAlignStreamer(const char *fname="/hera/alice/local/bench
   AliTPCcalibLaser * laser = (AliTPCcalibLaser * )fin->Get("TPCAlign/laserTPC");
   AliSysInfo::AddStamp("LoadLaser");
   TTree * tree =AliSysInfo::MakeTree("syswatch.log");
-  tree->Scan("sname:deltaVM:VM","","colsize=30");
+  tree->Scan("sname:deltaVM:VM:pI.fMemResident","","colsize=30");
   //
   // 1.) Write part
   //
   TFile * fout=new TFile("testAliTPCcalibAlignStreamer.root","recreate");
   align->Write();
   fout->ls();
-  delete align;
-  AliSysInfo::AddStamp("deleteAlign");
   delete laser;
   AliSysInfo::AddStamp("deleteLaser");
+  delete align;
+  AliSysInfo::AddStamp("deleteAlign");
   delete fout;
   //
   // 2.) Check memory
   //
   tree =AliSysInfo::MakeTree("syswatch.log");
-  tree->Scan("sname:deltaVM:VM","","colsize=30");
+  tree->Scan("sname:deltaVM:VM:pI.fMemResident","","colsize=25");
 
 }