00001 #ifndef writeESD_h
00002 #define writeESD_h 1
00003
00004 #include <XANADOO/XANAClusters/interface/XANACaloRecHit.h>
00005
00006 #include <CARF/G3Event/interface/G3EventProxy.h>
00007 #include <CARF/Reco/interface/RecCollection.h>
00008 #include <CARF/Reco/interface/RecQuery.h>
00009
00010 #include <TrackerReco/TkEvent/interface/TkEventPreselectorByTracks.h>
00011 #include <Calorimetry/CaloDetector/interface/CellID.h>
00012
00013 #include <Utilities/Notification/interface/Observer.h>
00014 #include <Utilities/UI/interface/SimpleConfigurable.h>
00015
00016 #include <XANADOO/XANATracks/interface/XANAGSUtil.h>
00017
00018 #include "CommonReco/PatternTools/interface/RecTrack.h"
00019
00020 #include <string>
00021 #include <iostream>
00022 #include <iomanip>
00023 #include <map>
00024
00025 class TFile;
00026 class TTree;
00027 class TBranch;
00028 class TClonesArray;
00029 class XANAEsdEvent;
00030 class XANAGeantEvent;
00031 class XANAGeneratorEvent;
00032 class XANAMemLog;
00033 class XANAElectronTrack;
00034 class IsoCalculator;
00035
00036 class EgammaBasicCluster;
00037 class EgammaSuperCluster;
00038 class EgammaEndcapCluster;
00039 class EcalPlusHcalTower;
00040 class TTrack;
00041 class RecoVertex;
00042 class RecMuon;
00043 class ConcreteRecTrack;
00044 class ElectronCandidate;
00045 class PhotonCandidate;
00046 class HighLevelTriggerResult;
00047 class RecJet;
00048 class RecMET;
00049
00050
00051 class TrajectoryStateOnSurface;
00052 class TrajectoryMeasurement;
00053
00054 class VertexTrackCompatibilityEstimator;
00055
00056 class RegionalTrackFinder;
00057
00058
00059 class XANAEsdBuilder : public Observer<G3EventProxy *>, public Observer<G3SetUp *>
00060 {
00061
00062 public:
00063
00064
00065
00066 SimpleConfigurable<bool> writeTree_;
00067 SimpleConfigurable<bool> memlog_;
00068 SimpleConfigurable<std::string> fileName_;
00069 SimpleConfigurable<std::string> treeName_;
00070 SimpleConfigurable<int> autosave_;
00071 SimpleConfigurable<bool> writeCaloRecHits_;
00072 SimpleConfigurable<int> compressionLevel_;
00073 SimpleConfigurable<int> bufferSize_;
00074 SimpleConfigurable<int> splitMode_;
00075 SimpleConfigurable<bool> writeTrackHits_;
00076 SimpleConfigurable<bool> writeAllTrackHits_;
00077 SimpleConfigurable<bool> writeEleTrackHits_;
00078
00079
00080 SimpleConfigurable<std::string> clusterizerName_;
00081 SimpleConfigurable<std::string> superClusterizerName_;
00082 SimpleConfigurable<std::string> endcapSuperClusterizerName_;
00083 SimpleConfigurable<std::string> hcalClusterizerName_;
00084 SimpleConfigurable<std::string> trackReconstructorName_;
00085 SimpleConfigurable<std::string> vertexReconstructorName_;
00086 SimpleConfigurable<std::string> muonReconstructorName_;
00087 SimpleConfigurable<std::string> electronReconstructorName_;
00088 SimpleConfigurable<bool> hZZVertexReconstructor_;
00089
00090
00091 SimpleConfigurable<std::string> gsfForwardFit_;
00092 SimpleConfigurable<std::string> electronTrackSeeding_;
00093
00094
00095 SimpleConfigurable<float> eCandidateEtaCut_;
00096 SimpleConfigurable<float> eCandidatePhiCut_;
00097 SimpleConfigurable<float> eCandidateEOverPMin_;
00098 SimpleConfigurable<float> eCandidateEOverPMax_;
00099
00100
00101 SimpleConfigurable<bool> jetsFromTrueInformation_;
00102 SimpleConfigurable<bool> metsFromTrueInformation_;
00103
00104
00105 SimpleConfigurable<std::string> l1Menu_;
00106 SimpleConfigurable<std::string> hltMenu_;
00107
00108 protected:
00109
00110 typedef RecCollection<TTrack> Collection;
00111
00112 Collection* theCollection;
00113
00114 RecCollection<EgammaBasicCluster>* clusters;
00115 RecCollection<EgammaSuperCluster>* superClusters;
00116 RecCollection<EgammaEndcapCluster>* endcapSuperClusters;
00117 RecCollection<EcalPlusHcalTower>* towers;
00118 RecCollection<TTrack>* tracks;
00119 RecCollection<RecoVertex>* vertices;
00120 RecCollection<RecMuon>* muons;
00121 RecCollection<ElectronCandidate>* electrons;
00122 RecCollection<PhotonCandidate>* photons;
00123 RecCollection<ConcreteRecTrack>* eltracks;
00124 RecCollection<RecJet>* jets;
00125 RecCollection<RecMET>* mets;
00126 RecCollection<HighLevelTriggerResult>* hlt;
00127
00128 TTree *xanaEsdTree_;
00129 TBranch *xanaEsdEventBranch_;
00130 TFile *xanaEsdFile_;
00131 XANAEsdEvent *xanaEsdEvent_;
00132
00133 TBranch *xanaGenEventBranch_;
00134 XANAGeneratorEvent *xanaGenEvent_;
00135 TBranch *xanaGeantEventBranch_;
00136 XANAGeantEvent *xanaGeantEvent_;
00137
00138 IsoCalculator *ciso_;
00139
00140 XANAMemLog *xanamemlog_;
00141
00142 int nbClusters_, nbTracks_, nbElectrons_, nbPhotons_;
00143
00144 map<CellID, XANACaloRecHit, less<CellID> > allCaloRecHits_;
00145 map<CellID, XANACaloRecHit, less<CellID> > clusterizedCaloRecHits_;
00146 vector<CellID> allCells_;
00147 vector<CellID> clusterizedCells_;
00148
00149 vector<RecTrack> electronTracks;
00150
00151 RegionalTrackFinder* theRegionalTrackFinder;
00152
00153
00154 VertexTrackCompatibilityEstimator * theVertexTrackCompatibilityEstimator;
00155
00156 public:
00157
00158 XANAEsdBuilder();
00159 ~XANAEsdBuilder();
00160
00161 protected:
00162
00163 virtual void upDate( G3EventProxy * );
00164 void upDate( G3SetUp * );
00165
00166 void setHeader( G3EventProxy * );
00167 void setCaloRecHits( G3EventProxy * );
00168 void setEmClusters( G3EventProxy * );
00169 void setSuperClusters( G3EventProxy * );
00170 void setEndcapClusters( G3EventProxy * );
00171 void setHadClusters( G3EventProxy * );
00172 void setTracks( G3EventProxy * );
00173 void setVertices( G3EventProxy * );
00174 void setJets( G3EventProxy * );
00175 void setMet( G3EventProxy * );
00176 void setMuons( G3EventProxy * );
00177 void setElectrons( G3EventProxy * );
00178 void setPhotons( G3EventProxy * );
00179 void setElectronsGSF( G3EventProxy * );
00180 void setElectronsGSFPixelMatch( G3EventProxy * );
00181 void setElectronsZZVertex( G3EventProxy * );
00182 virtual void setMcTruth( G3EventProxy * );
00183 void setTriggerInfo( G3EventProxy * );
00184 void setAllTrackHits( G3EventProxy * );
00185 void setElectronTracks(G3EventProxy * );
00186
00187
00188 void setEleTrackHits(std::vector<TrajectoryMeasurement>, XANAElectronTrack *);
00189
00190 void writeTree();
00191
00192 std::string getAlgoName(int);
00193
00194 } ;
00195
00196 class CompareRecTrackPt
00197 {
00198 public:
00199 bool operator() (RecTrack* P1, RecTrack* P2){
00200 return P1->impactPointState().globalMomentum().perp() > P2->impactPointState().globalMomentum().perp();
00201 }
00202 };
00203
00204 #endif