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 ()
 
Float_t SumOfSignals (char *opt, Bool_t mask=kTRUE)
 
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)
 
std::map< Int_t, Float_t > GetAllTimes (Bool_t mask=kTRUE)
 
Float_t GetDeltaT (Bool_t mask=kTRUE)
 
Float_t GetFastDeltaT (Bool_t mask=kTRUE)
 
Float_t GetImpactT (Bool_t mask=kTRUE)
 
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/VandUpSiPMcalibration");
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
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 
)

Definition at line 153 of file MuFilterHit.cxx.

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

◆ GetAllTimes()

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

Definition at line 171 of file MuFilterHit.cxx.

172{
173 std::map<Int_t,Float_t> allTimes;
174 for (unsigned int s=0; s<nSides; ++s){
175 for (unsigned int j=0; j<nSiPMs; ++j){
176 unsigned int channel = j+s*nSiPMs;
177 if (signals[channel]> 0){
178 if (!fMasked[channel] || !mask){
179 allTimes[channel] = times[channel];
180 }
181 }
182 }
183 }
184 return allTimes;
185}

◆ GetDeltaT()

Float_t MuFilterHit::GetDeltaT ( Bool_t  mask = kTRUE)

Definition at line 188 of file MuFilterHit.cxx.

190{
191 Float_t mean[] = {0,0};
192 Int_t count[] = {0,0};
193 Float_t dT = -999.;
194 for (unsigned int s=0; s<nSides; ++s){
195 for (unsigned int j=0; j<nSiPMs; ++j){
196 unsigned int channel = j+s*nSiPMs;
197 if (signals[channel]> 0){
198 if (!fMasked[channel] || !mask){
199 mean[s] += times[channel];
200 count[s] += 1;
201 }
202 }
203 }
204 }
205 if (count[0]>0 && count[1]>0) {
206 dT = mean[0]/count[0] - mean[1]/count[1];
207 }
208 return dT;
209}

◆ GetEnergy()

Float_t MuFilterHit::GetEnergy ( )

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 E+=signals[j];
134 if (nSides>1){ E+=signals[j+nSiPMs];}
135 }
136 return E;
137}

◆ GetFastDeltaT()

Float_t MuFilterHit::GetFastDeltaT ( Bool_t  mask = kTRUE)

Definition at line 210 of file MuFilterHit.cxx.

212{
213 Float_t first[] = {1E20,1E20};
214 Float_t dT = -999.;
215 for (unsigned int s=0; s<nSides; ++s){
216 for (unsigned int j=0; j<nSiPMs; ++j){
217 unsigned int channel = j+s*nSiPMs;
218 if (signals[channel]> 0){
219 if (!fMasked[channel] || !mask){
220 if (times[channel]<first[s]) {first[s] = times[channel];}
221 }
222 }
223 }
224 }
225 if (first[0]<1E10 && first[1]<1E10) {
226 dT = first[0] - first[1];
227 }
228 return dT;
229}

◆ GetImpactT()

Float_t MuFilterHit::GetImpactT ( Bool_t  mask = kTRUE)

Definition at line 233 of file MuFilterHit.cxx.

234{
235 Float_t mean[] = {0,0};
236 Int_t count[] = {0,0};
237 Float_t dT = -999.;
238 Float_t dL;
239 MuFilter* MuFilterDet = dynamic_cast<MuFilter*> (gROOT->GetListOfGlobals()->FindObject("MuFilter"));
240 if (floor(fDetectorID/10000==3)) {
241 dL = MuFilterDet->GetConfParF("MuFilterDet/DownstreamBarX") / MuFilterDet->GetConfParF("MuFilter/DsPropSpeed");}
242 else if (floor(fDetectorID/10000==2)) {
243 dL = MuFilterDet->GetConfParF("MuFilterDet/UpstreamBarX") / MuFilterDet->GetConfParF("MuFilter/VandUpPropSpeed");}
244 else {
245 dL = MuFilterDet->GetConfParF("MuFilterDet/VetoBarX") / MuFilterDet->GetConfParF("MuFilter/VandUpPropSpeed");}
246
247 for (unsigned int s=0; s<nSides; ++s){
248 for (unsigned int j=0; j<nSiPMs; ++j){
249 unsigned int channel = j+s*nSiPMs;
250 if (signals[channel]> 0){
251 if (!fMasked[channel] || !mask){
252 mean[s] += times[channel];
253 count[s] += 1;
254 }
255 }
256 }
257 }
258 if (count[0]>0 && count[1]>0) {
259 dT = (mean[0]/count[0] + mean[1]/count[1])/2.*6.25 - dL/2.; // TDC to ns = 6.25
260 }
261 return dT;
262}

◆ GetPlane()

int MuFilterHit::GetPlane ( )
inline

Definition at line 42 of file MuFilterHit.h.

◆ 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 147 of file MuFilterHit.cxx.

147 {
148 if (i%8==2 || i%8==5) {return kTRUE;}
149 else{return kFALSE;}
150}

◆ isValid()

bool MuFilterHit::isValid ( ) const
inline

Definition at line 38 of file MuFilterHit.h.

38{return flag;}

◆ isVertical()

bool MuFilterHit::isVertical ( )

Definition at line 139 of file MuFilterHit.cxx.

139 {
140 if ( (floor(fDetectorID/10000)==3&&fDetectorID%1000>59) ||
141 (floor(fDetectorID/10000)==1&&int(fDetectorID/1000)%10==2) ) {
142 return kTRUE;
143 }
144 else{return kFALSE;}
145}

◆ operator=()

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

◆ Print()

void MuFilterHit::Print ( ) const

Output to screen

Definition at line 301 of file MuFilterHit.cxx.

302{
303 std::cout << "-I- MuFilterHit: MuFilter hit " << " in detector " << fDetectorID;
304
305 if ( floor(fDetectorID/10000)==3&&fDetectorID%1000>59) {
306 std::cout << " with vertical bars"<<std::endl;
307 std::cout << "top digis:";
308 for (unsigned int j=0; j<nSiPMs; ++j){
309 std::cout << signals[j] <<" ";
310 }
311 }else{
312 std::cout << " with horizontal bars"<<std::endl;
313 for (unsigned int s=0; s<nSides; ++s){
314 if (s==0) {std::cout << "left digis:";}
315 else {std::cout << "right digis:";}
316 for (unsigned int j=0; j<nSiPMs; ++j){
317 std::cout << signals[j] <<" ";
318 }
319 }
320 }
321std::cout << std::endl;
322}

◆ SetMasked()

void MuFilterHit::SetMasked ( Int_t  i)
inline

Definition at line 40 of file MuFilterHit.h.

40{fMasked[i]=kTRUE;}

◆ SumOfSignals() [1/2]

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

Definition at line 264 of file MuFilterHit.cxx.

265{
266/* use cases, for Veto and DS small/large ignored
267 sum of signals left large SiPM: LL
268 sum of signals right large SiPM: RL
269 sum of signals left small SiPM: LS
270 sum of signals right small SiPM: RS
271 sum of signals left and right:
272*/
273 Float_t theSumL = 0;
274 Float_t theSumR = 0;
275 Float_t theSumLS = 0;
276 Float_t theSumRS = 0;
277 for (unsigned int s=0; s<nSides; ++s){
278 for (unsigned int j=0; j<nSiPMs; ++j){
279 unsigned int channel = j+s*nSiPMs;
280 if (signals[channel]> 0){
281 if (!fMasked[channel] || !mask){
282 if (s==0 and !isShort(j)){theSumL+= signals[channel];}
283 if (s==0 and isShort(j)){theSumLS+= signals[channel];}
284 if (s==1 and !isShort(j)){theSumR+= signals[channel];}
285 if (s==1 and isShort(j)){theSumRS+= signals[channel];}
286 }
287 }
288 }
289 }
290 std::map<TString,Float_t> sumSignals;
291 sumSignals["SumL"]=theSumL;
292 sumSignals["SumR"]=theSumR;
293 sumSignals["SumLS"]=theSumLS;
294 sumSignals["SumRS"]=theSumRS;
295 sumSignals["Sum"]=theSumL+theSumR;
296 sumSignals["SumS"]=theSumLS+theSumRS;
297 return sumSignals;
298}
bool isShort(Int_t)

◆ SumOfSignals() [2/2]

Float_t MuFilterHit::SumOfSignals ( char *  opt,
Bool_t  mask = kTRUE 
)

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: