ParticleBeamMonAna Class Reference

#include <ParticleBeamMonAna.h>

List of all members.

Public Member Functions

 ParticleBeamMonAna ()
 ~ParticleBeamMonAna ()
void ana (ParticleObjectHolder *poh, ParticleBeamMon *e)
BeamType::BeamType_t DetermineBeamType (VldContext vc)
BeamType::BeamType_t DetermineBeamType (std::string file)

Public Attributes

std::string fname

Detailed Description

Definition at line 8 of file ParticleBeamMonAna.h.


Constructor & Destructor Documentation

ParticleBeamMonAna::ParticleBeamMonAna (  ) 

Definition at line 23 of file ParticleBeamMonAna.cxx.

References fname.

00024 {
00025         fname="";
00026 }

ParticleBeamMonAna::~ParticleBeamMonAna (  ) 

Definition at line 28 of file ParticleBeamMonAna.cxx.

00029 {}


Member Function Documentation

void ParticleBeamMonAna::ana ( ParticleObjectHolder poh,
ParticleBeamMon e 
)

Definition at line 32 of file ParticleBeamMonAna.cxx.

References ParticleBeamMon::batchint, ParticleBeamMon::batchposx, ParticleBeamMon::batchposy, beamtype, ParticleBeamMon::beamtype, ParticleBeamMon::bI, ParticleBeamMon::bmst_vts, BeamMonSpill::BpmAtTarget(), DetermineBeamType(), ParticleBeamMon::dt_bmst, ParticleBeamMon::dt_stnd, BeamMonSpill::fBpmInt, BeamMonSpill::fHornCur, fname, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, BeamMonSpill::fTargBpmX, BeamMonSpill::fTargBpmY, BeamMonSpill::fTargProfX, BeamMonSpill::fTargProfY, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldContext::GetDetector(), VldTimeStamp::GetEOT(), RecRecordImp< T >::GetHeader(), ParticleBeamMon::GetPot(), VldTimeStamp::GetSeconds(), VldContext::GetSimFlag(), DataUtil::GetTempTagString(), SpillTimeFinder::GetTimeOfNearestSpill(), VldContext::GetTimeStamp(), SpillTimeFinder::GetTimeToNearestSpill(), RecHeader::GetVldContext(), ParticleBeamMon::goodParticleBeamMon, gSystem(), ParticleBeamMon::hbw, ParticleBeamMon::hornI, ParticleBeamMon::hpos1, ParticleBeamMon::hpos2, SpillTimeFinder::Instance(), RunStatus::IsOK(), CoilTools::IsReverse(), SimFlag::kData, Msg::kError, Detector::kFar, BeamType::kUnknown, BDSpillAccessor::LoadSpill(), MSG, ParticleBeamMon::ResetAll(), BMSpillAna::SelectSpill(), BMSpillAna::SetSnarlTime(), BMSpillAna::SetSpill(), BeamMonSpill::SpillTime(), ParticleBeamMon::stnd_vts, ParticleBeamMon::tor101, ParticleBeamMon::tortgt, BeamType::ToZarko(), ParticleBeamMon::tr101d, ParticleBeamMon::trtgtd, ParticleBeamMon::vbw, ParticleBeamMon::vpos1, and ParticleBeamMon::vpos2.

Referenced by ParticleFinder::Reco().

00033 {
00034 
00035     BDSpillAccessor& sa = BDSpillAccessor::Get();
00036     SpillTimeFinder &stf = SpillTimeFinder::Instance();
00037 
00038 
00039     
00040     BeamType::BeamType_t beamtype;
00041     int zbeamtype; 
00042     
00043     BMSpillAna fBMSpillAna;
00044 
00045 
00046 
00047 
00048         VldContext evt_vldc = poh->GetHeader().GetVldContext();
00049 
00050 
00051 
00052     std::string file = DataUtil::GetTempTagString(poh, "file");
00053     std::string filename = gSystem->BaseName(file.c_str());
00054 
00055 
00056 
00057     if(evt_vldc.GetSimFlag() == SimFlag::kData)
00058       beamtype = DetermineBeamType(evt_vldc);
00059     else
00060       beamtype = DetermineBeamType(filename);
00061 
00062     //last ditch effort...
00063         if(beamtype==BeamType::kUnknown)
00064         {
00065                 beamtype = DetermineBeamType(fname);    
00066         }
00067     
00068     e->beamtype=beamtype;
00069 
00070 
00071     // Only fill if this is data
00072     if (evt_vldc.GetSimFlag() != SimFlag::kData)
00073         return;
00074    
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083     const BeamMonSpill* bms = sa.LoadSpill(evt_vldc.GetTimeStamp());
00084     VldTimeStamp bms_vts;
00085     if (!bms) {
00086         MSG("NueParticleBeamMon",Msg::kError) << "No ParticleBeamMonSpill found for " << evt_vldc << endl;
00087         bms_vts = VldTimeStamp::GetEOT();
00088     }else{
00089         bms_vts = bms->SpillTime();
00090     }
00091   
00092  //   beamtype = bms->BeamType();
00093     
00094 //    e->beamtype=beamtype;
00095     
00096     zbeamtype = BeamType::ToZarko(beamtype);
00097   
00098   
00099         
00100     fBMSpillAna.SetSpill(*bms);
00101     // Get the time of the event, the value in the header is
00102     // accurate enough for this purpose
00103     fBMSpillAna.SetSnarlTime(evt_vldc.GetTimeStamp());
00104 
00105         e->ResetAll();                     // Fill in the variables
00106         if (fBMSpillAna.SelectSpill())
00107             e->goodParticleBeamMon=1;
00108         else
00109             e->goodParticleBeamMon=0;
00110 
00111         e->tortgt = bms->fTortgt;
00112         e->trtgtd = bms->fTrtgtd;
00113         e->tor101 = bms->fTor101;
00114         e->tr101d = bms->fTr101d;
00115 
00116 //        cout<<fBMSpillAna.SelectSpill()<<"  "<<"   "<<bms->BeamType()<<endl;
00117         e->bI = e->GetPot();
00118 
00119         double xbpm,ybpm,xrms,yrms;
00120         bms->BpmAtTarget(xbpm,ybpm,xrms,yrms);
00121         e->hpos2 = xbpm;
00122         e->vpos2 = ybpm;
00123 
00124         for (Int_t i=0;i<6;++i){
00125             e->batchposx[i]=bms->fTargBpmX[i];
00126             e->batchposy[i]=bms->fTargBpmY[i];
00127             e->batchint[i]=bms->fBpmInt[i];
00128         }
00129 
00130         e->hpos1 = bms->fTargProfX;
00131         e->vpos1 = bms->fTargProfY;
00132 
00133         e->hbw = bms->fProfWidX;
00134         e->vbw = bms->fProfWidY;
00135 
00136         e->hornI = bms->fHornCur;
00137 
00138         e->bmst_vts = bms->SpillTime();
00139 
00140         VldTimeStamp vtsdif = e->bmst_vts-evt_vldc.GetTimeStamp();
00141         e->dt_bmst=vtsdif.GetSeconds();
00142 
00143         e->stnd_vts=stf.GetTimeOfNearestSpill(evt_vldc);
00144         e->dt_stnd=stf.GetTimeToNearestSpill(evt_vldc);
00145 
00146         // count the pots for the good spills, only take the value
00147         // from the first event in the snarl
00148         bool goodCoil = CoilTools::IsOK(evt_vldc) && !CoilTools::IsReverse(evt_vldc);
00149         goodCoil = goodCoil || (evt_vldc.GetDetector()==Detector::kFar);
00150 
00151      
00152         
00153 }

BeamType::BeamType_t ParticleBeamMonAna::DetermineBeamType ( std::string  file  ) 

Definition at line 206 of file ParticleBeamMonAna.cxx.

References BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, and BeamType::kUnknown.

00207 {
00208 
00209 //printf("looking in %s\n",file.c_str());
00210    BeamType::BeamType_t beam = BeamType::kUnknown;
00211    if(file.find("L010185")!=string::npos){ beam=BeamType::kL010z185i; }
00212    if(file.find("L100200")!=string::npos){ beam=BeamType::kL100z200i; }
00213    if(file.find("L250200")!=string::npos){ beam=BeamType::kL250z200i; }
00214    if(file.find("L150200")!=string::npos){ beam=BeamType::kL150z200i; }
00215    if(file.find("L010200")!=string::npos){ beam=BeamType::kL010z200i; }
00216    if(file.find("L010170")!=string::npos){ beam=BeamType::kL010z170i; }
00217    if(file.find("L010000")!=string::npos){ beam=BeamType::kL010z000i; }
00218 
00219    return beam;
00220 }

BeamType::BeamType_t ParticleBeamMonAna::DetermineBeamType ( VldContext  vc  ) 

Definition at line 156 of file ParticleBeamMonAna.cxx.

References VldTimeStamp::GetSec(), VldContext::GetTimeStamp(), BeamType::kL000z200i, BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, and BeamType::kUnknown.

Referenced by ana().

00156                                                                      {
00157 
00158 /*    BDSpillAccessor& sa = BDSpillAccessor::Get();
00159     VldContext evt_vldc = nr->GetHeader().GetVldContext();
00160 
00161     const BeamMonSpill* bms = sa.LoadSpill(vc.GetTimeStamp());
00162     VldTimeStamp bms_vts;
00163     if (!bms) {
00164        MSG("NueBeamMon",Msg::kError) << "No BeamMonSpill found for " << evt_vldc << endl;
00165        bms_vts = VldTimeStamp::GetEOT();
00166     }
00167     else {
00168         bms_vts = bms->SpillTime();
00169     }
00170     return bms->BeamType();
00171 */
00172     int time = vc.GetTimeStamp().GetSec();
00173     
00174     //printf("time %d\n",time);
00175 
00176     BeamType::BeamType_t beam = BeamType::kUnknown;
00177 
00178     if(time >= 1107216000 && time < 1109539850) beam = BeamType::kL100z200i;
00179     if(time >= 1109540615 && time < 1109899325) beam = BeamType::kL250z200i;
00180     if(time >= 1109899938 && time < 1110239564) beam = BeamType::kL100z200i;
00181     if(time >= 1110323763 && time < 1111622400) beam = BeamType::kL000z200i;
00182     if(time >= 1114892377 && time < 1115927583) beam = BeamType::kL100z200i;
00183     if(time >= 1115937438 && time < 1116604821) beam = BeamType::kL250z200i;
00184     if(time >= 1116618256 && time < 1122659668) beam = BeamType::kL010z185i;
00185     if(time >= 1122659886 && time < 1122922688) beam = BeamType::kL010z170i;
00186     if(time >= 1122922890 && time < 1123112674) beam = BeamType::kL010z200i;
00187     if(time >= 1123112803 && time < 1139605423) beam = BeamType::kL010z185i;
00188     if(time >= 1139605543 && time < 1140022084) beam = BeamType::kL010z000i;
00189     if(time >= 1140026702 && time < 1140908579) beam = BeamType::kL010z185i;
00190     // End of Run 1
00191     if(time >= 1149180600 && time < 1150047780) beam = BeamType::kL150z200i;
00192     if(time >= 1150047780 && time < 1151690460) beam = BeamType::kL250z200i;
00193     if(time >= 1153956600 && time < 1155510000) beam = BeamType::kL250z200i;
00194     if(time >= 1158004800 && time < 1158019870) beam = BeamType::kL010z200i;
00195     if(time >= 1158019870 && time < 1161892800) beam = BeamType::kL010z185i;
00196     if(time >= 1161892800 && time < 1184351737) beam = BeamType::kL010z185i;
00197     if(time >= 1184351737 && time < 1184708040) beam = BeamType::kL010z000i;
00198     //End of Run 2
00199 
00200     if(time >= 1184800000 ) beam = BeamType::kL010z185i;
00201 
00202     return beam;
00203 
00204 }


Member Data Documentation

Definition at line 20 of file ParticleBeamMonAna.h.

Referenced by ana(), ParticleBeamMonAna(), and ParticleFinder::Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1