]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTSpacePointContainer.cxx
HLTcalo module
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTSpacePointContainer.cxx
index 9bc103b6226aacfbf481ce04ce1e7eeff5640ba3..eda14439f732236cac6f8de2c8b41067d4e4cef4 100644 (file)
 #include "TH2F.h"
 #include "TMath.h"
 #include "TMarker.h"
+#include "TTree.h"
 #include <memory>
 #include <algorithm>
 #include <iostream>
+#include <iomanip>
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTSpacePointContainer)
@@ -390,8 +392,62 @@ void AliHLTSpacePointContainer::Draw(Option_t *option)
   }  
 }
 
+TTree* AliHLTSpacePointContainer::FillTree(const char* name, const char* title)
+{
+  // create tree and fill the space point coordinates
+  TString treename=name;
+  TString treetitle=title;
+  if (treename.IsNull()) treename="spacepoints";
+  if (treetitle.IsNull()) treetitle="HLT space point coordinates";
+  std::auto_ptr<TTree> tree(new TTree(treename, treetitle));
+  if (!tree.get()) return NULL;
+
+  const unsigned dimension=8;
+  float values[dimension];
+  memset(values, 0, sizeof(values));
+  const char* names[dimension]={
+    "x", "y", "z", "sigmaY2", "sigmaZ2", "charge", "qmax", "alpha"
+  };
+
+  for (unsigned i=0; i<dimension; i++) {
+    TString type=names[i]; type+="/F";
+    tree->Branch(names[i], &values[i], type);
+  }
+
+  const vector<AliHLTUInt32_t>* clusterIDs=GetClusterIDs(0xffffffff);
+  for (vector<AliHLTUInt32_t>::const_iterator clusterID=clusterIDs->begin();
+       clusterID!=clusterIDs->end();
+       clusterID++) {
+    unsigned pos=0;
+    values[pos++]=GetX(*clusterID);
+    values[pos++]=GetY(*clusterID);
+    values[pos++]=GetZ(*clusterID);
+    values[pos++]=GetYWidth(*clusterID);
+    values[pos++]=GetZWidth(*clusterID);
+    values[pos++]=GetCharge(*clusterID);
+    values[pos++]=GetMaxSignal(*clusterID);
+    values[pos++]=GetPhi(*clusterID);
+
+    tree->Fill();
+  }
+
+  return tree.release();
+}
+
 ostream& operator<<(ostream &out, const AliHLTSpacePointContainer& c)
 {
   c.Print(out);
   return out;
 }
+
+ostream& operator<<(ostream &out, const AliHLTSpacePointContainer::AliHLTSpacePointProperties& p)
+{
+  // print
+  cout << p.fId;
+  return out;
+}
+
+bool operator==(const AliHLTSpacePointContainer::AliHLTSpacePointProperties& a,
+               const AliHLTSpacePointContainer::AliHLTSpacePointProperties& b) {
+  return a.fId==b.fId;
+}