]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCSpacePointContainer.cxx
Analysis task used to extract the VZERO event-plane flatenning parameters.
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCSpacePointContainer.cxx
index d55595417ca7f03d6a3744b68e57cf1dcbce302a..e82184d55dfd5b191109411e1cbb590bd969c4c5 100644 (file)
@@ -38,6 +38,7 @@ ClassImp(AliHLTTPCSpacePointContainer)
 AliHLTTPCSpacePointContainer::AliHLTTPCSpacePointContainer()
   : AliHLTSpacePointContainer()
   , fClusters()
+  , fSelections()
 {
   // see header file for class documentation
   // or
@@ -49,6 +50,7 @@ AliHLTTPCSpacePointContainer::AliHLTTPCSpacePointContainer()
 AliHLTTPCSpacePointContainer::AliHLTTPCSpacePointContainer(const AliHLTTPCSpacePointContainer& c)
   : AliHLTSpacePointContainer(c)
   , fClusters(c.fClusters.begin(), c.fClusters.end())
+  , fSelections()
 {
   /// copy constructor
 }
@@ -66,6 +68,8 @@ AliHLTTPCSpacePointContainer& AliHLTTPCSpacePointContainer::operator=(const AliH
 AliHLTTPCSpacePointContainer::~AliHLTTPCSpacePointContainer()
 {
   // destructor
+
+  Clear();
 }
 
 int AliHLTTPCSpacePointContainer::AddInputBlock(const AliHLTComponentBlockData* pDesc)
@@ -118,13 +122,14 @@ int AliHLTTPCSpacePointContainer::AddInputBlock(const AliHLTComponentBlockData*
       }
     }
     {
-      UInt_t clusterSlice =AliHLTTPCSpacePointData::GetSlice(clusterID);
-      UInt_t clusterPart  =AliHLTTPCSpacePointData::GetPatch(clusterID);
-      int row=AliHLTTPCTransform::GetPadRow(pClusterData->fSpacePoints[i].fX);
-      if (row<AliHLTTPCTransform::GetFirstRow(clusterPart) || row>AliHLTTPCTransform::GetLastRow(clusterPart)) {
-       HLTError("row number %d calculated from x value %f is outside slice %d partition %d, expected row %d"
-                , row, pClusterData->fSpacePoints[i].fX, clusterSlice, clusterPart, pClusterData->fSpacePoints[i].fPadRow);
-      }
+      // consistency check for x and row number
+      // UInt_t clusterSlice =AliHLTTPCSpacePointData::GetSlice(clusterID);
+      // UInt_t clusterPart  =AliHLTTPCSpacePointData::GetPatch(clusterID);
+      // int row=AliHLTTPCTransform::GetPadRow(pClusterData->fSpacePoints[i].fX);
+      // if (row<AliHLTTPCTransform::GetFirstRow(clusterPart) || row>AliHLTTPCTransform::GetLastRow(clusterPart)) {
+      //       HLTError("row number %d calculated from x value %f is outside slice %d partition %d, expected row %d"
+      //                , row, pClusterData->fSpacePoints[i].fX, clusterSlice, clusterPart, pClusterData->fSpacePoints[i].fPadRow);
+      // }
     }
 
     if (fClusters.find(clusterID)==fClusters.end()) {
@@ -148,6 +153,39 @@ int AliHLTTPCSpacePointContainer::GetClusterIDs(vector<AliHLTUInt32_t>& tgt) con
   return tgt.size();
 }
 
+bool AliHLTTPCSpacePointContainer::Check(AliHLTUInt32_t clusterID) const
+{
+  // check if the cluster is available
+  return fClusters.find(clusterID)!=fClusters.end();
+}
+
+const vector<AliHLTUInt32_t>* AliHLTTPCSpacePointContainer::GetClusterIDs(AliHLTUInt32_t mask)
+{
+  // get array of cluster IDs filtered by mask
+  if (fSelections.find(mask)!=fSelections.end()) {
+    // return existing selection
+    return fSelections.find(mask)->second;
+  }
+  // create new collection
+  vector<AliHLTUInt32_t>* selected=new vector<AliHLTUInt32_t>;
+  if (!selected) return NULL;
+  UInt_t slice=AliHLTTPCSpacePointData::GetSlice(mask);
+  UInt_t partition=AliHLTTPCSpacePointData::GetPatch(mask);
+  HLTInfo("creating collection 0x%08x", mask);
+  for (std::map<AliHLTUInt32_t, AliHLTTPCSpacePointProperties>::const_iterator cl=fClusters.begin();
+       cl!=fClusters.end(); cl++) {
+    UInt_t s=AliHLTTPCSpacePointData::GetSlice(cl->first);
+    UInt_t p=AliHLTTPCSpacePointData::GetPatch(cl->first);
+    if ((slice>=(unsigned)AliHLTTPCTransform::GetNSlice() || s==slice) && 
+       (partition>=(unsigned)AliHLTTPCTransform::GetNumberOfPatches() || p==partition)) {
+      selected->push_back(cl->first);
+    }
+  }
+  HLTInfo("collection 0x%08x with %d spacepoints", mask, selected->size());
+  fSelections[mask]=selected;
+  return selected;
+}
+
 float AliHLTTPCSpacePointContainer::GetX(AliHLTUInt32_t clusterID) const
 {
   // get X coordinate
@@ -209,6 +247,14 @@ float AliHLTTPCSpacePointContainer::GetCharge(AliHLTUInt32_t clusterID) const
   return fClusters.find(clusterID)->second.Data()->fCharge;
 }
 
+float AliHLTTPCSpacePointContainer::GetMaxSignal(AliHLTUInt32_t clusterID) const
+{
+  // get charge
+  if (fClusters.find(clusterID)==fClusters.end() ||
+      fClusters.find(clusterID)->second.Data()==NULL) return 0.0;
+  return fClusters.find(clusterID)->second.Data()->fQMax;
+}
+
 float AliHLTTPCSpacePointContainer::GetPhi(AliHLTUInt32_t clusterID) const
 {
   // get charge
@@ -219,9 +265,18 @@ float AliHLTTPCSpacePointContainer::GetPhi(AliHLTUInt32_t clusterID) const
   return ( slice + 0.5 ) * TMath::Pi() / 9.0;
 }
 
-void AliHLTTPCSpacePointContainer::Clear(Option_t * /*option*/)
+void AliHLTTPCSpacePointContainer::Clear(Option_t * option)
 {
   // clear the object and reset pointer references
+  fClusters.clear();
+
+  for (std::map<AliHLTUInt32_t, vector<AliHLTUInt32_t>*>::iterator selection=fSelections.begin();
+       selection!=fSelections.end(); selection++) {
+    if (selection->second) delete selection->second;
+  }
+  fSelections.clear();
+
+  AliHLTSpacePointContainer::Clear(option);
 }
 
 void AliHLTTPCSpacePointContainer::Print(ostream& out, Option_t */*option*/) const
@@ -235,6 +290,26 @@ void AliHLTTPCSpacePointContainer::Print(ostream& out, Option_t */*option*/) con
   }
 }
 
+AliHLTSpacePointContainer* AliHLTTPCSpacePointContainer::SelectByMask(AliHLTUInt32_t mask, bool /*bAlloc*/) const
+{
+  /// create a collection of clusters for a space point mask
+  std::auto_ptr<AliHLTTPCSpacePointContainer> c(new AliHLTTPCSpacePointContainer);
+  if (!c.get()) return NULL;
+
+  UInt_t slice=AliHLTTPCSpacePointData::GetSlice(mask);
+  UInt_t partition=AliHLTTPCSpacePointData::GetPatch(mask);
+  for (std::map<AliHLTUInt32_t, AliHLTTPCSpacePointProperties>::const_iterator cl=fClusters.begin();
+       cl!=fClusters.end(); cl++) {
+    UInt_t s=AliHLTTPCSpacePointData::GetSlice(cl->first);
+    UInt_t p=AliHLTTPCSpacePointData::GetPatch(cl->first);
+    if ((slice>=(unsigned)AliHLTTPCTransform::GetNSlice() || s==slice) && 
+       (partition>=(unsigned)AliHLTTPCTransform::GetNumberOfPatches() || p==partition)) {
+      c->fClusters[cl->first]=cl->second;
+    }
+  }
+  return c.release();
+}
+
 AliHLTSpacePointContainer* AliHLTTPCSpacePointContainer::SelectByTrack(int trackId, bool /*bAlloc*/) const
 {
   /// create a collection of clusters for a specific track
@@ -370,6 +445,8 @@ void AliHLTTPCSpacePointContainer::AliHLTTPCSpacePointProperties::Print(ostream&
   }
   const AliHLTTPCSpacePointData* data=Data();
   out << " " << data->fX << " " << data->fY << " " << data->fZ << " " << (UInt_t)data->fPadRow
+      << " " << data->GetSigmaY2() << " "  << data->GetSigmaZ2()
+      << " " << data->GetCharge() << " "  << data->GetQMax()
       << " " << fTrackId << " " << fMCId << " " << fUsed;
 }