Revision: | 1.7 |
Committed: | Thu Mar 18 20:21:00 2010 UTC (15 years, 1 month ago) by bendavid |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, HEAD |
Branch point for: | Mit_025c_branch |
Changes since 1.6: | +2 -2 lines |
Log Message: | Fix beginrun,beginjob mess |
# | Content |
---|---|
1 | // $Id: FillerBeamSpot.cc,v 1.6 2009/11/30 13:43:03 bendavid Exp $ |
2 | |
3 | #include "MitProd/TreeFiller/interface/FillerBeamSpot.h" |
4 | #include "DataFormats/BeamSpot/interface/BeamSpot.h" |
5 | #include "MitAna/DataTree/interface/BeamSpotCol.h" |
6 | #include "MitAna/DataTree/interface/Names.h" |
7 | #include "MitProd/ObjectService/interface/ObjectService.h" |
8 | |
9 | using namespace std; |
10 | using namespace edm; |
11 | using namespace mithep; |
12 | |
13 | //-------------------------------------------------------------------------------------------------- |
14 | FillerBeamSpot::FillerBeamSpot(const ParameterSet &cfg, const char *name, bool active) : |
15 | BaseFiller(cfg,name,active), |
16 | edmName_(Conf().getUntrackedParameter<string>("edmName","offlineBeamSpot")), |
17 | mitName_(Conf().getUntrackedParameter<string>("mitName","BeamSpot")), |
18 | beamSpots_(new mithep::BeamSpotArr) |
19 | { |
20 | // Constructor. |
21 | } |
22 | |
23 | //-------------------------------------------------------------------------------------------------- |
24 | FillerBeamSpot::~FillerBeamSpot() |
25 | { |
26 | // Destructor. |
27 | |
28 | delete beamSpots_; |
29 | } |
30 | |
31 | //-------------------------------------------------------------------------------------------------- |
32 | void FillerBeamSpot::BookDataBlock(TreeWriter &tws) |
33 | { |
34 | // Add Vertex branch and the VertexMap to tree. |
35 | |
36 | tws.AddBranch(mitName_,&beamSpots_); |
37 | OS()->add<mithep::BeamSpotArr>(beamSpots_,mitName_); |
38 | } |
39 | |
40 | //-------------------------------------------------------------------------------------------------- |
41 | void FillerBeamSpot::FillDataBlock(const edm::Event &event, |
42 | const edm::EventSetup &setup) |
43 | { |
44 | // Fill the BeamSpot branch. |
45 | |
46 | beamSpots_->Delete(); |
47 | |
48 | Handle<reco::BeamSpot> hBeamSpotProduct; |
49 | GetProduct(edmName_, hBeamSpotProduct, event); |
50 | const reco::BeamSpot *inBeamSpot = hBeamSpotProduct.product(); |
51 | |
52 | mithep::BeamSpot *bs = beamSpots_->AddNew(); |
53 | bs->SetErrors(inBeamSpot->x0Error(),inBeamSpot->y0Error(),inBeamSpot->z0Error()); |
54 | bs->SetPosition(inBeamSpot->x0(),inBeamSpot->y0(),inBeamSpot->z0()); |
55 | bs->SetSigmaZ(inBeamSpot->sigmaZ()); |
56 | bs->SetBeamWidthX(inBeamSpot->BeamWidthX()); |
57 | bs->SetBeamWidthY(inBeamSpot->BeamWidthY()); |
58 | bs->SetDxDz(inBeamSpot->dxdz()); |
59 | bs->SetDyDz(inBeamSpot->dydz()); |
60 | |
61 | bs->SetSigmaZErr(inBeamSpot->sigmaZ0Error()); |
62 | bs->SetBeamWidthXErr(inBeamSpot->BeamWidthXError()); |
63 | bs->SetBeamWidthYErr(inBeamSpot->BeamWidthYError()); |
64 | bs->SetDxDzErr(inBeamSpot->dxdzError()); |
65 | bs->SetDyDzErr(inBeamSpot->dydzError()); |
66 | |
67 | } |