Skip to content

Commit

Permalink
Update of the ALERT ATOF labeling for sector/layer/component (#260)
Browse files Browse the repository at this point in the history
* Unused and confusing directory

* Updated reading of the geometry (cf. PR389 in CJ)

* Update for the indexing

* Update bank description
  • Loading branch information
N-Plx authored Dec 16, 2024
1 parent d333a7a commit 76c5f45
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 286 deletions.
8 changes: 4 additions & 4 deletions clas12/alert/atof/bank.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ sub define_bank


insert_bank_variable(\%configuration, $bankname, "bankid", $bankId, "Di", "$bankname bank ID");
insert_bank_variable(\%configuration, $bankname, "sector", 1, "Di", "sector ");
insert_bank_variable(\%configuration, $bankname, "layer", 2, "Di", "hipo layer is superlayer*10 + layer");
insert_bank_variable(\%configuration, $bankname, "component", 3, "Di", "paddle number");
insert_bank_variable(\%configuration, $bankname, "ADC_order", 4, "Di", "long paddles: 0/1 = Front/Back. Top paddles: set to 0");
insert_bank_variable(\%configuration, $bankname, "sector", 1, "Di", "sector");
insert_bank_variable(\%configuration, $bankname, "layer", 2, "Di", "layer");
insert_bank_variable(\%configuration, $bankname, "component", 3, "Di", "component");
insert_bank_variable(\%configuration, $bankname, "ADC_order", 4, "Di", "order");
insert_bank_variable(\%configuration, $bankname, "ADC_ADC", 5, "Di", "ADC integral from pulse fit");
insert_bank_variable(\%configuration, $bankname, "ADC_time" , 6, "Dd", "time from pulse fit");
insert_bank_variable(\%configuration, $bankname, "ADC_ped" , 7, "Di", "pedestal from pulse analysis");
Expand Down
64 changes: 32 additions & 32 deletions clas12/alert/atof/factory.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import GeoArgParse
def variation = GeoArgParse.getVariation(args);
def runNumber = GeoArgParse.getRunNumber(args);

// not really used at the moment
//Will be used when calibration constants are defined
DatabaseConstantProvider cp = new DatabaseConstantProvider(runNumber, variation);
//provider.loadTable("/geometry/cnd/cndgeom");
//ConstantProvider cp = GeometryFactory.getConstants(DetectorType.FTOF, runNumber, variation);

//MYFactory_ATOF factory = new MYFactory_ATOF();
AlertTOFFactory factory = new AlertTOFFactory();
Detector atof = factory.createDetectorCLAS(cp);

Expand All @@ -36,44 +35,48 @@ int nsectors = atof.getNumSectors();

//double ATOF_Z_length = 279.7; // mm, atof paddles total lenght in z

//15 ATOF sectors
for(int isec=0; isec<nsectors; isec++)
{
//Divided into SL=0/bottom/bar and SL=1/top/wedge
int nsuperlayers = atof.getSector(isec).getNumSuperlayers();
for(int isl=0; isl<nsuperlayers; isl++)
{
//Divided into 4 layers = quarters of sectors
int nlayers = atof.getSector(isec).getSuperlayer(isl).getNumLayers();
for(int ilay=0; ilay<nlayers; ilay++)
{
int ncomponents = atof.getSector(isec).getSuperlayer(isl).getLayer(ilay).getNumComponents();
//if(isec==0 && isl==0 && ilay==0) writer1 << "ahdc.layer.ncomponents | " << ncomponents << "\n";
//Components are z slices
int ncomponents = atof.getSector(isec).getSuperlayer(isl).getLayer(ilay).getNumComponents();
if(ncomponents!=0)
{
writer1 << "atof.sector" << isec << ".superlayer"<< isl << ".layer"<< ilay <<".ncomponents | " << ncomponents << "| na | number of counters in module | sergeyeva | [email protected] | none | none | 15 June 2020 \n";

for(int icomp=isec*4; icomp<isec*4+ncomponents; icomp++)
if(isl==0)
{
//Bottom bar not sliced in z index=10
Component comp = atof.getSector(isec).getSuperlayer(isl).getLayer(ilay).getComponent(10);
writer2<< gemcString(isec, isl, ilay, comp);
}
else
{
Component comp = atof.getSector(isec).getSuperlayer(isl).getLayer(ilay).getComponent(icomp);
writer2<< gemcString(isec, isl, ilay, comp);
for(int icomp=0; icomp<ncomponents; icomp++)
{
//Top wedge has 10 z slices
Component comp = atof.getSector(isec).getSuperlayer(isl).getLayer(ilay).getComponent(icomp);
writer2<< gemcString(isec, isl, ilay, comp);
}
}
}
}
}
}



writer1.close();
writer2.close();

// need to be updated with correct format for trapezoide
public String gemcString(int sector, int superlayer,int layer, Component comp) {
StringBuilder str = new StringBuilder();
/*
for (int ip = 0; ip < comp.getNumVolumePoints(); ip++) {
Point3D p = comp.getVolumePoint(ip);
str.append(String.format("%14.6f*cm | %14.6f*cm | %14.6f*cm ||", p.x(), p.y(), p.z()));
}
*/

// reading top face vertices of ATOF cell and storing their x,y coordinates
Point3D p0 = comp.getVolumePoint(0);
double top_x_0 = p0.x();
Expand Down Expand Up @@ -102,11 +105,8 @@ public String gemcString(int sector, int superlayer,int layer, Component comp) {
double bottom_y_7 = p7.y();

// component name should be added
str.append(String.format("sector%d_superlayer%d_layer%d_paddle%d | root", sector, superlayer, layer, (comp.getComponentId()+1)));

// Giving the origin point of coordinate system in which the trapezoide vertices are defined
//str.append(String.format("| %8.4f*mm %8.4f*mm %8.4f*mm | ", 0.0, 0.0, ((comp.getLine().midpoint().z()-15.0)-150.0+15.0))); // in mm

str.append(String.format("sector%d_superlayer%d_layer%d_paddle%d | root", sector, superlayer, layer, (comp.getComponentId())));

if(superlayer == 0)
{
str.append(String.format("| %8.4f*mm %8.4f*mm %8.4f*mm | ", 0.0, 0.0, ((comp.getLine().midpoint().z() - 279.7/2)))); // in mm
Expand Down Expand Up @@ -138,19 +138,19 @@ public String gemcString(int sector, int superlayer,int layer, Component comp) {

// need to be corrected according to geant4 volume definition

str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_0, top_y_0));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_1, top_y_1));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_2, top_y_2));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_3, top_y_3));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_0, top_y_0));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_1, top_y_1));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_2, top_y_2));
str.append(String.format("%14.6f*mm %14.6f*mm ", top_x_3, top_y_3));

str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_4, bottom_y_4));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_5, bottom_y_5));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_6, bottom_y_6));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_7, bottom_y_7));

str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_4, bottom_y_4));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_5, bottom_y_5));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_6, bottom_y_6));
str.append(String.format("%14.6f*mm %14.6f*mm ", bottom_x_7, bottom_y_7));
// currently only writing the component id but should save all necessary identifiers according to detector definition
str.append(" | ");
str.append(String.format("%d %d %d %d", sector, superlayer, layer, (comp.getComponentId()+1)));
str.append(String.format("%d %d %d %d", sector, superlayer, layer, (comp.getComponentId())));

str.append("\n");

Expand Down
64 changes: 37 additions & 27 deletions clas12/alert/atof/geometry_java.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,21 @@ sub makeATOF
# Sectors/superlayers/layers
sub build_sectors
{
# loop for sectors
for(my $s=0; $s<$nsectors; $s++)
# loop for sectors
for(my $s=0; $s<$nsectors; $s++)
{
# loop for superlayers in Z
for(my $z=0; $z<$nsuperlayers; $z++)
{
# loop for superlayers in Z
for(my $z=0; $z<$nsuperlayers; $z++)
{
if($z == 0)
{
$nlayers = 1;
}
if($z == 1)
{
$nlayers = 10;
}
# loop for layers in XY
for(my $l=0; $l<$nlayers; $l++)
{
$npaddles = $main::parameters{"atof.sector$s.superlayer$z.layer$l.ncomponents"};
build_paddles($s,$z,$l);
}
}
$nlayers = 4;
# loop for layers in XY
for(my $l=0; $l<$nlayers; $l++)
{
#$npaddles = $main::parameters{"atof.sector$s.superlayer$z.layer$l.ncomponents"};
build_paddles($s,$z,$l);
}
}
}
}

# Paddles for each sector/superlayer/layer
Expand All @@ -91,21 +84,38 @@ sub build_paddles
my $superlayer = shift;
my $layer = shift;
#my $mother = "atof_mother";
my $mother = "ahdc_mother";
my $mother = "ahdc_mother"; ##???

my $ncomponents = 10;
if($superlayer == 0)
{
$ncomponents = 1;
}

for(my $n=($sector*4+1); $n<=($sector*4+$npaddles); $n++)
for(my $n=0; $n<$ncomponents; $n++)
{
my %detector = init_det();

my $component=$n;
if($superlayer == 0)
{
$component = 10;
}

my $vname = "sector".$sector."_superlayer".$superlayer."_layer".$layer."_paddle".$n;
#print "Sector: $sector\n";
#print "SL: $superlayer\n";
#print "Layer: $layer\n";
#print "Component: $component\n";

my $vname = "sector".$sector."_superlayer".$superlayer."_layer".$layer."_paddle".$component;
$detector{"name"} = $vname;
$detector{"mother"} = $mother;
$detector{"pos"} = $positions->{$vname};
$detector{"rotation"} = $rotations->{$vname};
$detector{"type"} = $types->{$vname};
$detector{"dimensions"} = $dimensions->{$vname};
$detector{"description"} = "ATOFpaddle$n sector$sector superlayer$superlayer layer$layer";

$detector{"description"} = "ATOFpaddle$component sector$sector superlayer$superlayer layer$layer";
if($superlayer==0)
{
$detector{"color"} = "ff11aa";
Expand All @@ -114,15 +124,15 @@ sub build_paddles
{
if($superlayer==1) {$detector{"color"} = "00aa00";}
}

$detector{"material"} = "scintillator";
$detector{"mfield"} = "no";
$detector{"visible"} = 1;
$detector{"style"} = 1;
$detector{"sensitivity"} = "atof";
$detector{"hit_type"} = "atof";
# set the identifiers
$detector{"identifiers"} = "sector manual $sector superlayer manual $superlayer layer manual $layer paddle manual $n order manual 0";
$detector{"identifiers"} = "sector manual $sector superlayer manual $superlayer layer manual $layer paddle manual $component order manual 0";
print_det(\%main::configuration, \%detector);
}
}
Expand Down
10 changes: 0 additions & 10 deletions clas12/atof/aftof__bank.txt

This file was deleted.

1 change: 0 additions & 1 deletion clas12/atof/aftof__hit_default.txt

This file was deleted.

1 change: 0 additions & 1 deletion clas12/atof/aftof__materials_default.txt

This file was deleted.

76 changes: 0 additions & 76 deletions clas12/atof/atof.pl

This file was deleted.

41 changes: 0 additions & 41 deletions clas12/atof/bank.pl

This file was deleted.

23 changes: 0 additions & 23 deletions clas12/atof/config.dat

This file was deleted.

Loading

0 comments on commit 76c5f45

Please sign in to comment.