00001
00002
00003
00004
00005
00006
00008
00009 #include "AnalysisNtuples/Module/ANtpRecoNtpManipulator.h"
00010 #include "AnalysisNtuples/Module/ANtpInfoObjectFillerNC.h"
00011 #include "AnalysisNtuples/ANtpTrackInfoNC.h"
00012 #include "AnalysisNtuples/ANtpShowerInfoNC.h"
00013 #include "AnalysisNtuples/ANtpEventInfoNC.h"
00014 #include "MessageService/MsgService.h"
00015 #include "AnalysisNtuples/ANtpTruthInfoBeam.h"
00016 #include "AnalysisNtuples/ANtpBeamInfo.h"
00017 #include "AnalysisNtuples/ANtpDefaultValue.h"
00018 #include "StandardNtuple/NtpStRecord.h"
00019 #include "CandNtupleSR/NtpSRRecord.h"
00020 #include "CandNtupleSR/NtpSREvent.h"
00021 #include "CandNtupleSR/NtpSRStrip.h"
00022 #include "CandNtupleSR/NtpSRCluster.h"
00023 #include "CandNtupleSR/NtpSRTrack.h"
00024 #include "CandNtupleSR/NtpSRShower.h"
00025 #include "MCNtuple/NtpMCTruth.h"
00026 #include "MCNtuple/NtpMCStdHep.h"
00027 #include "TruthHelperNtuple/NtpTHEvent.h"
00028 #include "DatabaseInterface/DbiResultPtr.h"
00029 #include "BField/BfieldCoilCurrent.h"
00030 #include "BeamDataUtil/BDSpillAccessor.h"
00031 #include "BeamDataUtil/BeamMonSpill.h"
00032 #include "BeamDataUtil/BMSpillAna.h"
00033 #include "BeamDataNtuple/NtpBDLiteRecord.h"
00034 #include "SpillTiming/SpillTimeFinder.h"
00035 #include "VertexFinder/NtpVtxFinder/NtpVtxFinder.h"
00036
00037
00038
00039
00040 #include "Conventions/Munits.h"
00041 #include "Conventions/PlaneView.h"
00042 #include "Conventions/ReleaseType.h"
00043
00044 #include "Registry/Registry.h"
00045
00046
00047 #include "TFile.h"
00048 #include "TH1.h"
00049 #include "TSystem.h"
00050
00051
00052 #include <cassert>
00053 #include <algorithm>
00054 #include <numeric>
00055 #include <cmath>
00056 #include <map>
00057 #include <set>
00058
00059 static int kNearPartial = 1;
00060 static int kNearFull = 2;
00061 static int kComplete = 3;
00062 static int kU = 2;
00063 static int kV = 3;
00064
00065 ClassImp(ANtpInfoObjectFillerNC)
00066
00067 CVSID("$Id: ANtpInfoObjectFillerNC.cxx,v 1.47 2009/11/17 18:30:19 tinti Exp $");
00068
00069
00070 ANtpInfoObjectFillerNC::ANtpInfoObjectFillerNC() :
00071
00072 ANtpInfoObjectFillerBeam(Detector::kNear),
00073 fClusterArray(0),
00074 fkNNSet(false),
00075 fVHSPlanes(20),
00076 fVHSStrips(20)
00077 {
00078 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
00079 << "ANtpInfoObjectFillerNC::Default Constructor" << endl;
00080
00081 FillStripToPixelMaps();
00082
00083 }
00084
00085
00086 ANtpInfoObjectFillerNC::ANtpInfoObjectFillerNC(Detector::Detector_t detector) :
00087 ANtpInfoObjectFillerBeam(detector),
00088 fClusterArray(0),
00089 fkNNSet(false),
00090 fVHSPlanes(20),
00091 fVHSStrips(20)
00092 {
00093 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
00094 << "ANtpInfoObjectFillerNC::Constructor" << endl;
00095
00096 FillStripToPixelMaps();
00097
00098 }
00099
00100
00101 ANtpInfoObjectFillerNC::~ANtpInfoObjectFillerNC()
00102 {
00103 if(fAnpInterface) delete fAnpInterface;
00104 }
00105
00106
00107 void ANtpInfoObjectFillerNC::FillStripToPixelMaps()
00108 {
00109
00110
00111 if(fDetector == Detector::kFar){
00112
00113
00114 Int_t stripToPixelWest[] = {0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00115 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00116 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00117 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00118 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00119 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00120 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00121 0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6};
00122
00123 Int_t stripToPixelEast[] = {0, 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6,
00124 2, 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0,
00125 5, 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2,
00126 7, 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2, 5,
00127 8, 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2, 5, 7,
00128 10, 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2, 5, 7, 8,
00129 13, 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2, 5, 7, 8, 10,
00130 15, 0, 2, 5, 7, 1, 3, 4, 6, 9, 11, 12, 14, 1, 3, 4, 6, 0, 2, 5, 7, 8, 10, 13};
00131
00132
00133 for(Int_t i = 0; i < 192; ++i){
00134 fStripToPixelMapWest[i] = stripToPixelWest[i];
00135 fStripToPixelMapEast[i] = stripToPixelEast[i];
00136 }
00137
00138
00139 for(Int_t i = 0; i < 486; ++i) fPlaneCoverage[i] = kComplete;
00140 }
00141
00142 else if(fDetector == Detector::kNear){
00143
00144
00145 Int_t pixelToStripU1[] = {40, 53, 22, 35, 11, 41, 54, 23,
00146 36, 10, 42, 55, 24, 37, 9, 43,
00147 56, 25, 38, 8, 44, 57, 26, 39,
00148 7, 45, 58, 27, 19, 6, 46, 59,
00149 28, 18, 5, 47, 60, 29, 17, 4,
00150 48, 61, 30, 16, 3, 49, 62, 31,
00151 15, 2, 50, 63, 32, 14, 1, 51,
00152 20, 33, 13, 0, 52, 21, 34, 12};
00153
00154 Int_t pixelToStripV1[] = {27, 14, 45, 32, 56, 26, 13, 44,
00155 31, 57, 25, 12, 43, 30, 58, 24,
00156 11, 42, 29, 59, 23, 10, 41, 28,
00157 60, 22, 9, 40, 48, 61, 21, 8,
00158 39, 49, 62, 20, 7, 38, 50, 63,
00159 19, 6, 37, 51, 64, 18, 5, 36,
00160 52, 65, 17, 4, 35, 53, 66, 16,
00161 47, 34, 54, 67, 15, 46, 33, 55};
00162
00163 Int_t pixelToStripU2[] = {68, 81, 94, 59, -1, 69, 82, 95,
00164 60, -1, 70, 83, 48, 61, -1, 71,
00165 84, 49, 62, -1, 72, 85, 50, 63,
00166 -1, 73, 86, 51, 64, -1, 74, 87,
00167 52, 65, -1, 75, 88, 53, 66, -1,
00168 76, 89, 54, 67, -1, 77, 90, 55,
00169 -1, -1, 78, 91, 56, -1, -1, 79,
00170 92, 57, -1, -1, 80, 93, 58, -1};
00171
00172 Int_t pixelToStripV2[] = {27, 14, 1, 36, -1, 26, 13, 0,
00173 35, -1, 25, 12, 47, 34, -1, 24,
00174 11, 46, 33, -1, 23, 10, 45, 32,
00175 -1, 22, 9, 44, 31, -1, 21, 8,
00176 43, 30, -1, 20, 7, 42, 29, -1,
00177 19, 6, 41, 28, -1, 18, 5, 40,
00178 -1, -1, 17, 4, 39, -1, -1, 16,
00179 3, 38, -1, -1, 15, 2, 37, -1};
00180
00181 Int_t pixelToStripU3[] = {47, 34, 21, 8, -1, 46, 33, 20,
00182 7, -1, 45, 32, 19, 6, -1, 44,
00183 31, 18, 5, -1, 43, 30, 17, 4,
00184 -1, 42, 29, 16, 3, -1, 41, 28,
00185 15, 2, -1, 40, 27, 14, 1, -1,
00186 39, 26, 13, 0, -1, 38, 25, 12,
00187 -1, -1, 37, 24, 11, -1, -1, 36,
00188 23, 10, -1, -1, 35, 22, 9, -1};
00189
00190 Int_t pixelToStripV3[] = {48, 61, 74, 87, -1, 49, 62, 75,
00191 88, -1, 50, 63, 76, 89, -1, 51,
00192 64, 77, 90, -1, 52, 65, 78, 91,
00193 -1, 53, 66, 79, 92, -1, 54, 67,
00194 80, 93, -1, 55, 68, 81, 94, -1,
00195 56, 69, 82, 95, -1, 57, 70, 83,
00196 -1, -1, 58, 71, 84, -1, -1, 59,
00197 72, 85, -1, -1, 60, 73, 86, -1};
00198
00199
00200 for(Int_t i = 0; i < 64; ++i){
00201 fStripToPixelMapNearU1[pixelToStripU1[i]] = i;
00202 fStripToPixelMapNearV1[pixelToStripV1[i]] = i;
00203
00204 fStripToPixelMapNearU2[i] = -1;
00205 if(pixelToStripU2[i]>-1) fStripToPixelMapNearU2[pixelToStripU2[i]] = i;
00206
00207 fStripToPixelMapNearV2[i] = -1;
00208 if(pixelToStripV2[i]>-1) fStripToPixelMapNearV2[pixelToStripV2[i]] = i;
00209
00210 fStripToPixelMapNearU3[i] = -1;
00211 if(pixelToStripU3[i]>-1) fStripToPixelMapNearU3[pixelToStripU3[i]] = i;
00212
00213 fStripToPixelMapNearV3[i] = -1;
00214 if(pixelToStripV3[i]>-1) fStripToPixelMapNearV3[pixelToStripV3[i]] = i;
00215
00216 }
00217
00218
00219 for(Int_t i = 0; i < 282; ++i){
00220 if( i%5 == 1 ) fPlaneCoverage[i] = kNearFull;
00221 else fPlaneCoverage[i] = kNearPartial;
00222 }
00223 }
00224
00225 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
00226 << "ANtpInfoObjectFillerNC::Constructor" << endl;
00227
00228 }
00229
00230
00231 void ANtpInfoObjectFillerNC::SetDetector(Detector::Detector_t detector)
00232 {
00233
00234 fDetector = detector;
00235 FillStripToPixelMaps();
00236 return;
00237 }
00238
00239
00240 void ANtpInfoObjectFillerNC::SetClusterArray(const TClonesArray *clusters) {
00241 fClusterArray = clusters;
00242 }
00243
00244
00245 bool ANtpInfoObjectFillerNC::FillInformation(int event,
00246 ANtpRecoNtpManipulator *ntpManipulator,
00247 ANtpEventInfoNC *eventInfo,
00248 ANtpTrackInfoNC *trackInfo,
00249 ANtpShowerInfoNC *showerInfo,
00250 ANtpTruthInfoBeam *truthInfo)
00251 {
00252
00253 NtpSRTrack *ntpTrack = 0;
00254 NtpSREvent *ntpEvent = 0;
00255 NtpSRShower *ntpShower = 0;
00256 NtpMCTruth *ntpMCTruth = 0;
00257 NtpTHEvent *ntpTHEvent = 0;
00258
00259 MAXMSG("ANtpInfoObjectFillerNC", Msg::kDebug,20)
00260 << "Begin Fill Information method..." << endl;
00261
00262
00263
00264
00265 ntpManipulator->GetEventManipulator()->SetEventInSnarl(event);
00266 ntpEvent = ntpManipulator->GetEventManipulator()->GetEvent();
00267 if(!ntpEvent) return false;
00268
00269 FillEventInformation(ntpManipulator, ntpEvent, eventInfo);
00270 FillEventTimingAndActivityInformation(ntpManipulator, event, eventInfo);
00271
00272
00273
00274 ntpShower = ntpManipulator->GetEventManipulator()->GetPrimaryShower();
00275 if(ntpShower) FillShowerInformation(ntpShower, showerInfo, eventInfo);
00276
00277
00278
00279 ntpTrack = ntpManipulator->GetEventManipulator()->GetPrimaryTrack();
00280 if(ntpTrack)
00281 FillTrackInformation(ntpManipulator, ntpTrack, ntpEvent, trackInfo, eventInfo);
00282
00283 FillCrossOverInformation(ntpTrack, ntpShower, ntpEvent, ntpManipulator,
00284 trackInfo, showerInfo, eventInfo);
00285
00286
00287
00288 ntpTHEvent = ntpManipulator->GetMCManipulator()->GetNtpTHEvent(event);
00289
00290 if(ntpTHEvent)
00291 ntpMCTruth = ntpManipulator->GetMCManipulator()->GetNtpMCTruth(ntpTHEvent->neumc);
00292 if(ntpMCTruth)
00293 FillMCInformation(ntpMCTruth, ntpManipulator->GetStdHepArray(), truthInfo);
00294
00295 if (truthInfo && ntpTHEvent)
00296 truthInfo->eventCompleteness = ntpTHEvent->completeall;
00297
00298 return true;
00299 }
00300
00301
00302
00303 void ANtpInfoObjectFillerNC::
00304 GetEvtVtxWithFixup(ANtpRecoNtpManipulator* ntpManipulator,
00305 int& vtxPlane, float& vtxZ) const
00306 {
00307 ANtpEventManipulator* evtManip = ntpManipulator->GetEventManipulator();
00308 const NtpSREvent* ntpEvent = evtManip->GetEvent();
00309
00310 vtxPlane = ntpEvent->vtx.plane;
00311 vtxZ = ntpEvent->vtx.z;
00312
00313
00314 const TString reco = ntpManipulator->GetReleaseMCType();
00315 const bool isCedar = reco.Contains("Cedar");
00316 if(isCedar){
00317 NtpVtxFinder::NtpVtxFinder vtxf;
00318 vtxf.SetTargetEvent(ntpEvent->index, ntpManipulator->GetNtpStRecord());
00319 if(vtxf.FindVertex() > 0){
00320 vtxPlane = vtxf.VtxPlane();
00321 vtxZ = vtxf.VtxZ();
00322 }
00323 }
00324
00325 const NtpSRShower* ntpShower = evtManip->GetPrimaryShower();
00326 const NtpSRTrack* ntpTrack = evtManip->GetPrimaryTrack();
00327
00328 if(ntpTrack && ntpShower){
00329 if(ntpEvent->ntrack > 0 &&
00330 ntpTrack->plane.n > ntpShower->plane.n){
00331 vtxPlane = ntpTrack->vtx.plane;
00332 vtxZ = ntpTrack->vtx.z - 3.92 * Munits::cm;
00333 }
00334 }
00335 }
00336
00337
00338
00339 void ANtpInfoObjectFillerNC::
00340 GetStripEventTime(const NtpSREvent* ntpEvent,
00341 int vtxPlane, float vtxZ,
00342 double& evtTime,
00343 double& ToFCorrectedEvtTime) const
00344 {
00345 vector<double> stpTimes;
00346
00347 ToFCorrectedEvtTime = 0;
00348 Int_t tfcount=0;
00349
00350 for(int ns = 0; ns < ntpEvent->nstrip; ++ns){
00351 const int stpIdx = ntpEvent->stp[ns];
00352 if(stpIdx < 0) continue;
00353 const NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(stpIdx);
00354
00355 if(ntpStrip->ph1.pe >=2) {
00356 ToFCorrectedEvtTime += ntpStrip->time1-
00357 (fabs(ntpStrip->z - vtxZ)/Munits::c_light);
00358 tfcount++;
00359 }
00360
00361 if(ntpStrip->plane >= vtxPlane &&
00362 ntpStrip->plane < vtxPlane + 5){
00363 stpTimes.push_back(ntpStrip->time1);
00364 }
00365 }
00366
00367 if(tfcount) ToFCorrectedEvtTime /= (double)tfcount;
00368 else ToFCorrectedEvtTime=ANtpDefVal::kDouble;
00369
00370
00371 sort(stpTimes.begin(), stpTimes.end());
00372
00373 if(stpTimes.size() % 2)
00374 evtTime = *(stpTimes.begin()+stpTimes.size()/2);
00375 else
00376 evtTime = ( *(stpTimes.begin()+stpTimes.size()/2)
00377 + *(stpTimes.begin()+stpTimes.size()/2-1) )/2.;
00378 }
00379
00380
00381
00382 void ANtpInfoObjectFillerNC::
00383 FillEventTimingAndActivityInformation(ANtpRecoNtpManipulator* ntpManipulator,
00384 int event,
00385 ANtpEventInfoNC* eventInfo)
00386 {
00387 ANtpEventManipulator* evtManip = ntpManipulator->GetEventManipulator();
00388
00389
00390 evtManip->SetEventInSnarl(event);
00391
00392 const NtpSREvent* ntpEvent = evtManip->GetEvent();
00393
00394
00395
00396 int thisVtxPlane; float thisVtxZ;
00397 GetEvtVtxWithFixup(ntpManipulator, thisVtxPlane, thisVtxZ);
00398
00399 double thisEvtTime; double thisToFEventTime;
00400 GetStripEventTime(ntpEvent, thisVtxPlane, thisVtxZ,
00401 thisEvtTime, thisToFEventTime);
00402
00403
00404 Double_t timeDiff = ANtpDefVal::kFloat;
00405
00406 Int_t closeEventIndex = ANtpDefVal::kInt;
00407
00408 Float_t minDeltaZ = ANtpDefVal::kFloat;
00409
00410 Double_t mintime = ANtpDefVal::kFloat;
00411
00412
00413 for(int i = 0; i <= ntpManipulator->GetEventArray()->GetLast(); ++i){
00414
00415 if(i == event) continue;
00416
00417 evtManip->SetEventInSnarl(i);
00418 const NtpSREvent* otherEvent = evtManip->GetEvent();
00419
00420 int otherVtxPlane; float otherVtxZ;
00421 GetEvtVtxWithFixup(ntpManipulator, otherVtxPlane, otherVtxZ);
00422
00423 double otherEvtTime; double otherToFEventTime;
00424 GetStripEventTime(otherEvent, otherVtxPlane, otherVtxZ,
00425 otherEvtTime, otherToFEventTime);
00426
00427 if( otherToFEventTime !=ANtpDefVal::kDouble)
00428 otherToFEventTime -= ((otherVtxZ-thisVtxZ)/Munits::c_light);
00429
00430 const double deltaT = otherEvtTime - thisEvtTime;
00431 if(TMath::Abs(deltaT) < TMath::Abs(timeDiff)){
00432 timeDiff = deltaT;
00433 closeEventIndex = i;
00434 eventInfo->closeTimeDeltaZ = thisVtxZ - otherVtxZ;
00435 }
00436
00437
00438 const float deltaZ = thisVtxZ - otherVtxZ;
00439 if(TMath::Abs(deltaZ) < TMath::Abs(minDeltaZ)){
00440 minDeltaZ = deltaZ;
00441 }
00442
00443 if(thisToFEventTime != ANtpDefVal::kDouble &&
00444 otherToFEventTime != ANtpDefVal::kDouble)
00445 if(fabs(thisToFEventTime-otherToFEventTime) < fabs(mintime))
00446 mintime = thisToFEventTime-otherToFEventTime;
00447 }
00448
00449 eventInfo->minTimeSeparation = timeDiff;
00450 eventInfo->closeTimeEvent = closeEventIndex;
00451 eventInfo->minDeltaZ = minDeltaZ;
00452 eventInfo->medianTime = thisEvtTime;
00453 eventInfo->evtTimeDiff = mintime;
00454
00455
00456
00457
00458 map<int, set<int> > mplanes;
00459
00460 for(int i = 0; i <= ntpManipulator->GetEventArray()->GetLast(); ++i){
00461
00462 if(i == event) continue;
00463 evtManip->SetEventInSnarl(i);
00464 const NtpSREvent* otherEvent = evtManip->GetEvent();
00465
00466
00467 for(Int_t ns = 0; ns < otherEvent->nstrip; ++ns){
00468 const int idx = otherEvent->stp[ns];
00469 if(idx < 0) continue;
00470 NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(idx);
00471
00472 if(ntpStrip->ph1.pe >= 2)
00473 mplanes[ntpStrip->plane].insert(ntpStrip->strip);
00474 }
00475 }
00476
00477
00478 int nstrips =0;
00479
00480 int sharedst=0;
00481
00482
00483 for(int ns = 0; ns < ntpEvent->nstrip; ++ns){
00484 const int stripIdx = ntpEvent->stp[ns];
00485 if(stripIdx < 0) continue;
00486 NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(stripIdx);
00487
00488 if(ntpStrip->ph1.pe < 2.) continue;
00489 ++nstrips;
00490 map<int, set<int> >::const_iterator PlanesIter =
00491 mplanes.find(ntpStrip->plane);
00492
00493
00494 if(PlanesIter == mplanes.end()) continue;
00495 set<int> stps = PlanesIter->second;
00496 const unsigned int stripn = ntpStrip->strip;
00497
00498
00499 for(set<int>::iterator stpit = stps.begin();
00500 stpit != stps.end();
00501 ++stpit){
00502
00503 if(abs(int(stripn)-int(*stpit)) <= 1){
00504 ++sharedst;
00505 break;
00506 }
00507 }
00508 }
00509
00510 if(nstrips)
00511 eventInfo->sharedStripFraction = float(sharedst)/nstrips;
00512
00513
00514
00515 ntpManipulator->GetSliceManipulator()->SetSliceInSnarl(ntpEvent->slc);
00516 NtpSRSlice* ntpSlice = ntpManipulator->GetSliceManipulator()->GetSlice();
00517
00518 float slicePH= 0;
00519 float eventPH = 0;
00520 for(int it = 0; it < ntpSlice->nstrip; ++it){
00521 const NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(ntpSlice->stp[it]);
00522 if(ntpStrip->ph1.pe < 2) continue;
00523 slicePH += ntpStrip->ph1.sigcor;
00524 }
00525
00526 for(int it = 0; it < ntpEvent->nstrip; ++it){
00527 const NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(ntpEvent->stp[it]);
00528 if(ntpStrip->ph1.pe < 2) continue;
00529 eventPH += ntpStrip->ph1.sigcor;
00530 }
00531
00532 if(slicePH)
00533 eventInfo->slicePHFraction = eventPH/slicePH;
00534
00535
00536 Int_t consecutive=1;
00537 vector <int> stripplanes;
00538 for(int it = 0; it < ntpEvent->nstrip; ++it){
00539 const NtpSRStrip* ntpStrip = (NtpSRStrip*)fStripArray->At(ntpEvent->stp[it]);
00540 if(ntpStrip->ph1.pe<2.) continue;
00541
00542 bool flag=false;
00543 for(unsigned int iv=0;iv<stripplanes.size();iv++)
00544 if(stripplanes[iv]==ntpStrip->plane) flag=true;
00545 if(!flag) stripplanes.push_back(ntpStrip->plane);
00546 }
00547
00548 for(unsigned int iv=0;iv<stripplanes.size();iv++)
00549 sort(stripplanes.begin(),stripplanes.end());
00550
00551 for(unsigned int iv=1;iv<stripplanes.size();iv++)
00552 if((-stripplanes[0]+stripplanes[iv]-(consecutive-1))==1)
00553 consecutive++;
00554
00555 eventInfo->consecutivePlanes=consecutive;
00556
00557
00558
00559 const double activityTimeStart = thisEvtTime - 4e-8;
00560 const double activityTimeStop = thisEvtTime + 4e-8;
00561
00562 Int_t edgeActivityStrips=0;
00563 Float_t edgeActivityPH=0;
00564 Int_t oppEdgeStrips=0;
00565 Float_t oppEdgePH=0;
00566
00567
00568 for(int i = 0; i <= fStripArray->GetLast(); ++i){
00569 const NtpSRStrip* strip = (NtpSRStrip*)fStripArray->At(i);
00570
00571
00572 if(strip->time1 <= activityTimeStart || strip->time1 >= activityTimeStop)
00573 continue;
00574
00575
00576 if(strip->plane >= 121) continue;
00577
00578 if(strip->ph1.pe < 2) continue;
00579
00580
00581 if(strip->plane % 2 == 1 && strip->tpos < -0.24){
00582 ++edgeActivityStrips;
00583 edgeActivityPH += strip->ph1.sigcor;
00584 }
00585
00586 if(strip->plane % 2 == 1 && strip->tpos > 2.27){
00587 ++oppEdgeStrips;
00588 oppEdgePH += strip->ph1.sigcor;
00589 }
00590
00591 if(strip->plane % 2 == 0 && strip->tpos > 0.24){
00592 ++edgeActivityStrips;
00593 edgeActivityPH += strip->ph1.sigcor;
00594 }
00595
00596 if(strip->plane % 2 == 0 && strip->tpos <- 2.27){
00597 ++oppEdgeStrips;
00598 oppEdgePH += strip->ph1.sigcor;
00599 }
00600 }
00601
00602 eventInfo->edgeActivityPH = edgeActivityPH;
00603 eventInfo->edgeActivityStrips = edgeActivityStrips;
00604 eventInfo->oppEdgePH = oppEdgePH;
00605 eventInfo->oppEdgeStrips = oppEdgeStrips;
00606
00607
00608
00609 int largestIndex = 0;
00610 double largestPH = 0;
00611 for(int i = 0; i <= ntpManipulator->GetEventArray()->GetLast(); ++i){
00612 evtManip->SetEventInSnarl(i);
00613 const NtpSREvent* otherEvent = evtManip->GetEvent();
00614 if(otherEvent->ph.sigcor > largestPH){
00615 largestPH = otherEvent->ph.sigcor;
00616 largestIndex = i;
00617 }
00618 }
00619
00620 if(eventInfo->index == largestIndex)
00621 eventInfo->largestEventInSnarl = 1;
00622
00623
00624 ntpManipulator->GetEventManipulator()->SetEventInSnarl(event);
00625 }
00626
00627
00628
00629 void ANtpInfoObjectFillerNC::InitializekNN(ANtpRecoNtpManipulator *ntpManipulator)
00630 {
00631
00632 if(!fkNNSet){
00633
00634
00635 TString weightFileName = "knn.train.far.cedar.daikon.root";
00636 if(fDetector == Detector::kNear) weightFileName = "knn.train.near.cedar.daikon.root";
00637
00638 TString base = getenv("SRT_PRIVATE_CONTEXT");
00639 TString ncutils = "/NCUtils/data/";
00640 if(base != "" && base != "."){
00641
00642 void *dirptr = gSystem->OpenDirectory(base+ncutils);
00643 if(!dirptr){
00644 base = getenv("SRT_PUBLIC_CONTEXT");
00645 }
00646 }
00647 else base = getenv("SRT_PUBLIC_CONTEXT");
00648
00649
00650 if(base == ""){
00651 MSG("ANtpInfoObjectFillerNC", Msg::kFatal) << "no SRT_PUBLIC_CONTEXT set"
00652 << endl;
00653 assert(false);
00654 }
00655
00656 TString weightFilePath = base+ncutils+weightFileName;
00657
00658
00659
00660 TString baseConf = getenv("SRT_PUBLIC_CONTEXT");
00661
00662 Registry reg;
00663 reg.Set("InterfaceConfigPath", baseConf+"/PhysicsNtuple/Config/Config2007Real.txt");
00664 reg.Set("FillkNNFilePath", weightFilePath);
00665
00666
00667
00668
00669
00670
00671
00672
00673 reg.LockValues();
00674
00675 fAnpInterface = new Anp::Interface();
00676 fAnpInterface->Config(reg);
00677 fkNNSet = true;
00678 }
00679 fAnpInterface->FillSnarl(ntpManipulator->GetNtpStRecord());
00680
00681 return;
00682
00683 }
00684
00685
00686
00687 void ANtpInfoObjectFillerNC::FillTrackInformation(ANtpRecoNtpManipulator *ntpManipulator,
00688 NtpSRTrack *ntpTrack,
00689 NtpSREvent *ntpEvent,
00690 ANtpTrackInfoNC *trackInfo,
00691 ANtpEventInfoNC *eventInfo)
00692 {
00693
00694 trackInfo->Reset();
00695 ANtpInfoObjectFiller::FillTrackInformation(ntpTrack, trackInfo);
00696
00697 if(trackInfo->totalStrips > 0){
00698 trackInfo->phPerStrip = trackInfo->pulseHeight/(1.*trackInfo->totalStrips);
00699 trackInfo->phPerPlane = trackInfo->pulseHeight/(1.*trackInfo->planes);
00700 }
00701
00702 NtpSRStrip *ntpStrip = 0;
00703
00704 Int_t plane = 0, strip = 0, stpCtr = 0;
00705 Float_t xPos = 0., yPos = 0., zPos = 0.;
00706 Int_t uXTalkStripCtr = 0;
00707 Int_t vXTalkStripCtr = 0;
00708
00709 Int_t numDigits = 0, numDoubleEndedStrips = 0;
00710 Int_t stripsInPlane[500], trkStripsInPlane[500];
00711
00712
00713
00714
00715 Double_t sumZT(0.); Double_t sumZ2(0.);
00716 Double_t sumT(0.); Double_t sumZ(0.);
00717 Int_t nHits(0);
00718
00719
00720
00721 ntpTrack = ntpManipulator->GetEventManipulator()->GetPrimaryTrackNS();
00722
00723 trackInfo->aTrkpass_ns =ntpTrack->fit.pass;
00724 trackInfo->aTrkph_ns =ntpTrack->ph.sigcor;
00725 trackInfo->aTrklen_ns =ntpTrack->plane.ntrklike;
00726 if(ntpTrack->plane.ntrklike>0) trackInfo->aTrkphperpl_ns = ntpTrack->ph.sigcor/ntpTrack->plane.ntrklike;
00727 if(ntpEvent->ph.sigcor>0) trackInfo->aTrkphper_ns = ntpTrack->ph.sigcor/ntpEvent->ph.sigcor;
00728 trackInfo->aTrkplu_ns =ntpTrack->plane.nu;
00729 trackInfo->aTrkplv_ns =ntpTrack->plane.nv;
00730 trackInfo->aTrkstp_ns =ntpTrack->nstrip;
00731 trackInfo->aTrkvtx_ns =ntpTrack->vtx.z;
00732
00733 for(Int_t ii = 0; ii < 500; ++ii){
00734 stripsInPlane[ii] = 0;
00735 trkStripsInPlane[ii] = 0;
00736 }
00737
00738
00739
00740 Float_t totalPH = 0.;
00741
00742 for(Int_t i = 0; i < ntpEvent->nstrip; ++i){
00743
00744 if(ntpEvent->stp[i] >= 0)
00745 ntpStrip = dynamic_cast<NtpSRStrip *>
00746 (fStripArray->At(ntpEvent->stp[i]));
00747 else continue;
00748 plane = (int)ntpStrip->plane;
00749 strip = ntpStrip->strip;
00750 totalPH = 0;
00751
00752 if( fDetector == Detector::kFar
00753 && !fStripIsXTalkEast[plane][strip] ) totalPH += ntpStrip->ph0.sigcor;
00754 if( !fStripIsXTalkWest[plane][strip] ) totalPH += ntpStrip->ph1.sigcor;
00755
00756 if(totalPH >= 90.){
00757 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
00758 << "plane " << plane << " strip " << ntpStrip->strip << " is ok "
00759 << fStripIsXTalkEast[plane][strip] << "/"
00760 << fStripIsXTalkWest[plane][strip] << " "
00761 << ntpStrip->ph0.sigcor << "/" << ntpStrip->ph1.sigcor << endl;
00762 ++stripsInPlane[(int)ntpStrip->plane];
00763 }
00764
00765 }
00766
00767
00768
00769
00770
00771
00772 for(Int_t i = 0; i < ntpTrack->nstrip; ++i){
00773
00774
00775 if (ntpTrack->stp[i] >= 0)
00776 ntpStrip = dynamic_cast<NtpSRStrip *>
00777 (fStripArray->At(ntpTrack->stp[i]));
00778 else continue;
00779 plane = (int)ntpStrip->plane;
00780 totalPH = 0;
00781
00782 if( fDetector > 0 && !fStripIsXTalkEast[plane][strip] ) totalPH += ntpStrip->ph0.sigcor;
00783 if( !fStripIsXTalkWest[plane][strip] ) totalPH += ntpStrip->ph1.sigcor;
00784
00785 if(totalPH >= 90.) ++trkStripsInPlane[(int)ntpStrip->plane];
00786
00787 if(fDetector == Detector::kFar
00788 && fStripIsXTalkEast[plane][strip] && fStripIsXTalkWest[plane][strip]){
00789 if((int)ntpStrip->planeview == kU) ++uXTalkStripCtr;
00790 else if((int)ntpStrip->planeview == kV) ++vXTalkStripCtr;
00791 }
00792 else if(fDetector == Detector::kNear && fStripIsXTalkWest[plane][strip]){
00793 if((int)ntpStrip->planeview == kU) ++uXTalkStripCtr;
00794 else if((int)ntpStrip->planeview == kV) ++vXTalkStripCtr;
00795 }
00796
00797 if (ntpStrip->ph0.pe > 2.) {
00798 sumZ += ntpStrip->z;
00799 sumZ2 += ntpStrip->z * ntpStrip->z;
00800 sumZT += ntpStrip->z * ntpStrip->time0;
00801 sumT += ntpStrip->time0;
00802 ++nHits;
00803 }
00804
00805 if (ntpStrip->ph1.pe > 2.) {
00806 sumZ += ntpStrip->z;
00807 sumZ2 += ntpStrip->z * ntpStrip->z;
00808 sumZT += ntpStrip->z * ntpStrip->time1;
00809 sumT += ntpStrip->time1;
00810 ++nHits;
00811 }
00812
00813
00814 }
00815
00816 trackInfo->xTalkStrips = uXTalkStripCtr+vXTalkStripCtr;
00817
00818
00819
00820 trackInfo->dtdz = 0;
00821 if (nHits > 1){
00822 Double_t CovZT = sumZT - (sumZ*sumT)/(Float_t)nHits;
00823 Double_t VarZ = sumZ2 - (sumZ*sumZ)/(Float_t)nHits;
00824 if (VarZ > 0) trackInfo->dtdz = Munits::c_light * CovZT/VarZ;
00825 }
00826
00827
00828
00829
00830
00831 trackInfo->trackLikePlanes = 0;
00832 for(Int_t i = 0; i < 500; ++i){
00833
00834 if(stripsInPlane[i]>0 && trkStripsInPlane[i]>0
00835 && stripsInPlane[i]*0.9 <= trkStripsInPlane[i])
00836 ++trackInfo->trackLikePlanes;
00837
00838 }
00839
00840
00841 Int_t index = 0;
00842 Int_t nVPlanes = 0, nUPlanes = 0;
00843
00844 nVPlanes = ntpTrack->plane.nv;
00845 nUPlanes = ntpTrack->plane.nu;
00846
00847 trackInfo->uvAsymmetry = 0.;
00848 if(nVPlanes+nUPlanes>0)
00849 trackInfo->uvAsymmetry = TMath::Abs((1.*nUPlanes-1.*nVPlanes)/(1.*nVPlanes+1.*nUPlanes));
00850
00851 trackInfo->signalUseFraction = 0.;
00852 if(eventInfo->pulseHeight>0.)
00853 trackInfo->signalUseFraction = trackInfo->pulseHeight/eventInfo->pulseHeight;
00854
00855 trackInfo->planeUseFraction = 0.;
00856 if(eventInfo->planes>0)
00857 trackInfo->planeUseFraction = 1.*trackInfo->trackLikePlanes/(1.*eventInfo->planes);
00858
00859 trackInfo->totalStrips = 0;
00860
00861
00862 if(trackInfo->length<50.){
00863
00864
00865 trackInfo->totalStrips = (int)ntpTrack->nstrip;
00866 numDoubleEndedStrips = 0;
00867
00868 stpCtr = 0;
00869
00870 for(Int_t ns = 0; ns < trackInfo->totalStrips; ++ns){
00871
00872
00873 if (ntpTrack->stp[ns] >= 0) index = ntpTrack->stp[ns];
00874 else continue;
00875
00876 ntpStrip = dynamic_cast<NtpSRStrip *>(fStripArray->At(index));
00877 plane = (int)ntpStrip->plane;
00878 strip = (int)ntpStrip->strip;
00879 numDigits = (int)ntpStrip->ndigit;
00880
00881 xPos = ntpTrack->stpx[ns];
00882 yPos = ntpTrack->stpy[ns];
00883 zPos = ntpTrack->stpz[ns];
00884
00885 if(numDigits == 2){
00886
00887 ++numDoubleEndedStrips;
00888
00889 }
00890 }
00891
00892 trackInfo->twoEndStripFraction = 0.;
00893 if(trackInfo->totalStrips>0)
00894 trackInfo->twoEndStripFraction = (1.*numDoubleEndedStrips)/(1.*trackInfo->totalStrips);
00895
00896 }
00897
00898
00899 trackInfo->kNN = fAnpInterface->GetVar("knn_pid",ntpEvent);
00900 trackInfo->numScintPlanes = fAnpInterface->GetVar("knn_01",ntpEvent);
00901 trackInfo->meanSigCor = fAnpInterface->GetVar("knn_10",ntpEvent);
00902 trackInfo->meanLowStripDivHighStrip = fAnpInterface->GetVar("knn_20",ntpEvent);
00903 trackInfo->trackSigCorFraction = fAnpInterface->GetVar("knn_40",ntpEvent);
00904
00905 return;
00906 }
00907
00908
00909
00910 void ANtpInfoObjectFillerNC::FillShowerInformation(NtpSRShower *ntpShower,
00911 ANtpShowerInfoNC *showerInfo,
00912 ANtpEventInfoNC *eventInfo)
00913 {
00914
00915 showerInfo->Reset();
00916 ANtpInfoObjectFiller::FillShowerInformation(ntpShower, showerInfo);
00917
00918 if(showerInfo->totalStrips > 0){
00919 showerInfo->phPerStrip = showerInfo->pulseHeight/(1.*showerInfo->totalStrips);
00920 showerInfo->phPerPlane = showerInfo->pulseHeight/(1.*showerInfo->planes);
00921 }
00922
00923 NtpSRStrip *ntpStrip = 0;
00924
00925 showerInfo->energyGeV = ntpShower->ph.gev;
00926
00927 Int_t index = 0;
00928 Int_t numDigits = 0;
00929 Int_t numDoubleEndedStrips = 0;
00930
00931 showerInfo->planeUseFraction = -1.;
00932 showerInfo->signalUseFraction = -1.;
00933 if(eventInfo->pulseHeight>0.)
00934 showerInfo->signalUseFraction = showerInfo->pulseHeight/(eventInfo->pulseHeight);
00935 if(eventInfo->planes>0)
00936 showerInfo->planeUseFraction = 1.*showerInfo->planes/(1.*eventInfo->planes);
00937
00938 Int_t plane = 0;
00939 Int_t strip = 0;
00940
00941 showerInfo->xTalkStrips = 0;
00942 showerInfo->twoEndStripFraction = -1.;
00943
00944 Float_t sumTposU = 0.;
00945 Float_t sum2TposU = 0.;
00946 Float_t sumPHU = 0.;
00947 Float_t maxTposU = -10.;
00948 Float_t minTposU = 10.;
00949
00950 Float_t sumTposV = 0.;
00951 Float_t sum2TposV = 0.;
00952 Float_t sumPHV = 0.;
00953 Float_t maxTposV = -10.;
00954 Float_t minTposV = 10.;
00955
00956 Float_t sumPHsigcor(0.);
00957 Int_t nstrip = ntpShower->nstrip;
00958
00959 MSG("ANtpInfoObjectFillerNC", Msg::kDebug) << "shower strips = "
00960 << ntpShower->nstrip << endl;
00961
00962 showerInfo->aShwdig_ns = ntpShower->ndigit;
00963 showerInfo->aShwplu_ns = ntpShower->plane.nu;
00964 showerInfo->aShwplv_ns = ntpShower->plane.nv;
00965
00966
00967
00968
00969
00970
00971
00972 for(Int_t ns = 0; ns < ntpShower->nstrip; ++ns){
00973
00974
00975 index = ntpShower->stp[ns];
00976
00977
00978 ntpStrip = dynamic_cast<NtpSRStrip *>(fStripArray->At(index));
00979 plane = (int)ntpStrip->plane;
00980 strip = ntpStrip->strip;
00981
00982
00983
00984
00985 sumPHsigcor += (ntpStrip->ph0.sigcor + ntpStrip->ph1.sigcor);
00986
00987
00988 numDigits = (int)ntpStrip->ndigit;
00989 if(numDigits == 2) ++numDoubleEndedStrips;
00990
00991 if(fDetector == Detector::kNear){
00992 if(fStripIsXTalkWest[plane][strip]) ++showerInfo->xTalkStrips;
00993 }
00994 else if(fDetector == Detector::kFar){
00995 if(fStripIsXTalkEast[plane][strip] && fStripIsXTalkWest[plane][strip])
00996 ++showerInfo->xTalkStrips;
00997 }
00998
00999 if(ntpStrip->ndigit == 1) continue;
01000 Float_t stpPH(ntpStrip->ph0.sigcor + ntpStrip->ph1.sigcor);
01001 if (ntpStrip->planeview == PlaneView::kU){
01002 maxTposU = TMath::Max(maxTposU, ntpStrip->tpos);
01003 minTposU = TMath::Min(minTposU, ntpStrip->tpos);
01004 sumTposU += (ntpStrip->tpos)*stpPH;
01005 sum2TposU += (ntpStrip->tpos * ntpStrip->tpos) * stpPH;
01006 sumPHU += stpPH;
01007 }
01008 else if (ntpStrip->planeview == PlaneView::kV){
01009 maxTposV = TMath::Max(maxTposV, ntpStrip->tpos);
01010 minTposV = TMath::Min(minTposV, ntpStrip->tpos);
01011 sumTposV += ntpStrip->tpos * stpPH;
01012 sum2TposV += (ntpStrip->tpos * ntpStrip->tpos) * stpPH;
01013 sumPHV +=stpPH;
01014 }
01015
01016 }
01017
01018 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01019 << "total strips = " << showerInfo->totalStrips << endl;
01020
01021 if(showerInfo->totalStrips>0)
01022 showerInfo->twoEndStripFraction = (1.*numDoubleEndedStrips)/(1.*showerInfo->totalStrips);
01023
01024 if(sumPHU>0){
01025 Float_t centroidU = sumTposU;
01026 if(sumPHU > 0.) centroidU /= sumPHU;
01027 else centroidU = 0.;
01028 showerInfo->transverseRMSU = TMath::Sqrt(TMath::Abs(sum2TposU/sumPHU - centroidU*centroidU));
01029 }
01030 else showerInfo->transverseRMSU = 0.;
01031
01032 if(sumPHV>0){
01033 Float_t centroidV = sumTposV;
01034 if(sumPHV > 0.) centroidV /= sumPHV;
01035 else centroidV = 0.;
01036 showerInfo->transverseRMSV = TMath::Sqrt(TMath::Abs(sum2TposV/sumPHV - centroidV*centroidV));
01037 }
01038 else showerInfo->transverseRMSV = 0.;
01039
01040
01041
01042
01043
01044 Float_t meanPHsigcor = sumPHsigcor/nstrip;
01045 Float_t secondMoment(0.);
01046 Float_t fourthMoment(0.);
01047
01048 for (Int_t stp_index_shw = 0; stp_index_shw < nstrip ; ++stp_index_shw){
01049 Int_t stp_index = ntpShower->stp[stp_index_shw];
01050 NtpSRStrip* strip =
01051 dynamic_cast<NtpSRStrip *>(fStripArray->At(stp_index));
01052 Float_t stpPH(strip->ph0.sigcor + strip->ph1.sigcor);
01053 secondMoment += TMath::Power((stpPH - meanPHsigcor),2);
01054 fourthMoment += TMath::Power((stpPH - meanPHsigcor),4);
01055 }
01056 Float_t sigma = secondMoment/(nstrip-1);
01057
01058
01059 showerInfo->phKurtosis = fourthMoment/(nstrip*sigma*sigma)-3.0;
01060
01061 Int_t emLikeStrips(0);
01062 Bool_t cluFailure(false);
01063 for (Int_t clu_index_shw = 0; clu_index_shw < ntpShower->ncluster ;
01064 ++clu_index_shw){
01065 Int_t clu_index = ntpShower->clu[clu_index_shw];
01066
01067 if (clu_index<0) {
01068 MSG("ANtpInfoObjectFillerNC",Msg::kError)
01069 << "Array index for cluster less than 0. This should never happen!"
01070 << endl;
01071 cluFailure = true;
01072 continue;
01073 }
01074
01075 NtpSRCluster* cluster =
01076 dynamic_cast<NtpSRCluster *>(fClusterArray->At(clu_index));
01077 if (cluster->id == 0)
01078 emLikeStrips += cluster->nstrip;
01079 }
01080 if (!cluFailure)
01081 showerInfo->emFrac = (1.0* emLikeStrips)/ntpShower->nstrip;
01082 else
01083 showerInfo->emFrac = -1;
01084
01085
01086
01087 return;
01088 }
01089
01090
01091
01092 void ANtpInfoObjectFillerNC::FillCrossOverInformation(NtpSRTrack *ntpTrack,
01093 NtpSRShower *ntpShower,
01094 NtpSREvent *ntpEvent,
01095 ANtpRecoNtpManipulator *ntpManipulator,
01096 ANtpTrackInfoNC *trackInfo,
01097 ANtpShowerInfoNC *showerInfo,
01098 ANtpEventInfoNC *eventInfo)
01099 {
01100
01101 Int_t indexShowerStrip = 0;
01102 Int_t indexTrackStrip = 0;
01103
01104 eventInfo->trackStripsInShower = 0;
01105 eventInfo->trackExtension = 0;
01106
01107 if(ntpShower && ntpTrack && trackInfo->length < 50.){
01108 for(Int_t ns = 0; ns < ntpShower->nstrip; ++ns){
01109
01110
01111 indexShowerStrip = ntpShower->stp[ns];
01112
01113
01114 for(Int_t nt = 0; nt < ntpTrack->nstrip; ++nt){
01115
01116 indexTrackStrip = ntpTrack->stp[nt];
01117
01118
01119
01120 if(indexTrackStrip == indexShowerStrip) ++eventInfo->trackStripsInShower;
01121
01122 }
01123
01124 }
01125
01126 if(ANtpDefaultValue::IsDefault(showerInfo->planes) ||
01127 ANtpDefaultValue::IsDefault(trackInfo->planes) )
01128 eventInfo->trackExtension = ANtpDefaultValue::kInt;
01129 else
01130 eventInfo->trackExtension = showerInfo->planes - trackInfo->planes;
01131 }
01132
01133
01134 Int_t ssind,ssplind;
01135 Double_t ssphtot;
01136 Bool_t foundshw,foundtrk;
01137
01138 Int_t planes = ntpEvent->plane.beg;
01139
01140 Double_t ph3,ph6,phlast,phcommon,phnowere,hitcommon,hitnowere;
01141 ph3=0.;ph6=0.;phlast=0.;phcommon=0.;phnowere=0.;hitcommon=0.;hitnowere=0.;
01142
01143 NtpSRTrack *ntpTrackNS = ntpManipulator->GetEventManipulator()->GetPrimaryTrackNS();
01144
01145
01146 for(Int_t evss=0;evss<ntpEvent->nstrip;evss++){
01147 Int_t stp_index=((ntpEvent->stp)[evss]);
01148
01149 if(stp_index!=-1){
01150
01151 NtpSRStrip *ntpStrip = dynamic_cast<NtpSRStrip *>(fStripArray->At(stp_index));
01152 if(!ntpStrip) continue;
01153 ssind = ntpStrip->strip;
01154 ssplind = ntpStrip->plane;
01155 ssphtot = ntpStrip->ph1.sigcor+ntpStrip->ph0.sigcor;
01156
01157 foundshw=false;
01158 foundtrk=false;
01159
01160 Double_t phstrips=0;
01161 Double_t phstript=0;
01162
01163 Int_t sshwind,sshwplind;
01164 Double_t sshwphtot;
01165
01166 if(ntpEvent->nshower > 0) {
01167 for(Int_t jj=0;jj<ntpShower->nstrip;jj++){
01168 Int_t stp_indexs=((ntpShower->stp)[jj]);
01169
01170 if(stp_indexs!=-1){
01171
01172 NtpSRStrip *ntpStrip1 = dynamic_cast<NtpSRStrip *>(fStripArray->At(stp_indexs));
01173 if(!foundshw){
01174 sshwind =ntpStrip1->strip;
01175 sshwplind =ntpStrip1->plane;
01176 sshwphtot =ntpStrip1->ph1.sigcor+ntpStrip1->ph0.sigcor;
01177 if(sshwind==ssind && sshwplind==ssplind) {
01178 foundshw=true;
01179 phstrips=sshwphtot;
01180 }
01181 }
01182 }
01183 }
01184 }
01185
01186 Int_t strkind,strkplind;
01187 Double_t strkphtot;
01188
01189 if(ntpEvent->ntrack > 0) {
01190
01191 for(Int_t jj=0;jj<ntpTrackNS->nstrip;jj++){
01192 Int_t stp_indext=((ntpTrackNS->stp)[jj]);
01193
01194 if(stp_indext!=-1){
01195
01196 NtpSRStrip *ntpStript = dynamic_cast<NtpSRStrip *>(fStripArray->At(stp_indext));
01197
01198 if(!foundtrk){
01199 strkind =ntpStript->strip;
01200 strkplind=ntpStript->plane;
01201 strkphtot=ntpStript->ph1.sigcor+ntpStript->ph0.sigcor;
01202 if(strkind==ssind && strkplind==ssplind) {
01203 foundtrk=true;
01204 phstript=strkphtot;
01205 }
01206 }
01207
01208 }
01209 }
01210 }
01211
01212 if(foundshw && foundtrk) {
01213 hitcommon= hitcommon+1;
01214 phcommon = phcommon+phstrips+phstript;
01215 }
01216 if(!foundshw && ! foundtrk) {
01217 hitnowere=hitnowere+1;
01218 phnowere=phnowere+ssphtot;
01219 }
01220 if(ssplind>=planes && ssplind<=(planes+3)){
01221 ph3=ph3+ssphtot;
01222 }
01223 else if(ssplind>(planes+3) && ssplind<=(planes+6)){
01224 ph6=ph6+ssphtot;
01225 }
01226 else {
01227 phlast=phlast+ssphtot;
01228 }
01229
01230 }
01231
01232 }
01233
01234
01235 eventInfo->aPh3_ns = ph3;
01236 eventInfo->aPh6_ns = ph6;
01237 eventInfo->aPhlast_ns = phlast;
01238 eventInfo->aPhcommon_ns = phcommon;
01239
01240
01241 return;
01242 }
01243
01244
01245
01246 void ANtpInfoObjectFillerNC::FillEventInformation(ANtpRecoNtpManipulator *ntpManipulator,
01247 NtpSREvent *ntpEvent,
01248 ANtpEventInfoNC *eventInfo)
01249 {
01250
01251 eventInfo->Reset();
01252 ANtpInfoObjectFiller::FillEventInformation(ntpManipulator,
01253 ntpEvent,
01254 eventInfo);
01255
01256 NtpSRStrip *ntpStrip = 0;
01257
01258 eventInfo->lengthInPlanes = eventInfo->endPlane - eventInfo->begPlane + 1;
01259 eventInfo->lateBucketPHFraction = ntpEvent->bleach.lateBucketPHFraction;
01260 eventInfo->timeWeightedPHFraction = ntpEvent->bleach.timeWeightedPHFraction;
01261 eventInfo->straightPHFraction = ntpEvent->bleach.straightPHFraction;
01262 eventInfo->fixedWindowPH = ntpEvent->bleach.fixedWindowPH;
01263
01264
01265 Float_t planePH[500] = {0.};
01266 eventInfo->totalStrips = ntpEvent->nstrip;
01267 eventInfo->passStrips = 0;
01268 eventInfo->modifiedPH = 0.;
01269 if(eventInfo->totalStrips > 0){
01270 eventInfo->phPerStrip = eventInfo->pulseHeight/(1.*eventInfo->totalStrips);
01271 eventInfo->phPerPlane = eventInfo->pulseHeight/(1.*eventInfo->planes);
01272 }
01273
01274 double maxStripTime = -1.e12;
01275 double minStripTime = 1.e12;
01276
01277
01278
01279
01280
01281
01282 const UInt_t nPlanes(eventInfo->planes);
01283 vector<Float_t> planeAdc(nPlanes+12,0);
01284
01285 const vector<Float_t>::const_iterator pAdc_begin(planeAdc.begin());
01286 const vector<Float_t>::const_iterator pAdc_last(pAdc_begin + nPlanes);
01287
01288
01289 Double_t t_1stStp(10.);
01290 Double_t t_lastStp(0.);
01291 Double_t t_sumStp(0.);
01292 Double_t t_sum2Stp(0.);
01293 Int_t nStpHit( ntpEvent->nstrip );
01294
01295
01296 for(Int_t ns = 0; ns < ntpEvent->nstrip; ++ns){
01297
01298
01299 if (ntpEvent->stp[ns] >= 0)
01300 ntpStrip = dynamic_cast<NtpSRStrip *>
01301 (fStripArray->At(ntpEvent->stp[ns]));
01302 else continue;
01303 if(ntpStrip->plane>0 && ntpStrip->plane<486){
01304 planePH[ntpStrip->plane] += ntpStrip->ph0.sigcor + ntpStrip->ph1.sigcor;
01305
01306 if( fDetector == Detector::kFar
01307 && (!fStripIsXTalkWest[ntpStrip->plane][ntpStrip->strip]
01308 || !fStripIsXTalkEast[ntpStrip->plane][ntpStrip->strip]))
01309 ++eventInfo->passStrips;
01310 else if( fDetector == Detector::kNear
01311 && !fStripIsXTalkWest[ntpStrip->plane][ntpStrip->strip])
01312 ++eventInfo->passStrips;
01313
01314 if(ntpStrip->ph1.raw > 200.) eventInfo->modifiedPH += ntpStrip->ph1.raw;
01315
01316 if(ntpStrip->time1 > maxStripTime) maxStripTime = ntpStrip->time1;
01317 if(ntpStrip->time1 < minStripTime) minStripTime = ntpStrip->time1;
01318
01319 }
01320
01321
01322
01323
01324 Int_t pln_index = ntpStrip->plane - eventInfo->begPlane;
01325 if (pln_index < (Int_t) nPlanes && pln_index >= 0) {
01326 planeAdc[pln_index] += ntpStrip->ph0.sigcor;
01327 planeAdc[pln_index] += ntpStrip->ph1.sigcor;
01328 }
01329
01330
01331 Double_t t_stpHitA = TMath::Max(ntpStrip->time0 , ntpStrip->time1);
01332 Double_t t_stpHitB = TMath::Min(ntpStrip->time0 , ntpStrip->time1);
01333
01334 t_1stStp = TMath::Min(t_1stStp, t_stpHitA);
01335 t_lastStp = TMath::Max(t_lastStp, t_stpHitA);
01336 t_sumStp += t_stpHitA;
01337 t_sum2Stp += t_stpHitA * t_stpHitA;
01338
01339 if (t_stpHitB > 0 ){
01340 t_1stStp = TMath::Min(t_1stStp, t_stpHitB);
01341 t_lastStp = TMath::Max(t_lastStp, t_stpHitB);
01342 t_sumStp += t_stpHitB;
01343 t_sum2Stp += t_stpHitB * t_stpHitB;
01344 ++nStpHit;
01345 }
01346
01347
01348 }
01349
01350
01351
01352 eventInfo->stripTimeMean = t_sumStp / nStpHit;
01353 Float_t t_variance = t_sum2Stp / nStpHit
01354 - (t_sumStp / nStpHit) * (t_sumStp / nStpHit);
01355
01356 eventInfo->stripTimeRMS = TMath::Sqrt(TMath::Abs(t_variance));
01357
01358 eventInfo->stripTime1st = t_1stStp;
01359 eventInfo->stripTimelast = t_lastStp;
01360
01361
01362 eventInfo->eventDuration = maxStripTime - minStripTime;
01363
01364 if(fDetector == Detector::kNear) FindEarlyActivityWeight(ntpEvent, eventInfo);
01365
01366
01367
01368
01369
01370 TH1F planePHDist("planePHDist", "", 400, 0., 400.);
01371 eventInfo->maxPlanePH = 0.;
01372 eventInfo->maxPHIn3Planes = 0.;
01373 eventInfo->maxPHIn6Planes = 0.;
01374 eventInfo->maxPHIn9Planes = 0.;
01375 eventInfo->maxPHIn12Planes = 0.;
01376
01377 for(Int_t i = eventInfo->begPlane; i <= eventInfo->endPlane; ++i){
01378 if(planePH[i] > eventInfo->maxPlanePH) eventInfo->maxPlanePH = planePH[i];
01379 if(planePH[i] > 0.) planePHDist.Fill(planePH[i]*1.e-4);
01380 }
01381
01382 Float_t phInWindow = 0.;
01383 for(Int_t windowSize = 3; windowSize<14; windowSize +=3){
01384 for(Int_t i = eventInfo->begPlane; i<=eventInfo->endPlane; ++i){
01385 phInWindow = 0.;
01386 for(Int_t j = 0; j<windowSize && j+i<=eventInfo->endPlane; ++j){
01387 phInWindow += planePH[i+j];
01388 }
01389 if(windowSize == 3 && eventInfo->maxPHIn3Planes<phInWindow)
01390 eventInfo->maxPHIn3Planes = phInWindow;
01391 else if(windowSize == 6 && eventInfo->maxPHIn6Planes<phInWindow)
01392 eventInfo->maxPHIn6Planes = phInWindow;
01393 else if(windowSize == 9 && eventInfo->maxPHIn9Planes<phInWindow)
01394 eventInfo->maxPHIn9Planes = phInWindow;
01395 else if(windowSize == 12 && eventInfo->maxPHIn12Planes<phInWindow)
01396 eventInfo->maxPHIn12Planes = phInWindow;
01397 }
01398
01399 }
01400
01401 eventInfo->pulseHeightRms = planePHDist.GetRMS();
01402
01403
01404
01405
01406
01407 eventInfo->triPlane1PH = accumulate(pAdc_begin, pAdc_begin+3, 0.0 );
01408 eventInfo->triPlane2PH = accumulate(pAdc_begin+3, pAdc_begin+6, 0.0 );
01409 if (nPlanes>6)
01410 eventInfo->triPlaneOverPH = accumulate(pAdc_begin+6, pAdc_last, 0.0 );
01411 else
01412 eventInfo->triPlaneOverPH = 0.0;
01413
01414
01415 eventInfo->eventSummaryPlanes = ntpManipulator->GetSnarlEventSummary().plane.n;
01416
01417
01418
01419
01420 return;
01421 }
01422
01423
01424
01425 void ANtpInfoObjectFillerNC::FillMCInformation(NtpMCTruth *ntpMCTruth,
01426 TClonesArray *stdHepArray,
01427 ANtpTruthInfoBeam *truthInfo)
01428 {
01429 truthInfo->Reset();
01430 ANtpInfoObjectFiller::FillMCTruthInformation(ntpMCTruth, truthInfo);
01431 ANtpInfoObjectFillerBeam::FillBeamMCTruthInformation(ntpMCTruth, stdHepArray, truthInfo);
01432
01433 return;
01434 }
01435
01436
01437 void ANtpInfoObjectFillerNC::FillPlanePixelSignalArrays(NtpSREvent *ntpEvent)
01438 {
01439 MSG("ANtpInfoObjectFillerNC", Msg::kDebug) << "in FillPlanePixelSignalArrays" << endl;
01440
01441 NtpSRStrip *ntpStrip = 0;
01442
01443 Int_t pixel = 0;
01444 Int_t plane = 0;
01445
01446
01447
01448
01449
01450
01451 for(Int_t ns = 0; ns < ntpEvent->nstrip; ++ns){
01452
01453
01454 if (ntpEvent->stp[ns] >= 0)
01455 ntpStrip = dynamic_cast<NtpSRStrip *>
01456 (fStripArray->At(ntpEvent->stp[ns]));
01457 else continue;
01458 plane = ntpStrip->plane;
01459
01460 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01461 << "plane " << plane << " strip " << ntpStrip->strip
01462 << " pmt1 " << ntpStrip->pmtindex1 << endl;
01463 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01464 << " pmt0 " << ntpStrip->pmtindex0 << endl;
01465
01466 fPlaneToPMTMapWest[plane] = ntpStrip->pmtindex1;
01467 if(fDetector == Detector::kFar) fPlaneToPMTMapEast[plane] = ntpStrip->pmtindex0;
01468
01469 }
01470
01471 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01472 << "finish filling plane to pmt maps" << endl;
01473
01474
01475 for(Int_t ns = 0; ns < ntpEvent->nstrip; ++ns){
01476
01477
01478 if(ntpEvent->stp[ns] >= 0)
01479 ntpStrip = dynamic_cast<NtpSRStrip *>
01480 (fStripArray->At(ntpEvent->stp[ns]));
01481 else continue;
01482 plane = ntpStrip->plane;
01483
01484 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01485 << "plane " << plane << " strip " << ntpStrip->strip
01486 << " detector " << fDetector << endl;
01487
01488
01489 if(fDetector == Detector::kFar){
01490
01491
01492 pixel = fStripToPixelMapEast[ntpStrip->strip];
01493
01494 if(ntpStrip->pmtindex0 == fPlaneToPMTMapEast[plane])
01495 fPlanePixelEastSignal[plane][pixel][0] = ntpStrip->ph0.sigcor;
01496 else
01497 fPlanePixelEastSignal[plane][pixel][1] = ntpStrip->ph0.sigcor;
01498
01499
01500 pixel = fStripToPixelMapWest[ntpStrip->strip];
01501 if(ntpStrip->pmtindex1 == fPlaneToPMTMapWest[plane])
01502 fPlanePixelWestSignal[plane][pixel][0] = ntpStrip->ph1.sigcor;
01503 else
01504 fPlanePixelWestSignal[plane][pixel][1] = ntpStrip->ph1.sigcor;
01505
01506 }
01507 else if(fDetector == Detector::kNear){
01508
01509
01510
01511
01512 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01513 << "in near detector algorithm "
01514 << " plane " << plane
01515 << " coverage = " << fPlaneCoverage[plane]
01516 << " view = " << (int)ntpStrip->planeview << endl;
01517
01518 if(fPlaneCoverage[plane] == kNearFull){
01519
01520 if((int)ntpStrip->planeview == kU){
01521 pixel = fStripToPixelMapNearU2[ntpStrip->strip];
01522 if(pixel < 0) pixel = fStripToPixelMapNearU3[ntpStrip->strip];
01523 if(pixel < 0)
01524 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01525 << "cannot find pixel for strip " << ntpStrip->strip
01526 << " plane " << plane << endl;
01527
01528 }
01529 else if((int)ntpStrip->planeview == kV){
01530 pixel = fStripToPixelMapNearV2[ntpStrip->strip];
01531 if(pixel < 0) pixel = fStripToPixelMapNearV3[ntpStrip->strip];
01532 if(pixel < 0)
01533 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01534 << "cannot find pixel for strip " << ntpStrip->strip
01535 << " plane " << plane << endl;
01536
01537 }
01538
01539 }
01540 else if(fPlaneCoverage[plane] == kNearPartial){
01541
01542 if((int)ntpStrip->planeview == kU)
01543 pixel = fStripToPixelMapNearU1[ntpStrip->strip];
01544 else if((int)ntpStrip->planeview == kV)
01545 pixel = fStripToPixelMapNearV1[ntpStrip->strip];
01546
01547 }
01548
01549 if(ntpStrip->pmtindex1 == fPlaneToPMTMapWest[plane])
01550 fPlanePixelWestSignal[plane][pixel][0] = ntpStrip->ph1.sigcor;
01551 else
01552 fPlanePixelWestSignal[plane][pixel][1] = ntpStrip->ph1.sigcor;
01553
01554
01555 }
01556 }
01557
01558 return;
01559 }
01560
01561
01562 void ANtpInfoObjectFillerNC::FindEarlyActivityWeight(NtpSREvent *ntpEvent,
01563 ANtpEventInfoNC *eventInfo)
01564 {
01565
01566
01567 double earliestEventTime = 1.e20;
01568 map<int,int> eventPlanes;
01569 NtpSRStrip *strip = 0;
01570
01571 for(int i = 0; i < ntpEvent->nstrip; ++i){
01572 if (ntpEvent->stp[i] >= 0)
01573 strip = dynamic_cast<NtpSRStrip *>
01574 (fStripArray->At(ntpEvent->stp[i]));
01575 else continue;
01576 if(strip->time1 < earliestEventTime) earliestEventTime = strip->time1;
01577 if(eventPlanes.find(strip->pmtindex1) == eventPlanes.end()) eventPlanes[strip->pmtindex1] = 1;
01578
01579 }
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594 double weightSum = 0.;
01595 for(int i = 0; i < fStripArray->GetLast()+1; ++i){
01596
01597 strip = dynamic_cast<NtpSRStrip *>(fStripArray->At(i));
01598
01599
01600 if(1.e9*(earliestEventTime - strip->time1) > 0.
01601 && 1.e9*(earliestEventTime - strip->time1) < 1000.*1.5
01602 && eventPlanes.find(strip->pmtindex1) != eventPlanes.end()){
01603 weightSum += strip->ph1.sigcor*TMath::Exp(-1.e9*(earliestEventTime - strip->time1)/700.);
01604
01605 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01606 << strip->pmtindex1 << " " << strip->plane
01607 << " " << strip->ph1.sigcor
01608 << " " << 1.e9*(earliestEventTime-strip->time1)
01609 << " " << weightSum
01610 << " " << eventInfo->pulseHeight << endl;
01611
01612 }
01613 }
01614
01615 eventInfo->earlyWeightedADC = weightSum;
01616
01617 return;
01618 }
01619
01620
01621 Float_t ANtpInfoObjectFillerNC::FindNearestNeighborPixelSignal(Int_t plane, Int_t pixel, Int_t pmt,
01622 Float_t planePixelSignal[][64][2])
01623 {
01624 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01625 << "in FindNearestNeighborPixelSignal" << endl;
01626
01627 Float_t sumNeighborSignal = 0.;
01628
01629 if(fDetector == Detector::kFar){
01630 if(pixel == 5 || pixel == 6 || pixel == 9 || pixel == 10)
01631 sumNeighborSignal = (planePixelSignal[plane][pixel-4][pmt] + planePixelSignal[plane][pixel+4][pmt]
01632 + planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]);
01633 else if(pixel < 3 && pixel > 0)
01634 sumNeighborSignal = (planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]
01635 + planePixelSignal[plane][pixel+4][pmt]);
01636 else if(pixel < 15 && pixel > 12)
01637 sumNeighborSignal = (planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]
01638 + planePixelSignal[plane][pixel-4][pmt]);
01639 else if(pixel > 3 && pixel < 15 && (pixel+1)%4 == 0)
01640 sumNeighborSignal = (planePixelSignal[plane][pixel-4][pmt] + planePixelSignal[plane][pixel+4][pmt]
01641 + planePixelSignal[plane][pixel-1][pmt]);
01642
01643 else if(pixel > 3 && pixel < 12 && pixel%4 == 0)
01644 sumNeighborSignal = (planePixelSignal[plane][pixel-4][pmt] + planePixelSignal[plane][pixel+4][pmt]
01645 + planePixelSignal[plane][pixel+1][pmt]);
01646 else if(pixel == 0)
01647 sumNeighborSignal = planePixelSignal[plane][pixel+4][pmt] + planePixelSignal[plane][pixel+1][pmt];
01648
01649 else if(pixel == 3)
01650 sumNeighborSignal = planePixelSignal[plane][pixel+4][pmt] + planePixelSignal[plane][pixel-1][pmt];
01651
01652 else if(pixel == 12)
01653 sumNeighborSignal = planePixelSignal[plane][pixel-4][pmt] + planePixelSignal[plane][pixel+1][pmt];
01654
01655 else if(pixel == 15)
01656 sumNeighborSignal = planePixelSignal[plane][pixel-4][pmt] + planePixelSignal[plane][pixel-1][pmt];
01657
01658 }
01659 else if(fDetector == Detector::kNear){
01660
01661 if( (pixel > 8 && pixel < 15) || (pixel > 16 && pixel < 23)
01662 || (pixel > 24 && pixel < 31) || (pixel > 32 && pixel < 39)
01663 || (pixel > 40 && pixel < 47) || (pixel > 48 && pixel < 55) )
01664 sumNeighborSignal = (planePixelSignal[plane][pixel-8][pmt] + planePixelSignal[plane][pixel+8][pmt]
01665 + planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]);
01666 else if( pixel > 0 && pixel < 7)
01667 sumNeighborSignal = (planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]
01668 + planePixelSignal[plane][pixel+8][pmt]);
01669 else if( pixel > 56 && pixel < 63)
01670 sumNeighborSignal = (planePixelSignal[plane][pixel-1][pmt] + planePixelSignal[plane][pixel+1][pmt]
01671 + planePixelSignal[plane][pixel-8][pmt]);
01672 else if( pixel > 8 && pixel < 63 && (pixel+1)%8==0 )
01673 sumNeighborSignal = (planePixelSignal[plane][pixel-8][pmt] + planePixelSignal[plane][pixel+8][pmt]
01674 + planePixelSignal[plane][pixel-1][pmt]);
01675 else if( pixel > 7 && pixel < 56 && (pixel)%8==0 )
01676 sumNeighborSignal = (planePixelSignal[plane][pixel-8][pmt] + planePixelSignal[plane][pixel+8][pmt]
01677 + planePixelSignal[plane][pixel+1][pmt]);
01678 else if(pixel==0)
01679 sumNeighborSignal = planePixelSignal[plane][pixel+8][pmt] + planePixelSignal[plane][pixel+1][pmt];
01680 else if(pixel==7)
01681 sumNeighborSignal = planePixelSignal[plane][pixel+8][pmt] + planePixelSignal[plane][pixel-1][pmt];
01682 else if(pixel==56)
01683 sumNeighborSignal = planePixelSignal[plane][pixel-8][pmt] + planePixelSignal[plane][pixel+1][pmt];
01684 else if(pixel==63)
01685 sumNeighborSignal = planePixelSignal[plane][pixel-8][pmt] + planePixelSignal[plane][pixel-1][pmt];
01686 }
01687
01688 return sumNeighborSignal;
01689 }
01690
01691
01692 void ANtpInfoObjectFillerNC::FindXTalkStrips(NtpSREvent *ntpEvent)
01693 {
01694 MSG("ANtpInfoObjectFillerNC", Msg::kDebug) << "in FindXTalkStrips" << endl;
01695
01696 NtpSRStrip *ntpStrip = 0;
01697
01698 Int_t plane = 0;
01699 Int_t pixelEast = 0;
01700 Int_t pmtEast = 0;
01701 Int_t pixelWest = 0;
01702 Int_t pmtWest = 0;
01703
01704 for(Int_t ns = 0; ns < ntpEvent->nstrip; ++ns){
01705
01706
01707 if (ntpEvent->stp[ns] >= 0)
01708 ntpStrip = dynamic_cast<NtpSRStrip *>
01709 (fStripArray->At(ntpEvent->stp[ns]));
01710 else continue;
01711 plane = (int)ntpStrip->plane;
01712
01713 if(fDetector == Detector::kFar){
01714 pixelEast = fStripToPixelMapEast[ntpStrip->strip];
01715 pmtEast = 0;
01716 if(fPlaneToPMTMapEast[plane] != ntpStrip->pmtindex0) pmtEast = 1;
01717
01718 if(ntpStrip->ph0.sigcor < 0.1*FindNearestNeighborPixelSignal(plane, pixelEast,
01719 pmtEast, fPlanePixelEastSignal)
01720 || ntpStrip->ph0.sigcor < 90.){
01721 fStripIsXTalkEast[plane][ntpStrip->strip] = 1;
01722 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01723 << "east plane " << plane << " strip " << ntpStrip->strip
01724 << " is xtalk " << ntpStrip->ph0.sigcor << endl;
01725 }
01726
01727 }
01728
01729 pixelWest = fStripToPixelMapWest[ntpStrip->strip];
01730 pmtWest = 0;
01731 if(fPlaneToPMTMapWest[plane] != ntpStrip->pmtindex1) pmtWest = 1;
01732
01733 if(ntpStrip->ph1.sigcor < 0.1*FindNearestNeighborPixelSignal(plane, pixelWest,
01734 pmtWest, fPlanePixelWestSignal)
01735 || ntpStrip->ph1.sigcor < 90.){
01736
01737 fStripIsXTalkWest[plane][ntpStrip->strip] = 1;
01738 MSG("ANtpInfoObjectFillerNC", Msg::kDebug)
01739 << "west plane " << plane << " strip " << ntpStrip->strip
01740 << " is xtalk " << ntpStrip->ph1.sigcor << endl;
01741 }
01742
01743 }
01744 return;
01745 }
01746