14 #include <cdc/modules/cdcGeoScan/ScanCDCGeoModule.h>
15 #include <geometry/GeometryManager.h>
16 #include <framework/gearbox/GearDir.h>
17 #include <cdc/geometry/CDCGeometryPar.h>
28 ScanCDCGeoModule::ScanCDCGeoModule()
30 setDescription(
"This module fills CDC geometry information in histo/tree format to a root file");
33 void ScanCDCGeoModule::initialize()
38 TH1F* h_nwires =
new TH1F(
"h_nwires",
"Number of wires in layer;CDC layer#", 56, 0.5, 56.5);
39 TH1F* h_stereo =
new TH1F(
"h_stereo",
"Stereo angle in this layer;CDC layer#", 56, 0.5, 56.5);
40 TH1F* h_swire_posF_phi =
new TH1F(
"h_swire_posF_phi",
"#phi of sense wires in forward pos;CDC layer#", 56, 0.5, 56.5);
41 TH1F* h_swire_posF_theta =
new TH1F(
"h_swire_posF_theta",
"#theta of sense wires in forward pos;CDC layer#", 56, 0.5, 56.5);
42 TH1F* h_swire_posB_phi =
new TH1F(
"h_swire_posB_phi",
"#phi of sense wires in backward pos;CDC layer#", 56, 0.5, 56.5);
43 TH1F* h_swire_posB_theta =
new TH1F(
"h_swire_posB_theta",
"#theta of sense wires in backward pos;CDC layer#", 56, 0.5, 56.5);
44 TH1F* h_fwire_iradius =
new TH1F(
"h_fwire_iradius",
"inner radius of field wires;CDC layer#", 56, 0.5, 56.5);
45 TH1F* h_fwire_oradius =
new TH1F(
"h_fwire_oradius",
"outer radius of field wires;CDC layer#", 56, 0.5, 56.5);
46 TH1F* h_width =
new TH1F(
"h_width",
"Cell Width;CDC layer#", 56, 0.5, 56.5);
47 TH1F* h_height =
new TH1F(
"h_height",
"Cell Height;CDC layer#", 56, 0.5, 56.5);
48 TH1F* h_length =
new TH1F(
"h_length",
"length of the wires;CDC layer#", 56, 0.5, 56.5);
50 B2INFO(
"Creating CDCGeometryPar object");
51 CDCGeometryPar::Instance();
55 cout <<
"------| Summary-1 " << endl;
56 cout << left <<
"Number of CDC wire layers" << setw(15) <<
" " << cdcgeo.
nWireLayers() << endl;
57 cout << left <<
"Sense Wire Diameter" << setw(15) <<
" " << cdcgeo.
senseWireDiameter() << endl;
58 cout << left <<
"Field Wire Diameter" << setw(15) <<
" " << cdcgeo.
fieldWireDiameter() << endl;
60 cout <<
"------| Summary-2 " << endl;
63 << setw(10) <<
"Layer"
64 << setw(15) <<
"nwire"
65 << setw(15) <<
"radii sense"
66 << setw(15) <<
"dRdown"
68 << setw(15) <<
"Delta"
71 for (
unsigned int i = 0; i < cdcgeo.
nWireLayers(); ++i) {
74 h_nwires->SetBinContent(i + 1, fnWires);
78 fswire_posF_phi = wirePosF.
Phi();
79 h_swire_posF_phi->SetBinContent(i + 1, fswire_posF_phi);
80 fswire_posF_theta = wirePosF.
Theta();
81 h_swire_posF_theta->SetBinContent(i + 1, fswire_posF_theta);
84 fswire_posB_phi = wirePosB.
Phi();
85 h_swire_posB_phi->SetBinContent(i + 1, fswire_posB_phi);
86 fswire_posB_theta = wirePosB.
Theta();
87 h_swire_posB_theta->SetBinContent(i + 1, fswire_posB_theta);
89 const B2Vector3D wireDir = (wirePosF - wirePosB);
90 fstereoAng = wireDir.
Theta();
91 if (wirePosF.
Phi() < wirePosB.
Phi())fstereoAng *= -1;
92 h_stereo->SetBinContent(i + 1, fstereoAng);
94 fclength = wirePosF.
Perp();
95 h_length->SetBinContent(i + 1, fclength);
98 fcwidth = 2 * PI * wirePosF.
Perp() / fnWires;
99 h_width->SetBinContent(i + 1, fcwidth);
102 h_fwire_iradius->SetBinContent(i + 1, fwire_iradius);
105 h_fwire_oradius->SetBinContent(i + 1, fwire_oradius);
107 fcheight = fwire_oradius - fwire_iradius;
108 h_height->SetBinContent(i + 1, fcheight);
112 double delta = -99.0;
114 delta = fwire_oradius - inradiusnext;
120 << setw(15) << fnWires
130 TDirectory* dhistos = m_file->mkdir(
"histos");
133 h_swire_posF_phi->Write();
134 h_swire_posB_phi->Write();
135 h_swire_posF_theta->Write();
136 h_swire_posB_theta->Write();
138 h_fwire_iradius->Write();
139 h_fwire_oradius->Write();
144 TDirectory* dvar = m_file->mkdir(
"vars");
147 TVectorF sWireDia(1);
149 sWireDia.Write(
"sWireDia");
151 TVectorF fWireDia(1);
153 fWireDia.Write(
"fWireDia");
157 void ScanCDCGeoModule::bookOutput()
160 m_file =
new TFile(
"CDCGeometryScan.root",
"RECREATE");
161 m_tree =
new TTree(
"tree",
"CDC Geometry details");
162 m_tree->SetDirectory(0);
163 m_tree->Branch(
"lnwires", &fnWires,
"lnwires/I");
164 m_tree->Branch(
"lsteang", &fstereoAng,
"lsteang/D");
165 m_tree->Branch(
"lswire_fpos_phi", &fswire_posF_phi,
"lswire_fpos_phi/D");
166 m_tree->Branch(
"lswire_fpos_theta", &fswire_posF_theta,
"lswire_fpos_theta/D");
167 m_tree->Branch(
"lswire_bpos_phi", &fswire_posB_phi,
"lswire_bpos_phi/D");
168 m_tree->Branch(
"lswire_bpos_theta", &fswire_posB_theta,
"lswire_bpos_theta/D");
169 m_tree->Branch(
"lfwire_inr", &fwire_iradius,
"lfwire_inr/D");
170 m_tree->Branch(
"lfwire_or", &fwire_oradius,
"lfwire_or/D");
171 m_tree->Branch(
"lcwidth", &fcwidth,
"lcwidth/D");
172 m_tree->Branch(
"lclength", &fclength,
"lclength/D");
173 m_tree->Branch(
"lcheight", &fcheight,
"lcheight/D");
176 void ScanCDCGeoModule::terminate()
DataType Phi() const
The azimuth angle.
DataType Theta() const
The polar angle.
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
The Class for CDC Geometry Parameters.
double fieldWireDiameter() const
Returns diameter of the field wire.
const B2Vector3D wireForwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
double senseWireDiameter() const
Returns diameter of the sense wire.
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
const double * innerRadiusWireLayer() const
Returns an array of inner radius of wire layers.
unsigned nWireLayers() const
Returns a number of wire layers.
const double * outerRadiusWireLayer() const
Returns an array of outer radius of wire layers.
double senseWireR(int layerId) const
Returns radius of sense wire in each layer.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.