Pedestals in OCDB + minors
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 5 May 2007 20:39:47 +0000 (20:39 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 5 May 2007 20:39:47 +0000 (20:39 +0000)
HMPID/AliHMPIDDigit.h
HMPID/AliHMPIDPreprocessor.cxx
HMPID/AliHMPIDPreprocessor.h
HMPID/AliHMPIDReconstructor.cxx
HMPID/AliHMPIDReconstructor.h
HMPID/Hshuttle.C

index b9d28be..fe1a6b6 100644 (file)
@@ -39,7 +39,7 @@ public:
   static Int_t   A2Y         (Int_t pad                      )     {return pad%1000;                                                 } //abs pad -> pad Y 
          void    AddTidOffset(Int_t offset                   )     {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;  } //needed for merging
          Int_t   Ch          (                               )const{return A2C(fPad);                                                } //chamber number
-  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgSigmas;                                            } //is digit over threshold????
+  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgSigmas;                                            } //is digit over threshold?
   static Bool_t  IsInside    (Float_t x,Float_t y,Float_t margin=0){return x>-margin&&y>-margin&&x<SizeAllX()+margin&&y<SizeAllY()+margin;} //is point inside chamber boundary?
          Float_t LorsX       (                               )const{return LorsX(A2P(fPad),A2X(fPad));                               } //center of the pad x, [cm]
   static Float_t LorsX       (Int_t pc,Int_t padx            )     {return (padx    +0.5)*SizePadX()+(pc  %2)*(SizePcX()+SizeDead());} //center of the pad x, [cm]
@@ -55,9 +55,10 @@ public:
          Float_t Q           (                               )const{return fQ;}                                                        //charge, [QDC]
   inline void    Raw         (UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a)const;                                                 //digit->(w32,ddl,r,d,a)
   inline void    Raw         (UInt_t  w32,Int_t  ddl         );                                                                        //(w32,ddl)->digit
+  inline void    Raw         (Int_t ddl,Int_t r,Int_t d,Int_t a);                                                                      //raw->abs pad number
   inline Bool_t  Set         (Int_t c,Int_t p,Int_t x,Int_t y,Int_t tid=0);                                                            //manual creation 
          void    SetQ        (Float_t q                      )     {fQ=q;}                                                             //manual creation 
-         void    SetSigmas   (Int_t sigmas                   )     {fgSigmas=sigmas;}                                                  //manual creation 
+         void    SetNsig     (Int_t sigmas                   )     {fgSigmas=sigmas;}                                                  //set n sigmas 
   static void    WriteRaw    (TObjArray *pDigLst             );                                                                        //write as raw stream     
   
   static Float_t CathAnoCath (                               )     {return 0.445;}                                                     //Cathode-Anode-cathode pitch
@@ -65,7 +66,7 @@ public:
   static Float_t MaxPcY      (Int_t iPc                      )     {return fgkMaxPcY[iPc];}                                            // PC limits
   static Float_t MinPcX      (Int_t iPc                      )     {return fgkMinPcX[iPc];}                                            // PC limits
   static Float_t MinPcY      (Int_t iPc                      )     {return fgkMinPcY[iPc];}                                            // PC limits
-  static Int_t   Sigmas      (                               )     {return fgSigmas;}                                                  // Getter n. sigmas for noise
+  static Int_t   Nsig        (                               )     {return fgSigmas;}                                                  //Getter n. sigmas for noise
   static Float_t SizeAllX    (                               )     {return fgkMaxPcX[5];}                                              //all PCs size x, [cm]        
   static Float_t SizeAllY    (                               )     {return fgkMaxPcY[5];}                                              //all PCs size y, [cm]    
   static Float_t SizeArea    (                               )     {return SizePcX()*SizePcY()*(kMaxPc-kMinPc+1);}                     //sence area, [cm^2]  
@@ -80,7 +81,7 @@ public:
   inline static Bool_t IsInDead(Float_t x,Float_t y        );                                                                          //is point in dead area?
   inline static void   Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py);                                                    //(x,y)->(pc,px,py) 
 protected:                                                                   //AliDigit has fTracks[3]
-  static Int_t fgSigmas;                                                                                                               //sigma cut on charge 
+  static Int_t fgSigmas;                                                                                                               //n. sigma to cut on charge 
   static const Float_t fgkMinPcX[6];                                                                                                   //limits PC
   static const Float_t fgkMinPcY[6];                                                                                                   //limits PC
   static const Float_t fgkMaxPcX[6];                                                                                                   //limits PC
@@ -178,17 +179,25 @@ void AliHMPIDDigit::Raw(UInt_t w32,Int_t ddl)
 // Arguments: w32 - 32 bits raw data word
 //            ddl - DDL idx  0 1 2 3 4 ... 13
 //   Returns: none
-  Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip)
   Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24);   //                                         Row number      (1..24)    
   Int_t d = AliBitPacking::UnpackWord(w32,18,21); assert(1<=d&&d<=10);   // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC number  (1..10)
   Int_t a = AliBitPacking::UnpackWord(w32,12,17); assert(0<=a&&a<=47);   // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC address (0..47)  
-  Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc             (0..4095)   
+  Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc             (0..4095) 
+  Raw(ddl,r,d,a);
+  fQ=q;
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDDigit::Raw(Int_t ddl,Int_t r,Int_t d,Int_t a)
+{
+  Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip)
                                   Int_t ch=ddl/2;
   Int_t tmp=(r-1)/8;              Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; 
                                   Int_t px=(d-1)*8+a/6;
         tmp=(ddl%2)?(24-r):r-1;   Int_t py=6*(tmp%8)+a2y[a%6];
-  fPad=Abs(ch,pc,px,py);fQ=q;
+  fPad=Abs(ch,pc,px,py);
 }
+
+
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDDigit::Set(Int_t ch,Int_t pc,Int_t px,Int_t py,Int_t tid)
 {
index 232a717..034e6a6 100644 (file)
@@ -1,10 +1,13 @@
 #include "AliHMPIDPreprocessor.h" //header
 
+#include <Riostream.h>
 #include <AliCDBMetaData.h>
 #include <AliDCSValue.h>      
+#include <TObjString.h>       //Process()
 #include <TF1.h>              //Process()
 #include <TF2.h>              //Process()
 #include <TGraph.h>           //Process()
+#include <TMatrixF.h>         //Process()
 #include <AliLog.h>           //Process() 
 
 //.
@@ -31,15 +34,36 @@ UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
 //          2. CH4 pressure and HV                 stores TObjArray of 7 TF1 where TF1 is thr=f(t), one per chamber
 // Arguments: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
 // Assume that: HV is the same during the run for a given chamber, different chambers might have different HV
-//              P=f(t), different for different chambers     
-     
-//  TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files
-//  if (list){
-//    Log("The following sources produced files with the id MAP");
-//    list->Print();
-//    delete list;
-//  }
-
+//              P=f(t), different for different chambers
+  TObjArray arDaqSig(14); arDaqSig.SetOwner(kTRUE);
+  for(Int_t iddl=0;iddl<14;iddl++){
+    arDaqSig.AddAt(new TObjArray(24),iddl);
+    for(Int_t row=1;row<=24;row++){
+      ((TObjArray*)arDaqSig.At(iddl))->Add(new TMatrixF(1,10,0,47));
+    }
+  }
+  TObjArray arSigCut(14); arSigCut.SetOwner(kTRUE);                                  //14  n. of sigmas for zero suppression
+  Int_t ddl,r,d,a,hard;
+  Float_t mean,sigma;
+  Int_t sigmaCut;
+  for(Int_t iddl=0;iddl<14;iddl++){
+    TObject *sigCut= new TObject; 
+    const char *name=GetFile(kDAQ,"pedestals",Form("DDL%i",iddl));                   //first analyse a set of pedestal files
+    ifstream infile(name);
+    //
+    infile>>sigmaCut;
+    sigCut->SetUniqueID(sigmaCut);arSigCut.AddAt(sigCut,iddl);
+    TObjArray *pTmp = (TObjArray*)arDaqSig.At(iddl);
+    TMatrixF *pM;
+    while(!infile.eof()){
+      infile>>dec>>ddl>>r>>d>>a>>mean>>sigma>>hex>>hard;
+      pM = (TMatrixF*)pTmp->At(r-1);
+      (*pM)(d,a) = sigma;
+    }
+    //
+    infile.close();
+    Printf("file %s read successfully",name);
+  }
 
   if(!pMap)  return 0;                    //no DCS map provided 
   Double_t sor=0,eor=1500;
@@ -50,8 +74,8 @@ UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
   
 //  TObjArray arTmean(21); arTmean.SetOwner(kTRUE);     //21 Tmean=f(time) one per radiator
 //  TObjArray arPress(7);  arPress.SetOwner(kTRUE);     //7  Press=f(time) one pre chamber
-  TObjArray arNmean(21); arNmean.SetOwner(kTRUE);     //21 Nmean=f(time) one per radiator
-  TObjArray arQthre(7);  arQthre.SetOwner(kTRUE);     //7  Qthre=f(time) one pre chamber
+  TObjArray arNmean(21); arNmean.SetOwner (kTRUE);     //21 Nmean=f(time) one per radiator
+  TObjArray arQthre(7);  arQthre.SetOwner (kTRUE);     //7  Qthre=f(time) one pre chamber
   
 //  AliDCSValue *pVal; Int_t cnt=0;
     
@@ -84,14 +108,17 @@ UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
   }//chambers loop
   
   AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliHMPIDPreprocessor"); metaData.SetComment("SIMULATED");
-
   
-  arQthre.Print();
+//  arQthre.Print();
 //  Store("Calib", "Press" , &arPress , &metaData); 
-//  Store("Calib", "Tmean" , &arTmean , &metaData); 
-
-  if( Store("Calib", "Qthre" , &arQthre , &metaData) == kTRUE && Store("Calib", "Nmean" , &arNmean , &metaData) == kTRUE ) return 0;   //clm: compatibility with new Store and preprocessor requirement
-  else return 1;
+//  Store("Calib", "Tmean" , &arTmean , &metaData);
+  
+  if(Store("Calib","Qthre"    ,&arQthre , &metaData,0,kTRUE) == kTRUE && 
+     Store("Calib","Nmean"    ,&arNmean , &metaData,0,kTRUE) == kTRUE &&   
+     Store("Calib","DaqSigCut",&arSigCut, &metaData,0,kTRUE) == kTRUE &&
+     Store("Calib","DaqSig"   ,&arDaqSig, &metaData,0,kTRUE) == kTRUE    ) return 0; //all OK
+  else
+    return 1;
   
   //  AliInfo("End.");  
 
index 7f8736a..c7b32f3 100644 (file)
@@ -13,7 +13,10 @@ class AliHMPIDPreprocessor : public AliPreprocessor
 public:
            AliHMPIDPreprocessor(AliShuttleInterface* pShuttle):AliPreprocessor("HMP",pShuttle) {}
   virtual ~AliHMPIDPreprocessor(                             )                                 {}
-  
+  static char*     GetP ()    {return fgP;}        //getter for pressure
+  static char*     GetHV()    {return fgHV;}       //getter for high voltage
+  static char*     GetT1()    {return fgT1;}       //getter for inlet temperature
+  static char*     GetT2()    {return fgT2;}       //getter for inlet temperature
 protected:
   static char    *fgP;     // Name of the aliases provided by the DCS
   static char    *fgHV;    // Name of the aliases provided by the DCS
index 0c1c106..2345c49 100644 (file)
 #include "AliHMPID.h"              //Reconstruct() 
 #include "AliHMPIDCluster.h"       //Dig2Clu()
 #include "AliHMPIDParam.h"         //FillEsd() 
-#include <AliESD.h>               //FillEsd()
-#include <AliRawReader.h>         //Reconstruct() for raw digits
+#include <AliCDBEntry.h>           //ctor
+#include <AliCDBManager.h>         //ctor
+#include <AliESD.h>                //FillEsd()
+#include <AliRawReader.h>          //Reconstruct() for raw digits
 ClassImp(AliHMPIDReconstructor)
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor()
+AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0)
 {
 //
 //ctor
 //
-  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
-  fDig=new TObjArray(AliHMPIDDigit::kMaxCh+1);
-  fClu->SetOwner(kTRUE);
+
+  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1); fClu->SetOwner(kTRUE);
+  fDig=new TObjArray(AliHMPIDDigit::kMaxCh+1); fDig->SetOwner(kTRUE);
+
   for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){ 
     fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i);
     fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
   }
-  fDig->SetOwner(kTRUE);
+  
+  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME");
+  
+  AliCDBEntry *pUserCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/UserCut");    //contains TObjArray of 14 TObject with n. of sigmas to cut charge 
+  if(!pUserCutEnt) return;                                                            //No request from User to apply a more severe cut on pad charge  
+  
+  fUserCut = pUserCutEnt->GetObject()->GetUniqueID();
+
+  Printf(" usercut %i ",fUserCut);
+  
+  AliCDBEntry *pDaqCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSigCut");     //contains TObjArray of 14 TObject with n. of sigmas to cut charge 
+  if(!pDaqCutEnt) AliFatal("No pedestal sigmas cut!");
+  TObjArray *pDaqCut = (TObjArray*)pDaqCutEnt->GetObject();
+
+
+  for(Int_t ddl=0;ddl<14;ddl++){
+    if(fUserCut<=(Int_t)pDaqCut->At(ddl)->GetUniqueID()) continue;
+    AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");  //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads 
+    if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!");
+    TObjArray *pDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
+    SigConv(pDaqSig);
+    break;
+  }
 }//AliHMPIDReconstructor
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDReconstructor::SigConv(TObjArray *pDaqSig)
+{
+// Conversion from the pedestal objects in to 7 TMatrixF(padX,padY)
+//Arguments: pDaqSig pointer to the pedestal objects from OCDB
+//   Returs: none
+//
+  fDaqSig = new TObjArray(AliHMPIDDigit::kMaxCh+1);fDaqSig->SetOwner(kTRUE);
+  
+  for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++) fDaqSig->AddAt(new TMatrixF(1,10,0,47),iCh);
+  AliHMPIDDigit dig;
+   
+  for(Int_t ddl=0;ddl<=13;ddl++){
+    for(Int_t row=1;row<=24;row++)
+      for(Int_t dil=1;dil<=10;dil++)
+        for(Int_t adr=0;adr<=47;adr++){
+          TObjArray *pDdl = (TObjArray*)pDaqSig->At(ddl);
+          TObjArray *pRow = (TObjArray*)pDdl->At(row-1);
+          TMatrixF *pM = (TMatrixF*)pRow;
+          Float_t sigma = (*pM)(dil,adr);
+          dig.Raw(ddl,row,dil,adr);
+          TMatrixF* pMConv = (TMatrixF*)(fDaqSig->At(dig.Ch()));
+          (*pMConv)(dig.PadChX(),dig.PadChY()) = sigma;
+        }
+  }
+}//SigConv()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t isTryUnfold)
 {
 // Finds all clusters for a given digits list provided not empty. Currently digits list is a list of all digits for a single chamber.
@@ -64,7 +116,6 @@ void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t
     }//digits loop to fill digits map 
     
     AliHMPIDCluster clu;                                                                  //tmp cluster to be used as current
-  
     for(Int_t iDig=0;iDig<pDigCur->GetEntriesFast();iDig++){                              //digits loop for current chamber
       AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCur->At(iDig);                              //take current digit
       if(!(pDig=UseDig(pDig->PadChX(),pDig->PadChY(),pDigCur,&padMap))) continue;         //this digit is already taken in FormClu(), go after next digit
@@ -142,6 +193,7 @@ void AliHMPIDReconstructor::Reconstruct(AliRunLoader *pAL,AliRawReader* pRR)cons
         UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
         dig.Raw(w32,ddl);
         AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
+        if(!IsDigSurvive(&dig)) continue;                                             //sigma cut test
         new((*((TClonesArray*)digLst.At(iCh)))[iDigCnt[iCh]++]) AliHMPIDDigit(dig); //add this digit to the tmp list
       }//raw records loop
       pRR->Reset();
@@ -174,6 +226,7 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
       UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
       dig.Raw(w32,ddl);  
       AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
+      if(!IsDigSurvive(&dig)) continue;                                       //sigma cut test
       new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list
     }//raw records loop
     pRR->Reset();        
index 7b381fa..86f80dc 100644 (file)
@@ -5,12 +5,13 @@
 //.
 // HMPID base class to reconstruct an event
 //.
-#include <AliReconstructor.h>       //base class
+#include <AliReconstructor.h>        //base class
 #include "AliHMPIDTracker.h"         //CreateTracker()
-#include <TMatrixF.h>               //UseDig()
-#include <TClonesArray.h>           //UseDig()
-class AliRawReader;                 //Reconstruct() with raw data   
-class AliHMPIDDigit;                 //Dig2Clu(), UseDig()
+#include "AliHMPIDDigit.h"           //Dig2Clu(), UseDig()
+#include <TMatrixF.h>                //UseDig()
+#include <TClonesArray.h>            //UseDig()
+#include <TObjArray.h>               //SigConv()
+class AliRawReader;                  //Reconstruct() with raw data   
 class AliHMPIDCluster;               //Dig2Clu()
 
 class AliHMPIDReconstructor: public AliReconstructor 
@@ -34,11 +35,14 @@ public:
   static        void           Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Bool_t isUnfold=kTRUE                      );//digits->clusters
   static        void           FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
   static inline AliHMPIDDigit* UseDig  (Int_t padX,Int_t padY,                    TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
-
+  inline Bool_t                IsDigSurvive(AliHMPIDDigit *pDig                                                     )const;//check for sigma cut
+  void                         SigConv(TObjArray *pDaqSig                                                                );//conversion to 7 TMatrixF for sigmas
   protected:
+  Int_t      fUserCut;                 // n sigma for pedestals decided by the User (if in OCDB)
+  TObjArray *fDaqSig;                  // container for the pad pedestal sigmas
   TObjArray *fDig;                     // tmp list of digits
   TObjArray *fClu;                     // tmp list of clusters
-  ClassDef(AliHMPIDReconstructor, 0)   //class for the HMPID reconstruction
+  ClassDef(AliHMPIDReconstructor, 0)   // class for the HMPID reconstruction
 };
 
 //__________________________________________________________________________________________________
@@ -54,5 +58,17 @@ AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray
   if(iDig!=-1)    return (AliHMPIDDigit*)pDigLst->At(iDig);        //digit pointer
   else            return 0;
 }
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDReconstructor::IsDigSurvive(AliHMPIDDigit *pDig)const
+{
+//Check if the current digit survive to a riapllied sigma cut
+//Arguments: pDig pointer to the current digit
+//  Returns: kTRUE if charge > mean+n*sigma
+  if(!fUserCut) return kTRUE;
+  TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
+  Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
+  if(pDig->Q()>fUserCut*sig) return kTRUE;
+  else return kFALSE;
+}
 
 #endif
index fdd3ced..d38c903 100644 (file)
@@ -10,6 +10,7 @@ void Hshuttle(Int_t runTime=1500)
   
   TMap        *pDcsMap = new TMap;       pDcsMap->SetOwner(1);          //DCS archive map
 
+  SimPed();
   SimMap(pDcsMap,runTime);
   TestShuttle(pDcsMap);  
   TCanvas *c=new TCanvas("cc","ff",600,600);  
@@ -17,6 +18,26 @@ void Hshuttle(Int_t runTime=1500)
   DrawOutput();
 }//Hshuttle()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void SimPed()
+{
+  ofstream out;
+  for(Int_t ddl=0;ddl<=13;ddl++){
+    out.open(Form("ped_%02i.txt",ddl));
+    out << 3 <<endl;
+    for(Int_t row=1;row<=24;row++)
+      for(Int_t dil=1;dil<=10;dil++)
+        for(Int_t adr=0;adr<=47;adr++){
+          Float_t mean  = 150+200*gRandom->Rndm();
+          Float_t sigma = 1+0.2*gRandom->Rndm();
+          Int_t inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma);
+          out << Form("%2i %2i %2i %2i %5.2f %5.2f %x\n",ddl,row,dil,adr,mean,sigma,inhard);
+        }
+
+    Printf("file ped %02i created",ddl);
+    out.close();
+  }
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void SimMap(TMap *pDcsMap,Int_t runTime=1500)
 {
   Int_t stepTime=100; //time interval between mesuraments
@@ -28,17 +49,16 @@ void SimMap(TMap *pDcsMap,Int_t runTime=1500)
     TObjArray *pHV=new TObjArray; pHV->SetOwner(1); 
     for(Int_t time=0;time<runTime;time+=stepTime)  pP->Add(new AliDCSValue((Float_t)1005.0 ,time));   //sample CH4 pressure [mBar]
                                                    pHV->Add(new AliDCSValue((Float_t)2010.0,time));   //sample chamber HV [V]
-      
-    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fP,iCh,iCh,iCh)),pP); 
-    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fHV,iCh,iCh,iCh)),pHV); 
+    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::GetP(),iCh,iCh,iCh)),pP); 
+    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::GetHV(),iCh,iCh,iCh)),pHV); 
         
     for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
       TObjArray *pT1=new TObjArray; pT1->SetOwner(1); 
       TObjArray *pT2=new TObjArray; pT2->SetOwner(1); 
       for (Int_t time=0;time<runTime;time+=stepTime)  pT1->Add(new AliDCSValue(13,time));  //sample inlet temperature    Nmean=1.292 @ 13 degrees
       for (Int_t time=0;time<runTime;time+=stepTime)  pT2->Add(new AliDCSValue(13,time));  //sample outlet temperature
-      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fT1,iCh,iCh,iRad)) ,pT1); 
-      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fT2,iCh,iCh,iRad)),pT2);
+      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::GetT1(),iCh,iCh,iRad)) ,pT1); 
+      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::GetT2(),iCh,iCh,iRad)),pT2);
     }//radiators loop    
   }//chambers loop
 }//SimMap()
@@ -47,7 +67,8 @@ void TestShuttle(TMap *pDcsMap)
 {
   AliTestShuttle* pShuttle = new AliTestShuttle(0,0,1000000);   
   pShuttle->SetDCSInput(pDcsMap);                                                    //DCS map
-  AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle);                           //actual ipreprocessor is created here
+  for(Int_t ddl=0;ddl<=13;ddl++) pShuttle->AddInputFile(AliTestShuttle::kDAQ,"HMP","pedestals",Form("DDL%i",ddl),Form("./ped_%02i.txt",ddl));
+  AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle);                           //actual preprocessor is created here
   pShuttle->Process();                                                               //run SHUTTLE simulator
   delete pp;
 }
@@ -63,8 +84,8 @@ void DrawInput(TCanvas *c,TMap *pDcsMap)
     if(iCh==4) c->cd(4);  if(iCh==3) c->cd(5);  if(iCh==2) c->cd(6);
                           if(iCh==1) c->cd(8);  if(iCh==0) c->cd(9); 
                           
-    TObjArray *pHV=(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::fHV,iCh,iCh,iCh,iCh)); //HV
-    TObjArray *pP =(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::fP,iCh,iCh,iCh)); //P
+    TObjArray *pHV=(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::GetHV(),iCh,iCh,iCh,iCh)); //HV
+    TObjArray *pP =(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::GetP(),iCh,iCh,iCh)); //P
     TGraph *pGr=new TGraph; pGr->SetMarkerStyle(5);
     
     TIter nextp(pP); cnt=0; while((pVal=(AliDCSValue*)nextp())){ pGr->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());}//P
@@ -77,14 +98,18 @@ void DrawInput(TCanvas *c,TMap *pDcsMap)
 void DrawOutput()
 {
   AliCDBManager::Instance()->SetDefaultStorage("local://$HOME");
-  AliCDBEntry *pQthreEnt=AliCDBManager::Instance()->Get("HMPID/Calib/Qthre",0);
-  AliCDBEntry *pNmeanEnt=AliCDBManager::Instance()->Get("HMPID/Calib/Nmean",0);
-  
-  if(!pQthreEnt || ! pNmeanEnt) return;
+  AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre",0);
+  AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean",0);
+  AliCDBEntry *pSigCutEnt=AliCDBManager::Instance()->Get("HMPID/Calib/SigCut",0);
+  AliCDBEntry *pDaqSigEnt=AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig",0);
   
-  TObjArray *pNmean=(TObjArray*)pNmeanEnt->GetObject(); 
-  TObjArray *pQthre=(TObjArray*)pQthreEnt->GetObject(); 
+  if(!pQthreEnt || ! pNmeanEnt || !pSigCutEnt || !pDaqSigEnt) return;
   
+  TObjArray *pNmean =(TObjArray*)pNmeanEnt ->GetObject(); 
+  TObjArray *pQthre =(TObjArray*)pQthreEnt ->GetObject(); 
+  TObjArray *pSigCut=(TObjArray*)pSigCutEnt->GetObject(); 
+  TObjArray *pDaqSig=(TObjArray*)pDaqSigEnt->GetObject();
+   
   TF1 *pRad0,*pRad1,*pRad2;  
   TCanvas *c2=new TCanvas("c2","Nmean"); c2->Divide(3,3);