9#include <svd/modules/svdPerformance/SVDEventT0PerformanceTTreeModule.h>
10#include <framework/gearbox/Unit.h>
11#include <framework/core/Environment.h>
12#include <framework/dataobjects/EventMetaData.h>
13#include <svd/dataobjects/SVDShaperDigit.h>
14#include <svd/dataobjects/SVDTrueHit.h>
15#include <svd/dataobjects/SVDEventInfo.h>
16#include <vxd/dataobjects/VxdID.h>
17#include <vxd/geometry/SensorInfoBase.h>
18#include <tracking/dataobjects/RecoTrack.h>
19#include <tracking/dataobjects/RecoHitInformation.h>
20#include <genfit/TrackPoint.h>
21#include <TDirectory.h>
22#include <Math/Boost.h>
26#include <mdst/dataobjects/Track.h>
27#include <mdst/dataobjects/TrackFitResult.h>
28#include <mdst/dataobjects/MCParticle.h>
29#include <framework/datastore/RelationArray.h>
32#include <trg/ecl/dataobjects/TRGECLUnpackerStore.h>
35#include <hlt/dataobjects/OnlineEventT0.h>
53 setDescription(
"This module is used to create a TTree to study SVD eventT0 using clusters associated to tracks.");
55 addParam(
"outputFileName",
m_rootFileName,
"Name of output root file.", std::string(
"SVDEventT0PerformanceTTree.root"));
67 TDirectory::TContext context;
73 m_t =
new TTree(
"tree",
"Tree for SVD clusters related to tracks");
134 m_eventT0 = std::numeric_limits<float>::quiet_NaN();
152 m_eclTCEmax = std::numeric_limits<int>::quiet_NaN();
153 m_eclTCid = std::numeric_limits<int>::quiet_NaN();
156 m_exp = evtMetaData->getExperiment();
157 m_run = evtMetaData->getRun();
158 m_event = evtMetaData->getEvent();
165 if (
m_EventT0->hasTemporaryEventT0(Const::EDetector::SVD)) {
166 const auto bestSVDEvtT0 =
m_EventT0->getBestSVDTemporaryEventT0();
171 if (
m_EventT0->hasTemporaryEventT0(Const::EDetector::CDC)) {
172 const auto bestCDCEvtT0 =
m_EventT0->getBestCDCTemporaryEventT0();
177 if (
m_EventT0->hasTemporaryEventT0(Const::EDetector::TOP)) {
178 const auto bestTOPEvtT0 =
m_EventT0->getBestTOPTemporaryEventT0();
183 if (
m_EventT0->hasTemporaryEventT0(Const::EDetector::ECL)) {
184 const auto bestECLEvtT0 =
m_EventT0->getBestECLTemporaryEventT0();
191 for (
auto& evt : onlineEventT0) {
192 if (evt.getOnlineEventT0Detector() == Const::EDetector::SVD) {
193 B2DEBUG(40,
"OnlineEventT0 given by SVD");
198 if (evt.getOnlineEventT0Detector() == Const::EDetector::CDC) {
199 B2DEBUG(40,
"OnlineEventT0 given by CDC");
204 if (evt.getOnlineEventT0Detector() == Const::EDetector::ECL) {
205 B2DEBUG(40,
"OnlineEventT0 given by ECL");
210 if (evt.getOnlineEventT0Detector() == Const::EDetector::TOP) {
211 B2DEBUG(40,
"OnlineEventT0 given by TOP");
249 std::string m_svdEventInfoName =
"SVDEventInfo";
251 m_svdEventInfoName =
"SVDEventInfoSim";
253 if (!eventinfo) B2ERROR(
"No SVDEventInfo!");
254 m_svdTB = eventinfo->getModeByte().getTriggerBin();
261 for (
const auto& trk : recoTracks) {
262 if (! trk.wasFitSuccessful()) {
270 if (theTK.
size() == 0) {
277 const vector<SVDCluster* > svdClusters = trk.getSVDHitList();
278 B2DEBUG(40,
"FITTED TRACK: NUMBER OF SVD HITS = " << svdClusters.size());
280 for (
unsigned int i = 0; i < svdClusters.size(); i++) {
295 ROOT::Math::BoostZ boost(3. / 11);
296 pStar = boost(pStar);
335 if (isMC && trueHit_1.
size() > 0) {
340 if (mcParticle_1.
size() > 0) {
341 if (mcParticle_1[0]->isPrimaryParticle())
345 m_svdTrueTime.push_back(std::numeric_limits<float>::quiet_NaN());
350 for (
const auto& trgHit : TRGECLData) {
351 int hitWin = trgHit.getHitWin();
352 B2DEBUG(40,
"hitWin = " << hitWin);
353 if (hitWin != 3 && hitWin != 4) {
continue; }
370 TDirectory::TContext context;
static const ChargedStable pion
charged pion particle
bool isMC() const
Do we have generated, not real data?
static Environment & Instance()
Static method to get a reference to the Environment instance.
A Class to store the Monte Carlo particle information.
void setDescription(const std::string &description)
Sets the description of the module.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getClsTime() const
Get average of waveform maximum times of cluster strip signals.
float getSNR() const
Get cluster SNR.
unsigned short getSize() const
Get cluster size.
float getCharge() const
Get collected charge.
VxdID getSensorID() const
Get the sensor ID.
bool isUCluster() const
Get the direction of strips.
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
float getClsTimeSigma() const
Get the error of the reconstructed hit time.
float getPositionSigma() const
Get the error of the reconstructed hit coordinate.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Values of the result of a track fit with a given particle hypothesis.
float getNDF() const
Getter for number of degrees of freedom of the track fit.
short getChargeSign() const
Return track charge (1 or -1).
double getPValue() const
Getter for Chi2 Probability of the track fit.
ROOT::Math::PxPyPzEVector get4Momentum() const
Getter for the 4Momentum at the closest approach of the track in the r/phi projection.
double getD0() const
Getter for d0.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getSensorNumber() const
Get the sensor id.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.