]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONEventReconstructor.cxx
MC-dependent part of AliRun extracted in AliMC (F.Carminati)
[u/mrichter/AliRoot.git] / MUON / AliMUONEventReconstructor.cxx
index 19650b19162a9f040e7e3e295c3e70e771d9a86f..e5b25215013c4eed7d605d7b77e3974c5c2aa375 100644 (file)
@@ -53,6 +53,7 @@
 #include "AliLoader.h"
 #include "AliMUONTrackK.h" //AZ
 #include <TMatrixD.h> //AZ
+#include "AliMC.h"
 
 //************* Defaults parameters for reconstruction
 static const Double_t kDefaultMinBendingMomentum = 3.0;
@@ -197,16 +198,16 @@ void AliMUONEventReconstructor::SetReconstructionParametersToDefaults(void)
   // Maximum distance in bending plane:
   // values from TRACKF_STAT, corresponding to (J psi 20cm),
   // scaled to the real distance between chambers in a station
-  fSegmentMaxDistBending[0] = 1.5 *
-    ((&(pMUON->Chamber(1)))->Z() - (&(pMUON->Chamber(0)))->Z()) / 20.0;
-  fSegmentMaxDistBending[1] = 1.5 *
-    ((&(pMUON->Chamber(3)))->Z() - (&(pMUON->Chamber(2)))->Z()) / 20.0;
-  fSegmentMaxDistBending[2] = 3.0 *
-    ((&(pMUON->Chamber(5)))->Z() - (&(pMUON->Chamber(4)))->Z()) / 20.0;
-  fSegmentMaxDistBending[3] = 6.0 *
-    ((&(pMUON->Chamber(7)))->Z() - (&(pMUON->Chamber(6)))->Z()) / 20.0;
-  fSegmentMaxDistBending[4] = 6.0 *
-    ((&(pMUON->Chamber(9)))->Z() - (&(pMUON->Chamber(8)))->Z()) / 20.0;
+  fSegmentMaxDistBending[0] = TMath::Abs( 1.5 *
+    ((&(pMUON->Chamber(1)))->Z() - (&(pMUON->Chamber(0)))->Z()) / 20.0);
+  fSegmentMaxDistBending[1] =  TMath::Abs( 1.5 *
+    ((&(pMUON->Chamber(3)))->Z() - (&(pMUON->Chamber(2)))->Z()) / 20.0);
+  fSegmentMaxDistBending[2] =  TMath::Abs( 3.0 *
+    ((&(pMUON->Chamber(5)))->Z() - (&(pMUON->Chamber(4)))->Z()) / 20.0);
+  fSegmentMaxDistBending[3] =  TMath::Abs( 6.0 *
+    ((&(pMUON->Chamber(7)))->Z() - (&(pMUON->Chamber(6)))->Z()) / 20.0);
+  fSegmentMaxDistBending[4] =  TMath::Abs( 6.0 *
+    ((&(pMUON->Chamber(9)))->Z() - (&(pMUON->Chamber(8)))->Z()) / 20.0);
   
   fBendingResolution = kDefaultBendingResolution;
   fNonBendingResolution = kDefaultNonBendingResolution;
@@ -489,6 +490,7 @@ void AliMUONEventReconstructor::AddHitsForRecFromGEANT(TTree *TH)
     cout << "enter AddHitsForRecFromGEANT with TH: " << TH << endl;
   if (TH == NULL) return;
   AliMUON *pMUON  = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
+  AliMUONData * muondata = pMUON->GetMUONData();
   // Security on MUON ????
   // See whether it could be the same for signal and background ????
   // Loop over tracks in tree
@@ -497,23 +499,26 @@ void AliMUONEventReconstructor::AddHitsForRecFromGEANT(TTree *TH)
     cout << "ntracks: " << ntracks << endl;
   fMuons = 0; //AZ
   for (Int_t track = 0; track < ntracks; track++) {
-    gAlice->ResetHits();
+    muondata->ResetHits();
     TH->GetEvent(track);
     // Loop over hits
     Int_t hit = 0;
     hitBits = 0; // AZ
     chamBits = 0; // AZ
     Int_t itrack = track; //AZ
-    for (AliMUONHit* mHit = (AliMUONHit*) pMUON->FirstHit(-1); 
-        mHit;
-        mHit = (AliMUONHit*) pMUON->NextHit(), hit++) {
-      Int_t ipart = TMath::Abs ((Int_t) mHit->Particle()); //AZ
-      //itrack = mHit->Track(); //AZ
-      //AZNewHitForRecFromGEANT(mHit,track, hit, 1);
-      if (NewHitForRecFromGEANT(mHit,track, hit, 1) && ipart == 13
-      //if (NewHitForRecFromGEANT(mHit,itrack-1, hit, 1) && ipart == 13 
-          && itrack <= 2) chamBits |= BIT(mHit->Chamber()-1); //AZ - set bit
-    } // end of hit loop
+
+    Int_t ihit, nhits=0;
+      nhits = (Int_t) muondata->Hits()->GetEntriesFast();
+      AliMUONHit* mHit=0x0;
+
+      for(ihit=0; ihit<nhits; ihit++) {
+       mHit = static_cast<AliMUONHit*>(muondata->Hits()->At(ihit));
+       Int_t ipart = TMath::Abs ((Int_t) mHit->Particle()); //AZ
+       if (NewHitForRecFromGEANT(mHit,track, hit, 1) && ipart == 13
+           //if (NewHitForRecFromGEANT(mHit,itrack-1, hit, 1) && ipart == 13 
+           && itrack <= 2 && !BIT(mHit->Chamber()-1)  ) chamBits |= BIT(mHit->Chamber()-1); //AZ - set bit
+      }
+
     if (chamBits&3 && chamBits>>2&3 && chamBits>>4&3 && chamBits>>6&3 && 
         chamBits>>8&3 && ((chamBits>>6&3)==3 || (chamBits>>8&3)==3)) 
       fMuons += 1; //AZ
@@ -715,9 +720,6 @@ void AliMUONEventReconstructor::AddHitsForRecFromRawClusters(TTree* TR)
   // Loading MUON subsystem
   AliMUON * pMUON = (AliMUON *) gAlice->GetDetector("MUON");
 
-  //  AliMUON *pMUON  = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
-  // Security on MUON ????
-  //pMUON->ResetRawClusters();
   nTRentries = Int_t(TR->GetEntries());
   if (nTRentries != 1) {
     cout << "Error in AliMUONEventReconstructor::AddHitsForRecFromRawClusters"
@@ -1456,7 +1458,7 @@ void AliMUONEventReconstructor::EventDump(void)
             z, x, y, pX, pY, pZ, c);
   }
   // informations about generated particles
-  np = gAlice->GetNtrack();
+  np = gAlice->GetMCApp()->GetNtrack();
   printf(" **** number of generated particles: %d  \n", np);
   
 //    for (Int_t iPart = 0; iPart < np; iPart++) {