]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDQADataMakerRec.cxx
New class to create energy distributions
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerRec.cxx
index 7d8226dc5d39dcda8e7f857de5d0825d15cebe8c..86f937377ca56e805bda31b815c2e1acdac1d0d9 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliFMDParameters.h"
 #include "AliFMDRawReader.h"
 #include "AliRawReader.h"
+#include "AliFMDAltroMapping.h"
 
 //_____________________________________________________________________
 // This is the class that collects the QA data for the FMD during
@@ -136,12 +137,37 @@ void AliFMDQADataMakerRec::InitRecPoints()
 //_____________________________________________________________________ 
 void AliFMDQADataMakerRec::InitRaws()
 {
-  TH1I* hADCCounts      = new TH1I("hADCCounts","Dist of ADC counts",
+  
+  TH1I* hADCCounts;
+  for(Int_t det = 1; det<=3; det++) {
+    Int_t firstring = (det==1 ? 1 : 0);
+    for(Int_t iring = firstring;iring<=1;iring++) {
+      Char_t ring = (iring == 1 ? 'I' : 'O');
+      hADCCounts      = new TH1I(Form("hADCCounts_FMD%d%c",
+                                     det, ring), "ADC counts",
+                                1024,0,1023);
+      
+      Int_t index1 = GetHalfringIndex(det, ring, 0,1);
+      Add2RawsList(hADCCounts, index1,kTRUE);
+      
+      for(Int_t b = 0; b<=1;b++) {
+       
+       //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
+       UInt_t board = (iring == 1 ? 0 : 1);
+       board = board + b*16;
+       
+       
+       hADCCounts      = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
+                                       det, ring, board), "ADC counts",
                                   1024,0,1023);
-  hADCCounts->SetXTitle("ADC counts");
-  hADCCounts->SetYTitle("");
-  Add2RawsList(hADCCounts, 0);
+       hADCCounts->SetXTitle("ADC counts");
+       hADCCounts->SetYTitle("");
+       Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
+       Add2RawsList(hADCCounts, index2);
 
+      }
+    }
+  }
 }
 
 //_____________________________________________________________________
@@ -211,18 +237,25 @@ void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   TClonesArray* digitsAddress = &fDigitsArray;
   
   rawReader->Reset();
-  
-  while(rawReader->NextEvent()) {
+               
+  digitsAddress->Clear();
+  fmdReader.ReadAdcs(digitsAddress);
+  for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
+    //Raw ADC counts
+    AliFMDDigit*      digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
+    UShort_t          det   = digit->Detector();
+    Char_t            ring  = digit->Ring();
+    UShort_t          sec   = digit->Sector();
+    // UShort_t strip = digit->Strip();
+    AliFMDParameters* pars  = AliFMDParameters::Instance();
+    Short_t           board = pars->GetAltroMap()->Sector2Board(ring, sec);
+    
+    Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
+    GetRawsData(index1)->Fill(digit->Counts());
+    Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
+    GetRawsData(index2)->Fill(digit->Counts());
     
-    digitsAddress->Clear();
-    fmdReader.ReadAdcs(digitsAddress);
-    for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
-      //Raw ADC counts
-      AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
-      GetRawsData(0)->Fill(digit->Counts());
-    }
   }
-  
 }
 
 //_____________________________________________________________________
@@ -259,6 +292,22 @@ void AliFMDQADataMakerRec::StartOfDetectorCycle()
   // do?
 }
 //_____________________________________________________________________ 
+Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det, 
+                                            Char_t ring, 
+                                            UShort_t board, 
+                                            UShort_t monitor) {
+  
+  UShort_t iring  =  (ring == 'I' ? 1 : 0);
+  
+  Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
+  
+  return index-2;
+  
+}
+
+//_____________________________________________________________________ 
+
+
 //
 // EOF
 //