M AliTPCcalibDButil.h - Add usage of ITS-TPC calibration,fix compiler warning
M AliTPCcalibLaser.h - Use mag field form OCDB - no parameter
M AliTPCCalibQAChecker.h - Add representation histograms for number and hist case, improve draw funcionality, fix rep hist streaming
M AliTPCCalibViewerGUIAlarms.h - Add Reset of tree, add tree open
M AliTPCLaserTrack.h - add comment
M AliTPCcalibCosmic.cxx - disable obsolete histos
M AliTPCcalibDB.cxx - Usage of ITS-TPC drift and T0 calibration, +Bug fix - Expand
M AliTPCcalibDButil.cxx - Add usage of ITS-TPC calibration,fix compiler warning
M AliTPCcalibLaser.cxx - Use mag field form OCDB - no parameter
M AliTPCCalibQAChecker.cxx - Add representation histograms for number and hist case, improve draw funcionality, fix rep hist streaming
M AliTPCCalibRaw.cxx - store all occupancy info on ebye basis only in debug mode. By default store only occupancy in noise sensitive re
gions!
M AliTPCcalibTime.cxx - Use cluster info to decide if tracks crossed CE (not z position)
M AliTPCCalibViewerGUIAlarms.cxx - Add Reset of tree, add tree open
#include <TObjArray.h>
#include <TString.h>
#include <TObjString.h>
+#include <TStyle.h>
+#include <TMarker.h>
+#include <TAxis.h>
+#include <TLine.h>
+#include <TList.h>
#include <TTree.h>
+#include <TMath.h>
#include <TGraph.h>
#include <TFrame.h>
#include <TIterator.h>
#include <TPad.h>
+#include <TCanvas.h>
#include <TH1.h>
#include <TH2.h>
#include <TStopwatch.h>
ProcessBin();
break;
}
+
+ //create representation histogram if we are not in tree mode
+ if (!fTreePtr){
+ if (!fHistRep) {
+ fHistRep=(*fHistPtr)->Clone();
+ TH1* h=(TH1*)fHistRep;
+ h->SetDirectory(0);
+ h->SetNameTitle(Form("h%s",GetName()),GetTitle());
+ }
+ TH1* h=(TH1*)fHistRep;
+ h->Reset();
+ h->Add(*fHistPtr);
+ if (!fHistRep->InheritsFrom(TH2::Class())) AddQualityLines(h);
+ }
}
//_________________________________________________________________________
void AliTPCCalibQAChecker::ProcessGraph()
//
if (!fNumberPtr) return;
fQualityLevel=GetQuality(*fNumberPtr);
+ //create representation histogram
+ if (!fHistRep){
+ TH1* h=new TH1F(Form("h%s",GetName()),GetTitle(),1,0,1);
+ h->GetXaxis()->SetBinLabel(1,"Value");
+ AddQualityLines(h);
+ h->SetDirectory(0);
+ fHistRep=h;
+ }
+ TH1 *h=(TH1*)fHistRep;
+ TMarker *marker=(TMarker*)h->GetListOfFunctions()->FindObject("TMarker");
+ if (!marker) {
+ marker=new TMarker(.5,0,20);
+ h->GetListOfFunctions()->Add(marker);
+ }
+ marker->SetMarkerColor(GetQualityColor());
+ marker->SetY(*fNumberPtr);
}
//_________________________________________________________________________
void AliTPCCalibQAChecker::ProcessEntries()
AliError(Form("Could not create representation histogram of alarm '%s'",GetName()));
return;
}
- fHistRep=(TH1*)hist->Clone();
- fHistRep->SetDirectory(0);
+ fHistRep=hist->Clone();
+ TH1 *h=(TH1*)fHistRep;
+ h->SetDirectory(0);
+ h->SetNameTitle(Form("h%s",GetName()),GetTitle());
}
//_________________________________________________________________________
void AliTPCCalibQAChecker::CreateAlarmHist()
// use 'nobc' to change this
//
- if (!fHistRep) return;
-
- Bool_t withBackColor=kTRUE;
-
- TString opt=option;
- opt.ToLower();
-
- if (opt.Contains("nobc")) withBackColor=kFALSE;
- opt.ReplaceAll("nobc","");
-
- if (opt.IsNull()) opt=fStrDrawRepOpt;
- opt.ToLower();
-
- opt.ReplaceAll("prof","");
-
- fHistRep->Draw(opt.Data());
-
- if (gPad){
- gPad->Modified();
- if (withBackColor) gPad->SetFillColor(GetQualityColor());
- TFrame* frame=(TFrame*)gPad->GetPrimitive("TFrame");
- if (frame) frame->SetFillColor(kWhite);
- }
-
- gPad->Modified();
+ //case of a node with subcheckers and no specific representation histogram
+ if (HasSubCheckers()&&!fHistRep) {DrawSubNodes(option); return;}
+ if (fHistRep) {DrawRepresentationHist(option); return;}
}
//_________________________________________________________________________
void AliTPCCalibQAChecker::Print(Option_t *option) const
return s.Data();
}
//_________________________________________________________________________
-Int_t AliTPCCalibQAChecker::DrawInPad(TPad *pad, Int_t sub)
+Int_t AliTPCCalibQAChecker::DrawInPad(TVirtualPad *pad, Int_t sub)
{
//
//
}
return sub;
}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::DrawSubNodes(Option_t */*option*/)
+{
+ //
+ // divide the current pad in sub pads and draw all sub nodes
+ //
+ if (!gPad) new TCanvas;
+ TPad *mother=(TPad*)gPad;
+ mother->Clear();
+ //find number of sub pads needed
+ Int_t nPads = GetNumberOfSubCheckers();
+ Int_t nCols = (Int_t)TMath::Ceil( TMath::Sqrt(nPads) );
+ Int_t nRows = (Int_t)TMath::Ceil( (Double_t)nPads/(Double_t)nCols );
+ gPad->Divide(nCols,nRows);
+
+ DrawInPad(gPad);
+ mother->Update();
+ TPad *pad=0;
+ Int_t ipad=1;
+ while ( (pad=(TPad*)mother->GetPad(ipad)) ){
+ TFrame* frame=(TFrame*)pad->GetPrimitive("TFrame");
+ if (frame) frame->SetFillColor(kWhite);
+ else {printf("no frame\n");}
+ pad->Modified();
+ ++ipad;
+ }
+ mother->Update();
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::DrawRepresentationHist(Option_t *option)
+{
+ //
+ // Draw the representation histogram
+ //
+ if (!fHistRep) return;
+ if (!gPad) new TCanvas;
+ Bool_t withBackColor=kTRUE;
+
+ TString opt=option;
+ opt.ToLower();
+
+ if (opt.Contains("nobc")) withBackColor=kFALSE;
+ opt.ReplaceAll("nobc","");
+
+ if (opt.IsNull()) opt=fStrDrawRepOpt;
+ opt.ToLower();
+
+ opt.ReplaceAll("prof","");
+
+ fHistRep->Draw(opt.Data());
+ if (withBackColor) {
+ gPad->SetFillColor(GetQualityColor());
+ }
+
+ gPad->Modified();
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::AddQualityLines(TH1 *hist)
+{
+ //
+ // add lines indicating the quality level to hist
+ //
+
+ Double_t xmin=hist->GetXaxis()->GetXmin();
+ Double_t xmax=hist->GetXaxis()->GetXmax();
+ Double_t min=0;
+ Double_t max=0;
+
+ for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
+ if (fThresMin[i]>=fThresMax[i]) continue;
+ min=fThresMin[i];
+ max=fThresMax[i];
+ TLine *lmin=new TLine(xmin,min,xmax,min);
+ lmin->SetLineWidth(2);
+ lmin->SetLineColor(QualityColor((QualityFlag_t)i));
+ TLine *lmax=new TLine(xmin,max,xmax,max);
+ lmax->SetLineWidth(2);
+ lmax->SetLineColor(QualityColor((QualityFlag_t)i));
+ hist->GetListOfFunctions()->Add(lmin);
+ hist->GetListOfFunctions()->Add(lmax);
+ }
+ hist->SetAxisRange(min,max,"Y");
+}
class TIterator;
class TGraph;
class TObjArray;
-class TPad;
+class TVirtualPad;
class AliTPCCalibQAChecker : public TNamed {
public:
AliTPCCalibQAChecker();
AliTPCCalibQAChecker(const char* name, const char *title);
-// AliTPCCalibQAChecker(const char* name, const char *title);
virtual ~AliTPCCalibQAChecker();
AlarmType_t fAlarmType; //type of the alarm
QualityFlag_t fQualityLevel; //quality level
- TH1* fHistRep; //visualised histogram
+ TObject* fHistRep; //visualised histogram
Double_t fThresMin[kNQualityFlags];//minimum thresholds
Double_t fThresMax[kNQualityFlags];//maximum thresholds
void CreateAlarmHist();
void ResetAlarmHist();
//
- Int_t DrawInPad(TPad *pad, Int_t sub=1);
+ Int_t DrawInPad(TVirtualPad *pad, Int_t sub=1);
+ void DrawSubNodes(Option_t *option);
+ void DrawRepresentationHist(Option_t *option);
+ void AddQualityLines(TH1 *hist);
+ //
AliTPCCalibQAChecker(const AliTPCCalibQAChecker &cfg);
AliTPCCalibQAChecker& operator = (const AliTPCCalibQAChecker &cfg);
fLastTimeBin=1020;
if (config->GetValue("FirstTimeBin")) fFirstTimeBin = ((TObjString*)config->GetValue("FirstTimeBin"))->GetString().Atoi();
if (config->GetValue("LastTimeBin")) fLastTimeBin = ((TObjString*)config->GetValue("LastTimeBin"))->GetString().Atoi();
+ if (config->GetValue("DebugLevel")) fDebugLevel = ((TObjString*)config->GetValue("DebugLevel"))->GetString().Atoi();
}
//_____________________________________________________________________
}
}
// store phase of current event
- if (fArrALTROL1Phase.GetNrows()<=GetNevents())
+ if (fArrALTROL1Phase.GetNrows()-1<=GetNevents())
fArrALTROL1Phase.ResizeTo(GetNevents()+10000);
(fArrALTROL1Phase.GetMatrixArray())[GetNevents()]=phaseMaxEntries;
if (phase<0) continue;
if (phase!=phaseMaxEntries){
TVectorF *arr=MakeArrL1PhaseRCU(fCurrDDLNum,kTRUE);
- if (arr->GetNrows()<=(Int_t)fNFailL1PhaseEvent) arr->ResizeTo(arr->GetNrows()+100);
+ if (arr->GetNrows()-1<=(Int_t)fNFailL1PhaseEvent) arr->ResizeTo(arr->GetNrows()+100);
(arr->GetMatrixArray())[fNFailL1PhaseEvent]=phase;
++fNFailL1Phase;
fail=1;
fArrCurrentPhase[ircu]=-1;
}
if (fail){
- if (fArrFailEventNumber.GetNrows()<=(Int_t)fNFailL1PhaseEvent) fArrFailEventNumber.ResizeTo(fArrFailEventNumber.GetNrows()+100);
+ if (fArrFailEventNumber.GetNrows()-1<=(Int_t)fNFailL1PhaseEvent) fArrFailEventNumber.ResizeTo(fArrFailEventNumber.GetNrows()+100);
fArrFailEventNumber.GetMatrixArray()[fNFailL1PhaseEvent]=GetNevents();
}
fNFailL1PhaseEvent+=fail;
fVTimeStampEvent.GetMatrixArray()[GetNevents()]=GetTimeStamp()-fFirstTimeStamp+fNanoSec*1e-9;
fNanoSec=0;
//occupance related
- if (fVOccupancyEvent.GetNrows()<=GetNevents()){
+ if (fVOccupancyEvent.GetNrows()-1<=GetNevents()){
fVOccupancyEvent.ResizeTo(GetNevents()+10000);
fVSignalSumEvent.ResizeTo(GetNevents()+10000);
fVOccupancySenEvent.ResizeTo(GetNevents()+10000);
// TVectorF *arrF=MakeArrL1PhaseFailRCU(ircu);
// arrF->ResizeTo(1);
}
- //resize occupancy arrays
- fVTimeStampEvent.ResizeTo(GetNevents());
- fVOccupancyEvent.ResizeTo(GetNevents());
+ //resize occupancy arrays only save event occupancy in sensitive regions by default
+ //save the rest in debub mode
fVOccupancySenEvent.ResizeTo(GetNevents());
- fVSignalSumEvent.ResizeTo(GetNevents());
- fVSignalSumSenEvent.ResizeTo(GetNevents());
- fVNfiredPadsSenEvent.ResizeTo(GetNevents());
+ if (fDebugLevel>0){
+ fVOccupancyEvent.ResizeTo(GetNevents());
+ fVSignalSumEvent.ResizeTo(GetNevents());
+ fVSignalSumSenEvent.ResizeTo(GetNevents());
+ fVNfiredPadsSenEvent.ResizeTo(GetNevents());
+ fVTimeStampEvent.ResizeTo(GetNevents());
+ } else {
+ fVOccupancyEvent.ResizeTo(0);
+ fVSignalSumEvent.ResizeTo(0);
+ fVSignalSumSenEvent.ResizeTo(0);
+ fVNfiredPadsSenEvent.ResizeTo(0);
+ fVTimeStampEvent.ResizeTo(0);
+ }
//Analyse drift velocity TODO
}
// type=11: mean data volume (ADC counts/sample)
// type=12: data volume (ADC counts)
// type=13: samples per ADC count
- // type=14: sample occupancy
+ // type=14: sample occupancy
//
// type=16: number of samples sensitive / number of pads sensitive
// type=17: pad occupancy in sensitive regions
TString xTitle("Time");
TString yTitle("number of samples");
TGraph *gr=new TGraph(GetNevents());
+ if (fVSignalSumEvent.GetNrows()==0&&!(type==10||type==14)) return 0;
TVectorF *vOcc=&fVOccupancyEvent;
TVectorF *vSum=&fVSignalSumEvent;
TVectorF *vPads=&fVNfiredPadsSenEvent;
//--------------
// canvas on top
- TRootEmbeddedCanvas *cEmbed = new TRootEmbeddedCanvas("Main_Canvas", contCenterTop, 200, 200, kFitWidth | kFitHeight);
+ TRootEmbeddedCanvas *cEmbed = new TRootEmbeddedCanvas("Alarm_Canvas", contCenterTop, 200, 200, kFitWidth | kFitHeight);
contCenterTop->AddFrame(cEmbed, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
// cEmbed->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliTPCCalibViewerGUIAlarms", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
cEmbed->GetCanvas()->SetToolTipText("Alarm histograms are displayed in this region.");
//
//
- printf("name: %s\n", item->GetText());
+// printf("name: %s\n", item->GetText());
AliTPCCalibQAChecker *checker=dynamic_cast<AliTPCCalibQAChecker*>((TObject*)item->GetUserData());
if (checker){
item->SetColor(checker->GetQualityColor());
fAlarmTree->ClearViewPort();
}
//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::ResetBrowser()
+{
+ //
+ //
+ //
+ if (!fAlarmTree->GetFirstItem()) return;
+ fAlarmTree->DeleteChildren(fAlarmTree->GetFirstItem());
+ fAlarmTree->DeleteItem(fAlarmTree->GetFirstItem());
+ fAlarmTree->ClearViewPort();
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::OpenSubItems(TGListTreeItem *item)
+{
+ //
+ //
+ //
+ fAlarmTree->OpenItem(item);
+ TGListTreeItem *nextItem=0x0;
+ if ( (nextItem=item->GetFirstChild()) ) OpenSubItems(nextItem);
+ if ( (nextItem=item->GetNextSibling()) ) OpenSubItems(nextItem);
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::OpenAllItems()
+{
+ //
+ //
+ //
+ if (!fAlarmTree->GetFirstItem()) return;
+ OpenSubItems(fAlarmTree->GetFirstItem());
+ fAlarmTree->ClearViewPort();
+}
+//______________________________________________________________________________
void AliTPCCalibViewerGUIAlarms::OnDoubleClick(TGListTreeItem* item, Int_t /*id*/)
{
//
class TGListTree;
class TGListTreeItem;
class TCanvas;
+class TGCanvas;
class TGLabel;
class AliTPCCalibQAChecker;
void SetCalibViewerGUItime(AliTPCCalibViewerGUItime *gui) {fCalibViewerGUItime=gui;}
void InitBrowser();
-
void UpdateBrowser();
+ void ResetBrowser();
+ void OpenAllItems();
static AliTPCCalibViewerGUIAlarms* Show();
void DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h);
void AddSubItems(AliTPCCalibQAChecker *fChecker, TGListTreeItem *item);
void UpdateSubItem(TGListTreeItem *item);
+ void OpenSubItems(TGListTreeItem *item);
private:
AliTPCCalibViewerGUIAlarms(const AliTPCCalibViewerGUIAlarms &v);
Float_t fRayLength; //distance from the last common point of the laser Rays
//(Splitter box on the A-Side at the bottom of the TPC)
- //to each mirror (needed for an exact drift velocity estimation)
+ //to each mirror [cm](needed for an exact drift velocity estimation)
static TObjArray* fgArrLaserTracks; //! Array of all Laser Tracks,
Int_t ntracks=event->GetNumberOfTracks();
fHistNTracks->Fill(ntracks);
if (ntracks==0) return;
- AliESDcosmic cosmicESD;
- TTreeSRedirector * cstream = GetDebugStreamer();
- cosmicESD.SetDebugStreamer(cstream);
- cosmicESD.ProcessEvent(event);
- if (cstream) cosmicESD.DumpToTree();
+ // AliESDcosmic cosmicESD;
+// TTreeSRedirector * cstream = GetDebugStreamer();
+// cosmicESD.SetDebugStreamer(cstream);
+// cosmicESD.ProcessEvent(event);
+// if (cstream) cosmicESD.DumpToTree();
}
// - > Don't use it for reconstruction - Only for Calibration studies
//
if (run<0) return;
- if (fRunList[run]>0 &&force==kFALSE) return;
AliCDBEntry * entry = 0;
- if (run>= fRunList.GetSize()){
+ if (run>= fRunList.fN){
fRunList.Set(run*2+1);
fGRPArray.Expand(run*2+1);
fGRPMaps.Expand(run*2+1);
fVdriftArray.Expand(run*2+1);
fDriftCorrectionArray.Expand(run*2+1);
fTimeGainSplinesArray.Expand(run*2+1);
+ //
+ //
+ fALTROConfigData->Expand(run*2+1); // ALTRO configuration data
+ fPulserData->Expand(run*2+1); // Calibration Pulser data
+ fCEData->Expand(run*2+1); // CE data
+ fTimeGainSplines->Expand(run*2+1); // Array of AliSplineFits: at 0 MIP position in
}
+ if (fRunList[run]>0 &&force==kFALSE) return;
fRunList[run]=1; // sign as used
Double_t result;
// mode 1 automatic mode - according to the distance to the valid calibration
// -
- Double_t deltaP=0, driftP=0, wP = 0.;
- Double_t deltaLT=0, driftLT=0, wLT = 0.;
- Double_t deltaCE=0, driftCE=0, wCE = 0.;
+ Double_t deltaP=0, driftP=0, wP = 0.;
+ Double_t deltaITS=0,driftITS=0, wITS= 0.;
+ Double_t deltaLT=0, driftLT=0, wLT = 0.;
+ Double_t deltaCE=0, driftCE=0, wCE = 0.;
driftP = fDButil->GetVDriftTPC(deltaP,run,timeStamp);
+ driftITS= fDButil->GetVDriftTPCITS(deltaITS,run,timeStamp);
driftCE = fDButil->GetVDriftTPCCE(deltaCE, run,timeStamp,36000,2);
driftLT = fDButil->GetVDriftTPCLaserTracks(deltaLT,run,timeStamp,36000,2);
+ deltaITS = TMath::Abs(deltaITS);
deltaP = TMath::Abs(deltaP);
deltaLT = TMath::Abs(deltaLT);
deltaCE = TMath::Abs(deltaCE);
if (mode==1) {
- const Double_t kEpsilon=0.0000000001;
- Double_t meanDist= (deltaP+deltaLT+deltaCE)*0.3;
- if (meanDist<1.) return driftLT;
- wP = meanDist/(deltaP +0.005*meanDist);
- wLT = meanDist/(deltaLT+0.005*meanDist);
- wCE = meanDist/(deltaCE+0.001*meanDist);
+ const Double_t kEpsilon=0.00000000001;
+ const Double_t kdeltaT=360.; // 10 minutes
+ wITS = 64.*kdeltaT/(deltaITS +kdeltaT);
+ wLT = 16.*kdeltaT/(deltaLT +kdeltaT);
+ wP = 0. *kdeltaT/(deltaP +kdeltaT);
+ wCE = 1. *kdeltaT/(deltaCE +kdeltaT);
+ //
+ //
+ if (TMath::Abs(driftP)<kEpsilon) wP=0; // invalid calibration
+ if (TMath::Abs(driftITS)<kEpsilon)wITS=0; // invalid calibration
+ if (TMath::Abs(driftLT)<kEpsilon) wLT=0; // invalid calibration
if (TMath::Abs(driftCE)<kEpsilon) wCE=0; // invalid calibration
- result = (driftP*wP+driftLT*wLT+driftCE*wCE)/(wP+wLT+wCE);
+ if (wP+wITS+wLT+wCE<kEpsilon) return 0;
+ result = (driftP*wP+driftITS*wITS+driftLT*wLT+driftCE*wCE)/(wP+wITS+wLT+wCE);
}
return result;
// Notice - Extrapolation outside of calibration range - using constant function
//
Double_t result=0;
- if (mode==1) result=fDButil->GetTriggerOffsetTPC(run,timeStamp);
- result *=fParam->GetZLength();
-
+ if (mode==2) {
+ // TPC-TPC mode
+ result=fDButil->GetTriggerOffsetTPC(run,timeStamp);
+ result *=fParam->GetZLength();
+ }
+ if (mode==1){
+ // TPC-ITS mode
+ Double_t dist=0;
+ result= fDButil->GetTime0TPCITS(dist, run, timeStamp);
+ }
return result;
}
if (!fCurrentRefMap) return -2;
TObjString *str=dynamic_cast<TObjString*>(fCurrentRefMap->GetValue(type));
if (!str) return -2;
- return str->GetString().Atoi();
+ return (const Int_t)str->GetString().Atoi();
}
//_____________________________________________________________________________________
const Int_t AliTPCcalibDButil::GetReferenceRun(const char* type) const{
if (!fRefMap) return -1;
TObjString *str=dynamic_cast<TObjString*>(fRefMap->GetValue(type));
if (!str) return -1;
- return str->GetString().Atoi();
+ return (const Int_t)str->GetString().Atoi();
}
//_____________________________________________________________________________________
AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad *ceOut, Float_t minSignal, Float_t cutTrmsMin, Float_t cutTrmsMax, Float_t cutMaxDistT){
Double_t vcosmic= AliTPCcalibDButil::EvalGraphConst(cosmicAll, timeStamp);
if (timeStamp>cosmicAll->GetX()[cosmicAll->GetN()-1]) vcosmic=cosmicAll->GetY()[cosmicAll->GetN()-1];
if (timeStamp<cosmicAll->GetX()[0]) vcosmic=cosmicAll->GetY()[0];
- return vcosmic+t0;
+ return vcosmic-t0;
/*
Example usage:
return corrM;
}
+Double_t AliTPCcalibDButil::GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t timeStamp){
+ //
+ // return drift velocity using the TPC-ITS matchin method
+ // return also distance to the closest point
+ //
+ TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run);
+ TGraphErrors *graph=0;
+ dist=0;
+ if (!array) return 0;
+ graph = (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_DRIFTVD");
+ if (!graph) return 0;
+ Double_t deltaY;
+ AliTPCcalibDButil::GetNearest(graph,timeStamp,dist,deltaY);
+ Double_t value = AliTPCcalibDButil::EvalGraphConst(graph,timeStamp);
+ return value;
+}
+
+Double_t AliTPCcalibDButil::GetTime0TPCITS(Double_t &dist, Int_t run, Int_t timeStamp){
+ //
+ // Get time dependent time 0 (trigger delay in cm) correction
+ // Arguments:
+ // timestamp - timestamp
+ // run - run number
+ //
+ // Notice - Extrapolation outside of calibration range - using constant function
+ //
+ TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run);
+ TGraphErrors *graph=0;
+ dist=0;
+ if (!array) return 0;
+ graph = (TGraphErrors*)array->FindObject("ALIGN_ITSM_TPC_T0");
+ if (!graph) return 0;
+ Double_t deltaY;
+ AliTPCcalibDButil::GetNearest(graph,timeStamp,dist,deltaY);
+ Double_t value = AliTPCcalibDButil::EvalGraphConst(graph,timeStamp);
+ return value;
+}
+
+
// row - parameter type (rotation[3], translation[3], drift[3])
if (!array) return 0;
if (array->GetEntries()<=0) return 0;
- Int_t entries = array->GetEntries();
+ // Int_t entries = array->GetEntries();
Int_t entriesFast = array->GetEntriesFast();
TVectorD state(9);
TVectorD *valArray[9];
// sigmaCut - maximal allowed deviation from mean in terms of RMS
if (!array) return 0;
if (array->GetEntries()<=0) return 0;
- const Double_t errvd = 0.0001;
- const Double_t errt0 = 0.001;
- const Double_t errvy = 0.0001;
-
+ // error increase in 1 hour
+ const Double_t kerrsTime[9]={
+ 0.00001, 0.00001, 0.00001,
+ 0.001, 0.001, 0.001,
+ 0.0001, 0.001, 0.0001};
+ //
+ //
Int_t entries = array->GetEntriesFast();
TObjArray *sArray= new TObjArray(entries);
AliRelAlignerKalman * sKalman =0;
}
if (!sKalman) continue;
Double_t deltaT=TMath::Abs(Int_t(kalman->GetTimeStamp())-Int_t(sKalman->GetTimeStamp()))/3600.;
- (*(sKalman->GetStateCov()))(6,6)+=deltaT*errvd*errvd;
- (*(sKalman->GetStateCov()))(7,7)+=deltaT*errt0*errt0;
- (*(sKalman->GetStateCov()))(8,8)+=deltaT*errvy*errvy;
+ for (Int_t ipar=0; ipar<9; ipar++){
+// (*(sKalman->GetStateCov()))(6,6)+=deltaT*errvd*errvd;
+// (*(sKalman->GetStateCov()))(7,7)+=deltaT*errt0*errt0;
+// (*(sKalman->GetStateCov()))(8,8)+=deltaT*errvy*errvy;
+ (*(sKalman->GetStateCov()))(ipar,ipar)+=deltaT*kerrsTime[ipar]*kerrsTime[ipar];
+ }
sKalman->SetRunNumber(kalman->GetRunNumber());
if (!isOK) sKalman->SetRunNumber(0);
sArray->AddAt(new AliRelAlignerKalman(*sKalman),index);
return sArray;
}
+TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *arrayP, TObjArray *arrayM){
+ //
+ // Merge 2 RelKalman arrays
+ // Input:
+ // arrayP - rel kalman in direction plus
+ // arrayM - rel kalman in direction minus
+ if (!arrayP) return 0;
+ if (arrayP->GetEntries()<=0) return 0;
+ if (!arrayM) return 0;
+ if (arrayM->GetEntries()<=0) return 0;
+ Int_t entries = arrayP->GetEntriesFast();
+ TObjArray *array = new TObjArray(arrayP->GetEntriesFast());
+ for (Int_t i=0; i<entries; i++){
+ AliRelAlignerKalman * kalmanP = (AliRelAlignerKalman *) arrayP->UncheckedAt(i);
+ AliRelAlignerKalman * kalmanM = (AliRelAlignerKalman *) arrayM->UncheckedAt(i);
+ if (!kalmanP) continue;
+ if (!kalmanM) continue;
+ AliRelAlignerKalman *kalman = new AliRelAlignerKalman(*kalmanP);
+ kalman->Merge(kalmanM);
+ array->AddAt(kalman,i);
+ }
+ return array;
+}
//
static TMatrixD* MakeStatRelKalman(TObjArray *array, Float_t minFraction, Int_t minStat, Float_t maxvd);
static TObjArray *SmoothRelKalman(TObjArray *array,TMatrixD & stat, Bool_t direction, Float_t sigmaCut);
+ static TObjArray *SmoothRelKalman(TObjArray *arrayP, TObjArray *arrayM);
static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector *pcstream=0);
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 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);
static Double_t GetVDriftTPCCE(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2);
+ static Double_t GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t timeStamp);
+ static Double_t GetTime0TPCITS(Double_t &dist, Int_t run, Int_t timeStamp);
Int_t MakeRunList(Int_t startRun, Int_t stopRun); // find the list of usable runs
Int_t FindRunTPC(Int_t itime, Bool_t debug=kFALSE);
private:
gSystem->Load("libTPCcalib");
TFile fcalib("CalibObjectsTrain2.root");
AliTPCcalibLaser * laser = ( AliTPCcalibLaser *)fcalib->Get("laserTPC");
- laser->DumpMeanInfo(-0,0)
+ laser->DumpMeanInfo(0)
TFile fmean("laserMean.root")
//
// laser track clasification;
#include "TTimeStamp.h"
#include "AliDCSSensorArray.h"
#include "AliDCSSensor.h"
+#include "AliGRPObject.h"
using namespace std;
-void AliTPCcalibLaser::DumpMeanInfo(Float_t bfield, Int_t run){
+void AliTPCcalibLaser::DumpMeanInfo(Int_t run){
//
// Dump information about laser beams
// isOK variable indicates usability of the beam
AliTPCcalibLaser *laser = this;
TTreeSRedirector *pcstream = new TTreeSRedirector("laserMean.root");
TF1 fg("fg","gaus");
-
+ AliTPCParam * tpcparam = 0;
// start set up for absolute residuals analysis
- //AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
- // AliTPCParam * tpcparam = calib->GetParameters();
- AliTPCParam * tpcparam = 0;
+ //
+ AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
+ tpcparam = calib->GetParameters();
if (!tpcparam) tpcparam = new AliTPCParamSR;
tpcparam->Update();
+ AliGRPObject *grp = AliTPCcalibDB::GetGRP(run);
+ Float_t current=0;
+ Float_t bfield = 0, bz=0;
+ if (grp){
+ current = grp->GetL3Current((AliGRPObject::Stats)0);
+ bfield = 5*current/30000.;
+ bz = 5*current/30000.;
+ printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
+ }
+
SetBeamParameters(fBeamOffsetYOuter, fBeamSlopeYOuter, fBeamSectorOuter,0);
SetBeamParameters(fBeamOffsetYInner, fBeamSlopeYInner, fBeamSectorInner,1);
TLinearFitter lfabsyInner(2);
Int_t GetNtracks(){return fNtracks;}
virtual void Analyze();
virtual Long64_t Merge(TCollection *li);
- virtual void DumpMeanInfo(Float_t bfield, Int_t run=-1);
+ virtual void DumpMeanInfo(Int_t run=-1);
static void DumpScanInfo(TTree * tree, const char * cutUser="entries>300&&(gz2<0.15&&gphi2<0.1&&gp42<0.02&&abs(gp41)<0.03)");
static void DumpFitInfo(TTree * chainFit, Int_t id);
static TH1* GetLaserProjection(TH2F* his, Int_t laser){return his->ProjectionY("aaa",laser+1,laser+1);}
// Track0 is choosen in upper TPC part
// Track1 is choosen in lower TPC part
//
+ const Int_t kMinClustersCross =30;
+ const Int_t kMinClusters =80;
Int_t ntracks=event->GetNumberOfTracks();
if (ntracks==0) return;
if (ntracks > fCutTracks) return;
//
// track loop
//
+ TArrayI clusterSideA(ntracks);
+ TArrayI clusterSideC(ntracks);
for (Int_t i=0;i<ntracks;++i) {
+ clusterSideA[i]=0;
+ clusterSideC[i]=0;
AliESDtrack *track = event->GetTrack(i);
const AliExternalTrackParam * trackIn = track->GetInnerParam();
TObject *calibObject;
AliTPCseed *seed = 0;
for (Int_t l=0;(calibObject=friendTrack->GetCalibObject(l));++l) if ((seed=dynamic_cast<AliTPCseed*>(calibObject))) break;
- if (seed) tpcSeeds.AddAt(seed,i);
+ if (seed) {
+ tpcSeeds.AddAt(seed,i);
+ Int_t nA=0, nC=0;
+ for (Int_t irow=159;irow>0;irow--) {
+ AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
+ if (!cl) continue;
+ if ((cl->GetDetector()%36)<18) nA++;
+ if ((cl->GetDetector()%36)>=18) nC++;
+ }
+ clusterSideA[i]=nA;
+ clusterSideC[i]=nC;
+ }
}
if (ntracks<2) return;
//
//track 1 lower part
if (!track1) continue;
if (!track1->GetOuterParam()) continue;
+ if (track0->GetTPCNcls()+ track1->GetTPCNcls()< kMinClusters) continue;
+ Int_t nAC = TMath::Max( TMath::Min(clusterSideA[i], clusterSideC[j]),
+ TMath::Min(clusterSideC[i], clusterSideA[j]));
+ if (nAC<kMinClustersCross) continue;
+ Int_t nA0=clusterSideA[i];
+ Int_t nC0=clusterSideC[i];
+ Int_t nA1=clusterSideA[j];
+ Int_t nC1=clusterSideC[j];
// if (track1->GetOuterParam()->GetAlpha()>0) continue;
//
Double_t d2[3];
if((isSame) || (isCross && isPair)){
if (track0->GetTPCNcls()+ track1->GetTPCNcls()> 80) {
fDz = param0.GetZ() - param1.GetZ();
- if(track0->GetOuterParam()->GetZ()<0) fDz=-fDz;
+ Double_t sign=(nA0>nA1)? 1:-1;
+ fDz*=sign;
TTimeStamp tstamp(fTime);
Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
"tr1.="<<track1<<
"p0.="<<¶m0<<
"p1.="<<¶m1<<
+ "nAC="<<nAC<<
+ "nA0="<<nA0<<
+ "nA1="<<nA1<<
+ "nC0="<<nC0<<
+ "nC1="<<nC1<<
"isPair="<<isPair<<
"isCross="<<isCross<<
"isSame="<<isSame<<
return kTRUE;
}
Bool_t AliTPCcalibTime::IsCross(AliESDtrack *tr0, AliESDtrack *tr1){
- return tr0->GetOuterParam()->GetZ()*tr1->GetOuterParam()->GetZ()<0 && tr0->GetInnerParam()->GetZ()*tr1->GetInnerParam()->GetZ()<0 && tr0->GetOuterParam()->GetZ()*tr0->GetInnerParam()->GetZ()>0 && tr1->GetOuterParam()->GetZ()*tr1->GetInnerParam()->GetZ()>0;
+ //
+ // check if the cosmic pair of tracks crossed A/C side
+ //
+ Bool_t result= tr0->GetOuterParam()->GetZ()*tr1->GetOuterParam()->GetZ()<0;
+ if (result==kFALSE) return result;
+ result=kTRUE;
+ return result;
}
Bool_t AliTPCcalibTime::IsSame(AliESDtrack *tr0, AliESDtrack *tr1){