Real aliases names
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Sep 2006 15:36:36 +0000 (15:36 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Sep 2006 15:36:36 +0000 (15:36 +0000)
RICH/AliRICHPreprocessor.cxx
RICH/AliRICHPreprocessor.h
RICH/RichTestShuttle.C [new file with mode: 0644]

index 6b459d3..e7d2781 100644 (file)
 
 ClassImp(AliRICHPreprocessor)
 
-
-
-const char *AliRICHPreprocessor::fgkAliasName[AliRICHPreprocessor::fgkNalias]={"HMP_DET/HMP_MP0/HMP_MP0_LIQ_LOOP.actual.sensors.Rad1In_Temp",
-                                                                               "HMP_DET/HMP_MP0/HMP_MP0_LIQ_LOOP.actual.sensors.Rad1Out_Temp"};
-
-
-
-
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliRICHPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
 {
@@ -29,7 +21,9 @@ void AliRICHPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 UInt_t AliRICHPreprocessor::Process(TMap* pDcsMap)
 {
-//  
+// 
+// Argumets: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
+   
   TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files
   if (list){
     Log("The following sources produced files with the id MAP");
@@ -42,68 +36,24 @@ UInt_t AliRICHPreprocessor::Process(TMap* pDcsMap)
   TObjArray result; result.SetOwner(kTRUE);  //result is a array of TF1
     
   
-  for(Int_t iAlias=0;iAlias<fgkNalias;iAlias++){//aliases loop
-    TObjArray *pOA=(TObjArray*)pDcsMap->GetValue(fgkAliasName[iAlias]);
-    if(!pOA) continue;                                                    //no data points for this alias
-    TF1 *pF1=new TF1("t11","[0]+[1]*x+[2]*sin([3]*x)",0,10);
-    
-    TGraph *pGr=new TGraph; pGr->GetXaxis()->SetTimeDisplay(kTRUE);       //tmp graph of sensor data versus time 
-
-    TIter next(pOA);  AliDCSValue *pDcsVal; Int_t i=0;
-    while((pDcsVal=(AliDCSValue*)next()))                           //loop over data points for this sensor and fill the graph
-      pGr->SetPoint(i++,pDcsVal->GetTimeStamp(),pDcsVal->GetFloat());
-    
-    
-    pGr->Fit(pF1);                                                        //do fit
-    delete pGr;
-    result.Add(pF1);
-  }
+  for(Int_t iCh=0;iCh<7;iCh++){                             //aliases loop
+    for(Int_t iRad=0;iRad<3;iRad++){
+      TObjArray *pValLst=(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));//get data serias
+      if(!pValLst) continue;                                                                                               //no data serias this alias
+      TF1    *pF1=new TF1("t11","[0]+[1]*x+[2]*sin([3]*x)",0,10); pF1->SetLineColor(iRad+2);     //temp=f(time) for fitting data seria 
+      TGraph *pGr=new TGraph;                                                  //tmp graph of sensor data versus time 
+      TIter next(pValLst);  AliDCSValue *pDcsVal; Int_t i=0;
+      while((pDcsVal=(AliDCSValue*)next()))                                    //loop over data points for this sensor 
+        pGr->SetPoint(i++,pDcsVal->GetTimeStamp(),pDcsVal->GetFloat());        //and fill the graph
+      pGr->Fit(pF1);                                                           //now fit the graph 
+      delete pGr;
+      result.Add(pF1);
+    }//radiators loop
+  }//chambers loop
   
   AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliRICHPreprocessor"); metaData.SetComment("SIMULATED");
 
-  return Store("DCS", "Data", &result, &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly
+  return Store("DCS", "RefIdx", &result, &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly
 
 }//Process()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliRICHPreprocessor::Test()
-{
-  
-  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/TestCDB"); // initialize location of CDB
-
-//   AliTestShuttle* pShuttle = new AliTestShuttle();   
-//   pShuttle->SetDCSInput(SimulateDcsMap());                                           //DCS map format alias->TObjArray of AliDCSValue    
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC1", "map1.root");  //????? real gain map
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC2", "map2.root");  //how to crrespond LDC id and staff from AliRICHDigit ????
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC3", "map3.root");
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC4", "map4.root");
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC5", "map5.root");
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC6", "map6.root");
-//   pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC7", "map7.root");
-//   
-//   AliPreprocessor* pp = new AliRICHPreprocessor(pShuttle);                           //start test, actual invocation of Process will be done from shuttle
-//   pShuttle->Process();                                    
-//   delete pp;
-  
-  
-  
-//read array of TF1 stored in CDB  
-  AliCDBEntry *pEntry=AliCDBManager::Instance()->Get("RICH/SHUTTLE/Data",0);
-  if(!pEntry) Printf("ERROR file is not retrieved!!!");
-}//Test()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TMap* AliRICHPreprocessor::SimulateDcsMap()
-{
-  TMap*      pDcsMap = new TMap;       pDcsMap->SetOwner(1);
-  
-  for(Int_t iAlias=0;iAlias<fgkNalias;iAlias++){//loop on aliases
-    TObjArray* pOA  = new TObjArray;  pOA->SetOwner(1); //values are supposed to be arranged in TObjArray
-    for (Int_t timeStamp=0;timeStamp<1000;timeStamp+=10) {
-      Float_t simVal = Float_t(20*gRandom->Gaus());                    //T sensor provides floats
-      AliDCSValue*    pDcsVal = new AliDCSValue(simVal, timeStamp);
-      pOA->Add(pDcsVal);                                                                            //add new data point to array
-    }
-    pDcsMap->Add(new TObjString(fgkAliasName[iAlias]),pOA);                                         //add new array of data points to the map
-  }//aliases loop
-  return pDcsMap;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index 9e074ea..5f170c1 100644 (file)
@@ -10,14 +10,9 @@ class AliRICHPreprocessor : public AliPreprocessor
 public:
            AliRICHPreprocessor(AliShuttleInterface* pShuttle):AliPreprocessor("RICH",pShuttle)  {}
   virtual ~AliRICHPreprocessor(                             )                                   {}
-  static  void      Test(); 
-  static  TMap*     SimulateDcsMap(); 
 protected:
   virtual void   Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
   virtual UInt_t Process   (TMap* pDcsMap                              );
-  
-  static const Int_t fgkNalias=2;
-  static const char *fgkAliasName[fgkNalias];         //array of DCS alias names
   ClassDef(AliRICHPreprocessor, 0);
 };
 
diff --git a/RICH/RichTestShuttle.C b/RICH/RichTestShuttle.C
new file mode 100644 (file)
index 0000000..99b734c
--- /dev/null
@@ -0,0 +1,50 @@
+void RichTestShuttle()
+{
+// this macro is to simulate the functionality of SHUTTLE.
+// Here the list of DCS aliases is created and packed in TMap of structure "alias name" - TObjArray of AliDCSValue    
+  TMultiGraph *pMG[7]; for(Int_t i=0;i<7;i++) {pMG[i]=new TMultiGraph; pMG[i]->SetTitle("T,grad C;time");}
+  TGraph      *pGr[21];for(Int_t i=0;i<21;i++){pGr[i]=new TGraph;      pGr[i]->SetMarkerStyle(i%3+24); pGr[i]->SetMarkerColor(i%3+2); pMG[i/3]->Add(pGr[i]);}    
+  TMap        *pDcsMap = new TMap;       pDcsMap->SetOwner(1);          //DCS archive map
+  
+  for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
+    for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
+      TObjArray* pValLst  = new TObjArray;  pValLst->SetOwner(1);                
+      Int_t iPoint=0;
+      for (Int_t time=0;time<1000;time+=50) {
+        AliDCSValue*    pVal = new AliDCSValue(Float_t(iCh*3+iRad+0.1*gRandom->Gaus()), time);         //sample new data point 
+        pValLst->Add(pVal);                                                                            //add it to the list
+        pGr[3*iCh+iRad]->SetPoint(iPoint++,time,pVal->GetFloat());                                     //and also to the graph  
+      }
+      pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad)),pValLst); //add new list to the map
+    }//radiators loop
+  }//chambers loop
+  
+  
+  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/tstCDB"); // initialize location of CDB
+      
+      
+  gSystem->Load("libTestShuttle.so"); 
+  Int_t iRun=1;   
+  AliTestShuttle* pShuttle = new AliTestShuttle(iRun,0,100000);   
+  pShuttle->SetDCSInput(pDcsMap);                                                    //DCS map
+  AliPreprocessor* pp = new AliRICHPreprocessor(pShuttle);                           //actual ipreprocessor is created here
+  pShuttle->Process();                                                               //run SHUTTLE simulator
+  delete pp;
+  
+    
+//read array of TF1 stored in CDB  
+  AliCDBEntry *pEntry=AliCDBManager::Instance()->Get("RICH/DCS/RefIdx",iRun);
+  if(!pEntry) {Printf("ERROR file is not retrieved!!!");return;}
+
+  TObjArray *pFunLst=(TObjArray*)pEntry->GetObject(); TF1 *pRad0,*pRad1,*pRad2;  
+  TCanvas *pC=new TCanvas; pC->Divide(3,3);
+  for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
+    if(iCh==6) pC->cd(1);  if(iCh==5) pC->cd(2);                          //this is just to see the input
+    if(iCh==4) pC->cd(4);  if(iCh==3) pC->cd(5);  if(iCh==2) pC->cd(6);
+                           if(iCh==1) pC->cd(8);  if(iCh==0) pC->cd(9); 
+    pMG[iCh]->Draw("ap"); pMG[iCh]->GetXaxis()->SetTimeDisplay(kTRUE);
+    pRad0=(TF1*)pFunLst->At(iCh*3+0); pRad0->Draw("same");
+    pRad1=(TF1*)pFunLst->At(iCh*3+1); pRad1->Draw("same");
+    pRad2=(TF1*)pFunLst->At(iCh*3+2); pRad2->Draw("same");
+  }  
+}//Test()