8 #include <cdc/modules/cdcGeoScan/ScanCDCGeoModule.h>
9 #include <geometry/GeometryManager.h>
10 #include <framework/gearbox/GearDir.h>
11 #include <cdc/geometry/CDCGeometryPar.h>
22 ScanCDCGeoModule::ScanCDCGeoModule()
24 setDescription(
"This module fills CDC geometry information in histo/tree format to a root file");
27 void ScanCDCGeoModule::initialize()
32 TH1F* h_nwires =
new TH1F(
"h_nwires",
"Number of wires in layer;CDC layer#", 56, 0.5, 56.5);
33 TH1F* h_stereo =
new TH1F(
"h_stereo",
"Stereo angle in this layer;CDC layer#", 56, 0.5, 56.5);
34 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);
35 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);
36 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);
37 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);
38 TH1F* h_fwire_iradius =
new TH1F(
"h_fwire_iradius",
"inner radius of field wires;CDC layer#", 56, 0.5, 56.5);
39 TH1F* h_fwire_oradius =
new TH1F(
"h_fwire_oradius",
"outer radius of field wires;CDC layer#", 56, 0.5, 56.5);
40 TH1F* h_width =
new TH1F(
"h_width",
"Cell Width;CDC layer#", 56, 0.5, 56.5);
41 TH1F* h_height =
new TH1F(
"h_height",
"Cell Height;CDC layer#", 56, 0.5, 56.5);
42 TH1F* h_length =
new TH1F(
"h_length",
"length of the wires;CDC layer#", 56, 0.5, 56.5);
44 B2INFO(
"Creating CDCGeometryPar object");
45 CDCGeometryPar::Instance();
49 cout <<
"------| Summary-1 " << endl;
50 cout << left <<
"Number of CDC wire layers" << setw(15) <<
" " << cdcgeo.
nWireLayers() << endl;
51 cout << left <<
"Sense Wire Diameter" << setw(15) <<
" " << cdcgeo.
senseWireDiameter() << endl;
52 cout << left <<
"Field Wire Diameter" << setw(15) <<
" " << cdcgeo.
fieldWireDiameter() << endl;
54 cout <<
"------| Summary-2 " << endl;
57 << setw(10) <<
"Layer"
58 << setw(15) <<
"nwire"
59 << setw(15) <<
"radii sense"
60 << setw(15) <<
"dRdown"
62 << setw(15) <<
"Delta"
65 for (
unsigned int i = 0; i < cdcgeo.
nWireLayers(); ++i) {
68 h_nwires->SetBinContent(i + 1, fnWires);
72 fswire_posF_phi = wirePosF.Phi();
73 h_swire_posF_phi->SetBinContent(i + 1, fswire_posF_phi);
74 fswire_posF_theta = wirePosF.Theta();
75 h_swire_posF_theta->SetBinContent(i + 1, fswire_posF_theta);
78 fswire_posB_phi = wirePosB.Phi();
79 h_swire_posB_phi->SetBinContent(i + 1, fswire_posB_phi);
80 fswire_posB_theta = wirePosB.Theta();
81 h_swire_posB_theta->SetBinContent(i + 1, fswire_posB_theta);
83 const TVector3 wireDir = (wirePosF - wirePosB);
84 fstereoAng = wireDir.Theta();
85 if (wirePosF.Phi() < wirePosB.Phi())fstereoAng *= -1;
86 h_stereo->SetBinContent(i + 1, fstereoAng);
88 fclength = wirePosF.Perp();
89 h_length->SetBinContent(i + 1, fclength);
92 fcwidth = 2 * PI * wirePosF.Perp() / fnWires;
93 h_width->SetBinContent(i + 1, fcwidth);
96 h_fwire_iradius->SetBinContent(i + 1, fwire_iradius);
99 h_fwire_oradius->SetBinContent(i + 1, fwire_oradius);
101 fcheight = fwire_oradius - fwire_iradius;
102 h_height->SetBinContent(i + 1, fcheight);
106 double delta = -99.0;
108 delta = fwire_oradius - inradiusnext;
114 << setw(15) << fnWires
124 TDirectory* dhistos = m_file->mkdir(
"histos");
127 h_swire_posF_phi->Write();
128 h_swire_posB_phi->Write();
129 h_swire_posF_theta->Write();
130 h_swire_posB_theta->Write();
132 h_fwire_iradius->Write();
133 h_fwire_oradius->Write();
138 TDirectory* dvar = m_file->mkdir(
"vars");
141 TVectorF sWireDia(1);
143 sWireDia.Write(
"sWireDia");
145 TVectorF fWireDia(1);
147 fWireDia.Write(
"fWireDia");
151 void ScanCDCGeoModule::bookOutput()
154 m_file =
new TFile(
"CDCGeometryScan.root",
"RECREATE");
155 m_tree =
new TTree(
"tree",
"CDC Geometry details");
156 m_tree->SetDirectory(0);
157 m_tree->Branch(
"lnwires", &fnWires,
"lnwires/I");
158 m_tree->Branch(
"lsteang", &fstereoAng,
"lsteang/D");
159 m_tree->Branch(
"lswire_fpos_phi", &fswire_posF_phi,
"lswire_fpos_phi/D");
160 m_tree->Branch(
"lswire_fpos_theta", &fswire_posF_theta,
"lswire_fpos_theta/D");
161 m_tree->Branch(
"lswire_bpos_phi", &fswire_posB_phi,
"lswire_bpos_phi/D");
162 m_tree->Branch(
"lswire_bpos_theta", &fswire_posB_theta,
"lswire_bpos_theta/D");
163 m_tree->Branch(
"lfwire_inr", &fwire_iradius,
"lfwire_inr/D");
164 m_tree->Branch(
"lfwire_or", &fwire_oradius,
"lfwire_or/D");
165 m_tree->Branch(
"lcwidth", &fcwidth,
"lcwidth/D");
166 m_tree->Branch(
"lclength", &fclength,
"lclength/D");
167 m_tree->Branch(
"lcheight", &fcheight,
"lcheight/D");
170 void ScanCDCGeoModule::terminate()