PHOS/DA/CMakeLists.txt
authorkharlov <Yuri.Kharlov@cern.ch>
Fri, 27 Feb 2015 20:42:32 +0000 (23:42 +0300)
committerkharlov <Yuri.Kharlov@cern.ch>
Fri, 27 Feb 2015 20:42:32 +0000 (23:42 +0300)
PHOS/DA/PHOSCPVBCMda.cxx
PHOS/DA/PHOSCPVGAINda.cxx [new file with mode: 0644]
PHOS/DA/PHOSCPVPEDda.cxx
PHOS/PHOSbase/AliPHOSCpvGainCalibDA.cxx [new file with mode: 0644]
PHOS/PHOSbase/AliPHOSCpvGainCalibDA.h [new file with mode: 0644]
PHOS/PHOSbase/AliPHOSCpvPedProducer.cxx
PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.cxx
PHOS/PHOSbase/CMakeLists.txt
PHOS/PHOSbase/PHOSbaseLinkDef.h

index 9bac53d..0c3dd0e 100644 (file)
@@ -3,11 +3,11 @@ CPV BCM DA for processing physics runs and producing bad channel map for further
 
 Contact: Sergey Evdokimov <sevdokim@cern.ch>
 Link: https://twiki.cern.ch/twiki/bin/view/ALICE/CPVda
-Reference run: 
+Reference run: 214340 (/afs/cern.ch/user/s/sevdokim/public/CPV_run214340_standalone.raw)
 Run Type:  PHYSICS
 DA Type: MON
-Number of events needed: ? events
-Input files: thr?_??.dat
+Number of events needed: ~100000 events
+Input files: thr?_??.dat CpvPeds.root PHOSCPVBCMda.cfg
 Output files: CpvBadMap.root
 Trigger types used: PHYSICS_EVENT
 */
@@ -16,6 +16,8 @@ Trigger types used: PHYSICS_EVENT
 #include "event.h"
 #include "monitor.h"
 #include "daqDA.h"
+//AMORE monitoring framework
+#include <AmoreDA.h>
 
 //system
 #include <Riostream.h>
@@ -48,7 +50,8 @@ Trigger types used: PHYSICS_EVENT
 #include "TMath.h"
 #include "TRandom.h"
 
-void FillBadMap(TH2* DigMap, TH2* BadMap);
+Double_t FillNoisyMap(TH2* DigMap, TH2* BadMap); //returns mean occupancy when all bad channels are excluded
+void FillDeadMap(TH2* PedMap, TH2* DigMap, TH2* BadMap);
 
 int main( int argc, char **argv )
 {
@@ -57,8 +60,10 @@ int main( int argc, char **argv )
                                         "TStreamerInfo",
                                         "RIO",
                                         "TStreamerInfo()");
-  Int_t status,print;
+  Int_t status,statusPeds=0,print,statusBadMap=0;
   Int_t sigcut=3;
+  Int_t minAmpl = 10;//minimal amplitude for consideration, to be read from DAQ DB
+  Int_t minOccupancy = 10;//min occupancy for publishing in OCDB, to be read from DAQ DB
   Bool_t turbo = kTRUE;
 
   if (argc!=2) {
@@ -72,6 +77,18 @@ int main( int argc, char **argv )
   /* report progress */
   daqDA_progressReport(0);
 
+  /* retrieve configuration file from DAQ DB */
+  status=daqDA_DB_getFile("PHOSCPVGAINda.cfg", "PHOSCPVGAINda.cfg");
+  if(!status) {
+    char buf[500]; 
+    FILE * fConf = fopen("PHOSCPVGAINda.cfg","r");
+    while(fgets(buf, 500, fConf)){
+      if(buf[0]=='#') continue;//comment indicator
+      if(strstr(buf,"minOccupancy")) sscanf(buf,"%*s %d",&minOccupancy);
+      if(strstr(buf,"minAmpl")) sscanf(buf,"%*s %d",&minAmpl);
+    }
+  }
+
 
   /* retrieve pedestal tables from DAQ DB */
   for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2){
@@ -80,11 +97,21 @@ int main( int argc, char **argv )
       status=daqDA_DB_getFile(Form("thr%d_%02d.dat", iDDL, iCC),Form("thr%d_%02d.dat", iDDL, iCC));
       if(status!=0) {
        printf("cannot retrieve file %s from DAQ DB. Exit.\n", Form("thr%d_%02d.dat", iDDL, iCC));
-       //return -1;
+       //return 11;//error code 11 (cannot retrive thr.dat from DAQ DB)
       }
     }
   }
 
+  /* retrieve pedestals in root format to find dead channels */
+  statusPeds=daqDA_DB_getFile("CpvPeds.root", "CpvPeds.root");
+  if(statusPeds) {
+    printf("cannot retrieve CpvPeds.root from DAQ DB! No dead channels will be found.");
+    //return 12; //error code 12 (cannot retrive CpvPeds.root from DAQ DB)
+  }
+  
+  /* retrieve bad map from DAQ DB to see if we have some statistics saved form previous runs */
+  statusBadMap=daqDA_DB_getFile("CpvBadMap.root", "CpvBadMap.root");
+
   /* connecting to raw data */
   status=monitorSetDataSource( argv[1] );
   if (status!=0) {
@@ -118,7 +145,7 @@ int main( int argc, char **argv )
   AliPHOSCpvRawDigiProducer* digiProducer = new AliPHOSCpvRawDigiProducer();
   digiProducer->SetTurbo(turbo);
   digiProducer->LoadPedFiles();
-  digiProducer->SetCpvMinAmp(0);
+  digiProducer->SetCpvMinAmp(minAmpl);
 
   //digits
   TClonesArray *digits = new TClonesArray("AliPHOSDigit",1);
@@ -128,16 +155,31 @@ int main( int argc, char **argv )
 
   //maps of digits and bad channels
   TH2F* hMapOfDig[2*AliPHOSCpvParam::kNDDL]; 
-  TH2I *hBadChMap[2*AliPHOSCpvParam::kNDDL]; 
-  for(Int_t iDDL=0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++){
-    hMapOfDig[iDDL] = new TH2F(Form("hMapOfDig%d",iDDL),Form("Map of digits with substructed pedestals, DDL = %d",iDDL),
-                         AliPHOSCpvParam::kPadPcX,0,AliPHOSCpvParam::kPadPcX,
-                         AliPHOSCpvParam::kPadPcY,0,AliPHOSCpvParam::kPadPcY);
-    hBadChMap[iDDL] = new TH2I(Form("hBadMap%d",iDDL),Form("Bad Channels Map, DDL= %d",iDDL),
-                         AliPHOSCpvParam::kPadPcX,0,AliPHOSCpvParam::kPadPcX,
-                         AliPHOSCpvParam::kPadPcY,0,AliPHOSCpvParam::kPadPcY);
+  TH2I *hBadChMap[2*AliPHOSCpvParam::kNDDL];
+  
+  for (int i = 0;i<2*AliPHOSCpvParam::kNDDL;i++){
+    hMapOfDig[i]= 0x0;
+    hBadChMap[i]= 0x0;
   }
 
+  //any previously gained statistics?
+  TFile *fPreviousStatistics = 0x0;
+  if(!statusBadMap) fPreviousStatistics = TFile::Open("CpvBadMap.root");
+
+  for(Int_t iDDL=0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++){
+    if(!statusBadMap){//we have some statistics from previous runs
+      if(fPreviousStatistics->Get(Form("hMapOfDig%d",iDDL)))
+       hMapOfDig[iDDL] = new TH2F(*(TH2F*)(fPreviousStatistics->Get(Form("hMapOfDig%d",iDDL))));
+    }
+    if(!hMapOfDig[iDDL])
+      hMapOfDig[iDDL] = new TH2F(Form("hMapOfDig%d",iDDL),Form("Map of digits with substructed pedestals, DDL = %d",iDDL),
+                                AliPHOSCpvParam::kPadPcX,0,AliPHOSCpvParam::kPadPcX,
+                                AliPHOSCpvParam::kPadPcY,0,AliPHOSCpvParam::kPadPcY);
+      hBadChMap[iDDL] = new TH2I(Form("hBadMap%d",iDDL),Form("Bad Channels Map, DDL= %d",iDDL),
+                                AliPHOSCpvParam::kPadPcX,0,AliPHOSCpvParam::kPadPcX,
+                                AliPHOSCpvParam::kPadPcY,0,AliPHOSCpvParam::kPadPcY);
+      
+  }
   /* report progress */
   daqDA_progressReport(10);
 
@@ -203,21 +245,57 @@ int main( int argc, char **argv )
   /* report progress */
   daqDA_progressReport(90);
 
+  TH2* hPedMap[2*AliPHOSCpvParam::kNDDL];
+  //prepare ped maps for dead channels search
+  TFile* fPeds = TFile::Open("CpvPeds.root");
+  for(int iDDL = 0; iDDL< 2*AliPHOSCpvParam::kNDDL; iDDL+=2){
+    if(fPeds->Get(Form("fPedMeanMap%d",iDDL)))
+      hPedMap[iDDL] = new TH2F(*(TH2F*)(fPeds->Get(Form("fPedMeanMap%d",iDDL))));
+    else
+      hPedMap[iDDL] = 0x0;
+  }
+  fPeds->Close();
+
+
+
+  //find noisy channels (i.e. channelOccupancy > 10*meanOccupancy)
   TFile *fSave = TFile::Open("CpvBadMap.root","RECREATE");
 
+  Double_t meanOccupancy = 0;
+  amore::da::AmoreDA* myAmore = new amore::da::AmoreDA(amore::da::AmoreDA::kSender);
   for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2){
     if(hMapOfDig[iDDL]->GetEntries()>0) {
-      FillBadMap(hMapOfDig[iDDL],hBadChMap[iDDL]);
+      Double_t Occupancy = FillNoisyMap(hMapOfDig[iDDL],hBadChMap[iDDL]);
+      if(meanOccupancy>0&&Occupancy<meanOccupancy) meanOccupancy = Occupancy;
+      if(meanOccupancy==0) meanOccupancy = Occupancy;
+      if(Occupancy>minOccupancy) FillDeadMap(hPedMap[iDDL],hMapOfDig[iDDL],hBadChMap[iDDL]);
       fSave->WriteObject(hMapOfDig[iDDL],Form("hMapOfDig%d",iDDL));
+      //send digit maps to amore
+      myAmore->Send(Form("hMapOfDig%d",iDDL),hMapOfDig[iDDL]);
       fSave->WriteObject(hBadChMap[iDDL],Form("hBadChMap%d",iDDL));
     }
   }
   fSave->Close();
-  //status = daqDA_DB_storeFile("CpvBadMap.root","CpvBadMap.root");
-  //if(status) printf("Failed to store CpvBadMap.root in DAQ DB!\n");
-  status = daqDA_FES_storeFile("CpvBadMap.root","CpvBadMap.root");
-  if(status) printf("Failed to store CpvBadMap.root in DAQ FXS!\n");
+  cout<< "meanOccupancy = "<<meanOccupancy<<"; minOccupancy = "<<minOccupancy<<endl;
+  
+  if(meanOccupancy>minOccupancy){//send file to FES if only statistics is enough
+    status = daqDA_FES_storeFile("CpvBadMap.root","CpvBadMap.root");
+    if(status) printf("Failed to store CpvBadMap.root in DAQ FXS!\n");
+    //store dummy file in DAQ DB
+    TFile *fDummy = TFile::Open("dummy.root","RECREATE");
+    fDummy->Close();
+    status = daqDA_DB_storeFile("dummy.root","CpvBadMap.root");
+    if(status) printf("Failed to store dummy.root as CpvBadMap.root in DAQ DB!\n");
+    //send bad map to amore as well
+    for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2)
+      if(hMapOfDig[iDDL]->GetEntries()>0)
+       myAmore->Send(Form("hBadChMap%d",iDDL),hBadChMap[iDDL]);
+  }
+  else{//store file with current statistics in DAQ DB for further use.
+    status = daqDA_DB_storeFile("CpvBadMap.root","CpvBadMap.root");
+    if(status) printf("Failed to store CpvBadMap.root in DAQ DB!\n");
 
+  }
 
   /* report progress */
   daqDA_progressReport(100);
@@ -226,7 +304,9 @@ int main( int argc, char **argv )
   return status;
 }
 //==============================================================================
-void FillBadMap(TH2* hDigMap, TH2* hBadChMap){
+Double_t FillNoisyMap(TH2* hDigMap, TH2* hBadChMap){
+  if(!hDigMap)return 0;
+  if(!hBadChMap)return 0;
   Double_t meanOccupancy = hDigMap->GetEntries()/7680.;
   Double_t nDigits=0,nChannels=0;
   int x,y,iterationNumber=1;
@@ -267,6 +347,27 @@ void FillBadMap(TH2* hDigMap, TH2* hBadChMap){
        }
     
   }
-  cout<<"Total number of bad channels: "<<nBadChannelsTotal<<endl;
+  cout<<"Total number of noisy channels (DDL = 4): "<<nBadChannelsTotal<<endl;
+  return meanOccupancy;
+}
+//==============================================================================
+void FillDeadMap(TH2* hPedMap, TH2* hDigMap, TH2* hBadChMap){
+  if(!hPedMap) return;
+  if(!hBadChMap) return;
+  if(!hDigMap)return;
+  Int_t nDeadTotal = 0;
+  for(int ix = 1;ix<=128;ix++)
+    for(int iy = 1;iy<=60;iy++){
+       if(hPedMap->GetBinContent(ix,iy) < 1. && hBadChMap->GetBinContent(ix,iy)==0) {
+         nDeadTotal++;
+         hBadChMap->Fill(ix-1,iy-1);
+         printf("Dead channel found! DDL=4 x=%d y=%d\n",ix-1,iy-1);
+       }
+       if(hDigMap->GetBinContent(ix,iy) < 1. && hBadChMap->GetBinContent(ix,iy)==0) {
+         nDeadTotal++;
+         hBadChMap->Fill(ix-1,iy-1);
+         printf("Dead channel found! DDL=4 x=%d y=%d\n",ix-1,iy-1);
+       }
+    }
+  cout<<"Total number of noisy channels (DDL = 4): "<<nDeadTotal<<endl;
 }
-
diff --git a/PHOS/DA/PHOSCPVGAINda.cxx b/PHOS/DA/PHOSCPVGAINda.cxx
new file mode 100644 (file)
index 0000000..4d2a567
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+CPV GAIN DA for processing physics runs and producing amplitude histograms in every channel for further calibration coefs calulation.
+
+Contact: Sergey Evdokimov <sevdokim@cern.ch>
+Link: https://twiki.cern.ch/twiki/bin/view/ALICE/CPVda
+Reference run: 214340 (/afs/cern.ch/user/s/sevdokim/public/CPV_run214340_standalone.raw)
+Run Type:  PHYSICS
+DA Type: MON
+Number of events needed: 1M events
+Input files: thr?_??.dat CpvBadMap.root PHOSCPVGAINda.cfg
+Output files: CpvCalibrSupply.root
+Trigger types used: PHYSICS_EVENT
+*/
+
+//daqDA
+#include "event.h"
+#include "monitor.h"
+#include "daqDA.h"
+//AMORE monitoring framework
+#include <AmoreDA.h>
+
+//system
+#include <Riostream.h>
+#include <stdlib.h>
+#include <fstream>
+#include <string>
+
+//AliRoot
+#include "AliPHOSCpvRawDigiProducer.h"
+#include "AliPHOSCpvGainCalibDA.h"
+#include "AliPHOSCpvParam.h"
+#include "AliRawReaderDate.h"
+#include "AliBitPacking.h"
+#include "AliPHOSDigit.h"
+#include "AliPHOSGeometry.h"
+
+//ROOT
+#include "TROOT.h"
+#include "TPluginManager.h"
+#include "TSAXParser.h"
+#include "TTree.h"
+#include "TList.h"
+#include "TMath.h"
+#include "TString.h"
+#include "TFile.h"
+#include "TSystem.h"
+#include "TKey.h"
+#include "TH2S.h"
+#include "TH2F.h"
+#include "TObject.h"
+#include "TBenchmark.h"
+#include "TMath.h"
+#include "TRandom.h"
+
+
+int main( int argc, char **argv )
+{
+  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                        "*",
+                                        "TStreamerInfo",
+                                        "RIO",
+                                        "TStreamerInfo()");
+  Int_t status,statusBadCh=0,statusCalibrSupply=0,print;
+  Int_t sigcut=3;
+  Int_t minAmpl = 10;//minimal amplitude for consideration, to be read from DAQ DB
+  Int_t minOccupancy = 100;//min occupancy for publishing in OCDB, to be read from DAQ DB
+  Bool_t turbo = kTRUE;
+
+  if (argc!=2) {
+    printf("Wrong number of arguments\n");
+    return -1;
+  }
+
+  // log start of process
+  printf("Cpv gain calibration DA program started\n");
+
+  /* report progress */
+  daqDA_progressReport(0);
+
+  /* retrieve configuration file from DAQ DB */
+  status=daqDA_DB_getFile("PHOSCPVGAINda.cfg", "PHOSCPVGAINda.cfg");
+  if(!status) {
+    char buf[500]; 
+    FILE * fConf = fopen("PHOSCPVGAINda.cfg","r");
+    while(fgets(buf, 500, fConf)){
+      if(buf[0]=='#') continue;//comment indicator
+      if(strstr(buf,"minOccupancy")) sscanf(buf,"%*s %d",&minOccupancy);
+      if(strstr(buf,"minAmpl")) sscanf(buf,"%*s %d",&minAmpl);
+    }
+  }
+  
+
+  /* retrieve pedestal tables from DAQ DB */
+  for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2){
+    if(iDDL!=4) continue; // only one module with DDL=4 by now
+    for (int iCC = 0; iCC<AliPHOSCpvParam::kNRows; iCC++){
+      status=daqDA_DB_getFile(Form("thr%d_%02d.dat", iDDL, iCC),Form("thr%d_%02d.dat", iDDL, iCC));
+      if(status!=0) {
+       printf("cannot retrieve file %s from DAQ DB. Exit.\n", Form("thr%d_%02d.dat", iDDL, iCC));
+       //return -1;
+      }
+    }
+  }
+
+  /* retrieve Bad Channel Map from DAQ DB */
+  statusBadCh=daqDA_DB_getFile("CpvBadMap.root", "CpvBadMap.root");
+  if(statusBadCh!=0) printf("Cannot retrieve file CpvBadMap.root from DAQ DB! Bad channels map will not be used!");
+
+  /* retrieve previously collected histograms from DAQ DB */
+  statusCalibrSupply=daqDA_DB_getFile("CpvCalibrSupply.root", "CpvCalibrSupply.root");
+  if(statusCalibrSupply!=0) printf("Cannot retrieve file CpvCalibrSupply.root from DAQ DB! No previously collected histograms found!");
+
+  /* connecting to raw data */
+  status=monitorSetDataSource( argv[1] );
+  if (status!=0) {
+    printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+    return -1;
+  }
+
+  /* declare monitoring program */
+  status=monitorDeclareMp( __FILE__ );
+  if (status!=0) {
+    printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
+    return -1;
+  }
+
+  /* define wait event timeout - 1s max */
+  monitorSetNowait();
+  monitorSetNoWaitNetworkTimeout(1000);
+
+    /* report progress */
+  daqDA_progressReport(5);
+
+
+  // init event counter
+  Int_t iPhysEvnt=0;
+  Int_t iTotEvnt =0;
+
+  // Reader
+  AliRawReader * reader;
+
+  //digiProducer
+  AliPHOSCpvRawDigiProducer* digiProducer = new AliPHOSCpvRawDigiProducer();
+  digiProducer->SetTurbo(turbo);
+  digiProducer->LoadPedFiles();
+  digiProducer->SetCpvMinAmp(minAmpl);
+
+  //digits
+  TClonesArray *digits = new TClonesArray("AliPHOSDigit",1);
+  digits->SetName("DIGITS");
+  
+  //DA object
+  AliPHOSCpvGainCalibDA *fDA = new AliPHOSCpvGainCalibDA();
+  TFile *fCalibrSupplyRoot=0x0; 
+  if(!statusCalibrSupply) fCalibrSupplyRoot = TFile::Open("CpvCalibrSupply.root");
+  fDA->InitCalibration(fCalibrSupplyRoot);
+  if(fCalibrSupplyRoot)fCalibrSupplyRoot->Close();
+  if(!statusBadCh)fDA->SetDeadChannelMapFromFile("CpvBadMap.root");
+
+  /* report progress */
+  daqDA_progressReport(10);
+
+  /* main loop (infinite) */
+  for(;;) { // infinite loop
+    struct eventHeaderStruct *event;
+    eventTypeType eventT;
+
+    /* check shutdown condition */
+    if (daqDA_checkShutdown()) {break;}
+
+    // get next event
+    status=monitorGetEventDynamic((void **)&event);
+    if (status==MON_ERR_EOF) { // end of monitoring file has been reached
+      printf("End of monitoring file has been reached! \n");
+      break;
+    }
+
+    if (status!=0) {
+      printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
+      break;
+    }
+
+    // retry if got no event
+    if (event==NULL) continue;
+
+    // use event - here, just write event id to result file
+    eventT=event->eventType;
+    if (eventT==PHYSICS_EVENT) { //we use PHYSICS_EVENT for pedestal not CALIBRATION_EVENT???
+      iTotEvnt++;
+      reader = new AliRawReaderDate((void*)event);
+      digiProducer->LoadNewEvent(reader);
+      digiProducer->MakeDigits(digits);
+      if(digits->GetEntriesFast()>0) iPhysEvnt++;
+      fDA->FillAmplA0Histos(digits);
+      digits->Clear("C");
+      delete reader;
+    } // if PHYSICS_EVENT
+
+    free(event);
+
+    /* exit when last event received, no need to wait for TERM signal */
+    if (eventT==END_OF_RUN) {
+      printf("EOR event detected\n");
+      break;
+    }
+  }
+
+  Printf(" Received %d events, %d good events",iTotEvnt,iPhysEvnt);
+  /* report progress */
+  daqDA_progressReport(90);
+
+  /* save collected histos, send files to DBs */
+  fDA->WriteA0HistosToFile();
+
+  //calculate occupancy
+  Double_t Occupancy = 0;
+  TFile* fSave = TFile::Open("CpvCalibrSupply.root");
+  for(Int_t iDDL = 0;iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2){
+    if(iDDL!=4)continue;
+    if(fSave->Get(Form("hEntriesMap%d",iDDL))){
+      TH2* hEntries = (TH2*)(fSave->Get(Form("hEntriesMap%d",iDDL)));
+      Occupancy = hEntries->GetEntries()/7680.;
+    }
+  }
+  fSave->Close();
+  cout<<"Occupancy = "<<Occupancy<<"; minOccupancy = "<<minOccupancy<<endl;
+  if(Occupancy>minOccupancy){//if we have enough statistics to calculate calibration
+    status = daqDA_FES_storeFile("CpvCalibrSupply.root","CpvCalibrSupply.root");
+    if(status) printf("Failed to store CpvCalibrSupply.root in DAQ FXS!\n");
+    TFile * fDummy = TFile::Open("dummy.root");
+    status = daqDA_DB_storeFile("dummy.root","CpvCalibrSupply.root");
+    if(status) printf("Failed to store dummy.root as CpvCalibrSupply.root in DAQ DB!\n");
+  }
+  else{//store CpvCalibrSupply.root in DAQ DB for future
+    status = daqDA_DB_storeFile("CpvCalibrSupply.root","CpvCalibrSupply.root");
+    if(status) printf("Failed to CpvCalibrSupply.root in DAQ DB!\n");
+
+  }
+  //send pictures to amore
+  TList* histos = fDA->GetQAHistos();
+  amore::da::AmoreDA* myAmore = new amore::da::AmoreDA(amore::da::AmoreDA::kSender);
+  Int_t iHist = 0;
+  while(histos->At(iHist)){
+    myAmore->Send(histos->At(iHist)->GetName(),histos->At(iHist));
+    iHist++;
+  }
+
+  /* report progress */
+  daqDA_progressReport(100);
+
+
+  return 0;
+}
index 451be9f..ecbefa7 100644 (file)
@@ -15,6 +15,9 @@ Trigger types used: PHYSICS_EVENT
 #include "event.h"
 #include "monitor.h"
 #include "daqDA.h"
+//AMORE monitoring framework
+#include <AmoreDA.h>
+
 //system
 #include <Riostream.h>
 #include <stdlib.h>
@@ -147,27 +150,47 @@ int main( int argc, char **argv )
   /* report progress */
   daqDA_progressReport(95);
 
-  for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++){
-    if(pedProducer -> CalcPedestal(iDDL)){
-      pedProducer -> WritePedFiles(iDDL);
-      for (int iCC = 0; iCC<AliPHOSCpvParam::kNRows; iCC++){
-       status=daqDA_DB_storeFile(Form("thr%d_%02d.dat", iDDL, iCC),Form("thr%d_%02d.dat", iDDL, iCC));
-       if(status) printf("Failed to store thr%d_%02d.dat in DAQ DB!\n",iDDL, iCC);
-       //status=daqDA_FES_storeFile(Form("thr%d_%02d.dat", iDDL, iCC));
-       //if(status) printf("Failed to export thr%d_%02d.dat to DAQ FES!\n",iDDL, iCC);
+  pedProducer->WriteAllHistsToFile("CpvPeds.root");
+
+  //send file with histos to amore
+  amore::da::AmoreDA* myAmore = new amore::da::AmoreDA(amore::da::AmoreDA::kSender);
+  TFile* fSend = TFile::Open("CpvPeds.root");
+  TH2F *pedsMean = (TH2F*)fSend->Get("fPedMeanMap4");
+  pedsMean->SetDrawOption("colz");
+  myAmore->Send("fPedMeanMap4",pedsMean);
+  TH2F *pedsSig = (TH2F*)fSend->Get("fPedSigMap4");
+  pedsSig->SetDrawOption("colz");
+  myAmore->Send("fPedSigMap4",pedsSig);
+  TH1F *h1DPedMean=(TH1F*)fSend->Get("f1DPedMean4");
+  h1DPedMean->GetXaxis()->SetRangeUser(0.,750.);
+  myAmore->Send("f1DPedMean4",h1DPedMean);
+  TH1F *h1DPedSig=(TH1F*)fSend->Get("f1DPedSig4");
+  h1DPedSig->GetXaxis()->SetRangeUser(0.,10.);
+  myAmore->Send("f1DPedSig4",h1DPedSig);
+  fSend->Close();
+
+  if(iPhysEvnt>=1000){//we have enough events to publish data
+    status = daqDA_DB_storeFile("CpvPeds.root","CpvPeds.root");
+    if(status) printf("Failed to store CpvPeds.root in DAQ DB!\n");
+  
+    status = daqDA_FES_storeFile("CpvPeds.root","CpvPeds.root");
+    if(status) printf("Failed to store CpvPeds.root in DAQ FXS!\n");
+
+    for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++){
+      if(pedProducer -> CalcPedestal(iDDL)){
+       pedProducer -> WritePedFiles(iDDL);
+       for (int iCC = 0; iCC<AliPHOSCpvParam::kNRows; iCC++){
+         status=daqDA_DB_storeFile(Form("thr%d_%02d.dat", iDDL, iCC),Form("thr%d_%02d.dat", iDDL, iCC));
+         if(status) printf("Failed to store thr%d_%02d.dat in DAQ DB!\n",iDDL, iCC);
+       }
       }
     }
-  }
+  }else return 10;//error code 10 (not enough events!)
 
-  pedProducer->WriteAllHistsToFile("CpvPeds.root");
-  status = daqDA_DB_storeFile("CpvPeds.root","CpvPeds.root");
-  if(status) printf("Failed to store CpvPeds.root in DAQ DB!\n");
-  status = daqDA_FES_storeFile("CpvPeds.root","CpvPeds.root");
-  if(status) printf("Failed to store CpvPeds.root in DAQ FXS!\n");
 
   /* report progress */
   daqDA_progressReport(100);
 
 
-  return status;
+  return 0;
 }
diff --git a/PHOS/PHOSbase/AliPHOSCpvGainCalibDA.cxx b/PHOS/PHOSbase/AliPHOSCpvGainCalibDA.cxx
new file mode 100644 (file)
index 0000000..f8b7dc7
--- /dev/null
@@ -0,0 +1,269 @@
+#include "AliPHOSCpvGainCalibDA.h" 
+#include "AliPHOSCpvParam.h" 
+#include "AliPHOSCpvRawDigiProducer.h"
+#include "AliPHOSDigit.h"
+#include <fstream>
+#include <iostream>
+#include <TTree.h>
+#include <TF1.h>
+#include <TFitResult.h>
+#include <TFitResultPtr.h>
+#include <TSystem.h>
+#include <TTimeStamp.h>
+#include "AliPHOSGeometry.h"
+
+#include "TFile.h"
+
+ClassImp(AliPHOSCpvGainCalibDA) ;
+
+using namespace std;
+
+using std::ifstream;
+using std::ofstream;
+
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliPHOSCpvGainCalibDA::AliPHOSCpvGainCalibDA():
+  TObject(),
+  fGeom(0)
+{
+  //
+  //constructor
+  //
+  
+  fGeom=AliPHOSGeometry::GetInstance() ;
+  if(!fGeom) fGeom = AliPHOSGeometry::GetInstance("IHEP");
+
+  for(Int_t iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++){
+    fDeadMap[iDDL] = 0x0;
+    fEntriesMap[iDDL] = 0x0;
+    for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++) 
+      for(Int_t iY=1; iY<AliPHOSCpvParam::kPadPcY; iY++) 
+       fAmplA0Histo[iDDL][iX][iY] = 0x0;
+  }
+  CreateQAHistos();
+}  //constructor
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliPHOSCpvGainCalibDA::~AliPHOSCpvGainCalibDA()
+{
+  //
+  //destructor
+  //
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++) {
+    for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++) {
+      for(Int_t iY=1; iY<AliPHOSCpvParam::kPadPcY; iY++) {
+       if(fAmplA0Histo[iDDL][iX][iY]) delete fAmplA0Histo[iDDL][iX][iY];
+      }//iY
+    }//iX
+    if(fDeadMap[iDDL])delete fDeadMap[iDDL];
+    if(fEntriesMap[iDDL]) delete fEntriesMap[iDDL];
+  }//iDDL
+
+  //delete fhErrors;
+}  //destructor
+//***********************************************************************
+void AliPHOSCpvGainCalibDA::InitCalibration(TFile *fCalibrSupplyRoot){
+  //tries to open CpvCalibrSupply.root for loading previously filled histograms;
+  //creates new histos otherwise.
+  //TFile *fCalibrSupplyRoot = TFile::Open("CpvCalibrSupply.root");
+  for(Int_t iDDL = 0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++){
+    if(fCalibrSupplyRoot)
+      if(fCalibrSupplyRoot->Get(Form("hEntriesMap%d",iDDL))) 
+       fEntriesMap[iDDL]=new TH2I(*(TH2I*)(fCalibrSupplyRoot->Get(Form("hEntriesMap%d",iDDL))));
+      else fEntriesMap[iDDL]=0x0;
+    else fEntriesMap[iDDL]=0x0;
+    for(Int_t iX = 0;iX  <AliPHOSCpvParam::kPadPcX;iX++)
+      for(Int_t iY = 0;iY  <AliPHOSCpvParam::kPadPcY;iY++)
+       if(fCalibrSupplyRoot){
+         if(fCalibrSupplyRoot->Get(Form("hAmplA0_DDL%d_iX%d_iY%d",iDDL,iX,iY)))
+           fAmplA0Histo[iDDL][iX][iY]=new TH1F(*(TH1F*)(fCalibrSupplyRoot->Get(Form("hAmplA0_DDL%d_iX%d_iY%d",iDDL,iX,iY))));
+         else fAmplA0Histo[iDDL][iX][iY]=0x0;
+       }
+       else fAmplA0Histo[iDDL][iX][iY]=0x0;
+  }
+}
+//***********************************************************************
+void AliPHOSCpvGainCalibDA::CreateA0Histos(Int_t iDDL){
+  //create 1D histos for particular DDL to fill them with raw amplitudes later
+  if(iDDL<0||iDDL>=2*AliPHOSCpvParam::kNDDL) return; //invalid ddl number
+  fEntriesMap[iDDL]=new TH2I(Form("hEntriesMap%d",iDDL),Form("A0 entries map, DDL = %d",iDDL),AliPHOSCpvParam::kPadPcX,0,AliPHOSCpvParam::kPadPcX,AliPHOSCpvParam::kPadPcY,0,AliPHOSCpvParam::kPadPcY);
+  fHistosList->Add(fEntriesMap[iDDL]);
+  for(Int_t iX = 0;iX  <AliPHOSCpvParam::kPadPcX;iX++)
+    for(Int_t iY = 0;iY  <AliPHOSCpvParam::kPadPcY;iY++)
+      fAmplA0Histo[iDDL][iX][iY]=new TH1F(Form("hAmplA0_DDL%d_iX%d_iY%d",iDDL,iX,iY),Form("Max amplitude in cluster DDL = %d X = %d Y = %d",iDDL,iX,iY),4096,0.,4096.);
+}
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliPHOSCpvGainCalibDA::SetDeadChannelMapFromFile(const char * filename = "CpvBadMap.root"){
+  //
+  //Set Dead Channel Map Cut from the file, if the input file is not present default value is set!
+  //Arguments: the name of the Dead Channel Map file 
+  //Returns: false if not possible to open file with provided filename
+
+  TFile *fDeadCh = TFile::Open(filename);
+  if(!fDeadCh)return 0;
+  for(Int_t iDDL = 0; iDDL < 2*AliPHOSCpvParam::kNDDL; iDDL+=2){
+    if(fDeadCh->Get(Form("hBadChMap%d",iDDL)))
+      fDeadMap[iDDL] = new TH2I(*(TH2I*)(fDeadCh->Get(Form("hBadChMap%d",iDDL))));
+  }
+  fDeadCh->Close();
+  return 1;
+}//SetDeadChannelMapFromFile()
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliPHOSCpvGainCalibDA::WriteA0HistosToFile() const
+{
+  //write all A0 amplitude histos and A0 entries maps to CpvCalibrSupply.root
+  TFile * rootF = new TFile("CpvCalibrSupply.root","RECREATE");
+  rootF->cd();
+  
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL+=2){
+    if(fEntriesMap[iDDL]) fEntriesMap[iDDL]->Write();
+    for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++) 
+      for(Int_t iY=0; iY<AliPHOSCpvParam::kPadPcY; iY++) 
+       if(fAmplA0Histo[iDDL][iX][iY])fAmplA0Histo[iDDL][iX][iY]->Write();
+  }
+  rootF->Close();
+} //WriteAllHistsToFile()
+//*************************************************************
+Bool_t AliPHOSCpvGainCalibDA::FillAmplA0Histos(TClonesArray *digits){
+  // do a clusterization then find cell with max amlitude (so called A0) in every cluster
+  // fill corresponding histos with A0 amplitude
+  // return true in case of success (found at least 1 cluster).
+  if(!digits) return kFALSE;
+  Int_t nDig = digits->GetEntriesFast();
+  if(nDig < 2) return kFALSE;//why do we need at least 2 digits?
+  Bool_t stop = kFALSE;
+  Int_t nExcludedPoints = 0;
+  Bool_t *excludedPoints = new Bool_t[nDig];//points which already belongs to other clusters
+  for(int i=0;i<nDig;i++)excludedPoints[i]=kFALSE;
+  Int_t clusterIndex[10][5][5];//10 clusters max; this array contains digit numbers which belongs to particular cluster
+  Int_t clusterDDL[10];// DDL number of particular cluster
+  Int_t clusterX[10]; //X coordinate of cluster 
+  Int_t clusterY[10]; //Y coordinate of cluster
+  Float_t clusterAmplitude[10][5][5];
+  //=============================================================================
+  //========================= C L U S T E R I S A T I O N =======================
+  //=============================================================================
+  //here we define cluster as bunch of cells with at least 1 common verticies
+// x= |_0_|_1_|_2_|_3_|_4_|
+// y=0|   |   |   |   |   |
+//    |___|___|___|___|___|
+// y=1|   |   |   |   |   |
+//    |___|___|___|___|___|
+// y=2|   |   |   |   |   |
+//    |___|___|___|___|___|
+// y=3|   |   |   |   |   |
+//    |___|___|___|___|___|
+// y=4|   |   |   |   |   |
+//    |___|___|___|___|___|
+  // initialize clusters array
+  for(Int_t iClus=0;iClus<10;iClus++)
+    for(Int_t ix=0;ix<5;ix++)
+      for(Int_t iy=0;iy<5;iy++)
+       clusterIndex[iClus][ix][iy]=-1;
+  
+  Int_t relId[4];
+  Int_t cluNumber = 0;
+  while(!stop){//we are going to find 10 or less clusters
+    Float_t qMax = 0.;//local maximum value
+    Int_t indMax = -1;//local maximum index
+    for(Int_t iDig = 0; iDig<nDig;iDig++){//find a local maximum
+      if(excludedPoints[iDig]==kTRUE)continue;//is this point already excluded?
+      AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(iDig) ) ;
+      fGeom->AbsToRelNumbering(digit->GetId(),relId);
+      if(relId[1]!=-1){//exclude this digit
+       nExcludedPoints++; 
+       excludedPoints[iDig]=kTRUE;
+       continue;//this is not a CPV digit
+      }
+      int DDL = AliPHOSCpvParam::Mod2DDL(relId[0]);
+      if(IsBad(DDL,relId[2],relId[3])){//let's see if it is a bad pad
+       nExcludedPoints++; 
+       excludedPoints[iDig]=kTRUE;
+       continue;
+      }
+      if( digit->GetEnergy()>qMax) {qMax = digit->GetEnergy(); indMax = iDig;}
+    }
+    if(indMax<0){//did we find something?
+      stop=kTRUE;
+      continue;//no new local maximum 
+    }
+    //set found local maximum as center of new cluster
+    nExcludedPoints++; excludedPoints[indMax]=kTRUE; //do not forget to exclude found maximum from consideration
+    AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(indMax) ) ;
+    fGeom->AbsToRelNumbering(digit->GetId(),relId);
+    clusterIndex[cluNumber][2][2] = indMax;
+    clusterAmplitude[cluNumber][2][2] = qMax;
+    clusterDDL[cluNumber] = AliPHOSCpvParam::Mod2DDL(relId[0]);
+    clusterX[cluNumber]=relId[2];
+    clusterY[cluNumber]=relId[3];
+    //let us try to find all other digits which belongs to the same cluster
+    Int_t pointsFound = 0;
+    do{
+      pointsFound=0;
+      for(Int_t iDig = 0; iDig<nDig;iDig++){
+       if(excludedPoints[iDig]==kTRUE)continue;//is this point already excluded?
+       AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(iDig) ) ;
+       fGeom->AbsToRelNumbering(digit->GetId(),relId);
+       if(AliPHOSCpvParam::Mod2DDL(relId[0])!=clusterDDL[cluNumber]) continue;
+       //see if this current digit has common vertex with 
+       for(int ix = 0;ix<5;ix++)
+         for(int iy = 0;iy<5;iy++)
+           if(clusterIndex[cluNumber][ix][iy]>=0&&(TMath::Abs(relId[2]-clusterX[cluNumber]+ix-2)<=1&&TMath::Abs(relId[3]-clusterY[cluNumber]+iy-2)<=1)){//we found a cell!
+             pointsFound++;
+             clusterAmplitude[cluNumber][ix][iy] = digit->GetEnergy();
+             clusterIndex[cluNumber][ix][iy] = iDig;
+             //finally, exclude this point from consideration
+             nExcludedPoints++;
+             excludedPoints[iDig]=kTRUE;
+           }
+      }
+    }while (pointsFound!=0);
+    //OK, we have finished with this cluster
+    cluNumber++;
+    if(cluNumber>=10) stop=kTRUE; //we found enough clusters
+    if(nExcludedPoints>=nDig) stop=kTRUE;//we assigned all the digits
+  }
+  //cout<<"I found " <<cluNumber<<" clusters"<<endl;
+
+  //now we can operate with clusters
+  //=====================================================================================
+  //===================== F I L L I N G == O F == H I S T O G R A M S====================
+  //=====================================================================================
+  
+  fhClusterMult->Fill(cluNumber);
+  for (Int_t iClu = 0; iClu < cluNumber; iClu++){
+    if(!fEntriesMap[clusterDDL[iClu]]) CreateA0Histos(clusterDDL[iClu]);
+    // cout<<"iClu = "<<iClu<<
+    fAmplA0Histo[clusterDDL[iClu]][clusterX[iClu]-1][clusterY[iClu]-1]->Fill(clusterAmplitude[iClu][2][2]);
+    fEntriesMap[clusterDDL[iClu]]->Fill(clusterX[iClu]-1,clusterY[iClu]-1);
+    fhA0Value->Fill(clusterAmplitude[iClu][2][2]);
+    Double_t totAmpl = 0.;
+    for(int ix = 0; ix<5; ix++)
+      for(int iy = 0; iy<5; iy++)
+       if(clusterIndex[iClu][ix][iy]>=0){
+         fhAmplInClust->Fill(clusterAmplitude[iClu][ix][iy],ix*5+iy);
+         fhClusterShape->Fill(ix-2,iy-2);
+         totAmpl+=clusterAmplitude[iClu][ix][iy];
+       }
+  }
+}
+//*************************************************************
+void AliPHOSCpvGainCalibDA::CreateQAHistos(){
+  fHistosList=new TList();
+  
+  fhClusterMult = new TH1F("fhClusterMult","Cluster Multiplicity in event",100,0,100);
+  fHistosList->Add(fhClusterMult);
+  
+  fhClusterShape=new TH2F("fhClusterShape","Shape of cluster", 5,-2.5,2.5, 5,-2.5,2.5 );
+  fHistosList->Add(fhClusterShape);
+
+  fhA0Value = new TH1F("fhA0Value","Max Amplitude in Cluster ",4096,0.,4096);
+  fHistosList->Add(fhA0Value);
+  
+  fhAmplInClust=new TH2F("fhAmplInClust", "amplitude distribution in cluster", 1000,0.,1000., 25,0.,25.);
+  fHistosList->Add(fhAmplInClust);
+
+  fhTotalClusterAmplitude = new TH1F("fhTotalClusterAmplitude", "Total Amplitude in Cluster",4096,0.,4096);
+  fHistosList->Add(fhTotalClusterAmplitude);
+}
diff --git a/PHOS/PHOSbase/AliPHOSCpvGainCalibDA.h b/PHOS/PHOSbase/AliPHOSCpvGainCalibDA.h
new file mode 100644 (file)
index 0000000..55bed75
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef AliPHOSCpvGainCalibDA_h
+#define AliPHOSCpvGainCalibDA_h
+
+// Author: Sergey Evdokimov <sevdokim@cern.ch>
+// The AliPHOSCpvGainCalibDA class creates 1D amplitude histos for every channel using AliPHOSDigit array
+// produced by AliPHOSCPVRawDigiProducer (with pedestal subtraction!!!)
+// Also writes these histos to file  
+// And creates a ROOT file with some histograms
+
+#include <TH1.h>
+#include <TH2.h>
+#include <TMath.h>
+#include <TFile.h>
+#include <TString.h>
+#include <THnSparse.h>
+#include "AliPHOSCpvParam.h"
+#include "AliPHOSCpvRawDigiProducer.h"
+#include <TClonesArray.h>
+#include "AliPHOSGeometry.h"
+
+class TFile;
+class AliPHOSCpvGainCalibDA: public TObject { 
+
+
+public:
+  AliPHOSCpvGainCalibDA();
+  virtual ~AliPHOSCpvGainCalibDA();
+  void InitCalibration(TFile *fCalibrSupplyRoot); //run it before analysing data to create calibration coeffs map. input is file where previously created histos are stored.
+  void CreateA0Histos(Int_t iDDL);
+  Bool_t SetDeadChannelMapFromFile(const char * filename);
+  void WriteA0HistosToFile() const;                  // create and write a new CpvCalibrSupply.root file with hists
+  Bool_t IsBad(Int_t ddl, Int_t x, Int_t y) {  // returns true, if the cell is bad
+    if(!fDeadMap) return kFALSE;
+    if(!fDeadMap[ddl]) return kFALSE;
+    if(fDeadMap[ddl] -> GetBinContent(x+1,y+1)) return kTRUE;
+    return kFALSE;
+  }
+  Bool_t IsBad(Int_t abs) {  // returns true, if the cell is bad
+    if(!AliPHOSCpvParam::IsValidAbs(abs)) return kFALSE;
+    Int_t ddl = AliPHOSCpvParam::A2DDL(abs),
+            x = AliPHOSCpvParam::A2X(abs),
+            y = AliPHOSCpvParam::A2Y(abs);
+    return IsBad(ddl,x,y);
+  }
+  Bool_t FillAmplA0Histos(TClonesArray *digits);
+  TList * GetQAHistos(){return fHistosList;}
+  void CreateQAHistos();
+
+ protected: 
+  AliPHOSGeometry * fGeom ;         //! PHOS geometry
+  TH2I *fDeadMap[2*AliPHOSCpvParam::kNDDL]; //Dead Channel Map  
+  TH2I *fEntriesMap[2*AliPHOSCpvParam::kNDDL];//entries map
+  TH1F       *fAmplA0Histo[2*AliPHOSCpvParam::kNDDL][AliPHOSCpvParam::kPadPcX][AliPHOSCpvParam::kPadPcY]; //raw amplitudes specrta for every channel   
+  TList* fHistosList;
+  TH1F* fhClusterMult;
+  TH2F* fhClusterShape;
+  TH1F* fhA0Value;
+  TH2F* fhAmplInClust;
+  TH1F* fhTotalClusterAmplitude;
+  
+  ClassDef(AliPHOSCpvGainCalibDA,1);                                                  //Cpv calibration class        
+};
+#endif
+
index 5a8facd..c26bd87 100644 (file)
@@ -155,7 +155,7 @@ void AliPHOSCpvPedProducer::WriteAllHistsToFile(const char * name) const
     // }
        //Printf("iDDL = %d\n", iDDL);
     if ( fPedMeanMap[iDDL])
-      rootF->WriteObject(fPedMeanMap[iDDL], Form("PedMeanMap%d",iDDL));
+      rootF->WriteObject(fPedMeanMap[iDDL], Form("fPedMeanMap%d",iDDL));
     if ( fPedSigMap[iDDL])
       rootF->WriteObject(fPedSigMap [iDDL], Form("fPedSigMap%d",iDDL));
     if ( f1DPedMean[iDDL])
@@ -256,10 +256,10 @@ void AliPHOSCpvPedProducer::CreateErrHist()
 void AliPHOSCpvPedProducer::CreateDDLHistos(Int_t iDDL)
 {
   // creating histograms
-  fPedMeanMap[iDDL] = new TH2F(Form("hPedMeanMap%d",iDDL),"2D mean pedestal map" ,AliPHOSCpvParam::kPadPcX,0.,AliPHOSCpvParam::kPadPcX,AliPHOSCpvParam::kPadPcY,0.,AliPHOSCpvParam::kPadPcY);
-  fPedSigMap [iDDL] = new TH2F(Form("hPedSigMap%d" ,iDDL),"2D pedestal sigma map",AliPHOSCpvParam::kPadPcX,0.,AliPHOSCpvParam::kPadPcX,AliPHOSCpvParam::kPadPcY,0.,AliPHOSCpvParam::kPadPcY);
-  f1DPedMean [iDDL] = new TH1F(Form("h1DPedMean%d" ,iDDL),"1D mean pedestal map" ,5000,0,5000);
-  f1DPedSigma[iDDL] = new TH1F(Form("h1DPedSigma%d",iDDL),"1D pedestal sigma map",100 ,0,100 );
+  fPedMeanMap[iDDL] = new TH2F(Form("hPedMeanMap%d",iDDL),Form("2D pedestal value map, DDL = %d",iDDL) ,AliPHOSCpvParam::kPadPcX,0.,AliPHOSCpvParam::kPadPcX,AliPHOSCpvParam::kPadPcY,0.,AliPHOSCpvParam::kPadPcY);
+  fPedSigMap [iDDL] = new TH2F(Form("hPedSigMap%d" ,iDDL),Form("2D pedestal sigma map, DDL = %d",iDDL),AliPHOSCpvParam::kPadPcX,0.,AliPHOSCpvParam::kPadPcX,AliPHOSCpvParam::kPadPcY,0.,AliPHOSCpvParam::kPadPcY);
+  f1DPedMean [iDDL] = new TH1F(Form("h1DPedMean%d" ,iDDL),Form("pedestal value distribution, DDL = %d",iDDL) ,5000,0,5000);
+  f1DPedSigma[iDDL] = new TH1F(Form("h1DPedSigma%d",iDDL),Form("pedestal sigma distribution, DDL = %d",iDDL),1000 ,0,100 );
 
   // initialization of arrays
   int adr;
index 593b9f8..172d3e1 100644 (file)
@@ -99,7 +99,7 @@ Bool_t AliPHOSCpvRawDigiProducer::LoadPedFiles() {
       FILE * pedFile;
       pedFile = fopen(Form("thr%d_%02d.dat",iDDL,iCC),"r");
       if(!pedFile) {
-       Printf("AliPHOSCpvRawDigiProducer::LoadPedFiles: Error, file thr%d_%02d.dat could not be open",iDDL,iCC);
+       //Printf("AliPHOSCpvRawDigiProducer::LoadPedFiles: Error, file thr%d_%02d.dat could not be open",iDDL,iCC);
        continue;
       }
       Int_t i3g = 0, iPad = 0;
index 03782a4..ad8b8bd 100644 (file)
@@ -37,13 +37,14 @@ set(SRCS
     AliPHOSCalibData.cxx
     AliPHOSClusterizer.cxx
     AliPHOSClusterizerv1.cxx
-    AliPHOSCpvCalibData.cxx
-    AliPHOSCpvRecPoint.cxx
     AliPHOSCpv3GConnection.cxx
+    AliPHOSCpvCalibData.cxx
+    AliPHOSCpvGainCalibDA.cxx
     AliPHOSCpvParam.cxx
     AliPHOSCpvPedProducer.cxx
     AliPHOSCpvRawDigiProducer.cxx
     AliPHOSCpvRawStream.cxx
+    AliPHOSCpvRecPoint.cxx
     AliPHOSDigit.cxx
     AliPHOSDigitizer.cxx
     AliPHOSEmcBadChannelsMap.cxx
index ad0f4df..a1e82b5 100644 (file)
@@ -61,5 +61,6 @@
 #pragma link C++ class AliPHOSCpvParam+;
 #pragma link C++ class AliPHOSCpv3GConnection+;
 #pragma link C++ class AliPHOSCpvPedProducer+;
+#pragma link C++ class AliPHOSCpvGainCalibDA+;
 
 #endif