Skip to content

Commit 8269a1a

Browse files
committed
Adding the first files
1 parent 1c12546 commit 8269a1a

12 files changed

+2332
-0
lines changed

CBC/CBC-tb2011

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# MPV = 19100
4+
# Noise = 950
5+
# 6036, 16876 electrons thres
6+
# 7 um resolution telescope
7+
# 300 um thick
8+
# 80 um pitch
9+
# TB2012
10+
# crosstalk=8% (each side) = 16% (total)
11+
# <cluster width> = ??
12+
# res1 = ??
13+
# res2 = ??
14+
15+
16+
../bin/clustersim --maxangle=40 --chargedensity=63.7 --driftzone=60 --thickness=300 --saturation=1000 --adcbits=10 --pitch=134.4 --noiserms=950 --crosstalk=.16 --telescoperesolution=10 \
17+
--angle=0 --threshold=5470 --tag=TB2011_530mV_0deg binarySignal --tag=TB2011_530mV_0deg binErrorScan
18+

CBC/CBC-tb2012

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# MPV = 19100
4+
# Noise = 950
5+
# 6036, 16876 electrons thres
6+
# 7 um resolution telescope
7+
# 300 um thick
8+
# 80 um pitch
9+
# TB2012
10+
# crosstalk=8% (each side) = 16% (total)
11+
# <cluster width> = ??
12+
# res1 = ??
13+
# res2 = ??
14+
15+
../bin/clustersim --maxangle=40 --chargedensity=63.7 --driftzone=20 --thickness=300 --saturation=1000 --adcbits=10 --pitch=80 --noiserms=950 --crosstalk=.16 --telescoperesolution=7 \
16+
--angle=0 --threshold=5470 --tag=TB2012_530mV_0deg binarySignal \
17+
--angle=0 --threshold=16116 --tag=TB2012_610mV_0deg binarySignal \
18+
--angle=30 --threshold=5470 --tag=TB2012_530mV_30deg binarySignal \
19+
--angle=0 --threshold=4139 --tag=TB2012_520mV_0deg binarySignal \
20+
--angle=0 --threshold=6800 --tag=TB2012_540mV_0deg binarySignal \
21+
--angle=0 --threshold=8131 --tag=TB2012_550mV_0deg binarySignal \
22+
--angle=0 --threshold=10793 --tag=TB2012_570mV_0deg binarySignal \
23+
--angle=0 --threshold=21439 --tag=TB2012_650mV_0deg binarySignal \
24+
--threshold=5470 --tag=TB2012_530mV_STD_TelescopeON binErrorScan \
25+
--tag=TB2012_530mV_STD_Intrinsic --telescoperesolution=0 binErrorScan \
26+
--tag=TB2012_530mV_alternate_TelescopeON --driftzone=40 --telescoperesolution=15 binErrorScan \
27+
--tag=TB2012_530mV_alternate_Intrinsic --telescoperesolution=0 binErrorScan

CBC/getResolutions

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
mvList="520 530 540 550 570 610 650"
4+
fileList=""
5+
6+
reso=`cat antani | grep Residuals | grep _0deg`
7+
for i in $mvList; do
8+
echo "$i" > /tmp/$i.txt
9+
echo "$reso" | grep "${i}mV" | gawk '{print $8}' >> /tmp/$i.txt
10+
fileList="$fileList /tmp/$i.txt"
11+
done
12+
13+
paste $fileList

CBC/inefficiencyPlots.cpp

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
const int nMv = 4;
3+
int mvList[nMv] = {530, 570, 610, 650};
4+
TProfile* mvProfiles[nMv];
5+
6+
void inefficiencyPlots() {
7+
char filename[1024];
8+
TFile* myFile;
9+
TCanvas* myCanvas;
10+
TObject* myObject;
11+
for (int i=0; i<nMv; ++i) {
12+
sprintf(filename, "clusterWidthImpact_TB2012_%dmV_0deg.root", mvList[i]);
13+
myFile = new TFile(filename, "READ");
14+
if (myFile) {
15+
std::cout << filename << " opened"<< std::endl;
16+
myCanvas = (TCanvas*) myFile->GetObjectChecked("c1", "TCanvas");
17+
if (myCanvas) {
18+
myObject = myCanvas->GetPrimitive("clusterSizeHisto0");
19+
if ((myObject)&&(std::string(myObject->ClassName())=="TProfile")) {
20+
mvProfiles[i] = new TProfile(*(TProfile*) myObject);
21+
std::cout << mvProfiles[i]->GetName() << std::endl;
22+
}
23+
}
24+
}
25+
}
26+
27+
myCanvas = new TCanvas("myCanvas", "Inefficiency", 600, 600);
28+
gStyle->SetOptStat(0);
29+
std::string plotOpt = "l HIST";
30+
for (int i=0; i<nMv; ++i) {
31+
for (int iBin=1; iBin<=mvProfiles[i]->GetNbinsX(); ++iBin) {
32+
mvProfiles[i]->SetBinContent(iBin,(1-mvProfiles[i]->GetBinContent(iBin))*
33+
mvProfiles[i]->GetBinEntries(iBin) );
34+
}
35+
std::cout << mvProfiles[i]->GetName() << std::endl;
36+
if (i<=1) mvProfiles[i]->SetLineColor(kRed);
37+
else if (i==2) mvProfiles[i]->SetLineColor(kBlue);
38+
else if (i==3) mvProfiles[i]->SetLineColor(kGreen);
39+
mvProfiles[i]->SetTitle(";Interstrip Position [pitch];Efficiency");
40+
mvProfiles[i]->Draw(plotOpt.c_str());
41+
mvProfiles[i]->GetYaxis()->SetRangeUser(0,1);
42+
plotOpt="same l HIST";
43+
}
44+
myCanvas->SaveAs("eff.png");
45+
}

HPK/HPK

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# MPV = 14700
4+
# Noise = 500
5+
# 2000 to 20000 electrons Thres
6+
# 6 um resolution telescope
7+
# 320 um thick
8+
# 80 um pitch
9+
# FZ 320 N
10+
# <cluster width> = 1.18
11+
# res1 = 25
12+
# res2 = 23
13+
../bin/clustersim --maxangle=40 --chargedensity=45.9375 --driftzone=20 --thickness=320 --saturation=10000 --adcbits=10 --pitch=80 --noiserms=500 --crosstalk=.08 --angle=0 --threshold=3000 --telescoperesolution=10 --tag=FZ320N binarySignal --tag=FZ320N binErrorScan
14+
15+
16+
# MPV = ?
17+
# Noise = ?
18+
# 2000 to 20000 electrons Thres
19+
# 6 um resolution telescope
20+
# 200 um thick
21+
# 80 um pitch

MPA/MPA

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
../bin/clustersim --maxangle=40 --chargedensity=70 --driftzone=20 --thickness=200 --saturation=30000 --adcbits=10 --pitch=100 --noiserms=220 --crosstalk=.12 --angle=0 --threshold=3744 --telescoperesolution=0 --tag=MPA binarySignal --tag=MPA_20um binErrorScan
4+
5+
../bin/clustersim --maxangle=40 --chargedensity=70 --driftzone=99.99 --thickness=200 --saturation=30000 --adcbits=10 --pitch=100 --noiserms=220 --crosstalk=.12 --angle=0 --threshold=3744 --telescoperesolution=0 --tag=MPA_maxDrift binarySignal --tag=MPA_maxDrift binErrorScan

Makefile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
ROOTFLAGS=`root-config --cflags`
3+
ROOTLIBDIR=`root-config --libdir`
4+
ROOTLIBFLAGS=`root-config --libs`
5+
INCLUDEFLAGS=-Iinclude
6+
7+
COMP=g++ $(INCLUDEFLAGS) -ggdb -fpermissive
8+
9+
all: bin/clustersim
10+
11+
lib/Palette.o: src/Palette.cpp include/Palette.h
12+
$(COMP) $(ROOTFLAGS) -c -o lib/Palette.o src/Palette.cpp
13+
14+
lib/sensor.o: src/sensor.cpp include/sensor.h
15+
$(COMP) $(ROOTFLAGS) -c -o lib/sensor.o src/sensor.cpp
16+
17+
bin/clustersim: src/clustersim.cpp lib/sensor.o lib/Palette.o
18+
$(COMP) $(ROOTFLAGS) lib/Palette.o lib/sensor.o src/clustersim.cpp $(ROOTLIBFLAGS) -o bin/clustersim
19+
20+
clean:
21+
rm -f include/*~ *~ lib/* bin/clustersim
22+
23+
cleandata:
24+
rm -f *.png *.root
25+
26+
install: bin/clustersim
27+
cp bin/clustersim ~/bin

include/Palette.h

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef palette_h
2+
#define palette_h
3+
4+
#include <TColor.h>
5+
#include <TROOT.h>
6+
#include <iostream>
7+
#include <string>
8+
#include <map>
9+
10+
class Palette {
11+
public:
12+
static Color_t Color(const unsigned int& plotIndex);
13+
};
14+
15+
#endif

include/sensor.h

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
#ifndef _SENSOR_H_
2+
#define _SENSOR_H_
3+
4+
#include <vector>
5+
#include <time.h>
6+
#include <TRandom3.h>
7+
#include <cmath>
8+
#include <cstdlib>
9+
10+
#define RANDOM_SEED 42
11+
12+
typedef std::vector<double> digiV;
13+
14+
extern inline int maxValue(int a, int b) {
15+
return a > b ? a : b;
16+
}
17+
18+
// The following parameter determines how many tracks left and right the good one
19+
// will be generated to simulate the charge drift
20+
#define DRIFT_WING 1 // n left and n right
21+
#define N_TRACCE ((2*DRIFT_WING)+1)
22+
23+
class Sensor {
24+
public:
25+
enum { blockSharing, linearSharing, nSharing };
26+
27+
private:
28+
TRandom3 myDice;
29+
int trackHitElement_old(double impact, double theta, digiV &result);
30+
void trackHitElement_old2(double& x, double& y, double theta, double& prevCharge, double& thisCharge, double& nextCharge);
31+
void trackHitElement(double& x, double& y, double theta, double& prevCharge, double& thisCharge, double& nextCharge);
32+
double wallHit(double x, double y, double theta, double width, double height, double& x1, double& y1);
33+
double landau(double mpv);
34+
double stripNoise();
35+
digiV myDigis_;
36+
double pitch_;
37+
double chargeDensity_;
38+
double saturation_;
39+
int adcBits_;
40+
double driftZone_;
41+
double transverseDrift_;
42+
double thickness_;
43+
double eta_;
44+
double etaZs_;
45+
double seed_cut_;
46+
double neighbour_cut_;
47+
double total_cut_;
48+
double noise_rms_;
49+
double xTalk_l_;
50+
double xTalk_c_;
51+
double xTalk_r_;
52+
double rndmXTalk_l_;
53+
double rndmXTalk_c_;
54+
double rndmXTalk_r_;
55+
double binaryThreshold_;
56+
unsigned int sharingMethod_;
57+
58+
// Landau with parameter expressed
59+
// in units of MPV
60+
double landauWidth_;
61+
62+
// Default parameters in the sensor simulation
63+
static const double defaultPitch = 80.;
64+
static const double defaultTransverseDrift = 0.; // Obsolete. do not use
65+
static const double defaultDriftZone = 10.;
66+
static const double defaultThickness = 200.;
67+
static const double defaultChargeDensity = 0.3;
68+
static const double defaultSaturation = 135;
69+
static const int defaultAdcBits = 4;
70+
static const double defaultNoiseRms = 4.;
71+
static const double defaultSeedCut = 4.;
72+
static const double defaultNeighbourCut = 3.;
73+
static const double defaultTotalCut = 5.; // Unused
74+
static const double defaultRndmXTalkL = 0.00; // Fraction of charge that can randomly cross talk between strips
75+
static const double defaultRndmXTalkC = 1.00; // Fraction of charge that can randomly cross talk between strips
76+
static const double defaultRndmXTalkR = 0.00; // Fraction of charge that can randomly cross talk between strips
77+
static const double defaultXTalkL = 0.10; // Cross talk between strips
78+
static const double defaultXTalkC = 0.80; // each strip shares 20% of its charge
79+
static const double defaultXTalkR = 0.10; // with the neighbours TODO: make this adjustable
80+
static const double defaultLandauWidth = 0.08; // width is MPV/12.5
81+
static const double defaultBinaryThreshold = 16; // width is MPV/12.5
82+
static const unsigned int defaultSharingMethod = linearSharing; // All charge released proportionally to the distance (within charge sharing zone)
83+
84+
85+
// Simulation parameters
86+
static const int cycle_gauss = 5; // Number of flat distributions used to simulate a Gaussian
87+
88+
public:
89+
// Constructors and destructor
90+
~Sensor();
91+
Sensor();
92+
Sensor(double thickness, double pitch, double chargeDensity, double transverseDrift);
93+
Sensor(double thickness, double pitch, double chargeDensity, double transverseDrift, double, double, double, double);
94+
95+
96+
// Creates digi correspondent to a specific angle/impact point
97+
int trackHit_old(double impact, double theta); // old: deprecated
98+
int trackHit(double impact, double theta);
99+
100+
// pure binary cluster search
101+
bool binaryCluster(int& nStrip, int& clusterWidth, const bool& onlyLeading, double& baricenter, double& baricenter_ext, double& totalCharge);
102+
103+
104+
// Compute cluster on the present digi
105+
// it reports the number of strips involved and the total
106+
// (digitised) charge of the cluster
107+
void clusterize(int& nClus, int& totCharge);
108+
109+
// Modifies the digi according to the cross-talk
110+
void crossTalk();
111+
112+
// Get the eta produced by the last clusterizing
113+
// Computed on raw data, or zero-suppressed
114+
double getEta();
115+
double getEtaZs();
116+
117+
// Parameter get
118+
double getNoiseRms() { return noise_rms_; };
119+
double getThickness() { return thickness_; };
120+
double getPitch() { return pitch_; };
121+
double getChargeDensity() { return chargeDensity_; };
122+
double getSaturation() { return saturation_; };
123+
int getAdcBits() { return adcBits_; };
124+
double getTransverseDrift() { return transverseDrift_; }; // obsolete. do not use
125+
double getDriftZone() { return driftZone_*2; };
126+
double getSeedCut() { return seed_cut_; };
127+
double getNeighbourCut() { return neighbour_cut_; };
128+
double getTotalCut() { return total_cut_; };
129+
double getXTalk() { return (1-xTalk_c_); };
130+
double getRndmXTalk() { return (1-rndmXTalk_c_); };
131+
double getLandauWidth() { return landauWidth_; }
132+
double getBinaryThreshold() { return binaryThreshold_; }
133+
134+
// Parameter set
135+
bool setSharingMethod(unsigned int newValue);
136+
void setNoiseRms(double newValue) { noise_rms_ = newValue; };
137+
void setThickness(double newValue) { thickness_ = newValue; };
138+
void setPitch(double newValue) { pitch_ = newValue; };
139+
void setChargeDensity(double newValue) { chargeDensity_ = newValue; };
140+
void setSaturation(double newValue) { saturation_ = newValue; };
141+
void setAdcBits(int newValue) { adcBits_ = newValue; };
142+
void setTransverseDrift(double newValue) { transverseDrift_ = newValue; }; // obsolete. do not use
143+
void setDriftZone(double newValue) { driftZone_ = newValue/2; };
144+
void setSeedCut(double newValue) { seed_cut_ = newValue; };
145+
void setNeighbourCut(double newValue) { neighbour_cut_ = newValue; };
146+
void setTotalCut(double newValue) { total_cut_ = newValue; };
147+
void setXTalk(double newValue) {
148+
if ((newValue>=0)&&(newValue<=1)) {
149+
xTalk_c_ = 1 - newValue;
150+
xTalk_r_ = newValue/2.;
151+
xTalk_l_ = newValue/2.;
152+
}
153+
}
154+
void setRndmXTalk(double newValue) {
155+
if ((newValue>=0)&&(newValue<=1)) {
156+
rndmXTalk_c_ = 1 - newValue;
157+
rndmXTalk_r_ = newValue/2.;
158+
rndmXTalk_l_ = newValue/2.;
159+
}
160+
}
161+
void setLandauWidth(double newValue) { landauWidth_ = newValue; }
162+
double setBinaryThreshold(const double& newValue ) { binaryThreshold_ = newValue; }
163+
void addNeighbourNoise(int nStrips);
164+
165+
void printDigis() {
166+
for (int i=0; i<myDigis_.size(); ++i) std::cerr << myDigis_[i] <<", ";
167+
std::cerr << std::endl;
168+
}
169+
};
170+
171+
172+
173+
#endif

0 commit comments

Comments
 (0)