EventQualAna Class Reference

#include <EventQualAna.h>

Inheritance diagram for EventQualAna:
NueAnaBase

List of all members.

Public Member Functions

 EventQualAna (NueRecord &nr)
 ~EventQualAna ()
void Analyze (int evtn, RecRecordImp< RecCandHeader > *srobj)
Int_t FDRCBoundary (NtpSREventSummary *eventSummary)

Private Member Functions

 EventQualAna (const EventQualAna &rhs)

Private Attributes

NueRecordnr

Detailed Description

Definition at line 11 of file EventQualAna.h.


Constructor & Destructor Documentation

EventQualAna::EventQualAna ( NueRecord nr  ) 

Definition at line 28 of file EventQualAna.cxx.

00028                                        :
00029     nr(nr)
00030 {}

EventQualAna::~EventQualAna (  ) 

Definition at line 32 of file EventQualAna.cxx.

00033 {
00034   
00035 }

EventQualAna::EventQualAna ( const EventQualAna rhs  )  [private]

Member Function Documentation

void EventQualAna::Analyze ( int  evtn,
RecRecordImp< RecCandHeader > *  srobj 
) [virtual]

Implements NueAnaBase.

Definition at line 37 of file EventQualAna.cxx.

References EventQual::closeTimeDeltaZ, EventQual::coilDirection, EventQual::coilQuality, NtpSRDetStatus::coilstatus, EventQual::coilStatus, det, NtpStRecord::detstatus, EventQual::dmxstatus, NtpStRecord::dmxstatus, MuELoss::e, EventQual::edgeActivityPH, EventQual::edgeActivityStrips, NueRecord::eventq, NtpStRecord::evthdr, FDRCBoundary(), VldContext::GetDetector(), SntpHelpers::GetEvent(), RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetRemoteSpillType(), VldContext::GetSimFlag(), VHS::GetStrip(), SntpHelpers::GetStripIndex(), RecPhysicsHeader::GetTrigSrc(), RecHeader::GetVldContext(), header, DataUtil::IsGoodData(), EventQual::isLargestEvent, LISieve::IsLI(), RunStatus::IsOK(), CoilTools::IsReverse(), Detector::kFar, SimFlag::kMC, EventQual::liTime, NtpSREventSummary::litime, EventQual::minTimeSeparation, NtpSRStripPulseHeight::mip, NtpSREventSummary::nevent, NtpSRDmxStatus::nonphysicalfail, nr, NtpSREventSummary::nstrip, NtpSREvent::nstrip, EventQual::oppEdgePH, EventQual::oppEdgeStrips, EventQual::passCosmicCut, NueStandard::PassesCosmicCutFunction(), EventQual::passFarDetQuality, EventQual::passLI, EventQual::passNearDetQuality, NtpSREvent::ph, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRVertex::plane, EventQual::rcBoundary, NtpSRPulseHeight::sigcor, EventQual::spillType, NtpSRStrip::time1, NtpSRStrip::tpos, EventQual::triggerSource, NtpSRDmxStatus::validplanesfail, NtpSRDmxStatus::vertexplanefail, NtpSREvent::vtx, and NtpSRVertex::z.

Referenced by NueModule::Analyze(), and NueRecordAna::Analyze().

00038 {
00039     NtpStRecord *st = dynamic_cast<NtpStRecord*>(srobj);
00040 
00041 //    cout<<"Starting EventQualAna - "<<evtn<<endl;
00042     if(st == 0) return;
00043  
00044     NtpSREventSummary *eventSummary = &(st->evthdr);
00045     NtpSRDmxStatus *dmxSummary = &(st->dmxstatus);
00046     NtpSRDetStatus *detStatus = &(st->detstatus);
00047     const RecCandHeader *header = &(st->GetHeader());
00048                                                                                                              
00049     int det = header->GetVldContext().GetDetector();
00050     SimFlag::SimFlag_t s = header->GetVldContext().GetSimFlag();
00051     VldContext vld = header->GetVldContext();
00052 
00053     
00054     if(s == SimFlag::kMC && evtn == -10) return; //if "empty" and mc don't need this all
00055 
00056     nr.eventq.triggerSource = header->GetTrigSrc();
00057     nr.eventq.spillType   = header->GetRemoteSpillType();
00058 //    nr.eventq.triggerTime = eventSummary->trigtime;
00059     nr.eventq.coilStatus  = detStatus->coilstatus;
00060 
00061     nr.eventq.liTime = eventSummary->litime;
00062     int isLI = 0;
00063     if(nr.eventq.liTime != -1) isLI = 1;
00064     else{ isLI = (int) LISieve::IsLI((*st)); }
00065     
00066     nr.eventq.passLI = 1 - isLI;  // 1 when its a good event
00067 
00068 //    cout<<"LITime - "<<isLI<<endl;                                                                                                             
00069     nr.eventq.coilQuality = 0;
00070     nr.eventq.coilDirection = 0;
00071 
00072     if(s != SimFlag::kMC){
00073        nr.eventq.coilQuality = CoilTools::IsOK(vld);
00074        if(CoilTools::IsReverse(vld))  nr.eventq.coilDirection = -1;
00075        else                           nr.eventq.coilDirection = 1;
00076     }
00077 
00078 //    cout<<nr.eventq.coilQuality<<"  "<<nr.eventq.coilDirection<<endl;
00079                                                                                                              
00080     int dmxStatus = 0;
00081     dmxStatus += (dmxSummary->nonphysicalfail);
00082     dmxStatus += ((dmxSummary->validplanesfail<<1));
00083     dmxStatus += ((dmxSummary->vertexplanefail<<2));
00084     nr.eventq.dmxstatus = dmxStatus;
00085     
00086     nr.eventq.rcBoundary = 0;
00087     if(det == Detector::kFar)
00088     {
00089       nr.eventq.rcBoundary = FDRCBoundary(eventSummary);
00090     }
00091 
00092     nr.eventq.passFarDetQuality = 1;    
00093     if(s != SimFlag::kMC) nr.eventq.passFarDetQuality = DataUtil::IsGoodData(st);
00094     nr.eventq.passNearDetQuality = nr.eventq.passFarDetQuality;
00095     //Greg July 29, 2009: I added the variable passNearDetQuality 
00096     //passNearDetQuality is the same as passFarDetQuality 
00097     //I would have preferred to have renamed passFarDetQuality->passDetQuality 
00098     //but I worried that it might have caused problems with older nueana files   
00099     //and I didn't want to store ND quailty in something that is called FD
00100     //so the two identical variables, maybe they will diverge in the future 
00101 
00102     if(evtn == -10) return;  //exit if this is an "empty" snarl
00103 
00104     nr.eventq.passCosmicCut = NueStandard::PassesCosmicCutFunction(&nr);
00105 
00106     int lgst_evt_idx=-1;
00107     float big_ph=0.0;
00108     for(int i=0;i<eventSummary->nevent;i++){ 
00109       NtpSREvent *evtTemp = SntpHelpers::GetEvent(i,srobj);
00110       if(evtTemp == 0) continue; //no event found
00111       if(evtTemp->ph.mip > big_ph){ 
00112         big_ph=evtTemp->ph.mip; 
00113         lgst_evt_idx=i;
00114       }
00115     }
00116 
00117     nr.eventq.isLargestEvent = 0;    
00118     if(lgst_evt_idx == evtn)  nr.eventq.isLargestEvent = 1;
00119 
00120     NtpSREvent *event = SntpHelpers::GetEvent(evtn,st);
00121 
00122     //Loop over all the snarls
00123     Int_t edgeActivityStrips = 0;
00124     Float_t edgeActivityPH = 0;
00125     Int_t oppEdgeStrips = 0;
00126     Float_t oppEdgePH = 0;
00127                                                                                                              
00128     Double_t thisEvtTime = 99999.;
00129                                                                                 
00130     Int_t thisVtxPlane = 0;
00131     Float_t thisVtxZ = 0.0;                                                                                
00132     thisVtxPlane = event->vtx.plane;
00133     thisVtxZ = event->vtx.z;
00134                                                                                 
00135     vector<Double_t> stpTimes; // container needed to calculate median
00136                                                                                 
00137     // loop over strips in current event
00138     for(int i = 0; i < event->nstrip; i++){
00139        Int_t index = SntpHelpers::GetStripIndex(i,event);
00140        NtpSRStrip *strip = SntpHelpers::GetStrip(index,srobj);
00141        if(!strip)  continue;
00142      
00143        if (strip->plane >= thisVtxPlane 
00144              && strip->plane  < (thisVtxPlane+5)) { 
00145           stpTimes.push_back(strip->time1);
00146        }
00147     }
00148     // calculate strip time median for this event
00149     sort(stpTimes.begin(), stpTimes.end());
00150  
00151     if(stpTimes.size() > 0){
00152 
00153     if (stpTimes.size()%2)
00154       thisEvtTime = *(stpTimes.begin()+stpTimes.size()/2);
00155     else
00156       thisEvtTime = ( *(stpTimes.begin()+stpTimes.size()/2)
00157                     + *(stpTimes.begin()+stpTimes.size()/2-1) )/2.;
00158                                                                               
00159     Double_t timeDiff = 99999.;
00160     int nevent = eventSummary->nevent;
00161     for(int i = 0; i < nevent; ++i){
00162       NtpSREvent *evtTemp = SntpHelpers::GetEvent(i,srobj);
00163       if(evtTemp == 0) continue; //no event found
00164       // don't want to compare time to itself
00165       if (i == evtn) continue;
00166                                                                                 
00167       int vtxPlane = evtTemp->vtx.plane;
00168       float vtxZ = evtTemp->vtx.z;
00169    
00170       Double_t evtTime = 99999.;
00171       stpTimes.clear();
00172                                                                                 
00173       // loop over strips in other event
00174       for(Int_t j = 0; j < evtTemp->nstrip; ++j){
00175          Int_t index = SntpHelpers::GetStripIndex(j,evtTemp);
00176          NtpSRStrip *strip = SntpHelpers::GetStrip(index,st);
00177          if(!strip)  continue;
00178          if (strip->plane >= vtxPlane && strip->plane < (vtxPlane+5)) {
00179            stpTimes.push_back(strip->time1);
00180          }
00181       }
00182       // calculate strip time median for this event
00183       sort(stpTimes.begin(), stpTimes.end());
00184       if (stpTimes.size()%2)
00185         evtTime = *(stpTimes.begin()+stpTimes.size()/2);
00186       else
00187         evtTime= ( *(stpTimes.begin()+stpTimes.size()/2)
00188                + *(stpTimes.begin()+stpTimes.size()/2-1) )/2.;
00189                                                                                 
00190       Double_t deltaT = evtTime - thisEvtTime;
00191       if( TMath::Abs(deltaT) < TMath::Abs(timeDiff)) {
00192         timeDiff = deltaT;
00193         nr.eventq.closeTimeDeltaZ = thisVtxZ - vtxZ;
00194       }
00195   }
00196   //end loop over events to find min time separation between events
00197   nr.eventq.minTimeSeparation = timeDiff;
00198                                                                                 
00199   // calculate edge activity variables
00200   Double_t activityTimeStart = thisEvtTime - 4e-8; // +/- 40ns window
00201   Double_t activityTimeStop  = thisEvtTime + 4e-8;
00202 
00203   // loop over strips in snarl
00204   for(unsigned int i = 0; i < eventSummary->nstrip; ++i){
00205      NtpSRStrip *strip = SntpHelpers::GetStrip(i,st);
00206      if(!strip)  continue;
00207 
00208      // consider only strips in time window
00209      if (strip->time1 > activityTimeStart
00210         && strip->time1 < activityTimeStop) {
00211                                                                                 
00212       // look at U planes in calorimeter
00213       if (strip->plane%2==1 && (strip->tpos<-0.24)
00214           && strip->plane<121) {
00215         edgeActivityStrips++;
00216         edgeActivityPH += strip->ph1.sigcor;
00217       }
00218       // look at opposite edge in U (use 3 strips of fully instr.)
00219       if (strip->plane%2==1 && (strip->tpos>2.27)
00220           && strip->plane<121) {
00221         oppEdgeStrips++;
00222         oppEdgePH += strip->ph1.sigcor;
00223       }
00224       // look at V planes in calorimeter
00225       if (strip->plane%2==0 && (strip->tpos>0.24)
00226           && strip->plane<121) {
00227         edgeActivityStrips++;
00228         edgeActivityPH += strip->ph1.sigcor;
00229       }
00230       // look at opposite edge in V (use 3 strips of fully instr.)
00231       if (strip->plane%2==0 && (strip->tpos<-2.27)
00232           && strip->plane<121) {
00233         oppEdgeStrips++;
00234         oppEdgePH += strip->ph1.sigcor;
00235       }
00236                                                                                 
00237     } // time window
00238   }
00239   }
00240   nr.eventq.edgeActivityPH = edgeActivityPH;
00241   nr.eventq.edgeActivityStrips = edgeActivityStrips;
00242   nr.eventq.oppEdgePH = oppEdgePH;
00243   nr.eventq.oppEdgeStrips = oppEdgeStrips;
00244                                                                                 
00245   //....................................................................
00246 
00247 
00248 
00249 }

Int_t EventQualAna::FDRCBoundary ( NtpSREventSummary eventSummary  ) 

Definition at line 252 of file EventQualAna.cxx.

References NtpSRPlane::beg, NtpSRPlane::end, NtpSREventSummary::nshower, NtpSREventSummary::ph, NtpSREventSummary::plane, and NtpSRPulseHeight::raw.

Referenced by Analyze().

00252                                                                {
00253   Int_t litag=0;
00254   Int_t numshower=eventSummary->nshower;
00255   Float_t allph=eventSummary->ph.raw;
00256   Int_t plbeg=eventSummary->plane.beg;
00257   Int_t plend=eventSummary->plane.end;
00258 
00259   if (numshower) {
00260     if (allph>1e6) litag+=10;
00261 
00262     if (((plbeg==1 || plbeg==2) && (plend==63 || plend==64)) ||
00263         ((plbeg==65 || plbeg==66) && (plend==127 || plend==128)) ||
00264         ((plbeg==129 || plbeg==130) && (plend==191 || plend==192)) ||
00265         ((plbeg==193 || plbeg==194) && (plend==247 || plend==248))) litag++;
00266     if (((plbeg==250 || plbeg==251) && (plend==312 || plend==313)) ||
00267         ((plbeg==314 || plbeg==315) && (plend==376 || plend==377)) ||
00268         ((plbeg==378 || plbeg==379) && (plend==440 || plend==441)) ||
00269         ((plbeg==442 || plbeg==443) && (plend==484 || plend==485))) litag++;
00270   }
00271   return litag;
00272 }


Member Data Documentation

Definition at line 23 of file EventQualAna.h.

Referenced by Analyze().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1