]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDGainDA.cxx
a macro with TPC,ITS, ITSSPD vertex, global vertex and v0's
[u/mrichter/AliRoot.git] / FMD / AliFMDGainDA.cxx
index d4b285107808a491c78b7fb760b534d10b699293..f24161e2a2005796cafb5b98714d72a769c7a252 100644 (file)
@@ -168,11 +168,14 @@ void AliFMDGainDA::FillChannels(AliFMDDigit* digit) {
   UShort_t sec   = digit->Sector();
   UShort_t strip = digit->Strip();
   
-  //Strip is always seen as the first in a VA chip. All other strips are junk
-  if(strip % fNumberOfStripsPerChip) return;
+  //Strip is always seen as the first in a VA chip. All other strips are junk.
+  //Strips are counted from zero on even sectors and from 511 on odd sectors...
+   
+  if((sec%2)     && ((strip+1) % fNumberOfStripsPerChip)) return;
+  if(((sec+1)%2) && (strip % fNumberOfStripsPerChip)) return;
+  
   Int_t vaChip   = strip / fNumberOfStripsPerChip; 
   TH1S* hChannel = GetChannelHistogram(det, ring, sec, vaChip);
-  
   hChannel->Fill(digit->Counts());
   UpdatePulseAndADC(det,ring,sec,strip);
 }
@@ -184,8 +187,8 @@ void AliFMDGainDA::Analyse(UShort_t det,
                           UShort_t strip) {
   TGraphErrors* grChannel = GetChannel(det,ring,sec,strip);
   if(!grChannel->GetN()) {
-    // AliWarning(Form("No entries for FMD%d%c, sector %d, strip %d",
-    //                 det, ring , sec, strip));
+    AliWarning(Form("No entries for FMD%d%c, sector %d, strip %d",
+                     det, ring , sec, strip));
     return;
   }
   TF1 fitFunc("fitFunc","pol1",-10,280); 
@@ -211,13 +214,13 @@ void AliFMDGainDA::Analyse(UShort_t det,
              << chi2ndf                     <<"\n";
   
   //due to RCU trouble, first strips on VAs are excluded
-  if(strip%128 != 0) {
+  // if(strip%128 != 0) {
     
-    fSummaryGains.SetBinContent(fCurrentSummaryStrip,fitFunc.GetParameter(1));
-    fSummaryGains.SetBinError(fCurrentSummaryStrip,fitFunc.GetParError(1));
-    
-    fCurrentSummaryStrip++;
-  }
+  fSummaryGains.SetBinContent(fCurrentSummaryStrip,fitFunc.GetParameter(1));
+  fSummaryGains.SetBinError(fCurrentSummaryStrip,fitFunc.GetParError(1));
+  
+  fCurrentSummaryStrip++;
+    // }
   if(fSaveHistograms) {
     gDirectory->cd(GetSectorPath(det,ring, sec, kTRUE));
     
@@ -245,8 +248,10 @@ void AliFMDGainDA::Analyse(UShort_t det,
 //_____________________________________________________________________
 void AliFMDGainDA::Terminate(TFile* diagFile)
 {
-  diagFile->cd();
-  fSummaryGains.Write();
+  if(diagFile) {
+    diagFile->cd();
+    fSummaryGains.Write();
+  }
 }
 
 //_____________________________________________________________________
@@ -315,7 +320,11 @@ void AliFMDGainDA::UpdatePulseAndADC(UShort_t det,
   
   if(GetCurrentEvent()> (fNumberOfStripsPerChip*fEventsPerChannel.At(halfring)))
     return;
-  if(strip % fNumberOfStripsPerChip) return;
+  
+  if((sec%2)     && ((strip+1) % fNumberOfStripsPerChip)) return;
+  
+  if(((sec+1)%2) && (strip % fNumberOfStripsPerChip)) return;
+  
   if(((GetCurrentEvent()) % fPulseLength.At(halfring)) 
      && GetCurrentEvent() > 0) return;
      
@@ -340,10 +349,15 @@ void AliFMDGainDA::UpdatePulseAndADC(UShort_t det,
   
   hChannel->GetXaxis()->SetRange(firstBin,lastBin);
   
-  Int_t channelNumber = (strip + 
-                        (GetCurrentEvent()-1)
-                        / ((fPulseLength.At(halfring)*fHighPulse)
-                           / fPulseSize.At(halfring))); 
+  Int_t    channelNumber      = (strip + 
+                                (GetCurrentEvent()-1)
+                                / ((fPulseLength.At(halfring)*fHighPulse)
+                                   / fPulseSize.At(halfring))); 
+  if(sec%2)
+    channelNumber      = (strip - 
+                         (GetCurrentEvent()-1)
+                         / ((fPulseLength.At(halfring)*fHighPulse)
+                            / fPulseSize.At(halfring))); 
   
   TGraphErrors* channel = GetChannel(det,ring,sec,channelNumber);