Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hcalUtil.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file hcalUtil.h
1 #ifndef __HCALUTIL_H__
2 #define __HCALUTIL_H__
3 //#include <TString.h>
4 #include <list>
5 #include <algorithm>
6 
7 #include <TROOT.h>
8 #include <TFile.h>
9 #include <TTree.h>
10 #include <TGMsgBox.h>
11 #include <TCanvas.h>
12 #include <TGraph.h>
13 #include <TString.h>
14 #include <TText.h>
15 #include <TApplication.h>
16 #include <TStyle.h>
17 #include <TSystem.h>
18 #include <TGClient.h>
19 #include <TGWindow.h>
20 #include <TH1.h>
21 #include <TH1F.h>
22 #include <TH1D.h>
23 #include <TProfile.h>
24 #include <TF1.h>
25 #include <TH2.h>
26 #include <TH3.h>
27 #include <TMath.h>
28 #include <TSpectrum.h>
29 #include "TVirtualFitter.h"
30 #include <TSystemDirectory.h>
31 #include <TSystemFile.h>
32 
33 class hcalUtil;
34 class hLabHelper;
35 class hcalHelper;
36 class hcalTree;
37 class tileHelper;
38 class tileTree;
39 class hcal;
40 class stack;
41 class tower;
42 
43 
44 #include <hcalControls.h>
45 
46 // **************************************************************************
47 
48 extern "C" Double_t erfunc(Double_t *x, Double_t * par);
49 extern "C" Double_t erf_g(Double_t *x, Double_t * par);
50 extern "C" Double_t powerFun(Double_t *x, Double_t * par);
51 extern "C" Double_t power_g(Double_t *x, Double_t * par);
52 extern "C" Double_t ps( Double_t *adc, Double_t *par);
53 extern "C" Double_t sipmPeaks(Double_t *x, Double_t *par);
54 extern "C" Int_t sipmCalib(TString & hName, int mode=0);
55 extern "C" Double_t AsymToX(Double_t asym);
56 //extern "C" void pcPattern(Int_t nx, Int_t ny, Int_t run=0, Int_t mode=1);
57 extern "C" Double_t signalShape(Double_t *x, Double_t * par);
58 //extern "C" void fitShape(int chan);
59 //extern "C" void status();
60 //extern "C" Int_t evLoop(int run, int nevents=0, int nfiles=1);
61 //extern "C" void closeEvent();
62 //extern "C" void closeLoop();
63 
64 // **************************************************************************
65 
66 //#ifndef __CINT__
67 // ====================================================================================
68 
69 struct rootfile{
70  rootfile(TString n, Int_t rn, TString rid) : name(n) ,runnumber(rn), runid(rid) {;}
71  rootfile(const rootfile & last){
72  this->name = last.name;
73  this->runnumber = last.runnumber;
74  this->runid = last.runid;
75  }
76  void print(){
77  cout<<"<rootfile> "<<name<<" Run # "<<runnumber<<" RunId "<<runid<<endl;
78  }
79  TString name;
80  Int_t runnumber;
81  TString runid;
82 
83 };
84 // bool operator() runnumberequal(rootfile & rf, Int_t run) const {return run==rf.runnumber;}
85 // ====================================================================================
86 
87 struct prdffile{
88  prdffile(TString n, Int_t rn, TString rid) : name(n) ,runnumber(rn), runid(rid) {;}
89  prdffile(const prdffile & last){
90  this->name = last.name;
91  this->runnumber = last.runnumber;
92  this->runid = last.runid;
93  }
94  void print(){
95  cout<<"<prdffile> "<<name<<" Run # "<<runnumber<<" RunId "<<runid<<endl;
96  }
97  TString name;
98  Int_t runnumber;
99  TString runid;
100 };
101 // bool operator() runnumberequal(prdffile & pf, Int_t run) const {return run==pf.runnumber;}
102 
103 // ====================================================================================
104 
106 
107 protected:
108  hLabHelper();
109  virtual ~hLabHelper(){;}
110  static hLabHelper * single;
111 
112 
113 public:
114  static hLabHelper * getInstance(){if(!single) single = new hLabHelper(); return single;}
115  static void deleteInstance(){if(single) delete single;}
116 
117  bool evDisplay(Int_t run);
118 
119  void getFileLists();
120  void decoderun(TString & fname, Int_t & rn, TString & rid);
121  TFile * attachrootrun(Int_t rn);
122  void setRunKind(TString rK = "beam");
123  Bool_t setPRDFRun(int run, Bool_t bookH = kTRUE);
124  Bool_t setROOTRun(int run = 0);
125  Int_t runToRootFile(Int_t run = 0);
126  Int_t runToPRDFFile(Int_t run = 0);
127  void renameAndCloseRF();
128  void makeCanvasDirectory();
129  void updateMap();
130  void updateCalibration();
131  void initPRDFRun(Bool_t bookH = kTRUE);
132  void fitShape(int chan, Double_t & peakVal, Int_t & peakPos, Int_t mode);
133  void getDetectorTiming();
134  void displaySumEvent();
135  void dofixes();
136  void collect(Bool_t fitshape = kFALSE);
137  Bool_t reject();
138 
139  Int_t runnumber;
140  TString runKind;
141  Int_t rfiles;
142  TString host;
144  TString rootfName;
145  TString prdfName;
146  TString rootdirname;
147  TString cDirectory; // directory to store TCanvases for Run#
148  list<rootfile> roots;
149  Int_t pfiles;
150  TString prdfdirname;
151  list<prdffile> prdfs;
152  Int_t eventseq;
153  Int_t eventsread;
154 
155  Int_t * active; // list of active ADC channels
156  Float_t ** adc;
157  Float_t * pedestal;
158  Float_t * rawPeak, * rawTime;
159 
160  Double_t ** fitResults;
161  Float_t * fitPeak, * fitTime, * fitInt, * fitChi2;
162  Float_t * fitPeakRMS, * fitTimeRMS;
163 
164  Float_t * calibPeak; // units of SiPM pixels
165 
166  Double_t ** shapeD;
167 
168  TF1 ** shapes;
169  TF1 ** sigFit;
170  TF1 ** rvsc, **fmsc; // Single cell calibration
171  TGraph ** gpulse; // Graph of the pulse in indivuidual channel
172  TH1 ** ft, ** fm, ** fw, ** fint, ** fpd, **fchi2;
173  TH1 *** fitPar; // Actual fit parameters in every channel
174  TH1 ** rpeak, ** rtm;
175  TH2 * rdata;
176 
177  // Event produced by separately summing up all detector data in High and Low gains
178  Double_t * evtadcsum[2];
179  Double_t * evtfitpar[2];
180  Double_t evtpedestal[2];
181  Double_t evttime[2];
182  Double_t evtpeak[2];
183  Double_t tChi2[2]; // Chi2 from signal fit of the total ampl sum
184  TF1 * evtShape[2], * evtSignal[2];
185  TGraph * evtGraph[2];
186  //
187  TFile * fhcl;
188  TTree * thcl;
189 
190 };
191 
192 // ====================================================================================
193 
195 protected:
196  hcalHelper();
197  static hcalHelper * single;
198  virtual ~hcalHelper(){ ; }
199 
200 public:
201  static hcalHelper * getInstance(){if(!single) single = new hcalHelper(); return single;}
202  static void deleteInstance(){if(single) delete single;}
203  // HCAL implementation for test beam
204 
206 
207  void setCTriggerOn(Bool_t ON = kTRUE); // program runs on cosmic data
208  void setCTriggerGRange(Int_t gain = 1); // Gain range used to trigger on cosmic
209  void setDisplayMode(Int_t mode = 3); // defult: show only summary
210  void setRunKind(TString rK = "beam");
211  Int_t evLoop(int run, int evToProcess=0, int fToProcess=1);
212  Int_t collectRaw();
213  void updateCalibration();
214  void hcalTrigger();
215  void hcalPattern(Int_t nx, Int_t ny, Int_t run, Int_t mod = 0);
216  void hcalImpact();
217  void fitHCalSignal();
218  void hcalDisplay();
219  void dofixes();
220  Int_t reject();
221 
222  Double_t trThresholdBin;
223  Double_t twrThreshold;
225 
226  Int_t runnumber;
227  Int_t eventseq;
228  Int_t eventsread;
229  Int_t displayMode; // amount and form of graphic data presented
230  Int_t triggerOn; // if kFALSE - cosmic trigger is disabled
231  Int_t triggerGain; // preamp range used for triggering if enabled
232  Int_t rejectRaw;
233  Int_t eventReject;
235  Int_t channels;
236  Int_t samples;
237  Int_t parameters;
238  // Energy sums from collectTileSummary()
239  Double_t uSum, cSum;
240  Double_t YF, YU, YC, XU, XC;
241  Double_t sumFU, sumFC;
242  Double_t muxU, muxC, muxFU, muxFC;
244 
245  Int_t ** adc;
246  Int_t * activeCh;
247  // processing run summaries
248  TH2 * rdata;
249 };
250 
251 // ====================================================================================
252 
253 
254 class hcal{
255  hcal();
256  ~hcal();
257  friend class hcalHelper;
258 public:
259  // currently number of stacks with reject codes
260  Int_t rejectEvent; // Event must be rejected
262  Int_t maxStacks; // may include scintillators between or upfront or what not
265  Bool_t * alive;
266  Int_t * kinds; // for now is just StackId
267  // Stacks belong to hcal and towers belong to stacks
269  void setCalibration();
270  Int_t getStackTiming();
271  Int_t update(Int_t displayMode = 3, Bool_t fitShapes=kFALSE); // returns reject
272  Int_t collectTrPrimitives();
273  void displayRaw(Int_t mode = 0);
274  void displaySummary(Int_t mode = 0);
275  void clean(); // clean all related objects for new event
276  // Summary
277  Double_t amplTotal;
278  Double_t eTotal;
279  Double_t calLCG;
280  Double_t scintLCG;
281  TH1 * totalamp, * totale, * totallcg, * scintlcg;
282 };
283 
284 // ====================================================================================
285 
286 class stack{
287  friend class hcal;
288  friend class hcalHelper;
289 
290 public:
291 
292  stack();
293 
294  stack(const Int_t kind, const Int_t chnls, const Int_t xch, const Int_t ych);
295  ~stack();
296  void displayEvent(Int_t mode = 0);
297  void displayADCSum();
298  void displayTowerSummary(Int_t mode = 3);
299  void displayStackSummary(Int_t mode = 3);
300  void print();
301  void updateMap(Int_t stckloc); // Map Update in Towers is done Helper->HCal->Stack->Tower
302  Int_t update(Bool_t fitShapes = kFALSE); // EVent update. HCal, Stacks and Towers are updated from HCal
303  Int_t getStackTime();
304  Int_t getStackImpact();
305  Int_t getStackTrack();// returns reject code
306  Int_t getTrigger();
307  void clean(); // get ready for new event
308 
309  Int_t reject;
310  // single energy scale calibration [GeV/ADC count [LG]) (copied into towers by setCalibration()). May became
311  // different later
312 
313  Double_t stackECalib;
314  Int_t triggerFlag;
315  Int_t triggerHits;
316  Int_t triggerSum;
317  Int_t eventsSeen;
318 
319  Int_t stackId; // from enum )HINNER etc)
320  Int_t stackKind; // Stack kind (CALOR, COUNTER)
321  Int_t gains; // number of gain ranges
322  Int_t twrsInStack; // Maximum number of active towers in this stack
323  Int_t stackLoc; // first tower location in activeCh lookup table
324  Int_t nTwrsX; // Stack geometry in units of Towers
325  Int_t nTwrsY; //
326  Int_t key; // (stackId*10+gains)
327  Bool_t mapUpdated;
328  Double_t totPed;
329  Double_t totAmpl; // total sum of amplitudes in stack (inits LG)
330  Double_t totCorAmpl; // fully corrected amplitude sum
331  Double_t avTwrTime;
332  Double_t rmsTwrTime;
333  Double_t E; // Fully calibrated energy in Stack [GeV]
334  Double_t xImpact; // x - Impact position in stack
335  Double_t yImpact; // y - Impact position in stack
337 
338  // Event produced by separately summing up all detector data in High and Low gains
339  Int_t gainToUse;
340  Int_t twrsUsed[2];
341  Double_t * adcsum[2];
342  Double_t * fitPar[2];
343  Double_t fitPed[2];
344  // fit results for a total ADC sums (HIGH and LOW gains) in stack (exclude overflow towers)
345  Double_t fitTime[2];
346  Double_t fitPeak[2];
347  Double_t fitChi2[2]; // Chi2 from signal fit of the total ampl sum
348  TF1 * shape[2], * signal[2];
349  TGraph * graph[2];
350  // Muon Track in the stack
351  // counted towers with less then 3 samples in sat. region and above TWRAMPTHR
352  Int_t stackHits;
353  Int_t trackHits;
355  // Summaries
356  TH1 * stFGR;
357  TH1 * stFPed, * stFAmpl, * stFTime, * stChi2;
358  TH1 * stSPed, * stSAmpl, * stSE, * stAvT, * stTRMS;
359 
360  TH2 * hitCG;
361  // cosmics summary
362  TH1 * trAmp, * trChi2, * trCr, * trSl;
363  TH2 * trAmpCh2, * trAstH,* trASl, * trATwr;
364 
365  // saturation study
366  TH1 * satProb[2]; // High and Low gains
367 
368 };
369 
370 // ====================================================================================
371  // towers are created and updated by evloop in hcalHelper as readout objects,
372  // converted into physics entities by stacks when added to stacks but still -
373  // remain property of hcalHelper which updates them when new event is coming
374 
375 class tower{
376  friend class hcalHelper;
377 public:
378  tower(){;}
379  ~tower(){;}
380  tower(Int_t stack, Int_t stkLoc, Int_t xSt, Int_t ySt);
381  void setChannel(Int_t channel, Int_t gain);
382  Int_t update(Bool_t fitShape=kFALSE); // channel energies, times and gain selection in new event
383  void clean(); // clean tower (we keep whole configuration stable, just update data)
384  void print();
385  void display();
386 
387  Int_t reject; // for now just a signal of overflow in both (or single) ranges
388  Double_t twrECalib; // calibration coefficient (set by hcal->setCalibration()). Common to stack
389  Double_t twrEScale; // equalization coefficient
390  Int_t stackId; // stack which owns this tower
391  Int_t index; // index in the stack y*HCALCOLUMNS + x
392  Int_t key; // ((stackId*1000+index)*10)+gainToUse
393  Int_t x;
394  Int_t y;
395  Int_t gains;
396  Int_t gainToUse;
397  Int_t adcChannel[2]; // location in activeCh[] and adc[][] storage areas (-stackLoc)
398  Int_t satFlag[2];
399  Double_t rawPed[2]; // 2048 (PEDESTAL) subtructed
400  Double_t rawAmpl[2], rawTime[2];
401  Bool_t attached; // attached to muon track when calibrating
402 
403  Double_t rped, rampl, rtime; // best raw values for amplitude and time (units LG)
404  Double_t cped, campl, ctime; // mixed & corrected peds&Amplitude (in units of LG) and time
405  Double_t E; // fully calibrated energy in Tower [GeV]
406  TF1 * shape[2], * signal[2];
407  TGraph * graph[2];
408  // data accumulated since beginning of processing run
409  TH1 * twrPed, * twrAmpl, * twrTime, * twrE;
410 
411  // Double_t fitAmpl[2], fitTime[2];
412 
413 
414 };
415 
416 // ====================================================================================
417 
418 class hcalTree
419 {
420 
421 protected:
422  hcalTree();
423  virtual ~hcalTree(){;}
424  static hcalTree * single;
425 
426 
427 public:
428  static hcalTree * getInstance(){if(!single) single = new hcalTree(); return single;}
429  static void deleteInstance(){if(single) delete single;}
430 
431 
432  // switching output file if so required: TBD
433 
434  void updateRootFile();
435 
437  int eventseq;
439  int channels;
440  int samples;
441 
442  // 1 overflows in calorimeter amplitudes
443  // 10 tags outside range
444  // 100 HCal time is unreliable
445  // 1000
446  // 10000 Total energy in event is consistent with ZERO
447  //
449 
450 };
451 
452 
453 // ====================================================================================
454 
456 protected:
457  tileHelper();
458  static tileHelper * single;
459  virtual ~tileHelper(){
460  delete [] tileCalib;
461  delete [] tileCalPeak;
462  }
463 
464 
465 public:
466  static tileHelper * getInstance(){if(!single) single = new tileHelper(); return single;}
467  static void deleteInstance(){if(single) delete single;}
468 
469  // **************************************************************************
470  // event data for a smartTile
471 
474  evtGraph = new TGraph(NSAMPLES);
475  TString fitName = "det adc sum";
476  evtShape = new TF1(fitName, &signalShape, 0., (Double_t)NSAMPLES, NPARAMETERS);
477  fitName = "det signal";
478  evtSignal = new TF1(fitName, &signalShape, 0., (Double_t)NSAMPLES, NPARAMETERS);
479  }
480  Double_t times[TILECHANNELS];
481  Double_t chi2[TILECHANNELS];
482  Double_t evtadcsum[NSAMPLES];
484  Double_t evtpedestal;
485  Double_t evttime;
486  Double_t evtpeak;
487  Double_t tChi2; // Chi2 from signal fit of the tile total amplitude
488  Double_t evtpc; // event total pixel count (sum of calibrated counts in individual tile channels)
489  Int_t hitfiber; // fiber with highest signal
490  Double_t hitfiberpc; // pixel count in the hit fiber
491  Double_t hitfibertd; // time delta between hit fiber ends
492  Double_t yChi2; // CHi2 from fitting Y coordinate in the tile
493  Double_t ySigma;
494  TGraph * evtGraph;
495  TF1 * evtShape;
496  TF1 * evtSignal;
497  Int_t rejectCode;
498 
499  void reset(){
500  for (int is = 0; is < NSAMPLES; is++) evtadcsum[is] = 0.;
501  for (int tch = 0; tch < TILECHANNELS; tch++) times[tch] = 0.;
502  evttime = 0.;
503  rejectCode = 0;
504  }
505  };
506 
507  // **************************************************************************
508  // Run data for a smartTile
509 
511  runtilesummary();
512 
513  // --------------------------------------------------------------------------
514  // Tile data (when calibrated - in units of fired cells)
515  TH2 * rmax; // [TILECHANNELS][2050]; // maximum uncalibrated amplitudes
516  TH2 * rfsum; // [TILEFIBERS][2050]; // raw fiber sum (only max fiber)
517  TH2 * rtsum; // [TILEFIBERS][2050]; // raw total sum (only max fiber)
518  TH2 * rfasym; // [TILEFIBERS][-1:+1] // raw asymmetry per fiber
519  TH1 * rtasym; // [-1 : +1] right-left asymmetry (using uncalibrated sums}
520  TH1 * rx; // uncalibrated X
521  TH1 * ry; // uncalibrated Y
522  TH2 * rimp;
523  TH2 * cdata; // [TILECHANNELS][2000]; // all calibrated data for further unalisis
524  TH2 * cmax; // [TILECHANNELS][2000]; // maximum calibrated amplitudes
525  TH2 * cfsum; // // calobrated fiber sum
526  TH2 * ctsum; // [TILECHANNELS][2000]; // calobrated total sum
527  TH2 * cfasym; // [TILEFIBERS][-1.-1.] // calibrated asymmetry per fiber
528  TH1 * ctasym; // [-1 : +1] right-left asymmetry (using calibrated sums)
529  TH1 * cx; // calibrated X
530  TH1 * cy; // calibrated Y
531  TH1 * fy; // fitted Y
532  TH2 * cimp;
533  TH2 * cx_pc; // calibrated total asymmetry (X) vs total pixel count
534  TH2 * cy_pc; // calibrated weighted Y vs total pixel count
535  TH2 * fy_pc; // fitted Y vs total pixel count
536  TH2 * cimpW; // Weighted (by total pixel count) impact points
537 
538  // Trigger related
539  TH1 * trhits; // Raw total sum with binning similar to "hits_tpc"
540  TH2 * hits_tpc; // Number of triggerable hits (above threshold) vs total pixel count
541 
542  // --------------------------------------------------------------------------
543  // accumulated in the processing phase and must be written to .root file
544  TH3 * treff; // [HITMULTTHRESHOLDS][CHANNELTHRESHOLDS][0, 200]; // total pixel count (histogramm) vs cuts on total number of hits and hit amplitude in individual channels
545  TH3 * pc_imp; // total pixel count (histogramm) vs impact position
546  TH2 * pc_pat; // fitted positions of maxiuma in pc_imp pixel distributions
547  TH3 * pc_fimp; // total pixel count (histogramm) vs impact position (fitted Y)
548  TH2 * pc_fpat; // fitted positions of maxiuma in pc_imp pixel distributions (fitted Y)
549 
550  // --------------------------------------------------------------------------
551  // debugging muon impact computations
552  TH2 * XvsSl, * XY; // X value vs assumption about slope in the X vs Asymmetry
553  TH1 * Y0, * Y1, * Y2; // Parameters from the tile-Y fit
554  TH2 * y_yChi2, * s_y_Chi2; // Y in the tile vs Chi2 of the Y fit and Tile signal Chi2 vs Chi2 of Y fit
555  TH2 * y_ys, * yc_rcode;
556  TH1 * yCleaned, * yKept;
557  TH1 * trcode;
558 
559  // --------------------------------------------------------------------------
560  // attempts on timing resolution in tiles and towers
561  TH2 * td_r_l; // Time difference R/L vs total pixel count in the fiber
562  TH3 * td_t_tw; // Time difference tile to tower vs tile pc and tower ampl
563 
564 
565  };
566 
567  // **************************************************************************
568 
569 
570  Int_t evLoop(Int_t run, Int_t evToProcess, Int_t fToProcess);
571  void status();
572  void updateMap();
573  void updateCalibration();
574  void evreset(); // reset last event data
575  void tileTrigger();
576  void tileTiming();
577  void tileDisplay();
578  void tileTriggerDisplay();
579  void tilePattern(Int_t nx, Int_t ny, Int_t run, Int_t mod = 0);
580  void collectTileSummary();
581  Double_t getYFit();
582  void tileImpact();
583  void fitTileSignal();
584  Int_t reject();
587 
588  Int_t channels;
589  Int_t samples;
590  Int_t fibers;
592  Int_t parameters;
593  // Energy sums from collectTileSummary()
594  Double_t uSum, cSum, luSum, lcSum, ruSum, rcSum;
595  Double_t YF, YU, YC, XU, XC;
596  Double_t sumFU, sumFC;
597  Double_t muxU, muxC, muxFU, muxFC;
599  Double_t ras, cas, rtas, ctas;
600  Double_t * fiberY;
601  Double_t * fiberLY; // Calibrated Light Yields from individual fibers
602  Double_t * tileCalib; // Calibration coefficients for SiPM's currently in use (earlier measurements)
603  Double_t * tileCalPeak; // Fitted peak values scaled by tileCalib (tile channels)
605 
606  TCanvas * fiberDisplay;
607  TCanvas * triggerDisplay;
608  TCanvas * impactDisplay;
609  TCanvas * lyPattern, * lyFits;
610  TF1 * yFit;
611  TGraph * fLY;
612 
613 };
614 
615 // ====================================================================================
616 
617 
619  tileLightYield();
620  void setrootfile(rootfile & rf){
621  // hcalHelper * hHelper = hcalHelper ::getInstance();
622  rfile = new rootfile(rf);
623  }
624  void setdivisions(Int_t nx, Int_t ny){
625  xdivisions = nx;
626  ydivisions = ny;
627  lightyield = new Double_t * [ny];
628  for(int iy =0; iy<ny; iy++) lightyield[iy] = new Double_t [nx];
629 
630  }
633  Double_t ** lightyield;
634 };
635 
636 // ====================================================================================
637 class tileTree
638 {
639 
640 protected:
641  tileTree();
642  virtual ~tileTree(){;}
643  static tileTree * single;
644 
645 
646 public:
647  static tileTree * getInstance(){if(!single) single = new tileTree(); return single;}
648  static void deleteInstance(){if(single) delete single;}
649 
650 
651  // switching output file if so required: TBD
652 
653  void updateRootFile();
654 
655 
656  // 1 overflows in calorimeter amplitudes
657  // 10 tags outside range
658  // 100 HCal time is unreliable
659  // 1000
660  // 10000 Total energy in event is consistent with ZERO
661  //
663 };
664 
665 // ====================================================================================
666 
667 class hcalUtil{
668 protected:
669  hcalUtil ();
670  virtual ~hcalUtil(){;}
671  static hcalUtil * single;
672 
673 public:
674  static hcalUtil * getInstance(){if(!single) single=new hcalUtil(); return single;}
675  static void deleteInstance(){if(single) delete single;}
676 
677  Float_t xPeak(TF1* f, Float_t x1, Float_t x2);
678 
679  // Float_t xPeak(TF1* f, Float_t x1, Float_t x2);
680  Float_t width(TF1* f, Float_t x1, Float_t x2, Float_t peak);
681 
682  bool shapeFit(TH1D * proj, Double_t * pE, Float_t & maxE, Double_t * pG, bool fine, bool MIP);
683 
684  bool emcFit(TH1D * proj, bool fine, bool sing, Double_t * pE, Float_t & maxE, Double_t * pG, bool MIP);
685  bool emcFit(TH1D * proj, bool sing, Double_t * pE, Float_t & maxE, Double_t * pG);
686  bool emcFit(TH1D * proj, bool sing, Double_t * pE, Float_t & maxE, Double_t * pG, Float_t minx, Float_t maxx);
687  bool twrMipFit(TH1D * proj, Double_t * pE, Float_t & maxE, Double_t * pG);
688  bool twrTimeFit(TH1D * proj, Double_t * pE, Float_t & maxE, Double_t * pG);
689 
690 };
691 
692 // hcalUtil * hcalUtil :: single = 0;
693 // hLabHelper * hLabHelper :: single = 0;
694 // hcalHelper * hcalHelper :: single = 0;
695 // hcalTree * hcalTree :: single = 0;
696 // tileHelper * tileHelper :: single = 0;
697 // tileTree * tileTree :: single = 0;
698 
699 
700 //#endif // CINT
701 
702 #endif // HCALUTIL_H_
703