From c6f3749a0b5cf5b200db1f75312f26ce55387701 Mon Sep 17 00:00:00 2001 From: marian Date: Thu, 6 Dec 2007 12:20:17 +0000 Subject: [PATCH] Possibility to register data - AliTPCselector* Adding the angular effect calibration - AliTPCselectorTracksGain (Marian) --- TPC/AliTPCSelectorESD.cxx | 35 +++++++- TPC/AliTPCSelectorESD.h | 69 ++++++++-------- TPC/AliTPCSelectorTracks.cxx | 3 +- TPC/AliTPCcalibTracksGain.h | 154 +++++++++++++++++++++++------------ 4 files changed, 172 insertions(+), 89 deletions(-) diff --git a/TPC/AliTPCSelectorESD.cxx b/TPC/AliTPCSelectorESD.cxx index 5bebfb6a2f2..54e38d7fa82 100644 --- a/TPC/AliTPCSelectorESD.cxx +++ b/TPC/AliTPCSelectorESD.cxx @@ -57,6 +57,10 @@ AliTPCSelectorESD::AliTPCSelectorESD(TTree *tree) : fESDevent(0), fESD(0), fESDfriend(0), + fNtracks(0), //! number of Tracks + fNtracksFriend(0), //! number of firend Tracks + fNClusters(0), //! number of clusters on track + fRegPath(0), // path to store persistent data fFileNo(0), fSysWatch(0), // system info fFileWatch(0), // file watch - write the status of the analyzed files @@ -83,6 +87,18 @@ void AliTPCSelectorESD::Begin(TTree * /*tree*/) } + +void AliTPCSelectorESD::SetInputList(TList *input) { + // + // + // + fInput = input; + TNamed *regData = (TNamed*)input->FindObject("debugStreamPrefix"); + if (regData) fRegPath = new TString(regData->GetTitle()); + +} + + void AliTPCSelectorESD::SlaveBegin(TTree * tree) { // The SlaveBegin() function is called after the Begin() function. @@ -255,8 +271,8 @@ void AliTPCSelectorESD::SlaveTerminate() // The SlaveTerminate() function is called after all entries or objects // have been processed. When running with PROOF SlaveTerminate() is called // on each slave server. - printf ("SlaveTerminate.. \n"); - + printf ("SlaveTerminate.. \n"); + RegisterData(); } void AliTPCSelectorESD::Terminate() @@ -391,6 +407,21 @@ Bool_t AliTPCSelectorESD::Notify() return kTRUE; } +void AliTPCSelectorESD::RegisterData(){ + // + // Register persistent data + // + if (fRegPath){ + gSystem->Exec(Form("mkdir %s/%s",fRegPath->Data(), gSystem->HostName())); + printf("Register data to\t%s\n",fRegPath->Data()); + char command[1000]; + sprintf(command,"cp *.log %s/%s/",fRegPath->Data(), gSystem->HostName()); + gSystem->Exec(command); + sprintf(command,"cp *.root %s/%s/",fRegPath->Data(), gSystem->HostName()); + gSystem->Exec(command); + } +} + void AliTPCSelectorESD::DumpSysInfo(Int_t entry){ // diff --git a/TPC/AliTPCSelectorESD.h b/TPC/AliTPCSelectorESD.h index c8955684d70..70c799cdea4 100644 --- a/TPC/AliTPCSelectorESD.h +++ b/TPC/AliTPCSelectorESD.h @@ -11,6 +11,7 @@ using namespace std; #include #include +class TString; class AliESDEvent; class AliESD; class AliESDfriend; @@ -19,45 +20,47 @@ class TH1I; class AliTPCSelectorESD : public TSelector { public : - AliTPCSelectorESD(TTree *tree=0); - virtual ~AliTPCSelectorESD() { /*delete fESD; delete fESDfriend;*/ } - virtual Int_t Version() const { return 1; } - virtual void Begin(TTree *tree); - virtual void SlaveBegin(TTree *tree); - virtual void Init(TTree *tree); - virtual Bool_t Notify(); - virtual Bool_t Process(Long64_t entry); + AliTPCSelectorESD(TTree *tree=0); + virtual ~AliTPCSelectorESD() { /*delete fESD; delete fESDfriend;*/ } + virtual Int_t Version() const { return 1; } + virtual void Begin(TTree *tree); + virtual void SlaveBegin(TTree *tree); + virtual void Init(TTree *tree); + virtual Bool_t Notify(); + virtual Bool_t Process(Long64_t entry); virtual Int_t ReadEvent(Long64_t entry); - virtual Int_t ProcessIn(Long64_t entry); + virtual Int_t ProcessIn(Long64_t entry); + virtual void RegisterData(); - virtual void SetOption(const char *option) { fOption = option; } - virtual void SetObject(TObject *obj) { fObject = obj; } - virtual void SetInputList(TList *input) { fInput = input; } - virtual TList *GetOutputList() const { return fOutput; } - virtual void SlaveTerminate(); - virtual void Terminate(); - void CleanESD(); - void DumpSysInfo(Int_t entry); // dump system info + + virtual void SetOption(const char *option) { fOption = option; } + virtual void SetObject(TObject *obj) { fObject = obj; } + virtual void SetInputList(TList *input); + virtual TList *GetOutputList() const { return fOutput; } + virtual void SlaveTerminate(); + virtual void Terminate(); + void CleanESD(); + void DumpSysInfo(Int_t entry); // dump system info protected: - TTree *fChain; //! pointer to the analyzed TTree or TChain - TTree *fTreeFriend; //! pointer to friend tree + TTree *fChain; //! pointer to the analyzed TTree or TChain + TTree *fTreeFriend; //! pointer to friend tree AliESDEvent *fESDevent; //! esd event - AliESD *fESD; //! pointer to ESD - AliESDfriend *fESDfriend; //! pointer to friend + AliESD *fESD; //! pointer to ESD + AliESDfriend *fESDfriend; //! pointer to friend // USER defined variables - Int_t fFileNo; //! file number - TH1I *fNtracks; //! number of Tracks - TH1I *fNtracksFriend; //! number of firend Tracks - TH1I *fNClusters; //! number of clusters on track - // - // System info - // - fstream *fSysWatch; // system watch - Memory and CPU usage - fstream *fFileWatch; // file watch - write the status of the analyzed files - Int_t fDebugLevel; //debug level - - ClassDef(AliTPCSelectorESD,1); + Int_t fFileNo; //! file number + TH1I *fNtracks; //! number of Tracks + TH1I *fNtracksFriend; //! number of firend Tracks + TH1I *fNClusters; //! number of clusters on track + TString *fRegPath; // path to store persistent data + // + // System info + // + fstream *fSysWatch; // system watch - Memory and CPU usage + fstream *fFileWatch; // file watch - write the status of the analyzed files + Int_t fDebugLevel; //debug level + ClassDef(AliTPCSelectorESD,1); }; diff --git a/TPC/AliTPCSelectorTracks.cxx b/TPC/AliTPCSelectorTracks.cxx index 8ff6a08813a..e5be8e5bb5b 100644 --- a/TPC/AliTPCSelectorTracks.cxx +++ b/TPC/AliTPCSelectorTracks.cxx @@ -144,9 +144,8 @@ void AliTPCSelectorTracks::SlaveTerminate() // The SlaveTerminate() function is called after all entries or objects // have been processed. When running with PROOF SlaveTerminate() is called // on each slave server. - printf ("SlaveTerminate.. \n"); - printf ("Terminate CalibTracksGain.. \n"); if (fCalibTracksGain) fCalibTracksGain->Terminate(); + RegisterData(); } diff --git a/TPC/AliTPCcalibTracksGain.h b/TPC/AliTPCcalibTracksGain.h index e80a8335b8c..60b1cbc8eab 100644 --- a/TPC/AliTPCcalibTracksGain.h +++ b/TPC/AliTPCcalibTracksGain.h @@ -19,8 +19,11 @@ using namespace std; class TTreeSRedirector; -class TH3F; +class TObjString; class TLinearFitter; +class TProfile; +class TProfile2D; +class TH1F; class AliTPCClusterParam; class AliTPCParamSR; @@ -32,7 +35,6 @@ class AliTrackPointArray; class TTreeStream; class AliTPCcalibTracksCuts; class AliTPCFitPad; -class TObjString; class AliTPCcalibTracksGain : public TNamed { public: @@ -47,58 +49,106 @@ public: kLogFitter = 2 }; - AliTPCcalibTracksGain(); - AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj); - AliTPCcalibTracksGain(const char* name, const char* title, AliTPCcalibTracksCuts* cuts, TNamed* debugStreamPrefix = 0, AliTPCcalibTracksGain* prevIter = 0); - virtual ~AliTPCcalibTracksGain(); - AliTPCcalibTracksGain& operator=(const AliTPCcalibTracksGain& rhs); - - static void AddInfo(TChain* chain, char* debugStreamPrefix = 0, char* prevIterFileName = 0); - Bool_t AcceptTrack(AliTPCseed* track); - void Terminate(); - void Add(AliTPCcalibTracksGain* cal); - void AddTrack(AliTPCseed* seed); - void AddCluster(AliTPCclusterMI* cluster, Float_t momenta, Float_t mdedx, Int_t padType, Float_t xcenter, TVectorD dedxQ, TVectorD dedxM, Float_t fraction, Float_t fraction2, Float_t dedge, TVectorD parY, TVectorD parZ, TVectorD meanPos); - void Process(AliTPCseed* seed); - Long64_t Merge(TCollection *list); - void Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.); - void GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam); - void GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError); - Double_t GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType); - void GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix); - AliTPCCalPad* CreateFitCalPad(UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); - AliTPCCalROC* CreateFitCalROC(UInt_t sector, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); - AliTPCCalROC* CreateFitCalROC(UInt_t sector, UInt_t padType, TVectorD &fitParam, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); - AliTPCCalROC* CreateCombinedCalROC(const AliTPCCalROC* roc1, const AliTPCCalROC* roc2); - TLinearFitter* GetFitter(UInt_t segment, UInt_t padType, UInt_t fitType); - static Double_t GetPadLength(Double_t lx); - static Int_t GetPadType(Double_t lx); - void DumpTrack(AliTPCseed* track); - Bool_t GetDedx(AliTPCseed* track, Int_t padType, Int_t* rows); - - static Bool_t GetRowPad(Double_t lx, Double_t ly, Int_t& row, Int_t& pad); // just for debugging -protected: + AliTPCcalibTracksGain(); + AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj); + AliTPCcalibTracksGain(const char* name, const char* title, AliTPCcalibTracksCuts* cuts, TNamed* debugStreamPrefix = 0, AliTPCcalibTracksGain* prevIter = 0); + virtual ~AliTPCcalibTracksGain(); + AliTPCcalibTracksGain& operator=(const AliTPCcalibTracksGain& rhs); + static void AddInfo(TChain* chain, char* debugStreamPrefix = 0, char* prevIterFileName = 0); + void Terminate(); + // + // Tracks manipulation + // + void Process(AliTPCseed* seed); + void AddTrack(AliTPCseed* seed); + Bool_t AcceptTrack(AliTPCseed* track); + void DumpTrack(AliTPCseed* track); + Bool_t GetDedx(AliTPCseed* track, Int_t padType, Int_t*rows, + Int_t §or, Int_t& npoints, + TVectorD &dedxM, TVectorD &dedxQ, + TVectorD &parY, TVectorD &parZ, TVectorD & meanPos); + void AddCluster(AliTPCclusterMI* cluster, Float_t momenta, Float_t mdedx, Int_t padType, Float_t xcenter, TVectorD &dedxQ, TVectorD & dedxM, Float_t fraction, Float_t fraction2, Float_t dedge, TVectorD& parY, TVectorD& parZ, TVectorD& meanPos); + void AddTracklet(UInt_t sector, UInt_t padType,TVectorD &dedxQ, TVectorD &dedxM,TVectorD& parY, TVectorD& parZ, TVectorD& meanPos); - UInt_t fTotalTracks; // just for debugging - UInt_t fAcceptedTracks; // just for debugging - AliTPCCalPad* fDebugCalPadRaw; // just for debugging - AliTPCCalPad* fDebugCalPadCorr; // just for debugging - - TTreeSRedirector* fDebugStream; //! debug stream for debugging - - AliTPCFitPad* fSimpleFitter; // simple fitter for short pads - AliTPCFitPad* fSqrtFitter; // sqrt fitter for medium pads - AliTPCFitPad* fLogFitter; // log fitter for long pads - AliTPCFitPad* fSingleSectorFitter; // just for debugging - - AliTPCcalibTracksGain* fPrevIter; // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!) - - UInt_t fNShortClusters[36]; // number of clusters registered on short pads - UInt_t fNMediumClusters[36]; // number of clusters registered on medium pads - UInt_t fNLongClusters[36]; // number of clusters registered on long pads - TObjString* fDebugStreamPrefix; // pathname of the final location of the debug stream file (may also be an xrootd directory) - AliTPCcalibTracksCuts* fCuts; // cuts that are used for sieving the tracks used for calibration + void AddCluster(AliTPCclusterMI* cluster); + // + // Merging of the component + // + Long64_t Merge(TCollection *list); + void Add(AliTPCcalibTracksGain* cal); + // + // Histogram part + // + TH1F * GetQM(Int_t sector=-1){return (TH1F*)(sector<0 ? fArrayQM->At(72): fArrayQM->At(sector));} + TH1F * GetQT(Int_t sector=-1){return (TH1F*)(sector<0 ? fArrayQT->At(72): fArrayQT->At(sector));} + TProfile* GetProfileQM(Int_t sector){return (TProfile*)(sector<0 ? fProfileArrayQM->At(36): fProfileArrayQM->At(sector));} + TProfile* GetProfileQT(Int_t sector){return (TProfile*)(sector<0 ? fProfileArrayQT->At(36): fProfileArrayQT->At(sector));} + TProfile2D* GetProfileQM2D(Int_t sector){return (TProfile2D*)(sector<0 ? fProfileArrayQM2D->At(36): fProfileArrayQM2D->At(sector));} + TProfile2D* GetProfileQT2D(Int_t sector){return (TProfile2D*)(sector<0 ? fProfileArrayQT2D->At(36): fProfileArrayQT2D->At(sector));} + // + // Get Derived results - gain maps + // + AliTPCCalPad* CreateFitCalPad(UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); + AliTPCCalROC* CreateFitCalROC(UInt_t sector, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); + AliTPCCalROC* CreateFitCalROC(UInt_t sector, UInt_t padType, TVectorD &fitParam, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE); + AliTPCCalROC* CreateCombinedCalROC(const AliTPCCalROC* roc1, const AliTPCCalROC* roc2); + // + void Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.); + void GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam); + void GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError); + Double_t GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType); + void GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix); + TLinearFitter* GetFitter(UInt_t segment, UInt_t padType, UInt_t fitType); +public: + // + // Helper function + // + static Double_t GetPadLength(Double_t lx); + static Int_t GetPadType(Double_t lx); + static Bool_t GetRowPad(Double_t lx, Double_t ly, Int_t& row, Int_t& pad); // just for debugging + // + // + TTreeSRedirector* fDebugStream; //! debug stream for debugging + AliTPCcalibTracksCuts* fCuts; // cuts that are used for sieving the tracks used for calibration + // + // Simple Profiles and histograms - per chambers + 1 total + // + TObjArray* fArrayQM; // Qmax normalized + TObjArray* fArrayQT; // Qtot normalized + TObjArray* fProfileArrayQM; // Qmax normalized versus local X + TObjArray* fProfileArrayQT; // Qtot normalized versus local X + TObjArray* fProfileArrayQM2D; // Qmax normalized versus local X and phi + TObjArray* fProfileArrayQT2D; // Qtot normalized versus local X and phi + // + // Fitters + // + AliTPCFitPad* fSimpleFitter; // simple fitter for short pads + AliTPCFitPad* fSqrtFitter; // sqrt fitter for medium pads + AliTPCFitPad* fLogFitter; // log fitter for long pads + TLinearFitter* fFitter0M; // fitting of the atenuation, angular correction, and mean chamber gain + TLinearFitter* fFitter1M; // fitting of the atenuation, angular correction, and mean chamber gain + TLinearFitter* fFitter2M; // fitting of the atenuation, angular correction, and mean chamber gain + TLinearFitter* fFitter0T; // fitting of the atenuation, angular correction, and mean chamber gain + TLinearFitter* fFitter1T; // fitting of the atenuation, angular correction, and mean chamber gain + TLinearFitter* fFitter2T; // fitting of the atenuation, angular correction, and mean chamber gain + AliTPCFitPad* fSingleSectorFitter; // just for debugging + // + // Conters + // + UInt_t fTotalTracks; // just for debugging + UInt_t fAcceptedTracks; // just for debugging + AliTPCCalPad* fDebugCalPadRaw; // just for debugging + AliTPCCalPad* fDebugCalPadCorr; // just for debugging + UInt_t fNShortClusters[36]; // number of clusters registered on short pads + UInt_t fNMediumClusters[36]; // number of clusters registered on medium pads + UInt_t fNLongClusters[36]; // number of clusters registered on long pads + // + // + AliTPCcalibTracksGain* fPrevIter; // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!) + // + // Setup + // static AliTPCParamSR* fgTPCparam; //! helper object for geometry related operations static const Double_t fgkM; // value used in the transformation of the charge values for the logarithmic fitter static const char* fgkDebugStreamFileName; // filename of the debug stream file -- 2.43.0