00001 00002 //$Id: NCAnalysisCutsCC.cxx,v 1.5 2009/03/04 12:07:46 bckhouse Exp $ 00003 // 00004 //NCAnalysisCuts.cxx 00005 // 00006 //utility holding analysis cut algorithms 00007 // 00008 //B. Rebel 10/2005 00010 00011 #include "NCUtils/Cuts/NCAnalysisCutsCC.h" 00012 #include "NCUtils/NCType.h" 00013 #include "NCUtils/NCUtility.h" 00014 #include "AnalysisNtuples/ANtpEventInfoNC.h" 00015 #include "AnalysisNtuples/ANtpShowerInfoNC.h" 00016 #include "AnalysisNtuples/ANtpBeamInfo.h" 00017 #include "AnalysisNtuples/ANtpHeaderInfo.h" 00018 #include "AnalysisNtuples/ANtpTrackInfoNC.h" 00019 #include "AnalysisNtuples/ANtpTruthInfoBeam.h" 00020 #include "AnalysisNtuples/ANtpRecoInfo.h" 00021 #include "MessageService/MsgService.h" 00022 #include "Conventions/Detector.h" 00023 #include "Conventions/Munits.h" 00024 #include "Conventions/SimFlag.h" 00025 #include "Conventions/PlaneView.h" 00026 #include "Conventions/PlaneCoverage.h" 00027 #include "DataUtil/PlaneOutline.h" 00028 00029 #include "TMath.h" 00030 00031 using namespace BeamType; 00032 using std::vector; 00033 using NC::Utility::SQR; 00034 00035 CVSID("$Id: NCAnalysisCutsCC.cxx,v 1.5 2009/03/04 12:07:46 bckhouse Exp $"); 00036 00037 //---------------------------------------------------------------------- 00038 NCAnalysisCutsCC::NCAnalysisCutsCC() : 00039 NCAnalysisCuts() 00040 { 00041 return; 00042 } 00043 00044 //---------------------------------------------------------------------- 00045 NCAnalysisCutsCC::~NCAnalysisCutsCC() 00046 { 00047 return; 00048 } 00049 00050 //---------------------------------------------------------------------- 00051 bool NCAnalysisCutsCC::IsGoodBeamEvent() 00052 { 00053 MSG("NCAnalysisCutsCC", Msg::kDebug) << "IsGoodBeamEventCC" << endl; 00054 00055 bool goodEvent = true; 00056 bool recovered = false; 00057 00058 //recover events that fail the passedFit cut 00059 if(fEventInfo.header->detector==(int)Detector::kNear 00060 && fEventInfo.track->passedFit < 1 00061 && TMath::Abs(fEventInfo.track->begPlaneU - fEventInfo.track->begPlaneV) < 6 00062 && TMath::Abs(fEventInfo.track->endPlaneU - fEventInfo.track->endPlaneV) < 41 00063 && fEventInfo.track->endPlane < 270 00064 ) 00065 recovered = true; 00066 00067 if(fEventInfo.event->tracks < 1 00068 || (fEventInfo.track->passedFit < 1 && !recovered) 00069 ) 00070 goodEvent = false; 00071 00072 if(goodEvent && fEventInfo.header->detector==(int)Detector::kFar){ 00073 00074 if(!IsFarDetectorBeamEvent() || !TrackInBeamDirection()) 00075 goodEvent = false; 00076 00077 } 00078 00079 return goodEvent; 00080 } 00081 00082 //---------------------------------------------------------------------- 00083 bool NCAnalysisCutsCC::IsFarDetectorBeamEvent() 00084 { 00085 bool goodEvent = true; 00086 00087 if(fEventInfo.header->dataType == (int)SimFlag::kMC) 00088 fEventInfo.header->triggerPMTTime = -1.; 00089 00090 bool liEvent = false; 00091 bool onCrateBoundary = false; 00092 double eventTime = 0.; 00093 00094 //is the event starting or stopping on a crate boundary? 00095 if( (fEventInfo.event->begPlane < 3 && fEventInfo.event->endPlane > 62 00096 && fEventInfo.event->endPlane < 65) 00097 || (fEventInfo.event->begPlane > 64 && fEventInfo.event->begPlane < 67 00098 && fEventInfo.event->endPlane > 126 && fEventInfo.event->endPlane < 129) 00099 || (fEventInfo.event->begPlane > 128 && fEventInfo.event->begPlane < 131 00100 && fEventInfo.event->endPlane > 190 && fEventInfo.event->endPlane < 193) 00101 || (fEventInfo.event->begPlane > 192 && fEventInfo.event->begPlane < 195 00102 && fEventInfo.event->endPlane > 246 && fEventInfo.event->endPlane < 249) 00103 || (fEventInfo.event->begPlane > 248 && fEventInfo.event->begPlane < 252 00104 && fEventInfo.event->endPlane > 311 && fEventInfo.event->endPlane < 314) 00105 || (fEventInfo.event->begPlane > 313 && fEventInfo.event->begPlane < 316 00106 && fEventInfo.event->endPlane > 375 && fEventInfo.event->endPlane < 378) 00107 || (fEventInfo.event->begPlane > 377 && fEventInfo.event->begPlane < 380 00108 && fEventInfo.event->endPlane > 439 && fEventInfo.event->endPlane < 442) 00109 || (fEventInfo.event->begPlane > 441 && fEventInfo.event->begPlane < 444 00110 && fEventInfo.event->endPlane > 483) 00111 ) onCrateBoundary = true; 00112 00113 //*********Should change this to use the isLI in the ANtpHeaderInfo object 00114 00115 if(fEventInfo.header->triggerPMTTime > 0. 00116 || (fEventInfo.event->showers > 0 && fEventInfo.event->pulseHeight > 1.e6) 00117 || onCrateBoundary 00118 ) 00119 liEvent = true; 00120 00121 //find the difference between the spill server prediction and the 00122 //time of the event. 00123 00124 //time of the event is defined to be NtpEvenSummarySR->trigtime 00125 //and is earliest recorded hit in the event 00126 eventTime = fEventInfo.event->stripTime1st; 00127 if(fEventInfo.header->dataType == (int)SimFlag::kMC){ 00128 eventTime = 0.; 00129 fEventInfo.beam->nearestNSToSpill = 0; 00130 } 00131 00132 //beamInfo->nearestNSToSpill is the difference in ns between 00133 //the spill time and the start of the snarl 00134 if(1.e-9*fEventInfo.beam->nearestNSToSpill - eventTime < -20.e-6 00135 || 1.e-9*fEventInfo.beam->nearestNSToSpill - eventTime > 30.e-6 00136 || liEvent 00137 || fEventInfo.event->largestEventInSnarl < 1 00138 ) 00139 goodEvent = false; 00140 00141 MAXMSG("NCAnalysisCutsCC", Msg::kDebug, 20) 00142 << fEventInfo.event->stripTime1st 00143 << " " << fEventInfo.header->triggerTime 00144 << " " << fEventInfo.beam->timeToNearestSpill 00145 << " " << eventTime 00146 << " " << liEvent 00147 << " " << fEventInfo.event->largestEventInSnarl 00148 << " " << goodEvent 00149 << endl; 00150 00151 00152 return goodEvent; 00153 } 00154 00155 //---------------------------------------------------------------------- 00156 bool NCAnalysisCutsCC::TrackInBeamDirection() 00157 { 00158 bool goodDirection = true; 00159 00160 //setup NEAR angle - currently not used for near detector 00161 double beamDCosY = TMath::Cos(0.0575958653+TMath::Pi()*0.5); 00162 double beamDCosZ = TMath::Sqrt(1. - beamDCosY*beamDCosY); 00163 00164 //setup FAR angle 00165 // use 3 degrees upward in far det since that is what David is using 00166 // the real number is more like 3.27 degrees 00167 beamDCosY = TMath::Cos(-0.052359877+TMath::Pi()*0.5); 00168 beamDCosZ = TMath::Sqrt(1. - beamDCosY*beamDCosY); 00169 00170 if(fEventInfo.track->dcosYVtx*beamDCosY + fEventInfo.track->dcosZVtx*beamDCosZ < 0.6) 00171 goodDirection = false; 00172 00173 return goodDirection; 00174 } 00175 00176 //---------------------------------------------------------------------- 00177 bool NCAnalysisCutsCC::IsStoppingBeamMuon() 00178 { 00179 bool stoppingMuon = false; 00180 00181 if(fEventInfo.header->detector == int(Detector::kNear) 00182 && fEventInfo.track->endZ < 16. 00183 && TMath::Sqrt(SQR(fEventInfo.track->endX) 00184 +SQR(fEventInfo.track->endY)) > 0.4 00185 && fEventInfo.track->endX < 2.7 && fEventInfo.track->endX > -1.65 00186 && fEventInfo.track->endY < 1.65 && fEventInfo.track->endY > -1.65 00187 && fEventInfo.track->endY > -1.*(fEventInfo.track->endX + 1.65) 00188 && fEventInfo.track->endY < fEventInfo.track->endX + 1.65 00189 && fEventInfo.track->endY < 3.55 - fEventInfo.track->endX 00190 && fEventInfo.track->endY > fEventInfo.track->endX - 3.55 00191 ) 00192 stoppingMuon = true; 00193 else if(fEventInfo.header->detector == (int)Detector::kFar 00194 && fEventInfo.track->endZ > 0.5 && fEventInfo.track->endZ < 29.5 00195 && fEventInfo.track->endMetersToCloseEdge > 0.5) 00196 stoppingMuon = true; 00197 00198 return stoppingMuon; 00199 } 00200 00201 //--------------------------------------------------------------------- 00202 bool NCAnalysisCutsCC::InBeamFiducialVolume() 00203 { 00204 bool inFiducialVolume = true; 00205 00206 double vtxX = 0.; 00207 double vtxY = 0.; 00208 double vtxZ = 0.; 00209 00210 if(fEventInfo.event->tracks > 0){ 00211 vtxX = fEventInfo.track->vtxX; 00212 vtxY = fEventInfo.track->vtxY; 00213 vtxZ = fEventInfo.track->vtxZ; 00214 } 00215 else{ 00216 vtxX = fEventInfo.event->vtxX; 00217 vtxY = fEventInfo.event->vtxY; 00218 vtxZ = fEventInfo.event->vtxZ; 00219 } 00220 00221 //cuts made for selecting far detector CC events based on docdb #1466 00222 if(fEventInfo.header->detector == (int)Detector::kFar){ 00223 if(SQR(vtxX) + SQR(vtxY) > 14. 00224 || vtxZ < 0.5 00225 || (vtxZ > 14.3 && vtxZ < 16.2) 00226 || vtxZ > 28.) 00227 inFiducialVolume = false; 00228 } 00229 else if(fEventInfo.header->detector == (int)Detector::kNear){ 00230 00231 double x = vtxX; 00232 double y = vtxY; 00233 00234 double fBeamCenterX = 1.4885; 00235 double fBeamCenterY = 0.1397; 00236 x -= fBeamCenterX; 00237 y -= fBeamCenterY; 00238 00239 if(vtxZ <= 1. 00240 || vtxZ >= 5. 00241 || x*x + y*y >= 1.) 00242 inFiducialVolume = false; 00243 00244 } 00245 00246 MAXMSG("NCAnalysisCutsCC", Msg::kDebug, 20) << vtxX << " " << vtxY 00247 << " " << vtxZ << endl; 00248 00249 return inFiducialVolume; 00250 } 00251 00252 //---------------------------------------------------------------------- 00253 bool NCAnalysisCutsCC::PassesFinalSelection(ANtpRecoInfo *recoInfo) 00254 { 00255 //throw out events that are not in the fiducial volume 00256 return recoInfo->inFiducialVolume >= 1 && fEventInfo.track->fitMomentum <= 0; 00257 } 00258 00259 //---------------------------------------------------------------------- 00260 bool NCAnalysisCutsCC::PassesFinalSelection() 00261 { 00262 return true; 00263 }
1.3.9.1