]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONrawclusters.C
MUONrawcluster ready to compile
[u/mrichter/AliRoot.git] / MUON / MUONrawclusters.C
index 00e005dac769fdf3ead184ca5d5e093de1d75475..cdc45b9a01cdca2586e77e1a5ba39745647c26f9 100644 (file)
@@ -1,6 +1,20 @@
 #include "iostream.h"
 
-void MUONrawclusters (Int_t evNumber1=0,Int_t evNumber2=0) 
+#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"
+
+void MUONrawclusters (char* filename, Int_t evNumber1=0,Int_t evNumber2=0) 
 {
   //////////////////////////////////////
   //                                  //
@@ -22,66 +36,58 @@ void MUONrawclusters (Int_t evNumber1=0,Int_t evNumber2=0)
   //
   //__________________________________________________________________________
 
-// Dynamically link some shared libs
+//  // Dynamically link some shared libs
 
-    if (gClassTable->GetID("AliRun") < 0) {
-       gROOT->LoadMacro("loadlibs.C");
-       loadlibs();
-    }
+  //if (gClassTable->GetID("AliRun") < 0) {
+  //   gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
+  //   loadlibs();
+  //    }
 
-// Connect the Root Galice file containing Geometry, Kine and Hits
+ // Creating Run Loader and openning file containing Hits
+  AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","UPDATE");
+  if (RunLoader ==0x0) {
+    printf(">>> Error : Error Opening %s file \n",filename);
+    return;
+  }
 
-    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
-    if (!file) file = new TFile("galice.root","UPDATE");
+  // Loading AliRun master
+  RunLoader->UnloadgAlice();
+  RunLoader->LoadgAlice();
+  gAlice = RunLoader->GetAliRun();
 
-// Get AliRun object from file or create it if not on file
+  // Loading MUON subsystem
+  AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
+  AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
 
-    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");
-    }
+  Int_t ievent, nevents;
+  nevents = RunLoader->GetNumberOfEvents();
 
-// 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);
-    }
+  for (Int_t i=0; i<10; i++) {
+    //RecModel = new AliMUONClusterFinderVS();
+    AliMUONClusterFinderVS *RecModel = new AliMUONClusterFinderVS();
+    // RecModel->SetTracks(16,17);    
+    // RecModel->SetTracks(266,267);    
+    RecModel->SetGhostChi2Cut(10);
+    MUON->SetReconstructionModel(i,RecModel);
+  }
 //
 //   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 
+    //    gAlice->RunReco("MUON", evNumber1, evNumber2);
+    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();
+      MUON->Digits2Reco(); 
+      MUONLoader->UnloadDigits();
+      MUONLoader->UnloadRecPoints();
+    }
 
-    file->Close();
 }
 
+