]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Now pedestal files and User and Daq sigma cuts properly set.
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 23:35:22 +0000 (23:35 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 23:35:22 +0000 (23:35 +0000)
HMPID/AliHMPIDPreprocessor.cxx
HMPID/AliHMPIDReconstructor.cxx
HMPID/AliHMPIDReconstructor.h
HMPID/Hshuttle.C

index 142c2c9c185c2857376266f298c4331773b3e8dc..49e13220f548235649cd4fab81a4b13d046b1d7e 100644 (file)
@@ -27,10 +27,23 @@ 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    
-  if(! pMap)                     return 1; 
-  if(ProcDcs(pMap) && ProcPed()) return 0;
-  else                           return 1;     
+//   Returns: 0 on success or 1 on error
+  Printf("HMPID - Process in Preprocessor started");
+  if(! pMap) {Printf(" - Not map of DCS aliases for HMPID - ");return 1;}   
+  
+  TString runType = GetRunType();
+  Printf(" AliHMPIDPreprocessor: RunType is %s",runType.Data());
+  Bool_t result1,result2;
+  if (runType == "PEDESTAL_RUN"){
+    result1 = ProcPed(); return result1;
+  } else if ( runType == "PHYSICS" ){
+    result1 = ProcPed(); 
+    result2 = ProcDcs(pMap); return (result1&&result2);
+  } else {
+    Log("Nothing to do with preprocessor for HMPID, bye!");
+  return kFALSE;
+  }
+  
 }//Process()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
@@ -49,10 +62,11 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
 // Qthr is estimated as 3*A0
   TF2 thr("RthrCH4"  ,"3*10^(3.01e-3*x-4.72)+170745848*exp(-y*0.0162012)"             ,2000,3000,900,1200); 
   
-  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 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 arUserCut(7);    arUserCut.SetOwner(kTRUE);     //7  user cut in number of sigmas
   
   AliDCSValue *pVal; Int_t cnt=0;
     
@@ -64,7 +78,9 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
     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;   
     
-    arQthre.AddAt(new TF1(Form("HMP_Qthre%i",iCh),"100",fStartTime,fEndTime),iCh);    
+    arQthre.AddAt(new TF1(Form("HMP_Qthre%i",iCh),"100",fStartTime,fEndTime),iCh);
+    TObject *pUserCut = new TObject();pUserCut->SetUniqueID(1);
+    arUserCut.AddAt(pUserCut,iCh);    
     
     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
@@ -86,10 +102,10 @@ Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
   
   AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliHMPIDPreprocessor"); metaData.SetComment("SIMULATED");
   
-//  Store("Calib", "Press" , &arPress , &metaData)  Store("Calib", "Tmean" , &arTmean , &metaData);
-  
-  if(Store("Calib","Qthre",&arQthre,&metaData,0,kTRUE) && Store("Calib","Nmean",&arNmean,&metaData,0,kTRUE) ) return kTRUE; //all OK
-  else                                                                                                        return 1;
+  if(Store("Calib","Qthre",&arQthre,&metaData,0,kTRUE) && 
+     Store("Calib","Nmean",&arNmean,&metaData,0,kTRUE) &&
+     Store("Calib","UserCut",&arUserCut,&metaData,0,kTRUE)) return kTRUE; //all OK
+  else return kFALSE;
 }//Process()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDPreprocessor::ProcPed()
@@ -106,7 +122,7 @@ Bool_t AliHMPIDPreprocessor::ProcPed()
   Int_t nSigCut,r,d,a,hard;  Float_t mean,sigma;
   for(Int_t ddl=0;ddl<14;ddl++){  
     ifstream infile(Form("HmpidPedDdl%02i.txt",ddl));
-    if(!infile.is_open()) return kFALSE;
+    if(!infile.is_open()) {Printf("No pedestal file found for HMPID,bye!");return kFALSE;}
     TMatrix *pM=(TMatrixF*)aDaqSig.At(ddl/2);
     infile>>nSigCut; pM->SetUniqueID(nSigCut); //n. of pedestal distribution sigmas used to create zero suppresion table
     while(!infile.eof()){
index cb4bad14f7720d4716f8a7428237168364e6a093..93520d0b2788580859ffd0cc396132e0462a0db8 100644 (file)
@@ -34,9 +34,10 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
 //ctor
 //
   AliHMPIDParam::Instance();                                                        //geometry loaded for reconstruction
+  fUserCut = new Int_t(7);
   fClu=new TObjArray(AliHMPIDParam::kMaxCh+1); fClu->SetOwner(kTRUE);
   fDig=new TObjArray(AliHMPIDParam::kMaxCh+1); fDig->SetOwner(kTRUE);
-
+  
   for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ 
     fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i);
     TClonesArray *pClus = new TClonesArray("AliHMPIDCluster");
@@ -46,53 +47,21 @@ AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fD
   
   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();
+  TObjArray *pUserCut = (TObjArray*)pUserCutEnt->GetObject(); 
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop 
+    fUserCut[iCh] = pUserCut->At(iCh)->GetUniqueID();
+    Printf("HMPID: UserCut successfully loaded for chamber %i -> %i ",iCh,fUserCut[iCh]);
+  }
 
-  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;
+  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!");
+  fDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop 
+    Printf(" HMPID: DaqSigCut successfully loaded for chamber %i -> %i ",iCh,(Int_t)fDaqSig->At(iCh)->GetUniqueID());
   }
 }//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(AliHMPIDParam::kMaxCh+1);fDaqSig->SetOwner(kTRUE);
-  
-  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::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.
index 86f80dc76f08ecff50bfbcf54d828d5bbaf5572f..b8a6bdc520213175571b2e434211476408dfcb9c 100644 (file)
@@ -36,9 +36,8 @@ public:
   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)
+  Int_t     *fUserCut;                 // n sigmas for pedestals decided by the User for each chamber(if in OCDB)
   TObjArray *fDaqSig;                  // container for the pad pedestal sigmas
   TObjArray *fDig;                     // tmp list of digits
   TObjArray *fClu;                     // tmp list of clusters
@@ -64,10 +63,12 @@ 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;
+  Int_t iCh = pDig->Ch();
+  Int_t iDaqSigCut =(Int_t)fDaqSig->At(iCh)->GetUniqueID(); 
+  if(fUserCut[iCh]<=iDaqSigCut) return kTRUE;
   TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
   Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
-  if(pDig->Q()>fUserCut*sig) return kTRUE;
+  if(pDig->Q()>fUserCut[iCh]*sig) return kTRUE;
   else return kFALSE;
 }
 
index e94f145369ff8036c4c3cf80a8f17e90db52e4ef..efd6afef6d14effd661f4eab55c339e3bb1fc912 100644 (file)
@@ -1,31 +1,36 @@
-void Hshuttle(Int_t runTime=1500)
+  void Hshuttle(Int_t runTime=1500)
 {// this macro is to simulate the functionality of SHUTTLE.
-  gSystem->Load("libTestShuttle.so");
-  AliTestShuttle::SetMainCDB(TString("local://$HOME/CDB"));
+  gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle.so");
+//  AliTestShuttle::SetMainCDB(TString("local://$HOME/CDB"));
+  AliTestShuttle::SetMainCDB(TString("local://$HOME"));
   
   TMap *pDcsMap = new TMap;       pDcsMap->SetOwner(1);          //DCS archive map
   
   AliTestShuttle* pShuttle = new AliTestShuttle(0,0,1000000);   
+  pShuttle->SetInputRunType("PHYSICS");
   SimPed();   for(Int_t ldc=1;ldc<=4;ldc++) pShuttle->AddInputFile(AliTestShuttle::kDAQ,"HMP","pedestals",Form("LDC%i",ldc),Form("HmpidPeds%i.tar",ldc));
   SimMap(pDcsMap,runTime); pShuttle->SetDCSInput(pDcsMap);                                    //DCS map
   
   AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle); pShuttle->Process();  delete pp;  //here goes preprocessor 
 
   DrawInput(pDcsMap); DrawOutput();
+  gSystem->Exec("rm -rf HmpidPedDdl*.txt");
+  gSystem->Exec("rm -rf HmpidPeds*.tar");
 }//Hshuttle()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void SimPed()
 {
+  Int_t nSigmas = 1;             // value stored in the ddl files of pedestals
   ofstream out;
   for(Int_t ddl=0;ddl<=13;ddl++){
     out.open(Form("HmpidPedDdl%02i.txt",ddl));
-    out << 3 <<endl;
+    out << nSigmas <<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 = ddl+gRandom->Gaus();
-          Int_t inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma);
+          Float_t sigma = 1+0.3*gRandom->Gaus();
+          Int_t inhard=((Int_t(mean))<<9)+Int_t(mean+nSigmas*sigma);
           out << Form("%2i %2i %2i %5.2f %5.2f %x\n",row,dil,adr,mean,sigma,inhard);
         }
 
@@ -36,7 +41,6 @@ void SimPed()
   gSystem->Exec("tar cf HmpidPeds2.tar HmpidPedDdl04.txt HmpidPedDdl05.txt HmpidPedDdl06.txt HmpidPedDdl07.txt");
   gSystem->Exec("tar cf HmpidPeds3.tar HmpidPedDdl08.txt HmpidPedDdl09.txt HmpidPedDdl10.txt HmpidPedDdl11.txt");
   gSystem->Exec("tar cf HmpidPeds4.tar HmpidPedDdl12.txt HmpidPedDdl13.txt");
-  gSystem->Exec("rm -rf ped*.txt");
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void SimMap(TMap *pDcsMap,Int_t runTime=1500)
@@ -48,11 +52,19 @@ void SimMap(TMap *pDcsMap,Int_t runTime=1500)
   for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
     TObjArray *pP=new TObjArray;  pP->SetOwner(1);
     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]
+    TObjArray *pUserCut=new TObjArray; pUserCut->SetOwner(1); 
+    TObjArray *pDaqSigCut=new TObjArray; pDaqSigCut->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]
+       pUserCut->Add(new AliDCSValue(3,time));            //User Cut in number of sigmas
+       pDaqSigCut->Add(new AliDCSValue(1,time));          //Cut in sigmas applied to electronics
+    }
     pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value"           ,iCh,iCh,iCh)),pP); 
     pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh)),pHV); 
-        
+    pDcsMap->Add(new TObjString(Form("HMP_%i.UserCut",iCh)),pUserCut); 
+    pDcsMap->Add(new TObjString(Form("HMP_%i.DaqSigCut",iCh)),pDaqSigCut); 
+
     for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
       TObjArray *pT1=new TObjArray; pT1->SetOwner(1); 
       TObjArray *pT2=new TObjArray; pT2->SetOwner(1); 
@@ -94,7 +106,8 @@ void DrawInput(TMap *pDcsMap)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void DrawOutput()
 {
-  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/CDB"); AliCDBManager::Instance()->SetRun(0);
+//  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/CDB"); AliCDBManager::Instance()->SetRun(0);
+  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME"); AliCDBManager::Instance()->SetRun(0);
   AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre");
   AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean");
   AliCDBEntry *pDaqSigEnt=AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");