]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
online hot channels introduced
authorbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Jun 2009 15:57:14 +0000 (15:57 +0000)
committerbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Jun 2009 15:57:14 +0000 (15:57 +0000)
PMD/AliPMDCalibGain.cxx
PMD/AliPMDCalibGain.h
PMD/PMDGAINda.cxx
PMD/PMD_GAIN_CONFIGFILE

index 6200cffcc629ec972cd36537ae33fc710bccac10..8bdccaaea721ff38af2dda1191dca0614ecbc101 100644 (file)
@@ -194,7 +194,7 @@ Int_t AliPMDCalibGain::ExtractHotChannel(const Char_t *rootFile)
 
   if(!hotmapfile)
     {
-      printf(" NO HOTCHANNEL MAP FOUND (PMD_HOR.root) FILE IS FOUND \n");
+      printf(" NO HOTCHANNEL MAP FOUND (PMD_HOT.root) FILE IS FOUND \n");
       fHotFlag[kDet][kMaxSMN][kMaxRow][kMaxCol] = 0.;
     }
 
@@ -459,14 +459,23 @@ Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlc
   
 }
 // ------------------------------------------------------------------------ //
-void AliPMDCalibGain::Analyse(TTree *gaintree)
+void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree)
 {
   // Calculates the mean
   Int_t   det, sm, row, col;
   Float_t gain;
-  Float_t modmean  = 0.;
   Float_t cellmean = 0.;
 
+  Float_t modmean[2][24];
+
+  for (Int_t idet=0; idet < 2; idet++)
+    {
+      for (Int_t ism = 0; ism < 24; ism++)
+       {
+         modmean[idet][ism] = 0.;
+       }
+    }
+
   gaintree->Branch("det",&det,"det/I");
   gaintree->Branch("sm",&sm,"sm/I");
   gaintree->Branch("row",&row,"row/I");
@@ -478,7 +487,7 @@ void AliPMDCalibGain::Analyse(TTree *gaintree)
       for(Int_t ism = 0; ism < kMaxSMN; ism++)
        {
          if (fSMCount[idet][ism] > 0)
-           modmean = fSMIso[idet][ism]/fSMCount[idet][ism];
+           modmean[idet][ism] = fSMIso[idet][ism]/fSMCount[idet][ism];
          for(Int_t irow = 0; irow < kMaxRow; irow++)
            {
              for(Int_t icol = 0; icol < kMaxCol; icol++)
@@ -493,7 +502,7 @@ void AliPMDCalibGain::Analyse(TTree *gaintree)
                  col      = icol;
                  if (cellmean > 0.0 && fCellCount[idet][ism][irow][icol]>0.)
                    {
-                     gain = cellmean/modmean;
+                     gain = cellmean/modmean[idet][ism];
                    }
                  else
                    {
@@ -505,10 +514,28 @@ void AliPMDCalibGain::Analyse(TTree *gaintree)
            }
        }
     }
+
+  Float_t smmean;
+
+  // Writing each module mean value
+  meantree->Branch("det",&det,"det/I");
+  meantree->Branch("sm",&sm,"sm/I");
+  meantree->Branch("smmean",&smmean,"row/F");
   
+  for(Int_t idet = 0; idet < kDet; idet++)
+    {
+      for (Int_t ism = 0; ism < kMaxSMN; ism++)
+       {
+         det    = idet;
+         sm     = ism;
+         smmean = modmean[idet][ism];
+         meantree->Fill();
+       }
+    }
+
 }
 // ------------------------------------------------------------------------ //
-void AliPMDCalibGain::AnalyseHotCell(TTree *hottree)
+void AliPMDCalibGain::FindHotCell(TTree *hottree, Float_t xvar)
 {
   // Calculates the mean
   Int_t   det, sm, row, col;
@@ -516,7 +543,9 @@ void AliPMDCalibGain::AnalyseHotCell(TTree *hottree)
   Float_t meannhit;
   Float_t meanSqnhit;
   Float_t sigmanhit,nhitcut;
-  
+
+  //Float_t xvar = 5.;
+
   hottree->Branch("det",&det,"det/I");
   hottree->Branch("sm",&sm,"sm/I");
   hottree->Branch("row",&row,"row/I");
@@ -532,7 +561,7 @@ void AliPMDCalibGain::AnalyseHotCell(TTree *hottree)
              meannhit   = fTempnhit[idet][ism]/fCountSm[idet][ism];
              meanSqnhit = fTempnhitSq[idet][ism]/fCountSm[idet][ism];
              sigmanhit  = sqrt(meanSqnhit-(meannhit*meannhit));
-             nhitcut    = meannhit + 6.*sigmanhit;
+             nhitcut    = meannhit + xvar*sigmanhit;
 
              for(Int_t irow = 0; irow < kMaxRow; irow++)
                {
index 86416cba35a67e6c529eb4a6390ba24c707abba6..5b792edd15faa5982c4351ad5c5568a20c305c64 100644 (file)
@@ -24,8 +24,8 @@ class AliPMDCalibGain : public TObject
 
   Bool_t ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlcont);  //Looks for iso cells
 
-  void Analyse(TTree *gaintree);
-  void AnalyseHotCell(TTree *hottree); // finds hot cell
+  void Analyse(TTree *gaintree, TTree *meantree);
+  void FindHotCell(TTree *hottree, Float_t xvar); // finds hot cell
   
  private:
 
@@ -50,6 +50,6 @@ class AliPMDCalibGain : public TObject
   Float_t fTempnhitSq[kDet][kMaxSMN];  // square of hit freq. of each mod.
   FILE    *fpw;                        // write the temp file
 
-ClassDef(AliPMDCalibGain,6)            // description 
+ClassDef(AliPMDCalibGain,7)            // description 
 };
 #endif // ALIPMDCALIBGAIN_H
index e68ed50b632002cbb3b6eed77e5e2677e4ba344c..bb59e3d325a5a14bdf97e19f743b8f946df5adbe 100644 (file)
@@ -18,7 +18,6 @@ extern "C" {
 
 #include "event.h"
 #include "monitor.h"
-//#include "daqDA.h"
 
 #include <Riostream.h>
 #include <stdio.h>
@@ -56,14 +55,15 @@ int main(int argc, char **argv) {
     int status = 0;
 
 
-    Int_t filestatus = -1, totevt = -1;
-    Int_t maxevt = -1;
+    Int_t filestatus = -1, xvar = 5;
+    Int_t totevt = -1, maxevt = -1;
 
     // Reads the pedestal file and keep the values in memory for subtraction
 
     AliPMDCalibGain calibgain;
 
     // Fetch the pedestal file - PMD_PED.root 
+
     status = daqDA_DB_getFile("PMD_PED.root","PMD_PED.root");
 
     if(!status)
@@ -75,12 +75,13 @@ int main(int argc, char **argv) {
        printf("*** Pedestal file NOT retrieved from DB *** \n");
        return -1;
       }
-
+    
     Int_t pstatus = calibgain.ExtractPedestal("PMD_PED.root");
 
     if(pstatus == -3) return -3;
 
-    TTree *ic = NULL;
+    TTree *ic    = NULL;
+    TTree *meanc = NULL;
 
     // Retrieve the PMD_GAIN_CONFIGFILE
     status = daqDA_DB_getFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
@@ -96,10 +97,11 @@ int main(int argc, char **argv) {
       }
     else
       {
-       fscanf(fp1,"%d %d %d\n",&filestatus, &totevt,&maxevt);
-       //printf("%d %d %d\n",filestatus, totevt, maxevt);
+       fscanf(fp1,"%d %d %d %d\n",&filestatus, &xvar, &totevt, &maxevt);
+       //printf("%d %d %d %d\n",filestatus, xvar, totevt, maxevt);
       }
     fclose(fp1);
+
     
     if (filestatus == 1)
       {
@@ -113,8 +115,19 @@ int main(int argc, char **argv) {
          {
            printf("--- pmd_gain_tempfile.dat: not retrieved from DB ---\n");
          }
+       // Retrieve the hot cell file from DB - PMD_HOT.root
+       status = daqDA_DB_getFile("PMD_HOT.root","PMD_HOT.root");
+       if(!status)
+         {
+           calibgain.ExtractHotChannel("PMD_HOT.root");
+         }
+       else
+         {
+           printf("--- pmd_gain_tempfile.dat: not retrieved from DB ---\n");
+         }
       }
 
+
     // decoding the events
     
 
@@ -214,7 +227,26 @@ int main(int argc, char **argv) {
 
     /* exit when last event received, no need to wait for TERM signal */
 
-    ic = new TTree("ic","PMD Gain tree");
+
+    ic    = new TTree("ic","PMD Gain tree");
+    meanc = new TTree("meanc","PMD Module mean tree");
+
+    if (filestatus == 0)
+      {
+       TFile *hotRun = new TFile ("PMD_HOT.root","RECREATE");
+
+       TTree *hot = new TTree("hot","PMD Hot cell tree");
+       
+       calibgain.FindHotCell(hot,xvar);
+       
+       hot->Write();
+       hotRun->Close();
+
+       // store the hot cell root file in the DB
+
+       status = daqDA_DB_storeFile("PMD_HOT.root","PMD_HOT.root");
+      }
+
 
     totevt += nevents_physics++;
 
@@ -234,7 +266,8 @@ int main(int argc, char **argv) {
        status = daqDA_DB_storeFile("pmd_gain_tempfile.dat","pmd_gain_tempfile.dat");
 
        filestatus = 1;
-       fprintf(fp1,"%d %d %d\n",filestatus,totevt,maxevt);
+       fprintf(fp1,"%d %d %d %d\n",filestatus,xvar,totevt,maxevt);
+       fclose(fp1);
 
        // Store the configfile in the DB
        status = daqDA_DB_storeFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
@@ -247,38 +280,50 @@ int main(int argc, char **argv) {
        printf("***  Writing the PMDGAINS.root file           ***\n");
        printf("-----------------------------------------------\n");
 
-       calibgain.Analyse(ic);
+       calibgain.Analyse(ic, meanc);
 
        TFile * gainRun = new TFile ("PMDGAINS.root","RECREATE"); 
        ic->Write();
        gainRun->Close();
 
+       TFile * meanRun = new TFile ("PMD_MEAN_SM.root","RECREATE"); 
+       meanc->Write();
+       meanRun->Close();
+
+
        filestatus = 0;
        totevt     = 0;
-       fprintf(fp1,"%d %d %d\n",filestatus,totevt,maxevt);
+       fprintf(fp1,"%d %d %d %d\n",filestatus,xvar,totevt,maxevt);
+       fclose(fp1);
 
        // Store the configfile in the DB
        status = daqDA_DB_storeFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
-
       }
-    fclose(fp1);
     
     delete ic;
     ic = 0;
+
+    delete meanc;
+    meanc = 0;
     
 
     /* store the result file on FES */
  
     if (filestatus == 0)
       {
-       printf("root file is created and getting exported\n");
+       printf("root file for cell gain is created and getting exported\n");
        status = daqDA_FES_storeFile("PMDGAINS.root","PMDGAINS.root");
+       printf("root file for hot cell is created and getting exported\n");
+       status = daqDA_FES_storeFile("PMD_HOT.root","PMD_HOT.root");
+       printf("root file for normalised means of different modules\n");
+       status = daqDA_FES_storeFile("PMD_MEAN_SM.root","PMD_MEAN_SM.root");
       }
-
+    
     if (status) {
       status = -2;
     }
 
 
+
     return status;
 }
index fb171c2a490eb3e77ed3536fe12443454bae1113..e3e845aabf6aa5fe17f73afd01713a75e7ae4361 100644 (file)
@@ -1 +1 @@
-0 0 2000
+0 0 2000