]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDqaBlackEvents.cxx
Modifications in AliRoot for re-processing a selected event.
[u/mrichter/AliRoot.git] / TRD / AliTRDqaBlackEvents.cxx
index 91d35eda781e01a7da00aa07d6859e56ac9be5e8..29b2f8cfdc3723dfd87739412655cc75ae0fa0b9 100644 (file)
@@ -35,6 +35,7 @@
 #include "TStyle.h"
 #include "TGraph.h"
 
+#include "AliLog.h"
 #include "AliRawReader.h"
 
 #include "AliTRDrawStreamOld.h"
@@ -51,6 +52,7 @@ AliTRDqaBlackEvents::AliTRDqaBlackEvents()
   ,fThresh(0)
   ,fCount(0)
   ,fRefEv(0)
+  ,fRefFileName(0x0)
   ,fOccupancy(0)
   ,fDetRob(0)
   ,fTBEvent(0)
@@ -125,7 +127,11 @@ AliTRDqaBlackEvents::AliTRDqaBlackEvents()
   for (Int_t i = 0; i < 1000; i++) {
     fEvNoDist[i]       = 0;
   }
-  strncpy(fRefFileName,"",256);
+  for (Int_t i = 0; i < kDET*kROB*kMCM; i++) {
+    fFullSignal[i]     = 0x0;
+    fFullCounter[i]    = 0;
+  }
+  //strncpy(fRefFileName,"",256);
 
 }
 
@@ -138,6 +144,7 @@ AliTRDqaBlackEvents::AliTRDqaBlackEvents(const AliTRDqaBlackEvents &qa)
   ,fThresh(0)
   ,fCount(0)
   ,fRefEv(0)
+  ,fRefFileName(0x0)
   ,fOccupancy(0)
   ,fDetRob(0)
   ,fTBEvent(0)
@@ -212,7 +219,11 @@ AliTRDqaBlackEvents::AliTRDqaBlackEvents(const AliTRDqaBlackEvents &qa)
   for (Int_t i = 0; i < 1000; i++) {
     fEvNoDist[i]       = 0;
   }
-  strncpy(fRefFileName,"",256);
+  for (Int_t i = 0; i < kDET*kROB*kMCM; i++) {
+    fFullSignal[i]     = 0x0;
+    fFullCounter[i]    = 0;
+  }
+  //strncpy(fRefFileName,"",256);
 
 }
 
@@ -369,7 +380,8 @@ void AliTRDqaBlackEvents::Reset()
 
 void AliTRDqaBlackEvents::SetRefFile(const char *filename) {
   
-  strncpy(fRefFileName,filename,256);
+  //strncpy(fRefFileName,filename,256);
+  fRefFileName = filename;
 
 }
 
@@ -383,8 +395,8 @@ void AliTRDqaBlackEvents::ReadRefHists(Int_t det) {
   fRefHistPed = 0;
   fRefHistNoise = 0;
   
-  TFile *file = 0;
-  if (fRefFileName) TFile::Open(fRefFileName);
+  TFile *file = 0x0;
+  if (fRefFileName) file = TFile::Open(fRefFileName);
   if (!file) return;
 
   fRefHistPed   = (TH2D*)file->Get(Form("ped_%d",det));
@@ -443,7 +455,7 @@ void AliTRDqaBlackEvents::AddBuffer(AliTRDrawStreamOld *data, AliRawReader * con
   //printf("reading SM %d\n", sm);
   AliInfo(Form("reading SM %d", sm));
   
-  if (sm < 0 || sm > 18) return;
+  if (sm < 0 || sm > 17) return;
 
   // lopp over stacks, links ...
 
@@ -601,7 +613,7 @@ void AliTRDqaBlackEvents::AddBuffer(AliTRDrawStreamOld *data, AliRawReader * con
            //fSignal[det]->Fill(sig[k]);
            //fData[det]->Fill(row, col, sig[k]); // slow
 
-           if (sig[k] < kCH) {
+           if ((sig[k] >=0) && (sig[k] < kCH)) {
              fSignalDirect[det][sig[k]]++;
              fDataDirect[det][row][col][sig[k]]++; // direct data
            }
@@ -751,8 +763,8 @@ void AliTRDqaBlackEvents::Process(const char *filename)
   // Process something
   //
   
-  char fn[256];
-  strncpy(fn,filename,256);
+  //char fn[256];
+  //strncpy(fn,filename,256);
   
   //AliInfo(Form("FILENAME = %s (%s)\n", filename, fn));
 
@@ -826,7 +838,10 @@ void AliTRDqaBlackEvents::Process(const char *filename)
          Double_t refnoise = 0;
          
          if (fRefHistPed)   refped   = fRefHistPed->GetBinContent(bin);
-         if (fRefHistNoise) refnoise = fRefHistPed->GetBinContent(bin);
+         if (fRefHistPed)   refnoise = fRefHistPed->GetBinContent(bin);
+         // Original code, should it not be fRefHistNoise->GetBinContent(bin)
+         // instead of fRefHistPed->GetBinContent(bin)  (CBL) ???
+         //if (fRefHistNoise) refnoise = fRefHistPed->GetBinContent(bin);
 
          fChPedRes[det]->SetBinContent(bin, ped-refped);
          fChNoiseRes[det]->SetBinContent(bin, noise-refnoise);
@@ -875,7 +890,7 @@ void AliTRDqaBlackEvents::Process(const char *filename)
     
     if (!map[i]) continue;
     
-    sprintf(entriesDistName, "entriesDist_%d", i);
+    snprintf(entriesDistName,100,"entriesDist_%d",i);
     fNPointDist[i] = new TH1D(entriesDistName, ";number of events", max+2, -0.5, max+1.5);
     
     for(Int_t j=0; j<fNPoint[i]->GetXaxis()->GetNbins(); j++) {
@@ -898,7 +913,7 @@ void AliTRDqaBlackEvents::Process(const char *filename)
   // save histograms
 
   //AliInfo(Form("FILENAME 2 = %s (%d)\n", fn, fn));
-  TFile *file = new TFile(fn, "recreate");
+  TFile *file = new TFile(filename, "recreate");
   for(Int_t det = 0; det < kDET; det++) {
     if (!map[det]) continue; 
     fChPed[det]->Write();
@@ -1019,41 +1034,41 @@ void AliTRDqaBlackEvents::Process(const char *filename)
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-Int_t AliTRDqaBlackEvents::CheckMCM(Int_t index) const {
+Int_t AliTRDqaBlackEvents::CheckMCM(Int_t /*index*/) const {
   //
   // Checks a single MCM
   //  
 
   return 1;
   
-  static Int_t data[21][3] = {
-    {1, 0, 1}, 
-    {242, 0, 0}, 
-    {242, 0, 1}, 
-    {242, 0, 2}, 
-    {242, 0, 4}, 
-    {242, 0, 5}, 
-    {242, 0, 6}, 
-    {242, 0, 8}, 
-    {242, 0, 12}, 
-    {251, 7, 7}, 
-    {254, 3, 11}, 
-    {259, 3, 14}, 
-    {260, 1, 9}, 
-    {260, 3, 15}, 
-    {273, 1, 7}, 
-    {273, 1, 15}, 
-    {276, 5, 11}, 
-    {280, 6, 2}, 
-    {299, 6, 4}, 
-    {511, 2, 9}, 
-    {517, 7, 15}
-  };
+  // static Int_t data[21][3] = {
+  //   {1, 0, 1}, 
+  //   {242, 0, 0}, 
+  //   {242, 0, 1}, 
+  //   {242, 0, 2}, 
+  //   {242, 0, 4}, 
+  //   {242, 0, 5}, 
+  //   {242, 0, 6}, 
+  //   {242, 0, 8}, 
+  //   {242, 0, 12}, 
+  //   {251, 7, 7}, 
+  //   {254, 3, 11}, 
+  //   {259, 3, 14}, 
+  //   {260, 1, 9}, 
+  //   {260, 3, 15}, 
+  //   {273, 1, 7}, 
+  //   {273, 1, 15}, 
+  //   {276, 5, 11}, 
+  //   {280, 6, 2}, 
+  //   {299, 6, 4}, 
+  //   {511, 2, 9}, 
+  //   {517, 7, 15}
+  // };
   
-  for(Int_t i=0; i<21; i++) {
-    Int_t wIndex = data[i][0] * kROB*kMCM + data[i][1] * kMCM + data[i][2];
-    if (index == wIndex) return 0;
-  }
+  // for(Int_t i=0; i<21; i++) {
+  //   Int_t wIndex = data[i][0] * kROB*kMCM + data[i][1] * kMCM + data[i][2];
+  //   if (index == wIndex) return 0;
+  // }
 
   return 1;
 }