9#include <reconstruction/modules/CDCDedxDQM/CDCDedxDQM.h>
11#include <TDirectory.h>
22 addParam(
"mmode",
mmode,
"default monitoring mode is basic", std::string(
"basic"));
29 TDirectory* oldDir = gDirectory;
30 oldDir->mkdir(
"CDCDedx");
31 oldDir->cd(
"CDCDedx");
35 double rungain = -99.0;
43 hMeta =
new TH1D(
"hMeta",
"hMeta", 3, 0.5, 3.5);
44 hMeta->GetXaxis()->SetTitle(
"Quantity");
45 hMeta->GetYaxis()->SetTitle(
"Values");
46 hMeta->SetTitle(Form(
"(Exp:%d, Run:%d, RG:%0.03f)", expNum, runNum, rungain));
47 hMeta->GetXaxis()->SetBinLabel(1,
"nevt");
48 hMeta->GetXaxis()->SetBinLabel(2,
"nbhabha");
49 hMeta->GetXaxis()->SetBinLabel(3,
"nhadron");
51 hdEdx =
new TH1D(
"hdEdx",
";CDC dE/dx;Entries", 100, 0., 2.5);
52 hinjtimeHer =
new TH2D(
"hinjtimeHer",
";injection time (#mu s); CDC dE/dx", 40, 0, 80e3, 50, 0, 2.5);
53 hinjtimeLer =
new TH2D(
"hinjtimeLer",
";injection time (#mu s); CDC dE/dx", 40, 0, 80e3, 50, 0, 2.5);
54 hdEdxvsP =
new TH2D(
"hdEdxVsP",
";#it{p}_{CDC} (GeV/c);CDC dE/dx", 100, 0.05, 2.50, 100, 0.35, 10.0);
55 hdEdxvsEvt =
new TH2D(
"hdEdxvsEvt",
";Events(M);CDC dE/dx", 50, 0, 200, 50, 0.00, 2.0);
56 hdEdxvsCosth =
new TH2D(
"hdEdxvsCosth",
";cos#theta (e^{-}e^{+} tracks);CDC dE/dx", 50, -1.00, 1.00, 50, 0.00, 2.5);
57 hdEdxvsPhi =
new TH2D(
"hdEdxvsPhi",
";#phi (e^{-}e^{+} tracks);CDC dE/dx", 50, -3.20, 3.20, 50, 0.00, 2.5);
58 if (
mmode !=
"basic") {
59 hWires =
new TH2F(
"hWires",
"All Wires;", 2400, -1.2, 1.2, 2400, -1.2, 1.2);
60 hWires->GetXaxis()->SetTitle(
"CDC-wire map: counter-clockwise and start from +x");
61 hWireStatus =
new TH2F(
"hWireStatus",
"Wire Status", 2400, -1.2, 1.2, 2400, -1.2, 1.2);
62 hWireStatus->GetXaxis()->SetTitle(
"CDC-wire map: counter-clockwise and start from +x");
74 B2WARNING(
"Missing CDCDedxTracks array, CDCDedxDQM is skipped.");
89 B2WARNING(
"Missing CDCDedxTracks array, CDCDedxDQM is skipped.");
101 if (
mmode !=
"basic") {
115 B2WARNING(
"Required SoftwareTriggerResult object not available: CDCDedxDQM is skipped");
119 const std::map<std::string, int>& fresults =
m_TrgResult->getResults();
120 if (fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end()
121 and fresults.find(
"software_trigger_cut&skim&accept_hadron") == fresults.end())
return;
123 const bool IsBhabhaEvt = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha") ==
125 const bool IsHadronEvt = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_hadron") ==
129 if (!IsBhabhaEvt and !IsHadronEvt)
return;
141 if (!dedxTrack || dedxTrack->
size() == 0)
continue;
147 if (!fitResult)
continue;
151 helix.
passiveMoveBy(ROOT::Math::XYZVector(beamSpotDB->getIPPosition()));
153 double dr = frame.getVertex(ROOT::Math::XYZVector(helix.getPerigee())).Rho();
154 double dz = frame.getVertex(ROOT::Math::XYZVector(helix.getPerigee())).Z();
155 if (dr >= 1.0 || fabs(dz) >= 1.0)
continue;
159 if (costh < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
160 if (costh > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
164 if (costh > -0.55 && costh < 0.820) {
165 if (nhits < 20)
continue;
167 if (costh <= -0.62 || costh >= 0.880) {
168 if (nhits < 8)
continue;
169 if (costh > 0 && nhits < 10)
continue;
171 if (nhits < 15)
continue;
176 if (dedxnosat < 0)
continue;
178 double dedx = dedxTrack->
getDedx();
179 if (dedx < 0)
continue;
182 if (pCDC <= 0)
continue;
185 if (pTrk <= 0)
continue;
192 if (abs(TrkEoverP - 1.0) > 0.25)
continue;
196 hdEdx->Fill(dedxnosat);
201 if (
event >= 150e6)
event = 150e6 - 100;
202 event = int(
event / 5e5);
215 if (IsHadronEvt &&
hdEdxvsP->Integral() <= 80000)
hdEdxvsP->Fill(pCDC, dedx);
217 if (
mmode !=
"basic") {
218 for (
int ihit = 0; ihit < dedxTrack->
size(); ++ihit) {
219 int iwire = dedxTrack->
getWire(ihit);
221 if (
m_adc[iwire].size() < 50)
m_adc[iwire].push_back(iadc);
236 if (
hdEdx->GetEntries() > 0) {
237 hdEdx->GetXaxis()->SetRange(
hdEdx->FindFirstBinAbove(0, 1),
hdEdx->FindLastBinAbove(0, 1));
258 B2INFO(
"CDCDedxDQMModule: terminate called");
265 B2INFO(
"Creating CDCGeometryPar object");
271 for (
unsigned int ilay = 0; ilay < c_maxNSenseLayers; ++ilay) {
272 for (
unsigned int iwire = 0; iwire < cdcgeo.
nWiresInLayer(ilay); ++iwire) {
274 double phi = 2.*TMath::Pi() * (iwire / double(cdcgeo.
nWiresInLayer(ilay)));
275 double radius = cdcgeo.
senseWireR(ilay) / 100.;
276 double x = radius * cos(phi);
277 double y = radius * sin(phi);
279 if (
m_adc[jwire].size() > 0)
continue;
TH2F * hWireStatus
dead wire status
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
TH2D * hdEdxvsCosth
dedx vs costh
virtual void initialize() override
Initialize the module.
TH2F * hWires
all wire mapping
virtual void event() override
This method is called for each event.
virtual void endRun() override
This method is called at the end of each run.
virtual void terminate() override
End of the event processing.
StoreObjPtr< EventMetaData > m_MetaDataPtr
Store array for metadata info.
virtual void beginRun() override
This method is called for each run.
StoreArray< CDCDedxTrack > m_cdcDedxTracks
Store array for CDCDedxTrack.
int m_nEvt
accepted events
TH2D * hdEdxvsPhi
dedx vs phi
std::array< std::vector< double >, c_nSenseWires > m_adc
adc per wire for wire status
TH2D * hdEdxvsEvt
dedx vs event
StoreObjPtr< EventLevelTriggerTimeInfo > TTDInfo
Store array for injection time info.
CDCDedxDQMModule()
Default constructor.
TH2D * hinjtimeLer
injection time in LER
TH2D * hinjtimeHer
injection time in HER
void plotWireMap()
function to plot wire status map (all, bad)
std::string mmode
monitoring mode all/basic
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
Store array for Trigger selection.
virtual void defineHisto() override
Defination of histograms.
Debug output for CDCDedxPID module.
int getADCCount(int i) const
Return the adcCount for this hit.
double getDedx() const
Get dE/dx truncated mean for this track.
int getNLayerHits() const
Return the number of layer hits for this track.
double getCosTheta() const
Return cos(theta) for this track.
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
int size() const
Return the number of hits for this track.
double getMomentum() const
Return the track momentum valid in the CDC.
The Class for CDC Geometry Parameters.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
double senseWireR(int layerId) const
Returns radius of sense wire in each layer.
static const ChargedStable pion
charged pion particle
Class for accessing objects in the database.
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
@ c_nPhotons
CR is split into n photons (N1)
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
static const ReferenceFrame & GetCurrent()
Get current rest frame.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
Values of the result of a track fit with a given particle hypothesis.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
UncertainHelix getUncertainHelix() const
Conversion to framework Uncertain Helix (i.e., with covariance).
Class that bundles various TrackFitResults.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
double passiveMoveBy(const ROOT::Math::XYZVector &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
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.
@ c_accept
Accept this event.
Abstract base class for different kinds of events.