// if force is true create a new histogram if it doesn't exist allready
//
if ( !force || arr->UncheckedAt(sector) )
- return (TH2S*)arr->UncheckedAt(sector);
+ return (TH2S*)arr->UncheckedAt(sector);
// if we are forced and histogram doesn't exist yet create it
- Char_t name[255], title[255];
-
- sprintf(name,"hCalib%s%.2d",type,sector);
- sprintf(title,"%s calibration histogram sector %.2d",type,sector);
-
// new histogram with Q calib information. One value for each pad!
- TH2S* hist = new TH2S(name,title,
+ TH2S* hist = new TH2S(Form("hCalib%s%.2d",type,sector),Form("%s calibration histogram sector %.2d",type,sector),
nbinsY, ymin, ymax,
fROC->GetNChannels(sector),0,fROC->GetNChannels(sector));
hist->SetDirectory(0);
// if force is true create a new histogram if it doesn't exist allready
//
if ( !force || arr->UncheckedAt(sector) )
- return (TH1S*)arr->UncheckedAt(sector);
+ return (TH1S*)arr->UncheckedAt(sector);
// if we are forced and histogram doesn't yes exist create it
- Char_t name[255], title[255];
-
- sprintf(name,"hCalib%s%.2d",type,sector);
- sprintf(title,"%s calibration histogram sector %.2d",type,sector);
-
// new histogram with calib information. One value for each pad!
- TH1S* hist = new TH1S(name,title,
+ TH1S* hist = new TH1S(Form("hCalib%s%.2d",type,sector),Form("%s calibration histogram sector %.2d",type,sector),
fLastTimeBin-fFirstTimeBin,fFirstTimeBin,fLastTimeBin);
hist->SetDirectory(0);
arr->AddAt(hist,sector);
// for an example see class description at the beginning
//
- Double_t *x = new Double_t[fNevents];
- Double_t *y = new Double_t[fNevents];
-
TVectorD *xVar = 0x0;
TObjArray *aType = 0x0;
Int_t npoints=0;
for ( Int_t i=0;i<fNevents; ++i) (*xVar)[i]=i;
}
+ Double_t *x = new Double_t[fNevents];
+ Double_t *y = new Double_t[fNevents];
+
for (Int_t ievent =0; ievent<fNevents; ++ievent){
if ( fitType<2 ){
TObjArray *events = (TObjArray*)(aType->At(sector));
TGraph *gr = new TGraph(npoints);
//sort xVariable increasing
Int_t *sortIndex = new Int_t[npoints];
- TMath::Sort(npoints,x,sortIndex);
+ TMath::Sort(npoints,x,sortIndex, kFALSE);
for (Int_t i=0;i<npoints;++i){
gr->SetPoint(i,x[sortIndex[i]],y[sortIndex[i]]);
}
// if force is true create a new histogram if it doesn't exist allready
//
if ( !force || arr->UncheckedAt(sector) )
- return (TH2F*)arr->UncheckedAt(sector);
+ return (TH2F*)arr->UncheckedAt(sector);
// if we are forced and histogram doesn't yes exist create it
- Char_t name[255], title[255];
-
- sprintf(name,"hCalib%s%.2d",type,sector);
- sprintf(title,"%s calibration histogram sector %.2d;ADC channel;Channel (pad)",type,sector);
-
// new histogram with Q calib information. One value for each pad!
- TH2F* hist = new TH2F(name,title,
- nbinsY, ymin, ymax,
- fROC->GetNChannels(sector),0,fROC->GetNChannels(sector)
- );
+ TH2F* hist = new TH2F(Form("hCalib%s%.2d",type,sector),
+ Form("%s calibration histogram sector %.2d;ADC channel;Channel (pad)",type,sector),
+ nbinsY, ymin, ymax,
+ fROC->GetNChannels(sector),0,fROC->GetNChannels(sector)
+ );
hist->SetDirectory(0);
arr->AddAt(hist,sector);
return hist;
if ( !force || arr->UncheckedAt(sector) )
return (TH2S*)arr->UncheckedAt(sector);
- // if we are forced and histogram doesn't yes exist create it
- Char_t name[255], title[255];
-
- sprintf(name,"hCalib%s%.2d",type,sector);
- sprintf(title,"%s calibration histogram sector %.2d",type,sector);
-
- // new histogram with Q calib information. One value for each pad!
- TH2S* hist = new TH2S(name,title,
+ // if we are forced and histogram doesn't yes exist create it
+ // new histogram with Q calib information. One value for each pad!
+ TH2S* hist = new TH2S(Form("hCalib%s%.2d",type,sector),Form("%s calibration histogram sector %.2d",type,sector),
nbinsY, ymin, ymax,
fROC->GetNChannels(sector),0,fROC->GetNChannels(sector));
hist->SetDirectory(0);
// loop over sub checkers
// if recursive, recursively return the pointers of non subchecker type sub checkers
//
- if (!fArrSubCheckers && !fArrSubCheckers->GetEntries()) return 0;
+ if (!fArrSubCheckers || !fArrSubCheckers->GetEntries()) return 0;
if (!fIterSubCheckers) fIterSubCheckers=fArrSubCheckers->MakeIterator();
AliTPCCalibQAChecker *al=(AliTPCCalibQAChecker*)fIterSubCheckers->Next();
if (!al){
TMatrixD covMatrix(0,0);
TString cutStr("");
TString formulaStr("");
- TString *returnStr = new TString("");
// specify data to plot:
TString drawStr(GetDrawString()->Data());
// ********** call AliTPCCalibViewer's fit-function
ReplacePlaceHolders(drawStr);
ReplacePlaceHolders(cutStr);
- returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
+ TString *returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
std::cout << std::endl;
std::cout << "Your fit formula reads as follows:" << std::endl;
std::cout << returnStr->Data() << std::endl;
std::cout << "chi2 = " << chi2 << std::endl;
+
+ delete returnStr;
}
}
Error("DoExportNorm", "Not yet implemented.");
+/*
return;
// specify data to plot:
// finally export calPad to Cint:
gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t) calPad));
Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
+ */
}
ptr = listOfPrimitives->At(i);
if ( ptr->InheritsFrom("TH1") ) break;
}
- if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
+ if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
TH1 *hist = (TH1*)ptr;
// Double_t histMax = hist->GetMaximum();
id=fListVariables->GetSelectedEntry()->EntryId();
// printf("id: %d\n",id);
TString branchName=selectedVariable;
- const TObject *key=(*fConfigParser)(id);
- if (key) branchName=(*fConfigParser)(id)->GetName();
+ if (fConfigParser){
+ const TObject *key=(*fConfigParser)(id);
+ if (key) branchName=(*fConfigParser)(id)->GetName();
+ }
//treat case of TVector
if (branchName.EndsWith(".")){
Int_t par = (Int_t)(fNmbPar->GetNumber());
}
}
}
- UpdateValueArrays(graphOutput, xArr);
+ if (xArr) UpdateValueArrays(graphOutput, xArr);
// if (graphOutput){
// if (fIsCustomDraw){
// if (fDrawString.Contains(":")){
class TGraphErrors;
class TTreeSRedirector;
class AliTPCCalROC;
-
+class AliSplineFit;
class AliTPCcalibDButil : public TObject
{
AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray);
AliDCSSensorArray* goofieArray = fCalibDB->GetGoofieSensors(irun);
//
- Int_t dtime = TMath::Max((endTime-startTime)/20,10*60);
+ Int_t dtime = TMath::Max((endTime-startTime)/20,10);
//
//Goofie statistical data
//
}
//
TVectorD voltagesIROC(36);
- TVectorD voltagesOROC(36);
+ TVectorD voltagesOROC(36);
for(Int_t j=1; j<36; j++) voltagesIROC[j-1] = fCalibDB->GetChamberHighVoltage(irun, j,itime);
for(Int_t j=36; j<72; j++) voltagesOROC[j-36] = fCalibDB->GetChamberHighVoltage(irun, j,itime);
Double_t voltIROC = TMath::Median(36, voltagesIROC.GetMatrixArray());
ProcessCTP(irun,itime);
ProcessAlign(irun,itime);
ProcessGain(irun,itime);
- ProcessDriftCERef();
- ProcessPulserRef();
+ //ProcessDriftCERef();
+ //ProcessPulserRef();
+ ProcessCurrent(irun,itime);
(*fPcstream)<<"dcs"<<
"PulserTChi2.="<<&vecAChi2; // chi2 (rms in cm)
}
+void AliTPCcalibSummary::ProcessCurrent(Int_t irun, Int_t itime){
+ //
+ // Dump current
+ //
+ //variables to export
+ //
+ static TObjArray *currentArray=new TObjArray(72); // current graphs
+ static TObjArray *currentArray2=new TObjArray(72); // current graphs to export
+ //
+ static TVectorD currentIROC(36); // current snapshots
+ static TVectorD currentOROC(36);
+ static TVectorF sector(72); //
+ static Double_t medcurIROC = 0;
+ static Double_t medcurOROC = 0;
+ //
+ static TVectorF minROC(72); // current mean +-5 minutes
+ static TVectorF maxROC(72);
+ static TVectorF meanROC(72);
+ static TVectorF medianROC(72);
+ static Double_t meanIIROC=0;
+ static Double_t meanIOROC=0;
+ static Double_t medianIIROC=0;
+ static Double_t medianIOROC=0;
+ //
+ AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(irun);
+ //
+ for(Int_t j=1; j<36; j++) currentIROC[j-1] = fCalibDB->GetChamberHighVoltage(irun, j,itime,-1,kTRUE);
+ for(Int_t j=36; j<72; j++) currentOROC[j-36] = fCalibDB->GetChamberHighVoltage(irun, j,itime,-1,kTRUE);
+ medcurIROC = TMath::Median(36, currentIROC.GetMatrixArray());
+ medcurOROC = TMath::Median(36, currentOROC.GetMatrixArray());
+
+
+ if (currentArray->At(0)==0){
+ for (Int_t isec=0; isec<72; isec++){
+ TString sensorName="";
+ const char* sideName=(isec%36<18) ? "A":"C";
+ if (isec<36){
+ //IROC
+ sensorName=Form("TPC_ANODE_I_%s%02d_IMEAS",sideName,isec%18);
+ }else{
+ //OROC
+ sensorName=Form("TPC_ANODE_O_%s%02d_0_IMEAS",sideName,isec%18);
+ }
+
+ AliDCSSensor *sensor = 0;
+ if (voltageArray) sensor= voltageArray->GetSensor(sensorName);
+ TGraph *gr=0;
+ if (!sensor) gr=new TGraph(1);
+ else{
+ if (!sensor->GetGraph()) gr=new TGraph(1);
+ else{
+ gr=sensor->GetGraph();
+ Double_t startTime=sensor->GetStartTime();
+ Double_t * time = new Double_t[gr->GetN()];
+ for (Int_t ip=0; ip<gr->GetN(); ip++){ time[ip]= (gr->GetX()[ip]*3600.)+startTime;}
+ gr=new TGraph(gr->GetN(), time, gr->GetY());
+ delete [] time;
+ }
+ }
+ gr->Sort();
+ currentArray->AddAt(gr, isec);
+ currentArray->AddAt(gr->Clone(), isec);
+ }
+ }
+
+
+ for (Int_t isec=0; isec<72; isec++){
+ sector[isec]=isec;
+ TGraph * gr = (TGraph*)currentArray->At(isec);
+ TGraph * graph2 = (TGraph*)currentArray2->At(isec);
+ Int_t firstBin= TMath::BinarySearch(gr->GetN(), gr->GetX(), itime-300.)-2;
+ Int_t lastBin= TMath::BinarySearch(gr->GetN(), gr->GetX(), itime+300.)+2;
+ if (firstBin<0) firstBin=0;
+ if (lastBin>=gr->GetN()) lastBin=gr->GetN()-1;
+ //
+ if (firstBin<lastBin){
+ //
+ minROC[isec]=TMath::MinElement(lastBin-firstBin, &(gr->GetY()[firstBin]));
+ maxROC[isec]=TMath::MaxElement(lastBin-firstBin, &(gr->GetY()[firstBin]));
+ meanROC[isec]=TMath::Mean(lastBin-firstBin, &(gr->GetY()[firstBin]));
+ medianROC[isec]=TMath::Median(lastBin-firstBin, &(gr->GetY()[firstBin]));
+ graph2 = new TGraph(lastBin-firstBin, &(gr->GetX()[firstBin]), &(gr->GetY()[firstBin]));
+ delete currentArray2->At(isec);
+ currentArray2->AddAt(graph2,isec);
+ }
+ (*fPcstream)<<"dcs"<< // current information
+ Form("current%d.=",isec)<<graph2;
+ }
+ meanIIROC=TMath::Mean(36, &(meanROC.GetMatrixArray()[0]));
+ meanIOROC=TMath::Mean(36, &(meanROC.GetMatrixArray()[36]));
+ medianIIROC=TMath::Median(36, &(meanROC.GetMatrixArray()[0]));
+ medianIOROC=TMath::Median(36, &(meanROC.GetMatrixArray()[36]));
+ //
+ (*fPcstream)<<"dcs"<< // current information
+ "isec.="<<§or<< //sector number
+ "IIROC.="<<¤tIROC<< // current sample at given moment
+ "IOROC.="<<¤tOROC<< // current sample at given moment
+ "medianIIROC="<<medcurIROC<< // median at given moment
+ "medianIOROC="<<medcurOROC<< // median at given moment
+ //
+ "minIROC.="<<&minROC<< // minimum in +-5 min
+ "maxIROC.="<<&maxROC<< // maximum in +-5 min
+ "meanIROC.="<<&meanROC<< // mean in +-5 min
+ "medianIROC.="<<&medianROC<< // median in +-5 min
+ "meanIIROC5="<<meanIIROC<< // mean current in IROC +-5 minutes
+ "meanIOROC5="<<meanIOROC<< // mean current in OROC
+ "medianIIROC5="<<medianIIROC<< // median current in IROC
+ "medianIOROC5="<<medianIOROC; // medianan current in OROC
+
+
+ (*fPcstream)<<"current"<< // current information
+ "time="<<itime<<
+ "isec.="<<§or<< //sector number
+ "IIROC.="<<¤tIROC<< // current sample at given moment
+ "IOROC.="<<¤tOROC<< // current sample at given moment
+ "medianIIROC="<<medcurIROC<< // median at given moment
+ "medianIOROC="<<medcurOROC<< // median at given moment
+ //
+ "minIROC.="<<&minROC<< // minimum in +-5 min
+ "maxIROC.="<<&maxROC<< // maximum in +-5 min
+ "meanIROC.="<<&meanROC<< // mean in +-5 min
+ "medianIROC.="<<&medianROC<< // median in +-5 min
+ "meanIIROC5="<<meanIIROC<< // mean current in IROC +-5 minutes
+ "meanIOROC5="<<meanIOROC<< // mean current in OROC
+ "medianIIROC5="<<medianIIROC<< // median current in IROC
+ "medianIOROC5="<<medianIOROC<< // medianan current in OROC
+ "\n";
+
+}