 |
Belle II Software
release-05-02-19
|
21 #include <ecl/modules/eclCRFinder/ECLCRFinderModule.h>
24 #include <framework/gearbox/Unit.h>
25 #include <framework/logging/Logger.h>
28 #include <ecl/geometry/ECLNeighbours.h>
29 #include <ecl/dataobjects/ECLCalDigit.h>
30 #include <ecl/dataobjects/ECLConnectedRegion.h>
33 #include <mdst/dataobjects/EventLevelClusteringInfo.h>
48 m_eclConnectedRegions(eclConnectedRegionArrayName()), m_eventLevelClusteringInfo(eventLevelClusteringInfoName())
51 setDescription(
"ECLCRFinderModule");
54 setPropertyFlags(c_ParallelProcessingCertified);
57 addParam(
"energyCut0", m_energyCut[0],
"Seed energy cut.", 10.0 *
Belle2::Unit::MeV);
58 addParam(
"energyCut1", m_energyCut[1],
"Growth energy cut.", 1.5 *
Belle2::Unit::MeV);
59 addParam(
"energyCut2", m_energyCut[2],
"Digit energy cut.", 0.5 *
Belle2::Unit::MeV);
60 addParam(
"energyCutBkgd0", m_energyCutBkgd[0],
"Seed energy cut (for high background).", 10.0 *
Belle2::Unit::MeV);
61 addParam(
"energyCutBkgd1", m_energyCutBkgd[1],
"Growth energy cut (for high background).", 1.5 *
Belle2::Unit::MeV);
62 addParam(
"energyCutBkgd2", m_energyCutBkgd[2],
"Digit energy cut (for high background).", 0.5 *
Belle2::Unit::MeV);
63 addParam(
"timeCut0", m_timeCut[0],
"Seed time cut (negative values for residual cut).", 99999.);
64 addParam(
"timeCut1", m_timeCut[1],
"Growth time cut (negative values for residual cut).", 99999.);
65 addParam(
"timeCut2", m_timeCut[2],
"Digit time cut (negative values for residual cut).", 99999.);
66 addParam(
"mapType0", m_mapType[0],
"Map type for seed crystals.", std::string(
"N"));
67 addParam(
"mapType1", m_mapType[1],
"Map type for growth crystals.", std::string(
"N"));
68 addParam(
"mapPar0", m_mapPar[0],
69 "Map parameter for seed crystals (radius (type=R), integer (for type=N) or fraction (for type=MC)).", 1.0);
70 addParam(
"mapPar1", m_mapPar[1],
71 "Map parameter for growth crystals (radius (type=R), integer (for type=N) or fraction (for type=MC)).", 1.0);
72 addParam(
"useBackgroundLevel", m_useBackgroundLevel,
"Use background dependent time and energy cuts.", 0);
73 addParam(
"skipFailedTimeFitDigits", m_skipFailedTimeFitDigits,
"Digits with failed fits are skipped when checking timing cuts.", 0);
74 addParam(
"fullBkgdCount", m_fullBkgdCount,
"Full background count (via eventLevelClusteringInfo).", 182);
85 B2DEBUG(200,
"ECLCRFinderModule::initialize()");
96 if (
m_energyCut[0] <
m_energyCut[1]) B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[0] must be larger than m_energyCut[1].");
97 if (
m_energyCut[1] <
m_energyCut[2]) B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[1] must be larger than m_energyCut[2].");
98 if (
m_energyCut[0] <
m_energyCut[2]) B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[0] must be larger than m_energyCut[2].");
101 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCutBkgd[0] must be larger than m_energyCutBkgd[1].");
104 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCutBkgd[1] must be larger than m_energyCutBkgd[2].");
107 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCutBkgd[0] must be larger than m_energyCutBkgd[2].");
110 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[0] must be smaller than m_energyCutBkgd[0].");
113 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[1] must be smaller than m_energyCutBkgd[1].");
116 B2FATAL(
"ECLCRFinderModule::initialize(): m_energyCut[2] must be smaller than m_energyCutBkgd[2].");
124 for (
int i = 0; i < 3; i++) {
144 B2DEBUG(200,
"ECLCRFinderModule::event()");
174 B2DEBUG(175,
"ECLCRFinderModule::event(), Background count for this event: " << bkgdcount <<
" (expected for full bkgd: " <<
178 for (
int i = 0; i < 3; i++) {
180 B2DEBUG(200,
"ECLCRFinderModule::event(), Energy cut value m_energyCutMod[" << i <<
"] = " <<
m_energyCutMod[i] <<
181 ", without bkgd scale m_energyCut[" << i <<
"] = " <<
m_energyCut[i]);
188 const double energy = eclCalDigit.getEnergy();
189 const double time = eclCalDigit.getTime();
190 const double timeresolution = eclCalDigit.getTimeResolution();
191 const int cellid = eclCalDigit.getCellId();
192 const bool fitfailed = eclCalDigit.isFailedFit();
194 double timeresidual = 999.;
195 if (!fitfailed and fabs(timeresolution) > 1e-9) {
196 timeresidual = time / timeresolution;
211 B2DEBUG(250,
"ECLCRFinderModule::event(), adding 'seed digit' with cellid = " << cellid);
215 unsigned isGrowth = 0;
227 B2DEBUG(250,
"ECLCRFinderModule::event(), adding 'growth digit' with cellid = " << cellid);
241 B2DEBUG(250,
"ECLCRFinderModule::event(), adding 'digit' with cellid = " << cellid);
257 std::map< int, int > tempCRIdToCRIdMap;
258 std::map< int, int>::iterator tempCRIdToCRIdMapIterator;
266 if (tempCRIdToCRIdMapIterator == tempCRIdToCRIdMap.end()) {
274 for (
const auto& entry : tempCRIdToCRIdMap) {
275 int connectedRegionID = entry.second;
283 aCR->setCRId(connectedRegionID);
299 B2DEBUG(200,
"ECLCRFinderModule::endRun()");
305 B2DEBUG(200,
"ECLCRFinderModule::terminate()");
315 B2DEBUG(200,
"ECLCRFinderModule::checkNeighbours() type=" << type);
317 for (
const auto& neighbour :
m_neighbourMaps[type]->getNeighbours(cellid)) {
318 B2DEBUG(200,
"ECLCRFinderModule::checkNeighbours(): neighbour=" << neighbour);
345 B2DEBUG(200,
"ECLCRFinderModule::updateCRs()");
virtual void event() override
Event.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
virtual void beginRun() override
Begin.
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
double m_energyCut[3]
Energy cut for seed, neighbours, ...
virtual ~ECLCRFinderModule()
Destructor.
std::vector< int > m_cellIdToTempCRIdVec
Connected Region map.
double m_energyCutBkgd[3]
Energy cut (for high background) for seed, neighbours, ...
int m_tempCRId
Temporary CR ID.
double m_timeCut[3]
Time cut for seed, neighbours, ...
void updateCRs(int cellid, int tempcr)
Update CRs.
static const double MeV
[megaelectronvolt]
std::string m_mapType[2]
Neighbour map types.
std::map< int, int > m_cellIdToTempCRIdMap
cellid -> temporary CR.
Class to get the neighbours for a given cell id.
virtual const char * eventLevelClusteringInfoName() const
Name to be used for default option: EventLevelClusteringInfo.
virtual void terminate() override
Terminate (close ROOT files here if you have opened any).
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
Abstract base class for different kinds of events.
virtual void initialize() override
Initialize.
std::vector< int > m_cellIdToDigitVec
cellid -> above threshold digits.
int m_useBackgroundLevel
Background dependend energy and timing cuts.
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
Store object pointer: EventLevelClusteringInfo.
virtual void endRun() override
End run.
void checkNeighbours(const int cellid, const int tempcrid, const int type)
Neighbour finder.
std::vector< int > m_cellIdToGrowthVec
cellid -> growth digits.
double m_energyCutMod[3]
Other variables.
std::vector< ECL::ECLNeighbours * > m_neighbourMaps
Neighbour maps.
double m_mapPar[2]
Parameters for neighbour maps.
virtual const char * eclConnectedRegionArrayName() const
Name to be used for default option: ECLConnectedRegions.
virtual const char * eclCalDigitArrayName() const
Name to be used for default or PureCsI option: ECLCalDigits.
Class to find connected regions.
int m_fullBkgdCount
Number of expected background digits at full background.
std::vector< int > m_cellIdToSeedVec
Digit vectors.
std::vector< int > m_calDigitStoreArrPosition
vector (8736+1 entries) with cell id to store array positions
int m_skipFailedTimeFitDigits
Handling of digits with failed time fits.