]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDPreprocessor.cxx
Removing .cvsignore files
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPreprocessor.cxx
index fd1cb5ecddab5bba338f440176c16a68749e7548..920888b4d1fc4af5d3b09d18d9854936744f6fdc 100644 (file)
@@ -9,6 +9,7 @@
 #include <TTimeStamp.h>           //Initialize()
 #include <TF1.h>                  //Process()
 #include <TF2.h>                  //Process()
+//#include <TString.h>
 #include <TGraph.h>               //Process()
 #include <TMatrix.h>              //ProcPed()
 #include <TList.h>                //ProcPed()
@@ -34,23 +35,31 @@ UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
 // Process all information from DCS and DAQ
 // Arguments: pMap- map of DCS aliases
 // Returns: 0 on success or 1 on error (opposite to Store!)
-  
-  Log("HMPID - Process in Preprocessor started");
-  if(! pMap) {Log(" - Not map of DCS aliases for HMPID - ");return 1;}   
-  
+
   TString runType = GetRunType();
   Log(Form(" AliHMPIDPreprocessor: RunType is %s",runType.Data()));
-  Bool_t result1,result2;
+  
+// start to check event type and procedures
+  
+  Log("HMPID - Process in Preprocessor started");
+  if(! pMap) {
+    Log("HMPID - ERROR - Not map of DCS aliases for HMPID - ");             return kTRUE;   // error in the DCS mapped aliases
+  }   
   if (runType == "PEDESTAL_RUN"){
-    result1 = ProcPed(); return !result1;
+    if (!ProcPed()){
+       Log("HMPID - ERROR - Pedestal processing failed!!");                return kTRUE;   // error in pedestal processing
+    } else {
+       Log("HMPID - Pedestal processing successful!!");                    return kFALSE;  // ok for pedestals
+    }
   } else if ( runType == "PHYSICS" ){
-    result1 = ProcPed(); 
-    result2 = ProcDcs(pMap); return !(result1&&result2);
+    if (!ProcDcs(pMap)){
+       Log("HMPID - ERROR - DCS processing failed!!");                     return kTRUE;   // error in DCS processing
+    } else {
+       Log("HMPID - DCS processing successful!!");                         return kFALSE;  // ok for DCS
+    }
   } else {
-    Log("HMPID - Nothing to do with preprocessor for HMPID, bye!");
-  return kFALSE;
+    Log("HMPID - Nothing to do with preprocessor for HMPID, bye!");         return kFALSE;  // ok - nothing done
   }
-  
 }//Process()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
@@ -64,7 +73,7 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
 
   Bool_t stDcsStore=kFALSE;
 
-  TF2 idx("RidxC4F14","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5796)-0.0005*(y-20))",5.5 ,8.5 ,0  ,50);  //N=f(Ephot,T) [eV,grad C] DiMauro mail
+  TF2 idx("RidxC4F14","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5769)-0.0005*(y-20))",5.5 ,8.5 ,0  ,50);  //N=f(Ephot,T) [eV,grad C] DiMauro mail
   
 // Qthr=f(HV,P) [V,mBar]  logA0=k*HV+b is taken from p. 64 TDR plot 2.59 for PC32 
 //                           A0=f(P) is taken from DiMauro mail
@@ -78,22 +87,42 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
   TObjArray arUserCut(7);    arUserCut.SetOwner(kTRUE);     //7  user cut in number of sigmas
   
   AliDCSValue *pVal; Int_t cnt=0;
+
+// evaluate environment pressure
+  TObjArray *pPenv=(TObjArray*)pMap->GetValue("HMP_DET/HMP_ENV/HMP_ENV_PENV.actual.value"); 
+
+  TIter nextPenv(pPenv);
+
+  TGraph *pGrPenv=new TGraph; cnt=0;
+  while((pVal=(AliDCSValue*)nextPenv())) pGrPenv->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());        //P env
+  if( cnt!=0) pGrPenv->Fit(new TF1("Penv","1000+x*[0]",fStartTime,fEndTime),"Q");                               //clm: if no DCS map entry don't fit
+  delete pGrPenv;
     
   for(Int_t iCh=0;iCh<7;iCh++){                   
 // evaluate High Voltage
-//    TObjArray *pHV=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); //HV
+    TObjArray *pHV=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); TIter nextHV(pHV);
+    TGraph *pGrHV=new TGraph; cnt=0;
+    while((pVal=(AliDCSValue*)nextHV())) pGrHV->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());            //P
+    if( cnt!=0) pGrHV->Fit(new TF1(Form("HV%i",iCh),"2000+x*[0]",fStartTime,fEndTime),"Q");                       //clm: if no DCS map entry don't fit
+    delete pGrHV;
+
 // evaluate Pressure
-    TObjArray *pP =(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value"           ,iCh,iCh,iCh));    TIter nextP(pP);
+    TObjArray *pP =(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWPC.actual.value"           ,iCh,iCh,iCh));
+    TIter nextP(pP);    
     TGraph *pGrP=new TGraph; cnt=0; 
     while((pVal=(AliDCSValue*)nextP())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());            //P
-    if( cnt!=0) pGrP->Fit(new TF1(Form("P%i",iCh),"1005+x*[0]",fStartTime,fEndTime),"Q");                       //clm: if no DCS map entry don't fit
-    delete pGrP;   
+    if( cnt!=0) pGrP->Fit(new TF1(Form("P%i",iCh),"4 + x*[0]",fStartTime,fEndTime),"Q");                       //clm: if no DCS map entry don't fit
+    delete pGrP;
+    
 // evaluate Qthre
-    arQthre.AddAt(new TF1(Form("HMP_Qthre%i",iCh),"100",fStartTime,fEndTime),iCh);
+    arQthre.AddAt(new TF1(Form("HMP_Qthre%i",iCh),Form("3*10^(3.01e-3*HV%i - 4.72)+170745848*exp(-(P%i+Penv)*0.0162012)",iCh),fStartTime,fEndTime),iCh);
+
+    
 // evaluate UserCut
     Int_t nSigmaUserCut = 3;
     TObject *pUserCut = new TObject();pUserCut->SetUniqueID(nSigmaUserCut);
     arUserCut.AddAt(pUserCut,iCh);    
+    
 // evaluate Temperatures    
     for(Int_t iRad=0;iRad<3;iRad++){
       TObjArray *pT1=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));  TIter nextT1(pT1);//Tin
@@ -139,11 +168,27 @@ Bool_t AliHMPIDPreprocessor::ProcPed()
   TObjArray aDaqSig(7); aDaqSig.SetOwner(kTRUE); for(Int_t i=0;i<7;i++) aDaqSig.AddAt(new TMatrix(160,144),i); //TObjArray of 7 TMatrixF, m(padx,pady)=sigma
   
   TList *pLdc=GetFileSources(kDAQ,"pedestals"); //get list of LDC names containing id "pedestals"
+
+  if(!pLdc) {
+        Log("ERROR: Retrieval of sources for pedestals failed!");
+        return kFALSE;}
+
   Log(Form("HMPID - Pedestal files to be read --> %i LDCs for HMPID",pLdc->GetEntries()));
   
-  for(Int_t i=0;i<pLdc->GetEntries();i++)//lists of LDCs
-    gSystem->Exec(Form("tar xf %s",GetFile(kDAQ,"pedestals",((TObjString*)pLdc->At(i))->GetName()))); //untar pedestal files from current LDC
+  for(Int_t i=0;i<pLdc->GetEntries();i++) {//lists of LDCs
+
+    //gSystem->Exec(Form("tar xf %s",GetFile(kDAQ,"pedestals",((TObjString*)pLdc->At(i))->GetName()))); //untar pedestal files from current LDC
   
+  TString fileName = GetFile(kDAQ,"pedestals", ((TObjString*)pLdc->At(i))->GetName());
+
+  if(fileName.Length()==0) {
+        Log("ERROR retrieving pedestal file!");
+        return kFALSE;  }
+
+  gSystem->Exec(Form("tar xf %s",fileName.Data()));
+
+ }
+
   AliHMPIDDigit dig;
   AliHMPIDRawStream rs;
   Int_t nSigCut,r,d,a,hard;  Float_t mean,sigma;
@@ -155,9 +200,7 @@ Bool_t AliHMPIDPreprocessor::ProcPed()
     infile>>nSigCut; pM->SetUniqueID(nSigCut); //n. of pedestal distribution sigmas used to create zero suppresion table
     while(!infile.eof()){
       infile>>dec>>r>>d>>a>>mean>>sigma>>hex>>hard;      
-      //dig.Raw(ddl,r,d,a);
-      rs.Raw(ddl,r,d,a);
-      AliHMPIDDigit dig(rs.GetPad(ddl,r,d,a),rs.GetCharge(ddl,r,d,a));
+      AliHMPIDDigit dig(rs.GetPad(ddl,r,d,a),(Int_t)mean);
       (*pM)(dig.PadChX(),dig.PadChY()) = sigma;
     }
     infile.close();