Skip to content

Commit

Permalink
merge master and change range on chi2ondf
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodyyugo committed May 16, 2024
2 parents 10e650a + 9e1f266 commit 83d4acf
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,17 +482,57 @@ private void doEoPPlots(Track track, Cluster cluster) {
phi,
eop);



// Cluster positions

double clusterX = cluster.getPosition()[0];
double clusterY = cluster.getPosition()[1];
TrackState ts_ecal = TrackUtils.getTrackStateAtECal(track);

if(ts_ecal == null){
return;
}

double[] ts_ecalPos = ts_ecal.getReferencePoint();
double trkX = ts_ecalPos[1];
double trkY = ts_ecalPos[2];

aidaGBL.histogram1D(eopFolder+"Xcluster_"+vol+"_fid").fill(clusterX);
aidaGBL.histogram1D(eopFolder+"Ycluster_"+vol+"_fid").fill(clusterY);

aidaGBL.histogram1D(eopFolder+"trk_clu_resX_"+vol+"_fid").fill(trkX-clusterX);
aidaGBL.histogram1D(eopFolder+"trk_clu_resY_"+vol+"_fid").fill(trkY-clusterY);

aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsX_"+vol+"_fid").fill(trkX,trkX-clusterX);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsY_"+vol+"_fid").fill(trkY,trkX-clusterX);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsX_"+vol+"_fid").fill(trkX,trkY-clusterY);
aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsY_"+vol+"_fid").fill(trkY,trkY-clusterY);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vstrkP_"+vol+"_fid").fill(trackp,trkY-clusterY);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vstrkP_"+vol+"_fid").fill(trackp,trkX-clusterX);

aidaGBL.histogram2D(eopFolder+"trkY_vs_tanL_"+vol+"_fid").fill(tanL,trkY);


aidaGBL.histogram1D(eopFolder+"Xcluster_"+charge+"_"+vol+"_fid").fill(clusterX);
aidaGBL.histogram1D(eopFolder+"Ycluster_"+charge+"_"+vol+"_fid").fill(clusterY);

aidaGBL.histogram1D(eopFolder+"trk_clu_resX_"+charge+"_"+vol+"_fid").fill(trkX-clusterX);
aidaGBL.histogram1D(eopFolder+"trk_clu_resY_"+charge+"_"+vol+"_fid").fill(trkY-clusterY);

aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsX_"+charge+"_"+vol+"_fid").fill(trkX,trkX-clusterX);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsY_"+charge+"_"+vol+"_fid").fill(trkY,trkX-clusterX);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsX_"+charge+"_"+vol+"_fid").fill(trkX,trkY-clusterY);
aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsY_"+charge+"_"+vol+"_fid").fill(trkY,trkY-clusterY);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vstrkP_"+charge+"_"+vol+"_fid").fill(trackp,trkY-clusterY);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vstrkP_"+charge+"_"+vol+"_fid").fill(trackp,trkX-clusterX);

aidaGBL.histogram2D(eopFolder+"trkY_vs_tanL_"+charge+"_"+vol+"_fid").fill(tanL,trkY);


//

Expand Down Expand Up @@ -1019,10 +1059,7 @@ private void setupEoPPlots() {
aidaGBL.histogram1D(eopFolder+"Ecluster"+vol,200,0,6);
aidaGBL.histogram1D(eopFolder+"EoP"+vol,200,0,2);

aidaGBL.histogram1D(eopFolder+"Xcluster"+vol+"_fid",200,-100,100);
aidaGBL.histogram1D(eopFolder+"Ycluster"+vol+"_fid",200,-100,100);

double lmin = 0.;
double lmin = 0.;
double lmax = 0.08;
if (vol == "_bot") {
lmin = -0.08;
Expand All @@ -1038,15 +1075,54 @@ private void setupEoPPlots() {
aidaGBL.histogram1D(eopFolder+"Ecluster"+vol+"_fid",200,0,5);
aidaGBL.histogram1D(eopFolder+"EoP"+vol+"_fid",200,0,2);
aidaGBL.histogram2D(eopFolder+"EoP_vs_trackP"+vol+"_fid",200,0,6,200,0,2);


double cxrange = 20;
double cyrange = 20;
double ecalX = 400;

aidaGBL.histogram1D(eopFolder+"Xcluster"+vol+"_fid",200,-ecalX,ecalX);
aidaGBL.histogram1D(eopFolder+"Ycluster"+vol+"_fid",200,-ecalX,ecalX);
aidaGBL.histogram1D(eopFolder+"trk_clu_resX"+vol+"_fid",200,-cxrange,cxrange);
aidaGBL.histogram1D(eopFolder+"trk_clu_resY"+vol+"_fid",200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsX"+vol+"_fid",200,-ecalX,ecalX,200,-cxrange,cxrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsY"+vol+"_fid",200,-ecalX,ecalX,200,-cxrange,cxrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsX"+vol+"_fid",200,-ecalX,ecalX,200,-cyrange,cyrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsY"+vol+"_fid",200,-ecalX,ecalX,200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vstrkP"+vol+"_fid",100,0.,5,200,-cyrange,cyrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vstrkP"+vol+"_fid",100,0.,5,200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trkY_vs_tanL"+vol+"_fid",200,-0.2,0.2,200,-100,100);


for (String charge : charges) {
aidaGBL.histogram2D(eopFolder+"EoP_vs_trackP"+charge+vol+"_fid",200,0,6,200,0,2);
aidaGBL.histogram2D(eopFolder+"EoP_vs_tanLambda"+charge+vol+"_fid",200,0.01,0.08,200,0,2);
aidaGBL.histogram2D(eopFolder+"EoP_vs_phi"+charge+vol+"_fid",200,-0.2,0.2,200,0,2);



aidaGBL.histogram1D(eopFolder+"Xcluster"+charge+vol+"_fid",200,-ecalX,ecalX);
aidaGBL.histogram1D(eopFolder+"Ycluster"+charge+vol+"_fid",200,-ecalX,ecalX);
aidaGBL.histogram1D(eopFolder+"trk_clu_resX"+charge+vol+"_fid",200,-cxrange,cxrange);
aidaGBL.histogram1D(eopFolder+"trk_clu_resY"+charge+vol+"_fid",200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsX"+charge+vol+"_fid",200,-ecalX,ecalX,200,-cxrange,cxrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vsY"+charge+vol+"_fid",200,-ecalX,ecalX,200,-cxrange,cxrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsX"+charge+vol+"_fid",200,-ecalX,ecalX,200,-cyrange,cyrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vsY"+charge+vol+"_fid",200,-ecalX,ecalX,200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trk_clu_resY_vstrkP"+charge+vol+"_fid",100,0.,5,200,-cyrange,cyrange);
aidaGBL.histogram2D(eopFolder+"trk_clu_resX_vstrkP"+charge+vol+"_fid",100,0.,5,200,-cyrange,cyrange);

aidaGBL.histogram2D(eopFolder+"trkY_vs_tanL"+charge+vol+"_fid",200,-0.2,0.2,200,-100,100);





}
}
Expand Down Expand Up @@ -1202,7 +1278,7 @@ private void setupPlots() {
aidaGBL.histogram1D(trkpFolder+"p_slot"+vol+charge,nbins_p,0.,pmax);

aidaGBL.histogram1D(trkpFolder+"Chi2"+vol+charge,nbins_t*2,0,200);
aidaGBL.histogram1D(trkpFolder+"Chi2oNDF"+vol+charge,nbins_t*2,0,200);
aidaGBL.histogram1D(trkpFolder+"Chi2oNDF"+vol+charge,nbins_t*2,0,20);
aidaGBL.histogram1D(trkpFolder+"nHits"+vol+charge,15,0,15);
aidaGBL.histogram1D(trkpFolder+"trk_extr_or_x"+vol+charge,nbins_t,-3,3);
aidaGBL.histogram1D(trkpFolder+"trk_extr_or_y"+vol+charge,nbins_t,-3,3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.lcsim.event.RelationalTable;
import org.lcsim.event.Track;
import org.lcsim.event.base.BaseTrack;
import org.lcsim.event.base.BaseTrackState;

//Fiducial cuts on the calorimeter cluster
import org.hps.record.triggerbank.TriggerModule;
Expand Down Expand Up @@ -100,8 +101,7 @@ public class SimpleGBLTrajAliDriver extends Driver {

private AIDA aidaGBL;
String derFolder = "/gbl_derivatives/";
String eopFolder = "/EoP/";


private String inputCollectionName = "MatchedTracks";
private String outputCollectionName = "GBLTracks";
private String trackRelationCollectionName = "MatchedToGBLTrackRelations";
Expand Down Expand Up @@ -444,27 +444,30 @@ protected void detectorChanged(Detector detector) {
//Alignment Manager - Get the composite structures.
IDetectorElement detectorElement = detector.getDetectorElement();
Alignabledes = detectorElement.findDescendants(AlignableDetectorElement.class);

for (AlignableDetectorElement ade : Alignabledes) {
if (ade.getName().contains("alignable")) {
System.out.printf("Alignable Detector Elements informations: %s \n", ade.getName());
//System.out.printf(((AlignableDetectorElement)ade).getlocalToGlobal().toString()+"\n");
if (ade.getParent() != null) {
System.out.printf("The parent is: %s\n", ade.getParent().getName());
}
else {
System.out.printf("No parent. \n");
}
}
}

if (debug_) {
for (AlignableDetectorElement ade : Alignabledes) {
if (ade.getName().contains("alignable")) {
System.out.printf("Alignable Detector Elements informations: %s \n", ade.getName());
//System.out.printf(((AlignableDetectorElement)ade).getlocalToGlobal().toString()+"\n");
if (ade.getParent() != null) {
System.out.printf("The parent is: %s\n", ade.getParent().getName());
}
else {
System.out.printf("No parent. \n");
}
}
}
}

// Get the sensors subcomponents // This should be only HpsSiSensors
sensors = detectorElement.findDescendants(SiSensor.class);

if (!doCOMAlignment) {

//Assign the mothers to the sensors
//TODO FIX this part. For the moment the mother of the sensors are chosen by string parsing.
//TODO FIX this part. For the moment the mother of the sensors are chosen by string parsing.

MakeAlignmentTree("alignable_fullmodule");

//Dump the constrain file
Expand All @@ -478,6 +481,7 @@ protected void detectorChanged(Detector detector) {

@Override
protected void process(EventHeader event) {
int runNumber = event.getRunNumber();

//Track collection

Expand Down Expand Up @@ -882,11 +886,18 @@ else if (trackSide == 1 && !TrackUtils.isHoleTrack(track))
Collection<TrackerHit> hth = track.getTrackerHits();
List<TrackerHit> allHthList = TrackUtils.sortHits(hth);
Pair<Track, GBLKinkData> newTrack = MakeGblTracks.makeCorrectedTrack(fitTraj, TrackUtils.getHTF(track), allHthList, 0, bfield);


// Track refit failed
// Track refit failed
if (newTrack == null)
continue;


// Extrapolate to the ECAL and make a new trackState there.

Track gblTrk = newTrack.getFirst();
BaseTrackState ts_ecal = new BaseTrackState();
ts_ecal = TrackUtils.getTrackExtrapAtEcalRK(gblTrk, bFieldMap, runNumber);
gblTrk.getTrackStates().add(ts_ecal);

//To make sure that the track fit converged
if (writeMilleBinary) {
Expand All @@ -899,7 +910,7 @@ else if (trackSide == 1 && !TrackUtils.isHoleTrack(track))



Track gblTrk = newTrack.getFirst();


//System.out.println("DEBUG::Tom::Correct GBL track has "+gblTrk.getTrackerHits().size()+" hits");

Expand Down Expand Up @@ -1338,16 +1349,17 @@ private void MakeAlignmentTree(String regEx) {
}//loop on sensors



for (SiSensor sensor : sensors) {
if (((HpsSiSensor)sensor).getAdeMother() != null)
System.out.printf("DEBUG::PF::MakeAlignmentTree sensor %s has mother %s \n", sensor.getName(), ((HpsSiSensor)sensor).getAdeMother().getName());
}

for (AlignableDetectorElement ade : Alignabledes) {
System.out.printf("DEBUG::PF::MakeAlignmentTree ade %s has children \n %s \n", ade.getName(), ade.getChildren().toString());

}
if (debug_) {
for (SiSensor sensor : sensors) {
if (((HpsSiSensor)sensor).getAdeMother() != null)
System.out.printf("DEBUG::PF::MakeAlignmentTree sensor %s has mother %s \n", sensor.getName(), ((HpsSiSensor)sensor).getAdeMother().getName());
}

for (AlignableDetectorElement ade : Alignabledes) {
System.out.printf("DEBUG::PF::MakeAlignmentTree ade %s has children \n %s \n", ade.getName(), ade.getChildren().toString());

}
}
}

//Matching by name
Expand Down

0 comments on commit 83d4acf

Please sign in to comment.