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

NtpTools Class Reference

#include <NtpTools.h>

List of all members.

Public Types

typedef enum NtpTools::EBeamType BeamType_t
enum  EBeamType {
  kAny = -1, kUnknown = 0, kLE10 = 1, kME = 2,
  kHE = 3, kpME = 4, pHE = 5
}

Public Member Functions

 NtpTools ()
 ~NtpTools ()
float GetMCEventWeight (const NtpStRecord *record, const int eventno)
bool MakeEventPict (const char *title, const NtpStRecord *record, const int eventno)

Static Public Member Functions

const NtpSREventGetEvent (const NtpStRecord *record, const int eventno)
VldContext GetVldContext (const NtpStRecord *record)
Detector::Detector_t GetDetector (const NtpStRecord *record)
bool VtxIsContained (const NtpStRecord *record, const int eventno)
bool IsInFidVolumeNear (const float x, const float y, const float z)
bool IsInFidVolumeFar (const float x, const float y, const float z)
bool PassBeamCuts (const BeamType_t beamtype, const NtpBDLiteRecord *beamntp, float &pot, bool isMC=false)
float RadialDistFromBeam (const float x, const float y)
const NtpSRTrackGetPrimaryTrack (const NtpStRecord *record, const int eventno)
bool FillRecoEInfo (const NtpStRecord *record, const int eventno, RecoE *recoe)
Int_t GetPittContainmentFlag (const NtpSREvent *evt)
bool FillMyShwInfo (const NtpStRecord *record, const int eventno, MyShwInfo *shwinfo)
bool GetTrueEnergy (const NtpStRecord *record, const int eventno, float &mceneu)
const NtpMCTruthGetTruth (const NtpStRecord *record, const int eventno)
int GetNEventsPerSlice (const NtpStRecord *record, const int eventno)
float GetTotHadPt (const NtpStRecord *record, const NtpMCTruth *truth)

Private Member Functions

bool ResetCanvas (Detector::Detector_t det)
bool PrintCanvas (const char *title)

Private Attributes

ZflukfFluxModel
TCanvas * fCanvas
TH2F * fUZAxis
TH2F * fVZAxis
std::vector< TMarker > fUZMarkers
std::vector< TMarker > fVZMarkers


Member Typedef Documentation

typedef enum NtpTools::EBeamType NtpTools::BeamType_t
 

Referenced by PassBeamCuts().


Member Enumeration Documentation

enum NtpTools::EBeamType
 

Enumeration values:
kAny 
kUnknown 
kLE10 
kME 
kHE 
kpME 
pHE 

Definition at line 34 of file NtpTools.h.

00034                         {
00035     kAny = -1,  //use this to say "I dont care what beam type it is"
00036     kUnknown = 0,
00037     kLE10 = 1,
00038     kME = 2,
00039     kHE = 3,
00040     kpME = 4,
00041     pHE = 5
00042   }BeamType_t;


Constructor & Destructor Documentation

NtpTools::NtpTools  ) 
 

Definition at line 23 of file NtpTools.cxx.

References fCanvas, fFluxModel, MSG, and Zfluk::UseParameterization().

00024   : fCanvas(NULL),
00025     fUZAxis(NULL),
00026     fVZAxis(NULL)
00027 {
00028   MSG("NtpAna",Msg::kDebug) << " NtpTools::NtpTools() "<<endl;
00029   fCanvas = new TCanvas("canv", " NtpTools ", 800, 422);
00030   fFluxModel = new Zfluk();
00031   fFluxModel->UseParameterization("SKZP");  
00032 }

NtpTools::~NtpTools  ) 
 

Definition at line 35 of file NtpTools.cxx.

00035                    {
00036   if(fCanvas) delete fCanvas;
00037   if(fUZAxis) delete fUZAxis;
00038   if(fVZAxis) delete fVZAxis;
00039 }


Member Function Documentation

bool NtpTools::FillMyShwInfo const NtpStRecord record,
const int  eventno,
MyShwInfo shwinfo
[static]
 

Definition at line 273 of file NtpTools.cxx.

References GetEvent(), MyShwInfo::maxPH3Plane, NtpSREvent::nstrip, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, MyShwInfo::Reset(), NtpSRPulseHeight::sigcor, NtpSREvent::stp, NtpStRecord::stp, and MyShwInfo::totalPH.

00273                                                                                             {
00274   shwinfo->Reset();
00275   static float planePH[500];
00276   for(int i=0; i<500; ++i) planePH[i] = 0;
00277   const NtpSREvent* event = GetEvent(record, eventno);
00278   for(int istp = 0; istp<event->nstrip; ++istp){
00279     const NtpSRStrip* strip = dynamic_cast<const NtpSRStrip*>(record->stp->At(event->stp[istp]));
00280     shwinfo->totalPH+=(strip->ph0.sigcor+strip->ph1.sigcor);
00281     if(strip->plane<500){
00282       planePH[strip->plane]+=(strip->ph0.sigcor+strip->ph1.sigcor);
00283     }else{
00284       cout << "Failed to get plane number; " << strip->plane<< endl;
00285     }
00286   }
00287   shwinfo->maxPH3Plane = 0;
00288   for(int i=1; i<499; ++i){
00289     float tmp = planePH[i-1] +  planePH[i+1] +  planePH[i];
00290     if(tmp>shwinfo->maxPH3Plane) shwinfo->maxPH3Plane = tmp;
00291   }
00292   return true;
00293 }

bool NtpTools::FillRecoEInfo const NtpStRecord record,
const int  eventno,
RecoE recoe
[static]
 

Definition at line 148 of file NtpTools.cxx.

References CorrectMomentumFromRange(), CorrectShowerEnergy(), CorrectSignedMomentumFromCurvature(), RecoE::EOkay, VldContext::GetDetector(), GetEvent(), RecRecordImp< T >::GetHeader(), GetPittContainmentFlag(), GetPrimaryTrack(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), NtpSRShowerPulseHeight::linCCgev, NtpSRTrack::momentum, NtpSREvent::nshower, NtpSRMomentum::qp, NtpSRMomentum::range, RecoE::Reset(), NtpSREvent::shw, NtpStRecord::shw, RecoE::shwE, NtpSRShower::shwph, RecoE::totalE, RecoE::trkE, RecoE::trkECurve, RecoE::trkEMethod, and RecoE::trkERange.

Referenced by MCNNRunner::WriteResults().

00148                                                                                         {
00149   e_reco->Reset();
00150   const NtpSRTrack* track = GetPrimaryTrack(record, eventno);
00151   const NtpSREvent* event = GetEvent(record, eventno);
00152   Detector::Detector_t detector =record->GetHeader().GetVldContext().GetDetector();
00153   const     Bool_t isdata= record->GetHeader().GetVldContext().GetSimFlag()==SimFlag::kData;  
00154   const int pitt_flag = GetPittContainmentFlag(event);
00155   e_reco->EOkay = 1;
00156 
00157   if(track){
00158     if(pitt_flag ==1 || pitt_flag==3){
00159       e_reco->trkEMethod = 1;
00160     }else if(pitt_flag==2 || pitt_flag==4){
00161       e_reco->trkEMethod = 2;
00162     }
00163     Float_t mr=CorrectMomentumFromRange(track->momentum.range,isdata, detector);
00164     e_reco->trkERange = sqrt(mr*mr+0.105*0.105);
00165   
00166     if (track->momentum.qp!=0){
00167       Float_t p= CorrectSignedMomentumFromCurvature(1./track->momentum.qp,isdata,detector);
00168       if(p>0 && p<10000){
00169         e_reco->trkECurve =  sqrt(pow(p,2)+pow(0.105,2));
00170       } else e_reco->trkECurve = 0;
00171     }
00172     else{
00173       e_reco->trkECurve = 0;
00174       e_reco->EOkay = 0;
00175     }
00176     if(e_reco->trkEMethod==1) e_reco->trkE = e_reco->trkERange;
00177     else if(e_reco->trkEMethod==2)  e_reco->trkE = e_reco->trkECurve;
00178     else e_reco->EOkay = 0;
00179   }else{
00180     e_reco->trkE = 0;
00181     e_reco->trkEMethod = 0;
00182     e_reco->trkERange = 0;
00183     e_reco->trkECurve = 0;   
00184   }//tracks
00185 
00186   //now add in the other showers
00187   e_reco->shwE = 0;
00188   for(int ishw = 0; ishw<event->nshower; ++ishw){
00189     const NtpSRShower* ishower = dynamic_cast<const NtpSRShower*>(record->shw->At(event->shw[ishw]));
00190     float showere = CorrectShowerEnergy(ishower->shwph.linCCgev, 
00191                                         detector, 
00192                                         CandShowerHandle::kCC, 
00193                                         1, isdata);//or kWtCC but don't use that
00194     assert(ishower);
00195     e_reco->shwE+=showere;
00196   }
00197   
00198   e_reco->totalE= (e_reco->trkE + e_reco->shwE);
00199   return true;
00200 }

Detector::Detector_t NtpTools::GetDetector const NtpStRecord record  )  [inline, static]
 

Definition at line 98 of file NtpTools.h.

References VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), and RecHeader::GetVldContext().

Referenced by MakeEventPict(), and VtxIsContained().

00098                                                                         {
00099   return(record->GetHeader().GetVldContext().GetDetector());
00100 }

const NtpSREvent * NtpTools::GetEvent const NtpStRecord record,
const int  eventno
[inline, static]
 

Definition at line 90 of file NtpTools.h.

References NtpStRecord::evt.

Referenced by DataPreselected(), FillMyShwInfo(), FillRecoEInfo(), GetNEventsPerSlice(), MakeEventPict(), VtxIsContained(), and MCNNRunner::WriteResults().

00090                                                                                        {
00091   return (dynamic_cast<const NtpSREvent*>(record->evt->At(eventno)));
00092 }

float NtpTools::GetMCEventWeight const NtpStRecord record,
const int  eventno
 

Definition at line 41 of file NtpTools.cxx.

00041                                                                                     {
00042   //
00043   //Calculates the SKZP weight for each event
00044   //
00045 
00046   /*
00047     const NtpMCTruth* mc = GetTruth(record, eventno);
00048 
00049     double par[]={1.5686,
00050     -2.9241,
00051     1.0259,
00052     1.1673,
00053     0.9719,
00054     2.4302,
00055     0.80088};
00056     float pz = mc->flux.tpz;
00057     float pt = sqrt(mc->flux.tpx*mc->flux.tpx+mc->flux.tpy*mc->flux.tpy);
00058 
00059     float weight = fFluxModel->GetWeight(mc->flux.tptype,pt,pz,par);
00060     return weight;
00061   */
00062 
00063   cout << "CAUTION: RETURNING 1.0 AS ZFLUK WEIGHT" << endl;
00064 
00065   return 1.0;
00066 
00067 }

int NtpTools::GetNEventsPerSlice const NtpStRecord record,
const int  eventno
[static]
 

Definition at line 202 of file NtpTools.cxx.

References NtpStRecord::evt, NtpStRecord::evthdr, GetEvent(), NtpSREventSummary::nevent, and NtpSREvent::slc.

00202                                                                             {
00203   const NtpSREvent* event = GetEvent(record, eventno);
00204   if(!event) return -1;
00205 
00206   int nmatch = 0;
00207   for(int ievent = 0; ievent<record->evthdr.nevent; ++ievent){
00208     const NtpSREvent* tmpevent = dynamic_cast<const NtpSREvent*>(record->evt->At(ievent));
00209     if(tmpevent->slc == event->slc){
00210       nmatch++;
00211     }
00212   }
00213   return nmatch;
00214 }

Int_t NtpTools::GetPittContainmentFlag const NtpSREvent evt  )  [static]
 

Definition at line 216 of file NtpTools.cxx.

References NtpSREvent::end, NtpSRVertex::u, NtpSRVertex::v, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by FillRecoEInfo().

00217 {
00218  //Calc Pittsburgh (Donna/Debdatta) containment flag
00219 
00220   Int_t pitt_flag=0;
00221   // pitt_flag:
00222   // 1 = track is fully     contained in the upstream   region
00223   // 2 = track is partially contained in the upstream   region
00224   // 3 = track is fully     contained in the downstream region
00225   // 4 = track is partially contained in the downstream region
00226 
00227   Float_t x=evt->end.x;
00228   Float_t y=evt->end.y;
00229   Float_t z=evt->end.z;
00230   Float_t u=evt->end.u;
00231   Float_t v=evt->end.v;
00232   Float_t rad=TMath::Sqrt(x*x + y*y);
00233   
00234   Float_t calZ=7;
00235   Float_t specZ=15.6;//same as Mad
00236   Float_t minR=0.8;
00237 
00238   Bool_t down_stop=false;
00239   Bool_t down_exit=false;
00240   Bool_t up_stop=false;
00241   Bool_t up_exit=false;
00242   
00243   // downstream
00244   if (z>calZ) {
00245     if (u>-0.85 && u<2.1 && 
00246         v>-2.1 && v<0.85 && 
00247         x>-1.5 && x<2.4 && 
00248         y>-1.4 && y<1.4  && 
00249         rad>minR && 
00250         z>calZ && z<=specZ) down_stop=true;
00251     else down_exit=true;
00252   }
00253   //ustream
00254   else if (z<=calZ && z>=0) {
00255     if (u>0.3 && u<1.8 && 
00256         v>-1.8 && v<-0.3 && 
00257         x<2.4 && 
00258         rad>minR &&
00259         z<calZ && z>=0) up_stop=true;
00260     else up_exit=true;
00261   }
00262   else cout<<"Ahhh, z="<<z<<endl;
00263 
00264   // set the track's pitt flag
00265   if (down_stop) pitt_flag = 3;
00266   if (up_stop  ) pitt_flag = 1;
00267   if (down_exit) pitt_flag = 4;
00268   if (up_exit  ) pitt_flag = 2;
00269 
00270   return pitt_flag;
00271 }

const NtpSRTrack * NtpTools::GetPrimaryTrack const NtpStRecord record,
const int  eventno
[static]
 

Definition at line 295 of file NtpTools.cxx.

References abs(), NtpSRTrack::end, NtpStRecord::evt, MSG, NtpSREvent::ntrack, NtpSRVertex::plane, NtpSREvent::trk, NtpStRecord::trk, and NtpSRTrack::vtx.

Referenced by FillRecoEInfo().

00295                                                                                        {
00296   const NtpSREvent* event = dynamic_cast<const NtpSREvent*>(record->evt->At(eventno));
00297   if(event==NULL){
00298     MSG("NtpAna",Msg::kError) << " NtpTools::GetPrimaryTrack passed null event " <<endl;
00299   }
00300   int best_track = -1;
00301   int nplanes = 0;
00302   for(int itrk=0; itrk<event->ntrack; ++itrk){
00303     const NtpSRTrack* track = dynamic_cast<const NtpSRTrack*>(record->trk->At(event->trk[itrk]));
00304 
00305     int tpln = abs(track->end.plane - track->vtx.plane);
00306     if(tpln>nplanes) {
00307       nplanes = tpln;
00308       best_track = itrk;
00309     }
00310   }
00311   if(best_track==-1){
00312     return NULL;
00313   }else{
00314     return (dynamic_cast<const NtpSRTrack*>(record->trk->At(event->trk[best_track])));
00315   }
00316 }

float NtpTools::GetTotHadPt const NtpStRecord record,
const NtpMCTruth truth
[static]
 

Definition at line 77 of file NtpTools.cxx.

References NtpMCStdHep::IdHEP, NtpMCTruth::index, NtpMCStdHep::IstHEP, NtpMCStdHep::mass, NtpMCStdHep::mc, NtpStRecord::mchdr, NtpMCSummary::nstdhep, NtpMCStdHep::p4, NtpMCStdHep::parent, and NtpStRecord::stdhep.

Referenced by MCNNRunner::WriteResults().

00077                                                                              {
00078 
00079   float totpt=0;
00080   int index=truth->index;
00081 
00082   vector<int> pid;
00083   vector<double> px;
00084   vector<double> py;
00085   vector<double> pz;
00086   vector<double> eng;
00087   vector<double> mass;
00088 
00089   double hspx = 0;
00090   double hspy = 0;
00091   double hspz = 0;
00092   double hse  = 0;
00093 
00094   //cout<<"counting pi0"<<endl;
00095   Int_t nStdHep = record->mchdr.nstdhep;
00096   NtpMCStdHep *ntpStdHep = 0;
00097   for(int i=0; i<nStdHep; i++){
00098     ntpStdHep = dynamic_cast<NtpMCStdHep *>(record->stdhep->At(i));
00099     //check that stdhep entry corresponds to this mc event
00100     if(ntpStdHep->mc!=index) continue;
00101     
00102     if(ntpStdHep->IstHEP==3){//resonance decay
00103       if (TMath::Abs(ntpStdHep->p4[3])>hse){
00104         hspx = ntpStdHep->p4[0];
00105         hspy = ntpStdHep->p4[1];
00106         hspz = ntpStdHep->p4[2];
00107         hse  = TMath::Abs(ntpStdHep->p4[3]);
00108       }
00109     }
00110     else {
00111       //check if this particle comes from a resonance decay or DIS
00112       bool resdecay = true;
00113       for (int ip = ntpStdHep->parent[0]; ip<=ntpStdHep->parent[1]; ip++){
00114         if (ip==-1) {
00115           resdecay = false;
00116           break;
00117         }
00118         NtpMCStdHep *parent = dynamic_cast<NtpMCStdHep *>(record->stdhep->At(ip));
00119         resdecay = resdecay && (parent->IstHEP==3);
00120         if (!resdecay) break;
00121       }
00122       if (resdecay&&ntpStdHep->IdHEP) {
00123         pid.push_back(ntpStdHep->IdHEP);
00124         px.push_back(ntpStdHep->p4[0]);
00125         py.push_back(ntpStdHep->p4[1]);
00126         pz.push_back(ntpStdHep->p4[2]);
00127         eng.push_back(ntpStdHep->p4[3]);
00128         mass.push_back(ntpStdHep->mass);
00129       }
00130     }
00131   }
00132 
00133   double Phs = sqrt(pow(hspx,2)+pow(hspy,2)+pow(hspz,2));
00134   for (unsigned ipar = 0; ipar<pid.size(); ipar++){//loop through hadrons
00135     double ptot = sqrt(pow(px[ipar],2)+pow(py[ipar],2)+pow(pz[ipar],2));
00136     double Pz = (px[ipar]*hspx+py[ipar]*hspy+pz[ipar]*hspz)/Phs;
00137     double pt = pow(ptot,2)-pow(Pz,2);
00138     if (pt>0.00000001) pt = sqrt(pt);
00139     else pt = 0;
00140 
00141     totpt += pt;
00142   }
00143 
00144   return totpt;
00145 
00146 }

bool NtpTools::GetTrueEnergy const NtpStRecord record,
const int  eventno,
float &  mceneu
[static]
 

Definition at line 500 of file NtpTools.cxx.

References GetTruth(), and NtpMCTruth::p4neu.

00500                                                                                        {
00501   const NtpMCTruth* mcevent = GetTruth(record, eventno);
00502 
00503   if(!mcevent){
00504     cout << "*** unable to get mcevent" <<endl;
00505     return false;    
00506   }
00507   mceneu = fabs(mcevent->p4neu[3]);
00508   return true;
00509 }

const NtpMCTruth * NtpTools::GetTruth const NtpStRecord record,
const int  eventno
[static]
 

Definition at line 482 of file NtpTools.cxx.

References NtpStRecord::evt, NtpStRecord::mc, NtpTHEvent::neumc, and NtpStRecord::thevt.

Referenced by GetTrueEnergy(), and MCNNRunner::WriteResults().

00482                                                                                 {
00483     if(!record || record->thevt==NULL){
00484     cout << "*** no truth helper! " <<endl;
00485     return NULL;
00486   }
00487   if(record->evt->GetEntries() != record->thevt->GetEntries()){
00488     cout << " funny matching evt - >thevt " <<endl;
00489     return NULL;
00490   }
00491   const NtpTHEvent* thevent = dynamic_cast<const NtpTHEvent*>(record->thevt->At(eventno));
00492   if(!thevent){
00493     cout << "*** unable to get thevt" <<endl;
00494     return NULL;
00495   }
00496   return (dynamic_cast<const NtpMCTruth*>(record->mc->At(thevent->neumc)));
00497   
00498 }

VldContext NtpTools::GetVldContext const NtpStRecord record  )  [static]
 

bool NtpTools::IsInFidVolumeFar const float  x,
const float  y,
const float  z
[inline, static]
 

Definition at line 133 of file NtpTools.h.

Referenced by VtxIsContained().

00133                                                                                              {  
00134   return true;//<--
00135 }

bool NtpTools::IsInFidVolumeNear const float  x,
const float  y,
const float  z
[inline, static]
 

Definition at line 125 of file NtpTools.h.

References RadialDistFromBeam().

Referenced by VtxIsContained().

00125                                                                                   {  
00126   float radius = RadialDistFromBeam(x, y);
00127   if( z>1. &&
00128       z<5. &&
00129       radius<1. ) return true;
00130   else return false;
00131 }

bool NtpTools::MakeEventPict const char *  title,
const NtpStRecord record,
const int  eventno
 

Definition at line 405 of file NtpTools.cxx.

References fUZMarkers, fVZMarkers, GetDetector(), GetEvent(), MSG, NtpSREvent::nstrip, NtpSRTrack::nstrip, NtpSREvent::ntrack, NtpSRStrip::planeview, PrintCanvas(), ResetCanvas(), NtpSREvent::stp, NtpSRTrack::stp, NtpStRecord::stp, NtpSRStrip::tpos, NtpSREvent::trk, NtpStRecord::trk, and NtpSRStrip::z.

00405                                                                                             {
00406   bool rc = false;
00407   if(ResetCanvas(GetDetector(record))==false) return false;
00408   
00409   const NtpSREvent* event = GetEvent(record, eventno);
00410   const TClonesArray* strips = (record->stp);
00411   const TClonesArray* tracks = (record->trk);
00412   
00413   std::set<int> trkstp_index;
00414                                                 
00415  for(int itrk=0; itrk<event->ntrack; ++itrk){
00416     const NtpSRTrack* track = dynamic_cast<const NtpSRTrack*>(tracks->At(event->trk[itrk]));
00417     if(track==NULL){
00418       MSG("NtpAna",Msg::kError) << " failed to cast track " <<endl;
00419     }else{
00420       for(int istp=0; istp<track->nstrip; istp++){
00421         trkstp_index.insert(track->stp[istp])      ;
00422       }    
00423     }
00424   }
00425 
00426   for(int istp =0; istp< event->nstrip ; ++istp){
00427     const int stp_index = event->stp[istp];
00428     const NtpSRStrip* strip = dynamic_cast<const NtpSRStrip*>(strips->At(stp_index));
00429     if(strip==NULL){
00430       MSG("NtpAna",Msg::kError) << " failed to cast strip " <<endl;
00431       rc = false;
00432     }else{
00433       
00434       TMarker tmpmarker(strip->z, strip->tpos, 
00435                         20);
00436       tmpmarker.SetMarkerSize(0.5);
00437       if(trkstp_index.count(stp_index)>0)      tmpmarker.SetMarkerColor(2);
00438       if(strip->planeview==2){
00439         fUZMarkers.push_back(tmpmarker);
00440       }else{
00441         fVZMarkers.push_back(tmpmarker);
00442       }
00443     }
00444     
00445   }
00446 
00447   // RBP - changed "!=" to "=!" in a guess at what was intended by the original author.
00448   rc = !PrintCanvas(title);
00449   
00450   return rc;
00451 }

bool NtpTools::PassBeamCuts const BeamType_t  beamtype,
const NtpBDLiteRecord beamntp,
float &  pot,
bool  isMC = false
[static]
 

Definition at line 318 of file NtpTools.cxx.

References beamtype, BeamType_t, BMSpillAna::Config(), RecRecordImp< T >::GetHeader(), BeamDataLiteHeader::GetTimeDiffStreamSpill(), Registry::LockValues(), MAXMSG, Registry::PrettyPrint(), BMSpillAna::SelectSpill(), Registry::Set(), BMSpillAna::SetSpill(), NtpBDLiteRecord::tortgt, and Registry::UnLockValues().

00318                                                                                                             {
00319   //
00320   //PassBeamCuts
00321   //
00322 
00323   if(isMC){
00324    pot =  24.2;
00325    return true;
00326   }
00327 
00328   static Registry* beam_config = NULL;
00329   static BeamMonSpill spill;
00330   static BMSpillAna bmsa;
00331   static BeamType_t lastbeamtype = beamtype;
00332 
00333   if(beamntp==NULL) return 0;
00334   
00335   if(beam_config==NULL){
00336     beam_config = new Registry();
00337     beam_config->UnLockValues();
00338     //beam_config->Set("TargetIn",1);
00339     //beam_config->Set("BeamType",-1);//don't care if ME,LE,etc
00340     //beam_config->Set("PosTgtXMin",-2.0*Munits::mm);
00341     beam_config->Set("BeamType",(int)(beamtype));
00342     //have to make sure that zero is not included
00343     beam_config->Set("PosTgtXMax",-0.0000001*Munits::mm);
00344     beam_config->Set("PosTgtYMin", 0.0000001*Munits::mm);
00345     //beam_config->Set("PosTgtYMax", 2.0*Munits::mm);
00346     beam_config->LockValues();
00347     bmsa.Config(*beam_config);    
00348     //print the registry
00349     beam_config->PrettyPrint(cout);
00350   }
00351   if(lastbeamtype!=beamtype){
00352     beam_config->UnLockValues();
00353     beam_config->Set("BeamType",(int)(beamtype));
00354     beam_config->LockValues();
00355     bmsa.Config(*beam_config);    
00356     lastbeamtype = beamtype;
00357   }
00358   
00359   bmsa.SetSpill(*beamntp,spill);
00360   pot =  beamntp->tortgt;
00361   if (!bmsa.SelectSpill()){
00362     MAXMSG("NtpAna",Msg::kInfo,10)
00363       <<"Rejected spill!"
00364       <<", tortgt="<<beamntp->tortgt
00365       <<", timeDiff="<<beamntp->GetHeader().GetTimeDiffStreamSpill() <<endl;
00366     return 0;    
00367   }else{
00368     return true;
00369   }
00370 }

bool NtpTools::PrintCanvas const char *  title  )  [private]
 

Definition at line 453 of file NtpTools.cxx.

References fCanvas, fUZAxis, fUZMarkers, fVZAxis, fVZMarkers, and NtpSREvent::Print().

Referenced by MakeEventPict().

00453                                            {
00454   fCanvas->cd(1);
00455   fUZAxis->Draw("axis");
00456   float minz = 999;
00457   float maxz = 0;
00458 
00459   for(unsigned int i=0; i<fUZMarkers.size(); i++){
00460     fUZMarkers[i].Draw();
00461     if(minz>fUZMarkers[i].GetX()) minz=fUZMarkers[i].GetX();
00462     if(maxz<fUZMarkers[i].GetX()) maxz=fUZMarkers[i].GetX();
00463   }
00464   fUZAxis->GetXaxis()->SetRangeUser(minz, maxz);
00465 
00466   fCanvas->cd(2);
00467   fVZAxis->Draw("axis");
00468   minz = 999;
00469   maxz = 0;
00470 
00471   for(unsigned int i=0; i<fVZMarkers.size(); i++){
00472     fVZMarkers[i].Draw();
00473     if(minz>fVZMarkers[i].GetX()) minz=fVZMarkers[i].GetX();
00474     if(maxz<fVZMarkers[i].GetX()) maxz=fVZMarkers[i].GetX();
00475   }
00476   fVZAxis->GetXaxis()->SetRangeUser(minz, maxz);
00477   
00478   fCanvas->Print(title);
00479   return true;
00480 }

float NtpTools::RadialDistFromBeam const float  x,
const float  y
[inline, static]
 

Definition at line 113 of file NtpTools.h.

Referenced by IsInFidVolumeNear().

00113                                                                      {
00114   float radius = sqrt((x - NtpConstants::kNearBeamCentreX)*
00115                       (x - NtpConstants::kNearBeamCentreX) + 
00116                       (y - NtpConstants::kNearBeamCentreY)*
00117                       (y - NtpConstants::kNearBeamCentreY)  
00118                       ); 
00119 
00120   return radius;
00121   
00122 }

bool NtpTools::ResetCanvas Detector::Detector_t  det  )  [private]
 

Definition at line 374 of file NtpTools.cxx.

References fCanvas, fUZAxis, fUZMarkers, fVZAxis, and fVZMarkers.

Referenced by MakeEventPict().

00374                                                 {
00375   if(fUZAxis) delete fUZAxis;
00376   if(fVZAxis) delete fVZAxis;
00377   fUZAxis = NULL;
00378   fVZAxis = NULL;
00379   fUZMarkers.clear();
00380   fVZMarkers.clear();
00381   fCanvas->Clear();
00382   fCanvas->Divide(1,2);
00383   
00384   switch(det){
00385   case Detector::kFar:
00386     fUZAxis = new TH2F("fUZAxis", "", 100, 0, 17, 100, -4, 4.);
00387     fVZAxis = new TH2F("fVZAxis", "", 100, 0, 17, 100, -4, 4.);    
00388     break;
00389   case Detector::kNear:
00390     fUZAxis = new TH2F("fUZAxis", "", 100, 0, 17, 100, -1.5, 3.);
00391     fVZAxis = new TH2F("fVZAxis", "", 100, 0, 17, 100, -3, 1.5);    
00392     break;
00393   default:
00394     return false;
00395     break;
00396   };
00397   
00398   fUZAxis->SetXTitle("Z/m");
00399   fUZAxis->SetYTitle("U/m");
00400   fVZAxis->SetXTitle("Z/m");
00401   fVZAxis->SetYTitle("V/m");
00402   return true;
00403 }

bool NtpTools::VtxIsContained const NtpStRecord record,
const int  eventno
[inline, static]
 

Definition at line 102 of file NtpTools.h.

References GetDetector(), GetEvent(), IsInFidVolumeFar(), IsInFidVolumeNear(), NtpSREvent::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

00102                                                                                 {
00103   if(!record) return false;
00104   const NtpSREvent* event = GetEvent(record, eventno);
00105   if(!event) return false;
00106   if(GetDetector(record)==Detector::kNear){
00107     return (IsInFidVolumeNear(event->vtx.x, event->vtx.y, event->vtx.z) );
00108   }else{
00109     return (IsInFidVolumeFar(event->vtx.x, event->vtx.y, event->vtx.z) );
00110   }
00111 }


Member Data Documentation

TCanvas* NtpTools::fCanvas [private]
 

Definition at line 80 of file NtpTools.h.

Referenced by NtpTools(), PrintCanvas(), and ResetCanvas().

Zfluk* NtpTools::fFluxModel [private]
 

Definition at line 78 of file NtpTools.h.

Referenced by NtpTools().

TH2F* NtpTools::fUZAxis [private]
 

Definition at line 81 of file NtpTools.h.

Referenced by PrintCanvas(), and ResetCanvas().

std::vector<TMarker> NtpTools::fUZMarkers [private]
 

Definition at line 83 of file NtpTools.h.

Referenced by MakeEventPict(), PrintCanvas(), and ResetCanvas().

TH2F* NtpTools::fVZAxis [private]
 

Definition at line 82 of file NtpTools.h.

Referenced by PrintCanvas(), and ResetCanvas().

std::vector<TMarker> NtpTools::fVZMarkers [private]
 

Definition at line 84 of file NtpTools.h.

Referenced by MakeEventPict(), PrintCanvas(), and ResetCanvas().


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