17 using namespace Diana;
27 if( fCoincidentTag.count( _tag ) != 0 )
29 fCoincidentTag.insert( _tag );
41 fCoincidenceLabel = GetString(
"CoincidenceLabel",
"FastCoincidence@CoincidenceData");
43 ev.Require<
QHeader>(
"DAQ",
"Header");
46 ev.Add<
QBool>(
"Valid");
47 ev.Add<
QBool>(
"Selected");
54 const int channel = pulseinfo.GetChannelId();
55 const int tower = ( (
channel-1)/52 ) + 1;
57 ULong64_t tag = 100*EventNumber + tower;
59 if( GetIteration() == 1 ){
60 if( fMultiplets.count( tag ) != 0 )
61 Panic(
"Something impossible happened: unique tag %llu found twice!",tag);
64 for(
unsigned int j=0; j < coindata.fCoincidentChannels.size(); j++){
68 if( !(fMultiplets.at(tag))->Insert( thistag ) )
69 Panic(
"Current tag: %llu. Found duplicate tag %llu in coincident tag-list.",tag,thistag);
72 ev.Get<
QBool>(
"Valid") = (fMultiplets.at( tag ))->GetIsValid();
73 ev.Get<
QBool>(
"Selected") =
true;
78 if( GetIteration() == 1 ){
90 std::map< ULong64_t, LightMultiplet* >::iterator mainIT;
91 for( mainIT = fMultiplets.begin(); mainIT != fMultiplets.end(); ++mainIT )
93 if( (mainIT->second)->GetIsValid() ){
94 std::set<ULong64_t>::iterator coinIT;
95 for(coinIT = ((mainIT->second)->fCoincidentTag).begin(); coinIT != ((mainIT->second)->fCoincidentTag).end(); ++coinIT )
97 if( fMultiplets.count( *coinIT ) <= 0 ){
98 (mainIT->second)->SetInvalid();
104 if(
false == (mainIT->second)->GetIsValid() ){
105 std::set<ULong64_t>::iterator coinIT;
106 std::map<ULong64_t, LightMultiplet*>::iterator mainIT2;
107 for(coinIT = ((mainIT->second)->fCoincidentTag).begin(); coinIT != ((mainIT->second)->fCoincidentTag).end(); ++coinIT )
109 mainIT2 = fMultiplets.find( *coinIT );
110 if( mainIT2 != fMultiplets.end() ){
111 (mainIT2->second)->SetInvalid();
118 int myRunCounter = 0;
121 Info(
"Running 2nd level check of coincident multiplets. Iteration %d", myRunCounter);
122 if( myRunCounter > 1 )
123 Warn(
"The 2nd level check had to modify multiplet validity at least once. This means multiplets were NOT symmetric in the first place.");
125 for( mainIT = fMultiplets.begin(); mainIT != fMultiplets.end(); ++mainIT )
127 if( (mainIT->second)->GetIsValid() )
129 std::set<ULong64_t>::iterator coinIT;
130 std::map<ULong64_t, LightMultiplet*>::iterator mainIT2;
131 for(coinIT = ((mainIT->second)->fCoincidentTag).begin(); coinIT != ((mainIT->second)->fCoincidentTag).end(); ++coinIT )
133 if( fMultiplets.count( *coinIT ) <= 0 )
134 Panic(
"Event tag %llu, coincident of valid main event tag %llu not found.", *coinIT, mainIT->first);
135 mainIT2 = fMultiplets.find( *coinIT );
136 if( (mainIT2->second)->GetIsValid() && ((mainIT2->second)->fCoincidentTag).count( mainIT->first ) )
138 (mainIT->second)->SetInvalid();
141 Info(
"Event tag %llu found as coincident of valid main event tag %llu, either is invalid or does not list the main tag among its coincidents. Set main invalid.", mainIT2->first, mainIT->first);
142 Info(
"Setting invalid all coincident events of main event tag %llu", mainIT->first);
147 std::set<ULong64_t>::iterator coinIT;
148 std::map<ULong64_t, LightMultiplet*>::iterator mainIT2;
149 for(coinIT = ((mainIT->second)->fCoincidentTag).begin(); coinIT != ((mainIT->second)->fCoincidentTag).end(); ++coinIT )
151 mainIT2 = fMultiplets.find( *coinIT );
152 if( mainIT2 != fMultiplets.end() ){
153 if( (mainIT2->second)->GetIsValid() ){
154 (mainIT2->second)->SetInvalid();
157 Info(
"Event tag %llu found as coincident of invalid main event tag %llu, was set valid. Set invalid.", mainIT2->first, mainIT->first);
163 }
while( myRunAgain );
166 std::map< ULong64_t, LightMultiplet*>::iterator it;
167 for( it = fMultiplets.begin(); it != fMultiplets.end(); ++it)
REGISTER_MODULE(MMultipletValidation)
LightMultiplet(ULong64_t _tag)
bool Insert(ULong64_t _tag)
void Init(Diana::QEvent &ev)
void Do(Diana::QEvent &ev)
bool wrapped into a QObject
data of coincident channel
Raw event: bolometer channel, trigger positions and types.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...