9 #include <reconstruction/modules/CDCDedxDQM/CDCDedxDQM.h>
10 #include <TDirectory.h>
19 setPropertyFlags(c_ParallelProcessingCertified);
20 setDescription(
"CDC dE/dx DQM plots with bhabha/hadron events.");
21 addParam(
"mmode", mmode,
"default monitoring mode is basic", std::string(
"basic"));
34 TDirectory* oldDir = gDirectory;
35 oldDir->mkdir(
"CDCDedx");
36 oldDir->cd(
"CDCDedx");
44 hMeta =
new TH1D(
"hMeta",
"hMeta", 3, 0.5, 3.5);
45 hMeta->GetXaxis()->SetTitle(
"Quantity");
46 hMeta->GetYaxis()->SetTitle(
"Values");
48 hMeta->GetXaxis()->SetBinLabel(1,
"nevt");
49 hMeta->GetXaxis()->SetBinLabel(2,
"nbhabha");
50 hMeta->GetXaxis()->SetBinLabel(3,
"nhadron");
52 hdEdx =
new TH1D(
"hdEdx",
";CDC dE/dx;Entries", 250, 0., 2.5);
53 hdEdxvsP =
new TH2D(
"hdEdxVsP",
";#it{p}_{CDC} (GeV/c);CDC dE/dx", 400, 0.050, 4.50, 800, 0.35, 20.35);
54 hdEdxvsEvt =
new TH2D(
"hdEdxvsEvt",
";Events(M);CDC dE/dx", 300, 0, 300, 200, 0.00, 2.5);
55 hdEdxvsCosth =
new TH2D(
"hdEdxvsCosth",
";cos#theta (e^{-}e^{+} tracks);CDC dE/dx", 100, -1.00, 1.00, 250, 0.00, 2.5);
56 hdEdxvsPhi =
new TH2D(
"hdEdxvsPhi",
";#phi (e^{-}e^{+} tracks);CDC dE/dx", 100, -3.20, 3.20, 250, 0.00, 2.5);
57 if (
mmode !=
"basic") {
58 hWires =
new TH2F(
"hWires",
"All Wires;", 2400, -1.2, 1.2, 2400, -1.2, 1.2);
59 hWires->GetXaxis()->SetTitle(
"CDC-wire map: counter-clockwise and start from +x");
60 hWireStatus =
new TH2F(
"hWireStatus",
"Wire Status", 2400, -1.2, 1.2, 2400, -1.2, 1.2);
61 hWireStatus->GetXaxis()->SetTitle(
"CDC-wire map: counter-clockwise and start from +x");
73 B2WARNING(
"Missing CDCDedxTracks array, CDCDedxDQM is skipped.");
88 B2WARNING(
"Missing CDCDedxTracks array, CDCDedxDQM is skipped.");
98 if (
mmode !=
"basic") {
112 B2WARNING(
"Required SoftwareTriggerResult object not available: CDCDedxDQM is skipped");
116 const std::map<std::string, int>& fresults =
m_TrgResult->getResults();
117 if (fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end()
118 and fresults.find(
"software_trigger_cut&skim&accept_hadron") == fresults.end())
return;
120 const bool IsBhabhaEvt = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha") ==
122 const bool IsHadronEvt = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_hadron") ==
126 if (!IsBhabhaEvt and !IsHadronEvt)
return;
136 if (!dedxTrack || dedxTrack->
size() == 0)
continue;
142 if (!fitResult)
continue;
148 double dr = frame.getVertex(helix.getPerigee()).Perp();
149 double dz = frame.getVertex(helix.getPerigee()).Z();
150 if (dr >= 1.0 || fabs(dz) >= 1.0)
continue;
154 if (costh < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
155 if (costh > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
159 if (costh > -0.55 && costh < 0.820) {
160 if (nhits < 20)
continue;
162 if (costh <= -0.62 || costh >= 0.880) {
163 if (nhits < 8)
continue;
164 if (costh > 0 && nhits < 10)
continue;
166 if (nhits < 15)
continue;
171 if (dedxnosat < 0)
continue;
173 double dedx = dedxTrack->
getDedx();
174 if (dedx < 0)
continue;
177 if (pCDC <= 0)
continue;
180 if (pTrk <= 0)
continue;
187 if (abs(TrkEoverP - 1.0) > 0.25)
continue;
191 hdEdx->Fill(dedxnosat);
202 if (IsHadronEvt &&
hdEdxvsP->Integral() <= 80000)
hdEdxvsP->Fill(pCDC, dedx);
204 if (
mmode !=
"basic") {
205 for (
int ihit = 0; ihit < dedxTrack->
size(); ++ihit) {
206 int iwire = dedxTrack->
getWire(ihit);
208 if (
m_adc[iwire].size() < 50)
m_adc[iwire].push_back(iadc);
223 if (
hdEdx->GetEntries() > 0) {
224 hdEdx->GetXaxis()->SetRange(
hdEdx->FindFirstBinAbove(0, 1),
hdEdx->FindLastBinAbove(0, 1));
232 if (
mmode !=
"basic") {
234 for (
int iwire = 0; iwire < 14336; ++iwire) {
238 int wire = iwire - twire ;
239 double phi = 2.*TMath::Pi() * (float(wire) / float(nwire));
240 double x = radius * cos(phi);
241 double y = radius * sin(phi);
243 if (
m_adc[iwire].size() > 0)
continue;
265 16.80, 17.80, 18.80, 19.80, 20.80, 21.80, 22.80, 23.80,
266 25.70, 27.52, 29.34, 31.16, 32.98, 34.80,
267 36.52, 38.34, 40.16, 41.98, 43.80, 45.57,
268 47.69, 49.46, 51.28, 53.10, 54.92, 56.69,
269 58.41, 60.18, 62.00, 63.82, 65.64, 67.41,
270 69.53, 71.30, 73.12, 74.94, 76.76, 78.53,
271 80.25, 82.02, 83.84, 85.66, 87.48, 89.25,
272 91.37, 93.14, 94.96, 96.78, 98.60, 100.37,
273 102.09, 103.86, 105.68, 107.50, 109.32, 111.14
276 Int_t totalWireiLayer = 0 ;
278 for (Int_t iLayer = 0; iLayer < 56; iLayer++) {
279 int iSuperLayer = (iLayer - 2) / 6;
280 if (iSuperLayer <= 0)iSuperLayer = 1;
281 int nWireiLayer = 160 + (iSuperLayer - 1) * 32;
282 totalWireiLayer += nWireiLayer;
284 if (iWire < totalWireiLayer) {
285 if (what ==
"layer")myreturn = iLayer;
286 else if (what ==
"nwirelayer") myreturn = nWireiLayer;
287 else if (what ==
"twire") myreturn = totalWireiLayer - nWireiLayer;
288 else if (what ==
"rwire") myreturn = r[iLayer] / 100.;
289 else std::cout <<
"Invalid return :0 " << std::endl;
This module to design collect CDC dEdx monitoring for DQM and only minimal information are stored.
Int_t m_nBEvt
bhabha events
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
Int_t m_event
number of event
virtual void event() override
This method is called for each event.
Int_t m_nHEvt
hadron events
virtual void endRun() override
This method is called at the end of each run.
virtual void terminate() override
End of the event processing.
Int_t m_nEvt
accepted events
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.
virtual ~CDCDedxDQMModule()
Destructor.
Double_t m_rungain
previous rungain
TH2D * hdEdxvsPhi
dedx vs phi
double getIndexVal(int iWire, TString what)
get index val of cdc wire/layer/parameters
TH2D * hdEdxvsEvt
dedx vs event
std::string mmode
monitoring mode all/basic
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
Store array for Trigger selection.
virtual void defineHisto() override
Defination of histograms.
std::vector< double > m_adc[14336]
adc per wire for wire status
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.
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...
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.
TVector3 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 TVector3 &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
#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.