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

ANtpShowerInfoAna Class Reference

#include <ANtpShowerInfoAna.h>

Inheritance diagram for ANtpShowerInfoAna:

NueAnaBase List of all members.

Public Member Functions

 ANtpShowerInfoAna (ANtpShowerInfoNue &ansi)
virtual ~ANtpShowerInfoAna ()
void Analyze (int evtn, RecRecordImp< RecCandHeader > *srobj)
void FillNueShowerInformation (NtpSRShower *ntpShower, NtpSREvent *ntpEvent, ANtpShowerInfoNue *showerInfoNue, RecRecordImp< RecCandHeader > *srobj)
Float_t RecoShwEnergy (Float_t linearCCGeV, SimFlag::SimFlag_t s, const Detector::Detector_t &det, int mode)
Float_t RecoShwEnergy (NtpSRShower *ntpShower, Int_t opt, Int_t det)
Float_t RecoShwEnergyNew (NtpSRShower *ntpShower, Int_t opt, VldContext cx)
Float_t GetShwEnergy (NtpSRShower *ntpShower, Int_t opt)
CandShowerHandle::EShowerType GetShwHandleType (Int_t opt)
void FillGapInformation (NtpSREvent *evt, NtpSRShower *shw, NtpSRTrack *trk, NtpStRecord *st)

Private Attributes

ANtpShowerInfoNuefANtpShowerInfo
ANtpInfoObjectFillerfInfoFiller

Constructor & Destructor Documentation

ANtpShowerInfoAna::ANtpShowerInfoAna ANtpShowerInfoNue ansi  ) 
 

Definition at line 19 of file ANtpShowerInfoAna.cxx.

00019                                                            :
00020    fANtpShowerInfo(ansi)
00021 {}

ANtpShowerInfoAna::~ANtpShowerInfoAna  )  [virtual]
 

Definition at line 23 of file ANtpShowerInfoAna.cxx.

00024 {
00025 }


Member Function Documentation

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

Implements NueAnaBase.

Definition at line 28 of file ANtpShowerInfoAna.cxx.

References det, fANtpShowerInfo, FillGapInformation(), FillNueShowerInformation(), ANtpInfoObjectFiller::FillShowerInformation(), fInfoFiller, VldContext::GetDetector(), ANtpEventManipulator::GetEvent(), SntpHelpers::GetEvent(), ANtpRecoNtpManipulator::GetEventManipulator(), RecRecordImp< T >::GetHeader(), ANtpEventManipulator::GetPrimaryShower(), SntpHelpers::GetPrimaryShower(), SntpHelpers::GetPrimaryTrack(), VldContext::GetSimFlag(), ANtpRecoNtpManipulator::GetStripArray(), RecHeader::GetVldContext(), ReleaseType::IsBirch(), ReleaseType::IsCedar(), ReleaseType::IsDogwood(), NtpSRShowerPulseHeight::linNCgev, ANtpShowerInfoNue::phCCGeV, ANtpShowerInfoNue::phNCGeV, RecoShwEnergyNew(), s(), EnergyCorrections::SetCorrectionVersion(), ANtpEventManipulator::SetEventInSnarl(), ANtpRecoNtpManipulator::SetPrimaryShowerCriteria(), ANtpInfoObjectFiller::SetStripArray(), and NtpSRShower::shwph.

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

00029 {    
00030   if(srobj==0){
00031     return;
00032   }
00033   if(((dynamic_cast<NtpStRecord *>(srobj))==0)&&
00034      ((dynamic_cast<NtpSRRecord *>(srobj))==0)){
00035     return;
00036   }
00037 
00038   NtpSREvent *event = 0;
00039   NtpSRShower *shower = 0;
00040   NtpSRTrack *track = 0;
00041   Detector::Detector_t  det;
00042 
00043   //and now an ugly bit of code to deal with either NtpStRecord or NtpSRRecord
00044   bool foundst=false;
00045   NtpStRecord *st=dynamic_cast<NtpStRecord *>(srobj);
00046     fInfoFiller = new ANtpInfoObjectFiller();
00047 
00048   SimFlag::SimFlag_t s = SimFlag::kUnknown;
00049 
00050   if(ReleaseType::IsDogwood(release))
00051      SetCorrectionVersion(EnergyCorrections::kDogwood);
00052   if(ReleaseType::IsCedar(release))
00053      SetCorrectionVersion(EnergyCorrections::kCedar);
00054   if(ReleaseType::IsBirch(release))
00055      SetCorrectionVersion(EnergyCorrections::kBirch);
00056 
00057   if(st!=0){
00058     foundst=true;    
00059     //instansiate a NtpHelper object to help you get the info you want
00060     ANtpRecoNtpManipulator ntpManipulator(st);  
00061     fInfoFiller->SetStripArray(ntpManipulator.GetStripArray());
00062 
00063     event = SntpHelpers::GetEvent(evtn, st);
00064     track = SntpHelpers::GetPrimaryTrack(evtn, st);
00065     shower = SntpHelpers::GetPrimaryShower(evtn, st);
00066 
00067     det = st->GetHeader().GetVldContext().GetDetector();
00068     s = st->GetHeader().GetVldContext().GetSimFlag();
00069   }
00070 
00071 
00072   if(!foundst){  //Old Code, only good for R1.12 or earlier
00073       NtpSRRecord *sr=dynamic_cast<NtpSRRecord *>(srobj);    
00074       //instansiate a NtpHelper object to help you get the info you want
00075       ANtpRecoNtpManipulator ntpManipulator(sr);
00076       fInfoFiller->SetStripArray(ntpManipulator.GetStripArray());
00077         
00078       //set up which flags you want to use to determine the primary shower or track
00079       //a value of 0 for a flag means it will not be used
00080       ntpManipulator.SetPrimaryShowerCriteria(0,1); // nplanes, total pulse height
00081       //get the primary shower for the event - if no track is present it
00082       //returns 0     
00083     ANtpEventManipulator * ntpEventManipulator =
00084                            ntpManipulator.GetEventManipulator();
00085                                    
00086     ntpEventManipulator->SetEventInSnarl(evtn);
00087     event=ntpEventManipulator->GetEvent();
00088     shower = ntpEventManipulator->GetPrimaryShower();
00089   }  //end of old code
00090 
00091 
00092   if(shower) {
00093     //          Fill information from the base ANtpShowerInfo  
00094     fInfoFiller->FillShowerInformation(shower, &fANtpShowerInfo);
00095     //          Fill information specific to the ANtpShowerInfoNue class
00096     FillNueShowerInformation(shower, event, &fANtpShowerInfo,st);
00097     VldContext vc = st->GetHeader().GetVldContext();
00098 
00099     fANtpShowerInfo.phCCGeV = RecoShwEnergyNew(shower, 0, vc);
00100     fANtpShowerInfo.phNCGeV = shower->shwph.linNCgev;
00101 
00102     FillGapInformation(event, shower, track, st);
00103 
00104   }
00105 
00106   if(fInfoFiller){
00107     delete fInfoFiller;
00108     fInfoFiller=0;
00109   }
00110 
00111   
00112 }

void ANtpShowerInfoAna::FillGapInformation NtpSREvent evt,
NtpSRShower shw,
NtpSRTrack trk,
NtpStRecord st
 

Definition at line 259 of file ANtpShowerInfoAna.cxx.

References count, det, NtpSRPlane::end, fANtpShowerInfo, ANtpShowerInfoNue::gapPlanes, ANtpShowerInfoNue::gapPlanesU, ANtpShowerInfoNue::gapPlanesV, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), SntpHelpers::GetStrip(), SntpHelpers::GetStripIndex(), RecHeader::GetVldContext(), ANtpShowerInfoNue::longestTrackGap, ANtpShowerInfoNue::longestTrackGapU, ANtpShowerInfoNue::longestTrackGapV, NtpSRTrack::nstrip, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRTrack::plane, NtpSRShower::plane, and NtpSRPulseHeight::sigcor.

Referenced by Analyze().

00260 {
00261    float planes[500];
00262    int dir[500];
00263 
00264    for(int i = 0; i < 500; i++){
00265      planes[i] = dir[i] = 0;
00266    }
00267 
00268    Detector::Detector_t det = st->GetHeader().GetVldContext().GetDetector();
00269 
00270    for(int i = 0; i < 500; i++){
00271      if(i < 250 || det == Detector::kNear){
00272        if(i%2 == 0) dir[i] = PlaneView::kU;
00273        else         dir[i] = PlaneView::kV;
00274      }else{
00275        if(i%2 == 0) dir[i] = PlaneView::kV;
00276        else         dir[i] = PlaneView::kU;
00277      }
00278    }                                                                                
00279    int shwendplane = shw->plane.end;
00280 
00281    if(trk == 0) return;
00282    if(trk->plane.end <= shwendplane){
00283      fANtpShowerInfo.longestTrackGapU = 0;
00284      fANtpShowerInfo.longestTrackGapV = 0;
00285      fANtpShowerInfo.gapPlanesU = 0;
00286      fANtpShowerInfo.gapPlanesV = 0;
00287      fANtpShowerInfo.longestTrackGap = 0;
00288      fANtpShowerInfo.gapPlanes = 0;
00289      return;
00290    }
00291        
00292    for(int i=0; i<trk->nstrip; i++){
00293       Int_t index = SntpHelpers::GetStripIndex(i,trk);
00294       NtpSRStrip *ntpStrip = SntpHelpers::GetStrip(index,st);
00295       if(ntpStrip==0) continue;
00296       if(ntpStrip->plane < shwendplane) continue;
00297       float charge =  ntpStrip->ph0.sigcor + ntpStrip->ph1.sigcor;
00298       planes[ntpStrip->plane] = charge;
00299    }
00300  
00301    int ucount = 0;
00302    int vcount = 0;  
00303    int count = 0;
00304 
00305    int longestU = 0;
00306    int longestV = 0;
00307    int longest = 0;
00308 
00309    int totalU = 0;
00310    int totalV = 0;   
00311  
00312    bool start = true;
00313 
00314    for(int i = shwendplane - 1; i < trk->plane.end + 1; i++)
00315    {
00316       if(planes[i] == 0 && start)  continue;  //Keep reading till we find a hit
00317 
00318       if(planes[i] == 0){
00319         if(dir[i] == PlaneView::kU && !start)   ucount++;
00320         if(dir[i] == PlaneView::kV && !start)   vcount++;
00321         if(!start) count++;
00322         continue;
00323       }
00324       
00325       if(planes[i] > 0){
00326         start = false;
00327 
00328         if(dir[i] == PlaneView::kU){
00329            if(ucount > longestU) longestU = ucount;
00330            totalU += ucount;
00331            if(count > longest) longest = count;
00332            ucount = count = 0;
00333         }
00334         if(dir[i] == PlaneView::kV){
00335            if(ucount > longestV) longestV = vcount;
00336            totalV += vcount;
00337            if(count > longest) longest = count;
00338            vcount = count = 0;
00339         }
00340       }
00341    } 
00342 
00343    fANtpShowerInfo.longestTrackGapU = longestU;
00344    fANtpShowerInfo.longestTrackGapV = longestV;
00345    fANtpShowerInfo.gapPlanesU = totalU;
00346    fANtpShowerInfo.gapPlanesV = totalV;
00347    fANtpShowerInfo.longestTrackGap = longest;
00348    fANtpShowerInfo.gapPlanes = totalU + totalV;
00349 }

void ANtpShowerInfoAna::FillNueShowerInformation NtpSRShower ntpShower,
NtpSREvent ntpEvent,
ANtpShowerInfoNue showerInfoNue,
RecRecordImp< RecCandHeader > *  srobj
 

Definition at line 115 of file ANtpShowerInfoAna.cxx.

References MOISolution::EigenValues, MOISolution::EigenVectors, ANtpShowerInfoNue::EValUZ0, ANtpShowerInfoNue::EValUZ1, ANtpShowerInfoNue::EValVZ0, ANtpShowerInfoNue::EValVZ1, ANtpShowerInfoNue::EVecUZ0, ANtpShowerInfoNue::EVecUZ1, ANtpShowerInfoNue::EVecVZ0, ANtpShowerInfoNue::EVecVZ1, SntpHelpers::GetStrip(), NtpSRStripPulseHeight::mip, NtpSRPlane::n, NtpSRShower::nstrip, NtpSREvent::nstrip, NtpSRShower::ph, NtpSREvent::ph, ANtpShowerInfoNue::phMeu, ANtpShowerInfoNue::phMip, ANtpShowerInfoNue::phNueGeV, NtpSRShower::plane, NtpSREvent::plane, ANtpShowerInfoNue::planeRatio, NtpSRStrip::planeview, ANtpShowerInfoNue::pulseHeightRatio, NtpSRShower::stp, NtpSRShower::stpph0mip, NtpSRShower::stpph1mip, ANtpShowerInfoNue::stripRatio, NtpSRStrip::tpos, and NtpSRStrip::z.

Referenced by Analyze().

00116 {
00117 
00118     if(ntpEvent->nstrip){
00119         showerInfoNue->stripRatio=static_cast<Float_t>(ntpShower->nstrip)/static_cast<Float_t>(ntpEvent->nstrip); 
00120     }
00121     if(ntpEvent->plane.n){
00122         showerInfoNue->planeRatio=static_cast<Float_t>(ntpShower->plane.n)/static_cast<Float_t>(ntpEvent->plane.n);
00123     }
00124     if(ntpEvent->ph.mip){
00125         showerInfoNue->pulseHeightRatio=ntpShower->ph.mip/ntpEvent->ph.mip; 
00126     }
00127  
00128     showerInfoNue->phMeu = ntpShower->ph.mip;
00129     showerInfoNue->phMip = ntpShower->ph.mip;    
00130     showerInfoNue->phNueGeV = showerInfoNue->phMip/MeuPerGeV;    
00131     
00132     //borrowing moment of intertia calculation from AtNuOutput package
00133     vector<double> UStripsU, UStripsZ, UStripsE;
00134     vector<double> VStripsU, VStripsZ, VStripsE;
00135     for(int i=0;i<ntpShower->nstrip;i++){
00136       NtpSRStrip *strip = SntpHelpers::GetStrip(ntpShower->stp[i],srobj);
00137       float energy = ntpShower->stpph1mip[i] + ntpShower->stpph0mip[i];
00138 
00139       if(!strip) continue;
00140       if(strip->planeview==2){
00141         UStripsU.push_back(strip->tpos);
00142         UStripsZ.push_back(strip->z);
00143         UStripsE.push_back(energy);
00144       }
00145       else if(strip->planeview==3){
00146         VStripsU.push_back(strip->tpos);
00147         VStripsZ.push_back(strip->z);
00148         VStripsE.push_back(energy);
00149       }
00150     }
00151 
00152     MOISolution MOIUZ(UStripsU,UStripsZ,UStripsE);
00153     showerInfoNue->EValUZ0 = MOIUZ.EigenValues[0];
00154     showerInfoNue->EValUZ1 = MOIUZ.EigenValues[1];
00155     showerInfoNue->EVecUZ0[0] = MOIUZ.EigenVectors[0][0];
00156     showerInfoNue->EVecUZ1[0] = MOIUZ.EigenVectors[1][0];
00157     showerInfoNue->EVecUZ0[1] = MOIUZ.EigenVectors[0][1];
00158     showerInfoNue->EVecUZ1[1] = MOIUZ.EigenVectors[1][1];
00159 
00160     MOISolution MOIVZ(VStripsU,VStripsZ,VStripsE);
00161     showerInfoNue->EValVZ0 = MOIVZ.EigenValues[0];
00162     showerInfoNue->EValVZ1 = MOIVZ.EigenValues[1];
00163     showerInfoNue->EVecVZ0[0] = MOIVZ.EigenVectors[0][0];
00164     showerInfoNue->EVecVZ1[0] = MOIVZ.EigenVectors[1][0];
00165     showerInfoNue->EVecVZ0[1] = MOIVZ.EigenVectors[0][1];
00166     showerInfoNue->EVecVZ1[1] = MOIVZ.EigenVectors[1][1];
00167 
00168     return;
00169 }

Float_t ANtpShowerInfoAna::GetShwEnergy NtpSRShower ntpShower,
Int_t  opt
 

Definition at line 196 of file ANtpShowerInfoAna.cxx.

References NtpSRShowerPulseHeight::EMgev, NtpSRStripPulseHeight::gev, NtpSRShowerPulseHeight::linCCgev, NtpSRShowerPulseHeight::linNCgev, NtpSRShower::ph, NtpSRShower::shwph, NtpSRShowerPulseHeight::wtCCgev, and NtpSRShowerPulseHeight::wtNCgev.

Referenced by RecoShwEnergy().

00197 {
00198   Float_t shower_ene = 0.0;
00199   if(opt==-1) shower_ene = ntpShower->ph.gev;
00200   if(opt==0)  shower_ene = ntpShower->shwph.linCCgev;
00201   if(opt==1)  shower_ene = ntpShower->shwph.wtCCgev;
00202   if(opt==2)  shower_ene = ntpShower->shwph.linNCgev;
00203   if(opt==3)  shower_ene = ntpShower->shwph.wtNCgev;
00204   if(opt==4)  shower_ene = ntpShower->shwph.EMgev;
00205 
00206   return shower_ene;
00207 }

CandShowerHandle::EShowerType ANtpShowerInfoAna::GetShwHandleType Int_t  opt  ) 
 

Definition at line 209 of file ANtpShowerInfoAna.cxx.

Referenced by RecoShwEnergy().

00210 {
00211   CandShowerHandle::EShowerType type = CandShowerHandle::kCC;
00212   if(opt==0)  type = CandShowerHandle::kCC;
00213   if(opt==1)  type = CandShowerHandle::kWtCC;
00214   if(opt==2)  type = CandShowerHandle::kNC;
00215   if(opt==3)  type = CandShowerHandle::kWtCC;
00216  
00217   return type;
00218 }

Float_t ANtpShowerInfoAna::RecoShwEnergy NtpSRShower ntpShower,
Int_t  opt,
Int_t  det
 

Definition at line 173 of file ANtpShowerInfoAna.cxx.

References CorrectShowerEnergyFar(), CorrectShowerEnergyNear(), det, GetShwEnergy(), and GetShwHandleType().

00173                                                                                      {
00174   //use SR reco
00175   Float_t shower_ene=0;
00176   Float_t shwEtemp = GetShwEnergy(ntpShower, opt);
00177   CandShowerHandle::EShowerType type = GetShwHandleType(opt);
00178 
00179   if(det==1){
00180     if(opt==-1 || opt == 4) shower_ene = shwEtemp;
00181     else{
00182         shower_ene = CorrectShowerEnergyNear(shwEtemp, type);
00183     }
00184     return shower_ene;
00185   }
00186   if(det==2){
00187     if(opt==-1 || opt == 4) shower_ene = shwEtemp;
00188     else{
00189         shower_ene = CorrectShowerEnergyFar(shwEtemp, type);
00190     }
00191     return shower_ene;
00192   }
00193   return 0;
00194 }

Float_t ANtpShowerInfoAna::RecoShwEnergy Float_t  linearCCGeV,
SimFlag::SimFlag_t  s,
const Detector::Detector_t det,
int  mode
 

Definition at line 221 of file ANtpShowerInfoAna.cxx.

References CorrectShowerEnergy(), det, ANtpDefaultValue::IsDefault(), and s().

00221                                                                                                                         {
00222 
00223   Float_t result = 0;
00224   // Return Jim's calculation
00225   Bool_t ok = !ANtpDefVal::IsDefault(linearCCGeV);
00226   bool isdata = (s == SimFlag::kData);
00227   if(!ok) return 0;
00228 
00229   // test for shwph.linCCGeV<=0.0
00230   // if so, assume that this is an R1.16 object
00231   // and use ph.gev
00232   result = linearCCGeV;
00233   if(result> 0.0 )
00234   {
00235      result = CorrectShowerEnergy(result,det,CandShowerHandle::kCC,mode,isdata); 
00236   }
00237   return result;
00238 
00239 }

Float_t ANtpShowerInfoAna::RecoShwEnergyNew NtpSRShower ntpShower,
Int_t  opt,
VldContext  cx
 

Definition at line 242 of file ANtpShowerInfoAna.cxx.

References NtpSRShowerPulseHeight::EMgev, EnergyCorrections::FullyCorrectShowerEnergy(), NtpSRStripPulseHeight::gev, NtpSRShowerPulseHeight::linCCgev, NtpSRShowerPulseHeight::linNCgev, NtpSRShower::ph, NtpSRShower::shwph, NtpSRShowerPulseHeight::wtCCgev, and NtpSRShowerPulseHeight::wtNCgev.

Referenced by Analyze().

00244 {
00245   EnergyCorrections::WhichCorrection_t corrver = EnergyCorrections::kDefault; 
00246   Float_t shower_ene=0;
00247 
00248   if(opt==-1) shower_ene = ntpShower->ph.gev;
00249   if(opt==0)  shower_ene = FullyCorrectShowerEnergy(ntpShower->shwph.linCCgev,CandShowerHandle::kCC,cx,release,corrver);
00250   if(opt==1)  shower_ene = FullyCorrectShowerEnergy(ntpShower->shwph.wtCCgev,CandShowerHandle::kWtCC,cx,release,corrver);
00251   if(opt==2)  shower_ene = FullyCorrectShowerEnergy(ntpShower->shwph.linNCgev,CandShowerHandle::kNC,cx,release,corrver);
00252   if(opt==3)  shower_ene = FullyCorrectShowerEnergy(ntpShower->shwph.wtNCgev,CandShowerHandle::kWtNC,cx,release,corrver);
00253   if(opt==4)  shower_ene = ntpShower->shwph.EMgev;
00254   return shower_ene;
00255 
00256   return 0;
00257 }


Member Data Documentation

ANtpShowerInfoNue& ANtpShowerInfoAna::fANtpShowerInfo [private]
 

Definition at line 34 of file ANtpShowerInfoAna.h.

Referenced by Analyze(), and FillGapInformation().

ANtpInfoObjectFiller* ANtpShowerInfoAna::fInfoFiller [private]
 

Definition at line 35 of file ANtpShowerInfoAna.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