StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Equal.C
1 
3 class StEmcEqualMaker;
4 class StEmcMipMaker;
5 StEmcEqualMaker *equal = 0;
6 
7 TMemStat memory;
8 
9 void Equal()
10 {
11  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
12  loadSharedLibraries();
13  gSystem->Load("StDbUtilities");
14  gSystem->Load("StDbLib");
15  gSystem->Load("StDbBroker");
16  gSystem->Load("St_db_Maker");
17  gSystem->Load("libgeometry_Tables");
18  gSystem->Load("StDaqLib");
19  gSystem->Load("StEmcRawMaker");
20  gSystem->Load("StEmcADCtoEMaker");
21 
22 // Load my maker
23  gSystem->Load("StEmcCalibrationMaker");
24 
25  if(equal) { delete equal; equal = 0;}
26  equal = new StEmcEqualMaker();
27 
28  // need to configure the maker with the same parameters that
29  // were used to create the spectra.
30  equal->setDetector(1);
31  equal->setRange(700);
32  equal->Init();
33 
34  // load equalization data.
35  equal->loadHist("equal/equal.root");
36 
37  // equalization of the detector based on slopes
38  // mode = equalization mode
39  // 0 = equalize based on mean and RMS spectrum values (linear)
40  // 1 = equalize based only on mean values (linear)
41  // 2 = equalize based on mean and RMS spectrum values (log)
42  // 3 = equalize based only on mean values (log)
43  // 4 = equalize based on exponential fit and compare to a reference spectrum
44  // 5 = equalize based on exponential fit and compare slope to a given function
45  // the reference is found as the tower with the
46  // mean ADC value closest to the mean of mean ADC values
47  // Only 4 and 5 are fully tested. I never paid too much attention to the others.
48  //
49  // deta = size of eta bin in towers
50  //
51  // et = true/false. This sets if equalization is done in E or Et.
52  // it only makes difference if deta is too large
53  //
54  // to tune up the equalization need to change the function StEmcEqualMaker::equalize()
55  // because we need to look at the data to check statistics to decide the fit
56  // limits and initial guesses. Every run we have something different.
57 
58  int mode = 5;
59  int deta = 2;
60  bool et=false;
61  equal->equalize(mode, deta, et);
62 
63  // This saves the equalization contants to a root file. This file can
64  // be used to do eta bins MIP calibration or to change the high voltages.
65  // the parameters are date, time
66 
67  equal->saveEqual(20040101,0);
68 
69 }