Skip to content

Commit bac9b69

Browse files
adding mu reconstruction package for muCLAS12 setup (#1015)
* imported muCLAS12/ddvcs reconstruction from ddvcs branch creating new dedicated mu package * fix version number in mu pom, and adding missing MUHD reconstruction package * fix dependency in mu pom * fix dependency in mu pom * addressing spotbugs findings * updatedmu pom and MUVT fixes * added MUVT trajectory points * bug fixes * removing printout * bug fix * added muCLAS12 banks to dst schema * reverted changes to implement DC frames: will do a separate PR
1 parent b25681f commit bac9b69

File tree

28 files changed

+4928
-1
lines changed

28 files changed

+4928
-1
lines changed

common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public enum DetectorType {
3434
AHDC (24, "AHDC"),
3535
ATOF (25, "ATOF"),
3636
RECOIL (26, "RECOIL"),
37+
MUCAL (28, "MUCAL"),
38+
MUVT (29, "MUVT"),
39+
MURT (30, "MURT"),
40+
MURH (31, "MURH"),
3741
TARGET (100, "TARGET"),
3842
MAGNETS (101, "MAGNETS");
3943

etc/bankdefs/hipo4/data.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,66 @@
396396
{ "name":"TDC" , "type":"I", "info":"TDC value"}
397397
]
398398
},
399+
{
400+
"name" : "MUCAL::adc",
401+
"group": 22800,
402+
"item" : 11,
403+
"info": "ADC bank for the muCLAS12 Electromagnetic Calorimeter",
404+
"entries":[
405+
{ "name":"sector" , "type":"B", "info":"sector (=1)"},
406+
{ "name":"layer" , "type":"B", "info":"layer (1-6)"},
407+
{ "name":"component" , "type":"S", "info":"strip"},
408+
{ "name":"order" , "type":"B", "info":"order: 0 - ADCL , 1 - ADCR"},
409+
{ "name":"ADC" , "type":"I", "info":"ADC maximum"},
410+
{ "name":"time" , "type":"F", "info":"time from pulse fit"},
411+
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
412+
]
413+
},
414+
{
415+
"name" : "MUVT::adc",
416+
"group": 22900,
417+
"item" : 11,
418+
"info": "ADC bank for the muCLAS12 Vertex Tracker",
419+
"entries":[
420+
{"name":"sector" , "type":"B", "info":"sector (=1)"},
421+
{"name":"layer" , "type":"B", "info":"layer (=1)"},
422+
{"name":"component" , "type":"S", "info":"crystal id"},
423+
{ "name":"order" , "type":"B", "info":"order: 0 - ADCL , 1 - ADCR"},
424+
{ "name":"ADC" , "type":"I", "info":"ADC integral from pulse fit"},
425+
{ "name":"time" , "type":"F", "info":"time from pulse fit"},
426+
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
427+
]
428+
},
429+
{
430+
"name" : "MURT::adc",
431+
"group": 23000,
432+
"item" : 11,
433+
"info": "ADC bank for the muCLAS12 Recoil Tracker",
434+
"entries":[
435+
{"name":"sector" , "type":"B", "info":"sector (=1)"},
436+
{"name":"layer" , "type":"B", "info":"layer (=1)"},
437+
{"name":"component" , "type":"S", "info":"crystal id"},
438+
{ "name":"order" , "type":"B", "info":"order: 0 - ADCL , 1 - ADCR"},
439+
{ "name":"ADC" , "type":"I", "info":"ADC integral from pulse fit"},
440+
{ "name":"time" , "type":"F", "info":"time from pulse fit"},
441+
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
442+
]
443+
},
444+
{
445+
"name" : "MURH::adc",
446+
"group": 23100,
447+
"item" : 11,
448+
"info": "ADC bank for the muCLAS12 Recoil Hodoscope",
449+
"entries":[
450+
{"name":"sector" , "type":"B", "info":"sector (1-8)"},
451+
{"name":"layer" , "type":"B", "info":"layer (1-2)"},
452+
{"name":"component" , "type":"S", "info":"tile id"},
453+
{ "name":"order" , "type":"B", "info":"order: 0 - ADCL , 1 - ADCR"},
454+
{ "name":"ADC" , "type":"I", "info":"ADC integral from pulse fit"},
455+
{ "name":"time" , "type":"F", "info":"time from pulse fit"},
456+
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
457+
]
458+
},
399459
{
400460
"name" : "RF::adc",
401461
"group": 21700,

etc/bankdefs/hipo4/mu.json

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
[
2+
{
3+
"name": "MUCAL::hits",
4+
"group": 22800,
5+
"item" : 21,
6+
"info": "Reconstructed Hits in muCLAS12 calorimeter",
7+
"entries": [
8+
{"name":"idx", "type":"B", "info":"x id of grid"},
9+
{"name":"idy", "type":"B", "info":"y id of grid"},
10+
{"name":"x", "type":"F", "info":"Hit X position (cm)" },
11+
{"name":"y", "type":"F", "info":"Hit Y position (cm)" },
12+
{"name":"z", "type":"F", "info":"Hit Z position (cm)" },
13+
{"name":"energy", "type":"F", "info":"Hit Energy" },
14+
{"name":"time", "type":"F", "info":"Hit Time" },
15+
{"name":"hitID", "type":"S", "info":"Hit Pointer to ADC bank"},
16+
{"name":"clusterID", "type":"S", "info":"Hit Pointer to Cluster Bank"}
17+
]
18+
},
19+
{
20+
"name": "MUCAL::clusters",
21+
"group": 22800,
22+
"item" : 22,
23+
"info": "Reconstructed Clusters in muCLAS12 calorimeter",
24+
"entries": [
25+
{"name":"size", "type":"S", "info":"Cluster size" },
26+
{"name":"id", "type":"S", "info":"Cluster ID" },
27+
{"name":"x", "type":"F", "info":"Cluster centroid X moment (cm)" },
28+
{"name":"y", "type":"F", "info":"Cluster centroid Y moment (cm)" },
29+
{"name":"z", "type":"F", "info":"Cluster centroid Z moment (cm)" },
30+
{"name":"widthX", "type":"F", "info":"Cluster width in x (cm)" },
31+
{"name":"widthY", "type":"F", "info":"Cluster width in y (cm)" },
32+
{"name":"radius", "type":"F", "info":"Cluster radius (cm)" },
33+
{"name":"time", "type":"F", "info":"Cluster timing information" },
34+
{"name":"energy", "type":"F", "info":"Cluster total energy" },
35+
{"name":"maxEnergy", "type":"F", "info":"Cluster maximum energy" },
36+
{"name":"recEnergy", "type":"F", "info":"Cluster reconstructed energy" }
37+
]
38+
},
39+
{
40+
"name": "MUVT::hits",
41+
"group": 22900,
42+
"item" : 21,
43+
"info": "MUVT hits",
44+
"entries": [
45+
{"name":"id", "type":"S", "info":"id of the hit"},
46+
{"name":"sector", "type":"B", "info":"sector number"},
47+
{"name":"layer", "type":"B", "info":"layer number"},
48+
{"name":"strip", "type":"S", "info":"strip number"},
49+
{"name":"energy", "type":"F", "info":"energy of the hit (eV)"},
50+
{"name":"time", "type":"F", "info":"time of the hit (ns)"},
51+
{"name":"clusterId", "type":"S", "info":"id of the cluster the hit belongs to"},
52+
{"name":"status", "type":"S", "info":"status of the hit"}
53+
]
54+
},
55+
{
56+
"name": "MUVT::clusters",
57+
"group": 22900,
58+
"item" : 22,
59+
"info": "reconstructed clusters from MUVT",
60+
"entries": [
61+
{"name":"id", "type":"S", "info":"id of the cluster"},
62+
{"name":"sector", "type":"B", "info":"sector"},
63+
{"name":"layer", "type":"B", "info":"layer"},
64+
{"name":"strip", "type":"S", "info":"seed strip"},
65+
{"name":"energy", "type":"F", "info":"energy of the cluster (eV)"},
66+
{"name":"time", "type":"F", "info":"time of the cluster (ns)"},
67+
{"name":"xo", "type":"F", "info":"strip origin X coordinate (cm)"},
68+
{"name":"yo", "type":"F", "info":"strip origin Y coordinate (cm)"},
69+
{"name":"zo", "type":"F", "info":"strip origin Z coordinate (cm)"},
70+
{"name":"xe", "type":"F", "info":"strip end X coordinate (cm)"},
71+
{"name":"ye", "type":"F", "info":"strip end Y coordinate (cm)"},
72+
{"name":"ze", "type":"F", "info":"strip end Z coordinate (cm)"},
73+
{"name":"size", "type":"S", "info":"size of the cluster"},
74+
{"name":"status", "type":"S", "info":"status of the cluster"}
75+
]
76+
},
77+
{
78+
"name": "MUVT::crosses",
79+
"group": 22900,
80+
"item" : 23,
81+
"info": "reconstructed crosses from MUVT",
82+
"entries": [
83+
{"name":"id", "type":"S", "info":"id of the cross"},
84+
{"name":"sector", "type":"B", "info":"sector"},
85+
{"name":"region", "type":"B", "info":"region"},
86+
{"name":"energy", "type":"F", "info":"energy of the cross (eV)"},
87+
{"name":"time", "type":"F", "info":"time of the cross (ns)"},
88+
{"name":"x", "type":"F", "info":"x coordinate (cm)"},
89+
{"name":"y", "type":"F", "info":"y coordinate (cm)"},
90+
{"name":"z", "type":"F", "info":"z coordinate (cm)"},
91+
{"name":"cluster1", "type":"S", "info":"id of the cluster in the V layer"},
92+
{"name":"cluster2", "type":"S", "info":"id of the cluster in the W layer"},
93+
{"name":"status", "type":"S", "info":"status of the cluster"}
94+
]
95+
},
96+
{
97+
"name": "MUVT::tracks",
98+
"group": 22900,
99+
"item" : 36,
100+
"info": "reconstructed tracks using MUVT information",
101+
"entries": [
102+
{"name":"index", "type":"S", "info":"index of the track in the DC bank"},
103+
{"name":"status", "type":"B", "info":"status of the track (0: refitted using FMT, 1: original DC track)"},
104+
{"name":"sector", "type":"B", "info":"sector of the track in DC"},
105+
{"name":"vx", "type":"F", "info":"Vertex x-position of the swam track to the DOCA to the beamline (in cm)"},
106+
{"name":"vy", "type":"F", "info":"Vertex y-position of the swam track to the DOCA to the beamline (in cm)"},
107+
{"name":"vz", "type":"F", "info":"Vertex z-position of the swam track to the DOCA to the beamline (in cm)"},
108+
{"name":"px", "type":"F", "info":"3-momentum x-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
109+
{"name":"py", "type":"F", "info":"3-momentum y-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
110+
{"name":"pz", "type":"F", "info":"3-momentum z-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
111+
{"name":"charge", "type":"B", "info":"charge of the track"},
112+
{"name":"chi2", "type":"F", "info":"chi^2 of the fit"},
113+
{"name":"NDF", "type":"B", "info":"number of degrees of freedom of the fit"}
114+
]
115+
},
116+
{
117+
"name": "MUVT::trajectory",
118+
"group": 22900,
119+
"item" : 37,
120+
"info": "MUVT tracks trajectory bank",
121+
"entries": [
122+
{"name":"index", "type":"S", "info":"index of the track in the DC bank"},
123+
{"name":"detector", "type":"B", "info":"id of the detector"},
124+
{"name":"layer", "type":"B", "info":"id of the layer"},
125+
{"name":"x", "type":"F", "info":"track x position at detector surface (cm)"},
126+
{"name":"y", "type":"F", "info":"track y position at detector surface (cm)"},
127+
{"name":"z", "type":"F", "info":"track z position at detector surface (cm)"},
128+
{"name":"tx", "type":"F", "info":"track unit direction vector x component at detector surface"},
129+
{"name":"ty", "type":"F", "info":"track unit direction vector y component at detector surface"},
130+
{"name":"tz", "type":"F", "info":"track unit direction vector z component at detector surface"},
131+
{"name":"lx", "type":"F", "info":"track x position in local coordinates (cm)"},
132+
{"name":"ly", "type":"F", "info":"track y position in local coordinates (cm)"},
133+
{"name":"lz", "type":"F", "info":"track z position in local coordinates (cm)"},
134+
{"name":"dx", "type":"F", "info":"DC track x position in local coordinates (cm)"},
135+
{"name":"dy", "type":"F", "info":"DC track y position in local coordinates (cm)"},
136+
{"name":"dz", "type":"F", "info":"DC track z position in local coordinates (cm)"},
137+
{"name":"path", "type":"F", "info":"pathlength of the track from the track vertex to the detector surface (cm)"}
138+
]
139+
},
140+
{
141+
"name": "MURH::hits",
142+
"group": 23100,
143+
"item" : 21,
144+
"info": "Reconstructed Hits in muCLAS12 hodoscope",
145+
"entries": [
146+
{"name":"sector", "type":"B", "info":"sector number"},
147+
{"name":"layer", "type":"B", "info":"layer number"},
148+
{"name":"component", "type":"S", "info":"component number"},
149+
{"name":"x", "type":"F", "info":"Hit X position (cm)" },
150+
{"name":"y", "type":"F", "info":"Hit Y position (cm)" },
151+
{"name":"z", "type":"F", "info":"Hit Z position (cm)" },
152+
{"name":"energy", "type":"F", "info":"Hit Energy" },
153+
{"name":"time", "type":"F", "info":"Hit Time" },
154+
{"name":"hitID", "type":"S", "info":"Hit Pointer to ADC bank"},
155+
{"name":"clusterID", "type":"S", "info":"Hit Pointer to Cluster Bank"}
156+
]
157+
},
158+
{
159+
"name": "MURH::clusters",
160+
"group": 23100,
161+
"item" : 22,
162+
"info": "Reconstructed clusters in muCLAS12 hodoscope",
163+
"entries": [
164+
{"name":"size", "type":"S", "info":"Cluster size" },
165+
{"name":"id", "type":"S", "info":"Cluster ID" },
166+
{"name":"x", "type":"F", "info":"Cluster centroid X moment (cm)" },
167+
{"name":"y", "type":"F", "info":"Cluster centroid Y moment (cm)" },
168+
{"name":"z", "type":"F", "info":"Cluster centroid Z moment (cm)" },
169+
{"name":"widthX", "type":"F", "info":"Cluster width in x (cm)" },
170+
{"name":"widthY", "type":"F", "info":"Cluster width in y (cm)" },
171+
{"name":"radius", "type":"F", "info":"Cluster radius (cm)" },
172+
{"name":"time", "type":"F", "info":"Cluster timing information" },
173+
{"name":"energy", "type":"F", "info":"Cluster total energy" }
174+
]
175+
}
176+
]

etc/bankdefs/util/bankSplit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def create(dirname, banklist):
6666
rich = ["RICH::tdc","RICH::Ring","RICH::Particle"]
6767
rtpc = ["RTPC::hits","RTPC::tracks","RTPC::KFtracks"]
6868
alert = ["AHDC::track", "AHDC::mc", "AHDC::hits", "AHDC::preclusters", "AHDC::clusters", "AHDC::kftrack", "AHDC::ai:prediction"]
69-
dets = band + raster + rich + rtpc + alert
69+
muclas = ["MUCAL::clusters", "MUVT::tracks"]
70+
dets = band + raster + rich + rtpc + alert + muclas
7071

7172
# additions for the calibration schema:
7273
calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::calib","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBTracks"]

reconstruction/ft/src/main/java/org/jlab/rec/ft/cal/FTCALEngine.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import javax.swing.JFrame;
77
import org.jlab.clas.detector.DetectorData;
88
import org.jlab.clas.detector.DetectorEvent;
9+
import org.jlab.clas.physics.PhysicsEvent;
910
import org.jlab.clas.reco.ReconstructionEngine;
1011
import org.jlab.geom.prim.Vector3D;
1112
import org.jlab.groot.data.H1F;
@@ -89,4 +90,75 @@ public int setRunConditionsParameters(DataEvent event) {
8990

9091
return run;
9192
}
93+
94+
95+
public static void main (String arg[]) {
96+
FTCALEngine cal = new FTCALEngine();
97+
cal.init();
98+
// String input = "/Users/devita/Work/clas12/simulations/clas12Tags/4.4.0/out.hipo";
99+
// String input = "/home/filippi/clas/ForwardTracker/DATA/out_realGeo_noMagField.data";
100+
// String input = "/home/filippi/clas/gemc/electronGun/gemc.hipo";
101+
String input = "/home/filippi/clas12/fttrkDev/clas12-offline-software-6.5.13-fttrkDev/ft_005038.evio.01231.hipo";
102+
HipoDataSource reader = new HipoDataSource();
103+
// String input = "/Users/devita/Work/clas12/simulations/tests/detectors/clas12/ft/out_header.ev";
104+
// EvioSource reader = new EvioSource();
105+
reader.open(input);
106+
107+
// initialize histos
108+
H1F h1 = new H1F("Cluster Energy",100, 0.,5.);
109+
h1.setOptStat(Integer.parseInt("1111")); h1.setTitleX("Cluster Energy (GeV)");
110+
H1F h2 = new H1F("Energy Resolution",100, -1, 1);
111+
h2.setOptStat(Integer.parseInt("1111")); h2.setTitleX("Energy Resolution(GeV)");
112+
H1F h3 = new H1F("Theta Resolution",100, -2, 2);
113+
h3.setOptStat(Integer.parseInt("1111")); h3.setTitleX("Theta Resolution(deg)");
114+
H1F h4 = new H1F("Phi Resolution",100, -10, 10);
115+
h4.setOptStat(Integer.parseInt("1111")); h4.setTitleX("Phi Resolution(deg)");
116+
// H1F h5 = new H1F("Time Resolution",100, -10, 10);
117+
H1F h5 = new H1F("Time Resolution",100, -100, 300);
118+
h5.setOptStat(Integer.parseInt("1111")); h5.setTitleX("Time Resolution(ns)");
119+
H2F h6 = new H2F("cluster xy", 100, -15., 15., 100, -15., 15.);
120+
h6.setTitleX("cluster x"); h6.setTitleY("cluster y");
121+
122+
while(reader.hasEvent()){
123+
// for(int nev=0; nev<2; nev++){
124+
DataEvent event = (DataEvent) reader.getNextEvent();
125+
cal.processDataEvent(event);
126+
127+
DetectorEvent detectorEvent = DetectorData.readDetectorEvent(event);
128+
PhysicsEvent gen = detectorEvent.getGeneratedEvent();
129+
if(event.hasBank("FTCAL::clusters")) {
130+
DataBank bank = event.getBank("FTCAL::clusters");
131+
int nrows = bank.rows();
132+
for(int i=0; i<nrows;i++) {
133+
h1.fill(bank.getFloat("energy",i));
134+
Vector3D cluster = new Vector3D(bank.getFloat("x",i),bank.getFloat("y",i),bank.getFloat("z",i));
135+
// System.out.println(cluster.theta() + " " + gen.getGeneratedParticle(0).theta());
136+
// System.out.println(cluster.x() + " " + cluster.y() + " " + cluster.z() + " ");
137+
/// h5.fill(bank.getFloat("time",i)-124.25); // 124.25 offet for MC data
138+
h5.fill(bank.getFloat("time", i));
139+
h6.fill(cluster.x(), cluster.y());
140+
if(gen.countGenerated() != 0){
141+
h2.fill(bank.getFloat("energy",i)-gen.getGeneratedParticle(0).vector().p());
142+
h3.fill(Math.toDegrees(cluster.theta()-gen.getGeneratedParticle(0).theta()));
143+
h4.fill(Math.toDegrees(cluster.phi()-gen.getGeneratedParticle(0).phi()));
144+
}
145+
}
146+
}
147+
}
148+
JFrame frame = new JFrame("FT Reconstruction");
149+
frame.setSize(800,800);
150+
EmbeddedCanvas canvas = new EmbeddedCanvas();
151+
canvas.divide(2,3);
152+
canvas.cd(0); canvas.draw(h1);
153+
canvas.cd(1); canvas.draw(h2);
154+
canvas.cd(2); canvas.draw(h3);
155+
canvas.cd(3); canvas.draw(h4);
156+
canvas.cd(4); canvas.draw(h6);
157+
canvas.cd(5); canvas.draw(h5);
158+
frame.add(canvas);
159+
frame.setLocationRelativeTo(null);
160+
frame.setVisible(true);
161+
162+
}
163+
92164
}

0 commit comments

Comments
 (0)