]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONrawclusters.C
Removing warnings
[u/mrichter/AliRoot.git] / MUON / MUONrawclusters.C
index 00e005dac769fdf3ead184ca5d5e093de1d75475..2a42f8caa3a40cf45f9718a5b2db1304d4e6d483 100644 (file)
-#include "iostream.h"
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
 
-void MUONrawclusters (Int_t evNumber1=0,Int_t evNumber2=0) 
+/* $Id$ */
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+//#include "iostream.h"
+
+#include <TClassTable.h>
+#include <TClonesArray.h>
+#include <TFile.h>
+#include <TParticle.h>
+#include <TROOT.h>
+#include <TTree.h>
+
+#include "AliHeader.h"
+#include "AliRun.h"
+
+#include "AliMUON.h"
+
+#include "AliMUONClusterFinderVS.h"
+//#include "AliMUONClusterFinderAZ.h"
+#include "AliMUONClusterReconstructor.h"
+#endif
+
+void MUONrawclusters (char* filename="galice.root", Int_t evNumber1=0,Int_t evNumber2=9999) 
 {
-  //////////////////////////////////////
-  //                                  //
-  // ROOT macro for ALICE Dimuon Arm: //
-  // Clusterization of digits         //
-  //                                  //
-  //////////////////////////////////////
-  //
-  // Adds the tree TR for raw clusters
-  // to the ROOT file "galice.root"
-  // containing the digits (tree TD).
-  //
-  // Arguments:
-  //   evNumber1 = first event number to act on in file "galice.root"
-  //   evNumber2 = last event number to act on in file "galice.root"
-  //
-  // Input/output file:
-  //   "galice.root"
-  //
-  //__________________________________________________________________________
-
-// Dynamically link some shared libs
-
-    if (gClassTable->GetID("AliRun") < 0) {
-       gROOT->LoadMacro("loadlibs.C");
-       loadlibs();
-    }
+ // Creating Run Loader and openning file containing Hits
+  AliRunLoader* RunLoader = AliRunLoader::Open(filename,"MUONLoader","UPDATE");
+  if (RunLoader ==0x0) {
+    printf(">>> Error : Error Opening %s file \n",filename);
+    return;
+  }
+  if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
+  
+  // Loading MUON subsystem
+  AliLoader* MUONLoader = RunLoader->GetLoader("MUONLoader");
+  
+  MUONLoader->LoadDigits("READ");
+  MUONLoader->LoadRecPoints("UPDATE");
 
-// Connect the Root Galice file containing Geometry, Kine and Hits
+  Int_t ievent, nevents;
+  nevents = RunLoader->GetNumberOfEvents();
 
-    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
-    if (!file) file = new TFile("galice.root","UPDATE");
+  AliMUONClusterReconstructor* Reco = new AliMUONClusterReconstructor(MUONLoader);
+  AliMUONData* muondata = Reco->GetMUONData();
 
-// Get AliRun object from file or create it if not on file
+  for (Int_t i=0; i<10; i++) {
+    AliMUONClusterFinderVS* RecModel = new AliMUONClusterFinderVS();
+    // RecModel->SetTracks(16,17);    
+    // RecModel->SetTracks(266,267);    
+    RecModel->SetGhostChi2Cut(10);
+    Reco->SetReconstructionModel(i,RecModel);
+  } 
 
-    if (!gAlice) {
-       gAlice = (AliRun*)file->Get("gAlice");
-       if (gAlice) printf("AliRun object found on file\n");
-       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
+  // 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");
     }
+  }
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    if (evNumber2 > nevents) evNumber2 = nevents;
+
+    for(ievent = evNumber1; ievent < evNumber2; ievent++) {
+      printf("event %d\n",ievent);
+      RunLoader->GetEvent(ievent);
 
-// Set reconstruction models
-//
-// Get pointers to Alice detectors and Digits containers
-    AliMUON *MUON  = (AliMUON*) gAlice->GetModule("MUON");
-    for (Int_t i=0; i<10; i++) {
-       AliMUONChamber* iChamber= &(MUON->Chamber(i));
-       AliMUONResponse* response =  iChamber->ResponseModel();
-       AliMUONSegmentation*  seg1 = iChamber->SegmentationModel(1);
-       AliMUONSegmentation*  seg2 = iChamber->SegmentationModel(2);
-//
-       RecModel = new AliMUONClusterFinderVS();
-       RecModel->SetNperMax(90);
-       RecModel->SetClusterSize(100);
-       RecModel->SetDeclusterFlag(0);
-       RecModel->SetSegmentation(seg1,seg2);
-       RecModel->SetResponse(response); 
-//     RecModel->SetTracks(16,17);    
-//     RecModel->SetTracks(266,267);    
-       MUON->SetReconstructionModel(i,RecModel);
+      // 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");
+
+      Reco->Digits2Clusters();
+  
+      muondata->Fill("RC"); //Filling Reconstructed Cluster
+      MUONLoader->WriteRecPoints("OVERWRITE");
+      muondata->ResetRawClusters();  
+      muondata->ResetDigits();     
     }
-//
-//   Loop over events              
-//
-    Int_t Nh=0;
-    Int_t Nh1=0;
-    for (int nev=evNumber1; nev<= evNumber2; nev++) {
-       Int_t nparticles = gAlice->GetEvent(nev);
-       cout << "nev         " << nev <<endl;
-       cout << "nparticles  " << nparticles <<endl;
-       if (nev < evNumber1) continue;
-       if (nparticles <= 0) return;
-       Int_t nbytes = 0;
-       TClonesArray *Particles = gAlice->Particles();
-       TTree *TD = gAlice->TreeD();
-       Int_t nent=TD->GetEntries();
-       if (MUON) {
-           MUON->FindClusters(nev,nent-2);
-       }   // end if MUON
-    }   // event loop 
-
-    file->Close();
+    MUONLoader->UnloadDigits();
+    MUONLoader->UnloadRecPoints();
 }
 
+