2 #include "QCalibData.hh"
3 #include "QDbDetector.hh"
6 #include "QFiltersData.hh"
7 #include "QMainPulse.hh"
19 :
QModule(
"CoincidenceMultiplicity",s)
46 const QRawEvent& rawEvent = ev->GetRawEvent();
48 const int&
channel = rawEvent.GetPulse().GetChannelId();
49 const int& run = rawEvent.GetRun();
50 const int& event_number = rawEvent.GetEventNumber();
51 const double& time_sec = rawEvent.GetTime().GetFromStartRunNs() / 1e9;
52 const double& energy = ev->GetCalib().GetEnergy();
58 vector<int> allChannels( QDbDetector::ActiveChannelList(run) );
60 set<int> channelsAndRelatives;
65 for ( vector<int>::const_iterator ch = allChannels.begin();
66 ch != allChannels.end();
68 vector<int> relativeChannels;
74 relativeChannels = QDbDetector::GetRelativeChannels(
81 Warn(
err.GetDescription().c_str() );
85 if ( channelsAndRelatives.count(*ch) == 0 ) {
87 channelsAndRelatives.insert(*ch);
88 channelsAndRelatives.insert(
89 relativeChannels.begin(), relativeChannels.end()
95 const bool useThermistorRankingVariable
98 if (
GetIteration() == 1 && ev->GetFilters().GetPassed() ) {
99 bool useEvent =
false;
101 if (useThermistorRankingVariable) {
102 const int thermistorRanking
104 if (thermistorRanking <= 1) {
115 event.fEnergy = energy;
116 event.fEventNumber = event_number;
117 event.fTime = time_sec;
124 int multiplicity = -1;
125 int orderInMultiple = -1;
126 double totalEnergy = -1;
127 int firstEventNumber = -1;
132 orderInMultiple =
fEventInfos[index].fOrderInMultiple;
134 firstEventNumber =
fEventInfos[index].fFirstEventNumber;
136 ev->AuxData().SetInt(
fPrefix +
"Multiplicity", multiplicity,
"save");
137 ev->AuxData().SetInt(
fPrefix +
"OrderInMultiple", orderInMultiple,
139 ev->AuxData().SetDouble(
fPrefix +
"TotalEnergy", totalEnergy,
141 ev->AuxData().SetInt(
fPrefix +
"FirstEventNumber", firstEventNumber,
153 for (
int index = 0; index < (int)
fEventInfos.size(); ++index) {
168 double totalEnergy = 0;
169 for (
int i = indexFirst; i <= indexLast; ++i) {
174 for (
int i = indexFirst; i <= indexLast; ++i) {
175 fEventInfos[i].fMultiplicity = indexLast - indexFirst + 1;
189 double totalEnergy = 0;
190 for (
int i = indexFirst; i <= indexLast; ++i) {
195 for (
int i = indexFirst; i <= indexLast; ++i) {
196 fEventInfos[i].fMultiplicity = indexLast - indexFirst + 1;
#define REGISTER_MODULE(clazz)
Puts multiplicities and total energies in events.
std::set< int > fChannels
List of channels to use.
std::string fPrefix
AuxData variable prefix string.
std::string fRelativeChannelsSource
Source file name or 'DB' for relative channels.
~MCoincidenceMultiplicity()
destructor
std::string fThermistorRankingVariable
AuxData variable containing thermistor rankings.
std::map< int, int > fEventInfosIndex
map from EventNumber to fEventInfos index
std::vector< EventInfo > fEventInfos
time ordered vector of event info
bool fUseRunningWindow
Flag to use running or fixed window.
void Do(Diana::QEvent &ev)
Do method.
double fCoincidenceWindow
Maximum time (in seconds) between coincident events.
MCoincidenceMultiplicity(QSequence *s)
constructor
const std::string & GetString(const std::string &parname, const std::string &defVal, bool warnCfg=true) const
Get a string parameter from config file ( see GetDouble() )
void Warn(const char *descr,...) const
Send a warning message (an error that the framework can recover) with printf syntax.
unsigned int GetIteration() const
Get Current sequence iteration.
double GetDouble(const std::string &parname, double defVal, bool warnCfg=true) const
Get a double parameter from config file.
bool GetBool(const std::string &parname, bool defVal, bool warnCfg=true) const
Get a bool parameter from config file ( see GetDouble() )
void SetRunAgain(bool b)
Set that the sequence will be reiterated.
error class with error type and description
Base class for diana modules.
Diana Reconstruction program.