1 |
lethuill |
1.3 |
#include "../interface/ClusterAnalyzer.h"
|
2 |
mlethuil |
1.1 |
|
3 |
|
|
using namespace std;
|
4 |
|
|
using namespace reco;
|
5 |
|
|
using namespace edm;
|
6 |
|
|
|
7 |
lethuill |
1.4 |
|
8 |
|
|
ClusterAnalyzer::ClusterAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0), iClus_(0)
|
9 |
|
|
{
|
10 |
|
|
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
|
11 |
|
|
}
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
ClusterAnalyzer::ClusterAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity), iClus_(0)
|
15 |
mlethuil |
1.1 |
{
|
16 |
lethuill |
1.4 |
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
|
17 |
mlethuil |
1.1 |
}
|
18 |
lethuill |
1.4 |
|
19 |
|
|
|
20 |
mlethuil |
1.1 |
ClusterAnalyzer::~ClusterAnalyzer()
|
21 |
|
|
{
|
22 |
|
|
}
|
23 |
|
|
|
24 |
lethuill |
1.4 |
|
25 |
lethuill |
1.2 |
void ClusterAnalyzer::Process(const edm::Event& iEvent, TRootEvent* rootEvent, EcalClusterLazyTools& lazyTools, TClonesArray* rootClusters, const string moduleLabel, const string instanceName, const int clusterType)
|
26 |
mlethuil |
1.1 |
{
|
27 |
|
|
|
28 |
lethuill |
1.4 |
// if RECO or AOD, read cluster from reco::SuperCluster
|
29 |
mlethuil |
1.1 |
edm::Handle<reco::BasicClusterCollection> basicClustersHandle;
|
30 |
|
|
iEvent.getByLabel(moduleLabel, instanceName, basicClustersHandle);
|
31 |
|
|
const reco::BasicClusterCollection basicClusters = *(basicClustersHandle.product());
|
32 |
|
|
|
33 |
lethuill |
1.4 |
if(verbosity_>1) cout << endl << " Producer: " << moduleLabel << " : " << instanceName << " - Number of BasicClusters (type " << clusterType << ") = " << basicClusters.size() << std::endl;
|
34 |
mlethuil |
1.1 |
|
35 |
|
|
Int_t iClusType=0;
|
36 |
|
|
|
37 |
|
|
for( reco::BasicClusterCollection::const_iterator aClus = basicClusters.begin(); aClus != basicClusters.end(); aClus++)
|
38 |
|
|
{
|
39 |
|
|
TRootCluster localClus( aClus->energy(), aClus->eta(), aClus->phi(), aClus->x(), aClus->y(), aClus->z(), clusterType);
|
40 |
lethuill |
1.2 |
localClus.setE3x3( lazyTools.e3x3(*aClus) );
|
41 |
|
|
localClus.setE5x5( lazyTools.e5x5(*aClus) );
|
42 |
|
|
localClus.setEmax( lazyTools.eMax(*aClus) );
|
43 |
|
|
localClus.setE2nd( lazyTools.e2nd(*aClus) );
|
44 |
mlethuil |
1.1 |
localClus.setNxtals( (aClus->getHitsByDetId()).size() );
|
45 |
|
|
localClus.setUid( (aClus->getHitsByDetId())[0] );
|
46 |
|
|
|
47 |
lethuill |
1.4 |
new( (*rootClusters)[iClus_] ) TRootCluster(localClus);
|
48 |
|
|
if(verbosity_>3) cout << " ["<< setw(3) << iClus_ << "] " << localClus << endl;
|
49 |
mlethuil |
1.1 |
|
50 |
lethuill |
1.4 |
iClus_++;
|
51 |
mlethuil |
1.1 |
iClusType++;
|
52 |
|
|
}
|
53 |
|
|
rootEvent->setNBasicClusters(clusterType,iClusType);
|
54 |
|
|
}
|