]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONrawclusters.C
Modifications needed by the HBT analysis (P.Skowronski)
[u/mrichter/AliRoot.git] / MUON / MUONrawclusters.C
index cdc45b9a01cdca2586e77e1a5ba39745647c26f9..8758f3078d0ee6bf7f44be3b6ec2041e6298d310 100644 (file)
@@ -1,3 +1,21 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
 #include "iostream.h"
 
 #include <TClassTable.h>
@@ -13,8 +31,9 @@
 #include "AliMUON.h"
 
 #include "AliMUONClusterFinderVS.h"
+#endif
 
-void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0
+void MUONrawclusters (char* filename="galice.root", Int_t evNumber1=0,Int_t evNumber2=9999
 {
   //////////////////////////////////////
   //                                  //
@@ -58,6 +77,7 @@ void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0)
   // Loading MUON subsystem
   AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
   AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
+  AliMUONData * muondata = MUON->GetMUONData();
 
   Int_t ievent, nevents;
   nevents = RunLoader->GetNumberOfEvents();
@@ -69,6 +89,19 @@ void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0)
     // RecModel->SetTracks(266,267);    
     RecModel->SetGhostChi2Cut(10);
     MUON->SetReconstructionModel(i,RecModel);
+  } 
+
+  MUONLoader->LoadDigits("READ");
+  MUONLoader->LoadRecPoints("UPDATE");
+
+  // Testing if RawClusterisation has already been done
+  RunLoader->GetEvent(0);
+  if (MUONLoader->TreeR()) {
+    if (muondata->IsRawClusterBranchesInTree()) {
+      MUONLoader->UnloadRecPoints();
+      MUONLoader->LoadRecPoints("RECREATE");
+      printf("Recreating RecPoints files\n");
+    }
   }
 //
 //   Loop over events              
@@ -76,18 +109,27 @@ void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0)
     Int_t Nh=0;
     Int_t Nh1=0;
     //    gAlice->RunReco("MUON", evNumber1, evNumber2);
+    if (evNumber2>nevents) evNumber2=nevents;
     for(Int_t ievent=evNumber1; ievent<evNumber2; ievent++) {
       printf("event %d\n",ievent);
       RunLoader->GetEvent(ievent);
-      MUONLoader->LoadDigits("read");
-      if (MUONLoader->TreeR() == 0x0) MUONLoader->MakeTree("R");
-      MUON->MakeBranch("R");
-      MUON->SetTreeAddress();
+
+      // Test if rawcluster has already been done before
+      if (MUONLoader->TreeR() == 0x0) 
+       MUONLoader->MakeRecPointsContainer();
+      else {
+       if (muondata->IsRawClusterBranchesInTree()){ // Test if rawcluster has already been done before
+         if (ievent==evNumber1) MUONLoader->UnloadRecPoints();
+         MUONLoader->MakeRecPointsContainer();  // Redoing clusterisation
+         Info("RecPointsContainer","Recreating RecPointsContainer and deleting previous ones");
+       }
+      }
+      muondata->MakeBranch("RC");
+      muondata->SetTreeAddress("D,RC");
       MUON->Digits2Reco(); 
-      MUONLoader->UnloadDigits();
-      MUONLoader->UnloadRecPoints();
     }
-
+    MUONLoader->UnloadDigits();
+    MUONLoader->UnloadRecPoints();
 }