@@ -1469,19 +1469,22 @@ struct AnalysisSameEventPairing {
14691469
14701470 if (fEnableBarrelHistos ) {
14711471 names = {
1472+ // change define histname
14721473 Form (" PairsBarrelSEPM_%s" , objArray->At (icut)->GetName ()),
14731474 Form (" PairsBarrelSEPP_%s" , objArray->At (icut)->GetName ()),
1474- Form (" PairsBarrelSEMM_%s" , objArray->At (icut)->GetName ())};
1475- histNames += Form (" %s;%s;%s;" , names[0 ].Data (), names[1 ].Data (), names[2 ].Data ());
1475+ Form (" PairsBarrelSEMM_%s" , objArray->At (icut)->GetName ()),
1476+ Form (" PairsBarrelTRPM_%s" , objArray->At (icut)->GetName ())};
1477+ histNames += Form (" %s;%s;%s;%s;" , names[0 ].Data (), names[1 ].Data (), names[2 ].Data (), names[3 ].Data ());
14761478 names.push_back (Form (" PairsBarrelSEPM_ambiguousextra_%s" , objArray->At (icut)->GetName ()));
14771479 names.push_back (Form (" PairsBarrelSEPP_ambiguousextra_%s" , objArray->At (icut)->GetName ()));
14781480 names.push_back (Form (" PairsBarrelSEMM_ambiguousextra_%s" , objArray->At (icut)->GetName ()));
1479- histNames += Form (" %s;%s;%s;" , names[3 ].Data (), names[4 ].Data (), names[5 ].Data ());
1481+ names.push_back (Form (" PairsBarrelTRPM_ambiguousextra_%s" , objArray->At (icut)->GetName ()));
1482+ histNames += Form (" %s;%s;%s;%s;" , names[4 ].Data (), names[5 ].Data (), names[6 ].Data (), names[7 ].Data ());
14801483 if (fEnableBarrelMixingHistos ) {
14811484 names.push_back (Form (" PairsBarrelMEPM_%s" , objArray->At (icut)->GetName ()));
14821485 names.push_back (Form (" PairsBarrelMEPP_%s" , objArray->At (icut)->GetName ()));
14831486 names.push_back (Form (" PairsBarrelMEMM_%s" , objArray->At (icut)->GetName ()));
1484- histNames += Form (" %s;%s;%s;" , names[6 ].Data (), names[7 ].Data (), names[8 ].Data ());
1487+ histNames += Form (" %s;%s;%s;" , names[8 ].Data (), names[9 ].Data (), names[10 ].Data ());
14851488 }
14861489 fTrackHistNames [icut] = names;
14871490
@@ -2127,6 +2130,71 @@ struct AnalysisSameEventPairing {
21272130 } // end loop (pair cuts)
21282131 }
21292132 } // end loop (cuts)
2133+
2134+ // edit
2135+ // rotation 20 times
2136+ if constexpr (TPairType == VarManager::kDecayToEE ) {
2137+ twoTrackFilter = a1.isBarrelSelected_raw () & a2.isBarrelSelected_raw () & a1.isBarrelSelectedPrefilter_raw () & a2.isBarrelSelectedPrefilter_raw () & fTrackFilterMask ;
2138+
2139+ if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue
2140+ continue ;
2141+ }
2142+
2143+ auto t1 = a1.template reducedtrack_as <TTracks>();
2144+ auto t2 = a2.template reducedtrack_as <TTracks>();
2145+ sign1 = t1.sign ();
2146+ sign2 = t2.sign ();
2147+ // store the ambiguity number of the two dilepton legs in the last 4 digits of the two-track filter
2148+ // TODO: Make sure that we do not work with more than 28 track bits
2149+ if (t1.barrelAmbiguityInBunch () > 1 ) {
2150+ twoTrackFilter |= (static_cast <uint32_t >(1 ) << 28 );
2151+ }
2152+ if (t2.barrelAmbiguityInBunch () > 1 ) {
2153+ twoTrackFilter |= (static_cast <uint32_t >(1 ) << 29 );
2154+ }
2155+ if (t1.barrelAmbiguityOutOfBunch () > 1 ) {
2156+ twoTrackFilter |= (static_cast <uint32_t >(1 ) << 30 );
2157+ }
2158+ if (t2.barrelAmbiguityOutOfBunch () > 1 ) {
2159+ twoTrackFilter |= (static_cast <uint32_t >(1 ) << 31 );
2160+ }
2161+
2162+ for (int icut = 0 ; icut < ncuts; icut++) {
2163+ if (twoTrackFilter & (static_cast <uint32_t >(1 ) << icut)) {
2164+ isAmbiInBunch = (twoTrackFilter & (static_cast <uint32_t >(1 ) << 28 )) || (twoTrackFilter & (static_cast <uint32_t >(1 ) << 29 ));
2165+ isAmbiOutOfBunch = (twoTrackFilter & (static_cast <uint32_t >(1 ) << 30 )) || (twoTrackFilter & (static_cast <uint32_t >(1 ) << 31 ));
2166+ isUnambiguous = !(isAmbiInBunch || isAmbiOutOfBunch);
2167+ isLeg1Ambi = (twoTrackFilter & (static_cast <uint32_t >(1 ) << 28 ) || (twoTrackFilter & (static_cast <uint32_t >(1 ) << 30 )));
2168+ isLeg2Ambi = (twoTrackFilter & (static_cast <uint32_t >(1 ) << 29 ) || (twoTrackFilter & (static_cast <uint32_t >(1 ) << 31 )));
2169+ if constexpr (TPairType == VarManager::kDecayToEE ) {
2170+ if (isLeg1Ambi && isLeg2Ambi) {
2171+ std::pair<uint32_t , uint32_t > iPair (a1.reducedtrackId (), a2.reducedtrackId ());
2172+ if (fAmbiguousPairs .find (iPair) != fAmbiguousPairs .end ()) {
2173+ if (fAmbiguousPairs [iPair] & (static_cast <uint32_t >(1 ) << icut)) { // if this pair is already stored with this cut
2174+ isAmbiExtra = true ;
2175+ } else {
2176+ fAmbiguousPairs [iPair] |= static_cast <uint32_t >(1 ) << icut;
2177+ }
2178+ } else {
2179+ fAmbiguousPairs [iPair] = static_cast <uint32_t >(1 ) << icut;
2180+ }
2181+ }
2182+ }
2183+ if (sign1 * sign2 < 0 ) {
2184+ for (int i = 0 ; i < 20 ; i++) {
2185+ VarManager::FillPairRotation<TPairType, TTrackFillMap>(t1, t2);
2186+ if constexpr (TPairType == VarManager::kDecayToEE ) {
2187+ fHistMan ->FillHistClass (Form (" PairsBarrelTRPM_%s" , fTrackCuts [icut].Data ()), VarManager::fgValues);
2188+ if (isAmbiExtra) {
2189+ fHistMan ->FillHistClass (Form (" PairsBarrelTRPM_ambiguousextra_%s" , fTrackCuts [icut].Data ()), VarManager::fgValues);
2190+ }
2191+ }
2192+ }
2193+ }
2194+ }
2195+ }
2196+ }
2197+ // end
21302198 } // end loop over pairs of track associations
21312199 VarManager::fgValues[VarManager::kNPairsPerEvent ] = fNPairPerEvent ;
21322200 if (fEnableBarrelHistos && fConfigQA ) {
0 commit comments