AtNuShieldEvent Class Reference

#include <AtNuShieldEvent.h>

List of all members.

Public Member Functions

 AtNuShieldEvent ()
 ~AtNuShieldEvent ()
void FillEvent (AtmosEvent *event, AtmosEvent *vetoevent=0, Double_t tmin=-50.0, Double_t tmax=+50.0)
AtmosShieldPlankGetMatchedPlank (Int_t ishield, Bool_t &vetoN, Bool_t &vetoS)
AtmosShieldPlankGetMatchedPlank (Int_t ishield, Double_t &dtN, Double_t &dtS)
AtmosShieldPlankGetMatchedPlank (Int_t ishield)
Int_t GetMatchedPlankEntries ()
AtmosShieldPlankGetExpectedPlank (Int_t ishield)
Int_t GetExpectedPlankEntries ()

Private Member Functions

void FindMatchedPlanks (AtmosTrack *track, Double_t tmin, Double_t tmax)
void FindMatchedPlanksFromTruth (AtmosEvent *event)
void FindExpectedPlanks (AtmosTrack *track)

Private Attributes

std::vector< AtmosShieldPlank * > fMatchedPlanks
std::vector< Double_t > fMatchedPlanksTimeN
std::vector< Double_t > fMatchedPlanksTimeS
std::vector< Bool_t > fMatchedPlanksVetoN
std::vector< Bool_t > fMatchedPlanksVetoS
std::vector< AtmosShieldPlank * > fExpectedPlanks
ShieldGeomfShGeom
VldContextfVldContext
TClonesArray * fShieldPlankList
Bool_t * fVeto
Double_t * fTime


Detailed Description

Definition at line 16 of file AtNuShieldEvent.h.


Constructor & Destructor Documentation

AtNuShieldEvent::AtNuShieldEvent (  ) 

Definition at line 11 of file AtNuShieldEvent.cxx.

00012 {
00013   fShGeom = 0;
00014   fVldContext = 0;
00015   fShieldPlankList = 0;
00016 
00017   fVeto = new Bool_t[2];
00018   fTime = new Double_t[2];
00019 }

AtNuShieldEvent::~AtNuShieldEvent (  ) 

Definition at line 21 of file AtNuShieldEvent.cxx.

References fTime, and fVeto.

00022 {
00023   delete [] fVeto;
00024   delete [] fTime;
00025 }


Member Function Documentation

void AtNuShieldEvent::FillEvent ( AtmosEvent event,
AtmosEvent vetoevent = 0,
Double_t  tmin = -50.0,
Double_t  tmax = +50.0 
)

Definition at line 27 of file AtNuShieldEvent.cxx.

References fExpectedPlanks, FindExpectedPlanks(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), fMatchedPlanks, fMatchedPlanksTimeN, fMatchedPlanksTimeS, fMatchedPlanksVetoN, fMatchedPlanksVetoS, fShieldPlankList, fVldContext, SimFlag::kData, Detector::kFar, AtmosEvent::NanoSec, AtmosEvent::NTracks, AtmosEvent::ShieldPlankList, AtmosEvent::SimFlag, AtmosEvent::TrackList, and AtmosEvent::UnixTime.

Referenced by AtNuShieldEventNtuple::Run().

00028 {  
00029   fMatchedPlanks.clear();
00030   fMatchedPlanksVetoN.clear();
00031   fMatchedPlanksVetoS.clear();
00032   fMatchedPlanksTimeN.clear();
00033   fMatchedPlanksTimeS.clear();
00034 
00035   for( unsigned n=0; n<fExpectedPlanks.size(); n++ ){
00036     AtmosShieldPlank* plank = (AtmosShieldPlank*)(fExpectedPlanks.at(n));
00037     if( plank ) delete plank;
00038   }
00039 
00040   fExpectedPlanks.clear();
00041 
00042   if( event==0 ){
00043     return;
00044   }
00045 
00046   AtmosEvent* tempevent = vetoevent;
00047   if( tempevent==0 ) tempevent = event;
00048 
00049   if( fVldContext ) delete fVldContext;
00050   VldTimeStamp vtime(tempevent->UnixTime, tempevent->NanoSec);
00051   fVldContext = new VldContext(Detector::kFar, SimFlag::kData, vtime);
00052   fShieldPlankList = (TClonesArray*)(tempevent->ShieldPlankList);
00053 
00054   // expected shield hits
00055   for( Int_t itrack=0; itrack<event->NTracks; itrack++ ){
00056     AtmosTrack* track = (AtmosTrack*)(event->TrackList->At(itrack));
00057     FindExpectedPlanks(track);
00058   }
00059 
00060   // observed shield hits
00061   if( event->SimFlag==1 ){
00062     for( Int_t itrack=0; itrack<event->NTracks; itrack++ ){
00063       AtmosTrack* track = (AtmosTrack*)(event->TrackList->At(itrack));
00064       FindMatchedPlanks(track, tmin, tmax);
00065     }
00066   }
00067 
00068   // observed shield hits from truth
00069   else if( event->SimFlag==4 ){
00070     FindMatchedPlanksFromTruth(event);
00071   }
00072   
00073   return;
00074 }

void AtNuShieldEvent::FindExpectedPlanks ( AtmosTrack track  )  [private]

Definition at line 308 of file AtNuShieldEvent.cxx.

References fExpectedPlanks, fShGeom, fVldContext, CandShieldSR::GetCandShieldPlane(), CandShieldSR::GetCandShieldStrip0(), ShieldGeom::GetPlank_X(), ShieldGeom::GetPlank_Y(), CandShieldSR::HitsInShield(), ShieldGeom::Reinitialize(), AtmosTrack::VtxDirCosX, AtmosTrack::VtxDirCosY, AtmosTrack::VtxDirCosZ, AtmosTrack::VtxX, AtmosTrack::VtxY, AtmosTrack::VtxZ, and ShieldGeom::WhatSection().

Referenced by FillEvent().

00309 {
00310   if( track==0 ){
00311     return;
00312   }
00313 
00314   Double_t TrkVtxX = track->VtxX;
00315   Double_t TrkVtxY = track->VtxY;
00316   Double_t TrkVtxZ = track->VtxZ;
00317 
00318   Double_t TrkVtxDirCosX = track->VtxDirCosX;
00319   Double_t TrkVtxDirCosY = track->VtxDirCosY;
00320   Double_t TrkVtxDirCosZ = track->VtxDirCosZ;
00321 
00322   if(!fShGeom) {
00323     fShGeom = new ShieldGeom(*fVldContext);
00324   }
00325   else {
00326     fShGeom->Reinitialize(*fVldContext);
00327   }
00328 
00329   CandShieldSR candsh(TrkVtxX,TrkVtxY,TrkVtxZ,
00330                       TrkVtxDirCosX,TrkVtxDirCosY,TrkVtxDirCosZ,
00331                       fShGeom);
00332 
00333   for( Int_t iplank=0; iplank<candsh.HitsInShield(); iplank++ ){
00334 
00335     AtmosShieldPlank* plank = new AtmosShieldPlank();
00336 
00337     plank->Plane = candsh.GetCandShieldPlane(iplank+1);
00338     plank->Plank = candsh.GetCandShieldStrip0(iplank+1);
00339     plank->Section = fShGeom->WhatSection(plank->Plane);
00340     plank->X = fShGeom->GetPlank_X(plank->Plane,plank->Plank);
00341     plank->Y = fShGeom->GetPlank_Y(plank->Plane,plank->Plank);
00342 
00343     fExpectedPlanks.push_back(plank);
00344   }
00345 
00346   //
00347   // print expected planks
00348   // =====================
00349   // for( unsigned int i=0; i<fExpectedPlanks.size(); i++ ){
00350   //   fShieldPlank = fExpectedPlanks.at(i);
00351   //   std::cout << " Expected: Section=" << fShieldPlank.Section << " Plane=" << fShieldPlank.Plane << " Plank=" << fShieldPlank.Plank << " X=" << fShieldPlank.X << " Y=" << fShieldPlank.Y << std::endl;
00352   // }
00353   //
00354 
00355   return;
00356 }

void AtNuShieldEvent::FindMatchedPlanks ( AtmosTrack track,
Double_t  tmin,
Double_t  tmax 
) [private]

Definition at line 126 of file AtNuShieldEvent.cxx.

References MuELoss::e, AtmosTrack::EndTime, AtmosTrack::EndU, AtmosTrack::EndV, AtmosTrack::EndX, AtmosTrack::EndY, AtmosTrack::EndZ, fClearFibreN, fMatchedPlanks, fMatchedPlanksTimeN, fMatchedPlanksTimeS, fMatchedPlanksVetoN, fMatchedPlanksVetoS, fShieldPlankList, fTime, fVeto, fWlsFibreN, AtmosTrack::VtxTime, AtmosTrack::VtxU, AtmosTrack::VtxV, AtmosTrack::VtxX, AtmosTrack::VtxY, and AtmosTrack::VtxZ.

Referenced by FillEvent().

00127 {
00128   if( track == 0 ){
00129     return;
00130   }
00131 
00132   if( fShieldPlankList==0 ){
00133     return;
00134   }
00135 
00136   Double_t topvtxX = 0.0;
00137   Double_t topvtxY = 0.0;
00138   Double_t topvtxZ = -999.9;
00139   Double_t topvtxtime = 0.0;
00140 
00141   Double_t shldminU = -999.9;
00142   Double_t shldmaxU = +999.9;
00143   Double_t shldminV = -999.9;
00144   Double_t shldmaxV = +999.9;
00145   Double_t shldminX = -999.9;
00146   Double_t shldmaxX = +999.9;
00147   Double_t shldminY = -999.9;
00148   Double_t shldmaxY = +999.9;
00149 
00150   if (track->VtxY >= track->EndY){
00151     topvtxX = track->VtxX; 
00152     topvtxY = track->VtxY; 
00153     topvtxZ = track->VtxZ;
00154     topvtxtime = track->VtxTime; 
00155     if(track->EndX>+3.5) shldmaxX = +4.5;
00156     if(track->EndX<-3.5) shldminX = -4.5;
00157     if(track->EndU<-3.5) shldminU = -4.5;
00158     if(track->EndV<-3.5) shldminV = -4.5;
00159     shldminY = track->VtxY-0.1;
00160   } 
00161   else{
00162     topvtxX = track->EndX; 
00163     topvtxY = track->EndY; 
00164     topvtxZ = track->EndZ;
00165     topvtxtime = track->EndTime; 
00166     if(track->VtxX>+3.5) shldmaxX = +4.5;
00167     if(track->VtxX<-3.5) shldminX = -4.5;
00168     if(track->VtxU<-3.5) shldminU = -4.5;
00169     if(track->VtxV<-3.5) shldminV = -4.5;
00170     shldminY = track->EndY-0.1;
00171   }
00172 
00173   Int_t nplanks = (int)(fShieldPlankList->GetEntries());
00174 
00175   for (Int_t iplank = 0; iplank<nplanks; iplank++) {
00176     AtmosShieldPlank* plank = dynamic_cast<AtmosShieldPlank*>(fShieldPlankList->At(iplank));
00177 
00178     Double_t plankU = 0.7071*(+plank->X+plank->Y);
00179     Double_t plankV = 0.7071*(-plank->X+plank->Y);
00180     Double_t plankX = plank->X;
00181     Double_t plankY = plank->Y;
00182 
00183     if( plank->Z[0]+0.5>topvtxZ
00184      && plank->Z[1]-0.5<topvtxZ
00185      && plankU>shldminU && plankU<shldmaxU
00186      && plankV>shldminV && plankV<shldmaxV
00187      && plankX>shldminX && plankX<shldmaxX
00188      && plankY>shldminY && plankY<shldmaxY ){
00189 
00190       Double_t travelDT = (1.0/3.0e8)*sqrt(
00191         (plank->X-topvtxX)*(plank->X-topvtxX) +
00192         (plank->Y-topvtxY)*(plank->Y-topvtxY) );
00193      
00194       for( Int_t iend=0; iend<2; iend++ ){
00195         fTime[iend] = 0.0;
00196 
00197         if( plank->QPE[iend]>0.0 ){
00198           fTime[iend] = plank->Tcal[iend] + 26e-9;
00199           fTime[iend] -= plank->WlsPigtail[iend]*fWlsFibreN/3e8;
00200           fTime[iend] -= plank->ClearFibre[iend]*fClearFibreN/3e8;
00201           fTime[iend] -= TMath::Abs(topvtxZ-plank->Z[iend])*fWlsFibreN/3e8;
00202           fTime[iend] += travelDT;
00203           fTime[iend] -= topvtxtime;
00204           fTime[iend] *= 1.0e9;
00205         }
00206         else{
00207           fTime[iend] = -99999.9;
00208         }
00209       
00210         fVeto[iend] = 0;
00211 
00212         if( fTime[iend]>tmin && fTime[iend]<tmax ){
00213           fVeto[iend] = 1;
00214         }
00215       }
00216 
00217       fMatchedPlanks.push_back(plank);
00218       fMatchedPlanksVetoN.push_back(fVeto[0]);
00219       fMatchedPlanksVetoS.push_back(fVeto[1]);
00220       fMatchedPlanksTimeN.push_back(fTime[0]);
00221       fMatchedPlanksTimeS.push_back(fTime[1]);
00222 
00223     }
00224   }
00225 
00226   //
00227   // print matched planks
00228   // ====================
00229   // for( unsigned int i=0; i<fMatchedPlanks.size(); i++ ){
00230   //   AtmosShieldPlank* plank = fMatchedPlanks.at(i);
00231   //   fVeto[0] = fMatchedPlanksVetoN.at(i);
00232   //   fVeto[1] = fMatchedPlanksVetoS.at(i);
00233   //   fTime[0] = fMatchedPlanksTimeN.at(i);
00234   //   fTime[1] = fMatchedPlanksTimeS.at(i);
00235   //   std::cout << " Observed: Section=" << plank->Section << " Plane=" << plank->Plane << " Plank=" << plank->Plank << " X=" << plank->X << " Y=" << plank->Y << " dT(N)=" << fTime[0] << " dT(S)=" << fTime[1] << " veto(N)=" << fVeto[0] << " veto(S)=" << fVeto[1] << std::endl;
00236   // }
00237   //
00238 
00239   return;
00240 }

void AtNuShieldEvent::FindMatchedPlanksFromTruth ( AtmosEvent event  )  [private]

Definition at line 242 of file AtNuShieldEvent.cxx.

References fMatchedPlanks, fMatchedPlanksTimeN, fMatchedPlanksTimeS, fMatchedPlanksVetoN, fMatchedPlanksVetoS, fShGeom, fVldContext, CandShieldSR::GetCandShieldPlane(), CandShieldSR::GetCandShieldStrip0(), ShieldGeom::GetPlank_X(), ShieldGeom::GetPlank_Y(), CandShieldSR::HitsInShield(), AtmosEvent::MCInfo, AtmosMC::MuVtxX, AtmosMC::MuVtxY, AtmosMC::MuVtxZ, AtmosMC::PmuX, AtmosMC::PmuY, AtmosMC::PmuZ, ShieldGeom::Reinitialize(), and ShieldGeom::WhatSection().

Referenced by FillEvent().

00243 {
00244   if( event==0 ){
00245     return;
00246   }
00247 
00248   Double_t Pmu = sqrt( event->MCInfo.PmuX*event->MCInfo.PmuX
00249                      + event->MCInfo.PmuY*event->MCInfo.PmuY
00250                      + event->MCInfo.PmuZ*event->MCInfo.PmuZ );
00251 
00252   if( Pmu==0 ){
00253     return;
00254   }
00255 
00256   Double_t TrkVtxX = event->MCInfo.MuVtxX;
00257   Double_t TrkVtxY = event->MCInfo.MuVtxY;
00258   Double_t TrkVtxZ = event->MCInfo.MuVtxZ;
00259 
00260   Double_t TrkVtxDirCosX = event->MCInfo.PmuX/Pmu;
00261   Double_t TrkVtxDirCosY = event->MCInfo.PmuY/Pmu;
00262   Double_t TrkVtxDirCosZ = event->MCInfo.PmuZ/Pmu;
00263 
00264   if(!fShGeom) {
00265     fShGeom = new ShieldGeom(*fVldContext);
00266   }
00267   else {
00268     fShGeom->Reinitialize(*fVldContext);
00269   }
00270 
00271   CandShieldSR candsh(TrkVtxX,TrkVtxY,TrkVtxZ,
00272                       TrkVtxDirCosX,TrkVtxDirCosY,TrkVtxDirCosZ,
00273                       fShGeom);
00274 
00275   for( Int_t iplank=0; iplank<candsh.HitsInShield(); iplank++ ){
00276 
00277     AtmosShieldPlank* plank = new AtmosShieldPlank();
00278 
00279     plank->Plane = candsh.GetCandShieldPlane(iplank+1);
00280     plank->Plank = candsh.GetCandShieldStrip0(iplank+1);
00281     plank->Section = fShGeom->WhatSection(plank->Plane);
00282     plank->X = fShGeom->GetPlank_X(plank->Plane,plank->Plank);
00283     plank->Y = fShGeom->GetPlank_Y(plank->Plane,plank->Plank);
00284 
00285     fMatchedPlanks.push_back(plank);
00286     fMatchedPlanksVetoN.push_back(1);
00287     fMatchedPlanksVetoS.push_back(1);
00288     fMatchedPlanksTimeN.push_back(0.0);
00289     fMatchedPlanksTimeS.push_back(0.0);
00290   }
00291 
00292   //
00293   // print matched planks
00294   // ====================
00295   // for( unsigned int i=0; i<fMatchedPlanks.size(); i++ ){
00296   //   AtmosShieldPlank* plank = fMatchedPlanks.at(i);
00297   //   fVeto[0] = fMatchedPlanksVetoN.at(i);
00298   //   fVeto[1] = fMatchedPlanksVetoS.at(i);
00299   //   fTime[0] = fMatchedPlanksTimeN.at(i);
00300   //   fTime[1] = fMatchedPlanksTimeS.at(i);
00301   //   std::cout << " Observed: Section=" << plank->Section << " Plane=" << plank->Plane << " Plank=" << plank->Plank << " X=" << plank->X << " Y=" << plank->Y << " dT(N)=" << fTime[0] << " dT(S)=" << fTime[1] << " veto(N)=" << fVeto[0] << " veto(S)=" << fVeto[1] << std::endl;
00302   // }
00303   //
00304 
00305   return;
00306 }

AtmosShieldPlank * AtNuShieldEvent::GetExpectedPlank ( Int_t  ishield  ) 

Definition at line 112 of file AtNuShieldEvent.cxx.

References fExpectedPlanks, and GetExpectedPlankEntries().

Referenced by AtNuShieldEventNtuple::Run().

00113 {
00114   if( ishield<this->GetExpectedPlankEntries() ){
00115     return (AtmosShieldPlank*)(fExpectedPlanks.at(ishield));
00116   }
00117 
00118   return 0;
00119 }

Int_t AtNuShieldEvent::GetExpectedPlankEntries (  ) 

Definition at line 121 of file AtNuShieldEvent.cxx.

References fExpectedPlanks.

Referenced by GetExpectedPlank(), and AtNuShieldEventNtuple::Run().

00122 {
00123   return (Int_t)(fExpectedPlanks.size());
00124 }

AtmosShieldPlank * AtNuShieldEvent::GetMatchedPlank ( Int_t  ishield  ) 

Definition at line 76 of file AtNuShieldEvent.cxx.

References fMatchedPlanks, and GetMatchedPlankEntries().

00077 {
00078   if( ishield<this->GetMatchedPlankEntries() ){
00079     return (AtmosShieldPlank*)fMatchedPlanks.at(ishield);
00080   }
00081 
00082   return 0;
00083 }

AtmosShieldPlank * AtNuShieldEvent::GetMatchedPlank ( Int_t  ishield,
Double_t &  dtN,
Double_t &  dtS 
)

Definition at line 96 of file AtNuShieldEvent.cxx.

References fMatchedPlanks, fMatchedPlanksTimeN, fMatchedPlanksTimeS, and GetMatchedPlankEntries().

00097 {
00098   if( ishield<this->GetMatchedPlankEntries() ){
00099     dtN = fMatchedPlanksTimeN.at(ishield);
00100     dtS = fMatchedPlanksTimeS.at(ishield);
00101     return (AtmosShieldPlank*)fMatchedPlanks.at(ishield);
00102   }
00103 
00104   return 0;
00105 }

AtmosShieldPlank * AtNuShieldEvent::GetMatchedPlank ( Int_t  ishield,
Bool_t &  vetoN,
Bool_t &  vetoS 
)

Definition at line 85 of file AtNuShieldEvent.cxx.

References fMatchedPlanks, fMatchedPlanksVetoN, fMatchedPlanksVetoS, and GetMatchedPlankEntries().

Referenced by AtNuShieldEventNtuple::Run().

00086 {
00087   if( ishield<this->GetMatchedPlankEntries() ){
00088     vetoN = fMatchedPlanksVetoN.at(ishield);
00089     vetoS = fMatchedPlanksVetoS.at(ishield);
00090     return (AtmosShieldPlank*)fMatchedPlanks.at(ishield);
00091   }
00092 
00093   return 0;
00094 }

Int_t AtNuShieldEvent::GetMatchedPlankEntries (  ) 

Definition at line 107 of file AtNuShieldEvent.cxx.

References fMatchedPlanks.

Referenced by GetMatchedPlank(), and AtNuShieldEventNtuple::Run().

00108 {
00109   return (Int_t)(fMatchedPlanks.size());
00110 }


Member Data Documentation

std::vector<AtmosShieldPlank*> AtNuShieldEvent::fExpectedPlanks [private]

Definition at line 45 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindExpectedPlanks(), GetExpectedPlank(), and GetExpectedPlankEntries().

std::vector<AtmosShieldPlank*> AtNuShieldEvent::fMatchedPlanks [private]

Definition at line 39 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), GetMatchedPlank(), and GetMatchedPlankEntries().

std::vector<Double_t> AtNuShieldEvent::fMatchedPlanksTimeN [private]

Definition at line 40 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), and GetMatchedPlank().

std::vector<Double_t> AtNuShieldEvent::fMatchedPlanksTimeS [private]

Definition at line 41 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), and GetMatchedPlank().

std::vector<Bool_t> AtNuShieldEvent::fMatchedPlanksVetoN [private]

Definition at line 42 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), and GetMatchedPlank().

std::vector<Bool_t> AtNuShieldEvent::fMatchedPlanksVetoS [private]

Definition at line 43 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindMatchedPlanks(), FindMatchedPlanksFromTruth(), and GetMatchedPlank().

ShieldGeom* AtNuShieldEvent::fShGeom [private]

Definition at line 47 of file AtNuShieldEvent.h.

Referenced by FindExpectedPlanks(), and FindMatchedPlanksFromTruth().

TClonesArray* AtNuShieldEvent::fShieldPlankList [private]

Definition at line 50 of file AtNuShieldEvent.h.

Referenced by FillEvent(), and FindMatchedPlanks().

Double_t* AtNuShieldEvent::fTime [private]

Definition at line 53 of file AtNuShieldEvent.h.

Referenced by FindMatchedPlanks(), and ~AtNuShieldEvent().

Bool_t* AtNuShieldEvent::fVeto [private]

Definition at line 52 of file AtNuShieldEvent.h.

Referenced by FindMatchedPlanks(), and ~AtNuShieldEvent().

VldContext* AtNuShieldEvent::fVldContext [private]

Definition at line 48 of file AtNuShieldEvent.h.

Referenced by FillEvent(), FindExpectedPlanks(), and FindMatchedPlanksFromTruth().


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:55:07 2014 for loon by  doxygen 1.4.7