CPV DA updates (S.Evdokimov)
authorkharlov <Yuri.Kharlov@cern.ch>
Sun, 15 Feb 2015 19:33:59 +0000 (22:33 +0300)
committerkharlov <Yuri.Kharlov@cern.ch>
Sun, 15 Feb 2015 19:33:59 +0000 (22:33 +0300)
PHOS/DA/CMakeLists.txt
PHOS/DA/PHOSCPVPEDda.cxx
PHOS/PHOSbase/AliPHOSCpvPedProducer.cxx
PHOS/PHOSbase/AliPHOSCpvPedProducer.h
PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.cxx
PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.h

index 4469a37..e29e641 100644 (file)
@@ -42,3 +42,6 @@ generateDA("PHOS" "PED" "${STATIC_DEPENDENCIES}")
 
 set(STATIC_DEPENDENCIES PHOSbase-static RAWDatabase-static RAWDatarec-static STEERBase-static)
 generateDA("PHOS" "CPVPED" "${STATIC_DEPENDENCIES}")
+
+set(STATIC_DEPENDENCIES PHOSbase-static RAWDatabase-static RAWDatarec-static STEERBase-static)
+generateDA("PHOS" "CPVBCM" "${STATIC_DEPENDENCIES}")
index 1dc2d57..451be9f 100644 (file)
@@ -11,11 +11,11 @@ Input files: raw data file
 Output files: thr?_??.dat CpvPeds.root
 Trigger types used: PHYSICS_EVENT
 */
-
+//daqDA
 #include "event.h"
 #include "monitor.h"
 #include "daqDA.h"
-
+//system
 #include <Riostream.h>
 #include <stdlib.h>
 #include <fstream>
@@ -27,14 +27,13 @@ Trigger types used: PHYSICS_EVENT
 #include "AliPHOSCpvParam.h"
 #include "AliRawReaderDate.h"
 #include "AliBitPacking.h"
-#include "TMath.h"
 
 //ROOT
 #include "TROOT.h"
 #include "TPluginManager.h"
 #include "TSAXParser.h"
 #include "TTree.h"
-
+#include "TMath.h"
 #include "TString.h"
 #include "TFile.h"
 #include "TSystem.h"
@@ -64,7 +63,7 @@ int main( int argc, char **argv )
   }
 
   // log start of process
-  printf("Cpv DA program started\n");
+  printf("Cpv pedestal DA program started\n");
 
   /* report progress */
   daqDA_progressReport(0);
@@ -146,26 +145,28 @@ int main( int argc, char **argv )
 
   Printf(" Received %d events, %d good events",iTotEvnt,iPhysEvnt);
   /* report progress */
-  daqDA_progressReport(80);
+  daqDA_progressReport(95);
 
-  for(int iDDL = 0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++){
+  for(int iDDL = 0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++){
     if(pedProducer -> CalcPedestal(iDDL)){
       pedProducer -> WritePedFiles(iDDL);
-      //for (int iCC = 0; iCC<AliPHOSCpvParam::kNRows){
-      //       status=daqDA_DB_storeFile(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);
-      //}
+      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");
   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(95);
+  daqDA_progressReport(100);
 
 
   return status;
index 9f9d1e4..5a8facd 100644 (file)
@@ -29,6 +29,16 @@ AliPHOSCpvPedProducer::AliPHOSCpvPedProducer(Int_t sigcut):
   //
   //constructor
   //
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++) {//iDDL
+    fPedMeanMap[iDDL]=0;
+    fPedSigMap [iDDL]=0;
+    f1DPedMean [iDDL]=0;
+    f1DPedSigma[iDDL]=0;
+    for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++)
+      for(Int_t iY=1; iY<AliPHOSCpvParam::kPadPcY; iY++)
+       fPadAdc[iDDL][iX][iY]=0;
+  }//iDDL
+
   CreateErrHist();
 }  //constructor
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -37,7 +47,7 @@ AliPHOSCpvPedProducer::~AliPHOSCpvPedProducer()
   //
   //destructor
   //
-  for(Int_t iDDL=0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++) {//iDDL
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++) {//iDDL
     delete fPedMeanMap[iDDL];
     delete fPedSigMap [iDDL];
     delete f1DPedMean [iDDL];
@@ -82,7 +92,7 @@ Bool_t AliPHOSCpvPedProducer::FillPedestal(Int_t abspad,Float_t q)
     Int_t iDDL=AliPHOSCpvParam::A2DDL(abspad),
             iX=AliPHOSCpvParam::A2X(abspad),
             iY=AliPHOSCpvParam::A2Y(abspad);
-    if(!fPedMeanMap[iDDL]) CreateDDLHistos(iDDL);
+    if(!fPadAdc [iDDL][iX][iY]) CreateDDLHistos(iDDL); 
     fPadAdc [iDDL][iX][iY] -> Fill(q);
     return kTRUE;
   }
@@ -137,7 +147,7 @@ void AliPHOSCpvPedProducer::WriteAllHistsToFile(const char * name) const
   TFile * rootF = TFile::Open(name,"RECREATE");
   printf("Root file created \n");
   //rootF->cd();
-  for(Int_t iDDL=0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++) {
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++) {
     // for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++) {
     //   for(Int_t iY=0; iY<AliPHOSCpvParam::kPadPcY; iY++) {
     //         //fPadAdc[iDDL][iX][iY]->Write();
@@ -156,7 +166,7 @@ void AliPHOSCpvPedProducer::WriteAllHistsToFile(const char * name) const
   }
   //if(fhErrors) fhErrors -> Write();
 
-  for(Int_t iDDL=0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++)
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++)
     for(Int_t iX=0; iX<AliPHOSCpvParam::kPadPcX; iX++)
       for(Int_t iY=0; iY<AliPHOSCpvParam::kPadPcY; iY++);
   //fPadAdc[iDDL][iX][iY]->Write();
index 74c6ee2..c286bb1 100644 (file)
@@ -47,15 +47,16 @@ protected:
   void CreateErrHist();    // initialize histogram of errors
   void CreateDDLHistos(Int_t iDDL);  // initialize histograms for pedestal calculation and representation
 
-  TH1F       *fPadAdc[AliPHOSCpvParam::kNDDL][AliPHOSCpvParam::kPadPcX][AliPHOSCpvParam::kPadPcY];        //Charge distribution for pads
+  //our ddls are 0,2,4,6,8
+  TH1F       *fPadAdc[2*AliPHOSCpvParam::kNDDL][AliPHOSCpvParam::kPadPcX][AliPHOSCpvParam::kPadPcY];        //Charge distribution for pads
   Int_t       fSigCut;                         //n. of pedestal distribution sigmas used to create zero suppresion table
   static const Int_t fMaxThr = 511;            //maximal threshold (9 bits all with 1)
   Bool_t fTurbo;           // if true, then read without error checking
-
-  TH2F       *fPedMeanMap[AliPHOSCpvParam::kNDDL]; //2D mean pedestal map to export to AMORE
-  TH2F       *fPedSigMap [AliPHOSCpvParam::kNDDL]; //2D pedestal sigma map to export to AMORE
-  TH1F       *f1DPedMean [AliPHOSCpvParam::kNDDL]; //1D mean pedestal map to export to AMORE
-  TH1F       *f1DPedSigma[AliPHOSCpvParam::kNDDL]; //1D pedestal sigma map to export to AMORE
+  //our ddls are 0,2,4,6,8
+  TH2F       *fPedMeanMap[2*AliPHOSCpvParam::kNDDL]; //2D mean pedestal map to export to AMORE
+  TH2F       *fPedSigMap [2*AliPHOSCpvParam::kNDDL]; //2D pedestal sigma map to export to AMORE
+  TH1F       *f1DPedMean [2*AliPHOSCpvParam::kNDDL]; //1D mean pedestal map to export to AMORE
+  TH1F       *f1DPedSigma[2*AliPHOSCpvParam::kNDDL]; //1D pedestal sigma map to export to AMORE
   TH1I       *fhErrors;                        //histogram of errors from AliPHOSCpvRawDigiProducer
   AliPHOSCpvRawStream         * fRawStream;       //! Raw data stream
 private:
index 8753e17..593b9f8 100644 (file)
@@ -42,7 +42,7 @@ AliPHOSCpvRawDigiProducer::AliPHOSCpvRawDigiProducer():
 
   CreateErrHist();
   // create a 2d array to store the pedestals                                        
-  for (Int_t iDDL=0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++){
+  for (Int_t iDDL=0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++){
     fPed[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     fPed[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) {
@@ -68,7 +68,7 @@ AliPHOSCpvRawDigiProducer::AliPHOSCpvRawDigiProducer(AliRawReader * rawReader):
   fRawStream->SetTurbo(fTurbo);
   CreateErrHist();
   // create a 2d array to store the pedestals                                               
-  for (Int_t iDDL=0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++) {
+  for (Int_t iDDL=0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++) {
     fPed[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     fPed[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) {
@@ -82,7 +82,7 @@ AliPHOSCpvRawDigiProducer::~AliPHOSCpvRawDigiProducer()
 {
   if(fRawStream) delete fRawStream;
   if(fhErrors) delete fhErrors; 
-  for(Int_t iDDL = 0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++) {
+  for(Int_t iDDL = 0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL++) {
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) { 
       delete [] fPed[0][iDDL][ix];
       delete [] fPed[1][iDDL][ix];
@@ -94,7 +94,7 @@ AliPHOSCpvRawDigiProducer::~AliPHOSCpvRawDigiProducer()
 //--------------------------------------------------------------------------------------
 Bool_t AliPHOSCpvRawDigiProducer::LoadPedFiles() {
   // read pedestals from file                                             
-  for(Int_t iDDL = 0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++)
+  for(Int_t iDDL = 0;iDDL<2*AliPHOSCpvParam::kNDDL;iDDL+=2)
     for(Int_t iCC=0; iCC<AliPHOSCpvParam::kNRows; iCC++) {
       FILE * pedFile;
       pedFile = fopen(Form("thr%d_%02d.dat",iDDL,iCC),"r");
@@ -177,7 +177,7 @@ void AliPHOSCpvRawDigiProducer::MakeDigits(TClonesArray * digits) const
       Int_t iddl     = AliPHOSCpvParam::A2DDL(aPad);
 
       relId[0] = AliPHOSCpvParam::DDL2Mod(iddl) ; // counts from 1 to 5
-      relId[1] = 1;      // 1=CPV
+      relId[1] = -1;      // -1=CPV
       relId[2] = ix + 1; // counts from 1 to 128
       relId[3] = iy + 1; // counts from 1 to 60
       fGeom->RelToAbsNumbering(relId, absId);
@@ -205,7 +205,7 @@ void AliPHOSCpvRawDigiProducer::MakeDigits(TClonesArray * digits) const
   AliDebug(1,Form("Array of %d CPV digits is created",digits->GetEntriesFast())); 
 
   // fill histogram of errors
-  for(Int_t iDDL=0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++) {
+  for(Int_t iDDL=0; iDDL<2*AliPHOSCpvParam::kNDDL; iDDL++) {
     Int_t nErrors = AliPHOSCpvRawStream::GetNErrors();
     for(Int_t iType=0; iType<nErrors; iType++) { // iType - type of error
       fhErrors -> Fill(iType+1,fRawStream -> GetErrors(iDDL,iType));
index 7438c48..c275dcf 100644 (file)
@@ -51,7 +51,7 @@ private:
 
   TH1I * fhErrors;         // ! histogram of errors
 
-  Int_t ** fPed[2][AliPHOSCpvParam::kNDDL]; // pedestals    ped[0][iddl][x][y] = pedestal; ped[1][iddl][x][y] = N*sigma (N was used while creating ped files)
+  Int_t ** fPed[2][2*AliPHOSCpvParam::kNDDL]; // pedestals    ped[0][iddl][x][y] = pedestal; ped[1][iddl][x][y] = N*sigma (N was used while creating ped files)
   Bool_t fPedFilesRLoaded;
 
   ClassDef(AliPHOSCpvRawDigiProducer,2);