33 #include "Utilities/AssociationUtil.h" 57 class ShowerMuonCoincidence;
114 for (
unsigned int iShower = 0; iShower < showerClusterHandle->size(); iShower++) {
115 rb::Cluster showerSlice = (*showerClusterHandle)[iShower];
116 auto hitTimeMin = showerSlice.
MinTNS();
117 auto hitTimeMax = showerSlice.
MaxTNS();
119 auto coincidenceWindowMin = hitTimeMin - 500;
120 auto coincidenceWindowMax = hitTimeMax + 500;
121 unsigned int countSlicers = 0;
122 std::vector<art::Ptr<rb::Track>> tracks;
123 for (
unsigned int iMuon = 0; iMuon < muonClusterHandle->size(); iMuon++){
124 rb::Cluster muonSlice = (*muonClusterHandle)[iMuon];
125 auto muonHitTimeMin = muonSlice.
MinTNS();
126 auto muonHitTimeMax = muonSlice.
MaxTNS();
127 bool muonBeforeShower = coincidenceWindowMin <= muonHitTimeMax && muonHitTimeMax <= coincidenceWindowMax;
128 bool muonAfterShower = coincidenceWindowMin <= muonHitTimeMin && muonHitTimeMin <= coincidenceWindowMax;
129 if (muonBeforeShower && muonAfterShower) {
131 if (fmtrack.isValid()){
132 tracks = fmtrack.at(iMuon);
137 if (countSlicers == 1) {
143 TVector3 point(vertexXinCM, vertexYinCM, vertexZinCM);
146 if (tracks.size() == 1) {
147 if (tracks.at(0)->Is3D()) {
148 auto startPoint = tracks.at(0)->Start();
149 auto endPoint = tracks.at(0)->Stop();
162 double distSq21 = (point2 - point1).
Mag2();
163 double distSq10 = (point1 - point0).
Mag2();
164 double scalarProd = (point1 - point0).
Dot(point2 - point1);
165 double numerator = distSq10 * distSq21 - TMath::Power(scalarProd, 2);
void beginSubRun(art::SubRun const &sr) override
float Dot(const Proxy &v) const
A collection of associated CellHits.
static void energyBalancingVertex(rb::Cluster cluster, double &vertexX, double &vertexY, double &vertexZ)
DEFINE_ART_MODULE(TestTMapFile)
void beginRun(art::Run const &r) override
ShowerMuonCoincidence(fhicl::ParameterSet const &p)
void analyze(art::Event const &e) override
art::InputTag _MuonClusterLabel
void endSubRun(art::SubRun const &sr) override
ShowerMuonCoincidence & operator=(ShowerMuonCoincidence const &)=delete
EDAnalyzer(Table< Config > const &config)
Vertex location in position and time.
art::InputTag _CosmicTrackLabel
double distancePointToLine(TVector3 point, TVector3 pointOnLineA, TVector3 pointOnLineB)
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Var Sqrt(const Var &v)
Use to take sqrt of a var.
TH1D * distFromShowerToCoincidenceMuon
art::InputTag _ShowerClusterLabel
void endRun(art::Run const &r) override