43 MuFilter* MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter"));
48 Float_t timeResol = MuFilterDet->
GetConfParF(
"MuFilter/timeResol");
51 Float_t siPMcalibration=0;
52 Float_t siPMcalibrationS=0;
54 if (floor(detID/10000)==3) {
55 if (
nSides==2){attLength = MuFilterDet->
GetConfParF(
"MuFilter/DsAttenuationLength");}
56 else {attLength = MuFilterDet->
GetConfParF(
"MuFilter/DsTAttenuationLength");}
57 siPMcalibration = MuFilterDet->
GetConfParF(
"MuFilter/DsSiPMcalibration");
58 propspeed = MuFilterDet->
GetConfParF(
"MuFilter/DsPropSpeed");
61 if (floor(detID/10000)==1 &&
nSides==1){
63 attLength = 2*MuFilterDet->
GetConfParF(
"MuFilter/VandUpAttenuationLength");
65 else {attLength = MuFilterDet->
GetConfParF(
"MuFilter/VandUpAttenuationLength");}
66 siPMcalibration = MuFilterDet->
GetConfParF(
"MuFilter/VandUpSiPMcalibrationL");
67 siPMcalibrationS = MuFilterDet->
GetConfParF(
"MuFilter/VandUpSiPMcalibrationS");
68 propspeed = MuFilterDet->
GetConfParF(
"MuFilter/VandUpPropSpeed");
71 for (
unsigned int j=0; j<16; ++j){
75 LOG(DEBUG) <<
"detid "<<detID<<
" size "<<
nSiPMs<<
" side "<<
nSides;
78 Float_t signalLeft = 0;
79 Float_t signalRight = 0;
80 Float_t earliestToAL = 1E20;
81 Float_t earliestToAR = 1E20;
82 for(
auto p = std::begin(V); p!= std::end(V); ++p) {
84 Double_t signal = (*p)->GetEnergyLoss();
87 TVector3 vLeft,vRight;
88 TVector3 impact((*p)->GetX(),(*p)->GetY() ,(*p)->GetZ() );
90 Double_t distance_Left = (vLeft-impact).Mag();
91 Double_t distance_Right = (vRight-impact).Mag();
93 signalLeft+=signal/
nSides*TMath::Exp(-distance_Left/attLength);
94 signalRight+=signal/
nSides*TMath::Exp(-distance_Right/attLength);
97 Double_t ptime = (*p)->GetTime();
98 Double_t t_Left = ptime + distance_Left/propspeed;
99 Double_t t_Right = ptime + distance_Right/propspeed;
100 if ( t_Left <earliestToAL){earliestToAL = t_Left ;}
101 if ( t_Right <earliestToAR){earliestToAR = t_Right ;}
105 for (
unsigned int j=0; j<
nSiPMs; ++j){
106 if ( floor(detID/10000)==2 && (j==2 or j==5)){
108 times[j] = gRandom->Gaus(earliestToAL, timeResol);
111 times[j] = gRandom->Gaus(earliestToAL, timeResol);
115 times[j+
nSiPMs] = gRandom->Gaus(earliestToAR, timeResol);
119 for (Int_t i=0;i<16;i++){
fMasked[i]=kFALSE;}
120 LOG(DEBUG) <<
"signal created";
197 Float_t mean[] = {0,0};
198 Int_t count[] = {0,0};
200 for (
unsigned int s=0; s<
nSides; ++s){
201 for (
unsigned int j=0; j<
nSiPMs; ++j){
202 unsigned int channel = j+s*
nSiPMs;
203 if (
signals[channel]> 0 || !positive){
204 if (!
fMasked[channel] || !mask){
205 if (!
isShort(channel) || use_small_sipms){
206 mean[s] +=
times[channel];
213 if (count[0]>0 && count[1]>0) {
214 dT = mean[0]/count[0] - mean[1]/count[1];
221 Float_t first[] = {1E20,1E20};
223 for (
unsigned int s=0; s<
nSides; ++s){
224 for (
unsigned int j=0; j<
nSiPMs; ++j){
225 unsigned int channel = j+s*
nSiPMs;
226 if (
signals[channel]> 0 || !positive){
227 if (!
fMasked[channel] || !mask){
228 if (!
isShort(channel) || use_small_sipms){
229 if (
times[channel]<first[s]) {first[s] =
times[channel];}
235 if (first[0]<1E10 && first[1]<1E10) {
236 dT = first[0] - first[1];
245 Float_t mean[] = {0,0};
246 Int_t count[] = {0,0};
249 MuFilter* MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter"));
251 dL = MuFilterDet->
GetConfParF(
"MuFilter/DownstreamBarX") / MuFilterDet->
GetConfParF(
"MuFilter/DsPropSpeed");}
253 dL = MuFilterDet->
GetConfParF(
"MuFilter/UpstreamBarX") / MuFilterDet->
GetConfParF(
"MuFilter/VandUpPropSpeed");}
255 dL = MuFilterDet->
GetConfParF(
"MuFilter/VetoBarX") / MuFilterDet->
GetConfParF(
"MuFilter/VandUpPropSpeed");}
257 for (
unsigned int s=0; s<
nSides; ++s){
258 for (
unsigned int j=0; j<
nSiPMs; ++j){
259 unsigned int channel = j+s*
nSiPMs;
260 if (
signals[channel]> 0 || !positive){
261 if (!
fMasked[channel] || !mask){
262 if (!
isShort(channel) || use_small_sipms){
263 mean[s] +=
times[channel];
270 if (count[0]>0 && count[1]>0) {
271 dT = (mean[0]/count[0] + mean[1]/count[1])/2.*ShipUnit::snd_TDC2ns - dL/2.;
282 Float_t dT =
GetDeltaT(mask,positive,use_small_sipms);
287 MuFilter* MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter"));
288 Float_t bar_length = MuFilterDet->
GetConfParF(
"MuFilter/UpstreamBarX");
289 Float_t signal_speed = MuFilterDet->
GetConfParF(
"MuFilter/VandUpPropSpeed");
291 signal_speed = MuFilterDet->
GetConfParF(
"MuFilter/DsPropSpeed");
292 bar_length = MuFilterDet->
GetConfParF(
"MuFilter/DownstreamBarX");
295 bar_length = MuFilterDet->
GetConfParF(
"MuFilter/UpstreamBarX");
298 bar_length = MuFilterDet->
GetConfParF(
"MuFilter/VetoBarX");
300 double timeConversion = 1.;
301 if (!isMC) timeConversion = ShipUnit::snd_TDC2ns;
302 return 0.5*(bar_length + dT*timeConversion*signal_speed);