]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixes for coverity checks.
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Nov 2011 11:49:50 +0000 (11:49 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Nov 2011 11:49:50 +0000 (11:49 +0000)
Added QA script Draw123.C to draw eloss from single, double, and triple hits
Added QA shell script to draw all QA stuff and put the result in a PDF

45 files changed:
FMD/AliFMDBaseDA.h
FMD/AliFMDBaseDigitizer.cxx
FMD/AliFMDBoolMap.cxx
FMD/AliFMDCalibGain.cxx
FMD/AliFMDCalibPedestal.cxx
FMD/AliFMDDetector.cxx
FMD/AliFMDEdepHitPair.h
FMD/AliFMDEdepMap.cxx
FMD/AliFMDGeometry.cxx
FMD/AliFMDHitDigitizer.cxx
FMD/AliFMDIndex.cxx
FMD/AliFMDIndex.h
FMD/AliFMDUShortMap.cxx
PWG2/FORWARD/analysis2/AliBasedNdetaTask.cxx
PWG2/FORWARD/analysis2/AliCentralMCCorrectionsTask.cxx
PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliFMDCorrELossFit.cxx
PWG2/FORWARD/analysis2/AliFMDCorrector.cxx
PWG2/FORWARD/analysis2/AliFMDDensityCalculator.cxx
PWG2/FORWARD/analysis2/AliFMDEnergyFitter.cxx
PWG2/FORWARD/analysis2/AliFMDEnergyFitterTask.cxx
PWG2/FORWARD/analysis2/AliFMDEventInspector.cxx
PWG2/FORWARD/analysis2/AliFMDHistCollector.cxx
PWG2/FORWARD/analysis2/AliFMDMCCorrector.cxx
PWG2/FORWARD/analysis2/AliFMDMCTrackDensity.cxx
PWG2/FORWARD/analysis2/AliFMDMultCuts.cxx
PWG2/FORWARD/analysis2/AliFMDSharingFilter.cxx
PWG2/FORWARD/analysis2/AliForwardFlowTaskQC.cxx
PWG2/FORWARD/analysis2/AliForwardMCCorrectionsTask.cxx
PWG2/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliForwardMultiplicityBase.cxx
PWG2/FORWARD/analysis2/AliForwardMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliForwardQATask.cxx
PWG2/FORWARD/analysis2/AliForwardUtil.h
PWG2/FORWARD/analysis2/AliPoissonCalculator.cxx
PWG2/FORWARD/analysis2/AliSPDMCTrackDensity.cxx
PWG2/FORWARD/analysis2/corrs/DrawAnaELoss.C
PWG2/FORWARD/analysis2/qa/Draw123.C [new file with mode: 0644]
PWG2/FORWARD/analysis2/qa/DrawBeforeAfter.C
PWG2/FORWARD/analysis2/qa/DrawELossPoisson.C
PWG2/FORWARD/analysis2/qa/DrawNeighbors.C
PWG2/FORWARD/analysis2/qa/DrawOccupancy.C
PWG2/FORWARD/analysis2/qa/DrawQA.C
PWG2/FORWARD/analysis2/qa/DrawQA.sh [new file with mode: 0755]
PWG2/FORWARD/analysis2/qa/DrawRecAnaEloss.C

index dce3913095bcdfb736d0f1095ee42f734be468e0..36fda2ee4f670fd500913717173d7ee69eff3b91 100644 (file)
@@ -55,6 +55,7 @@ public:
    * 
    */  
   ~AliFMDBaseDA() ;
+  AliFMDBaseDA& operator=(const AliFMDBaseDA&) { return *this; }
   /** 
    * Run this DA
    * 
index a689e00b0b58ef00840cd2c00f380fb4cc8c4de6..7dcf7e416decb52782dd8768b4ce09d451f01a34 100644 (file)
@@ -285,6 +285,7 @@ AliFMDBaseDigitizer::operator=(const AliFMDBaseDigitizer& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this; 
   AliDigitizer::operator=(o);
   fRunLoader      = o.fRunLoader;
   fEdep           = o.fEdep;
index 3a7b86e464906491c36ff225b72064362de89106..16f20c67b4101abc6dc6ee7ced557ac6b07d837e 100644 (file)
@@ -85,6 +85,7 @@ AliFMDBoolMap&
 AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
 {
   // Assignment operator 
+  if (&other == this) return *this; 
   fMaxDetectors = other.fMaxDetectors;
   fMaxRings     = other.fMaxRings;
   fMaxSectors   = other.fMaxSectors;
index 42f14a5efcb34c6dc5a894657930224c07dc6ef5..72ac806bd7f9c7cca6620a4fd0909d971e739def 100644 (file)
@@ -65,6 +65,7 @@ AliFMDCalibGain&
 AliFMDCalibGain::operator=(const AliFMDCalibGain& o)
 {
   // Assignment operator 
+  if (&o == this) return *this; 
   fValue     = o.fValue;
   fThreshold = o.fThreshold;
   return (*this);
@@ -103,6 +104,7 @@ namespace {
     {}
     MakeDead& operator=(const MakeDead& other) 
     { 
+      if (&other == this) return *this; 
       fDead   = other.fDead;
       fMin    = other.fMin;
       fMax    = other.fMax;
index 6735bc1e868247085919cd695a048a38354fce5c..9ef31e30ca5f76747aa1be3bff3716cc46cfea89 100644 (file)
@@ -64,6 +64,7 @@ AliFMDCalibPedestal&
 AliFMDCalibPedestal::operator=(const AliFMDCalibPedestal& o)
 {
   // Assignment operator 
+  if (&o == this) return *this; 
   fValue = o.fValue;
   fWidth = o.fWidth;
   return (*this);
@@ -111,6 +112,7 @@ namespace {
     {}
     MakeDead& operator=(const MakeDead& other) 
     { 
+      if (&other == this) return *this; 
       fDead   = other.fDead;
       fMax    = other.fMax;
       fCount  = other.fCount;
index b9d636f11a29834968d0141409bb8bfa55ed57a2..78cc6ffd1e8d988bcdb25fa3a531ba6148da2e42 100644 (file)
@@ -108,6 +108,7 @@ AliFMDDetector&
 AliFMDDetector::operator=(const AliFMDDetector& other)
 {
   // Assignment operator
+  if (&other == this) return *this; 
   SetName(other.GetName());
   SetTitle(other.GetTitle());
   fId              = other.fId;
index 6c6b41cef84bf3d388d524bb0178356cb1c52570..88d0c598101b2067d155cdc7a1e66436d9a1a578 100644 (file)
@@ -50,6 +50,7 @@ public:
       @return Reference to this object */
   AliFMDEdepHitPair& operator=(const AliFMDEdepHitPair& o) 
   { 
+    if (&o == this) return *this; 
     fEdep   = o.fEdep; 
     fN      = o.fN; 
     fNPrim  = o.fNPrim;
index 634161935fa39500a396f9d0052c2791676fb8eb..7a34c10ea989d6bff865fa2f94124895fb97831e 100644 (file)
@@ -87,6 +87,7 @@ AliFMDEdepMap&
 AliFMDEdepMap::operator=(const AliFMDEdepMap& other) 
 {
   // Assignment operator
+  if (&other == this) return *this; 
   fMaxDetectors = other.fMaxDetectors;
   fMaxRings     = other.fMaxRings;
   fMaxSectors   = other.fMaxSectors;
index 7844a482ec3e9ca69ac92ddf2a37eb3abc0a9665..8050cc0d98aedfcb0e66f4f2c535d894f5a92920 100644 (file)
@@ -216,6 +216,7 @@ AliFMDGeometry::operator=(const AliFMDGeometry& other)
   // Return:
   //    reference to this.  
   //
+  if (&other == this) return *this; 
   fUseFMD1             = other.fUseFMD1; 
   fUseFMD2             = other.fUseFMD2; 
   fUseFMD3             = other.fUseFMD3; 
index ad7d7f33459d65fd1a198bbb1253b45ac2ddab84..3c4e1b6ae7e39af8d33ccdb722c3f7d46b94e50f 100644 (file)
@@ -231,6 +231,7 @@ AliFMDHitDigitizer::operator=(const AliFMDHitDigitizer& o)
    * @param o Object to assign from 
    * @return Reference to this 
    */
+  if (&o == this) return *this; 
   AliFMDBaseDigitizer::operator=(o);
   fHoldTime    = o.fHoldTime;
   fOutput      = o.fOutput;
index 919b2b19042f307e07cc21aa8bcaf55ae20ef615..16e80c3e00459931516638c1e9dac6ee31aeaa6d 100644 (file)
@@ -95,6 +95,7 @@ AliFMDIndex&
 AliFMDIndex::operator=(const AliFMDIndex& o)
 {
   // Assignment operator 
+  if (&o == this) return *this; 
   fDetector = o.fDetector;
   fRing     = o.fRing;
   fSector   = o.fSector;
index a16f0bfe66b81bdd270550076e9c66e869c45884..dac5c79efe91f1081cb491261a53374f818dd74b 100644 (file)
@@ -121,6 +121,12 @@ public:
   {}
   /** DTOR */
   virtual ~AliFMDObjIndex() {}
+  AliFMDObjIndex& operator=(const AliFMDObjIndex& o) 
+  {
+    if (&o == this) return *this;
+    AliFMDIndex::operator=(o);
+    return *this; 
+  }
   /** @return name */
   virtual const char* GetName() const { return AliFMDIndex::Name(); }
   /** sort compare for TCollection's
index b688651c947ae5bc29c8e4f0d4839f1e5f0a06ce..b0e75f6e94d2238484e0c772ea0b97981f7dfc0d 100644 (file)
@@ -86,6 +86,7 @@ AliFMDUShortMap&
 AliFMDUShortMap::operator=(const AliFMDUShortMap& other) 
 {
   // Assignment operator
+  if (&other == this) return *this; 
   fMaxDetectors = other.fMaxDetectors;
   fMaxRings     = other.fMaxRings;
   fMaxSectors   = other.fMaxSectors;
index c543f4bad811069c5cced87583359378ddb3d7a8..ac94b2ccb44defb37aa675bc7c0e91b1d67fac20 100644 (file)
@@ -1229,6 +1229,7 @@ AliBasedNdetaTask::CentralityBin::operator=(const CentralityBin& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this; 
   SetName(o.GetName());
   SetTitle(o.GetTitle());
   fSums      = o.fSums;
index dcbaf64036b27e8796f16bb31128cd39fed7f910..7c5581b6be6d3ebc68d7078eb4fd9ce3d3166ada 100644 (file)
@@ -138,6 +138,7 @@ AliCentralMCCorrectionsTask::operator=(const AliCentralMCCorrectionsTask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this; 
   fInspector         = o.fInspector;
   fTrackDensity      = o.fTrackDensity;
   fVtxBins           = o.fVtxBins;
@@ -542,6 +543,7 @@ AliCentralMCCorrectionsTask::VtxBin::VtxBin(const VtxBin& o)
 AliCentralMCCorrectionsTask::VtxBin&
 AliCentralMCCorrectionsTask::VtxBin::operator=(const VtxBin& o)
 {
+  if (&o == this) return *this; 
   TNamed::operator=(o);
   fHits    = 0;
   fPrimary = 0;
index 89866e465d5d0422c037b9fa8af38b1ce7fcd32f..6aa3c7986d21ae5eebd5f3debdb27e119e796fcc 100644 (file)
@@ -107,6 +107,7 @@ AliCentralMultiplicityTask::operator=(const AliCentralMultiplicityTask& o)
   // 
   // Assignment operator 
   //
+  if (&o == this) return *this; 
   fInspector         = o.fInspector;
   fData              = o.fData;
   fList              = o.fList;
@@ -570,6 +571,7 @@ AliCentralMultiplicityTask::Manager::operator=(const Manager& o)
   //
   // Assignment operator  
   // 
+  if (&o == this) return *this; 
   fAcceptancePath = o.fAcceptancePath;
   fSecMapPath     = o.fSecMapPath;
   fAcceptance     = o.fAcceptance;
index 0c2d89c2dd6d427350d65956217b9aa1172dc1bc..872ee734c3f05d1bc5afdf834569142fa0e87cf1 100644 (file)
@@ -203,6 +203,7 @@ AliFMDCorrELossFit::ELossFit::operator=(const ELossFit& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this; 
   fN      = o.fN;
   fNu     = o.fNu;
   fChi2           = o.fChi2;
@@ -606,6 +607,7 @@ AliFMDCorrELossFit::operator=(const AliFMDCorrELossFit& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this; 
   fRings = o.fRings;
   fLowCut = o.fLowCut;
   SetEtaAxis(o.fEtaAxis.GetNbins(), o.fEtaAxis.GetXmin(), o.fEtaAxis.GetXmax());
index 62a6f29f3c055eba89a4594263feff7672aef4d3..637599b86ea3fbdb1c1377337721124d710d2dd6 100644 (file)
@@ -95,6 +95,7 @@ AliFMDCorrector::operator=(const AliFMDCorrector& o)
   // 
   // Parameters:
   //   o   Object to assign from 
+  if (&o == this) return *this; 
   TNamed::operator=(o);
 
   fDebug   = o.fDebug;
@@ -415,6 +416,7 @@ AliFMDCorrector::RingHistos::operator=(const RingHistos& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this; 
   AliForwardUtil::RingHistos::operator=(o);
   
   if (fDensity) delete fDensity;
index e383506b9f1069780eacfbe7572fce32d047f9c4..c96cdb64ad69c162a77830bc390082d952ca1d66 100644 (file)
@@ -178,6 +178,7 @@ AliFMDDensityCalculator::operator=(const AliFMDDensityCalculator& o)
   // Return:
   //    Reference to this object
   //
+  if (&o == this) return *this; 
   TNamed::operator=(o);
 
   fDebug              = o.fDebug;
@@ -1075,6 +1076,7 @@ AliFMDDensityCalculator::RingHistos::operator=(const RingHistos& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this; 
   AliForwardUtil::RingHistos::operator=(o);
   
   if (fEvsN)           delete fEvsN;
index efcce5232c02688799f00fd53d6aafb36de7056b..152784c24c1d45558e6fb67cf54d6cc4370a0b4e 100644 (file)
@@ -141,6 +141,7 @@ AliFMDEnergyFitter::operator=(const AliFMDEnergyFitter& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this; 
   TNamed::operator=(o);
 
   fLowCut        = o.fLowCut;
@@ -545,6 +546,7 @@ AliFMDEnergyFitter::RingHistos::operator=(const RingHistos& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this; 
   AliForwardUtil::RingHistos::operator=(o);
   
   if (fEDist) delete fEDist;
index 4a91981e035013e8804ebf4721c6c28358f327a4..5178a5dcb54fb9a8831600637998cc9fa9ccc1c2 100644 (file)
@@ -99,6 +99,7 @@ AliFMDEnergyFitterTask::operator=(const AliFMDEnergyFitterTask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this; 
   AliAnalysisTaskSE::operator=(o);
 
   fFirstEvent        = o.fFirstEvent;
index ba81ed383b56af96b27ebf80722b10247a16ec3d..a316282d9889ad12bdb94d465bad30eb53afd59d 100644 (file)
@@ -144,6 +144,7 @@ AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
   // Return:
   //    Reference to this object
   //
+  if (&o == this) return *this; 
   TNamed::operator=(o);
   fHEventsTr         = o.fHEventsTr;
   fHEventsTrVtx      = o.fHEventsTrVtx;
index 7d73098f4c44f26cab4c535a9593b6aeecb24c35..103c621ceae9302c6756403f2d25c8bfbbfbff12 100644 (file)
@@ -95,6 +95,7 @@ AliFMDHistCollector::operator=(const AliFMDHistCollector& o)
   // Return:
   //    Reference to this object
   //
+  if (&o == this) return *this; 
   TNamed::operator=(o);
 
   fNCutBins       = o.fNCutBins;
index e12ec02d19710088177e9972e6dd267ba1c02657..ca4ef2d0314285a4216e201a0a6ab3f3d6ba19ff 100644 (file)
@@ -60,6 +60,7 @@ AliFMDMCCorrector::operator=(const AliFMDMCCorrector& o)
   // Return:
   //    Reference to this object
   //
+  if (&o == this) return *this; 
   AliFMDCorrector::operator=(o);
   fSecondaryForMC = o.fSecondaryForMC;
   return *this;
index 0cf1e6e6aa6eb3e7693124d8a0422090cf4920d3..63295dc558cd8cee5f120bcb6b3beb1897b9bf0a 100644 (file)
@@ -63,6 +63,7 @@ AliFMDMCTrackDensity&
 AliFMDMCTrackDensity::operator=(const AliFMDMCTrackDensity& o)
 {
   // Assignment operator 
+  if (&o == this) return *this; 
   TNamed::operator=(o);
   fUseOnlyPrimary       = o.fUseOnlyPrimary;
   fMaxConsequtiveStrips = o.fMaxConsequtiveStrips;
index ec4b8228984ce457738e875cd15a16643a522285..10161fa0153537f65f9ba4e9d90bd07f1c535302 100644 (file)
@@ -32,6 +32,7 @@ AliFMDMultCuts::AliFMDMultCuts(const AliFMDMultCuts& o)
 AliFMDMultCuts&
 AliFMDMultCuts::operator=(const AliFMDMultCuts& o)
 {
+  if (&o == this) return *this; 
   fMPVFraction  = o.fMPVFraction;
   fNXi          = o.fNXi;
   fIncludeSigma = o.fIncludeSigma;
index 978a1d926f9bf990ef0c9c5abcaea26f2ad692fa..32b9c5d5c673e04da9dc3ab96b23fe5f9416fa08 100644 (file)
@@ -161,6 +161,7 @@ AliFMDSharingFilter::operator=(const AliFMDSharingFilter& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this;
   TNamed::operator=(o);
 
   fCorrectAngles                = o.fCorrectAngles;
@@ -1163,6 +1164,7 @@ AliFMDSharingFilter::RingHistos::operator=(const RingHistos& o)
   // Return:
   //    Reference to this 
   //
+  if (&o == this) return *this;
   AliForwardUtil::RingHistos::operator=(o);
   fDet = o.fDet;
   fRing = o.fRing;
index 951d3b1660ad673981d380aef997b822ffabf777..e2813fdf41f7af0b0e56529146f4c117414e217b 100644 (file)
@@ -57,6 +57,7 @@ AliForwardFlowTaskQC::AliForwardFlowTaskQC()
   // 
   // Default constructor
   //
+  for (Int_t n = 0; n <= 6; n++) fv[n] = kTRUE;
 }
 //_____________________________________________________________________
 AliForwardFlowTaskQC::AliForwardFlowTaskQC(const char* name) :
index 0bc47389e86eb8c2d4d8723a16f932c84d2b1a4c..9a12d40526151d864da28295645c57841d9b0e66 100644 (file)
@@ -140,6 +140,7 @@ AliForwardMCCorrectionsTask::operator=(const AliForwardMCCorrectionsTask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this;
   fInspector         = o.fInspector;
   fTrackDensity      = o.fTrackDensity;
   fESDFMD            = o.fESDFMD;
@@ -565,6 +566,7 @@ AliForwardMCCorrectionsTask::VtxBin::VtxBin(const VtxBin& o)
 AliForwardMCCorrectionsTask::VtxBin&
 AliForwardMCCorrectionsTask::VtxBin::operator=(const VtxBin& o)
 {
+  if (&o == this) return *this;
   TNamed::operator=(o);
   fHists   = o.fHists;
   fPrimary = 0;
index 185feef55080b72e82043d9494666c82af8b0135..1fcad32d8de9590f52693dcb1e0efa781c8bdce0 100644 (file)
@@ -124,6 +124,7 @@ AliForwardMCMultiplicityTask::operator=(const AliForwardMCMultiplicityTask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this;
   AliForwardMultiplicityBase::operator=(o);
 
   fHData             = o.fHData;
index 7230dc5d588880a1e1ca70a156ff962798ba8cfa..34218555c6543cd9a6fa55f9b1189906c9bda5b9 100644 (file)
@@ -49,6 +49,7 @@ AliForwardMultiplicityBase::AliForwardMultiplicityBase(const char* name)
 AliForwardMultiplicityBase& 
 AliForwardMultiplicityBase::operator=(const AliForwardMultiplicityBase& o)
 {
+  if (&o == this) return *this;
   fEnableLowFlux = o.fEnableLowFlux;
   fFirstEvent    = o.fFirstEvent;
   fCorrManager   = o.fCorrManager;
index ca934d6fb073bf50feabcc3693833303fce9ac03..b7508e60aa9a8c1d04a9f3930ac645bb95d1dd3d 100644 (file)
@@ -108,6 +108,7 @@ AliForwardMultiplicityTask::operator=(const AliForwardMultiplicityTask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this;
   AliForwardMultiplicityBase::operator=(o);
 
   fHData             = o.fHData;
index a2e16ffdf05ab3a84849ad56319214a704669b8b..807e96e169cd3395e0a3f6634125c22647dbf4be 100644 (file)
@@ -120,6 +120,7 @@ AliForwardQATask::operator=(const AliForwardQATask& o)
   // Return:
   //    Reference to this object 
   //
+  if (&o == this) return *this;
   AliAnalysisTaskSE::operator=(o);
 
   fEnableLowFlux     = o.fEnableLowFlux;
index f2728ea53b46c1bbd45324d78dfedbf5a367bf87..cef26e0b0afee8ccdcefe24ca35108fe025f7104 100644 (file)
@@ -568,6 +568,7 @@ public:
      */
     RingHistos& operator=(const RingHistos& o) 
     {
+      if (&o == this) return *this;
       TObject::operator=(o);
       fDet  = o.fDet;
       fRing = o.fRing;
index 2f517ffcdf493d725fd7f5871036a03c4f006587..aa7712af5bdc5022585098be0e2bfb128011862e 100644 (file)
@@ -123,6 +123,7 @@ AliPoissonCalculator::CleanUp()
 AliPoissonCalculator&
 AliPoissonCalculator::operator=(const AliPoissonCalculator& o)
 {
+  if (&o == this) return *this;
   TNamed::operator=(o);
   fEtaLumping = o.fEtaLumping;
   fPhiLumping = o.fPhiLumping;
index 4ba68d1c4f8d159e99e24aae97cd9748306f3933..ad072af5532ada8a812686c4ea842c894e52e8ce 100644 (file)
@@ -64,6 +64,7 @@ AliSPDMCTrackDensity&
 AliSPDMCTrackDensity::operator=(const AliSPDMCTrackDensity& o)
 {
   // Assignment operator 
+  if (&o == this) return *this;
   TNamed::operator=(o);
   fUseOnlyPrimary       = o.fUseOnlyPrimary;
   fMinR             = o.fMinR;
index 7c45626c71673e199d8707cf16d01c01e91a7804..69af59ddc383a450c8dae54e6ecf73fb545d1353 100644 (file)
@@ -21,6 +21,7 @@
 TList* fitter = 0;
 TCanvas* canvas = 0;
 const char* pdfName = "FitResults.pdf";
+bool landscape = true;
 
 //____________________________________________________________________
 /** 
@@ -122,7 +123,14 @@ TCanvas* CheckCanvas()
   gStyle->SetStatColor(0);
   gStyle->SetStatBorderSize(1);
 
-  canvas = new TCanvas("c", "C", Int_t(800 / TMath::Sqrt(2)), 800);
+  Int_t w = Int_t(800 / TMath::Sqrt(2));
+  Int_t h = 800;
+  if (landscape) { 
+    Int_t tmp = h;
+    h         = w;
+    w         = tmp;
+  }
+  canvas = new TCanvas("c", "C", w, h);
   canvas->SetFillColor(0);
   canvas->SetBorderMode(0);
   canvas->SetBorderSize(0);
@@ -145,13 +153,13 @@ void CleanStack(THStack* stack)
 
 //____________________________________________________________________
 THStack*
-AddToStack(TList* stacks, TList* fitter, const char* name)
+AddToStack(TList* stacks, TList* list, const char* name)
 {
-  TObject* o = fitter->FindObject(name);
+  TObject* o = list->FindObject(name);
   if (!o) { 
     Warning("AddToStack", "Object %s not found in %s", name, 
-           fitter->GetName());
-    // fitter->ls();
+           list->GetName());
+    // list->ls();
     return 0;
   }
   THStack* toAdd = static_cast<THStack*>(o);
@@ -170,7 +178,8 @@ AddToStack(TList* stacks, TList* fitter, const char* name)
  * 
  * @ingroup pwg2_forward_scripts_corr
  */
-void DrawSummary(const char* fname="forward_eloss.root")
+void DrawSummary(const char* fname="forward_eloss.root", 
+                bool onlySummary=true)
 {
   if (!CheckFitter(fname)) {
     Error("DrawFits", "File not opened");
@@ -183,13 +192,13 @@ void DrawSummary(const char* fname="forward_eloss.root")
   canvas->Clear();
 
   TList    stacks;
-  THStack* chi2nu  = AddToStack(&stacks, fitter, "chi2");
-  THStack* c       = AddToStack(&stacks, fitter, "c");
-  THStack* delta   = AddToStack(&stacks, fitter, "delta");
-  THStack* xi      = AddToStack(&stacks, fitter, "xi");
-  THStack* sigma   = AddToStack(&stacks, fitter, "sigma");
-  THStack* sigman  = AddToStack(&stacks, fitter, "sigman");
-  THStack* n       = AddToStack(&stacks, fitter, "n");
+  /* THStack* chi2nu  = */ AddToStack(&stacks, fitter, "chi2");
+  /* THStack* c       = */ AddToStack(&stacks, fitter, "c");
+  /* THStack* delta   = */ AddToStack(&stacks, fitter, "delta");
+  /* THStack* xi      = */ AddToStack(&stacks, fitter, "xi");
+  /* THStack* sigma   = */ AddToStack(&stacks, fitter, "sigma");
+  /* THStack* sigman  = */ AddToStack(&stacks, fitter, "sigman");
+  /* THStack* n       = */ AddToStack(&stacks, fitter, "n");
   Int_t    baseA   = stacks.GetEntries()+1;
   Int_t    i       = 2;
   while (true) { 
@@ -198,7 +207,7 @@ void DrawSummary(const char* fname="forward_eloss.root")
   }
   // stacks.ls();
   Int_t nMax = stacks.GetEntries();
-  for (Int_t i = nMax-1; i >= baseA; i--) { 
+  for (i = nMax-1; i >= baseA; i--) { 
     THStack* stack   = static_cast<THStack*>(stacks.At(i));
     TIter    nextH(stack->GetHists());
     TH1*     hist    = 0;
@@ -210,21 +219,28 @@ void DrawSummary(const char* fname="forward_eloss.root")
 
   canvas->SetRightMargin(0.01);
   canvas->SetTopMargin(0.01);
+  Int_t nL = (nMax+1) / 2;
   Int_t nX = 2;
-  Int_t nY = (nMax+1) / 2;
+  Int_t nY = nL;
+  if (landscape) { 
+    Int_t tmp = nY;
+    nY        = nX;
+    nX        = tmp;
+  }
+
   canvas->Divide(nX, nY, 0.1, 0, 0);
 
   TIter next(&stacks);
   THStack* stack = 0;
   i = 0;
-  Int_t b = 1;
+  // Int_t b = 1;
   while ((stack = static_cast<THStack*>(next()))) {
     if (i > nMax) break;
-    Int_t ipad = 1+i/nY + 2 * (i % nY);
+    Int_t ipad = 1+i/nL + 2 * (i % nL);
     Info("DrawSummary", "cd'ing to canvas %d for %s", ipad, 
         stack->GetName());
     TVirtualPad* p = canvas->cd(ipad);
-    p->SetLeftMargin(.6/nY);
+    p->SetLeftMargin(.6/nL);
     p->SetTopMargin(.01);
     p->SetRightMargin(.01);
     p->SetFillColor(0);
@@ -242,18 +258,18 @@ void DrawSummary(const char* fname="forward_eloss.root")
     if (i == 4 || i == 5)           stack->SetMaximum(0.5);    // sigma{,n}
     if (i == 7)                     stack->SetMaximum(0.5);    // a
     if (i == 0) p->SetLogy();
-    yaxis->SetTitleSize(0.3/nY);
+    yaxis->SetTitleSize(0.3/nL);
     yaxis->SetLabelSize(0.08);
-    yaxis->SetTitleOffset(2.5/nY);
+    yaxis->SetTitleOffset(2.5/nL);
     yaxis->SetNdivisions(5);
     yaxis->SetTitleFont(42);
     yaxis->SetLabelFont(42);
     yaxis->SetDecimals();
     
     TAxis* xaxis = stack->GetHistogram()->GetXaxis();
-    xaxis->SetTitleSize(0.3/nY);
+    xaxis->SetTitleSize(0.3/nL);
     xaxis->SetLabelSize(0.08);
-    xaxis->SetTitleOffset(2./nY);
+    xaxis->SetTitleOffset(2./nL);
     xaxis->SetNdivisions(10);
     xaxis->SetTitleFont(42);
     xaxis->SetLabelFont(42);
@@ -262,11 +278,12 @@ void DrawSummary(const char* fname="forward_eloss.root")
     // Redraw 
     stack->Draw("nostack");
     i++;
-    if (i >= 5) b = 2;
+    // if (i >= 5) b = 2;
     p->cd();
   }
   canvas->SaveAs("fit_results.png");
-  canvas->Print(pdfName, "Title:Fit summary");
+  if (!onlySummary) 
+    canvas->Print(pdfName, "Title:Fit summary");
 }
 
 //____________________________________________________________________
@@ -445,7 +462,7 @@ DrawAnaELoss(const char* fname="forward_eloss.root", bool onlySummary=true)
     return;
   }
   if (!onlySummary) canvas->Print(Form("%s[", pdfName));
-  DrawSummary(fname);
+  DrawSummary(fname, onlySummary);
   if (onlySummary) return;
   DrawRings(fname);
   DrawEtaBins(fname);
diff --git a/PWG2/FORWARD/analysis2/qa/Draw123.C b/PWG2/FORWARD/analysis2/qa/Draw123.C
new file mode 100644 (file)
index 0000000..e3cbac2
--- /dev/null
@@ -0,0 +1,137 @@
+#ifndef __CINT__
+# include <TH1.h>
+# include <TH2.h>
+# include <TList.h>
+# include <TFile.h>
+# include <TString.h>
+# include <TError.h>
+# include <TPad.h>
+# include <TCanvas.h>
+# include <TLine.h>
+# include <TLatex.h>
+# include <TStyle.h>
+# include <TLegend.h>
+#else
+class TList;
+#endif
+
+/** 
+ * Draw the before/after merging image for a single ring
+ * 
+ * @param p 
+ * @param d 
+ * @param r 
+ *
+ * @ingroup pwg2_forward_scripts_qa
+ */
+void
+DrawRing123(TList* p, UShort_t d, Char_t r)
+{
+  if (!p) return;
+
+  TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
+  if (!ring) { 
+    Error("Draw123", "List FMD%d%c not found in %s",d,r,p->GetName());
+    return;
+  }
+  
+  TH1* one   = static_cast<TH1*>(ring->FindObject("singleEloss"));
+  TH1* two   = static_cast<TH1*>(ring->FindObject("doubleEloss"));
+  TH1* three = static_cast<TH1*>(ring->FindObject("tripleEloss"));
+  if (!one || !two || !three) { 
+    Error("DrawRing123", "Histograms of Eloss not found in FMD%d%c", d, r);
+    return;
+  }
+  one->SetStats(0);
+  one->SetTitle(Form("FMD%d%c", d, r));
+  one->GetXaxis()->SetRangeUser(0, 8);
+
+  gPad->SetLogy();
+  gPad->SetFillColor(0);
+
+  one->Draw();
+  if (two)   two->Draw("same");
+  if (three) three->Draw("same");
+
+  TLegend* l = new TLegend(.6, .6, .95, 1);
+  l->SetFillColor(0);
+  l->SetBorderSize(0);
+  l->AddEntry(one);
+  if (two)   l->AddEntry(two);
+  if (three) l->AddEntry(three);
+  l->Draw();
+
+  gPad->cd();
+}
+
+
+/** 
+ * Draw the before/after sharing image for all rings 
+ * 
+ * @param filename 
+ *
+ * @ingroup pwg2_forward_scripts_qa
+ */
+void
+Draw123(const char* filename="forward.root", 
+               const char* folder="ForwardResults")
+{
+  gStyle->SetPalette(1);
+  gStyle->SetOptFit(0);
+  gStyle->SetOptStat(0);
+  gStyle->SetOptTitle(1);
+  gStyle->SetTitleW(.4);
+  gStyle->SetTitleH(.1);
+  gStyle->SetTitleColor(0);
+  gStyle->SetTitleStyle(0);
+  gStyle->SetTitleBorderSize(0);
+  gStyle->SetTitleX(.6);
+  
+  TFile* file = TFile::Open(filename, "READ");
+  if (!file) { 
+    Error("Draw123", "failed to open %s", filename);
+    return;
+  }
+
+  TList* forward = static_cast<TList*>(file->Get(folder));
+  if (!forward) { 
+    Error("Draw123", "List %s not found in %s", folder, filename);
+    return;
+  }
+
+  TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
+  if (!sf) { 
+    Error("Draw123", "List fmdSharingFilter not found in Forward");
+    return;
+  }
+  
+  TCanvas* c = new TCanvas("123", 
+                          "singles, doubles, and tripples", 900, 700);
+  c->SetFillColor(0);
+  c->SetBorderSize(0);
+  c->SetLeftMargin(0.15);
+  c->SetRightMargin(0.02);
+  c->SetTopMargin(0.02);
+  c->Divide(3, 2, 0, 0);
+  
+  c->cd(1); DrawRing123(sf, 1, 'I');
+  c->cd(2); DrawRing123(sf, 2, 'I');
+  c->cd(5); DrawRing123(sf, 2, 'O');
+  c->cd(3); DrawRing123(sf, 3, 'I');
+  c->cd(6); DrawRing123(sf, 3, 'O');
+  TVirtualPad* p = c->cd(4);
+  // p->SetTopMargin(0.05);
+  p->SetRightMargin(0.15);
+  p->SetFillColor(0);
+  TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
+  if (highCuts) highCuts->Draw("colz");
+  c->cd();
+  c->SaveAs("123.png");
+}
+
+  
+  
+//
+// EOF
+//
index c345e82c681c51ce1e32100d70dbe42a28369a6f..3002e82947d2fe9a1c8f65af070a94c3d204b82d 100644 (file)
@@ -1,3 +1,19 @@
+#ifndef __CINT__
+# include <TH1.h>
+# include <TH2.h>
+# include <TList.h>
+# include <TFile.h>
+# include <TString.h>
+# include <TError.h>
+# include <TPad.h>
+# include <TCanvas.h>
+# include <TLine.h>
+# include <TLatex.h>
+# include <TStyle.h>
+#else
+class TList;
+#endif
+
 /** 
  * Draw the before/after merging image for a single ring
  * 
@@ -43,7 +59,8 @@ DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r)
  * @ingroup pwg2_forward_scripts_qa
  */
 void
-DrawBeforeAfter(const char* filename="forward.root")
+DrawBeforeAfter(const char* filename="forward.root", 
+               const char* folder="ForwardResults")
 {
   gStyle->SetPalette(1);
   gStyle->SetOptFit(0);
@@ -62,9 +79,9 @@ DrawBeforeAfter(const char* filename="forward.root")
     return;
   }
 
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get(folder));
   if (!forward) { 
-    Error("DrawBeforeAfter", "List Forward not found in %s", filename);
+    Error("DrawBeforeAfter", "List %s not found in %s", folder, filename);
     return;
   }
 
@@ -95,7 +112,7 @@ DrawBeforeAfter(const char* filename="forward.root")
   TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
   if (highCuts) highCuts->Draw("colz");
   c->cd();
-  
+  c->SaveAs("beforeAfter.png");
 }
 
   
index efe66cb9b1130ba753a0928d5c028f2dc0baa6e4..1f2e34f144cbe9fdf81283dde517741f68653d22 100644 (file)
@@ -9,6 +9,24 @@
  * @ingroup pwg2_forward_scripts_qa
  * 
  */
+#ifndef __CINT__
+# include <TH1.h>
+# include <TH2.h>
+# include <TList.h>
+# include <TFile.h>
+# include <TString.h>
+# include <TError.h>
+# include <TPad.h>
+# include <TCanvas.h>
+# include <TMath.h>
+# include <TF1.h>
+# include <TLine.h>
+# include <TLatex.h>
+# include <TLinearFitter.h>
+# include <TStyle.h>
+#else
+class TList;
+#endif
 
 /** 
  * Draw the poisson @f$N_{ch}@f$ estimate against the @f$\Delta@f$
@@ -28,19 +46,19 @@ Double_t
 DrawRingELossPoisson(TList* p, UShort_t d, Char_t r, 
                     Double_t xmin, Double_t xmax)
 {
-  if (!p) return;
+  if (!p) return 0;
 
   TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
   if (!ring) { 
     Error("DrawELossPoisson", "List FMD%d%c not found in %s",d,r,p->GetName());
-    return;
+    return 0;
   }
   
   TH2* corr = static_cast<TH2D*>(ring->FindObject("elossVsPoisson"));
   if (!corr) { 
     Error("DrawRingELossPoisson", "Histogram esdEloss not found in FMD%d%c",
          d, r);
-    return;
+    return 0;
   }
   TPad* pad = static_cast<TPad*>(gPad);
   pad->SetGridy();
@@ -56,11 +74,13 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
   corr->GetXaxis()->SetRangeUser(xmin,xmax);
   corr->GetYaxis()->SetRangeUser(xmin,xmax);
   corr->SetTitle(Form("FMD%d%c",d,r));
-  Info("", "Entries: %d, integral: %f", corr->GetEntries(), corr->Integral()); 
+  // Info("", "Entries: %d, integral: %f", 
+  //      int(corr->GetEntries()), corr->Integral()); 
   corr->Draw("colz");
+  if (corr->GetEntries() <= 0) return 0;
 
   // Calculate the linear regression 
-  Double_t dx    = (xmax-xmin);
+  // Double_t dx    = (xmax-xmin);
   Double_t rxy   = corr->GetCorrelationFactor();
   Double_t sx    = corr->GetRMS(1);
   Double_t sy    = corr->GetRMS(2);
@@ -73,6 +93,7 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
 #if 0
   Double_t beta  = rxy * sy / sx;
 #else
+  if (TMath::Abs(cxy) < 1e-6) return 0;
   Double_t beta  = ((sy2 - delta*sx2 + 
                     TMath::Sqrt(TMath::Power(sy2-delta*sx2,2) + 
                                 4*delta*cxy*cxy))
@@ -92,8 +113,10 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
   l->Draw();
   // corr->GetXaxis()->SetRangeUser(0, 2);
 
+#if 0
   Info("", "FMD%d%c correlation coefficient: %9.5f%% "
        "line y = %f + %f * x", d, r, 100*rxy, alpha, beta);
+#endif
 
   Double_t x = pad->GetLeftMargin()+.01;
   Double_t y = 1-pad->GetTopMargin()-.01;
@@ -130,6 +153,7 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
     fitter->EvalRobust();
   else 
     fitter->Eval();
+#if 0
   for (Int_t i = 0; i < 2; i++) { 
     std::cout << i << "\t" 
              << fitter->GetParName(i) << "\t"
@@ -143,6 +167,7 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
                   fitter->GetNumberFreeParameters() );
   std::cout << "chi2/ndf: " << chi2 << '/' << ndf 
            << '=' << chi2 / ndf << std::endl;
+#endif
 
   // corr->Scale(1. / corr->GetMaximum());
   pad->cd();
@@ -162,6 +187,7 @@ DrawRingELossPoisson(TList* p, UShort_t d, Char_t r,
  */
 void
 DrawELossPoisson(const char* filename="forward.root", 
+                const char* folder="ForwardResults",
                 Double_t xmax=-1,
                 Double_t xmin=-1)
 {
@@ -183,9 +209,9 @@ DrawELossPoisson(const char* filename="forward.root",
     return;
   }
 
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get(folder));
   if (!forward) { 
-    Error("DrawELossPoisson", "List Forward not found in %s", filename);
+    Error("DrawELossPoisson", "List %s not found in %s", folder, filename);
     return;
   }
 
index 764d772bbb12fa2a6da46709d6d3b297c983c899..e43e44071d573a0ae0c2c6605d17a7692bf04a70 100644 (file)
@@ -1,3 +1,18 @@
+#ifndef __CINT__
+# include <TH1.h>
+# include <TH2.h>
+# include <TList.h>
+# include <TFile.h>
+# include <TString.h>
+# include <TError.h>
+# include <TPad.h>
+# include <TCanvas.h>
+# include <TLine.h>
+# include <TLatex.h>
+# include <TStyle.h>
+#else
+class TList;
+#endif
 /** 
  * Draw the correlation of neighboring strips before/after merging 
  * 
@@ -65,7 +80,8 @@ DrawRingNeighbors(TList* p, UShort_t d, Char_t r)
  * @ingroup pwg2_forward_scripts_qa
  */
 void
-DrawNeighbors(const char* filename="forward.root")
+DrawNeighbors(const char* filename="forward.root", 
+             const char* folder="ForwardResults")
 {
   gStyle->SetPalette(1);
   gStyle->SetOptFit(0);
@@ -85,9 +101,9 @@ DrawNeighbors(const char* filename="forward.root")
     return;
   }
 
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get(folder));
   if (!forward) { 
-    Error("DrawNeighbors", "List Forward not found in %s", filename);
+    Error("DrawNeighbors", "List %s not found in %s", folder, filename);
     return;
   }
 
@@ -110,6 +126,7 @@ DrawNeighbors(const char* filename="forward.root")
   c->cd(6); DrawRingNeighbors(sf, 3, 'O');
   c->cd(4)->SetFillColor(0);
   c->cd();
+  c->SaveAs("neighbors.png");
 }
 
   
index daf8ead3e39b3c0f3f1262a7ab930aa6d15e0738..fb5d5f1624c5ce6e26cf4effe4c0a418a579fb13 100644 (file)
@@ -9,6 +9,21 @@
  * @ingroup pwg2_forward_scripts_qa
  * 
  */
+#ifndef __CINT__
+# include <TH1.h>
+# include <TH2.h>
+# include <TList.h>
+# include <TFile.h>
+# include <TString.h>
+# include <TError.h>
+# include <TPad.h>
+# include <TCanvas.h>
+# include <TLine.h>
+# include <TLatex.h>
+# include <TStyle.h>
+#else
+class TList;
+#endif
 
 /** 
  * Draw the poisson @f$N_{ch}@f$ estimate against the @f$\Delta@f$
 Double_t
 DrawRingOccupancy(TList* p, UShort_t d, Char_t r)
 {
-  if (!p) return;
+  if (!p) return 0;
 
   TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
   if (!ring) { 
     Error("DrawOccupancy", "List FMD%d%c not found in %s",d,r,p->GetName());
-    return;
+    return 0;
   }
   
   TH1* corr = static_cast<TH1*>(ring->FindObject("occupancy"));
   if (!corr) { 
     Error("DrawRingOccupancy", "Histogram occupancy not found in FMD%d%c",
          d, r);
-    return;
+    return 0;
   }
+  corr->Rebin(4);
+
   TPad* pad = static_cast<TPad*>(gPad);
   pad->SetGridy();
   pad->SetGridx();
@@ -79,8 +96,7 @@ DrawRingOccupancy(TList* p, UShort_t d, Char_t r)
  */
 void
 DrawOccupancy(const char* filename="forward.root", 
-                Double_t xmax=-1,
-                Double_t xmin=-1)
+             const char* folder="ForwardResults")
 {
   gStyle->SetPalette(1);
   gStyle->SetOptFit(0);
@@ -100,9 +116,9 @@ DrawOccupancy(const char* filename="forward.root",
     return;
   }
 
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get(folder));
   if (!forward) { 
-    Error("DrawOccupancy", "List Forward not found in %s", filename);
+    Error("DrawOccupancy", "List %s not found in %s", folder, filename);
     return;
   }
 
index a0a2d20b7e0ab3d5e608649b87df45417419ae67..020f8c72ed762f6877f81a5e3cff1ba1e4e71345 100644 (file)
@@ -20,19 +20,28 @@ DrawQA(const char* file, bool full=false)
   gROOT->SetMacroPath(Form(".:$(ALICE_ROOT)/PWG2/FORWARD/analysis2/qa:"
                           "$(ALICE_ROOT)/PWG2/FORWARD/analysis2/corrs:%s",
                           gROOT->GetMacroPath()));
-  gROOT->LoadMacro("DrawBeforeAfter.C");
-  gROOT->LoadMacro("DrawELossPoisson.C");
-  gROOT->LoadMacro("DrawNeighbors.C");
-  gROOT->LoadMacro("DrawOccupancy.C");
-  gROOT->LoadMacro("DrawRecAnaEloss.C");
+  gROOT->LoadMacro("DrawBeforeAfter.C+g");
+  gROOT->LoadMacro("DrawELossPoisson.C+g");
+  gROOT->LoadMacro("DrawNeighbors.C+g");
+  gROOT->LoadMacro("DrawOccupancy.C+g");
+  gROOT->LoadMacro("DrawRecAnaEloss.C+g");
+  gROOT->LoadMacro("Draw123.C+g");
 
+  Info("DrawQA", "Drawing before-after");
   DrawBeforeAfter(file);
-  DrawELossPoisson(file);
+  Info("DrawQA", "Drawing singles, doubles, tripples");
+  Draw123(file);
+  Info("DrawQA", "Drawing Neighbors");
   DrawNeighbors(file);
-  DrawOccupancy(file);
+  Info("DrawQA", "Drawing raw and analysed energy loss");
   DrawRecAnaEloss(file);
+  Info("DrawQA", "Drawing poisson vs energy loss");
+  DrawELossPoisson(file);
+  Info("DrawQA", "Drawing Occupancies");
+  DrawOccupancy(file);
 
   if (!full) { 
+    Info("DrawQA", "Drawing fit results");
     gROOT->LoadMacro("DrawAnaELoss.C");
     DrawAnaELoss(file);
   }
diff --git a/PWG2/FORWARD/analysis2/qa/DrawQA.sh b/PWG2/FORWARD/analysis2/qa/DrawQA.sh
new file mode 100755 (executable)
index 0000000..f8022a8
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/sh 
+
+file=trending.root 
+
+# --- Help message ---------------------------------------------------
+usage ()
+{
+    cat <<EOF
+Usage: $0 [OPTIONS] 
+
+Options:
+       -f,--file    FILE       Input file 
+       -t,--title   STRING     Title string 
+       -o,--output  FILE       Write output on this file 
+       -h,--help               Show this help
+EOF
+}
+
+# --- Command line parsing -------------------------------------------
+while test $# -gt 0 ; do 
+    case $1 in  
+       -f|--file) file=$2 ; shift ;;
+       -t|--title) title=$2 ; shift ;; 
+       -h|--help) usage ; exit 0 ;; 
+       *)  echo "Uknown option $1" > /dev/stderr ; exit 1 ;; 
+    esac
+    shift 
+done 
+
+# --- Run aliroot ----------------------------------------------------
+scr=$ALICE_ROOT/PWG2/FORWARD/analysis2/qa/DrawQA.C 
+
+root -l -b -q ${scr}\(\"$file\"\)
+
+# --- Make LaTeX code ------------------------------------------------
+if test "x$title" = "x" ; then 
+    title=`echo "QA from $file" | sed -e 's/_/\\_/g'`
+fi
+if test "x$output" = "x" ; then 
+    output=`basename $file .root` 
+else 
+    output=`basename $file .pdf` 
+fi
+doc=${output}.tex
+
+echo $title
+cat <<EOF > $doc
+\documentclass[landscape,12pt,a4paper]{article}
+\usepackage[a4paper,margin=2cm]{geometry}
+\usepackage{graphicx}
+\title{$title}
+\author{FMD Team}
+\date{\today}
+\begin{document}
+\maketitle
+\clearpage
+
+EOF
+pngs="fit_results neighbors beforeAfter 123 recAnaELoss occupancy elossVsPoisson"
+for i in $pngs ; do
+    case $i in  
+       fit_results) t="Energy loss fits" ;; 
+       neighbors)   t="Correlation of neighbors" ;; 
+       beforeAfter) t="Effect of sharing correction" ;; 
+       123)         t="Energy loss from single, double, and tripple hits" ;; 
+       recAnaELoss) t="Energy loss from reconstruction and used in analysis" ;;
+       occupancy)   t="Calculated occupancy" ;;
+       elossVsPoisson) t="Correlation of Poisson and Energy loss methods" ;;
+       *)           t="Unkknown" ;;
+    esac
+    cat <<EOF >> $doc
+\section*{$t}
+\begin{center}
+\includegraphics[keepaspectratio,height=.9\textheight]{$i}
+\end{center}
+\clearpage
+EOF
+done
+
+cat <<EOF >> $doc
+\end{document}
+EOF
+
+pdflatex $doc    
+
+rm -f $doc $output.aux $output.log FitResults.pdf 
+for i in $pngs ; do rm -f $i.png ; done 
+
+# 
+# EOF
+# 
+
index bc166be889d4ab5ea705a153d5040fa52c4d2671..9b875f04a9155adcb9057fc7d9e6377600c19071 100644 (file)
@@ -104,7 +104,7 @@ DrawRingRecAnaEloss(TList* p, TList* p2, Double_t lowCut, UShort_t d, Char_t r)
   // after->Scale(1. / ib);
   // presented->Scale(1. / ib);
   // used->Scale(1. / ib);
-  
+
   gPad->SetLogy();
   gPad->SetFillColor(0);
   before->SetTitle(Form("FMD%d%c",d,r));
@@ -134,13 +134,15 @@ DrawRingRecAnaEloss(TList* p, TList* p2, Double_t lowCut, UShort_t d, Char_t r)
   TLine* l = new TLine;
   l->SetLineWidth(1);
   l->DrawLineNDC(x, y-0.9*ts, 1-gPad->GetRightMargin()-0.01, y-0.9*ts);
-  DrawText(ltx, x, y, "Change (merging)", Form("%5.1f%%", (100.*(ia-ib))/ib));
-  DrawText(ltx, x, y, "Change (input)",   Form("%5.1f%% (%5.1f%%)", 
-                                              (100.*(ip-ia))/ia,
-                                              (100.*(ip-ib))/ib));
-  DrawText(ltx, x, y, "Change (use)",     Form("%5.1f%% (%5.1f%%)", 
-                                              (100.*(iu-ip))/ip,
-                                              (100.*(iu-ib))/ib));
+  if (ib != 0 && ia != 0) {
+    DrawText(ltx, x, y, "Change (merging)", Form("%5.1f%%", (100.*(ia-ib))/ib));
+    DrawText(ltx, x, y, "Change (input)",   Form("%5.1f%% (%5.1f%%)", 
+                                                (100.*(ip-ia))/ia,
+                                                (100.*(ip-ib))/ib));
+    DrawText(ltx, x, y, "Change (use)",     Form("%5.1f%% (%5.1f%%)", 
+                                                (100.*(iu-ip))/ip,
+                                                (100.*(iu-ib))/ib));
+  }
   before->GetXaxis()->SetRangeUser(0, 4);
   gPad->cd();
 }
@@ -153,7 +155,8 @@ DrawRingRecAnaEloss(TList* p, TList* p2, Double_t lowCut, UShort_t d, Char_t r)
  * @ingroup pwg2_forward_scripts_qa
  */
 void
-DrawRecAnaEloss(const char* filename="forward.root")
+DrawRecAnaEloss(const char* filename="forward.root",
+               const char* folder="ForwardResults")
 {
   gStyle->SetPalette(1);
   gStyle->SetOptFit(0);
@@ -172,9 +175,9 @@ DrawRecAnaEloss(const char* filename="forward.root")
     return;
   }
 
-  TList* forward = static_cast<TList*>(file->Get("Forward"));
+  TList* forward = static_cast<TList*>(file->Get(folder));
   if (!forward) { 
-    Error("DrawRecAnaEloss", "List Forward not found in %s", filename);
+    Error("DrawRecAnaEloss", "List %s not found in %s", folder, filename);
     return;
   }
 
@@ -216,7 +219,7 @@ DrawRecAnaEloss(const char* filename="forward.root")
   TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
   if (highCuts) highCuts->Draw("colz");
   c->cd();
-  
+  c->SaveAs("recAnaELoss.png");
 }