]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/MakeT0RecoParam.C
correct fill T0 triggers for all run periods
[u/mrichter/AliRoot.git] / T0 / MakeT0RecoParam.C
1 void MakeT0RecoParam(Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity(), AliRecoParam::EventSpecie_t defaultParam = AliRecoParam::kHighMult)
2 //void MakeT0RecoParam(Int_t startRun = 122000, Int_t endRun = 126437, AliRecoParam::EventSpecie_t defaultParam = AliRecoParam::kHighMult)
3 {
4   // Create T0 Calibration Object for Ideal calibration and
5   // write it on CDB
6   AliCDBManager *man = AliCDBManager::Instance();
7   //  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
8    man->SetDefaultStorage("local:///home/alla/alice/Feb11/TestCDB");
9   man->SetRun(startRun);
10   
11   TObjArray *recoParamArray = new TObjArray();
12   AliT0RecoParam* t0RecoParam;
13
14   t0RecoParam = AliT0RecoParam::GetHighFluxParam();
15   t0RecoParam->SetEventSpecie(AliRecoParam::kHighMult);
16    Float_t low[500] , high[500] ;
17    Float_t pos[24] = {2472, 2492, 2501, 2540, 2526, 2525, 2501, 2461, 2556, 2544, 2533, 2487, 
18                       2485, 2502, 2453, 2470, 2520, 2486, 2512, 2523, 2505, 2562, 2533, 2481}; 
19     for (Int_t i=0; i<107; i++)
20       {
21         low[i] = 500;
22         high[i]=50000;
23         if(i>0  && i<13) { low[i] = pos[i-1] - 200; high[i] = pos[i-1] + 200;}
24         if(i>56 && i<69) { low[i] = pos[i-57] - 200.; high[i]=pos[i-57] + 200;}
25         //      if(i<13) { low[i]=pos[i]-500.;high[i]=pos[i]+500.;}
26         //      if(i>56 && i<69) { low[i]=pos[i+13-57]-500.;high[i]=pos[i-57+13]+500.;}
27   }
28
29   // bad PMT
30   t0RecoParam->SetRefPoint(-1);
31   // amplitude range for recontruction
32   low[200]=0.5;
33   high[200]=80;
34   for (Int_t i=0; i<24; i++) t0RecoParam-> SetBadChannels(i,0);
35   
36   for (Int_t i=0; i<500; i++) {
37     t0RecoParam->SetLow(i,low[i]);
38     t0RecoParam->SetHigh(i,high[i]);
39   }
40   t0RecoParam->PrintParameters();
41   recoParamArray->AddLast(t0RecoParam);
42   
43   //-----------------------------------------
44
45   t0RecoParam = AliT0RecoParam::GetLowFluxParam();
46   t0RecoParam->SetEventSpecie(AliRecoParam::kLowMult);
47     Float_t low[500], high[500] ;
48     for (Int_t i=0; i<500; i++)
49       {
50         low[i] = 500;
51         high[i]=50000;
52         if(i>0  && i<13) { low[i] = pos[i-1] - 200; high[i] = pos[i-1] + 200;}
53         if(i>56 && i<69) { low[i] = pos[i-57] - 200.; high[i]=pos[i-57] + 200;}
54         //      if(i<13) { low[i]=pos[i]-500.;high[i]=pos[i]+500.;}
55         //      if(i>56 && i<69) { low[i]=pos[i+13-57]-500.;high[i]=pos[i-57+13]+500.;}
56     }
57
58   // bad PMT
59     //  t0RecoParam->SetRefPoint(-1);
60     for (Int_t i=0; i<24; i++) t0RecoParam->SetBadChannels(i,0);
61   t0RecoParam->SetRefPoint(-1);
62   // amplitude range for recontruction
63   low[200]=0.8;
64   high[200]=80;
65   for (Int_t i=0; i<500; i++) {
66     t0RecoParam->SetLow(i,low[i]);
67     t0RecoParam->SetHigh(i,high[i]);
68   }
69   t0RecoParam->PrintParameters();
70   recoParamArray->AddLast(t0RecoParam);
71   //--------------------------------------
72   t0RecoParam = AliT0RecoParam::GetLaserTestParam();
73   t0RecoParam->SetEventSpecie(AliRecoParam::kCalib);
74   // t0RecoParam->Dump();
75   cout<<" t0RecoParam->GetEventSpecie "<< t0RecoParam->GetEventSpecie()<<endl;
76   for (Int_t i=0; i<107; i++) {
77     t0RecoParam->SetLow(i, 0);
78     t0RecoParam->SetHigh(i, 50000);
79   }
80   //  t0RecoParam->Dump();
81   t0RecoParam->SetRefPoint(1);
82   t0RecoParam->PrintParameters();
83   recoParamArray->AddLast(t0RecoParam);
84
85
86   // Set the default
87  Bool_t defaultIsSet = kFALSE;
88  //  cout<<"recoParamArray->GetEntriesFast() "<<recoParamArray.GetEntriesFast()<<endl;
89   TIter next(recoParamArray->MakeIterator());
90   while ( (param = static_cast<AliT0RecoParam*>(next())) ) {
91     if (!param) continue;
92       if (defaultParam ==  param->GetEventSpecie()) {
93       cout<<" Specie "<<param->GetEventSpecie()<<endl;
94           param->SetEventSpecie(param->GetEventSpecie());
95         param->SetAsDefault(); 
96        defaultIsSet = kTRUE;
97       }
98         param->Print("FULL");
99   }
100
101
102   AliCDBMetaData *md= new AliCDBMetaData();
103   md->SetResponsible("Alla");
104   md->SetComment("Reconstruction parameters T0");
105   md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
106   md->SetBeamPeriod(0);
107   AliCDBId id("T0/Calib/RecoParam",startRun,endRun);
108   man->GetDefaultStorage()->Put(recoParamArray,id, md);
109
110 }
111
112