+ TObjArray localsFromStore, regionalsFromStore;
+ localsFromStore.SetOwner(kTRUE);
+ regionalsFromStore.SetOwner(kTRUE);
+ AliMUONVTriggerStore* store = data.TriggerStore(event);
+ if (store == NULL) return false;
+ AliMUONGlobalTrigger* globalFromStore = static_cast<AliMUONGlobalTrigger*>(store->Global()->Clone());
+ TIter nextLocal(store->CreateLocalIterator());
+ AliMUONLocalTrigger* localTrig;
+ while ( (localTrig = static_cast<AliMUONLocalTrigger*>( nextLocal() )) != NULL )
+ {
+ localsFromStore.Add(localTrig->Clone());
+ }
+ TIter nextRegional(store->CreateRegionalIterator());
+ AliMUONRegionalTrigger* regionalTrig;
+ while ( (regionalTrig = static_cast<AliMUONRegionalTrigger*>( nextRegional() )) != NULL )
+ {
+ regionalsFromStore.Add(regionalTrig->Clone());
+ }
+
+ TObjArray localsByIndex, regionalsByIndex;
+ localsByIndex.SetOwner(kTRUE);
+ regionalsByIndex.SetOwner(kTRUE);
+ data.GetEvent(event);
+ AliMUONGlobalTrigger* globalByMethod = static_cast<AliMUONGlobalTrigger*>(data.GlobalTrigger()->Clone());
+ Int_t nlocals = data.NumberOfLocalTriggers();
+ for (Int_t i = 0; i < nlocals; i++)
+ {
+ localTrig = data.LocalTrigger(i);
+ localsByIndex.Add(localTrig->Clone());
+ }
+ Int_t nregionals = data.NumberOfRegionalTriggers();
+ for (Int_t i = 0; i < nregionals; i++)
+ {
+ regionalTrig = data.RegionalTrigger(i);
+ regionalsByIndex.Add(regionalTrig->Clone());
+ }
+
+ // Now check that all the lists of local, regional and global triggers
+ // contain the same results.
+ // They must. If they do not then something is wrong with the implementation
+ // of AliMUONDataInterface.
+ if (Compare(globalFromStore, globalByMethod) != 0)
+ {
+ Error( "TriggersOk",
+ "The AliMUONDataInterface does not return identical global"
+ " triggers through all its user interface methods."
+ );
+ globalFromStore->Print();
+ globalByMethod->Print();
+ return false;
+ }
+ delete globalFromStore;
+ delete globalByMethod;
+ if (localsFromStore.GetEntriesFast() != localsByIndex.GetEntriesFast())
+ {
+ Error( "TriggersOk",
+ "The AliMUONDataInterface does not return all the local triggers"
+ " correctly through all its user interface methods. We got the"
+ " following numbers of local triggers: %d and %d",
+ localsFromStore.GetEntriesFast(),
+ localsByIndex.GetEntriesFast()
+ );
+ return false;
+ }
+ if (regionalsFromStore.GetEntriesFast() != regionalsByIndex.GetEntriesFast())
+ {
+ Error( "TriggersOk",
+ "The AliMUONDataInterface does not return all the regional triggers"
+ " correctly through all its user interface methods. We got the"
+ " following numbers of regional triggers: %d and %d",
+ regionalsFromStore.GetEntriesFast(),
+ regionalsByIndex.GetEntriesFast()
+ );
+ return false;
+ }
+ for (Int_t i = 0; i < localsFromStore.GetEntriesFast(); i++)
+ {
+ if (Compare(localsFromStore[i], localsByIndex[i]) != 0)
+ {
+ Error( "TriggersOk",
+ "The AliMUONDataInterface does not return identical local"
+ " triggers through all its user interface methods. The"
+ " incorrect local trigger has index %d.",
+ i
+ );
+ localsFromStore[i]->Print();
+ localsByIndex[i]->Print();
+ return false;
+ }
+ }
+ for (Int_t i = 0; i < regionalsFromStore.GetEntriesFast(); i++)
+ {
+ if (Compare(regionalsFromStore[i], regionalsByIndex[i]) != 0)
+ {
+ Error( "TriggersOk",
+ "The AliMUONDataInterface does not return identical regional"
+ " triggers through all its user interface methods. The"
+ " incorrect regional trigger has index %d.",
+ i
+ );
+ regionalsFromStore[i]->Print();
+ regionalsByIndex[i]->Print();
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+/**
+ * This method performs a check of the AliMUONDataInterface and AliMUONMCDataInterface
+ * classes. Basically there are at least 2 ways to fetch data using these interfaces:
+ * The expert way using the store objects returned by these interface classes or
+ * the much slower but easier way of using the NumberOfxxx and Digit(...),
+ * RawCluster(...), Track(...) etc. methods to fetch individual data objects.
+ * The MUONCheckDI will check that all these various ways of fetching data results
+ * in the same information being returned. If yes then kTRUE is returned and a
+ * confirmation message is printed, if not then kFALSE is returned with the failure
+ * reason printed to screen.
+ */
+bool MUONCheckDI(bool checkSim = true, bool checkRec = true)
+{
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+
+ // Note: we do not bother checking the AliMUONMCDataInterface::Particle,
+ // AliMUONMCDataInterface::Stack and AliMUONMCDataInterface::TrackRefs methods
+ // because they are trivial enough to validate from a quick inspecition of
+ // the source code.
+
+ if (checkSim)
+ {
+ cout << "Checking simulated hits..." << endl;
+ if (! SimHitsOk()) return false;
+ cout << "Simulated hits look OK." << endl;
+
+ cout << "Checking simulated s-digits..." << endl;
+ if (! SimSDigitsOk()) return false;
+ cout << "Simulated s-digits look OK." << endl;
+
+ cout << "Checking simulated digits..." << endl;
+ if (! SimDigitsOk()) return false;
+ cout << "Simulated digits look OK." << endl;
+
+ cout << "Checking simulated triggers..." << endl;
+ if (! SimTriggersOk()) return false;
+ cout << "Simulated triggers look OK." << endl;
+ }
+
+ if (checkRec)
+ {
+ cout << "Checking reconstructed digits..." << endl;
+ if (! RecDigitsOk()) return false;
+ cout << "Reconstructed digits look OK." << endl;
+
+ cout << "Checking raw clusters..." << endl;
+ if (! RawClustersOk()) return false;
+ cout << "Raw clusters look OK." << endl;
+
+ cout << "Checking reconstructed triggers..." << endl;
+ if (! TriggersOk()) return false;
+ cout << "Reconstructed triggers look OK." << endl;
+ }
+
+ return true;