#include <MeuReco.h>
Public Member Functions | |
| MeuReco () | |
| ~MeuReco () | |
| void | CalcFCPC (MeuSummary &s, const std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CalcLPos (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | CalcMEU (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CalcPosOfGaps (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CalcPosOfBigGaps (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CalcPosOfTrkEndGaps (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | CalcPLCor (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Float_t | CalcSmallestDeepDistToEdge (const MeuHitInfo &cp) const |
| void | CalcStripDists (const MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CalcTrace (const MeuSummary &s, const std::map< Int_t, MeuHitInfo > &plInfo, Float_t *trace=0, Float_t *traceZ=0) const |
| void | CalcVtx (MeuSummary &s, const std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | CalcVtxSpecialND (MeuSummary &s, const std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | CalcWindow (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| Bool_t | CheckTrackGaps (const std::map< Int_t, MeuHitInfo > &plInfo) const |
| Float_t | CheckDeepDistToEdge (const MeuHitInfo &cp) const |
| Bool_t | CheckWinContainment (const MeuSummary &s, const std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | ConvertToXYZ (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | PrintContainment (const MeuSummary &s) const |
| void | PrintMeuHitInfo (const std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | PrintMeuHitInfoFull (const std::map< Int_t, MeuHitInfo > &plInfo) const |
| void | PrintMeuSummary (const MeuSummary &s) const |
| Bool_t | Reconstruct (MeuSummary &s, std::map< Int_t, MeuHitInfo > &plInfo) const |
|
|
Definition at line 35 of file MeuReco.cxx. References MSG. 00036 {
00037 MSG("MeuReco",Msg::kDebug)
00038 <<"Running MeuReco Constructor..."<<endl;
00039
00040
00041 MSG("MeuReco",Msg::kDebug)
00042 <<"Finished MeuReco Constructor"<<endl;
00043 }
|
|
|
Definition at line 47 of file MeuReco.cxx. References MSG. 00048 {
00049 MSG("MeuReco",Msg::kDebug)
00050 <<"Running MeuReco Destructor..."<<endl;
00051
00052
00053 MSG("MeuReco",Msg::kDebug)
00054 <<"Finished MeuReco Destructor"<<endl;
00055 }
|
|
||||||||||||
|
Definition at line 1876 of file MeuReco.cxx. References CheckDeepDistToEdge(), MeuSummary::Detector, MeuSummary::DistToEdgeFid, MeuSummary::EndDistToEdge, MeuSummary::EndPlane, MeuSummary::EntSM1Back, MeuSummary::EntSM1Front, MeuSummary::EntSM2Back, MeuSummary::EntSM2Front, MeuSummary::EntSMEnd, MeuSummary::ExitSM1Back, MeuSummary::ExitSM1Front, MeuSummary::ExitSM2Back, MeuSummary::ExitSM2Front, MeuSummary::ExitSMEnd, MeuSummary::FC, MAXMSG, MeuSummary::MaxPlane2, MeuSummary::MaxPlane3, MeuSummary::MinPlane2, MeuSummary::MinPlane3, MSG, MeuSummary::PC, MeuHitInfo::Plane, print(), MeuSummary::REnd, MeuSummary::RFid, MeuSummary::RVtx, s(), MeuSummary::SM1, MeuSummary::SM2, MeuSummary::SMBoth, MeuSummary::TrigSrc, MeuSummary::VtxDistToEdge, MeuSummary::VtxPlane, and MeuHitInfo::Y. Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), MeuAnalysis::SnarlList(), and MeuAnalysis::SpillPlots(). 01878 {
01879
01880 if (s.Detector==Detector::kNear) {
01881 //set these just to be explicit
01882 s.SM1=true;
01883 s.SM2=false;
01884 s.SMBoth=false;
01885
01886 //check if muon entered SM end
01887 s.EntSM1Front=s.VtxPlane<=5;//first 5 planes
01888 s.EntSM1Back=s.VtxPlane>=116;//120,119,18,17,16
01889 s.EntSMEnd=s.EntSM1Front || s.EntSM1Back;
01890
01891 //check if muon exited SM end
01892 s.ExitSM1Front=s.EndPlane<=5;//first 5 planes
01893 s.ExitSM1Back=s.EndPlane>=116;//120,119,18,17,16
01894 s.ExitSMEnd=s.ExitSM1Front || s.ExitSM1Back;
01895
01896 //check containment
01897 //vtx plane
01898 if (plInfo.find(s.VtxPlane)==plInfo.end()) {
01899 MSG("MeuReco",Msg::kFatal)<<"Ahhhhh! No vtx"<<endl;
01900 }
01901 const MeuHitInfo& cp=plInfo.find(s.VtxPlane)->second;
01902 s.VtxDistToEdge=this->CheckDeepDistToEdge(cp);
01903
01904 //end plane
01905 if (plInfo.find(s.EndPlane)==plInfo.end()) {
01906 MSG("MeuReco",Msg::kError)<<"Ahhhhh2! No end"<<endl;
01907 }
01908 const MeuHitInfo& cpEnd=plInfo.find(s.EndPlane)->second;
01909 s.EndDistToEdge=this->CheckDeepDistToEdge(cpEnd);
01910
01911 //decide if FC or PC
01912 if (s.TrigSrc>60000) {//spill mode
01913 MAXMSG("MeuReco",Msg::kInfo,1)
01914 <<"CalcFCPC: Spill mode"<<endl;
01915 s.PC=!s.ExitSMEnd && s.EndDistToEdge>s.DistToEdgeFid;
01916 }
01917 else {//cosmics mode
01918 MAXMSG("MeuReco",Msg::kInfo,1)
01919 <<"CalcFCPC: Cosmics mode"<<endl;
01920 s.PC=!s.ExitSMEnd && s.EndDistToEdge>s.DistToEdgeFid &&
01921 (s.VtxDistToEdge<s.DistToEdgeFid || s.EntSMEnd);
01922 }
01923
01924 if (!s.PC) {
01925 s.FC=!s.ExitSMEnd && !s.EntSMEnd &&
01926 s.VtxDistToEdge>s.DistToEdgeFid &&
01927 s.EndDistToEdge>s.DistToEdgeFid;
01928 }
01929 else s.FC=false;//don't want something both FC and PC
01930
01931 //s.PC=!s.ExitSMEnd && s.REnd<s.RFid &&
01932 //(s.RVtx>s.RFid || s.EntSMEnd);
01933 //s.FC=!s.ExitSMEnd && !s.EntSMEnd &&
01934 //s.RVtx<s.RFid && s.REnd<s.RFid;
01935 //if (s.PC){
01936 //this->PrintContainment(s);
01937 //}
01938 }
01939 else if (s.Detector==Detector::kFar) {
01940
01941 Float_t maxPlane=s.MaxPlane2;
01942 if (s.MaxPlane3>s.MaxPlane2) maxPlane=s.MaxPlane3;
01943 Float_t minPlane=s.MinPlane2;
01944 if (s.MinPlane3<s.MinPlane2) minPlane=s.MinPlane3;
01945
01946 //work out which SM or if in both
01947 s.SM1=maxPlane<=248;
01948 s.SM2=minPlane>=250;
01949 s.SMBoth=minPlane<=248 && maxPlane>=250;
01950
01951 //record the min and max planes in each view
01952 s.MinPlane2=s.MinPlane2;
01953 s.MinPlane3=s.MinPlane3;
01954 s.MaxPlane2=s.MaxPlane2;
01955 s.MaxPlane3=s.MaxPlane3;
01956
01957 //check if muon entered SM end
01958 s.EntSM1Front=s.VtxPlane<=5;//first 5 planes
01959 s.EntSM1Back=s.VtxPlane>=244 && s.VtxPlane<=248;//248,7,6,5,4
01960 s.EntSM2Front=s.VtxPlane>=250 && s.VtxPlane<=254;//250,1,2,3,4
01961 s.EntSM2Back=s.VtxPlane>=481;//485,4,3,2,1
01962 s.EntSMEnd=s.EntSM1Front || s.EntSM1Back || s.EntSM2Front ||
01963 s.EntSM2Back;
01964
01965 //check if muon exited SM end
01966 s.ExitSM1Front=s.EndPlane<=5;//first 5 planes
01967 s.ExitSM1Back=s.EndPlane>=244 && s.EndPlane<=248;//248,7,6,5,4
01968 s.ExitSM2Front=s.EndPlane>=250 && s.EndPlane<=254;//250,1,2,3,4
01969 s.ExitSM2Back=s.EndPlane>=481;//485,4,3,2,1
01970 s.ExitSMEnd=s.ExitSM1Front || s.ExitSM1Back ||
01971 s.ExitSM2Front || s.ExitSM2Back;
01972
01973 //work out if FC or PC
01974 s.PC=!s.ExitSMEnd && s.REnd<s.RFid &&
01975 (s.RVtx>s.RFid || s.EntSMEnd);
01976 s.FC=!s.ExitSMEnd && !s.EntSMEnd && s.RVtx<s.RFid &&
01977 s.REnd<s.RFid;
01978
01979 //this->PrintContainment(s);
01980 }
01981 else {
01982 MAXMSG("MeuReco",Msg::kFatal,500)
01983 <<"CalcFCPC: Detector not implemented = "<<s.Detector<<endl;
01984 }
01985
01986
01987 Bool_t print=false;
01988 if (print){
01989 if (s.PC){
01990 MAXMSG("MeuReco",Msg::kInfo,500)
01991 <<"PC"
01992 <<", vtx Pl="<<s.VtxPlane<<", end Pl="<<s.EndPlane
01993 <<", dVtx="<<s.VtxDistToEdge
01994 <<", dEnd="<<s.EndDistToEdge<<endl;
01995 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.begin();
01996 it!=plInfo.end();++it){
01997 const MeuHitInfo& c=it->second;
01998 MAXMSG("MeuReco",Msg::kInfo,500)
01999 <<"pl="<<c.Plane<<", y="<<c.Y<<endl;
02000 }
02001 }
02002 else if (s.FC){
02003 MAXMSG("MeuReco",Msg::kInfo,500)
02004 <<"FC!!!!!"
02005 <<", vtx Pl="<<s.VtxPlane<<", end Pl="<<s.EndPlane
02006 <<", dVtx="<<s.VtxDistToEdge
02007 <<", dEnd="<<s.EndDistToEdge<<endl;
02008 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.begin();
02009 it!=plInfo.end();++it){
02010 const MeuHitInfo& c=it->second;
02011 MAXMSG("MeuReco",Msg::kInfo,500)
02012 <<"pl="<<c.Plane<<", y="<<c.Y<<endl;
02013 }
02014 }
02015 else {
02016 MAXMSG("MeuReco",Msg::kInfo,500)
02017 <<"NOT PC or FC"<<endl;
02018 }
02019 }
02020 }
|
|
||||||||||||
|
Definition at line 1047 of file MeuReco.cxx. References MeuSummary::Detector, MeuSummary::EndPlane, UgliStripHandle::GetHalfLength(), UgliPlnHandle::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliGeomHandle::GetStripHandle(), UgliGeomHandle::GetTransverseExtent(), UgliStripHandle::LocalToGlobal(), MeuHitInfo::LPos, MAXMSG, MSG, MeuHitInfo::Plane, s(), MeuSummary::SimFlag, MeuHitInfo::Strip, MeuHitInfo::TPos, MeuSummary::VtxPlane, UgliGeomHandle::xyz2uvz(), and MeuHitInfo::Z. Referenced by Reconstruct(). 01049 {
01050 //variable to turn on all the useful messages if required
01051 Msg::LogLevel_t logLevel=Msg::kDebug;
01052
01053 MAXMSG("MeuReco",logLevel,1000)
01054 <<endl<<"CalcLPos: Get position along strip, track: "
01055 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
01056
01057 Float_t initValue=-999;
01058 Bool_t posDir=(s.EndPlane>s.VtxPlane);
01059
01060 //get variables for loops
01061 Int_t pl=s.VtxPlane;
01062 if (posDir) pl+=1;//start one plane in from vtx
01063 else pl-=1;
01064 Int_t tmpEndPlane=s.EndPlane;
01065
01066 //loop over n-4 planes in track looking for gaps to fill
01067 //only fill the simple 1-plane gaps
01068 while (pl!=tmpEndPlane){//does not actually use tmpEndPlane
01069 MeuHitInfo& cp=plInfo[pl];
01070
01071 if (cp.LPos<=initValue) {
01072 //cache the adjacent calibPos
01073 MeuHitInfo& cpA=plInfo[pl+1];
01074 MeuHitInfo& cpB=plInfo[pl-1];
01075
01076 if (cpA.TPos<=initValue || cpB.TPos<=initValue) {
01077 MAXMSG("MeuReco",Msg::kWarning,1000)
01078 <<"Found a gap, pl="<<cp.Plane
01079 <<", pl+1 tposA="<<cpA.TPos
01080 <<", pl-1 tposB="<<cpB.TPos
01081 <<endl;
01082 }
01083 else{
01084 Float_t avTPos=(cpA.TPos+cpB.TPos)*0.5;
01085 cp.LPos=avTPos;//note that setting LPos=TPos
01086 MAXMSG("MeuReco",logLevel,1000)
01087 <<"Calc LPos: pl="<<cp.Plane<<", st="<<cp.Strip
01088 <<", tposA="<<cpA.TPos
01089 <<", tposB="<<cpB.TPos
01090 <<", LPos="<<cp.LPos<<endl;
01091 }
01092 }
01093 else{
01094 MAXMSG("MeuReco",Msg::kWarning,1000)
01095 <<"LPos value already found="<<cp.LPos
01096 <<", pl="<<cp.Plane<<endl;
01097 }
01098
01099 if (posDir) pl++;
01100 else pl--;
01101 }
01102
01103 //now calc the ends
01104 //determine the planes to use to calc the lpos of the last plane
01105 Int_t plNearVtxA=s.VtxPlane-1;
01106 Int_t plNearVtxB=s.VtxPlane-3;
01107 if (posDir) {
01108 plNearVtxA=s.VtxPlane+1;
01109 plNearVtxB=s.VtxPlane+3;
01110 }
01111 Int_t plNearEndA=s.EndPlane+1;
01112 Int_t plNearEndB=s.EndPlane+3;
01113 if (posDir) {
01114 plNearEndA=s.EndPlane-1;
01115 plNearEndB=s.EndPlane-3;
01116 }
01117
01118 Bool_t interpError=false;
01119
01120 MeuHitInfo& cpEnd=plInfo[s.EndPlane];
01121 MeuHitInfo& cpEndA=plInfo[plNearEndA];
01122 MeuHitInfo& cpEndB=plInfo[plNearEndB];
01123 MeuHitInfo& cpVtx=plInfo[s.VtxPlane];
01124 MeuHitInfo& cpVtxA=plInfo[plNearVtxA];
01125 MeuHitInfo& cpVtxB=plInfo[plNearVtxB];
01126
01127 //calc the lpos for the vtx and end planes
01128 for (Int_t i=0;i<2;i++){
01129
01130 MeuHitInfo* cpGap=&cpVtx;
01131 MeuHitInfo* cp1=&cpVtxA;
01132 MeuHitInfo* cp2=&cpVtxB;
01133 if (i==1) {
01134 cpGap=&cpEnd;
01135 cp1=&cpEndA;
01136 cp2=&cpEndB;
01137 }
01138
01139 Int_t pl=cpGap->Plane;
01140
01141 //do interpolation
01142 //define m=x1_2/y1_2 = x1-x2/y1-y2
01143 //(x and y are what is required)
01144 //define x=tpos, y=z
01145 Float_t m=(cp1->TPos-cp2->TPos)/(cp1->Z-cp2->Z);
01146 //Double_t x=(y-y2)*m+x2;// give above formula for m
01147 Float_t tpos=(cpGap->Z-cp2->Z)*m+cp2->TPos;
01148 if (cpGap) {
01149 //record result
01150 cpGap->LPos=tpos;//note that setting LPos=TPos
01151 }
01152 else {
01153 MAXMSG("MeuReco",Msg::kWarning,1000)
01154 <<"Ahhhhh, not found a cp for after gap"<<endl;
01155 interpError=true;
01156 }
01157
01158 MAXMSG("MeuReco",logLevel,1000)
01159 <<"Doing interpolation:"<<endl
01160 <<"Point1: tpos="<<cp1->TPos<<", z="<<cp1->Z<<endl
01161 <<" gap sizes: ="<<cp1->TPos-cpGap->LPos
01162 <<", z="<<cp1->Z-cpGap->Z<<endl
01163 <<"Interp point: tpos="<<cpGap->LPos
01164 <<", z="<<cpGap->Z<<endl
01165 <<" gap sizes: ="<<cpGap->LPos-cp2->TPos
01166 <<", ="<<cpGap->Z-cp2->Z<<endl
01167 <<"Point2: tpos="<<cp2->TPos<<", z="<<cp2->Z<<endl
01168 <<endl;
01169
01170 VldTimeStamp vldts;
01171 //VldTimeStamp vldts(ev.UnixTime,0);
01172 VldContext vc
01173 (static_cast<Detector::Detector_t>(s.Detector),
01174 static_cast<SimFlag::ESimFlag>(s.SimFlag),vldts);
01175 //get the ugh
01176 UgliGeomHandle ugh(vc);
01177 //Float_t zmin=-1;
01178 //Float_t zmax=-1;
01179 Float_t tmin=-1;
01180 Float_t tmax=-1;
01181 PlexPlaneId plidScint
01182 (static_cast<Detector::Detector_t>(s.Detector),pl);
01183 PlaneView::PlaneView_t pv=PlaneView::kUnknown;
01184 pv=ugh.GetScintPlnHandle(plidScint).GetPlaneView();
01185 string sPv="";//PlaneView::AsString(pv);
01186
01187 if (cpGap->Strip<0) cout<<"Ahhhhh, bad strip="
01188 <<cpGap->Strip<<endl;
01189 PlexStripEndId seid
01190 (static_cast<Detector::Detector_t>(s.Detector),
01191 pl,cpGap->Strip,StripEnd::kWest);
01192
01193 if (!seid.IsValid()){
01194 interpError=true;
01195 MSG("MeuReco",Msg::kInfo)
01196 <<"Strip not valid: pl="<<pl<<", st="<<cpGap->Strip
01197 <<", view="<<sPv<<endl;
01198 seid.Print();
01199 break;
01200 }
01201
01202 UgliStripHandle ush=ugh.GetStripHandle(seid);
01203 Float_t halflen=ush.GetHalfLength();
01204 TVector3 localCenter(0,0,0);//centre of the "logical" strip
01205 TVector3 localEastEnd(-halflen,0,0);
01206 TVector3 localWestEnd(+halflen,0,0);
01207
01208 // calculate the positions in global XYZ space
01209 TVector3 xyzE = ush.LocalToGlobal(localEastEnd);
01210 TVector3 xyzW = ush.LocalToGlobal(localWestEnd);
01211 // calculate the positions in UVZ space
01212 TVector3 uvzE = ugh.xyz2uvz(xyzE);
01213 TVector3 uvzW = ugh.xyz2uvz(xyzW);
01214 //uvzE.Print();
01215 //uvzW.Print();
01216
01217 Float_t lposE=-999;
01218 Float_t lposW=-999;
01219 if (pv==PlaneView::kU){
01220 lposE=uvzE.Y();//in u-view strip lies along v=y in vector
01221 lposW=uvzW.Y();//therefore to get strip length need y
01222 }
01223 else if (pv==PlaneView::kV){
01224 lposE=uvzE.X();//in v-view strip lies along u=x in vector
01225 lposW=uvzW.X();//therefore to get strip length need x
01226 }
01227 else cout<<"ahhhhhhh"<<endl;
01228
01229 //work out min and max
01230 Float_t lmax=lposE;
01231 Float_t lmin=lposW;
01232 if (lposE<lposW){
01233 lmin=lposE;
01234 lmax=lposW;
01235 }
01236
01237 //ugh.GetZExtent(zmin,zmax);
01238 ugh.GetTransverseExtent(pv,tmin,tmax);
01239 MAXMSG("MeuReco",Msg::kVerbose,1000)
01240 <<"pl="<<pl<<", st="<<cpGap->Strip<<", view="<<sPv<<endl
01241 //<<"Got ZExtent, min="<<zmin<<", max="<<zmax<<endl
01242 <<"Got TransverseExtent, min="<<tmin<<", max="<<tmax<<endl
01243 <<"Got LongitudinalExtent, min="<<lmin<<", max="<<lmax<<endl;
01244
01245 //check that the interpolation did not go crazy
01246 if (tpos>lmax || tpos<lmin){
01247 Float_t lposToUse=lmax;
01248 if (tpos<0) lposToUse=lmin;
01249
01250 Float_t newLPos=tpos;
01251
01252 //check difference
01253 //20 cm shift in 6 cm is not too steep
01254 if (fabs(lposToUse-tpos)<20*Munits::cm) {
01255 //just cap the tpos value at slightly below min/max
01256 newLPos=lposToUse;
01257
01258 //now use the new tpos value
01259 if (cpGap) {
01260 //record result
01261 cpGap->LPos=newLPos;//note that setting LPos=TPos
01262 }
01263 else {
01264 MAXMSG("MeuReco",Msg::kWarning,1000)
01265 <<"Ahhhhh, not found a cp for after gap"<<endl;
01266 interpError=true;
01267 }
01268 }
01269 else{
01270 MAXMSG("MeuReco",logLevel,1000)
01271 <<endl<<"Interpolated out of the detector significantly"
01272 <<" for trk end plane"<<endl
01273 <<"LPos="<<tpos<<", not capping the value at "
01274 <<lposToUse<<endl
01275 <<"LongitudinalExtent: min="<<lmin<<", max="<<lmax<<endl;
01276 //don't cap it if it's this bad
01277 //newLPos=lposToUse;
01278 interpError=true;
01279 }
01280 }
01281 }
01282
01283 //last final check
01284 if (interpError){
01285 MAXMSG("MeuReco",logLevel,1000)
01286 <<"Couldn't fill LPos of track end planes"<<endl;
01287 }
01288
01289 return !interpError;//return true if all ok
01290 }
|
|
||||||||||||
|
Definition at line 755 of file MeuReco.cxx. References MeuHitInfo::Adc, MeuSummary::EndPlane, MAXMSG, MeuHitInfo::MCEnDep, MeuSummary::MCWinEnDep, MeuSummary::MCWinSigCor_MeV, MeuSummary::MCWinSigMap_MeV, MeuHitInfo::NumDigits, MeuHitInfo::NumStrips, MeuHitInfo::Pe, MeuHitInfo::PLCor, s(), MeuHitInfo::SigCor, MeuHitInfo::SigDrf, MeuHitInfo::SigLin, MeuHitInfo::SigLinOnly, MeuHitInfo::SigMap, MeuSummary::TotalMatTraversed, MeuSummary::VtxPlane, MeuSummary::WinAdc, MeuSummary::WinAvCosThetaZ, MeuSummary::WinAvNumDigits, MeuSummary::WinAvNumStrips, MeuSummary::WinAvPLCor, MeuSummary::WinPe, MeuSummary::WinSigCor, MeuSummary::WinSigDrf, MeuSummary::WinSigLin, MeuSummary::WinSigLinOnly, MeuSummary::WinSigMap, MeuSummary::WinStopSidePl, and MeuSummary::WinVtxSidePl. Referenced by CalcWindow(). 00757 {
00758 //variable to turn on all the useful messages if required
00759 Msg::LogLevel_t logLevel=Msg::kDebug;
00760
00761 MAXMSG("MeuReco",logLevel,1000)
00762 <<endl<<"CalcMEU: Get the MEU, track: "
00763 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00764
00765 //Float_t initValue=-999;
00766 Bool_t posDir=(s.EndPlane>s.VtxPlane);
00767 //static Int_t event=0;
00768 //event++;//for getting MC PLCor
00769
00770 Float_t meuSigLinOnly=0;
00771 Float_t meuSigDrf=0;
00772 Float_t meuAdc=0;
00773 Float_t meuPe=0;
00774 Float_t meuSigLin=0;
00775 Float_t meuSigCor=0;
00776 Float_t meuSigMap=0;
00777 Float_t meuNumDigits=0;
00778 Float_t meuNumStrips=0;
00779 Float_t meuEnDep=0;
00780 Float_t meuSigMap_MeV=0;
00781 Float_t meuSigCor_MeV=0;
00782 Float_t sigCorSum=0;
00783 Float_t sigMapSum=0;
00784 Float_t enDepSum=0;
00785 Float_t materialFromTrkEnd=0;
00786 Float_t materialInWindow=0;
00787 Int_t winCounter=0;
00788 Float_t avPLCor=0;
00789 Int_t winStopSidePl=-1;
00790 Int_t winVtxSidePl=-1;
00791 //const Float_t material01Pl=(2.5+1)*Munits::cm;
00792 const Float_t material01Pl=(5.94)*Munits::cm;//including air gap
00793 const Float_t material16Pl=16*material01Pl;//distance to trk end
00794 const Float_t material14Pl=14*material01Pl;//length of window
00795 MAXMSG("MeuReco",Msg::kInfo,1)
00796 <<endl<<"Using 14 pls material="<<material14Pl
00797 <<", 16 plns="<<material16Pl
00798 <<", 1 plns="<<material01Pl<<endl;
00799
00800 //calculate energy deposition in the window
00801 if (s.EndPlane>=0){
00802
00803 //get variables for loops
00804 //NOTE: start at the end of the track NOT the vtx
00805 Int_t pl=s.EndPlane;
00806 Int_t tmpVtxPlane=s.VtxPlane;
00807 if (posDir) tmpVtxPlane--;//make sure last plane is used
00808 else tmpVtxPlane++;
00809
00810 //loop over the track starting at the end
00811 while (pl!=tmpVtxPlane){
00812
00813 //cache the current cp
00814 MeuHitInfo& cp=plInfo[pl];
00815 Float_t PLCor=cp.PLCor;
00816 Float_t plMaterial=PLCor*material01Pl;
00817
00818 //sum up energy in window
00819 //require that the material from trk end is >16pl already
00820 //or when you include the current plane
00821 //ALSO check if already passed window
00822 if ((materialFromTrkEnd>material16Pl ||
00823 materialFromTrkEnd+plMaterial>material16Pl) &&
00824 materialInWindow<material14Pl){
00825
00826 //record the first plane included in window
00827 if (winStopSidePl<0) {
00828 winStopSidePl=pl;
00829 }
00830 winVtxSidePl=pl;//the last plane will be the last time called
00831
00832 //add the energy in this plane to the total
00833 materialInWindow+=plMaterial;
00834
00835 //sum the path length corrections
00836 avPLCor+=PLCor;
00837
00838 //sum the energy deposition in the window
00839 meuSigLinOnly+=cp.SigLinOnly/PLCor;
00840 meuSigDrf+=cp.SigDrf/PLCor;
00841 meuAdc+=cp.Adc/PLCor;
00842 meuPe+=cp.Pe/PLCor;
00843 meuSigLin+=cp.SigLin/PLCor;
00844 meuSigCor+=cp.SigCor/PLCor;
00845 meuSigMap+=cp.SigMap/PLCor;
00846 meuNumDigits+=cp.NumDigits;
00847 meuNumStrips+=cp.NumStrips;
00848
00849 if (cp.MCEnDep>0) meuEnDep+=cp.MCEnDep/PLCor;
00850
00851 sigCorSum+=cp.SigCor;
00852 sigMapSum+=cp.SigMap;
00853 enDepSum+=cp.MCEnDep;
00854 winCounter++;
00855 }
00856
00857 materialFromTrkEnd+=plMaterial;
00858
00859 MAXMSG("MeuReco",logLevel,1000)
00860 <<"plMat="<<plMaterial
00861 <<", matTrk="<<materialFromTrkEnd<<" (of "<<material16Pl<<")"
00862 <<", matWin="<<materialInWindow<<" (of "<<material14Pl<<")"
00863 <<endl
00864 <<"meuSigMap="<<meuSigMap<<", PLCor="<<PLCor<<endl;
00865
00866 //increment the plane
00867 if (posDir) pl--;//working backwards from end to vtx
00868 else pl++;
00869 }
00870 }
00871 else{
00872 MAXMSG("MeuReco",Msg::kWarning,1000)
00873 <<"Can't CalcMEU: fEndPlane="<<s.EndPlane
00874 <<", vtxPl="<<s.VtxPlane<<endl;
00875 }
00876
00877 //store the material traversed - do this for all events
00878 s.TotalMatTraversed=materialFromTrkEnd;
00879
00880 //if a window was completed
00881 if (materialInWindow>material14Pl){
00882
00883 if (winCounter>0){
00884 meuSigLinOnly/=winCounter;
00885 meuSigDrf/=winCounter;
00886 meuAdc/=winCounter;
00887 meuPe/=winCounter;
00888 meuSigLin/=winCounter;
00889 meuSigCor/=winCounter;
00890 meuSigMap/=winCounter;
00891 meuNumDigits/=winCounter;
00892 meuNumStrips/=winCounter;
00893 meuEnDep/=winCounter;
00894
00895 if (enDepSum>0){
00896 meuSigMap_MeV=sigMapSum/(enDepSum/Munits::MeV);
00897 meuSigCor_MeV=sigCorSum/(enDepSum/Munits::MeV);
00898 }
00899
00900 avPLCor/=winCounter;
00901
00902 //store the meu values
00903 s.WinSigLinOnly=meuSigLinOnly;
00904 s.WinSigDrf=meuSigDrf;
00905 s.WinAdc=meuAdc;
00906 s.WinPe=meuPe;
00907 s.WinSigLin=meuSigLin;
00908 s.WinSigCor=meuSigCor;
00909 s.WinSigMap=meuSigMap;
00910 s.WinAvNumDigits=meuNumDigits;
00911 s.WinAvNumStrips=meuNumStrips;
00912 s.MCWinEnDep=meuEnDep;
00913
00914 s.MCWinSigCor_MeV=meuSigCor_MeV;
00915 s.MCWinSigMap_MeV=meuSigMap_MeV;
00916
00917 //store others
00918 s.WinAvPLCor=avPLCor;
00919 s.WinAvCosThetaZ=1./s.WinAvPLCor;
00920 if (!posDir) s.WinAvCosThetaZ*=-1;//make it negative
00921 s.WinStopSidePl=winStopSidePl;
00922 s.WinVtxSidePl=winVtxSidePl;
00923 }
00924 }
00925 //else they just stay as the defaults
00926 }
|
|
||||||||||||
|
Definition at line 587 of file MeuReco.cxx. References MeuSummary::EndPlane, MAXMSG, MSG, MeuHitInfo::PLCor, s(), MeuSummary::VtxPlane, MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z. Referenced by Reconstruct(). 00589 {
00590 //variable to turn on all the useful messages if required
00591 Msg::LogLevel_t logLevel=Msg::kDebug;
00592 Msg::LogLevel_t logLevel2=Msg::kDebug;//for finding +/- planes
00593
00594 MAXMSG("MeuReco",logLevel,1000)
00595 <<endl<<"CalcPLCor: Get path length correction, track: "
00596 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00597
00598 Float_t initValue=-999;
00599 Bool_t posDir=(s.EndPlane>s.VtxPlane);
00600 static Int_t event=0;
00601 event++;//for getting MC PLCor
00602
00603 //get variables for loops
00604 Int_t pl=s.VtxPlane;
00605 Int_t tmpEndPlane=s.EndPlane;
00606 if (posDir) tmpEndPlane++;//make sure last plane is used
00607 else tmpEndPlane--;
00608
00609 //loop and determine PLCor in each plane
00610 while (pl!=tmpEndPlane){
00611 MAXMSG("MeuReco",Msg::kVerbose,1000)
00612 <<"pl="<<pl<<endl;
00613
00614 //cache the current cp
00615 MeuHitInfo& cp=plInfo[pl];
00616
00617 //first step is to determine the planes to use in determining PLCor
00618
00619 //work out the plane to use that is towards the track end
00620 Int_t nextPlane=pl;
00621 if (posDir) nextPlane+=2;
00622 else nextPlane-=2;
00623
00624 Bool_t beyondEndPlane=(nextPlane<s.EndPlane);
00625 if (posDir) beyondEndPlane=(nextPlane>s.EndPlane);
00626 if (beyondEndPlane) {
00627 MAXMSG("MeuReco",logLevel2,1000)
00628 <<"pl+2="<<nextPlane<<", gone beyond the end plane in track: "
00629 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00630
00631 //try looking only 1 plane further
00632 nextPlane=pl;
00633 if (posDir) nextPlane+=1;
00634 else nextPlane-=1;
00635 beyondEndPlane=(nextPlane<s.EndPlane);
00636 if (posDir) beyondEndPlane=(nextPlane>s.EndPlane);
00637
00638 if (beyondEndPlane) {
00639 MAXMSG("MeuReco",logLevel2,1000)
00640 <<"pl+1="<<nextPlane<<", gone beyond the end plane in track: "
00641 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00642 nextPlane=pl;//must be at one track end so just take pl
00643 }
00644 else{
00645 MAXMSG("MeuReco",logLevel2,1000)
00646 <<"pl+1="<<nextPlane<<", is ok for track: "
00647 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00648 }
00649 }
00650
00651 //work out the plane to use that is towards the track vtx
00652 Int_t prevPlane=pl;
00653 if (posDir) prevPlane-=2;
00654 else prevPlane+=2;
00655
00656 Bool_t beyondVtxPlane=(prevPlane>s.VtxPlane);
00657 if (posDir) beyondVtxPlane=(prevPlane<s.VtxPlane);
00658 if (beyondVtxPlane) {
00659 MAXMSG("MeuReco",logLevel2,1000)
00660 <<"pl+2="<<prevPlane<<", gone beyond the end plane in track: "
00661 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00662
00663 //try looking only 1 plane further
00664 prevPlane=pl;
00665 if (posDir) prevPlane-=1;
00666 else prevPlane+=1;
00667 beyondVtxPlane=(prevPlane>s.VtxPlane);
00668 if (posDir) beyondVtxPlane=(prevPlane<s.VtxPlane);
00669
00670 if (beyondVtxPlane) {
00671 MAXMSG("MeuReco",logLevel2,1000)
00672 <<"pl+1="<<prevPlane<<", gone beyond the end plane in track: "
00673 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00674 prevPlane=pl;//must be at one track end so just take pl
00675 }
00676 else{
00677 MAXMSG("MeuReco",logLevel2,1000)
00678 <<"pl+1="<<prevPlane<<", is ok for track: "
00679 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00680 }
00681 }
00682
00683 MAXMSG("MeuReco",logLevel2,1000)
00684 <<"For pl="<<pl<<" using planes: "<<prevPlane<<"->"<<nextPlane
00685 <<endl;
00686
00687 //second step is to create a TGraph of 3-5 planes and then
00688 //fit to a straight line
00689
00690 TGraph gx_z(3);//min of 3 points
00691 TGraph gy_z(3);
00692 Int_t tmpPl=prevPlane;
00693 Int_t tmpPlEnd=nextPlane-1;
00694 if (posDir) tmpPlEnd=nextPlane+1;
00695 Int_t i=0;
00696 //loop over planes to fit
00697 while (tmpPl!=tmpPlEnd){
00698 MeuHitInfo& tmpcp=plInfo[tmpPl];
00699
00700 Float_t x=tmpcp.X;
00701 Float_t y=tmpcp.Y;
00702 Float_t z=tmpcp.Z;
00703 gx_z.SetPoint(i,z,x);
00704 gy_z.SetPoint(i,z,y);
00705 MAXMSG("MeuReco",Msg::kVerbose,1000)
00706 <<"Adding points to graphs: x="<<x<<", y="<<y<<", z="<<z<<endl;
00707 //count the number of points added
00708 i++;
00709 //increment the plane
00710 if (posDir) tmpPl++;
00711 else tmpPl--;
00712 }
00713
00714 //calc the MC plcor if this is MC
00715 Double_t PLCorMC=-1;
00716 Double_t pathLength=-1;//=this->TrueMainPL(pl,event);
00717 if (pathLength>=0){//-1 if no MC
00718 static Double_t lastPL=1.3*Munits::cm;
00719 //make a best guess if a zero is returned
00720 if (pathLength<=0) pathLength=lastPL;
00721 lastPL=pathLength;
00722
00723 PLCorMC=pathLength/(0.95*Munits::cm);
00724 }
00725
00726 Float_t PLCor=initValue;
00727 if (i>=3){
00728 gx_z.Fit("pol1","q");
00729 gy_z.Fit("pol1","q");
00730 Float_t mx_z=gx_z.GetFunction("pol1")->GetParameter(1);
00731 Float_t my_z=gy_z.GetFunction("pol1")->GetParameter(1);
00732
00733 //calc plcor; don't need to worry about 0.95 since
00734 //it's already per unit z
00735 PLCor=sqrt(pow(mx_z,2)+pow(my_z,2)+1);
00736 MAXMSG("MeuReco",logLevel,1000)
00737 <<"pl="<<pl<<", reconstructed PLCor="<<PLCor
00738 <<", MC PLCor="<<PLCorMC
00739 <<endl;
00740 //set the value in cp
00741 cp.PLCor=PLCor;
00742 }
00743 else {
00744 MSG("MeuReco",Msg::kWarning)
00745 <<"Less than 3 points, can't do local grad. fit"<<endl;
00746 }
00747
00748 if (posDir) pl++;
00749 else pl--;
00750 }
00751 }
|
|
||||||||||||
|
Definition at line 187 of file MeuReco.cxx. References MAXMSG, s(), MeuHitInfo::TPos, and MeuHitInfo::Z. Referenced by Reconstruct(). 00188 {
00189 //assumes that tracks don't cross the SM boundary
00190
00191 MAXMSG("MeuReco",Msg::kDebug,1000)
00192 <<endl<<"CalcPosOfBigGaps: Trying to fill big gap"<<endl;
00193
00194 Float_t initValue=-999;
00195 Bool_t posDir=(s.EndPlane>s.VtxPlane);
00196 Bool_t allGapsFilled=true;
00197
00198 //get variables for loops
00199 Int_t pl=s.VtxPlane;
00200
00201 //loop and fill more difficult gaps
00202 //this loop finds a plane with a gap then looks along the track
00203 //until it finds a good tpos. It then combines the tpos before
00204 //the gap with the one after and interpolates between them
00205 while (pl!=s.EndPlane){
00206
00207 MAXMSG("MeuReco",Msg::kVerbose,10000)
00208 <<"pl="<<pl<<", track:"<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00209
00210 MeuHitInfo& cp=plInfo[pl];
00211 if (cp.TPos<=initValue) {
00212 //this can happen if the first but one plane is not hit
00213 MAXMSG("MeuReco",Msg::kDebug,1000)
00214 <<"plane="<<pl<<" has no tpos"
00215 <<", track:"<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00216 allGapsFilled=false;
00217 if (posDir) pl++;
00218 else pl--;
00219 continue;
00220 }
00221
00222 //work out next plane to check and make sure in track
00223 Int_t nextPlane=pl;
00224 if (posDir) nextPlane+=2;
00225 else nextPlane-=2;
00226 Bool_t beyondEndPlane=(nextPlane<s.EndPlane);
00227 if (posDir) beyondEndPlane=(nextPlane>s.EndPlane);
00228 if (beyondEndPlane) {
00229 MAXMSG("MeuReco",Msg::kDebug,1000)
00230 <<"Reached end of track. nextPlane="<<nextPlane
00231 <<", track:"<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00232 break;
00233 }
00234
00235 MeuHitInfo* cpGap=&plInfo[nextPlane];
00236 MeuHitInfo* cpAfterGap=0;
00237
00238 //check if next plane is a gap
00239 if (cpGap->TPos<=initValue){
00240
00241 MAXMSG("MeuReco",Msg::kDebug,1000)
00242 <<"Found a big gap in plane="<<nextPlane<<endl;
00243
00244 Bool_t foundGoodTPos=false;
00245
00246 //now find plane after gap with good tpos
00247 for (Int_t iteration=0;iteration<100000;iteration++){
00248 if (posDir) nextPlane+=2;
00249 else nextPlane-=2;
00250
00251 Bool_t beyondEndPlane=(nextPlane<s.EndPlane);
00252 if (posDir) beyondEndPlane=(nextPlane>s.EndPlane);
00253 if (beyondEndPlane) {
00254 //this can happen if the last but one plane is not hit
00255 MAXMSG("MeuReco",Msg::kDebug,1000)
00256 <<"Iterated beyond the end plane in track:"
00257 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00258 allGapsFilled=false;
00259 break;
00260 }
00261
00262 //cache the calibPos
00263 cpAfterGap=&plInfo[nextPlane];
00264 if (cpAfterGap->TPos<=initValue) {
00265 MAXMSG("MeuReco",Msg::kDebug,1000)
00266 <<"Found another gap on iteration="<<iteration
00267 <<", in plane="<<nextPlane<<endl;
00268 continue;
00269 }
00270 else{
00271 MAXMSG("MeuReco",Msg::kDebug,1000)
00272 <<"Found next plane with good tpos, pl="<<nextPlane
00273 <<", iteration="<<iteration<<endl;
00274 foundGoodTPos=true;
00275 break;
00276 }
00277 }
00278
00279 if (foundGoodTPos){
00280 //do interpolation
00281 //define m=x1_2/y1_2 = x1-x2/y1-y2
00282 //(x and y are what is required)
00283 //define x=tpos, y=z
00284 MeuHitInfo& cp1=cp;
00285 MeuHitInfo& cp2=*cpAfterGap;
00286 Float_t m=(cp1.TPos-cp2.TPos)/(cp1.Z-cp2.Z);
00287 //Double_t x=(y-y2)*m+x2;// give above formula for m
00288 Float_t tpos=(cpGap->Z-cp2.Z)*m+cp2.TPos;
00289 if (cpGap) cpGap->TPos=tpos;
00290 else {
00291 MAXMSG("MeuReco",Msg::kWarning,1000)
00292 <<"Ahhhhh, not found a cp for after gap"<<endl;
00293 allGapsFilled=false;
00294 }
00295
00296 MAXMSG("MeuReco",Msg::kDebug,1000)
00297 <<"Doing interpolation:"<<endl
00298 <<"Point1: tpos="<<cp1.TPos<<", z="<<cp1.Z<<endl
00299 <<" gap sizes: ="<<cp1.TPos-cpGap->TPos
00300 <<", z="<<cp1.Z-cpGap->Z<<endl
00301 <<"Interp point: tpos="<<cpGap->TPos<<", z="<<cpGap->Z<<endl
00302 <<" gap sizes: ="<<cpGap->TPos-cp2.TPos
00303 <<", ="<<cpGap->Z-cp2.Z<<endl
00304 <<"Point2: tpos="<<cp2.TPos<<", z="<<cp2.Z<<endl
00305 <<endl;
00306
00307 //Double_t m=(*ph-*(ph-1))/(*adc-*(adc-1));
00308 //interpPh=this->Interpolate(reqAdc,*adc,m,*ph);
00309 //Interpolate(Double_t y,Double_t y2,Double_t m,Double_t x2)
00310 //interpolation formula
00311 //Double_t x=(y-y2)*m+x2;
00312 }
00313 }
00314 else {
00315 MAXMSG("MeuReco",Msg::kDebug,5000)
00316 <<"Big gap search: no gap in plane="<<nextPlane<<endl;
00317 }
00318
00319 if (posDir) pl++;
00320 else pl--;
00321 }
00322
00323 MAXMSG("MeuReco",Msg::kDebug,5000)
00324 <<"CalcPosOfBigGaps: End of big gap search"<<endl<<endl;
00325 return allGapsFilled;
00326 }
|
|
||||||||||||
|
Definition at line 60 of file MeuReco.cxx. References UgliPlnHandle::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliPlnHandle::GetZ0(), MAXMSG, MeuHitInfo::Plane, s(), MeuHitInfo::TPos, MeuHitInfo::View, and MeuHitInfo::Z. Referenced by Reconstruct(). 00061 {
00062 //assumes that tracks don't cross the SM boundary
00063
00064 //variable to turn on all the useful messages if required
00065 Msg::LogLevel_t logLevel=Msg::kDebug;
00066
00067 MAXMSG("MeuReco",logLevel,1000)
00068 <<endl<<"CalcPosOfGaps: Trying to fill gaps"
00069 <<", track:"<<s.VtxPlane<<"->"<<s.EndPlane
00070 <<", minPlane2="<<s.MinPlane2<<", maxPlane2="<<s.MaxPlane2
00071 <<", minPlane3="<<s.MinPlane3<<", maxPlane3="<<s.MaxPlane3
00072 <<endl;
00073
00074 Float_t initValue=-999;
00075 Bool_t posDir=(s.EndPlane>s.VtxPlane);
00076 Bool_t allGapsFilled=true;
00077
00078 //get variables for loops
00079 Int_t pl=s.VtxPlane;
00080 Int_t tmpEndPlane=s.EndPlane;
00081 if (posDir) tmpEndPlane+=1;//add 1 so loop uses end plane
00082 else tmpEndPlane-=1;
00083
00084 //first loop:
00085 //recalculate all z's as well as set plane numbers in gaps
00086 while (pl!=tmpEndPlane){
00087
00088 MeuHitInfo& cp=plInfo[pl];
00089
00090 MAXMSG("MeuReco",logLevel,1000)
00091 <<"first: pl="<<cp.Plane<<", cp.z="<<cp.Z
00092 <<endl;
00093
00094 //recalculate all the z positions! (saw difference in csh)
00095 VldTimeStamp vldts;
00096 //VldTimeStamp vldts(ev.UnixTime,0);
00097 VldContext vc
00098 (static_cast<Detector::Detector_t>(s.Detector),
00099 static_cast<SimFlag::ESimFlag>(s.SimFlag),vldts);
00100 //get the ugh
00101 UgliGeomHandle ugh(vc);
00102 PlexPlaneId plidScint
00103 (static_cast<Detector::Detector_t>(s.Detector),pl);
00104 Float_t zScint=ugh.GetScintPlnHandle(plidScint).GetZ0();
00105 MAXMSG("MeuReco",logLevel,1000)
00106 <<", zScint="<<zScint<<endl;
00107 //ugh-csh=0.0141 - what is this difference???
00108 cp.Z=zScint;
00109 //set the plane (wont already be set in a gap)
00110 cp.Plane=pl;
00111
00112 //now get the view
00113 PlaneView::PlaneView_t pv=PlaneView::kUnknown;
00114 pv=ugh.GetScintPlnHandle(plidScint).GetPlaneView();
00115 cp.View=pv;
00116
00117 if (posDir) pl++;
00118 else pl--;
00119 }
00120
00121 MAXMSG("MeuReco",logLevel,1000)
00122 <<"CalcPosOfGaps: second loop"<<endl;
00123
00127 //second loop:
00128 //get variables for loops
00129 pl=s.VtxPlane;
00130 if (posDir) pl+=2;
00131 else pl-=2;
00132 tmpEndPlane=s.EndPlane;
00133 if (posDir) tmpEndPlane-=1;//use 1 so loop uses to end-2 plane
00134 else tmpEndPlane+=1;
00135
00136 //loop over n-4 planes in track looking for gaps to fill
00137 //only fill the simple 1-plane gaps
00138 while (pl!=tmpEndPlane){
00139 MeuHitInfo& cp=plInfo[pl];
00140
00141 if (cp.TPos<=initValue) {
00142 //cache the adjacent calibPos
00143 MeuHitInfo& cpA=plInfo[pl+2];
00144 MeuHitInfo& cpB=plInfo[pl-2];
00145
00146 if (cpA.TPos<=initValue || cpB.TPos<=initValue) {
00147 MAXMSG("MeuReco",Msg::kVerbose,1000)
00148 <<"Gap too big to fill by simple average of neighbours, pl="
00149 <<cp.Plane<<endl;
00150 allGapsFilled=false;
00151 }
00152 else{
00153 Float_t avTPos=(cpA.TPos+cpB.TPos)*0.5;
00154 cp.TPos=avTPos;
00155 }
00156 }
00157
00158 if (posDir) pl++;
00159 else pl--;
00160 }
00161
00162 //have to check if there is a gap just in from track edges
00163 //since the above loop skips the outside edge 2 planes
00164 //determine the planes in which a gap would appear
00165 Int_t plNearVtx=s.VtxPlane-1;
00166 if (posDir) plNearVtx=s.VtxPlane+1;
00167 Int_t plNearEnd=s.EndPlane+1;
00168 if (posDir) plNearEnd=s.EndPlane-1;
00169
00170 //find out what gaps are present
00171 Bool_t foundVtxGap=false;
00172 if (plInfo[plNearVtx].TPos<=initValue){
00173 foundVtxGap=true;
00174 }
00175 Bool_t foundEndGap=false;
00176 if (plInfo[plNearEnd].TPos<=initValue){
00177 foundEndGap=true;
00178 }
00179 if (foundVtxGap || foundEndGap) allGapsFilled=false;
00180
00181 return allGapsFilled;
00182 }
|
|
||||||||||||
|
Definition at line 331 of file MeuReco.cxx. References UgliPlnHandle::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliGeomHandle::GetTransverseExtent(), MeuHitInfo::LPos, MAXMSG, MeuHitInfo::Plane, s(), MeuHitInfo::SigCor, MeuHitInfo::Strip, MeuHitInfo::TPos, MeuHitInfo::View, and MeuHitInfo::Z. Referenced by Reconstruct(). 00332 {
00333 //assumes that tracks don't cross the SM boundary
00334 //also assumes that the track is long enough that there are
00335 //at least two good planes in each view between the track centre
00336 //and the two ends.
00337
00338 //variable to turn on all the useful messages if required
00339 Msg::LogLevel_t logLevel=Msg::kDebug;
00340
00341 MAXMSG("MeuReco",logLevel,1000)
00342 <<endl<<"CalcPosOfTrkEndGaps: Trying to fill trk end gap"
00343 <<", track:"<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00344
00345 Float_t initValue=-999;
00346 Bool_t posDir=(s.EndPlane>s.VtxPlane);
00347 Bool_t allGapsFilled=true;
00348
00349 //determine the planes in which a gap would appear
00350 Int_t plNearVtx=s.VtxPlane-1;
00351 if (posDir) plNearVtx=s.VtxPlane+1;
00352 Int_t plNearEnd=s.EndPlane+1;
00353 if (posDir) plNearEnd=s.EndPlane-1;
00354
00355 //find out what gaps are present
00356 Bool_t foundVtxGap=false;
00357 if (plInfo[plNearVtx].TPos<=initValue){
00358 foundVtxGap=true;
00359 }
00360 Bool_t foundEndGap=false;
00361 if (plInfo[plNearEnd].TPos<=initValue){
00362 foundEndGap=true;
00363 }
00364
00365 MAXMSG("MeuReco",logLevel,1000)
00366 <<"foundVtxGap="<<foundVtxGap<<", plNearVtx="<<plNearVtx<<endl
00367 <<"foundEndGap="<<foundEndGap<<", plNearEnd="<<plNearEnd<<endl;
00368
00369 //loop twice:
00370 //first time moving forwards to the end from the middle
00371 //second time moving backwards to the vtx from the middle
00372 for (Int_t i=0;i<2;i++){
00373 Bool_t movingTowardsEnd=true;
00374 if (i==1) movingTowardsEnd=false;
00375
00376 //check if a gap exists at each end
00377 if (movingTowardsEnd){
00378 if (!foundEndGap) {
00379 MAXMSG("MeuReco",logLevel,1000)
00380 <<"No gap at end of track, so not entering loop"<<endl;
00381 continue;
00382 }
00383 }
00384 else{
00385 if (!foundVtxGap) {
00386 MAXMSG("MeuReco",logLevel,1000)
00387 <<"No gap at vtx of track, so not entering loop"<<endl;
00388 continue;
00389 }
00390 }
00391
00392 MeuHitInfo* cpA=0;
00393 MeuHitInfo* cpB=0;
00394
00395 //start in the middle of the event
00396 Int_t pl=(s.VtxPlane+s.EndPlane)/2;
00397 //make sure that the pl starts in the right view
00398 if (!movingTowardsEnd){
00399 if (pl%2!=plNearVtx%2) pl++;
00400 }
00401 else{
00402 if (pl%2!=plNearEnd%2) pl++;
00403 }
00404
00405 //calc the planes beyond the track ends so loop stops in right
00406 //place
00407 Int_t plBeyondEnd=plNearEnd-2;
00408 if (posDir) plBeyondEnd=plNearEnd+2;
00409 Int_t plBeyondVtx=plNearVtx+2;
00410 if (posDir) plBeyondVtx=plNearVtx-2;
00411
00412 Int_t lastLoopPlane=plBeyondEnd;
00413 if (!movingTowardsEnd) lastLoopPlane=plBeyondVtx;
00414
00415 MAXMSG("MeuReco",logLevel,1000)
00416 <<"Starting on pl="<<pl
00417 <<" and working towards pl="<<lastLoopPlane
00418 <<", movingTowardsEnd="<<movingTowardsEnd<<endl;
00419
00420 //loop and fill more difficult gaps
00421 //move towards end plane from middle first
00422 while (pl!=lastLoopPlane){
00423
00424 MAXMSG("MeuReco",logLevel,1000)
00425 <<"CalcPosOfTrkEndGaps: pl="<<pl
00426 <<", track:"<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
00427
00428 MeuHitInfo* cp=&plInfo[pl];
00429 if (cp->TPos<=initValue){
00430 MAXMSG("MeuReco",logLevel,1000)
00431 <<"Found gap at pl="<<pl<<endl;
00432 allGapsFilled=false;
00433
00434 //if there are two good tpos then can interpolate
00435 if (cpA!=0 && cpB!=0){
00436
00437 //do interpolation
00438 //define m=x1_2/y1_2 = x1-x2/y1-y2
00439 //(x and y are what is required)
00440 //define x=tpos, y=z
00441 MeuHitInfo& cp1=*cpA;
00442 MeuHitInfo& cp2=*cpB;
00443 MeuHitInfo* cpGap=cp;
00444 Float_t m=(cp1.TPos-cp2.TPos)/(cp1.Z-cp2.Z);
00445 //Double_t x=(y-y2)*m+x2;// give above formula for m
00446 Float_t tpos=(cpGap->Z-cp2.Z)*m+cp2.TPos;
00447 if (cpGap) {
00448 cpGap->TPos=tpos;
00449 //record result
00450 allGapsFilled=true;
00451 }
00452 else {
00453 MAXMSG("MeuReco",Msg::kWarning,1000)
00454 <<"Ahhhhh, not found a cp for after gap"<<endl;
00455 allGapsFilled=false;
00456 }
00457
00458 MAXMSG("MeuReco",logLevel,1000)
00459 <<"Doing interpolation:"<<endl
00460 <<"Point1: tpos="<<cp1.TPos<<", z="<<cp1.Z<<endl
00461 <<" gap sizes: ="<<cp1.TPos-cpGap->TPos
00462 <<", z="<<cp1.Z-cpGap->Z<<endl
00463 <<"Interp point: tpos="<<cpGap->TPos
00464 <<", z="<<cpGap->Z<<endl
00465 <<" gap sizes: ="<<cpGap->TPos-cp2.TPos
00466 <<", ="<<cpGap->Z-cp2.Z<<endl
00467 <<"Point2: tpos="<<cp2.TPos<<", z="<<cp2.Z<<endl
00468 <<endl;
00469
00470 VldTimeStamp vldts;
00471 //VldTimeStamp vldts(ev.UnixTime,0);
00472 VldContext vc
00473 (static_cast<Detector::Detector_t>(s.Detector),
00474 static_cast<SimFlag::ESimFlag>(s.SimFlag),vldts);
00475 //get the ugh
00476 UgliGeomHandle ugh(vc);
00477 //Float_t zmin=-1;
00478 //Float_t zmax=-1;
00479 Float_t tmin=-1;
00480 Float_t tmax=-1;
00481 PlexPlaneId plidScint
00482 (static_cast<Detector::Detector_t>(s.Detector),
00483 pl);
00484 PlaneView::PlaneView_t pv=PlaneView::kUnknown;
00485 pv=ugh.GetScintPlnHandle(plidScint).GetPlaneView();
00486 string sPv="";//PlaneView::AsString(pv);
00487 //ugh.GetZExtent(zmin,zmax);
00488 ugh.GetTransverseExtent(pv,tmin,tmax);
00489 MAXMSG("MeuReco",Msg::kVerbose,1000)
00490 <<"pl="<<pl<<", view="<<sPv<<endl
00491 //<<"Got ZExtent, min="<<zmin<<", max="<<zmax<<endl
00492 <<"Got TransverseExtent, min="<<tmin<<", max="<<tmax<<endl;
00493
00494 if (tpos>tmax || tpos<tmin){
00495 Float_t tposToUse=tmax;
00496 if (tpos<0) tposToUse=tmin;
00497
00498 MAXMSG("MeuReco",logLevel,1000)
00499 <<endl<<"Interpolated out of the detector: tpos="<<tpos
00500 <<", capping the value at "<<tposToUse<<endl
00501 <<"TransverseExtent: min="<<tmin<<", max="<<tmax
00502 <<endl;
00503
00504 cpGap->TPos=tposToUse;
00505 allGapsFilled=true;
00506 }
00507 }
00508 }
00509 else{//use this as a tpos
00510 MAXMSG("MeuReco",logLevel,1000)
00511 <<"Found good tpos in plane="<<pl<<endl;
00512 cpB=cpA;//overwrite previous cpB with later one
00513 cpA=cp;
00514 }
00515
00516 if (movingTowardsEnd) {
00517 //forwards loop
00518 if (posDir) pl+=2;//move to next in view
00519 else pl-=2;
00520 }
00521 else{
00522 //backwards loop
00523 if (posDir) pl-=2;//move to next in view
00524 else pl+=2;
00525 }
00526 }
00527 }
00528
00529 Bool_t warningUnfilledGaps=false;
00530
00531 if (!allGapsFilled) {
00532 MAXMSG("MeuReco",Msg::kDebug,1000)
00533 <<"Failed to fill all gaps"<<endl;
00534 }
00535 else{//loop and check all gaps were indeed filled
00536 //get variables for loops
00537 Int_t pl=s.VtxPlane;
00538 Int_t tmpEndPlane=s.EndPlane;
00539 if (posDir) tmpEndPlane+=1;//add 1 so loop uses end plane
00540 else tmpEndPlane-=1;
00541
00542 //first loop:
00543 //recalculate all z's as well as set plane numbers in gaps
00544 while (pl!=tmpEndPlane){
00545 MeuHitInfo& cp=plInfo[pl];
00546 if (cp.TPos<=initValue){
00547 MAXMSG("MeuReco",Msg::kWarning,20)
00548 <<endl<<endl<<"**** Found unfilled gap! ****"<<endl<<endl;
00549 warningUnfilledGaps=true;
00550 allGapsFilled=false;
00551 }
00552
00553 if (posDir) pl++;
00554 else pl--;
00555 }
00556 }
00557
00558 if (warningUnfilledGaps){
00559 MAXMSG("MeuReco",Msg::kInfo,20)
00560 <<"Event="<<s.Event<<", run="<<s.Run<<", fSnarl="<<s.Snarl
00561 <<endl;
00562 Int_t pl=s.VtxPlane;
00563 Int_t tmpEndPlane=s.EndPlane;
00564 if (posDir) tmpEndPlane+=1;//add 1 so loop uses end plane
00565 else tmpEndPlane-=1;
00566
00567 //print out plane gap info
00568 while (pl!=tmpEndPlane){
00569 MeuHitInfo& cp=plInfo[pl];
00570 MAXMSG("MeuReco",Msg::kInfo,100)
00571 <<"pl="<<cp.Plane<<", st="<<cp.Strip<<", view="<<cp.View
00572 <<", sigCor="<<cp.SigCor
00573 <<", t="<<cp.TPos<<", l="<<cp.LPos<<endl;
00574
00575 if (posDir) pl++;
00576 else pl--;
00577 }
00578 }
00579
00580 MAXMSG("MeuReco",logLevel,1000)
00581 <<"CalcPosOfTrkEndGaps: End of trk end gap search"<<endl;
00582 return allGapsFilled;
00583 }
|
|
|
Definition at line 1730 of file MeuReco.cxx. References PlaneOutline::DistanceToEdge(), PlaneOutline::IsInside(), MAXMSG, MeuHitInfo::X, and MeuHitInfo::Y. Referenced by MeuAnalysis::N_1Plots(). 01731 {
01732 //Deep containment is defined as being within the overlap of
01733 //all different plane coverages
01734
01735 Float_t distUPI=0;
01736 Float_t distVPI=0;
01737 Float_t distUFI=0;
01738 Float_t distVFI=0;
01739 Float_t xedge=0;
01740 Float_t yedge=0;
01741
01742 PlaneOutline po;
01743
01744 //calc for U-view partial
01745 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kU,
01746 PlaneCoverage::kNearPartial,
01747 distUPI,xedge,yedge);
01748 Bool_t isInsideUPI=po.IsInside(cp.X,cp.Y,PlaneView::kU,
01749 PlaneCoverage::kNearPartial);
01750
01751 //calc for U-view full
01752 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kU,
01753 PlaneCoverage::kNearFull,
01754 distUFI,xedge,yedge);
01755 Bool_t isInsideUFI=po.IsInside(cp.X,cp.Y,PlaneView::kU,
01756 PlaneCoverage::kNearFull);
01757
01758 //calc for V-view partial
01759 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kV,
01760 PlaneCoverage::kNearPartial,
01761 distVPI,xedge,yedge);
01762 Bool_t isInsideVPI=po.IsInside(cp.X,cp.Y,PlaneView::kV,
01763 PlaneCoverage::kNearPartial);
01764
01765 //calc for V-view full
01766 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kV,
01767 PlaneCoverage::kNearFull,
01768 distVFI,xedge,yedge);
01769 Bool_t isInsideVFI=po.IsInside(cp.X,cp.Y,PlaneView::kV,
01770 PlaneCoverage::kNearFull);
01771
01772 //check that hit has "deep" containment and find
01773 //the closest distance to the edge of the combined overlap region
01774 Float_t smallestDist=999;
01775 if (isInsideUPI && isInsideUFI && isInsideVPI && isInsideVFI){
01776 if (smallestDist>distUPI) smallestDist=distUPI;
01777 if (smallestDist>distUFI) smallestDist=distUFI;
01778 if (smallestDist>distVPI) smallestDist=distVPI;
01779 if (smallestDist>distVFI) smallestDist=distVFI;
01780 }
01781
01782 //if not deeply contained then find the closest distance
01783 //to the combined overlap region
01784 //this is actually the furthest distance!
01785 if (smallestDist==999) {
01786 smallestDist=0;
01787 if (smallestDist<distUPI && !isInsideUPI) smallestDist=distUPI;
01788 if (smallestDist<distUFI && !isInsideUFI) smallestDist=distUFI;
01789 if (smallestDist<distVPI && !isInsideVPI) smallestDist=distVPI;
01790 if (smallestDist<distVFI && !isInsideVFI) smallestDist=distVFI;
01791
01792 //make the distance negative for hits outside deep containment
01793 smallestDist*=-1;
01794 }
01795
01796 if (smallestDist==999) cout<<"Ahhhhhhh"<<endl;
01797
01798 MAXMSG("MeuReco",Msg::kDebug,500)
01799 <<"smallestDist="<<smallestDist
01800 <<", UPI="<<distUPI<<" (in="<<isInsideUPI<<")"
01801 <<", UFI="<<distUFI<<" (in="<<isInsideUFI<<")"
01802 <<", VPI="<<distVPI<<" (in="<<isInsideVPI<<")"
01803 <<", VFI="<<distVFI<<" (in="<<isInsideVFI<<")"<<endl;
01804
01805 return smallestDist;
01806 }
|
|
||||||||||||
|
Definition at line 1295 of file MeuReco.cxx. References UgliStripHandle::ClearFiber(), MeuHitInfo::DistToStripCentre, UgliStripHandle::GetHalfLength(), UgliPlnHandle::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliGeomHandle::GetStripHandle(), UgliStripHandle::GetTPos(), UgliStripHandle::GlobalToLocal(), MeuHitInfo::LPos, MAXMSG, MSG, MeuHitInfo::Plane, s(), MeuHitInfo::Strip, MeuHitInfo::StripBestGuess, MeuHitInfo::StripClearFibre1, MeuHitInfo::StripClearFibre2, MeuHitInfo::StripHalfLength, MeuHitInfo::StripPigtail1, MeuHitInfo::StripPigtail2, MeuHitInfo::TPos, UgliStripHandle::WlsPigtail(), MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z. Referenced by MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), and MeuAnalysis::SpillPlots(). 01296 {
01297 //variable to turn on all the useful messages if required
01298 Msg::LogLevel_t logLevel=Msg::kDebug;
01299
01300 MAXMSG("MeuReco",logLevel,1000)
01301 <<endl<<"CalcStripDists: Get position along strip, track: "
01302 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
01303
01304 VldTimeStamp vldts;
01305 //VldTimeStamp vldts(ev.UnixTime,0);
01306 VldContext vc
01307 (static_cast<Detector::Detector_t>(s.Detector),
01308 static_cast<SimFlag::ESimFlag>(s.SimFlag),vldts);
01309 //get the ugh
01310 UgliGeomHandle ugh(vc);
01311
01312 typedef map<Int_t,MeuHitInfo>::iterator cpIt;
01313 for (cpIt it=plInfo.begin();it!=plInfo.end();++it){
01314
01315 MeuHitInfo& cp=it->second;
01316 Int_t pl=cp.Plane;
01317
01318 PlexPlaneId plidScint
01319 (static_cast<Detector::Detector_t>(s.Detector),pl);
01320 PlaneView::PlaneView_t pv=PlaneView::kUnknown;
01321 pv=ugh.GetScintPlnHandle(plidScint).GetPlaneView();
01322 string sPv="";//PlaneView::AsString(pv);
01323
01324 //work out the strip from u,v coord.
01325 Int_t strip=ugh.GetScintPlnHandle(plidScint).
01326 GetClosestStrip(cp.TPos,cp.LPos).GetSEId().GetStrip();
01327 //UgliStripHandle GetClosestStrip (tpos,orthCoord=9999.)
01328 if (cp.Strip>=0 && cp.Strip!=strip) {
01329 PlexStripEndId seidW
01330 (static_cast<Detector::Detector_t>(s.Detector),
01331 pl,strip,StripEnd::kWest);
01332 PlexStripEndId seidWOrig
01333 (static_cast<Detector::Detector_t>(s.Detector),
01334 pl,cp.Strip,StripEnd::kWest);
01335
01336 MAXMSG("MeuReco",Msg::kInfo,5)
01337 <<"Weird strip: orig="<<cp.Strip
01338 <<", ugli="<<strip
01339 <<", ugli2="<<ugh.GetScintPlnHandle(plidScint).
01340 GetClosestStrip(cp.TPos).GetSEId().GetStrip()
01341 <<", pl="<<pl<<endl
01342 <<"tposOrig="<<ugh.GetStripHandle(seidWOrig).GetTPos()
01343 <<", tposNew="<<ugh.GetStripHandle(seidW).GetTPos()
01344 <<", tposNtp="<<cp.TPos<<endl;
01345 strip=cp.Strip;//use the original for now
01346 }
01347
01348 //set the best guess strip
01349 cp.StripBestGuess=strip;
01350
01351 PlexStripEndId seidW
01352 (static_cast<Detector::Detector_t>(s.Detector),
01353 pl,strip,StripEnd::kWest);
01354
01355 MAXMSG("MeuReco",Msg::kDebug,100)
01356 <<"pl="<<pl<<", st="<<strip<<endl;
01357
01358 if (!seidW.IsValid()){//only west because of ND
01359 MSG("MeuReco",Msg::kError)
01360 <<"Strip not valid: pl="<<pl<<", st="<<strip
01361 <<", view="<<sPv<<endl;
01362 seidW.Print();
01363 break;
01364 }
01365
01366 //set some of the strip's variables
01367 UgliStripHandle ushW=ugh.GetStripHandle(seidW);
01368 cp.StripHalfLength=ushW.GetHalfLength();
01369 cp.StripClearFibre2=ushW.ClearFiber(StripEnd::kWest);
01370 cp.StripPigtail2=ushW.WlsPigtail(StripEnd::kWest);
01371
01372 if (s.Detector!=Detector::kNear){
01373 PlexStripEndId seidE
01374 (static_cast<Detector::Detector_t>(s.Detector),
01375 pl,strip,StripEnd::kEast);
01376 UgliStripHandle ushE=ugh.GetStripHandle(seidE);
01377 cp.StripClearFibre1=ushE.ClearFiber(StripEnd::kEast);
01378 cp.StripPigtail1=ushE.WlsPigtail(StripEnd::kEast);
01379 }
01380
01381 //get the distance to the strip centre
01382 TVector3 xyz(cp.X,cp.Y,cp.Z);
01383 //static Int_t i=0;
01384 //++i;
01385 //if (i<200) xyz.Print();
01386 TVector3 localPos=ushW.GlobalToLocal(xyz);
01387 //if (i<200) localPos.Print();
01388 cp.DistToStripCentre=localPos.X();
01389
01390 //TVector3 localCenter(0,0,0);//centre of the "logical" strip
01391 //TVector3 localEastEnd(-halflen,0,0);
01392 //TVector3 localWestEnd(+halflen,0,0);
01393
01394 // calculate the positions in global XYZ space
01395 //TVector3 xyzE = ush.LocalToGlobal(localEastEnd);
01396 //TVector3 xyzW = ush.LocalToGlobal(localWestEnd);
01397 // calculate the positions in UVZ space
01398 //TVector3 uvzE = ugh.xyz2uvz(xyzE);
01399 //TVector3 uvzW = ugh.xyz2uvz(xyzW);
01400 //uvzE.Print();
01401 //uvzW.Print();
01402 }
01403 }
|
|
||||||||||||||||||||
|
Definition at line 2180 of file MeuReco.cxx. References MuELoss::e, MAXMSG, s(), MeuHitInfo::Strip, MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z. Referenced by MeuAnalysis::MakeSummaryTreeWithAtNu(), and MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(). 02182 {
02183 if (s.Detector!=Detector::kFar) {
02184 MAXMSG("MeuReco",Msg::kInfo,1)
02185 <<"Not calculating trace for detector="<<s.Detector
02186 <<", only implemented for FD"<<endl;
02187 return true;
02188 }
02189
02190 //variable to turn on all the useful messages if required
02191 Msg::LogLevel_t logLevel=Msg::kDebug;
02192
02193 MAXMSG("MeuReco",logLevel,50)
02194 <<endl<<"CalcTrace: Get position along strip, track: "
02195 <<s.VtxPlane<<"->"<<s.EndPlane<<endl;
02196
02197 Bool_t posDir=(s.EndPlane>s.VtxPlane);
02198
02199 Int_t pl=s.EndPlane;
02200 if (posDir) pl-=5;//step back 5 if pos direction
02201 else pl+=5;
02202
02203 const MeuHitInfo& cpEnd=plInfo.find(s.EndPlane)->second;
02204 const MeuHitInfo* tmpcp=&(plInfo.find(pl)->second);
02205
02206 if (tmpcp->Strip<0){
02207 MAXMSG("MeuReco",Msg::kDebug,100)
02208 <<"Can't find strip for this plane="<<pl
02209 <<", strip="<<tmpcp->Strip
02210 <<", trk: "<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
02211
02212 if (posDir) pl--;//step back another plane if pos direction
02213 else pl++;
02214 tmpcp=&(plInfo.find(pl)->second);
02215
02216 if (tmpcp->Strip<0){
02217 MAXMSG("MeuReco",Msg::kDebug,1000)
02218 <<"Can't find strip (again) for this plane="<<pl
02219 <<", strip="<<tmpcp->Strip
02220 <<", trk: "<<s.VtxPlane<<"->"<<s.EndPlane<<endl;
02221
02222 if (posDir) pl--;//step back another plane if pos direction
02223 else pl++;
02224 tmpcp=&(plInfo.find(pl)->second);
02225
02226 if (tmpcp->Strip<0){
02227 MAXMSG("MeuReco",logLevel,100)
02228 <<"Can't find strip (again2) for this plane="<<pl
02229 <<", strip="<<tmpcp->Strip
02230 <<", trk: "<<s.VtxPlane<<"->"<<s.EndPlane<<endl
02231 <<"Given up looking... and returned false"<<endl;
02232 return false;
02233 }
02234 }
02235 MAXMSG("MeuReco",Msg::kDebug,10)
02236 <<"Found pl="<<pl<<", strip="<<tmpcp->Strip<<endl;
02237 }
02238
02239 //get a reference to the calibpos pl5
02240 const MeuHitInfo& cp=*tmpcp;
02241
02242 static vector<TVector3> va;
02243 static vector<TVector3> vb;
02244 static vector<TVector3> vc;
02245
02246 //initialise all the vectors if they are not already
02247 if (va.size()==0){
02249 //get the points on the planes
02251
02252 //get the points on the 8 detector sides (of the octagon)
02253 va.push_back(TVector3( 0, 4 ,0));//top 0 or 12 o'clock
02254 va.push_back(TVector3(-4, 1.66,0));
02255 va.push_back(TVector3(-4, 0 ,0));//3 o'clock
02256 va.push_back(TVector3(-4,-1.66,0));
02257 va.push_back(TVector3( 0,-4 ,0));//bottom or 6 o'clock
02258 va.push_back(TVector3( 4,-1.66,0));
02259 va.push_back(TVector3( 4, 0 ,0));//9 o'clock
02260 va.push_back(TVector3( 4, 1.66,0));
02261
02262 //get the points on the 4 super-module ends
02263 va.push_back(TVector3( 0, 0 , 0));
02264 va.push_back(TVector3( 0, 0 ,14.772));
02265 va.push_back(TVector3( 0, 0 ,15.957));
02266 va.push_back(TVector3( 0, 0 ,29.948));
02267
02269 //get the 1st vector
02271
02272 //get the vectors on the 8 detector sides (of the octagon)
02273 //going round clockwise
02274 vb.push_back(TVector3(-1, 0, 0));
02275 vb.push_back(TVector3(-1,-1, 0));//45 degrees
02276 vb.push_back(TVector3( 0,-1, 0));
02277 vb.push_back(TVector3( 1,-1, 0));//45 degrees
02278
02279 vb.push_back(TVector3( 1, 0, 0));
02280 vb.push_back(TVector3( 1, 1, 0));//45 degrees
02281 vb.push_back(TVector3( 0, 1, 0));
02282 vb.push_back(TVector3(-1, 1, 0));//45 degrees
02283
02284 //get the vectors of the planes on the 4 super-module ends
02285 for (Int_t i=0;i<4;i++){
02286 vb.push_back(TVector3( 0, 1, 0));
02287 }
02288
02290 //get the 2nd vector
02292
02293 //get the vectors along the 8 detector sides (of the octagon)
02294 for (Int_t i=0;i<8;i++){
02295 vc.push_back(TVector3( 0, 0, 1));
02296 }
02297 //get the vectors of the planes on the 4 super-module ends
02298 for (Int_t i=0;i<4;i++){
02299 vc.push_back(TVector3( 1, 0, 0));
02300 }
02301 }
02302
02303 MAXMSG("MeuReco",logLevel,1)
02304 <<"Sizes: va="<<va.size()
02305 <<", vb="<<vb.size()
02306 <<", vc="<<vc.size()<<endl;
02307
02308 const TVector3 d(cpEnd.X,cpEnd.Y,cpEnd.Z);
02309 Float_t dX=cpEnd.X-cp.X;
02310 Float_t dY=cpEnd.Y-cp.Y;
02311
02312 //make sanity checks on the directions
02313 //to ensure distance to all planes can be found
02314 if (dX==0){//will never hit some edges
02315 dX+=0.001;//add on 1mm so it just hits
02316 MAXMSG("MeuReco",Msg::kDebug,1000)
02317 <<"Tweaking dX so !=0"<<endl;
02318 }
02319 if (dY==0){//will never hit some edges
02320 dY-=0.001;//subtract 1mm so it just hits
02321 MAXMSG("MeuReco",Msg::kDebug,1000)
02322 <<"Tweaking dY so !=0"<<endl;
02323 }
02324 //the denominator below is zero if dX and dY are equal
02325 //so just tweak them a bit if so.
02326 if (fabs(dX)==fabs(dY)){
02327 dX+=0.001;//add on 1mm just to make them not the same
02328 MAXMSG("MeuReco",Msg::kDebug,1000)
02329 <<"Tweaking dX so !=dY"<<endl;
02330 }
02331 const TVector3 e(dX,dY,cpEnd.Z-cp.Z);//end-pl5
02332
02333
02334 vector<Float_t> dist(va.size(),-999);//hold the dist. to intersection
02335 vector<TVector3> vintersect(va.size());//hold the intersection points
02336 Float_t closestDist=999999;
02337 Int_t closesti=-1;
02338 Float_t closestdZ=999;
02339
02340 MAXMSG("MeuReco",logLevel,50)
02341 <<"pl="<<pl<<", strip="<<cp.Strip
02342 <<", trk: "<<s.VtxPlane<<"->"<<s.EndPlane<<endl
02343 <<"pl5.X,Y,Z="<<cp.X<<" , "<<cp.Y<<" , "<<cp.Z<<endl
02344 <<"d.X,Y,Z="<<d.X()<<" , "<<d.Y()<<" , "<<d.Z()<<endl
02345 <<"e.X,Y,Z="<<e.X()<<" , "<<e.Y()<<" , "<<e.Z()
02346 <<endl;
02347
02348 for (UInt_t i=0;i<va.size();i++){
02349 //get references to the TVector3s
02350 TVector3& a=va[i];
02351 TVector3& b=vb[i];
02352 TVector3& c=vc[i];
02353 TVector3& intersect=vintersect[i];
02354
02355 //work out d-a
02356 TVector3 d_a=d-a;
02357
02358 Float_t denominator=b.Cross(c).Dot(-e);
02359 MAXMSG("MeuReco",logLevel,500)
02360 <<"Denominator="<<denominator<<endl;
02361
02362 Float_t distance=999999;
02363 if (denominator!=0){
02364 Float_t numerator=b.Cross(c).Dot(d_a);
02365 Float_t lambda=numerator/denominator;
02366
02367 intersect=d+(lambda*e);
02368 Float_t dZ=fabs(intersect.Z()-d.Z());
02369
02370 distance=lambda*e.Mag();
02371
02372 MAXMSG("MeuReco",logLevel,500)
02373 <<"i="<<i<<", numerator="<<numerator<<", Mag="<<e.Mag()
02374 <<", closest distance="<<distance<<endl
02375 <<" in.X,Y,Z="<<intersect.X()<<" , "<<intersect.Y()
02376 <<" , "<<intersect.Z()
02377 <<", R="<<sqrt(pow(intersect.X(),2)+pow(intersect.Y(),2))
02378 <<", dZ="<<dZ
02379 <<" (pl="<<dZ/(5.94*Munits::cm)<<")"
02380 <<endl;
02381
02382 //store the distance
02383 dist[i]=distance;
02384
02385 //get closest distance, has to be positive
02386 if (distance<closestDist && distance>=0) {
02387 closesti=i;
02388 closestdZ=dZ;
02389 closestDist=distance;
02390 }
02391 }
02392 else{
02393 MAXMSG("MeuReco",logLevel,200)
02394 <<endl<<endl<<"Bad denominator, pl="<<pl<<", strip="<<cp.Strip
02395 <<", trk: "<<s.VtxPlane<<"->"<<s.EndPlane<<endl
02396 <<"pl5.X,Y,Z="<<cp.X<<" , "<<cp.Y<<" , "<<cp.Z<<endl
02397 <<"d.X,Y,Z="<<d.X()<<" , "<<d.Y()<<" , "<<d.Z()<<endl
02398 <<"e.X,Y,Z="<<e.X()<<" , "<<e.Y()<<" , "<<e.Z()
02399 <<endl;
02400 cout<<"CalcTrace: denominator=0!!!"<<endl<<endl;
02401 }
02402 }
02403
02404 MAXMSG("MeuReco",logLevel,100)
02405 <<"ClosestDist="<<closestDist<<endl;
02406
02407 if (closestDist<0.5 || (closestdZ<0.5 && closesti<8)){
02408 MAXMSG("MeuReco",logLevel,100)
02409 <<"ClosestDist="<<closestDist<<", dZ="<<closestdZ
02410 <<", i="<<closesti<<endl;
02411 }
02412
02413 if (trace!=0 && traceZ!=0) {
02414 *trace=closestDist;
02415 if (closesti<8){
02416 *traceZ=closestdZ;
02417 }
02418 else *traceZ=999;//if it exits the SM end then don't calc traceZ
02419 //already have a 5 plane cut, which is good enough
02420 }
02421
02422 return true;//return true if all ok
02423 }
|
|
||||||||||||
|
Definition at line 1630 of file MeuReco.cxx. References MeuSummary::Detector, MeuSummary::EndPlane, MAXMSG, MeuHitInfo::Plane, MeuSummary::REnd, MeuSummary::RVtx, s(), MeuHitInfo::Strip, MeuSummary::TrigSrc, MeuSummary::VtxPlane, MeuHitInfo::X, and MeuHitInfo::Y. Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), MeuAnalysis::SnarlList(), and MeuAnalysis::SpillPlots(). 01632 {
01633 //vtx plane is the one with the greatest Y for downward events
01634 //for cosmics
01635
01636 map<Int_t,MeuHitInfo>::const_iterator itBegin=plInfo.begin();
01637 map<Int_t,MeuHitInfo>::const_iterator itEnd=--plInfo.end();
01638
01639 //loop and find the first tracked plane
01640 while (itBegin->second.Strip<0 || itEnd->second.Strip<0){
01641
01642 MAXMSG("MeuReco",Msg::kDebug,500)
01643 <<"Beg/End plane not on track:"<<endl
01644 <<"Beg: pl="<<itBegin->second.Plane
01645 <<", st="<<itBegin->second.Strip<<endl
01646 <<", End: pl="<<itEnd->second.Plane
01647 <<", st="<<itEnd->second.Strip
01648 <<endl;
01649
01650 //iterate the required iterator
01651 if (itBegin->second.Strip<0) ++itBegin;
01652 if (itEnd->second.Strip<0) --itEnd;
01653
01654 MAXMSG("MeuReco",Msg::kDebug,500)
01655 <<"trying next plane in on track..."<<endl
01656 <<"Beg: pl="<<itBegin->second.Plane
01657 <<", st="<<itBegin->second.Strip<<endl
01658 <<", End: pl="<<itEnd->second.Plane
01659 <<", st="<<itEnd->second.Strip
01660 <<endl;
01661
01662 //check that haven't iterated off the end
01663 if (itBegin==plInfo.end()) {
01664 MAXMSG("MeuReco",Msg::kWarning,500)
01665 <<"Failed to find beg/end strip"<<endl;
01666 break;
01667 }
01668
01669 }
01670
01671 if (s.TrigSrc>60000) {//spill mode
01672 MAXMSG("MeuReco",Msg::kInfo,1)
01673 <<"CalcVtx in spill mode"<<endl;
01674 s.VtxPlane=itBegin->second.Plane;
01675 s.EndPlane=itEnd->second.Plane;
01676
01677 const MeuHitInfo& cvtx=itBegin->second;
01678 const MeuHitInfo& cend=itEnd->second;
01679 if (s.Detector==Detector::kNear){
01680 s.RVtx=sqrt(pow(cvtx.X-1.5,2)+pow(cvtx.Y,2));
01681 s.REnd=sqrt(pow(cend.X-1.5,2)+pow(cend.Y,2));
01682 }
01683 else if (s.Detector==Detector::kFar){
01684 s.RVtx=sqrt(pow(cvtx.X,2)+pow(cvtx.Y,2));
01685 s.REnd=sqrt(pow(cend.X,2)+pow(cend.Y,2));
01686 }
01687 else cout<<"No detector type recognised"<<endl;
01688 }
01689 else {//dynode triggers i.e. cosmics (probably)
01690 MAXMSG("MeuReco",Msg::kInfo,1)
01691 <<"CalcVtx in cosmics mode"<<endl;
01692 //now actually work out which end is the vtx
01693 if (itBegin->second.Y>itEnd->second.Y) {
01694 s.VtxPlane=itBegin->second.Plane;
01695 s.EndPlane=itEnd->second.Plane;
01696
01697 const MeuHitInfo& cvtx=itBegin->second;
01698 const MeuHitInfo& cend=itEnd->second;
01699 if (s.Detector==Detector::kNear) {
01700 s.RVtx=sqrt(pow(cvtx.X-1.5,2)+pow(cvtx.Y,2));
01701 s.REnd=sqrt(pow(cend.X-1.5,2)+pow(cend.Y,2));
01702 }
01703 else if (s.Detector==Detector::kFar) {
01704 s.RVtx=sqrt(pow(cvtx.X,2)+pow(cvtx.Y,2));
01705 s.REnd=sqrt(pow(cend.X,2)+pow(cend.Y,2));
01706 }
01707 else cout<<"No detector type recognised"<<endl;
01708 }
01709 else {
01710 s.VtxPlane=itEnd->second.Plane;
01711 s.EndPlane=itBegin->second.Plane;
01712
01713 const MeuHitInfo& cvtx=itEnd->second;
01714 const MeuHitInfo& cend=itBegin->second;
01715 if (s.Detector==Detector::kNear) {
01716 s.RVtx=sqrt(pow(cvtx.X-1.5,2)+pow(cvtx.Y,2));
01717 s.REnd=sqrt(pow(cend.X-1.5,2)+pow(cend.Y,2));
01718 }
01719 else if (s.Detector==Detector::kFar) {
01720 s.RVtx=sqrt(pow(cvtx.X,2)+pow(cvtx.Y,2));
01721 s.REnd=sqrt(pow(cend.X,2)+pow(cend.Y,2));
01722 }
01723 else cout<<"No detector type recognised"<<endl;
01724 }
01725 }
01726 }
|
|
||||||||||||
|
Definition at line 1578 of file MeuReco.cxx. References MSG, s(), and MeuHitInfo::Strip. Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), MeuAnalysis::SnarlList(), and MeuAnalysis::SpillPlots(). 01579 {
01580 //this function allows muons to start in the spectrometer
01581 //but it converts the vtx plane to be 120 to get round
01582 //the wide active plane spacing in the ND
01583
01584 if (s.Detector!=Detector::kNear) return;
01585
01586 //variable to turn on all the useful messages if required
01587 Msg::LogLevel_t logLevel=Msg::kDebug;
01588
01589 if (s.VtxPlane<=120 && s.EndPlane<=120) {
01590 //do nothing
01591 }
01592 else if (s.VtxPlane>120 && s.EndPlane<=118) {
01593 for (Int_t pl=120;pl>0;pl--){
01594 if (plInfo.find(pl)!=plInfo.end()){
01595 const MeuHitInfo& cp=plInfo.find(pl)->second;
01596 MSG("MeuReco",logLevel)
01597 <<"MeuReco::CalcVtxSpecialND pl="<<pl
01598 <<", st="<<cp.Strip<<endl;
01599 if (cp.Strip!=-1) {
01600 s.VtxPlane=pl;
01601 MSG("MeuReco",logLevel)
01602 <<"Breaking out of loop, s.VtxPlane="
01603 <<s.VtxPlane<<endl;
01604 break;
01605 }
01606 }
01607 else {
01608 MSG("MeuReco",logLevel)
01609 <<"CalcVtxSpecialND: No pl="<<pl<<endl;
01610 }
01611 }
01612 }
01613 else if (s.EndPlane>120) {
01614 MSG("MeuReco",Msg::kError)
01615 <<"End plane is in Spectrometer"<<endl;
01616 }
01617 else MSG("MeuReco",Msg::kError)<<"Spectrometer issues!!!"<<endl;
01618
01619 //last final check
01620 if (s.VtxPlane>120) {
01621 MSG("MeuReco",Msg::kError)
01622 <<"Ahhh, last part of special missed vtx plane >120, pl="
01623 <<s.VtxPlane<<endl;
01624 this->PrintMeuHitInfo(plInfo);
01625 }
01626 }
|
|
||||||||||||
|
Definition at line 1533 of file MeuReco.cxx. References CalcMEU(), MAXMSG, MSG, s(), MeuSummary::WinSigCor, and MeuSummary::WinSigMap. Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), and MeuAnalysis::SpillPlots(). 01535 {
01536 //variable to turn on all the useful messages if required
01537 Msg::LogLevel_t logLevel=Msg::kDebug;
01538
01539 MSG("MeuReco",logLevel)
01540 <<"Running CalcWindow..."<<endl;
01544 //MC
01545 //this->TrueFirstLastPl(s.MCVtxPlane,s.MCEndPlane,
01546 // s.MCTrueWinVtxSidePl,s.MCTrueWinStopSidePl);
01547
01548 //this->ExtractTrueLPos(plInfo,s);
01549
01550 //this->ExtractTrueEnDep(plInfo,s);
01551
01552 MSG("MeuReco",logLevel)
01553 <<"Running CalcMEU..."<<endl;
01554 //actually get the MEU value!!!
01555 this->CalcMEU(s,plInfo);
01556
01557 if (s.WinSigMap>0){
01558 static Float_t avMeuSigCor=0;
01559 static Float_t avMeuSigMap=0;
01560 static Int_t counter=0;
01561 avMeuSigCor+=s.WinSigCor;
01562 avMeuSigMap+=s.WinSigMap;
01563 counter++;
01564
01565 MAXMSG("MeuReco",Msg::kDebug,1000)
01566 <<"Completed the window:"<<endl
01567 <<" s.WinSigMap="<<s.WinSigMap
01568 <<", runing av="<<avMeuSigMap/counter<<endl
01569 <<" s.WinSigCor="<<s.WinSigCor
01570 <<", runing av="<<avMeuSigCor/counter
01571 <<" (N="<<counter<<")"<<endl;
01572 }
01573 }
|
|
|
Definition at line 1810 of file MeuReco.cxx. References PlaneOutline::DistanceToEdge(), PlaneOutline::IsInside(), MAXMSG, MeuHitInfo::X, and MeuHitInfo::Y. Referenced by CalcFCPC(), and MeuCuts::FillEnVsDist2(). 01811 {
01812 //Deep containment is defined as being within the overlap of
01813 //all different plane coverages
01814
01815 Float_t distUPI=0;
01816 Float_t distVPI=0;
01817 Float_t distUFI=0;
01818 Float_t distVFI=0;
01819 Float_t xedge=0;
01820 Float_t yedge=0;
01821
01822 PlaneOutline po;
01823
01824 //calc for U-view partial
01825 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kU,
01826 PlaneCoverage::kNearPartial,
01827 distUPI,xedge,yedge);
01828 Bool_t isInsideUPI=po.IsInside(cp.X,cp.Y,PlaneView::kU,
01829 PlaneCoverage::kNearPartial);
01830
01831 //calc for U-view full
01832 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kU,
01833 PlaneCoverage::kNearFull,
01834 distUFI,xedge,yedge);
01835 Bool_t isInsideUFI=po.IsInside(cp.X,cp.Y,PlaneView::kU,
01836 PlaneCoverage::kNearFull);
01837
01838 //calc for V-view partial
01839 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kV,
01840 PlaneCoverage::kNearPartial,
01841 distVPI,xedge,yedge);
01842 Bool_t isInsideVPI=po.IsInside(cp.X,cp.Y,PlaneView::kV,
01843 PlaneCoverage::kNearPartial);
01844
01845 //calc for V-view full
01846 po.DistanceToEdge(cp.X,cp.Y,PlaneView::kV,
01847 PlaneCoverage::kNearFull,
01848 distVFI,xedge,yedge);
01849 Bool_t isInsideVFI=po.IsInside(cp.X,cp.Y,PlaneView::kV,
01850 PlaneCoverage::kNearFull);
01851
01852 //check that hit has "deep" containment
01853 Float_t smallestDist=999;
01854 if (isInsideUPI && isInsideUFI && isInsideVPI && isInsideVFI){
01855 if (smallestDist>distUPI) smallestDist=distUPI;
01856 if (smallestDist>distUFI) smallestDist=distUFI;
01857 if (smallestDist>distVPI) smallestDist=distVPI;
01858 if (smallestDist>distVFI) smallestDist=distVFI;
01859 }
01860
01861 //set to be right on the edge of the detector
01862 if (smallestDist==999) smallestDist=0;
01863
01864 MAXMSG("MeuReco",Msg::kDebug,500)
01865 <<"smallestDist="<<smallestDist
01866 <<", UPI="<<distUPI
01867 <<", UFI="<<distUFI
01868 <<", VPI="<<distVPI
01869 <<", VFI="<<distVFI<<endl;
01870
01871 return smallestDist;
01872 }
|
|
|
Definition at line 2105 of file MeuReco.cxx. References MeuHitInfo::LPos, MAXMSG, MeuHitInfo::Plane, MeuHitInfo::SigCor, MeuHitInfo::Strip, MeuHitInfo::TPos, and MeuHitInfo::View. 02106 {
02107 Bool_t gapsOk=true;
02108 Int_t lastTrkPl=-1;
02109 Int_t gap=0;
02110
02111 //strips TPos:
02112 //plane 6 goes -2.64 -> 1.32 m
02113 //plane 11 goes -1.32 -> 2.64 m
02114
02115 //plane 4,8,10 goes -2.40 -> 0.24 m (V-view)
02116 //plane 5,7,9 goes -0.24 -> 2.40 m (U-view)
02117
02118 //2.64 - 2.40 = 24 cm = 5.85 strips
02119 //the FI planes "stick out" by ~6 strips
02120
02121 //Tobi's code snippet:
02122 // in the near detector, a further check is needed:
02123 // partial U planes have strips 0-63
02124 // partial V planes have strips 4-67
02125 //if (det==static_cast<Detector::Detector_t>(s.Detector)) {
02126 // if (((pl-1)%5) && (pl%2) && st>63) continue;
02127 // if (((pl-1)%5) && (pl%2)==0 && st<4 ) continue;
02128 //}
02129
02130 //define the fiducial volume
02131 Float_t minU=-0.14*Munits::m;
02132 Float_t maxU=2.3*Munits::m;
02133 Float_t minV=-maxU;
02134 Float_t maxV=-minU;
02135 MAXMSG("MeuReco",Msg::kInfo,50)
02136 <<"minU="<<minU<<", maxU="<<maxU
02137 <<", minV="<<minV<<", maxV="<<maxV
02138 <<endl;
02139
02140 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.begin();
02141 it!=plInfo.end();++it){
02142 const MeuHitInfo& cp=it->second;
02143 Int_t pl=cp.Plane;
02144 if (pl>120) continue;
02145
02146 Float_t u=cp.TPos;
02147 Float_t v=cp.LPos;
02148 if (cp.View==PlaneView::kV){
02149 v=cp.TPos;//in the V-view tpos measures V
02150 u=cp.LPos;
02151 }
02152
02153 Bool_t fid=false;
02154 if (u>minU && u<maxU && v>minV && v<maxV){
02155 fid=true;
02156 }
02157
02158 if (cp.Strip!=-1) {
02159 gap=0;
02160 lastTrkPl=pl;
02161 }
02162 else gap++;
02163
02164 MAXMSG("MeuReco",Msg::kInfo,500)
02165 <<"pl="<<cp.Plane<<", st="<<cp.Strip
02166 <<", sigcor="<<cp.SigCor
02167 <<", gap="<<gap
02168 <<", fid="<<fid<<", u="<<u<<", v="<<v<<endl;
02169
02170 if (gap>=3) gapsOk=false;
02171
02172 }
02173
02174 return gapsOk;
02175 }
|
|
||||||||||||
|
Definition at line 2050 of file MeuReco.cxx. References MAXMSG, MeuHitInfo::Plane, s(), MeuHitInfo::Strip, MeuSummary::WinStopSidePl, and MeuSummary::WinVtxSidePl. Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), and MeuAnalysis::SpillPlots(). 02051 {
02052 Bool_t contained=true;
02053 Float_t containDisttoEdge=0.1;//fiducial distance from edge for win
02054
02055 if (s.Detector==Detector::kNear) {
02056 //perform check that every plane in window is in fiducial vol
02057 Int_t lowPl=s.WinVtxSidePl;
02058 Int_t highPl=s.WinStopSidePl;
02059 if (lowPl>highPl){
02060 lowPl=s.WinStopSidePl;
02061 highPl=s.WinVtxSidePl;
02062 }
02063
02064 //check that planes exist
02065 if (plInfo.find(lowPl)==plInfo.end() ||
02066 plInfo.find(highPl)==plInfo.end()) {
02067 MAXMSG("MeuReco",Msg::kFatal,200)
02068 <<"Can't find track window edge planes, returning !contained"
02069 <<endl;
02070 contained=false;
02071 return contained;
02072 }
02073
02074 //loop over planes in window
02075 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.find(lowPl);
02076 it!=++plInfo.find(highPl);++it){//stop at 1 past highPl
02077
02078 const MeuHitInfo& cp=it->second;
02079
02080 Float_t distToEdge=this->CheckDeepDistToEdge(cp);
02081
02082 if(distToEdge<containDisttoEdge) {
02083 contained=false;
02084 MAXMSG("MeuReco",Msg::kDebug,500)
02085 <<"pl="<<cp.Plane<<", st="<<cp.Strip
02086 <<", d="<<distToEdge
02087 <<", con="<<contained<<endl;
02088 break;
02089 }
02090 }
02091 }
02092 else if (s.Detector==Detector::kFar) {
02093 //do nothing
02094 }
02095 else {
02096 cout<<"Detector type not supported"<<endl;
02097 }
02098
02099 return contained;
02100 }
|
|
||||||||||||
|
Definition at line 1407 of file MeuReco.cxx. References MeuSummary::Detector, MeuSummary::EndPlane, MeuHitInfo::LPos, MAXMSG, s(), MeuSummary::SimFlag, MeuHitInfo::TPos, UgliGeomHandle::uvz2xyz(), MeuHitInfo::View, MeuSummary::VtxPlane, MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z. Referenced by Reconstruct(). 01409 {
01410 //variable to turn on all the useful messages if required
01411 Msg::LogLevel_t logLevel=Msg::kDebug;
01412
01413 MAXMSG("MeuReco",logLevel,1000)
01414 <<endl<<"ConvertToXYZ: Turn TPos, LPos and z -> xyz"<<endl;
01415
01416 //Float_t initValue=-999;
01417 Bool_t posDir=(s.EndPlane>s.VtxPlane);
01418
01419 //get variables for loops
01420 Int_t pl=s.VtxPlane;
01421 Int_t tmpEndPlane=s.EndPlane;
01422 if (posDir) tmpEndPlane++;//make sure last plane is used
01423 else tmpEndPlane--;
01424
01425 VldTimeStamp vldts;
01426 //VldTimeStamp vldts(ev.UnixTime,0);
01427 VldContext vc
01428 (static_cast<Detector::Detector_t>(s.Detector),
01429 static_cast<SimFlag::ESimFlag>(s.SimFlag),vldts);
01430 //get the ugh
01431 UgliGeomHandle ugh(vc);
01432 TVector3 uvz;
01433
01434 //loop and calc xyz using tpos, lpos and z in each plane
01435 while (pl!=tmpEndPlane){
01436 MAXMSG("MeuReco",Msg::kVerbose,1000)
01437 <<"pl="<<pl<<endl;
01438
01439 //cache the current cp
01440 MeuHitInfo& cp=plInfo[pl];
01441
01442 //set z first
01443 uvz.SetZ(cp.Z);
01444
01445 //now decide what tpos and lpos measure depending on the view
01446 if (cp.View==PlaneView::kU){
01447 uvz.SetX(cp.TPos);//in u-view tpos measures u
01448 uvz.SetY(cp.LPos);//in u-view lpos measures v
01449 }
01450 else if (cp.View==PlaneView::kV){
01451 uvz.SetY(cp.TPos);//in v-view tpos measures v
01452 uvz.SetX(cp.LPos);//in v-view lpos measures u
01453 }
01454 else cout<<"ahhhhhhh"<<endl;
01455
01456 //now calc xyz
01457 TVector3 xyz=ugh.uvz2xyz(uvz);
01458
01459 //now set the cp x and y
01460 cp.X=xyz.X();
01461 cp.Y=xyz.Y();
01462
01463 MAXMSG("MeuReco",logLevel,1000)
01464 <<"pl="<<pl<<", cp: X="<<cp.X<<", Y="<<cp.Y<<", Z="<<cp.Z
01465 <<endl;
01466
01467 if (posDir) pl++;
01468 else pl--;
01469 }
01470 }
|
|
|
Definition at line 2024 of file MeuReco.cxx. References MeuSummary::EndDistToEdge, MeuSummary::EndPlane, MeuSummary::EntSM1Back, MeuSummary::EntSM1Front, MeuSummary::EntSM2Back, MeuSummary::EntSM2Front, MeuSummary::EntSMEnd, MeuSummary::ExitSM1Back, MeuSummary::ExitSM1Front, MeuSummary::ExitSM2Back, MeuSummary::ExitSM2Front, MeuSummary::ExitSMEnd, MeuSummary::FC, MSG, MeuSummary::PC, MeuSummary::REnd, MeuSummary::RFid, MeuSummary::RVtx, s(), MeuSummary::VtxDistToEdge, and MeuSummary::VtxPlane. 02025 {
02026 MSG("MeuReco",Msg::kInfo)
02027 <<"Containment summary:"<<endl;
02028 MSG("MeuReco",Msg::kInfo)
02029 <<" Track: "<<s.VtxPlane<<" -> "<<s.EndPlane<<endl;
02030 MSG("MeuReco",Msg::kInfo)
02031 <<" EntSMEnd="<<s.EntSMEnd
02032 <<" (SM1: F="<<s.EntSM1Front<<", B="<<s.EntSM1Back
02033 <<" SM2: F="<<s.EntSM2Front<<", B="<<s.EntSM2Back<<")"<<endl;
02034 MSG("MeuReco",Msg::kInfo)
02035 <<" ExitSMEnd="<<s.ExitSMEnd
02036 <<" (SM1: F="<<s.ExitSM1Front<<", B="<<s.ExitSM1Back
02037 <<" SM2: F="<<s.ExitSM2Front<<", B="<<s.ExitSM2Back<<")"<<endl;
02038 MSG("MeuReco",Msg::kInfo)
02039 <<" Radius: fREnd="<<s.REnd<<", fRVtx="<<s.RVtx
02040 <<", (fRFid="<<s.RFid<<")"<<endl;
02041 MSG("MeuReco",Msg::kInfo)
02042 <<" VtxDistToEdge="<<s.VtxDistToEdge
02043 <<", EndDistToEdge="<<s.EndDistToEdge
02044 <<", PC="<<s.PC<<", FC="<<s.FC<<endl;
02045 }
|
|
|
Definition at line 931 of file MeuReco.cxx. References MeuHitInfo::LPos, MAXMSG, MeuHitInfo::Plane, MeuHitInfo::Strip, MeuHitInfo::TPos, and MeuHitInfo::View. 00932 {
00933 Msg::LogLevel_t logLevel=Msg::kInfo;
00934
00935 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.begin();
00936 it!=plInfo.end();++it){
00937
00938 const MeuHitInfo& cp=it->second;
00939
00940 MAXMSG("MeuReco",logLevel,1000)
00941 <<"Print: pl="<<cp.Plane<<", st="<<cp.Strip
00942 <<", view="<<cp.View
00943 <<", LPos="<<cp.LPos
00944 <<", TPos="<<cp.TPos
00945 <<endl;
00946 }
00947 }
|
|
|
Definition at line 952 of file MeuReco.cxx. References MeuHitInfo::Adc, MeuHitInfo::Adc1, MeuHitInfo::Adc2, MeuHitInfo::LPos, MeuHitInfo::MCEnDep, MeuHitInfo::MCSigMap, MeuHitInfo::MCSuppEnDep, MSG, MeuHitInfo::Pe, MeuHitInfo::Pe1, MeuHitInfo::Pe2, MeuHitInfo::Plane, MeuHitInfo::PLCor, MeuHitInfo::SigCor, MeuHitInfo::SigCor1, MeuHitInfo::SigCor2, MeuHitInfo::SigCorTrk1, MeuHitInfo::SigCorTrk2, MeuHitInfo::SigLin, MeuHitInfo::SigLin1, MeuHitInfo::SigLin2, MeuHitInfo::SigMap, MeuHitInfo::Strip, MeuHitInfo::TPos, MeuHitInfo::View, MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z. 00953 {
00954 Msg::LogLevel_t logLevel=Msg::kInfo;
00955
00956 MSG("MeuReco",logLevel)<<"Printing full MeuHitInfo:"<<endl;
00957
00958 for (map<Int_t,MeuHitInfo>::const_iterator it=plInfo.begin();
00959 it!=plInfo.end();++it){
00960
00961 const MeuHitInfo& cp=it->second;
00962
00963 MSG("MeuReco",logLevel)
00964 <<"pl="<<cp.Plane<<", st="<<cp.Strip
00965 <<", view="<<cp.View
00966 <<", T="<<cp.TPos<<", L="<<cp.LPos
00967 <<", PLCor="<<cp.PLCor
00968 <<", xyz="<<cp.X<<","<<cp.Y<<","<<cp.Z
00969 <<endl
00970 <<"ADC: "<<cp.Adc<<" ("<<cp.Adc1<<","<<cp.Adc2<<")"
00971 <<", SigLin: "<<cp.SigLin
00972 <<" ("<<cp.SigLin1<<","<<cp.SigLin2<<")"
00973 <<endl
00974 <<"PE: "<<cp.Pe<<" ("<<cp.Pe1<<","<<cp.Pe2<<")"
00975 <<endl
00976 <<"SigCor: "<<cp.SigCor
00977 <<" ("<<cp.SigCor1<<","<<cp.SigCor2<<")"
00978 <<"SigCorTrk: "<<-1
00979 <<" ("<<cp.SigCorTrk1<<","<<cp.SigCorTrk2<<")"
00980 <<endl
00981 <<"SigMap: "<<cp.SigMap
00982 <<" ("<<cp.SigMap<<","<<cp.SigMap<<")"
00983 <<", MCSigMap: "<<cp.MCSigMap
00984 <<endl
00985 <<"MCEnDep="<<cp.MCEnDep
00986 <<", MCSuppEnDep="<<cp.MCSuppEnDep
00987 <<endl;
00988 }
00989 }
|
|
|
Definition at line 993 of file MeuReco.cxx. References MeuSummary::AwayFromCoil, MeuSummary::Count, MeuSummary::EndPlane, MeuSummary::EntSM1Back, MeuSummary::EntSM1Front, MeuSummary::EntSM2Back, MeuSummary::EntSM2Front, MeuSummary::EntSMEnd, MeuSummary::Event, MeuSummary::ExitSM1Back, MeuSummary::ExitSM1Front, MeuSummary::ExitSM2Back, MeuSummary::ExitSM2Front, MeuSummary::ExitSMEnd, MeuSummary::FC, MeuSummary::GoodContainment, MeuSummary::GoodWindow, MeuSummary::MCEndPlane, MeuSummary::MCHighEn, MeuSummary::MCLowEn, MeuSummary::MCParticleId, MeuSummary::MCVtxPlane, MSG, MeuSummary::NStrip, MeuSummary::PC, MeuSummary::REnd, MeuSummary::RFid, MeuSummary::RFidCoil, MeuSummary::Run, MeuSummary::RVtx, s(), MeuSummary::SM1, MeuSummary::SM2, MeuSummary::SMBoth, MeuSummary::Snarl, MeuSummary::SubRun, MeuSummary::Temperature, MeuSummary::TimeSec, and MeuSummary::VtxPlane. 00994 {
00995 Msg::LogLevel_t logLevel=Msg::kInfo;
00996
00997 MSG("MeuReco",logLevel)
00998 <<"Printing full MeuHitInfo:"<<endl
00999 <<"fCount"<<s.Count<<endl
01000 <<"fTemperature"<<s.Temperature<<endl
01001
01002 <<"fEvent"<<s.Event<<endl
01003 <<"fRun"<<s.Run<<endl
01004 <<"fSubRun"<<s.SubRun<<endl
01005 <<"fTimeSec"<<s.TimeSec<<endl
01006 <<"fSnarl"<<s.Snarl<<endl
01007 <<"fNStrip"<<s.NStrip<<endl
01008
01009 <<"fGoodContainment"<<s.GoodContainment<<endl
01010 <<"fGoodWindow"<<s.GoodWindow<<endl
01011
01012 <<"fSM1"<<s.SM1<<endl
01013 <<"fSM2"<<s.SM2<<endl
01014 <<"fSMBoth"<<s.SMBoth<<endl
01015
01016 <<"fEntSM1Front"<<s.EntSM1Front<<endl
01017 <<"fEntSM1Back"<<s.EntSM1Back<<endl
01018 <<"fEntSM2Front"<<s.EntSM2Front<<endl
01019 <<"fEntSM2Back"<<s.EntSM2Back<<endl
01020 <<"fEntSMEnd"<<s.EntSMEnd<<endl
01021
01022 <<"fExitSM1Front"<<s.ExitSM1Front<<endl
01023 <<"fExitSM1Back"<<s.ExitSM1Back<<endl
01024 <<"fExitSM2Front"<<s.ExitSM2Front<<endl
01025 <<"fExitSM2Back"<<s.ExitSM2Back<<endl
01026 <<"fExitSMEnd"<<s.ExitSMEnd<<endl
01027
01028 <<"fPC"<<s.PC<<endl
01029 <<"fFC"<<s.FC<<endl
01030 <<"fAwayFromCoil"<<s.AwayFromCoil<<endl
01031
01032 <<"fMCHighEn"<<s.MCHighEn<<endl
01033 <<"fMCLowEn"<<s.MCLowEn<<endl
01034 <<"fMCParticleId"<<s.MCParticleId<<endl
01035 <<"fRFid"<<s.RFid<<endl
01036 <<"fRFidCoil"<<s.RFidCoil<<endl
01037 <<"fRVtx"<<s.RVtx<<endl
01038 <<"fREnd"<<s.REnd<<endl
01039 <<"fVtxPlane"<<s.VtxPlane<<endl
01040 <<"fEndPlane"<<s.EndPlane<<endl
01041 <<"fMCVtxPlane"<<s.MCVtxPlane<<endl
01042 <<"fMCEndPlane"<<s.MCEndPlane<<endl;
01043 }
|
|
||||||||||||
|
Definition at line 1474 of file MeuReco.cxx. References CalcLPos(), CalcPLCor(), CalcPosOfBigGaps(), CalcPosOfGaps(), CalcPosOfTrkEndGaps(), ConvertToXYZ(), MAXMSG, MSG, and s(). Referenced by MeuAnalysis::BasicReco(), MeuAnalysis::MakeSummaryTreeWithAtNu(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MeuAnalysis::N_1Plots(), and MeuAnalysis::SpillPlots(). 01476 {
01477 //variable to turn on all the useful messages if required
01478 Msg::LogLevel_t logLevel=Msg::kDebug;
01479
01480 MSG("MeuReco",logLevel)
01481 <<"Running Reconstruct..."<<endl;
01482
01483 //steps:
01484 //determine lpos for all planes
01485 //determine the x,y,z
01486
01487 //this function should only accept tracks which finish
01488 //in similar places in two views
01489
01490 Bool_t allGapsFilled=this->CalcPosOfGaps(s,plInfo);
01491 if (!allGapsFilled) {
01492 MSG("MeuReco",logLevel)
01493 <<"Running CalcPosOfBigGaps..."<<endl;
01494 allGapsFilled=this->CalcPosOfBigGaps(s,plInfo);
01495 }
01496 if (!allGapsFilled) {
01497 MSG("MeuReco",logLevel)
01498 <<"Running CalcPosOfTrkEndGaps..."<<endl;
01499 allGapsFilled=this->CalcPosOfTrkEndGaps(s,plInfo);
01500 }
01501 if (!allGapsFilled) {
01502 MAXMSG("MeuReco",Msg::kDebug,100)
01503 <<"Giving up on this event, gaps not filled"<<endl;
01504 //this->PrintMeuHitInfo(plInfo);
01505 return false;//have to give up now...
01506 }
01507
01508 MSG("MeuReco",logLevel)
01509 <<"Running CalcLPos..."<<endl;
01510
01511 Bool_t goodLPos=this->CalcLPos(s,plInfo);
01512 if (!goodLPos) {
01513 MAXMSG("MeuReco",Msg::kDebug,100)
01514 <<"Giving up on this event, LPos is bad"<<endl;
01515 return false;//have to give up now...
01516 }
01517
01518 MSG("MeuReco",logLevel)
01519 <<"Running ConvertToXYZ..."<<endl;
01520 //calcuate xyz from tpos and lpos
01521 this->ConvertToXYZ(s,plInfo);
01522
01523 MSG("MeuReco",logLevel)
01524 <<"Running CalcPLCor..."<<endl;
01525 //do the fit to determine the PLCor
01526 this->CalcPLCor(s,plInfo);//needs xyz
01527
01528 return true;
01529 }
|
1.3.9.1