]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDclusterizer.cxx
Update of clusterizer
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.cxx
index 9ea7f049a6da64e9afc13d114bd2963fa14647bb..ed3a96eba10cec2e4d6d1694aee3bed7f09c3689 100644 (file)
@@ -240,9 +240,21 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
     AliInfo(Form("Writing the cluster tree %s for event %d."
                ,fClusterTree->GetName(),fRunLoader->GetEventNumber()));
 
-    AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
-    loader->WriteRecPoints("OVERWRITE");
+    if (fRecPoints) {
+
+      branch->SetAddress(&fRecPoints);
+
+      AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
+      loader->WriteRecPoints("OVERWRITE");
   
+    }
+    else {
+
+      AliError("Cluster tree does not exist. Cannot write clusters.\n");
+      return kFALSE;
+
+    }
+
     return kTRUE;  
 
   }
@@ -267,7 +279,6 @@ AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin
   AliTRDcluster *c = new AliTRDcluster();
 
   c->SetDetector(det);
-  c->AddTrackIndex(tracks);
   c->SetQ(amp);
   c->SetX(pos[2]);
   c->SetY(pos[0]);
@@ -277,6 +288,10 @@ AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin
   c->SetLocalTimeBin(timebin);
   c->SetCenter(center);
 
+  if (tracks) {
+    c->AddTrackIndex(tracks);
+  }
+
   switch (iType) {
   case 0:
     c->Set2pad();
@@ -311,7 +326,7 @@ Double_t AliTRDclusterizer::CalcXposFromTimebin(Float_t timebin, Int_t idet
   
   AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
-    AliError("Cannot calibration object");
+    AliError("Cannot find calibration object");
     return -1;
   }