#include "AliTPCcalibDButil.h"
#include "AliTPCPreprocessorOnline.h"
#include "AliTPCCalibVdrift.h"
+#include "AliMathBase.h"
ClassImp(AliTPCcalibDButil)
AliTPCcalibDButil::AliTPCcalibDButil() :
-void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, TTreeSRedirector *pcstream){
+void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, Double_t minVd, Double_t maxVd, TTreeSRedirector *pcstream){
//
// Filter Goofie data
+ // goofieArray - points will be filtered
+ // deltaT - smmothing time window
+ // cutSigma - outler sigma cut in rms
+ // minVn, maxVd- range absolute cut for variable vd/pt
+ // - to be tuned
//
- //
// Ignore goofie if not enough points
//
const Int_t kMinPoints = 3;
// area far peak
//
Double_t medianpt=0;
- Double_t medianvd=0;
+ Double_t medianvd=0, sigmavd=0;
Double_t medianan=0;
Double_t medianaf=0;
- Int_t entries=graphvd->GetN();
- TGraph * graphvd0 = AliTPCcalibDButil::FilterGraphMedianAbs(graphvd,0.03,medianvd);
- TGraph * graphvd1 = AliTPCcalibDButil::FilterGraphMedian(graphvd0,2,medianvd);
+ Int_t entries=graphvd->GetN();
+ Double_t yvdn[10000];
+ Int_t nvd=0;
+ //
+ for (Int_t ipoint=0; ipoint<entries; ipoint++){
+ if (graphpt->GetY()[ipoint]<=0.0000001) continue;
+ if (graphvd->GetY()[ipoint]/graphpt->GetY()[ipoint]<minVd) continue;
+ if (graphvd->GetY()[ipoint]/graphpt->GetY()[ipoint]>maxVd) continue;
+ yvdn[nvd++]=graphvd->GetY()[ipoint];
+ }
+ if (nvd<kMinPoints){
+ delete graphvd;
+ goofieArray->GetSensorNum(2)->SetGraph(0);
+ return;
+ }
+ //
+ Int_t nuni = TMath::Min(TMath::Nint(nvd*0.4+2), nvd-1);
+ if (nuni>=kMinPoints){
+ AliMathBase::EvaluateUni(nvd, yvdn, medianvd,sigmavd,nuni);
+ }else{
+ medianvd = TMath::Median(nvd, yvdn);
+ }
+
TGraph * graphpt0 = AliTPCcalibDButil::FilterGraphMedianAbs(graphpt,10,medianpt);
TGraph * graphpt1 = AliTPCcalibDButil::FilterGraphMedian(graphpt0,2,medianpt);
TGraph * graphan0 = AliTPCcalibDButil::FilterGraphMedianAbs(graphan,10,medianan);
TGraph * graphan1 = AliTPCcalibDButil::FilterGraphMedian(graphan0,2,medianan);
TGraph * graphaf0 = AliTPCcalibDButil::FilterGraphMedianAbs(graphaf,10,medianaf);
TGraph * graphaf1 = AliTPCcalibDButil::FilterGraphMedian(graphaf0,2,medianaf);
- delete graphvd0;
- delete graphvd1;
delete graphpt0;
delete graphpt1;
delete graphan0;
//
// 2. Make outlyer graph
//
- Int_t nOut=0;
+ Int_t nOK=0;
TGraph graphOut(*graphvd);
for (Int_t i=0; i<entries;i++){
//
Bool_t isOut=kFALSE;
- if (TMath::Abs(graphvd->GetY()[i]/medianvd-1.)>0.02) isOut|=kTRUE;
+ if (graphpt->GetY()[i]<=0.0000001) { graphOut.GetY()[i]=1; continue;}
+ if (graphvd->GetY()[i]/graphpt->GetY()[i]<minVd || graphvd->GetY()[i]/graphpt->GetY()[i]>maxVd) { graphOut.GetY()[i]=1; continue;}
+
+ if (TMath::Abs((graphvd->GetY()[i]/graphpt->GetY()[i])/medianvd-1.)<0.05)
+ isOut|=kTRUE;
if (TMath::Abs(graphpt->GetY()[i]/medianpt-1.)>0.02) isOut|=kTRUE;
- if (TMath::Abs(graphan->GetY()[i]/medianan-1.)>0.03) isOut|=kTRUE;
- if (TMath::Abs(graphaf->GetY()[i]/medianaf-1.)>0.03) isOut|=kTRUE;
+ if (TMath::Abs(graphan->GetY()[i]/medianan-1.)>0.2) isOut|=kTRUE;
+ if (TMath::Abs(graphaf->GetY()[i]/medianaf-1.)>0.2) isOut|=kTRUE;
graphOut.GetY()[i]= (isOut)?1:0;
- if (isOut) nOut++;
+ if (!isOut) nOK++;
}
- if (nOut<kMinPoints) return;
+ if (nOK<kMinPoints) {
+ delete graphvd;
+ goofieArray->GetSensorNum(2)->SetGraph(0);
+ return;
+ }
//
// 3. Filter out outlyers - and smooth
//
junk.AddLast(graphNew0);
graphNew1 = AliTPCcalibDButil::FilterGraphMedian(graphNew0,cutSigma,median);
if (graphNew1!=0){
- junk.AddLast(graphNew1);
+ junk.AddLast(graphNew1);
graphNew2 = AliTPCcalibDButil::FilterGraphMedian(graphNew1,cutSigma,median);
if (graphNew2!=0) {
+ vrmsArray[isensor] =TMath::RMS(graphNew2->GetN(),graphNew2->GetY());
AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
- printf("%d\t%f\n",isensor, median);
+ printf("%d\t%f\t%f\n",isensor, median,vrmsArray[isensor]);
vmedianArray[isensor]=median;
- vrmsArray[isensor] =median;
//
}
}
Form("gr0_%d.=",isensor)<<graphNew0<<
Form("gr1_%d.=",isensor)<<graphNew1<<
Form("gr2_%d.=",isensor)<<graphNew2;
- sensor->SetGraph(graphNew2);
- }
- (*pcstream)<<"goofieA"<<
- "vmed.="<<&vmedianArray<<
- "\n";
- junk.Delete(); // delete temoprary graphs
+ if (isOK) sensor->SetGraph(graphNew2);
+ }
+ (*pcstream)<<"goofieA"<<
+ "vmed.="<<&vmedianArray<<
+ "vrms.="<<&vrmsArray<<
+ "\n";
+ junk.Delete(); // delete temoprary graphs
}
static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector *pcstream=0);
static Float_t FilterTemperature(AliTPCSensorTempArray *tempArray, Double_t ymin=15, Double_t ymax=22, Double_t sigmaCut=5);
- static void FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT=2, Double_t cutSigma=4., TTreeSRedirector *pcstream=0);
+ static void FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT=2, Double_t cutSigma=4., Double_t minVdn=8.5, Double_t maxVdn=9.05, TTreeSRedirector *pcstream=0);
static Double_t GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0);
static Double_t GetVDriftTPC(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0);
static Double_t GetVDriftTPCLaserTracks(Double_t &dist,Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2);
//dbutil->FilterCE(120., 3., 4.,pcstream);
//dbutil->FilterTracks(irun, 10.,pcstream);
AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(irun);
- if (goofieArray) dbutil->FilterGoofie(goofieArray,0.5,4.,pcstream);
+ if (goofieArray) dbutil->FilterGoofie(goofieArray,0.5,4.,6.8,7.05,pcstream);
// don't filter goofie for the moment
ProcessRun(irun, startTime,endTime);
}
//production information
//
Int_t nalien=0,nRawAlien=0,nlocal=0,nRawLocal=0;
- // GetProductionInfo(irun, nalien, nRawAlien, nlocal,nRawLocal);
+ GetProductionInfo(irun, nalien, nRawAlien, nlocal,nRawLocal);
//run type
TObjString runType(AliTPCcalibDB::GetRunType(irun).Data());
//
command += " | grep raw | grep -v tag | wc -l";
sNlines = gSystem->GetFromPipe(command.Data());
nRawAlien=sNlines.Atoi();
- //find number of ESDs local
- command="find /lustre/alice/alien/alice/data/2009 -name AliESDs.root | grep ";
- command += Form("%09d",run);
- command += " | wc -l";
- sNlines = gSystem->GetFromPipe(command.Data());
- nlocal=sNlines.Atoi();
- //find number of local raw data files
- command="find /lustre/alice/alien/alice/data/2009 -name \"*.root\" | grep ";
- command += Form("%09d",run);
- command += " | grep raw | grep -v tag | wc -l";
- sNlines = gSystem->GetFromPipe(command.Data());
- nRawLocal=sNlines.Atoi();
+ // //find number of ESDs local
+// command="find /lustre/alice/alien/alice/data/2009 -name AliESDs.root | grep ";
+// command += Form("%09d",run);
+// command += " | wc -l";
+// sNlines = gSystem->GetFromPipe(command.Data());
+// nlocal=sNlines.Atoi();
+// //find number of local raw data files
+// command="find /lustre/alice/alien/alice/data/2009 -name \"*.root\" | grep ";
+// command += Form("%09d",run);
+// command += " | grep raw | grep -v tag | wc -l";
+// sNlines = gSystem->GetFromPipe(command.Data());
+// nRawLocal=sNlines.Atoi();
}