+
+ AliTPCCalROC *rocQ = GetCalRocQ (iSec,kTRUE);
+ AliTPCCalROC *rocT0 = GetCalRocT0 (iSec,kTRUE);
+ AliTPCCalROC *rocRMS = GetCalRocRMS(iSec,kTRUE);
+ AliTPCCalROC *rocOut = GetCalRocOutliers(iSec,kTRUE);
+
+ TH2S *hQ = GetHistoQ(iSec);
+ TH2S *hRMS = GetHistoRMS(iSec);
+
+ Short_t *arrayhQ = hQ->GetArray();
+ Short_t *arrayhT0 = hT0->GetArray();
+ Short_t *arrayhRMS = hRMS->GetArray();
+
+ UInt_t nChannels = fROC->GetNChannels(iSec);
+ Float_t meanTsec = fVMeanTimeSector[iSec];
+
+ //debug
+ Int_t row=0;
+ Int_t pad=0;
+ Int_t padc=0;
+ //! debug
+
+ for (UInt_t iChannel=0; iChannel<nChannels; ++iChannel){
+
+ Float_t cogTime0 = -1000;
+ Float_t cogQ = -1000;
+ Float_t cogRMS = -1000;
+ Float_t cogOut = 0;
+
+ Int_t offsetQ = (fNbinsQ+2)*(iChannel+1)+1;
+ Int_t offsetT0 = (fNbinsT0+2)*(iChannel+1)+1;
+ Int_t offsetRMS = (fNbinsRMS+2)*(iChannel+1)+1;
+/*
+ AliMathBase::FitGaus(arrayhQ+offsetQ,fNbinsQ,fXminQ,fXmaxQ,¶mQ,&dummy);
+ AliMathBase::FitGaus(arrayhT0+offsetT0,fNbinsT0,fXminT0,fXmaxT0,¶mT0,&dummy);
+ AliMathBase::FitGaus(arrayhRMS+offsetRMS,fNbinsRMS,fXminRMS,fXmaxRMS,¶mRMS,&dummy);
+ cogQ = paramQ[1];
+ cogTime0 = paramT0[1];
+ cogRMS = paramRMS[1];
+*/
+ cogQ = AliMathBase::GetCOG(arrayhQ+offsetQ,fNbinsQ,fXminQ,fXmaxQ);
+ cogTime0 = AliMathBase::GetCOG(arrayhT0+offsetT0,fNbinsT0,fXminT0,fXmaxT0);
+ cogRMS = AliMathBase::GetCOG(arrayhRMS+offsetRMS,fNbinsRMS,fXminRMS,fXmaxRMS);
+
+ /*
+ if ( (cogQ < ??) && (cogTime0 > ??) && (cogTime0<??) && ( cogRMS>??) ){
+ cogOut = 1;
+ cogTime0 = 0;
+ cogQ = 0;
+ cogRMS = 0;
+ }
+*/
+// rocQ->SetValue(iChannel, cogQ*cogQ); // changed to linear scale again
+ rocQ->SetValue(iChannel, cogQ);
+ rocT0->SetValue(iChannel, cogTime0+meanTsec); //offset by mean time of the sector
+ rocRMS->SetValue(iChannel, cogRMS);
+ rocOut->SetValue(iChannel, cogOut);
+
+ // in case a channel has no data set the value to 0
+ if (TMath::Abs(cogTime0-fXminT0)<1e-10){
+ rocQ->SetValue(iChannel, 0);
+ rocT0->SetValue(iChannel, 0); //offset by mean time of the sector
+ rocRMS->SetValue(iChannel, 0);
+ }
+
+ //debug
+ if ( GetStreamLevel() > 2 ){
+ TTreeSRedirector *streamer=GetDebugStreamer();
+ if ( streamer ) {
+ while ( iChannel > (fROC->GetRowIndexes(iSec)[row]+fROC->GetNPads(iSec,row)-1) ) row++;
+ pad = iChannel-fROC->GetRowIndexes(iSec)[row];
+ padc = pad-(fROC->GetNPads(iSec,row)/2);
+
+ (*streamer) << "DataEnd" <<
+ "Sector=" << iSec <<
+ "Pad=" << pad <<
+ "PadC=" << padc <<
+ "Row=" << row <<
+ "PadSec=" << iChannel <<
+ "Q=" << cogQ <<
+ "T0=" << cogTime0 <<
+ "RMS=" << cogRMS <<
+ "\n";
+ }
+ }
+ //! debug
+ }
+
+
+ }