scripts/Poisson.C

Go to the documentation of this file.
00001 //____________________________________________________________________
00002 //
00003 // $Id: Poisson.C,v 1.1 2006/03/17 11:42:24 cholm Exp $
00004 //
00005 // Script that contains a class to draw hits, using the
00006 // AliFMDInputHits class in the util library. 
00007 //
00008 // It draws the energy loss versus the p/(mq^2).  It can be overlayed
00009 // with the Bethe-Bloc curve to show how the simulation behaves
00010 // relative to the expected. 
00011 //
00012 // Use the script `Compile.C' to compile this class using ACLic. 
00013 //
00014 #include <AliESDFMD.h>
00015 #include <AliFMDInput.h>
00016 #include <TH2D.h>
00017 #include <TStyle.h>
00018 #include <TArrayF.h>
00019 #include <iostream>
00020 
00031 class Poisson : public AliFMDInput
00032 {
00033 private:
00034   TH2D*  fEmpty; // Histogram 
00035   TH2D*  fTotal; // Histogram 
00036   TH2D*  fMult;  // Histogram 
00037   TFile* fFile;  // File 
00038   Int_t  fEv;    // Event number
00039 public:
00040   Poisson(Double_t threshold=.3,
00041           Int_t nEta=120, Float_t minEta=-6, Float_t maxEta=6, 
00042           Int_t nPhi=4,   Float_t minPhi=0,  Float_t maxPhi=2*TMath::Pi())
00043     : fFile(0), fEv(0)
00044   { 
00045     AddLoad(kESD);
00046 
00047     fEmpty = new TH2D("empty", "# of empty strips", nEta, minEta, maxEta, 
00048                       nPhi, minPhi, maxPhi);
00049     fTotal = new TH2D("total", "Total # of strips", nEta, minEta, maxEta, 
00050                       nPhi, minPhi, maxPhi);
00051     fMult = new TH2D("mult", "Multiplicity", nEta, minEta, maxEta, 
00052                       nPhi, minPhi, maxPhi);
00053     fEmpty->SetXTitle("#eta");  
00054     fEmpty->SetYTitle("#phi"); 
00055     fEmpty->SetZTitle("N");
00056     fTotal->SetXTitle("#eta");  
00057     fTotal->SetYTitle("#phi"); 
00058     fTotal->SetZTitle("N");
00059     fMult->SetXTitle("#eta");  
00060     fMult->SetYTitle("#phi"); 
00061     fMult->SetZTitle("<M_{ch}>");
00062 
00063   }
00064   Bool_t Init() 
00065   {
00066     if (!AliFMDInput::Begin(event)) return kFALSE;
00067     fFile = TFile::Open("poisson.root");
00068     if (!fFile) return kFALSE;
00069     return kTRUE;
00070   }
00074   Bool_t Begin(Int_t event) 
00075   {
00076     if (!AliFMDInput::Begin(event)) return kFALSE;
00077     fEv = event;
00078     fEmpty->Clear();
00079     fTotal->Clear();
00080     fMult->Clear();
00081     return kTRUE;
00082   }
00083   Bool_t ProcessESD(AliESDFMDHit* esd)
00084   {
00085     for (UShort_t det = 1; det <= esd->MaxDetector(); det++) {
00086       for (UShort_t rng = 0; rng < esd->MaxRing(); rng++) {
00087         Char_t ring = (rng == 0 ? 'I' : 'O');
00088         // Not covered channels 
00089         for (UShort_t sec = 0; sec < esd->MaxSector(); sec++) {
00090           for (UShort_t str = 0; str < esd->MaxStrip(); str++) {
00091             Float_t mult = esd->Multiplicity(det, ring, sec, str);
00092             Float_t eta  = esd->Eta(det, ring, sec, str);
00093             // Dead channels, or not covered. 
00094             if (mult >= AliESDFMD::kInvalidMult) continue;
00095             if (esd  >= AliESDFMD::kInvalidEta) continue;
00096             Float_t phi;
00097             switch (ring) { 
00098             case 'I':  phi = (sec + .5) * 2 * TMath::Pi() / 20; break;
00099             case 'O':  phi = (sec + .5) * 2 * TMath::Pi() / 40; break;
00100             }
00101             fTotal->Fill(eta, phi);
00102             if (mult < threshold) fEmpty->Fill(eta, phi);
00103           } // Loop over strips
00104         } // Loop over sectors
00105       } // Loop over rings
00106     } // Loop over detectors
00107   }
00116   Bool_t End() 
00117   {
00118     for (Int_t etaBin = 1; etaBin <= fEmpty->GetNbinsX(); etaBin++) {
00119       for (Int_t phiBin = 1; phiBin <= fEmpty->GetNbinsY(); phiBin++) {
00120         Double_t empty  = fEmpty->GetBinContent(etaBin, phiBin);
00121         Double_t total  = fTotal->GetBinContent(etaBin, phiBin);
00122         Double_t lambda = (empty > 0 ? - TMath::Log(empty / nTotal) : 1);
00123         Double_t mult   = lambda * nTotal;
00124         fMult->SetBinContent(etaBin, phiBin, mult);
00125       }
00126     }
00127     fFile->cd();
00128     fMult->Write(Form("mult%03d", fEv));
00129     return AliFMDInput::End();
00130   }
00131   
00132   Bool_t Finish()
00133   {
00134     fFile->Write();
00135     fFile->Close();
00136     fFile = 0;
00137     return AliFMDInput::Finish();
00138   }
00139   ClassDef(Poisson,0);
00140 };
00141 
00142 //____________________________________________________________________
00143 //
00144 // EOF
00145 //

Generated on Fri Mar 24 17:11:21 2006 for ALICE FMD Off-line by  doxygen 1.4.6