27 #include "art_root_io/TFileService.h" 31 #include "dune/Protodune/singlephase/CTB/data/pdspctb.h" 32 #include "dune/Protodune/singlephase/CRT/data/CRTTrigger.h" 36 #include "artdaq-core/Data/ContainerFragment.hh" 41 #include "TLorentzVector.h" 56 #include "canvas/Persistency/Common/FindManyP.h" 148 consumes<std::vector<raw::RDTimeStamp>>(
fTimeLabel);
149 consumes<std::vector<raw::ctb::pdspctb>>(
fCTBLabel);
150 consumes<std::vector<CRT::Trigger>>(
fCRTLabel);
191 for(
int h=0;
h<32;
h++){
199 fTree = tFileService->make<TTree>(
"ProtoDUNE_Evt_Match",
"ProtoDUNE Matched Event Tree");
250 if(timeStamps.isValid() && timeStamps->size() == 1){
256 mf::LogWarning(
"Empty Event TimeStamp") <<
"Invalid Event TimeStamp. Skipping. \n";
260 if (trigger !=13)
return;
263 if(crtHandle->empty()){
264 mf::LogWarning(
"Empty CRT Fragment") <<
"Empty CRT fragments for this event. Skipping. \n";
269 if(OpHitHandle->empty()){
270 mf::LogWarning(
"Empty OpHit Object") <<
"Empty OpHit Object. Error in retrieval. Skipping. \n";
275 if(ctbHandle->empty()){
276 mf::LogWarning(
"Empty CTB Fragment") <<
"Empty CTB fragment for this event. Skipping. \n";
280 if(ctbHandle->size() > 1){
281 mf::LogWarning(
"Multiple CTB Triggers") <<
"Found " << ctbHandle->size() <<
" CTB data products. Skipping. \n";
285 const auto& ctbStatus = ctbHandle->front();
286 const auto statuses = ctbStatus.GetChStatusAfterHLTs();
289 for(
const auto&
status: statuses){
310 if(!crtHandle->empty()){
311 std::vector<CRT::Trigger> inWindow(crtHandle->size());
312 const int64_t ctbetime =
status.timestamp;
313 const auto newEnd = std::copy_if(crtHandle->begin(), crtHandle->end(), inWindow.begin(),[
this,ctbetime](
const auto& trigger){
316 for(
size_t k=0;
k<inWindow.size();++
k){
318 fCRTChan.push_back(inWindow[
k].Channel());
321 for(
const auto& OpHit: *OpHitHandle){
322 if(OpHit.PE() < 10.0 || OpHit.PE() > 1000.00)
continue;
323 fPDS_time.push_back((OpHit.PeakTime()/3));
324 fOpChan.push_back(OpHit.OpChannel());
325 fPE.push_back(OpHit.PE());
328 std::vector<art::Ptr<recob::Track>> PandoTrk;
332 mf::LogWarning(
"Empty PandoTrk Fragment") <<
"Empty PandoTrk Vector for this event. Skipping. \n";
337 if(!PFParListHandle){;
338 mf::LogWarning(
"Empty PFParticle Vector") <<
"Empty PFParticle Vector for this event. Skipping. \n";
341 art::FindManyP<recob::PFParticle> PFPar(PandoTrkHandle,e,
fPandoLabel);
344 for(
size_t p = 0;
p<PandoTrk.size();++
p){
345 auto & Trk = PandoTrk[
p];
346 if(!((Trk->Vertex().Z() < 40) || (Trk->End().Z() < 40)))
continue;
347 if(!((Trk->Vertex().Z() > 660) || (Trk->End().Z() > 660)))
continue;
355 auto &PFPS = PFPar.at(Trk.key());
357 auto &T0S = PFT0.at(PFPS[0].
key());
359 t0temp = T0S[0]->Time();
364 if(PandoTrk.size() > 0) pat =
true;
366 if(pat)
fTree->Fill();
PDSPmatch(fhicl::ParameterSet const &p)
std::vector< double > fPE
const art::InputTag fCTBLabel
const art::InputTag fOpHitLabel
uint16_t GetFlags() const
Handle< PROD > getHandle(SelectorBase const &) const
std::vector< double > fTrkStartx_Pando
std::vector< double > fTrkDSPixelProx_Pando
const art::InputTag fCRTLabel
std::vector< int64_t > fCRT_time
std::vector< TVector3 > PandoTracks
const uint64_t fCRTWindow
std::vector< double > fTrkEndx_Pando
EDAnalyzer(fhicl::ParameterSet const &pset)
const art::InputTag fPandoLabel
const art::InputTag fPFParListLabel
std::vector< double > fTrkEndz_Pando
art framework interface to geometry description
void analyze(art::Event const &e) override
std::vector< int64_t > fPDS_time
std::vector< double > fTrkDSPosy_Pando
#define DEFINE_ART_MODULE(klass)
std::vector< double > fTrkDSPosx_Pando
std::vector< uint32_t > fCRTChan
std::vector< double > fTrkDSPixelProy_Pando
const int64_t fCRTCTBOffset
std::vector< double > fTrkPhi_Pando
std::vector< uint32_t > fTrkProDS_Pando
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
std::vector< TVector3 > PMTracks
std::vector< double > fTrkUSPos1y_Pando
SubRunNumber_t subRun() const
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< double > fTrkUSPos2y_Pando
std::vector< double > fTrkStartz_Pando
std::vector< int64_t > fPando_time
ULong64_t GetTimeStamp() const
Encapsulate the geometry of an optical detector.
std::vector< double > fOpChan
std::vector< double > fTrkUSPixelProx_Pando
const art::InputTag fTimeLabel
std::vector< uint32_t > fTrkProUS_Pando
std::vector< double > fTrkStarty_Pando
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Provides recob::Track data product.
EventNumber_t event() const
Access the description of detector geometry.
PDSPmatch & operator=(PDSPmatch const &)=delete
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::vector< double > fTrkTheta_Pando
std::vector< double > fTrkUSPixelProy_Pando
std::vector< double > fTrkUSPos1x_Pando
std::vector< double > fTrkUSPos2x_Pando
Event finding and building.
pure virtual base interface for detector clocks
std::vector< double > fTrkEndy_Pando
std::vector< double > fTrigCos_Pando