1 |
lethuill |
1.3 |
#include "../interface/SuperClusterAnalyzer.h"
|
2 |
mlethuil |
1.1 |
|
3 |
|
|
using namespace std;
|
4 |
|
|
using namespace reco;
|
5 |
|
|
using namespace edm;
|
6 |
|
|
|
7 |
lethuill |
1.5 |
|
8 |
|
|
SuperClusterAnalyzer::SuperClusterAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0), iClus_(0)
|
9 |
mlethuil |
1.1 |
{
|
10 |
lethuill |
1.5 |
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
|
11 |
|
|
patEncapsulation_ = false;
|
12 |
|
|
if( dataType_=="PAT" || dataType_=="PATAOD" )
|
13 |
|
|
{
|
14 |
|
|
patEncapsulation_ = producersNames.getUntrackedParameter<bool>("patEncapsulation");
|
15 |
|
|
}
|
16 |
mlethuil |
1.1 |
}
|
17 |
lethuill |
1.5 |
|
18 |
|
|
SuperClusterAnalyzer::SuperClusterAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity), iClus_(0)
|
19 |
|
|
{
|
20 |
|
|
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
|
21 |
|
|
patEncapsulation_ = false;
|
22 |
|
|
if( dataType_=="PAT" || dataType_=="PATAOD" )
|
23 |
|
|
{
|
24 |
|
|
patEncapsulation_ = producersNames.getUntrackedParameter<bool>("patEncapsulation");
|
25 |
|
|
}
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
|
29 |
mlethuil |
1.1 |
SuperClusterAnalyzer::~SuperClusterAnalyzer()
|
30 |
|
|
{
|
31 |
|
|
}
|
32 |
|
|
|
33 |
lethuill |
1.5 |
|
34 |
mlethuil |
1.1 |
void SuperClusterAnalyzer::Process(const edm::Event& iEvent, TRootEvent* rootEvent, TClonesArray* rootSuperClusters, const string moduleLabel, const string instanceName, const int clusterType)
|
35 |
|
|
{
|
36 |
|
|
|
37 |
|
|
edm::Handle<reco::SuperClusterCollection> superClustersHandle;
|
38 |
|
|
iEvent.getByLabel(moduleLabel, instanceName, superClustersHandle);
|
39 |
|
|
const reco::SuperClusterCollection superClusters = *(superClustersHandle.product());
|
40 |
|
|
|
41 |
lethuill |
1.5 |
if(verbosity_>1) cout << endl << " Producer: " << moduleLabel << " : " << instanceName << " - Number of SuperClusters (type " << clusterType << ") = " << superClusters.size() << std::endl;
|
42 |
lethuill |
1.2 |
|
43 |
mlethuil |
1.1 |
Int_t iClusType=0;
|
44 |
|
|
|
45 |
|
|
for( reco::SuperClusterCollection::const_iterator aSuperClus = superClusters.begin(); aSuperClus != superClusters.end(); aSuperClus++)
|
46 |
|
|
{
|
47 |
|
|
TRootSuperCluster localClus( aSuperClus->energy(), aSuperClus->eta(), aSuperClus->phi(), aSuperClus->x(), aSuperClus->y(), aSuperClus->z(), clusterType);
|
48 |
|
|
localClus.setNBasicClusters( aSuperClus->clustersSize () );
|
49 |
|
|
localClus.setNxtals( (aSuperClus->getHitsByDetId()).size() );
|
50 |
lethuill |
1.2 |
localClus.setPreshowerEnergy( aSuperClus->preshowerEnergy() );
|
51 |
|
|
localClus.setRawEnergy( aSuperClus->rawEnergy() );
|
52 |
lethuill |
1.4 |
unsigned int seedUID = (aSuperClus->seed()->getHitsByDetId())[0];
|
53 |
lethuill |
1.2 |
|
54 |
lethuill |
1.4 |
int iSubCluster=0;
|
55 |
|
|
for( reco::basicCluster_iterator aBasicClus = aSuperClus->clustersBegin(); aBasicClus != aSuperClus->clustersEnd(); aBasicClus++)
|
56 |
mlethuil |
1.1 |
{
|
57 |
lethuill |
1.4 |
unsigned int basicClusterUID = (aBasicClus->get()->getHitsByDetId())[0];
|
58 |
|
|
localClus.addSubClusterUID( basicClusterUID );
|
59 |
|
|
if ( basicClusterUID==seedUID ) localClus.setSeedClusterVectorIndex(iSubCluster);
|
60 |
|
|
iSubCluster++;
|
61 |
mlethuil |
1.1 |
}
|
62 |
|
|
|
63 |
lethuill |
1.5 |
new( (*rootSuperClusters)[iClus_] ) TRootSuperCluster(localClus);
|
64 |
|
|
if(verbosity_>3) cout << " ["<< setw(3) << iClus_ << "] " << localClus << endl;
|
65 |
mlethuil |
1.1 |
|
66 |
lethuill |
1.5 |
iClus_++;
|
67 |
mlethuil |
1.1 |
iClusType++;
|
68 |
lethuill |
1.2 |
|
69 |
mlethuil |
1.1 |
}
|
70 |
|
|
rootEvent->setNSuperClusters(clusterType,iClusType);
|
71 |
|
|
}
|