diff --git a/FWCore/Skeletons/doc/man/skeletons.1 b/FWCore/Skeletons/doc/man/skeletons.1 index 920359e8066ed..42c7501c02732 100644 --- a/FWCore/Skeletons/doc/man/skeletons.1 +++ b/FWCore/Skeletons/doc/man/skeletons.1 @@ -58,8 +58,6 @@ The following CMS commands is available for your needs: \fBmkrecord\fP generates code based on Record template .IP \(bu 2 \fBmkskel\fP generates code based on Skeleton template -.IP \(bu 2 -\fBmktsel\fP generate code based on TSelector template .UNINDENT .sp The \fBmkrecord\fP and \fBmkskel\fP scripts will run anywhere on your system, while diff --git a/FWCore/Skeletons/mkTemplates/TSelector/BuildFile.xml b/FWCore/Skeletons/mkTemplates/TSelector/BuildFile.xml deleted file mode 100644 index c66ff2cc3f667..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/BuildFile.xml +++ /dev/null @@ -1,5 +0,0 @@ -@example_track - - - - diff --git a/FWCore/Skeletons/mkTemplates/TSelector/Driver.dir b/FWCore/Skeletons/mkTemplates/TSelector/Driver.dir deleted file mode 100644 index c3737695246b1..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/Driver.dir +++ /dev/null @@ -1,5 +0,0 @@ -BuildFile.xml -src/TSelector.cc -interface/TSelector.h -interface/classes.h -interface/classes_def.xml diff --git a/FWCore/Skeletons/mkTemplates/TSelector/TSelector.cc b/FWCore/Skeletons/mkTemplates/TSelector/TSelector.cc deleted file mode 100644 index 018121772b828..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/TSelector.cc +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- -// -// Package: __subsys__/__pkgname__ -// Class: __class__ -// -/* - - Description: [one line class summary] - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: __author__ -// Created: __date__ -// -// - -// system include files -#include -#include - -#include "TCanvas.h" -// user include files -#include "__subsys__/__pkgname__/interface/__class__.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" - -@example_track#include "DataFormats/TrackReco/interface/Track.h" -@example_track#include "DataFormats/TrackReco/interface/TrackFwd.h" -// -// constants shared between the Selector and the Workers -// -@example_trackconst char* const kPt = "pt"; -//const char* const kA = "a"; - -//=============================================== -//A worker processes the events. -// A new worker is created each time the events are processed -//=============================================== - -// ------------ constructed for each PROOF Node ------------ -// The arguments are -// fromSelector: these are copies of values set in the selector and sent to all workers -// out: these are the items which will be passed back to the selector (e.g. histograms) -__class__Worker::__class__Worker(const TList* fromSelector, TList& out) { - //h_a = new TH1F( kA , "a" , 100, 0, 20 ); - //out.Add(h_a); -@example_track h_pt = new TH1F(kPt, "P_t", 100, 0, 100); -@example_track out.Add(h_pt); -} - -__class__Worker::~__class__Worker() {} - -// ------------ method called for each event ------------ -void __class__Worker::process(const edm::Event& iEvent) { - using namespace edm; -@example_track using reco::TrackCollection; -@example_track -@example_track Handle tracks; -@example_track iEvent.getByLabel("ctfWithMaterialTracks", tracks); -@example_track for (const auto& track : *tracks) { -@example_track h_pt->Fill(track.pt()); -@example_track } - - //using namespace edmtest; - //edm::Handle hThings; - //iEvent.getByLabel("Thing", hThings); - //for (const auto& thing : *hThings) { - // h_a ->Fill(it->a); - //} -} - -// ------------ called after processing the events ------------ -// The argument is the same as for the constructor -void __class__Worker::postProcess(TList& out) {} - -//=============================================== -//Only one Selector is made per job. It gets all the results from each worker. -//=============================================== -__class__::__class__() {} - -__class__::~__class__() {} - -// ------------ called just before all workers are constructed ------------ -void __class__::begin(TList*& toWorkers) {} - -// ------------ called after all workers have finished ------------ -// The argument 'fromWorkers' contains the accumulated output of all Workers -void __class__::terminate(TList& fromWorkers) { - using namespace std; - auto canvas = std::make_unique(); - //{ - // TObject* hist = fromWorkers.FindObject(kA); - // if (nullptr != hist) { - // hist->Draw(); - // canvas->SaveAs("a.jpg"); - // } else { - // cout << "no '" << kA << "' histogram" << endl; - // } - // -@example_track -@example_track { -@example_track TObject* hist = fromWorkers.FindObject(kPt); -@example_track if (nullptr != hist) { -@example_track hist->Draw(); -@example_track canvas->SaveAs("pt.jpg"); -@example_track } else { -@example_track cout << "no '" << kPt << "' histogram" << endl; -@example_track } -@example_track } -} diff --git a/FWCore/Skeletons/mkTemplates/TSelector/TSelector.h b/FWCore/Skeletons/mkTemplates/TSelector/TSelector.h deleted file mode 100644 index 319e56c44b2ff..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/TSelector.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __subsys_____pkgname_____class___h -#define __subsys_____pkgname_____class___h -// -*- C++ -*- -// -// Package: __subsys__/__pkgname__ -// Class: __class__ -// -/**\class __class__ __class__.h __subsys__/__pkgname__/plugins/__class__.h - -Description: [one line class summary] - -Implementation: -[Notes on implementation] -*/ -// -// Original Author: __author__ -// Created: __date__ -// -// -#include -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelector.h" - -//A worker processes the events. When using PROOF there is one Worker per PROOF CPU Node. -struct __class__Worker { - __class__Worker(const TList*, TList&); - ~__class__Worker(); - void process(const edm::Event& iEvent); - void postProcess(TList&); - //Place histograms, etc that you want to fill here - //TH1F* h_a; -@example_track TH1F* h_pt; -}; - -//Only one Selector is made per job. It gets all the results from each worker. -class __class__ : public TFWLiteSelector<__class__Worker> { -public: - __class__(); - ~__class__() override; - void begin(TList*&) override; - void terminate(TList&) override; - -private: - __class__(__class__ const&); - __class__ operator=(__class__ const&); - - ClassDef(__class__, 2) -}; -#endif diff --git a/FWCore/Skeletons/mkTemplates/TSelector/classes.h b/FWCore/Skeletons/mkTemplates/TSelector/classes.h deleted file mode 100644 index a6c1436a72d87..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/classes.h +++ /dev/null @@ -1 +0,0 @@ -#include "__subsys__/__class__/src/__class__.h" diff --git a/FWCore/Skeletons/mkTemplates/TSelector/classes_def.xml b/FWCore/Skeletons/mkTemplates/TSelector/classes_def.xml deleted file mode 100644 index f7f8689f3be08..0000000000000 --- a/FWCore/Skeletons/mkTemplates/TSelector/classes_def.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/FWCore/Skeletons/scripts/mktsel b/FWCore/Skeletons/scripts/mktsel deleted file mode 100755 index ef933d6d4bed8..0000000000000 --- a/FWCore/Skeletons/scripts/mktsel +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -#-*- coding: utf-8 -*- -#pylint: disable-msg= -""" -File : mktsel -Author : Valentin Kuznetsov -Description: mktsel code -""" - -# system modules -import sys - -if sys.version_info < (2, 6): - raise Exception("This script requires python 2.6 or greater") - -# package modules -from FWCore.Skeletons.cms import generate, config - -def pkg_help(): - "mktsel help function" - msg = '\nmktsel script generates CMS TSelector code' - msg += '\nUsage : mktsel ProducerName -author "FirstName LastName"' - msg += ' ' - msg += '\nOutput : ' - msg += """ - MyTSel/ - |-- BuildFile.xml - | src/ - | |-- MyTSel.cc - | interface/ - | |-- MyTSel.h - | |-- classes.h - | |-- classes_def.xml - """ - msg += '\nExample:' - msg += '\n # create new TSelector code' - msg += '\n mktsel MyTSel' - msg += '\n # create new TSelector code with given author' - msg += '\n mktsel MyTSel -author "First Last"' - msg += '\n # create new TSelector code with myparticle example' - msg += '\n mktsel MyTSel example_track' - msg += '\n' - return msg - -if __name__ == '__main__': - generate(config('TSelector', pkg_help())) diff --git a/FWCore/Skeletons/test/runtests.sh b/FWCore/Skeletons/test/runtests.sh index 78f68303a423c..856dd2fafa49c 100755 --- a/FWCore/Skeletons/test/runtests.sh +++ b/FWCore/Skeletons/test/runtests.sh @@ -53,9 +53,6 @@ mkdatapkg TestDataPackage -author "Test Author" mkskel TestSkeleton -author "Test Author" -mktsel TestSelector -author "Test Author" -mktsel TestSelectorTrack example_track -author "Test Author" - popd git add TestSubsystem git commit -a -m "Other skeletong code" diff --git a/FWCore/TFWLiteSelector/BuildFile.xml b/FWCore/TFWLiteSelector/BuildFile.xml deleted file mode 100644 index 4d44f61a0987a..0000000000000 --- a/FWCore/TFWLiteSelector/BuildFile.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/FWCore/TFWLiteSelector/doc/proofNotes.txt b/FWCore/TFWLiteSelector/doc/proofNotes.txt deleted file mode 100644 index 8994d46b834e0..0000000000000 --- a/FWCore/TFWLiteSelector/doc/proofNotes.txt +++ /dev/null @@ -1,147 +0,0 @@ -To get use proof from root: - -REFERENCE MATERIAL -================== -The twiki might prove useful if you have difficulties below: - - http://higweb.lns.mit.edu/twikis/proof/bin/view/Proof/ProofDocs - $ROOTSYS/README/README.PROOF - -ON INSTALLING PROOF -=================== - -Install proof according to the instructions in - -$ROOTSYS/README/README.PROOF - -One problem we had was that we needed to give the proofd the LD_LIBRARY_PATH -where it can find the library with our TSelector that we were testing. -For example, - export LD_LIBRARY_PATH=/mylogin/CMSSW_0_9_0/lib:$LD_LIBRARY_PATH -The best way to determine the proper LD_LIBRARY_PATH is to look for LD_LIBRARY_PATH -issued by the command 'scramv1 run -csh'. - -This is unfortunate for several reasons: -1) Once you start the proofd, it will only use libraries for the software - release pointed to by that LD_LIBRARY_PATH. -2) There isn't a way to ensure that the release used by proofd is consistent - with the release you are using. -3) Anyone making a new shared library for the release used by proofd has to - install it somewhere in the LD_LIBRARY_PATH used to start all the proofd daemons. - -If you want reasonably open access, make a suitably writable directory for people to -install their shared libraries and add it to the LD_LIBRARY_PATH of proofd. - -Proofd also needs access (e.g., via NFS or AFS) to the binary you -want to run. So when setting up your proof.conf file, make sure it -has access to your binaries. We did this by configuring the proofd -machines with NFS images. - -There may be some other way of getting the binaries and libraries to the -proof daemons for execution, but we haven't found it yet. - -For our simple test setup, we used the same host for master and workers. -It has 2 CPUs, so we set up two workers. -Our $ROOTSYS/proof/etc/proof.conf file contains: - -master hostie.lns.cornell.edu image=nfs -worker hostie.lns.cornell.edu perf=100 image=nfs -worker hostie.lns.cornell.edu perf=100 image=nfs - -Note, you don't need to start the proofd from /etc/inetd.conf for an -initial test. You can just log in to the master proof server and run - -$ROOTSYS/bin/proofd $ROOTSYS & - -The output will be logged to the screen where you started it, which is -what you probably want for a quick test. - -You need a password to access proof. Create that as follows, replacing -the string secret_passwd with the password that you want. - -$ROOTSYS/proof/utils/crypt secret_passwd > $HOME/.rootdpass -chmod 0600 $HOME/.rootdpass - -Note: this appears to provides no security of any value.Anybody who can - access your master proofd host can issue themselves a password and - start using your system. - -Now you can start root. - -$ROOTSYS/bin/root - -At the root prompt, issue the following command, replacing proof-master-host -with the fully qualified name of the host running the proofd master. - - gROOT->Proof("proof-master-host") - -for example, - - gROOT->Proof("hostie.lns.cornell.edu"); - -You will get a pop-up dialog asking for your password. It is really -annoying that it doesn't ask for the password at the CLI where you -were already typing. -If all went well, type - - gProof->print() - -This will print 20-30 lines of helpful information that will enlighten you. - -RUNNING A ROOT JOB USING PROOF -============================== - -Now you will want to do something useful, like run a TSelector. -This turned out to be quite tricky. Here is an example. -We made a ThingsTSelector, which we put into libFWCoreTFWLiteSelectorTest. -To ensure that our TSelector was auto-loaded we loaded libFWCoreFWLite -and then enabled fwlite. -NOTE WELL: libFWCoreTFWLiteSelectorTest.so must be in the LD_LIBRARY_PATH -for all the proofd's you are running. - -After that, our library was correctly loaded. Next we made a TDSet. -In non-proof code you would make a TChain, but for proof you make a TDSet. -We added a file to the TDSet and were able to read in our data. The sequence -of root commands is as follows. - -First make a file called proof_remote.C with the following code to make -everything load properly on the remote proof host(s). - - { - // This makes the TSelectors in the library available to the - // remote proof session - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - gSystem->Load("libFWCoreTFWLiteSelectorTest"); - } - -Now make proof_local.C - - { - // Setup the connection to the proof server - gROOT->Proof( "lnx7108.lns.cornell.edu" ); - - // You need this to allow ROOT to be able to use a ThingsTSelector - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - - gSystem->Load("libFWCoreTFWLiteSelectorTest"); - - // This makes sure the TSelector library and dictionary are properly - // installed in the remote PROOF servers - gProof->Exec( ".x proof_remote.C" ); - - // This creates the 'data set' which defines what files we need to process - // NOTE: the files given must be accessible by the remote systems. - TDSet c( "TTree", "Events"); - c.Add("/mylogin/CMSSW_0_9_0/src/FWCore/TFWLiteSelector/test/test.root"); - - //This makes the actual processing happen - c.Process( "ThingsTSelector" ); - } - -Start root and at the root command prompt run the command - - .x proof_local.C - -This should execute on several proof hosts. diff --git a/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h b/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h deleted file mode 100644 index 3491915ef2de7..0000000000000 --- a/FWCore/TFWLiteSelector/interface/TFWLiteSelector.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef FWCore_TFWLiteSelector_TFWLiteSelector_h -#define FWCore_TFWLiteSelector_TFWLiteSelector_h -// -*- C++ -*- -// -// Package: TFWLiteSelector -// Class : TFWLiteSelector -// -/**\class TFWLiteSelector TFWLiteSelector.h FWCore/TFWLiteSelector/interface/TFWLiteSelector.h - - Description: A 'safe' form of a TSelector which uses a Worker helper class to do the processing - - Usage: - This is a safe form of a TSelector which separates the processing (which could happen on many - computers when using PROOF) from the handling of the final result (which only happens on the - original computer which is running the ROOT job). - - The processing is handled by a worker class. This class is expected to have the following methods - 1) a constructor which takes a 'const TList*' and a 'TList&' as its arguments. The 'const TList*' holds - objects The 'TList&' is used to hold all the - 'TObject' items (e.g. histograms) you want to access for the final result (e.g. the sum of all - histograms created by the many Workers running on different computers). You should create the - items in the constructor, hold onto them as member data in the Worker and 'Add' them to the TList. - In addition, the 'TList&' can hold items sent to the workers from the TFWLiteSelector. - 2) a method called 'process(const edm::Event&)' - this is called for each Event - 3) a destructor which does what ever you want to have done after all the Events have finished - - You should inherit from TFWLiteSelector<...> where the template argument should be the worker you want - to use. You need to implement the following methods - 1) 'begin(const TList*& itemsForProcessing)' - this is called before processing has started and before any workers get created. If you want to pass data to - your workers, you can create a new TList and assign it to 'itemsForProcessing' and then add the objects you - want passed into that list. - NOTE: you are responsible for deleting the created TList and for deleting all items held by the TList. The easiest - way to do this is to add a 'std::unique_ptr' member data to your Selector and then call 'SetOwner()' on the TList. - 2) 'terminate(TList&)' - this is called after all processing has finished. The TList& contains all the accumulated information - from all the workers. -*/ -// -// Original Author: Chris Jones -// Created: Fri Jun 30 21:04:46 CDT 2006 -// - -// system include files -#include - -class TList; - -// user include files - -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h" -#include "FWCore/Utilities/interface/propagate_const.h" - -// forward declarations -template -class TFWLiteSelector : public TFWLiteSelectorBasic { -public: - TFWLiteSelector() : worker_() {} - ~TFWLiteSelector() override {} - - // ---------- const member functions --------------------- - - // ---------- static member functions -------------------- - - // ---------- member functions --------------------------- - -private: - TFWLiteSelector(const TFWLiteSelector&); // stop default - - const TFWLiteSelector& operator=(const TFWLiteSelector&); // stop default - - void preProcessing(const TList* in, TList& out) override { worker_ = std::make_shared(in, out); } - void process(const edm::Event& iEvent) override { worker_->process(iEvent); } - void postProcessing(TList& out) override { worker_->postProcess(out); } - - // ---------- member data -------------------------------- - edm::propagate_const> worker_; - ClassDefOverride(TFWLiteSelector, 2) -}; - -#endif diff --git a/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h b/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h deleted file mode 100644 index 1a5f7cbb0bfd5..0000000000000 --- a/FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef FWCore_TFWLiteSelector_TFWLiteSelectorBasic_h -#define FWCore_TFWLiteSelector_TFWLiteSelectorBasic_h -// -*- C++ -*- -// -// Package: TFWLiteSelector -// Class : TFWLiteSelectorBasic -// -/**\class TFWLiteSelectorBasic TFWLiteSelectorBasic.h FWCore/FWLite/interface/TFWLiteSelectorBasic.h - - Description: A ROOT TSelector which accesses data using an edm::Event - - Usage: - By inheriting from this class one can make a TSelector for ROOT which works with PROOF and which -allows you to access data using an edm::Event. - -*/ -// -// Original Author: Chris Jones -// Created: Tue Jun 27 16:37:27 EDT 2006 -// - -// system include files -#include -#include "TSelector.h" - -// user include files -#include "FWCore/Utilities/interface/propagate_const.h" - -// forward declarations -class TFile; -class TList; -class TTree; - -namespace edm { - class Event; - - namespace root { - struct TFWLiteSelectorMembers; - } -} // namespace edm - -class TFWLiteSelectorBasic : public TSelector { -public: - TFWLiteSelectorBasic(); - ~TFWLiteSelectorBasic() override; - - // ---------- const member functions --------------------- - - // ---------- static member functions -------------------- - - // ---------- member functions --------------------------- - /**Called each time the 'client' begins processing (remote 'slaves' do not see this message) - \param in an assignable pointer to a list of objects you want passed to 'preProcessing'. This - list is used to communicate with remote slaves. NOTE: you are responsible for deleting this TList - and its content once you are done with it. - */ - virtual void begin(TList*& in) = 0; - - /**Called each time the 'slave' is about to start processing - \param in a pointer to the list of objects created in 'begin()'. The pointer can be 0 - \param out a list of objects that are the result of processing (e.g. histograms). - You should call 'Add()' for each object you want sent to the 'terminate' method. - */ - virtual void preProcessing(const TList* in, TList& out) = 0; - - /**Call each time the 'slave' gets a new Event - \param event a standard edm::Event which works just like it does in cmsRun - */ - virtual void process(const edm::Event& event) = 0; - - /**Called each time the 'slave' has seen all the events - \param out the list of objects that will be sent to 'terminate'. - You can Add() additional objects to 'out' at this point as well. - */ - virtual void postProcessing(TList& out) = 0; - - /**Called each time the 'client' has finished processing. - \param out contains the accumulated output of all slaves. - */ - virtual void terminate(TList& out) = 0; - -private: - TFWLiteSelectorBasic(const TFWLiteSelectorBasic&); // stop default - - const TFWLiteSelectorBasic& operator=(const TFWLiteSelectorBasic&); // stop default - - void Begin(TTree*) override; - void SlaveBegin(TTree*) override; - void Init(TTree*) override; - Bool_t Notify() override; - Bool_t Process(Long64_t /*entry*/) override; - void SlaveTerminate() override; - void Terminate() override; - Int_t Version() const override { return 1; } - - void setupNewFile(TFile&); - // ---------- member data -------------------------------- - edm::propagate_const> m_; - bool everythingOK_; - - ClassDefOverride(TFWLiteSelectorBasic, 2) -}; - -#endif diff --git a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc deleted file mode 100644 index d3ff96802e7fd..0000000000000 --- a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc +++ /dev/null @@ -1,510 +0,0 @@ -// -*- C++ -*- - -// -// Package: TFWLiteSelector -// Class : TFWLiteSelectorBasic -// -// Implementation: -// -// -// Original Author: Chris Jones -// Created: Tue Jun 27 17:58:10 EDT 2006 -// - -// user include files -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h" - -#include "DataFormats/Common/interface/RefCoreStreamer.h" -#include "DataFormats/Common/interface/setIsMergeable.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" -#include "DataFormats/Provenance/interface/BranchIDList.h" -#include "DataFormats/Provenance/interface/BranchIDListHelper.h" -#include "DataFormats/Provenance/interface/BranchListIndex.h" -#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" -#include "DataFormats/Provenance/interface/BranchType.h" -#include "DataFormats/Provenance/interface/EventAuxiliary.h" -#include "DataFormats/Provenance/interface/EventEntryDescription.h" // kludge to allow compilation -#include "DataFormats/Provenance/interface/EventSelectionID.h" -#include "DataFormats/Provenance/interface/EventToProcessBlockIndexes.h" -#include "DataFormats/Provenance/interface/FileFormatVersion.h" -#include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h" -#include "DataFormats/Provenance/interface/ModuleDescription.h" -#include "DataFormats/Provenance/interface/ParameterSetBlob.h" -#include "DataFormats/Provenance/interface/ProcessConfiguration.h" -#include "DataFormats/Provenance/interface/ProcessHistory.h" -#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" -#include "DataFormats/Provenance/interface/ProductRegistry.h" -#include "DataFormats/Provenance/interface/RunAuxiliary.h" -#include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" -#include "FWCore/Framework/interface/DelayedReader.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" -#include "FWCore/Framework/interface/RunPrincipal.h" -#include "FWCore/ParameterSet/interface/Registry.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Utilities/interface/FriendlyName.h" -#include "FWCore/Reflection/interface/ObjectWithDict.h" -#include "FWCore/Reflection/interface/TypeWithDict.h" -#include "FWCore/Utilities/interface/WrappedClassName.h" -#include "FWCore/Utilities/interface/get_underlying_safe.h" - -// system include files -#include "TBranch.h" -#include "TChain.h" -#include "TFile.h" -#include "TTree.h" - -#include -#include -#include -#include -#include - -namespace edm { - namespace root { - class FWLiteDelayedReader : public DelayedReader { - public: - FWLiteDelayedReader() : entry_(-1), eventTree_(nullptr) {} - void setEntry(Long64_t iEntry) { entry_ = iEntry; } - void setTree(TTree* iTree) { eventTree_ = iTree; } - void set(std::shared_ptr> iMap) { - bidToDesc_ = std::move(iMap); - } - - private: - std::unique_ptr getTheProduct(BranchID const& k) const; - std::shared_ptr getProduct_(BranchID const& k, EDProductGetter const* ep) override; - virtual std::unique_ptr getProvenance_(BranchKey const&) const { - return std::unique_ptr(); - } - void mergeReaders_(DelayedReader*) override {} - void reset_() override {} - - signalslot::Signal const* preEventReadFromSourceSignal() - const override { - return nullptr; - } - signalslot::Signal const* postEventReadFromSourceSignal() - const override { - return nullptr; - }; - - Long64_t entry_; - TTree* eventTree_; - std::shared_ptr> bidToDesc_; - }; - - std::shared_ptr FWLiteDelayedReader::getProduct_(BranchID const& k, EDProductGetter const* /*ep*/) { - return getTheProduct(k); - } - - std::unique_ptr FWLiteDelayedReader::getTheProduct(BranchID const& k) const { - auto itFind = bidToDesc_->find(k.id()); - if (itFind == bidToDesc_->end()) { - throw Exception(errors::ProductNotFound) << "could not find entry for product " << k; - } - BranchDescription const& bDesc = *(itFind->second); - - TBranch* branch = eventTree_->GetBranch(bDesc.branchName().c_str()); - if (nullptr == branch) { - throw cms::Exception("MissingBranch") << "could not find branch named '" << bDesc.branchName() << "'" - << "\n Perhaps the data being requested was not saved in this file?"; - } - //find the class type - std::string const fullName = wrappedClassName(bDesc.className()); - TypeWithDict classType = TypeWithDict::byName(fullName); - if (!bool(classType)) { - throw cms::Exception("MissingDictionary") << "could not find dictionary for type '" << fullName << "'" - << "\n Please make sure all the necessary libraries are available."; - } - - //create an instance of it - ObjectWithDict wrapperObj = classType.construct(); - if (nullptr == wrapperObj.address()) { - throw cms::Exception("FailedToCreate") << "could not create an instance of '" << fullName << "'"; - } - void* address = wrapperObj.address(); - branch->SetAddress(&address); - ObjectWithDict edProdObj = wrapperObj.castObject(TypeWithDict::byName("edm::WrapperBase")); - - WrapperBase* prod = reinterpret_cast(edProdObj.address()); - - if (nullptr == prod) { - throw cms::Exception("FailedConversion") << "failed to convert a '" << fullName << "' to a edm::WrapperBase." - << "Please contact developers since something is very wrong."; - } - branch->GetEntry(entry_); - return std::unique_ptr(prod); - } - - struct TFWLiteSelectorMembers { - TFWLiteSelectorMembers() - : tree_(nullptr), - reg_(new ProductRegistry()), - bidToDesc_(std::make_shared>()), - phreg_(new ProcessHistoryRegistry()), - branchIDListHelper_(new BranchIDListHelper()), - // Note that thinned collections are not supported yet, the next - // line just makes it compile but when the Ref or Ptr tries to - // find the thinned collection it will report them not found. - // More work needed here if this is needed (we think no one - // is using TFWLiteSelector anymore and intend to implement - // this properly if it turns out we are wrong) - thinnedAssociationsHelper_(new ThinnedAssociationsHelper()), - processNames_(), - reader_(new FWLiteDelayedReader), - prov_(), - pointerToBranchBuffer_(), - provRetriever_(new edm::ProductProvenanceRetriever(0)) { - reader_->set(get_underlying_safe(bidToDesc_)); - } - void setTree(TTree* iTree) { - tree_ = iTree; - reader_->setTree(iTree); - } - - TTree const* tree() const { return get_underlying_safe(tree_); } - TTree*& tree() { return get_underlying_safe(tree_); } - std::shared_ptr reg() const { return get_underlying_safe(reg_); } - std::shared_ptr& reg() { return get_underlying_safe(reg_); } - std::shared_ptr branchIDListHelper() const { - return get_underlying_safe(branchIDListHelper_); - } - std::shared_ptr& branchIDListHelper() { return get_underlying_safe(branchIDListHelper_); } - std::shared_ptr thinnedAssociationsHelper() const { - return get_underlying_safe(thinnedAssociationsHelper_); - } - std::shared_ptr& thinnedAssociationsHelper() { - return get_underlying_safe(thinnedAssociationsHelper_); - } - - edm::propagate_const tree_; - edm::propagate_const> reg_; - edm::propagate_const>> bidToDesc_; - edm::propagate_const> phreg_; - edm::propagate_const> branchIDListHelper_; - edm::propagate_const> thinnedAssociationsHelper_; - ProcessHistory processNames_; - edm::propagate_const> reader_; - std::vector prov_; - std::vector pointerToBranchBuffer_; - FileFormatVersion fileFormatVersion_; - - edm::propagate_const> provRetriever_; - edm::ProcessConfiguration pc_; - edm::propagate_const> ep_; - edm::ModuleDescription md_; - }; - } // namespace root -} // namespace edm - -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - -// -// constructors and destructor -// -TFWLiteSelectorBasic::TFWLiteSelectorBasic() : m_(new edm::root::TFWLiteSelectorMembers), everythingOK_(false) {} - -// TFWLiteSelectorBasic::TFWLiteSelectorBasic(TFWLiteSelectorBasic const& rhs) -// { -// // do actual copying here; -// } - -TFWLiteSelectorBasic::~TFWLiteSelectorBasic() {} - -// -// assignment operators -// -// TFWLiteSelectorBasic const& TFWLiteSelectorBasic::operator=(TFWLiteSelectorBasic const& rhs) -// { -// //An exception safe implementation is -// TFWLiteSelectorBasic temp(rhs); -// swap(rhs); -// -// return *this; -// } - -// -// member functions -// -void TFWLiteSelectorBasic::Begin(TTree* iTree) { - Init(iTree); - begin(fInput); -} - -void TFWLiteSelectorBasic::SlaveBegin(TTree* iTree) { - Init(iTree); - preProcessing(fInput, *fOutput); -} - -void TFWLiteSelectorBasic::Init(TTree* iTree) { - if (iTree == nullptr) - return; - m_->setTree(iTree); -} - -Bool_t TFWLiteSelectorBasic::Notify() { - //std::cout << "Notify start" << std::endl; - //we have switched to a new file - //get new file from Tree - if (nullptr == m_->tree_) { - std::cout << "No tree" << std::endl; - return kFALSE; - } - TFile* file = m_->tree_->GetCurrentFile(); - if (nullptr == file) { - //When in Rome, do as the Romans - TChain* chain = dynamic_cast(m_->tree()); - if (nullptr == chain) { - std::cout << "No file" << std::endl; - return kFALSE; - } - file = chain->GetFile(); - if (nullptr == file) { - std::cout << "No file" << std::endl; - return kFALSE; - } - } - setupNewFile(*file); - return everythingOK_ ? kTRUE : kFALSE; -} - -namespace { - struct Operate { - Operate(edm::EDProductGetter const* iGetter) : old_(setRefCoreStreamer(iGetter)) {} - - ~Operate() { setRefCoreStreamer(old_); } - - private: - edm::EDProductGetter const* old_; - }; -} // namespace - -Bool_t TFWLiteSelectorBasic::Process(Long64_t iEntry) { - //std::cout << "Process start" << std::endl; - if (everythingOK_) { - std::unique_ptr eaux = std::make_unique(); - edm::EventAuxiliary& aux = *eaux; - edm::EventAuxiliary* pAux = eaux.get(); - TBranch* branch = m_->tree_->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InEvent).c_str()); - - branch->SetAddress(&pAux); - branch->GetEntry(iEntry); - - //NEW m_->processNames_ = aux.processHistory(); - - // std::cout << "ProcessNames\n"; - // for(auto const& name : m_->processNames_) { - // std::cout << " " << name << std::endl; - // } - - edm::EventSelectionIDVector eventSelectionIDs; - edm::EventSelectionIDVector* pEventSelectionIDVector = &eventSelectionIDs; - TBranch* eventSelectionsBranch = m_->tree_->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str()); - if (!eventSelectionsBranch) { - throw edm::Exception(edm::errors::FatalRootError) << "Failed to find event Selections branch in event tree"; - } - eventSelectionsBranch->SetAddress(&pEventSelectionIDVector); - eventSelectionsBranch->GetEntry(iEntry); - - edm::BranchListIndexes branchListIndexes; - edm::BranchListIndexes* pBranchListIndexes = &branchListIndexes; - TBranch* branchListIndexBranch = m_->tree_->GetBranch(edm::poolNames::branchListIndexesBranchName().c_str()); - if (!branchListIndexBranch) { - throw edm::Exception(edm::errors::FatalRootError) << "Failed to find branch list index branch in event tree"; - } - branchListIndexBranch->SetAddress(&pBranchListIndexes); - branchListIndexBranch->GetEntry(iEntry); - m_->branchIDListHelper_->fixBranchListIndexes(branchListIndexes); - edm::EventToProcessBlockIndexes dummyEventToProcessBlockIndexes; - - try { - m_->reader_->setEntry(iEntry); - auto rp = std::make_shared(m_->reg(), m_->pc_, nullptr, 0); - rp->setAux(edm::RunAuxiliary(aux.run(), aux.time(), aux.time())); - auto lbp = std::make_shared(m_->reg(), m_->pc_, nullptr, 0); - lbp->setAux(edm::LuminosityBlockAuxiliary(rp->run(), 1, aux.time(), aux.time())); - auto history = m_->phreg_->getMapped(eaux->processHistoryID()); - m_->ep_->fillEventPrincipal(*eaux, - history, - std::move(eventSelectionIDs), - std::move(branchListIndexes), - dummyEventToProcessBlockIndexes, - *(m_->provRetriever_), - m_->reader_.get()); - lbp->setRunPrincipal(rp); - m_->ep_->setLuminosityBlockPrincipal(lbp.get()); - m_->processNames_ = m_->ep_->processHistory(); - - edm::Event event(*m_->ep_, m_->md_, nullptr); - - //Make the event principal accessible to edm::Ref's - Operate sentry(m_->ep_->prodGetter()); - process(event); - } catch (std::exception const& iEx) { - std::cout << "While processing entry " << iEntry << " the following exception was caught \n" - << iEx.what() << std::endl; - } catch (...) { - std::cout << "While processing entry " << iEntry << " an unknown exception was caught" << std::endl; - } - } - return everythingOK_ ? kTRUE : kFALSE; -} - -void TFWLiteSelectorBasic::SlaveTerminate() { postProcessing(*fOutput); } - -void TFWLiteSelectorBasic::Terminate() { terminate(*fOutput); } - -void TFWLiteSelectorBasic::setupNewFile(TFile& iFile) { - //look up meta-data - //get product registry - - //std::vector eventProcessHistoryIDs_; - TTree* metaDataTree = dynamic_cast(iFile.Get(edm::poolNames::metaDataTreeName().c_str())); - if (!metaDataTree) { - std::cout << "could not find TTree " << edm::poolNames::metaDataTreeName() << std::endl; - everythingOK_ = false; - return; - } - edm::FileFormatVersion* fftPtr = &(m_->fileFormatVersion_); - if (metaDataTree->FindBranch(edm::poolNames::fileFormatVersionBranchName().c_str()) != nullptr) { - metaDataTree->SetBranchAddress(edm::poolNames::fileFormatVersionBranchName().c_str(), &fftPtr); - } - - edm::ProductRegistry* pReg = &(*m_->reg_); - metaDataTree->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &(pReg)); - - typedef std::map PsetMap; - PsetMap psetMap; - PsetMap* psetMapPtr = &psetMap; - if (metaDataTree->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != nullptr) { - metaDataTree->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr); - } else { - TTree* psetTree = dynamic_cast(iFile.Get(edm::poolNames::parameterSetsTreeName().c_str())); - if (nullptr == psetTree) { - throw edm::Exception(edm::errors::FileReadError) - << "Could not find tree " << edm::poolNames::parameterSetsTreeName() << " in the input file.\n"; - } - typedef std::pair IdToBlobs; - IdToBlobs idToBlob; - IdToBlobs* pIdToBlob = &idToBlob; - psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob); - for (long long i = 0; i != psetTree->GetEntries(); ++i) { - psetTree->GetEntry(i); - psetMap.insert(idToBlob); - } - } - - edm::ProcessHistoryRegistry::vector_type pHistVector; - edm::ProcessHistoryRegistry::vector_type* pHistVectorPtr = &pHistVector; - if (metaDataTree->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != nullptr) { - metaDataTree->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr); - } - - edm::ProcessConfigurationVector procConfigVector; - edm::ProcessConfigurationVector* procConfigVectorPtr = &procConfigVector; - if (metaDataTree->FindBranch(edm::poolNames::processConfigurationBranchName().c_str()) != nullptr) { - metaDataTree->SetBranchAddress(edm::poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr); - } - - auto branchIDListsHelper = std::make_shared(); - edm::BranchIDLists const* branchIDListsPtr = &branchIDListsHelper->branchIDLists(); - if (metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != nullptr) { - metaDataTree->SetBranchAddress(edm::poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr); - } - - metaDataTree->GetEntry(0); - - for (auto& prod : m_->reg_->productListUpdator()) { - prod.second.init(); - setIsMergeable(prod.second); - } - - // Merge into the registries. For now, we do NOT merge the product registry. - edm::pset::Registry& psetRegistry = *edm::pset::Registry::instance(); - for (auto const& entry : psetMap) { - edm::ParameterSet pset(entry.second.pset()); - pset.setID(entry.first); - psetRegistry.insertMapped(pset); - } - - for (auto const& ph : pHistVector) { - m_->phreg_->registerProcessHistory(ph); - } - - m_->pointerToBranchBuffer_.erase(m_->pointerToBranchBuffer_.begin(), m_->pointerToBranchBuffer_.end()); - - std::unique_ptr newReg = std::make_unique(); - - edm::ProductRegistry::ProductList& prodList = m_->reg_->productListUpdator(); - { - for (auto& item : prodList) { - edm::BranchDescription& prod = item.second; - //std::cout << "productname = " << item.second << " end " << std::endl; - std::string newFriendlyName = edm::friendlyname::friendlyName(prod.className()); - if (newFriendlyName == prod.friendlyClassName()) { - newReg->copyProduct(prod); - } else { - if (m_->fileFormatVersion_.splitProductIDs()) { - throw edm::Exception(edm::errors::UnimplementedFeature) - << "Cannot change friendly class name algorithm without more development work\n" - << "to update BranchIDLists. Contact the framework group.\n"; - } - edm::BranchDescription newBD(prod); - newBD.updateFriendlyClassName(); - newReg->copyProduct(newBD); - } - prod.init(); - } - - m_->reg().reset(newReg.release()); - } - - edm::ProductRegistry::ProductList& prodList2 = m_->reg_->productListUpdator(); - std::vector temp(prodList2.size(), edm::EventEntryDescription()); - m_->prov_.swap(temp); - m_->pointerToBranchBuffer_.reserve(prodList2.size()); - - for (auto& item : prodList2) { - edm::BranchDescription& prod = item.second; - if (prod.branchType() == edm::InEvent) { - prod.init(); - //NEED to do this and check to see if branch exists - if (m_->tree_->GetBranch(prod.branchName().c_str()) == nullptr) { - prod.setDropped(true); - } - prod.setOnDemand(true); - - //std::cout << "id " << it->first << " branch " << it->second << std::endl; - //m_->pointerToBranchBuffer_.push_back(&(*itB)); - //void* tmp = &(m_->pointerToBranchBuffer_.back()); - //edm::EventEntryDescription* tmp = &(*itB); - //CDJ need to fix provenance and be backwards compatible, for now just don't read the branch - //m_->metaTree_->SetBranchAddress(prod.branchName().c_str(), tmp); - } - } - m_->branchIDListHelper_->updateFromInput(*branchIDListsPtr); - m_->reg_->setFrozen(); - m_->bidToDesc_->clear(); - for (auto const& p : m_->reg_->productList()) { - m_->bidToDesc_->emplace(p.second.branchID().id(), &p.second); - } - m_->ep_ = std::make_shared( - m_->reg(), m_->branchIDListHelper(), m_->thinnedAssociationsHelper(), m_->pc_, nullptr); - everythingOK_ = true; -} - -// -// const member functions -// - -// -// static member functions -// diff --git a/FWCore/TFWLiteSelector/src/classes.h b/FWCore/TFWLiteSelector/src/classes.h deleted file mode 100644 index 2d89adb3f7f3c..0000000000000 --- a/FWCore/TFWLiteSelector/src/classes.h +++ /dev/null @@ -1 +0,0 @@ -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h" diff --git a/FWCore/TFWLiteSelector/src/classes_def.xml b/FWCore/TFWLiteSelector/src/classes_def.xml deleted file mode 100644 index e5f10a341c674..0000000000000 --- a/FWCore/TFWLiteSelector/src/classes_def.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/FWCore/TFWLiteSelector/test/BuildFile.xml b/FWCore/TFWLiteSelector/test/BuildFile.xml deleted file mode 100644 index 1c88252224884..0000000000000 --- a/FWCore/TFWLiteSelector/test/BuildFile.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/FWCore/TFWLiteSelector/test/TestRunnerFWCoreTFWLiteSelector.cpp b/FWCore/TFWLiteSelector/test/TestRunnerFWCoreTFWLiteSelector.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/FWCore/TFWLiteSelector/test/TestRunnerFWCoreTFWLiteSelector.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/FWCore/TFWLiteSelector/test/gen_things_cfg.py b/FWCore/TFWLiteSelector/test/gen_things_cfg.py deleted file mode 100644 index 12f5902078ebc..0000000000000 --- a/FWCore/TFWLiteSelector/test/gen_things_cfg.py +++ /dev/null @@ -1,24 +0,0 @@ -# Configuration file for RefTest_t - -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") - -process.load("FWCore.Framework.test.cmsExceptionsFatal_cff") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(2) -) - -process.source = cms.Source("EmptySource") - -process.Thing = cms.EDProducer("ThingProducer") - -process.OtherThing = cms.EDProducer("OtherThingProducer") - -process.out = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string('testTFWLiteSelector.root') -) - -process.p = cms.Path(process.Thing*process.OtherThing) -process.o = cms.EndPath(process.out) diff --git a/FWCore/TFWLiteSelector/test/proof_remote.C b/FWCore/TFWLiteSelector/test/proof_remote.C deleted file mode 100644 index 7658f031af9fc..0000000000000 --- a/FWCore/TFWLiteSelector/test/proof_remote.C +++ /dev/null @@ -1,6 +0,0 @@ -{ - //This make the TSelectors in the library available to the remote proof session - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - gSystem->Load("libFWCoreTFWLiteSelectorTest"); -} diff --git a/FWCore/TFWLiteSelector/test/run_all_t.sh b/FWCore/TFWLiteSelector/test/run_all_t.sh deleted file mode 100755 index b4eba6671e9af..0000000000000 --- a/FWCore/TFWLiteSelector/test/run_all_t.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Pass in name and status -function die { echo $1: status $2 ; exit $2; } - -LOCAL_TEST_DIR=${SCRAM_TEST_PATH} -export TMPDIR=`pwd` -cmsRun ${LOCAL_TEST_DIR}/gen_things_cfg.py || die 'Failed generating test root file' $? - -rm -f a.jpg refA.jpg -root -b -n -q ${LOCAL_TEST_DIR}/thing_sel.C || die 'Failed tfwliteselectortest::ThingsTSelector test' $? -[ -s a.jpg ] && [ -s refA.jpg ] || die 'Failed tfwliteselectortest::ThingsTSelector test, no histograms' 20 - -rm -f a.jpg refA.jpg -root -b -n -q ${LOCAL_TEST_DIR}/thing2_sel.C || die 'Failed tfwliteselectortest::ThingsTSelector2 test' $? -[ -s a.jpg ] && [ -s refA.jpg ] || die 'Failed tfwliteselectortest::ThingsTSelector2 test, no histograms' 20 - -rm -f a.jpg refA.jpg - -exit 0 diff --git a/FWCore/TFWLiteSelector/test/thing2_sel.C b/FWCore/TFWLiteSelector/test/thing2_sel.C deleted file mode 100644 index e273de19921f7..0000000000000 --- a/FWCore/TFWLiteSelector/test/thing2_sel.C +++ /dev/null @@ -1,15 +0,0 @@ -{ - //Need this to allow ROOT to be able to use a ThingsTSelector - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - gSystem->Load("libFWCoreTFWLiteSelectorTest"); - - TSelector* sel = new tfwliteselectortest::ThingsTSelector2(); - - //This holds the list of files and 'TTree' to process - TChain c("Events"); - c.Add("testTFWLiteSelector.root"); - - //This actually processes the data - c.Process(sel); -} diff --git a/FWCore/TFWLiteSelector/test/thing_sel.C b/FWCore/TFWLiteSelector/test/thing_sel.C deleted file mode 100644 index 0201a43aaa729..0000000000000 --- a/FWCore/TFWLiteSelector/test/thing_sel.C +++ /dev/null @@ -1,15 +0,0 @@ -{ - //Need this to allow ROOT to be able to use a ThingsTSelector - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - gSystem->Load("libFWCoreTFWLiteSelectorTest"); - - TSelector* sel = new tfwliteselectortest::ThingsTSelector(); - - //This holds the list of files and 'TTree' to process - TChain c("Events"); - c.Add("testTFWLiteSelector.root"); - - //This actually processes the data - c.Process(sel); -} diff --git a/FWCore/TFWLiteSelectorTest/BuildFile.xml b/FWCore/TFWLiteSelectorTest/BuildFile.xml deleted file mode 100644 index 21a7647fa4433..0000000000000 --- a/FWCore/TFWLiteSelectorTest/BuildFile.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.cc b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.cc deleted file mode 100644 index d3c155d655a18..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.cc +++ /dev/null @@ -1,98 +0,0 @@ -#include "FWCore/TFWLiteSelectorTest/src/ThingsTSelector.h" -#include -#include -#include "Rtypes.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/TestObjects/interface/OtherThingCollection.h" -#include "DataFormats/TestObjects/interface/ThingCollection.h" -#include "FWCore/Utilities/interface/thread_safety_macros.h" - -using namespace tfwliteselectortest; - -static const char* kA = "a"; -static const char* kRefA = "refA"; -void ThingsTSelector::begin(TList*&) {} - -void ThingsTSelector::preProcessing(const TList*, TList& out) { - if (nullptr != h_a) { - out.Remove(h_a); - delete h_a.get(); - h_a = nullptr; - } - h_a = new TH1F(kA, "a", 100, 0, 20); - out.Add(h_a); - - if (nullptr != h_refA) { - out.Remove(h_refA); - delete h_refA.get(); - h_refA = nullptr; - } - h_refA = new TH1F(kRefA, "refA", 100, 0, 20); - out.Add(h_refA); -} - -void ThingsTSelector::process(const edm::Event& iEvent) { - std::cout << "processing event " << std::endl; - // chain->GetEntry( entry ); - using namespace edmtest; - edm::Handle hOThings; - // In case of an exception prints the message and aborts the process - CMS_SA_ALLOW try { - iEvent.getByLabel("OtherThing", "testUserTag", hOThings); - std::cout << ">> other things found:" << hOThings->size() << std::endl; - - for (size_t i = 0; i < hOThings->size(); ++i) { - const OtherThing& thing = (*hOThings)[i]; - h_refA->Fill(thing.ref->a); - std::cout << ">> ref->a: " << thing.ref->a << std::endl; - } - - edm::Handle hThings; - iEvent.getByLabel("Thing", hThings); - const ThingCollection& things = *hThings; - std::cout << ">> things found:" << things.size() << std::endl; - for (size_t i = 0; i < things.size(); ++i) { - const Thing& thing = things[i]; - h_a->Fill(thing.a); - std::cout << ">> a: " << thing.a << std::endl; - } - } catch (cms::Exception& x) { - std::cout << std::endl << "Failed with cms::Exception: " << std::endl; - std::cout << x.what() << std::endl; - abort(); - } catch (std::exception& x) { - std::cout << std::endl << "Failed with std::exception" << std::endl; - std::cout << x.what() << std::endl; - abort(); - } catch (...) { - std::cout << std::endl << "Failed with unknown exception" << std::endl; - abort(); - } -} - -void ThingsTSelector::postProcessing(TList&) {} - -void ThingsTSelector::terminate(TList& out) { - std::cout << "terminate" << std::endl; - TCanvas* canvas = new TCanvas(); - { - TObject* hist = out.FindObject(kA); - if (nullptr != hist) { - hist->Draw(); - canvas->SaveAs("a.jpg"); - } else { - std::cout << "no '" << kA << "' histogram" << std::endl; - } - } - { - TObject* hist = out.FindObject(kRefA); - if (nullptr != hist) { - hist->Draw(); - canvas->SaveAs("refA.jpg"); - } else { - std::cout << "no '" << kRefA << "' histogram" << std::endl; - } - } - delete canvas; -} diff --git a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.h b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.h deleted file mode 100644 index fbaa2591aa68e..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef ThingsTSelector_h -#define ThingsTSelector_h -/** \class ThingsTSelector - * - * Simple interactive analysis example based on TSelector - * accessing EDM data - * - * \author Luca Lista, INFN - * - */ -#include "TH1.h" -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelectorBasic.h" -#include "FWCore/Utilities/interface/propagate_const.h" - -namespace tfwliteselectortest { - class ThingsTSelector : public TFWLiteSelectorBasic { - public: - ThingsTSelector() : h_a(nullptr), h_refA(nullptr) {} - void begin(TList*&) override; - void preProcessing(const TList*, TList&) override; - void process(const edm::Event&) override; - void postProcessing(TList&) override; - void terminate(TList&) override; - - private: - /// histograms - edm::propagate_const h_a; - edm::propagate_const h_refA; - - ThingsTSelector(ThingsTSelector const&); - ThingsTSelector operator=(ThingsTSelector const&); - - ClassDefOverride(ThingsTSelector, 2) - }; -} // namespace tfwliteselectortest -#endif diff --git a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.cc b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.cc deleted file mode 100644 index 5c008bb1b30e3..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.cc +++ /dev/null @@ -1,92 +0,0 @@ -#include "FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h" -#include -#include -#include "Rtypes.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/TestObjects/interface/OtherThingCollection.h" -#include "DataFormats/TestObjects/interface/ThingCollection.h" -#include "FWCore/Utilities/interface/thread_safety_macros.h" - -using namespace tfwliteselectortest; - -//Names used in common between the worker and the Selector -static const char* kA = "a"; -static const char* kRefA = "refA"; - -ThingsWorker::ThingsWorker(const TList*, TList& out) { - std::cout << "begin" << std::endl; - h_a = new TH1F(kA, "a", 100, 0, 20); - out.Add(h_a); - - h_refA = new TH1F(kRefA, "refA", 100, 0, 20); - out.Add(h_refA); -} - -void ThingsWorker::process(const edm::Event& iEvent) { - std::cout << "processing event " << std::endl; - // chain->GetEntry( entry ); - using namespace edmtest; - edm::Handle hOThings; - // In case of an exception prints the message and aborts the process - CMS_SA_ALLOW try { - iEvent.getByLabel("OtherThing", "testUserTag", hOThings); - - std::cout << ">> other things found:" << hOThings->size() << std::endl; - for (size_t i = 0; i < hOThings->size(); ++i) { - const OtherThing& thing = (*hOThings)[i]; - h_refA->Fill(thing.ref->a); - std::cout << ">> ref->a: " << thing.ref->a << std::endl; - } - - edm::Handle hThings; - iEvent.getByLabel("Thing", hThings); - const ThingCollection& things = *hThings; - std::cout << ">> things found:" << things.size() << std::endl; - for (size_t i = 0; i < things.size(); ++i) { - const Thing& thing = things[i]; - h_a->Fill(thing.a); - std::cout << ">> a: " << thing.a << std::endl; - } - } catch (cms::Exception& x) { - std::cout << std::endl << "Failed with cms::Exception: " << std::endl; - std::cout << x.what() << std::endl; - abort(); - } catch (std::exception& x) { - std::cout << std::endl << "Failed with std::exception" << std::endl; - std::cout << x.what() << std::endl; - abort(); - } catch (...) { - std::cout << std::endl << "Failed with unknown exception" << std::endl; - abort(); - } -} - -void ThingsWorker::postProcess(TList&) {} - -void ThingsTSelector2::begin(TList*&) {} - -void ThingsTSelector2::terminate(TList& out) { - std::cout << "terminate" << std::endl; - TCanvas* canvas = new TCanvas(); - { - TObject* hist = out.FindObject(kA); - if (nullptr != hist) { - hist->Draw(); - canvas->SaveAs("a.jpg"); - } else { - std::cout << "no '" << kA << "' histogram" << std::endl; - } - } - std::cout << "refA" << std::endl; - { - TObject* hist = out.FindObject(kRefA); - if (nullptr != hist) { - hist->Draw(); - canvas->SaveAs("refA.jpg"); - } else { - std::cout << "no '" << kRefA << "' histogram" << std::endl; - } - } - delete canvas; -} diff --git a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h b/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h deleted file mode 100644 index 5ddcb396366a9..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef ThingsTSelector2_h -#define ThingsTSelector2_h -/** \class ThingsTSelector2 - * - * Simple interactive analysis example based on TSelector - * accessing EDM data - * - * \author Luca Lista, INFN - * - */ -#include "TH1.h" -#include "FWCore/TFWLiteSelector/interface/TFWLiteSelector.h" - -namespace tfwliteselectortest { - struct ThingsWorker { - ThingsWorker(const TList*, TList&); - void process(const edm::Event& iEvent); - void postProcess(TList&); - edm::propagate_const h_a; - edm::propagate_const h_refA; - }; - - class ThingsTSelector2 : public TFWLiteSelector { - public: - ThingsTSelector2() {} - void begin(TList*&) override; - void terminate(TList&) override; - - private: - ThingsTSelector2(ThingsTSelector2 const&); - ThingsTSelector2 operator=(ThingsTSelector2 const&); - - ClassDefOverride(ThingsTSelector2, 2) - }; -} // namespace tfwliteselectortest -#endif diff --git a/FWCore/TFWLiteSelectorTest/src/classes.h b/FWCore/TFWLiteSelectorTest/src/classes.h deleted file mode 100644 index ca4ddccb89560..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/classes.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/TFWLiteSelectorTest/src/ThingsTSelector.h" -#include "FWCore/TFWLiteSelectorTest/src/ThingsTSelector2.h" diff --git a/FWCore/TFWLiteSelectorTest/src/classes_def.xml b/FWCore/TFWLiteSelectorTest/src/classes_def.xml deleted file mode 100644 index dd233f782c0c4..0000000000000 --- a/FWCore/TFWLiteSelectorTest/src/classes_def.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Utilities/ReleaseScripts/scripts/duplicateReflexLibrarySearch.py b/Utilities/ReleaseScripts/scripts/duplicateReflexLibrarySearch.py index 29d4ba33f175f..bed28cfebde3d 100755 --- a/Utilities/ReleaseScripts/scripts/duplicateReflexLibrarySearch.py +++ b/Utilities/ReleaseScripts/scripts/duplicateReflexLibrarySearch.py @@ -71,7 +71,6 @@ {'PhysicsToolsObjects' : ['PhysicsTools::Calibration']}, {'TrackReco' : ['reco::Track','reco::TrackRef']}, {'VertexReco' : ['reco::Vertex']}, - {'TFWLiteSelectorTest' : ['tfwliteselectortest']}, {'TauReco' : ['reco::PFJetRef']}, {'JetReco' : ['reco::.*Jet','reco::.*Jet(Collection|Ref)']}, {'HGCDigi' : ['HGCSample']},