1867 art::FindManyP<rec::Hit>* findManyHits = NULL;
1869 TPCClusterHandle =
e.getHandle< std::vector<rec::TPCCluster> >(
fTPCClusterLabel);
1870 if (!TPCClusterHandle) {
1872 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1874 findManyHits =
new art::FindManyP<rec::Hit>(TPCClusterHandle,
e,
fTPCClusterLabel);
1882 art::FindManyP<rec::TPCCluster>* findManyTPCClusters = NULL;
1883 art::FindOneP<rec::TrackIoniz>* findIonization = NULL;
1885 TrackHandle =
e.getHandle< std::vector<rec::Track> >(
fTrackLabel);
1888 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1890 TrackIonHandle =
e.getHandle< std::vector<rec::TrackIoniz> >(
fTrackLabel);
1891 if (!TrackIonHandle) {
1893 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1896 findManyTPCClusters =
new art::FindManyP<rec::TPCCluster>(TrackHandle,
e,
fTrackLabel);
1897 findIonization =
new art::FindOneP<rec::TrackIoniz>(TrackHandle,
e,
fTrackLabel);
1901 if (!TrackTrajHandle) {
1902 throw cet::exception(
"anatree") <<
" No rec::TrackTrajectory branch." 1903 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1910 art::FindManyP<rec::Track, rec::TrackEnd>* findManyTrackEnd = NULL;
1912 VertexHandle = e.getHandle< std::vector<rec::Vertex> >(
fVertexLabel);
1913 if (!VertexHandle) {
1915 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1917 findManyTrackEnd =
new art::FindManyP<rec::Track, rec::TrackEnd>(VertexHandle,
e,
fVertexLabel);
1922 art::FindManyP<rec::Track, rec::TrackEnd>* findManyVeeTrackEnd = NULL;
1924 VeeHandle = e.getHandle< std::vector<rec::Vee> >(
fVeeLabel);
1927 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1929 findManyVeeTrackEnd =
new art::FindManyP<rec::Track, rec::TrackEnd>(VeeHandle,
e,
fVeeLabel);
1937 art::FindManyP<rec::Track, rec::TrackEnd>* findManyCALTrackEnd = NULL;
1938 art::FindManyP<gar::rec::CaloHit>* findManyClusterRecoHit = NULL;
1939 art::FindManyP<gar::rec::CaloHit>* findManyClusterMuIDHit = NULL;
1942 RecoClusterHandle = e.getHandle< std::vector<rec::Cluster> >(ecalclustertag);
1943 if (!RecoClusterHandle) {
1945 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1950 RecoClusterMuIDHandle = e.getHandle< std::vector<rec::Cluster> >(muidclustertag);
1951 if (!RecoClusterMuIDHandle) {
1952 throw cet::exception(
"anatree") <<
" No rec::Cluster (MuID) branch." 1953 <<
" Line " << __LINE__ <<
" in file " << __FILE__ <<
std::endl;
1958 findManyClusterRecoHit =
new art::FindManyP<gar::rec::CaloHit>(RecoClusterHandle,
e,ecalclustertag);
1961 findManyClusterMuIDHit =
new art::FindManyP<gar::rec::CaloHit>(RecoClusterMuIDHandle,e,muidclustertag);
1965 findManyCALTrackEnd =
new art::FindManyP<rec::Track, rec::TrackEnd>(RecoClusterHandle,
e,
fECALAssnLabel);
1973 size_t iTPCCluster = 0;
1974 for (
auto const& TPCCluster : (*TPCClusterHandle) ) {
1981 cov = TPCCluster.CovMatPacked();
1990 int indexToPush = -1;
float valueToPush = 0;
1991 if ( findManyHits->isValid() ) {
1992 std::map<int,float> sumEforTrkID;
1993 float eTotCluster = 0;
1994 auto const& hitsInTPCCluster = findManyHits->at(iTPCCluster);
1995 for (
size_t iHits = 0; iHits<hitsInTPCCluster.size(); ++iHits) {
1997 for (
size_t iIDE = 0; iIDE<IDEs.size(); ++iIDE) {
1998 int trackID = IDEs[iIDE].trackID;
1999 float thisEdepE = IDEs[iIDE].energyTot;
2000 if ( sumEforTrkID.find(trackID) == sumEforTrkID.end() ) {
2001 sumEforTrkID[trackID] = 0;
2003 sumEforTrkID[trackID] += thisEdepE;
2004 eTotCluster += thisEdepE;
2007 if (sumEforTrkID.size()!=0) {
2009 typedef std::function<bool(std::pair<int,float>, std::pair<int,float>)> Comparator;
2011 std::set<std::pair<int,float>, Comparator> setOfTrkIDs(
2012 sumEforTrkID.begin(), sumEforTrkID.end(),
2013 [](std::pair<int,float>
a ,std::pair<int,float>
b) {
2014 return a.second >
b.second;
2017 auto iReturnSet = setOfTrkIDs.begin();
2019 valueToPush = iReturnSet->second/eTotCluster;
2025 Int_t trackForThisTPCluster = -1;
2028 for (
auto const& track : (*TrackHandle) ) {
2029 for (
size_t iCluster=0; iCluster<track.NHits(); iCluster++) {
2030 auto const& trackedCluster =
2031 *(findManyTPCClusters->at(iTrack).at(iCluster));
2032 if (TPCCluster==trackedCluster) {
2033 trackForThisTPCluster = track.getIDNumber();
2050 for (
auto const& track : (*TrackHandle) ) {
2057 fTrackStartPX.push_back(track.Momentum_beg()*track.VtxDir()[0]);
2058 fTrackStartPY.push_back(track.Momentum_beg()*track.VtxDir()[1]);
2059 fTrackStartPZ.push_back(track.Momentum_beg()*track.VtxDir()[2]);
2065 fTrackEndPX.push_back(track.Momentum_end()*track.EndDir()[0]);
2066 fTrackEndPY.push_back(track.Momentum_end()*track.EndDir()[1]);
2067 fTrackEndPZ.push_back(track.Momentum_end()*track.EndDir()[2]);
2071 fTrackLenB.push_back(track.LengthBackward());
2077 TVector3 momF(track.Momentum_beg()*track.VtxDir()[0], track.Momentum_beg()*track.VtxDir()[1], track.Momentum_beg()*track.VtxDir()[2]);
2078 TVector3 momB(track.Momentum_end()*track.EndDir()[0], track.Momentum_end()*track.EndDir()[1], track.Momentum_end()*track.EndDir()[2]);
2081 float pF = momF.Mag();
2082 float pB = momB.Mag();
2083 std::vector< std::pair<int, float> > pidF =
processPIDInfo( pF );
2084 std::vector< std::pair<int, float> > pidB =
processPIDInfo( pB );
2087 for(
size_t ipid = 0; ipid < pidF.size(); ipid++) {
2091 for(
size_t ipid = 0; ipid < pidB.size(); ipid++) {
2097 std::vector<std::pair<simb::MCParticle*,float>> trakt;
2110 if (findIonization->isValid()) {
2112 rec::TrackIoniz ionization = *(findIonization->at(iTrack));
2113 float avgIonF, avgIonB;
2128 size_t iTrackTraj = 0;
2129 for (
auto const& tracktraj : (*TrackTrajHandle) ) {
2131 std::vector<TVector3>
temp = tracktraj.getFWDTrajectory();
2132 for(
size_t i = 0; i < temp.size(); i++) {
2139 temp = tracktraj.getBAKTrajectory();
2140 for(
size_t i = 0; i < temp.size(); i++) {
2153 for (
auto const&
vertex : (*VertexHandle) ) {
2160 int nVertexedTracks = 0;
2161 if ( findManyTrackEnd->isValid() ) {
2162 nVertexedTracks = findManyTrackEnd->at(iVertex).size();
2164 fVertexN.push_back(nVertexedTracks);
2166 int vertexCharge = 0;
2167 for (
int iVertexedTrack=0; iVertexedTrack<nVertexedTracks; ++iVertexedTrack) {
2171 rec::Track track = *(findManyTrackEnd->at(iVertex).at(iVertexedTrack));
2179 rec::TrackEnd fee = *(findManyTrackEnd->data(iVertex).at(iVertexedTrack));
2184 vertexCharge += track.ChargeBeg();
2186 vertexCharge += track.ChargeEnd();
2197 for (
auto const& vee : (*VeeHandle) ) {
2199 fVeeX.push_back(vee.Position()[0]);
2200 fVeeY.push_back(vee.Position()[1]);
2201 fVeeZ.push_back(vee.Position()[2]);
2202 fVeeT.push_back(vee.Time());
2206 fVeeEKpipi.push_back(vee.FourMomentum(0).E());
2207 fVeeMKpipi.push_back(vee.FourMomentum(0).M());
2208 fVeePXLppi.push_back(vee.FourMomentum(1).X());
2209 fVeePYLppi.push_back(vee.FourMomentum(1).Y());
2210 fVeePZLppi.push_back(vee.FourMomentum(1).Z());
2211 fVeeELppi.push_back(vee.FourMomentum(1).E());
2212 fVeeMLppi.push_back(vee.FourMomentum(1).M());
2213 fVeePXLpip.push_back(vee.FourMomentum(2).X());
2214 fVeePYLpip.push_back(vee.FourMomentum(2).Y());
2215 fVeePZLpip.push_back(vee.FourMomentum(2).Z());
2216 fVeeELpip.push_back(vee.FourMomentum(2).E());
2217 fVeeMLpip.push_back(vee.FourMomentum(2).M());
2220 if ( findManyVeeTrackEnd->isValid() ) {
2221 nVeeTracks = findManyVeeTrackEnd->at(iVee).size();
2224 for (
int iVeeTrack=0; iVeeTrack<nVeeTracks; ++iVeeTrack) {
2228 rec::Track track = *(findManyVeeTrackEnd->at(iVee).at(iVeeTrack));
2231 rec::TrackEnd fee = *(findManyVeeTrackEnd->data(iVee).at(iVeeTrack));
2241 size_t iCluster = 0;
2242 for (
auto const&
cluster : (*RecoClusterHandle) ) {
2261 std::vector<ULong64_t> fVecHitIDs = {};
2262 if (findManyClusterRecoHit->isValid()) {
2263 int nClusterHit = findManyClusterRecoHit->at(iCluster).size();
2264 for (
int iClusterHit=0; iClusterHit<nClusterHit; ++iClusterHit) {
2265 rec::CaloHit
hit = *(findManyClusterRecoHit->at(iCluster).at(iClusterHit));
2266 fVecHitIDs.push_back(hit.getIDNumber());
2273 std::vector<std::pair<simb::MCParticle*,float>> trakt;
2289 size_t iCluster_local = 0;
2290 for (
auto const&
cluster : (*RecoClusterMuIDHandle) ) {
2309 std::vector<ULong64_t> fVecHitIDs = {};
2310 if (findManyClusterMuIDHit->isValid()) {
2311 int nClusterHit = findManyClusterMuIDHit->at(iCluster_local).size();
2312 for (
int iClusterHit=0; iClusterHit<nClusterHit; ++iClusterHit) {
2313 rec::CaloHit hit = *(findManyClusterMuIDHit->at(iCluster_local).at(iClusterHit));
2314 fVecHitIDs.push_back(hit.getIDNumber());
2343 size_t iCluster = 0;
2344 for (
auto const&
cluster : (*RecoClusterHandle) ) {
2345 int nCALedTracks(0);
2346 if ( findManyCALTrackEnd->isValid() ) {
2347 nCALedTracks = findManyCALTrackEnd->at(iCluster).size();
2349 for (
int iCALedTrack=0; iCALedTrack<nCALedTracks; ++iCALedTrack) {
2351 rec::Track track = *(findManyCALTrackEnd->at(iCluster).at(iCALedTrack));
2354 rec::TrackEnd fee = *(findManyCALTrackEnd->data(iCluster).at(iCALedTrack));
std::vector< Float_t > fVeeY
float fIonizTruncate
Default=1.00;.
std::vector< Float_t > fClusterPhi
std::vector< Float_t > fVertexY
std::vector< Float_t > fTrackChi2F
std::vector< ULong64_t > fVTAssn_TrackIDNumber
std::vector< std::pair< int, float > > processPIDInfo(float p)
bool fWriteTPCClusters
Write TPCClusters info Default=true.
std::vector< Float_t > fClusterZ
std::vector< Float_t > fTrackLenB
bool fWriteVees
Reco vees & their tracks Default=true.
std::vector< Float_t > fClusterX
std::vector< Float_t > fVeePXLpip
std::vector< ULong64_t > fVeeIDNumber
std::vector< Float_t > fClusterY_MuID
std::vector< Float_t > fTrackEndX
std::vector< Float_t > fTPCClusterCovYZ
std::vector< Int_t > fTPCClusterMCindex
std::string fTPCClusterLabel
module label for TPC Clusters rec::TPCCluster
bool fWriteTrackTrajectories
Point traj of reco tracks Default=false.
bool fWriteVertices
Reco vertexes & their tracks Default=true.
std::vector< Float_t > fTrackEndPZ
std::vector< std::vector< ULong64_t > > fClusterMuIDAssn_MuIDHitIDNumber
std::vector< ULong64_t > fVeeTAssn_VeeIDNumber
std::vector< Float_t > fClusterTheta
std::vector< gar::rec::TrackEnd > fVeeTAssn_TrackEnd
std::vector< UInt_t > fClusterNhits_MuID
std::vector< Float_t > fClusterZ_MuID
const geo::GeometryCore * fGeo
pointer to the geometry
std::vector< Float_t > fClusterTimeDiffFirstLast
std::vector< Float_t > fTrackTrajectoryFWDZ
std::vector< Float_t > fVertexX
std::vector< Float_t > fVeePZLppi
std::vector< Float_t > fTrackStartPZ
std::vector< Float_t > fTPCClusterY
std::vector< Int_t > fNTPCClustersOnTrack
std::string fTrackTrajectoryLabel
module label for TPC Track Trajectories rec:TrackTrajectory
std::vector< Float_t > fVeePZKpipi
Cluster finding and building.
std::vector< Int_t > fVertexN
std::vector< Float_t > fClusterPhi_MuID
std::vector< Float_t > fTrackTrajectoryBWDZ
std::vector< ULong64_t > fTPCClusterTrkIDNumber
std::vector< Float_t > fTrackEndPY
std::vector< Float_t > fVertexZ
std::vector< Int_t > fClusterMCindex_MuID
std::vector< Float_t > fClusterMainAxisZ_MuID
std::string fClusterLabel
module label for calo clusters rec::Cluster
std::vector< Float_t > fVeeMLppi
std::vector< Float_t > fTrackEndY
std::vector< Float_t > fTPCClusterSig
std::vector< Float_t > fVeePXLppi
std::vector< Float_t > fTrackPIDProbF
std::vector< ULong64_t > fTrackIDNumber
std::vector< Float_t > fTrackStartX
std::vector< Int_t > fTrackMCindex
std::vector< Int_t > fTrackTrajectoryFWDID
std::vector< std::pair< simb::MCParticle *, float > > ClusterToMCParticles(rec::Cluster *const c)
std::vector< Float_t > fVeeELpip
std::vector< Float_t > fTrackEndZ
std::vector< ULong64_t > fVeeTAssn_TrackIDNumber
std::vector< Float_t > fTrackEndPX
std::vector< Float_t > fTrackAvgIonF
std::vector< Float_t > fVeePYLppi
std::vector< Float_t > fVeePYLpip
std::vector< Float_t > fTrackTrajectoryBWDX
std::vector< Float_t > fTPCClusterCovXZ
std::vector< Float_t > fClusterPID_MuID
std::vector< Float_t > fClusterEnergy_MuID
std::string fVeeLabel
module label for conversion/decay vertexes rec:Vee
std::vector< Int_t > fClusterMCindex
std::vector< Float_t > fTrackAvgIonB
std::vector< ULong64_t > fCALAssn_TrackIDNumber
std::vector< ULong64_t > fClusterIDNumber_MuID
std::vector< ULong64_t > fClusterIDNumber
std::vector< Float_t > fClusterTime_MuID
std::vector< std::vector< ULong64_t > > fClusterAssn_RecoHitIDNumber
std::vector< HitIDE > HitToHitIDEs(art::Ptr< rec::Hit > const &hit) const
std::vector< Float_t > fTrackStartY
std::vector< Float_t > fClusterMCfrac_MuID
std::vector< Float_t > fTPCClusterX
std::vector< Float_t > fClusterTimeDiffFirstLast_MuID
Detector simulation of raw signals on wires.
std::string fClusterMuIDLabel
module label for calo clusters rec::Cluster in MuID
std::vector< Float_t > fTrackTrajectoryFWDY
std::vector< ULong64_t > fVeeT
std::vector< Float_t > fVeePYKpipi
std::vector< ULong64_t > fVertexIDNumber
std::vector< Int_t > fTrackEndQ
std::vector< Float_t > fVeeMKpipi
std::vector< gar::rec::TrackEnd > fVTAssn_TrackEnd
std::vector< ULong64_t > fVTAssn_VertIDNumber
std::vector< Float_t > fVeeEKpipi
TrackEnd const TrackEndBeg
std::vector< Float_t > fClusterMainAxisZ
std::vector< Float_t > fClusterMCfrac
std::string fECALAssnLabel
module label for track-clusters associations
cheat::BackTrackerCore * BackTrack
std::vector< Float_t > fTPCClusterCovYY
std::vector< ULong64_t > fVertexT
std::vector< Float_t > fClusterEnergy
std::vector< Float_t > fVeeELppi
std::vector< Int_t > fTrackPIDB
std::vector< Float_t > fTrackStartPY
std::vector< Float_t > fClusterTime
std::vector< std::pair< simb::MCParticle *, float > > TrackToMCParticles(rec::Track *const t)
std::vector< Float_t > fTPCClusterCovZZ
std::vector< Float_t > fTrackPIDProbB
bool HasMuonDetector() const
std::vector< Float_t > fClusterMainAxisY
std::vector< Float_t > fClusterPID
std::vector< Float_t > fTPCClusterMCfrac
std::vector< Float_t > fTPCClusterRMS
std::vector< Float_t > fVeeX
std::vector< Float_t > fVeePXKpipi
bool fWriteTracks
Start/end X, P for tracks Default=true.
std::vector< Float_t > fVeeZ
std::unordered_map< TrkId, Int_t > TrackIdToIndex
std::string fInstanceLabelCalo
Instance name for ECAL.
std::vector< Float_t > fTrackChi2B
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
bool fWriteMatchedTracks
Write ECAL-track Assns Default=true.
std::vector< Float_t > fClusterMainAxisY_MuID
std::vector< gar::rec::TrackEnd > fCALAssn_TrackEnd
std::vector< Float_t > fTPCClusterCovXY
std::vector< Float_t > fTrackStartZ
std::vector< Int_t > fTrackStartQ
std::vector< Float_t > fTrackMCfrac
std::vector< Float_t > fTrackTrajectoryBWDY
second_as<> second
Type of time stored in seconds, in double precision.
std::vector< Float_t > fVeePZLpip
std::vector< Float_t > fTrackTrajectoryFWDX
std::vector< Int_t > fTrackPIDF
std::vector< Float_t > fTrackStartPX
std::string fTrackLabel
module label for TPC Tracks rec:Track
std::vector< Float_t > fClusterX_MuID
std::string fVertexLabel
module label for vertexes rec:Vertex
std::string fInstanceLabelMuID
Instance name for MuID.
std::vector< ULong64_t > fCALAssn_ClusIDNumber
void processIonizationInfo(rec::TrackIoniz &ion, float ionizeTruncate, float &forwardIonVal, float &backwardIonVal)
std::vector< Float_t > fTPCClusterZ
bool fWriteCaloClusters
Write ECAL clusters. Default=true.
std::vector< Int_t > fVertexQ
std::vector< Float_t > fClusterMainAxisX
std::vector< Int_t > fTrackTrajectoryBWDID
std::vector< Float_t > fTPCClusterCovXX
std::vector< Float_t > fClusterMainAxisX_MuID
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< UInt_t > fClusterNhits
std::vector< Float_t > fTrackLenF
std::vector< Float_t > fVeeMLpip
std::vector< Float_t > fClusterTheta_MuID
std::vector< Float_t > fClusterY