@@ -262,17 +262,23 @@ struct AnalysisEventSelection {
262262
263263 bool decision = false ;
264264 // Fill histograms in the class Event, before cuts
265- fHistMan ->FillHistClass (" Event_BeforeCuts" , VarManager::fgValues);
265+ if (fConfigQA ) {
266+ fHistMan ->FillHistClass (" Event_BeforeCuts" , VarManager::fgValues);
267+ }
266268
267269 // Apply event cuts and fill histograms after selection
268270 if (fEventCut ->IsSelected (VarManager::fgValues)) {
269271 if (fConfigRunZorro ) {
270272 if (event.tag_bit (56 )) { // This is the bit used for the software trigger event selections [TO BE DONE: find a more clear way to use it]
271- fHistMan ->FillHistClass (" Event_AfterCuts" , VarManager::fgValues);
273+ if (fConfigQA ) {
274+ fHistMan ->FillHistClass (" Event_AfterCuts" , VarManager::fgValues);
275+ }
272276 decision = true ;
273277 }
274278 } else {
275- fHistMan ->FillHistClass (" Event_AfterCuts" , VarManager::fgValues);
279+ if (fConfigQA ) {
280+ fHistMan ->FillHistClass (" Event_AfterCuts" , VarManager::fgValues);
281+ }
276282 decision = true ;
277283 }
278284 }
@@ -304,51 +310,57 @@ struct AnalysisEventSelection {
304310 // key: event global index, value: whether pileup event is a possible splitting
305311 std::map<int64_t , bool > collisionSplittingMap;
306312
307- // Reset the fValues array and fill event observables
308- VarManager::ResetValues (0 , VarManager::kNEventWiseVariables );
309- // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations
310- for (auto bc1It = fBCCollMap .begin (); bc1It != fBCCollMap .end (); ++bc1It) {
311- uint64_t bc1 = bc1It->first ;
312- auto bc1Events = bc1It->second ;
313-
314- // same bunch event correlations, if more than 1 collisions in this bunch
315- if (bc1Events.size () > 1 ) {
316- for (auto ev1It = bc1Events.begin (); ev1It != bc1Events.end (); ++ev1It) {
317- auto ev1 = events.rawIteratorAt (*ev1It);
318- for (auto ev2It = std::next (ev1It); ev2It != bc1Events.end (); ++ev2It) {
319- auto ev2 = events.rawIteratorAt (*ev2It);
320- // compute 2-event quantities and mark the candidate split collisions
321- VarManager::FillTwoEvents (ev1, ev2);
322- if (TMath::Abs (VarManager::fgValues[VarManager::kTwoEvDeltaZ ]) < fConfigSplitCollisionsDeltaZ ) { // this is a possible collision split
323- collisionSplittingMap[*ev1It] = true ;
324- collisionSplittingMap[*ev2It] = true ;
325- }
326- fHistMan ->FillHistClass (" SameBunchCorrelations" , VarManager::fgValues);
327- } // end second event loop
328- } // end first event loop
329- } // end if BC1 events > 1
330-
331- // loop over the following BCs in the TF
332- for (auto bc2It = std::next (bc1It); bc2It != fBCCollMap .end (); ++bc2It) {
333- uint64_t bc2 = bc2It->first ;
334- if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC ) {
335- break ;
336- }
337- auto bc2Events = bc2It->second ;
338-
339- // loop over events in the first BC
340- for (auto ev1It : bc1Events) {
341- auto ev1 = events.rawIteratorAt (ev1It);
342- // loop over events in the second BC
343- for (auto ev2It : bc2Events) {
344- auto ev2 = events.rawIteratorAt (ev2It);
345- // compute 2-event quantities and mark the candidate split collisions
346- VarManager::FillTwoEvents (ev1, ev2);
347- if (TMath::Abs (VarManager::fgValues[VarManager::kTwoEvDeltaZ ]) < fConfigSplitCollisionsDeltaZ ) { // this is a possible collision split
348- collisionSplittingMap[ev1It] = true ;
349- collisionSplittingMap[ev2It] = true ;
313+ if (fConfigCheckSplitCollisions ) {
314+ // Reset the fValues array and fill event observables
315+ VarManager::ResetValues (0 , VarManager::kNEventWiseVariables );
316+ // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations
317+ for (auto bc1It = fBCCollMap .begin (); bc1It != fBCCollMap .end (); ++bc1It) {
318+ uint64_t bc1 = bc1It->first ;
319+ auto bc1Events = bc1It->second ;
320+
321+ // same bunch event correlations, if more than 1 collisions in this bunch
322+ if (bc1Events.size () > 1 ) {
323+ for (auto ev1It = bc1Events.begin (); ev1It != bc1Events.end (); ++ev1It) {
324+ auto ev1 = events.rawIteratorAt (*ev1It);
325+ for (auto ev2It = std::next (ev1It); ev2It != bc1Events.end (); ++ev2It) {
326+ auto ev2 = events.rawIteratorAt (*ev2It);
327+ // compute 2-event quantities and mark the candidate split collisions
328+ VarManager::FillTwoEvents (ev1, ev2);
329+ if (TMath::Abs (VarManager::fgValues[VarManager::kTwoEvDeltaZ ]) < fConfigSplitCollisionsDeltaZ ) { // this is a possible collision split
330+ collisionSplittingMap[*ev1It] = true ;
331+ collisionSplittingMap[*ev2It] = true ;
332+ }
333+ if (fConfigQA ) {
334+ fHistMan ->FillHistClass (" SameBunchCorrelations" , VarManager::fgValues);
335+ }
336+ } // end second event loop
337+ } // end first event loop
338+ } // end if BC1 events > 1
339+
340+ // loop over the following BCs in the TF
341+ for (auto bc2It = std::next (bc1It); bc2It != fBCCollMap .end (); ++bc2It) {
342+ uint64_t bc2 = bc2It->first ;
343+ if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC ) {
344+ break ;
345+ }
346+ auto bc2Events = bc2It->second ;
347+
348+ // loop over events in the first BC
349+ for (auto ev1It : bc1Events) {
350+ auto ev1 = events.rawIteratorAt (ev1It);
351+ // loop over events in the second BC
352+ for (auto ev2It : bc2Events) {
353+ auto ev2 = events.rawIteratorAt (ev2It);
354+ // compute 2-event quantities and mark the candidate split collisions
355+ VarManager::FillTwoEvents (ev1, ev2);
356+ if (TMath::Abs (VarManager::fgValues[VarManager::kTwoEvDeltaZ ]) < fConfigSplitCollisionsDeltaZ ) { // this is a possible collision split
357+ collisionSplittingMap[ev1It] = true ;
358+ collisionSplittingMap[ev2It] = true ;
359+ }
360+ if (fConfigQA ) {
361+ fHistMan ->FillHistClass (" OutOfBunchCorrelations" , VarManager::fgValues);
362+ }
350363 }
351- fHistMan ->FillHistClass (" OutOfBunchCorrelations" , VarManager::fgValues);
352364 }
353365 }
354366 }
0 commit comments