]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerDisplay.cxx
reduce size on disk for storing PDF nodes
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerDisplay.cxx
index 12c268418cae7637cbfab92adff06462ecf5c041..bc8551ac24b62595f1902cdfaa70a8e489a4b295 100644 (file)
 ///
 /// MUON base class for converting histos as a function of strip/board/slat number
 /// into display histos showing the detection element position in the 
-/// trigger chamber
+/// trigger chamber.
+///
+/// Input histos can be given as:
+///  - TH2 with x -> board # [1-234]  and   y -> strip # in board [0-15].  Option: kDisplayStrips
+///  - TH1 with x -> board # [1-234]                                       Option: kDisplayBoards
+///  - TH1 with x -> slat #  [0-17]                                        Option: kDisplaySlats
 ///
 /// \author D. Stocco
 
@@ -185,6 +190,9 @@ Bool_t AliMUONTriggerDisplay::InitOrDisplayTriggerInfo(TH1* inputHisto, TH2* dis
       AliWarning("Display histogram not initialized. Please initialize it first!");
       return kFALSE;
   }
+  else if ( inputHisto->GetEntries() == 0 ) {
+    return kTRUE;
+  }
 
   Float_t xWidth, yWidth, yWidthSlat=0., xWidthCol=0.;
   Float_t x1,x2,y1,y2;
@@ -219,11 +227,11 @@ Bool_t AliMUONTriggerDisplay::InitOrDisplayTriggerInfo(TH1* inputHisto, TH2* dis
       AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(1))};
 
     if(iLoc==0){
-      AliMpPad pad1 = seg[1]->PadByLocation(AliMpIntPair(iBoard,0),kFALSE);
-      yWidthSlat = pad1.Dimensions().Y();
-      AliMpPad pad0 = seg[0]->PadByLocation(AliMpIntPair(iBoard,0),kFALSE);
-      xOffsetLine = TMath::Abs(pad0.Position().X()) + pad0.Dimensions().X();
-      xWidthCol = 2.* pad0.Dimensions().X();
+      AliMpPad pad1 = seg[1]->PadByLocation(iBoard,0,kFALSE);
+      yWidthSlat = pad1.GetDimensionY();
+      AliMpPad pad0 = seg[0]->PadByLocation(iBoard,0,kFALSE);
+      xOffsetLine = TMath::Abs(pad0.GetPositionX()) + pad0.GetDimensionX();
+      xWidthCol = 2.* pad0.GetDimensionX();
     }
 
     // Get ideal global position of DetElemId center
@@ -246,17 +254,17 @@ Bool_t AliMUONTriggerDisplay::InitOrDisplayTriggerInfo(TH1* inputHisto, TH2* dis
        // get pad from electronics
 
        Int_t offset = 0;
-       if (cath && localBoard->GetSwitch(6)) offset = -8;
+       if (cath && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
 
-       AliMpPad pad = seg[cath]->PadByLocation(AliMpIntPair(iBoard,iStrip+offset),kFALSE);
+       AliMpPad pad = seg[cath]->PadByLocation(iBoard,iStrip+offset,kFALSE);
 
        if (!pad.IsValid()) continue;
 
-       xWidth = pad.Dimensions().X();
-       yWidth = pad.Dimensions().Y();
-       xcPad = sign * (pad.Position().X() + xOffsetLine);
+       xWidth = pad.GetDimensionX();
+       yWidth = pad.GetDimensionY();
+       xcPad = sign * (pad.GetPositionX() + xOffsetLine);
        if(line==4) xcPad += 0.75 * sign * xWidthCol;
-       ycPad = pad.Position().Y() + yOffsetLine;
+       ycPad = pad.GetPositionY() + yOffsetLine;
 
        if(cath==iCath){
          x1 = xcPad - xWidth + kShiftX;
@@ -417,9 +425,19 @@ void AliMUONTriggerDisplay::FillBins(TH1* inputHisto, TH2* displayHisto,
     binY2 = meanBin;
   }
 
+  Float_t elementArea = 1.;
+  if(displayOpt == kNormalizeToArea) {
+    elementArea = (x2 - x1 + 2*kShiftX) * 
+      (y2 - y1 + 2*kShiftY); // In InitOrDisplayTriggerInfo: 
+                             // x2 = x_c + xHalfWidth - kShiftX
+                             // x1 = x_c - xHalfWidth + kShiftX
+                             // so x2 - x1 + 2*kShiftX returns the element width.
+
+  }
+
   for(Int_t ibinx=binX1; ibinx<=binX2; ibinx++){
     for(Int_t ibiny=binY1; ibiny<=binY2; ibiny++){
-      displayHisto->SetBinContent(ibinx,ibiny,binContent);
+      displayHisto->SetBinContent(ibinx,ibiny,binContent/elementArea);
     }
   }
 }