133 art::Handle< vector<simb::MCParticle> > particleHandle;
134 e.getByLabel(
"largeant", particleHandle);
135 map<int,const simb::MCParticle*> idToMu;
136 vector<const simb::MCParticle*> photList;
139 art::Handle< vector<sbn::crt::CRTHit> > trueHitHandle;
140 vector< art::Ptr<sbn::crt::CRTHit> > trueHitList;
141 map<int,vector<art::Ptr<sbn::crt::CRTHit>>> muToTrueHits;
143 if(
e.getByLabel(
"crttruehit",trueHitHandle) )
144 art::fill_ptr_vector(trueHitList,trueHitHandle);
146 for(
auto const& particle : *particleHandle) {
148 if(
abs(particle.PdgCode())==13){
149 idToMu[particle.TrackId()] = &particle;
152 else if(particle.PdgCode()==22 && particle.Process()==
"muBrems")
153 photList.push_back(&particle);
159 for(
auto const&
hit : trueHitList){
161 if(idToMu.find(
id)==idToMu.end())
163 muToTrueHits[id].push_back(
hit);
167 for(
auto const& phot : photList) {
169 const TLorentzVector& positionStart = phot->Position();
170 const TLorentzVector& positionEnd = phot->EndPosition();
177 bool iv =
false, av =
false;
180 for(
size_t i=0; i<4; i++) {
185 fEndE = phot->E(phot->NumberTrajectoryPoints()-2);
188 string endprocess = phot->EndProcess();
189 if(endprocess==
"conv")
fIcode = 0;
190 else if(endprocess==
"compt")
fIcode = 1;
191 else if(endprocess==
"phot")
fIcode = 2;
192 else std::cout <<
"uknown end process: " << endprocess << std::endl;
196 if(idToMu.find(phot->Mother())==idToMu.end())
197 throw cet::exception(
"PhotBackground") <<
198 "no match muon found for mubrems photons" << std::endl;
209 if(muToTrueHits.find(phot->Mother())!=muToTrueHits.end()){
211 fMuNHit=muToTrueHits[phot->Mother()].size();
212 for(
auto const&
hit : muToTrueHits[phot->Mother()]){
213 vector<double> xyzt = {
hit->x_pos,
hit->y_pos,
hit->z_pos,(double)
hit->ts0_ns};
216 for(
int j=0; j<3; j++) l+=pow(xyzt[j]-
fEndPos[j],2);
219 string reg =
hit->tagger;
225 for(
size_t i=0; i<idToMu[phot->Mother()]->NumberTrajectoryPoints(); i++){
227 const TLorentzVector& position = idToMu[phot->Mother()]->Position(i);
vector< vector< double > > fMuHitPos
double fEndPos[4]
photon end x,y,z,t [cm/ns]
int EnteredLar(const TLorentzVector &v, bool &iv, bool &fv)
double fStartPos[4]
photon start x,y,z,t [cm/ns]
vector< double > fMuHitDt
int fStartReg
region where photon was produced
int AuxDetRegionNameToNum(string reg)
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
int fIcode
end process code [-1->do not use; 0-> pair prod; 1-> compton]
std::vector< int > AllTrueIds(const art::Event &event, const CRTData &data)
double fStartE
photon start energy [GeV]
crt::CRTCommonUtils * fCrtutils
vector< double > fMuHitDx
BEGIN_PROLOG could also be cout
double fEndE
photon end energy [GeV]
int fEndReg
region where photon interacted