Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
skim::NumuCCpiSkimmer Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-17/AnalysisSkimmer/skimmers/NumuCCpiSkimmer.h"

Inheritance diagram for skim::NumuCCpiSkimmer:
skim::BaseSkimmer

Public Member Functions

 NumuCCpiSkimmer (fhicl::ParameterSet const &p)
 
void reconfigure (fhicl::ParameterSet const &p)
 
void Skim (art::Event &e, art::EDProducer const &prod)
 
std::string const & InstanceLabel ()
 

Protected Attributes

std::string fCellHitSkimLabel
 label of module creating slices More...
 
std::string fInstanceLabel
 instance label for products created by this skimmer More...
 
art::InputTag fInputTag
 combination of the above two strings More...
 

Private Member Functions

template<class T >
void CopyTrackAssn (art::Event &e, art::EDProducer const &prod, std::vector< art::Ptr< rb::Track > > const &trackIn, std::vector< T > &tOut, std::vector< rb::Track > &trackOut, art::Assns< rb::Track, T > &trkTAssn, std::string const &modLabel)
 

Private Attributes

std::string fVertexLabel
 label of module creating vertex More...
 
std::string fShowerLabel
 label of module creating showers More...
 
std::string fEnergyLabel
 label of module creating energy objects More...
 
std::string fTrackLabel
 label of module creating tracks More...
 
std::string fCosRejLabel
 label of module creating CosRej More...
 
std::string fNumuSandLabel
 label of module creating NumuSand More...
 
std::string fVetoLabel
 label of module creating vetos More...
 
std::string fQePIdLabel
 label of module creating QePIds More...
 
std::string fReMIdLabel
 label of module creating ReMIds More...
 
std::string fNumuELabel
 label of module creating NumuEs More...
 
std::string fMichelELabel
 label of module creating MichelEClusters More...
 
std::string fCAFLabel
 label of module creating StandardRecords More...
 
std::string fGeneratorLabel
 label of module creating MC events More...
 
std::string fFluxWeightLabel
 label of module creating MC events More...
 

Detailed Description

Definition at line 28 of file NumuCCpiSkimmer.h.

Constructor & Destructor Documentation

skim::NumuCCpiSkimmer::NumuCCpiSkimmer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 30 of file NumuCCpiSkimmer.cxx.

References reconfigure().

32 {
33  this->reconfigure(p);
34 
35  return;
36 }
const char * p
Definition: xmltok.h:285
void reconfigure(fhicl::ParameterSet const &p)
BaseSkimmer(fhicl::ParameterSet const &p)
Definition: BaseSkimmer.cxx:10

Member Function Documentation

template<class T >
void skim::NumuCCpiSkimmer::CopyTrackAssn ( art::Event e,
art::EDProducer const &  prod,
std::vector< art::Ptr< rb::Track > > const &  trackIn,
std::vector< T > &  tOut,
std::vector< rb::Track > &  trackOut,
art::Assns< rb::Track, T > &  trkTAssn,
std::string const &  modLabel 
)
private

Definition at line 236 of file NumuCCpiSkimmer.cxx.

References util::CreateAssn(), skim::BaseSkimmer::fInstanceLabel, art::Assns< L, R, D >::size(), and confusionMatrixTree::t.

Referenced by Skim().

243 {
244  // this method requires the trackOut collection to have already been filled. All
245  // tracks from the slice are assumed to be copied into the skimmed slice and in the
246  // same order as the tracks from the original slice (ie trackIn)
247  // trackOut could be larger than track in, if we are in the ND so only look at the
248  // last trackIn.size() entries in trackOut
249 
250  // do a FindOne for the track to T connection. Copy the found T
251  // into the output vector, then make the associations
252  art::FindOne<T> fot(trackIn, e, modLabel);
253  for(size_t ti = 0; ti < trackIn.size(); ++ti){
254  cet::maybe_ref<T const> t(fot.at(ti));
255  if( t.isValid() ){
256  tOut.push_back( t.ref() );
258  e,
259  trackOut,
260  tOut,
261  trkTAssn,
262  tOut.size()-1,
263  tOut.size(),
264  trackOut.size() - trackIn.size() + ti,
267  }
268  }
269 
270  return;
271 }
size_type size() const
Definition: Assns.h:440
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
T prod(const std::vector< T > &v)
Definition: prod.hpp:17
std::string fInstanceLabel
instance label for products created by this skimmer
Definition: BaseSkimmer.h:44
std::string const & skim::BaseSkimmer::InstanceLabel ( )
inlineinherited

Definition at line 48 of file BaseSkimmer.h.

References skim::BaseSkimmer::fInstanceLabel.

48 { return fInstanceLabel; }
std::string fInstanceLabel
instance label for products created by this skimmer
Definition: BaseSkimmer.h:44
void skim::NumuCCpiSkimmer::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Implements skim::BaseSkimmer.

Definition at line 276 of file NumuCCpiSkimmer.cxx.

References fCAFLabel, fCosRejLabel, fEnergyLabel, fFluxWeightLabel, fGeneratorLabel, fMichelELabel, fNumuELabel, fNumuSandLabel, fQePIdLabel, fReMIdLabel, fShowerLabel, fTrackLabel, fVertexLabel, fVetoLabel, and fhicl::ParameterSet::get().

Referenced by NumuCCpiSkimmer().

277 {
278  fVertexLabel = p.get<std::string>("VertexLabel", "elasticarmshs" );
279  fShowerLabel = p.get<std::string>("ShowerLabel", "recluster" );
280  fTrackLabel = p.get<std::string>("TrackLabel", "kalmantrackmerge" );
281  fCosRejLabel = p.get<std::string>("CosRejLabel", "cosrej" );
282  fNumuSandLabel = p.get<std::string>("NumuSandLabel", "numusand" );
283  fVetoLabel = p.get<std::string>("VetoLabel", "veto" );
284  fQePIdLabel = p.get<std::string>("QePIdLabel", "qepid" );
285  fReMIdLabel = p.get<std::string>("ReMIdLabel", "remid" );
286  fMichelELabel = p.get<std::string>("MichelELabel", "michelekalmantrack");
287  fNumuELabel = p.get<std::string>("NumuELabel", "numue" );
288  fEnergyLabel = p.get<std::string>("EnergyLabel", "numue" );
289  fCAFLabel = p.get<std::string>("CAFLabel", "cafmaker" );
290  fGeneratorLabel = p.get<std::string>("GeneratorLabel", "generator" );
291  fFluxWeightLabel = p.get<std::string>("FluxWeightLabel", "ppfxcorrection" );
292 
293  return;
294 }
std::string fVetoLabel
label of module creating vetos
std::string fTrackLabel
label of module creating tracks
const char * p
Definition: xmltok.h:285
std::string fEnergyLabel
label of module creating energy objects
std::string fNumuSandLabel
label of module creating NumuSand
std::string fNumuELabel
label of module creating NumuEs
std::string fMichelELabel
label of module creating MichelEClusters
std::string fFluxWeightLabel
label of module creating MC events
std::string fCosRejLabel
label of module creating CosRej
std::string fCAFLabel
label of module creating StandardRecords
std::string fShowerLabel
label of module creating showers
std::string fReMIdLabel
label of module creating ReMIds
std::string fVertexLabel
label of module creating vertex
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::string fGeneratorLabel
label of module creating MC events
std::string fQePIdLabel
label of module creating QePIds
void skim::NumuCCpiSkimmer::Skim ( art::Event e,
art::EDProducer const &  prod 
)
virtual

Implements skim::BaseSkimmer.

Definition at line 39 of file NumuCCpiSkimmer.cxx.

References skim::SkimmingUtils::CopyProductAndSliceAssn(), skim::SkimmingUtils::CopySlice(), CopyTrackAssn(), skim::SkimmingUtils::CopyTracks(), art::Handle< T >::failedToGet(), fCosRejLabel, fEnergyLabel, fFluxWeightLabel, fGeneratorLabel, skim::BaseSkimmer::fInputTag, skim::BaseSkimmer::fInstanceLabel, PandAna.Demos.pi0_spectra::fmt, fNumuELabel, fNumuSandLabel, fQePIdLabel, fReMIdLabel, fShowerLabel, fTrackLabel, fVertexLabel, fVetoLabel, art::FindManyP< ProdB, Data >::get(), art::DataViewImpl::getByLabel(), art::DataViewImpl::getValidHandle(), art::Event::isRealData(), LOG_DEBUG, LOG_VERBATIM, art::Event::put(), art::PtrVector< T >::size(), and skim::SkimmingUtils::SliceMCTruthAssociation().

Referenced by skim::NumuCCpiSkim::produce().

41 {
42  // get the CellHits made in the previous module
44  e.getByLabel(fInputTag, cellHits);
45 
46  if(cellHits.failedToGet() ){
47  LOG_VERBATIM("NumuSkimmer")
48  << "There are no numu CellHits for this event, don't try to skim anything.";
49  return;
50  }
51 
52  // if we are in this module, then this event has interesting slices.
53  // to facilitate making copies of the rb::XXX objects we want, make
54  // a map of the cell unique id values to the art::Ptr of the copy
55  // from the previous module
56  skim::SkimmingUtils su(cellHits, fInstanceLabel);
57 
58  // get the slices out of the event
59  auto sliceHandle = e.getValidHandle< art::PtrVector<rb::Cluster> >(fInputTag);
60  art::PtrVector<rb::Cluster> slices = *sliceHandle;
61 
62  LOG_DEBUG("NumuCCpiSkimmer") << "there are " << slices.size() << " slices in this event";
63  //std::cout << "Inside NumuCCpiSkimmer on behalf of numuccpi skim" << std::endl;
64  // now we are sure we have all the data products we need, declare the items to store in the event
65  // As long as we do a drop on output we will keep all the necessary provanence information on how
66  // each item was created. The information is left in the configuration DB intact, and we know what
67  // modules created which input data product by the module label configurations for this module.
68  std::unique_ptr< std::vector<rb::Energy> > energyOut (new std::vector<rb::Energy> );
69  std::unique_ptr< std::vector<rb::Cluster> > sliceOut (new std::vector<rb::Cluster> );
70  //std::unique_ptr< std::vector<rb::Shower> > showerOut (new std::vector<rb::Shower> );
71  //std::unique_ptr< std::vector<rb::Vertex> > vertexOut (new std::vector<rb::Vertex> );
72  std::unique_ptr< std::vector<rb::Track> > trackOut (new std::vector<rb::Track> );
73  std::unique_ptr< std::vector<cosrej::CosRejObj> > cosRejOut (new std::vector<cosrej::CosRejObj> );
74  std::unique_ptr< std::vector<numusand::NumuSandObj> > sandOut (new std::vector<numusand::NumuSandObj> );
75  std::unique_ptr< std::vector<presel::Veto> > vetoOut (new std::vector<presel::Veto> );
76  std::unique_ptr< std::vector<qeef::QePId> > qepidOut (new std::vector<qeef::QePId> );
77  std::unique_ptr< std::vector<remid::ReMId> > remidOut (new std::vector<remid::ReMId> );
78  std::unique_ptr< std::vector<numue::NumuE> > numuEOut (new std::vector<numue::NumuE> );
79  //std::unique_ptr< std::vector<me::MichelECluster> > michelEOut(new std::vector<me::MichelECluster> );
80  //std::unique_ptr< art::Assns<rb::Cluster, rb::Shower> > slcShwAssn(new art::Assns<rb::Cluster, rb::Shower> );
81  //std::unique_ptr< art::Assns<rb::Cluster, rb::Vertex> > slcVtxAssn(new art::Assns<rb::Cluster, rb::Vertex> );
82  std::unique_ptr< art::Assns<rb::Cluster, rb::Track> > slcTrkAssn(new art::Assns<rb::Cluster, rb::Track> );
83  std::unique_ptr< art::Assns<rb::Cluster, cosrej::CosRejObj> > slcCROAssn(new art::Assns<rb::Cluster, cosrej::CosRejObj> );
84  std::unique_ptr< art::Assns<rb::Cluster, numusand::NumuSandObj> > slcNSOAssn(new art::Assns<rb::Cluster, numusand::NumuSandObj>);
85  std::unique_ptr< art::Assns<rb::Cluster, presel::Veto> > slcVetAssn(new art::Assns<rb::Cluster, presel::Veto> );
86  std::unique_ptr< art::Assns<rb::Cluster, qeef::QePId> > slcQEPAssn(new art::Assns<rb::Cluster, qeef::QePId> );
87  std::unique_ptr< art::Assns<rb::Cluster, numue::NumuE> > slcNMEAssn(new art::Assns<rb::Cluster, numue::NumuE> );
88  //std::unique_ptr< art::Assns<rb::Cluster, me::MichelECluster> > slcMECAssn(new art::Assns<rb::Cluster, me::MichelECluster> );
89  //std::unique_ptr< art::Assns<rb::Track, me::MichelECluster> > trkMECAssn(new art::Assns<rb::Track, me::MichelECluster> );
90  std::unique_ptr< art::Assns<rb::Track, remid::ReMId> > trkREMAssn(new art::Assns<rb::Track, remid::ReMId> );
91  std::unique_ptr< art::Assns<rb::Track, rb::Energy> > trkEngAssn(new art::Assns<rb::Track, rb::Energy> );
92  std::unique_ptr< art::Assns<rb::Cluster, simb::MCTruth> > slcTruAssn(new art::Assns<rb::Cluster, simb::MCTruth> );
93  std::unique_ptr< art::Assns<rb::Cluster, simb::MCFlux> > slcFlxAssn(new art::Assns<rb::Cluster, simb::MCFlux> );
94  std::unique_ptr< art::Assns<rb::Cluster, fxwgt::FluxWeights> > slcFlxWgtAssn(new art::Assns<rb::Cluster, fxwgt::FluxWeights> );
95  std::unique_ptr< art::Assns<rb::Cluster, simb::GTruth> > slcGTruAssn(new art::Assns<rb::Cluster, simb::GTruth> );
96 
97  // get the FindMany for the slices to shower association.
98  art::FindManyP<rb::Shower> fms (slices, e, fShowerLabel );
99  art::FindManyP<rb::Vertex> fmvx(slices, e, fVertexLabel );
103  art::FindManyP<presel::Veto> fmv (slices, e, fVetoLabel );
104  art::FindManyP<qeef::QePId> fmqe(slices, e, fQePIdLabel );
105  art::FindManyP<numue::NumuE> fme (slices, e, fNumuELabel );
106 
107  //std::cout << "slices.size() in NumuCCpiSkimmer : " << slices.size() << std::endl;
108  for(size_t s = 0; s < slices.size(); ++s){
109 
110  //std::cout << "loop over available slices and fill new file." << std::endl;
111  // vector of art::Ptrs for the FindManyP calls
112  std::vector< art::Ptr<rb::Track> > tracks;
113  std::vector< art::Ptr<cosrej::CosRejObj> > cosrejs;
114  std::vector< art::Ptr<numusand::NumuSandObj> > sands;
115  std::vector< art::Ptr<presel::Veto> > vetos;
116  std::vector< art::Ptr<qeef::QePId> > qepids;
117  std::vector< art::Ptr<numue::NumuE> > numues;
118 
119  fmt .get(s, tracks);
120  fmcr.get(s, cosrejs);
121  fmns.get(s, sands);
122  fmv .get(s, vetos);
123  fmqe.get(s, qepids);
124  fme .get(s, numues);
125 
126  // create the new copies of the desired data products
127  su.CopySlice(slices[s], *sliceOut, s);
128  su.CopyTracks(prod, e, tracks, *trackOut, *sliceOut, *slcTrkAssn);
129  su.CopyProductAndSliceAssn(prod, e, cosrejs, *cosRejOut, *sliceOut, *slcCROAssn);
130  su.CopyProductAndSliceAssn(prod, e, sands, *sandOut, *sliceOut, *slcNSOAssn);
131  su.CopyProductAndSliceAssn(prod, e, vetos, *vetoOut, *sliceOut, *slcVetAssn);
132  su.CopyProductAndSliceAssn(prod, e, qepids, *qepidOut, *sliceOut, *slcQEPAssn);
133  su.CopyProductAndSliceAssn(prod, e, numues, *numuEOut, *sliceOut, *slcNMEAssn);
134  //this->CopyMichelEClusters(e, prod, tracks, *michelEOut, *sliceOut, *trackOut, *slcMECAssn, *trkMECAssn);
135  this->CopyTrackAssn(e, prod, tracks, *remidOut, *trackOut, *trkREMAssn, fReMIdLabel);
136  this->CopyTrackAssn(e, prod, tracks, *energyOut, *trackOut, *trkEngAssn, fEnergyLabel);
137 
138  // apparently we can't count on a vertex object being present in the
139  // reconstruction. As no cuts depend on them, just remove them for now
140 // std::vector< art::Ptr<rb::Vertex> > vertices;
141 // fmvx.get(s, vertices);
142 // su.CopyVertex(prod, e, vertices[0], *vertexOut, *sliceOut, *slcVtxAssn);
143 
144 
145  // finally check to see if this is MC, and if so make the association to MCTruth
146  if( !e.isRealData() )
147  su.SliceMCTruthAssociation(prod,
148  e,
149  s,
150  *sliceOut,
151  *slcTruAssn,
152  *slcFlxAssn,
153  *slcFlxWgtAssn,
154  *slcGTruAssn,
157 
158  } // end loop over the slices
159 
160  e.put(std::move(sliceOut), fInstanceLabel);
161  e.put(std::move(energyOut), fInstanceLabel);
162  //e.put(std::move(showerOut), fInstanceLabel);
163  //e.put(std::move(vertexOut), fInstanceLabel);
164  e.put(std::move(trackOut), fInstanceLabel);
165  e.put(std::move(cosRejOut), fInstanceLabel);
166  e.put(std::move(sandOut), fInstanceLabel);
167  e.put(std::move(vetoOut), fInstanceLabel);
168  e.put(std::move(qepidOut), fInstanceLabel);
169  e.put(std::move(remidOut), fInstanceLabel);
170  e.put(std::move(numuEOut), fInstanceLabel);
171  //e.put(std::move(michelEOut));
172  e.put(std::move(slcTrkAssn), fInstanceLabel);
173  //e.put(std::move(slcShwAssn), fInstanceLabel);
174  //e.put(std::move(slcVtxAssn), fInstanceLabel);
175  e.put(std::move(slcCROAssn), fInstanceLabel);
176  e.put(std::move(slcNSOAssn), fInstanceLabel);
177  e.put(std::move(slcVetAssn), fInstanceLabel);
178  e.put(std::move(slcQEPAssn), fInstanceLabel);
179  e.put(std::move(slcNMEAssn), fInstanceLabel);
180  //e.put(std::move(slcMECAssn));
181  //e.put(std::move(trkMECAssn));
182  e.put(std::move(trkREMAssn), fInstanceLabel);
183  e.put(std::move(trkEngAssn), fInstanceLabel);
184  e.put(std::move(slcTruAssn), fInstanceLabel);
185  e.put(std::move(slcFlxAssn), fInstanceLabel);
186  e.put(std::move(slcFlxWgtAssn), fInstanceLabel);
187 
188 
189  return;
190 
191 }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::string fVetoLabel
label of module creating vetos
std::string fTrackLabel
label of module creating tracks
std::string fEnergyLabel
label of module creating energy objects
bool isRealData() const
Definition: Event.h:83
std::string fNumuSandLabel
label of module creating NumuSand
art::InputTag fInputTag
combination of the above two strings
Definition: BaseSkimmer.h:45
std::string fNumuELabel
label of module creating NumuEs
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
const XML_Char * s
Definition: expat.h:262
std::string fFluxWeightLabel
label of module creating MC events
std::string fCosRejLabel
label of module creating CosRej
std::string fShowerLabel
label of module creating showers
T prod(const std::vector< T > &v)
Definition: prod.hpp:17
size_type size() const
Definition: PtrVector.h:308
std::string fReMIdLabel
label of module creating ReMIds
std::string fVertexLabel
label of module creating vertex
std::string fGeneratorLabel
label of module creating MC events
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void CopyTrackAssn(art::Event &e, art::EDProducer const &prod, std::vector< art::Ptr< rb::Track > > const &trackIn, std::vector< T > &tOut, std::vector< rb::Track > &trackOut, art::Assns< rb::Track, T > &trkTAssn, std::string const &modLabel)
std::string fQePIdLabel
label of module creating QePIds
std::string fInstanceLabel
instance label for products created by this skimmer
Definition: BaseSkimmer.h:44
#define LOG_VERBATIM(category)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool failedToGet() const
Definition: Handle.h:196

Member Data Documentation

std::string skim::NumuCCpiSkimmer::fCAFLabel
private

label of module creating StandardRecords

Definition at line 69 of file NumuCCpiSkimmer.h.

Referenced by reconfigure().

std::string skim::BaseSkimmer::fCellHitSkimLabel
protectedinherited

label of module creating slices

Definition at line 43 of file BaseSkimmer.h.

std::string skim::NumuCCpiSkimmer::fCosRejLabel
private

label of module creating CosRej

Definition at line 62 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fEnergyLabel
private

label of module creating energy objects

Definition at line 60 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fFluxWeightLabel
private

label of module creating MC events

Definition at line 71 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fGeneratorLabel
private

label of module creating MC events

Definition at line 70 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

art::InputTag skim::BaseSkimmer::fInputTag
protectedinherited

combination of the above two strings

Definition at line 45 of file BaseSkimmer.h.

Referenced by Skim(), skim::NumuSkimmer::Skim(), and skim::NueSkimmer::Skim().

std::string skim::BaseSkimmer::fInstanceLabel
protectedinherited
std::string skim::NumuCCpiSkimmer::fMichelELabel
private

label of module creating MichelEClusters

Definition at line 68 of file NumuCCpiSkimmer.h.

Referenced by reconfigure().

std::string skim::NumuCCpiSkimmer::fNumuELabel
private

label of module creating NumuEs

Definition at line 67 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fNumuSandLabel
private

label of module creating NumuSand

Definition at line 63 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fQePIdLabel
private

label of module creating QePIds

Definition at line 65 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fReMIdLabel
private

label of module creating ReMIds

Definition at line 66 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fShowerLabel
private

label of module creating showers

Definition at line 59 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fTrackLabel
private

label of module creating tracks

Definition at line 61 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fVertexLabel
private

label of module creating vertex

Definition at line 58 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().

std::string skim::NumuCCpiSkimmer::fVetoLabel
private

label of module creating vetos

Definition at line 64 of file NumuCCpiSkimmer.h.

Referenced by reconfigure(), and Skim().


The documentation for this class was generated from the following files: