Added hit distributions from all events from MC and data in preparation for sharing...
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Sep 2009 23:21:18 +0000 (23:21 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Sep 2009 23:21:18 +0000 (23:21 +0000)
FMD/analysis/AliFMDAnalysisTaskBackgroundCorrection.cxx
FMD/analysis/AliFMDAnalysisTaskDndeta.cxx
FMD/analysis/AliFMDAnalysisTaskSharing.cxx
FMD/analysis/AliFMDAnalysisTaskSharing.h

index b9fb176..2a14354 100644 (file)
@@ -78,6 +78,7 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
   
   TH2F* hMult = 0;
   TH2F* hHits = 0;
+  TH2F* hHitsNoCuts = 0;
   Int_t nVtxbins = pars->GetNvtxBins();
   
   for(Int_t det =1; det<=3;det++)
@@ -103,9 +104,20 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
                              hBg->GetXaxis()->GetXmax(),
                              nSec, 0, 2*TMath::Pi());
            
+           /*  hHitsNoCuts  = new TH2F(Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i),
+                                   hBg->GetNbinsX(),
+                                   hBg->GetXaxis()->GetXmin(),
+                                   hBg->GetXaxis()->GetXmax(),
+                                   nSec, 0, 2*TMath::Pi());
+           
+           */
            hHits->Sumw2();
+           //hHitsNoCuts->Sumw2();
+           
            fHitList->Add(hHits);
            fOutputList->Add(hHits);
+           // fHitList->Add(hHitsNoCuts);
+           //  fOutputList->Add(hHitsNoCuts);
            
          }
        } 
@@ -200,7 +212,11 @@ void AliFMDAnalysisTaskBackgroundCorrection::Terminate(Option_t */*option*/) {
       for(Int_t i =0; i<nVtxbins; i++) {
        TH2F* hHits      = (TH2F*)fOutputList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i));
        TH1D* hHitsproj  = hHits->ProjectionX(Form("hits_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hHits->GetNbinsY());
+       TH1D* hHitsNoCuts = (TH1D*)hHitsproj->Clone(Form("hits_NoCuts_FMD%d%c_vtxbin%d_proj",det,ringChar,i));
+       
+       hHitsNoCuts->Scale(1/pars->GetEventSelectionEfficiency(i));
        fHitList->Add(hHitsproj);
+       fHitList->Add(hHitsNoCuts);
        
       }
     }
index 5c488de..8e78354 100644 (file)
@@ -235,7 +235,7 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
   Double_t delta           = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
   Double_t vertexBinDouble = (vertex.At(2) + pars->GetVtxCutZ()) / delta;
   Int_t    vertexBin       = (Int_t)vertexBinDouble;
-  
+    
   Bool_t firstTrack = kTRUE;
   
   // we loop over the primaries only unless we need the hits (diagnostics running slowly)
index c8d39a7..cd23865 100644 (file)
@@ -24,6 +24,7 @@
 #include "AliHeader.h"
 #include "AliStack.h"
 #include "AliMCParticle.h"
+#include "AliFMDStripIndex.h"
 
 ClassImp(AliFMDAnalysisTaskSharing)
 
@@ -39,7 +40,8 @@ AliFMDAnalysisTaskSharing::AliFMDAnalysisTaskSharing()
   fDiagList(0),
   fStandalone(kTRUE),
   fEsdVertex(0),
-  fStatus(kTRUE)
+  fStatus(kTRUE),
+  fLastTrackByStrip(0)
 {
   // Default constructor
   DefineInput (0, AliESDEvent::Class());
@@ -61,7 +63,8 @@ AliFMDAnalysisTaskSharing::AliFMDAnalysisTaskSharing(const char* name, Bool_t SE
     fDiagList(0),
     fStandalone(kTRUE),
     fEsdVertex(0),
-    fStatus(kTRUE)
+    fStatus(kTRUE),
+    fLastTrackByStrip(0)
 {
   fStandalone = SE;
   if(fStandalone) {
@@ -95,6 +98,7 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects()
   hPrimary->Sumw2();
   fDiagList->Add(hPrimary);
   TH1F* hPrimVertexBin = 0;
+  TH1F* hHits = 0;
   for(Int_t i = 0; i< pars->GetNvtxBins(); i++) {
     
     hPrimVertexBin = new TH1F(Form("primmult_NoCuts_vtxbin%d",i),
@@ -126,7 +130,17 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects()
       fDiagList->Add(hEdist);
       fDiagList->Add(hEdist_after);
       //fDiagList->Add(hNstripsHit);
+      
+      for(Int_t i = 0; i< pars->GetNvtxBins(); i++) {
+       hHits  = new TH1F(Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),
+                         hBg->GetNbinsX(),
+                         hBg->GetXaxis()->GetXmin(),
+                         hBg->GetXaxis()->GetXmax());
+       hHits->Sumw2();
+       fDiagList->Add(hHits);
 
+      }
+      
     }
   }
   TH1F*  nMCevents = new TH1F("nMCEventsNoCuts","nMCEventsNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins());
@@ -161,12 +175,12 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
     ProcessPrimary();
   
   Bool_t isTriggered = pars->IsEventTriggered(fESD);
-  
   if(!isTriggered) {
     fStatus = kFALSE;
     return;
-  }
-  else
+   }
+   else
     fStatus = kTRUE;
   
   if(vertex[0] == 0 && vertex[1] == 0 && vertex[2] == 0) {
@@ -361,7 +375,7 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   AliMCEvent* mcEvent = eventHandler->MCEvent();
   if(!mcEvent)
     return;
-  
+  fLastTrackByStrip.Reset(-1);
   AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
   
   AliMCParticle* particle = 0;
@@ -376,6 +390,7 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   
   TArrayF vertex;
   genHeader->PrimaryVertex(vertex);
+  
   if(TMath::Abs(vertex.At(2)) > pars->GetVtxCutZ())
     return;
   
@@ -386,6 +401,8 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   Bool_t firstTrack = kTRUE;
   
   Int_t nTracks = stack->GetNprimary();
+  if(pars->GetProcessHits())
+    nTracks = stack->GetNtrack();
   TH1F* nMCevents = (TH1F*)fDiagList->FindObject("nMCEventsNoCuts");
   for(Int_t i = 0 ;i<nTracks;i++) {
     particle = (AliMCParticle*) mcEvent->GetTrack(i);
@@ -405,6 +422,43 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
       }
     
     }
+     if(pars->GetProcessHits()) {
+           
+      for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
+       
+       AliTrackReference* ref = particle->GetTrackReference(j);
+       UShort_t det,sec,strip;
+       Char_t   ring;
+       if(ref->DetectorId() != AliTrackReference::kFMD)
+         continue;
+       AliFMDStripIndex::Unpack(ref->UserId(),det,ring,sec,strip);
+       Float_t thisStripTrack = fLastTrackByStrip(det,ring,sec,strip);
+       if(particle->Charge() != 0 && i != thisStripTrack ) {
+         //Double_t x,y,z;
+         
+         Float_t   eta   = pars->GetEtaFromStrip(det,ring,sec,strip,vertex.At(2));//-1*TMath::Log(TMath::Tan(0.5*theta));
+         TH1F* hHits = (TH1F*)fDiagList->FindObject(Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ring,vertexBin));
+         
+       
+         hHits->Fill(eta);
+         
+         Float_t nstrips = (ring =='O' ? 256 : 512);
+         
+         fLastTrackByStrip(det,ring,sec,strip) = (Float_t)i;
+       
+         if(strip >0)
+           fLastTrackByStrip(det,ring,sec,strip-1) = (Float_t)i;
+         if(strip < (nstrips - 1))
+           fLastTrackByStrip(det,ring,sec,strip+1) = (Float_t)i;
+         
+       }
+      
+       
+      }
+      
+      
+    }
+    
   }
 
 }
index 11963c3..a1fe47c 100644 (file)
@@ -10,6 +10,7 @@
 #include "AliESDFMD.h"
 #include "TTree.h"
 #include "AliESDEvent.h"
+#include "AliFMDFloatMap.h"
 class TChain;
 class AliAODEvent;
 class AliESDVertex;
@@ -73,7 +74,8 @@ class AliFMDAnalysisTaskSharing : public AliAnalysisTask
     Bool_t        fStandalone;
     AliESDVertex* fEsdVertex;
     Bool_t        fStatus;
-
+    AliFMDFloatMap fLastTrackByStrip;
+    
     ClassDef(AliFMDAnalysisTaskSharing, 0); // Analysis task for FMD analysis
 };