00001
00002
00003
00004
00005
00006
00008 #ifndef CONDENSEDNTPMODULEATM_H
00009 #define CONDENSEDNTPMODULEATM_H
00010
00011 #include "TObject.h"
00012 #include "Registry/Registry.h"
00013 #include "TTree.h"
00014 #include "TFile.h"
00015
00016 #ifndef JOBCMODULE_H
00017 #include "JobControl/JobCModule.h"
00018 #endif
00019
00020 #include <string>
00021
00022 #include "AnalysisNtuples/ANtpEventInfo.h"
00023 #include "AnalysisNtuples/ANtpTrackInfoAtm.h"
00024 #include "AnalysisNtuples/ANtpTruthInfoAtm.h"
00025 #include "../ANtpHeaderInfo.h"
00026 #include "AnalysisNtuples/ANtpBeamInfo.h"
00027 #include "AnalysisNtuples/Module/ANtpInfoObjectFillerBeam.h"
00028
00029 class MomNavigator;
00030 class JobCommand;
00031 class NtpSRTrack;
00032 class NtpSRShower;
00033 class NtpSREvent;
00034 class NtpMCTruth;
00035 class NtpMCStdHep;
00036 class NtpSRRecord;
00037 class TClonesArray;
00038
00039
00040
00041 class CondensedNtpModuleAtm : public JobCModule, public TObject
00042 {
00043
00044 public:
00045 CondensedNtpModuleAtm();
00046 virtual ~CondensedNtpModuleAtm();
00047
00048 void BeginJob();
00049 JobCResult Ana(const MomNavigator *mom);
00050 const Registry& DefaultConfig() const;
00051 void Config(const Registry& r);
00052 void Help();
00053 void EndJob();
00054
00055 private:
00056
00057 std::string fFileName;
00058 std::string fRockMapFileName;
00059 std::string fTreeName;
00060 std::string fBeamTreeName;
00061 std::string fBeamPath;
00062 TFile *fNtpFile;
00063 TTree *fNtuple;
00064 TTree *fFailTree;
00065 TTree *fBeamTree;
00066 Int_t fDetector;
00067 Int_t fGoodTrack;
00068 Int_t fDataType;
00069 Int_t fEndPlane;
00070 Double_t fHornCurrent;
00071 Double_t fCurrentPOT;
00072 Double_t fBeamHPos;
00073 Double_t fBeamVPos;
00074 Double_t fTargetPos;
00075 Double_t fBeamTimeSec;
00076 Int_t fIsMultiple;
00077 Int_t fValidPlaneFail;
00078 Int_t fFailDeMux;
00079 Int_t fMajorRelease;
00080 Double_t fPathCosZenDeg[1500];
00081 Double_t fPathAzimuthDeg[1500];
00082 Double_t fColDenCosZen[1500];
00083 Double_t fDensity[1500];
00084 bool fNewMC;
00085
00086 ANtpEventInfo *fEventInfo;
00087 ANtpHeaderInfo *fHeaderInfo;
00088 ANtpBeamInfo *fBeamInfo;
00089 ANtpTrackInfoAtm *fTrackInfo;
00090 ANtpTruthInfoAtm *fTruthInfo;
00091
00092 ANtpInfoObjectFillerBeam *fInfoFiller;
00093
00094 Int_t fCtr;
00095
00096 void FillEventInformation(ANtpRecoNtpManipulator *ntpManipulator,
00097 NtpSREvent *ntpEvent);
00098 void FillMCInformation(NtpMCTruth *ntpMCTruth, NtpMCStdHep *ntpMCStdHep);
00099 void FillTrackInformation(NtpSRTrack *ntpTrack, TClonesArray *stripArray, double azimuth,
00100 double ra, double dec);
00101 void FillTrackTimingVariables(NtpSRTrack *ntpTrack, TClonesArray *stripArray);
00102 void FillTrackMagneticBendingVariables(NtpSRTrack *ntpTrack, TClonesArray *stripArray);
00103
00104 void ResetTreeVariables();
00105
00106 Double_t GetTimeWeight(Float_t ph);
00107 Double_t ArrivalTime_Weight(Double_t npe) const;
00108 Double_t ArrivalTime_Uncertainty(Double_t npe) const;
00109 void WeightedAverage(const Int_t n, const Double_t *x, const Double_t *w,
00110 Double_t *parm, Double_t *eparm);
00111 void LinearFit_Weighted(const Int_t n, const Double_t *x, const Double_t *y,
00112 const Double_t *w,Double_t *parm, Double_t *eparm);
00113 void FitMinimizingResidual(Int_t &n, Double_t *x, Double_t *y, Double_t *w,
00114 Double_t *param, Double_t *eparam, bool findSlope = true);
00115 void FindLinearFit(Double_t *x, Double_t *y, Double_t *weight,
00116 Int_t nPoints, Double_t &a1, Double_t &a2,
00117 Double_t &chiSq);
00118 void FindChi2(Double_t *x, Double_t *y, Double_t *weight,
00119 Int_t nPoints, Double_t &a1, Double_t &a2,
00120 Double_t &chiSq);
00121 void FindStraightLineDeviation(Double_t *x, Double_t *y, Int_t nPoints,
00122 Double_t &a1, Double_t &a2, Double_t &deviation);
00123 void FindMeanAndRMS(double *x, double *weight, int nPoints,
00124 double &mean, double &rms);
00125 Float_t CheapBaseline(float cosz);
00126
00127
00128 ClassDef(CondensedNtpModuleAtm, 3)
00129 };
00130
00131 #endif // CONDENSEDNTPMODULEATM_H
00132
00133