SND@LHC Software
Loading...
Searching...
No Matches
MuFilterHit Class Reference

#include <MuFilterHit.h>

Inheritance diagram for MuFilterHit:
Collaboration diagram for MuFilterHit:

Public Member Functions

 MuFilterHit ()
 
 MuFilterHit (Int_t detID)
 
 MuFilterHit (Int_t detID, Int_t nP, Int_t nS)
 
 MuFilterHit (const MuFilterHit &hit)=default
 
MuFilterHitoperator= (const MuFilterHit &hit)=default
 
 MuFilterHit (Int_t detID, std::vector< MuFilterPoint * >)
 
virtual ~MuFilterHit ()
 
void Print () const
 
Float_t GetEnergy (Bool_t use_small_sipms=kFALSE)
 
std::map< TString, Float_t > SumOfSignals (Bool_t mask=kTRUE)
 
std::map< Int_t, Float_t > GetAllSignals (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)
 
std::map< Int_t, Float_t > GetAllTimes (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)
 
Float_t GetDeltaT (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)
 
Float_t GetFastDeltaT (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)
 
Float_t GetImpactT (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)
 
Float_t GetImpactXpos (Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE, Bool_t isMC=kFALSE)
 
bool isValid () const
 
bool isMasked (Int_t i) const
 
void SetMasked (Int_t i)
 
int GetSystem ()
 
int GetPlane ()
 
bool isVertical ()
 
bool isShort (Int_t)
 
- Public Member Functions inherited from SndlhcHit
 SndlhcHit ()
 
 SndlhcHit (Int_t detID, Int_t nSiPMs=1, Int_t nSides=0)
 
virtual ~SndlhcHit ()
 
Int_t GetDetectorID () const
 
Float_t GetSignal (Int_t nChannel=0)
 
Float_t GetTime (Int_t nChannel=0)
 
Int_t GetnSiPMs () const
 
Int_t GetnSides () const
 
void SetDigi (Float_t s, Float_t t, Int_t i=0)
 
void SetDetectorID (Int_t detID)
 
void SetDaqID (Int_t i, Int_t k, Int_t board_id, Int_t tofpet_id, Int_t tofpet_channel)
 
Int_t GetBoardID (Int_t i)
 
Int_t GetTofpetID (Int_t i)
 
Int_t Getchannel (Int_t i)
 
Int_t GetRawHitIndex (Int_t i=0)
 
virtual void Print (const Option_t *opt="") const
 
virtual void GetPosition (TVector3 L, TVector3 R) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

 ClassDef (MuFilterHit, 6)
 masked signal
 

Private Attributes

Float_t flag
 flag
 
Float_t fMasked [16]
 

Additional Inherited Members

- Protected Member Functions inherited from SndlhcHit
 ClassDef (SndlhcHit, 2)
 encodes rawhitindex*100000+(board_id * 1000) + (tofpet_id * 100) + tofpet_channel
 
- Protected Attributes inherited from SndlhcHit
Int_t fDetectorID
 Detector unique identifier.
 
Int_t nSiPMs
 
Int_t nSides
 number of SiPMs per side
 
Float_t signals [16]
 number of sides
 
Float_t times [16]
 SiPM signal.
 
Int_t fDaqID [16]
 SiPM time.
 

Detailed Description

Definition at line 10 of file MuFilterHit.h.

Constructor & Destructor Documentation

◆ MuFilterHit() [1/5]

MuFilterHit::MuFilterHit ( )

Default constructor

Definition at line 13 of file MuFilterHit.cxx.

14 : SndlhcHit()
15{
16 flag = true;
17 for (Int_t i=0;i<16;i++){fMasked[i]=kFALSE;}
18}
Float_t fMasked[16]
Definition MuFilterHit.h:48
Float_t flag
flag
Definition MuFilterHit.h:47
int i
Definition ShipAna.py:86

◆ MuFilterHit() [2/5]

MuFilterHit::MuFilterHit ( Int_t  detID)
explicit

Definition at line 20 of file MuFilterHit.cxx.

21 : SndlhcHit(detID)
22{
23 flag = true;
24 for (Int_t i=0;i<16;i++){fMasked[i]=kFALSE;}
25}

◆ MuFilterHit() [3/5]

MuFilterHit::MuFilterHit ( Int_t  detID,
Int_t  nP,
Int_t  nS 
)

Constructor with detector id, number of SiPMs per side, number of sides

Definition at line 26 of file MuFilterHit.cxx.

27 : SndlhcHit(detID,nP,nS)
28{
29 flag = true;
30 for (Int_t i=0;i<16;i++){
31 fMasked[i]=kFALSE;
32 signals[i] = -999;
33 times[i] = -999;
34 fDaqID[i] = -1;
35 }
36}
Float_t times[16]
SiPM signal.
Definition SndlhcHit.h:76
Int_t fDaqID[16]
SiPM time.
Definition SndlhcHit.h:77
Float_t signals[16]
number of sides
Definition SndlhcHit.h:75

◆ MuFilterHit() [4/5]

MuFilterHit::MuFilterHit ( const MuFilterHit hit)
default

◆ MuFilterHit() [5/5]

MuFilterHit::MuFilterHit ( Int_t  detID,
std::vector< MuFilterPoint * >  V 
)

Definition at line 40 of file MuFilterHit.cxx.

41 : SndlhcHit()
42{
43 MuFilter* MuFilterDet = dynamic_cast<MuFilter*> (gROOT->GetListOfGlobals()->FindObject("MuFilter"));
44 // get parameters from the MuFilter detector for simulating the digitized information
45 nSiPMs = MuFilterDet->GetnSiPMs(detID);
46 nSides = MuFilterDet->GetnSides(detID);
47
48 Float_t timeResol = MuFilterDet->GetConfParF("MuFilter/timeResol");
49
50 Float_t attLength=0;
51 Float_t siPMcalibration=0;
52 Float_t siPMcalibrationS=0;
53 Float_t propspeed =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");
59 }
60 else {
61 if (floor(detID/10000)==1 && nSides==1){
62 // top readout with mirror on bottom
63 attLength = 2*MuFilterDet->GetConfParF("MuFilter/VandUpAttenuationLength");
64 }
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");
69 }
70
71 for (unsigned int j=0; j<16; ++j){
72 signals[j] = -1;
73 times[j] =-1;
74 }
75 LOG(DEBUG) << "detid "<<detID<< " size "<<nSiPMs<< " side "<<nSides;
76
77 fDetectorID = detID;
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) {
83
84 Double_t signal = (*p)->GetEnergyLoss();
85
86 // Find distances from MCPoint centre to ends of bar
87 TVector3 vLeft,vRight;
88 TVector3 impact((*p)->GetX(),(*p)->GetY() ,(*p)->GetZ() );
89 MuFilterDet->GetPosition(fDetectorID,vLeft, vRight);
90 Double_t distance_Left = (vLeft-impact).Mag();
91 Double_t distance_Right = (vRight-impact).Mag();
92 // Simple model: divide signal between nSides
93 signalLeft+=signal/nSides*TMath::Exp(-distance_Left/attLength);
94 signalRight+=signal/nSides*TMath::Exp(-distance_Right/attLength);
95
96 // for the timing, find earliest particle and smear with time resolution
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 ;}
102 }
103 // shortSiPM = {3,6,11,14,19,22,27,30,35,38,43,46,51,54,59,62,67,70,75,78}; - counting from 1!
104 // In the SndlhcHit class the 'signals' array starts from 0.
105 for (unsigned int j=0; j<nSiPMs; ++j){
106 if ( floor(detID/10000)==2 && (j==2 or j==5)){ // only US has small SiPMs
107 signals[j] = signalLeft/float(nSiPMs) * siPMcalibrationS; // most simplest model, divide signal individually. Small SiPMS special: set signal to zero
108 times[j] = gRandom->Gaus(earliestToAL, timeResol);
109 }else{
110 signals[j] = signalLeft/float(nSiPMs) * siPMcalibration; // most simplest model, divide signal individually.
111 times[j] = gRandom->Gaus(earliestToAL, timeResol);
112 }
113 if (nSides>1){
114 signals[j+nSiPMs] = signalRight/float(nSiPMs) * siPMcalibration; // most simplest model, divide signal individually.
115 times[j+nSiPMs] = gRandom->Gaus(earliestToAR, timeResol);
116 }
117 }
118 flag = true;
119 for (Int_t i=0;i<16;i++){fMasked[i]=kFALSE;}
120 LOG(DEBUG) << "signal created";
121}
Int_t GetnSides(Int_t detID)
Definition MuFilter.cxx:715
void GetPosition(Int_t id, TVector3 &vLeft, TVector3 &vRight)
Definition MuFilter.cxx:639
Int_t GetnSiPMs(Int_t detID)
Definition MuFilter.cxx:708
Float_t GetConfParF(TString name)
Definition MuFilter.h:46
Int_t nSiPMs
Definition SndlhcHit.h:73
Int_t fDetectorID
Detector unique identifier.
Definition SndlhcHit.h:72
Int_t nSides
number of SiPMs per side
Definition SndlhcHit.h:74

◆ ~MuFilterHit()

MuFilterHit::~MuFilterHit ( )
virtual

Destructor

Definition at line 124 of file MuFilterHit.cxx.

124{ }

Member Function Documentation

◆ ClassDef()

MuFilterHit::ClassDef ( MuFilterHit  ,
 
)
private

masked signal

◆ GetAllSignals()

std::map< Int_t, Float_t > MuFilterHit::GetAllSignals ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE 
)

Definition at line 155 of file MuFilterHit.cxx.

156{
157 std::map<Int_t,Float_t> allSignals;
158 for (unsigned int s=0; s<nSides; ++s){
159 for (unsigned int j=0; j<nSiPMs; ++j){
160 unsigned int channel = j+s*nSiPMs;
161 if (signals[channel]<-900){continue;}
162 if (signals[channel]> 0 || !positive){
163 if (!fMasked[channel] || !mask){
164 if (!isShort(channel) || use_small_sipms){
165 allSignals[channel] = signals[channel];
166 }
167 }
168 }
169 }
170 }
171 return allSignals;
172}
bool isShort(Int_t)

◆ GetAllTimes()

std::map< Int_t, Float_t > MuFilterHit::GetAllTimes ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE 
)

Definition at line 175 of file MuFilterHit.cxx.

176{
177 std::map<Int_t,Float_t> allTimes;
178 for (unsigned int s=0; s<nSides; ++s){
179 for (unsigned int j=0; j<nSiPMs; ++j){
180 unsigned int channel = j+s*nSiPMs;
181 if (signals[channel]> 0 || !positive){
182 if (!fMasked[channel] || !mask){
183 if (!isShort(channel) || use_small_sipms){
184 allTimes[channel] = times[channel];
185 }
186 }
187 }
188 }
189 }
190 return allTimes;
191}

◆ GetDeltaT()

Float_t MuFilterHit::GetDeltaT ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE 
)

Definition at line 194 of file MuFilterHit.cxx.

196{
197 Float_t mean[] = {0,0};
198 Int_t count[] = {0,0};
199 Float_t dT = -999.;
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];
207 count[s] += 1;
208 }
209 }
210 }
211 }
212 }
213 if (count[0]>0 && count[1]>0) {
214 dT = mean[0]/count[0] - mean[1]/count[1];
215 }
216 return dT;
217}

◆ GetEnergy()

Float_t MuFilterHit::GetEnergy ( Bool_t  use_small_sipms = kFALSE)

Definition at line 128 of file MuFilterHit.cxx.

129{
130 // to be calculated from digis and calibration constants, missing!
131 Float_t E = 0;
132 for (unsigned int j=0; j<nSiPMs; ++j){
133 if (!use_small_sipms && isShort(j)) continue; // remove small SiPMs
134 E+=signals[j];
135 if (nSides>1){ E+=signals[j+nSiPMs];}
136 }
137 return E;
138}

◆ GetFastDeltaT()

Float_t MuFilterHit::GetFastDeltaT ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE 
)

Definition at line 218 of file MuFilterHit.cxx.

220{
221 Float_t first[] = {1E20,1E20};
222 Float_t dT = -999.;
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];}
230 }
231 }
232 }
233 }
234 }
235 if (first[0]<1E10 && first[1]<1E10) {
236 dT = first[0] - first[1];
237 }
238 return dT;
239}

◆ GetImpactT()

Float_t MuFilterHit::GetImpactT ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE 
)

Definition at line 243 of file MuFilterHit.cxx.

244{
245 Float_t mean[] = {0,0};
246 Int_t count[] = {0,0};
247 Float_t dT = -999.;
248 Float_t dL;
249 MuFilter* MuFilterDet = dynamic_cast<MuFilter*> (gROOT->GetListOfGlobals()->FindObject("MuFilter"));
250 if (GetSystem()==3) {
251 dL = MuFilterDet->GetConfParF("MuFilter/DownstreamBarX") / MuFilterDet->GetConfParF("MuFilter/DsPropSpeed");}
252 else if (GetSystem()==2) {
253 dL = MuFilterDet->GetConfParF("MuFilter/UpstreamBarX") / MuFilterDet->GetConfParF("MuFilter/VandUpPropSpeed");}
254 else {
255 dL = MuFilterDet->GetConfParF("MuFilter/VetoBarX") / MuFilterDet->GetConfParF("MuFilter/VandUpPropSpeed");}
256
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];
264 count[s] += 1;
265 }
266 }
267 }
268 }
269 }
270 if (count[0]>0 && count[1]>0) {
271 dT = (mean[0]/count[0] + mean[1]/count[1])/2.*ShipUnit::snd_TDC2ns - dL/2.; // TDC to ns = 6.25
272 }
273 return dT;
274}
int GetSystem()
Definition MuFilterHit.h:41

◆ GetImpactXpos()

Float_t MuFilterHit::GetImpactXpos ( Bool_t  mask = kTRUE,
Bool_t  positive = kTRUE,
Bool_t  use_small_sipms = kFALSE,
Bool_t  isMC = kFALSE 
)

Definition at line 277 of file MuFilterHit.cxx.

278{
279 if ( nSides!=2 ){
280 return -999.;
281 }
282 Float_t dT = GetDeltaT(mask,positive,use_small_sipms);
283 if (dT==-999.){
284 return -999.;
285 }
286
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");
290 if (GetSystem()==3) {
291 signal_speed = MuFilterDet->GetConfParF("MuFilter/DsPropSpeed");
292 bar_length = MuFilterDet->GetConfParF("MuFilter/DownstreamBarX");
293 }
294 else if (GetSystem()==2) {
295 bar_length = MuFilterDet->GetConfParF("MuFilter/UpstreamBarX");
296 }
297 else {
298 bar_length = MuFilterDet->GetConfParF("MuFilter/VetoBarX");
299 }
300 double timeConversion = 1.;
301 if (!isMC) timeConversion = ShipUnit::snd_TDC2ns;
302 return 0.5*(bar_length + dT*timeConversion*signal_speed);
303}
Float_t GetDeltaT(Bool_t mask=kTRUE, Bool_t positive=kTRUE, Bool_t use_small_sipms=kFALSE)

◆ GetPlane()

int MuFilterHit::GetPlane ( )
inline

Definition at line 42 of file MuFilterHit.h.

42{return int(fDetectorID/1000)%10;}

◆ GetSystem()

int MuFilterHit::GetSystem ( )
inline

Definition at line 41 of file MuFilterHit.h.

41{return floor(fDetectorID/10000);}

◆ isMasked()

bool MuFilterHit::isMasked ( Int_t  i) const
inline

Definition at line 39 of file MuFilterHit.h.

39{return fMasked[i];}

◆ isShort()

bool MuFilterHit::isShort ( Int_t  i)

Definition at line 148 of file MuFilterHit.cxx.

148 {
149 // only US has short SiPMs
150 if (GetSystem()==2 && (i%8==2 || i%8==5)) {return kTRUE;}
151 else{return kFALSE;}
152}

◆ isValid()

bool MuFilterHit::isValid ( ) const
inline

Definition at line 38 of file MuFilterHit.h.

38{return flag;}

◆ isVertical()

bool MuFilterHit::isVertical ( )

Definition at line 140 of file MuFilterHit.cxx.

140 {
141 if ( (GetSystem()==3&&fDetectorID%1000>59) ||
142 (GetSystem()==1&&GetPlane()==2) ) {
143 return kTRUE;
144 }
145 else{return kFALSE;}
146}
int GetPlane()
Definition MuFilterHit.h:42

◆ operator=()

MuFilterHit & MuFilterHit::operator= ( const MuFilterHit hit)
default

◆ Print()

void MuFilterHit::Print ( ) const

Output to screen

Definition at line 342 of file MuFilterHit.cxx.

343{
344 std::cout << "-I- MuFilterHit: MuFilter hit " << " in detector " << fDetectorID;
345
346 if ( floor(fDetectorID/10000)==3&&fDetectorID%1000>59) {
347 std::cout << " with vertical bars"<<std::endl;
348 std::cout << "top digis:";
349 for (unsigned int j=0; j<nSiPMs; ++j){
350 std::cout << signals[j] <<" ";
351 }
352 }else{
353 std::cout << " with horizontal bars"<<std::endl;
354 for (unsigned int s=0; s<nSides; ++s){
355 if (s==0) {std::cout << "left digis:";}
356 else {std::cout << "right digis:";}
357 for (unsigned int j=0; j<nSiPMs; ++j){
358 std::cout << signals[j] <<" ";
359 }
360 }
361 }
362std::cout << std::endl;
363}

◆ SetMasked()

void MuFilterHit::SetMasked ( Int_t  i)
inline

Definition at line 40 of file MuFilterHit.h.

40{fMasked[i]=kTRUE;}

◆ SumOfSignals()

std::map< TString, Float_t > MuFilterHit::SumOfSignals ( Bool_t  mask = kTRUE)

Definition at line 305 of file MuFilterHit.cxx.

306{
307/* use cases, for Veto and DS small/large ignored
308 sum of signals left large SiPM: LL
309 sum of signals right large SiPM: RL
310 sum of signals left small SiPM: LS
311 sum of signals right small SiPM: RS
312 sum of signals left and right:
313*/
314 Float_t theSumL = 0;
315 Float_t theSumR = 0;
316 Float_t theSumLS = 0;
317 Float_t theSumRS = 0;
318 for (unsigned int s=0; s<nSides; ++s){
319 for (unsigned int j=0; j<nSiPMs; ++j){
320 unsigned int channel = j+s*nSiPMs;
321 if (signals[channel]> 0){ // makes sense to sum up positive signals only
322 if (!fMasked[channel] || !mask){
323 if (s==0 and !isShort(j)){theSumL+= signals[channel];}
324 if (s==0 and isShort(j)){theSumLS+= signals[channel];}
325 if (s==1 and !isShort(j)){theSumR+= signals[channel];}
326 if (s==1 and isShort(j)){theSumRS+= signals[channel];}
327 }
328 }
329 }
330 }
331 std::map<TString,Float_t> sumSignals;
332 sumSignals["SumL"]=theSumL;
333 sumSignals["SumR"]=theSumR;
334 sumSignals["SumLS"]=theSumLS;
335 sumSignals["SumRS"]=theSumRS;
336 sumSignals["Sum"]=theSumL+theSumR;
337 sumSignals["SumS"]=theSumLS+theSumRS;
338 return sumSignals;
339}

Member Data Documentation

◆ flag

Float_t MuFilterHit::flag
private

flag

Definition at line 47 of file MuFilterHit.h.

◆ fMasked

Float_t MuFilterHit::fMasked[16]
private

Definition at line 48 of file MuFilterHit.h.


The documentation for this class was generated from the following files: