 |
Belle II Software
release-05-02-19
|
2 #include <alignment/modules/CosmicsAlignmentValidation/CosmicsAlignmentValidation.h>
4 #include <framework/datastore/StoreArray.h>
5 #include <framework/datastore/RelationIndex.h>
6 #include <mdst/dataobjects/MCParticle.h>
8 #include <genfit/Track.h>
10 #include <root/TFile.h>
11 #include <root/TTree.h>
13 #include <boost/foreach.hpp>
31 setDescription(
"Alignment Validation with Cosmics");
33 addParam(
"gfTrackColName", m_gfTrackColName,
34 "Name of genfit::Track collection.", std::string(
""));
35 addParam(
"outputFileName", m_outputFileName,
"Name of the output file.",
36 std::string(
"cosmics.root"));
46 "[CosmicsAlignmentValidation Module]: Starting initialization of CosmicsAlignmentValidation Module. Give me Cosmics!");
48 tree =
new TTree(
"cosmics",
"cosmics");
91 B2DEBUG(99,
"[CosmicsAlignmentValidationModule] begin event");
98 const int nFittedTracks = gfTracks.
getEntries();
108 if (nFittedTracks != 2) {
110 "[CosmicsAlignmentValidationModule] no two tracks reconstructed, but "
123 if (fitResult1 == fitResult2)
125 "[CosmicsAlignmentValidationModule] Fit Results are from the same track!");
127 if (fitResult1 != NULL) {
143 if (fitResult2 != NULL) {
160 t_p1MC = mcParticles[0]->getMomentum().Mag();
162 if (fitResult2 != NULL && fitResult1 != NULL) {
188 B2INFO(
"[CosmicsAlignmentValidationModule] Saving tree.");
190 "[CosmicsAlignmentValidationModule] Tree has " <<
tree->GetEntries()
193 tree->Write(
"cosmics");
204 std::vector<const TrackFitResult*> fitResults;
206 BOOST_FOREACH(
const relElement_t& relGfTrackToTrackFitResult, relGfTracksToTrackFitResults.
getElementsFrom(gfTrack)) {
207 B2DEBUG(99,
"----> Related TrackFitResult found!!!");
208 fitResults.push_back(relGfTrackToTrackFitResult.to);
211 int numberTrackFitResults = fitResults.size();
213 if (numberTrackFitResults == 1) {
214 return fitResults[0];
216 if (numberTrackFitResults == 0) {
219 if (numberTrackFitResults > 1) {
221 "[CosmicsAlignmentValidationModule] genfit::Track has "
222 << numberTrackFitResults
223 <<
" related TrackFitResults. No TrackFitResult is returned.");
float t_p1MC
momentum in MC
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double getOmega() const
Getter for omega.
Provides access to fast ( O(log n) ) bi-directional lookups on a specified relation.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
virtual void initialize() override
Use this to initialize resources or memory your module needs.
const TrackFitResult * findRelatedTrackFitResult(const genfit::Track *gfTrack)
Find trackfit results in for the corresponding track.
Values of the result of a track fit with a given particle hypothesis.
TVector3 getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
double getZ0() const
Getter for z0.
virtual void terminate() override
Clean up anything you created in initialize().
Module to find Track correlation in cosmic events.
Element type for the index.
virtual void beginRun() override
Called once before a new run begins.
double getCotTheta() const
Getter for tanLambda with CDF naming convention.
range_from getElementsFrom(const FROM *from) const
Return a range of all elements pointing from the given object.
Abstract base class for different kinds of events.
virtual ~CosmicsAlignmentValidationModule()
Use to clean up anything you created in the constructor.
std::string m_gfTrackColName
m_gfTrackColName
std::string m_outputFileName
ouput filename string
virtual void endRun() override
Called once when a run ends.
Accessor to arrays stored in the data store.
virtual void event() override
Called once for each event.
int getEntries() const
Get the number of objects in the array.
float t_p2MC
momentum in MC
double getPhi() const
Getter for phi0 with CDF naming convention.
double getD0() const
Getter for d0.