//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Class to align tpc with respect to external tracks // // // Environment: // Software NOT developed for the PANDA Detector at FAIR. // // Author List: // Alexander Schmah TUM (original author) // Maxence Vandenbroucke TUM (author) // Francesco Cusanno TUM (author) // Sverre Doerheim TUM (author, rewrite from macro to compiled object) // // //----------------------------------------------------------- #ifndef TpcAligner_H #define TpcAligner_H #include #include #include #include #include #include #include #include #include #include "TpcResidual.h" #include "TpcSimpleResidual.h" #include "TpcAlignmentManager.h" #include "TpcRefGFTrkResCalc.h" #include "AbsChi2.h" enum AlignmentMode {fMinuit, fSimulatedAnnealing,fMCMC }; class TpcAligner : public TObject, public AbsChi2 { public: TpcAligner(); void setAlignmentFile(TString alfile){fAlignmentFile=alfile;} void setDetectorName(std::string name){fDetectorName=name;} void setInputChain(TChain* chain){fInputChain=chain;} void setMaxEvents(int nEv){fMaxEvents=nEv;} //turn on BAT, replaces minuit with bat, default ist using MCMC void setBatPars(double batItMin, double batItMax,double batItUpdate, int batNChains){ fBatItMin=batItMin; fBatItMax=batItMax; fBatItUpdate=batItUpdate; fBatNChains=batNChains; } void setMinimizer(AlignmentMode al){fAlignmentMode=al;} //Uses direction of track at the POCA to recalculate Residual void trackUseLinearization(bool opt=true){fUseTrackLinearization=opt;} //Turns on shifting of the center of rotation during the minimization void setUseShiftRotation(bool bla=true){fuseShiftedRotation=bla;} //Changes the shift witch is used if the previous option is set, default 50 cm void setRotationShift(double z){fshift=z;} void setAutoRotationShift(bool opt=true){fAutoRotationShift=opt;} // void setUse3DResiduals(bool opt=true){fUse3DResidual=opt;} //Main methods //Initializes everything, TCA, branches, histograms+++ bool init(); bool execute(); bool getPrintChi2() const; void setPrintChi2(bool value); //Static methods, chisquare function // void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); //to be minimized virtual double chisquare(int npar,double * pars); void setVerbose(int verbose = 1){fVerbose=verbose;} virtual void getRealParameters(const std::vector pars, double *realpars) ; private: TStopwatch clock; TpcAlignmentManager* fAlMan; int nCallsFcn; int fVerbose; bool fuseShiftedRotation; double fshift; bool fUseTrackLinearization; bool fUse3DResidual; bool fUse2DResidual; std::string fDetectorName; std::string fAlignmentFile; std::vector fSimpleResiduals; //Used when storing resiudals to file TClonesArray* fTCResiduals; bool fAutoRotationShift; double fMeanZ; TVector3 fInititalTpcPos; double fInitialPhi; double fInitialTheta; double fInitialPsi; double fInitialPhiXYZ; double fInitialThetaXZY; double fInitialPsiXYZ; //variables needed caching in the chi2 method, not used double fFirstChiSq; bool fPrintChi2; AlignmentMode fAlignmentMode ; double fBatItMax; double fBatItMin; double fBatItUpdate; int fBatNChains; double phi_,theta_, psi_; TVector3 tpcpos_; TChain* fInputChain; int fMaxEvents; std::string residualFile; //int chargeFiltering;// positive value= positive tracks, negative = negative, 0 all public: ClassDef(TpcAligner,1) }; #endif // TpcAligner_H