StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fitAdc4Ped.C
1 TFile *fd=0;
2 TCanvas *c=0;
3 
4 fitAdc4Ped(char* fName="Rnnnped", char* inDir="") {//
5 
6  assert( !gSystem->Load("StEEmcPedFit"));
7 
8  TString fPath=inDir;
9 
10  TString headName=fPath+fName;
11 
12  TString fullName=headName+".hist.root";
13 
14  TString saveHistoName=headName+"fit";
15 
16  TFile *j=new TFile(fullName);
17 
18  if (!j->IsOpen()){
19  printf("failed to open %s hist.root file\n",fName);
20  return;
21  }
22 
23  EEpixPed *pix=new EEpixPed(fullName);
24 
25  TString fname1=fPath+"ped";
26 
27  //Towers
28  // peak search [x1,x2], peak fit [max-xFit, max+xFit] if integral>minInt
29  pix->setLimits(1,250,10,5); //x1,x2,minInt,+/-xFit
30  pix->setQA(2000, 1.,35, 0.5,2.); // minInt, pedLow, pedHigh, pedSigMin pedSigMax
31  pix->findTowerHisto();
32  pix->fitHisto(fPath);
33  pix->saveHisto(saveHistoName);
34 
35  pix->savePedTable("w", fname1);
36  pix->dropHisto();
37 
38  //MAPMT
39  pix->setLimits(2,400,900,3); //x1,x2,minInt,+/-xFit
40  pix->setQA(2000, 120.,300, 0.4,2.); // minInt, pedLow, pedHigh, pedSigMin pedSigMax
41  pix->findMapmtHisto();
42  pix->fitHisto(fPath);
43  pix->saveHisto(saveHistoName);
44  pix->savePedTable("a", fname1);
45 
46 }
47