//#include <AliTestShuttle.h> //Test()
#include <TRandom.h> //Test()
#include <TF1.h> //Process()
+#include <TF2.h> //Process()
#include <TGraph.h> //Process()
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)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
UInt_t AliRICHPreprocessor::Process(TMap* pDcsMap)
{
-//
- 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;
- }
+//
+// 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");
+// list->Print();
+// delete list;
+// }
if(!pDcsMap) return 0; //no DCS map provided
- TObjArray result; result.SetOwner(kTRUE); //result is a array of TF1
-
+ TF2 idxC6F14("RidxC4F14","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5796)-0.0005*(y-20))",5.5,8.5,0,50); //DiMauro mail temp 0-50 degrees C
+ Double_t eMean=6.67786; //mean energy of photon defined by transperancy window
- 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());
+ TObjArray radTemp; radTemp.SetOwner(kTRUE); //store temp versus time as TF1 array for all radiators (21)
+ TObjArray meanIdx; meanIdx.SetOwner(kTRUE); //store ref idx versus time as TF1 array for all radiators (21)
-
- 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 points for this alias
+ if(!pValLst) continue; //no data points
+ TF1 *pRadTempF=new TF1(Form("RadTemp%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",0,10); pRadTempF->SetLineColor(iRad+2); //temp=f(time)
+ TF1 *pMeanIdxF=new TF1(Form("MeanIdx%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",0,10); pMeanIdxF->SetLineColor(iRad+2); //idx=f(time)
+ TGraph *pRadTempG=new TGraph; //tmp graph of rad temp versus time
+ TGraph *pMeanIdxG=new TGraph; //tmp graph of mean ref idx versus time
+ TIter next(pValLst); AliDCSValue *pDcsVal; Int_t i=0;
+ while((pDcsVal=(AliDCSValue*)next())){ //loop over data points for this sensor
+ pRadTempG->SetPoint(i,pDcsVal->GetTimeStamp(), pDcsVal->GetFloat()); //and fill the temp graph
+ pMeanIdxG->SetPoint(i,pDcsVal->GetTimeStamp(),idxC6F14.Eval(eMean,pDcsVal->GetFloat())); //and fill the maen ref idx graph
+ i++;
+ }
+ pRadTempG->Fit(pRadTempF,"Q"); //now fit the temp graph
+ pMeanIdxG->Fit(pMeanIdxF,"Q"); //now fit the mean idx graph
+ delete pRadTempG;
+ delete pMeanIdxG;
+ radTemp.Add(pRadTempF);
+ meanIdx.Add(pMeanIdxF);
+ }//radiators loop
+ }//chambers loop
AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliRICHPreprocessor"); metaData.SetComment("SIMULATED");
- return Store(&result, &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly
-
-}//Process()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliRICHPreprocessor::Test()
-{
+ Store("DCS", "RadTemp" , &radTemp , &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly
+ Store("DCS", "MeanIdx" , &meanIdx , &metaData);
- AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/TestCDB"); // initialize location of CDB
+ return 1;
-// 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;
-}
+}//Process()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++