]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDPreprocessor.cxx
ANALYSIS lib is added
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPreprocessor.cxx
1 #include "AliHMPIDPreprocessor.h" //header
2
3 #include <AliCDBMetaData.h>
4 #include <AliDCSValue.h>      
5 #include <TF1.h>              //Process()
6 #include <TF2.h>              //Process()
7 #include <TGraph.h>           //Process()
8 #include <AliLog.h>           //Process() 
9
10 //.
11 // HMPID Preprocessor base class
12 //.
13 //.
14 //.
15 ClassImp(AliHMPIDPreprocessor)
16
17 char *AliHMPIDPreprocessor::fgP ="HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value";
18 char *AliHMPIDPreprocessor::fgT1="HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp";
19 char *AliHMPIDPreprocessor::fgT2="HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp";
20 char *AliHMPIDPreprocessor::fgHV="HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon";
21
22 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 void AliHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
24 {
25   AliPreprocessor::Initialize(run, startTime, endTime);
26 }
27 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28 UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
29 {
30 // Process: 1. inlet and outlet C6F14 temperature, stores TObjArray of 21 TF1, where TF1 is Nmean=f(t), one per radiator
31 //          2. CH4 pressure and HV                 stores TObjArray of 7 TF1 where TF1 is thr=f(t), one per chamber
32 // Arguments: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
33 // Assume that: HV is the same during the run for a given chamber, different chambers might have different HV
34 //              P=f(t), different for different chambers     
35      
36 //  TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files
37 //  if (list){
38 //    Log("The following sources produced files with the id MAP");
39 //    list->Print();
40 //    delete list;
41 //  }
42
43
44   if(!pMap)  return 0;                    //no DCS map provided 
45   Double_t sor=0,eor=1500;
46
47   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
48   TF2 thr("RthrCH4"  ,"x+170745848*exp(-y*0.0162012)"                                                      ,2000,3000,900,1200); //thr=f(HV,P)  [V,mBar]
49 //  Double_t eMean=6.67786;                                                                                  //mean energy of photon defined  by transperancy window
50   
51 //  TObjArray arTmean(21); arTmean.SetOwner(kTRUE);     //21 Tmean=f(time) one per radiator
52 //  TObjArray arPress(7);  arPress.SetOwner(kTRUE);     //7  Press=f(time) one pre chamber
53   TObjArray arNmean(21); arNmean.SetOwner(kTRUE);     //21 Nmean=f(time) one per radiator
54   TObjArray arQthre(7);  arQthre.SetOwner(kTRUE);     //7  Qthre=f(time) one pre chamber
55   
56 //  AliDCSValue *pVal; Int_t cnt=0;
57     
58   for(Int_t iCh=0;iCh<7;iCh++){            
59  //   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
60 //    pVal=(AliDCSValue*)pHV->At(0); Float_t hv=pVal->GetFloat();//HV    
61
62 //    TObjArray *pP =(TObjArray*)pMap->GetValue(Form(fP,iCh,iCh,iCh)); //P
63 //    TGraph *pGrP; cnt=0;TIter nextp(pP); while((pVal=(AliDCSValue*)nextp())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P
64                                                                          
65 //    TF1 *pFuP=new TF1(Form("P%i",iCh),"1005",sor,eor); 
66 //    pGrP->Fit(pFuP,"Q"); delete pGrP;
67     TF1 *pFuQ=new TF1(Form("HMP_Qthre%i",iCh),"100",sor,eor);
68     arQthre.AddAt(pFuQ,iCh);    
69     for(Int_t iRad=0;iRad<3;iRad++){
70 //      TObjArray *pT1=(TObjArray*)pMap->GetValue(Form(fT1,iCh,iCh,iRad)); //Tin
71 //      TGraph *pGrT1=new TGraph; cnt=0; TIter next1(pT1); while((pVal=(AliDCSValue*)next1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //inlet temperature
72 //      pGrT1->Fit(new TF1(Form("Tin%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",sor,eor),"Q");       //now fit the temp graph 
73       
74 //      TObjArray *pT2=(TObjArray*)pMap->GetValue(Form(fT2,iCh,iCh,iRad));//Tout      
75 //      TGraph *pGrT2=new TGraph; cnt=0; TIter next2(pT2); while((pVal=(AliDCSValue*)next2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //outlet temperature
76 //      TF1*pFuT1=new TF1(Form("Tout%i%i",iCh,iRad),"13",sor,eor)      
77 //      pGrT2->Fit(,"Q");       //now fit the temp graph 
78       
79 //      arTmean.Add(pRadTempF);  
80       TF1 *pFuN=new TF1(Form("HMP_Nmean%i-%i",iCh,iRad),"1.292",sor,eor); pFuN->SetLineColor(iRad+2); pFuN->SetLineWidth(1);
81       arNmean.AddAt(pFuN,3*iCh+iRad);
82 //      delete pGrT1;  delete pGrT2;
83     }//radiators loop
84   }//chambers loop
85   
86   AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliHMPIDPreprocessor"); metaData.SetComment("SIMULATED");
87
88   
89   arQthre.Print();
90 //  Store("Calib", "Press" , &arPress , &metaData); 
91 //  Store("Calib", "Tmean" , &arTmean , &metaData); 
92
93   if( Store("Calib", "Qthre" , &arQthre , &metaData) == kTRUE && Store("Calib", "Nmean" , &arNmean , &metaData) == kTRUE ) return 0;   //clm: compatibility with new Store and preprocessor requirement
94   else return 1;
95   
96   //  AliInfo("End.");  
97
98 }//Process()
99 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
100