SND@LHC Software
Loading...
Searching...
No Matches
sndSciFiTools.h
Go to the documentation of this file.
1#pragma once
2class Scifi;
3
4#include <map>
5#include "TClonesArray.h"
6#include "ShipUnit.h"
7
8namespace snd {
9 namespace analysis_tools {
10
11 // Function to get the number of hits per station in SciFi
12 void getSciFiHitsPerStation(const TClonesArray * digiHits, std::vector<int> &horizontal_hits, std::vector<int> &vertical_hits);
13
14 // Function to get the total number of SciFi hits
15 int getTotalSciFiHits(std::vector<int> &horizontal_hits, std::vector<int> &vertical_hits);
16 int getTotalSciFiHits(const TClonesArray * digiHits);
17
18 // Function to get the SciFi fractional hits per plane
19 std::vector<float> getFractionalHitsPerScifiPlane(std::vector<int> &horizontal_hits, std::vector<int> &vertical_hits);
20 std::vector<float> getFractionalHitsPerScifiPlane(const TClonesArray * digiHits);
21
22 // Function to find the station where the interaction ocurred by checking the station at which the cumulative hit fraction exceeds a threshold
23 int findScifiStation(std::vector<int> &horizontal_hits, std::vector<int> &vertical_hits, float threshold);
24 int findScifiStation(const TClonesArray * digiHits, float threshold);
25
26 // Function to get the peak of the Scifi hit timing distribution for any given plane
27 float peakScifiTiming(const TClonesArray &digiHits, int bins, float min_x, float max_x, bool isMC=false);
28
29 // Function to get the hits in station n and plane X or Y
30 // Station and orientation are defined with the same convention as the outputs of
31 // sndScifiHit->GetStation() and sndScifiHits->isVertical()
32 std::unique_ptr<TClonesArray> getScifiHits(const TClonesArray &digiHits, int station, bool orientation);
33
34 // Function to select the Scifi hits of station n and plane X or Y that are in the range
35 // [peakTiming-range_lower; peakTiming+range_upper] of the peak of its time distribution
36 // selection_parameters should have the form [bins_x, min_x, max_x, time_lower_range,
37 // time_upper_range ] (bins_x is converted to int before creating the histogram)
38 // if len(selection_parameters) == 4 => time_lower_range = time_upper_range =
39 // selection_parameters[3]
40 // make_selection determines whether you want to select the hits for the respective plane
41 // or not and skip that step (in case the hits are already curated)
42 std::unique_ptr<TClonesArray> selectScifiHits(const TClonesArray &digiHits, int station, bool orientation, int bins_x=52, float min_x=0.0, float max_x=26.0, float time_lower_range=1E9/(2*ShipUnit::snd_freq), float time_upper_range=1.2E9/(ShipUnit::snd_freq/ShipUnit::hertz), bool make_selection=true, bool isMC=false);
43 std::unique_ptr<TClonesArray> selectScifiHits(const TClonesArray &digiHits, int station, bool orientation, const std::map<std::string, float> &selection_parameters, bool make_selection=true, bool isMC=false);
44
45 // Function to obtain the ScifiHits that are considered to be useful from an event
46 // selection_parameters is the number of bins for the histogram, min_x, max_x and
47 // range of the selected hits in ns
48 // Methods available are as follows:
49 // (0) Events within \pm range of the peak of the time distribution for Scifi Hits within
50 // each station and orientation
51 std::unique_ptr<TClonesArray> filterScifiHits(const TClonesArray &digiHits, const std::map<std::string, float> &selection_parameters, int method=0, std::string setup="TI18", bool isMC=false);
52 //Foregoing the selection_parameters option runs with the default values
53 std::unique_ptr<TClonesArray> filterScifiHits(const TClonesArray &digiHits, int method=0, std::string setup="TI18", bool isMC=false);
54
55 // Function to calculate the number of the SiPM channel with respect to the whole station
56 // referene_SiPM given in the format of sndScifiHit->GetChannelID()
57 int calculateSiPMNumber(int reference_SiPM);
58
59 // Function to determine SciFi hit density for channel reference_SiPM around a radius of r
60 // SiPM channels
61 // If min_check == True the function stops checking the density once it reaches the minimum
62 // requirement, and immediately returns -1 in case the minimum density cannot be achieved
63 int densityScifi(int reference_SiPM, const TClonesArray &digiHits, int radius, int min_hit_density, bool min_check);
64
65 // Function to check efficiently wether a plane has a required hit density within a radius of r
66 // SiPM channels
67 bool densityCheck(const TClonesArray &digiHits, int radius=64, int min_hit_density=36, int station=1, bool orientation=false);
68
69 // Function to get the starting wall for a shower in the Scifi
70 // Method 0 checks for a minimum Scifi Cluster density to determine whether a shower is
71 // propagating on a given Scifi station or not by checking both orientations of the station,
72 // and declares the interaction block as being the previous one to pass the check
73 // selection_parameters must contain "radius" and "min_hit_density". In case you want the
74 // selection to be made relying on a single orientation, then "orientation" can be provided
75 // in the for of 0 or 1, for the horizontal and vertical orientations, respectively
76 int showerInteractionWall(const TClonesArray &digiHits, const std::map<std::string, float> &selection_parameters, int method=0, std::string setup="TI18");
77 // Foregoing the selection_parameters option runs with the default values
78 int showerInteractionWall(const TClonesArray &digiHits, int method=0, std::string setup="TI18");
79
80 // Find the Center of Particle Showering on the SciFi plane
81 std::pair<double, double> findCentreOfGravityPerStation(const TClonesArray* digiHits, int station, Scifi* ScifiDet);
82 }
83}
Definition Scifi.h:20
int calculateSiPMNumber(int reference_SiPM)
std::unique_ptr< TClonesArray > selectScifiHits(const TClonesArray &digiHits, int station, bool orientation, int bins_x=52, float min_x=0.0, float max_x=26.0, float time_lower_range=1E9/(2 *ShipUnit::snd_freq), float time_upper_range=1.2E9/(ShipUnit::snd_freq/ShipUnit::hertz), bool make_selection=true, bool isMC=false)
int findScifiStation(std::vector< int > &horizontal_hits, std::vector< int > &vertical_hits, float threshold)
float peakScifiTiming(const TClonesArray &digiHits, int bins, float min_x, float max_x, bool isMC=false)
int showerInteractionWall(const TClonesArray &digiHits, const std::map< std::string, float > &selection_parameters, int method=0, std::string setup="TI18")
void getSciFiHitsPerStation(const TClonesArray *digiHits, std::vector< int > &horizontal_hits, std::vector< int > &vertical_hits)
std::unique_ptr< TClonesArray > filterScifiHits(const TClonesArray &digiHits, const std::map< std::string, float > &selection_parameters, int method=0, std::string setup="TI18", bool isMC=false)
std::unique_ptr< TClonesArray > getScifiHits(const TClonesArray &digiHits, int station, bool orientation)
int densityScifi(int reference_SiPM, const TClonesArray &digiHits, int radius, int min_hit_density, bool min_check)
std::pair< double, double > findCentreOfGravityPerStation(const TClonesArray *digiHits, int station, Scifi *ScifiDet)
bool densityCheck(const TClonesArray &digiHits, int radius=64, int min_hit_density=36, int station=1, bool orientation=false)
std::vector< float > getFractionalHitsPerScifiPlane(std::vector< int > &horizontal_hits, std::vector< int > &vertical_hits)
int getTotalSciFiHits(std::vector< int > &horizontal_hits, std::vector< int > &vertical_hits)