scripts/DrawDigitsRecs.C

Go to the documentation of this file.
00001 //____________________________________________________________________
00002 //
00003 // $Id: DrawDigitsRecs.C,v 1.2 2006/03/17 11:42:24 cholm Exp $
00004 //
00005 // Script that contains a class to draw eloss from hits, versus ADC
00006 // counts from digits, using the 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 <TH2D.h>
00015 #include <AliFMDHit.h>
00016 #include <AliFMDDigit.h>
00017 #include <AliFMDInput.h>
00018 #include <AliFMDUShortMap.h>
00019 #include <AliFMDFloatMap.h>
00020 #include <AliFMDMultStrip.h>
00021 #include <AliFMDMultRegion.h>
00022 #include <iostream>
00023 #include <TStyle.h>
00024 #include <TArrayF.h>
00025 #include <TCanvas.h>
00026 
00037 class DrawDigitsRecs : public AliFMDInputDigits
00038 {
00039 private:
00040   TH2D* fAdcVsSingle; // Histogram 
00041   AliFMDUShortMap fMap;
00042 public:
00043   //__________________________________________________________________
00044   TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max) 
00045   {
00046     TArrayF bins(n+1);
00047     Float_t dp   = n / TMath::Log10(max / min);
00048     Float_t pmin = TMath::Log10(min);
00049     bins[0]      = min;
00050     for (Int_t i = 1; i < n+1; i++) {
00051       Float_t p = pmin + i / dp;
00052       bins[i]   = TMath::Power(10, p);
00053     }
00054     return bins;
00055   }
00056   //__________________________________________________________________
00057   DrawDigitsRecs(Int_t m=1100, Double_t amin=-0.5, Double_t amax=1099.5,
00058                  Int_t n=105, Double_t mmin=-0.5, Double_t mmax=20.5) 
00059   { 
00060     AddLoad(kRecPoints);
00061     fAdcVsSingle = new TH2D("adcVsSingle", "ADC vs. Multiplicity (strip)", 
00062                             m, amin, amax, n, mmin, mmax);
00063     fAdcVsSingle->SetXTitle("ADC value");
00064     fAdcVsSingle->SetYTitle("Strip Multiplicity");
00065   }
00066   //__________________________________________________________________
00070   Bool_t Begin(Int_t ev) 
00071   {
00072     fMap.Reset();
00073     return AliFMDInputDigits::Begin(ev);
00074   }
00075   //__________________________________________________________________
00076   Bool_t ProcessDigit(AliFMDDigit* digit) 
00077   {
00078     // Cache the energy loss 
00079     if (!digit) return kFALSE;
00080     UShort_t det = digit->Detector();
00081     Char_t   rng = digit->Ring();
00082     UShort_t sec = digit->Sector();
00083     UShort_t str = digit->Strip();
00084     if (str > 511) {
00085       AliWarning(Form("Bad strip number %d in digit", str));
00086       return kTRUE;
00087     }
00088     fMap(det, rng, sec, str) = digit->Counts();
00089     return kTRUE;
00090   }
00091   //__________________________________________________________________
00092   Bool_t ProcessRecPoint(AliFMDRecPoint* single)
00093   {
00094     if (!single) continue;
00095     UShort_t det = single->Detector();
00096     Char_t   rng = single->Ring();
00097     UShort_t sec = single->Sector();
00098     UShort_t str = single->Strip();
00099     if (str > 511) {
00100       AliWarning(Form("Bad strip number %d in single", str));
00101       continue;
00102     }
00103     fAdcVsSingle->Fill(fMap(det, rng, sec, str), single->Particles());
00104     return kTRUE;
00105   }
00106   //__________________________________________________________________
00107   Bool_t Finish()
00108   {
00109     gStyle->SetPalette(1);
00110     gStyle->SetOptTitle(0);
00111     gStyle->SetCanvasColor(0);
00112     gStyle->SetCanvasBorderSize(0);
00113     gStyle->SetPadColor(0);
00114     gStyle->SetPadBorderSize(0);
00115 
00116     fAdcVsSingle->SetStats(kFALSE);
00117     fAdcVsSingle->Draw("COLZ");
00118     return kTRUE;
00119   }
00120 
00121   ClassDef(DrawDigitsRecs,0);
00122   
00123 };
00124 
00125 //____________________________________________________________________
00126 //
00127 // EOF
00128 //

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