00001 #include <iostream> 00002 #include <cmath> 00003 00004 #include "BeamData/ana/Summary/BeamSummaryAna.h" 00005 #include "MessageService/MsgService.h" 00006 00007 CVSID("$Id: BeamSummaryAna.cxx,v 1.4 2005/06/07 21:50:13 mdier Exp $"); 00008 00009 using namespace std; 00010 00011 BeamSummaryAna::BeamSummaryAna() 00012 { 00013 SetDefaults(); 00014 } 00015 00016 void BeamSummaryAna::SetDefaults() 00017 { 00018 SetMinIntensCut(0.15); 00019 SetMaxIntensCut(1000); 00020 SetMinHorPosTgtCut(-3.0); 00021 SetMaxHorPosTgtCut(0.0); 00022 SetMinVerPosTgtCut(-1.0); 00023 SetMaxVerPosTgtCut(2.0); 00024 SetMinHorWidthCut(0.0); 00025 SetMaxHorWidthCut(1.5); 00026 SetMinVerWidthCut(0.0); 00027 SetMaxVerWidthCut(1.5); 00028 SetMinHornCurCut(190); 00029 SetMaxHornCurCut(2000); 00030 SelectTargetPosition("in"); 00031 } 00032 00033 void BeamSummaryAna::SetMinIntensCut(Double_t cutval){ 00034 fIntensMin = cutval; 00035 } 00036 void BeamSummaryAna::SetMaxIntensCut(Double_t cutval){ 00037 fIntensMax = cutval; 00038 } 00039 void BeamSummaryAna::SetMinHorPosTgtCut(Double_t cutval){ 00040 fHorPosTgtMin = cutval; 00041 } 00042 void BeamSummaryAna::SetMaxHorPosTgtCut(Double_t cutval){ 00043 fHorPosTgtMax = cutval; 00044 } 00045 void BeamSummaryAna::SetMinVerPosTgtCut(Double_t cutval){ 00046 fVerPosTgtMin = cutval; 00047 } 00048 void BeamSummaryAna::SetMaxVerPosTgtCut(Double_t cutval){ 00049 fVerPosTgtMax = cutval; 00050 } 00051 void BeamSummaryAna::SetMinHorWidthCut(Double_t cutval){ 00052 fHorWidthMin = cutval; 00053 } 00054 void BeamSummaryAna::SetMaxHorWidthCut(Double_t cutval){ 00055 fHorWidthMax = cutval; 00056 } 00057 void BeamSummaryAna::SetMinVerWidthCut(Double_t cutval){ 00058 fVerWidthMin = cutval; 00059 } 00060 void BeamSummaryAna::SetMaxVerWidthCut(Double_t cutval){ 00061 fVerWidthMax = cutval; 00062 } 00063 void BeamSummaryAna::SetMinHornCurCut(Double_t cutval){ 00064 fHornCurMin = cutval; 00065 } 00066 void BeamSummaryAna::SetMaxHornCurCut(Double_t cutval){ 00067 fHornCurMax = cutval; 00068 } 00069 void BeamSummaryAna::SetMinTargetPosCut(Double_t cutval){ 00070 fTargetPosMin = cutval; 00071 } 00072 void BeamSummaryAna::SetMaxTargetPosCut(Double_t cutval){ 00073 fTargetPosMax = cutval; 00074 } 00075 00076 void BeamSummaryAna::SelectTargetPosition(const char* topt){ 00077 string tchoice = topt; 00078 00079 if (tchoice == "all") { 00080 SetMinTargetPosCut(-1e5); 00081 SetMaxTargetPosCut(1e6); 00082 } else if (tchoice == "out") { 00083 SetMinTargetPosCut(-1e5); 00084 SetMaxTargetPosCut(0.0); 00085 } else if (tchoice == "in") { 00086 SetMinTargetPosCut(0.0); 00087 SetMaxTargetPosCut(1e6); 00088 } else if (tchoice == "le") { 00089 SetMinTargetPosCut(0.0); 00090 SetMaxTargetPosCut(1000); 00091 } else if (tchoice == "ple") { 00092 SetMinTargetPosCut(3500); 00093 SetMaxTargetPosCut(4500); 00094 } else if (tchoice == "pme") { 00095 SetMinTargetPosCut(20000); 00096 SetMaxTargetPosCut(60000); 00097 } else if (tchoice == "phe") { 00098 SetMinTargetPosCut(60000); 00099 SetMaxTargetPosCut(1e6); 00100 } else { 00101 MSG("BeamSummaryAna",Msg::kWarning) << "Wrong option for SelectTargetPosition. " 00102 << "Will use default: target in" << endl; 00103 SetMinTargetPosCut(0.0); 00104 SetMaxTargetPosCut(1e6); 00105 } 00106 } 00107 00108 void BeamSummaryAna::PrintCuts() 00109 { 00110 cout << "The cut values for beam spills are:" << endl; 00111 cout << " " << fIntensMin << "E12 PoT < beam intensity < " 00112 << fIntensMax << "E12 PoT" << endl; 00113 cout << " " << fHorPosTgtMin << "mm < horizontal position at target < " 00114 << fHorPosTgtMax << "mm " << endl; 00115 cout << " " << fVerPosTgtMin << "mm < vertical position at target < " 00116 << fVerPosTgtMax << "mm " << endl; 00117 cout << " (note: target not at (0,0) in this coord system)" << endl; 00118 cout << " " << fHorWidthMin << "mm < horizontal width at target < " 00119 << fHorWidthMax << "mm " << endl; 00120 cout << " " << fVerWidthMin << "mm < vertical width at target < " 00121 << fVerWidthMax << "mm " << endl; 00122 cout << " " << fHornCurMin << "kA < absolute horn peak current < " 00123 << fHornCurMax << "kA " << endl; 00124 cout << " " << fTargetPosMin << "mils < target position < " 00125 << fTargetPosMax << "mils " << endl; 00126 } 00127 00128 00129 Bool_t BeamSummaryAna::SimpleBeamCut(const BeamSummary& bsum) 00130 { 00131 // Select spills with beam 00132 if (bsum.beamIntensity<fIntensMin || 00133 bsum.beamIntensity>fIntensMax) return false; 00134 // Horizontal position 00135 if (bsum.hPosatTargetBPM<fHorPosTgtMin || 00136 bsum.hPosatTargetBPM>fHorPosTgtMax) return false; 00137 // Vertical position 00138 if (bsum.vPosatTargetBPM<fVerPosTgtMin || 00139 bsum.vPosatTargetBPM>fVerPosTgtMax) return false; 00140 // Horizontal Beam width 00141 if (bsum.hBeamWidth<fHorWidthMin || 00142 bsum.hBeamWidth>fHorWidthMax) return false; 00143 // Vertical Beam width 00144 if (bsum.vBeamWidth<fVerWidthMin || 00145 bsum.vBeamWidth>fVerWidthMax) return false; 00146 // Horn current 00147 Double_t hcur = bsum.hornPeakCurrent ; 00148 if ( fabs(hcur) < fHornCurMin || 00149 fabs(hcur) > fHornCurMax) return false; 00150 // Target in 00151 if (bsum.nuTarZ<fTargetPosMin || 00152 bsum.nuTarZ>fTargetPosMax) return false; 00153 00154 return true; 00155 }
1.3.9.1