Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ANtpEventInfoAna Class Reference

#include <ANtpEventInfoAna.h>

Inheritance diagram for ANtpEventInfoAna:

NueAnaBase List of all members.

Public Member Functions

 ANtpEventInfoAna (ANtpEventInfoNue &anei)
virtual ~ANtpEventInfoAna ()
void Analyze (int evtn, RecRecordImp< RecCandHeader > *srobj)
void FillNueEventInformation (NtpSREvent *ntpEvent, ANtpEventInfoNue *eventInfoNue)
Float_t GetNDCoilCurrent (const VldContext &vc)
Int_t FDRCBoundary (NtpSREventSummary *eventSummary)
void FillStripVariables (NtpSREvent *ntpEvent, RecRecordImp< RecCandHeader > *srobj)

Private Attributes

ANtpEventInfoNuefANtpEventInfo
ANtpInfoObjectFillerfInfoFiller
Int_t fDetectorType

Constructor & Destructor Documentation

ANtpEventInfoAna::ANtpEventInfoAna ANtpEventInfoNue anei  ) 
 

Definition at line 26 of file ANtpEventInfoAna.cxx.

00026                                                         :
00027     fANtpEventInfo(anei),
00028     fDetectorType(Detector::kUnknown)
00029 {}

ANtpEventInfoAna::~ANtpEventInfoAna  )  [virtual]
 

Definition at line 31 of file ANtpEventInfoAna.cxx.

00032 {
00033   
00034 }


Member Function Documentation

void ANtpEventInfoAna::Analyze int  evtn,
RecRecordImp< RecCandHeader > *  srobj
[virtual]
 

Implements NueAnaBase.

Definition at line 37 of file ANtpEventInfoAna.cxx.

References CoilTools::CoilCurrent(), ANtpEventInfoNue::coilCurrent, ANtpEventInfoNue::coilCurrentSM2, ANtpEventInfoNue::coilDirection, ANtpEventInfoNue::coilQuality, NtpSRDetStatus::coilstatus, ANtpEventInfoNue::coilStatus, ANtpEventInfoNue::daveFDDataQuality, det, NtpSRRecord::detstatus, NtpStRecord::detstatus, ANtpEventInfoNue::dmxStatus, NtpSRRecord::dmxstatus, NtpStRecord::dmxstatus, NtpSRRecord::evthdr, NtpStRecord::evthdr, fANtpEventInfo, fDetectorType, FDRCBoundary(), ANtpInfoObjectFiller::FillEventInformation(), FillNueEventInformation(), FillStripVariables(), NtpVtxFinder::FindVertex(), fInfoFiller, VldContext::GetDetector(), SntpHelpers::GetEvent(), RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetRemoteSpillType(), VldContext::GetSimFlag(), RecPhysicsHeader::GetSnarl(), ANtpRecoNtpManipulator::GetStripArray(), RecPhysicsHeader::GetTrigSrc(), RecHeader::GetVldContext(), ANtpEventInfo::index, ReleaseType::IsCedar(), DataUtil::IsGoodFDData(), CoilTools::IsOK(), CoilTools::IsReverse(), ANtpEventInfoNue::largestEvent, NtpSREventSummary::litime, ANtpEventInfoNue::liTime, ANtpInfoObjectFiller::MetersToBeam(), ANtpInfoObjectFiller::MetersToCloseEdge(), ANtpInfoObjectFiller::MetersToCoil(), NtpSRStripPulseHeight::mip, MSG, NtpSREventSummary::nevent, NtpSRDmxStatus::nonphysicalfail, NtpSREvent::ph, ANtpEventInfoNue::rcBoundary, s(), ANtpInfoObjectFiller::SetStripArray(), NtpVtxFinder::SetTargetEvent(), ANtpEventInfoNue::spillType, ANtpEventInfoNue::triggerSource, NtpSRDmxStatus::validplanesfail, NtpSRDmxStatus::vertexplanefail, ANtpEventInfo::vertexTime, ANtpEventInfo::vtxMetersToBeam, ANtpEventInfo::vtxMetersToCloseEdge, ANtpEventInfo::vtxMetersToCoil, NtpVtxFinder::VtxT(), NtpVtxFinder::VtxX(), ANtpEventInfo::vtxX, NtpVtxFinder::VtxY(), ANtpEventInfo::vtxY, NtpVtxFinder::VtxZ(), and ANtpEventInfo::vtxZ.

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

00038 {
00039 
00040     fANtpEventInfo.index = evtn;
00041 
00042 //    const RecCandHeader *ntpHeader = &(srobj->GetHeader());
00043 
00044     ANtpRecoNtpManipulator *ntpManipulator = 0;
00045     NtpStRecord *st = dynamic_cast<NtpStRecord *>(srobj);
00046     NtpSRRecord *sr = 0;   
00047     NtpSREventSummary *eventSummary;
00048     NtpSRDmxStatus *dmxSummary;
00049     NtpSRDetStatus *detStatus;
00050     const RecCandHeader *header;
00051                           
00052     if(st != 0){
00053       ntpManipulator = new ANtpRecoNtpManipulator(st);
00054       header = &(st->GetHeader());
00055       eventSummary = &(st->evthdr);
00056       detStatus = &(st->detstatus);
00057       dmxSummary = &(st->dmxstatus);
00058     }
00059     else{
00060       sr = dynamic_cast<NtpSRRecord *>(srobj);
00061       ntpManipulator = new ANtpRecoNtpManipulator(sr);
00062       header = &(sr->GetHeader());
00063       eventSummary = &(sr->evthdr);
00064       detStatus = &(sr->detstatus);
00065       dmxSummary = &(sr->dmxstatus);
00066     }
00067 
00068     fDetectorType = header->GetVldContext().GetDetector();
00069     SimFlag::SimFlag_t s = header->GetVldContext().GetSimFlag();
00070     if(s == SimFlag::kMC && evtn == -10) return;
00071                                                                                
00072 
00073     MSG("ANtpEventInfoAna",Msg::kDebug)<<"Filled event information specific to nue" << endl; 
00074 
00075     fANtpEventInfo.triggerSource = header->GetTrigSrc();
00076     fANtpEventInfo.spillType = header->GetRemoteSpillType();
00077     fANtpEventInfo.liTime = eventSummary->litime;    
00078 
00079 //    fANtpEventInfo.triggerTime = eventSummary->trigtime;
00080     fANtpEventInfo.coilStatus  = detStatus->coilstatus;
00081                                                                                 
00082     fANtpEventInfo.coilCurrent = 0;
00083     fANtpEventInfo.coilQuality = 0;
00084     VldContext vld = header->GetVldContext();
00085 
00086     if(s != SimFlag::kMC){
00087        std::pair<float, float> temp = CoilTools::CoilCurrent(vld);
00088 
00089        fANtpEventInfo.coilCurrent = temp.first;
00090        if(vld.GetDetector() == Detector::kFar)
00091           fANtpEventInfo.coilCurrentSM2 = temp.second;
00092        fANtpEventInfo.coilQuality = CoilTools::IsOK(vld);
00093        if(CoilTools::IsReverse(vld))  fANtpEventInfo.coilDirection = -1; 
00094        else                           fANtpEventInfo.coilDirection = 1;
00095     }
00096 
00097     fANtpEventInfo.dmxStatus = 0;
00098     fANtpEventInfo.dmxStatus += (dmxSummary->nonphysicalfail);
00099     fANtpEventInfo.dmxStatus += ((dmxSummary->validplanesfail<<1));
00100     fANtpEventInfo.dmxStatus += ((dmxSummary->vertexplanefail<<2));
00101 
00102 
00103     fANtpEventInfo.rcBoundary = FDRCBoundary(eventSummary);
00104     fANtpEventInfo.daveFDDataQuality = DataUtil::IsGoodFDData(st);
00105 
00106     if(evtn == -10) return;
00107 
00108 
00109     NtpSREvent *event = 0;
00110     event = SntpHelpers::GetEvent(evtn,srobj);
00111     if(!event){
00112         MSG("ANtpEventInfoAna",Msg::kError)<<"Couldn't get event "
00113                <<evtn<<" from Snarl "<<srobj->GetHeader().GetSnarl()<<endl;
00114         return;
00115     }
00116 
00117 
00118     fInfoFiller = new ANtpInfoObjectFiller();
00119         MSG("ANtpEventInfoAna",Msg::kDebug)<<"Created manipulator and filler "
00120                                            << ntpManipulator << " "
00121                                            << fInfoFiller <<endl;
00122 
00123 //  Fill information from the base ANtpEventINfo
00124 //    TClonesArray* temp = ntpManipulator->GetStripArray();
00125 //    MSG("ANtpEventInfoAna",Msg::kDebug)<<"Filled array " << temp->GetEntries()
00126 //                                     <<endl;
00127     fInfoFiller->SetStripArray(ntpManipulator->GetStripArray());
00128     MSG("ANtpEventInfoAna",Msg::kDebug)<<"SetStripArray " << fInfoFiller;
00129     fInfoFiller->FillEventInformation(ntpManipulator, event, &fANtpEventInfo);
00130     MSG("ANtpEventInfoAna",Msg::kDebug)<<"Filled event information "
00131                                        << fInfoFiller << endl;
00132 
00133     if(ReleaseType::IsCedar(release))
00134     {
00135       Float_t vtxx, vtxy, vtxz;
00136 
00137       NtpVtxFinder vtxf;
00138       vtxf.SetTargetEvent(evtn, st);
00139       if(vtxf.FindVertex() > 0){
00140         fANtpEventInfo.vtxX = vtxx = vtxf.VtxX();
00141         fANtpEventInfo.vtxY = vtxy = vtxf.VtxY();
00142         fANtpEventInfo.vtxZ = vtxz = vtxf.VtxZ();
00143         fANtpEventInfo.vertexTime = vtxf.VtxT();
00144 
00145         Detector::Detector_t det = ( Detector::Detector_t) fDetectorType;
00146         fANtpEventInfo.vtxMetersToBeam =
00147             fInfoFiller->MetersToBeam(det, vtxx, vtxy, vtxz);
00148         fANtpEventInfo.vtxMetersToCoil =
00149              fInfoFiller->MetersToCoil(det, vtxx, vtxy);
00150         fANtpEventInfo.vtxMetersToCloseEdge =
00151              fInfoFiller->MetersToCloseEdge(det, vtxx,vtxy, 0);
00152      }
00153    }
00154 
00155     FillNueEventInformation(event, &fANtpEventInfo);
00156 
00157 
00158     int lgst_evt_idx=-1;
00159     float big_ph=0.0;
00160     for(int i=0;i<eventSummary->nevent;i++){ 
00161       NtpSREvent *evtTemp = SntpHelpers::GetEvent(i,srobj);
00162       if(evtTemp == 0) continue; //no event found
00163       if(evtTemp->ph.mip > big_ph){ 
00164         big_ph=evtTemp->ph.mip; 
00165         lgst_evt_idx=i;
00166       }
00167     }
00168 
00169     fANtpEventInfo.largestEvent = 0;    
00170     if(lgst_evt_idx == evtn)
00171        fANtpEventInfo.largestEvent = 1;
00172 
00173     FillStripVariables(event, srobj);
00174      
00175   if(fInfoFiller){
00176     delete fInfoFiller;
00177     fInfoFiller=0;
00178   }
00179   if(ntpManipulator){
00180     delete ntpManipulator;
00181     ntpManipulator=0;
00182   }
00183 
00184 }

Int_t ANtpEventInfoAna::FDRCBoundary NtpSREventSummary eventSummary  ) 
 

Definition at line 206 of file ANtpEventInfoAna.cxx.

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

Referenced by Analyze().

00206                                                                    {
00207   Int_t litag=0;
00208   Int_t numshower=eventSummary->nshower;
00209   Float_t allph=eventSummary->ph.raw;
00210   Int_t plbeg=eventSummary->plane.beg;
00211   Int_t plend=eventSummary->plane.end;
00212 
00213   if (numshower) {
00214     if (allph>1e6) litag+=10;
00215 
00216     if (((plbeg==1 || plbeg==2) && (plend==63 || plend==64)) ||
00217         ((plbeg==65 || plbeg==66) && (plend==127 || plend==128)) ||
00218         ((plbeg==129 || plbeg==130) && (plend==191 || plend==192)) ||
00219         ((plbeg==193 || plbeg==194) && (plend==247 || plend==248))) litag++;
00220     if (((plbeg==250 || plbeg==251) && (plend==312 || plend==313)) ||
00221         ((plbeg==314 || plbeg==315) && (plend==376 || plend==377)) ||
00222         ((plbeg==378 || plbeg==379) && (plend==440 || plend==441)) ||
00223         ((plbeg==442 || plbeg==443) && (plend==484 || plend==485))) litag++;
00224   }
00225   return litag;
00226 }

void ANtpEventInfoAna::FillNueEventInformation NtpSREvent ntpEvent,
ANtpEventInfoNue eventInfoNue
 

Definition at line 187 of file ANtpEventInfoAna.cxx.

References NtpSREvent::end, NtpSRStripPulseHeight::mip, NtpSREvent::ph, ANtpEventInfoNue::phMeu, ANtpEventInfoNue::phMip, ANtpEventInfoNue::phNueGeV, NtpSRVertex::t, ANtpEventInfoNue::timeLength, and NtpSREvent::vtx.

Referenced by Analyze().

00188 {
00189 
00190     eventInfoNue->timeLength=ntpEvent->end.t-ntpEvent->vtx.t; // event time lenght
00191     eventInfoNue->phMeu =  ntpEvent->ph.mip;
00192     eventInfoNue->phMip =  ntpEvent->ph.mip;
00193     eventInfoNue->phNueGeV = ntpEvent->ph.mip/MeuPerGeV;
00194    
00195     return;
00196 }

void ANtpEventInfoAna::FillStripVariables NtpSREvent ntpEvent,
RecRecordImp< RecCandHeader > *  srobj
 

Definition at line 228 of file ANtpEventInfoAna.cxx.

References ANtpEventInfoNue::eventSignalFull, ANtpEventInfoNue::eventSignalPartial, ANtpEventInfoNue::eventTimeMax, ANtpEventInfoNue::eventTimeMin, fANtpEventInfo, fDetectorType, RecRecordImp< T >::GetHeader(), VldTimeStamp::GetNanoSec(), RecPhysicsHeader::GetSnarl(), SntpHelpers::GetStrip(), SntpHelpers::GetStripIndex(), VldContext::GetTimeStamp(), RecHeader::GetVldContext(), ANtpEventInfoNue::hotch, NueConvention::InPartialRegion(), NtpSRStripPulseHeight::mip, MSG, NtpSREvent::nstrip, NtpSREvent::ph, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRPulseHeight::raw, NtpSRStrip::strip, striptime, NtpSRStrip::time0, NtpSRStrip::time1, and ANtpEventInfoNue::triggerPass.

Referenced by Analyze().

00229 {
00230  
00231   Int_t  HotChannel = 0;
00232   //cut and pasted, with minor changes from MadDpAnalysis.cxx
00233 
00234   double trgtime= srobj->GetHeader().GetVldContext().GetTimeStamp().GetNanoSec()/1.e9;                                                                                
00235   double timemax=0.;
00236   double timemin=1.e10;
00237 
00238   Float_t sigfull,sigpart;
00239   sigfull=sigpart=0;
00240 
00241   int triggerPlanes = 4; //4/5 plane trigger
00242   int nDetPlanes = 0;
00243   if(fDetectorType == Detector::kNear)   nDetPlanes = 122;
00244   if(fDetectorType == Detector::kFar)    nDetPlanes = 485;
00245                                                                                      
00246   vector<int> dataInPlane;
00247   dataInPlane.assign(nDetPlanes, 0);
00248 
00249   for(int i=0;i<ntpEvent->nstrip;i++){
00250     Int_t index = SntpHelpers::GetStripIndex(i,ntpEvent);
00251     NtpSRStrip *ntpStrip = SntpHelpers::GetStrip(index,srobj);
00252     if(!ntpStrip){
00253       MSG("ANtpEventInfoAna",Msg::kError)<<"Couldn't get strip "
00254               <<index<<" from "<<" snarl "
00255               <<srobj->GetHeader().GetSnarl()
00256               <<" something has gone horribly wrong, I'll just go"
00257               <<" on to the next strip"<<endl;
00258       continue;
00259     }
00260     
00261     if(fDetectorType==Detector::kNear)
00262        if(ntpStrip->ph0.raw+ntpStrip->ph1.raw>60000) HotChannel = 1;
00263 
00264     //Strip Timing Information
00265     Double_t striptime = 0;
00266     if(fDetectorType==Detector::kNear){
00267       striptime=ntpStrip->time1-trgtime;
00268     }
00269     if(fDetectorType==Detector::kFar){
00270       Double_t striptime1=ntpStrip->time1-trgtime;
00271       Double_t striptime0=ntpStrip->time0-trgtime;
00272       if(striptime1>0 && striptime0<0)  striptime=striptime1;
00273       if(striptime0>0 && striptime1<0)  striptime=striptime0;
00274       if(striptime0>0 && striptime1>0)  striptime=(striptime0+striptime1)/2.; 
00275     }
00276 
00277     if(striptime<=timemin) timemin=striptime;
00278     if(striptime>=timemax) timemax=striptime;
00279     //End of Strip timing information
00280 
00281     // compute the amount of signal in the partially instrumented region
00282     // and the amount in the fully instrumented region
00283     //
00284     // this region is defined as:
00285     // v planes: (strip<=4 || strip>=67)
00286     // partial u: (strip==0 || strip=63)
00287     // full u: (strip<=26 || strip>=88) 
00288 
00289     if(fDetectorType == Detector::kNear){
00290       Int_t pr = NueConvention::InPartialRegion(ntpStrip->plane, ntpStrip->strip);
00291       if(!evtstp0mip){
00292        MSG("ANtpEventInfoAna",Msg::kError)<<"No mip strip information"<<endl;
00293        continue;
00294       }
00295 
00296       float charge = evtstp0mip[index] + evtstp1mip[index];
00297       if(pr==1)      {  sigpart += charge; }
00298       else if(pr==-1){  sigfull += charge; }
00299     }
00300                                                                                      
00301     if(ntpStrip->plane <  nDetPlanes) dataInPlane[ntpStrip->plane] = 1;
00302   }
00303   
00304   bool triggerVerified = false;
00305   Int_t group = 0;
00306                                                                        
00307   for(Int_t loop = 0; loop < nDetPlanes && !triggerVerified; loop++) {
00308     if(dataInPlane[loop] > 0) {
00309        group = 1;
00310        for(Int_t l = 1; l < triggerPlanes+1; l++) {
00311          if(dataInPlane[loop+l] > 0) group++;
00312        }
00313        if(group >= triggerPlanes) triggerVerified = true;
00314      }
00315    }
00316                                 
00317   dataInPlane.clear();                                                     
00318 
00319   if(fDetectorType == Detector::kFar){
00320     sigfull = ntpEvent->ph.mip;
00321     sigpart = 0;
00322   }
00323   
00324   fANtpEventInfo.eventSignalFull = sigfull;
00325   fANtpEventInfo.eventSignalPartial = sigpart;
00326 
00327   fANtpEventInfo.triggerPass = (int) triggerVerified;
00328     
00329   fANtpEventInfo.eventTimeMax=timemax;
00330   fANtpEventInfo.eventTimeMin=timemin;
00331   fANtpEventInfo.hotch = HotChannel;
00332 
00333 
00334 //    evttimeln=timemax-timemin;
00335 
00336 }

Float_t ANtpEventInfoAna::GetNDCoilCurrent const VldContext vc  ) 
 

Definition at line 198 of file ANtpEventInfoAna.cxx.

References Dcs_Mag_Near::GetCurrent(), CoilTools::GetMagNear(), and CoilTools::Instance().

00199 {
00200    const Dcs_Mag_Near* magnear =
00201          CoilTools::Instance().GetMagNear(vc);  // NearDet only
00202    if ( magnear ) return magnear->GetCurrent();
00203    else           return 0;
00204 }


Member Data Documentation

ANtpEventInfoNue& ANtpEventInfoAna::fANtpEventInfo [private]
 

Definition at line 29 of file ANtpEventInfoAna.h.

Referenced by Analyze(), and FillStripVariables().

Int_t ANtpEventInfoAna::fDetectorType [private]
 

Definition at line 32 of file ANtpEventInfoAna.h.

Referenced by Analyze(), and FillStripVariables().

ANtpInfoObjectFiller* ANtpEventInfoAna::fInfoFiller [private]
 

Definition at line 30 of file ANtpEventInfoAna.h.

Referenced by Analyze().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:08:39 2010 for loon by  doxygen 1.3.9.1