1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for T0 calibration TM-AC-AM_6-02-2006
21 // equalize time shift for each time CFD channel
23 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliT0CalibTimeEq.h"
30 #include <TSpectrum.h>
34 ClassImp(AliT0CalibTimeEq)
36 //________________________________________________________________
37 AliT0CalibTimeEq::AliT0CalibTimeEq():TNamed(),
45 //________________________________________________________________
46 AliT0CalibTimeEq::AliT0CalibTimeEq(const char* name):TNamed(),
52 TString namst = "Calib_";
54 SetName(namst.Data());
55 SetTitle(namst.Data());
58 //________________________________________________________________
59 AliT0CalibTimeEq::AliT0CalibTimeEq(const AliT0CalibTimeEq& calibda):TNamed(calibda),
64 SetName(calibda.GetName());
65 SetTitle(calibda.GetName());
70 //________________________________________________________________
71 AliT0CalibTimeEq &AliT0CalibTimeEq::operator =(const AliT0CalibTimeEq& calibda)
73 // assignment operator
74 SetName(calibda.GetName());
75 SetTitle(calibda.GetName());
80 //________________________________________________________________
81 AliT0CalibTimeEq::~AliT0CalibTimeEq()
86 //________________________________________________________________
87 void AliT0CalibTimeEq::Reset()
91 memset(fCFDvalue,0,120*sizeof(Float_t));
92 memset(fTimeEq,1,24*sizeof(Float_t));
96 //________________________________________________________________
97 void AliT0CalibTimeEq::Print(Option_t*) const
101 printf("\n ---- PM Arrays ----\n\n");
102 printf(" Time delay CFD \n");
103 for (Int_t i=0; i<24; i++) printf(" CFD %f ",fTimeEq[i]);
104 printf("\n Mean Vertex %f \n", fMeanVertex);
108 //________________________________________________________________
109 Bool_t AliT0CalibTimeEq::ComputeOnlineParams(const char* filePhys)
111 // compute online equalized time
112 Double_t mean=0, meanver=0;
113 Double_t rms=0, rmsver=0;
121 gFile = TFile::Open(filePhys);
123 AliError("No input PHYS data found ");
130 for (Int_t i=0; i<24; i++)
132 sprintf(buf1,"CFD1minCFD%d",i+1);
133 TH1F *cfd = (TH1F*) gFile->Get(buf1);
134 if(!cfd) AliWarning(Form("no histograms collected by PHYS DA for channel %i", i));
135 // printf(" i = %d buf1 = %s\n", i, buf1);
137 TSpectrum *s = new TSpectrum(2*npeaks,1);
138 nfound = s->Search(cfd,sigma," ",0.1);
140 Float_t *xpeak = s->GetPositionX();
141 TMath::Sort(nfound, xpeak, index,down);
142 Float_t xp = xpeak[index[0]];
143 Double_t hmax = xp+3*sigma;
144 Double_t hmin = xp-3*sigma;
145 cfd->GetXaxis()->SetRangeUser(hmin-20,hmax+20);
148 nent=cfd->GetEntries();
149 if(nent<500 || rms>10. ) {
151 AliWarning(Form("Data is not good enouph in PMT %i - mean %f rsm %f nentries %i", i,mean, rms, nent));
158 AliWarning(Form("Data is not good enouph in PMT %i , no clean peak", i));
167 TH1F *ver = (TH1F*) gFile->Get("hVertex");
168 if(!ver) AliWarning("no T0 histogram collected by PHYS DA ");
170 meanver = ver->GetMean();
171 rmsver = ver->GetRMS();
173 SetMeanVertex(meanver);
174 SetRmsVertex(rmsver);