12 for(
unsigned int i = 0; i <
fHitVector.size()-1; i++)
16 std::vector<recoHit> vec_TempHits;
27 vec_TempHits.push_back(
fHitVector.at(i + timeCount + 1));
49 fFirstHitTime = 50000;
54 for(
int i = 0; i < fNHits; i++)
60 channels.insert(chan);
68 if(time < fFirstHitTime)
71 if(time > fLastHitTime)
78 fNChan = channels.size();
86 fChanWidth = fEndChan - fStartChan;
87 fTimeWidth = fLastHitTime - fFirstHitTime;
130 NConfigs = cut_AdjChanTolerance.size();
194 std::vector<ClusterHitsInTime> &vec_ChannelCluster,
195 unsigned int const &
config)
199 for(
unsigned int i = 0; i < vec_Hits.size()-1; i++)
201 std::vector<recoHit> vec_TempHits;
202 double width =
std::abs(vec_Hits.at(i ).getHitChan()-
203 vec_Hits.at(i+1).getHitChan());
207 int channelCount = 1;
209 vec_TempHits.push_back(vec_Hits.at(i ));
210 vec_TempHits.push_back(vec_Hits.at(i+1));
212 while((i+channelCount+1)<vec_Hits.size() &&
215 vec_TempHits.push_back(vec_Hits.at(i + channelCount + 1));
219 i = i + channelCount;
221 temp.
DoIt(vec_TempHits);
223 vec_ChannelCluster.push_back(temp);
239 it_Clusters!=vec_Clusters.end();)
241 bool fail_MinChannels(
false), fail_ChanWidth(
false), fail_TotalADC(
false);
243 fail_MinChannels =
true;
246 fail_ChanWidth =
true;
249 fail_TotalADC =
true;
251 if(fail_MinChannels ==
true || fail_ChanWidth ==
true || fail_TotalADC ==
true)
252 it_Clusters = vec_Clusters.erase(it_Clusters);
264 for(
unsigned int i = 0; i < vec_Clusters.size(); i++)
266 vec_Clusters.at(i).setTriggerFlag(1);
277 for(
unsigned int i = 0; i <
NConfigs; i++)
279 TGraph* g_config = tfs->make<TGraph>(
NCuts);
280 g_config->SetName(Form(
"g_ConfigDefinitions%i",i));
301 "DAQQuickClustering_unusedhits");
327 "DAQQuickClustering_clusteredhits");
351 h_ENu_MC = tfs->make<TH1D>(
"h_ENu_MC",
"h_ENu_MC",35,0,50);
352 h_MarlTime_MC = tfs->make<TH1D>(
"h_MarlTime_MC",
"h_MarlTime_MC",100,-0.1,10.5);
353 h_TimeElapsed = tfs->make<TH1D>(
"h_TimeElapsed",
"h_TimeElapsed", 50,0,0.5);
355 std::cout <<
"Finished beginJob" <<
std::endl;
364 ThisPType=it->second;
375 ParIt = ParMap.find(TrID);
377 if(ParIt != ParMap.end())
return true;
394 art::FindManyP<simb::MCParticle> Assn,
397 for (
size_t L1=0; L1 < Hand->size(); ++L1 ) {
398 for (
size_t L2=0; L2 < Assn.at(L1).size(); ++L2 ) {
400 MyMap[ThisPar.
TrackId()] = ThisPar;
416 auto const*
geo = lar::providerFrom<geo::Geometry>();
423 art::FindManyP<simb::MCParticle> MarlAssn(MarlTrue,evt,
fGEANTLabel);
428 art::FindManyP<sim::SupernovaTruth> SNTruth(MarlTrue, evt,
fMARLLabel);
430 double Px_(0), Py_(0), Pz_(0), Pnorm(1);
431 for(
unsigned int i = 0; i < MarlTrue->size(); i++)
433 Nu_Type = MarlTrue->at(i).GetNeutrino().Nu().PdgCode();
434 ENu = MarlTrue->at(i).GetNeutrino().Nu().E();
435 Mode = MarlTrue->at(i).GetNeutrino().Mode();
436 CCNC = MarlTrue->at(i).GetNeutrino().CCNC();
437 Target = MarlTrue->at(i).GetNeutrino().Target();
438 HitNucleon = MarlTrue->at(i).GetNeutrino().HitNuc();
439 Nu_Lep_Type = MarlTrue->at(i).GetNeutrino().Lepton().PdgCode();
440 VertX = MarlTrue->at(i).GetNeutrino().Lepton().Vx();
441 VertY = MarlTrue->at(i).GetNeutrino().Lepton().Vy();
442 VertZ = MarlTrue->at(i).GetNeutrino().Lepton().Vz();
443 Px_ = MarlTrue->at(i).GetNeutrino().Lepton().Px();
444 Py_ = MarlTrue->at(i).GetNeutrino().Lepton().Py();
445 Pz_ = MarlTrue->at(i).GetNeutrino().Lepton().Pz();
446 ENu_Lep = MarlTrue->at(i).GetNeutrino().Lepton().E();
447 for (
unsigned int j = 0; j < SNTruth.at(i).size(); j++)
455 Pnorm = std::sqrt(Px_*Px_+Py_*Py_+Pz_*Pz_);
465 WireID =
geo->NearestWireID(Vertex,
Plane);
480 double drift_velocity = detProp.DriftVelocity(detProp.Efield(),detProp.Temperature());
482 drift_velocity = drift_velocity*0.5;
486 art::FindManyP<simb::MCParticle> APAAssn(APATrue,evt,
fGEANTLabel);
491 art::FindManyP<simb::MCParticle> CPAAssn(CPATrue,evt,
fGEANTLabel);
496 art::FindManyP<simb::MCParticle> Ar39Assn(Ar39True,evt,
fGEANTLabel);
501 art::FindManyP<simb::MCParticle> NeutAssn(NeutTrue,evt,
fGEANTLabel);
506 art::FindManyP<simb::MCParticle> KrypAssn(KrypTrue,evt,
fGEANTLabel);
511 art::FindManyP<simb::MCParticle> PlonAssn(PlonTrue,evt,
fGEANTLabel);
516 art::FindManyP<simb::MCParticle> RdonAssn(RdonTrue,evt,
fGEANTLabel);
521 art::FindManyP<simb::MCParticle> Ar42Assn(Ar42True,evt,
fGEANTLabel);
525 std::map<PType, std::map< int, simb::MCParticle >&> PTypeToMap{
537 for(
auto const& it : PTypeToMap){
539 auto const&
m=it.second;
540 for(
auto const& it2 :
m){
547 std::vector< recob::Hit > ColHits_Marl;
548 std::vector< recob::Hit > ColHits_CPA;
549 std::vector< recob::Hit > ColHits_APA;
550 std::vector< recob::Hit > ColHits_Ar39;
551 std::vector< recob::Hit > ColHits_Neut;
552 std::vector< recob::Hit > ColHits_Kryp;
553 std::vector< recob::Hit > ColHits_Plon;
554 std::vector< recob::Hit > ColHits_Rdon;
555 std::vector< recob::Hit > ColHits_Oth;
556 std::vector< recob::Hit > ColHits_Ar42;
578 if (ThisHit.
View() == 2) {
579 std::vector< sim::TrackIDE > ThisHitIDE;
581 std::vector<const sim::IDE*> ThisSimIDE;
624 if(ThisHitIDE.size()==0)
629 double TopEFrac = -DBL_MAX;
630 for (
size_t ideL=0; ideL < ThisHitIDE.size(); ++ideL)
632 if ( ThisHitIDE[ideL].energyFrac > TopEFrac )
634 TopEFrac = ThisHitIDE[ideL].energyFrac;
635 MainTrID = ThisHitIDE[ideL].trackID;
640 GenType[colHitCount] = ThisPType;
644 Hit_X[colHitCount] = -1;
645 Hit_Y[colHitCount] = -1;
646 Hit_Z[colHitCount] = -1;
652 for(
unsigned int i = 0; i < ThisSimIDE.size(); i++)
654 if(ThisSimIDE.at(i)->trackID==MainTrID)
656 Hit_X[colHitCount] = ThisSimIDE.at(i)->x;
657 Hit_Y[colHitCount] = ThisSimIDE.at(i)->y;
658 Hit_Z[colHitCount] = ThisSimIDE.at(i)->z;
659 Hit_Energy[colHitCount] = ThisSimIDE.at(i)->energy;
666 case kUnknown: { ColHits_Oth .push_back( ThisHit );
break; }
667 case kMarl: { ColHits_Marl.push_back( ThisHit );
break; }
668 case kAPA: { ColHits_APA .push_back( ThisHit );
break; }
669 case kCPA: { ColHits_CPA .push_back( ThisHit );
break; }
670 case kAr39: { ColHits_Ar39.push_back( ThisHit );
break; }
671 case kNeut: { ColHits_Neut.push_back( ThisHit );
break; }
672 case kKryp: { ColHits_Kryp.push_back( ThisHit );
break; }
673 case kPlon: { ColHits_Plon.push_back( ThisHit );
break; }
674 case kRdon: { ColHits_Rdon.push_back( ThisHit );
break; }
675 case kAr42: { ColHits_Ar42.push_back( ThisHit );
break; }
683 std::vector<int> vec_ClusterCount(
NConfigs);
691 std::vector<recoHit> vec_Hits;
696 vec_Hits.push_back(hit);
699 for(
unsigned int j = 0; j < 1; j++)
701 std::vector<ClusterHitsInTime> vec_ChannelCluster;
702 std::vector<cluster> vec_Clusters;
703 TStopwatch *timeElapsed =
new TStopwatch();
706 for(
unsigned int k = 0;
k < vec_ChannelCluster.size();
k++)
708 std::vector<cluster> vec_Temp = vec_ChannelCluster.at(
k).getClusterVector();
710 for(
unsigned int l = 0;
l < vec_Temp.size();
l++)
711 vec_Clusters.push_back(vec_Temp.at(
l));
721 for(
unsigned int k = 0;
k < vec_Clusters.size();
k++)
723 if(vec_Clusters.at(
k).getTriggerFlag()==1)
741 for(
unsigned int l = 0;
l < vec_Clusters.at(
k).getHits().size();
l++)
743 out_HitView.push_back(vec_Clusters.at(
k).getHits().at(
l).getHitView());
744 out_GenType.push_back(vec_Clusters.at(
k).getHits().at(
l).getGenType());
745 out_HitChan.push_back(vec_Clusters.at(
k).getHits().at(
l).getHitChan());
746 out_HitTime.push_back(vec_Clusters.at(
k).getHits().at(
l).getHitTime());
747 out_HitSADC.push_back(vec_Clusters.at(
k).getHits().at(
l).getHitSADC());
748 out_HitRMS .push_back(vec_Clusters.at(
k).getHits().at(
l).getHitRMS ());
754 vec_ClusterCount.at(j)++;
757 vec_ChannelCluster.clear();
758 vec_Clusters.clear();
std::vector< int > MarlSample
std::vector< int > cut_HitsInWindow
std::map< int, simb::MCParticle > NeutParts
std::vector< int > cut_MinChannels
EventNumber_t event() const
std::map< int, PType > trkIDToPType
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
void FillMyMaps(std::map< int, simb::MCParticle > &MyMap, art::FindManyP< simb::MCParticle > Assn, art::ValidHandle< std::vector< simb::MCTruth > > Hand)
geo::WireID WireID() const
float RMS() const
RMS of the hit shape, in tick units.
std::vector< int > cut_MinChanWidth
The data type to uniquely identify a Plane.
std::vector< double > MarlTime
void analyze(art::Event const &evt) override
Planes which measure Z direction.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
geo::View_t View() const
View for the plane of the hit.
std::vector< double > out_HitTime
Cluster finding and building.
std::map< int, std::vector< double > > map_EventToMC
SupernovaSamplingMode_t SamplingMode
Method used to sample the supernova neutrino's energy and arrival time.
std::vector< double > MarlWeight
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
std::map< int, simb::MCParticle > CPAParts
std::map< int, simb::MCParticle > Ar42Parts
double Weight
Statistical weight for this neutrino vertex.
std::vector< double > out_HitRMS
std::vector< int > cut_AdjChanTolerance
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > cut_TimeWindowSize
std::map< int, simb::MCParticle > MarlParts
T get(std::string const &key) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
float Hit_Energy[nMaxHits]
SubRunNumber_t subRun() const
std::map< int, simb::MCParticle > APAParts
void clusterChannels(std::vector< recoHit > &vec_Hits, std::vector< ClusterHitsInTime > &vec_ChannelCluster, unsigned int const &config)
raw::TDCtick_t StartTick() const
Initial tdc tick for hit.
void clusterCut(std::vector< cluster > &vec_Clusters, unsigned int const &config)
PType WhichParType(int TrID)
Detector simulation of raw signals on wires.
std::string fRawDigitLabel
TTree * t_Output_clusteredhits
raw::TDCtick_t EndTick() const
Final tdc tick for hit.
int NCorrespondingIDEs[nMaxHits]
TTree * t_Output_unusedhits
float PeakTime() const
Time of the signal peak, in tick units.
std::vector< float > cut_TotalADC
double SupernovaTime
Arrival time of the supernova neutrino (seconds)
std::vector< int > out_HitView
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void DoIt(std::vector< recoHit > cHitVector)
void trigger(std::vector< cluster > &vec_Clusters, unsigned int const &config)
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
void reconfigure(fhicl::ParameterSet const &p)
std::vector< cluster > fVecClusters
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::map< int, simb::MCParticle > PlonParts
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
art::ServiceHandle< cheat::BackTrackerService > bt_serv
2D representation of charge deposited in the TDC/wire plane
float Hit_NumElectrons[nMaxHits]
std::map< int, simb::MCParticle > Ar39Parts
TPCID_t TPC
Index of the TPC within its cryostat.
std::map< int, simb::MCParticle > RdonParts
std::vector< double > out_HitSADC
recob::tracking::Plane Plane
LArSoft geometry interface.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
bool InMyMap(int TrID, std::map< int, simb::MCParticle > ParMap)
std::vector< int > out_GenType
QTextStream & endl(QTextStream &s)
std::map< int, simb::MCParticle > KrypParts
std::vector< int > out_HitChan
std::vector< recoHit > fHitVector
DAQQuickClustering(fhicl::ParameterSet const &p)