00001 #ifndef ANP_FILLMUONID_H
00002 #define ANP_FILLMUONID_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <algorithm>
00011 #include <map>
00012
00013
00014 #include "PhysicsNtuple/AlgEvent.h"
00015 #include "PhysicsNtuple/AlgSnarl.h"
00016
00017 class VldContext;
00018
00019 namespace Anp
00020 {
00021 namespace Fill
00022 {
00023 struct AddCharge : public std::unary_function<double, void>
00024 {
00025 AddCharge(double value_);
00026 void operator() (double &x);
00027 const double value;
00028 };
00029 }
00030
00031 class FillMuonId: public AlgSnarl, public AlgEvent
00032 {
00033 public:
00034
00035 typedef std::vector<double> ChargeVec;
00036 typedef std::map<short, float> DataMap;
00037
00038 struct PlaneData
00039 {
00040 PlaneData();
00041
00042 short min_strip;
00043 short max_strip;
00044
00045 ChargeVec track_vec;
00046 ChargeVec other_vec;
00047
00048 float tpos;
00049 };
00050
00051 typedef std::map<short, PlaneData> PMap;
00052 typedef PMap::const_iterator PIter;
00053
00054 public:
00055
00056 FillMuonId();
00057 virtual ~FillMuonId();
00058
00059 bool Run(Record &record);
00060
00061 bool Run(Event &event, const Record &record, const bool pass);
00062
00063 void Config(const Registry ®);
00064
00065 const DataMap Run(const Track &track, const Record &record) const;
00066
00067 void Fill(const PMap &pmap, DataMap &dmap, short base) const;
00068
00069 const PMap Select(const Track &track, const Record &record, const std::string &opt = "") const;
00070
00071 const PMap AddCharge(const PMap &pmap, double calor, double spect) const;
00072
00073 private:
00074
00075 void Fill0(PIter beg, PIter end, DataMap &dmap) const;
00076 void Fill1(PIter beg, PIter end, DataMap &dmap, short base) const;
00077 void Fill2(PIter beg, PIter end, DataMap &dmap, short base) const;
00078 void Fill3(PIter beg, PIter end, DataMap &dmap, short base) const;
00079 void Fill4(PIter beg, PIter end, DataMap &dmap, short base) const;
00080
00081 const VldContext GetVldc(const Header &header) const;
00082
00083 float GetLPos(short plane, const PMap &pmap) const;
00084 float Get(const Strip &strip, const VldContext &vldc, float lpos, short option) const;
00085
00086 private:
00087
00088 short fStripWindow;
00089 short fMinViewNPlane;
00090 short fKeyBase;
00091 int fKeyPass;
00092
00093 double fTimeWindow;
00094
00095 double fMinStripAdc;
00096 double fMinStripMip;
00097
00098 double fADCShiftMuon;
00099 double fADCShiftMuonSpect;
00100
00101 double fADCShiftOther;
00102 double fADCShiftOtherSpect;
00103
00104 bool fIsStudy;
00105 bool fFillDetec;
00106 bool fFillEvent;
00107 bool fFillShift;
00108 bool fFillShort;
00109 };
00110
00111
00112
00113
00114 inline Fill::AddCharge::AddCharge(const double value_)
00115 :value(value_)
00116 {
00117 }
00118 inline void Fill::AddCharge::operator() (double &x)
00119 {
00120 x += value;
00121 }
00122 }
00123
00124 #endif